diff --git a/Makefile b/Makefile index 09d790cf63..d2acfed29b 100644 --- a/Makefile +++ b/Makefile @@ -166,6 +166,7 @@ mkfs: mkfs.c fs.h .PRECIOUS: %.o UPROGS=\ + _hello\ _cat\ _echo\ _forktest\ diff --git a/_cat b/_cat new file mode 100755 index 0000000000..7872ec45f3 Binary files /dev/null and b/_cat differ diff --git a/_echo b/_echo new file mode 100755 index 0000000000..1a2ccf9cc7 Binary files /dev/null and b/_echo differ diff --git a/_forktest b/_forktest new file mode 100755 index 0000000000..9aa28ca801 Binary files /dev/null and b/_forktest differ diff --git a/_grep b/_grep new file mode 100755 index 0000000000..a2f04d3d4a Binary files /dev/null and b/_grep differ diff --git a/_hello b/_hello new file mode 100755 index 0000000000..d47354b1e4 Binary files /dev/null and b/_hello differ diff --git a/_init b/_init new file mode 100755 index 0000000000..132022a34a Binary files /dev/null and b/_init differ diff --git a/_kill b/_kill new file mode 100755 index 0000000000..03a9c80d1b Binary files /dev/null and b/_kill differ diff --git a/_ln b/_ln new file mode 100755 index 0000000000..b7a1501db5 Binary files /dev/null and b/_ln differ diff --git a/_ls b/_ls new file mode 100755 index 0000000000..9effa31564 Binary files /dev/null and b/_ls differ diff --git a/_mkdir b/_mkdir new file mode 100755 index 0000000000..9231b10c76 Binary files /dev/null and b/_mkdir differ diff --git a/_rm b/_rm new file mode 100755 index 0000000000..6aae6f36b2 Binary files /dev/null and b/_rm differ diff --git a/_sh b/_sh new file mode 100755 index 0000000000..66b7fc6f7e Binary files /dev/null and b/_sh differ diff --git a/_stressfs b/_stressfs new file mode 100755 index 0000000000..5b1fde41b1 Binary files /dev/null and b/_stressfs differ diff --git a/_usertests b/_usertests new file mode 100755 index 0000000000..2b9dd12bb0 Binary files /dev/null and b/_usertests differ diff --git a/_wc b/_wc new file mode 100755 index 0000000000..6a5a851911 Binary files /dev/null and b/_wc differ diff --git a/_zombie b/_zombie new file mode 100755 index 0000000000..27b905a856 Binary files /dev/null and b/_zombie differ diff --git a/bio.d b/bio.d new file mode 100644 index 0000000000..b4bbd30f9a --- /dev/null +++ b/bio.d @@ -0,0 +1,2 @@ +bio.o: bio.c /usr/include/stdc-predef.h types.h defs.h param.h spinlock.h \ + sleeplock.h fs.h buf.h diff --git a/bio.o b/bio.o new file mode 100644 index 0000000000..a90f710621 Binary files /dev/null and b/bio.o differ diff --git a/bootasm.d b/bootasm.d new file mode 100644 index 0000000000..3b3dc19557 --- /dev/null +++ b/bootasm.d @@ -0,0 +1 @@ +bootasm.o: bootasm.S asm.h memlayout.h mmu.h diff --git a/bootasm.o b/bootasm.o new file mode 100644 index 0000000000..ea793cd45e Binary files /dev/null and b/bootasm.o differ diff --git a/bootblock b/bootblock new file mode 100755 index 0000000000..ff63c64978 Binary files /dev/null and b/bootblock differ diff --git a/bootblock.asm b/bootblock.asm new file mode 100644 index 0000000000..bf774190fb --- /dev/null +++ b/bootblock.asm @@ -0,0 +1,353 @@ + +bootblock.o: file format elf32-i386 + + +Disassembly of section .text: + +00007c00 : +# with %cs=0 %ip=7c00. + +.code16 # Assemble for 16-bit mode +.globl start +start: + cli # BIOS enabled interrupts; disable + 7c00: fa cli + + # Zero data segment registers DS, ES, and SS. + xorw %ax,%ax # Set %ax to zero + 7c01: 31 c0 xor %eax,%eax + movw %ax,%ds # -> Data Segment + 7c03: 8e d8 mov %eax,%ds + movw %ax,%es # -> Extra Segment + 7c05: 8e c0 mov %eax,%es + movw %ax,%ss # -> Stack Segment + 7c07: 8e d0 mov %eax,%ss + +00007c09 : + + # Physical address line A20 is tied to zero so that the first PCs + # with 2 MB would run software that assumed 1 MB. Undo that. +seta20.1: + inb $0x64,%al # Wait for not busy + 7c09: e4 64 in $0x64,%al + testb $0x2,%al + 7c0b: a8 02 test $0x2,%al + jnz seta20.1 + 7c0d: 75 fa jne 7c09 + + movb $0xd1,%al # 0xd1 -> port 0x64 + 7c0f: b0 d1 mov $0xd1,%al + outb %al,$0x64 + 7c11: e6 64 out %al,$0x64 + +00007c13 : + +seta20.2: + inb $0x64,%al # Wait for not busy + 7c13: e4 64 in $0x64,%al + testb $0x2,%al + 7c15: a8 02 test $0x2,%al + jnz seta20.2 + 7c17: 75 fa jne 7c13 + + movb $0xdf,%al # 0xdf -> port 0x60 + 7c19: b0 df mov $0xdf,%al + outb %al,$0x60 + 7c1b: e6 60 out %al,$0x60 + + # Switch from real to protected mode. Use a bootstrap GDT that makes + # virtual addresses map directly to physical addresses so that the + # effective memory map doesn't change during the transition. + lgdt gdtdesc + 7c1d: 0f 01 16 lgdtl (%esi) + 7c20: 78 7c js 7c9e + movl %cr0, %eax + 7c22: 0f 20 c0 mov %cr0,%eax + orl $CR0_PE, %eax + 7c25: 66 83 c8 01 or $0x1,%ax + movl %eax, %cr0 + 7c29: 0f 22 c0 mov %eax,%cr0 + +//PAGEBREAK! + # Complete the transition to 32-bit protected mode by using a long jmp + # to reload %cs and %eip. The segment descriptors are set up with no + # translation, so that the mapping is still the identity mapping. + ljmp $(SEG_KCODE<<3), $start32 + 7c2c: ea .byte 0xea + 7c2d: 31 7c 08 00 xor %edi,0x0(%eax,%ecx,1) + +00007c31 : + +.code32 # Tell assembler to generate 32-bit code now. +start32: + # Set up the protected-mode data segment registers + movw $(SEG_KDATA<<3), %ax # Our data segment selector + 7c31: 66 b8 10 00 mov $0x10,%ax + movw %ax, %ds # -> DS: Data Segment + 7c35: 8e d8 mov %eax,%ds + movw %ax, %es # -> ES: Extra Segment + 7c37: 8e c0 mov %eax,%es + movw %ax, %ss # -> SS: Stack Segment + 7c39: 8e d0 mov %eax,%ss + movw $0, %ax # Zero segments not ready for use + 7c3b: 66 b8 00 00 mov $0x0,%ax + movw %ax, %fs # -> FS + 7c3f: 8e e0 mov %eax,%fs + movw %ax, %gs # -> GS + 7c41: 8e e8 mov %eax,%gs + + # Set up the stack pointer and call into C. + movl $start, %esp + 7c43: bc 00 7c 00 00 mov $0x7c00,%esp + call bootmain + 7c48: e8 e2 00 00 00 call 7d2f + + # If bootmain returns (it shouldn't), trigger a Bochs + # breakpoint if running under Bochs, then loop. + movw $0x8a00, %ax # 0x8a00 -> port 0x8a00 + 7c4d: 66 b8 00 8a mov $0x8a00,%ax + movw %ax, %dx + 7c51: 66 89 c2 mov %ax,%dx + outw %ax, %dx + 7c54: 66 ef out %ax,(%dx) + movw $0x8ae0, %ax # 0x8ae0 -> port 0x8a00 + 7c56: 66 b8 e0 8a mov $0x8ae0,%ax + outw %ax, %dx + 7c5a: 66 ef out %ax,(%dx) + +00007c5c : +spin: + jmp spin + 7c5c: eb fe jmp 7c5c + 7c5e: 66 90 xchg %ax,%ax + +00007c60 : + ... + 7c68: ff (bad) + 7c69: ff 00 incl (%eax) + 7c6b: 00 00 add %al,(%eax) + 7c6d: 9a cf 00 ff ff 00 00 lcall $0x0,$0xffff00cf + 7c74: 00 .byte 0x0 + 7c75: 92 xchg %eax,%edx + 7c76: cf iret + ... + +00007c78 : + 7c78: 17 pop %ss + 7c79: 00 60 7c add %ah,0x7c(%eax) + ... + +00007c7e : + entry(); +} + +void +waitdisk(void) +{ + 7c7e: 55 push %ebp + 7c7f: 89 e5 mov %esp,%ebp +static inline uchar +inb(ushort port) +{ + uchar data; + + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); + 7c81: ba f7 01 00 00 mov $0x1f7,%edx + 7c86: ec in (%dx),%al + // Wait for disk ready. + while((inb(0x1F7) & 0xC0) != 0x40) + 7c87: 83 e0 c0 and $0xffffffc0,%eax + 7c8a: 3c 40 cmp $0x40,%al + 7c8c: 75 f8 jne 7c86 + ; +} + 7c8e: 5d pop %ebp + 7c8f: c3 ret + +00007c90 : + +// Read a single sector at offset into dst. +void +readsect(void *dst, uint offset) +{ + 7c90: 55 push %ebp + 7c91: 89 e5 mov %esp,%ebp + 7c93: 57 push %edi + 7c94: 53 push %ebx + 7c95: 8b 5d 0c mov 0xc(%ebp),%ebx + // Issue command. + waitdisk(); + 7c98: e8 e1 ff ff ff call 7c7e +} + +static inline void +outb(ushort port, uchar data) +{ + asm volatile("out %0,%1" : : "a" (data), "d" (port)); + 7c9d: ba f2 01 00 00 mov $0x1f2,%edx + 7ca2: b8 01 00 00 00 mov $0x1,%eax + 7ca7: ee out %al,(%dx) + 7ca8: b2 f3 mov $0xf3,%dl + 7caa: 89 d8 mov %ebx,%eax + 7cac: ee out %al,(%dx) + 7cad: 0f b6 c7 movzbl %bh,%eax + 7cb0: b2 f4 mov $0xf4,%dl + 7cb2: ee out %al,(%dx) + outb(0x1F2, 1); // count = 1 + outb(0x1F3, offset); + outb(0x1F4, offset >> 8); + outb(0x1F5, offset >> 16); + 7cb3: 89 d8 mov %ebx,%eax + 7cb5: c1 e8 10 shr $0x10,%eax + 7cb8: b2 f5 mov $0xf5,%dl + 7cba: ee out %al,(%dx) + outb(0x1F6, (offset >> 24) | 0xE0); + 7cbb: c1 eb 18 shr $0x18,%ebx + 7cbe: 89 d8 mov %ebx,%eax + 7cc0: 83 c8 e0 or $0xffffffe0,%eax + 7cc3: b2 f6 mov $0xf6,%dl + 7cc5: ee out %al,(%dx) + 7cc6: b2 f7 mov $0xf7,%dl + 7cc8: b8 20 00 00 00 mov $0x20,%eax + 7ccd: ee out %al,(%dx) + outb(0x1F7, 0x20); // cmd 0x20 - read sectors + + // Read data. + waitdisk(); + 7cce: e8 ab ff ff ff call 7c7e + asm volatile("cld; rep insl" : + 7cd3: 8b 7d 08 mov 0x8(%ebp),%edi + 7cd6: b9 80 00 00 00 mov $0x80,%ecx + 7cdb: ba f0 01 00 00 mov $0x1f0,%edx + 7ce0: fc cld + 7ce1: f3 6d rep insl (%dx),%es:(%edi) + insl(0x1F0, dst, SECTSIZE/4); +} + 7ce3: 5b pop %ebx + 7ce4: 5f pop %edi + 7ce5: 5d pop %ebp + 7ce6: c3 ret + +00007ce7 : + +// Read 'count' bytes at 'offset' from kernel into physical address 'pa'. +// Might copy more than asked. +void +readseg(uchar* pa, uint count, uint offset) +{ + 7ce7: 55 push %ebp + 7ce8: 89 e5 mov %esp,%ebp + 7cea: 57 push %edi + 7ceb: 56 push %esi + 7cec: 53 push %ebx + 7ced: 83 ec 08 sub $0x8,%esp + 7cf0: 8b 5d 08 mov 0x8(%ebp),%ebx + 7cf3: 8b 75 10 mov 0x10(%ebp),%esi + uchar* epa; + + epa = pa + count; + 7cf6: 89 df mov %ebx,%edi + 7cf8: 03 7d 0c add 0xc(%ebp),%edi + + // Round down to sector boundary. + pa -= offset % SECTSIZE; + 7cfb: 89 f0 mov %esi,%eax + 7cfd: 25 ff 01 00 00 and $0x1ff,%eax + 7d02: 29 c3 sub %eax,%ebx + + // Translate from bytes to sectors; kernel starts at sector 1. + offset = (offset / SECTSIZE) + 1; + 7d04: c1 ee 09 shr $0x9,%esi + 7d07: 83 c6 01 add $0x1,%esi + + // If this is too slow, we could read lots of sectors at a time. + // We'd write more to memory than asked, but it doesn't matter -- + // we load in increasing order. + for(; pa < epa; pa += SECTSIZE, offset++) + 7d0a: 39 df cmp %ebx,%edi + 7d0c: 76 19 jbe 7d27 + readsect(pa, offset); + 7d0e: 89 74 24 04 mov %esi,0x4(%esp) + 7d12: 89 1c 24 mov %ebx,(%esp) + 7d15: e8 76 ff ff ff call 7c90 + for(; pa < epa; pa += SECTSIZE, offset++) + 7d1a: 81 c3 00 02 00 00 add $0x200,%ebx + 7d20: 83 c6 01 add $0x1,%esi + 7d23: 39 df cmp %ebx,%edi + 7d25: 77 e7 ja 7d0e +} + 7d27: 83 c4 08 add $0x8,%esp + 7d2a: 5b pop %ebx + 7d2b: 5e pop %esi + 7d2c: 5f pop %edi + 7d2d: 5d pop %ebp + 7d2e: c3 ret + +00007d2f : +{ + 7d2f: 55 push %ebp + 7d30: 89 e5 mov %esp,%ebp + 7d32: 57 push %edi + 7d33: 56 push %esi + 7d34: 53 push %ebx + 7d35: 83 ec 1c sub $0x1c,%esp + readseg((uchar*)elf, 4096, 0); + 7d38: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + 7d3f: 00 + 7d40: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp) + 7d47: 00 + 7d48: c7 04 24 00 00 01 00 movl $0x10000,(%esp) + 7d4f: e8 93 ff ff ff call 7ce7 + if(elf->magic != ELF_MAGIC) + 7d54: 81 3d 00 00 01 00 7f cmpl $0x464c457f,0x10000 + 7d5b: 45 4c 46 + 7d5e: 75 57 jne 7db7 + ph = (struct proghdr*)((uchar*)elf + elf->phoff); + 7d60: a1 1c 00 01 00 mov 0x1001c,%eax + 7d65: 8d 98 00 00 01 00 lea 0x10000(%eax),%ebx + eph = ph + elf->phnum; + 7d6b: 0f b7 35 2c 00 01 00 movzwl 0x1002c,%esi + 7d72: c1 e6 05 shl $0x5,%esi + 7d75: 01 de add %ebx,%esi + for(; ph < eph; ph++){ + 7d77: 39 f3 cmp %esi,%ebx + 7d79: 73 36 jae 7db1 + pa = (uchar*)ph->paddr; + 7d7b: 8b 7b 0c mov 0xc(%ebx),%edi + readseg(pa, ph->filesz, ph->off); + 7d7e: 8b 43 04 mov 0x4(%ebx),%eax + 7d81: 89 44 24 08 mov %eax,0x8(%esp) + 7d85: 8b 43 10 mov 0x10(%ebx),%eax + 7d88: 89 44 24 04 mov %eax,0x4(%esp) + 7d8c: 89 3c 24 mov %edi,(%esp) + 7d8f: e8 53 ff ff ff call 7ce7 + if(ph->memsz > ph->filesz) + 7d94: 8b 4b 14 mov 0x14(%ebx),%ecx + 7d97: 8b 43 10 mov 0x10(%ebx),%eax + 7d9a: 39 c1 cmp %eax,%ecx + 7d9c: 76 0c jbe 7daa + stosb(pa + ph->filesz, 0, ph->memsz - ph->filesz); + 7d9e: 01 c7 add %eax,%edi + 7da0: 29 c1 sub %eax,%ecx +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 7da2: b8 00 00 00 00 mov $0x0,%eax + 7da7: fc cld + 7da8: f3 aa rep stos %al,%es:(%edi) + for(; ph < eph; ph++){ + 7daa: 83 c3 20 add $0x20,%ebx + 7dad: 39 de cmp %ebx,%esi + 7daf: 77 ca ja 7d7b + entry(); + 7db1: ff 15 18 00 01 00 call *0x10018 +} + 7db7: 83 c4 1c add $0x1c,%esp + 7dba: 5b pop %ebx + 7dbb: 5e pop %esi + 7dbc: 5f pop %edi + 7dbd: 5d pop %ebp + 7dbe: c3 ret diff --git a/bootblock.o b/bootblock.o new file mode 100755 index 0000000000..848c84fb33 Binary files /dev/null and b/bootblock.o differ diff --git a/bootblockother.o b/bootblockother.o new file mode 100755 index 0000000000..933e949cd7 Binary files /dev/null and b/bootblockother.o differ diff --git a/bootmain.d b/bootmain.d new file mode 100644 index 0000000000..b32eaf51bb --- /dev/null +++ b/bootmain.d @@ -0,0 +1 @@ +bootmain.o: bootmain.c types.h elf.h x86.h memlayout.h diff --git a/bootmain.o b/bootmain.o new file mode 100644 index 0000000000..3a77a03eb7 Binary files /dev/null and b/bootmain.o differ diff --git a/cat.asm b/cat.asm new file mode 100644 index 0000000000..f8e847a8e1 --- /dev/null +++ b/cat.asm @@ -0,0 +1,1208 @@ + +_cat: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + } +} + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + int fd, i; + + if(argc <= 1){ + 5: be 01 00 00 00 mov $0x1,%esi +{ + a: 53 push %ebx + b: 83 e4 f0 and $0xfffffff0,%esp + e: 83 ec 10 sub $0x10,%esp + 11: 8b 45 0c mov 0xc(%ebp),%eax + if(argc <= 1){ + 14: 83 7d 08 01 cmpl $0x1,0x8(%ebp) + 18: 8d 58 04 lea 0x4(%eax),%ebx + 1b: 7e 68 jle 85 + 1d: 8d 76 00 lea 0x0(%esi),%esi + cat(0); + exit(0); + } + + for(i = 1; i < argc; i++){ + if((fd = open(argv[i], 0)) < 0){ + 20: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 27: 00 + 28: 8b 03 mov (%ebx),%eax + 2a: 89 04 24 mov %eax,(%esp) + 2d: e8 70 03 00 00 call 3a2 + 32: 85 c0 test %eax,%eax + 34: 89 c7 mov %eax,%edi + 36: 78 27 js 5f + printf(1, "cat: cannot open %s\n", argv[i]); + exit(0); + } + cat(fd); + 38: 89 04 24 mov %eax,(%esp) + for(i = 1; i < argc; i++){ + 3b: 83 c6 01 add $0x1,%esi + 3e: 83 c3 04 add $0x4,%ebx + cat(fd); + 41: e8 5a 00 00 00 call a0 + close(fd); + 46: 89 3c 24 mov %edi,(%esp) + 49: e8 3c 03 00 00 call 38a + for(i = 1; i < argc; i++){ + 4e: 3b 75 08 cmp 0x8(%ebp),%esi + 51: 75 cd jne 20 + } + exit(0); + 53: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 5a: e8 03 03 00 00 call 362 + printf(1, "cat: cannot open %s\n", argv[i]); + 5f: 8b 03 mov (%ebx),%eax + 61: c7 44 24 04 39 08 00 movl $0x839,0x4(%esp) + 68: 00 + 69: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 70: 89 44 24 08 mov %eax,0x8(%esp) + 74: e8 37 04 00 00 call 4b0 + exit(0); + 79: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 80: e8 dd 02 00 00 call 362 + cat(0); + 85: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 8c: e8 0f 00 00 00 call a0 + exit(0); + 91: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 98: e8 c5 02 00 00 call 362 + 9d: 66 90 xchg %ax,%ax + 9f: 90 nop + +000000a0 : +{ + a0: 55 push %ebp + a1: 89 e5 mov %esp,%ebp + a3: 56 push %esi + a4: 53 push %ebx + a5: 83 ec 10 sub $0x10,%esp + a8: 8b 75 08 mov 0x8(%ebp),%esi + while((n = read(fd, buf, sizeof(buf))) > 0) { + ab: eb 1f jmp cc + ad: 8d 76 00 lea 0x0(%esi),%esi + if (write(1, buf, n) != n) { + b0: 89 5c 24 08 mov %ebx,0x8(%esp) + b4: c7 44 24 04 20 0b 00 movl $0xb20,0x4(%esp) + bb: 00 + bc: c7 04 24 01 00 00 00 movl $0x1,(%esp) + c3: e8 ba 02 00 00 call 382 + c8: 39 d8 cmp %ebx,%eax + ca: 75 28 jne f4 + while((n = read(fd, buf, sizeof(buf))) > 0) { + cc: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + d3: 00 + d4: c7 44 24 04 20 0b 00 movl $0xb20,0x4(%esp) + db: 00 + dc: 89 34 24 mov %esi,(%esp) + df: e8 96 02 00 00 call 37a + e4: 83 f8 00 cmp $0x0,%eax + e7: 89 c3 mov %eax,%ebx + e9: 7f c5 jg b0 + if(n < 0){ + eb: 75 27 jne 114 +} + ed: 83 c4 10 add $0x10,%esp + f0: 5b pop %ebx + f1: 5e pop %esi + f2: 5d pop %ebp + f3: c3 ret + printf(1, "cat: write error\n"); + f4: c7 44 24 04 16 08 00 movl $0x816,0x4(%esp) + fb: 00 + fc: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 103: e8 a8 03 00 00 call 4b0 + exit(0); + 108: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 10f: e8 4e 02 00 00 call 362 + printf(1, "cat: read error\n"); + 114: c7 44 24 04 28 08 00 movl $0x828,0x4(%esp) + 11b: 00 + 11c: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 123: e8 88 03 00 00 call 4b0 + exit(0); + 128: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 12f: e8 2e 02 00 00 call 362 + 134: 66 90 xchg %ax,%ax + 136: 66 90 xchg %ax,%ax + 138: 66 90 xchg %ax,%ax + 13a: 66 90 xchg %ax,%ax + 13c: 66 90 xchg %ax,%ax + 13e: 66 90 xchg %ax,%ax + +00000140 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 8b 45 08 mov 0x8(%ebp),%eax + 146: 8b 4d 0c mov 0xc(%ebp),%ecx + 149: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 14a: 89 c2 mov %eax,%edx + 14c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 150: 83 c1 01 add $0x1,%ecx + 153: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 157: 83 c2 01 add $0x1,%edx + 15a: 84 db test %bl,%bl + 15c: 88 5a ff mov %bl,-0x1(%edx) + 15f: 75 ef jne 150 + ; + return os; +} + 161: 5b pop %ebx + 162: 5d pop %ebp + 163: c3 ret + 164: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 16a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000170 : + +int +strcmp(const char *p, const char *q) +{ + 170: 55 push %ebp + 171: 89 e5 mov %esp,%ebp + 173: 8b 55 08 mov 0x8(%ebp),%edx + 176: 53 push %ebx + 177: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 17a: 0f b6 02 movzbl (%edx),%eax + 17d: 84 c0 test %al,%al + 17f: 74 2d je 1ae + 181: 0f b6 19 movzbl (%ecx),%ebx + 184: 38 d8 cmp %bl,%al + 186: 74 0e je 196 + 188: eb 2b jmp 1b5 + 18a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 190: 38 c8 cmp %cl,%al + 192: 75 15 jne 1a9 + p++, q++; + 194: 89 d9 mov %ebx,%ecx + 196: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 199: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 19c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 19f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 1a3: 84 c0 test %al,%al + 1a5: 75 e9 jne 190 + 1a7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 1a9: 29 c8 sub %ecx,%eax +} + 1ab: 5b pop %ebx + 1ac: 5d pop %ebp + 1ad: c3 ret + 1ae: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 1b1: 31 c0 xor %eax,%eax + 1b3: eb f4 jmp 1a9 + 1b5: 0f b6 cb movzbl %bl,%ecx + 1b8: eb ef jmp 1a9 + 1ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000001c0 : + +uint +strlen(const char *s) +{ + 1c0: 55 push %ebp + 1c1: 89 e5 mov %esp,%ebp + 1c3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 1c6: 80 39 00 cmpb $0x0,(%ecx) + 1c9: 74 12 je 1dd + 1cb: 31 d2 xor %edx,%edx + 1cd: 8d 76 00 lea 0x0(%esi),%esi + 1d0: 83 c2 01 add $0x1,%edx + 1d3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 1d7: 89 d0 mov %edx,%eax + 1d9: 75 f5 jne 1d0 + ; + return n; +} + 1db: 5d pop %ebp + 1dc: c3 ret + for(n = 0; s[n]; n++) + 1dd: 31 c0 xor %eax,%eax +} + 1df: 5d pop %ebp + 1e0: c3 ret + 1e1: eb 0d jmp 1f0 + 1e3: 90 nop + 1e4: 90 nop + 1e5: 90 nop + 1e6: 90 nop + 1e7: 90 nop + 1e8: 90 nop + 1e9: 90 nop + 1ea: 90 nop + 1eb: 90 nop + 1ec: 90 nop + 1ed: 90 nop + 1ee: 90 nop + 1ef: 90 nop + +000001f0 : + +void* +memset(void *dst, int c, uint n) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 8b 55 08 mov 0x8(%ebp),%edx + 1f6: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 1f7: 8b 4d 10 mov 0x10(%ebp),%ecx + 1fa: 8b 45 0c mov 0xc(%ebp),%eax + 1fd: 89 d7 mov %edx,%edi + 1ff: fc cld + 200: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 202: 89 d0 mov %edx,%eax + 204: 5f pop %edi + 205: 5d pop %ebp + 206: c3 ret + 207: 89 f6 mov %esi,%esi + 209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000210 : + +char* +strchr(const char *s, char c) +{ + 210: 55 push %ebp + 211: 89 e5 mov %esp,%ebp + 213: 8b 45 08 mov 0x8(%ebp),%eax + 216: 53 push %ebx + 217: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 21a: 0f b6 18 movzbl (%eax),%ebx + 21d: 84 db test %bl,%bl + 21f: 74 1d je 23e + if(*s == c) + 221: 38 d3 cmp %dl,%bl + 223: 89 d1 mov %edx,%ecx + 225: 75 0d jne 234 + 227: eb 17 jmp 240 + 229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 230: 38 ca cmp %cl,%dl + 232: 74 0c je 240 + for(; *s; s++) + 234: 83 c0 01 add $0x1,%eax + 237: 0f b6 10 movzbl (%eax),%edx + 23a: 84 d2 test %dl,%dl + 23c: 75 f2 jne 230 + return (char*)s; + return 0; + 23e: 31 c0 xor %eax,%eax +} + 240: 5b pop %ebx + 241: 5d pop %ebp + 242: c3 ret + 243: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000250 : + +char* +gets(char *buf, int max) +{ + 250: 55 push %ebp + 251: 89 e5 mov %esp,%ebp + 253: 57 push %edi + 254: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 255: 31 f6 xor %esi,%esi +{ + 257: 53 push %ebx + 258: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 25b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 25e: eb 31 jmp 291 + cc = read(0, &c, 1); + 260: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 267: 00 + 268: 89 7c 24 04 mov %edi,0x4(%esp) + 26c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 273: e8 02 01 00 00 call 37a + if(cc < 1) + 278: 85 c0 test %eax,%eax + 27a: 7e 1d jle 299 + break; + buf[i++] = c; + 27c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 280: 89 de mov %ebx,%esi + buf[i++] = c; + 282: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 285: 3c 0d cmp $0xd,%al + buf[i++] = c; + 287: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 28b: 74 0c je 299 + 28d: 3c 0a cmp $0xa,%al + 28f: 74 08 je 299 + for(i=0; i+1 < max; ){ + 291: 8d 5e 01 lea 0x1(%esi),%ebx + 294: 3b 5d 0c cmp 0xc(%ebp),%ebx + 297: 7c c7 jl 260 + break; + } + buf[i] = '\0'; + 299: 8b 45 08 mov 0x8(%ebp),%eax + 29c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 2a0: 83 c4 2c add $0x2c,%esp + 2a3: 5b pop %ebx + 2a4: 5e pop %esi + 2a5: 5f pop %edi + 2a6: 5d pop %ebp + 2a7: c3 ret + 2a8: 90 nop + 2a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000002b0 : + +int +stat(const char *n, struct stat *st) +{ + 2b0: 55 push %ebp + 2b1: 89 e5 mov %esp,%ebp + 2b3: 56 push %esi + 2b4: 53 push %ebx + 2b5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 2b8: 8b 45 08 mov 0x8(%ebp),%eax + 2bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2c2: 00 + 2c3: 89 04 24 mov %eax,(%esp) + 2c6: e8 d7 00 00 00 call 3a2 + if(fd < 0) + 2cb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 2cd: 89 c3 mov %eax,%ebx + if(fd < 0) + 2cf: 78 27 js 2f8 + return -1; + r = fstat(fd, st); + 2d1: 8b 45 0c mov 0xc(%ebp),%eax + 2d4: 89 1c 24 mov %ebx,(%esp) + 2d7: 89 44 24 04 mov %eax,0x4(%esp) + 2db: e8 da 00 00 00 call 3ba + close(fd); + 2e0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 2e3: 89 c6 mov %eax,%esi + close(fd); + 2e5: e8 a0 00 00 00 call 38a + return r; + 2ea: 89 f0 mov %esi,%eax +} + 2ec: 83 c4 10 add $0x10,%esp + 2ef: 5b pop %ebx + 2f0: 5e pop %esi + 2f1: 5d pop %ebp + 2f2: c3 ret + 2f3: 90 nop + 2f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 2f8: b8 ff ff ff ff mov $0xffffffff,%eax + 2fd: eb ed jmp 2ec + 2ff: 90 nop + +00000300 : + +int +atoi(const char *s) +{ + 300: 55 push %ebp + 301: 89 e5 mov %esp,%ebp + 303: 8b 4d 08 mov 0x8(%ebp),%ecx + 306: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 307: 0f be 11 movsbl (%ecx),%edx + 30a: 8d 42 d0 lea -0x30(%edx),%eax + 30d: 3c 09 cmp $0x9,%al + n = 0; + 30f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 314: 77 17 ja 32d + 316: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 318: 83 c1 01 add $0x1,%ecx + 31b: 8d 04 80 lea (%eax,%eax,4),%eax + 31e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 322: 0f be 11 movsbl (%ecx),%edx + 325: 8d 5a d0 lea -0x30(%edx),%ebx + 328: 80 fb 09 cmp $0x9,%bl + 32b: 76 eb jbe 318 + return n; +} + 32d: 5b pop %ebx + 32e: 5d pop %ebp + 32f: c3 ret + +00000330 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 330: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 331: 31 d2 xor %edx,%edx +{ + 333: 89 e5 mov %esp,%ebp + 335: 56 push %esi + 336: 8b 45 08 mov 0x8(%ebp),%eax + 339: 53 push %ebx + 33a: 8b 5d 10 mov 0x10(%ebp),%ebx + 33d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 340: 85 db test %ebx,%ebx + 342: 7e 12 jle 356 + 344: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 348: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 34c: 88 0c 10 mov %cl,(%eax,%edx,1) + 34f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 352: 39 da cmp %ebx,%edx + 354: 75 f2 jne 348 + return vdst; +} + 356: 5b pop %ebx + 357: 5e pop %esi + 358: 5d pop %ebp + 359: c3 ret + +0000035a : + 35a: b8 01 00 00 00 mov $0x1,%eax + 35f: cd 40 int $0x40 + 361: c3 ret + +00000362 : + 362: b8 02 00 00 00 mov $0x2,%eax + 367: cd 40 int $0x40 + 369: c3 ret + +0000036a : + 36a: b8 03 00 00 00 mov $0x3,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + +00000372 : + 372: b8 04 00 00 00 mov $0x4,%eax + 377: cd 40 int $0x40 + 379: c3 ret + +0000037a : + 37a: b8 05 00 00 00 mov $0x5,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + +00000382 : + 382: b8 10 00 00 00 mov $0x10,%eax + 387: cd 40 int $0x40 + 389: c3 ret + +0000038a : + 38a: b8 15 00 00 00 mov $0x15,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + +00000392 : + 392: b8 06 00 00 00 mov $0x6,%eax + 397: cd 40 int $0x40 + 399: c3 ret + +0000039a : + 39a: b8 07 00 00 00 mov $0x7,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + +000003a2 : + 3a2: b8 0f 00 00 00 mov $0xf,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + +000003aa : + 3aa: b8 11 00 00 00 mov $0x11,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + +000003b2 : + 3b2: b8 12 00 00 00 mov $0x12,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + +000003ba : + 3ba: b8 08 00 00 00 mov $0x8,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + +000003c2 : + 3c2: b8 13 00 00 00 mov $0x13,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + +000003ca : + 3ca: b8 14 00 00 00 mov $0x14,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + +000003d2 : + 3d2: b8 09 00 00 00 mov $0x9,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + +000003da : + 3da: b8 0a 00 00 00 mov $0xa,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + +000003e2 : + 3e2: b8 0b 00 00 00 mov $0xb,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + +000003ea : + 3ea: b8 0c 00 00 00 mov $0xc,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + +000003f2 : + 3f2: b8 0d 00 00 00 mov $0xd,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + +000003fa : + 3fa: b8 0e 00 00 00 mov $0xe,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret + 402: 66 90 xchg %ax,%ax + 404: 66 90 xchg %ax,%ax + 406: 66 90 xchg %ax,%ax + 408: 66 90 xchg %ax,%ax + 40a: 66 90 xchg %ax,%ax + 40c: 66 90 xchg %ax,%ax + 40e: 66 90 xchg %ax,%ax + +00000410 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 410: 55 push %ebp + 411: 89 e5 mov %esp,%ebp + 413: 57 push %edi + 414: 56 push %esi + 415: 89 c6 mov %eax,%esi + 417: 53 push %ebx + 418: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 41b: 8b 5d 08 mov 0x8(%ebp),%ebx + 41e: 85 db test %ebx,%ebx + 420: 74 09 je 42b + 422: 89 d0 mov %edx,%eax + 424: c1 e8 1f shr $0x1f,%eax + 427: 84 c0 test %al,%al + 429: 75 75 jne 4a0 + neg = 1; + x = -xx; + } else { + x = xx; + 42b: 89 d0 mov %edx,%eax + neg = 0; + 42d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 434: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 437: 31 ff xor %edi,%edi + 439: 89 ce mov %ecx,%esi + 43b: 8d 5d d7 lea -0x29(%ebp),%ebx + 43e: eb 02 jmp 442 + do{ + buf[i++] = digits[x % base]; + 440: 89 cf mov %ecx,%edi + 442: 31 d2 xor %edx,%edx + 444: f7 f6 div %esi + 446: 8d 4f 01 lea 0x1(%edi),%ecx + 449: 0f b6 92 55 08 00 00 movzbl 0x855(%edx),%edx + }while((x /= base) != 0); + 450: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 452: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 455: 75 e9 jne 440 + if(neg) + 457: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 45a: 89 c8 mov %ecx,%eax + 45c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 45f: 85 d2 test %edx,%edx + 461: 74 08 je 46b + buf[i++] = '-'; + 463: 8d 4f 02 lea 0x2(%edi),%ecx + 466: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 46b: 8d 79 ff lea -0x1(%ecx),%edi + 46e: 66 90 xchg %ax,%ax + 470: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 475: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 478: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 47f: 00 + 480: 89 5c 24 04 mov %ebx,0x4(%esp) + 484: 89 34 24 mov %esi,(%esp) + 487: 88 45 d7 mov %al,-0x29(%ebp) + 48a: e8 f3 fe ff ff call 382 + while(--i >= 0) + 48f: 83 ff ff cmp $0xffffffff,%edi + 492: 75 dc jne 470 + putc(fd, buf[i]); +} + 494: 83 c4 4c add $0x4c,%esp + 497: 5b pop %ebx + 498: 5e pop %esi + 499: 5f pop %edi + 49a: 5d pop %ebp + 49b: c3 ret + 49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 4a0: 89 d0 mov %edx,%eax + 4a2: f7 d8 neg %eax + neg = 1; + 4a4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 4ab: eb 87 jmp 434 + 4ad: 8d 76 00 lea 0x0(%esi),%esi + +000004b0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 4b0: 55 push %ebp + 4b1: 89 e5 mov %esp,%ebp + 4b3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 4b4: 31 ff xor %edi,%edi +{ + 4b6: 56 push %esi + 4b7: 53 push %ebx + 4b8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 4bb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 4be: 8d 45 10 lea 0x10(%ebp),%eax +{ + 4c1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 4c4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 4c7: 0f b6 13 movzbl (%ebx),%edx + 4ca: 83 c3 01 add $0x1,%ebx + 4cd: 84 d2 test %dl,%dl + 4cf: 75 39 jne 50a + 4d1: e9 c2 00 00 00 jmp 598 + 4d6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 4d8: 83 fa 25 cmp $0x25,%edx + 4db: 0f 84 bf 00 00 00 je 5a0 + write(fd, &c, 1); + 4e1: 8d 45 e2 lea -0x1e(%ebp),%eax + 4e4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4eb: 00 + 4ec: 89 44 24 04 mov %eax,0x4(%esp) + 4f0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 4f3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 4f6: e8 87 fe ff ff call 382 + 4fb: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 4fe: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 502: 84 d2 test %dl,%dl + 504: 0f 84 8e 00 00 00 je 598 + if(state == 0){ + 50a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 50c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 50f: 74 c7 je 4d8 + } + } else if(state == '%'){ + 511: 83 ff 25 cmp $0x25,%edi + 514: 75 e5 jne 4fb + if(c == 'd'){ + 516: 83 fa 64 cmp $0x64,%edx + 519: 0f 84 31 01 00 00 je 650 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 51f: 25 f7 00 00 00 and $0xf7,%eax + 524: 83 f8 70 cmp $0x70,%eax + 527: 0f 84 83 00 00 00 je 5b0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 52d: 83 fa 73 cmp $0x73,%edx + 530: 0f 84 a2 00 00 00 je 5d8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 536: 83 fa 63 cmp $0x63,%edx + 539: 0f 84 35 01 00 00 je 674 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 53f: 83 fa 25 cmp $0x25,%edx + 542: 0f 84 e0 00 00 00 je 628 + write(fd, &c, 1); + 548: 8d 45 e6 lea -0x1a(%ebp),%eax + 54b: 83 c3 01 add $0x1,%ebx + 54e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 555: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 556: 31 ff xor %edi,%edi + write(fd, &c, 1); + 558: 89 44 24 04 mov %eax,0x4(%esp) + 55c: 89 34 24 mov %esi,(%esp) + 55f: 89 55 d0 mov %edx,-0x30(%ebp) + 562: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 566: e8 17 fe ff ff call 382 + putc(fd, c); + 56b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 56e: 8d 45 e7 lea -0x19(%ebp),%eax + 571: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 578: 00 + 579: 89 44 24 04 mov %eax,0x4(%esp) + 57d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 580: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 583: e8 fa fd ff ff call 382 + for(i = 0; fmt[i]; i++){ + 588: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 58c: 84 d2 test %dl,%dl + 58e: 0f 85 76 ff ff ff jne 50a + 594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 598: 83 c4 3c add $0x3c,%esp + 59b: 5b pop %ebx + 59c: 5e pop %esi + 59d: 5f pop %edi + 59e: 5d pop %ebp + 59f: c3 ret + state = '%'; + 5a0: bf 25 00 00 00 mov $0x25,%edi + 5a5: e9 51 ff ff ff jmp 4fb + 5aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 5b0: 8b 45 d4 mov -0x2c(%ebp),%eax + 5b3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 5b8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 5ba: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 5c1: 8b 10 mov (%eax),%edx + 5c3: 89 f0 mov %esi,%eax + 5c5: e8 46 fe ff ff call 410 + ap++; + 5ca: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5ce: e9 28 ff ff ff jmp 4fb + 5d3: 90 nop + 5d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 5d8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 5db: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 5df: 8b 38 mov (%eax),%edi + s = "(null)"; + 5e1: b8 4e 08 00 00 mov $0x84e,%eax + 5e6: 85 ff test %edi,%edi + 5e8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 5eb: 0f b6 07 movzbl (%edi),%eax + 5ee: 84 c0 test %al,%al + 5f0: 74 2a je 61c + 5f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 5f8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 5fb: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 5fe: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 601: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 608: 00 + 609: 89 44 24 04 mov %eax,0x4(%esp) + 60d: 89 34 24 mov %esi,(%esp) + 610: e8 6d fd ff ff call 382 + while(*s != 0){ + 615: 0f b6 07 movzbl (%edi),%eax + 618: 84 c0 test %al,%al + 61a: 75 dc jne 5f8 + state = 0; + 61c: 31 ff xor %edi,%edi + 61e: e9 d8 fe ff ff jmp 4fb + 623: 90 nop + 624: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 628: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 62b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 62d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 634: 00 + 635: 89 44 24 04 mov %eax,0x4(%esp) + 639: 89 34 24 mov %esi,(%esp) + 63c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 640: e8 3d fd ff ff call 382 + 645: e9 b1 fe ff ff jmp 4fb + 64a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 650: 8b 45 d4 mov -0x2c(%ebp),%eax + 653: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 658: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 65b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 662: 8b 10 mov (%eax),%edx + 664: 89 f0 mov %esi,%eax + 666: e8 a5 fd ff ff call 410 + ap++; + 66b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 66f: e9 87 fe ff ff jmp 4fb + putc(fd, *ap); + 674: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 677: 31 ff xor %edi,%edi + putc(fd, *ap); + 679: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 67b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 682: 00 + 683: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 686: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 689: 8d 45 e4 lea -0x1c(%ebp),%eax + 68c: 89 44 24 04 mov %eax,0x4(%esp) + 690: e8 ed fc ff ff call 382 + ap++; + 695: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 699: e9 5d fe ff ff jmp 4fb + 69e: 66 90 xchg %ax,%ax + +000006a0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 6a0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6a1: a1 00 0b 00 00 mov 0xb00,%eax +{ + 6a6: 89 e5 mov %esp,%ebp + 6a8: 57 push %edi + 6a9: 56 push %esi + 6aa: 53 push %ebx + 6ab: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6ae: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 6b0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6b3: 39 d0 cmp %edx,%eax + 6b5: 72 11 jb 6c8 + 6b7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6b8: 39 c8 cmp %ecx,%eax + 6ba: 72 04 jb 6c0 + 6bc: 39 ca cmp %ecx,%edx + 6be: 72 10 jb 6d0 + 6c0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6c2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6c4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6c6: 73 f0 jae 6b8 + 6c8: 39 ca cmp %ecx,%edx + 6ca: 72 04 jb 6d0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6cc: 39 c8 cmp %ecx,%eax + 6ce: 72 f0 jb 6c0 + break; + if(bp + bp->s.size == p->s.ptr){ + 6d0: 8b 73 fc mov -0x4(%ebx),%esi + 6d3: 8d 3c f2 lea (%edx,%esi,8),%edi + 6d6: 39 cf cmp %ecx,%edi + 6d8: 74 1e je 6f8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 6da: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 6dd: 8b 48 04 mov 0x4(%eax),%ecx + 6e0: 8d 34 c8 lea (%eax,%ecx,8),%esi + 6e3: 39 f2 cmp %esi,%edx + 6e5: 74 28 je 70f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 6e7: 89 10 mov %edx,(%eax) + freep = p; + 6e9: a3 00 0b 00 00 mov %eax,0xb00 +} + 6ee: 5b pop %ebx + 6ef: 5e pop %esi + 6f0: 5f pop %edi + 6f1: 5d pop %ebp + 6f2: c3 ret + 6f3: 90 nop + 6f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 6f8: 03 71 04 add 0x4(%ecx),%esi + 6fb: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 6fe: 8b 08 mov (%eax),%ecx + 700: 8b 09 mov (%ecx),%ecx + 702: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 705: 8b 48 04 mov 0x4(%eax),%ecx + 708: 8d 34 c8 lea (%eax,%ecx,8),%esi + 70b: 39 f2 cmp %esi,%edx + 70d: 75 d8 jne 6e7 + p->s.size += bp->s.size; + 70f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 712: a3 00 0b 00 00 mov %eax,0xb00 + p->s.size += bp->s.size; + 717: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 71a: 8b 53 f8 mov -0x8(%ebx),%edx + 71d: 89 10 mov %edx,(%eax) +} + 71f: 5b pop %ebx + 720: 5e pop %esi + 721: 5f pop %edi + 722: 5d pop %ebp + 723: c3 ret + 724: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 72a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000730 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 730: 55 push %ebp + 731: 89 e5 mov %esp,%ebp + 733: 57 push %edi + 734: 56 push %esi + 735: 53 push %ebx + 736: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 739: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 73c: 8b 1d 00 0b 00 00 mov 0xb00,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 742: 8d 48 07 lea 0x7(%eax),%ecx + 745: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 748: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 74a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 74d: 0f 84 9b 00 00 00 je 7ee + 753: 8b 13 mov (%ebx),%edx + 755: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 758: 39 fe cmp %edi,%esi + 75a: 76 64 jbe 7c0 + 75c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 763: bb 00 80 00 00 mov $0x8000,%ebx + 768: 89 45 e4 mov %eax,-0x1c(%ebp) + 76b: eb 0e jmp 77b + 76d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 770: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 772: 8b 78 04 mov 0x4(%eax),%edi + 775: 39 fe cmp %edi,%esi + 777: 76 4f jbe 7c8 + 779: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 77b: 3b 15 00 0b 00 00 cmp 0xb00,%edx + 781: 75 ed jne 770 + if(nu < 4096) + 783: 8b 45 e4 mov -0x1c(%ebp),%eax + 786: 81 fe 00 10 00 00 cmp $0x1000,%esi + 78c: bf 00 10 00 00 mov $0x1000,%edi + 791: 0f 43 fe cmovae %esi,%edi + 794: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 797: 89 04 24 mov %eax,(%esp) + 79a: e8 4b fc ff ff call 3ea + if(p == (char*)-1) + 79f: 83 f8 ff cmp $0xffffffff,%eax + 7a2: 74 18 je 7bc + hp->s.size = nu; + 7a4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 7a7: 83 c0 08 add $0x8,%eax + 7aa: 89 04 24 mov %eax,(%esp) + 7ad: e8 ee fe ff ff call 6a0 + return freep; + 7b2: 8b 15 00 0b 00 00 mov 0xb00,%edx + if((p = morecore(nunits)) == 0) + 7b8: 85 d2 test %edx,%edx + 7ba: 75 b4 jne 770 + return 0; + 7bc: 31 c0 xor %eax,%eax + 7be: eb 20 jmp 7e0 + if(p->s.size >= nunits){ + 7c0: 89 d0 mov %edx,%eax + 7c2: 89 da mov %ebx,%edx + 7c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 7c8: 39 fe cmp %edi,%esi + 7ca: 74 1c je 7e8 + p->s.size -= nunits; + 7cc: 29 f7 sub %esi,%edi + 7ce: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 7d1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 7d4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 7d7: 89 15 00 0b 00 00 mov %edx,0xb00 + return (void*)(p + 1); + 7dd: 83 c0 08 add $0x8,%eax + } +} + 7e0: 83 c4 1c add $0x1c,%esp + 7e3: 5b pop %ebx + 7e4: 5e pop %esi + 7e5: 5f pop %edi + 7e6: 5d pop %ebp + 7e7: c3 ret + prevp->s.ptr = p->s.ptr; + 7e8: 8b 08 mov (%eax),%ecx + 7ea: 89 0a mov %ecx,(%edx) + 7ec: eb e9 jmp 7d7 + base.s.ptr = freep = prevp = &base; + 7ee: c7 05 00 0b 00 00 04 movl $0xb04,0xb00 + 7f5: 0b 00 00 + base.s.size = 0; + 7f8: ba 04 0b 00 00 mov $0xb04,%edx + base.s.ptr = freep = prevp = &base; + 7fd: c7 05 04 0b 00 00 04 movl $0xb04,0xb04 + 804: 0b 00 00 + base.s.size = 0; + 807: c7 05 08 0b 00 00 00 movl $0x0,0xb08 + 80e: 00 00 00 + 811: e9 46 ff ff ff jmp 75c diff --git a/cat.c b/cat.c index 5ddc820d69..ed1987de6d 100644 --- a/cat.c +++ b/cat.c @@ -12,12 +12,12 @@ cat(int fd) while((n = read(fd, buf, sizeof(buf))) > 0) { if (write(1, buf, n) != n) { printf(1, "cat: write error\n"); - exit(); + exit(0); } } if(n < 0){ printf(1, "cat: read error\n"); - exit(); + exit(0); } } @@ -28,16 +28,16 @@ main(int argc, char *argv[]) if(argc <= 1){ cat(0); - exit(); + exit(0); } for(i = 1; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ printf(1, "cat: cannot open %s\n", argv[i]); - exit(); + exit(0); } cat(fd); close(fd); } - exit(); + exit(0); } diff --git a/cat.d b/cat.d new file mode 100644 index 0000000000..8f55accad4 --- /dev/null +++ b/cat.d @@ -0,0 +1 @@ +cat.o: cat.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/cat.o b/cat.o new file mode 100644 index 0000000000..725c555f82 Binary files /dev/null and b/cat.o differ diff --git a/cat.sym b/cat.sym new file mode 100644 index 0000000000..f80d25f779 --- /dev/null +++ b/cat.sym @@ -0,0 +1,59 @@ +00000000 .text +00000816 .rodata +00000868 .eh_frame +00000b00 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 cat.c +00000000 ulib.c +00000000 printf.c +00000410 printint +00000855 digits.1354 +00000000 umalloc.c +00000b00 freep +00000b04 base +00000140 strcpy +000004b0 printf +00000330 memmove +000003aa mknod +00000250 gets +000003e2 getpid +000000a0 cat +00000730 malloc +000003f2 sleep +00000372 pipe +00000382 write +000003ba fstat +00000392 kill +000003d2 chdir +0000039a exec +0000036a wait +0000037a read +000003b2 unlink +0000035a fork +000003ea sbrk +000003fa uptime +00000b00 __bss_start +000001f0 memset +00000000 main +00000170 strcmp +000003da dup +00000b20 buf +000002b0 stat +00000b00 _edata +00000d20 _end +000003c2 link +00000362 exit +00000300 atoi +000001c0 strlen +000003a2 open +00000210 strchr +000003ca mkdir +0000038a close +000006a0 free diff --git a/console.d b/console.d new file mode 100644 index 0000000000..7b5564c213 --- /dev/null +++ b/console.d @@ -0,0 +1,3 @@ +console.o: console.c /usr/include/stdc-predef.h types.h defs.h param.h \ + traps.h spinlock.h sleeplock.h fs.h file.h memlayout.h mmu.h proc.h \ + x86.h diff --git a/console.o b/console.o new file mode 100644 index 0000000000..fd21e3c488 Binary files /dev/null and b/console.o differ diff --git a/defs.h b/defs.h index 82fb982837..49b824a905 100644 --- a/defs.h +++ b/defs.h @@ -11,180 +11,180 @@ struct stat; struct superblock; // bio.c -void binit(void); -struct buf* bread(uint, uint); -void brelse(struct buf*); -void bwrite(struct buf*); +void binit(void); +struct buf *bread(uint, uint); +void brelse(struct buf *); +void bwrite(struct buf *); // console.c -void consoleinit(void); -void cprintf(char*, ...); -void consoleintr(int(*)(void)); -void panic(char*) __attribute__((noreturn)); +void consoleinit(void); +void cprintf(char *, ...); +void consoleintr(int (*)(void)); +void panic(char *) __attribute__((noreturn)); // exec.c -int exec(char*, char**); +int exec(char *, char **); // file.c -struct file* filealloc(void); -void fileclose(struct file*); -struct file* filedup(struct file*); -void fileinit(void); -int fileread(struct file*, char*, int n); -int filestat(struct file*, struct stat*); -int filewrite(struct file*, char*, int n); +struct file *filealloc(void); +void fileclose(struct file *); +struct file *filedup(struct file *); +void fileinit(void); +int fileread(struct file *, char *, int n); +int filestat(struct file *, struct stat *); +int filewrite(struct file *, char *, int n); // fs.c -void readsb(int dev, struct superblock *sb); -int dirlink(struct inode*, char*, uint); -struct inode* dirlookup(struct inode*, char*, uint*); -struct inode* ialloc(uint, short); -struct inode* idup(struct inode*); -void iinit(int dev); -void ilock(struct inode*); -void iput(struct inode*); -void iunlock(struct inode*); -void iunlockput(struct inode*); -void iupdate(struct inode*); -int namecmp(const char*, const char*); -struct inode* namei(char*); -struct inode* nameiparent(char*, char*); -int readi(struct inode*, char*, uint, uint); -void stati(struct inode*, struct stat*); -int writei(struct inode*, char*, uint, uint); +void readsb(int dev, struct superblock *sb); +int dirlink(struct inode *, char *, uint); +struct inode *dirlookup(struct inode *, char *, uint *); +struct inode *ialloc(uint, short); +struct inode *idup(struct inode *); +void iinit(int dev); +void ilock(struct inode *); +void iput(struct inode *); +void iunlock(struct inode *); +void iunlockput(struct inode *); +void iupdate(struct inode *); +int namecmp(const char *, const char *); +struct inode *namei(char *); +struct inode *nameiparent(char *, char *); +int readi(struct inode *, char *, uint, uint); +void stati(struct inode *, struct stat *); +int writei(struct inode *, char *, uint, uint); // ide.c -void ideinit(void); -void ideintr(void); -void iderw(struct buf*); +void ideinit(void); +void ideintr(void); +void iderw(struct buf *); // ioapic.c -void ioapicenable(int irq, int cpu); -extern uchar ioapicid; -void ioapicinit(void); +void ioapicenable(int irq, int cpu); +extern uchar ioapicid; +void ioapicinit(void); // kalloc.c -char* kalloc(void); -void kfree(char*); -void kinit1(void*, void*); -void kinit2(void*, void*); +char *kalloc(void); +void kfree(char *); +void kinit1(void *, void *); +void kinit2(void *, void *); // kbd.c -void kbdintr(void); +void kbdintr(void); // lapic.c -void cmostime(struct rtcdate *r); -int lapicid(void); -extern volatile uint* lapic; -void lapiceoi(void); -void lapicinit(void); -void lapicstartap(uchar, uint); -void microdelay(int); +void cmostime(struct rtcdate *r); +int lapicid(void); +extern volatile uint *lapic; +void lapiceoi(void); +void lapicinit(void); +void lapicstartap(uchar, uint); +void microdelay(int); // log.c -void initlog(int dev); -void log_write(struct buf*); -void begin_op(); -void end_op(); +void initlog(int dev); +void log_write(struct buf *); +void begin_op(); +void end_op(); // mp.c -extern int ismp; -void mpinit(void); +extern int ismp; +void mpinit(void); // picirq.c -void picenable(int); -void picinit(void); +void picenable(int); +void picinit(void); // pipe.c -int pipealloc(struct file**, struct file**); -void pipeclose(struct pipe*, int); -int piperead(struct pipe*, char*, int); -int pipewrite(struct pipe*, char*, int); - -//PAGEBREAK: 16 -// proc.c -int cpuid(void); -void exit(void); -int fork(void); -int growproc(int); -int kill(int); -struct cpu* mycpu(void); -struct proc* myproc(); -void pinit(void); -void procdump(void); -void scheduler(void) __attribute__((noreturn)); -void sched(void); -void setproc(struct proc*); -void sleep(void*, struct spinlock*); -void userinit(void); -int wait(void); -void wakeup(void*); -void yield(void); +int pipealloc(struct file **, struct file **); +void pipeclose(struct pipe *, int); +int piperead(struct pipe *, char *, int); +int pipewrite(struct pipe *, char *, int); + +// PAGEBREAK: 16 +// proc.c +int cpuid(void); +void exit(int); // change to have status parameter +int fork(void); +int growproc(int); +int kill(int); +struct cpu *mycpu(void); +struct proc *myproc(); +void pinit(void); +void procdump(void); +void scheduler(void) __attribute__((noreturn)); +void sched(void); +void setproc(struct proc *); +void sleep(void *, struct spinlock *); +void userinit(void); +int wait(int *); +void wakeup(void *); +void yield(void); // swtch.S -void swtch(struct context**, struct context*); +void swtch(struct context **, struct context *); // spinlock.c -void acquire(struct spinlock*); -void getcallerpcs(void*, uint*); -int holding(struct spinlock*); -void initlock(struct spinlock*, char*); -void release(struct spinlock*); -void pushcli(void); -void popcli(void); +void acquire(struct spinlock *); +void getcallerpcs(void *, uint *); +int holding(struct spinlock *); +void initlock(struct spinlock *, char *); +void release(struct spinlock *); +void pushcli(void); +void popcli(void); // sleeplock.c -void acquiresleep(struct sleeplock*); -void releasesleep(struct sleeplock*); -int holdingsleep(struct sleeplock*); -void initsleeplock(struct sleeplock*, char*); +void acquiresleep(struct sleeplock *); +void releasesleep(struct sleeplock *); +int holdingsleep(struct sleeplock *); +void initsleeplock(struct sleeplock *, char *); // string.c -int memcmp(const void*, const void*, uint); -void* memmove(void*, const void*, uint); -void* memset(void*, int, uint); -char* safestrcpy(char*, const char*, int); -int strlen(const char*); -int strncmp(const char*, const char*, uint); -char* strncpy(char*, const char*, int); +int memcmp(const void *, const void *, uint); +void *memmove(void *, const void *, uint); +void *memset(void *, int, uint); +char *safestrcpy(char *, const char *, int); +int strlen(const char *); +int strncmp(const char *, const char *, uint); +char *strncpy(char *, const char *, int); // syscall.c -int argint(int, int*); -int argptr(int, char**, int); -int argstr(int, char**); -int fetchint(uint, int*); -int fetchstr(uint, char**); -void syscall(void); +int argint(int, int *); +int argptr(int, char **, int); +int argstr(int, char **); +int fetchint(uint, int *); +int fetchstr(uint, char **); +void syscall(void); // timer.c -void timerinit(void); +void timerinit(void); // trap.c -void idtinit(void); -extern uint ticks; -void tvinit(void); +void idtinit(void); +extern uint ticks; +void tvinit(void); extern struct spinlock tickslock; // uart.c -void uartinit(void); -void uartintr(void); -void uartputc(int); +void uartinit(void); +void uartintr(void); +void uartputc(int); // vm.c -void seginit(void); -void kvmalloc(void); -pde_t* setupkvm(void); -char* uva2ka(pde_t*, char*); -int allocuvm(pde_t*, uint, uint); -int deallocuvm(pde_t*, uint, uint); -void freevm(pde_t*); -void inituvm(pde_t*, char*, uint); -int loaduvm(pde_t*, char*, struct inode*, uint, uint); -pde_t* copyuvm(pde_t*, uint); -void switchuvm(struct proc*); -void switchkvm(void); -int copyout(pde_t*, uint, void*, uint); -void clearpteu(pde_t *pgdir, char *uva); +void seginit(void); +void kvmalloc(void); +pde_t *setupkvm(void); +char *uva2ka(pde_t *, char *); +int allocuvm(pde_t *, uint, uint); +int deallocuvm(pde_t *, uint, uint); +void freevm(pde_t *); +void inituvm(pde_t *, char *, uint); +int loaduvm(pde_t *, char *, struct inode *, uint, uint); +pde_t *copyuvm(pde_t *, uint); +void switchuvm(struct proc *); +void switchkvm(void); +int copyout(pde_t *, uint, void *, uint); +void clearpteu(pde_t *pgdir, char *uva); // number of elements in fixed-size array -#define NELEM(x) (sizeof(x)/sizeof((x)[0])) +#define NELEM(x) (sizeof(x) / sizeof((x)[0])) diff --git a/echo.asm b/echo.asm new file mode 100644 index 0000000000..df9a659aec --- /dev/null +++ b/echo.asm @@ -0,0 +1,1121 @@ + +_echo: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "stat.h" +#include "user.h" + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + 5: 53 push %ebx + 6: 83 e4 f0 and $0xfffffff0,%esp + 9: 83 ec 10 sub $0x10,%esp + c: 8b 75 08 mov 0x8(%ebp),%esi + f: 8b 7d 0c mov 0xc(%ebp),%edi + int i; + + for(i = 1; i < argc; i++) + 12: 83 fe 01 cmp $0x1,%esi + 15: 7e 58 jle 6f + 17: bb 01 00 00 00 mov $0x1,%ebx + 1c: eb 26 jmp 44 + 1e: 66 90 xchg %ax,%ax + printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); + 20: c7 44 24 0c 56 07 00 movl $0x756,0xc(%esp) + 27: 00 + 28: 8b 44 9f fc mov -0x4(%edi,%ebx,4),%eax + 2c: c7 44 24 04 58 07 00 movl $0x758,0x4(%esp) + 33: 00 + 34: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3b: 89 44 24 08 mov %eax,0x8(%esp) + 3f: e8 ac 03 00 00 call 3f0 + 44: 83 c3 01 add $0x1,%ebx + 47: 39 f3 cmp %esi,%ebx + 49: 75 d5 jne 20 + 4b: c7 44 24 0c 5d 07 00 movl $0x75d,0xc(%esp) + 52: 00 + 53: 8b 44 9f fc mov -0x4(%edi,%ebx,4),%eax + 57: c7 44 24 04 58 07 00 movl $0x758,0x4(%esp) + 5e: 00 + 5f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 66: 89 44 24 08 mov %eax,0x8(%esp) + 6a: e8 81 03 00 00 call 3f0 + exit(0); + 6f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 76: e8 27 02 00 00 call 2a2 + 7b: 66 90 xchg %ax,%ax + 7d: 66 90 xchg %ax,%ax + 7f: 90 nop + +00000080 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 80: 55 push %ebp + 81: 89 e5 mov %esp,%ebp + 83: 8b 45 08 mov 0x8(%ebp),%eax + 86: 8b 4d 0c mov 0xc(%ebp),%ecx + 89: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 8a: 89 c2 mov %eax,%edx + 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 90: 83 c1 01 add $0x1,%ecx + 93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 97: 83 c2 01 add $0x1,%edx + 9a: 84 db test %bl,%bl + 9c: 88 5a ff mov %bl,-0x1(%edx) + 9f: 75 ef jne 90 + ; + return os; +} + a1: 5b pop %ebx + a2: 5d pop %ebp + a3: c3 ret + a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000000b0 : + +int +strcmp(const char *p, const char *q) +{ + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 8b 55 08 mov 0x8(%ebp),%edx + b6: 53 push %ebx + b7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + ba: 0f b6 02 movzbl (%edx),%eax + bd: 84 c0 test %al,%al + bf: 74 2d je ee + c1: 0f b6 19 movzbl (%ecx),%ebx + c4: 38 d8 cmp %bl,%al + c6: 74 0e je d6 + c8: eb 2b jmp f5 + ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + d0: 38 c8 cmp %cl,%al + d2: 75 15 jne e9 + p++, q++; + d4: 89 d9 mov %ebx,%ecx + d6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + d9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + dc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + df: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + e3: 84 c0 test %al,%al + e5: 75 e9 jne d0 + e7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + e9: 29 c8 sub %ecx,%eax +} + eb: 5b pop %ebx + ec: 5d pop %ebp + ed: c3 ret + ee: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + f1: 31 c0 xor %eax,%eax + f3: eb f4 jmp e9 + f5: 0f b6 cb movzbl %bl,%ecx + f8: eb ef jmp e9 + fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000100 : + +uint +strlen(const char *s) +{ + 100: 55 push %ebp + 101: 89 e5 mov %esp,%ebp + 103: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 106: 80 39 00 cmpb $0x0,(%ecx) + 109: 74 12 je 11d + 10b: 31 d2 xor %edx,%edx + 10d: 8d 76 00 lea 0x0(%esi),%esi + 110: 83 c2 01 add $0x1,%edx + 113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 117: 89 d0 mov %edx,%eax + 119: 75 f5 jne 110 + ; + return n; +} + 11b: 5d pop %ebp + 11c: c3 ret + for(n = 0; s[n]; n++) + 11d: 31 c0 xor %eax,%eax +} + 11f: 5d pop %ebp + 120: c3 ret + 121: eb 0d jmp 130 + 123: 90 nop + 124: 90 nop + 125: 90 nop + 126: 90 nop + 127: 90 nop + 128: 90 nop + 129: 90 nop + 12a: 90 nop + 12b: 90 nop + 12c: 90 nop + 12d: 90 nop + 12e: 90 nop + 12f: 90 nop + +00000130 : + +void* +memset(void *dst, int c, uint n) +{ + 130: 55 push %ebp + 131: 89 e5 mov %esp,%ebp + 133: 8b 55 08 mov 0x8(%ebp),%edx + 136: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 137: 8b 4d 10 mov 0x10(%ebp),%ecx + 13a: 8b 45 0c mov 0xc(%ebp),%eax + 13d: 89 d7 mov %edx,%edi + 13f: fc cld + 140: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 142: 89 d0 mov %edx,%eax + 144: 5f pop %edi + 145: 5d pop %ebp + 146: c3 ret + 147: 89 f6 mov %esi,%esi + 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000150 : + +char* +strchr(const char *s, char c) +{ + 150: 55 push %ebp + 151: 89 e5 mov %esp,%ebp + 153: 8b 45 08 mov 0x8(%ebp),%eax + 156: 53 push %ebx + 157: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 15a: 0f b6 18 movzbl (%eax),%ebx + 15d: 84 db test %bl,%bl + 15f: 74 1d je 17e + if(*s == c) + 161: 38 d3 cmp %dl,%bl + 163: 89 d1 mov %edx,%ecx + 165: 75 0d jne 174 + 167: eb 17 jmp 180 + 169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 170: 38 ca cmp %cl,%dl + 172: 74 0c je 180 + for(; *s; s++) + 174: 83 c0 01 add $0x1,%eax + 177: 0f b6 10 movzbl (%eax),%edx + 17a: 84 d2 test %dl,%dl + 17c: 75 f2 jne 170 + return (char*)s; + return 0; + 17e: 31 c0 xor %eax,%eax +} + 180: 5b pop %ebx + 181: 5d pop %ebp + 182: c3 ret + 183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000190 : + +char* +gets(char *buf, int max) +{ + 190: 55 push %ebp + 191: 89 e5 mov %esp,%ebp + 193: 57 push %edi + 194: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 195: 31 f6 xor %esi,%esi +{ + 197: 53 push %ebx + 198: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 19b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 19e: eb 31 jmp 1d1 + cc = read(0, &c, 1); + 1a0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 1a7: 00 + 1a8: 89 7c 24 04 mov %edi,0x4(%esp) + 1ac: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1b3: e8 02 01 00 00 call 2ba + if(cc < 1) + 1b8: 85 c0 test %eax,%eax + 1ba: 7e 1d jle 1d9 + break; + buf[i++] = c; + 1bc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 1c0: 89 de mov %ebx,%esi + buf[i++] = c; + 1c2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 1c5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 1c7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 1cb: 74 0c je 1d9 + 1cd: 3c 0a cmp $0xa,%al + 1cf: 74 08 je 1d9 + for(i=0; i+1 < max; ){ + 1d1: 8d 5e 01 lea 0x1(%esi),%ebx + 1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1d7: 7c c7 jl 1a0 + break; + } + buf[i] = '\0'; + 1d9: 8b 45 08 mov 0x8(%ebp),%eax + 1dc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 1e0: 83 c4 2c add $0x2c,%esp + 1e3: 5b pop %ebx + 1e4: 5e pop %esi + 1e5: 5f pop %edi + 1e6: 5d pop %ebp + 1e7: c3 ret + 1e8: 90 nop + 1e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001f0 : + +int +stat(const char *n, struct stat *st) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 56 push %esi + 1f4: 53 push %ebx + 1f5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1f8: 8b 45 08 mov 0x8(%ebp),%eax + 1fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 202: 00 + 203: 89 04 24 mov %eax,(%esp) + 206: e8 d7 00 00 00 call 2e2 + if(fd < 0) + 20b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 20d: 89 c3 mov %eax,%ebx + if(fd < 0) + 20f: 78 27 js 238 + return -1; + r = fstat(fd, st); + 211: 8b 45 0c mov 0xc(%ebp),%eax + 214: 89 1c 24 mov %ebx,(%esp) + 217: 89 44 24 04 mov %eax,0x4(%esp) + 21b: e8 da 00 00 00 call 2fa + close(fd); + 220: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 223: 89 c6 mov %eax,%esi + close(fd); + 225: e8 a0 00 00 00 call 2ca + return r; + 22a: 89 f0 mov %esi,%eax +} + 22c: 83 c4 10 add $0x10,%esp + 22f: 5b pop %ebx + 230: 5e pop %esi + 231: 5d pop %ebp + 232: c3 ret + 233: 90 nop + 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 238: b8 ff ff ff ff mov $0xffffffff,%eax + 23d: eb ed jmp 22c + 23f: 90 nop + +00000240 : + +int +atoi(const char *s) +{ + 240: 55 push %ebp + 241: 89 e5 mov %esp,%ebp + 243: 8b 4d 08 mov 0x8(%ebp),%ecx + 246: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 247: 0f be 11 movsbl (%ecx),%edx + 24a: 8d 42 d0 lea -0x30(%edx),%eax + 24d: 3c 09 cmp $0x9,%al + n = 0; + 24f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 254: 77 17 ja 26d + 256: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 258: 83 c1 01 add $0x1,%ecx + 25b: 8d 04 80 lea (%eax,%eax,4),%eax + 25e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 262: 0f be 11 movsbl (%ecx),%edx + 265: 8d 5a d0 lea -0x30(%edx),%ebx + 268: 80 fb 09 cmp $0x9,%bl + 26b: 76 eb jbe 258 + return n; +} + 26d: 5b pop %ebx + 26e: 5d pop %ebp + 26f: c3 ret + +00000270 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 270: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 271: 31 d2 xor %edx,%edx +{ + 273: 89 e5 mov %esp,%ebp + 275: 56 push %esi + 276: 8b 45 08 mov 0x8(%ebp),%eax + 279: 53 push %ebx + 27a: 8b 5d 10 mov 0x10(%ebp),%ebx + 27d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 280: 85 db test %ebx,%ebx + 282: 7e 12 jle 296 + 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 28c: 88 0c 10 mov %cl,(%eax,%edx,1) + 28f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 292: 39 da cmp %ebx,%edx + 294: 75 f2 jne 288 + return vdst; +} + 296: 5b pop %ebx + 297: 5e pop %esi + 298: 5d pop %ebp + 299: c3 ret + +0000029a : + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + +000002f2 : + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + +000002fa : + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + +00000302 : + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + +0000030a : + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + +00000312 : + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + +0000031a : + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + +00000322 : + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + +0000032a : + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + +00000332 : + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + +0000033a : + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret + 342: 66 90 xchg %ax,%ax + 344: 66 90 xchg %ax,%ax + 346: 66 90 xchg %ax,%ax + 348: 66 90 xchg %ax,%ax + 34a: 66 90 xchg %ax,%ax + 34c: 66 90 xchg %ax,%ax + 34e: 66 90 xchg %ax,%ax + +00000350 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 350: 55 push %ebp + 351: 89 e5 mov %esp,%ebp + 353: 57 push %edi + 354: 56 push %esi + 355: 89 c6 mov %eax,%esi + 357: 53 push %ebx + 358: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 35b: 8b 5d 08 mov 0x8(%ebp),%ebx + 35e: 85 db test %ebx,%ebx + 360: 74 09 je 36b + 362: 89 d0 mov %edx,%eax + 364: c1 e8 1f shr $0x1f,%eax + 367: 84 c0 test %al,%al + 369: 75 75 jne 3e0 + neg = 1; + x = -xx; + } else { + x = xx; + 36b: 89 d0 mov %edx,%eax + neg = 0; + 36d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 374: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 377: 31 ff xor %edi,%edi + 379: 89 ce mov %ecx,%esi + 37b: 8d 5d d7 lea -0x29(%ebp),%ebx + 37e: eb 02 jmp 382 + do{ + buf[i++] = digits[x % base]; + 380: 89 cf mov %ecx,%edi + 382: 31 d2 xor %edx,%edx + 384: f7 f6 div %esi + 386: 8d 4f 01 lea 0x1(%edi),%ecx + 389: 0f b6 92 66 07 00 00 movzbl 0x766(%edx),%edx + }while((x /= base) != 0); + 390: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 392: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 395: 75 e9 jne 380 + if(neg) + 397: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 39a: 89 c8 mov %ecx,%eax + 39c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 39f: 85 d2 test %edx,%edx + 3a1: 74 08 je 3ab + buf[i++] = '-'; + 3a3: 8d 4f 02 lea 0x2(%edi),%ecx + 3a6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 3ab: 8d 79 ff lea -0x1(%ecx),%edi + 3ae: 66 90 xchg %ax,%ax + 3b0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 3b5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 3b8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3bf: 00 + 3c0: 89 5c 24 04 mov %ebx,0x4(%esp) + 3c4: 89 34 24 mov %esi,(%esp) + 3c7: 88 45 d7 mov %al,-0x29(%ebp) + 3ca: e8 f3 fe ff ff call 2c2 + while(--i >= 0) + 3cf: 83 ff ff cmp $0xffffffff,%edi + 3d2: 75 dc jne 3b0 + putc(fd, buf[i]); +} + 3d4: 83 c4 4c add $0x4c,%esp + 3d7: 5b pop %ebx + 3d8: 5e pop %esi + 3d9: 5f pop %edi + 3da: 5d pop %ebp + 3db: c3 ret + 3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 3e0: 89 d0 mov %edx,%eax + 3e2: f7 d8 neg %eax + neg = 1; + 3e4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 3eb: eb 87 jmp 374 + 3ed: 8d 76 00 lea 0x0(%esi),%esi + +000003f0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3f0: 55 push %ebp + 3f1: 89 e5 mov %esp,%ebp + 3f3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3f4: 31 ff xor %edi,%edi +{ + 3f6: 56 push %esi + 3f7: 53 push %ebx + 3f8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3fb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3fe: 8d 45 10 lea 0x10(%ebp),%eax +{ + 401: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 404: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 407: 0f b6 13 movzbl (%ebx),%edx + 40a: 83 c3 01 add $0x1,%ebx + 40d: 84 d2 test %dl,%dl + 40f: 75 39 jne 44a + 411: e9 c2 00 00 00 jmp 4d8 + 416: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 418: 83 fa 25 cmp $0x25,%edx + 41b: 0f 84 bf 00 00 00 je 4e0 + write(fd, &c, 1); + 421: 8d 45 e2 lea -0x1e(%ebp),%eax + 424: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 42b: 00 + 42c: 89 44 24 04 mov %eax,0x4(%esp) + 430: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 433: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 436: e8 87 fe ff ff call 2c2 + 43b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 43e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 442: 84 d2 test %dl,%dl + 444: 0f 84 8e 00 00 00 je 4d8 + if(state == 0){ + 44a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 44c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 44f: 74 c7 je 418 + } + } else if(state == '%'){ + 451: 83 ff 25 cmp $0x25,%edi + 454: 75 e5 jne 43b + if(c == 'd'){ + 456: 83 fa 64 cmp $0x64,%edx + 459: 0f 84 31 01 00 00 je 590 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 45f: 25 f7 00 00 00 and $0xf7,%eax + 464: 83 f8 70 cmp $0x70,%eax + 467: 0f 84 83 00 00 00 je 4f0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 46d: 83 fa 73 cmp $0x73,%edx + 470: 0f 84 a2 00 00 00 je 518 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 476: 83 fa 63 cmp $0x63,%edx + 479: 0f 84 35 01 00 00 je 5b4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 47f: 83 fa 25 cmp $0x25,%edx + 482: 0f 84 e0 00 00 00 je 568 + write(fd, &c, 1); + 488: 8d 45 e6 lea -0x1a(%ebp),%eax + 48b: 83 c3 01 add $0x1,%ebx + 48e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 495: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 496: 31 ff xor %edi,%edi + write(fd, &c, 1); + 498: 89 44 24 04 mov %eax,0x4(%esp) + 49c: 89 34 24 mov %esi,(%esp) + 49f: 89 55 d0 mov %edx,-0x30(%ebp) + 4a2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 4a6: e8 17 fe ff ff call 2c2 + putc(fd, c); + 4ab: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 4ae: 8d 45 e7 lea -0x19(%ebp),%eax + 4b1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4b8: 00 + 4b9: 89 44 24 04 mov %eax,0x4(%esp) + 4bd: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4c0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4c3: e8 fa fd ff ff call 2c2 + for(i = 0; fmt[i]; i++){ + 4c8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4cc: 84 d2 test %dl,%dl + 4ce: 0f 85 76 ff ff ff jne 44a + 4d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4d8: 83 c4 3c add $0x3c,%esp + 4db: 5b pop %ebx + 4dc: 5e pop %esi + 4dd: 5f pop %edi + 4de: 5d pop %ebp + 4df: c3 ret + state = '%'; + 4e0: bf 25 00 00 00 mov $0x25,%edi + 4e5: e9 51 ff ff ff jmp 43b + 4ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4f0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4f3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4f8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4fa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 501: 8b 10 mov (%eax),%edx + 503: 89 f0 mov %esi,%eax + 505: e8 46 fe ff ff call 350 + ap++; + 50a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 50e: e9 28 ff ff ff jmp 43b + 513: 90 nop + 514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 518: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 51b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 51f: 8b 38 mov (%eax),%edi + s = "(null)"; + 521: b8 5f 07 00 00 mov $0x75f,%eax + 526: 85 ff test %edi,%edi + 528: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 52b: 0f b6 07 movzbl (%edi),%eax + 52e: 84 c0 test %al,%al + 530: 74 2a je 55c + 532: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 538: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 53b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 53e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 541: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 548: 00 + 549: 89 44 24 04 mov %eax,0x4(%esp) + 54d: 89 34 24 mov %esi,(%esp) + 550: e8 6d fd ff ff call 2c2 + while(*s != 0){ + 555: 0f b6 07 movzbl (%edi),%eax + 558: 84 c0 test %al,%al + 55a: 75 dc jne 538 + state = 0; + 55c: 31 ff xor %edi,%edi + 55e: e9 d8 fe ff ff jmp 43b + 563: 90 nop + 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 568: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 56b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 56d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 574: 00 + 575: 89 44 24 04 mov %eax,0x4(%esp) + 579: 89 34 24 mov %esi,(%esp) + 57c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 580: e8 3d fd ff ff call 2c2 + 585: e9 b1 fe ff ff jmp 43b + 58a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 590: 8b 45 d4 mov -0x2c(%ebp),%eax + 593: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 598: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 59b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 5a2: 8b 10 mov (%eax),%edx + 5a4: 89 f0 mov %esi,%eax + 5a6: e8 a5 fd ff ff call 350 + ap++; + 5ab: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5af: e9 87 fe ff ff jmp 43b + putc(fd, *ap); + 5b4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 5b7: 31 ff xor %edi,%edi + putc(fd, *ap); + 5b9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 5bb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5c2: 00 + 5c3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 5c6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 5c9: 8d 45 e4 lea -0x1c(%ebp),%eax + 5cc: 89 44 24 04 mov %eax,0x4(%esp) + 5d0: e8 ed fc ff ff call 2c2 + ap++; + 5d5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5d9: e9 5d fe ff ff jmp 43b + 5de: 66 90 xchg %ax,%ax + +000005e0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 5e0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e1: a1 e0 09 00 00 mov 0x9e0,%eax +{ + 5e6: 89 e5 mov %esp,%ebp + 5e8: 57 push %edi + 5e9: 56 push %esi + 5ea: 53 push %ebx + 5eb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5ee: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5f0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5f3: 39 d0 cmp %edx,%eax + 5f5: 72 11 jb 608 + 5f7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5f8: 39 c8 cmp %ecx,%eax + 5fa: 72 04 jb 600 + 5fc: 39 ca cmp %ecx,%edx + 5fe: 72 10 jb 610 + 600: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 602: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 604: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 606: 73 f0 jae 5f8 + 608: 39 ca cmp %ecx,%edx + 60a: 72 04 jb 610 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 60c: 39 c8 cmp %ecx,%eax + 60e: 72 f0 jb 600 + break; + if(bp + bp->s.size == p->s.ptr){ + 610: 8b 73 fc mov -0x4(%ebx),%esi + 613: 8d 3c f2 lea (%edx,%esi,8),%edi + 616: 39 cf cmp %ecx,%edi + 618: 74 1e je 638 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 61a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 61d: 8b 48 04 mov 0x4(%eax),%ecx + 620: 8d 34 c8 lea (%eax,%ecx,8),%esi + 623: 39 f2 cmp %esi,%edx + 625: 74 28 je 64f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 627: 89 10 mov %edx,(%eax) + freep = p; + 629: a3 e0 09 00 00 mov %eax,0x9e0 +} + 62e: 5b pop %ebx + 62f: 5e pop %esi + 630: 5f pop %edi + 631: 5d pop %ebp + 632: c3 ret + 633: 90 nop + 634: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 638: 03 71 04 add 0x4(%ecx),%esi + 63b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 63e: 8b 08 mov (%eax),%ecx + 640: 8b 09 mov (%ecx),%ecx + 642: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 645: 8b 48 04 mov 0x4(%eax),%ecx + 648: 8d 34 c8 lea (%eax,%ecx,8),%esi + 64b: 39 f2 cmp %esi,%edx + 64d: 75 d8 jne 627 + p->s.size += bp->s.size; + 64f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 652: a3 e0 09 00 00 mov %eax,0x9e0 + p->s.size += bp->s.size; + 657: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 65a: 8b 53 f8 mov -0x8(%ebx),%edx + 65d: 89 10 mov %edx,(%eax) +} + 65f: 5b pop %ebx + 660: 5e pop %esi + 661: 5f pop %edi + 662: 5d pop %ebp + 663: c3 ret + 664: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 66a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000670 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 670: 55 push %ebp + 671: 89 e5 mov %esp,%ebp + 673: 57 push %edi + 674: 56 push %esi + 675: 53 push %ebx + 676: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 679: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 67c: 8b 1d e0 09 00 00 mov 0x9e0,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 682: 8d 48 07 lea 0x7(%eax),%ecx + 685: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 688: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 68a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 68d: 0f 84 9b 00 00 00 je 72e + 693: 8b 13 mov (%ebx),%edx + 695: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 698: 39 fe cmp %edi,%esi + 69a: 76 64 jbe 700 + 69c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 6a3: bb 00 80 00 00 mov $0x8000,%ebx + 6a8: 89 45 e4 mov %eax,-0x1c(%ebp) + 6ab: eb 0e jmp 6bb + 6ad: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 6b0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 6b2: 8b 78 04 mov 0x4(%eax),%edi + 6b5: 39 fe cmp %edi,%esi + 6b7: 76 4f jbe 708 + 6b9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 6bb: 3b 15 e0 09 00 00 cmp 0x9e0,%edx + 6c1: 75 ed jne 6b0 + if(nu < 4096) + 6c3: 8b 45 e4 mov -0x1c(%ebp),%eax + 6c6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 6cc: bf 00 10 00 00 mov $0x1000,%edi + 6d1: 0f 43 fe cmovae %esi,%edi + 6d4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 6d7: 89 04 24 mov %eax,(%esp) + 6da: e8 4b fc ff ff call 32a + if(p == (char*)-1) + 6df: 83 f8 ff cmp $0xffffffff,%eax + 6e2: 74 18 je 6fc + hp->s.size = nu; + 6e4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 6e7: 83 c0 08 add $0x8,%eax + 6ea: 89 04 24 mov %eax,(%esp) + 6ed: e8 ee fe ff ff call 5e0 + return freep; + 6f2: 8b 15 e0 09 00 00 mov 0x9e0,%edx + if((p = morecore(nunits)) == 0) + 6f8: 85 d2 test %edx,%edx + 6fa: 75 b4 jne 6b0 + return 0; + 6fc: 31 c0 xor %eax,%eax + 6fe: eb 20 jmp 720 + if(p->s.size >= nunits){ + 700: 89 d0 mov %edx,%eax + 702: 89 da mov %ebx,%edx + 704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 708: 39 fe cmp %edi,%esi + 70a: 74 1c je 728 + p->s.size -= nunits; + 70c: 29 f7 sub %esi,%edi + 70e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 711: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 714: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 717: 89 15 e0 09 00 00 mov %edx,0x9e0 + return (void*)(p + 1); + 71d: 83 c0 08 add $0x8,%eax + } +} + 720: 83 c4 1c add $0x1c,%esp + 723: 5b pop %ebx + 724: 5e pop %esi + 725: 5f pop %edi + 726: 5d pop %ebp + 727: c3 ret + prevp->s.ptr = p->s.ptr; + 728: 8b 08 mov (%eax),%ecx + 72a: 89 0a mov %ecx,(%edx) + 72c: eb e9 jmp 717 + base.s.ptr = freep = prevp = &base; + 72e: c7 05 e0 09 00 00 e4 movl $0x9e4,0x9e0 + 735: 09 00 00 + base.s.size = 0; + 738: ba e4 09 00 00 mov $0x9e4,%edx + base.s.ptr = freep = prevp = &base; + 73d: c7 05 e4 09 00 00 e4 movl $0x9e4,0x9e4 + 744: 09 00 00 + base.s.size = 0; + 747: c7 05 e8 09 00 00 00 movl $0x0,0x9e8 + 74e: 00 00 00 + 751: e9 46 ff ff ff jmp 69c diff --git a/echo.c b/echo.c index 806dee0316..eed68a0c4f 100644 --- a/echo.c +++ b/echo.c @@ -9,5 +9,5 @@ main(int argc, char *argv[]) for(i = 1; i < argc; i++) printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); - exit(); + exit(0); } diff --git a/echo.d b/echo.d new file mode 100644 index 0000000000..16a6098f7a --- /dev/null +++ b/echo.d @@ -0,0 +1 @@ +echo.o: echo.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/echo.o b/echo.o new file mode 100644 index 0000000000..1b628065ea Binary files /dev/null and b/echo.o differ diff --git a/echo.sym b/echo.sym new file mode 100644 index 0000000000..35919cc854 --- /dev/null +++ b/echo.sym @@ -0,0 +1,57 @@ +00000000 .text +00000756 .rodata +00000778 .eh_frame +000009e0 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 echo.c +00000000 ulib.c +00000000 printf.c +00000350 printint +00000766 digits.1354 +00000000 umalloc.c +000009e0 freep +000009e4 base +00000080 strcpy +000003f0 printf +00000270 memmove +000002ea mknod +00000190 gets +00000322 getpid +00000670 malloc +00000332 sleep +000002b2 pipe +000002c2 write +000002fa fstat +000002d2 kill +00000312 chdir +000002da exec +000002aa wait +000002ba read +000002f2 unlink +0000029a fork +0000032a sbrk +0000033a uptime +000009e0 __bss_start +00000130 memset +00000000 main +000000b0 strcmp +0000031a dup +000001f0 stat +000009e0 _edata +000009ec _end +00000302 link +000002a2 exit +00000240 atoi +00000100 strlen +000002e2 open +00000150 strchr +0000030a mkdir +000002ca close +000005e0 free diff --git a/entry.o b/entry.o new file mode 100644 index 0000000000..ba1e06649b Binary files /dev/null and b/entry.o differ diff --git a/entryother b/entryother new file mode 100755 index 0000000000..a7673dec6c Binary files /dev/null and b/entryother differ diff --git a/entryother.asm b/entryother.asm new file mode 100644 index 0000000000..c845a5d2a1 --- /dev/null +++ b/entryother.asm @@ -0,0 +1,125 @@ + +bootblockother.o: file format elf32-i386 + + +Disassembly of section .text: + +00007000 : +# This code combines elements of bootasm.S and entry.S. + +.code16 +.globl start +start: + cli + 7000: fa cli + + # Zero data segment registers DS, ES, and SS. + xorw %ax,%ax + 7001: 31 c0 xor %eax,%eax + movw %ax,%ds + 7003: 8e d8 mov %eax,%ds + movw %ax,%es + 7005: 8e c0 mov %eax,%es + movw %ax,%ss + 7007: 8e d0 mov %eax,%ss + + # Switch from real to protected mode. Use a bootstrap GDT that makes + # virtual addresses map directly to physical addresses so that the + # effective memory map doesn't change during the transition. + lgdt gdtdesc + 7009: 0f 01 16 lgdtl (%esi) + 700c: 84 70 0f test %dh,0xf(%eax) + movl %cr0, %eax + 700f: 20 c0 and %al,%al + orl $CR0_PE, %eax + 7011: 66 83 c8 01 or $0x1,%ax + movl %eax, %cr0 + 7015: 0f 22 c0 mov %eax,%cr0 + + # Complete the transition to 32-bit protected mode by using a long jmp + # to reload %cs and %eip. The segment descriptors are set up with no + # translation, so that the mapping is still the identity mapping. + ljmpl $(SEG_KCODE<<3), $(start32) + 7018: 66 ea 20 70 00 00 ljmpw $0x0,$0x7020 + 701e: 08 00 or %al,(%eax) + +00007020 : + +//PAGEBREAK! +.code32 # Tell assembler to generate 32-bit code now. +start32: + # Set up the protected-mode data segment registers + movw $(SEG_KDATA<<3), %ax # Our data segment selector + 7020: 66 b8 10 00 mov $0x10,%ax + movw %ax, %ds # -> DS: Data Segment + 7024: 8e d8 mov %eax,%ds + movw %ax, %es # -> ES: Extra Segment + 7026: 8e c0 mov %eax,%es + movw %ax, %ss # -> SS: Stack Segment + 7028: 8e d0 mov %eax,%ss + movw $0, %ax # Zero segments not ready for use + 702a: 66 b8 00 00 mov $0x0,%ax + movw %ax, %fs # -> FS + 702e: 8e e0 mov %eax,%fs + movw %ax, %gs # -> GS + 7030: 8e e8 mov %eax,%gs + + # Turn on page size extension for 4Mbyte pages + movl %cr4, %eax + 7032: 0f 20 e0 mov %cr4,%eax + orl $(CR4_PSE), %eax + 7035: 83 c8 10 or $0x10,%eax + movl %eax, %cr4 + 7038: 0f 22 e0 mov %eax,%cr4 + # Use entrypgdir as our initial page table + movl (start-12), %eax + 703b: a1 f4 6f 00 00 mov 0x6ff4,%eax + movl %eax, %cr3 + 7040: 0f 22 d8 mov %eax,%cr3 + # Turn on paging. + movl %cr0, %eax + 7043: 0f 20 c0 mov %cr0,%eax + orl $(CR0_PE|CR0_PG|CR0_WP), %eax + 7046: 0d 01 00 01 80 or $0x80010001,%eax + movl %eax, %cr0 + 704b: 0f 22 c0 mov %eax,%cr0 + + # Switch to the stack allocated by startothers() + movl (start-4), %esp + 704e: 8b 25 fc 6f 00 00 mov 0x6ffc,%esp + # Call mpenter() + call *(start-8) + 7054: ff 15 f8 6f 00 00 call *0x6ff8 + + movw $0x8a00, %ax + 705a: 66 b8 00 8a mov $0x8a00,%ax + movw %ax, %dx + 705e: 66 89 c2 mov %ax,%dx + outw %ax, %dx + 7061: 66 ef out %ax,(%dx) + movw $0x8ae0, %ax + 7063: 66 b8 e0 8a mov $0x8ae0,%ax + outw %ax, %dx + 7067: 66 ef out %ax,(%dx) + +00007069 : +spin: + jmp spin + 7069: eb fe jmp 7069 + 706b: 90 nop + +0000706c : + ... + 7074: ff (bad) + 7075: ff 00 incl (%eax) + 7077: 00 00 add %al,(%eax) + 7079: 9a cf 00 ff ff 00 00 lcall $0x0,$0xffff00cf + 7080: 00 .byte 0x0 + 7081: 92 xchg %eax,%edx + 7082: cf iret + ... + +00007084 : + 7084: 17 pop %ss + 7085: 00 6c 70 00 add %ch,0x0(%eax,%esi,2) + ... diff --git a/entryother.d b/entryother.d new file mode 100644 index 0000000000..a140303003 --- /dev/null +++ b/entryother.d @@ -0,0 +1 @@ +entryother.o: entryother.S asm.h memlayout.h mmu.h diff --git a/entryother.o b/entryother.o new file mode 100644 index 0000000000..1080d5a991 Binary files /dev/null and b/entryother.o differ diff --git a/exec.d b/exec.d new file mode 100644 index 0000000000..04002757a5 --- /dev/null +++ b/exec.d @@ -0,0 +1,2 @@ +exec.o: exec.c /usr/include/stdc-predef.h types.h param.h memlayout.h \ + mmu.h proc.h defs.h x86.h elf.h diff --git a/exec.o b/exec.o new file mode 100644 index 0000000000..2fad1f32bf Binary files /dev/null and b/exec.o differ diff --git a/file.d b/file.d new file mode 100644 index 0000000000..fea73d11dd --- /dev/null +++ b/file.d @@ -0,0 +1,2 @@ +file.o: file.c /usr/include/stdc-predef.h types.h defs.h param.h fs.h \ + spinlock.h sleeplock.h file.h diff --git a/file.o b/file.o new file mode 100644 index 0000000000..7a7c5e2a95 Binary files /dev/null and b/file.o differ diff --git a/forktest.asm b/forktest.asm new file mode 100644 index 0000000000..f5c1257a6e --- /dev/null +++ b/forktest.asm @@ -0,0 +1,623 @@ + +_forktest: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + + printf(1, "fork test OK\n"); +} + +int main(void) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp + 6: 83 ec 10 sub $0x10,%esp + forktest(); + 9: e8 42 00 00 00 call 50 + exit(0); + e: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 15: e8 58 03 00 00 call 372 + 1a: 66 90 xchg %ax,%ax + 1c: 66 90 xchg %ax,%ax + 1e: 66 90 xchg %ax,%ax + +00000020 : +{ + 20: 55 push %ebp + 21: 89 e5 mov %esp,%ebp + 23: 53 push %ebx + 24: 83 ec 14 sub $0x14,%esp + 27: 8b 5d 0c mov 0xc(%ebp),%ebx + write(fd, s, strlen(s)); + 2a: 89 1c 24 mov %ebx,(%esp) + 2d: e8 9e 01 00 00 call 1d0 + 32: 89 5c 24 04 mov %ebx,0x4(%esp) + 36: 89 44 24 08 mov %eax,0x8(%esp) + 3a: 8b 45 08 mov 0x8(%ebp),%eax + 3d: 89 04 24 mov %eax,(%esp) + 40: e8 4d 03 00 00 call 392 +} + 45: 83 c4 14 add $0x14,%esp + 48: 5b pop %ebx + 49: 5d pop %ebp + 4a: c3 ret + 4b: 90 nop + 4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +00000050 : +{ + 50: 55 push %ebp + 51: 89 e5 mov %esp,%ebp + 53: 53 push %ebx + for (n = 0; n < N; n++) + 54: 31 db xor %ebx,%ebx +{ + 56: 83 ec 14 sub $0x14,%esp + printf(1, "fork test\n"); + 59: c7 44 24 04 14 04 00 movl $0x414,0x4(%esp) + 60: 00 + 61: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 68: e8 b3 ff ff ff call 20 + 6d: eb 13 jmp 82 + 6f: 90 nop + if (pid == 0) + 70: 0f 84 a6 00 00 00 je 11c + for (n = 0; n < N; n++) + 76: 83 c3 01 add $0x1,%ebx + 79: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 7f: 90 nop + 80: 74 56 je d8 + pid = fork(); + 82: e8 e3 02 00 00 call 36a + if (pid < 0) + 87: 85 c0 test %eax,%eax + 89: 79 e5 jns 70 + for (; n > 0; n--) + 8b: 85 db test %ebx,%ebx + 8d: 8d 76 00 lea 0x0(%esi),%esi + 90: 74 1b je ad + 92: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if (wait(0) < 0) + 98: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 9f: e8 d6 02 00 00 call 37a + a4: 85 c0 test %eax,%eax + a6: 78 60 js 108 + for (; n > 0; n--) + a8: 83 eb 01 sub $0x1,%ebx + ab: 75 eb jne 98 + if (wait(0) != -1) + ad: c7 04 24 00 00 00 00 movl $0x0,(%esp) + b4: e8 c1 02 00 00 call 37a + b9: 83 f8 ff cmp $0xffffffff,%eax + bc: 75 6a jne 128 + printf(1, "fork test OK\n"); + be: c7 44 24 04 46 04 00 movl $0x446,0x4(%esp) + c5: 00 + c6: c7 04 24 01 00 00 00 movl $0x1,(%esp) + cd: e8 4e ff ff ff call 20 +} + d2: 83 c4 14 add $0x14,%esp + d5: 5b pop %ebx + d6: 5d pop %ebp + d7: c3 ret + write(fd, s, strlen(s)); + d8: c7 04 24 54 04 00 00 movl $0x454,(%esp) + df: e8 ec 00 00 00 call 1d0 + e4: c7 44 24 04 54 04 00 movl $0x454,0x4(%esp) + eb: 00 + ec: c7 04 24 01 00 00 00 movl $0x1,(%esp) + f3: 89 44 24 08 mov %eax,0x8(%esp) + f7: e8 96 02 00 00 call 392 + exit(0); + fc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 103: e8 6a 02 00 00 call 372 + printf(1, "wait stopped early\n"); + 108: c7 44 24 04 1f 04 00 movl $0x41f,0x4(%esp) + 10f: 00 + 110: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 117: e8 04 ff ff ff call 20 + exit(0); + 11c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 123: e8 4a 02 00 00 call 372 + printf(1, "wait got too many\n"); + 128: c7 44 24 04 33 04 00 movl $0x433,0x4(%esp) + 12f: 00 + 130: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 137: e8 e4 fe ff ff call 20 + exit(0); + 13c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 143: e8 2a 02 00 00 call 372 + 148: 66 90 xchg %ax,%ax + 14a: 66 90 xchg %ax,%ax + 14c: 66 90 xchg %ax,%ax + 14e: 66 90 xchg %ax,%ax + +00000150 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 150: 55 push %ebp + 151: 89 e5 mov %esp,%ebp + 153: 8b 45 08 mov 0x8(%ebp),%eax + 156: 8b 4d 0c mov 0xc(%ebp),%ecx + 159: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 15a: 89 c2 mov %eax,%edx + 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 160: 83 c1 01 add $0x1,%ecx + 163: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 167: 83 c2 01 add $0x1,%edx + 16a: 84 db test %bl,%bl + 16c: 88 5a ff mov %bl,-0x1(%edx) + 16f: 75 ef jne 160 + ; + return os; +} + 171: 5b pop %ebx + 172: 5d pop %ebp + 173: c3 ret + 174: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 17a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000180 : + +int +strcmp(const char *p, const char *q) +{ + 180: 55 push %ebp + 181: 89 e5 mov %esp,%ebp + 183: 8b 55 08 mov 0x8(%ebp),%edx + 186: 53 push %ebx + 187: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 18a: 0f b6 02 movzbl (%edx),%eax + 18d: 84 c0 test %al,%al + 18f: 74 2d je 1be + 191: 0f b6 19 movzbl (%ecx),%ebx + 194: 38 d8 cmp %bl,%al + 196: 74 0e je 1a6 + 198: eb 2b jmp 1c5 + 19a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 1a0: 38 c8 cmp %cl,%al + 1a2: 75 15 jne 1b9 + p++, q++; + 1a4: 89 d9 mov %ebx,%ecx + 1a6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 1a9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 1ac: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 1af: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 1b3: 84 c0 test %al,%al + 1b5: 75 e9 jne 1a0 + 1b7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 1b9: 29 c8 sub %ecx,%eax +} + 1bb: 5b pop %ebx + 1bc: 5d pop %ebp + 1bd: c3 ret + 1be: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 1c1: 31 c0 xor %eax,%eax + 1c3: eb f4 jmp 1b9 + 1c5: 0f b6 cb movzbl %bl,%ecx + 1c8: eb ef jmp 1b9 + 1ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000001d0 : + +uint +strlen(const char *s) +{ + 1d0: 55 push %ebp + 1d1: 89 e5 mov %esp,%ebp + 1d3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 1d6: 80 39 00 cmpb $0x0,(%ecx) + 1d9: 74 12 je 1ed + 1db: 31 d2 xor %edx,%edx + 1dd: 8d 76 00 lea 0x0(%esi),%esi + 1e0: 83 c2 01 add $0x1,%edx + 1e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 1e7: 89 d0 mov %edx,%eax + 1e9: 75 f5 jne 1e0 + ; + return n; +} + 1eb: 5d pop %ebp + 1ec: c3 ret + for(n = 0; s[n]; n++) + 1ed: 31 c0 xor %eax,%eax +} + 1ef: 5d pop %ebp + 1f0: c3 ret + 1f1: eb 0d jmp 200 + 1f3: 90 nop + 1f4: 90 nop + 1f5: 90 nop + 1f6: 90 nop + 1f7: 90 nop + 1f8: 90 nop + 1f9: 90 nop + 1fa: 90 nop + 1fb: 90 nop + 1fc: 90 nop + 1fd: 90 nop + 1fe: 90 nop + 1ff: 90 nop + +00000200 : + +void* +memset(void *dst, int c, uint n) +{ + 200: 55 push %ebp + 201: 89 e5 mov %esp,%ebp + 203: 8b 55 08 mov 0x8(%ebp),%edx + 206: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 207: 8b 4d 10 mov 0x10(%ebp),%ecx + 20a: 8b 45 0c mov 0xc(%ebp),%eax + 20d: 89 d7 mov %edx,%edi + 20f: fc cld + 210: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 212: 89 d0 mov %edx,%eax + 214: 5f pop %edi + 215: 5d pop %ebp + 216: c3 ret + 217: 89 f6 mov %esi,%esi + 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000220 : + +char* +strchr(const char *s, char c) +{ + 220: 55 push %ebp + 221: 89 e5 mov %esp,%ebp + 223: 8b 45 08 mov 0x8(%ebp),%eax + 226: 53 push %ebx + 227: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 22a: 0f b6 18 movzbl (%eax),%ebx + 22d: 84 db test %bl,%bl + 22f: 74 1d je 24e + if(*s == c) + 231: 38 d3 cmp %dl,%bl + 233: 89 d1 mov %edx,%ecx + 235: 75 0d jne 244 + 237: eb 17 jmp 250 + 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 240: 38 ca cmp %cl,%dl + 242: 74 0c je 250 + for(; *s; s++) + 244: 83 c0 01 add $0x1,%eax + 247: 0f b6 10 movzbl (%eax),%edx + 24a: 84 d2 test %dl,%dl + 24c: 75 f2 jne 240 + return (char*)s; + return 0; + 24e: 31 c0 xor %eax,%eax +} + 250: 5b pop %ebx + 251: 5d pop %ebp + 252: c3 ret + 253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000260 : + +char* +gets(char *buf, int max) +{ + 260: 55 push %ebp + 261: 89 e5 mov %esp,%ebp + 263: 57 push %edi + 264: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 265: 31 f6 xor %esi,%esi +{ + 267: 53 push %ebx + 268: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 26b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 26e: eb 31 jmp 2a1 + cc = read(0, &c, 1); + 270: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 277: 00 + 278: 89 7c 24 04 mov %edi,0x4(%esp) + 27c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 283: e8 02 01 00 00 call 38a + if(cc < 1) + 288: 85 c0 test %eax,%eax + 28a: 7e 1d jle 2a9 + break; + buf[i++] = c; + 28c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 290: 89 de mov %ebx,%esi + buf[i++] = c; + 292: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 295: 3c 0d cmp $0xd,%al + buf[i++] = c; + 297: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 29b: 74 0c je 2a9 + 29d: 3c 0a cmp $0xa,%al + 29f: 74 08 je 2a9 + for(i=0; i+1 < max; ){ + 2a1: 8d 5e 01 lea 0x1(%esi),%ebx + 2a4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 2a7: 7c c7 jl 270 + break; + } + buf[i] = '\0'; + 2a9: 8b 45 08 mov 0x8(%ebp),%eax + 2ac: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 2b0: 83 c4 2c add $0x2c,%esp + 2b3: 5b pop %ebx + 2b4: 5e pop %esi + 2b5: 5f pop %edi + 2b6: 5d pop %ebp + 2b7: c3 ret + 2b8: 90 nop + 2b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000002c0 : + +int +stat(const char *n, struct stat *st) +{ + 2c0: 55 push %ebp + 2c1: 89 e5 mov %esp,%ebp + 2c3: 56 push %esi + 2c4: 53 push %ebx + 2c5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 2c8: 8b 45 08 mov 0x8(%ebp),%eax + 2cb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2d2: 00 + 2d3: 89 04 24 mov %eax,(%esp) + 2d6: e8 d7 00 00 00 call 3b2 + if(fd < 0) + 2db: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 2dd: 89 c3 mov %eax,%ebx + if(fd < 0) + 2df: 78 27 js 308 + return -1; + r = fstat(fd, st); + 2e1: 8b 45 0c mov 0xc(%ebp),%eax + 2e4: 89 1c 24 mov %ebx,(%esp) + 2e7: 89 44 24 04 mov %eax,0x4(%esp) + 2eb: e8 da 00 00 00 call 3ca + close(fd); + 2f0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 2f3: 89 c6 mov %eax,%esi + close(fd); + 2f5: e8 a0 00 00 00 call 39a + return r; + 2fa: 89 f0 mov %esi,%eax +} + 2fc: 83 c4 10 add $0x10,%esp + 2ff: 5b pop %ebx + 300: 5e pop %esi + 301: 5d pop %ebp + 302: c3 ret + 303: 90 nop + 304: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 308: b8 ff ff ff ff mov $0xffffffff,%eax + 30d: eb ed jmp 2fc + 30f: 90 nop + +00000310 : + +int +atoi(const char *s) +{ + 310: 55 push %ebp + 311: 89 e5 mov %esp,%ebp + 313: 8b 4d 08 mov 0x8(%ebp),%ecx + 316: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 317: 0f be 11 movsbl (%ecx),%edx + 31a: 8d 42 d0 lea -0x30(%edx),%eax + 31d: 3c 09 cmp $0x9,%al + n = 0; + 31f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 324: 77 17 ja 33d + 326: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 328: 83 c1 01 add $0x1,%ecx + 32b: 8d 04 80 lea (%eax,%eax,4),%eax + 32e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 332: 0f be 11 movsbl (%ecx),%edx + 335: 8d 5a d0 lea -0x30(%edx),%ebx + 338: 80 fb 09 cmp $0x9,%bl + 33b: 76 eb jbe 328 + return n; +} + 33d: 5b pop %ebx + 33e: 5d pop %ebp + 33f: c3 ret + +00000340 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 340: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 341: 31 d2 xor %edx,%edx +{ + 343: 89 e5 mov %esp,%ebp + 345: 56 push %esi + 346: 8b 45 08 mov 0x8(%ebp),%eax + 349: 53 push %ebx + 34a: 8b 5d 10 mov 0x10(%ebp),%ebx + 34d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 350: 85 db test %ebx,%ebx + 352: 7e 12 jle 366 + 354: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 358: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 35c: 88 0c 10 mov %cl,(%eax,%edx,1) + 35f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 362: 39 da cmp %ebx,%edx + 364: 75 f2 jne 358 + return vdst; +} + 366: 5b pop %ebx + 367: 5e pop %esi + 368: 5d pop %ebp + 369: c3 ret + +0000036a : + 36a: b8 01 00 00 00 mov $0x1,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + +00000372 : + 372: b8 02 00 00 00 mov $0x2,%eax + 377: cd 40 int $0x40 + 379: c3 ret + +0000037a : + 37a: b8 03 00 00 00 mov $0x3,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + +00000382 : + 382: b8 04 00 00 00 mov $0x4,%eax + 387: cd 40 int $0x40 + 389: c3 ret + +0000038a : + 38a: b8 05 00 00 00 mov $0x5,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + +00000392 : + 392: b8 10 00 00 00 mov $0x10,%eax + 397: cd 40 int $0x40 + 399: c3 ret + +0000039a : + 39a: b8 15 00 00 00 mov $0x15,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + +000003a2 : + 3a2: b8 06 00 00 00 mov $0x6,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + +000003aa : + 3aa: b8 07 00 00 00 mov $0x7,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + +000003b2 : + 3b2: b8 0f 00 00 00 mov $0xf,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + +000003ba : + 3ba: b8 11 00 00 00 mov $0x11,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + +000003c2 : + 3c2: b8 12 00 00 00 mov $0x12,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + +000003ca : + 3ca: b8 08 00 00 00 mov $0x8,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + +000003d2 : + 3d2: b8 13 00 00 00 mov $0x13,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + +000003da : + 3da: b8 14 00 00 00 mov $0x14,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + +000003e2 : + 3e2: b8 09 00 00 00 mov $0x9,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + +000003ea : + 3ea: b8 0a 00 00 00 mov $0xa,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + +000003f2 : + 3f2: b8 0b 00 00 00 mov $0xb,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + +000003fa : + 3fa: b8 0c 00 00 00 mov $0xc,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret + +00000402 : + 402: b8 0d 00 00 00 mov $0xd,%eax + 407: cd 40 int $0x40 + 409: c3 ret + +0000040a : + 40a: b8 0e 00 00 00 mov $0xe,%eax + 40f: cd 40 int $0x40 + 411: c3 ret diff --git a/forktest.c b/forktest.c index 8bc984d309..a9d0f38a0a 100644 --- a/forktest.c +++ b/forktest.c @@ -5,52 +5,54 @@ #include "stat.h" #include "user.h" -#define N 1000 +#define N 1000 -void -printf(int fd, const char *s, ...) +void printf(int fd, const char *s, ...) { write(fd, s, strlen(s)); } -void -forktest(void) +void forktest(void) { int n, pid; printf(1, "fork test\n"); - for(n=0; n 0; n--){ - if(wait() < 0){ + for (; n > 0; n--) + { + if (wait(0) < 0) + { printf(1, "wait stopped early\n"); - exit(); + exit(0); } } - if(wait() != -1){ + if (wait(0) != -1) + { printf(1, "wait got too many\n"); - exit(); + exit(0); } printf(1, "fork test OK\n"); } -int -main(void) +int main(void) { forktest(); - exit(); + exit(0); } diff --git a/forktest.d b/forktest.d new file mode 100644 index 0000000000..d31a0c2755 --- /dev/null +++ b/forktest.d @@ -0,0 +1 @@ +forktest.o: forktest.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/forktest.o b/forktest.o new file mode 100644 index 0000000000..9cc01e416e Binary files /dev/null and b/forktest.o differ diff --git a/fs.d b/fs.d new file mode 100644 index 0000000000..a1d05ccccb --- /dev/null +++ b/fs.d @@ -0,0 +1,2 @@ +fs.o: fs.c /usr/include/stdc-predef.h types.h defs.h param.h stat.h mmu.h \ + proc.h spinlock.h sleeplock.h fs.h buf.h file.h diff --git a/fs.img b/fs.img new file mode 100644 index 0000000000..ff887b95f6 Binary files /dev/null and b/fs.img differ diff --git a/fs.o b/fs.o new file mode 100644 index 0000000000..80c8b12ab3 Binary files /dev/null and b/fs.o differ diff --git a/grep.asm b/grep.asm new file mode 100644 index 0000000000..00a27e1430 --- /dev/null +++ b/grep.asm @@ -0,0 +1,1455 @@ + +_grep: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + } +} + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + 5: 53 push %ebx + 6: 83 e4 f0 and $0xfffffff0,%esp + 9: 83 ec 10 sub $0x10,%esp + c: 8b 5d 0c mov 0xc(%ebp),%ebx + int fd, i; + char *pattern; + + if(argc <= 1){ + f: 83 7d 08 01 cmpl $0x1,0x8(%ebp) + 13: 0f 8e a0 00 00 00 jle b9 + printf(2, "usage: grep pattern [file ...]\n"); + exit(0); + } + pattern = argv[1]; + 19: 8b 43 04 mov 0x4(%ebx),%eax + 1c: 83 c3 08 add $0x8,%ebx + + if(argc <= 2){ + 1f: be 02 00 00 00 mov $0x2,%esi + 24: 83 7d 08 02 cmpl $0x2,0x8(%ebp) + pattern = argv[1]; + 28: 89 44 24 0c mov %eax,0xc(%esp) + if(argc <= 2){ + 2c: 74 6f je 9d + 2e: 66 90 xchg %ax,%ax + grep(pattern, 0); + exit(0); + } + + for(i = 2; i < argc; i++){ + if((fd = open(argv[i], 0)) < 0){ + 30: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 37: 00 + 38: 8b 03 mov (%ebx),%eax + 3a: 89 04 24 mov %eax,(%esp) + 3d: e8 50 05 00 00 call 592 + 42: 85 c0 test %eax,%eax + 44: 89 c7 mov %eax,%edi + 46: 78 2f js 77 + printf(1, "grep: cannot open %s\n", argv[i]); + exit(0); + } + grep(pattern, fd); + 48: 89 44 24 04 mov %eax,0x4(%esp) + 4c: 8b 44 24 0c mov 0xc(%esp),%eax + for(i = 2; i < argc; i++){ + 50: 83 c6 01 add $0x1,%esi + 53: 83 c3 04 add $0x4,%ebx + grep(pattern, fd); + 56: 89 04 24 mov %eax,(%esp) + 59: e8 c2 01 00 00 call 220 + close(fd); + 5e: 89 3c 24 mov %edi,(%esp) + 61: e8 14 05 00 00 call 57a + for(i = 2; i < argc; i++){ + 66: 39 75 08 cmp %esi,0x8(%ebp) + 69: 7f c5 jg 30 + } + exit(0); + 6b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 72: e8 db 04 00 00 call 552 + printf(1, "grep: cannot open %s\n", argv[i]); + 77: 8b 03 mov (%ebx),%eax + 79: c7 44 24 04 28 0a 00 movl $0xa28,0x4(%esp) + 80: 00 + 81: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 88: 89 44 24 08 mov %eax,0x8(%esp) + 8c: e8 0f 06 00 00 call 6a0 + exit(0); + 91: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 98: e8 b5 04 00 00 call 552 + grep(pattern, 0); + 9d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + a4: 00 + a5: 89 04 24 mov %eax,(%esp) + a8: e8 73 01 00 00 call 220 + exit(0); + ad: c7 04 24 00 00 00 00 movl $0x0,(%esp) + b4: e8 99 04 00 00 call 552 + printf(2, "usage: grep pattern [file ...]\n"); + b9: c7 44 24 04 08 0a 00 movl $0xa08,0x4(%esp) + c0: 00 + c1: c7 04 24 02 00 00 00 movl $0x2,(%esp) + c8: e8 d3 05 00 00 call 6a0 + exit(0); + cd: c7 04 24 00 00 00 00 movl $0x0,(%esp) + d4: e8 79 04 00 00 call 552 + d9: 66 90 xchg %ax,%ax + db: 66 90 xchg %ax,%ax + dd: 66 90 xchg %ax,%ax + df: 90 nop + +000000e0 : + return 0; +} + +// matchstar: search for c*re at beginning of text +int matchstar(int c, char *re, char *text) +{ + e0: 55 push %ebp + e1: 89 e5 mov %esp,%ebp + e3: 57 push %edi + e4: 56 push %esi + e5: 53 push %ebx + e6: 83 ec 1c sub $0x1c,%esp + e9: 8b 75 08 mov 0x8(%ebp),%esi + ec: 8b 7d 0c mov 0xc(%ebp),%edi + ef: 8b 5d 10 mov 0x10(%ebp),%ebx + f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + do{ // a * matches zero or more instances + if(matchhere(re, text)) + f8: 89 5c 24 04 mov %ebx,0x4(%esp) + fc: 89 3c 24 mov %edi,(%esp) + ff: e8 3c 00 00 00 call 140 + 104: 85 c0 test %eax,%eax + 106: 75 20 jne 128 + return 1; + }while(*text!='\0' && (*text++==c || c=='.')); + 108: 0f be 13 movsbl (%ebx),%edx + 10b: 84 d2 test %dl,%dl + 10d: 74 0c je 11b + 10f: 83 c3 01 add $0x1,%ebx + 112: 39 f2 cmp %esi,%edx + 114: 74 e2 je f8 + 116: 83 fe 2e cmp $0x2e,%esi + 119: 74 dd je f8 + return 0; +} + 11b: 83 c4 1c add $0x1c,%esp + 11e: 5b pop %ebx + 11f: 5e pop %esi + 120: 5f pop %edi + 121: 5d pop %ebp + 122: c3 ret + 123: 90 nop + 124: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 128: 83 c4 1c add $0x1c,%esp + return 1; + 12b: b8 01 00 00 00 mov $0x1,%eax +} + 130: 5b pop %ebx + 131: 5e pop %esi + 132: 5f pop %edi + 133: 5d pop %ebp + 134: c3 ret + 135: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000140 : +{ + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 53 push %ebx + 144: 83 ec 14 sub $0x14,%esp + 147: 8b 55 08 mov 0x8(%ebp),%edx + 14a: 8b 4d 0c mov 0xc(%ebp),%ecx + if(re[0] == '\0') + 14d: 0f be 02 movsbl (%edx),%eax + 150: 84 c0 test %al,%al + 152: 75 20 jne 174 + 154: eb 42 jmp 198 + 156: 66 90 xchg %ax,%ax + if(*text!='\0' && (re[0]=='.' || re[0]==*text)) + 158: 0f b6 19 movzbl (%ecx),%ebx + 15b: 84 db test %bl,%bl + 15d: 74 31 je 190 + 15f: 3c 2e cmp $0x2e,%al + 161: 74 04 je 167 + 163: 38 d8 cmp %bl,%al + 165: 75 29 jne 190 + return matchhere(re+1, text+1); + 167: 83 c2 01 add $0x1,%edx + if(re[0] == '\0') + 16a: 0f be 02 movsbl (%edx),%eax + return matchhere(re+1, text+1); + 16d: 83 c1 01 add $0x1,%ecx + if(re[0] == '\0') + 170: 84 c0 test %al,%al + 172: 74 24 je 198 + if(re[1] == '*') + 174: 0f b6 5a 01 movzbl 0x1(%edx),%ebx + 178: 80 fb 2a cmp $0x2a,%bl + 17b: 74 2b je 1a8 + if(re[0] == '$' && re[1] == '\0') + 17d: 3c 24 cmp $0x24,%al + 17f: 75 d7 jne 158 + 181: 84 db test %bl,%bl + 183: 74 3c je 1c1 + if(*text!='\0' && (re[0]=='.' || re[0]==*text)) + 185: 0f b6 19 movzbl (%ecx),%ebx + 188: 84 db test %bl,%bl + 18a: 75 d7 jne 163 + 18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return 0; + 190: 31 c0 xor %eax,%eax +} + 192: 83 c4 14 add $0x14,%esp + 195: 5b pop %ebx + 196: 5d pop %ebp + 197: c3 ret + 198: 83 c4 14 add $0x14,%esp + return 1; + 19b: b8 01 00 00 00 mov $0x1,%eax +} + 1a0: 5b pop %ebx + 1a1: 5d pop %ebp + 1a2: c3 ret + 1a3: 90 nop + 1a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return matchstar(re[0], re+2, text); + 1a8: 83 c2 02 add $0x2,%edx + 1ab: 89 4c 24 08 mov %ecx,0x8(%esp) + 1af: 89 54 24 04 mov %edx,0x4(%esp) + 1b3: 89 04 24 mov %eax,(%esp) + 1b6: e8 25 ff ff ff call e0 +} + 1bb: 83 c4 14 add $0x14,%esp + 1be: 5b pop %ebx + 1bf: 5d pop %ebp + 1c0: c3 ret + return *text == '\0'; + 1c1: 31 c0 xor %eax,%eax + 1c3: 80 39 00 cmpb $0x0,(%ecx) + 1c6: 0f 94 c0 sete %al + 1c9: eb c7 jmp 192 + 1cb: 90 nop + 1cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +000001d0 : +{ + 1d0: 55 push %ebp + 1d1: 89 e5 mov %esp,%ebp + 1d3: 56 push %esi + 1d4: 53 push %ebx + 1d5: 83 ec 10 sub $0x10,%esp + 1d8: 8b 75 08 mov 0x8(%ebp),%esi + 1db: 8b 5d 0c mov 0xc(%ebp),%ebx + if(re[0] == '^') + 1de: 80 3e 5e cmpb $0x5e,(%esi) + 1e1: 75 0e jne 1f1 + 1e3: eb 28 jmp 20d + 1e5: 8d 76 00 lea 0x0(%esi),%esi + }while(*text++ != '\0'); + 1e8: 83 c3 01 add $0x1,%ebx + 1eb: 80 7b ff 00 cmpb $0x0,-0x1(%ebx) + 1ef: 74 15 je 206 + if(matchhere(re, text)) + 1f1: 89 5c 24 04 mov %ebx,0x4(%esp) + 1f5: 89 34 24 mov %esi,(%esp) + 1f8: e8 43 ff ff ff call 140 + 1fd: 85 c0 test %eax,%eax + 1ff: 74 e7 je 1e8 + return 1; + 201: b8 01 00 00 00 mov $0x1,%eax +} + 206: 83 c4 10 add $0x10,%esp + 209: 5b pop %ebx + 20a: 5e pop %esi + 20b: 5d pop %ebp + 20c: c3 ret + return matchhere(re+1, text); + 20d: 83 c6 01 add $0x1,%esi + 210: 89 75 08 mov %esi,0x8(%ebp) +} + 213: 83 c4 10 add $0x10,%esp + 216: 5b pop %ebx + 217: 5e pop %esi + 218: 5d pop %ebp + return matchhere(re+1, text); + 219: e9 22 ff ff ff jmp 140 + 21e: 66 90 xchg %ax,%ax + +00000220 : +{ + 220: 55 push %ebp + 221: 89 e5 mov %esp,%ebp + 223: 57 push %edi + 224: 56 push %esi + 225: 53 push %ebx + 226: 83 ec 1c sub $0x1c,%esp + 229: 8b 75 08 mov 0x8(%ebp),%esi + m = 0; + 22c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) + 233: 90 nop + 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ + 238: 8b 55 e4 mov -0x1c(%ebp),%edx + 23b: b8 ff 03 00 00 mov $0x3ff,%eax + 240: 29 d0 sub %edx,%eax + 242: 89 44 24 08 mov %eax,0x8(%esp) + 246: 89 d0 mov %edx,%eax + 248: 05 c0 0d 00 00 add $0xdc0,%eax + 24d: 89 44 24 04 mov %eax,0x4(%esp) + 251: 8b 45 0c mov 0xc(%ebp),%eax + 254: 89 04 24 mov %eax,(%esp) + 257: e8 0e 03 00 00 call 56a + 25c: 85 c0 test %eax,%eax + 25e: 0f 8e b8 00 00 00 jle 31c + m += n; + 264: 01 45 e4 add %eax,-0x1c(%ebp) + p = buf; + 267: bb c0 0d 00 00 mov $0xdc0,%ebx + buf[m] = '\0'; + 26c: 8b 45 e4 mov -0x1c(%ebp),%eax + 26f: c6 80 c0 0d 00 00 00 movb $0x0,0xdc0(%eax) + 276: 66 90 xchg %ax,%ax + while((q = strchr(p, '\n')) != 0){ + 278: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp) + 27f: 00 + 280: 89 1c 24 mov %ebx,(%esp) + 283: e8 78 01 00 00 call 400 + 288: 85 c0 test %eax,%eax + 28a: 89 c7 mov %eax,%edi + 28c: 74 42 je 2d0 + *q = 0; + 28e: c6 07 00 movb $0x0,(%edi) + if(match(pattern, p)){ + 291: 89 5c 24 04 mov %ebx,0x4(%esp) + 295: 89 34 24 mov %esi,(%esp) + 298: e8 33 ff ff ff call 1d0 + 29d: 85 c0 test %eax,%eax + 29f: 75 07 jne 2a8 + 2a1: 8d 5f 01 lea 0x1(%edi),%ebx + 2a4: eb d2 jmp 278 + 2a6: 66 90 xchg %ax,%ax + *q = '\n'; + 2a8: c6 07 0a movb $0xa,(%edi) + write(1, p, q+1 - p); + 2ab: 83 c7 01 add $0x1,%edi + 2ae: 89 f8 mov %edi,%eax + 2b0: 29 d8 sub %ebx,%eax + 2b2: 89 5c 24 04 mov %ebx,0x4(%esp) + 2b6: 89 fb mov %edi,%ebx + 2b8: 89 44 24 08 mov %eax,0x8(%esp) + 2bc: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c3: e8 aa 02 00 00 call 572 + 2c8: eb ae jmp 278 + 2ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if(p == buf) + 2d0: 81 fb c0 0d 00 00 cmp $0xdc0,%ebx + 2d6: 74 38 je 310 + if(m > 0){ + 2d8: 8b 45 e4 mov -0x1c(%ebp),%eax + 2db: 85 c0 test %eax,%eax + 2dd: 0f 8e 55 ff ff ff jle 238 + m -= p - buf; + 2e3: b8 c0 0d 00 00 mov $0xdc0,%eax + 2e8: 29 d8 sub %ebx,%eax + 2ea: 01 45 e4 add %eax,-0x1c(%ebp) + memmove(buf, p, m); + 2ed: 8b 45 e4 mov -0x1c(%ebp),%eax + 2f0: 89 5c 24 04 mov %ebx,0x4(%esp) + 2f4: c7 04 24 c0 0d 00 00 movl $0xdc0,(%esp) + 2fb: 89 44 24 08 mov %eax,0x8(%esp) + 2ff: e8 1c 02 00 00 call 520 + 304: e9 2f ff ff ff jmp 238 + 309: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + m = 0; + 310: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) + 317: e9 1c ff ff ff jmp 238 +} + 31c: 83 c4 1c add $0x1c,%esp + 31f: 5b pop %ebx + 320: 5e pop %esi + 321: 5f pop %edi + 322: 5d pop %ebp + 323: c3 ret + 324: 66 90 xchg %ax,%ax + 326: 66 90 xchg %ax,%ax + 328: 66 90 xchg %ax,%ax + 32a: 66 90 xchg %ax,%ax + 32c: 66 90 xchg %ax,%ax + 32e: 66 90 xchg %ax,%ax + +00000330 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 330: 55 push %ebp + 331: 89 e5 mov %esp,%ebp + 333: 8b 45 08 mov 0x8(%ebp),%eax + 336: 8b 4d 0c mov 0xc(%ebp),%ecx + 339: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 33a: 89 c2 mov %eax,%edx + 33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 340: 83 c1 01 add $0x1,%ecx + 343: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 347: 83 c2 01 add $0x1,%edx + 34a: 84 db test %bl,%bl + 34c: 88 5a ff mov %bl,-0x1(%edx) + 34f: 75 ef jne 340 + ; + return os; +} + 351: 5b pop %ebx + 352: 5d pop %ebp + 353: c3 ret + 354: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 35a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000360 : + +int +strcmp(const char *p, const char *q) +{ + 360: 55 push %ebp + 361: 89 e5 mov %esp,%ebp + 363: 8b 55 08 mov 0x8(%ebp),%edx + 366: 53 push %ebx + 367: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 36a: 0f b6 02 movzbl (%edx),%eax + 36d: 84 c0 test %al,%al + 36f: 74 2d je 39e + 371: 0f b6 19 movzbl (%ecx),%ebx + 374: 38 d8 cmp %bl,%al + 376: 74 0e je 386 + 378: eb 2b jmp 3a5 + 37a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 380: 38 c8 cmp %cl,%al + 382: 75 15 jne 399 + p++, q++; + 384: 89 d9 mov %ebx,%ecx + 386: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 389: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 38c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 38f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 393: 84 c0 test %al,%al + 395: 75 e9 jne 380 + 397: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 399: 29 c8 sub %ecx,%eax +} + 39b: 5b pop %ebx + 39c: 5d pop %ebp + 39d: c3 ret + 39e: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 3a1: 31 c0 xor %eax,%eax + 3a3: eb f4 jmp 399 + 3a5: 0f b6 cb movzbl %bl,%ecx + 3a8: eb ef jmp 399 + 3aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000003b0 : + +uint +strlen(const char *s) +{ + 3b0: 55 push %ebp + 3b1: 89 e5 mov %esp,%ebp + 3b3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 3b6: 80 39 00 cmpb $0x0,(%ecx) + 3b9: 74 12 je 3cd + 3bb: 31 d2 xor %edx,%edx + 3bd: 8d 76 00 lea 0x0(%esi),%esi + 3c0: 83 c2 01 add $0x1,%edx + 3c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 3c7: 89 d0 mov %edx,%eax + 3c9: 75 f5 jne 3c0 + ; + return n; +} + 3cb: 5d pop %ebp + 3cc: c3 ret + for(n = 0; s[n]; n++) + 3cd: 31 c0 xor %eax,%eax +} + 3cf: 5d pop %ebp + 3d0: c3 ret + 3d1: eb 0d jmp 3e0 + 3d3: 90 nop + 3d4: 90 nop + 3d5: 90 nop + 3d6: 90 nop + 3d7: 90 nop + 3d8: 90 nop + 3d9: 90 nop + 3da: 90 nop + 3db: 90 nop + 3dc: 90 nop + 3dd: 90 nop + 3de: 90 nop + 3df: 90 nop + +000003e0 : + +void* +memset(void *dst, int c, uint n) +{ + 3e0: 55 push %ebp + 3e1: 89 e5 mov %esp,%ebp + 3e3: 8b 55 08 mov 0x8(%ebp),%edx + 3e6: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 3e7: 8b 4d 10 mov 0x10(%ebp),%ecx + 3ea: 8b 45 0c mov 0xc(%ebp),%eax + 3ed: 89 d7 mov %edx,%edi + 3ef: fc cld + 3f0: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 3f2: 89 d0 mov %edx,%eax + 3f4: 5f pop %edi + 3f5: 5d pop %ebp + 3f6: c3 ret + 3f7: 89 f6 mov %esi,%esi + 3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000400 : + +char* +strchr(const char *s, char c) +{ + 400: 55 push %ebp + 401: 89 e5 mov %esp,%ebp + 403: 8b 45 08 mov 0x8(%ebp),%eax + 406: 53 push %ebx + 407: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 40a: 0f b6 18 movzbl (%eax),%ebx + 40d: 84 db test %bl,%bl + 40f: 74 1d je 42e + if(*s == c) + 411: 38 d3 cmp %dl,%bl + 413: 89 d1 mov %edx,%ecx + 415: 75 0d jne 424 + 417: eb 17 jmp 430 + 419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 420: 38 ca cmp %cl,%dl + 422: 74 0c je 430 + for(; *s; s++) + 424: 83 c0 01 add $0x1,%eax + 427: 0f b6 10 movzbl (%eax),%edx + 42a: 84 d2 test %dl,%dl + 42c: 75 f2 jne 420 + return (char*)s; + return 0; + 42e: 31 c0 xor %eax,%eax +} + 430: 5b pop %ebx + 431: 5d pop %ebp + 432: c3 ret + 433: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000440 : + +char* +gets(char *buf, int max) +{ + 440: 55 push %ebp + 441: 89 e5 mov %esp,%ebp + 443: 57 push %edi + 444: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 445: 31 f6 xor %esi,%esi +{ + 447: 53 push %ebx + 448: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 44b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 44e: eb 31 jmp 481 + cc = read(0, &c, 1); + 450: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 457: 00 + 458: 89 7c 24 04 mov %edi,0x4(%esp) + 45c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 463: e8 02 01 00 00 call 56a + if(cc < 1) + 468: 85 c0 test %eax,%eax + 46a: 7e 1d jle 489 + break; + buf[i++] = c; + 46c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 470: 89 de mov %ebx,%esi + buf[i++] = c; + 472: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 475: 3c 0d cmp $0xd,%al + buf[i++] = c; + 477: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 47b: 74 0c je 489 + 47d: 3c 0a cmp $0xa,%al + 47f: 74 08 je 489 + for(i=0; i+1 < max; ){ + 481: 8d 5e 01 lea 0x1(%esi),%ebx + 484: 3b 5d 0c cmp 0xc(%ebp),%ebx + 487: 7c c7 jl 450 + break; + } + buf[i] = '\0'; + 489: 8b 45 08 mov 0x8(%ebp),%eax + 48c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 490: 83 c4 2c add $0x2c,%esp + 493: 5b pop %ebx + 494: 5e pop %esi + 495: 5f pop %edi + 496: 5d pop %ebp + 497: c3 ret + 498: 90 nop + 499: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000004a0 : + +int +stat(const char *n, struct stat *st) +{ + 4a0: 55 push %ebp + 4a1: 89 e5 mov %esp,%ebp + 4a3: 56 push %esi + 4a4: 53 push %ebx + 4a5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 4a8: 8b 45 08 mov 0x8(%ebp),%eax + 4ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 4b2: 00 + 4b3: 89 04 24 mov %eax,(%esp) + 4b6: e8 d7 00 00 00 call 592 + if(fd < 0) + 4bb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 4bd: 89 c3 mov %eax,%ebx + if(fd < 0) + 4bf: 78 27 js 4e8 + return -1; + r = fstat(fd, st); + 4c1: 8b 45 0c mov 0xc(%ebp),%eax + 4c4: 89 1c 24 mov %ebx,(%esp) + 4c7: 89 44 24 04 mov %eax,0x4(%esp) + 4cb: e8 da 00 00 00 call 5aa + close(fd); + 4d0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 4d3: 89 c6 mov %eax,%esi + close(fd); + 4d5: e8 a0 00 00 00 call 57a + return r; + 4da: 89 f0 mov %esi,%eax +} + 4dc: 83 c4 10 add $0x10,%esp + 4df: 5b pop %ebx + 4e0: 5e pop %esi + 4e1: 5d pop %ebp + 4e2: c3 ret + 4e3: 90 nop + 4e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 4e8: b8 ff ff ff ff mov $0xffffffff,%eax + 4ed: eb ed jmp 4dc + 4ef: 90 nop + +000004f0 : + +int +atoi(const char *s) +{ + 4f0: 55 push %ebp + 4f1: 89 e5 mov %esp,%ebp + 4f3: 8b 4d 08 mov 0x8(%ebp),%ecx + 4f6: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 4f7: 0f be 11 movsbl (%ecx),%edx + 4fa: 8d 42 d0 lea -0x30(%edx),%eax + 4fd: 3c 09 cmp $0x9,%al + n = 0; + 4ff: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 504: 77 17 ja 51d + 506: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 508: 83 c1 01 add $0x1,%ecx + 50b: 8d 04 80 lea (%eax,%eax,4),%eax + 50e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 512: 0f be 11 movsbl (%ecx),%edx + 515: 8d 5a d0 lea -0x30(%edx),%ebx + 518: 80 fb 09 cmp $0x9,%bl + 51b: 76 eb jbe 508 + return n; +} + 51d: 5b pop %ebx + 51e: 5d pop %ebp + 51f: c3 ret + +00000520 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 520: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 521: 31 d2 xor %edx,%edx +{ + 523: 89 e5 mov %esp,%ebp + 525: 56 push %esi + 526: 8b 45 08 mov 0x8(%ebp),%eax + 529: 53 push %ebx + 52a: 8b 5d 10 mov 0x10(%ebp),%ebx + 52d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 530: 85 db test %ebx,%ebx + 532: 7e 12 jle 546 + 534: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 538: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 53c: 88 0c 10 mov %cl,(%eax,%edx,1) + 53f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 542: 39 da cmp %ebx,%edx + 544: 75 f2 jne 538 + return vdst; +} + 546: 5b pop %ebx + 547: 5e pop %esi + 548: 5d pop %ebp + 549: c3 ret + +0000054a : + 54a: b8 01 00 00 00 mov $0x1,%eax + 54f: cd 40 int $0x40 + 551: c3 ret + +00000552 : + 552: b8 02 00 00 00 mov $0x2,%eax + 557: cd 40 int $0x40 + 559: c3 ret + +0000055a : + 55a: b8 03 00 00 00 mov $0x3,%eax + 55f: cd 40 int $0x40 + 561: c3 ret + +00000562 : + 562: b8 04 00 00 00 mov $0x4,%eax + 567: cd 40 int $0x40 + 569: c3 ret + +0000056a : + 56a: b8 05 00 00 00 mov $0x5,%eax + 56f: cd 40 int $0x40 + 571: c3 ret + +00000572 : + 572: b8 10 00 00 00 mov $0x10,%eax + 577: cd 40 int $0x40 + 579: c3 ret + +0000057a : + 57a: b8 15 00 00 00 mov $0x15,%eax + 57f: cd 40 int $0x40 + 581: c3 ret + +00000582 : + 582: b8 06 00 00 00 mov $0x6,%eax + 587: cd 40 int $0x40 + 589: c3 ret + +0000058a : + 58a: b8 07 00 00 00 mov $0x7,%eax + 58f: cd 40 int $0x40 + 591: c3 ret + +00000592 : + 592: b8 0f 00 00 00 mov $0xf,%eax + 597: cd 40 int $0x40 + 599: c3 ret + +0000059a : + 59a: b8 11 00 00 00 mov $0x11,%eax + 59f: cd 40 int $0x40 + 5a1: c3 ret + +000005a2 : + 5a2: b8 12 00 00 00 mov $0x12,%eax + 5a7: cd 40 int $0x40 + 5a9: c3 ret + +000005aa : + 5aa: b8 08 00 00 00 mov $0x8,%eax + 5af: cd 40 int $0x40 + 5b1: c3 ret + +000005b2 : + 5b2: b8 13 00 00 00 mov $0x13,%eax + 5b7: cd 40 int $0x40 + 5b9: c3 ret + +000005ba : + 5ba: b8 14 00 00 00 mov $0x14,%eax + 5bf: cd 40 int $0x40 + 5c1: c3 ret + +000005c2 : + 5c2: b8 09 00 00 00 mov $0x9,%eax + 5c7: cd 40 int $0x40 + 5c9: c3 ret + +000005ca : + 5ca: b8 0a 00 00 00 mov $0xa,%eax + 5cf: cd 40 int $0x40 + 5d1: c3 ret + +000005d2 : + 5d2: b8 0b 00 00 00 mov $0xb,%eax + 5d7: cd 40 int $0x40 + 5d9: c3 ret + +000005da : + 5da: b8 0c 00 00 00 mov $0xc,%eax + 5df: cd 40 int $0x40 + 5e1: c3 ret + +000005e2 : + 5e2: b8 0d 00 00 00 mov $0xd,%eax + 5e7: cd 40 int $0x40 + 5e9: c3 ret + +000005ea : + 5ea: b8 0e 00 00 00 mov $0xe,%eax + 5ef: cd 40 int $0x40 + 5f1: c3 ret + 5f2: 66 90 xchg %ax,%ax + 5f4: 66 90 xchg %ax,%ax + 5f6: 66 90 xchg %ax,%ax + 5f8: 66 90 xchg %ax,%ax + 5fa: 66 90 xchg %ax,%ax + 5fc: 66 90 xchg %ax,%ax + 5fe: 66 90 xchg %ax,%ax + +00000600 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 600: 55 push %ebp + 601: 89 e5 mov %esp,%ebp + 603: 57 push %edi + 604: 56 push %esi + 605: 89 c6 mov %eax,%esi + 607: 53 push %ebx + 608: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 60b: 8b 5d 08 mov 0x8(%ebp),%ebx + 60e: 85 db test %ebx,%ebx + 610: 74 09 je 61b + 612: 89 d0 mov %edx,%eax + 614: c1 e8 1f shr $0x1f,%eax + 617: 84 c0 test %al,%al + 619: 75 75 jne 690 + neg = 1; + x = -xx; + } else { + x = xx; + 61b: 89 d0 mov %edx,%eax + neg = 0; + 61d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 624: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 627: 31 ff xor %edi,%edi + 629: 89 ce mov %ecx,%esi + 62b: 8d 5d d7 lea -0x29(%ebp),%ebx + 62e: eb 02 jmp 632 + do{ + buf[i++] = digits[x % base]; + 630: 89 cf mov %ecx,%edi + 632: 31 d2 xor %edx,%edx + 634: f7 f6 div %esi + 636: 8d 4f 01 lea 0x1(%edi),%ecx + 639: 0f b6 92 45 0a 00 00 movzbl 0xa45(%edx),%edx + }while((x /= base) != 0); + 640: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 642: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 645: 75 e9 jne 630 + if(neg) + 647: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 64a: 89 c8 mov %ecx,%eax + 64c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 64f: 85 d2 test %edx,%edx + 651: 74 08 je 65b + buf[i++] = '-'; + 653: 8d 4f 02 lea 0x2(%edi),%ecx + 656: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 65b: 8d 79 ff lea -0x1(%ecx),%edi + 65e: 66 90 xchg %ax,%ax + 660: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 665: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 668: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 66f: 00 + 670: 89 5c 24 04 mov %ebx,0x4(%esp) + 674: 89 34 24 mov %esi,(%esp) + 677: 88 45 d7 mov %al,-0x29(%ebp) + 67a: e8 f3 fe ff ff call 572 + while(--i >= 0) + 67f: 83 ff ff cmp $0xffffffff,%edi + 682: 75 dc jne 660 + putc(fd, buf[i]); +} + 684: 83 c4 4c add $0x4c,%esp + 687: 5b pop %ebx + 688: 5e pop %esi + 689: 5f pop %edi + 68a: 5d pop %ebp + 68b: c3 ret + 68c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 690: 89 d0 mov %edx,%eax + 692: f7 d8 neg %eax + neg = 1; + 694: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 69b: eb 87 jmp 624 + 69d: 8d 76 00 lea 0x0(%esi),%esi + +000006a0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 6a0: 55 push %ebp + 6a1: 89 e5 mov %esp,%ebp + 6a3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 6a4: 31 ff xor %edi,%edi +{ + 6a6: 56 push %esi + 6a7: 53 push %ebx + 6a8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 6ab: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 6ae: 8d 45 10 lea 0x10(%ebp),%eax +{ + 6b1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 6b4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 6b7: 0f b6 13 movzbl (%ebx),%edx + 6ba: 83 c3 01 add $0x1,%ebx + 6bd: 84 d2 test %dl,%dl + 6bf: 75 39 jne 6fa + 6c1: e9 c2 00 00 00 jmp 788 + 6c6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 6c8: 83 fa 25 cmp $0x25,%edx + 6cb: 0f 84 bf 00 00 00 je 790 + write(fd, &c, 1); + 6d1: 8d 45 e2 lea -0x1e(%ebp),%eax + 6d4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 6db: 00 + 6dc: 89 44 24 04 mov %eax,0x4(%esp) + 6e0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 6e3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 6e6: e8 87 fe ff ff call 572 + 6eb: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 6ee: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 6f2: 84 d2 test %dl,%dl + 6f4: 0f 84 8e 00 00 00 je 788 + if(state == 0){ + 6fa: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 6fc: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 6ff: 74 c7 je 6c8 + } + } else if(state == '%'){ + 701: 83 ff 25 cmp $0x25,%edi + 704: 75 e5 jne 6eb + if(c == 'd'){ + 706: 83 fa 64 cmp $0x64,%edx + 709: 0f 84 31 01 00 00 je 840 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 70f: 25 f7 00 00 00 and $0xf7,%eax + 714: 83 f8 70 cmp $0x70,%eax + 717: 0f 84 83 00 00 00 je 7a0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 71d: 83 fa 73 cmp $0x73,%edx + 720: 0f 84 a2 00 00 00 je 7c8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 726: 83 fa 63 cmp $0x63,%edx + 729: 0f 84 35 01 00 00 je 864 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 72f: 83 fa 25 cmp $0x25,%edx + 732: 0f 84 e0 00 00 00 je 818 + write(fd, &c, 1); + 738: 8d 45 e6 lea -0x1a(%ebp),%eax + 73b: 83 c3 01 add $0x1,%ebx + 73e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 745: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 746: 31 ff xor %edi,%edi + write(fd, &c, 1); + 748: 89 44 24 04 mov %eax,0x4(%esp) + 74c: 89 34 24 mov %esi,(%esp) + 74f: 89 55 d0 mov %edx,-0x30(%ebp) + 752: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 756: e8 17 fe ff ff call 572 + putc(fd, c); + 75b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 75e: 8d 45 e7 lea -0x19(%ebp),%eax + 761: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 768: 00 + 769: 89 44 24 04 mov %eax,0x4(%esp) + 76d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 770: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 773: e8 fa fd ff ff call 572 + for(i = 0; fmt[i]; i++){ + 778: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 77c: 84 d2 test %dl,%dl + 77e: 0f 85 76 ff ff ff jne 6fa + 784: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 788: 83 c4 3c add $0x3c,%esp + 78b: 5b pop %ebx + 78c: 5e pop %esi + 78d: 5f pop %edi + 78e: 5d pop %ebp + 78f: c3 ret + state = '%'; + 790: bf 25 00 00 00 mov $0x25,%edi + 795: e9 51 ff ff ff jmp 6eb + 79a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 7a0: 8b 45 d4 mov -0x2c(%ebp),%eax + 7a3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 7a8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 7aa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 7b1: 8b 10 mov (%eax),%edx + 7b3: 89 f0 mov %esi,%eax + 7b5: e8 46 fe ff ff call 600 + ap++; + 7ba: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 7be: e9 28 ff ff ff jmp 6eb + 7c3: 90 nop + 7c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 7c8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 7cb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 7cf: 8b 38 mov (%eax),%edi + s = "(null)"; + 7d1: b8 3e 0a 00 00 mov $0xa3e,%eax + 7d6: 85 ff test %edi,%edi + 7d8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 7db: 0f b6 07 movzbl (%edi),%eax + 7de: 84 c0 test %al,%al + 7e0: 74 2a je 80c + 7e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 7e8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 7eb: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 7ee: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 7f1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 7f8: 00 + 7f9: 89 44 24 04 mov %eax,0x4(%esp) + 7fd: 89 34 24 mov %esi,(%esp) + 800: e8 6d fd ff ff call 572 + while(*s != 0){ + 805: 0f b6 07 movzbl (%edi),%eax + 808: 84 c0 test %al,%al + 80a: 75 dc jne 7e8 + state = 0; + 80c: 31 ff xor %edi,%edi + 80e: e9 d8 fe ff ff jmp 6eb + 813: 90 nop + 814: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 818: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 81b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 81d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 824: 00 + 825: 89 44 24 04 mov %eax,0x4(%esp) + 829: 89 34 24 mov %esi,(%esp) + 82c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 830: e8 3d fd ff ff call 572 + 835: e9 b1 fe ff ff jmp 6eb + 83a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 840: 8b 45 d4 mov -0x2c(%ebp),%eax + 843: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 848: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 84b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 852: 8b 10 mov (%eax),%edx + 854: 89 f0 mov %esi,%eax + 856: e8 a5 fd ff ff call 600 + ap++; + 85b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 85f: e9 87 fe ff ff jmp 6eb + putc(fd, *ap); + 864: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 867: 31 ff xor %edi,%edi + putc(fd, *ap); + 869: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 86b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 872: 00 + 873: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 876: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 879: 8d 45 e4 lea -0x1c(%ebp),%eax + 87c: 89 44 24 04 mov %eax,0x4(%esp) + 880: e8 ed fc ff ff call 572 + ap++; + 885: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 889: e9 5d fe ff ff jmp 6eb + 88e: 66 90 xchg %ax,%ax + +00000890 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 890: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 891: a1 a0 0d 00 00 mov 0xda0,%eax +{ + 896: 89 e5 mov %esp,%ebp + 898: 57 push %edi + 899: 56 push %esi + 89a: 53 push %ebx + 89b: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 89e: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 8a0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 8a3: 39 d0 cmp %edx,%eax + 8a5: 72 11 jb 8b8 + 8a7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 8a8: 39 c8 cmp %ecx,%eax + 8aa: 72 04 jb 8b0 + 8ac: 39 ca cmp %ecx,%edx + 8ae: 72 10 jb 8c0 + 8b0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 8b2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 8b4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 8b6: 73 f0 jae 8a8 + 8b8: 39 ca cmp %ecx,%edx + 8ba: 72 04 jb 8c0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 8bc: 39 c8 cmp %ecx,%eax + 8be: 72 f0 jb 8b0 + break; + if(bp + bp->s.size == p->s.ptr){ + 8c0: 8b 73 fc mov -0x4(%ebx),%esi + 8c3: 8d 3c f2 lea (%edx,%esi,8),%edi + 8c6: 39 cf cmp %ecx,%edi + 8c8: 74 1e je 8e8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 8ca: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 8cd: 8b 48 04 mov 0x4(%eax),%ecx + 8d0: 8d 34 c8 lea (%eax,%ecx,8),%esi + 8d3: 39 f2 cmp %esi,%edx + 8d5: 74 28 je 8ff + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 8d7: 89 10 mov %edx,(%eax) + freep = p; + 8d9: a3 a0 0d 00 00 mov %eax,0xda0 +} + 8de: 5b pop %ebx + 8df: 5e pop %esi + 8e0: 5f pop %edi + 8e1: 5d pop %ebp + 8e2: c3 ret + 8e3: 90 nop + 8e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 8e8: 03 71 04 add 0x4(%ecx),%esi + 8eb: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 8ee: 8b 08 mov (%eax),%ecx + 8f0: 8b 09 mov (%ecx),%ecx + 8f2: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 8f5: 8b 48 04 mov 0x4(%eax),%ecx + 8f8: 8d 34 c8 lea (%eax,%ecx,8),%esi + 8fb: 39 f2 cmp %esi,%edx + 8fd: 75 d8 jne 8d7 + p->s.size += bp->s.size; + 8ff: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 902: a3 a0 0d 00 00 mov %eax,0xda0 + p->s.size += bp->s.size; + 907: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 90a: 8b 53 f8 mov -0x8(%ebx),%edx + 90d: 89 10 mov %edx,(%eax) +} + 90f: 5b pop %ebx + 910: 5e pop %esi + 911: 5f pop %edi + 912: 5d pop %ebp + 913: c3 ret + 914: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 91a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000920 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 920: 55 push %ebp + 921: 89 e5 mov %esp,%ebp + 923: 57 push %edi + 924: 56 push %esi + 925: 53 push %ebx + 926: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 929: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 92c: 8b 1d a0 0d 00 00 mov 0xda0,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 932: 8d 48 07 lea 0x7(%eax),%ecx + 935: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 938: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 93a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 93d: 0f 84 9b 00 00 00 je 9de + 943: 8b 13 mov (%ebx),%edx + 945: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 948: 39 fe cmp %edi,%esi + 94a: 76 64 jbe 9b0 + 94c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 953: bb 00 80 00 00 mov $0x8000,%ebx + 958: 89 45 e4 mov %eax,-0x1c(%ebp) + 95b: eb 0e jmp 96b + 95d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 960: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 962: 8b 78 04 mov 0x4(%eax),%edi + 965: 39 fe cmp %edi,%esi + 967: 76 4f jbe 9b8 + 969: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 96b: 3b 15 a0 0d 00 00 cmp 0xda0,%edx + 971: 75 ed jne 960 + if(nu < 4096) + 973: 8b 45 e4 mov -0x1c(%ebp),%eax + 976: 81 fe 00 10 00 00 cmp $0x1000,%esi + 97c: bf 00 10 00 00 mov $0x1000,%edi + 981: 0f 43 fe cmovae %esi,%edi + 984: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 987: 89 04 24 mov %eax,(%esp) + 98a: e8 4b fc ff ff call 5da + if(p == (char*)-1) + 98f: 83 f8 ff cmp $0xffffffff,%eax + 992: 74 18 je 9ac + hp->s.size = nu; + 994: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 997: 83 c0 08 add $0x8,%eax + 99a: 89 04 24 mov %eax,(%esp) + 99d: e8 ee fe ff ff call 890 + return freep; + 9a2: 8b 15 a0 0d 00 00 mov 0xda0,%edx + if((p = morecore(nunits)) == 0) + 9a8: 85 d2 test %edx,%edx + 9aa: 75 b4 jne 960 + return 0; + 9ac: 31 c0 xor %eax,%eax + 9ae: eb 20 jmp 9d0 + if(p->s.size >= nunits){ + 9b0: 89 d0 mov %edx,%eax + 9b2: 89 da mov %ebx,%edx + 9b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 9b8: 39 fe cmp %edi,%esi + 9ba: 74 1c je 9d8 + p->s.size -= nunits; + 9bc: 29 f7 sub %esi,%edi + 9be: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 9c1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 9c4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 9c7: 89 15 a0 0d 00 00 mov %edx,0xda0 + return (void*)(p + 1); + 9cd: 83 c0 08 add $0x8,%eax + } +} + 9d0: 83 c4 1c add $0x1c,%esp + 9d3: 5b pop %ebx + 9d4: 5e pop %esi + 9d5: 5f pop %edi + 9d6: 5d pop %ebp + 9d7: c3 ret + prevp->s.ptr = p->s.ptr; + 9d8: 8b 08 mov (%eax),%ecx + 9da: 89 0a mov %ecx,(%edx) + 9dc: eb e9 jmp 9c7 + base.s.ptr = freep = prevp = &base; + 9de: c7 05 a0 0d 00 00 a4 movl $0xda4,0xda0 + 9e5: 0d 00 00 + base.s.size = 0; + 9e8: ba a4 0d 00 00 mov $0xda4,%edx + base.s.ptr = freep = prevp = &base; + 9ed: c7 05 a4 0d 00 00 a4 movl $0xda4,0xda4 + 9f4: 0d 00 00 + base.s.size = 0; + 9f7: c7 05 a8 0d 00 00 00 movl $0x0,0xda8 + 9fe: 00 00 00 + a01: e9 46 ff ff ff jmp 94c diff --git a/grep.c b/grep.c index adc4835566..1aa1081ebd 100644 --- a/grep.c +++ b/grep.c @@ -43,24 +43,24 @@ main(int argc, char *argv[]) if(argc <= 1){ printf(2, "usage: grep pattern [file ...]\n"); - exit(); + exit(0); } pattern = argv[1]; if(argc <= 2){ grep(pattern, 0); - exit(); + exit(0); } for(i = 2; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ printf(1, "grep: cannot open %s\n", argv[i]); - exit(); + exit(0); } grep(pattern, fd); close(fd); } - exit(); + exit(0); } // Regexp matcher from Kernighan & Pike, diff --git a/grep.d b/grep.d new file mode 100644 index 0000000000..15fc65b072 --- /dev/null +++ b/grep.d @@ -0,0 +1 @@ +grep.o: grep.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/grep.o b/grep.o new file mode 100644 index 0000000000..c6dcbc6775 Binary files /dev/null and b/grep.o differ diff --git a/grep.sym b/grep.sym new file mode 100644 index 0000000000..42b224581d --- /dev/null +++ b/grep.sym @@ -0,0 +1,62 @@ +00000000 .text +00000a08 .rodata +00000a58 .eh_frame +00000da0 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 grep.c +00000000 ulib.c +00000000 printf.c +00000600 printint +00000a45 digits.1354 +00000000 umalloc.c +00000da0 freep +00000da4 base +00000330 strcpy +000006a0 printf +00000520 memmove +00000140 matchhere +0000059a mknod +00000440 gets +000005d2 getpid +00000220 grep +00000920 malloc +000005e2 sleep +00000562 pipe +00000572 write +000005aa fstat +00000582 kill +000005c2 chdir +0000058a exec +0000055a wait +0000056a read +000005a2 unlink +0000054a fork +000005da sbrk +000005ea uptime +00000d98 __bss_start +000003e0 memset +00000000 main +000000e0 matchstar +00000360 strcmp +000005ca dup +00000dc0 buf +000004a0 stat +00000d98 _edata +000011c0 _end +000001d0 match +000005b2 link +00000552 exit +000004f0 atoi +000003b0 strlen +00000592 open +00000400 strchr +000005ba mkdir +0000057a close +00000890 free diff --git a/hello.asm b/hello.asm new file mode 100644 index 0000000000..0aed89c0f9 --- /dev/null +++ b/hello.asm @@ -0,0 +1,1111 @@ + +_hello: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "types.h" +#include "user.h" + +int main(int argc, char **argv) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp + 6: 83 ec 20 sub $0x20,%esp + int exitStatus = 10000000; + printf(1, "Waiting...\n"); + 9: c7 44 24 04 36 07 00 movl $0x736,0x4(%esp) + 10: 00 + 11: c7 04 24 01 00 00 00 movl $0x1,(%esp) + int exitStatus = 10000000; + 18: c7 44 24 1c 80 96 98 movl $0x989680,0x1c(%esp) + 1f: 00 + printf(1, "Waiting...\n"); + 20: e8 ab 03 00 00 call 3d0 + wait(&exitStatus); + 25: 8d 44 24 1c lea 0x1c(%esp),%eax + 29: 89 04 24 mov %eax,(%esp) + 2c: e8 59 02 00 00 call 28a + printf(1, "Hello World!\n"); + 31: c7 44 24 04 42 07 00 movl $0x742,0x4(%esp) + 38: 00 + 39: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 40: e8 8b 03 00 00 call 3d0 + exit(0); + 45: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 4c: e8 31 02 00 00 call 282 + 51: 66 90 xchg %ax,%ax + 53: 66 90 xchg %ax,%ax + 55: 66 90 xchg %ax,%ax + 57: 66 90 xchg %ax,%ax + 59: 66 90 xchg %ax,%ax + 5b: 66 90 xchg %ax,%ax + 5d: 66 90 xchg %ax,%ax + 5f: 90 nop + +00000060 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 60: 55 push %ebp + 61: 89 e5 mov %esp,%ebp + 63: 8b 45 08 mov 0x8(%ebp),%eax + 66: 8b 4d 0c mov 0xc(%ebp),%ecx + 69: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 6a: 89 c2 mov %eax,%edx + 6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 70: 83 c1 01 add $0x1,%ecx + 73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 77: 83 c2 01 add $0x1,%edx + 7a: 84 db test %bl,%bl + 7c: 88 5a ff mov %bl,-0x1(%edx) + 7f: 75 ef jne 70 + ; + return os; +} + 81: 5b pop %ebx + 82: 5d pop %ebp + 83: c3 ret + 84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000090 : + +int +strcmp(const char *p, const char *q) +{ + 90: 55 push %ebp + 91: 89 e5 mov %esp,%ebp + 93: 8b 55 08 mov 0x8(%ebp),%edx + 96: 53 push %ebx + 97: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 9a: 0f b6 02 movzbl (%edx),%eax + 9d: 84 c0 test %al,%al + 9f: 74 2d je ce + a1: 0f b6 19 movzbl (%ecx),%ebx + a4: 38 d8 cmp %bl,%al + a6: 74 0e je b6 + a8: eb 2b jmp d5 + aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + b0: 38 c8 cmp %cl,%al + b2: 75 15 jne c9 + p++, q++; + b4: 89 d9 mov %ebx,%ecx + b6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + b9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + bc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + bf: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + c3: 84 c0 test %al,%al + c5: 75 e9 jne b0 + c7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + c9: 29 c8 sub %ecx,%eax +} + cb: 5b pop %ebx + cc: 5d pop %ebp + cd: c3 ret + ce: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + d1: 31 c0 xor %eax,%eax + d3: eb f4 jmp c9 + d5: 0f b6 cb movzbl %bl,%ecx + d8: eb ef jmp c9 + da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000000e0 : + +uint +strlen(const char *s) +{ + e0: 55 push %ebp + e1: 89 e5 mov %esp,%ebp + e3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + e6: 80 39 00 cmpb $0x0,(%ecx) + e9: 74 12 je fd + eb: 31 d2 xor %edx,%edx + ed: 8d 76 00 lea 0x0(%esi),%esi + f0: 83 c2 01 add $0x1,%edx + f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + f7: 89 d0 mov %edx,%eax + f9: 75 f5 jne f0 + ; + return n; +} + fb: 5d pop %ebp + fc: c3 ret + for(n = 0; s[n]; n++) + fd: 31 c0 xor %eax,%eax +} + ff: 5d pop %ebp + 100: c3 ret + 101: eb 0d jmp 110 + 103: 90 nop + 104: 90 nop + 105: 90 nop + 106: 90 nop + 107: 90 nop + 108: 90 nop + 109: 90 nop + 10a: 90 nop + 10b: 90 nop + 10c: 90 nop + 10d: 90 nop + 10e: 90 nop + 10f: 90 nop + +00000110 : + +void* +memset(void *dst, int c, uint n) +{ + 110: 55 push %ebp + 111: 89 e5 mov %esp,%ebp + 113: 8b 55 08 mov 0x8(%ebp),%edx + 116: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 117: 8b 4d 10 mov 0x10(%ebp),%ecx + 11a: 8b 45 0c mov 0xc(%ebp),%eax + 11d: 89 d7 mov %edx,%edi + 11f: fc cld + 120: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 122: 89 d0 mov %edx,%eax + 124: 5f pop %edi + 125: 5d pop %ebp + 126: c3 ret + 127: 89 f6 mov %esi,%esi + 129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000130 : + +char* +strchr(const char *s, char c) +{ + 130: 55 push %ebp + 131: 89 e5 mov %esp,%ebp + 133: 8b 45 08 mov 0x8(%ebp),%eax + 136: 53 push %ebx + 137: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 13a: 0f b6 18 movzbl (%eax),%ebx + 13d: 84 db test %bl,%bl + 13f: 74 1d je 15e + if(*s == c) + 141: 38 d3 cmp %dl,%bl + 143: 89 d1 mov %edx,%ecx + 145: 75 0d jne 154 + 147: eb 17 jmp 160 + 149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 150: 38 ca cmp %cl,%dl + 152: 74 0c je 160 + for(; *s; s++) + 154: 83 c0 01 add $0x1,%eax + 157: 0f b6 10 movzbl (%eax),%edx + 15a: 84 d2 test %dl,%dl + 15c: 75 f2 jne 150 + return (char*)s; + return 0; + 15e: 31 c0 xor %eax,%eax +} + 160: 5b pop %ebx + 161: 5d pop %ebp + 162: c3 ret + 163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000170 : + +char* +gets(char *buf, int max) +{ + 170: 55 push %ebp + 171: 89 e5 mov %esp,%ebp + 173: 57 push %edi + 174: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 175: 31 f6 xor %esi,%esi +{ + 177: 53 push %ebx + 178: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 17b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 17e: eb 31 jmp 1b1 + cc = read(0, &c, 1); + 180: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 187: 00 + 188: 89 7c 24 04 mov %edi,0x4(%esp) + 18c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 193: e8 02 01 00 00 call 29a + if(cc < 1) + 198: 85 c0 test %eax,%eax + 19a: 7e 1d jle 1b9 + break; + buf[i++] = c; + 19c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 1a0: 89 de mov %ebx,%esi + buf[i++] = c; + 1a2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 1a5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 1a7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 1ab: 74 0c je 1b9 + 1ad: 3c 0a cmp $0xa,%al + 1af: 74 08 je 1b9 + for(i=0; i+1 < max; ){ + 1b1: 8d 5e 01 lea 0x1(%esi),%ebx + 1b4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1b7: 7c c7 jl 180 + break; + } + buf[i] = '\0'; + 1b9: 8b 45 08 mov 0x8(%ebp),%eax + 1bc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 1c0: 83 c4 2c add $0x2c,%esp + 1c3: 5b pop %ebx + 1c4: 5e pop %esi + 1c5: 5f pop %edi + 1c6: 5d pop %ebp + 1c7: c3 ret + 1c8: 90 nop + 1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001d0 : + +int +stat(const char *n, struct stat *st) +{ + 1d0: 55 push %ebp + 1d1: 89 e5 mov %esp,%ebp + 1d3: 56 push %esi + 1d4: 53 push %ebx + 1d5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1d8: 8b 45 08 mov 0x8(%ebp),%eax + 1db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1e2: 00 + 1e3: 89 04 24 mov %eax,(%esp) + 1e6: e8 d7 00 00 00 call 2c2 + if(fd < 0) + 1eb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 1ed: 89 c3 mov %eax,%ebx + if(fd < 0) + 1ef: 78 27 js 218 + return -1; + r = fstat(fd, st); + 1f1: 8b 45 0c mov 0xc(%ebp),%eax + 1f4: 89 1c 24 mov %ebx,(%esp) + 1f7: 89 44 24 04 mov %eax,0x4(%esp) + 1fb: e8 da 00 00 00 call 2da + close(fd); + 200: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 203: 89 c6 mov %eax,%esi + close(fd); + 205: e8 a0 00 00 00 call 2aa + return r; + 20a: 89 f0 mov %esi,%eax +} + 20c: 83 c4 10 add $0x10,%esp + 20f: 5b pop %ebx + 210: 5e pop %esi + 211: 5d pop %ebp + 212: c3 ret + 213: 90 nop + 214: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 218: b8 ff ff ff ff mov $0xffffffff,%eax + 21d: eb ed jmp 20c + 21f: 90 nop + +00000220 : + +int +atoi(const char *s) +{ + 220: 55 push %ebp + 221: 89 e5 mov %esp,%ebp + 223: 8b 4d 08 mov 0x8(%ebp),%ecx + 226: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 227: 0f be 11 movsbl (%ecx),%edx + 22a: 8d 42 d0 lea -0x30(%edx),%eax + 22d: 3c 09 cmp $0x9,%al + n = 0; + 22f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 234: 77 17 ja 24d + 236: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 238: 83 c1 01 add $0x1,%ecx + 23b: 8d 04 80 lea (%eax,%eax,4),%eax + 23e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 242: 0f be 11 movsbl (%ecx),%edx + 245: 8d 5a d0 lea -0x30(%edx),%ebx + 248: 80 fb 09 cmp $0x9,%bl + 24b: 76 eb jbe 238 + return n; +} + 24d: 5b pop %ebx + 24e: 5d pop %ebp + 24f: c3 ret + +00000250 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 250: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 251: 31 d2 xor %edx,%edx +{ + 253: 89 e5 mov %esp,%ebp + 255: 56 push %esi + 256: 8b 45 08 mov 0x8(%ebp),%eax + 259: 53 push %ebx + 25a: 8b 5d 10 mov 0x10(%ebp),%ebx + 25d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 260: 85 db test %ebx,%ebx + 262: 7e 12 jle 276 + 264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 268: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 26c: 88 0c 10 mov %cl,(%eax,%edx,1) + 26f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 272: 39 da cmp %ebx,%edx + 274: 75 f2 jne 268 + return vdst; +} + 276: 5b pop %ebx + 277: 5e pop %esi + 278: 5d pop %ebp + 279: c3 ret + +0000027a : + 27a: b8 01 00 00 00 mov $0x1,%eax + 27f: cd 40 int $0x40 + 281: c3 ret + +00000282 : + 282: b8 02 00 00 00 mov $0x2,%eax + 287: cd 40 int $0x40 + 289: c3 ret + +0000028a : + 28a: b8 03 00 00 00 mov $0x3,%eax + 28f: cd 40 int $0x40 + 291: c3 ret + +00000292 : + 292: b8 04 00 00 00 mov $0x4,%eax + 297: cd 40 int $0x40 + 299: c3 ret + +0000029a : + 29a: b8 05 00 00 00 mov $0x5,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 10 00 00 00 mov $0x10,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 15 00 00 00 mov $0x15,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 06 00 00 00 mov $0x6,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 07 00 00 00 mov $0x7,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 0f 00 00 00 mov $0xf,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 11 00 00 00 mov $0x11,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 12 00 00 00 mov $0x12,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 08 00 00 00 mov $0x8,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 13 00 00 00 mov $0x13,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 14 00 00 00 mov $0x14,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + +000002f2 : + 2f2: b8 09 00 00 00 mov $0x9,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + +000002fa : + 2fa: b8 0a 00 00 00 mov $0xa,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + +00000302 : + 302: b8 0b 00 00 00 mov $0xb,%eax + 307: cd 40 int $0x40 + 309: c3 ret + +0000030a : + 30a: b8 0c 00 00 00 mov $0xc,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + +00000312 : + 312: b8 0d 00 00 00 mov $0xd,%eax + 317: cd 40 int $0x40 + 319: c3 ret + +0000031a : + 31a: b8 0e 00 00 00 mov $0xe,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + 322: 66 90 xchg %ax,%ax + 324: 66 90 xchg %ax,%ax + 326: 66 90 xchg %ax,%ax + 328: 66 90 xchg %ax,%ax + 32a: 66 90 xchg %ax,%ax + 32c: 66 90 xchg %ax,%ax + 32e: 66 90 xchg %ax,%ax + +00000330 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 330: 55 push %ebp + 331: 89 e5 mov %esp,%ebp + 333: 57 push %edi + 334: 56 push %esi + 335: 89 c6 mov %eax,%esi + 337: 53 push %ebx + 338: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 33b: 8b 5d 08 mov 0x8(%ebp),%ebx + 33e: 85 db test %ebx,%ebx + 340: 74 09 je 34b + 342: 89 d0 mov %edx,%eax + 344: c1 e8 1f shr $0x1f,%eax + 347: 84 c0 test %al,%al + 349: 75 75 jne 3c0 + neg = 1; + x = -xx; + } else { + x = xx; + 34b: 89 d0 mov %edx,%eax + neg = 0; + 34d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 354: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 357: 31 ff xor %edi,%edi + 359: 89 ce mov %ecx,%esi + 35b: 8d 5d d7 lea -0x29(%ebp),%ebx + 35e: eb 02 jmp 362 + do{ + buf[i++] = digits[x % base]; + 360: 89 cf mov %ecx,%edi + 362: 31 d2 xor %edx,%edx + 364: f7 f6 div %esi + 366: 8d 4f 01 lea 0x1(%edi),%ecx + 369: 0f b6 92 57 07 00 00 movzbl 0x757(%edx),%edx + }while((x /= base) != 0); + 370: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 372: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 375: 75 e9 jne 360 + if(neg) + 377: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 37a: 89 c8 mov %ecx,%eax + 37c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 37f: 85 d2 test %edx,%edx + 381: 74 08 je 38b + buf[i++] = '-'; + 383: 8d 4f 02 lea 0x2(%edi),%ecx + 386: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 38b: 8d 79 ff lea -0x1(%ecx),%edi + 38e: 66 90 xchg %ax,%ax + 390: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 395: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 398: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 39f: 00 + 3a0: 89 5c 24 04 mov %ebx,0x4(%esp) + 3a4: 89 34 24 mov %esi,(%esp) + 3a7: 88 45 d7 mov %al,-0x29(%ebp) + 3aa: e8 f3 fe ff ff call 2a2 + while(--i >= 0) + 3af: 83 ff ff cmp $0xffffffff,%edi + 3b2: 75 dc jne 390 + putc(fd, buf[i]); +} + 3b4: 83 c4 4c add $0x4c,%esp + 3b7: 5b pop %ebx + 3b8: 5e pop %esi + 3b9: 5f pop %edi + 3ba: 5d pop %ebp + 3bb: c3 ret + 3bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 3c0: 89 d0 mov %edx,%eax + 3c2: f7 d8 neg %eax + neg = 1; + 3c4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 3cb: eb 87 jmp 354 + 3cd: 8d 76 00 lea 0x0(%esi),%esi + +000003d0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3d0: 55 push %ebp + 3d1: 89 e5 mov %esp,%ebp + 3d3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3d4: 31 ff xor %edi,%edi +{ + 3d6: 56 push %esi + 3d7: 53 push %ebx + 3d8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3db: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3de: 8d 45 10 lea 0x10(%ebp),%eax +{ + 3e1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 3e4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 3e7: 0f b6 13 movzbl (%ebx),%edx + 3ea: 83 c3 01 add $0x1,%ebx + 3ed: 84 d2 test %dl,%dl + 3ef: 75 39 jne 42a + 3f1: e9 c2 00 00 00 jmp 4b8 + 3f6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 3f8: 83 fa 25 cmp $0x25,%edx + 3fb: 0f 84 bf 00 00 00 je 4c0 + write(fd, &c, 1); + 401: 8d 45 e2 lea -0x1e(%ebp),%eax + 404: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 40b: 00 + 40c: 89 44 24 04 mov %eax,0x4(%esp) + 410: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 413: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 416: e8 87 fe ff ff call 2a2 + 41b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 41e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 422: 84 d2 test %dl,%dl + 424: 0f 84 8e 00 00 00 je 4b8 + if(state == 0){ + 42a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 42c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 42f: 74 c7 je 3f8 + } + } else if(state == '%'){ + 431: 83 ff 25 cmp $0x25,%edi + 434: 75 e5 jne 41b + if(c == 'd'){ + 436: 83 fa 64 cmp $0x64,%edx + 439: 0f 84 31 01 00 00 je 570 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 43f: 25 f7 00 00 00 and $0xf7,%eax + 444: 83 f8 70 cmp $0x70,%eax + 447: 0f 84 83 00 00 00 je 4d0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 44d: 83 fa 73 cmp $0x73,%edx + 450: 0f 84 a2 00 00 00 je 4f8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 456: 83 fa 63 cmp $0x63,%edx + 459: 0f 84 35 01 00 00 je 594 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 45f: 83 fa 25 cmp $0x25,%edx + 462: 0f 84 e0 00 00 00 je 548 + write(fd, &c, 1); + 468: 8d 45 e6 lea -0x1a(%ebp),%eax + 46b: 83 c3 01 add $0x1,%ebx + 46e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 475: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 476: 31 ff xor %edi,%edi + write(fd, &c, 1); + 478: 89 44 24 04 mov %eax,0x4(%esp) + 47c: 89 34 24 mov %esi,(%esp) + 47f: 89 55 d0 mov %edx,-0x30(%ebp) + 482: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 486: e8 17 fe ff ff call 2a2 + putc(fd, c); + 48b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 48e: 8d 45 e7 lea -0x19(%ebp),%eax + 491: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 498: 00 + 499: 89 44 24 04 mov %eax,0x4(%esp) + 49d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4a0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4a3: e8 fa fd ff ff call 2a2 + for(i = 0; fmt[i]; i++){ + 4a8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4ac: 84 d2 test %dl,%dl + 4ae: 0f 85 76 ff ff ff jne 42a + 4b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4b8: 83 c4 3c add $0x3c,%esp + 4bb: 5b pop %ebx + 4bc: 5e pop %esi + 4bd: 5f pop %edi + 4be: 5d pop %ebp + 4bf: c3 ret + state = '%'; + 4c0: bf 25 00 00 00 mov $0x25,%edi + 4c5: e9 51 ff ff ff jmp 41b + 4ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4d0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4d3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4d8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4da: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 4e1: 8b 10 mov (%eax),%edx + 4e3: 89 f0 mov %esi,%eax + 4e5: e8 46 fe ff ff call 330 + ap++; + 4ea: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 4ee: e9 28 ff ff ff jmp 41b + 4f3: 90 nop + 4f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 4f8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 4fb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 4ff: 8b 38 mov (%eax),%edi + s = "(null)"; + 501: b8 50 07 00 00 mov $0x750,%eax + 506: 85 ff test %edi,%edi + 508: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 50b: 0f b6 07 movzbl (%edi),%eax + 50e: 84 c0 test %al,%al + 510: 74 2a je 53c + 512: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 518: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 51b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 51e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 521: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 528: 00 + 529: 89 44 24 04 mov %eax,0x4(%esp) + 52d: 89 34 24 mov %esi,(%esp) + 530: e8 6d fd ff ff call 2a2 + while(*s != 0){ + 535: 0f b6 07 movzbl (%edi),%eax + 538: 84 c0 test %al,%al + 53a: 75 dc jne 518 + state = 0; + 53c: 31 ff xor %edi,%edi + 53e: e9 d8 fe ff ff jmp 41b + 543: 90 nop + 544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 548: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 54b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 54d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 554: 00 + 555: 89 44 24 04 mov %eax,0x4(%esp) + 559: 89 34 24 mov %esi,(%esp) + 55c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 560: e8 3d fd ff ff call 2a2 + 565: e9 b1 fe ff ff jmp 41b + 56a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 570: 8b 45 d4 mov -0x2c(%ebp),%eax + 573: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 578: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 57b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 582: 8b 10 mov (%eax),%edx + 584: 89 f0 mov %esi,%eax + 586: e8 a5 fd ff ff call 330 + ap++; + 58b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 58f: e9 87 fe ff ff jmp 41b + putc(fd, *ap); + 594: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 597: 31 ff xor %edi,%edi + putc(fd, *ap); + 599: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 59b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5a2: 00 + 5a3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 5a6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 5a9: 8d 45 e4 lea -0x1c(%ebp),%eax + 5ac: 89 44 24 04 mov %eax,0x4(%esp) + 5b0: e8 ed fc ff ff call 2a2 + ap++; + 5b5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5b9: e9 5d fe ff ff jmp 41b + 5be: 66 90 xchg %ax,%ax + +000005c0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 5c0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5c1: a1 cc 09 00 00 mov 0x9cc,%eax +{ + 5c6: 89 e5 mov %esp,%ebp + 5c8: 57 push %edi + 5c9: 56 push %esi + 5ca: 53 push %ebx + 5cb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5ce: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5d0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5d3: 39 d0 cmp %edx,%eax + 5d5: 72 11 jb 5e8 + 5d7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5d8: 39 c8 cmp %ecx,%eax + 5da: 72 04 jb 5e0 + 5dc: 39 ca cmp %ecx,%edx + 5de: 72 10 jb 5f0 + 5e0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5e4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e6: 73 f0 jae 5d8 + 5e8: 39 ca cmp %ecx,%edx + 5ea: 72 04 jb 5f0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5ec: 39 c8 cmp %ecx,%eax + 5ee: 72 f0 jb 5e0 + break; + if(bp + bp->s.size == p->s.ptr){ + 5f0: 8b 73 fc mov -0x4(%ebx),%esi + 5f3: 8d 3c f2 lea (%edx,%esi,8),%edi + 5f6: 39 cf cmp %ecx,%edi + 5f8: 74 1e je 618 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 5fa: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 5fd: 8b 48 04 mov 0x4(%eax),%ecx + 600: 8d 34 c8 lea (%eax,%ecx,8),%esi + 603: 39 f2 cmp %esi,%edx + 605: 74 28 je 62f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 607: 89 10 mov %edx,(%eax) + freep = p; + 609: a3 cc 09 00 00 mov %eax,0x9cc +} + 60e: 5b pop %ebx + 60f: 5e pop %esi + 610: 5f pop %edi + 611: 5d pop %ebp + 612: c3 ret + 613: 90 nop + 614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 618: 03 71 04 add 0x4(%ecx),%esi + 61b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 61e: 8b 08 mov (%eax),%ecx + 620: 8b 09 mov (%ecx),%ecx + 622: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 625: 8b 48 04 mov 0x4(%eax),%ecx + 628: 8d 34 c8 lea (%eax,%ecx,8),%esi + 62b: 39 f2 cmp %esi,%edx + 62d: 75 d8 jne 607 + p->s.size += bp->s.size; + 62f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 632: a3 cc 09 00 00 mov %eax,0x9cc + p->s.size += bp->s.size; + 637: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 63a: 8b 53 f8 mov -0x8(%ebx),%edx + 63d: 89 10 mov %edx,(%eax) +} + 63f: 5b pop %ebx + 640: 5e pop %esi + 641: 5f pop %edi + 642: 5d pop %ebp + 643: c3 ret + 644: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 64a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000650 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 650: 55 push %ebp + 651: 89 e5 mov %esp,%ebp + 653: 57 push %edi + 654: 56 push %esi + 655: 53 push %ebx + 656: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 659: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 65c: 8b 1d cc 09 00 00 mov 0x9cc,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 662: 8d 48 07 lea 0x7(%eax),%ecx + 665: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 668: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 66a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 66d: 0f 84 9b 00 00 00 je 70e + 673: 8b 13 mov (%ebx),%edx + 675: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 678: 39 fe cmp %edi,%esi + 67a: 76 64 jbe 6e0 + 67c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 683: bb 00 80 00 00 mov $0x8000,%ebx + 688: 89 45 e4 mov %eax,-0x1c(%ebp) + 68b: eb 0e jmp 69b + 68d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 690: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 692: 8b 78 04 mov 0x4(%eax),%edi + 695: 39 fe cmp %edi,%esi + 697: 76 4f jbe 6e8 + 699: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 69b: 3b 15 cc 09 00 00 cmp 0x9cc,%edx + 6a1: 75 ed jne 690 + if(nu < 4096) + 6a3: 8b 45 e4 mov -0x1c(%ebp),%eax + 6a6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 6ac: bf 00 10 00 00 mov $0x1000,%edi + 6b1: 0f 43 fe cmovae %esi,%edi + 6b4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 6b7: 89 04 24 mov %eax,(%esp) + 6ba: e8 4b fc ff ff call 30a + if(p == (char*)-1) + 6bf: 83 f8 ff cmp $0xffffffff,%eax + 6c2: 74 18 je 6dc + hp->s.size = nu; + 6c4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 6c7: 83 c0 08 add $0x8,%eax + 6ca: 89 04 24 mov %eax,(%esp) + 6cd: e8 ee fe ff ff call 5c0 + return freep; + 6d2: 8b 15 cc 09 00 00 mov 0x9cc,%edx + if((p = morecore(nunits)) == 0) + 6d8: 85 d2 test %edx,%edx + 6da: 75 b4 jne 690 + return 0; + 6dc: 31 c0 xor %eax,%eax + 6de: eb 20 jmp 700 + if(p->s.size >= nunits){ + 6e0: 89 d0 mov %edx,%eax + 6e2: 89 da mov %ebx,%edx + 6e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 6e8: 39 fe cmp %edi,%esi + 6ea: 74 1c je 708 + p->s.size -= nunits; + 6ec: 29 f7 sub %esi,%edi + 6ee: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 6f1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 6f4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 6f7: 89 15 cc 09 00 00 mov %edx,0x9cc + return (void*)(p + 1); + 6fd: 83 c0 08 add $0x8,%eax + } +} + 700: 83 c4 1c add $0x1c,%esp + 703: 5b pop %ebx + 704: 5e pop %esi + 705: 5f pop %edi + 706: 5d pop %ebp + 707: c3 ret + prevp->s.ptr = p->s.ptr; + 708: 8b 08 mov (%eax),%ecx + 70a: 89 0a mov %ecx,(%edx) + 70c: eb e9 jmp 6f7 + base.s.ptr = freep = prevp = &base; + 70e: c7 05 cc 09 00 00 d0 movl $0x9d0,0x9cc + 715: 09 00 00 + base.s.size = 0; + 718: ba d0 09 00 00 mov $0x9d0,%edx + base.s.ptr = freep = prevp = &base; + 71d: c7 05 d0 09 00 00 d0 movl $0x9d0,0x9d0 + 724: 09 00 00 + base.s.size = 0; + 727: c7 05 d4 09 00 00 00 movl $0x0,0x9d4 + 72e: 00 00 00 + 731: e9 46 ff ff ff jmp 67c diff --git a/hello.c b/hello.c new file mode 100644 index 0000000000..50e7b2992f --- /dev/null +++ b/hello.c @@ -0,0 +1,11 @@ +#include "types.h" +#include "user.h" + +int main(int argc, char **argv) +{ + + printf(1, "Waiting...\n"); + wait(0); + printf(1, "Hello World!\n"); + exit(0); +} diff --git a/hello.d b/hello.d new file mode 100644 index 0000000000..8d6eb56b92 --- /dev/null +++ b/hello.d @@ -0,0 +1 @@ +hello.o: hello.c /usr/include/stdc-predef.h types.h user.h diff --git a/hello.o b/hello.o new file mode 100644 index 0000000000..a903947f42 Binary files /dev/null and b/hello.o differ diff --git a/hello.sym b/hello.sym new file mode 100644 index 0000000000..6040663eae --- /dev/null +++ b/hello.sym @@ -0,0 +1,57 @@ +00000000 .text +00000736 .rodata +00000768 .eh_frame +000009cc .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 hello.c +00000000 ulib.c +00000000 printf.c +00000330 printint +00000757 digits.1354 +00000000 umalloc.c +000009cc freep +000009d0 base +00000060 strcpy +000003d0 printf +00000250 memmove +000002ca mknod +00000170 gets +00000302 getpid +00000650 malloc +00000312 sleep +00000292 pipe +000002a2 write +000002da fstat +000002b2 kill +000002f2 chdir +000002ba exec +0000028a wait +0000029a read +000002d2 unlink +0000027a fork +0000030a sbrk +0000031a uptime +000009cc __bss_start +00000110 memset +00000000 main +00000090 strcmp +000002fa dup +000001d0 stat +000009cc _edata +000009d8 _end +000002e2 link +00000282 exit +00000220 atoi +000000e0 strlen +000002c2 open +00000130 strchr +000002ea mkdir +000002aa close +000005c0 free diff --git a/ide.d b/ide.d new file mode 100644 index 0000000000..21155b97e7 --- /dev/null +++ b/ide.d @@ -0,0 +1,2 @@ +ide.o: ide.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h proc.h x86.h traps.h spinlock.h sleeplock.h fs.h buf.h diff --git a/ide.o b/ide.o new file mode 100644 index 0000000000..9d86db0cde Binary files /dev/null and b/ide.o differ diff --git a/init.asm b/init.asm new file mode 100644 index 0000000000..a3a86aa156 --- /dev/null +++ b/init.asm @@ -0,0 +1,1182 @@ + +_init: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "fcntl.h" + +char *argv[] = {"sh", 0}; + +int main(void) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 53 push %ebx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: 83 ec 10 sub $0x10,%esp + int pid, wpid; + + if (open("console", O_RDWR) < 0) + a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 11: 00 + 12: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) + 19: e8 64 03 00 00 call 382 + 1e: 85 c0 test %eax,%eax + 20: 0f 88 c0 00 00 00 js e6 + { + mknod("console", 1, 1); + open("console", O_RDWR); + } + dup(0); // stdout + 26: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2d: e8 88 03 00 00 call 3ba + dup(0); // stderr + 32: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 39: e8 7c 03 00 00 call 3ba + 3e: 66 90 xchg %ax,%ax + + for (;;) + { + printf(1, "init: starting sh\n"); + 40: c7 44 24 04 fe 07 00 movl $0x7fe,0x4(%esp) + 47: 00 + 48: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 4f: e8 3c 04 00 00 call 490 + pid = fork(); + 54: e8 e1 02 00 00 call 33a + if (pid < 0) + 59: 85 c0 test %eax,%eax + pid = fork(); + 5b: 89 c3 mov %eax,%ebx + if (pid < 0) + 5d: 78 33 js 92 + 5f: 90 nop + { + printf(1, "init: fork failed\n"); + exit(0); + } + if (pid == 0) + 60: 74 50 je b2 + 62: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + { + exec("sh", argv); + printf(1, "init: exec sh failed\n"); + exit(0); + } + while ((wpid = wait(0)) >= 0 && wpid != pid) + 68: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 6f: e8 d6 02 00 00 call 34a + 74: 85 c0 test %eax,%eax + 76: 78 c8 js 40 + 78: 39 d8 cmp %ebx,%eax + 7a: 74 c4 je 40 + printf(1, "zombie!\n"); + 7c: c7 44 24 04 3d 08 00 movl $0x83d,0x4(%esp) + 83: 00 + 84: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 8b: e8 00 04 00 00 call 490 + 90: eb d6 jmp 68 + printf(1, "init: fork failed\n"); + 92: c7 44 24 04 11 08 00 movl $0x811,0x4(%esp) + 99: 00 + 9a: c7 04 24 01 00 00 00 movl $0x1,(%esp) + a1: e8 ea 03 00 00 call 490 + exit(0); + a6: c7 04 24 00 00 00 00 movl $0x0,(%esp) + ad: e8 90 02 00 00 call 342 + exec("sh", argv); + b2: c7 44 24 04 c4 0a 00 movl $0xac4,0x4(%esp) + b9: 00 + ba: c7 04 24 24 08 00 00 movl $0x824,(%esp) + c1: e8 b4 02 00 00 call 37a + printf(1, "init: exec sh failed\n"); + c6: c7 44 24 04 27 08 00 movl $0x827,0x4(%esp) + cd: 00 + ce: c7 04 24 01 00 00 00 movl $0x1,(%esp) + d5: e8 b6 03 00 00 call 490 + exit(0); + da: c7 04 24 00 00 00 00 movl $0x0,(%esp) + e1: e8 5c 02 00 00 call 342 + mknod("console", 1, 1); + e6: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + ed: 00 + ee: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) + f5: 00 + f6: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) + fd: e8 88 02 00 00 call 38a + open("console", O_RDWR); + 102: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 109: 00 + 10a: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) + 111: e8 6c 02 00 00 call 382 + 116: e9 0b ff ff ff jmp 26 + 11b: 66 90 xchg %ax,%ax + 11d: 66 90 xchg %ax,%ax + 11f: 90 nop + +00000120 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 120: 55 push %ebp + 121: 89 e5 mov %esp,%ebp + 123: 8b 45 08 mov 0x8(%ebp),%eax + 126: 8b 4d 0c mov 0xc(%ebp),%ecx + 129: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 12a: 89 c2 mov %eax,%edx + 12c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 130: 83 c1 01 add $0x1,%ecx + 133: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 137: 83 c2 01 add $0x1,%edx + 13a: 84 db test %bl,%bl + 13c: 88 5a ff mov %bl,-0x1(%edx) + 13f: 75 ef jne 130 + ; + return os; +} + 141: 5b pop %ebx + 142: 5d pop %ebp + 143: c3 ret + 144: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 14a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000150 : + +int +strcmp(const char *p, const char *q) +{ + 150: 55 push %ebp + 151: 89 e5 mov %esp,%ebp + 153: 8b 55 08 mov 0x8(%ebp),%edx + 156: 53 push %ebx + 157: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 15a: 0f b6 02 movzbl (%edx),%eax + 15d: 84 c0 test %al,%al + 15f: 74 2d je 18e + 161: 0f b6 19 movzbl (%ecx),%ebx + 164: 38 d8 cmp %bl,%al + 166: 74 0e je 176 + 168: eb 2b jmp 195 + 16a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 170: 38 c8 cmp %cl,%al + 172: 75 15 jne 189 + p++, q++; + 174: 89 d9 mov %ebx,%ecx + 176: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 179: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 17c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 17f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 183: 84 c0 test %al,%al + 185: 75 e9 jne 170 + 187: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 189: 29 c8 sub %ecx,%eax +} + 18b: 5b pop %ebx + 18c: 5d pop %ebp + 18d: c3 ret + 18e: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 191: 31 c0 xor %eax,%eax + 193: eb f4 jmp 189 + 195: 0f b6 cb movzbl %bl,%ecx + 198: eb ef jmp 189 + 19a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000001a0 : + +uint +strlen(const char *s) +{ + 1a0: 55 push %ebp + 1a1: 89 e5 mov %esp,%ebp + 1a3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 1a6: 80 39 00 cmpb $0x0,(%ecx) + 1a9: 74 12 je 1bd + 1ab: 31 d2 xor %edx,%edx + 1ad: 8d 76 00 lea 0x0(%esi),%esi + 1b0: 83 c2 01 add $0x1,%edx + 1b3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 1b7: 89 d0 mov %edx,%eax + 1b9: 75 f5 jne 1b0 + ; + return n; +} + 1bb: 5d pop %ebp + 1bc: c3 ret + for(n = 0; s[n]; n++) + 1bd: 31 c0 xor %eax,%eax +} + 1bf: 5d pop %ebp + 1c0: c3 ret + 1c1: eb 0d jmp 1d0 + 1c3: 90 nop + 1c4: 90 nop + 1c5: 90 nop + 1c6: 90 nop + 1c7: 90 nop + 1c8: 90 nop + 1c9: 90 nop + 1ca: 90 nop + 1cb: 90 nop + 1cc: 90 nop + 1cd: 90 nop + 1ce: 90 nop + 1cf: 90 nop + +000001d0 : + +void* +memset(void *dst, int c, uint n) +{ + 1d0: 55 push %ebp + 1d1: 89 e5 mov %esp,%ebp + 1d3: 8b 55 08 mov 0x8(%ebp),%edx + 1d6: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 1d7: 8b 4d 10 mov 0x10(%ebp),%ecx + 1da: 8b 45 0c mov 0xc(%ebp),%eax + 1dd: 89 d7 mov %edx,%edi + 1df: fc cld + 1e0: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 1e2: 89 d0 mov %edx,%eax + 1e4: 5f pop %edi + 1e5: 5d pop %ebp + 1e6: c3 ret + 1e7: 89 f6 mov %esi,%esi + 1e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000001f0 : + +char* +strchr(const char *s, char c) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 8b 45 08 mov 0x8(%ebp),%eax + 1f6: 53 push %ebx + 1f7: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 1fa: 0f b6 18 movzbl (%eax),%ebx + 1fd: 84 db test %bl,%bl + 1ff: 74 1d je 21e + if(*s == c) + 201: 38 d3 cmp %dl,%bl + 203: 89 d1 mov %edx,%ecx + 205: 75 0d jne 214 + 207: eb 17 jmp 220 + 209: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 210: 38 ca cmp %cl,%dl + 212: 74 0c je 220 + for(; *s; s++) + 214: 83 c0 01 add $0x1,%eax + 217: 0f b6 10 movzbl (%eax),%edx + 21a: 84 d2 test %dl,%dl + 21c: 75 f2 jne 210 + return (char*)s; + return 0; + 21e: 31 c0 xor %eax,%eax +} + 220: 5b pop %ebx + 221: 5d pop %ebp + 222: c3 ret + 223: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000230 : + +char* +gets(char *buf, int max) +{ + 230: 55 push %ebp + 231: 89 e5 mov %esp,%ebp + 233: 57 push %edi + 234: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 235: 31 f6 xor %esi,%esi +{ + 237: 53 push %ebx + 238: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 23b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 23e: eb 31 jmp 271 + cc = read(0, &c, 1); + 240: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 247: 00 + 248: 89 7c 24 04 mov %edi,0x4(%esp) + 24c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 253: e8 02 01 00 00 call 35a + if(cc < 1) + 258: 85 c0 test %eax,%eax + 25a: 7e 1d jle 279 + break; + buf[i++] = c; + 25c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 260: 89 de mov %ebx,%esi + buf[i++] = c; + 262: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 265: 3c 0d cmp $0xd,%al + buf[i++] = c; + 267: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 26b: 74 0c je 279 + 26d: 3c 0a cmp $0xa,%al + 26f: 74 08 je 279 + for(i=0; i+1 < max; ){ + 271: 8d 5e 01 lea 0x1(%esi),%ebx + 274: 3b 5d 0c cmp 0xc(%ebp),%ebx + 277: 7c c7 jl 240 + break; + } + buf[i] = '\0'; + 279: 8b 45 08 mov 0x8(%ebp),%eax + 27c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 280: 83 c4 2c add $0x2c,%esp + 283: 5b pop %ebx + 284: 5e pop %esi + 285: 5f pop %edi + 286: 5d pop %ebp + 287: c3 ret + 288: 90 nop + 289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000290 : + +int +stat(const char *n, struct stat *st) +{ + 290: 55 push %ebp + 291: 89 e5 mov %esp,%ebp + 293: 56 push %esi + 294: 53 push %ebx + 295: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 298: 8b 45 08 mov 0x8(%ebp),%eax + 29b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2a2: 00 + 2a3: 89 04 24 mov %eax,(%esp) + 2a6: e8 d7 00 00 00 call 382 + if(fd < 0) + 2ab: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 2ad: 89 c3 mov %eax,%ebx + if(fd < 0) + 2af: 78 27 js 2d8 + return -1; + r = fstat(fd, st); + 2b1: 8b 45 0c mov 0xc(%ebp),%eax + 2b4: 89 1c 24 mov %ebx,(%esp) + 2b7: 89 44 24 04 mov %eax,0x4(%esp) + 2bb: e8 da 00 00 00 call 39a + close(fd); + 2c0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 2c3: 89 c6 mov %eax,%esi + close(fd); + 2c5: e8 a0 00 00 00 call 36a + return r; + 2ca: 89 f0 mov %esi,%eax +} + 2cc: 83 c4 10 add $0x10,%esp + 2cf: 5b pop %ebx + 2d0: 5e pop %esi + 2d1: 5d pop %ebp + 2d2: c3 ret + 2d3: 90 nop + 2d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 2d8: b8 ff ff ff ff mov $0xffffffff,%eax + 2dd: eb ed jmp 2cc + 2df: 90 nop + +000002e0 : + +int +atoi(const char *s) +{ + 2e0: 55 push %ebp + 2e1: 89 e5 mov %esp,%ebp + 2e3: 8b 4d 08 mov 0x8(%ebp),%ecx + 2e6: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 2e7: 0f be 11 movsbl (%ecx),%edx + 2ea: 8d 42 d0 lea -0x30(%edx),%eax + 2ed: 3c 09 cmp $0x9,%al + n = 0; + 2ef: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 2f4: 77 17 ja 30d + 2f6: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 2f8: 83 c1 01 add $0x1,%ecx + 2fb: 8d 04 80 lea (%eax,%eax,4),%eax + 2fe: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 302: 0f be 11 movsbl (%ecx),%edx + 305: 8d 5a d0 lea -0x30(%edx),%ebx + 308: 80 fb 09 cmp $0x9,%bl + 30b: 76 eb jbe 2f8 + return n; +} + 30d: 5b pop %ebx + 30e: 5d pop %ebp + 30f: c3 ret + +00000310 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 310: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 311: 31 d2 xor %edx,%edx +{ + 313: 89 e5 mov %esp,%ebp + 315: 56 push %esi + 316: 8b 45 08 mov 0x8(%ebp),%eax + 319: 53 push %ebx + 31a: 8b 5d 10 mov 0x10(%ebp),%ebx + 31d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 320: 85 db test %ebx,%ebx + 322: 7e 12 jle 336 + 324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 328: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 32c: 88 0c 10 mov %cl,(%eax,%edx,1) + 32f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 332: 39 da cmp %ebx,%edx + 334: 75 f2 jne 328 + return vdst; +} + 336: 5b pop %ebx + 337: 5e pop %esi + 338: 5d pop %ebp + 339: c3 ret + +0000033a : + 33a: b8 01 00 00 00 mov $0x1,%eax + 33f: cd 40 int $0x40 + 341: c3 ret + +00000342 : + 342: b8 02 00 00 00 mov $0x2,%eax + 347: cd 40 int $0x40 + 349: c3 ret + +0000034a : + 34a: b8 03 00 00 00 mov $0x3,%eax + 34f: cd 40 int $0x40 + 351: c3 ret + +00000352 : + 352: b8 04 00 00 00 mov $0x4,%eax + 357: cd 40 int $0x40 + 359: c3 ret + +0000035a : + 35a: b8 05 00 00 00 mov $0x5,%eax + 35f: cd 40 int $0x40 + 361: c3 ret + +00000362 : + 362: b8 10 00 00 00 mov $0x10,%eax + 367: cd 40 int $0x40 + 369: c3 ret + +0000036a : + 36a: b8 15 00 00 00 mov $0x15,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + +00000372 : + 372: b8 06 00 00 00 mov $0x6,%eax + 377: cd 40 int $0x40 + 379: c3 ret + +0000037a : + 37a: b8 07 00 00 00 mov $0x7,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + +00000382 : + 382: b8 0f 00 00 00 mov $0xf,%eax + 387: cd 40 int $0x40 + 389: c3 ret + +0000038a : + 38a: b8 11 00 00 00 mov $0x11,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + +00000392 : + 392: b8 12 00 00 00 mov $0x12,%eax + 397: cd 40 int $0x40 + 399: c3 ret + +0000039a : + 39a: b8 08 00 00 00 mov $0x8,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + +000003a2 : + 3a2: b8 13 00 00 00 mov $0x13,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + +000003aa : + 3aa: b8 14 00 00 00 mov $0x14,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + +000003b2 : + 3b2: b8 09 00 00 00 mov $0x9,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + +000003ba : + 3ba: b8 0a 00 00 00 mov $0xa,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + +000003c2 : + 3c2: b8 0b 00 00 00 mov $0xb,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + +000003ca : + 3ca: b8 0c 00 00 00 mov $0xc,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + +000003d2 : + 3d2: b8 0d 00 00 00 mov $0xd,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + +000003da : + 3da: b8 0e 00 00 00 mov $0xe,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + 3e2: 66 90 xchg %ax,%ax + 3e4: 66 90 xchg %ax,%ax + 3e6: 66 90 xchg %ax,%ax + 3e8: 66 90 xchg %ax,%ax + 3ea: 66 90 xchg %ax,%ax + 3ec: 66 90 xchg %ax,%ax + 3ee: 66 90 xchg %ax,%ax + +000003f0 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 3f0: 55 push %ebp + 3f1: 89 e5 mov %esp,%ebp + 3f3: 57 push %edi + 3f4: 56 push %esi + 3f5: 89 c6 mov %eax,%esi + 3f7: 53 push %ebx + 3f8: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 3fb: 8b 5d 08 mov 0x8(%ebp),%ebx + 3fe: 85 db test %ebx,%ebx + 400: 74 09 je 40b + 402: 89 d0 mov %edx,%eax + 404: c1 e8 1f shr $0x1f,%eax + 407: 84 c0 test %al,%al + 409: 75 75 jne 480 + neg = 1; + x = -xx; + } else { + x = xx; + 40b: 89 d0 mov %edx,%eax + neg = 0; + 40d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 414: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 417: 31 ff xor %edi,%edi + 419: 89 ce mov %ecx,%esi + 41b: 8d 5d d7 lea -0x29(%ebp),%ebx + 41e: eb 02 jmp 422 + do{ + buf[i++] = digits[x % base]; + 420: 89 cf mov %ecx,%edi + 422: 31 d2 xor %edx,%edx + 424: f7 f6 div %esi + 426: 8d 4f 01 lea 0x1(%edi),%ecx + 429: 0f b6 92 4d 08 00 00 movzbl 0x84d(%edx),%edx + }while((x /= base) != 0); + 430: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 432: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 435: 75 e9 jne 420 + if(neg) + 437: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 43a: 89 c8 mov %ecx,%eax + 43c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 43f: 85 d2 test %edx,%edx + 441: 74 08 je 44b + buf[i++] = '-'; + 443: 8d 4f 02 lea 0x2(%edi),%ecx + 446: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 44b: 8d 79 ff lea -0x1(%ecx),%edi + 44e: 66 90 xchg %ax,%ax + 450: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 455: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 458: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 45f: 00 + 460: 89 5c 24 04 mov %ebx,0x4(%esp) + 464: 89 34 24 mov %esi,(%esp) + 467: 88 45 d7 mov %al,-0x29(%ebp) + 46a: e8 f3 fe ff ff call 362 + while(--i >= 0) + 46f: 83 ff ff cmp $0xffffffff,%edi + 472: 75 dc jne 450 + putc(fd, buf[i]); +} + 474: 83 c4 4c add $0x4c,%esp + 477: 5b pop %ebx + 478: 5e pop %esi + 479: 5f pop %edi + 47a: 5d pop %ebp + 47b: c3 ret + 47c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 480: 89 d0 mov %edx,%eax + 482: f7 d8 neg %eax + neg = 1; + 484: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 48b: eb 87 jmp 414 + 48d: 8d 76 00 lea 0x0(%esi),%esi + +00000490 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 490: 55 push %ebp + 491: 89 e5 mov %esp,%ebp + 493: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 494: 31 ff xor %edi,%edi +{ + 496: 56 push %esi + 497: 53 push %ebx + 498: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 49b: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 49e: 8d 45 10 lea 0x10(%ebp),%eax +{ + 4a1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 4a4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 4a7: 0f b6 13 movzbl (%ebx),%edx + 4aa: 83 c3 01 add $0x1,%ebx + 4ad: 84 d2 test %dl,%dl + 4af: 75 39 jne 4ea + 4b1: e9 c2 00 00 00 jmp 578 + 4b6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 4b8: 83 fa 25 cmp $0x25,%edx + 4bb: 0f 84 bf 00 00 00 je 580 + write(fd, &c, 1); + 4c1: 8d 45 e2 lea -0x1e(%ebp),%eax + 4c4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4cb: 00 + 4cc: 89 44 24 04 mov %eax,0x4(%esp) + 4d0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 4d3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 4d6: e8 87 fe ff ff call 362 + 4db: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 4de: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4e2: 84 d2 test %dl,%dl + 4e4: 0f 84 8e 00 00 00 je 578 + if(state == 0){ + 4ea: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 4ec: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 4ef: 74 c7 je 4b8 + } + } else if(state == '%'){ + 4f1: 83 ff 25 cmp $0x25,%edi + 4f4: 75 e5 jne 4db + if(c == 'd'){ + 4f6: 83 fa 64 cmp $0x64,%edx + 4f9: 0f 84 31 01 00 00 je 630 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 4ff: 25 f7 00 00 00 and $0xf7,%eax + 504: 83 f8 70 cmp $0x70,%eax + 507: 0f 84 83 00 00 00 je 590 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 50d: 83 fa 73 cmp $0x73,%edx + 510: 0f 84 a2 00 00 00 je 5b8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 516: 83 fa 63 cmp $0x63,%edx + 519: 0f 84 35 01 00 00 je 654 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 51f: 83 fa 25 cmp $0x25,%edx + 522: 0f 84 e0 00 00 00 je 608 + write(fd, &c, 1); + 528: 8d 45 e6 lea -0x1a(%ebp),%eax + 52b: 83 c3 01 add $0x1,%ebx + 52e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 535: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 536: 31 ff xor %edi,%edi + write(fd, &c, 1); + 538: 89 44 24 04 mov %eax,0x4(%esp) + 53c: 89 34 24 mov %esi,(%esp) + 53f: 89 55 d0 mov %edx,-0x30(%ebp) + 542: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 546: e8 17 fe ff ff call 362 + putc(fd, c); + 54b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 54e: 8d 45 e7 lea -0x19(%ebp),%eax + 551: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 558: 00 + 559: 89 44 24 04 mov %eax,0x4(%esp) + 55d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 560: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 563: e8 fa fd ff ff call 362 + for(i = 0; fmt[i]; i++){ + 568: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 56c: 84 d2 test %dl,%dl + 56e: 0f 85 76 ff ff ff jne 4ea + 574: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 578: 83 c4 3c add $0x3c,%esp + 57b: 5b pop %ebx + 57c: 5e pop %esi + 57d: 5f pop %edi + 57e: 5d pop %ebp + 57f: c3 ret + state = '%'; + 580: bf 25 00 00 00 mov $0x25,%edi + 585: e9 51 ff ff ff jmp 4db + 58a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 590: 8b 45 d4 mov -0x2c(%ebp),%eax + 593: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 598: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 59a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 5a1: 8b 10 mov (%eax),%edx + 5a3: 89 f0 mov %esi,%eax + 5a5: e8 46 fe ff ff call 3f0 + ap++; + 5aa: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5ae: e9 28 ff ff ff jmp 4db + 5b3: 90 nop + 5b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 5b8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 5bb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 5bf: 8b 38 mov (%eax),%edi + s = "(null)"; + 5c1: b8 46 08 00 00 mov $0x846,%eax + 5c6: 85 ff test %edi,%edi + 5c8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 5cb: 0f b6 07 movzbl (%edi),%eax + 5ce: 84 c0 test %al,%al + 5d0: 74 2a je 5fc + 5d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 5d8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 5db: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 5de: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 5e1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5e8: 00 + 5e9: 89 44 24 04 mov %eax,0x4(%esp) + 5ed: 89 34 24 mov %esi,(%esp) + 5f0: e8 6d fd ff ff call 362 + while(*s != 0){ + 5f5: 0f b6 07 movzbl (%edi),%eax + 5f8: 84 c0 test %al,%al + 5fa: 75 dc jne 5d8 + state = 0; + 5fc: 31 ff xor %edi,%edi + 5fe: e9 d8 fe ff ff jmp 4db + 603: 90 nop + 604: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 608: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 60b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 60d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 614: 00 + 615: 89 44 24 04 mov %eax,0x4(%esp) + 619: 89 34 24 mov %esi,(%esp) + 61c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 620: e8 3d fd ff ff call 362 + 625: e9 b1 fe ff ff jmp 4db + 62a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 630: 8b 45 d4 mov -0x2c(%ebp),%eax + 633: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 638: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 63b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 642: 8b 10 mov (%eax),%edx + 644: 89 f0 mov %esi,%eax + 646: e8 a5 fd ff ff call 3f0 + ap++; + 64b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 64f: e9 87 fe ff ff jmp 4db + putc(fd, *ap); + 654: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 657: 31 ff xor %edi,%edi + putc(fd, *ap); + 659: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 65b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 662: 00 + 663: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 666: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 669: 8d 45 e4 lea -0x1c(%ebp),%eax + 66c: 89 44 24 04 mov %eax,0x4(%esp) + 670: e8 ed fc ff ff call 362 + ap++; + 675: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 679: e9 5d fe ff ff jmp 4db + 67e: 66 90 xchg %ax,%ax + +00000680 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 680: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 681: a1 cc 0a 00 00 mov 0xacc,%eax +{ + 686: 89 e5 mov %esp,%ebp + 688: 57 push %edi + 689: 56 push %esi + 68a: 53 push %ebx + 68b: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 68e: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 690: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 693: 39 d0 cmp %edx,%eax + 695: 72 11 jb 6a8 + 697: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 698: 39 c8 cmp %ecx,%eax + 69a: 72 04 jb 6a0 + 69c: 39 ca cmp %ecx,%edx + 69e: 72 10 jb 6b0 + 6a0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6a2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6a4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6a6: 73 f0 jae 698 + 6a8: 39 ca cmp %ecx,%edx + 6aa: 72 04 jb 6b0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6ac: 39 c8 cmp %ecx,%eax + 6ae: 72 f0 jb 6a0 + break; + if(bp + bp->s.size == p->s.ptr){ + 6b0: 8b 73 fc mov -0x4(%ebx),%esi + 6b3: 8d 3c f2 lea (%edx,%esi,8),%edi + 6b6: 39 cf cmp %ecx,%edi + 6b8: 74 1e je 6d8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 6ba: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 6bd: 8b 48 04 mov 0x4(%eax),%ecx + 6c0: 8d 34 c8 lea (%eax,%ecx,8),%esi + 6c3: 39 f2 cmp %esi,%edx + 6c5: 74 28 je 6ef + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 6c7: 89 10 mov %edx,(%eax) + freep = p; + 6c9: a3 cc 0a 00 00 mov %eax,0xacc +} + 6ce: 5b pop %ebx + 6cf: 5e pop %esi + 6d0: 5f pop %edi + 6d1: 5d pop %ebp + 6d2: c3 ret + 6d3: 90 nop + 6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 6d8: 03 71 04 add 0x4(%ecx),%esi + 6db: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 6de: 8b 08 mov (%eax),%ecx + 6e0: 8b 09 mov (%ecx),%ecx + 6e2: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 6e5: 8b 48 04 mov 0x4(%eax),%ecx + 6e8: 8d 34 c8 lea (%eax,%ecx,8),%esi + 6eb: 39 f2 cmp %esi,%edx + 6ed: 75 d8 jne 6c7 + p->s.size += bp->s.size; + 6ef: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 6f2: a3 cc 0a 00 00 mov %eax,0xacc + p->s.size += bp->s.size; + 6f7: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 6fa: 8b 53 f8 mov -0x8(%ebx),%edx + 6fd: 89 10 mov %edx,(%eax) +} + 6ff: 5b pop %ebx + 700: 5e pop %esi + 701: 5f pop %edi + 702: 5d pop %ebp + 703: c3 ret + 704: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 70a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000710 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 710: 55 push %ebp + 711: 89 e5 mov %esp,%ebp + 713: 57 push %edi + 714: 56 push %esi + 715: 53 push %ebx + 716: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 719: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 71c: 8b 1d cc 0a 00 00 mov 0xacc,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 722: 8d 48 07 lea 0x7(%eax),%ecx + 725: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 728: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 72a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 72d: 0f 84 9b 00 00 00 je 7ce + 733: 8b 13 mov (%ebx),%edx + 735: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 738: 39 fe cmp %edi,%esi + 73a: 76 64 jbe 7a0 + 73c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 743: bb 00 80 00 00 mov $0x8000,%ebx + 748: 89 45 e4 mov %eax,-0x1c(%ebp) + 74b: eb 0e jmp 75b + 74d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 750: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 752: 8b 78 04 mov 0x4(%eax),%edi + 755: 39 fe cmp %edi,%esi + 757: 76 4f jbe 7a8 + 759: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 75b: 3b 15 cc 0a 00 00 cmp 0xacc,%edx + 761: 75 ed jne 750 + if(nu < 4096) + 763: 8b 45 e4 mov -0x1c(%ebp),%eax + 766: 81 fe 00 10 00 00 cmp $0x1000,%esi + 76c: bf 00 10 00 00 mov $0x1000,%edi + 771: 0f 43 fe cmovae %esi,%edi + 774: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 777: 89 04 24 mov %eax,(%esp) + 77a: e8 4b fc ff ff call 3ca + if(p == (char*)-1) + 77f: 83 f8 ff cmp $0xffffffff,%eax + 782: 74 18 je 79c + hp->s.size = nu; + 784: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 787: 83 c0 08 add $0x8,%eax + 78a: 89 04 24 mov %eax,(%esp) + 78d: e8 ee fe ff ff call 680 + return freep; + 792: 8b 15 cc 0a 00 00 mov 0xacc,%edx + if((p = morecore(nunits)) == 0) + 798: 85 d2 test %edx,%edx + 79a: 75 b4 jne 750 + return 0; + 79c: 31 c0 xor %eax,%eax + 79e: eb 20 jmp 7c0 + if(p->s.size >= nunits){ + 7a0: 89 d0 mov %edx,%eax + 7a2: 89 da mov %ebx,%edx + 7a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 7a8: 39 fe cmp %edi,%esi + 7aa: 74 1c je 7c8 + p->s.size -= nunits; + 7ac: 29 f7 sub %esi,%edi + 7ae: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 7b1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 7b4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 7b7: 89 15 cc 0a 00 00 mov %edx,0xacc + return (void*)(p + 1); + 7bd: 83 c0 08 add $0x8,%eax + } +} + 7c0: 83 c4 1c add $0x1c,%esp + 7c3: 5b pop %ebx + 7c4: 5e pop %esi + 7c5: 5f pop %edi + 7c6: 5d pop %ebp + 7c7: c3 ret + prevp->s.ptr = p->s.ptr; + 7c8: 8b 08 mov (%eax),%ecx + 7ca: 89 0a mov %ecx,(%edx) + 7cc: eb e9 jmp 7b7 + base.s.ptr = freep = prevp = &base; + 7ce: c7 05 cc 0a 00 00 d0 movl $0xad0,0xacc + 7d5: 0a 00 00 + base.s.size = 0; + 7d8: ba d0 0a 00 00 mov $0xad0,%edx + base.s.ptr = freep = prevp = &base; + 7dd: c7 05 d0 0a 00 00 d0 movl $0xad0,0xad0 + 7e4: 0a 00 00 + base.s.size = 0; + 7e7: c7 05 d4 0a 00 00 00 movl $0x0,0xad4 + 7ee: 00 00 00 + 7f1: e9 46 ff ff ff jmp 73c diff --git a/init.c b/init.c index 046b551b71..b4cf955169 100644 --- a/init.c +++ b/init.c @@ -5,33 +5,36 @@ #include "user.h" #include "fcntl.h" -char *argv[] = { "sh", 0 }; +char *argv[] = {"sh", 0}; -int -main(void) +int main(void) { int pid, wpid; - if(open("console", O_RDWR) < 0){ + if (open("console", O_RDWR) < 0) + { mknod("console", 1, 1); open("console", O_RDWR); } - dup(0); // stdout - dup(0); // stderr + dup(0); // stdout + dup(0); // stderr - for(;;){ + for (;;) + { printf(1, "init: starting sh\n"); pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(1, "init: fork failed\n"); - exit(); + exit(0); } - if(pid == 0){ + if (pid == 0) + { exec("sh", argv); printf(1, "init: exec sh failed\n"); - exit(); + exit(0); } - while((wpid=wait()) >= 0 && wpid != pid) + while ((wpid = wait(0)) >= 0 && wpid != pid) printf(1, "zombie!\n"); } } diff --git a/init.d b/init.d new file mode 100644 index 0000000000..ee304c8a21 --- /dev/null +++ b/init.d @@ -0,0 +1 @@ +init.o: init.c /usr/include/stdc-predef.h types.h stat.h user.h fcntl.h diff --git a/init.o b/init.o new file mode 100644 index 0000000000..bfc015b8f4 Binary files /dev/null and b/init.o differ diff --git a/init.sym b/init.sym new file mode 100644 index 0000000000..d5e3ee7053 --- /dev/null +++ b/init.sym @@ -0,0 +1,59 @@ +00000000 .text +000007f6 .rodata +00000860 .eh_frame +00000ac4 .data +00000acc .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 init.c +00000000 ulib.c +00000000 printf.c +000003f0 printint +0000084d digits.1354 +00000000 umalloc.c +00000acc freep +00000ad0 base +00000120 strcpy +00000490 printf +00000ac4 argv +00000310 memmove +0000038a mknod +00000230 gets +000003c2 getpid +00000710 malloc +000003d2 sleep +00000352 pipe +00000362 write +0000039a fstat +00000372 kill +000003b2 chdir +0000037a exec +0000034a wait +0000035a read +00000392 unlink +0000033a fork +000003ca sbrk +000003da uptime +00000acc __bss_start +000001d0 memset +00000000 main +00000150 strcmp +000003ba dup +00000290 stat +00000acc _edata +00000ad8 _end +000003a2 link +00000342 exit +000002e0 atoi +000001a0 strlen +00000382 open +000001f0 strchr +000003aa mkdir +0000036a close +00000680 free diff --git a/initcode b/initcode new file mode 100755 index 0000000000..773d26c238 Binary files /dev/null and b/initcode differ diff --git a/initcode.S b/initcode.S index 80ac5d8567..b8229b83cd 100644 --- a/initcode.S +++ b/initcode.S @@ -14,7 +14,7 @@ start: movl $SYS_exec, %eax int $T_SYSCALL -# for(;;) exit(); +# for(;;) exit(0); exit: movl $SYS_exit, %eax int $T_SYSCALL diff --git a/initcode.asm b/initcode.asm new file mode 100644 index 0000000000..a07f9eeecb --- /dev/null +++ b/initcode.asm @@ -0,0 +1,43 @@ + +initcode.o: file format elf32-i386 + + +Disassembly of section .text: + +00000000 : + + +# exec(init, argv) +.globl start +start: + pushl $argv + 0: 68 24 00 00 00 push $0x24 + pushl $init + 5: 68 1c 00 00 00 push $0x1c + pushl $0 // where caller pc would be + a: 6a 00 push $0x0 + movl $SYS_exec, %eax + c: b8 07 00 00 00 mov $0x7,%eax + int $T_SYSCALL + 11: cd 40 int $0x40 + +00000013 : + +# for(;;) exit(0); +exit: + movl $SYS_exit, %eax + 13: b8 02 00 00 00 mov $0x2,%eax + int $T_SYSCALL + 18: cd 40 int $0x40 + jmp exit + 1a: eb f7 jmp 13 + +0000001c : + 1c: 2f das + 1d: 69 6e 69 74 00 00 90 imul $0x90000074,0x69(%esi),%ebp + +00000024 : + 24: 1c 00 sbb $0x0,%al + 26: 00 00 add %al,(%eax) + 28: 00 00 add %al,(%eax) + ... diff --git a/initcode.d b/initcode.d new file mode 100644 index 0000000000..ab1af4d0db --- /dev/null +++ b/initcode.d @@ -0,0 +1 @@ +initcode.o: initcode.S syscall.h traps.h diff --git a/initcode.o b/initcode.o new file mode 100644 index 0000000000..b5d7e3bd64 Binary files /dev/null and b/initcode.o differ diff --git a/initcode.out b/initcode.out new file mode 100755 index 0000000000..9e8ebbe729 Binary files /dev/null and b/initcode.out differ diff --git a/ioapic.d b/ioapic.d new file mode 100644 index 0000000000..997e68a61c --- /dev/null +++ b/ioapic.d @@ -0,0 +1 @@ +ioapic.o: ioapic.c /usr/include/stdc-predef.h types.h defs.h traps.h diff --git a/ioapic.o b/ioapic.o new file mode 100644 index 0000000000..20496a1674 Binary files /dev/null and b/ioapic.o differ diff --git a/kalloc.d b/kalloc.d new file mode 100644 index 0000000000..512c5db505 --- /dev/null +++ b/kalloc.d @@ -0,0 +1,2 @@ +kalloc.o: kalloc.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h spinlock.h diff --git a/kalloc.o b/kalloc.o new file mode 100644 index 0000000000..470c707472 Binary files /dev/null and b/kalloc.o differ diff --git a/kbd.d b/kbd.d new file mode 100644 index 0000000000..92532baa53 --- /dev/null +++ b/kbd.d @@ -0,0 +1 @@ +kbd.o: kbd.c /usr/include/stdc-predef.h types.h x86.h defs.h kbd.h diff --git a/kbd.o b/kbd.o new file mode 100644 index 0000000000..246ac7a1b4 Binary files /dev/null and b/kbd.o differ diff --git a/kernel b/kernel new file mode 100755 index 0000000000..1aa714c9b9 Binary files /dev/null and b/kernel differ diff --git a/kernel.asm b/kernel.asm new file mode 100644 index 0000000000..6b1eee2d81 --- /dev/null +++ b/kernel.asm @@ -0,0 +1,13310 @@ + +kernel: file format elf32-i386 + + +Disassembly of section .text: + +80100000 : +80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh +80100006: 00 00 add %al,(%eax) +80100008: fe 4f 52 decb 0x52(%edi) +8010000b: e4 .byte 0xe4 + +8010000c : +8010000c: 0f 20 e0 mov %cr4,%eax +8010000f: 83 c8 10 or $0x10,%eax +80100012: 0f 22 e0 mov %eax,%cr4 +80100015: b8 00 90 10 00 mov $0x109000,%eax +8010001a: 0f 22 d8 mov %eax,%cr3 +8010001d: 0f 20 c0 mov %cr0,%eax +80100020: 0d 00 00 01 80 or $0x80010000,%eax +80100025: 0f 22 c0 mov %eax,%cr0 +80100028: bc c0 b5 10 80 mov $0x8010b5c0,%esp +8010002d: b8 f0 2d 10 80 mov $0x80102df0,%eax +80100032: ff e0 jmp *%eax +80100034: 66 90 xchg %ax,%ax +80100036: 66 90 xchg %ax,%ax +80100038: 66 90 xchg %ax,%ax +8010003a: 66 90 xchg %ax,%ax +8010003c: 66 90 xchg %ax,%ax +8010003e: 66 90 xchg %ax,%ax + +80100040 : + struct buf head; +} bcache; + +void +binit(void) +{ +80100040: 55 push %ebp +80100041: 89 e5 mov %esp,%ebp +80100043: 53 push %ebx + +//PAGEBREAK! + // Create linked list of buffers + bcache.head.prev = &bcache.head; + bcache.head.next = &bcache.head; + for(b = bcache.buf; b < bcache.buf+NBUF; b++){ +80100044: bb f4 b5 10 80 mov $0x8010b5f4,%ebx +{ +80100049: 83 ec 14 sub $0x14,%esp + initlock(&bcache.lock, "bcache"); +8010004c: c7 44 24 04 40 6c 10 movl $0x80106c40,0x4(%esp) +80100053: 80 +80100054: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) +8010005b: e8 10 40 00 00 call 80104070 + bcache.head.next = &bcache.head; +80100060: ba bc fc 10 80 mov $0x8010fcbc,%edx + bcache.head.prev = &bcache.head; +80100065: c7 05 0c fd 10 80 bc movl $0x8010fcbc,0x8010fd0c +8010006c: fc 10 80 + bcache.head.next = &bcache.head; +8010006f: c7 05 10 fd 10 80 bc movl $0x8010fcbc,0x8010fd10 +80100076: fc 10 80 +80100079: eb 09 jmp 80100084 +8010007b: 90 nop +8010007c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80100080: 89 da mov %ebx,%edx + for(b = bcache.buf; b < bcache.buf+NBUF; b++){ +80100082: 89 c3 mov %eax,%ebx +80100084: 8d 43 0c lea 0xc(%ebx),%eax + b->next = bcache.head.next; +80100087: 89 53 54 mov %edx,0x54(%ebx) + b->prev = &bcache.head; +8010008a: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) + initsleeplock(&b->lock, "buffer"); +80100091: 89 04 24 mov %eax,(%esp) +80100094: c7 44 24 04 47 6c 10 movl $0x80106c47,0x4(%esp) +8010009b: 80 +8010009c: e8 9f 3e 00 00 call 80103f40 + bcache.head.next->prev = b; +801000a1: a1 10 fd 10 80 mov 0x8010fd10,%eax +801000a6: 89 58 50 mov %ebx,0x50(%eax) + for(b = bcache.buf; b < bcache.buf+NBUF; b++){ +801000a9: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax +801000af: 3d bc fc 10 80 cmp $0x8010fcbc,%eax + bcache.head.next = b; +801000b4: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10 + for(b = bcache.buf; b < bcache.buf+NBUF; b++){ +801000ba: 75 c4 jne 80100080 + } +} +801000bc: 83 c4 14 add $0x14,%esp +801000bf: 5b pop %ebx +801000c0: 5d pop %ebp +801000c1: c3 ret +801000c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +801000c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801000d0 : +} + +// Return a locked buf with the contents of the indicated block. +struct buf* +bread(uint dev, uint blockno) +{ +801000d0: 55 push %ebp +801000d1: 89 e5 mov %esp,%ebp +801000d3: 57 push %edi +801000d4: 56 push %esi +801000d5: 53 push %ebx +801000d6: 83 ec 1c sub $0x1c,%esp +801000d9: 8b 75 08 mov 0x8(%ebp),%esi + acquire(&bcache.lock); +801000dc: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) +{ +801000e3: 8b 7d 0c mov 0xc(%ebp),%edi + acquire(&bcache.lock); +801000e6: e8 f5 40 00 00 call 801041e0 + for(b = bcache.head.next; b != &bcache.head; b = b->next){ +801000eb: 8b 1d 10 fd 10 80 mov 0x8010fd10,%ebx +801000f1: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx +801000f7: 75 12 jne 8010010b +801000f9: eb 25 jmp 80100120 +801000fb: 90 nop +801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80100100: 8b 5b 54 mov 0x54(%ebx),%ebx +80100103: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx +80100109: 74 15 je 80100120 + if(b->dev == dev && b->blockno == blockno){ +8010010b: 3b 73 04 cmp 0x4(%ebx),%esi +8010010e: 75 f0 jne 80100100 +80100110: 3b 7b 08 cmp 0x8(%ebx),%edi +80100113: 75 eb jne 80100100 + b->refcnt++; +80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx) +80100119: eb 3f jmp 8010015a +8010011b: 90 nop +8010011c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ +80100120: 8b 1d 0c fd 10 80 mov 0x8010fd0c,%ebx +80100126: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx +8010012c: 75 0d jne 8010013b +8010012e: eb 58 jmp 80100188 +80100130: 8b 5b 50 mov 0x50(%ebx),%ebx +80100133: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx +80100139: 74 4d je 80100188 + if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { +8010013b: 8b 43 4c mov 0x4c(%ebx),%eax +8010013e: 85 c0 test %eax,%eax +80100140: 75 ee jne 80100130 +80100142: f6 03 04 testb $0x4,(%ebx) +80100145: 75 e9 jne 80100130 + b->dev = dev; +80100147: 89 73 04 mov %esi,0x4(%ebx) + b->blockno = blockno; +8010014a: 89 7b 08 mov %edi,0x8(%ebx) + b->flags = 0; +8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx) + b->refcnt = 1; +80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) + release(&bcache.lock); +8010015a: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) +80100161: e8 ea 40 00 00 call 80104250 + acquiresleep(&b->lock); +80100166: 8d 43 0c lea 0xc(%ebx),%eax +80100169: 89 04 24 mov %eax,(%esp) +8010016c: e8 0f 3e 00 00 call 80103f80 + struct buf *b; + + b = bget(dev, blockno); + if((b->flags & B_VALID) == 0) { +80100171: f6 03 02 testb $0x2,(%ebx) +80100174: 75 08 jne 8010017e + iderw(b); +80100176: 89 1c 24 mov %ebx,(%esp) +80100179: e8 a2 1f 00 00 call 80102120 + } + return b; +} +8010017e: 83 c4 1c add $0x1c,%esp +80100181: 89 d8 mov %ebx,%eax +80100183: 5b pop %ebx +80100184: 5e pop %esi +80100185: 5f pop %edi +80100186: 5d pop %ebp +80100187: c3 ret + panic("bget: no buffers"); +80100188: c7 04 24 4e 6c 10 80 movl $0x80106c4e,(%esp) +8010018f: e8 cc 01 00 00 call 80100360 +80100194: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +8010019a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +801001a0 : + +// Write b's contents to disk. Must be locked. +void +bwrite(struct buf *b) +{ +801001a0: 55 push %ebp +801001a1: 89 e5 mov %esp,%ebp +801001a3: 53 push %ebx +801001a4: 83 ec 14 sub $0x14,%esp +801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx + if(!holdingsleep(&b->lock)) +801001aa: 8d 43 0c lea 0xc(%ebx),%eax +801001ad: 89 04 24 mov %eax,(%esp) +801001b0: e8 6b 3e 00 00 call 80104020 +801001b5: 85 c0 test %eax,%eax +801001b7: 74 10 je 801001c9 + panic("bwrite"); + b->flags |= B_DIRTY; +801001b9: 83 0b 04 orl $0x4,(%ebx) + iderw(b); +801001bc: 89 5d 08 mov %ebx,0x8(%ebp) +} +801001bf: 83 c4 14 add $0x14,%esp +801001c2: 5b pop %ebx +801001c3: 5d pop %ebp + iderw(b); +801001c4: e9 57 1f 00 00 jmp 80102120 + panic("bwrite"); +801001c9: c7 04 24 5f 6c 10 80 movl $0x80106c5f,(%esp) +801001d0: e8 8b 01 00 00 call 80100360 +801001d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801001e0 : + +// Release a locked buffer. +// Move to the head of the MRU list. +void +brelse(struct buf *b) +{ +801001e0: 55 push %ebp +801001e1: 89 e5 mov %esp,%ebp +801001e3: 56 push %esi +801001e4: 53 push %ebx +801001e5: 83 ec 10 sub $0x10,%esp +801001e8: 8b 5d 08 mov 0x8(%ebp),%ebx + if(!holdingsleep(&b->lock)) +801001eb: 8d 73 0c lea 0xc(%ebx),%esi +801001ee: 89 34 24 mov %esi,(%esp) +801001f1: e8 2a 3e 00 00 call 80104020 +801001f6: 85 c0 test %eax,%eax +801001f8: 74 5b je 80100255 + panic("brelse"); + + releasesleep(&b->lock); +801001fa: 89 34 24 mov %esi,(%esp) +801001fd: e8 de 3d 00 00 call 80103fe0 + + acquire(&bcache.lock); +80100202: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) +80100209: e8 d2 3f 00 00 call 801041e0 + b->refcnt--; + if (b->refcnt == 0) { +8010020e: 83 6b 4c 01 subl $0x1,0x4c(%ebx) +80100212: 75 2f jne 80100243 + // no one is waiting for it. + b->next->prev = b->prev; +80100214: 8b 43 54 mov 0x54(%ebx),%eax +80100217: 8b 53 50 mov 0x50(%ebx),%edx +8010021a: 89 50 50 mov %edx,0x50(%eax) + b->prev->next = b->next; +8010021d: 8b 43 50 mov 0x50(%ebx),%eax +80100220: 8b 53 54 mov 0x54(%ebx),%edx +80100223: 89 50 54 mov %edx,0x54(%eax) + b->next = bcache.head.next; +80100226: a1 10 fd 10 80 mov 0x8010fd10,%eax + b->prev = &bcache.head; +8010022b: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) + b->next = bcache.head.next; +80100232: 89 43 54 mov %eax,0x54(%ebx) + bcache.head.next->prev = b; +80100235: a1 10 fd 10 80 mov 0x8010fd10,%eax +8010023a: 89 58 50 mov %ebx,0x50(%eax) + bcache.head.next = b; +8010023d: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10 + } + + release(&bcache.lock); +80100243: c7 45 08 c0 b5 10 80 movl $0x8010b5c0,0x8(%ebp) +} +8010024a: 83 c4 10 add $0x10,%esp +8010024d: 5b pop %ebx +8010024e: 5e pop %esi +8010024f: 5d pop %ebp + release(&bcache.lock); +80100250: e9 fb 3f 00 00 jmp 80104250 + panic("brelse"); +80100255: c7 04 24 66 6c 10 80 movl $0x80106c66,(%esp) +8010025c: e8 ff 00 00 00 call 80100360 +80100261: 66 90 xchg %ax,%ax +80100263: 66 90 xchg %ax,%ax +80100265: 66 90 xchg %ax,%ax +80100267: 66 90 xchg %ax,%ax +80100269: 66 90 xchg %ax,%ax +8010026b: 66 90 xchg %ax,%ax +8010026d: 66 90 xchg %ax,%ax +8010026f: 90 nop + +80100270 : + } +} + +int +consoleread(struct inode *ip, char *dst, int n) +{ +80100270: 55 push %ebp +80100271: 89 e5 mov %esp,%ebp +80100273: 57 push %edi +80100274: 56 push %esi +80100275: 53 push %ebx +80100276: 83 ec 1c sub $0x1c,%esp +80100279: 8b 7d 08 mov 0x8(%ebp),%edi +8010027c: 8b 75 0c mov 0xc(%ebp),%esi + uint target; + int c; + + iunlock(ip); +8010027f: 89 3c 24 mov %edi,(%esp) +80100282: e8 09 15 00 00 call 80101790 + target = n; + acquire(&cons.lock); +80100287: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +8010028e: e8 4d 3f 00 00 call 801041e0 + while(n > 0){ +80100293: 8b 55 10 mov 0x10(%ebp),%edx +80100296: 85 d2 test %edx,%edx +80100298: 0f 8e bc 00 00 00 jle 8010035a +8010029e: 8b 5d 10 mov 0x10(%ebp),%ebx +801002a1: eb 25 jmp 801002c8 +801002a3: 90 nop +801002a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while(input.r == input.w){ + if(myproc()->killed){ +801002a8: e8 f3 33 00 00 call 801036a0 +801002ad: 8b 40 24 mov 0x24(%eax),%eax +801002b0: 85 c0 test %eax,%eax +801002b2: 75 74 jne 80100328 + release(&cons.lock); + ilock(ip); + return -1; + } + sleep(&input.r, &cons.lock); +801002b4: c7 44 24 04 20 a5 10 movl $0x8010a520,0x4(%esp) +801002bb: 80 +801002bc: c7 04 24 a0 ff 10 80 movl $0x8010ffa0,(%esp) +801002c3: e8 38 39 00 00 call 80103c00 + while(input.r == input.w){ +801002c8: a1 a0 ff 10 80 mov 0x8010ffa0,%eax +801002cd: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax +801002d3: 74 d3 je 801002a8 + } + c = input.buf[input.r++ % INPUT_BUF]; +801002d5: 8d 50 01 lea 0x1(%eax),%edx +801002d8: 89 15 a0 ff 10 80 mov %edx,0x8010ffa0 +801002de: 89 c2 mov %eax,%edx +801002e0: 83 e2 7f and $0x7f,%edx +801002e3: 0f b6 8a 20 ff 10 80 movzbl -0x7fef00e0(%edx),%ecx +801002ea: 0f be d1 movsbl %cl,%edx + if(c == C('D')){ // EOF +801002ed: 83 fa 04 cmp $0x4,%edx +801002f0: 74 57 je 80100349 + // caller gets a 0-byte result. + input.r--; + } + break; + } + *dst++ = c; +801002f2: 83 c6 01 add $0x1,%esi + --n; +801002f5: 83 eb 01 sub $0x1,%ebx + if(c == '\n') +801002f8: 83 fa 0a cmp $0xa,%edx + *dst++ = c; +801002fb: 88 4e ff mov %cl,-0x1(%esi) + if(c == '\n') +801002fe: 74 53 je 80100353 + while(n > 0){ +80100300: 85 db test %ebx,%ebx +80100302: 75 c4 jne 801002c8 +80100304: 8b 45 10 mov 0x10(%ebp),%eax + break; + } + release(&cons.lock); +80100307: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +8010030e: 89 45 e4 mov %eax,-0x1c(%ebp) +80100311: e8 3a 3f 00 00 call 80104250 + ilock(ip); +80100316: 89 3c 24 mov %edi,(%esp) +80100319: e8 92 13 00 00 call 801016b0 +8010031e: 8b 45 e4 mov -0x1c(%ebp),%eax + + return target - n; +80100321: eb 1e jmp 80100341 +80100323: 90 nop +80100324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + release(&cons.lock); +80100328: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +8010032f: e8 1c 3f 00 00 call 80104250 + ilock(ip); +80100334: 89 3c 24 mov %edi,(%esp) +80100337: e8 74 13 00 00 call 801016b0 + return -1; +8010033c: b8 ff ff ff ff mov $0xffffffff,%eax +} +80100341: 83 c4 1c add $0x1c,%esp +80100344: 5b pop %ebx +80100345: 5e pop %esi +80100346: 5f pop %edi +80100347: 5d pop %ebp +80100348: c3 ret + if(n < target){ +80100349: 39 5d 10 cmp %ebx,0x10(%ebp) +8010034c: 76 05 jbe 80100353 + input.r--; +8010034e: a3 a0 ff 10 80 mov %eax,0x8010ffa0 +80100353: 8b 45 10 mov 0x10(%ebp),%eax +80100356: 29 d8 sub %ebx,%eax +80100358: eb ad jmp 80100307 + while(n > 0){ +8010035a: 31 c0 xor %eax,%eax +8010035c: eb a9 jmp 80100307 +8010035e: 66 90 xchg %ax,%ax + +80100360 : +{ +80100360: 55 push %ebp +80100361: 89 e5 mov %esp,%ebp +80100363: 56 push %esi +80100364: 53 push %ebx +80100365: 83 ec 40 sub $0x40,%esp +} + +static inline void +cli(void) +{ + asm volatile("cli"); +80100368: fa cli + cons.locking = 0; +80100369: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554 +80100370: 00 00 00 + getcallerpcs(&s, pcs); +80100373: 8d 5d d0 lea -0x30(%ebp),%ebx + cprintf("lapicid %d: panic: ", lapicid()); +80100376: e8 e5 23 00 00 call 80102760 +8010037b: 8d 75 f8 lea -0x8(%ebp),%esi +8010037e: c7 04 24 6d 6c 10 80 movl $0x80106c6d,(%esp) +80100385: 89 44 24 04 mov %eax,0x4(%esp) +80100389: e8 c2 02 00 00 call 80100650 + cprintf(s); +8010038e: 8b 45 08 mov 0x8(%ebp),%eax +80100391: 89 04 24 mov %eax,(%esp) +80100394: e8 b7 02 00 00 call 80100650 + cprintf("\n"); +80100399: c7 04 24 b7 75 10 80 movl $0x801075b7,(%esp) +801003a0: e8 ab 02 00 00 call 80100650 + getcallerpcs(&s, pcs); +801003a5: 8d 45 08 lea 0x8(%ebp),%eax +801003a8: 89 5c 24 04 mov %ebx,0x4(%esp) +801003ac: 89 04 24 mov %eax,(%esp) +801003af: e8 dc 3c 00 00 call 80104090 +801003b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + cprintf(" %p", pcs[i]); +801003b8: 8b 03 mov (%ebx),%eax +801003ba: 83 c3 04 add $0x4,%ebx +801003bd: c7 04 24 81 6c 10 80 movl $0x80106c81,(%esp) +801003c4: 89 44 24 04 mov %eax,0x4(%esp) +801003c8: e8 83 02 00 00 call 80100650 + for(i=0; i<10; i++) +801003cd: 39 f3 cmp %esi,%ebx +801003cf: 75 e7 jne 801003b8 + panicked = 1; // freeze other CPU +801003d1: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558 +801003d8: 00 00 00 +801003db: eb fe jmp 801003db +801003dd: 8d 76 00 lea 0x0(%esi),%esi + +801003e0 : + if(panicked){ +801003e0: 8b 15 58 a5 10 80 mov 0x8010a558,%edx +801003e6: 85 d2 test %edx,%edx +801003e8: 74 06 je 801003f0 +801003ea: fa cli +801003eb: eb fe jmp 801003eb +801003ed: 8d 76 00 lea 0x0(%esi),%esi +{ +801003f0: 55 push %ebp +801003f1: 89 e5 mov %esp,%ebp +801003f3: 57 push %edi +801003f4: 56 push %esi +801003f5: 53 push %ebx +801003f6: 89 c3 mov %eax,%ebx +801003f8: 83 ec 1c sub $0x1c,%esp + if(c == BACKSPACE){ +801003fb: 3d 00 01 00 00 cmp $0x100,%eax +80100400: 0f 84 ac 00 00 00 je 801004b2 + uartputc(c); +80100406: 89 04 24 mov %eax,(%esp) +80100409: e8 a2 53 00 00 call 801057b0 + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +8010040e: bf d4 03 00 00 mov $0x3d4,%edi +80100413: b8 0e 00 00 00 mov $0xe,%eax +80100418: 89 fa mov %edi,%edx +8010041a: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +8010041b: be d5 03 00 00 mov $0x3d5,%esi +80100420: 89 f2 mov %esi,%edx +80100422: ec in (%dx),%al + pos = inb(CRTPORT+1) << 8; +80100423: 0f b6 c8 movzbl %al,%ecx + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80100426: 89 fa mov %edi,%edx +80100428: c1 e1 08 shl $0x8,%ecx +8010042b: b8 0f 00 00 00 mov $0xf,%eax +80100430: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80100431: 89 f2 mov %esi,%edx +80100433: ec in (%dx),%al + pos |= inb(CRTPORT+1); +80100434: 0f b6 c0 movzbl %al,%eax +80100437: 09 c1 or %eax,%ecx + if(c == '\n') +80100439: 83 fb 0a cmp $0xa,%ebx +8010043c: 0f 84 0d 01 00 00 je 8010054f + else if(c == BACKSPACE){ +80100442: 81 fb 00 01 00 00 cmp $0x100,%ebx +80100448: 0f 84 e8 00 00 00 je 80100536 + crt[pos++] = (c&0xff) | 0x0700; // black on white +8010044e: 0f b6 db movzbl %bl,%ebx +80100451: 80 cf 07 or $0x7,%bh +80100454: 8d 79 01 lea 0x1(%ecx),%edi +80100457: 66 89 9c 09 00 80 0b mov %bx,-0x7ff48000(%ecx,%ecx,1) +8010045e: 80 + if(pos < 0 || pos > 25*80) +8010045f: 81 ff d0 07 00 00 cmp $0x7d0,%edi +80100465: 0f 87 bf 00 00 00 ja 8010052a + if((pos/80) >= 24){ // Scroll up. +8010046b: 81 ff 7f 07 00 00 cmp $0x77f,%edi +80100471: 7f 68 jg 801004db +80100473: 89 f8 mov %edi,%eax +80100475: 89 fb mov %edi,%ebx +80100477: c1 e8 08 shr $0x8,%eax +8010047a: 89 c6 mov %eax,%esi +8010047c: 8d 8c 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%ecx + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80100483: bf d4 03 00 00 mov $0x3d4,%edi +80100488: b8 0e 00 00 00 mov $0xe,%eax +8010048d: 89 fa mov %edi,%edx +8010048f: ee out %al,(%dx) +80100490: 89 f0 mov %esi,%eax +80100492: b2 d5 mov $0xd5,%dl +80100494: ee out %al,(%dx) +80100495: b8 0f 00 00 00 mov $0xf,%eax +8010049a: 89 fa mov %edi,%edx +8010049c: ee out %al,(%dx) +8010049d: 89 d8 mov %ebx,%eax +8010049f: b2 d5 mov $0xd5,%dl +801004a1: ee out %al,(%dx) + crt[pos] = ' ' | 0x0700; +801004a2: b8 20 07 00 00 mov $0x720,%eax +801004a7: 66 89 01 mov %ax,(%ecx) +} +801004aa: 83 c4 1c add $0x1c,%esp +801004ad: 5b pop %ebx +801004ae: 5e pop %esi +801004af: 5f pop %edi +801004b0: 5d pop %ebp +801004b1: c3 ret + uartputc('\b'); uartputc(' '); uartputc('\b'); +801004b2: c7 04 24 08 00 00 00 movl $0x8,(%esp) +801004b9: e8 f2 52 00 00 call 801057b0 +801004be: c7 04 24 20 00 00 00 movl $0x20,(%esp) +801004c5: e8 e6 52 00 00 call 801057b0 +801004ca: c7 04 24 08 00 00 00 movl $0x8,(%esp) +801004d1: e8 da 52 00 00 call 801057b0 +801004d6: e9 33 ff ff ff jmp 8010040e + memmove(crt, crt+80, sizeof(crt[0])*23*80); +801004db: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp) +801004e2: 00 + pos -= 80; +801004e3: 8d 5f b0 lea -0x50(%edi),%ebx + memmove(crt, crt+80, sizeof(crt[0])*23*80); +801004e6: c7 44 24 04 a0 80 0b movl $0x800b80a0,0x4(%esp) +801004ed: 80 + memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); +801004ee: 8d b4 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%esi + memmove(crt, crt+80, sizeof(crt[0])*23*80); +801004f5: c7 04 24 00 80 0b 80 movl $0x800b8000,(%esp) +801004fc: e8 3f 3e 00 00 call 80104340 + memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); +80100501: b8 d0 07 00 00 mov $0x7d0,%eax +80100506: 29 f8 sub %edi,%eax +80100508: 01 c0 add %eax,%eax +8010050a: 89 34 24 mov %esi,(%esp) +8010050d: 89 44 24 08 mov %eax,0x8(%esp) +80100511: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80100518: 00 +80100519: e8 82 3d 00 00 call 801042a0 +8010051e: 89 f1 mov %esi,%ecx +80100520: be 07 00 00 00 mov $0x7,%esi +80100525: e9 59 ff ff ff jmp 80100483 + panic("pos under/overflow"); +8010052a: c7 04 24 85 6c 10 80 movl $0x80106c85,(%esp) +80100531: e8 2a fe ff ff call 80100360 + if(pos > 0) --pos; +80100536: 85 c9 test %ecx,%ecx +80100538: 8d 79 ff lea -0x1(%ecx),%edi +8010053b: 0f 85 1e ff ff ff jne 8010045f +80100541: b9 00 80 0b 80 mov $0x800b8000,%ecx +80100546: 31 db xor %ebx,%ebx +80100548: 31 f6 xor %esi,%esi +8010054a: e9 34 ff ff ff jmp 80100483 + pos += 80 - pos%80; +8010054f: 89 c8 mov %ecx,%eax +80100551: ba 67 66 66 66 mov $0x66666667,%edx +80100556: f7 ea imul %edx +80100558: c1 ea 05 shr $0x5,%edx +8010055b: 8d 04 92 lea (%edx,%edx,4),%eax +8010055e: c1 e0 04 shl $0x4,%eax +80100561: 8d 78 50 lea 0x50(%eax),%edi +80100564: e9 f6 fe ff ff jmp 8010045f +80100569: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80100570 : +{ +80100570: 55 push %ebp +80100571: 89 e5 mov %esp,%ebp +80100573: 57 push %edi +80100574: 56 push %esi +80100575: 89 d6 mov %edx,%esi +80100577: 53 push %ebx +80100578: 83 ec 1c sub $0x1c,%esp + if(sign && (sign = xx < 0)) +8010057b: 85 c9 test %ecx,%ecx +8010057d: 74 61 je 801005e0 +8010057f: 85 c0 test %eax,%eax +80100581: 79 5d jns 801005e0 + x = -xx; +80100583: f7 d8 neg %eax +80100585: bf 01 00 00 00 mov $0x1,%edi + i = 0; +8010058a: 31 c9 xor %ecx,%ecx +8010058c: eb 04 jmp 80100592 +8010058e: 66 90 xchg %ax,%ax + buf[i++] = digits[x % base]; +80100590: 89 d9 mov %ebx,%ecx +80100592: 31 d2 xor %edx,%edx +80100594: f7 f6 div %esi +80100596: 8d 59 01 lea 0x1(%ecx),%ebx +80100599: 0f b6 92 b0 6c 10 80 movzbl -0x7fef9350(%edx),%edx + }while((x /= base) != 0); +801005a0: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; +801005a2: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) + }while((x /= base) != 0); +801005a6: 75 e8 jne 80100590 + if(sign) +801005a8: 85 ff test %edi,%edi + buf[i++] = digits[x % base]; +801005aa: 89 d8 mov %ebx,%eax + if(sign) +801005ac: 74 08 je 801005b6 + buf[i++] = '-'; +801005ae: 8d 59 02 lea 0x2(%ecx),%ebx +801005b1: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + while(--i >= 0) +801005b6: 83 eb 01 sub $0x1,%ebx +801005b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + consputc(buf[i]); +801005c0: 0f be 44 1d d8 movsbl -0x28(%ebp,%ebx,1),%eax + while(--i >= 0) +801005c5: 83 eb 01 sub $0x1,%ebx + consputc(buf[i]); +801005c8: e8 13 fe ff ff call 801003e0 + while(--i >= 0) +801005cd: 83 fb ff cmp $0xffffffff,%ebx +801005d0: 75 ee jne 801005c0 +} +801005d2: 83 c4 1c add $0x1c,%esp +801005d5: 5b pop %ebx +801005d6: 5e pop %esi +801005d7: 5f pop %edi +801005d8: 5d pop %ebp +801005d9: c3 ret +801005da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + x = xx; +801005e0: 31 ff xor %edi,%edi +801005e2: eb a6 jmp 8010058a +801005e4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801005ea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +801005f0 : + +int +consolewrite(struct inode *ip, char *buf, int n) +{ +801005f0: 55 push %ebp +801005f1: 89 e5 mov %esp,%ebp +801005f3: 57 push %edi +801005f4: 56 push %esi +801005f5: 53 push %ebx +801005f6: 83 ec 1c sub $0x1c,%esp + int i; + + iunlock(ip); +801005f9: 8b 45 08 mov 0x8(%ebp),%eax +{ +801005fc: 8b 75 10 mov 0x10(%ebp),%esi + iunlock(ip); +801005ff: 89 04 24 mov %eax,(%esp) +80100602: e8 89 11 00 00 call 80101790 + acquire(&cons.lock); +80100607: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +8010060e: e8 cd 3b 00 00 call 801041e0 +80100613: 8b 7d 0c mov 0xc(%ebp),%edi + for(i = 0; i < n; i++) +80100616: 85 f6 test %esi,%esi +80100618: 8d 1c 37 lea (%edi,%esi,1),%ebx +8010061b: 7e 12 jle 8010062f +8010061d: 8d 76 00 lea 0x0(%esi),%esi + consputc(buf[i] & 0xff); +80100620: 0f b6 07 movzbl (%edi),%eax +80100623: 83 c7 01 add $0x1,%edi +80100626: e8 b5 fd ff ff call 801003e0 + for(i = 0; i < n; i++) +8010062b: 39 df cmp %ebx,%edi +8010062d: 75 f1 jne 80100620 + release(&cons.lock); +8010062f: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +80100636: e8 15 3c 00 00 call 80104250 + ilock(ip); +8010063b: 8b 45 08 mov 0x8(%ebp),%eax +8010063e: 89 04 24 mov %eax,(%esp) +80100641: e8 6a 10 00 00 call 801016b0 + + return n; +} +80100646: 83 c4 1c add $0x1c,%esp +80100649: 89 f0 mov %esi,%eax +8010064b: 5b pop %ebx +8010064c: 5e pop %esi +8010064d: 5f pop %edi +8010064e: 5d pop %ebp +8010064f: c3 ret + +80100650 : +{ +80100650: 55 push %ebp +80100651: 89 e5 mov %esp,%ebp +80100653: 57 push %edi +80100654: 56 push %esi +80100655: 53 push %ebx +80100656: 83 ec 1c sub $0x1c,%esp + locking = cons.locking; +80100659: a1 54 a5 10 80 mov 0x8010a554,%eax + if(locking) +8010065e: 85 c0 test %eax,%eax + locking = cons.locking; +80100660: 89 45 e0 mov %eax,-0x20(%ebp) + if(locking) +80100663: 0f 85 27 01 00 00 jne 80100790 + if (fmt == 0) +80100669: 8b 45 08 mov 0x8(%ebp),%eax +8010066c: 85 c0 test %eax,%eax +8010066e: 89 c1 mov %eax,%ecx +80100670: 0f 84 2b 01 00 00 je 801007a1 + for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ +80100676: 0f b6 00 movzbl (%eax),%eax +80100679: 31 db xor %ebx,%ebx +8010067b: 89 cf mov %ecx,%edi +8010067d: 8d 75 0c lea 0xc(%ebp),%esi +80100680: 85 c0 test %eax,%eax +80100682: 75 4c jne 801006d0 +80100684: eb 5f jmp 801006e5 +80100686: 66 90 xchg %ax,%ax + c = fmt[++i] & 0xff; +80100688: 83 c3 01 add $0x1,%ebx +8010068b: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx + if(c == 0) +8010068f: 85 d2 test %edx,%edx +80100691: 74 52 je 801006e5 + switch(c){ +80100693: 83 fa 70 cmp $0x70,%edx +80100696: 74 72 je 8010070a +80100698: 7f 66 jg 80100700 +8010069a: 83 fa 25 cmp $0x25,%edx +8010069d: 8d 76 00 lea 0x0(%esi),%esi +801006a0: 0f 84 a2 00 00 00 je 80100748 +801006a6: 83 fa 64 cmp $0x64,%edx +801006a9: 75 7d jne 80100728 + printint(*argp++, 10, 1); +801006ab: 8d 46 04 lea 0x4(%esi),%eax +801006ae: b9 01 00 00 00 mov $0x1,%ecx +801006b3: 89 45 e4 mov %eax,-0x1c(%ebp) +801006b6: 8b 06 mov (%esi),%eax +801006b8: ba 0a 00 00 00 mov $0xa,%edx +801006bd: e8 ae fe ff ff call 80100570 +801006c2: 8b 75 e4 mov -0x1c(%ebp),%esi + for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ +801006c5: 83 c3 01 add $0x1,%ebx +801006c8: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax +801006cc: 85 c0 test %eax,%eax +801006ce: 74 15 je 801006e5 + if(c != '%'){ +801006d0: 83 f8 25 cmp $0x25,%eax +801006d3: 74 b3 je 80100688 + consputc(c); +801006d5: e8 06 fd ff ff call 801003e0 + for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ +801006da: 83 c3 01 add $0x1,%ebx +801006dd: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax +801006e1: 85 c0 test %eax,%eax +801006e3: 75 eb jne 801006d0 + if(locking) +801006e5: 8b 45 e0 mov -0x20(%ebp),%eax +801006e8: 85 c0 test %eax,%eax +801006ea: 74 0c je 801006f8 + release(&cons.lock); +801006ec: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +801006f3: e8 58 3b 00 00 call 80104250 +} +801006f8: 83 c4 1c add $0x1c,%esp +801006fb: 5b pop %ebx +801006fc: 5e pop %esi +801006fd: 5f pop %edi +801006fe: 5d pop %ebp +801006ff: c3 ret + switch(c){ +80100700: 83 fa 73 cmp $0x73,%edx +80100703: 74 53 je 80100758 +80100705: 83 fa 78 cmp $0x78,%edx +80100708: 75 1e jne 80100728 + printint(*argp++, 16, 0); +8010070a: 8d 46 04 lea 0x4(%esi),%eax +8010070d: 31 c9 xor %ecx,%ecx +8010070f: 89 45 e4 mov %eax,-0x1c(%ebp) +80100712: 8b 06 mov (%esi),%eax +80100714: ba 10 00 00 00 mov $0x10,%edx +80100719: e8 52 fe ff ff call 80100570 +8010071e: 8b 75 e4 mov -0x1c(%ebp),%esi + break; +80100721: eb a2 jmp 801006c5 +80100723: 90 nop +80100724: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + consputc('%'); +80100728: b8 25 00 00 00 mov $0x25,%eax +8010072d: 89 55 e4 mov %edx,-0x1c(%ebp) +80100730: e8 ab fc ff ff call 801003e0 + consputc(c); +80100735: 8b 55 e4 mov -0x1c(%ebp),%edx +80100738: 89 d0 mov %edx,%eax +8010073a: e8 a1 fc ff ff call 801003e0 +8010073f: eb 99 jmp 801006da +80100741: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + consputc('%'); +80100748: b8 25 00 00 00 mov $0x25,%eax +8010074d: e8 8e fc ff ff call 801003e0 + break; +80100752: e9 6e ff ff ff jmp 801006c5 +80100757: 90 nop + if((s = (char*)*argp++) == 0) +80100758: 8d 46 04 lea 0x4(%esi),%eax +8010075b: 8b 36 mov (%esi),%esi +8010075d: 89 45 e4 mov %eax,-0x1c(%ebp) + s = "(null)"; +80100760: b8 98 6c 10 80 mov $0x80106c98,%eax +80100765: 85 f6 test %esi,%esi +80100767: 0f 44 f0 cmove %eax,%esi + for(; *s; s++) +8010076a: 0f be 06 movsbl (%esi),%eax +8010076d: 84 c0 test %al,%al +8010076f: 74 16 je 80100787 +80100771: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80100778: 83 c6 01 add $0x1,%esi + consputc(*s); +8010077b: e8 60 fc ff ff call 801003e0 + for(; *s; s++) +80100780: 0f be 06 movsbl (%esi),%eax +80100783: 84 c0 test %al,%al +80100785: 75 f1 jne 80100778 + if((s = (char*)*argp++) == 0) +80100787: 8b 75 e4 mov -0x1c(%ebp),%esi +8010078a: e9 36 ff ff ff jmp 801006c5 +8010078f: 90 nop + acquire(&cons.lock); +80100790: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +80100797: e8 44 3a 00 00 call 801041e0 +8010079c: e9 c8 fe ff ff jmp 80100669 + panic("null fmt"); +801007a1: c7 04 24 9f 6c 10 80 movl $0x80106c9f,(%esp) +801007a8: e8 b3 fb ff ff call 80100360 +801007ad: 8d 76 00 lea 0x0(%esi),%esi + +801007b0 : +{ +801007b0: 55 push %ebp +801007b1: 89 e5 mov %esp,%ebp +801007b3: 57 push %edi +801007b4: 56 push %esi + int c, doprocdump = 0; +801007b5: 31 f6 xor %esi,%esi +{ +801007b7: 53 push %ebx +801007b8: 83 ec 1c sub $0x1c,%esp +801007bb: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&cons.lock); +801007be: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +801007c5: e8 16 3a 00 00 call 801041e0 +801007ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + while((c = getc()) >= 0){ +801007d0: ff d3 call *%ebx +801007d2: 85 c0 test %eax,%eax +801007d4: 89 c7 mov %eax,%edi +801007d6: 78 48 js 80100820 + switch(c){ +801007d8: 83 ff 10 cmp $0x10,%edi +801007db: 0f 84 2f 01 00 00 je 80100910 +801007e1: 7e 5d jle 80100840 +801007e3: 83 ff 15 cmp $0x15,%edi +801007e6: 0f 84 d4 00 00 00 je 801008c0 +801007ec: 83 ff 7f cmp $0x7f,%edi +801007ef: 90 nop +801007f0: 75 53 jne 80100845 + if(input.e != input.w){ +801007f2: a1 a8 ff 10 80 mov 0x8010ffa8,%eax +801007f7: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax +801007fd: 74 d1 je 801007d0 + input.e--; +801007ff: 83 e8 01 sub $0x1,%eax +80100802: a3 a8 ff 10 80 mov %eax,0x8010ffa8 + consputc(BACKSPACE); +80100807: b8 00 01 00 00 mov $0x100,%eax +8010080c: e8 cf fb ff ff call 801003e0 + while((c = getc()) >= 0){ +80100811: ff d3 call *%ebx +80100813: 85 c0 test %eax,%eax +80100815: 89 c7 mov %eax,%edi +80100817: 79 bf jns 801007d8 +80100819: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + release(&cons.lock); +80100820: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +80100827: e8 24 3a 00 00 call 80104250 + if(doprocdump) { +8010082c: 85 f6 test %esi,%esi +8010082e: 0f 85 ec 00 00 00 jne 80100920 +} +80100834: 83 c4 1c add $0x1c,%esp +80100837: 5b pop %ebx +80100838: 5e pop %esi +80100839: 5f pop %edi +8010083a: 5d pop %ebp +8010083b: c3 ret +8010083c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + switch(c){ +80100840: 83 ff 08 cmp $0x8,%edi +80100843: 74 ad je 801007f2 + if(c != 0 && input.e-input.r < INPUT_BUF){ +80100845: 85 ff test %edi,%edi +80100847: 74 87 je 801007d0 +80100849: a1 a8 ff 10 80 mov 0x8010ffa8,%eax +8010084e: 89 c2 mov %eax,%edx +80100850: 2b 15 a0 ff 10 80 sub 0x8010ffa0,%edx +80100856: 83 fa 7f cmp $0x7f,%edx +80100859: 0f 87 71 ff ff ff ja 801007d0 + input.buf[input.e++ % INPUT_BUF] = c; +8010085f: 8d 50 01 lea 0x1(%eax),%edx +80100862: 83 e0 7f and $0x7f,%eax + c = (c == '\r') ? '\n' : c; +80100865: 83 ff 0d cmp $0xd,%edi + input.buf[input.e++ % INPUT_BUF] = c; +80100868: 89 15 a8 ff 10 80 mov %edx,0x8010ffa8 + c = (c == '\r') ? '\n' : c; +8010086e: 0f 84 b8 00 00 00 je 8010092c + input.buf[input.e++ % INPUT_BUF] = c; +80100874: 89 f9 mov %edi,%ecx +80100876: 88 88 20 ff 10 80 mov %cl,-0x7fef00e0(%eax) + consputc(c); +8010087c: 89 f8 mov %edi,%eax +8010087e: e8 5d fb ff ff call 801003e0 + if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ +80100883: 83 ff 04 cmp $0x4,%edi +80100886: a1 a8 ff 10 80 mov 0x8010ffa8,%eax +8010088b: 74 19 je 801008a6 +8010088d: 83 ff 0a cmp $0xa,%edi +80100890: 74 14 je 801008a6 +80100892: 8b 0d a0 ff 10 80 mov 0x8010ffa0,%ecx +80100898: 8d 91 80 00 00 00 lea 0x80(%ecx),%edx +8010089e: 39 d0 cmp %edx,%eax +801008a0: 0f 85 2a ff ff ff jne 801007d0 + wakeup(&input.r); +801008a6: c7 04 24 a0 ff 10 80 movl $0x8010ffa0,(%esp) + input.w = input.e; +801008ad: a3 a4 ff 10 80 mov %eax,0x8010ffa4 + wakeup(&input.r); +801008b2: e8 d9 34 00 00 call 80103d90 +801008b7: e9 14 ff ff ff jmp 801007d0 +801008bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while(input.e != input.w && +801008c0: a1 a8 ff 10 80 mov 0x8010ffa8,%eax +801008c5: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax +801008cb: 75 2b jne 801008f8 +801008cd: e9 fe fe ff ff jmp 801007d0 +801008d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + input.e--; +801008d8: a3 a8 ff 10 80 mov %eax,0x8010ffa8 + consputc(BACKSPACE); +801008dd: b8 00 01 00 00 mov $0x100,%eax +801008e2: e8 f9 fa ff ff call 801003e0 + while(input.e != input.w && +801008e7: a1 a8 ff 10 80 mov 0x8010ffa8,%eax +801008ec: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax +801008f2: 0f 84 d8 fe ff ff je 801007d0 + input.buf[(input.e-1) % INPUT_BUF] != '\n'){ +801008f8: 83 e8 01 sub $0x1,%eax +801008fb: 89 c2 mov %eax,%edx +801008fd: 83 e2 7f and $0x7f,%edx + while(input.e != input.w && +80100900: 80 ba 20 ff 10 80 0a cmpb $0xa,-0x7fef00e0(%edx) +80100907: 75 cf jne 801008d8 +80100909: e9 c2 fe ff ff jmp 801007d0 +8010090e: 66 90 xchg %ax,%ax + doprocdump = 1; +80100910: be 01 00 00 00 mov $0x1,%esi +80100915: e9 b6 fe ff ff jmp 801007d0 +8010091a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +} +80100920: 83 c4 1c add $0x1c,%esp +80100923: 5b pop %ebx +80100924: 5e pop %esi +80100925: 5f pop %edi +80100926: 5d pop %ebp + procdump(); // now call procdump() wo. cons.lock held +80100927: e9 44 35 00 00 jmp 80103e70 + input.buf[input.e++ % INPUT_BUF] = c; +8010092c: c6 80 20 ff 10 80 0a movb $0xa,-0x7fef00e0(%eax) + consputc(c); +80100933: b8 0a 00 00 00 mov $0xa,%eax +80100938: e8 a3 fa ff ff call 801003e0 +8010093d: a1 a8 ff 10 80 mov 0x8010ffa8,%eax +80100942: e9 5f ff ff ff jmp 801008a6 +80100947: 89 f6 mov %esi,%esi +80100949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80100950 : + +void +consoleinit(void) +{ +80100950: 55 push %ebp +80100951: 89 e5 mov %esp,%ebp +80100953: 83 ec 18 sub $0x18,%esp + initlock(&cons.lock, "console"); +80100956: c7 44 24 04 a8 6c 10 movl $0x80106ca8,0x4(%esp) +8010095d: 80 +8010095e: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) +80100965: e8 06 37 00 00 call 80104070 + + devsw[CONSOLE].write = consolewrite; + devsw[CONSOLE].read = consoleread; + cons.locking = 1; + + ioapicenable(IRQ_KBD, 0); +8010096a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80100971: 00 +80100972: c7 04 24 01 00 00 00 movl $0x1,(%esp) + devsw[CONSOLE].write = consolewrite; +80100979: c7 05 6c 09 11 80 f0 movl $0x801005f0,0x8011096c +80100980: 05 10 80 + devsw[CONSOLE].read = consoleread; +80100983: c7 05 68 09 11 80 70 movl $0x80100270,0x80110968 +8010098a: 02 10 80 + cons.locking = 1; +8010098d: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554 +80100994: 00 00 00 + ioapicenable(IRQ_KBD, 0); +80100997: e8 14 19 00 00 call 801022b0 +} +8010099c: c9 leave +8010099d: c3 ret +8010099e: 66 90 xchg %ax,%ax + +801009a0 : +#include "x86.h" +#include "elf.h" + +int +exec(char *path, char **argv) +{ +801009a0: 55 push %ebp +801009a1: 89 e5 mov %esp,%ebp +801009a3: 57 push %edi +801009a4: 56 push %esi +801009a5: 53 push %ebx +801009a6: 81 ec 2c 01 00 00 sub $0x12c,%esp + uint argc, sz, sp, ustack[3+MAXARG+1]; + struct elfhdr elf; + struct inode *ip; + struct proghdr ph; + pde_t *pgdir, *oldpgdir; + struct proc *curproc = myproc(); +801009ac: e8 ef 2c 00 00 call 801036a0 +801009b1: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) + + begin_op(); +801009b7: e8 54 21 00 00 call 80102b10 + + if((ip = namei(path)) == 0){ +801009bc: 8b 45 08 mov 0x8(%ebp),%eax +801009bf: 89 04 24 mov %eax,(%esp) +801009c2: e8 39 15 00 00 call 80101f00 +801009c7: 85 c0 test %eax,%eax +801009c9: 89 c3 mov %eax,%ebx +801009cb: 0f 84 c2 01 00 00 je 80100b93 + end_op(); + cprintf("exec: fail\n"); + return -1; + } + ilock(ip); +801009d1: 89 04 24 mov %eax,(%esp) +801009d4: e8 d7 0c 00 00 call 801016b0 + pgdir = 0; + + // Check ELF header + if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) +801009d9: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax +801009df: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp) +801009e6: 00 +801009e7: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +801009ee: 00 +801009ef: 89 44 24 04 mov %eax,0x4(%esp) +801009f3: 89 1c 24 mov %ebx,(%esp) +801009f6: e8 65 0f 00 00 call 80101960 +801009fb: 83 f8 34 cmp $0x34,%eax +801009fe: 74 20 je 80100a20 + + bad: + if(pgdir) + freevm(pgdir); + if(ip){ + iunlockput(ip); +80100a00: 89 1c 24 mov %ebx,(%esp) +80100a03: e8 08 0f 00 00 call 80101910 + end_op(); +80100a08: e8 73 21 00 00 call 80102b80 + } + return -1; +80100a0d: b8 ff ff ff ff mov $0xffffffff,%eax +} +80100a12: 81 c4 2c 01 00 00 add $0x12c,%esp +80100a18: 5b pop %ebx +80100a19: 5e pop %esi +80100a1a: 5f pop %edi +80100a1b: 5d pop %ebp +80100a1c: c3 ret +80100a1d: 8d 76 00 lea 0x0(%esi),%esi + if(elf.magic != ELF_MAGIC) +80100a20: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) +80100a27: 45 4c 46 +80100a2a: 75 d4 jne 80100a00 + if((pgdir = setupkvm()) == 0) +80100a2c: e8 6f 5f 00 00 call 801069a0 +80100a31: 85 c0 test %eax,%eax +80100a33: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) +80100a39: 74 c5 je 80100a00 + for(i=0, off=elf.phoff; i +80100a59: 31 ff xor %edi,%edi +80100a5b: eb 18 jmp 80100a75 +80100a5d: 8d 76 00 lea 0x0(%esi),%esi +80100a60: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax +80100a67: 83 c7 01 add $0x1,%edi +80100a6a: 83 c6 20 add $0x20,%esi +80100a6d: 39 f8 cmp %edi,%eax +80100a6f: 0f 8e be 00 00 00 jle 80100b33 + if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) +80100a75: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax +80100a7b: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp) +80100a82: 00 +80100a83: 89 74 24 08 mov %esi,0x8(%esp) +80100a87: 89 44 24 04 mov %eax,0x4(%esp) +80100a8b: 89 1c 24 mov %ebx,(%esp) +80100a8e: e8 cd 0e 00 00 call 80101960 +80100a93: 83 f8 20 cmp $0x20,%eax +80100a96: 0f 85 84 00 00 00 jne 80100b20 + if(ph.type != ELF_PROG_LOAD) +80100a9c: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) +80100aa3: 75 bb jne 80100a60 + if(ph.memsz < ph.filesz) +80100aa5: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax +80100aab: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax +80100ab1: 72 6d jb 80100b20 + if(ph.vaddr + ph.memsz < ph.vaddr) +80100ab3: 03 85 0c ff ff ff add -0xf4(%ebp),%eax +80100ab9: 72 65 jb 80100b20 + if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) +80100abb: 89 44 24 08 mov %eax,0x8(%esp) +80100abf: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax +80100ac5: 89 44 24 04 mov %eax,0x4(%esp) +80100ac9: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100acf: 89 04 24 mov %eax,(%esp) +80100ad2: e8 39 5d 00 00 call 80106810 +80100ad7: 85 c0 test %eax,%eax +80100ad9: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) +80100adf: 74 3f je 80100b20 + if(ph.vaddr % PGSIZE != 0) +80100ae1: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax +80100ae7: a9 ff 0f 00 00 test $0xfff,%eax +80100aec: 75 32 jne 80100b20 + if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) +80100aee: 8b 95 14 ff ff ff mov -0xec(%ebp),%edx +80100af4: 89 44 24 04 mov %eax,0x4(%esp) +80100af8: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100afe: 89 5c 24 08 mov %ebx,0x8(%esp) +80100b02: 89 54 24 10 mov %edx,0x10(%esp) +80100b06: 8b 95 08 ff ff ff mov -0xf8(%ebp),%edx +80100b0c: 89 04 24 mov %eax,(%esp) +80100b0f: 89 54 24 0c mov %edx,0xc(%esp) +80100b13: e8 38 5c 00 00 call 80106750 +80100b18: 85 c0 test %eax,%eax +80100b1a: 0f 89 40 ff ff ff jns 80100a60 + freevm(pgdir); +80100b20: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100b26: 89 04 24 mov %eax,(%esp) +80100b29: e8 f2 5d 00 00 call 80106920 +80100b2e: e9 cd fe ff ff jmp 80100a00 + iunlockput(ip); +80100b33: 89 1c 24 mov %ebx,(%esp) +80100b36: e8 d5 0d 00 00 call 80101910 +80100b3b: 90 nop +80100b3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + end_op(); +80100b40: e8 3b 20 00 00 call 80102b80 + sz = PGROUNDUP(sz); +80100b45: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax +80100b4b: 05 ff 0f 00 00 add $0xfff,%eax +80100b50: 25 00 f0 ff ff and $0xfffff000,%eax + if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) +80100b55: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx +80100b5b: 89 44 24 04 mov %eax,0x4(%esp) +80100b5f: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100b65: 89 54 24 08 mov %edx,0x8(%esp) +80100b69: 89 04 24 mov %eax,(%esp) +80100b6c: e8 9f 5c 00 00 call 80106810 +80100b71: 85 c0 test %eax,%eax +80100b73: 89 85 e8 fe ff ff mov %eax,-0x118(%ebp) +80100b79: 75 33 jne 80100bae + freevm(pgdir); +80100b7b: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100b81: 89 04 24 mov %eax,(%esp) +80100b84: e8 97 5d 00 00 call 80106920 + return -1; +80100b89: b8 ff ff ff ff mov $0xffffffff,%eax +80100b8e: e9 7f fe ff ff jmp 80100a12 + end_op(); +80100b93: e8 e8 1f 00 00 call 80102b80 + cprintf("exec: fail\n"); +80100b98: c7 04 24 c1 6c 10 80 movl $0x80106cc1,(%esp) +80100b9f: e8 ac fa ff ff call 80100650 + return -1; +80100ba4: b8 ff ff ff ff mov $0xffffffff,%eax +80100ba9: e9 64 fe ff ff jmp 80100a12 + clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); +80100bae: 8b 9d e8 fe ff ff mov -0x118(%ebp),%ebx +80100bb4: 89 d8 mov %ebx,%eax +80100bb6: 2d 00 20 00 00 sub $0x2000,%eax +80100bbb: 89 44 24 04 mov %eax,0x4(%esp) +80100bbf: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100bc5: 89 04 24 mov %eax,(%esp) +80100bc8: e8 83 5e 00 00 call 80106a50 + for(argc = 0; argv[argc]; argc++) { +80100bcd: 8b 45 0c mov 0xc(%ebp),%eax +80100bd0: 8b 00 mov (%eax),%eax +80100bd2: 85 c0 test %eax,%eax +80100bd4: 0f 84 59 01 00 00 je 80100d33 +80100bda: 8b 4d 0c mov 0xc(%ebp),%ecx +80100bdd: 31 d2 xor %edx,%edx +80100bdf: 8d 71 04 lea 0x4(%ecx),%esi +80100be2: 89 cf mov %ecx,%edi +80100be4: 89 d1 mov %edx,%ecx +80100be6: 89 f2 mov %esi,%edx +80100be8: 89 fe mov %edi,%esi +80100bea: 89 cf mov %ecx,%edi +80100bec: eb 0a jmp 80100bf8 +80100bee: 66 90 xchg %ax,%ax +80100bf0: 83 c2 04 add $0x4,%edx + if(argc >= MAXARG) +80100bf3: 83 ff 20 cmp $0x20,%edi +80100bf6: 74 83 je 80100b7b + sp = (sp - (strlen(argv[argc]) + 1)) & ~3; +80100bf8: 89 04 24 mov %eax,(%esp) +80100bfb: 89 95 ec fe ff ff mov %edx,-0x114(%ebp) +80100c01: e8 ba 38 00 00 call 801044c0 +80100c06: f7 d0 not %eax +80100c08: 01 c3 add %eax,%ebx + if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) +80100c0a: 8b 06 mov (%esi),%eax + sp = (sp - (strlen(argv[argc]) + 1)) & ~3; +80100c0c: 83 e3 fc and $0xfffffffc,%ebx + if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) +80100c0f: 89 04 24 mov %eax,(%esp) +80100c12: e8 a9 38 00 00 call 801044c0 +80100c17: 83 c0 01 add $0x1,%eax +80100c1a: 89 44 24 0c mov %eax,0xc(%esp) +80100c1e: 8b 06 mov (%esi),%eax +80100c20: 89 5c 24 04 mov %ebx,0x4(%esp) +80100c24: 89 44 24 08 mov %eax,0x8(%esp) +80100c28: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100c2e: 89 04 24 mov %eax,(%esp) +80100c31: e8 7a 5f 00 00 call 80106bb0 +80100c36: 85 c0 test %eax,%eax +80100c38: 0f 88 3d ff ff ff js 80100b7b + for(argc = 0; argv[argc]; argc++) { +80100c3e: 8b 95 ec fe ff ff mov -0x114(%ebp),%edx + ustack[3+argc] = sp; +80100c44: 8d 8d 58 ff ff ff lea -0xa8(%ebp),%ecx +80100c4a: 89 9c bd 64 ff ff ff mov %ebx,-0x9c(%ebp,%edi,4) + for(argc = 0; argv[argc]; argc++) { +80100c51: 83 c7 01 add $0x1,%edi +80100c54: 8b 02 mov (%edx),%eax +80100c56: 89 d6 mov %edx,%esi +80100c58: 85 c0 test %eax,%eax +80100c5a: 75 94 jne 80100bf0 +80100c5c: 89 fa mov %edi,%edx + ustack[3+argc] = 0; +80100c5e: c7 84 95 64 ff ff ff movl $0x0,-0x9c(%ebp,%edx,4) +80100c65: 00 00 00 00 + ustack[2] = sp - (argc+1)*4; // argv pointer +80100c69: 8d 04 95 04 00 00 00 lea 0x4(,%edx,4),%eax + ustack[1] = argc; +80100c70: 89 95 5c ff ff ff mov %edx,-0xa4(%ebp) + ustack[2] = sp - (argc+1)*4; // argv pointer +80100c76: 89 da mov %ebx,%edx +80100c78: 29 c2 sub %eax,%edx + sp -= (3+argc+1) * 4; +80100c7a: 83 c0 0c add $0xc,%eax +80100c7d: 29 c3 sub %eax,%ebx + if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) +80100c7f: 89 44 24 0c mov %eax,0xc(%esp) +80100c83: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100c89: 89 4c 24 08 mov %ecx,0x8(%esp) +80100c8d: 89 5c 24 04 mov %ebx,0x4(%esp) + ustack[0] = 0xffffffff; // fake return PC +80100c91: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) +80100c98: ff ff ff + if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) +80100c9b: 89 04 24 mov %eax,(%esp) + ustack[2] = sp - (argc+1)*4; // argv pointer +80100c9e: 89 95 60 ff ff ff mov %edx,-0xa0(%ebp) + if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) +80100ca4: e8 07 5f 00 00 call 80106bb0 +80100ca9: 85 c0 test %eax,%eax +80100cab: 0f 88 ca fe ff ff js 80100b7b + for(last=s=path; *s; s++) +80100cb1: 8b 45 08 mov 0x8(%ebp),%eax +80100cb4: 0f b6 10 movzbl (%eax),%edx +80100cb7: 84 d2 test %dl,%dl +80100cb9: 74 19 je 80100cd4 +80100cbb: 8b 4d 08 mov 0x8(%ebp),%ecx +80100cbe: 83 c0 01 add $0x1,%eax + last = s+1; +80100cc1: 80 fa 2f cmp $0x2f,%dl + for(last=s=path; *s; s++) +80100cc4: 0f b6 10 movzbl (%eax),%edx + last = s+1; +80100cc7: 0f 44 c8 cmove %eax,%ecx +80100cca: 83 c0 01 add $0x1,%eax + for(last=s=path; *s; s++) +80100ccd: 84 d2 test %dl,%dl +80100ccf: 75 f0 jne 80100cc1 +80100cd1: 89 4d 08 mov %ecx,0x8(%ebp) + safestrcpy(curproc->name, last, sizeof(curproc->name)); +80100cd4: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi +80100cda: 8b 45 08 mov 0x8(%ebp),%eax +80100cdd: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) +80100ce4: 00 +80100ce5: 89 44 24 04 mov %eax,0x4(%esp) +80100ce9: 89 f8 mov %edi,%eax +80100ceb: 83 c0 6c add $0x6c,%eax +80100cee: 89 04 24 mov %eax,(%esp) +80100cf1: e8 8a 37 00 00 call 80104480 + curproc->pgdir = pgdir; +80100cf6: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx + oldpgdir = curproc->pgdir; +80100cfc: 8b 77 04 mov 0x4(%edi),%esi + curproc->tf->eip = elf.entry; // main +80100cff: 8b 47 18 mov 0x18(%edi),%eax + curproc->pgdir = pgdir; +80100d02: 89 4f 04 mov %ecx,0x4(%edi) + curproc->sz = sz; +80100d05: 8b 8d e8 fe ff ff mov -0x118(%ebp),%ecx +80100d0b: 89 0f mov %ecx,(%edi) + curproc->tf->eip = elf.entry; // main +80100d0d: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx +80100d13: 89 50 38 mov %edx,0x38(%eax) + curproc->tf->esp = sp; +80100d16: 8b 47 18 mov 0x18(%edi),%eax +80100d19: 89 58 44 mov %ebx,0x44(%eax) + switchuvm(curproc); +80100d1c: 89 3c 24 mov %edi,(%esp) +80100d1f: e8 9c 58 00 00 call 801065c0 + freevm(oldpgdir); +80100d24: 89 34 24 mov %esi,(%esp) +80100d27: e8 f4 5b 00 00 call 80106920 + return 0; +80100d2c: 31 c0 xor %eax,%eax +80100d2e: e9 df fc ff ff jmp 80100a12 + for(argc = 0; argv[argc]; argc++) { +80100d33: 8b 9d e8 fe ff ff mov -0x118(%ebp),%ebx +80100d39: 31 d2 xor %edx,%edx +80100d3b: 8d 8d 58 ff ff ff lea -0xa8(%ebp),%ecx +80100d41: e9 18 ff ff ff jmp 80100c5e +80100d46: 66 90 xchg %ax,%ax +80100d48: 66 90 xchg %ax,%ax +80100d4a: 66 90 xchg %ax,%ax +80100d4c: 66 90 xchg %ax,%ax +80100d4e: 66 90 xchg %ax,%ax + +80100d50 : + struct file file[NFILE]; +} ftable; + +void +fileinit(void) +{ +80100d50: 55 push %ebp +80100d51: 89 e5 mov %esp,%ebp +80100d53: 83 ec 18 sub $0x18,%esp + initlock(&ftable.lock, "ftable"); +80100d56: c7 44 24 04 cd 6c 10 movl $0x80106ccd,0x4(%esp) +80100d5d: 80 +80100d5e: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) +80100d65: e8 06 33 00 00 call 80104070 +} +80100d6a: c9 leave +80100d6b: c3 ret +80100d6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80100d70 : + +// Allocate a file structure. +struct file* +filealloc(void) +{ +80100d70: 55 push %ebp +80100d71: 89 e5 mov %esp,%ebp +80100d73: 53 push %ebx + struct file *f; + + acquire(&ftable.lock); + for(f = ftable.file; f < ftable.file + NFILE; f++){ +80100d74: bb f4 ff 10 80 mov $0x8010fff4,%ebx +{ +80100d79: 83 ec 14 sub $0x14,%esp + acquire(&ftable.lock); +80100d7c: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) +80100d83: e8 58 34 00 00 call 801041e0 +80100d88: eb 11 jmp 80100d9b +80100d8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + for(f = ftable.file; f < ftable.file + NFILE; f++){ +80100d90: 83 c3 18 add $0x18,%ebx +80100d93: 81 fb 54 09 11 80 cmp $0x80110954,%ebx +80100d99: 74 25 je 80100dc0 + if(f->ref == 0){ +80100d9b: 8b 43 04 mov 0x4(%ebx),%eax +80100d9e: 85 c0 test %eax,%eax +80100da0: 75 ee jne 80100d90 + f->ref = 1; + release(&ftable.lock); +80100da2: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) + f->ref = 1; +80100da9: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) + release(&ftable.lock); +80100db0: e8 9b 34 00 00 call 80104250 + return f; + } + } + release(&ftable.lock); + return 0; +} +80100db5: 83 c4 14 add $0x14,%esp + return f; +80100db8: 89 d8 mov %ebx,%eax +} +80100dba: 5b pop %ebx +80100dbb: 5d pop %ebp +80100dbc: c3 ret +80100dbd: 8d 76 00 lea 0x0(%esi),%esi + release(&ftable.lock); +80100dc0: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) +80100dc7: e8 84 34 00 00 call 80104250 +} +80100dcc: 83 c4 14 add $0x14,%esp + return 0; +80100dcf: 31 c0 xor %eax,%eax +} +80100dd1: 5b pop %ebx +80100dd2: 5d pop %ebp +80100dd3: c3 ret +80100dd4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80100dda: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +80100de0 : + +// Increment ref count for file f. +struct file* +filedup(struct file *f) +{ +80100de0: 55 push %ebp +80100de1: 89 e5 mov %esp,%ebp +80100de3: 53 push %ebx +80100de4: 83 ec 14 sub $0x14,%esp +80100de7: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&ftable.lock); +80100dea: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) +80100df1: e8 ea 33 00 00 call 801041e0 + if(f->ref < 1) +80100df6: 8b 43 04 mov 0x4(%ebx),%eax +80100df9: 85 c0 test %eax,%eax +80100dfb: 7e 1a jle 80100e17 + panic("filedup"); + f->ref++; +80100dfd: 83 c0 01 add $0x1,%eax +80100e00: 89 43 04 mov %eax,0x4(%ebx) + release(&ftable.lock); +80100e03: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) +80100e0a: e8 41 34 00 00 call 80104250 + return f; +} +80100e0f: 83 c4 14 add $0x14,%esp +80100e12: 89 d8 mov %ebx,%eax +80100e14: 5b pop %ebx +80100e15: 5d pop %ebp +80100e16: c3 ret + panic("filedup"); +80100e17: c7 04 24 d4 6c 10 80 movl $0x80106cd4,(%esp) +80100e1e: e8 3d f5 ff ff call 80100360 +80100e23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80100e29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80100e30 : + +// Close file f. (Decrement ref count, close when reaches 0.) +void +fileclose(struct file *f) +{ +80100e30: 55 push %ebp +80100e31: 89 e5 mov %esp,%ebp +80100e33: 57 push %edi +80100e34: 56 push %esi +80100e35: 53 push %ebx +80100e36: 83 ec 1c sub $0x1c,%esp +80100e39: 8b 7d 08 mov 0x8(%ebp),%edi + struct file ff; + + acquire(&ftable.lock); +80100e3c: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) +80100e43: e8 98 33 00 00 call 801041e0 + if(f->ref < 1) +80100e48: 8b 57 04 mov 0x4(%edi),%edx +80100e4b: 85 d2 test %edx,%edx +80100e4d: 0f 8e 89 00 00 00 jle 80100edc + panic("fileclose"); + if(--f->ref > 0){ +80100e53: 83 ea 01 sub $0x1,%edx +80100e56: 85 d2 test %edx,%edx +80100e58: 89 57 04 mov %edx,0x4(%edi) +80100e5b: 74 13 je 80100e70 + release(&ftable.lock); +80100e5d: c7 45 08 c0 ff 10 80 movl $0x8010ffc0,0x8(%ebp) + else if(ff.type == FD_INODE){ + begin_op(); + iput(ff.ip); + end_op(); + } +} +80100e64: 83 c4 1c add $0x1c,%esp +80100e67: 5b pop %ebx +80100e68: 5e pop %esi +80100e69: 5f pop %edi +80100e6a: 5d pop %ebp + release(&ftable.lock); +80100e6b: e9 e0 33 00 00 jmp 80104250 + ff = *f; +80100e70: 0f b6 47 09 movzbl 0x9(%edi),%eax +80100e74: 8b 37 mov (%edi),%esi +80100e76: 8b 5f 0c mov 0xc(%edi),%ebx + f->type = FD_NONE; +80100e79: c7 07 00 00 00 00 movl $0x0,(%edi) + ff = *f; +80100e7f: 88 45 e7 mov %al,-0x19(%ebp) +80100e82: 8b 47 10 mov 0x10(%edi),%eax + release(&ftable.lock); +80100e85: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) + ff = *f; +80100e8c: 89 45 e0 mov %eax,-0x20(%ebp) + release(&ftable.lock); +80100e8f: e8 bc 33 00 00 call 80104250 + if(ff.type == FD_PIPE) +80100e94: 83 fe 01 cmp $0x1,%esi +80100e97: 74 0f je 80100ea8 + else if(ff.type == FD_INODE){ +80100e99: 83 fe 02 cmp $0x2,%esi +80100e9c: 74 22 je 80100ec0 +} +80100e9e: 83 c4 1c add $0x1c,%esp +80100ea1: 5b pop %ebx +80100ea2: 5e pop %esi +80100ea3: 5f pop %edi +80100ea4: 5d pop %ebp +80100ea5: c3 ret +80100ea6: 66 90 xchg %ax,%ax + pipeclose(ff.pipe, ff.writable); +80100ea8: 0f be 75 e7 movsbl -0x19(%ebp),%esi +80100eac: 89 1c 24 mov %ebx,(%esp) +80100eaf: 89 74 24 04 mov %esi,0x4(%esp) +80100eb3: e8 a8 23 00 00 call 80103260 +80100eb8: eb e4 jmp 80100e9e +80100eba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + begin_op(); +80100ec0: e8 4b 1c 00 00 call 80102b10 + iput(ff.ip); +80100ec5: 8b 45 e0 mov -0x20(%ebp),%eax +80100ec8: 89 04 24 mov %eax,(%esp) +80100ecb: e8 00 09 00 00 call 801017d0 +} +80100ed0: 83 c4 1c add $0x1c,%esp +80100ed3: 5b pop %ebx +80100ed4: 5e pop %esi +80100ed5: 5f pop %edi +80100ed6: 5d pop %ebp + end_op(); +80100ed7: e9 a4 1c 00 00 jmp 80102b80 + panic("fileclose"); +80100edc: c7 04 24 dc 6c 10 80 movl $0x80106cdc,(%esp) +80100ee3: e8 78 f4 ff ff call 80100360 +80100ee8: 90 nop +80100ee9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80100ef0 : + +// Get metadata about file f. +int +filestat(struct file *f, struct stat *st) +{ +80100ef0: 55 push %ebp +80100ef1: 89 e5 mov %esp,%ebp +80100ef3: 53 push %ebx +80100ef4: 83 ec 14 sub $0x14,%esp +80100ef7: 8b 5d 08 mov 0x8(%ebp),%ebx + if(f->type == FD_INODE){ +80100efa: 83 3b 02 cmpl $0x2,(%ebx) +80100efd: 75 31 jne 80100f30 + ilock(f->ip); +80100eff: 8b 43 10 mov 0x10(%ebx),%eax +80100f02: 89 04 24 mov %eax,(%esp) +80100f05: e8 a6 07 00 00 call 801016b0 + stati(f->ip, st); +80100f0a: 8b 45 0c mov 0xc(%ebp),%eax +80100f0d: 89 44 24 04 mov %eax,0x4(%esp) +80100f11: 8b 43 10 mov 0x10(%ebx),%eax +80100f14: 89 04 24 mov %eax,(%esp) +80100f17: e8 14 0a 00 00 call 80101930 + iunlock(f->ip); +80100f1c: 8b 43 10 mov 0x10(%ebx),%eax +80100f1f: 89 04 24 mov %eax,(%esp) +80100f22: e8 69 08 00 00 call 80101790 + return 0; + } + return -1; +} +80100f27: 83 c4 14 add $0x14,%esp + return 0; +80100f2a: 31 c0 xor %eax,%eax +} +80100f2c: 5b pop %ebx +80100f2d: 5d pop %ebp +80100f2e: c3 ret +80100f2f: 90 nop +80100f30: 83 c4 14 add $0x14,%esp + return -1; +80100f33: b8 ff ff ff ff mov $0xffffffff,%eax +} +80100f38: 5b pop %ebx +80100f39: 5d pop %ebp +80100f3a: c3 ret +80100f3b: 90 nop +80100f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80100f40 : + +// Read from file f. +int +fileread(struct file *f, char *addr, int n) +{ +80100f40: 55 push %ebp +80100f41: 89 e5 mov %esp,%ebp +80100f43: 57 push %edi +80100f44: 56 push %esi +80100f45: 53 push %ebx +80100f46: 83 ec 1c sub $0x1c,%esp +80100f49: 8b 5d 08 mov 0x8(%ebp),%ebx +80100f4c: 8b 75 0c mov 0xc(%ebp),%esi +80100f4f: 8b 7d 10 mov 0x10(%ebp),%edi + int r; + + if(f->readable == 0) +80100f52: 80 7b 08 00 cmpb $0x0,0x8(%ebx) +80100f56: 74 68 je 80100fc0 + return -1; + if(f->type == FD_PIPE) +80100f58: 8b 03 mov (%ebx),%eax +80100f5a: 83 f8 01 cmp $0x1,%eax +80100f5d: 74 49 je 80100fa8 + return piperead(f->pipe, addr, n); + if(f->type == FD_INODE){ +80100f5f: 83 f8 02 cmp $0x2,%eax +80100f62: 75 63 jne 80100fc7 + ilock(f->ip); +80100f64: 8b 43 10 mov 0x10(%ebx),%eax +80100f67: 89 04 24 mov %eax,(%esp) +80100f6a: e8 41 07 00 00 call 801016b0 + if((r = readi(f->ip, addr, f->off, n)) > 0) +80100f6f: 89 7c 24 0c mov %edi,0xc(%esp) +80100f73: 8b 43 14 mov 0x14(%ebx),%eax +80100f76: 89 74 24 04 mov %esi,0x4(%esp) +80100f7a: 89 44 24 08 mov %eax,0x8(%esp) +80100f7e: 8b 43 10 mov 0x10(%ebx),%eax +80100f81: 89 04 24 mov %eax,(%esp) +80100f84: e8 d7 09 00 00 call 80101960 +80100f89: 85 c0 test %eax,%eax +80100f8b: 89 c6 mov %eax,%esi +80100f8d: 7e 03 jle 80100f92 + f->off += r; +80100f8f: 01 43 14 add %eax,0x14(%ebx) + iunlock(f->ip); +80100f92: 8b 43 10 mov 0x10(%ebx),%eax +80100f95: 89 04 24 mov %eax,(%esp) +80100f98: e8 f3 07 00 00 call 80101790 + if((r = readi(f->ip, addr, f->off, n)) > 0) +80100f9d: 89 f0 mov %esi,%eax + return r; + } + panic("fileread"); +} +80100f9f: 83 c4 1c add $0x1c,%esp +80100fa2: 5b pop %ebx +80100fa3: 5e pop %esi +80100fa4: 5f pop %edi +80100fa5: 5d pop %ebp +80100fa6: c3 ret +80100fa7: 90 nop + return piperead(f->pipe, addr, n); +80100fa8: 8b 43 0c mov 0xc(%ebx),%eax +80100fab: 89 45 08 mov %eax,0x8(%ebp) +} +80100fae: 83 c4 1c add $0x1c,%esp +80100fb1: 5b pop %ebx +80100fb2: 5e pop %esi +80100fb3: 5f pop %edi +80100fb4: 5d pop %ebp + return piperead(f->pipe, addr, n); +80100fb5: e9 26 24 00 00 jmp 801033e0 +80100fba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + return -1; +80100fc0: b8 ff ff ff ff mov $0xffffffff,%eax +80100fc5: eb d8 jmp 80100f9f + panic("fileread"); +80100fc7: c7 04 24 e6 6c 10 80 movl $0x80106ce6,(%esp) +80100fce: e8 8d f3 ff ff call 80100360 +80100fd3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80100fd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80100fe0 : + +//PAGEBREAK! +// Write to file f. +int +filewrite(struct file *f, char *addr, int n) +{ +80100fe0: 55 push %ebp +80100fe1: 89 e5 mov %esp,%ebp +80100fe3: 57 push %edi +80100fe4: 56 push %esi +80100fe5: 53 push %ebx +80100fe6: 83 ec 2c sub $0x2c,%esp +80100fe9: 8b 45 0c mov 0xc(%ebp),%eax +80100fec: 8b 7d 08 mov 0x8(%ebp),%edi +80100fef: 89 45 dc mov %eax,-0x24(%ebp) +80100ff2: 8b 45 10 mov 0x10(%ebp),%eax + int r; + + if(f->writable == 0) +80100ff5: 80 7f 09 00 cmpb $0x0,0x9(%edi) +{ +80100ff9: 89 45 e4 mov %eax,-0x1c(%ebp) + if(f->writable == 0) +80100ffc: 0f 84 ae 00 00 00 je 801010b0 + return -1; + if(f->type == FD_PIPE) +80101002: 8b 07 mov (%edi),%eax +80101004: 83 f8 01 cmp $0x1,%eax +80101007: 0f 84 c2 00 00 00 je 801010cf + return pipewrite(f->pipe, addr, n); + if(f->type == FD_INODE){ +8010100d: 83 f8 02 cmp $0x2,%eax +80101010: 0f 85 d7 00 00 00 jne 801010ed + // and 2 blocks of slop for non-aligned writes. + // this really belongs lower down, since writei() + // might be writing a device like the console. + int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512; + int i = 0; + while(i < n){ +80101016: 8b 45 e4 mov -0x1c(%ebp),%eax +80101019: 31 db xor %ebx,%ebx +8010101b: 85 c0 test %eax,%eax +8010101d: 7f 31 jg 80101050 +8010101f: e9 9c 00 00 00 jmp 801010c0 +80101024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + + begin_op(); + ilock(f->ip); + if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) + f->off += r; + iunlock(f->ip); +80101028: 8b 4f 10 mov 0x10(%edi),%ecx + f->off += r; +8010102b: 01 47 14 add %eax,0x14(%edi) +8010102e: 89 45 e0 mov %eax,-0x20(%ebp) + iunlock(f->ip); +80101031: 89 0c 24 mov %ecx,(%esp) +80101034: e8 57 07 00 00 call 80101790 + end_op(); +80101039: e8 42 1b 00 00 call 80102b80 +8010103e: 8b 45 e0 mov -0x20(%ebp),%eax + + if(r < 0) + break; + if(r != n1) +80101041: 39 f0 cmp %esi,%eax +80101043: 0f 85 98 00 00 00 jne 801010e1 + panic("short filewrite"); + i += r; +80101049: 01 c3 add %eax,%ebx + while(i < n){ +8010104b: 39 5d e4 cmp %ebx,-0x1c(%ebp) +8010104e: 7e 70 jle 801010c0 + int n1 = n - i; +80101050: 8b 75 e4 mov -0x1c(%ebp),%esi +80101053: b8 00 06 00 00 mov $0x600,%eax +80101058: 29 de sub %ebx,%esi +8010105a: 81 fe 00 06 00 00 cmp $0x600,%esi +80101060: 0f 4f f0 cmovg %eax,%esi + begin_op(); +80101063: e8 a8 1a 00 00 call 80102b10 + ilock(f->ip); +80101068: 8b 47 10 mov 0x10(%edi),%eax +8010106b: 89 04 24 mov %eax,(%esp) +8010106e: e8 3d 06 00 00 call 801016b0 + if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) +80101073: 89 74 24 0c mov %esi,0xc(%esp) +80101077: 8b 47 14 mov 0x14(%edi),%eax +8010107a: 89 44 24 08 mov %eax,0x8(%esp) +8010107e: 8b 45 dc mov -0x24(%ebp),%eax +80101081: 01 d8 add %ebx,%eax +80101083: 89 44 24 04 mov %eax,0x4(%esp) +80101087: 8b 47 10 mov 0x10(%edi),%eax +8010108a: 89 04 24 mov %eax,(%esp) +8010108d: e8 ce 09 00 00 call 80101a60 +80101092: 85 c0 test %eax,%eax +80101094: 7f 92 jg 80101028 + iunlock(f->ip); +80101096: 8b 4f 10 mov 0x10(%edi),%ecx +80101099: 89 45 e0 mov %eax,-0x20(%ebp) +8010109c: 89 0c 24 mov %ecx,(%esp) +8010109f: e8 ec 06 00 00 call 80101790 + end_op(); +801010a4: e8 d7 1a 00 00 call 80102b80 + if(r < 0) +801010a9: 8b 45 e0 mov -0x20(%ebp),%eax +801010ac: 85 c0 test %eax,%eax +801010ae: 74 91 je 80101041 + } + return i == n ? n : -1; + } + panic("filewrite"); +} +801010b0: 83 c4 2c add $0x2c,%esp + return -1; +801010b3: b8 ff ff ff ff mov $0xffffffff,%eax +} +801010b8: 5b pop %ebx +801010b9: 5e pop %esi +801010ba: 5f pop %edi +801010bb: 5d pop %ebp +801010bc: c3 ret +801010bd: 8d 76 00 lea 0x0(%esi),%esi + return i == n ? n : -1; +801010c0: 3b 5d e4 cmp -0x1c(%ebp),%ebx +801010c3: 89 d8 mov %ebx,%eax +801010c5: 75 e9 jne 801010b0 +} +801010c7: 83 c4 2c add $0x2c,%esp +801010ca: 5b pop %ebx +801010cb: 5e pop %esi +801010cc: 5f pop %edi +801010cd: 5d pop %ebp +801010ce: c3 ret + return pipewrite(f->pipe, addr, n); +801010cf: 8b 47 0c mov 0xc(%edi),%eax +801010d2: 89 45 08 mov %eax,0x8(%ebp) +} +801010d5: 83 c4 2c add $0x2c,%esp +801010d8: 5b pop %ebx +801010d9: 5e pop %esi +801010da: 5f pop %edi +801010db: 5d pop %ebp + return pipewrite(f->pipe, addr, n); +801010dc: e9 0f 22 00 00 jmp 801032f0 + panic("short filewrite"); +801010e1: c7 04 24 ef 6c 10 80 movl $0x80106cef,(%esp) +801010e8: e8 73 f2 ff ff call 80100360 + panic("filewrite"); +801010ed: c7 04 24 f5 6c 10 80 movl $0x80106cf5,(%esp) +801010f4: e8 67 f2 ff ff call 80100360 +801010f9: 66 90 xchg %ax,%ax +801010fb: 66 90 xchg %ax,%ax +801010fd: 66 90 xchg %ax,%ax +801010ff: 90 nop + +80101100 : +} + +// Free a disk block. +static void +bfree(int dev, uint b) +{ +80101100: 55 push %ebp +80101101: 89 e5 mov %esp,%ebp +80101103: 57 push %edi +80101104: 89 d7 mov %edx,%edi +80101106: 56 push %esi +80101107: 53 push %ebx + struct buf *bp; + int bi, m; + + bp = bread(dev, BBLOCK(b, sb)); + bi = b % BPB; + m = 1 << (bi % 8); +80101108: bb 01 00 00 00 mov $0x1,%ebx +{ +8010110d: 83 ec 1c sub $0x1c,%esp + bp = bread(dev, BBLOCK(b, sb)); +80101110: c1 ea 0c shr $0xc,%edx +80101113: 03 15 d8 09 11 80 add 0x801109d8,%edx +80101119: 89 04 24 mov %eax,(%esp) +8010111c: 89 54 24 04 mov %edx,0x4(%esp) +80101120: e8 ab ef ff ff call 801000d0 + m = 1 << (bi % 8); +80101125: 89 f9 mov %edi,%ecx + bi = b % BPB; +80101127: 81 e7 ff 0f 00 00 and $0xfff,%edi +8010112d: 89 fa mov %edi,%edx + m = 1 << (bi % 8); +8010112f: 83 e1 07 and $0x7,%ecx + if((bp->data[bi/8] & m) == 0) +80101132: c1 fa 03 sar $0x3,%edx + m = 1 << (bi % 8); +80101135: d3 e3 shl %cl,%ebx + bp = bread(dev, BBLOCK(b, sb)); +80101137: 89 c6 mov %eax,%esi + if((bp->data[bi/8] & m) == 0) +80101139: 0f b6 44 10 5c movzbl 0x5c(%eax,%edx,1),%eax +8010113e: 0f b6 c8 movzbl %al,%ecx +80101141: 85 d9 test %ebx,%ecx +80101143: 74 20 je 80101165 + panic("freeing free block"); + bp->data[bi/8] &= ~m; +80101145: f7 d3 not %ebx +80101147: 21 c3 and %eax,%ebx +80101149: 88 5c 16 5c mov %bl,0x5c(%esi,%edx,1) + log_write(bp); +8010114d: 89 34 24 mov %esi,(%esp) +80101150: e8 5b 1b 00 00 call 80102cb0 + brelse(bp); +80101155: 89 34 24 mov %esi,(%esp) +80101158: e8 83 f0 ff ff call 801001e0 +} +8010115d: 83 c4 1c add $0x1c,%esp +80101160: 5b pop %ebx +80101161: 5e pop %esi +80101162: 5f pop %edi +80101163: 5d pop %ebp +80101164: c3 ret + panic("freeing free block"); +80101165: c7 04 24 ff 6c 10 80 movl $0x80106cff,(%esp) +8010116c: e8 ef f1 ff ff call 80100360 +80101171: eb 0d jmp 80101180 +80101173: 90 nop +80101174: 90 nop +80101175: 90 nop +80101176: 90 nop +80101177: 90 nop +80101178: 90 nop +80101179: 90 nop +8010117a: 90 nop +8010117b: 90 nop +8010117c: 90 nop +8010117d: 90 nop +8010117e: 90 nop +8010117f: 90 nop + +80101180 : +{ +80101180: 55 push %ebp +80101181: 89 e5 mov %esp,%ebp +80101183: 57 push %edi +80101184: 56 push %esi +80101185: 53 push %ebx +80101186: 83 ec 2c sub $0x2c,%esp +80101189: 89 45 d8 mov %eax,-0x28(%ebp) + for(b = 0; b < sb.size; b += BPB){ +8010118c: a1 c0 09 11 80 mov 0x801109c0,%eax +80101191: 85 c0 test %eax,%eax +80101193: 0f 84 8c 00 00 00 je 80101225 +80101199: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) + bp = bread(dev, BBLOCK(b, sb)); +801011a0: 8b 75 dc mov -0x24(%ebp),%esi +801011a3: 89 f0 mov %esi,%eax +801011a5: c1 f8 0c sar $0xc,%eax +801011a8: 03 05 d8 09 11 80 add 0x801109d8,%eax +801011ae: 89 44 24 04 mov %eax,0x4(%esp) +801011b2: 8b 45 d8 mov -0x28(%ebp),%eax +801011b5: 89 04 24 mov %eax,(%esp) +801011b8: e8 13 ef ff ff call 801000d0 +801011bd: 89 45 e4 mov %eax,-0x1c(%ebp) +801011c0: a1 c0 09 11 80 mov 0x801109c0,%eax +801011c5: 89 45 e0 mov %eax,-0x20(%ebp) + for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ +801011c8: 31 c0 xor %eax,%eax +801011ca: eb 33 jmp 801011ff +801011cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if((bp->data[bi/8] & m) == 0){ // Is block free? +801011d0: 8b 5d e4 mov -0x1c(%ebp),%ebx +801011d3: 89 c2 mov %eax,%edx + m = 1 << (bi % 8); +801011d5: 89 c1 mov %eax,%ecx + if((bp->data[bi/8] & m) == 0){ // Is block free? +801011d7: c1 fa 03 sar $0x3,%edx + m = 1 << (bi % 8); +801011da: 83 e1 07 and $0x7,%ecx +801011dd: bf 01 00 00 00 mov $0x1,%edi +801011e2: d3 e7 shl %cl,%edi + if((bp->data[bi/8] & m) == 0){ // Is block free? +801011e4: 0f b6 5c 13 5c movzbl 0x5c(%ebx,%edx,1),%ebx + m = 1 << (bi % 8); +801011e9: 89 f9 mov %edi,%ecx + if((bp->data[bi/8] & m) == 0){ // Is block free? +801011eb: 0f b6 fb movzbl %bl,%edi +801011ee: 85 cf test %ecx,%edi +801011f0: 74 46 je 80101238 + for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ +801011f2: 83 c0 01 add $0x1,%eax +801011f5: 83 c6 01 add $0x1,%esi +801011f8: 3d 00 10 00 00 cmp $0x1000,%eax +801011fd: 74 05 je 80101204 +801011ff: 3b 75 e0 cmp -0x20(%ebp),%esi +80101202: 72 cc jb 801011d0 + brelse(bp); +80101204: 8b 45 e4 mov -0x1c(%ebp),%eax +80101207: 89 04 24 mov %eax,(%esp) +8010120a: e8 d1 ef ff ff call 801001e0 + for(b = 0; b < sb.size; b += BPB){ +8010120f: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) +80101216: 8b 45 dc mov -0x24(%ebp),%eax +80101219: 3b 05 c0 09 11 80 cmp 0x801109c0,%eax +8010121f: 0f 82 7b ff ff ff jb 801011a0 + panic("balloc: out of blocks"); +80101225: c7 04 24 12 6d 10 80 movl $0x80106d12,(%esp) +8010122c: e8 2f f1 ff ff call 80100360 +80101231: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + bp->data[bi/8] |= m; // Mark block in use. +80101238: 09 d9 or %ebx,%ecx +8010123a: 8b 5d e4 mov -0x1c(%ebp),%ebx +8010123d: 88 4c 13 5c mov %cl,0x5c(%ebx,%edx,1) + log_write(bp); +80101241: 89 1c 24 mov %ebx,(%esp) +80101244: e8 67 1a 00 00 call 80102cb0 + brelse(bp); +80101249: 89 1c 24 mov %ebx,(%esp) +8010124c: e8 8f ef ff ff call 801001e0 + bp = bread(dev, bno); +80101251: 8b 45 d8 mov -0x28(%ebp),%eax +80101254: 89 74 24 04 mov %esi,0x4(%esp) +80101258: 89 04 24 mov %eax,(%esp) +8010125b: e8 70 ee ff ff call 801000d0 + memset(bp->data, 0, BSIZE); +80101260: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +80101267: 00 +80101268: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +8010126f: 00 + bp = bread(dev, bno); +80101270: 89 c3 mov %eax,%ebx + memset(bp->data, 0, BSIZE); +80101272: 8d 40 5c lea 0x5c(%eax),%eax +80101275: 89 04 24 mov %eax,(%esp) +80101278: e8 23 30 00 00 call 801042a0 + log_write(bp); +8010127d: 89 1c 24 mov %ebx,(%esp) +80101280: e8 2b 1a 00 00 call 80102cb0 + brelse(bp); +80101285: 89 1c 24 mov %ebx,(%esp) +80101288: e8 53 ef ff ff call 801001e0 +} +8010128d: 83 c4 2c add $0x2c,%esp +80101290: 89 f0 mov %esi,%eax +80101292: 5b pop %ebx +80101293: 5e pop %esi +80101294: 5f pop %edi +80101295: 5d pop %ebp +80101296: c3 ret +80101297: 89 f6 mov %esi,%esi +80101299: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801012a0 : +// 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) +{ +801012a0: 55 push %ebp +801012a1: 89 e5 mov %esp,%ebp +801012a3: 57 push %edi +801012a4: 89 c7 mov %eax,%edi +801012a6: 56 push %esi + struct inode *ip, *empty; + + acquire(&icache.lock); + + // Is the inode already cached? + empty = 0; +801012a7: 31 f6 xor %esi,%esi +{ +801012a9: 53 push %ebx + for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ +801012aa: bb 14 0a 11 80 mov $0x80110a14,%ebx +{ +801012af: 83 ec 1c sub $0x1c,%esp + acquire(&icache.lock); +801012b2: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +{ +801012b9: 89 55 e4 mov %edx,-0x1c(%ebp) + acquire(&icache.lock); +801012bc: e8 1f 2f 00 00 call 801041e0 + for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ +801012c1: 8b 55 e4 mov -0x1c(%ebp),%edx +801012c4: eb 14 jmp 801012da +801012c6: 66 90 xchg %ax,%ax + if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ + ip->ref++; + release(&icache.lock); + return ip; + } + if(empty == 0 && ip->ref == 0) // Remember empty slot. +801012c8: 85 f6 test %esi,%esi +801012ca: 74 3c je 80101308 + for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ +801012cc: 81 c3 90 00 00 00 add $0x90,%ebx +801012d2: 81 fb 34 26 11 80 cmp $0x80112634,%ebx +801012d8: 74 46 je 80101320 + if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ +801012da: 8b 4b 08 mov 0x8(%ebx),%ecx +801012dd: 85 c9 test %ecx,%ecx +801012df: 7e e7 jle 801012c8 +801012e1: 39 3b cmp %edi,(%ebx) +801012e3: 75 e3 jne 801012c8 +801012e5: 39 53 04 cmp %edx,0x4(%ebx) +801012e8: 75 de jne 801012c8 + ip->ref++; +801012ea: 83 c1 01 add $0x1,%ecx + return ip; +801012ed: 89 de mov %ebx,%esi + release(&icache.lock); +801012ef: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) + ip->ref++; +801012f6: 89 4b 08 mov %ecx,0x8(%ebx) + release(&icache.lock); +801012f9: e8 52 2f 00 00 call 80104250 + ip->ref = 1; + ip->valid = 0; + release(&icache.lock); + + return ip; +} +801012fe: 83 c4 1c add $0x1c,%esp +80101301: 89 f0 mov %esi,%eax +80101303: 5b pop %ebx +80101304: 5e pop %esi +80101305: 5f pop %edi +80101306: 5d pop %ebp +80101307: c3 ret +80101308: 85 c9 test %ecx,%ecx +8010130a: 0f 44 f3 cmove %ebx,%esi + for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ +8010130d: 81 c3 90 00 00 00 add $0x90,%ebx +80101313: 81 fb 34 26 11 80 cmp $0x80112634,%ebx +80101319: 75 bf jne 801012da +8010131b: 90 nop +8010131c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(empty == 0) +80101320: 85 f6 test %esi,%esi +80101322: 74 29 je 8010134d + ip->dev = dev; +80101324: 89 3e mov %edi,(%esi) + ip->inum = inum; +80101326: 89 56 04 mov %edx,0x4(%esi) + ip->ref = 1; +80101329: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) + ip->valid = 0; +80101330: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) + release(&icache.lock); +80101337: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +8010133e: e8 0d 2f 00 00 call 80104250 +} +80101343: 83 c4 1c add $0x1c,%esp +80101346: 89 f0 mov %esi,%eax +80101348: 5b pop %ebx +80101349: 5e pop %esi +8010134a: 5f pop %edi +8010134b: 5d pop %ebp +8010134c: c3 ret + panic("iget: no inodes"); +8010134d: c7 04 24 28 6d 10 80 movl $0x80106d28,(%esp) +80101354: e8 07 f0 ff ff call 80100360 +80101359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80101360 : + +// 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) +{ +80101360: 55 push %ebp +80101361: 89 e5 mov %esp,%ebp +80101363: 57 push %edi +80101364: 56 push %esi +80101365: 53 push %ebx +80101366: 89 c3 mov %eax,%ebx +80101368: 83 ec 1c sub $0x1c,%esp + uint addr, *a; + struct buf *bp; + + if(bn < NDIRECT){ +8010136b: 83 fa 0b cmp $0xb,%edx +8010136e: 77 18 ja 80101388 +80101370: 8d 34 90 lea (%eax,%edx,4),%esi + if((addr = ip->addrs[bn]) == 0) +80101373: 8b 46 5c mov 0x5c(%esi),%eax +80101376: 85 c0 test %eax,%eax +80101378: 74 66 je 801013e0 + brelse(bp); + return addr; + } + + panic("bmap: out of range"); +} +8010137a: 83 c4 1c add $0x1c,%esp +8010137d: 5b pop %ebx +8010137e: 5e pop %esi +8010137f: 5f pop %edi +80101380: 5d pop %ebp +80101381: c3 ret +80101382: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + bn -= NDIRECT; +80101388: 8d 72 f4 lea -0xc(%edx),%esi + if(bn < NINDIRECT){ +8010138b: 83 fe 7f cmp $0x7f,%esi +8010138e: 77 77 ja 80101407 + if((addr = ip->addrs[NDIRECT]) == 0) +80101390: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax +80101396: 85 c0 test %eax,%eax +80101398: 74 5e je 801013f8 + bp = bread(ip->dev, addr); +8010139a: 89 44 24 04 mov %eax,0x4(%esp) +8010139e: 8b 03 mov (%ebx),%eax +801013a0: 89 04 24 mov %eax,(%esp) +801013a3: e8 28 ed ff ff call 801000d0 + if((addr = a[bn]) == 0){ +801013a8: 8d 54 b0 5c lea 0x5c(%eax,%esi,4),%edx + bp = bread(ip->dev, addr); +801013ac: 89 c7 mov %eax,%edi + if((addr = a[bn]) == 0){ +801013ae: 8b 32 mov (%edx),%esi +801013b0: 85 f6 test %esi,%esi +801013b2: 75 19 jne 801013cd + a[bn] = addr = balloc(ip->dev); +801013b4: 8b 03 mov (%ebx),%eax +801013b6: 89 55 e4 mov %edx,-0x1c(%ebp) +801013b9: e8 c2 fd ff ff call 80101180 +801013be: 8b 55 e4 mov -0x1c(%ebp),%edx +801013c1: 89 02 mov %eax,(%edx) +801013c3: 89 c6 mov %eax,%esi + log_write(bp); +801013c5: 89 3c 24 mov %edi,(%esp) +801013c8: e8 e3 18 00 00 call 80102cb0 + brelse(bp); +801013cd: 89 3c 24 mov %edi,(%esp) +801013d0: e8 0b ee ff ff call 801001e0 +} +801013d5: 83 c4 1c add $0x1c,%esp + brelse(bp); +801013d8: 89 f0 mov %esi,%eax +} +801013da: 5b pop %ebx +801013db: 5e pop %esi +801013dc: 5f pop %edi +801013dd: 5d pop %ebp +801013de: c3 ret +801013df: 90 nop + ip->addrs[bn] = addr = balloc(ip->dev); +801013e0: 8b 03 mov (%ebx),%eax +801013e2: e8 99 fd ff ff call 80101180 +801013e7: 89 46 5c mov %eax,0x5c(%esi) +} +801013ea: 83 c4 1c add $0x1c,%esp +801013ed: 5b pop %ebx +801013ee: 5e pop %esi +801013ef: 5f pop %edi +801013f0: 5d pop %ebp +801013f1: c3 ret +801013f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + ip->addrs[NDIRECT] = addr = balloc(ip->dev); +801013f8: 8b 03 mov (%ebx),%eax +801013fa: e8 81 fd ff ff call 80101180 +801013ff: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx) +80101405: eb 93 jmp 8010139a + panic("bmap: out of range"); +80101407: c7 04 24 38 6d 10 80 movl $0x80106d38,(%esp) +8010140e: e8 4d ef ff ff call 80100360 +80101413: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80101419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101420 : +{ +80101420: 55 push %ebp +80101421: 89 e5 mov %esp,%ebp +80101423: 56 push %esi +80101424: 53 push %ebx +80101425: 83 ec 10 sub $0x10,%esp + bp = bread(dev, 1); +80101428: 8b 45 08 mov 0x8(%ebp),%eax +8010142b: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) +80101432: 00 +{ +80101433: 8b 75 0c mov 0xc(%ebp),%esi + bp = bread(dev, 1); +80101436: 89 04 24 mov %eax,(%esp) +80101439: e8 92 ec ff ff call 801000d0 + memmove(sb, bp->data, sizeof(*sb)); +8010143e: 89 34 24 mov %esi,(%esp) +80101441: c7 44 24 08 1c 00 00 movl $0x1c,0x8(%esp) +80101448: 00 + bp = bread(dev, 1); +80101449: 89 c3 mov %eax,%ebx + memmove(sb, bp->data, sizeof(*sb)); +8010144b: 8d 40 5c lea 0x5c(%eax),%eax +8010144e: 89 44 24 04 mov %eax,0x4(%esp) +80101452: e8 e9 2e 00 00 call 80104340 + brelse(bp); +80101457: 89 5d 08 mov %ebx,0x8(%ebp) +} +8010145a: 83 c4 10 add $0x10,%esp +8010145d: 5b pop %ebx +8010145e: 5e pop %esi +8010145f: 5d pop %ebp + brelse(bp); +80101460: e9 7b ed ff ff jmp 801001e0 +80101465: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80101469: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101470 : +{ +80101470: 55 push %ebp +80101471: 89 e5 mov %esp,%ebp +80101473: 53 push %ebx +80101474: bb 20 0a 11 80 mov $0x80110a20,%ebx +80101479: 83 ec 24 sub $0x24,%esp + initlock(&icache.lock, "icache"); +8010147c: c7 44 24 04 4b 6d 10 movl $0x80106d4b,0x4(%esp) +80101483: 80 +80101484: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +8010148b: e8 e0 2b 00 00 call 80104070 + initsleeplock(&icache.inode[i].lock, "inode"); +80101490: 89 1c 24 mov %ebx,(%esp) +80101493: 81 c3 90 00 00 00 add $0x90,%ebx +80101499: c7 44 24 04 52 6d 10 movl $0x80106d52,0x4(%esp) +801014a0: 80 +801014a1: e8 9a 2a 00 00 call 80103f40 + for(i = 0; i < NINODE; i++) { +801014a6: 81 fb 40 26 11 80 cmp $0x80112640,%ebx +801014ac: 75 e2 jne 80101490 + readsb(dev, &sb); +801014ae: 8b 45 08 mov 0x8(%ebp),%eax +801014b1: c7 44 24 04 c0 09 11 movl $0x801109c0,0x4(%esp) +801014b8: 80 +801014b9: 89 04 24 mov %eax,(%esp) +801014bc: e8 5f ff ff ff call 80101420 + cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ +801014c1: a1 d8 09 11 80 mov 0x801109d8,%eax +801014c6: c7 04 24 b8 6d 10 80 movl $0x80106db8,(%esp) +801014cd: 89 44 24 1c mov %eax,0x1c(%esp) +801014d1: a1 d4 09 11 80 mov 0x801109d4,%eax +801014d6: 89 44 24 18 mov %eax,0x18(%esp) +801014da: a1 d0 09 11 80 mov 0x801109d0,%eax +801014df: 89 44 24 14 mov %eax,0x14(%esp) +801014e3: a1 cc 09 11 80 mov 0x801109cc,%eax +801014e8: 89 44 24 10 mov %eax,0x10(%esp) +801014ec: a1 c8 09 11 80 mov 0x801109c8,%eax +801014f1: 89 44 24 0c mov %eax,0xc(%esp) +801014f5: a1 c4 09 11 80 mov 0x801109c4,%eax +801014fa: 89 44 24 08 mov %eax,0x8(%esp) +801014fe: a1 c0 09 11 80 mov 0x801109c0,%eax +80101503: 89 44 24 04 mov %eax,0x4(%esp) +80101507: e8 44 f1 ff ff call 80100650 +} +8010150c: 83 c4 24 add $0x24,%esp +8010150f: 5b pop %ebx +80101510: 5d pop %ebp +80101511: c3 ret +80101512: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80101519: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101520 : +{ +80101520: 55 push %ebp +80101521: 89 e5 mov %esp,%ebp +80101523: 57 push %edi +80101524: 56 push %esi +80101525: 53 push %ebx +80101526: 83 ec 2c sub $0x2c,%esp +80101529: 8b 45 0c mov 0xc(%ebp),%eax + for(inum = 1; inum < sb.ninodes; inum++){ +8010152c: 83 3d c8 09 11 80 01 cmpl $0x1,0x801109c8 +{ +80101533: 8b 7d 08 mov 0x8(%ebp),%edi +80101536: 89 45 e4 mov %eax,-0x1c(%ebp) + for(inum = 1; inum < sb.ninodes; inum++){ +80101539: 0f 86 a2 00 00 00 jbe 801015e1 +8010153f: be 01 00 00 00 mov $0x1,%esi +80101544: bb 01 00 00 00 mov $0x1,%ebx +80101549: eb 1a jmp 80101565 +8010154b: 90 nop +8010154c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + brelse(bp); +80101550: 89 14 24 mov %edx,(%esp) + for(inum = 1; inum < sb.ninodes; inum++){ +80101553: 83 c3 01 add $0x1,%ebx + brelse(bp); +80101556: e8 85 ec ff ff call 801001e0 + for(inum = 1; inum < sb.ninodes; inum++){ +8010155b: 89 de mov %ebx,%esi +8010155d: 3b 1d c8 09 11 80 cmp 0x801109c8,%ebx +80101563: 73 7c jae 801015e1 + bp = bread(dev, IBLOCK(inum, sb)); +80101565: 89 f0 mov %esi,%eax +80101567: c1 e8 03 shr $0x3,%eax +8010156a: 03 05 d4 09 11 80 add 0x801109d4,%eax +80101570: 89 3c 24 mov %edi,(%esp) +80101573: 89 44 24 04 mov %eax,0x4(%esp) +80101577: e8 54 eb ff ff call 801000d0 +8010157c: 89 c2 mov %eax,%edx + dip = (struct dinode*)bp->data + inum%IPB; +8010157e: 89 f0 mov %esi,%eax +80101580: 83 e0 07 and $0x7,%eax +80101583: c1 e0 06 shl $0x6,%eax +80101586: 8d 4c 02 5c lea 0x5c(%edx,%eax,1),%ecx + if(dip->type == 0){ // a free inode +8010158a: 66 83 39 00 cmpw $0x0,(%ecx) +8010158e: 75 c0 jne 80101550 + memset(dip, 0, sizeof(*dip)); +80101590: 89 0c 24 mov %ecx,(%esp) +80101593: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp) +8010159a: 00 +8010159b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +801015a2: 00 +801015a3: 89 55 dc mov %edx,-0x24(%ebp) +801015a6: 89 4d e0 mov %ecx,-0x20(%ebp) +801015a9: e8 f2 2c 00 00 call 801042a0 + dip->type = type; +801015ae: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax + log_write(bp); // mark it allocated on the disk +801015b2: 8b 55 dc mov -0x24(%ebp),%edx + dip->type = type; +801015b5: 8b 4d e0 mov -0x20(%ebp),%ecx + log_write(bp); // mark it allocated on the disk +801015b8: 89 55 e4 mov %edx,-0x1c(%ebp) + dip->type = type; +801015bb: 66 89 01 mov %ax,(%ecx) + log_write(bp); // mark it allocated on the disk +801015be: 89 14 24 mov %edx,(%esp) +801015c1: e8 ea 16 00 00 call 80102cb0 + brelse(bp); +801015c6: 8b 55 e4 mov -0x1c(%ebp),%edx +801015c9: 89 14 24 mov %edx,(%esp) +801015cc: e8 0f ec ff ff call 801001e0 +} +801015d1: 83 c4 2c add $0x2c,%esp + return iget(dev, inum); +801015d4: 89 f2 mov %esi,%edx +} +801015d6: 5b pop %ebx + return iget(dev, inum); +801015d7: 89 f8 mov %edi,%eax +} +801015d9: 5e pop %esi +801015da: 5f pop %edi +801015db: 5d pop %ebp + return iget(dev, inum); +801015dc: e9 bf fc ff ff jmp 801012a0 + panic("ialloc: no inodes"); +801015e1: c7 04 24 58 6d 10 80 movl $0x80106d58,(%esp) +801015e8: e8 73 ed ff ff call 80100360 +801015ed: 8d 76 00 lea 0x0(%esi),%esi + +801015f0 : +{ +801015f0: 55 push %ebp +801015f1: 89 e5 mov %esp,%ebp +801015f3: 56 push %esi +801015f4: 53 push %ebx +801015f5: 83 ec 10 sub $0x10,%esp +801015f8: 8b 5d 08 mov 0x8(%ebp),%ebx + bp = bread(ip->dev, IBLOCK(ip->inum, sb)); +801015fb: 8b 43 04 mov 0x4(%ebx),%eax + memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); +801015fe: 83 c3 5c add $0x5c,%ebx + bp = bread(ip->dev, IBLOCK(ip->inum, sb)); +80101601: c1 e8 03 shr $0x3,%eax +80101604: 03 05 d4 09 11 80 add 0x801109d4,%eax +8010160a: 89 44 24 04 mov %eax,0x4(%esp) +8010160e: 8b 43 a4 mov -0x5c(%ebx),%eax +80101611: 89 04 24 mov %eax,(%esp) +80101614: e8 b7 ea ff ff call 801000d0 + dip = (struct dinode*)bp->data + ip->inum%IPB; +80101619: 8b 53 a8 mov -0x58(%ebx),%edx +8010161c: 83 e2 07 and $0x7,%edx +8010161f: c1 e2 06 shl $0x6,%edx +80101622: 8d 54 10 5c lea 0x5c(%eax,%edx,1),%edx + bp = bread(ip->dev, IBLOCK(ip->inum, sb)); +80101626: 89 c6 mov %eax,%esi + dip->type = ip->type; +80101628: 0f b7 43 f4 movzwl -0xc(%ebx),%eax + memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); +8010162c: 83 c2 0c add $0xc,%edx + dip->type = ip->type; +8010162f: 66 89 42 f4 mov %ax,-0xc(%edx) + dip->major = ip->major; +80101633: 0f b7 43 f6 movzwl -0xa(%ebx),%eax +80101637: 66 89 42 f6 mov %ax,-0xa(%edx) + dip->minor = ip->minor; +8010163b: 0f b7 43 f8 movzwl -0x8(%ebx),%eax +8010163f: 66 89 42 f8 mov %ax,-0x8(%edx) + dip->nlink = ip->nlink; +80101643: 0f b7 43 fa movzwl -0x6(%ebx),%eax +80101647: 66 89 42 fa mov %ax,-0x6(%edx) + dip->size = ip->size; +8010164b: 8b 43 fc mov -0x4(%ebx),%eax +8010164e: 89 42 fc mov %eax,-0x4(%edx) + memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); +80101651: 89 5c 24 04 mov %ebx,0x4(%esp) +80101655: 89 14 24 mov %edx,(%esp) +80101658: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp) +8010165f: 00 +80101660: e8 db 2c 00 00 call 80104340 + log_write(bp); +80101665: 89 34 24 mov %esi,(%esp) +80101668: e8 43 16 00 00 call 80102cb0 + brelse(bp); +8010166d: 89 75 08 mov %esi,0x8(%ebp) +} +80101670: 83 c4 10 add $0x10,%esp +80101673: 5b pop %ebx +80101674: 5e pop %esi +80101675: 5d pop %ebp + brelse(bp); +80101676: e9 65 eb ff ff jmp 801001e0 +8010167b: 90 nop +8010167c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80101680 : +{ +80101680: 55 push %ebp +80101681: 89 e5 mov %esp,%ebp +80101683: 53 push %ebx +80101684: 83 ec 14 sub $0x14,%esp +80101687: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&icache.lock); +8010168a: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +80101691: e8 4a 2b 00 00 call 801041e0 + ip->ref++; +80101696: 83 43 08 01 addl $0x1,0x8(%ebx) + release(&icache.lock); +8010169a: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +801016a1: e8 aa 2b 00 00 call 80104250 +} +801016a6: 83 c4 14 add $0x14,%esp +801016a9: 89 d8 mov %ebx,%eax +801016ab: 5b pop %ebx +801016ac: 5d pop %ebp +801016ad: c3 ret +801016ae: 66 90 xchg %ax,%ax + +801016b0 : +{ +801016b0: 55 push %ebp +801016b1: 89 e5 mov %esp,%ebp +801016b3: 56 push %esi +801016b4: 53 push %ebx +801016b5: 83 ec 10 sub $0x10,%esp +801016b8: 8b 5d 08 mov 0x8(%ebp),%ebx + if(ip == 0 || ip->ref < 1) +801016bb: 85 db test %ebx,%ebx +801016bd: 0f 84 b3 00 00 00 je 80101776 +801016c3: 8b 53 08 mov 0x8(%ebx),%edx +801016c6: 85 d2 test %edx,%edx +801016c8: 0f 8e a8 00 00 00 jle 80101776 + acquiresleep(&ip->lock); +801016ce: 8d 43 0c lea 0xc(%ebx),%eax +801016d1: 89 04 24 mov %eax,(%esp) +801016d4: e8 a7 28 00 00 call 80103f80 + if(ip->valid == 0){ +801016d9: 8b 43 4c mov 0x4c(%ebx),%eax +801016dc: 85 c0 test %eax,%eax +801016de: 74 08 je 801016e8 +} +801016e0: 83 c4 10 add $0x10,%esp +801016e3: 5b pop %ebx +801016e4: 5e pop %esi +801016e5: 5d pop %ebp +801016e6: c3 ret +801016e7: 90 nop + bp = bread(ip->dev, IBLOCK(ip->inum, sb)); +801016e8: 8b 43 04 mov 0x4(%ebx),%eax +801016eb: c1 e8 03 shr $0x3,%eax +801016ee: 03 05 d4 09 11 80 add 0x801109d4,%eax +801016f4: 89 44 24 04 mov %eax,0x4(%esp) +801016f8: 8b 03 mov (%ebx),%eax +801016fa: 89 04 24 mov %eax,(%esp) +801016fd: e8 ce e9 ff ff call 801000d0 + dip = (struct dinode*)bp->data + ip->inum%IPB; +80101702: 8b 53 04 mov 0x4(%ebx),%edx +80101705: 83 e2 07 and $0x7,%edx +80101708: c1 e2 06 shl $0x6,%edx +8010170b: 8d 54 10 5c lea 0x5c(%eax,%edx,1),%edx + bp = bread(ip->dev, IBLOCK(ip->inum, sb)); +8010170f: 89 c6 mov %eax,%esi + ip->type = dip->type; +80101711: 0f b7 02 movzwl (%edx),%eax + memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); +80101714: 83 c2 0c add $0xc,%edx + ip->type = dip->type; +80101717: 66 89 43 50 mov %ax,0x50(%ebx) + ip->major = dip->major; +8010171b: 0f b7 42 f6 movzwl -0xa(%edx),%eax +8010171f: 66 89 43 52 mov %ax,0x52(%ebx) + ip->minor = dip->minor; +80101723: 0f b7 42 f8 movzwl -0x8(%edx),%eax +80101727: 66 89 43 54 mov %ax,0x54(%ebx) + ip->nlink = dip->nlink; +8010172b: 0f b7 42 fa movzwl -0x6(%edx),%eax +8010172f: 66 89 43 56 mov %ax,0x56(%ebx) + ip->size = dip->size; +80101733: 8b 42 fc mov -0x4(%edx),%eax +80101736: 89 43 58 mov %eax,0x58(%ebx) + memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); +80101739: 8d 43 5c lea 0x5c(%ebx),%eax +8010173c: 89 54 24 04 mov %edx,0x4(%esp) +80101740: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp) +80101747: 00 +80101748: 89 04 24 mov %eax,(%esp) +8010174b: e8 f0 2b 00 00 call 80104340 + brelse(bp); +80101750: 89 34 24 mov %esi,(%esp) +80101753: e8 88 ea ff ff call 801001e0 + if(ip->type == 0) +80101758: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) + ip->valid = 1; +8010175d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) + if(ip->type == 0) +80101764: 0f 85 76 ff ff ff jne 801016e0 + panic("ilock: no type"); +8010176a: c7 04 24 70 6d 10 80 movl $0x80106d70,(%esp) +80101771: e8 ea eb ff ff call 80100360 + panic("ilock"); +80101776: c7 04 24 6a 6d 10 80 movl $0x80106d6a,(%esp) +8010177d: e8 de eb ff ff call 80100360 +80101782: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80101789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101790 : +{ +80101790: 55 push %ebp +80101791: 89 e5 mov %esp,%ebp +80101793: 56 push %esi +80101794: 53 push %ebx +80101795: 83 ec 10 sub $0x10,%esp +80101798: 8b 5d 08 mov 0x8(%ebp),%ebx + if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) +8010179b: 85 db test %ebx,%ebx +8010179d: 74 24 je 801017c3 +8010179f: 8d 73 0c lea 0xc(%ebx),%esi +801017a2: 89 34 24 mov %esi,(%esp) +801017a5: e8 76 28 00 00 call 80104020 +801017aa: 85 c0 test %eax,%eax +801017ac: 74 15 je 801017c3 +801017ae: 8b 43 08 mov 0x8(%ebx),%eax +801017b1: 85 c0 test %eax,%eax +801017b3: 7e 0e jle 801017c3 + releasesleep(&ip->lock); +801017b5: 89 75 08 mov %esi,0x8(%ebp) +} +801017b8: 83 c4 10 add $0x10,%esp +801017bb: 5b pop %ebx +801017bc: 5e pop %esi +801017bd: 5d pop %ebp + releasesleep(&ip->lock); +801017be: e9 1d 28 00 00 jmp 80103fe0 + panic("iunlock"); +801017c3: c7 04 24 7f 6d 10 80 movl $0x80106d7f,(%esp) +801017ca: e8 91 eb ff ff call 80100360 +801017cf: 90 nop + +801017d0 : +{ +801017d0: 55 push %ebp +801017d1: 89 e5 mov %esp,%ebp +801017d3: 57 push %edi +801017d4: 56 push %esi +801017d5: 53 push %ebx +801017d6: 83 ec 1c sub $0x1c,%esp +801017d9: 8b 75 08 mov 0x8(%ebp),%esi + acquiresleep(&ip->lock); +801017dc: 8d 7e 0c lea 0xc(%esi),%edi +801017df: 89 3c 24 mov %edi,(%esp) +801017e2: e8 99 27 00 00 call 80103f80 + if(ip->valid && ip->nlink == 0){ +801017e7: 8b 56 4c mov 0x4c(%esi),%edx +801017ea: 85 d2 test %edx,%edx +801017ec: 74 07 je 801017f5 +801017ee: 66 83 7e 56 00 cmpw $0x0,0x56(%esi) +801017f3: 74 2b je 80101820 + releasesleep(&ip->lock); +801017f5: 89 3c 24 mov %edi,(%esp) +801017f8: e8 e3 27 00 00 call 80103fe0 + acquire(&icache.lock); +801017fd: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +80101804: e8 d7 29 00 00 call 801041e0 + ip->ref--; +80101809: 83 6e 08 01 subl $0x1,0x8(%esi) + release(&icache.lock); +8010180d: c7 45 08 e0 09 11 80 movl $0x801109e0,0x8(%ebp) +} +80101814: 83 c4 1c add $0x1c,%esp +80101817: 5b pop %ebx +80101818: 5e pop %esi +80101819: 5f pop %edi +8010181a: 5d pop %ebp + release(&icache.lock); +8010181b: e9 30 2a 00 00 jmp 80104250 + acquire(&icache.lock); +80101820: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +80101827: e8 b4 29 00 00 call 801041e0 + int r = ip->ref; +8010182c: 8b 5e 08 mov 0x8(%esi),%ebx + release(&icache.lock); +8010182f: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +80101836: e8 15 2a 00 00 call 80104250 + if(r == 1){ +8010183b: 83 fb 01 cmp $0x1,%ebx +8010183e: 75 b5 jne 801017f5 +80101840: 8d 4e 30 lea 0x30(%esi),%ecx +80101843: 89 f3 mov %esi,%ebx +80101845: 89 7d e4 mov %edi,-0x1c(%ebp) +80101848: 89 cf mov %ecx,%edi +8010184a: eb 0b jmp 80101857 +8010184c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80101850: 83 c3 04 add $0x4,%ebx +{ + int i, j; + struct buf *bp; + uint *a; + + for(i = 0; i < NDIRECT; i++){ +80101853: 39 fb cmp %edi,%ebx +80101855: 74 19 je 80101870 + if(ip->addrs[i]){ +80101857: 8b 53 5c mov 0x5c(%ebx),%edx +8010185a: 85 d2 test %edx,%edx +8010185c: 74 f2 je 80101850 + bfree(ip->dev, ip->addrs[i]); +8010185e: 8b 06 mov (%esi),%eax +80101860: e8 9b f8 ff ff call 80101100 + ip->addrs[i] = 0; +80101865: c7 43 5c 00 00 00 00 movl $0x0,0x5c(%ebx) +8010186c: eb e2 jmp 80101850 +8010186e: 66 90 xchg %ax,%ax + } + } + + if(ip->addrs[NDIRECT]){ +80101870: 8b 86 8c 00 00 00 mov 0x8c(%esi),%eax +80101876: 8b 7d e4 mov -0x1c(%ebp),%edi +80101879: 85 c0 test %eax,%eax +8010187b: 75 2b jne 801018a8 + brelse(bp); + bfree(ip->dev, ip->addrs[NDIRECT]); + ip->addrs[NDIRECT] = 0; + } + + ip->size = 0; +8010187d: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi) + iupdate(ip); +80101884: 89 34 24 mov %esi,(%esp) +80101887: e8 64 fd ff ff call 801015f0 + ip->type = 0; +8010188c: 31 c0 xor %eax,%eax +8010188e: 66 89 46 50 mov %ax,0x50(%esi) + iupdate(ip); +80101892: 89 34 24 mov %esi,(%esp) +80101895: e8 56 fd ff ff call 801015f0 + ip->valid = 0; +8010189a: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) +801018a1: e9 4f ff ff ff jmp 801017f5 +801018a6: 66 90 xchg %ax,%ax + bp = bread(ip->dev, ip->addrs[NDIRECT]); +801018a8: 89 44 24 04 mov %eax,0x4(%esp) +801018ac: 8b 06 mov (%esi),%eax + for(j = 0; j < NINDIRECT; j++){ +801018ae: 31 db xor %ebx,%ebx + bp = bread(ip->dev, ip->addrs[NDIRECT]); +801018b0: 89 04 24 mov %eax,(%esp) +801018b3: e8 18 e8 ff ff call 801000d0 + for(j = 0; j < NINDIRECT; j++){ +801018b8: 89 7d e0 mov %edi,-0x20(%ebp) + a = (uint*)bp->data; +801018bb: 8d 48 5c lea 0x5c(%eax),%ecx + bp = bread(ip->dev, ip->addrs[NDIRECT]); +801018be: 89 45 e4 mov %eax,-0x1c(%ebp) + for(j = 0; j < NINDIRECT; j++){ +801018c1: 89 cf mov %ecx,%edi +801018c3: 31 c0 xor %eax,%eax +801018c5: eb 0e jmp 801018d5 +801018c7: 90 nop +801018c8: 83 c3 01 add $0x1,%ebx +801018cb: 81 fb 80 00 00 00 cmp $0x80,%ebx +801018d1: 89 d8 mov %ebx,%eax +801018d3: 74 10 je 801018e5 + if(a[j]) +801018d5: 8b 14 87 mov (%edi,%eax,4),%edx +801018d8: 85 d2 test %edx,%edx +801018da: 74 ec je 801018c8 + bfree(ip->dev, a[j]); +801018dc: 8b 06 mov (%esi),%eax +801018de: e8 1d f8 ff ff call 80101100 +801018e3: eb e3 jmp 801018c8 + brelse(bp); +801018e5: 8b 45 e4 mov -0x1c(%ebp),%eax +801018e8: 8b 7d e0 mov -0x20(%ebp),%edi +801018eb: 89 04 24 mov %eax,(%esp) +801018ee: e8 ed e8 ff ff call 801001e0 + bfree(ip->dev, ip->addrs[NDIRECT]); +801018f3: 8b 96 8c 00 00 00 mov 0x8c(%esi),%edx +801018f9: 8b 06 mov (%esi),%eax +801018fb: e8 00 f8 ff ff call 80101100 + ip->addrs[NDIRECT] = 0; +80101900: c7 86 8c 00 00 00 00 movl $0x0,0x8c(%esi) +80101907: 00 00 00 +8010190a: e9 6e ff ff ff jmp 8010187d +8010190f: 90 nop + +80101910 : +{ +80101910: 55 push %ebp +80101911: 89 e5 mov %esp,%ebp +80101913: 53 push %ebx +80101914: 83 ec 14 sub $0x14,%esp +80101917: 8b 5d 08 mov 0x8(%ebp),%ebx + iunlock(ip); +8010191a: 89 1c 24 mov %ebx,(%esp) +8010191d: e8 6e fe ff ff call 80101790 + iput(ip); +80101922: 89 5d 08 mov %ebx,0x8(%ebp) +} +80101925: 83 c4 14 add $0x14,%esp +80101928: 5b pop %ebx +80101929: 5d pop %ebp + iput(ip); +8010192a: e9 a1 fe ff ff jmp 801017d0 +8010192f: 90 nop + +80101930 : + +// Copy stat information from inode. +// Caller must hold ip->lock. +void +stati(struct inode *ip, struct stat *st) +{ +80101930: 55 push %ebp +80101931: 89 e5 mov %esp,%ebp +80101933: 8b 55 08 mov 0x8(%ebp),%edx +80101936: 8b 45 0c mov 0xc(%ebp),%eax + st->dev = ip->dev; +80101939: 8b 0a mov (%edx),%ecx +8010193b: 89 48 04 mov %ecx,0x4(%eax) + st->ino = ip->inum; +8010193e: 8b 4a 04 mov 0x4(%edx),%ecx +80101941: 89 48 08 mov %ecx,0x8(%eax) + st->type = ip->type; +80101944: 0f b7 4a 50 movzwl 0x50(%edx),%ecx +80101948: 66 89 08 mov %cx,(%eax) + st->nlink = ip->nlink; +8010194b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx +8010194f: 66 89 48 0c mov %cx,0xc(%eax) + st->size = ip->size; +80101953: 8b 52 58 mov 0x58(%edx),%edx +80101956: 89 50 10 mov %edx,0x10(%eax) +} +80101959: 5d pop %ebp +8010195a: c3 ret +8010195b: 90 nop +8010195c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80101960 : +//PAGEBREAK! +// Read data from inode. +// Caller must hold ip->lock. +int +readi(struct inode *ip, char *dst, uint off, uint n) +{ +80101960: 55 push %ebp +80101961: 89 e5 mov %esp,%ebp +80101963: 57 push %edi +80101964: 56 push %esi +80101965: 53 push %ebx +80101966: 83 ec 2c sub $0x2c,%esp +80101969: 8b 45 0c mov 0xc(%ebp),%eax +8010196c: 8b 7d 08 mov 0x8(%ebp),%edi +8010196f: 8b 75 10 mov 0x10(%ebp),%esi +80101972: 89 45 e0 mov %eax,-0x20(%ebp) +80101975: 8b 45 14 mov 0x14(%ebp),%eax + uint tot, m; + struct buf *bp; + + if(ip->type == T_DEV){ +80101978: 66 83 7f 50 03 cmpw $0x3,0x50(%edi) +{ +8010197d: 89 45 e4 mov %eax,-0x1c(%ebp) + if(ip->type == T_DEV){ +80101980: 0f 84 aa 00 00 00 je 80101a30 + if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) + return -1; + return devsw[ip->major].read(ip, dst, n); + } + + if(off > ip->size || off + n < off) +80101986: 8b 47 58 mov 0x58(%edi),%eax +80101989: 39 f0 cmp %esi,%eax +8010198b: 0f 82 c7 00 00 00 jb 80101a58 +80101991: 8b 5d e4 mov -0x1c(%ebp),%ebx +80101994: 89 da mov %ebx,%edx +80101996: 01 f2 add %esi,%edx +80101998: 0f 82 ba 00 00 00 jb 80101a58 + return -1; + if(off + n > ip->size) + n = ip->size - off; +8010199e: 89 c1 mov %eax,%ecx +801019a0: 29 f1 sub %esi,%ecx +801019a2: 39 d0 cmp %edx,%eax +801019a4: 0f 43 cb cmovae %ebx,%ecx + + for(tot=0; totsize - off; +801019ab: 89 4d e4 mov %ecx,-0x1c(%ebp) + for(tot=0; tot +801019b0: 89 7d d8 mov %edi,-0x28(%ebp) +801019b3: 89 c7 mov %eax,%edi +801019b5: 8d 76 00 lea 0x0(%esi),%esi + bp = bread(ip->dev, bmap(ip, off/BSIZE)); +801019b8: 8b 5d d8 mov -0x28(%ebp),%ebx +801019bb: 89 f2 mov %esi,%edx +801019bd: c1 ea 09 shr $0x9,%edx +801019c0: 89 d8 mov %ebx,%eax +801019c2: e8 99 f9 ff ff call 80101360 +801019c7: 89 44 24 04 mov %eax,0x4(%esp) +801019cb: 8b 03 mov (%ebx),%eax + m = min(n - tot, BSIZE - off%BSIZE); +801019cd: bb 00 02 00 00 mov $0x200,%ebx + bp = bread(ip->dev, bmap(ip, off/BSIZE)); +801019d2: 89 04 24 mov %eax,(%esp) +801019d5: e8 f6 e6 ff ff call 801000d0 + m = min(n - tot, BSIZE - off%BSIZE); +801019da: 8b 4d e4 mov -0x1c(%ebp),%ecx +801019dd: 29 f9 sub %edi,%ecx + bp = bread(ip->dev, bmap(ip, off/BSIZE)); +801019df: 89 c2 mov %eax,%edx + m = min(n - tot, BSIZE - off%BSIZE); +801019e1: 89 f0 mov %esi,%eax +801019e3: 25 ff 01 00 00 and $0x1ff,%eax +801019e8: 29 c3 sub %eax,%ebx + memmove(dst, bp->data + off%BSIZE, m); +801019ea: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax + m = min(n - tot, BSIZE - off%BSIZE); +801019ee: 39 cb cmp %ecx,%ebx + memmove(dst, bp->data + off%BSIZE, m); +801019f0: 89 44 24 04 mov %eax,0x4(%esp) +801019f4: 8b 45 e0 mov -0x20(%ebp),%eax + m = min(n - tot, BSIZE - off%BSIZE); +801019f7: 0f 47 d9 cmova %ecx,%ebx + memmove(dst, bp->data + off%BSIZE, m); +801019fa: 89 5c 24 08 mov %ebx,0x8(%esp) + for(tot=0; totdata + off%BSIZE, m); +80101a02: 89 55 dc mov %edx,-0x24(%ebp) +80101a05: 89 04 24 mov %eax,(%esp) +80101a08: e8 33 29 00 00 call 80104340 + brelse(bp); +80101a0d: 8b 55 dc mov -0x24(%ebp),%edx +80101a10: 89 14 24 mov %edx,(%esp) +80101a13: e8 c8 e7 ff ff call 801001e0 + for(tot=0; tot + } + return n; +80101a20: 8b 45 e4 mov -0x1c(%ebp),%eax +} +80101a23: 83 c4 2c add $0x2c,%esp +80101a26: 5b pop %ebx +80101a27: 5e pop %esi +80101a28: 5f pop %edi +80101a29: 5d pop %ebp +80101a2a: c3 ret +80101a2b: 90 nop +80101a2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) +80101a30: 0f bf 47 52 movswl 0x52(%edi),%eax +80101a34: 66 83 f8 09 cmp $0x9,%ax +80101a38: 77 1e ja 80101a58 +80101a3a: 8b 04 c5 60 09 11 80 mov -0x7feef6a0(,%eax,8),%eax +80101a41: 85 c0 test %eax,%eax +80101a43: 74 13 je 80101a58 + return devsw[ip->major].read(ip, dst, n); +80101a45: 8b 75 e4 mov -0x1c(%ebp),%esi +80101a48: 89 75 10 mov %esi,0x10(%ebp) +} +80101a4b: 83 c4 2c add $0x2c,%esp +80101a4e: 5b pop %ebx +80101a4f: 5e pop %esi +80101a50: 5f pop %edi +80101a51: 5d pop %ebp + return devsw[ip->major].read(ip, dst, n); +80101a52: ff e0 jmp *%eax +80101a54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +80101a58: b8 ff ff ff ff mov $0xffffffff,%eax +80101a5d: eb c4 jmp 80101a23 +80101a5f: 90 nop + +80101a60 : +// PAGEBREAK! +// Write data to inode. +// Caller must hold ip->lock. +int +writei(struct inode *ip, char *src, uint off, uint n) +{ +80101a60: 55 push %ebp +80101a61: 89 e5 mov %esp,%ebp +80101a63: 57 push %edi +80101a64: 56 push %esi +80101a65: 53 push %ebx +80101a66: 83 ec 2c sub $0x2c,%esp +80101a69: 8b 45 08 mov 0x8(%ebp),%eax +80101a6c: 8b 75 0c mov 0xc(%ebp),%esi +80101a6f: 8b 4d 14 mov 0x14(%ebp),%ecx + uint tot, m; + struct buf *bp; + + if(ip->type == T_DEV){ +80101a72: 66 83 78 50 03 cmpw $0x3,0x50(%eax) +{ +80101a77: 89 75 dc mov %esi,-0x24(%ebp) +80101a7a: 8b 75 10 mov 0x10(%ebp),%esi +80101a7d: 89 45 d8 mov %eax,-0x28(%ebp) +80101a80: 89 4d e0 mov %ecx,-0x20(%ebp) + if(ip->type == T_DEV){ +80101a83: 0f 84 b7 00 00 00 je 80101b40 + if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) + return -1; + return devsw[ip->major].write(ip, src, n); + } + + if(off > ip->size || off + n < off) +80101a89: 8b 45 d8 mov -0x28(%ebp),%eax +80101a8c: 39 70 58 cmp %esi,0x58(%eax) +80101a8f: 0f 82 e3 00 00 00 jb 80101b78 +80101a95: 8b 4d e0 mov -0x20(%ebp),%ecx +80101a98: 89 c8 mov %ecx,%eax +80101a9a: 01 f0 add %esi,%eax +80101a9c: 0f 82 d6 00 00 00 jb 80101b78 + return -1; + if(off + n > MAXFILE*BSIZE) +80101aa2: 3d 00 18 01 00 cmp $0x11800,%eax +80101aa7: 0f 87 cb 00 00 00 ja 80101b78 + return -1; + + for(tot=0; tot + bp = bread(ip->dev, bmap(ip, off/BSIZE)); +80101ab8: 8b 7d d8 mov -0x28(%ebp),%edi +80101abb: 89 f2 mov %esi,%edx + m = min(n - tot, BSIZE - off%BSIZE); +80101abd: bb 00 02 00 00 mov $0x200,%ebx + bp = bread(ip->dev, bmap(ip, off/BSIZE)); +80101ac2: c1 ea 09 shr $0x9,%edx +80101ac5: 89 f8 mov %edi,%eax +80101ac7: e8 94 f8 ff ff call 80101360 +80101acc: 89 44 24 04 mov %eax,0x4(%esp) +80101ad0: 8b 07 mov (%edi),%eax +80101ad2: 89 04 24 mov %eax,(%esp) +80101ad5: e8 f6 e5 ff ff call 801000d0 + m = min(n - tot, BSIZE - off%BSIZE); +80101ada: 8b 4d e0 mov -0x20(%ebp),%ecx +80101add: 2b 4d e4 sub -0x1c(%ebp),%ecx + memmove(bp->data + off%BSIZE, src, m); +80101ae0: 8b 55 dc mov -0x24(%ebp),%edx + bp = bread(ip->dev, bmap(ip, off/BSIZE)); +80101ae3: 89 c7 mov %eax,%edi + m = min(n - tot, BSIZE - off%BSIZE); +80101ae5: 89 f0 mov %esi,%eax +80101ae7: 25 ff 01 00 00 and $0x1ff,%eax +80101aec: 29 c3 sub %eax,%ebx +80101aee: 39 cb cmp %ecx,%ebx +80101af0: 0f 47 d9 cmova %ecx,%ebx + memmove(bp->data + off%BSIZE, src, m); +80101af3: 8d 44 07 5c lea 0x5c(%edi,%eax,1),%eax + for(tot=0; totdata + off%BSIZE, src, m); +80101af9: 89 54 24 04 mov %edx,0x4(%esp) +80101afd: 89 5c 24 08 mov %ebx,0x8(%esp) +80101b01: 89 04 24 mov %eax,(%esp) +80101b04: e8 37 28 00 00 call 80104340 + log_write(bp); +80101b09: 89 3c 24 mov %edi,(%esp) +80101b0c: e8 9f 11 00 00 call 80102cb0 + brelse(bp); +80101b11: 89 3c 24 mov %edi,(%esp) +80101b14: e8 c7 e6 ff ff call 801001e0 + for(tot=0; tot + } + + if(n > 0 && off > ip->size){ +80101b27: 8b 45 d8 mov -0x28(%ebp),%eax +80101b2a: 39 70 58 cmp %esi,0x58(%eax) +80101b2d: 72 39 jb 80101b68 + ip->size = off; + iupdate(ip); + } + return n; +80101b2f: 8b 45 e0 mov -0x20(%ebp),%eax +} +80101b32: 83 c4 2c add $0x2c,%esp +80101b35: 5b pop %ebx +80101b36: 5e pop %esi +80101b37: 5f pop %edi +80101b38: 5d pop %ebp +80101b39: c3 ret +80101b3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) +80101b40: 0f bf 40 52 movswl 0x52(%eax),%eax +80101b44: 66 83 f8 09 cmp $0x9,%ax +80101b48: 77 2e ja 80101b78 +80101b4a: 8b 04 c5 64 09 11 80 mov -0x7feef69c(,%eax,8),%eax +80101b51: 85 c0 test %eax,%eax +80101b53: 74 23 je 80101b78 + return devsw[ip->major].write(ip, src, n); +80101b55: 89 4d 10 mov %ecx,0x10(%ebp) +} +80101b58: 83 c4 2c add $0x2c,%esp +80101b5b: 5b pop %ebx +80101b5c: 5e pop %esi +80101b5d: 5f pop %edi +80101b5e: 5d pop %ebp + return devsw[ip->major].write(ip, src, n); +80101b5f: ff e0 jmp *%eax +80101b61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + ip->size = off; +80101b68: 8b 45 d8 mov -0x28(%ebp),%eax +80101b6b: 89 70 58 mov %esi,0x58(%eax) + iupdate(ip); +80101b6e: 89 04 24 mov %eax,(%esp) +80101b71: e8 7a fa ff ff call 801015f0 +80101b76: eb b7 jmp 80101b2f +} +80101b78: 83 c4 2c add $0x2c,%esp + return -1; +80101b7b: b8 ff ff ff ff mov $0xffffffff,%eax +} +80101b80: 5b pop %ebx +80101b81: 5e pop %esi +80101b82: 5f pop %edi +80101b83: 5d pop %ebp +80101b84: c3 ret +80101b85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80101b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101b90 : +//PAGEBREAK! +// Directories + +int +namecmp(const char *s, const char *t) +{ +80101b90: 55 push %ebp +80101b91: 89 e5 mov %esp,%ebp +80101b93: 83 ec 18 sub $0x18,%esp + return strncmp(s, t, DIRSIZ); +80101b96: 8b 45 0c mov 0xc(%ebp),%eax +80101b99: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) +80101ba0: 00 +80101ba1: 89 44 24 04 mov %eax,0x4(%esp) +80101ba5: 8b 45 08 mov 0x8(%ebp),%eax +80101ba8: 89 04 24 mov %eax,(%esp) +80101bab: e8 10 28 00 00 call 801043c0 +} +80101bb0: c9 leave +80101bb1: c3 ret +80101bb2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80101bb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101bc0 : + +// 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) +{ +80101bc0: 55 push %ebp +80101bc1: 89 e5 mov %esp,%ebp +80101bc3: 57 push %edi +80101bc4: 56 push %esi +80101bc5: 53 push %ebx +80101bc6: 83 ec 2c sub $0x2c,%esp +80101bc9: 8b 5d 08 mov 0x8(%ebp),%ebx + uint off, inum; + struct dirent de; + + if(dp->type != T_DIR) +80101bcc: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +80101bd1: 0f 85 97 00 00 00 jne 80101c6e + panic("dirlookup not DIR"); + + for(off = 0; off < dp->size; off += sizeof(de)){ +80101bd7: 8b 53 58 mov 0x58(%ebx),%edx +80101bda: 31 ff xor %edi,%edi +80101bdc: 8d 75 d8 lea -0x28(%ebp),%esi +80101bdf: 85 d2 test %edx,%edx +80101be1: 75 0d jne 80101bf0 +80101be3: eb 73 jmp 80101c58 +80101be5: 8d 76 00 lea 0x0(%esi),%esi +80101be8: 83 c7 10 add $0x10,%edi +80101beb: 39 7b 58 cmp %edi,0x58(%ebx) +80101bee: 76 68 jbe 80101c58 + if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) +80101bf0: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) +80101bf7: 00 +80101bf8: 89 7c 24 08 mov %edi,0x8(%esp) +80101bfc: 89 74 24 04 mov %esi,0x4(%esp) +80101c00: 89 1c 24 mov %ebx,(%esp) +80101c03: e8 58 fd ff ff call 80101960 +80101c08: 83 f8 10 cmp $0x10,%eax +80101c0b: 75 55 jne 80101c62 + panic("dirlookup read"); + if(de.inum == 0) +80101c0d: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) +80101c12: 74 d4 je 80101be8 + return strncmp(s, t, DIRSIZ); +80101c14: 8d 45 da lea -0x26(%ebp),%eax +80101c17: 89 44 24 04 mov %eax,0x4(%esp) +80101c1b: 8b 45 0c mov 0xc(%ebp),%eax +80101c1e: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) +80101c25: 00 +80101c26: 89 04 24 mov %eax,(%esp) +80101c29: e8 92 27 00 00 call 801043c0 + continue; + if(namecmp(name, de.name) == 0){ +80101c2e: 85 c0 test %eax,%eax +80101c30: 75 b6 jne 80101be8 + // entry matches path element + if(poff) +80101c32: 8b 45 10 mov 0x10(%ebp),%eax +80101c35: 85 c0 test %eax,%eax +80101c37: 74 05 je 80101c3e + *poff = off; +80101c39: 8b 45 10 mov 0x10(%ebp),%eax +80101c3c: 89 38 mov %edi,(%eax) + inum = de.inum; +80101c3e: 0f b7 55 d8 movzwl -0x28(%ebp),%edx + return iget(dp->dev, inum); +80101c42: 8b 03 mov (%ebx),%eax +80101c44: e8 57 f6 ff ff call 801012a0 + } + } + + return 0; +} +80101c49: 83 c4 2c add $0x2c,%esp +80101c4c: 5b pop %ebx +80101c4d: 5e pop %esi +80101c4e: 5f pop %edi +80101c4f: 5d pop %ebp +80101c50: c3 ret +80101c51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80101c58: 83 c4 2c add $0x2c,%esp + return 0; +80101c5b: 31 c0 xor %eax,%eax +} +80101c5d: 5b pop %ebx +80101c5e: 5e pop %esi +80101c5f: 5f pop %edi +80101c60: 5d pop %ebp +80101c61: c3 ret + panic("dirlookup read"); +80101c62: c7 04 24 99 6d 10 80 movl $0x80106d99,(%esp) +80101c69: e8 f2 e6 ff ff call 80100360 + panic("dirlookup not DIR"); +80101c6e: c7 04 24 87 6d 10 80 movl $0x80106d87,(%esp) +80101c75: e8 e6 e6 ff ff call 80100360 +80101c7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80101c80 : +// 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) +{ +80101c80: 55 push %ebp +80101c81: 89 e5 mov %esp,%ebp +80101c83: 57 push %edi +80101c84: 89 cf mov %ecx,%edi +80101c86: 56 push %esi +80101c87: 53 push %ebx +80101c88: 89 c3 mov %eax,%ebx +80101c8a: 83 ec 2c sub $0x2c,%esp + struct inode *ip, *next; + + if(*path == '/') +80101c8d: 80 38 2f cmpb $0x2f,(%eax) +{ +80101c90: 89 55 e0 mov %edx,-0x20(%ebp) + if(*path == '/') +80101c93: 0f 84 51 01 00 00 je 80101dea + ip = iget(ROOTDEV, ROOTINO); + else + ip = idup(myproc()->cwd); +80101c99: e8 02 1a 00 00 call 801036a0 +80101c9e: 8b 70 68 mov 0x68(%eax),%esi + acquire(&icache.lock); +80101ca1: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +80101ca8: e8 33 25 00 00 call 801041e0 + ip->ref++; +80101cad: 83 46 08 01 addl $0x1,0x8(%esi) + release(&icache.lock); +80101cb1: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) +80101cb8: e8 93 25 00 00 call 80104250 +80101cbd: eb 04 jmp 80101cc3 +80101cbf: 90 nop + path++; +80101cc0: 83 c3 01 add $0x1,%ebx + while(*path == '/') +80101cc3: 0f b6 03 movzbl (%ebx),%eax +80101cc6: 3c 2f cmp $0x2f,%al +80101cc8: 74 f6 je 80101cc0 + if(*path == 0) +80101cca: 84 c0 test %al,%al +80101ccc: 0f 84 ed 00 00 00 je 80101dbf + while(*path != '/' && *path != 0) +80101cd2: 0f b6 03 movzbl (%ebx),%eax +80101cd5: 89 da mov %ebx,%edx +80101cd7: 84 c0 test %al,%al +80101cd9: 0f 84 b1 00 00 00 je 80101d90 +80101cdf: 3c 2f cmp $0x2f,%al +80101ce1: 75 0f jne 80101cf2 +80101ce3: e9 a8 00 00 00 jmp 80101d90 +80101ce8: 3c 2f cmp $0x2f,%al +80101cea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80101cf0: 74 0a je 80101cfc + path++; +80101cf2: 83 c2 01 add $0x1,%edx + while(*path != '/' && *path != 0) +80101cf5: 0f b6 02 movzbl (%edx),%eax +80101cf8: 84 c0 test %al,%al +80101cfa: 75 ec jne 80101ce8 +80101cfc: 89 d1 mov %edx,%ecx +80101cfe: 29 d9 sub %ebx,%ecx + if(len >= DIRSIZ) +80101d00: 83 f9 0d cmp $0xd,%ecx +80101d03: 0f 8e 8f 00 00 00 jle 80101d98 + memmove(name, s, DIRSIZ); +80101d09: 89 5c 24 04 mov %ebx,0x4(%esp) +80101d0d: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) +80101d14: 00 +80101d15: 89 3c 24 mov %edi,(%esp) +80101d18: 89 55 e4 mov %edx,-0x1c(%ebp) +80101d1b: e8 20 26 00 00 call 80104340 + path++; +80101d20: 8b 55 e4 mov -0x1c(%ebp),%edx +80101d23: 89 d3 mov %edx,%ebx + while(*path == '/') +80101d25: 80 3a 2f cmpb $0x2f,(%edx) +80101d28: 75 0e jne 80101d38 +80101d2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + path++; +80101d30: 83 c3 01 add $0x1,%ebx + while(*path == '/') +80101d33: 80 3b 2f cmpb $0x2f,(%ebx) +80101d36: 74 f8 je 80101d30 + + while((path = skipelem(path, name)) != 0){ + ilock(ip); +80101d38: 89 34 24 mov %esi,(%esp) +80101d3b: e8 70 f9 ff ff call 801016b0 + if(ip->type != T_DIR){ +80101d40: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) +80101d45: 0f 85 85 00 00 00 jne 80101dd0 + iunlockput(ip); + return 0; + } + if(nameiparent && *path == '\0'){ +80101d4b: 8b 55 e0 mov -0x20(%ebp),%edx +80101d4e: 85 d2 test %edx,%edx +80101d50: 74 09 je 80101d5b +80101d52: 80 3b 00 cmpb $0x0,(%ebx) +80101d55: 0f 84 a5 00 00 00 je 80101e00 + // Stop one level early. + iunlock(ip); + return ip; + } + if((next = dirlookup(ip, name, 0)) == 0){ +80101d5b: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +80101d62: 00 +80101d63: 89 7c 24 04 mov %edi,0x4(%esp) +80101d67: 89 34 24 mov %esi,(%esp) +80101d6a: e8 51 fe ff ff call 80101bc0 +80101d6f: 85 c0 test %eax,%eax +80101d71: 74 5d je 80101dd0 + iunlock(ip); +80101d73: 89 34 24 mov %esi,(%esp) +80101d76: 89 45 e4 mov %eax,-0x1c(%ebp) +80101d79: e8 12 fa ff ff call 80101790 + iput(ip); +80101d7e: 89 34 24 mov %esi,(%esp) +80101d81: e8 4a fa ff ff call 801017d0 + iunlockput(ip); + return 0; + } + iunlockput(ip); + ip = next; +80101d86: 8b 45 e4 mov -0x1c(%ebp),%eax +80101d89: 89 c6 mov %eax,%esi +80101d8b: e9 33 ff ff ff jmp 80101cc3 + while(*path != '/' && *path != 0) +80101d90: 31 c9 xor %ecx,%ecx +80101d92: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + memmove(name, s, len); +80101d98: 89 4c 24 08 mov %ecx,0x8(%esp) +80101d9c: 89 5c 24 04 mov %ebx,0x4(%esp) +80101da0: 89 3c 24 mov %edi,(%esp) +80101da3: 89 55 dc mov %edx,-0x24(%ebp) +80101da6: 89 4d e4 mov %ecx,-0x1c(%ebp) +80101da9: e8 92 25 00 00 call 80104340 + name[len] = 0; +80101dae: 8b 4d e4 mov -0x1c(%ebp),%ecx +80101db1: 8b 55 dc mov -0x24(%ebp),%edx +80101db4: c6 04 0f 00 movb $0x0,(%edi,%ecx,1) +80101db8: 89 d3 mov %edx,%ebx +80101dba: e9 66 ff ff ff jmp 80101d25 + } + if(nameiparent){ +80101dbf: 8b 45 e0 mov -0x20(%ebp),%eax +80101dc2: 85 c0 test %eax,%eax +80101dc4: 75 4c jne 80101e12 +80101dc6: 89 f0 mov %esi,%eax + iput(ip); + return 0; + } + return ip; +} +80101dc8: 83 c4 2c add $0x2c,%esp +80101dcb: 5b pop %ebx +80101dcc: 5e pop %esi +80101dcd: 5f pop %edi +80101dce: 5d pop %ebp +80101dcf: c3 ret + iunlock(ip); +80101dd0: 89 34 24 mov %esi,(%esp) +80101dd3: e8 b8 f9 ff ff call 80101790 + iput(ip); +80101dd8: 89 34 24 mov %esi,(%esp) +80101ddb: e8 f0 f9 ff ff call 801017d0 +} +80101de0: 83 c4 2c add $0x2c,%esp + return 0; +80101de3: 31 c0 xor %eax,%eax +} +80101de5: 5b pop %ebx +80101de6: 5e pop %esi +80101de7: 5f pop %edi +80101de8: 5d pop %ebp +80101de9: c3 ret + ip = iget(ROOTDEV, ROOTINO); +80101dea: ba 01 00 00 00 mov $0x1,%edx +80101def: b8 01 00 00 00 mov $0x1,%eax +80101df4: e8 a7 f4 ff ff call 801012a0 +80101df9: 89 c6 mov %eax,%esi +80101dfb: e9 c3 fe ff ff jmp 80101cc3 + iunlock(ip); +80101e00: 89 34 24 mov %esi,(%esp) +80101e03: e8 88 f9 ff ff call 80101790 +} +80101e08: 83 c4 2c add $0x2c,%esp + return ip; +80101e0b: 89 f0 mov %esi,%eax +} +80101e0d: 5b pop %ebx +80101e0e: 5e pop %esi +80101e0f: 5f pop %edi +80101e10: 5d pop %ebp +80101e11: c3 ret + iput(ip); +80101e12: 89 34 24 mov %esi,(%esp) +80101e15: e8 b6 f9 ff ff call 801017d0 + return 0; +80101e1a: 31 c0 xor %eax,%eax +80101e1c: eb aa jmp 80101dc8 +80101e1e: 66 90 xchg %ax,%ax + +80101e20 : +{ +80101e20: 55 push %ebp +80101e21: 89 e5 mov %esp,%ebp +80101e23: 57 push %edi +80101e24: 56 push %esi +80101e25: 53 push %ebx +80101e26: 83 ec 2c sub $0x2c,%esp +80101e29: 8b 5d 08 mov 0x8(%ebp),%ebx + if((ip = dirlookup(dp, name, 0)) != 0){ +80101e2c: 8b 45 0c mov 0xc(%ebp),%eax +80101e2f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +80101e36: 00 +80101e37: 89 1c 24 mov %ebx,(%esp) +80101e3a: 89 44 24 04 mov %eax,0x4(%esp) +80101e3e: e8 7d fd ff ff call 80101bc0 +80101e43: 85 c0 test %eax,%eax +80101e45: 0f 85 8b 00 00 00 jne 80101ed6 + for(off = 0; off < dp->size; off += sizeof(de)){ +80101e4b: 8b 43 58 mov 0x58(%ebx),%eax +80101e4e: 31 ff xor %edi,%edi +80101e50: 8d 75 d8 lea -0x28(%ebp),%esi +80101e53: 85 c0 test %eax,%eax +80101e55: 75 13 jne 80101e6a +80101e57: eb 35 jmp 80101e8e +80101e59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80101e60: 8d 57 10 lea 0x10(%edi),%edx +80101e63: 39 53 58 cmp %edx,0x58(%ebx) +80101e66: 89 d7 mov %edx,%edi +80101e68: 76 24 jbe 80101e8e + if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) +80101e6a: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) +80101e71: 00 +80101e72: 89 7c 24 08 mov %edi,0x8(%esp) +80101e76: 89 74 24 04 mov %esi,0x4(%esp) +80101e7a: 89 1c 24 mov %ebx,(%esp) +80101e7d: e8 de fa ff ff call 80101960 +80101e82: 83 f8 10 cmp $0x10,%eax +80101e85: 75 5e jne 80101ee5 + if(de.inum == 0) +80101e87: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) +80101e8c: 75 d2 jne 80101e60 + strncpy(de.name, name, DIRSIZ); +80101e8e: 8b 45 0c mov 0xc(%ebp),%eax +80101e91: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) +80101e98: 00 +80101e99: 89 44 24 04 mov %eax,0x4(%esp) +80101e9d: 8d 45 da lea -0x26(%ebp),%eax +80101ea0: 89 04 24 mov %eax,(%esp) +80101ea3: e8 88 25 00 00 call 80104430 + de.inum = inum; +80101ea8: 8b 45 10 mov 0x10(%ebp),%eax + if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) +80101eab: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) +80101eb2: 00 +80101eb3: 89 7c 24 08 mov %edi,0x8(%esp) +80101eb7: 89 74 24 04 mov %esi,0x4(%esp) +80101ebb: 89 1c 24 mov %ebx,(%esp) + de.inum = inum; +80101ebe: 66 89 45 d8 mov %ax,-0x28(%ebp) + if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) +80101ec2: e8 99 fb ff ff call 80101a60 +80101ec7: 83 f8 10 cmp $0x10,%eax +80101eca: 75 25 jne 80101ef1 + return 0; +80101ecc: 31 c0 xor %eax,%eax +} +80101ece: 83 c4 2c add $0x2c,%esp +80101ed1: 5b pop %ebx +80101ed2: 5e pop %esi +80101ed3: 5f pop %edi +80101ed4: 5d pop %ebp +80101ed5: c3 ret + iput(ip); +80101ed6: 89 04 24 mov %eax,(%esp) +80101ed9: e8 f2 f8 ff ff call 801017d0 + return -1; +80101ede: b8 ff ff ff ff mov $0xffffffff,%eax +80101ee3: eb e9 jmp 80101ece + panic("dirlink read"); +80101ee5: c7 04 24 a8 6d 10 80 movl $0x80106da8,(%esp) +80101eec: e8 6f e4 ff ff call 80100360 + panic("dirlink"); +80101ef1: c7 04 24 9e 73 10 80 movl $0x8010739e,(%esp) +80101ef8: e8 63 e4 ff ff call 80100360 +80101efd: 8d 76 00 lea 0x0(%esi),%esi + +80101f00 : + +struct inode* +namei(char *path) +{ +80101f00: 55 push %ebp + char name[DIRSIZ]; + return namex(path, 0, name); +80101f01: 31 d2 xor %edx,%edx +{ +80101f03: 89 e5 mov %esp,%ebp +80101f05: 83 ec 18 sub $0x18,%esp + return namex(path, 0, name); +80101f08: 8b 45 08 mov 0x8(%ebp),%eax +80101f0b: 8d 4d ea lea -0x16(%ebp),%ecx +80101f0e: e8 6d fd ff ff call 80101c80 +} +80101f13: c9 leave +80101f14: c3 ret +80101f15: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80101f19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80101f20 : + +struct inode* +nameiparent(char *path, char *name) +{ +80101f20: 55 push %ebp + return namex(path, 1, name); +80101f21: ba 01 00 00 00 mov $0x1,%edx +{ +80101f26: 89 e5 mov %esp,%ebp + return namex(path, 1, name); +80101f28: 8b 4d 0c mov 0xc(%ebp),%ecx +80101f2b: 8b 45 08 mov 0x8(%ebp),%eax +} +80101f2e: 5d pop %ebp + return namex(path, 1, name); +80101f2f: e9 4c fd ff ff jmp 80101c80 +80101f34: 66 90 xchg %ax,%ax +80101f36: 66 90 xchg %ax,%ax +80101f38: 66 90 xchg %ax,%ax +80101f3a: 66 90 xchg %ax,%ax +80101f3c: 66 90 xchg %ax,%ax +80101f3e: 66 90 xchg %ax,%ax + +80101f40 : +} + +// Start the request for b. Caller must hold idelock. +static void +idestart(struct buf *b) +{ +80101f40: 55 push %ebp +80101f41: 89 e5 mov %esp,%ebp +80101f43: 56 push %esi +80101f44: 89 c6 mov %eax,%esi +80101f46: 53 push %ebx +80101f47: 83 ec 10 sub $0x10,%esp + if(b == 0) +80101f4a: 85 c0 test %eax,%eax +80101f4c: 0f 84 99 00 00 00 je 80101feb + panic("idestart"); + if(b->blockno >= FSSIZE) +80101f52: 8b 48 08 mov 0x8(%eax),%ecx +80101f55: 81 f9 e7 03 00 00 cmp $0x3e7,%ecx +80101f5b: 0f 87 7e 00 00 00 ja 80101fdf + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80101f61: ba f7 01 00 00 mov $0x1f7,%edx +80101f66: 66 90 xchg %ax,%ax +80101f68: ec in (%dx),%al + while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) +80101f69: 83 e0 c0 and $0xffffffc0,%eax +80101f6c: 3c 40 cmp $0x40,%al +80101f6e: 75 f8 jne 80101f68 + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80101f70: 31 db xor %ebx,%ebx +80101f72: ba f6 03 00 00 mov $0x3f6,%edx +80101f77: 89 d8 mov %ebx,%eax +80101f79: ee out %al,(%dx) +80101f7a: ba f2 01 00 00 mov $0x1f2,%edx +80101f7f: b8 01 00 00 00 mov $0x1,%eax +80101f84: ee out %al,(%dx) +80101f85: 0f b6 c1 movzbl %cl,%eax +80101f88: b2 f3 mov $0xf3,%dl +80101f8a: ee out %al,(%dx) + + idewait(0); + outb(0x3f6, 0); // generate interrupt + outb(0x1f2, sector_per_block); // number of sectors + outb(0x1f3, sector & 0xff); + outb(0x1f4, (sector >> 8) & 0xff); +80101f8b: 89 c8 mov %ecx,%eax +80101f8d: b2 f4 mov $0xf4,%dl +80101f8f: c1 f8 08 sar $0x8,%eax +80101f92: ee out %al,(%dx) +80101f93: b2 f5 mov $0xf5,%dl +80101f95: 89 d8 mov %ebx,%eax +80101f97: ee out %al,(%dx) + outb(0x1f5, (sector >> 16) & 0xff); + outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); +80101f98: 0f b6 46 04 movzbl 0x4(%esi),%eax +80101f9c: b2 f6 mov $0xf6,%dl +80101f9e: 83 e0 01 and $0x1,%eax +80101fa1: c1 e0 04 shl $0x4,%eax +80101fa4: 83 c8 e0 or $0xffffffe0,%eax +80101fa7: ee out %al,(%dx) + if(b->flags & B_DIRTY){ +80101fa8: f6 06 04 testb $0x4,(%esi) +80101fab: 75 13 jne 80101fc0 +80101fad: ba f7 01 00 00 mov $0x1f7,%edx +80101fb2: b8 20 00 00 00 mov $0x20,%eax +80101fb7: ee out %al,(%dx) + outb(0x1f7, write_cmd); + outsl(0x1f0, b->data, BSIZE/4); + } else { + outb(0x1f7, read_cmd); + } +} +80101fb8: 83 c4 10 add $0x10,%esp +80101fbb: 5b pop %ebx +80101fbc: 5e pop %esi +80101fbd: 5d pop %ebp +80101fbe: c3 ret +80101fbf: 90 nop +80101fc0: b2 f7 mov $0xf7,%dl +80101fc2: b8 30 00 00 00 mov $0x30,%eax +80101fc7: ee out %al,(%dx) + asm volatile("cld; rep outsl" : +80101fc8: b9 80 00 00 00 mov $0x80,%ecx + outsl(0x1f0, b->data, BSIZE/4); +80101fcd: 83 c6 5c add $0x5c,%esi +80101fd0: ba f0 01 00 00 mov $0x1f0,%edx +80101fd5: fc cld +80101fd6: f3 6f rep outsl %ds:(%esi),(%dx) +} +80101fd8: 83 c4 10 add $0x10,%esp +80101fdb: 5b pop %ebx +80101fdc: 5e pop %esi +80101fdd: 5d pop %ebp +80101fde: c3 ret + panic("incorrect blockno"); +80101fdf: c7 04 24 14 6e 10 80 movl $0x80106e14,(%esp) +80101fe6: e8 75 e3 ff ff call 80100360 + panic("idestart"); +80101feb: c7 04 24 0b 6e 10 80 movl $0x80106e0b,(%esp) +80101ff2: e8 69 e3 ff ff call 80100360 +80101ff7: 89 f6 mov %esi,%esi +80101ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102000 : +{ +80102000: 55 push %ebp +80102001: 89 e5 mov %esp,%ebp +80102003: 83 ec 18 sub $0x18,%esp + initlock(&idelock, "ide"); +80102006: c7 44 24 04 26 6e 10 movl $0x80106e26,0x4(%esp) +8010200d: 80 +8010200e: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp) +80102015: e8 56 20 00 00 call 80104070 + ioapicenable(IRQ_IDE, ncpu - 1); +8010201a: a1 00 2d 11 80 mov 0x80112d00,%eax +8010201f: c7 04 24 0e 00 00 00 movl $0xe,(%esp) +80102026: 83 e8 01 sub $0x1,%eax +80102029: 89 44 24 04 mov %eax,0x4(%esp) +8010202d: e8 7e 02 00 00 call 801022b0 + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102032: ba f7 01 00 00 mov $0x1f7,%edx +80102037: 90 nop +80102038: ec in (%dx),%al + while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) +80102039: 83 e0 c0 and $0xffffffc0,%eax +8010203c: 3c 40 cmp $0x40,%al +8010203e: 75 f8 jne 80102038 + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80102040: ba f6 01 00 00 mov $0x1f6,%edx +80102045: b8 f0 ff ff ff mov $0xfffffff0,%eax +8010204a: ee out %al,(%dx) +8010204b: b9 e8 03 00 00 mov $0x3e8,%ecx + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102050: b2 f7 mov $0xf7,%dl +80102052: eb 09 jmp 8010205d +80102054: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + for(i=0; i<1000; i++){ +80102058: 83 e9 01 sub $0x1,%ecx +8010205b: 74 0f je 8010206c +8010205d: ec in (%dx),%al + if(inb(0x1f7) != 0){ +8010205e: 84 c0 test %al,%al +80102060: 74 f6 je 80102058 + havedisk1 = 1; +80102062: c7 05 60 a5 10 80 01 movl $0x1,0x8010a560 +80102069: 00 00 00 + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +8010206c: ba f6 01 00 00 mov $0x1f6,%edx +80102071: b8 e0 ff ff ff mov $0xffffffe0,%eax +80102076: ee out %al,(%dx) +} +80102077: c9 leave +80102078: c3 ret +80102079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80102080 : + +// Interrupt handler. +void +ideintr(void) +{ +80102080: 55 push %ebp +80102081: 89 e5 mov %esp,%ebp +80102083: 57 push %edi +80102084: 56 push %esi +80102085: 53 push %ebx +80102086: 83 ec 1c sub $0x1c,%esp + struct buf *b; + + // First queued buffer is the active request. + acquire(&idelock); +80102089: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp) +80102090: e8 4b 21 00 00 call 801041e0 + + if((b = idequeue) == 0){ +80102095: 8b 1d 64 a5 10 80 mov 0x8010a564,%ebx +8010209b: 85 db test %ebx,%ebx +8010209d: 74 30 je 801020cf + release(&idelock); + return; + } + idequeue = b->qnext; +8010209f: 8b 43 58 mov 0x58(%ebx),%eax +801020a2: a3 64 a5 10 80 mov %eax,0x8010a564 + + // Read data if needed. + if(!(b->flags & B_DIRTY) && idewait(1) >= 0) +801020a7: 8b 33 mov (%ebx),%esi +801020a9: f7 c6 04 00 00 00 test $0x4,%esi +801020af: 74 37 je 801020e8 + insl(0x1f0, b->data, BSIZE/4); + + // Wake process waiting for this buf. + b->flags |= B_VALID; + b->flags &= ~B_DIRTY; +801020b1: 83 e6 fb and $0xfffffffb,%esi +801020b4: 83 ce 02 or $0x2,%esi +801020b7: 89 33 mov %esi,(%ebx) + wakeup(b); +801020b9: 89 1c 24 mov %ebx,(%esp) +801020bc: e8 cf 1c 00 00 call 80103d90 + + // Start disk on next buf in queue. + if(idequeue != 0) +801020c1: a1 64 a5 10 80 mov 0x8010a564,%eax +801020c6: 85 c0 test %eax,%eax +801020c8: 74 05 je 801020cf + idestart(idequeue); +801020ca: e8 71 fe ff ff call 80101f40 + release(&idelock); +801020cf: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp) +801020d6: e8 75 21 00 00 call 80104250 + + release(&idelock); +} +801020db: 83 c4 1c add $0x1c,%esp +801020de: 5b pop %ebx +801020df: 5e pop %esi +801020e0: 5f pop %edi +801020e1: 5d pop %ebp +801020e2: c3 ret +801020e3: 90 nop +801020e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +801020e8: ba f7 01 00 00 mov $0x1f7,%edx +801020ed: 8d 76 00 lea 0x0(%esi),%esi +801020f0: ec in (%dx),%al + while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) +801020f1: 89 c1 mov %eax,%ecx +801020f3: 83 e1 c0 and $0xffffffc0,%ecx +801020f6: 80 f9 40 cmp $0x40,%cl +801020f9: 75 f5 jne 801020f0 + if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) +801020fb: a8 21 test $0x21,%al +801020fd: 75 b2 jne 801020b1 + insl(0x1f0, b->data, BSIZE/4); +801020ff: 8d 7b 5c lea 0x5c(%ebx),%edi + asm volatile("cld; rep insl" : +80102102: b9 80 00 00 00 mov $0x80,%ecx +80102107: ba f0 01 00 00 mov $0x1f0,%edx +8010210c: fc cld +8010210d: f3 6d rep insl (%dx),%es:(%edi) +8010210f: 8b 33 mov (%ebx),%esi +80102111: eb 9e jmp 801020b1 +80102113: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80102119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102120 : +// 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) +{ +80102120: 55 push %ebp +80102121: 89 e5 mov %esp,%ebp +80102123: 53 push %ebx +80102124: 83 ec 14 sub $0x14,%esp +80102127: 8b 5d 08 mov 0x8(%ebp),%ebx + struct buf **pp; + + if(!holdingsleep(&b->lock)) +8010212a: 8d 43 0c lea 0xc(%ebx),%eax +8010212d: 89 04 24 mov %eax,(%esp) +80102130: e8 eb 1e 00 00 call 80104020 +80102135: 85 c0 test %eax,%eax +80102137: 0f 84 9e 00 00 00 je 801021db + panic("iderw: buf not locked"); + if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) +8010213d: 8b 03 mov (%ebx),%eax +8010213f: 83 e0 06 and $0x6,%eax +80102142: 83 f8 02 cmp $0x2,%eax +80102145: 0f 84 a8 00 00 00 je 801021f3 + panic("iderw: nothing to do"); + if(b->dev != 0 && !havedisk1) +8010214b: 8b 53 04 mov 0x4(%ebx),%edx +8010214e: 85 d2 test %edx,%edx +80102150: 74 0d je 8010215f +80102152: a1 60 a5 10 80 mov 0x8010a560,%eax +80102157: 85 c0 test %eax,%eax +80102159: 0f 84 88 00 00 00 je 801021e7 + panic("iderw: ide disk 1 not present"); + + acquire(&idelock); //DOC:acquire-lock +8010215f: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp) +80102166: e8 75 20 00 00 call 801041e0 + + // Append b to idequeue. + b->qnext = 0; + for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue +8010216b: a1 64 a5 10 80 mov 0x8010a564,%eax + b->qnext = 0; +80102170: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) + for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue +80102177: 85 c0 test %eax,%eax +80102179: 75 07 jne 80102182 +8010217b: eb 4e jmp 801021cb +8010217d: 8d 76 00 lea 0x0(%esi),%esi +80102180: 89 d0 mov %edx,%eax +80102182: 8b 50 58 mov 0x58(%eax),%edx +80102185: 85 d2 test %edx,%edx +80102187: 75 f7 jne 80102180 +80102189: 83 c0 58 add $0x58,%eax + ; + *pp = b; +8010218c: 89 18 mov %ebx,(%eax) + + // Start disk if necessary. + if(idequeue == b) +8010218e: 39 1d 64 a5 10 80 cmp %ebx,0x8010a564 +80102194: 74 3c je 801021d2 + idestart(b); + + // Wait for request to finish. + while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ +80102196: 8b 03 mov (%ebx),%eax +80102198: 83 e0 06 and $0x6,%eax +8010219b: 83 f8 02 cmp $0x2,%eax +8010219e: 74 1a je 801021ba + sleep(b, &idelock); +801021a0: c7 44 24 04 80 a5 10 movl $0x8010a580,0x4(%esp) +801021a7: 80 +801021a8: 89 1c 24 mov %ebx,(%esp) +801021ab: e8 50 1a 00 00 call 80103c00 + while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ +801021b0: 8b 13 mov (%ebx),%edx +801021b2: 83 e2 06 and $0x6,%edx +801021b5: 83 fa 02 cmp $0x2,%edx +801021b8: 75 e6 jne 801021a0 + } + + + release(&idelock); +801021ba: c7 45 08 80 a5 10 80 movl $0x8010a580,0x8(%ebp) +} +801021c1: 83 c4 14 add $0x14,%esp +801021c4: 5b pop %ebx +801021c5: 5d pop %ebp + release(&idelock); +801021c6: e9 85 20 00 00 jmp 80104250 + for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue +801021cb: b8 64 a5 10 80 mov $0x8010a564,%eax +801021d0: eb ba jmp 8010218c + idestart(b); +801021d2: 89 d8 mov %ebx,%eax +801021d4: e8 67 fd ff ff call 80101f40 +801021d9: eb bb jmp 80102196 + panic("iderw: buf not locked"); +801021db: c7 04 24 2a 6e 10 80 movl $0x80106e2a,(%esp) +801021e2: e8 79 e1 ff ff call 80100360 + panic("iderw: ide disk 1 not present"); +801021e7: c7 04 24 55 6e 10 80 movl $0x80106e55,(%esp) +801021ee: e8 6d e1 ff ff call 80100360 + panic("iderw: nothing to do"); +801021f3: c7 04 24 40 6e 10 80 movl $0x80106e40,(%esp) +801021fa: e8 61 e1 ff ff call 80100360 +801021ff: 90 nop + +80102200 : + ioapic->data = data; +} + +void +ioapicinit(void) +{ +80102200: 55 push %ebp +80102201: 89 e5 mov %esp,%ebp +80102203: 56 push %esi +80102204: 53 push %ebx +80102205: 83 ec 10 sub $0x10,%esp + int i, id, maxintr; + + ioapic = (volatile struct ioapic*)IOAPIC; +80102208: c7 05 34 26 11 80 00 movl $0xfec00000,0x80112634 +8010220f: 00 c0 fe + ioapic->reg = reg; +80102212: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 +80102219: 00 00 00 + return ioapic->data; +8010221c: 8b 15 34 26 11 80 mov 0x80112634,%edx +80102222: 8b 42 10 mov 0x10(%edx),%eax + ioapic->reg = reg; +80102225: c7 02 00 00 00 00 movl $0x0,(%edx) + return ioapic->data; +8010222b: 8b 1d 34 26 11 80 mov 0x80112634,%ebx + maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; + id = ioapicread(REG_ID) >> 24; + if(id != ioapicid) +80102231: 0f b6 15 60 27 11 80 movzbl 0x80112760,%edx + maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; +80102238: c1 e8 10 shr $0x10,%eax +8010223b: 0f b6 f0 movzbl %al,%esi + return ioapic->data; +8010223e: 8b 43 10 mov 0x10(%ebx),%eax + id = ioapicread(REG_ID) >> 24; +80102241: c1 e8 18 shr $0x18,%eax + if(id != ioapicid) +80102244: 39 c2 cmp %eax,%edx +80102246: 74 12 je 8010225a + cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); +80102248: c7 04 24 74 6e 10 80 movl $0x80106e74,(%esp) +8010224f: e8 fc e3 ff ff call 80100650 +80102254: 8b 1d 34 26 11 80 mov 0x80112634,%ebx +8010225a: ba 10 00 00 00 mov $0x10,%edx +8010225f: 31 c0 xor %eax,%eax +80102261: eb 07 jmp 8010226a +80102263: 90 nop +80102264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80102268: 89 cb mov %ecx,%ebx + ioapic->reg = reg; +8010226a: 89 13 mov %edx,(%ebx) + ioapic->data = data; +8010226c: 8b 1d 34 26 11 80 mov 0x80112634,%ebx +80102272: 8d 48 20 lea 0x20(%eax),%ecx + + // Mark all interrupts edge-triggered, active high, disabled, + // and not routed to any CPUs. + for(i = 0; i <= maxintr; i++){ + ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); +80102275: 81 c9 00 00 01 00 or $0x10000,%ecx + for(i = 0; i <= maxintr; i++){ +8010227b: 83 c0 01 add $0x1,%eax + ioapic->data = data; +8010227e: 89 4b 10 mov %ecx,0x10(%ebx) +80102281: 8d 4a 01 lea 0x1(%edx),%ecx +80102284: 83 c2 02 add $0x2,%edx + ioapic->reg = reg; +80102287: 89 0b mov %ecx,(%ebx) + ioapic->data = data; +80102289: 8b 0d 34 26 11 80 mov 0x80112634,%ecx + for(i = 0; i <= maxintr; i++){ +8010228f: 39 c6 cmp %eax,%esi + ioapic->data = data; +80102291: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) + for(i = 0; i <= maxintr; i++){ +80102298: 7d ce jge 80102268 + ioapicwrite(REG_TABLE+2*i+1, 0); + } +} +8010229a: 83 c4 10 add $0x10,%esp +8010229d: 5b pop %ebx +8010229e: 5e pop %esi +8010229f: 5d pop %ebp +801022a0: c3 ret +801022a1: eb 0d jmp 801022b0 +801022a3: 90 nop +801022a4: 90 nop +801022a5: 90 nop +801022a6: 90 nop +801022a7: 90 nop +801022a8: 90 nop +801022a9: 90 nop +801022aa: 90 nop +801022ab: 90 nop +801022ac: 90 nop +801022ad: 90 nop +801022ae: 90 nop +801022af: 90 nop + +801022b0 : + +void +ioapicenable(int irq, int cpunum) +{ +801022b0: 55 push %ebp +801022b1: 89 e5 mov %esp,%ebp +801022b3: 8b 55 08 mov 0x8(%ebp),%edx +801022b6: 53 push %ebx +801022b7: 8b 45 0c mov 0xc(%ebp),%eax + // Mark interrupt edge-triggered, active high, + // enabled, and routed to the given cpunum, + // which happens to be that cpu's APIC ID. + ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); +801022ba: 8d 5a 20 lea 0x20(%edx),%ebx +801022bd: 8d 4c 12 10 lea 0x10(%edx,%edx,1),%ecx + ioapic->reg = reg; +801022c1: 8b 15 34 26 11 80 mov 0x80112634,%edx + ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); +801022c7: c1 e0 18 shl $0x18,%eax + ioapic->reg = reg; +801022ca: 89 0a mov %ecx,(%edx) + ioapic->data = data; +801022cc: 8b 15 34 26 11 80 mov 0x80112634,%edx + ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); +801022d2: 83 c1 01 add $0x1,%ecx + ioapic->data = data; +801022d5: 89 5a 10 mov %ebx,0x10(%edx) + ioapic->reg = reg; +801022d8: 89 0a mov %ecx,(%edx) + ioapic->data = data; +801022da: 8b 15 34 26 11 80 mov 0x80112634,%edx +801022e0: 89 42 10 mov %eax,0x10(%edx) +} +801022e3: 5b pop %ebx +801022e4: 5d pop %ebp +801022e5: c3 ret +801022e6: 66 90 xchg %ax,%ax +801022e8: 66 90 xchg %ax,%ax +801022ea: 66 90 xchg %ax,%ax +801022ec: 66 90 xchg %ax,%ax +801022ee: 66 90 xchg %ax,%ax + +801022f0 : +// 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) +{ +801022f0: 55 push %ebp +801022f1: 89 e5 mov %esp,%ebp +801022f3: 53 push %ebx +801022f4: 83 ec 14 sub $0x14,%esp +801022f7: 8b 5d 08 mov 0x8(%ebp),%ebx + struct run *r; + + if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) +801022fa: f7 c3 ff 0f 00 00 test $0xfff,%ebx +80102300: 75 7c jne 8010237e +80102302: 81 fb a8 55 11 80 cmp $0x801155a8,%ebx +80102308: 72 74 jb 8010237e +8010230a: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +80102310: 3d ff ff ff 0d cmp $0xdffffff,%eax +80102315: 77 67 ja 8010237e + panic("kfree"); + + // Fill with junk to catch dangling refs. + memset(v, 1, PGSIZE); +80102317: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +8010231e: 00 +8010231f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) +80102326: 00 +80102327: 89 1c 24 mov %ebx,(%esp) +8010232a: e8 71 1f 00 00 call 801042a0 + + if(kmem.use_lock) +8010232f: 8b 15 74 26 11 80 mov 0x80112674,%edx +80102335: 85 d2 test %edx,%edx +80102337: 75 37 jne 80102370 + acquire(&kmem.lock); + r = (struct run*)v; + r->next = kmem.freelist; +80102339: a1 78 26 11 80 mov 0x80112678,%eax +8010233e: 89 03 mov %eax,(%ebx) + kmem.freelist = r; + if(kmem.use_lock) +80102340: a1 74 26 11 80 mov 0x80112674,%eax + kmem.freelist = r; +80102345: 89 1d 78 26 11 80 mov %ebx,0x80112678 + if(kmem.use_lock) +8010234b: 85 c0 test %eax,%eax +8010234d: 75 09 jne 80102358 + release(&kmem.lock); +} +8010234f: 83 c4 14 add $0x14,%esp +80102352: 5b pop %ebx +80102353: 5d pop %ebp +80102354: c3 ret +80102355: 8d 76 00 lea 0x0(%esi),%esi + release(&kmem.lock); +80102358: c7 45 08 40 26 11 80 movl $0x80112640,0x8(%ebp) +} +8010235f: 83 c4 14 add $0x14,%esp +80102362: 5b pop %ebx +80102363: 5d pop %ebp + release(&kmem.lock); +80102364: e9 e7 1e 00 00 jmp 80104250 +80102369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + acquire(&kmem.lock); +80102370: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) +80102377: e8 64 1e 00 00 call 801041e0 +8010237c: eb bb jmp 80102339 + panic("kfree"); +8010237e: c7 04 24 a6 6e 10 80 movl $0x80106ea6,(%esp) +80102385: e8 d6 df ff ff call 80100360 +8010238a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80102390 : +{ +80102390: 55 push %ebp +80102391: 89 e5 mov %esp,%ebp +80102393: 56 push %esi +80102394: 53 push %ebx +80102395: 83 ec 10 sub $0x10,%esp + p = (char*)PGROUNDUP((uint)vstart); +80102398: 8b 45 08 mov 0x8(%ebp),%eax +{ +8010239b: 8b 75 0c mov 0xc(%ebp),%esi + p = (char*)PGROUNDUP((uint)vstart); +8010239e: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx +801023a4: 81 e2 00 f0 ff ff and $0xfffff000,%edx + for(; p + PGSIZE <= (char*)vend; p += PGSIZE) +801023aa: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx +801023b0: 39 de cmp %ebx,%esi +801023b2: 73 08 jae 801023bc +801023b4: eb 18 jmp 801023ce +801023b6: 66 90 xchg %ax,%ax +801023b8: 89 da mov %ebx,%edx +801023ba: 89 c3 mov %eax,%ebx + kfree(p); +801023bc: 89 14 24 mov %edx,(%esp) +801023bf: e8 2c ff ff ff call 801022f0 + for(; p + PGSIZE <= (char*)vend; p += PGSIZE) +801023c4: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax +801023ca: 39 f0 cmp %esi,%eax +801023cc: 76 ea jbe 801023b8 +} +801023ce: 83 c4 10 add $0x10,%esp +801023d1: 5b pop %ebx +801023d2: 5e pop %esi +801023d3: 5d pop %ebp +801023d4: c3 ret +801023d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801023d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801023e0 : +{ +801023e0: 55 push %ebp +801023e1: 89 e5 mov %esp,%ebp +801023e3: 56 push %esi +801023e4: 53 push %ebx +801023e5: 83 ec 10 sub $0x10,%esp +801023e8: 8b 75 0c mov 0xc(%ebp),%esi + initlock(&kmem.lock, "kmem"); +801023eb: c7 44 24 04 ac 6e 10 movl $0x80106eac,0x4(%esp) +801023f2: 80 +801023f3: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) +801023fa: e8 71 1c 00 00 call 80104070 + p = (char*)PGROUNDUP((uint)vstart); +801023ff: 8b 45 08 mov 0x8(%ebp),%eax + kmem.use_lock = 0; +80102402: c7 05 74 26 11 80 00 movl $0x0,0x80112674 +80102409: 00 00 00 + p = (char*)PGROUNDUP((uint)vstart); +8010240c: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx +80102412: 81 e2 00 f0 ff ff and $0xfffff000,%edx + for(; p + PGSIZE <= (char*)vend; p += PGSIZE) +80102418: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx +8010241e: 39 de cmp %ebx,%esi +80102420: 73 0a jae 8010242c +80102422: eb 1a jmp 8010243e +80102424: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80102428: 89 da mov %ebx,%edx +8010242a: 89 c3 mov %eax,%ebx + kfree(p); +8010242c: 89 14 24 mov %edx,(%esp) +8010242f: e8 bc fe ff ff call 801022f0 + for(; p + PGSIZE <= (char*)vend; p += PGSIZE) +80102434: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax +8010243a: 39 c6 cmp %eax,%esi +8010243c: 73 ea jae 80102428 +} +8010243e: 83 c4 10 add $0x10,%esp +80102441: 5b pop %ebx +80102442: 5e pop %esi +80102443: 5d pop %ebp +80102444: c3 ret +80102445: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80102449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102450 : +{ +80102450: 55 push %ebp +80102451: 89 e5 mov %esp,%ebp +80102453: 56 push %esi +80102454: 53 push %ebx +80102455: 83 ec 10 sub $0x10,%esp + p = (char*)PGROUNDUP((uint)vstart); +80102458: 8b 45 08 mov 0x8(%ebp),%eax +{ +8010245b: 8b 75 0c mov 0xc(%ebp),%esi + p = (char*)PGROUNDUP((uint)vstart); +8010245e: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx +80102464: 81 e2 00 f0 ff ff and $0xfffff000,%edx + for(; p + PGSIZE <= (char*)vend; p += PGSIZE) +8010246a: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx +80102470: 39 de cmp %ebx,%esi +80102472: 73 08 jae 8010247c +80102474: eb 18 jmp 8010248e +80102476: 66 90 xchg %ax,%ax +80102478: 89 da mov %ebx,%edx +8010247a: 89 c3 mov %eax,%ebx + kfree(p); +8010247c: 89 14 24 mov %edx,(%esp) +8010247f: e8 6c fe ff ff call 801022f0 + for(; p + PGSIZE <= (char*)vend; p += PGSIZE) +80102484: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax +8010248a: 39 c6 cmp %eax,%esi +8010248c: 73 ea jae 80102478 + kmem.use_lock = 1; +8010248e: c7 05 74 26 11 80 01 movl $0x1,0x80112674 +80102495: 00 00 00 +} +80102498: 83 c4 10 add $0x10,%esp +8010249b: 5b pop %ebx +8010249c: 5e pop %esi +8010249d: 5d pop %ebp +8010249e: c3 ret +8010249f: 90 nop + +801024a0 : +// 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) +{ +801024a0: 55 push %ebp +801024a1: 89 e5 mov %esp,%ebp +801024a3: 53 push %ebx +801024a4: 83 ec 14 sub $0x14,%esp + struct run *r; + + if(kmem.use_lock) +801024a7: a1 74 26 11 80 mov 0x80112674,%eax +801024ac: 85 c0 test %eax,%eax +801024ae: 75 30 jne 801024e0 + acquire(&kmem.lock); + r = kmem.freelist; +801024b0: 8b 1d 78 26 11 80 mov 0x80112678,%ebx + if(r) +801024b6: 85 db test %ebx,%ebx +801024b8: 74 08 je 801024c2 + kmem.freelist = r->next; +801024ba: 8b 13 mov (%ebx),%edx +801024bc: 89 15 78 26 11 80 mov %edx,0x80112678 + if(kmem.use_lock) +801024c2: 85 c0 test %eax,%eax +801024c4: 74 0c je 801024d2 + release(&kmem.lock); +801024c6: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) +801024cd: e8 7e 1d 00 00 call 80104250 + return (char*)r; +} +801024d2: 83 c4 14 add $0x14,%esp +801024d5: 89 d8 mov %ebx,%eax +801024d7: 5b pop %ebx +801024d8: 5d pop %ebp +801024d9: c3 ret +801024da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + acquire(&kmem.lock); +801024e0: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) +801024e7: e8 f4 1c 00 00 call 801041e0 +801024ec: a1 74 26 11 80 mov 0x80112674,%eax +801024f1: eb bd jmp 801024b0 +801024f3: 66 90 xchg %ax,%ax +801024f5: 66 90 xchg %ax,%ax +801024f7: 66 90 xchg %ax,%ax +801024f9: 66 90 xchg %ax,%ax +801024fb: 66 90 xchg %ax,%ax +801024fd: 66 90 xchg %ax,%ax +801024ff: 90 nop + +80102500 : + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102500: ba 64 00 00 00 mov $0x64,%edx +80102505: ec in (%dx),%al + normalmap, shiftmap, ctlmap, ctlmap + }; + uint st, data, c; + + st = inb(KBSTATP); + if((st & KBS_DIB) == 0) +80102506: a8 01 test $0x1,%al +80102508: 0f 84 ba 00 00 00 je 801025c8 +8010250e: b2 60 mov $0x60,%dl +80102510: ec in (%dx),%al + return -1; + data = inb(KBDATAP); +80102511: 0f b6 c8 movzbl %al,%ecx + + if(data == 0xE0){ +80102514: 81 f9 e0 00 00 00 cmp $0xe0,%ecx +8010251a: 0f 84 88 00 00 00 je 801025a8 + shift |= E0ESC; + return 0; + } else if(data & 0x80){ +80102520: 84 c0 test %al,%al +80102522: 79 2c jns 80102550 + // Key released + data = (shift & E0ESC ? data : data & 0x7F); +80102524: 8b 15 b4 a5 10 80 mov 0x8010a5b4,%edx +8010252a: f6 c2 40 test $0x40,%dl +8010252d: 75 05 jne 80102534 +8010252f: 89 c1 mov %eax,%ecx +80102531: 83 e1 7f and $0x7f,%ecx + shift &= ~(shiftcode[data] | E0ESC); +80102534: 0f b6 81 e0 6f 10 80 movzbl -0x7fef9020(%ecx),%eax +8010253b: 83 c8 40 or $0x40,%eax +8010253e: 0f b6 c0 movzbl %al,%eax +80102541: f7 d0 not %eax +80102543: 21 d0 and %edx,%eax +80102545: a3 b4 a5 10 80 mov %eax,0x8010a5b4 + return 0; +8010254a: 31 c0 xor %eax,%eax +8010254c: c3 ret +8010254d: 8d 76 00 lea 0x0(%esi),%esi +{ +80102550: 55 push %ebp +80102551: 89 e5 mov %esp,%ebp +80102553: 53 push %ebx +80102554: 8b 1d b4 a5 10 80 mov 0x8010a5b4,%ebx + } else if(shift & E0ESC){ +8010255a: f6 c3 40 test $0x40,%bl +8010255d: 74 09 je 80102568 + // Last character was an E0 escape; or with 0x80 + data |= 0x80; +8010255f: 83 c8 80 or $0xffffff80,%eax + shift &= ~E0ESC; +80102562: 83 e3 bf and $0xffffffbf,%ebx + data |= 0x80; +80102565: 0f b6 c8 movzbl %al,%ecx + } + + shift |= shiftcode[data]; +80102568: 0f b6 91 e0 6f 10 80 movzbl -0x7fef9020(%ecx),%edx + shift ^= togglecode[data]; +8010256f: 0f b6 81 e0 6e 10 80 movzbl -0x7fef9120(%ecx),%eax + shift |= shiftcode[data]; +80102576: 09 da or %ebx,%edx + shift ^= togglecode[data]; +80102578: 31 c2 xor %eax,%edx + c = charcode[shift & (CTL | SHIFT)][data]; +8010257a: 89 d0 mov %edx,%eax +8010257c: 83 e0 03 and $0x3,%eax +8010257f: 8b 04 85 c0 6e 10 80 mov -0x7fef9140(,%eax,4),%eax + shift ^= togglecode[data]; +80102586: 89 15 b4 a5 10 80 mov %edx,0x8010a5b4 + if(shift & CAPSLOCK){ +8010258c: 83 e2 08 and $0x8,%edx + c = charcode[shift & (CTL | SHIFT)][data]; +8010258f: 0f b6 04 08 movzbl (%eax,%ecx,1),%eax + if(shift & CAPSLOCK){ +80102593: 74 0b je 801025a0 + if('a' <= c && c <= 'z') +80102595: 8d 50 9f lea -0x61(%eax),%edx +80102598: 83 fa 19 cmp $0x19,%edx +8010259b: 77 1b ja 801025b8 + c += 'A' - 'a'; +8010259d: 83 e8 20 sub $0x20,%eax + else if('A' <= c && c <= 'Z') + c += 'a' - 'A'; + } + return c; +} +801025a0: 5b pop %ebx +801025a1: 5d pop %ebp +801025a2: c3 ret +801025a3: 90 nop +801025a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + shift |= E0ESC; +801025a8: 83 0d b4 a5 10 80 40 orl $0x40,0x8010a5b4 + return 0; +801025af: 31 c0 xor %eax,%eax +801025b1: c3 ret +801025b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + else if('A' <= c && c <= 'Z') +801025b8: 8d 48 bf lea -0x41(%eax),%ecx + c += 'a' - 'A'; +801025bb: 8d 50 20 lea 0x20(%eax),%edx +801025be: 83 f9 19 cmp $0x19,%ecx +801025c1: 0f 46 c2 cmovbe %edx,%eax + return c; +801025c4: eb da jmp 801025a0 +801025c6: 66 90 xchg %ax,%ax + return -1; +801025c8: b8 ff ff ff ff mov $0xffffffff,%eax +801025cd: c3 ret +801025ce: 66 90 xchg %ax,%ax + +801025d0 : + +void +kbdintr(void) +{ +801025d0: 55 push %ebp +801025d1: 89 e5 mov %esp,%ebp +801025d3: 83 ec 18 sub $0x18,%esp + consoleintr(kbdgetc); +801025d6: c7 04 24 00 25 10 80 movl $0x80102500,(%esp) +801025dd: e8 ce e1 ff ff call 801007b0 +} +801025e2: c9 leave +801025e3: c3 ret +801025e4: 66 90 xchg %ax,%ax +801025e6: 66 90 xchg %ax,%ax +801025e8: 66 90 xchg %ax,%ax +801025ea: 66 90 xchg %ax,%ax +801025ec: 66 90 xchg %ax,%ax +801025ee: 66 90 xchg %ax,%ax + +801025f0 : + return inb(CMOS_RETURN); +} + +static void +fill_rtcdate(struct rtcdate *r) +{ +801025f0: 55 push %ebp +801025f1: 89 c1 mov %eax,%ecx +801025f3: 89 e5 mov %esp,%ebp + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +801025f5: ba 70 00 00 00 mov $0x70,%edx +801025fa: 53 push %ebx +801025fb: 31 c0 xor %eax,%eax +801025fd: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +801025fe: bb 71 00 00 00 mov $0x71,%ebx +80102603: 89 da mov %ebx,%edx +80102605: ec in (%dx),%al + return inb(CMOS_RETURN); +80102606: 0f b6 c0 movzbl %al,%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80102609: b2 70 mov $0x70,%dl +8010260b: 89 01 mov %eax,(%ecx) +8010260d: b8 02 00 00 00 mov $0x2,%eax +80102612: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102613: 89 da mov %ebx,%edx +80102615: ec in (%dx),%al +80102616: 0f b6 c0 movzbl %al,%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80102619: b2 70 mov $0x70,%dl +8010261b: 89 41 04 mov %eax,0x4(%ecx) +8010261e: b8 04 00 00 00 mov $0x4,%eax +80102623: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102624: 89 da mov %ebx,%edx +80102626: ec in (%dx),%al +80102627: 0f b6 c0 movzbl %al,%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +8010262a: b2 70 mov $0x70,%dl +8010262c: 89 41 08 mov %eax,0x8(%ecx) +8010262f: b8 07 00 00 00 mov $0x7,%eax +80102634: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102635: 89 da mov %ebx,%edx +80102637: ec in (%dx),%al +80102638: 0f b6 c0 movzbl %al,%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +8010263b: b2 70 mov $0x70,%dl +8010263d: 89 41 0c mov %eax,0xc(%ecx) +80102640: b8 08 00 00 00 mov $0x8,%eax +80102645: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102646: 89 da mov %ebx,%edx +80102648: ec in (%dx),%al +80102649: 0f b6 c0 movzbl %al,%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +8010264c: b2 70 mov $0x70,%dl +8010264e: 89 41 10 mov %eax,0x10(%ecx) +80102651: b8 09 00 00 00 mov $0x9,%eax +80102656: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102657: 89 da mov %ebx,%edx +80102659: ec in (%dx),%al +8010265a: 0f b6 d8 movzbl %al,%ebx +8010265d: 89 59 14 mov %ebx,0x14(%ecx) + r->minute = cmos_read(MINS); + r->hour = cmos_read(HOURS); + r->day = cmos_read(DAY); + r->month = cmos_read(MONTH); + r->year = cmos_read(YEAR); +} +80102660: 5b pop %ebx +80102661: 5d pop %ebp +80102662: c3 ret +80102663: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80102669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102670 : + if(!lapic) +80102670: a1 7c 26 11 80 mov 0x8011267c,%eax +{ +80102675: 55 push %ebp +80102676: 89 e5 mov %esp,%ebp + if(!lapic) +80102678: 85 c0 test %eax,%eax +8010267a: 0f 84 c0 00 00 00 je 80102740 + lapic[index] = value; +80102680: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax) +80102687: 01 00 00 + lapic[ID]; // wait for write to finish, by reading +8010268a: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +8010268d: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax) +80102694: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +80102697: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +8010269a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax) +801026a1: 00 02 00 + lapic[ID]; // wait for write to finish, by reading +801026a4: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +801026a7: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax) +801026ae: 96 98 00 + lapic[ID]; // wait for write to finish, by reading +801026b1: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +801026b4: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax) +801026bb: 00 01 00 + lapic[ID]; // wait for write to finish, by reading +801026be: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +801026c1: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax) +801026c8: 00 01 00 + lapic[ID]; // wait for write to finish, by reading +801026cb: 8b 50 20 mov 0x20(%eax),%edx + if(((lapic[VER]>>16) & 0xFF) >= 4) +801026ce: 8b 50 30 mov 0x30(%eax),%edx +801026d1: c1 ea 10 shr $0x10,%edx +801026d4: 80 fa 03 cmp $0x3,%dl +801026d7: 77 6f ja 80102748 + lapic[index] = value; +801026d9: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax) +801026e0: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +801026e3: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +801026e6: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) +801026ed: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +801026f0: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +801026f3: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) +801026fa: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +801026fd: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +80102700: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) +80102707: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +8010270a: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +8010270d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax) +80102714: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +80102717: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +8010271a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax) +80102721: 85 08 00 + lapic[ID]; // wait for write to finish, by reading +80102724: 8b 50 20 mov 0x20(%eax),%edx +80102727: 90 nop + while(lapic[ICRLO] & DELIVS) +80102728: 8b 90 00 03 00 00 mov 0x300(%eax),%edx +8010272e: 80 e6 10 and $0x10,%dh +80102731: 75 f5 jne 80102728 + lapic[index] = value; +80102733: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) +8010273a: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +8010273d: 8b 40 20 mov 0x20(%eax),%eax +} +80102740: 5d pop %ebp +80102741: c3 ret +80102742: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + lapic[index] = value; +80102748: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax) +8010274f: 00 01 00 + lapic[ID]; // wait for write to finish, by reading +80102752: 8b 50 20 mov 0x20(%eax),%edx +80102755: eb 82 jmp 801026d9 +80102757: 89 f6 mov %esi,%esi +80102759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102760 : + if (!lapic) +80102760: a1 7c 26 11 80 mov 0x8011267c,%eax +{ +80102765: 55 push %ebp +80102766: 89 e5 mov %esp,%ebp + if (!lapic) +80102768: 85 c0 test %eax,%eax +8010276a: 74 0c je 80102778 + return lapic[ID] >> 24; +8010276c: 8b 40 20 mov 0x20(%eax),%eax +} +8010276f: 5d pop %ebp + return lapic[ID] >> 24; +80102770: c1 e8 18 shr $0x18,%eax +} +80102773: c3 ret +80102774: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +80102778: 31 c0 xor %eax,%eax +} +8010277a: 5d pop %ebp +8010277b: c3 ret +8010277c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80102780 : + if(lapic) +80102780: a1 7c 26 11 80 mov 0x8011267c,%eax +{ +80102785: 55 push %ebp +80102786: 89 e5 mov %esp,%ebp + if(lapic) +80102788: 85 c0 test %eax,%eax +8010278a: 74 0d je 80102799 + lapic[index] = value; +8010278c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) +80102793: 00 00 00 + lapic[ID]; // wait for write to finish, by reading +80102796: 8b 40 20 mov 0x20(%eax),%eax +} +80102799: 5d pop %ebp +8010279a: c3 ret +8010279b: 90 nop +8010279c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +801027a0 : +{ +801027a0: 55 push %ebp +801027a1: 89 e5 mov %esp,%ebp +} +801027a3: 5d pop %ebp +801027a4: c3 ret +801027a5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801027a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801027b0 : +{ +801027b0: 55 push %ebp + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +801027b1: ba 70 00 00 00 mov $0x70,%edx +801027b6: 89 e5 mov %esp,%ebp +801027b8: b8 0f 00 00 00 mov $0xf,%eax +801027bd: 53 push %ebx +801027be: 8b 4d 08 mov 0x8(%ebp),%ecx +801027c1: 8b 5d 0c mov 0xc(%ebp),%ebx +801027c4: ee out %al,(%dx) +801027c5: b8 0a 00 00 00 mov $0xa,%eax +801027ca: b2 71 mov $0x71,%dl +801027cc: ee out %al,(%dx) + wrv[0] = 0; +801027cd: 31 c0 xor %eax,%eax +801027cf: 66 a3 67 04 00 80 mov %ax,0x80000467 + wrv[1] = addr >> 4; +801027d5: 89 d8 mov %ebx,%eax +801027d7: c1 e8 04 shr $0x4,%eax +801027da: 66 a3 69 04 00 80 mov %ax,0x80000469 + lapic[index] = value; +801027e0: a1 7c 26 11 80 mov 0x8011267c,%eax + lapicw(ICRHI, apicid<<24); +801027e5: c1 e1 18 shl $0x18,%ecx + lapicw(ICRLO, STARTUP | (addr>>12)); +801027e8: c1 eb 0c shr $0xc,%ebx + lapic[index] = value; +801027eb: 89 88 10 03 00 00 mov %ecx,0x310(%eax) + lapic[ID]; // wait for write to finish, by reading +801027f1: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +801027f4: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax) +801027fb: c5 00 00 + lapic[ID]; // wait for write to finish, by reading +801027fe: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +80102801: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax) +80102808: 85 00 00 + lapic[ID]; // wait for write to finish, by reading +8010280b: 8b 50 20 mov 0x20(%eax),%edx + lapic[index] = value; +8010280e: 89 88 10 03 00 00 mov %ecx,0x310(%eax) + lapic[ID]; // wait for write to finish, by reading +80102814: 8b 50 20 mov 0x20(%eax),%edx + lapicw(ICRLO, STARTUP | (addr>>12)); +80102817: 89 da mov %ebx,%edx +80102819: 80 ce 06 or $0x6,%dh + lapic[index] = value; +8010281c: 89 90 00 03 00 00 mov %edx,0x300(%eax) + lapic[ID]; // wait for write to finish, by reading +80102822: 8b 58 20 mov 0x20(%eax),%ebx + lapic[index] = value; +80102825: 89 88 10 03 00 00 mov %ecx,0x310(%eax) + lapic[ID]; // wait for write to finish, by reading +8010282b: 8b 48 20 mov 0x20(%eax),%ecx + lapic[index] = value; +8010282e: 89 90 00 03 00 00 mov %edx,0x300(%eax) + lapic[ID]; // wait for write to finish, by reading +80102834: 8b 40 20 mov 0x20(%eax),%eax +} +80102837: 5b pop %ebx +80102838: 5d pop %ebp +80102839: c3 ret +8010283a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80102840 : + +// qemu seems to use 24-hour GWT and the values are BCD encoded +void +cmostime(struct rtcdate *r) +{ +80102840: 55 push %ebp +80102841: ba 70 00 00 00 mov $0x70,%edx +80102846: 89 e5 mov %esp,%ebp +80102848: b8 0b 00 00 00 mov $0xb,%eax +8010284d: 57 push %edi +8010284e: 56 push %esi +8010284f: 53 push %ebx +80102850: 83 ec 4c sub $0x4c,%esp +80102853: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80102854: b2 71 mov $0x71,%dl +80102856: ec in (%dx),%al +80102857: 88 45 b7 mov %al,-0x49(%ebp) +8010285a: 8d 5d b8 lea -0x48(%ebp),%ebx + struct rtcdate t1, t2; + int sb, bcd; + + sb = cmos_read(CMOS_STATB); + + bcd = (sb & (1 << 2)) == 0; +8010285d: 80 65 b7 04 andb $0x4,-0x49(%ebp) +80102861: 8d 7d d0 lea -0x30(%ebp),%edi +80102864: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +80102868: be 70 00 00 00 mov $0x70,%esi + + // make sure CMOS doesn't modify time while we read it + for(;;) { + fill_rtcdate(&t1); +8010286d: 89 d8 mov %ebx,%eax +8010286f: e8 7c fd ff ff call 801025f0 +80102874: b8 0a 00 00 00 mov $0xa,%eax +80102879: 89 f2 mov %esi,%edx +8010287b: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +8010287c: ba 71 00 00 00 mov $0x71,%edx +80102881: ec in (%dx),%al + if(cmos_read(CMOS_STATA) & CMOS_UIP) +80102882: 84 c0 test %al,%al +80102884: 78 e7 js 8010286d + continue; + fill_rtcdate(&t2); +80102886: 89 f8 mov %edi,%eax +80102888: e8 63 fd ff ff call 801025f0 + if(memcmp(&t1, &t2, sizeof(t1)) == 0) +8010288d: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) +80102894: 00 +80102895: 89 7c 24 04 mov %edi,0x4(%esp) +80102899: 89 1c 24 mov %ebx,(%esp) +8010289c: e8 4f 1a 00 00 call 801042f0 +801028a1: 85 c0 test %eax,%eax +801028a3: 75 c3 jne 80102868 + break; + } + + // convert + if(bcd) { +801028a5: 80 7d b7 00 cmpb $0x0,-0x49(%ebp) +801028a9: 75 78 jne 80102923 +#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) + CONV(second); +801028ab: 8b 45 b8 mov -0x48(%ebp),%eax +801028ae: 89 c2 mov %eax,%edx +801028b0: 83 e0 0f and $0xf,%eax +801028b3: c1 ea 04 shr $0x4,%edx +801028b6: 8d 14 92 lea (%edx,%edx,4),%edx +801028b9: 8d 04 50 lea (%eax,%edx,2),%eax +801028bc: 89 45 b8 mov %eax,-0x48(%ebp) + CONV(minute); +801028bf: 8b 45 bc mov -0x44(%ebp),%eax +801028c2: 89 c2 mov %eax,%edx +801028c4: 83 e0 0f and $0xf,%eax +801028c7: c1 ea 04 shr $0x4,%edx +801028ca: 8d 14 92 lea (%edx,%edx,4),%edx +801028cd: 8d 04 50 lea (%eax,%edx,2),%eax +801028d0: 89 45 bc mov %eax,-0x44(%ebp) + CONV(hour ); +801028d3: 8b 45 c0 mov -0x40(%ebp),%eax +801028d6: 89 c2 mov %eax,%edx +801028d8: 83 e0 0f and $0xf,%eax +801028db: c1 ea 04 shr $0x4,%edx +801028de: 8d 14 92 lea (%edx,%edx,4),%edx +801028e1: 8d 04 50 lea (%eax,%edx,2),%eax +801028e4: 89 45 c0 mov %eax,-0x40(%ebp) + CONV(day ); +801028e7: 8b 45 c4 mov -0x3c(%ebp),%eax +801028ea: 89 c2 mov %eax,%edx +801028ec: 83 e0 0f and $0xf,%eax +801028ef: c1 ea 04 shr $0x4,%edx +801028f2: 8d 14 92 lea (%edx,%edx,4),%edx +801028f5: 8d 04 50 lea (%eax,%edx,2),%eax +801028f8: 89 45 c4 mov %eax,-0x3c(%ebp) + CONV(month ); +801028fb: 8b 45 c8 mov -0x38(%ebp),%eax +801028fe: 89 c2 mov %eax,%edx +80102900: 83 e0 0f and $0xf,%eax +80102903: c1 ea 04 shr $0x4,%edx +80102906: 8d 14 92 lea (%edx,%edx,4),%edx +80102909: 8d 04 50 lea (%eax,%edx,2),%eax +8010290c: 89 45 c8 mov %eax,-0x38(%ebp) + CONV(year ); +8010290f: 8b 45 cc mov -0x34(%ebp),%eax +80102912: 89 c2 mov %eax,%edx +80102914: 83 e0 0f and $0xf,%eax +80102917: c1 ea 04 shr $0x4,%edx +8010291a: 8d 14 92 lea (%edx,%edx,4),%edx +8010291d: 8d 04 50 lea (%eax,%edx,2),%eax +80102920: 89 45 cc mov %eax,-0x34(%ebp) +#undef CONV + } + + *r = t1; +80102923: 8b 4d 08 mov 0x8(%ebp),%ecx +80102926: 8b 45 b8 mov -0x48(%ebp),%eax +80102929: 89 01 mov %eax,(%ecx) +8010292b: 8b 45 bc mov -0x44(%ebp),%eax +8010292e: 89 41 04 mov %eax,0x4(%ecx) +80102931: 8b 45 c0 mov -0x40(%ebp),%eax +80102934: 89 41 08 mov %eax,0x8(%ecx) +80102937: 8b 45 c4 mov -0x3c(%ebp),%eax +8010293a: 89 41 0c mov %eax,0xc(%ecx) +8010293d: 8b 45 c8 mov -0x38(%ebp),%eax +80102940: 89 41 10 mov %eax,0x10(%ecx) +80102943: 8b 45 cc mov -0x34(%ebp),%eax +80102946: 89 41 14 mov %eax,0x14(%ecx) + r->year += 2000; +80102949: 81 41 14 d0 07 00 00 addl $0x7d0,0x14(%ecx) +} +80102950: 83 c4 4c add $0x4c,%esp +80102953: 5b pop %ebx +80102954: 5e pop %esi +80102955: 5f pop %edi +80102956: 5d pop %ebp +80102957: c3 ret +80102958: 66 90 xchg %ax,%ax +8010295a: 66 90 xchg %ax,%ax +8010295c: 66 90 xchg %ax,%ax +8010295e: 66 90 xchg %ax,%ax + +80102960 : +} + +// Copy committed blocks from log to their home location +static void +install_trans(void) +{ +80102960: 55 push %ebp +80102961: 89 e5 mov %esp,%ebp +80102963: 57 push %edi +80102964: 56 push %esi +80102965: 53 push %ebx + int tail; + + for (tail = 0; tail < log.lh.n; tail++) { +80102966: 31 db xor %ebx,%ebx +{ +80102968: 83 ec 1c sub $0x1c,%esp + for (tail = 0; tail < log.lh.n; tail++) { +8010296b: a1 c8 26 11 80 mov 0x801126c8,%eax +80102970: 85 c0 test %eax,%eax +80102972: 7e 78 jle 801029ec +80102974: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block +80102978: a1 b4 26 11 80 mov 0x801126b4,%eax +8010297d: 01 d8 add %ebx,%eax +8010297f: 83 c0 01 add $0x1,%eax +80102982: 89 44 24 04 mov %eax,0x4(%esp) +80102986: a1 c4 26 11 80 mov 0x801126c4,%eax +8010298b: 89 04 24 mov %eax,(%esp) +8010298e: e8 3d d7 ff ff call 801000d0 +80102993: 89 c7 mov %eax,%edi + struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst +80102995: 8b 04 9d cc 26 11 80 mov -0x7feed934(,%ebx,4),%eax + for (tail = 0; tail < log.lh.n; tail++) { +8010299c: 83 c3 01 add $0x1,%ebx + struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst +8010299f: 89 44 24 04 mov %eax,0x4(%esp) +801029a3: a1 c4 26 11 80 mov 0x801126c4,%eax +801029a8: 89 04 24 mov %eax,(%esp) +801029ab: e8 20 d7 ff ff call 801000d0 + memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst +801029b0: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +801029b7: 00 + struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst +801029b8: 89 c6 mov %eax,%esi + memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst +801029ba: 8d 47 5c lea 0x5c(%edi),%eax +801029bd: 89 44 24 04 mov %eax,0x4(%esp) +801029c1: 8d 46 5c lea 0x5c(%esi),%eax +801029c4: 89 04 24 mov %eax,(%esp) +801029c7: e8 74 19 00 00 call 80104340 + bwrite(dbuf); // write dst to disk +801029cc: 89 34 24 mov %esi,(%esp) +801029cf: e8 cc d7 ff ff call 801001a0 + brelse(lbuf); +801029d4: 89 3c 24 mov %edi,(%esp) +801029d7: e8 04 d8 ff ff call 801001e0 + brelse(dbuf); +801029dc: 89 34 24 mov %esi,(%esp) +801029df: e8 fc d7 ff ff call 801001e0 + for (tail = 0; tail < log.lh.n; tail++) { +801029e4: 39 1d c8 26 11 80 cmp %ebx,0x801126c8 +801029ea: 7f 8c jg 80102978 + } +} +801029ec: 83 c4 1c add $0x1c,%esp +801029ef: 5b pop %ebx +801029f0: 5e pop %esi +801029f1: 5f pop %edi +801029f2: 5d pop %ebp +801029f3: c3 ret +801029f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801029fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +80102a00 : +// Write in-memory log header to disk. +// This is the true point at which the +// current transaction commits. +static void +write_head(void) +{ +80102a00: 55 push %ebp +80102a01: 89 e5 mov %esp,%ebp +80102a03: 57 push %edi +80102a04: 56 push %esi +80102a05: 53 push %ebx +80102a06: 83 ec 1c sub $0x1c,%esp + struct buf *buf = bread(log.dev, log.start); +80102a09: a1 b4 26 11 80 mov 0x801126b4,%eax +80102a0e: 89 44 24 04 mov %eax,0x4(%esp) +80102a12: a1 c4 26 11 80 mov 0x801126c4,%eax +80102a17: 89 04 24 mov %eax,(%esp) +80102a1a: e8 b1 d6 ff ff call 801000d0 + struct logheader *hb = (struct logheader *) (buf->data); + int i; + hb->n = log.lh.n; +80102a1f: 8b 1d c8 26 11 80 mov 0x801126c8,%ebx + for (i = 0; i < log.lh.n; i++) { +80102a25: 31 d2 xor %edx,%edx +80102a27: 85 db test %ebx,%ebx + struct buf *buf = bread(log.dev, log.start); +80102a29: 89 c7 mov %eax,%edi + hb->n = log.lh.n; +80102a2b: 89 58 5c mov %ebx,0x5c(%eax) +80102a2e: 8d 70 5c lea 0x5c(%eax),%esi + for (i = 0; i < log.lh.n; i++) { +80102a31: 7e 17 jle 80102a4a +80102a33: 90 nop +80102a34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + hb->block[i] = log.lh.block[i]; +80102a38: 8b 0c 95 cc 26 11 80 mov -0x7feed934(,%edx,4),%ecx +80102a3f: 89 4c 96 04 mov %ecx,0x4(%esi,%edx,4) + for (i = 0; i < log.lh.n; i++) { +80102a43: 83 c2 01 add $0x1,%edx +80102a46: 39 da cmp %ebx,%edx +80102a48: 75 ee jne 80102a38 + } + bwrite(buf); +80102a4a: 89 3c 24 mov %edi,(%esp) +80102a4d: e8 4e d7 ff ff call 801001a0 + brelse(buf); +80102a52: 89 3c 24 mov %edi,(%esp) +80102a55: e8 86 d7 ff ff call 801001e0 +} +80102a5a: 83 c4 1c add $0x1c,%esp +80102a5d: 5b pop %ebx +80102a5e: 5e pop %esi +80102a5f: 5f pop %edi +80102a60: 5d pop %ebp +80102a61: c3 ret +80102a62: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80102a69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102a70 : +{ +80102a70: 55 push %ebp +80102a71: 89 e5 mov %esp,%ebp +80102a73: 56 push %esi +80102a74: 53 push %ebx +80102a75: 83 ec 30 sub $0x30,%esp +80102a78: 8b 5d 08 mov 0x8(%ebp),%ebx + initlock(&log.lock, "log"); +80102a7b: c7 44 24 04 e0 70 10 movl $0x801070e0,0x4(%esp) +80102a82: 80 +80102a83: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102a8a: e8 e1 15 00 00 call 80104070 + readsb(dev, &sb); +80102a8f: 8d 45 dc lea -0x24(%ebp),%eax +80102a92: 89 44 24 04 mov %eax,0x4(%esp) +80102a96: 89 1c 24 mov %ebx,(%esp) +80102a99: e8 82 e9 ff ff call 80101420 + log.start = sb.logstart; +80102a9e: 8b 45 ec mov -0x14(%ebp),%eax + log.size = sb.nlog; +80102aa1: 8b 55 e8 mov -0x18(%ebp),%edx + struct buf *buf = bread(log.dev, log.start); +80102aa4: 89 1c 24 mov %ebx,(%esp) + log.dev = dev; +80102aa7: 89 1d c4 26 11 80 mov %ebx,0x801126c4 + struct buf *buf = bread(log.dev, log.start); +80102aad: 89 44 24 04 mov %eax,0x4(%esp) + log.size = sb.nlog; +80102ab1: 89 15 b8 26 11 80 mov %edx,0x801126b8 + log.start = sb.logstart; +80102ab7: a3 b4 26 11 80 mov %eax,0x801126b4 + struct buf *buf = bread(log.dev, log.start); +80102abc: e8 0f d6 ff ff call 801000d0 + for (i = 0; i < log.lh.n; i++) { +80102ac1: 31 d2 xor %edx,%edx + log.lh.n = lh->n; +80102ac3: 8b 58 5c mov 0x5c(%eax),%ebx +80102ac6: 8d 70 5c lea 0x5c(%eax),%esi + for (i = 0; i < log.lh.n; i++) { +80102ac9: 85 db test %ebx,%ebx + log.lh.n = lh->n; +80102acb: 89 1d c8 26 11 80 mov %ebx,0x801126c8 + for (i = 0; i < log.lh.n; i++) { +80102ad1: 7e 17 jle 80102aea +80102ad3: 90 nop +80102ad4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + log.lh.block[i] = lh->block[i]; +80102ad8: 8b 4c 96 04 mov 0x4(%esi,%edx,4),%ecx +80102adc: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4) + for (i = 0; i < log.lh.n; i++) { +80102ae3: 83 c2 01 add $0x1,%edx +80102ae6: 39 da cmp %ebx,%edx +80102ae8: 75 ee jne 80102ad8 + brelse(buf); +80102aea: 89 04 24 mov %eax,(%esp) +80102aed: e8 ee d6 ff ff call 801001e0 + +static void +recover_from_log(void) +{ + read_head(); + install_trans(); // if committed, copy from log to disk +80102af2: e8 69 fe ff ff call 80102960 + log.lh.n = 0; +80102af7: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8 +80102afe: 00 00 00 + write_head(); // clear the log +80102b01: e8 fa fe ff ff call 80102a00 +} +80102b06: 83 c4 30 add $0x30,%esp +80102b09: 5b pop %ebx +80102b0a: 5e pop %esi +80102b0b: 5d pop %ebp +80102b0c: c3 ret +80102b0d: 8d 76 00 lea 0x0(%esi),%esi + +80102b10 : +} + +// called at the start of each FS system call. +void +begin_op(void) +{ +80102b10: 55 push %ebp +80102b11: 89 e5 mov %esp,%ebp +80102b13: 83 ec 18 sub $0x18,%esp + acquire(&log.lock); +80102b16: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102b1d: e8 be 16 00 00 call 801041e0 +80102b22: eb 18 jmp 80102b3c +80102b24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while(1){ + if(log.committing){ + sleep(&log, &log.lock); +80102b28: c7 44 24 04 80 26 11 movl $0x80112680,0x4(%esp) +80102b2f: 80 +80102b30: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102b37: e8 c4 10 00 00 call 80103c00 + if(log.committing){ +80102b3c: a1 c0 26 11 80 mov 0x801126c0,%eax +80102b41: 85 c0 test %eax,%eax +80102b43: 75 e3 jne 80102b28 + } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ +80102b45: a1 bc 26 11 80 mov 0x801126bc,%eax +80102b4a: 8b 15 c8 26 11 80 mov 0x801126c8,%edx +80102b50: 83 c0 01 add $0x1,%eax +80102b53: 8d 0c 80 lea (%eax,%eax,4),%ecx +80102b56: 8d 14 4a lea (%edx,%ecx,2),%edx +80102b59: 83 fa 1e cmp $0x1e,%edx +80102b5c: 7f ca jg 80102b28 + // this op might exhaust log space; wait for commit. + sleep(&log, &log.lock); + } else { + log.outstanding += 1; + release(&log.lock); +80102b5e: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) + log.outstanding += 1; +80102b65: a3 bc 26 11 80 mov %eax,0x801126bc + release(&log.lock); +80102b6a: e8 e1 16 00 00 call 80104250 + break; + } + } +} +80102b6f: c9 leave +80102b70: c3 ret +80102b71: eb 0d jmp 80102b80 +80102b73: 90 nop +80102b74: 90 nop +80102b75: 90 nop +80102b76: 90 nop +80102b77: 90 nop +80102b78: 90 nop +80102b79: 90 nop +80102b7a: 90 nop +80102b7b: 90 nop +80102b7c: 90 nop +80102b7d: 90 nop +80102b7e: 90 nop +80102b7f: 90 nop + +80102b80 : + +// called at the end of each FS system call. +// commits if this was the last outstanding operation. +void +end_op(void) +{ +80102b80: 55 push %ebp +80102b81: 89 e5 mov %esp,%ebp +80102b83: 57 push %edi +80102b84: 56 push %esi +80102b85: 53 push %ebx +80102b86: 83 ec 1c sub $0x1c,%esp + int do_commit = 0; + + acquire(&log.lock); +80102b89: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102b90: e8 4b 16 00 00 call 801041e0 + log.outstanding -= 1; +80102b95: a1 bc 26 11 80 mov 0x801126bc,%eax + if(log.committing) +80102b9a: 8b 15 c0 26 11 80 mov 0x801126c0,%edx + log.outstanding -= 1; +80102ba0: 83 e8 01 sub $0x1,%eax + if(log.committing) +80102ba3: 85 d2 test %edx,%edx + log.outstanding -= 1; +80102ba5: a3 bc 26 11 80 mov %eax,0x801126bc + if(log.committing) +80102baa: 0f 85 f3 00 00 00 jne 80102ca3 + panic("log.committing"); + if(log.outstanding == 0){ +80102bb0: 85 c0 test %eax,%eax +80102bb2: 0f 85 cb 00 00 00 jne 80102c83 + // begin_op() may be waiting for log space, + // and decrementing log.outstanding has decreased + // the amount of reserved space. + wakeup(&log); + } + release(&log.lock); +80102bb8: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +} + +static void +commit() +{ + if (log.lh.n > 0) { +80102bbf: 31 db xor %ebx,%ebx + log.committing = 1; +80102bc1: c7 05 c0 26 11 80 01 movl $0x1,0x801126c0 +80102bc8: 00 00 00 + release(&log.lock); +80102bcb: e8 80 16 00 00 call 80104250 + if (log.lh.n > 0) { +80102bd0: a1 c8 26 11 80 mov 0x801126c8,%eax +80102bd5: 85 c0 test %eax,%eax +80102bd7: 0f 8e 90 00 00 00 jle 80102c6d +80102bdd: 8d 76 00 lea 0x0(%esi),%esi + struct buf *to = bread(log.dev, log.start+tail+1); // log block +80102be0: a1 b4 26 11 80 mov 0x801126b4,%eax +80102be5: 01 d8 add %ebx,%eax +80102be7: 83 c0 01 add $0x1,%eax +80102bea: 89 44 24 04 mov %eax,0x4(%esp) +80102bee: a1 c4 26 11 80 mov 0x801126c4,%eax +80102bf3: 89 04 24 mov %eax,(%esp) +80102bf6: e8 d5 d4 ff ff call 801000d0 +80102bfb: 89 c6 mov %eax,%esi + struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block +80102bfd: 8b 04 9d cc 26 11 80 mov -0x7feed934(,%ebx,4),%eax + for (tail = 0; tail < log.lh.n; tail++) { +80102c04: 83 c3 01 add $0x1,%ebx + struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block +80102c07: 89 44 24 04 mov %eax,0x4(%esp) +80102c0b: a1 c4 26 11 80 mov 0x801126c4,%eax +80102c10: 89 04 24 mov %eax,(%esp) +80102c13: e8 b8 d4 ff ff call 801000d0 + memmove(to->data, from->data, BSIZE); +80102c18: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +80102c1f: 00 + struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block +80102c20: 89 c7 mov %eax,%edi + memmove(to->data, from->data, BSIZE); +80102c22: 8d 40 5c lea 0x5c(%eax),%eax +80102c25: 89 44 24 04 mov %eax,0x4(%esp) +80102c29: 8d 46 5c lea 0x5c(%esi),%eax +80102c2c: 89 04 24 mov %eax,(%esp) +80102c2f: e8 0c 17 00 00 call 80104340 + bwrite(to); // write the log +80102c34: 89 34 24 mov %esi,(%esp) +80102c37: e8 64 d5 ff ff call 801001a0 + brelse(from); +80102c3c: 89 3c 24 mov %edi,(%esp) +80102c3f: e8 9c d5 ff ff call 801001e0 + brelse(to); +80102c44: 89 34 24 mov %esi,(%esp) +80102c47: e8 94 d5 ff ff call 801001e0 + for (tail = 0; tail < log.lh.n; tail++) { +80102c4c: 3b 1d c8 26 11 80 cmp 0x801126c8,%ebx +80102c52: 7c 8c jl 80102be0 + write_log(); // Write modified blocks from cache to log + write_head(); // Write header to disk -- the real commit +80102c54: e8 a7 fd ff ff call 80102a00 + install_trans(); // Now install writes to home locations +80102c59: e8 02 fd ff ff call 80102960 + log.lh.n = 0; +80102c5e: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8 +80102c65: 00 00 00 + write_head(); // Erase the transaction from the log +80102c68: e8 93 fd ff ff call 80102a00 + acquire(&log.lock); +80102c6d: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102c74: e8 67 15 00 00 call 801041e0 + log.committing = 0; +80102c79: c7 05 c0 26 11 80 00 movl $0x0,0x801126c0 +80102c80: 00 00 00 + wakeup(&log); +80102c83: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102c8a: e8 01 11 00 00 call 80103d90 + release(&log.lock); +80102c8f: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102c96: e8 b5 15 00 00 call 80104250 +} +80102c9b: 83 c4 1c add $0x1c,%esp +80102c9e: 5b pop %ebx +80102c9f: 5e pop %esi +80102ca0: 5f pop %edi +80102ca1: 5d pop %ebp +80102ca2: c3 ret + panic("log.committing"); +80102ca3: c7 04 24 e4 70 10 80 movl $0x801070e4,(%esp) +80102caa: e8 b1 d6 ff ff call 80100360 +80102caf: 90 nop + +80102cb0 : +// modify bp->data[] +// log_write(bp) +// brelse(bp) +void +log_write(struct buf *b) +{ +80102cb0: 55 push %ebp +80102cb1: 89 e5 mov %esp,%ebp +80102cb3: 53 push %ebx +80102cb4: 83 ec 14 sub $0x14,%esp + int i; + + if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) +80102cb7: a1 c8 26 11 80 mov 0x801126c8,%eax +{ +80102cbc: 8b 5d 08 mov 0x8(%ebp),%ebx + if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) +80102cbf: 83 f8 1d cmp $0x1d,%eax +80102cc2: 0f 8f 98 00 00 00 jg 80102d60 +80102cc8: 8b 0d b8 26 11 80 mov 0x801126b8,%ecx +80102cce: 8d 51 ff lea -0x1(%ecx),%edx +80102cd1: 39 d0 cmp %edx,%eax +80102cd3: 0f 8d 87 00 00 00 jge 80102d60 + panic("too big a transaction"); + if (log.outstanding < 1) +80102cd9: a1 bc 26 11 80 mov 0x801126bc,%eax +80102cde: 85 c0 test %eax,%eax +80102ce0: 0f 8e 86 00 00 00 jle 80102d6c + panic("log_write outside of trans"); + + acquire(&log.lock); +80102ce6: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) +80102ced: e8 ee 14 00 00 call 801041e0 + for (i = 0; i < log.lh.n; i++) { +80102cf2: 8b 15 c8 26 11 80 mov 0x801126c8,%edx +80102cf8: 83 fa 00 cmp $0x0,%edx +80102cfb: 7e 54 jle 80102d51 + if (log.lh.block[i] == b->blockno) // log absorbtion +80102cfd: 8b 4b 08 mov 0x8(%ebx),%ecx + for (i = 0; i < log.lh.n; i++) { +80102d00: 31 c0 xor %eax,%eax + if (log.lh.block[i] == b->blockno) // log absorbtion +80102d02: 39 0d cc 26 11 80 cmp %ecx,0x801126cc +80102d08: 75 0f jne 80102d19 +80102d0a: eb 3c jmp 80102d48 +80102d0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80102d10: 39 0c 85 cc 26 11 80 cmp %ecx,-0x7feed934(,%eax,4) +80102d17: 74 2f je 80102d48 + for (i = 0; i < log.lh.n; i++) { +80102d19: 83 c0 01 add $0x1,%eax +80102d1c: 39 d0 cmp %edx,%eax +80102d1e: 75 f0 jne 80102d10 + break; + } + log.lh.block[i] = b->blockno; +80102d20: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4) + if (i == log.lh.n) + log.lh.n++; +80102d27: 83 c2 01 add $0x1,%edx +80102d2a: 89 15 c8 26 11 80 mov %edx,0x801126c8 + b->flags |= B_DIRTY; // prevent eviction +80102d30: 83 0b 04 orl $0x4,(%ebx) + release(&log.lock); +80102d33: c7 45 08 80 26 11 80 movl $0x80112680,0x8(%ebp) +} +80102d3a: 83 c4 14 add $0x14,%esp +80102d3d: 5b pop %ebx +80102d3e: 5d pop %ebp + release(&log.lock); +80102d3f: e9 0c 15 00 00 jmp 80104250 +80102d44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + log.lh.block[i] = b->blockno; +80102d48: 89 0c 85 cc 26 11 80 mov %ecx,-0x7feed934(,%eax,4) +80102d4f: eb df jmp 80102d30 +80102d51: 8b 43 08 mov 0x8(%ebx),%eax +80102d54: a3 cc 26 11 80 mov %eax,0x801126cc + if (i == log.lh.n) +80102d59: 75 d5 jne 80102d30 +80102d5b: eb ca jmp 80102d27 +80102d5d: 8d 76 00 lea 0x0(%esi),%esi + panic("too big a transaction"); +80102d60: c7 04 24 f3 70 10 80 movl $0x801070f3,(%esp) +80102d67: e8 f4 d5 ff ff call 80100360 + panic("log_write outside of trans"); +80102d6c: c7 04 24 09 71 10 80 movl $0x80107109,(%esp) +80102d73: e8 e8 d5 ff ff call 80100360 +80102d78: 66 90 xchg %ax,%ax +80102d7a: 66 90 xchg %ax,%ax +80102d7c: 66 90 xchg %ax,%ax +80102d7e: 66 90 xchg %ax,%ax + +80102d80 : +} + +// Common CPU setup code. +static void +mpmain(void) +{ +80102d80: 55 push %ebp +80102d81: 89 e5 mov %esp,%ebp +80102d83: 53 push %ebx +80102d84: 83 ec 14 sub $0x14,%esp + cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); +80102d87: e8 f4 08 00 00 call 80103680 +80102d8c: 89 c3 mov %eax,%ebx +80102d8e: e8 ed 08 00 00 call 80103680 +80102d93: 89 5c 24 08 mov %ebx,0x8(%esp) +80102d97: c7 04 24 24 71 10 80 movl $0x80107124,(%esp) +80102d9e: 89 44 24 04 mov %eax,0x4(%esp) +80102da2: e8 a9 d8 ff ff call 80100650 + idtinit(); // load idt register +80102da7: e8 24 27 00 00 call 801054d0 + xchg(&(mycpu()->started), 1); // tell startothers() we're up +80102dac: e8 4f 08 00 00 call 80103600 +80102db1: 89 c2 mov %eax,%edx +xchg(volatile uint *addr, uint newval) +{ + uint result; + + // The + in "+m" denotes a read-modify-write operand. + asm volatile("lock; xchgl %0, %1" : +80102db3: b8 01 00 00 00 mov $0x1,%eax +80102db8: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) + scheduler(); // start running processes +80102dbf: e8 9c 0b 00 00 call 80103960 +80102dc4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80102dca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +80102dd0 : +{ +80102dd0: 55 push %ebp +80102dd1: 89 e5 mov %esp,%ebp +80102dd3: 83 ec 08 sub $0x8,%esp + switchkvm(); +80102dd6: e8 c5 37 00 00 call 801065a0 + seginit(); +80102ddb: e8 00 37 00 00 call 801064e0 + lapicinit(); +80102de0: e8 8b f8 ff ff call 80102670 + mpmain(); +80102de5: e8 96 ff ff ff call 80102d80 +80102dea: 66 90 xchg %ax,%ax +80102dec: 66 90 xchg %ax,%ax +80102dee: 66 90 xchg %ax,%ax + +80102df0
: +{ +80102df0: 55 push %ebp +80102df1: 89 e5 mov %esp,%ebp +80102df3: 53 push %ebx + // 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++){ +80102df4: bb 80 27 11 80 mov $0x80112780,%ebx +{ +80102df9: 83 e4 f0 and $0xfffffff0,%esp +80102dfc: 83 ec 10 sub $0x10,%esp + kinit1(end, P2V(4*1024*1024)); // phys page allocator +80102dff: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp) +80102e06: 80 +80102e07: c7 04 24 a8 55 11 80 movl $0x801155a8,(%esp) +80102e0e: e8 cd f5 ff ff call 801023e0 + kvmalloc(); // kernel page table +80102e13: e8 18 3c 00 00 call 80106a30 + mpinit(); // detect other processors +80102e18: e8 73 01 00 00 call 80102f90 +80102e1d: 8d 76 00 lea 0x0(%esi),%esi + lapicinit(); // interrupt controller +80102e20: e8 4b f8 ff ff call 80102670 + seginit(); // segment descriptors +80102e25: e8 b6 36 00 00 call 801064e0 + picinit(); // disable pic +80102e2a: e8 21 03 00 00 call 80103150 +80102e2f: 90 nop + ioapicinit(); // another interrupt controller +80102e30: e8 cb f3 ff ff call 80102200 + consoleinit(); // console hardware +80102e35: e8 16 db ff ff call 80100950 + uartinit(); // serial port +80102e3a: e8 c1 29 00 00 call 80105800 +80102e3f: 90 nop + pinit(); // process table +80102e40: e8 9b 07 00 00 call 801035e0 + tvinit(); // trap vectors +80102e45: e8 e6 25 00 00 call 80105430 + binit(); // buffer cache +80102e4a: e8 f1 d1 ff ff call 80100040 +80102e4f: 90 nop + fileinit(); // file table +80102e50: e8 fb de ff ff call 80100d50 + ideinit(); // disk +80102e55: e8 a6 f1 ff ff call 80102000 + memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); +80102e5a: c7 44 24 08 8a 00 00 movl $0x8a,0x8(%esp) +80102e61: 00 +80102e62: c7 44 24 04 8c a4 10 movl $0x8010a48c,0x4(%esp) +80102e69: 80 +80102e6a: c7 04 24 00 70 00 80 movl $0x80007000,(%esp) +80102e71: e8 ca 14 00 00 call 80104340 + for(c = cpus; c < cpus+ncpu; c++){ +80102e76: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax +80102e7d: 00 00 00 +80102e80: 05 80 27 11 80 add $0x80112780,%eax +80102e85: 39 d8 cmp %ebx,%eax +80102e87: 76 6a jbe 80102ef3 +80102e89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(c == mycpu()) // We've started already. +80102e90: e8 6b 07 00 00 call 80103600 +80102e95: 39 d8 cmp %ebx,%eax +80102e97: 74 41 je 80102eda + continue; + + // Tell entryother.S what stack to use, where to enter, and what + // pgdir to use. We cannot use kpgdir yet, because the AP processor + // is running in low memory, so we use entrypgdir for the APs too. + stack = kalloc(); +80102e99: e8 02 f6 ff ff call 801024a0 + *(void**)(code-4) = stack + KSTACKSIZE; + *(void(**)(void))(code-8) = mpenter; +80102e9e: c7 05 f8 6f 00 80 d0 movl $0x80102dd0,0x80006ff8 +80102ea5: 2d 10 80 + *(int**)(code-12) = (void *) V2P(entrypgdir); +80102ea8: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4 +80102eaf: 90 10 00 + *(void**)(code-4) = stack + KSTACKSIZE; +80102eb2: 05 00 10 00 00 add $0x1000,%eax +80102eb7: a3 fc 6f 00 80 mov %eax,0x80006ffc + + lapicstartap(c->apicid, V2P(code)); +80102ebc: 0f b6 03 movzbl (%ebx),%eax +80102ebf: c7 44 24 04 00 70 00 movl $0x7000,0x4(%esp) +80102ec6: 00 +80102ec7: 89 04 24 mov %eax,(%esp) +80102eca: e8 e1 f8 ff ff call 801027b0 +80102ecf: 90 nop + + // wait for cpu to finish mpmain() + while(c->started == 0) +80102ed0: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax +80102ed6: 85 c0 test %eax,%eax +80102ed8: 74 f6 je 80102ed0 + for(c = cpus; c < cpus+ncpu; c++){ +80102eda: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax +80102ee1: 00 00 00 +80102ee4: 81 c3 b0 00 00 00 add $0xb0,%ebx +80102eea: 05 80 27 11 80 add $0x80112780,%eax +80102eef: 39 c3 cmp %eax,%ebx +80102ef1: 72 9d jb 80102e90 + kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() +80102ef3: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp) +80102efa: 8e +80102efb: c7 04 24 00 00 40 80 movl $0x80400000,(%esp) +80102f02: e8 49 f5 ff ff call 80102450 + userinit(); // first user process +80102f07: e8 c4 07 00 00 call 801036d0 + mpmain(); // finish this processor's setup +80102f0c: e8 6f fe ff ff call 80102d80 +80102f11: 66 90 xchg %ax,%ax +80102f13: 66 90 xchg %ax,%ax +80102f15: 66 90 xchg %ax,%ax +80102f17: 66 90 xchg %ax,%ax +80102f19: 66 90 xchg %ax,%ax +80102f1b: 66 90 xchg %ax,%ax +80102f1d: 66 90 xchg %ax,%ax +80102f1f: 90 nop + +80102f20 : +} + +// Look for an MP structure in the len bytes at addr. +static struct mp* +mpsearch1(uint a, int len) +{ +80102f20: 55 push %ebp +80102f21: 89 e5 mov %esp,%ebp +80102f23: 56 push %esi + uchar *e, *p, *addr; + + addr = P2V(a); +80102f24: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi +{ +80102f2a: 53 push %ebx + e = addr+len; +80102f2b: 8d 1c 16 lea (%esi,%edx,1),%ebx +{ +80102f2e: 83 ec 10 sub $0x10,%esp + for(p = addr; p < e; p += sizeof(struct mp)) +80102f31: 39 de cmp %ebx,%esi +80102f33: 73 3c jae 80102f71 +80102f35: 8d 76 00 lea 0x0(%esi),%esi + if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) +80102f38: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) +80102f3f: 00 +80102f40: c7 44 24 04 38 71 10 movl $0x80107138,0x4(%esp) +80102f47: 80 +80102f48: 89 34 24 mov %esi,(%esp) +80102f4b: e8 a0 13 00 00 call 801042f0 +80102f50: 85 c0 test %eax,%eax +80102f52: 75 16 jne 80102f6a +80102f54: 31 c9 xor %ecx,%ecx +80102f56: 31 d2 xor %edx,%edx + sum += addr[i]; +80102f58: 0f b6 04 16 movzbl (%esi,%edx,1),%eax + for(i=0; i + if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) +80102f66: 84 c9 test %cl,%cl +80102f68: 74 10 je 80102f7a + for(p = addr; p < e; p += sizeof(struct mp)) +80102f6a: 83 c6 10 add $0x10,%esi +80102f6d: 39 f3 cmp %esi,%ebx +80102f6f: 77 c7 ja 80102f38 + return (struct mp*)p; + return 0; +} +80102f71: 83 c4 10 add $0x10,%esp + return 0; +80102f74: 31 c0 xor %eax,%eax +} +80102f76: 5b pop %ebx +80102f77: 5e pop %esi +80102f78: 5d pop %ebp +80102f79: c3 ret +80102f7a: 83 c4 10 add $0x10,%esp +80102f7d: 89 f0 mov %esi,%eax +80102f7f: 5b pop %ebx +80102f80: 5e pop %esi +80102f81: 5d pop %ebp +80102f82: c3 ret +80102f83: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80102f89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80102f90 : + return conf; +} + +void +mpinit(void) +{ +80102f90: 55 push %ebp +80102f91: 89 e5 mov %esp,%ebp +80102f93: 57 push %edi +80102f94: 56 push %esi +80102f95: 53 push %ebx +80102f96: 83 ec 1c sub $0x1c,%esp + if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ +80102f99: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax +80102fa0: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx +80102fa7: c1 e0 08 shl $0x8,%eax +80102faa: 09 d0 or %edx,%eax +80102fac: c1 e0 04 shl $0x4,%eax +80102faf: 85 c0 test %eax,%eax +80102fb1: 75 1b jne 80102fce + p = ((bda[0x14]<<8)|bda[0x13])*1024; +80102fb3: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax +80102fba: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx +80102fc1: c1 e0 08 shl $0x8,%eax +80102fc4: 09 d0 or %edx,%eax +80102fc6: c1 e0 0a shl $0xa,%eax + if((mp = mpsearch1(p-1024, 1024))) +80102fc9: 2d 00 04 00 00 sub $0x400,%eax + if((mp = mpsearch1(p, 1024))) +80102fce: ba 00 04 00 00 mov $0x400,%edx +80102fd3: e8 48 ff ff ff call 80102f20 +80102fd8: 85 c0 test %eax,%eax +80102fda: 89 c7 mov %eax,%edi +80102fdc: 0f 84 22 01 00 00 je 80103104 + if((mp = mpsearch()) == 0 || mp->physaddr == 0) +80102fe2: 8b 77 04 mov 0x4(%edi),%esi +80102fe5: 85 f6 test %esi,%esi +80102fe7: 0f 84 30 01 00 00 je 8010311d + conf = (struct mpconf*) P2V((uint) mp->physaddr); +80102fed: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax + if(memcmp(conf, "PCMP", 4) != 0) +80102ff3: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) +80102ffa: 00 +80102ffb: c7 44 24 04 3d 71 10 movl $0x8010713d,0x4(%esp) +80103002: 80 +80103003: 89 04 24 mov %eax,(%esp) + conf = (struct mpconf*) P2V((uint) mp->physaddr); +80103006: 89 45 e4 mov %eax,-0x1c(%ebp) + if(memcmp(conf, "PCMP", 4) != 0) +80103009: e8 e2 12 00 00 call 801042f0 +8010300e: 85 c0 test %eax,%eax +80103010: 0f 85 07 01 00 00 jne 8010311d + if(conf->version != 1 && conf->version != 4) +80103016: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax +8010301d: 3c 04 cmp $0x4,%al +8010301f: 0f 85 0b 01 00 00 jne 80103130 + if(sum((uchar*)conf, conf->length) != 0) +80103025: 0f b7 86 04 00 00 80 movzwl -0x7ffffffc(%esi),%eax + for(i=0; i + sum = 0; +80103030: 31 c9 xor %ecx,%ecx + for(i=0; i + if(sum((uchar*)conf, conf->length) != 0) +80103049: 84 c9 test %cl,%cl +8010304b: 0f 85 cc 00 00 00 jne 8010311d + struct mp *mp; + struct mpconf *conf; + struct mpproc *proc; + struct mpioapic *ioapic; + + if((conf = mpconfig(&mp)) == 0) +80103051: 8b 45 e4 mov -0x1c(%ebp),%eax +80103054: 85 c0 test %eax,%eax +80103056: 0f 84 c1 00 00 00 je 8010311d + panic("Expect to run on an SMP"); + ismp = 1; + lapic = (uint*)conf->lapicaddr; +8010305c: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax + ismp = 1; +80103062: bb 01 00 00 00 mov $0x1,%ebx + lapic = (uint*)conf->lapicaddr; +80103067: a3 7c 26 11 80 mov %eax,0x8011267c + for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p +80103084: 0f b6 08 movzbl (%eax),%ecx + switch(*p){ +80103087: 80 f9 04 cmp $0x4,%cl +8010308a: 77 74 ja 80103100 +8010308c: ff 24 8d 7c 71 10 80 jmp *-0x7fef8e84(,%ecx,4) +80103093: 90 nop +80103094: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + p += sizeof(struct mpioapic); + continue; + case MPBUS: + case MPIOINTR: + case MPLINTR: + p += 8; +80103098: 83 c0 08 add $0x8,%eax + for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p + default: + ismp = 0; + break; + } + } + if(!ismp) +8010309f: 85 db test %ebx,%ebx +801030a1: 0f 84 93 00 00 00 je 8010313a + panic("Didn't find a suitable machine"); + + if(mp->imcrp){ +801030a7: 80 7f 0c 00 cmpb $0x0,0xc(%edi) +801030ab: 74 12 je 801030bf + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +801030ad: ba 22 00 00 00 mov $0x22,%edx +801030b2: b8 70 00 00 00 mov $0x70,%eax +801030b7: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +801030b8: b2 23 mov $0x23,%dl +801030ba: ec in (%dx),%al + // Bochs doesn't support IMCR, so this doesn't run on Bochs. + // But it would on real hardware. + outb(0x22, 0x70); // Select IMCR + outb(0x23, inb(0x23) | 1); // Mask external interrupts. +801030bb: 83 c8 01 or $0x1,%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +801030be: ee out %al,(%dx) + } +} +801030bf: 83 c4 1c add $0x1c,%esp +801030c2: 5b pop %ebx +801030c3: 5e pop %esi +801030c4: 5f pop %edi +801030c5: 5d pop %ebp +801030c6: c3 ret +801030c7: 90 nop + if(ncpu < NCPU) { +801030c8: 8b 35 00 2d 11 80 mov 0x80112d00,%esi +801030ce: 83 fe 07 cmp $0x7,%esi +801030d1: 7f 17 jg 801030ea + cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu +801030d3: 0f b6 48 01 movzbl 0x1(%eax),%ecx +801030d7: 69 f6 b0 00 00 00 imul $0xb0,%esi,%esi + ncpu++; +801030dd: 83 05 00 2d 11 80 01 addl $0x1,0x80112d00 + cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu +801030e4: 88 8e 80 27 11 80 mov %cl,-0x7feed880(%esi) + p += sizeof(struct mpproc); +801030ea: 83 c0 14 add $0x14,%eax + continue; +801030ed: eb 91 jmp 80103080 +801030ef: 90 nop + ioapicid = ioapic->apicno; +801030f0: 0f b6 48 01 movzbl 0x1(%eax),%ecx + p += sizeof(struct mpioapic); +801030f4: 83 c0 08 add $0x8,%eax + ioapicid = ioapic->apicno; +801030f7: 88 0d 60 27 11 80 mov %cl,0x80112760 + continue; +801030fd: eb 81 jmp 80103080 +801030ff: 90 nop + ismp = 0; +80103100: 31 db xor %ebx,%ebx +80103102: eb 83 jmp 80103087 + return mpsearch1(0xF0000, 0x10000); +80103104: ba 00 00 01 00 mov $0x10000,%edx +80103109: b8 00 00 0f 00 mov $0xf0000,%eax +8010310e: e8 0d fe ff ff call 80102f20 + if((mp = mpsearch()) == 0 || mp->physaddr == 0) +80103113: 85 c0 test %eax,%eax + return mpsearch1(0xF0000, 0x10000); +80103115: 89 c7 mov %eax,%edi + if((mp = mpsearch()) == 0 || mp->physaddr == 0) +80103117: 0f 85 c5 fe ff ff jne 80102fe2 + panic("Expect to run on an SMP"); +8010311d: c7 04 24 42 71 10 80 movl $0x80107142,(%esp) +80103124: e8 37 d2 ff ff call 80100360 +80103129: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(conf->version != 1 && conf->version != 4) +80103130: 3c 01 cmp $0x1,%al +80103132: 0f 84 ed fe ff ff je 80103025 +80103138: eb e3 jmp 8010311d + panic("Didn't find a suitable machine"); +8010313a: c7 04 24 5c 71 10 80 movl $0x8010715c,(%esp) +80103141: e8 1a d2 ff ff call 80100360 +80103146: 66 90 xchg %ax,%ax +80103148: 66 90 xchg %ax,%ax +8010314a: 66 90 xchg %ax,%ax +8010314c: 66 90 xchg %ax,%ax +8010314e: 66 90 xchg %ax,%ax + +80103150 : +80103150: 55 push %ebp +80103151: ba 21 00 00 00 mov $0x21,%edx +80103156: 89 e5 mov %esp,%ebp +80103158: b8 ff ff ff ff mov $0xffffffff,%eax +8010315d: ee out %al,(%dx) +8010315e: b2 a1 mov $0xa1,%dl +80103160: ee out %al,(%dx) +80103161: 5d pop %ebp +80103162: c3 ret +80103163: 66 90 xchg %ax,%ax +80103165: 66 90 xchg %ax,%ax +80103167: 66 90 xchg %ax,%ax +80103169: 66 90 xchg %ax,%ax +8010316b: 66 90 xchg %ax,%ax +8010316d: 66 90 xchg %ax,%ax +8010316f: 90 nop + +80103170 : + int writeopen; // write fd is still open +}; + +int +pipealloc(struct file **f0, struct file **f1) +{ +80103170: 55 push %ebp +80103171: 89 e5 mov %esp,%ebp +80103173: 57 push %edi +80103174: 56 push %esi +80103175: 53 push %ebx +80103176: 83 ec 1c sub $0x1c,%esp +80103179: 8b 75 08 mov 0x8(%ebp),%esi +8010317c: 8b 5d 0c mov 0xc(%ebp),%ebx + struct pipe *p; + + p = 0; + *f0 = *f1 = 0; +8010317f: c7 03 00 00 00 00 movl $0x0,(%ebx) +80103185: c7 06 00 00 00 00 movl $0x0,(%esi) + if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) +8010318b: e8 e0 db ff ff call 80100d70 +80103190: 85 c0 test %eax,%eax +80103192: 89 06 mov %eax,(%esi) +80103194: 0f 84 a4 00 00 00 je 8010323e +8010319a: e8 d1 db ff ff call 80100d70 +8010319f: 85 c0 test %eax,%eax +801031a1: 89 03 mov %eax,(%ebx) +801031a3: 0f 84 87 00 00 00 je 80103230 + goto bad; + if((p = (struct pipe*)kalloc()) == 0) +801031a9: e8 f2 f2 ff ff call 801024a0 +801031ae: 85 c0 test %eax,%eax +801031b0: 89 c7 mov %eax,%edi +801031b2: 74 7c je 80103230 + goto bad; + p->readopen = 1; +801031b4: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) +801031bb: 00 00 00 + p->writeopen = 1; +801031be: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) +801031c5: 00 00 00 + p->nwrite = 0; +801031c8: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) +801031cf: 00 00 00 + p->nread = 0; +801031d2: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) +801031d9: 00 00 00 + initlock(&p->lock, "pipe"); +801031dc: 89 04 24 mov %eax,(%esp) +801031df: c7 44 24 04 90 71 10 movl $0x80107190,0x4(%esp) +801031e6: 80 +801031e7: e8 84 0e 00 00 call 80104070 + (*f0)->type = FD_PIPE; +801031ec: 8b 06 mov (%esi),%eax +801031ee: c7 00 01 00 00 00 movl $0x1,(%eax) + (*f0)->readable = 1; +801031f4: 8b 06 mov (%esi),%eax +801031f6: c6 40 08 01 movb $0x1,0x8(%eax) + (*f0)->writable = 0; +801031fa: 8b 06 mov (%esi),%eax +801031fc: c6 40 09 00 movb $0x0,0x9(%eax) + (*f0)->pipe = p; +80103200: 8b 06 mov (%esi),%eax +80103202: 89 78 0c mov %edi,0xc(%eax) + (*f1)->type = FD_PIPE; +80103205: 8b 03 mov (%ebx),%eax +80103207: c7 00 01 00 00 00 movl $0x1,(%eax) + (*f1)->readable = 0; +8010320d: 8b 03 mov (%ebx),%eax +8010320f: c6 40 08 00 movb $0x0,0x8(%eax) + (*f1)->writable = 1; +80103213: 8b 03 mov (%ebx),%eax +80103215: c6 40 09 01 movb $0x1,0x9(%eax) + (*f1)->pipe = p; +80103219: 8b 03 mov (%ebx),%eax + return 0; +8010321b: 31 db xor %ebx,%ebx + (*f1)->pipe = p; +8010321d: 89 78 0c mov %edi,0xc(%eax) + if(*f0) + fileclose(*f0); + if(*f1) + fileclose(*f1); + return -1; +} +80103220: 83 c4 1c add $0x1c,%esp +80103223: 89 d8 mov %ebx,%eax +80103225: 5b pop %ebx +80103226: 5e pop %esi +80103227: 5f pop %edi +80103228: 5d pop %ebp +80103229: c3 ret +8010322a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if(*f0) +80103230: 8b 06 mov (%esi),%eax +80103232: 85 c0 test %eax,%eax +80103234: 74 08 je 8010323e + fileclose(*f0); +80103236: 89 04 24 mov %eax,(%esp) +80103239: e8 f2 db ff ff call 80100e30 + if(*f1) +8010323e: 8b 03 mov (%ebx),%eax + return -1; +80103240: bb ff ff ff ff mov $0xffffffff,%ebx + if(*f1) +80103245: 85 c0 test %eax,%eax +80103247: 74 d7 je 80103220 + fileclose(*f1); +80103249: 89 04 24 mov %eax,(%esp) +8010324c: e8 df db ff ff call 80100e30 +} +80103251: 83 c4 1c add $0x1c,%esp +80103254: 89 d8 mov %ebx,%eax +80103256: 5b pop %ebx +80103257: 5e pop %esi +80103258: 5f pop %edi +80103259: 5d pop %ebp +8010325a: c3 ret +8010325b: 90 nop +8010325c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80103260 : + +void +pipeclose(struct pipe *p, int writable) +{ +80103260: 55 push %ebp +80103261: 89 e5 mov %esp,%ebp +80103263: 56 push %esi +80103264: 53 push %ebx +80103265: 83 ec 10 sub $0x10,%esp +80103268: 8b 5d 08 mov 0x8(%ebp),%ebx +8010326b: 8b 75 0c mov 0xc(%ebp),%esi + acquire(&p->lock); +8010326e: 89 1c 24 mov %ebx,(%esp) +80103271: e8 6a 0f 00 00 call 801041e0 + if(writable){ +80103276: 85 f6 test %esi,%esi +80103278: 74 3e je 801032b8 + p->writeopen = 0; + wakeup(&p->nread); +8010327a: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax + p->writeopen = 0; +80103280: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) +80103287: 00 00 00 + wakeup(&p->nread); +8010328a: 89 04 24 mov %eax,(%esp) +8010328d: e8 fe 0a 00 00 call 80103d90 + } else { + p->readopen = 0; + wakeup(&p->nwrite); + } + if(p->readopen == 0 && p->writeopen == 0){ +80103292: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx +80103298: 85 d2 test %edx,%edx +8010329a: 75 0a jne 801032a6 +8010329c: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax +801032a2: 85 c0 test %eax,%eax +801032a4: 74 32 je 801032d8 + release(&p->lock); + kfree((char*)p); + } else + release(&p->lock); +801032a6: 89 5d 08 mov %ebx,0x8(%ebp) +} +801032a9: 83 c4 10 add $0x10,%esp +801032ac: 5b pop %ebx +801032ad: 5e pop %esi +801032ae: 5d pop %ebp + release(&p->lock); +801032af: e9 9c 0f 00 00 jmp 80104250 +801032b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + wakeup(&p->nwrite); +801032b8: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax + p->readopen = 0; +801032be: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) +801032c5: 00 00 00 + wakeup(&p->nwrite); +801032c8: 89 04 24 mov %eax,(%esp) +801032cb: e8 c0 0a 00 00 call 80103d90 +801032d0: eb c0 jmp 80103292 +801032d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + release(&p->lock); +801032d8: 89 1c 24 mov %ebx,(%esp) +801032db: e8 70 0f 00 00 call 80104250 + kfree((char*)p); +801032e0: 89 5d 08 mov %ebx,0x8(%ebp) +} +801032e3: 83 c4 10 add $0x10,%esp +801032e6: 5b pop %ebx +801032e7: 5e pop %esi +801032e8: 5d pop %ebp + kfree((char*)p); +801032e9: e9 02 f0 ff ff jmp 801022f0 +801032ee: 66 90 xchg %ax,%ax + +801032f0 : + +//PAGEBREAK: 40 +int +pipewrite(struct pipe *p, char *addr, int n) +{ +801032f0: 55 push %ebp +801032f1: 89 e5 mov %esp,%ebp +801032f3: 57 push %edi +801032f4: 56 push %esi +801032f5: 53 push %ebx +801032f6: 83 ec 1c sub $0x1c,%esp +801032f9: 8b 5d 08 mov 0x8(%ebp),%ebx + int i; + + acquire(&p->lock); +801032fc: 89 1c 24 mov %ebx,(%esp) +801032ff: e8 dc 0e 00 00 call 801041e0 + for(i = 0; i < n; i++){ +80103304: 8b 4d 10 mov 0x10(%ebp),%ecx +80103307: 85 c9 test %ecx,%ecx +80103309: 0f 8e b2 00 00 00 jle 801033c1 +8010330f: 8b 4d 0c mov 0xc(%ebp),%ecx + while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full + if(p->readopen == 0 || myproc()->killed){ + release(&p->lock); + return -1; + } + wakeup(&p->nread); +80103312: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi +80103318: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax + sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep +8010331e: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi +80103324: 89 4d e4 mov %ecx,-0x1c(%ebp) +80103327: 03 4d 10 add 0x10(%ebp),%ecx +8010332a: 89 4d e0 mov %ecx,-0x20(%ebp) + while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full +8010332d: 8b 8b 34 02 00 00 mov 0x234(%ebx),%ecx +80103333: 81 c1 00 02 00 00 add $0x200,%ecx +80103339: 39 c8 cmp %ecx,%eax +8010333b: 74 38 je 80103375 +8010333d: eb 55 jmp 80103394 +8010333f: 90 nop + if(p->readopen == 0 || myproc()->killed){ +80103340: e8 5b 03 00 00 call 801036a0 +80103345: 8b 40 24 mov 0x24(%eax),%eax +80103348: 85 c0 test %eax,%eax +8010334a: 75 33 jne 8010337f + wakeup(&p->nread); +8010334c: 89 3c 24 mov %edi,(%esp) +8010334f: e8 3c 0a 00 00 call 80103d90 + sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep +80103354: 89 5c 24 04 mov %ebx,0x4(%esp) +80103358: 89 34 24 mov %esi,(%esp) +8010335b: e8 a0 08 00 00 call 80103c00 + while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full +80103360: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax +80103366: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx +8010336c: 05 00 02 00 00 add $0x200,%eax +80103371: 39 c2 cmp %eax,%edx +80103373: 75 23 jne 80103398 + if(p->readopen == 0 || myproc()->killed){ +80103375: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx +8010337b: 85 d2 test %edx,%edx +8010337d: 75 c1 jne 80103340 + release(&p->lock); +8010337f: 89 1c 24 mov %ebx,(%esp) +80103382: e8 c9 0e 00 00 call 80104250 + return -1; +80103387: b8 ff ff ff ff mov $0xffffffff,%eax + p->data[p->nwrite++ % PIPESIZE] = addr[i]; + } + wakeup(&p->nread); //DOC: pipewrite-wakeup1 + release(&p->lock); + return n; +} +8010338c: 83 c4 1c add $0x1c,%esp +8010338f: 5b pop %ebx +80103390: 5e pop %esi +80103391: 5f pop %edi +80103392: 5d pop %ebp +80103393: c3 ret + while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full +80103394: 89 c2 mov %eax,%edx +80103396: 66 90 xchg %ax,%ax + p->data[p->nwrite++ % PIPESIZE] = addr[i]; +80103398: 8b 4d e4 mov -0x1c(%ebp),%ecx +8010339b: 8d 42 01 lea 0x1(%edx),%eax +8010339e: 81 e2 ff 01 00 00 and $0x1ff,%edx +801033a4: 89 83 38 02 00 00 mov %eax,0x238(%ebx) +801033aa: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +801033ae: 0f b6 09 movzbl (%ecx),%ecx +801033b1: 88 4c 13 34 mov %cl,0x34(%ebx,%edx,1) + for(i = 0; i < n; i++){ +801033b5: 8b 4d e4 mov -0x1c(%ebp),%ecx +801033b8: 3b 4d e0 cmp -0x20(%ebp),%ecx +801033bb: 0f 85 6c ff ff ff jne 8010332d + wakeup(&p->nread); //DOC: pipewrite-wakeup1 +801033c1: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax +801033c7: 89 04 24 mov %eax,(%esp) +801033ca: e8 c1 09 00 00 call 80103d90 + release(&p->lock); +801033cf: 89 1c 24 mov %ebx,(%esp) +801033d2: e8 79 0e 00 00 call 80104250 + return n; +801033d7: 8b 45 10 mov 0x10(%ebp),%eax +801033da: eb b0 jmp 8010338c +801033dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +801033e0 : + +int +piperead(struct pipe *p, char *addr, int n) +{ +801033e0: 55 push %ebp +801033e1: 89 e5 mov %esp,%ebp +801033e3: 57 push %edi +801033e4: 56 push %esi +801033e5: 53 push %ebx +801033e6: 83 ec 1c sub $0x1c,%esp +801033e9: 8b 75 08 mov 0x8(%ebp),%esi +801033ec: 8b 7d 0c mov 0xc(%ebp),%edi + int i; + + acquire(&p->lock); +801033ef: 89 34 24 mov %esi,(%esp) +801033f2: e8 e9 0d 00 00 call 801041e0 + while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty +801033f7: 8b 86 34 02 00 00 mov 0x234(%esi),%eax +801033fd: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax +80103403: 75 5b jne 80103460 +80103405: 8b 9e 40 02 00 00 mov 0x240(%esi),%ebx +8010340b: 85 db test %ebx,%ebx +8010340d: 74 51 je 80103460 + if(myproc()->killed){ + release(&p->lock); + return -1; + } + sleep(&p->nread, &p->lock); //DOC: piperead-sleep +8010340f: 8d 9e 34 02 00 00 lea 0x234(%esi),%ebx +80103415: eb 25 jmp 8010343c +80103417: 90 nop +80103418: 89 74 24 04 mov %esi,0x4(%esp) +8010341c: 89 1c 24 mov %ebx,(%esp) +8010341f: e8 dc 07 00 00 call 80103c00 + while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty +80103424: 8b 86 34 02 00 00 mov 0x234(%esi),%eax +8010342a: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax +80103430: 75 2e jne 80103460 +80103432: 8b 96 40 02 00 00 mov 0x240(%esi),%edx +80103438: 85 d2 test %edx,%edx +8010343a: 74 24 je 80103460 + if(myproc()->killed){ +8010343c: e8 5f 02 00 00 call 801036a0 +80103441: 8b 48 24 mov 0x24(%eax),%ecx +80103444: 85 c9 test %ecx,%ecx +80103446: 74 d0 je 80103418 + release(&p->lock); +80103448: 89 34 24 mov %esi,(%esp) +8010344b: e8 00 0e 00 00 call 80104250 + addr[i] = p->data[p->nread++ % PIPESIZE]; + } + wakeup(&p->nwrite); //DOC: piperead-wakeup + release(&p->lock); + return i; +} +80103450: 83 c4 1c add $0x1c,%esp + return -1; +80103453: b8 ff ff ff ff mov $0xffffffff,%eax +} +80103458: 5b pop %ebx +80103459: 5e pop %esi +8010345a: 5f pop %edi +8010345b: 5d pop %ebp +8010345c: c3 ret +8010345d: 8d 76 00 lea 0x0(%esi),%esi + for(i = 0; i < n; i++){ //DOC: piperead-copy +80103460: 8b 55 10 mov 0x10(%ebp),%edx + if(p->nread == p->nwrite) +80103463: 31 db xor %ebx,%ebx + for(i = 0; i < n; i++){ //DOC: piperead-copy +80103465: 85 d2 test %edx,%edx +80103467: 7f 2b jg 80103494 +80103469: eb 31 jmp 8010349c +8010346b: 90 nop +8010346c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + addr[i] = p->data[p->nread++ % PIPESIZE]; +80103470: 8d 48 01 lea 0x1(%eax),%ecx +80103473: 25 ff 01 00 00 and $0x1ff,%eax +80103478: 89 8e 34 02 00 00 mov %ecx,0x234(%esi) +8010347e: 0f b6 44 06 34 movzbl 0x34(%esi,%eax,1),%eax +80103483: 88 04 1f mov %al,(%edi,%ebx,1) + for(i = 0; i < n; i++){ //DOC: piperead-copy +80103486: 83 c3 01 add $0x1,%ebx +80103489: 3b 5d 10 cmp 0x10(%ebp),%ebx +8010348c: 74 0e je 8010349c + if(p->nread == p->nwrite) +8010348e: 8b 86 34 02 00 00 mov 0x234(%esi),%eax +80103494: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax +8010349a: 75 d4 jne 80103470 + wakeup(&p->nwrite); //DOC: piperead-wakeup +8010349c: 8d 86 38 02 00 00 lea 0x238(%esi),%eax +801034a2: 89 04 24 mov %eax,(%esp) +801034a5: e8 e6 08 00 00 call 80103d90 + release(&p->lock); +801034aa: 89 34 24 mov %esi,(%esp) +801034ad: e8 9e 0d 00 00 call 80104250 +} +801034b2: 83 c4 1c add $0x1c,%esp + return i; +801034b5: 89 d8 mov %ebx,%eax +} +801034b7: 5b pop %ebx +801034b8: 5e pop %esi +801034b9: 5f pop %edi +801034ba: 5d pop %ebp +801034bb: c3 ret +801034bc: 66 90 xchg %ax,%ax +801034be: 66 90 xchg %ax,%ax + +801034c0 : +// If found, change state to EMBRYO and initialize +// state required to run in the kernel. +// Otherwise return 0. +static struct proc * +allocproc(void) +{ +801034c0: 55 push %ebp +801034c1: 89 e5 mov %esp,%ebp +801034c3: 53 push %ebx + struct proc *p; + char *sp; + + acquire(&ptable.lock); + + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +801034c4: bb 54 2d 11 80 mov $0x80112d54,%ebx +{ +801034c9: 83 ec 14 sub $0x14,%esp + acquire(&ptable.lock); +801034cc: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801034d3: e8 08 0d 00 00 call 801041e0 +801034d8: eb 11 jmp 801034eb +801034da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +801034e0: 83 eb 80 sub $0xffffff80,%ebx +801034e3: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx +801034e9: 74 7d je 80103568 + if (p->state == UNUSED) +801034eb: 8b 43 0c mov 0xc(%ebx),%eax +801034ee: 85 c0 test %eax,%eax +801034f0: 75 ee jne 801034e0 + release(&ptable.lock); + return 0; + +found: + p->state = EMBRYO; + p->pid = nextpid++; +801034f2: a1 04 a0 10 80 mov 0x8010a004,%eax + + release(&ptable.lock); +801034f7: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + p->state = EMBRYO; +801034fe: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) + p->pid = nextpid++; +80103505: 8d 50 01 lea 0x1(%eax),%edx +80103508: 89 15 04 a0 10 80 mov %edx,0x8010a004 +8010350e: 89 43 10 mov %eax,0x10(%ebx) + release(&ptable.lock); +80103511: e8 3a 0d 00 00 call 80104250 + + // Allocate kernel stack. + if ((p->kstack = kalloc()) == 0) +80103516: e8 85 ef ff ff call 801024a0 +8010351b: 85 c0 test %eax,%eax +8010351d: 89 43 08 mov %eax,0x8(%ebx) +80103520: 74 5a je 8010357c + return 0; + } + sp = p->kstack + KSTACKSIZE; + + // Leave room for trap frame. + sp -= sizeof *p->tf; +80103522: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx + // Set up new context to start executing at forkret, + // which returns to trapret. + sp -= 4; + *(uint *)sp = (uint)trapret; + + sp -= sizeof *p->context; +80103528: 05 9c 0f 00 00 add $0xf9c,%eax + sp -= sizeof *p->tf; +8010352d: 89 53 18 mov %edx,0x18(%ebx) + *(uint *)sp = (uint)trapret; +80103530: c7 40 14 25 54 10 80 movl $0x80105425,0x14(%eax) + p->context = (struct context *)sp; + memset(p->context, 0, sizeof *p->context); +80103537: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) +8010353e: 00 +8010353f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80103546: 00 +80103547: 89 04 24 mov %eax,(%esp) + p->context = (struct context *)sp; +8010354a: 89 43 1c mov %eax,0x1c(%ebx) + memset(p->context, 0, sizeof *p->context); +8010354d: e8 4e 0d 00 00 call 801042a0 + p->context->eip = (uint)forkret; +80103552: 8b 43 1c mov 0x1c(%ebx),%eax +80103555: c7 40 10 90 35 10 80 movl $0x80103590,0x10(%eax) + + return p; +8010355c: 89 d8 mov %ebx,%eax +} +8010355e: 83 c4 14 add $0x14,%esp +80103561: 5b pop %ebx +80103562: 5d pop %ebp +80103563: c3 ret +80103564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + release(&ptable.lock); +80103568: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +8010356f: e8 dc 0c 00 00 call 80104250 +} +80103574: 83 c4 14 add $0x14,%esp + return 0; +80103577: 31 c0 xor %eax,%eax +} +80103579: 5b pop %ebx +8010357a: 5d pop %ebp +8010357b: c3 ret + p->state = UNUSED; +8010357c: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) + return 0; +80103583: eb d9 jmp 8010355e +80103585: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80103589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103590 : +} + +// A fork child's very first scheduling by scheduler() +// will swtch here. "Return" to user space. +void forkret(void) +{ +80103590: 55 push %ebp +80103591: 89 e5 mov %esp,%ebp +80103593: 83 ec 18 sub $0x18,%esp + static int first = 1; + // Still holding ptable.lock from scheduler. + release(&ptable.lock); +80103596: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +8010359d: e8 ae 0c 00 00 call 80104250 + + if (first) +801035a2: a1 00 a0 10 80 mov 0x8010a000,%eax +801035a7: 85 c0 test %eax,%eax +801035a9: 75 05 jne 801035b0 + iinit(ROOTDEV); + initlog(ROOTDEV); + } + + // Return to "caller", actually trapret (see allocproc). +} +801035ab: c9 leave +801035ac: c3 ret +801035ad: 8d 76 00 lea 0x0(%esi),%esi + iinit(ROOTDEV); +801035b0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + first = 0; +801035b7: c7 05 00 a0 10 80 00 movl $0x0,0x8010a000 +801035be: 00 00 00 + iinit(ROOTDEV); +801035c1: e8 aa de ff ff call 80101470 + initlog(ROOTDEV); +801035c6: c7 04 24 01 00 00 00 movl $0x1,(%esp) +801035cd: e8 9e f4 ff ff call 80102a70 +} +801035d2: c9 leave +801035d3: c3 ret +801035d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801035da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +801035e0 : +{ +801035e0: 55 push %ebp +801035e1: 89 e5 mov %esp,%ebp +801035e3: 83 ec 18 sub $0x18,%esp + initlock(&ptable.lock, "ptable"); +801035e6: c7 44 24 04 95 71 10 movl $0x80107195,0x4(%esp) +801035ed: 80 +801035ee: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801035f5: e8 76 0a 00 00 call 80104070 +} +801035fa: c9 leave +801035fb: c3 ret +801035fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80103600 : +{ +80103600: 55 push %ebp +80103601: 89 e5 mov %esp,%ebp +80103603: 56 push %esi +80103604: 53 push %ebx +80103605: 83 ec 10 sub $0x10,%esp + asm volatile("pushfl; popl %0" : "=r" (eflags)); +80103608: 9c pushf +80103609: 58 pop %eax + if (readeflags() & FL_IF) +8010360a: f6 c4 02 test $0x2,%ah +8010360d: 75 57 jne 80103666 + apicid = lapicid(); +8010360f: e8 4c f1 ff ff call 80102760 + for (i = 0; i < ncpu; ++i) +80103614: 8b 35 00 2d 11 80 mov 0x80112d00,%esi +8010361a: 85 f6 test %esi,%esi +8010361c: 7e 3c jle 8010365a + if (cpus[i].apicid == apicid) +8010361e: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx +80103625: 39 c2 cmp %eax,%edx +80103627: 74 2d je 80103656 +80103629: b9 30 28 11 80 mov $0x80112830,%ecx + for (i = 0; i < ncpu; ++i) +8010362e: 31 d2 xor %edx,%edx +80103630: 83 c2 01 add $0x1,%edx +80103633: 39 f2 cmp %esi,%edx +80103635: 74 23 je 8010365a + if (cpus[i].apicid == apicid) +80103637: 0f b6 19 movzbl (%ecx),%ebx +8010363a: 81 c1 b0 00 00 00 add $0xb0,%ecx +80103640: 39 c3 cmp %eax,%ebx +80103642: 75 ec jne 80103630 + return &cpus[i]; +80103644: 69 c2 b0 00 00 00 imul $0xb0,%edx,%eax +} +8010364a: 83 c4 10 add $0x10,%esp +8010364d: 5b pop %ebx +8010364e: 5e pop %esi +8010364f: 5d pop %ebp + return &cpus[i]; +80103650: 05 80 27 11 80 add $0x80112780,%eax +} +80103655: c3 ret + for (i = 0; i < ncpu; ++i) +80103656: 31 d2 xor %edx,%edx +80103658: eb ea jmp 80103644 + panic("unknown apicid\n"); +8010365a: c7 04 24 9c 71 10 80 movl $0x8010719c,(%esp) +80103661: e8 fa cc ff ff call 80100360 + panic("mycpu called with interrupts enabled\n"); +80103666: c7 04 24 78 72 10 80 movl $0x80107278,(%esp) +8010366d: e8 ee cc ff ff call 80100360 +80103672: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80103679: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103680 : +{ +80103680: 55 push %ebp +80103681: 89 e5 mov %esp,%ebp +80103683: 83 ec 08 sub $0x8,%esp + return mycpu() - cpus; +80103686: e8 75 ff ff ff call 80103600 +} +8010368b: c9 leave + return mycpu() - cpus; +8010368c: 2d 80 27 11 80 sub $0x80112780,%eax +80103691: c1 f8 04 sar $0x4,%eax +80103694: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax +} +8010369a: c3 ret +8010369b: 90 nop +8010369c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +801036a0 : +{ +801036a0: 55 push %ebp +801036a1: 89 e5 mov %esp,%ebp +801036a3: 53 push %ebx +801036a4: 83 ec 04 sub $0x4,%esp + pushcli(); +801036a7: e8 44 0a 00 00 call 801040f0 + c = mycpu(); +801036ac: e8 4f ff ff ff call 80103600 + p = c->proc; +801036b1: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx + popcli(); +801036b7: e8 74 0a 00 00 call 80104130 +} +801036bc: 83 c4 04 add $0x4,%esp +801036bf: 89 d8 mov %ebx,%eax +801036c1: 5b pop %ebx +801036c2: 5d pop %ebp +801036c3: c3 ret +801036c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801036ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +801036d0 : +{ +801036d0: 55 push %ebp +801036d1: 89 e5 mov %esp,%ebp +801036d3: 53 push %ebx +801036d4: 83 ec 14 sub $0x14,%esp + p = allocproc(); +801036d7: e8 e4 fd ff ff call 801034c0 +801036dc: 89 c3 mov %eax,%ebx + initproc = p; +801036de: a3 b8 a5 10 80 mov %eax,0x8010a5b8 + if ((p->pgdir = setupkvm()) == 0) +801036e3: e8 b8 32 00 00 call 801069a0 +801036e8: 85 c0 test %eax,%eax +801036ea: 89 43 04 mov %eax,0x4(%ebx) +801036ed: 0f 84 d4 00 00 00 je 801037c7 + inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); +801036f3: 89 04 24 mov %eax,(%esp) +801036f6: c7 44 24 08 2c 00 00 movl $0x2c,0x8(%esp) +801036fd: 00 +801036fe: c7 44 24 04 60 a4 10 movl $0x8010a460,0x4(%esp) +80103705: 80 +80103706: e8 c5 2f 00 00 call 801066d0 + p->sz = PGSIZE; +8010370b: c7 03 00 10 00 00 movl $0x1000,(%ebx) + memset(p->tf, 0, sizeof(*p->tf)); +80103711: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp) +80103718: 00 +80103719: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80103720: 00 +80103721: 8b 43 18 mov 0x18(%ebx),%eax +80103724: 89 04 24 mov %eax,(%esp) +80103727: e8 74 0b 00 00 call 801042a0 + p->tf->cs = (SEG_UCODE << 3) | DPL_USER; +8010372c: 8b 43 18 mov 0x18(%ebx),%eax +8010372f: ba 1b 00 00 00 mov $0x1b,%edx + p->tf->ds = (SEG_UDATA << 3) | DPL_USER; +80103734: b9 23 00 00 00 mov $0x23,%ecx + p->tf->cs = (SEG_UCODE << 3) | DPL_USER; +80103739: 66 89 50 3c mov %dx,0x3c(%eax) + p->tf->ds = (SEG_UDATA << 3) | DPL_USER; +8010373d: 8b 43 18 mov 0x18(%ebx),%eax +80103740: 66 89 48 2c mov %cx,0x2c(%eax) + p->tf->es = p->tf->ds; +80103744: 8b 43 18 mov 0x18(%ebx),%eax +80103747: 0f b7 50 2c movzwl 0x2c(%eax),%edx +8010374b: 66 89 50 28 mov %dx,0x28(%eax) + p->tf->ss = p->tf->ds; +8010374f: 8b 43 18 mov 0x18(%ebx),%eax +80103752: 0f b7 50 2c movzwl 0x2c(%eax),%edx +80103756: 66 89 50 48 mov %dx,0x48(%eax) + p->tf->eflags = FL_IF; +8010375a: 8b 43 18 mov 0x18(%ebx),%eax +8010375d: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) + p->tf->esp = PGSIZE; +80103764: 8b 43 18 mov 0x18(%ebx),%eax +80103767: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) + p->tf->eip = 0; // beginning of initcode.S +8010376e: 8b 43 18 mov 0x18(%ebx),%eax +80103771: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) + safestrcpy(p->name, "initcode", sizeof(p->name)); +80103778: 8d 43 6c lea 0x6c(%ebx),%eax +8010377b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) +80103782: 00 +80103783: c7 44 24 04 c5 71 10 movl $0x801071c5,0x4(%esp) +8010378a: 80 +8010378b: 89 04 24 mov %eax,(%esp) +8010378e: e8 ed 0c 00 00 call 80104480 + p->cwd = namei("/"); +80103793: c7 04 24 ce 71 10 80 movl $0x801071ce,(%esp) +8010379a: e8 61 e7 ff ff call 80101f00 +8010379f: 89 43 68 mov %eax,0x68(%ebx) + acquire(&ptable.lock); +801037a2: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801037a9: e8 32 0a 00 00 call 801041e0 + p->state = RUNNABLE; +801037ae: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) + release(&ptable.lock); +801037b5: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801037bc: e8 8f 0a 00 00 call 80104250 +} +801037c1: 83 c4 14 add $0x14,%esp +801037c4: 5b pop %ebx +801037c5: 5d pop %ebp +801037c6: c3 ret + panic("userinit: out of memory?"); +801037c7: c7 04 24 ac 71 10 80 movl $0x801071ac,(%esp) +801037ce: e8 8d cb ff ff call 80100360 +801037d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801037d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801037e0 : +{ +801037e0: 55 push %ebp +801037e1: 89 e5 mov %esp,%ebp +801037e3: 56 push %esi +801037e4: 53 push %ebx +801037e5: 83 ec 10 sub $0x10,%esp +801037e8: 8b 75 08 mov 0x8(%ebp),%esi + struct proc *curproc = myproc(); +801037eb: e8 b0 fe ff ff call 801036a0 + if (n > 0) +801037f0: 83 fe 00 cmp $0x0,%esi + struct proc *curproc = myproc(); +801037f3: 89 c3 mov %eax,%ebx + sz = curproc->sz; +801037f5: 8b 00 mov (%eax),%eax + if (n > 0) +801037f7: 7e 2f jle 80103828 + if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) +801037f9: 01 c6 add %eax,%esi +801037fb: 89 74 24 08 mov %esi,0x8(%esp) +801037ff: 89 44 24 04 mov %eax,0x4(%esp) +80103803: 8b 43 04 mov 0x4(%ebx),%eax +80103806: 89 04 24 mov %eax,(%esp) +80103809: e8 02 30 00 00 call 80106810 +8010380e: 85 c0 test %eax,%eax +80103810: 74 36 je 80103848 + curproc->sz = sz; +80103812: 89 03 mov %eax,(%ebx) + switchuvm(curproc); +80103814: 89 1c 24 mov %ebx,(%esp) +80103817: e8 a4 2d 00 00 call 801065c0 + return 0; +8010381c: 31 c0 xor %eax,%eax +} +8010381e: 83 c4 10 add $0x10,%esp +80103821: 5b pop %ebx +80103822: 5e pop %esi +80103823: 5d pop %ebp +80103824: c3 ret +80103825: 8d 76 00 lea 0x0(%esi),%esi + else if (n < 0) +80103828: 74 e8 je 80103812 + if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) +8010382a: 01 c6 add %eax,%esi +8010382c: 89 74 24 08 mov %esi,0x8(%esp) +80103830: 89 44 24 04 mov %eax,0x4(%esp) +80103834: 8b 43 04 mov 0x4(%ebx),%eax +80103837: 89 04 24 mov %eax,(%esp) +8010383a: e8 c1 30 00 00 call 80106900 +8010383f: 85 c0 test %eax,%eax +80103841: 75 cf jne 80103812 +80103843: 90 nop +80103844: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +80103848: b8 ff ff ff ff mov $0xffffffff,%eax +8010384d: eb cf jmp 8010381e +8010384f: 90 nop + +80103850 : +{ +80103850: 55 push %ebp +80103851: 89 e5 mov %esp,%ebp +80103853: 57 push %edi +80103854: 56 push %esi +80103855: 53 push %ebx +80103856: 83 ec 1c sub $0x1c,%esp + struct proc *curproc = myproc(); +80103859: e8 42 fe ff ff call 801036a0 +8010385e: 89 c3 mov %eax,%ebx + if ((np = allocproc()) == 0) +80103860: e8 5b fc ff ff call 801034c0 +80103865: 85 c0 test %eax,%eax +80103867: 89 c7 mov %eax,%edi +80103869: 89 45 e4 mov %eax,-0x1c(%ebp) +8010386c: 0f 84 bc 00 00 00 je 8010392e + if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) +80103872: 8b 03 mov (%ebx),%eax +80103874: 89 44 24 04 mov %eax,0x4(%esp) +80103878: 8b 43 04 mov 0x4(%ebx),%eax +8010387b: 89 04 24 mov %eax,(%esp) +8010387e: e8 fd 31 00 00 call 80106a80 +80103883: 85 c0 test %eax,%eax +80103885: 89 47 04 mov %eax,0x4(%edi) +80103888: 0f 84 a7 00 00 00 je 80103935 + np->sz = curproc->sz; +8010388e: 8b 03 mov (%ebx),%eax +80103890: 8b 4d e4 mov -0x1c(%ebp),%ecx +80103893: 89 01 mov %eax,(%ecx) + *np->tf = *curproc->tf; +80103895: 8b 79 18 mov 0x18(%ecx),%edi +80103898: 89 c8 mov %ecx,%eax + np->parent = curproc; +8010389a: 89 59 14 mov %ebx,0x14(%ecx) + *np->tf = *curproc->tf; +8010389d: 8b 73 18 mov 0x18(%ebx),%esi +801038a0: b9 13 00 00 00 mov $0x13,%ecx +801038a5: f3 a5 rep movsl %ds:(%esi),%es:(%edi) + for (i = 0; i < NOFILE; i++) +801038a7: 31 f6 xor %esi,%esi + np->tf->eax = 0; +801038a9: 8b 40 18 mov 0x18(%eax),%eax +801038ac: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) +801038b3: 90 nop +801038b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if (curproc->ofile[i]) +801038b8: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax +801038bc: 85 c0 test %eax,%eax +801038be: 74 0f je 801038cf + np->ofile[i] = filedup(curproc->ofile[i]); +801038c0: 89 04 24 mov %eax,(%esp) +801038c3: e8 18 d5 ff ff call 80100de0 +801038c8: 8b 55 e4 mov -0x1c(%ebp),%edx +801038cb: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) + for (i = 0; i < NOFILE; i++) +801038cf: 83 c6 01 add $0x1,%esi +801038d2: 83 fe 10 cmp $0x10,%esi +801038d5: 75 e1 jne 801038b8 + np->cwd = idup(curproc->cwd); +801038d7: 8b 43 68 mov 0x68(%ebx),%eax + safestrcpy(np->name, curproc->name, sizeof(curproc->name)); +801038da: 83 c3 6c add $0x6c,%ebx + np->cwd = idup(curproc->cwd); +801038dd: 89 04 24 mov %eax,(%esp) +801038e0: e8 9b dd ff ff call 80101680 +801038e5: 8b 7d e4 mov -0x1c(%ebp),%edi +801038e8: 89 47 68 mov %eax,0x68(%edi) + safestrcpy(np->name, curproc->name, sizeof(curproc->name)); +801038eb: 8d 47 6c lea 0x6c(%edi),%eax +801038ee: 89 5c 24 04 mov %ebx,0x4(%esp) +801038f2: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) +801038f9: 00 +801038fa: 89 04 24 mov %eax,(%esp) +801038fd: e8 7e 0b 00 00 call 80104480 + pid = np->pid; +80103902: 8b 5f 10 mov 0x10(%edi),%ebx + acquire(&ptable.lock); +80103905: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +8010390c: e8 cf 08 00 00 call 801041e0 + np->state = RUNNABLE; +80103911: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) + release(&ptable.lock); +80103918: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +8010391f: e8 2c 09 00 00 call 80104250 + return pid; +80103924: 89 d8 mov %ebx,%eax +} +80103926: 83 c4 1c add $0x1c,%esp +80103929: 5b pop %ebx +8010392a: 5e pop %esi +8010392b: 5f pop %edi +8010392c: 5d pop %ebp +8010392d: c3 ret + return -1; +8010392e: b8 ff ff ff ff mov $0xffffffff,%eax +80103933: eb f1 jmp 80103926 + kfree(np->kstack); +80103935: 8b 7d e4 mov -0x1c(%ebp),%edi +80103938: 8b 47 08 mov 0x8(%edi),%eax +8010393b: 89 04 24 mov %eax,(%esp) +8010393e: e8 ad e9 ff ff call 801022f0 + return -1; +80103943: b8 ff ff ff ff mov $0xffffffff,%eax + np->kstack = 0; +80103948: c7 47 08 00 00 00 00 movl $0x0,0x8(%edi) + np->state = UNUSED; +8010394f: c7 47 0c 00 00 00 00 movl $0x0,0xc(%edi) + return -1; +80103956: eb ce jmp 80103926 +80103958: 90 nop +80103959: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80103960 : +{ +80103960: 55 push %ebp +80103961: 89 e5 mov %esp,%ebp +80103963: 57 push %edi +80103964: 56 push %esi +80103965: 53 push %ebx +80103966: 83 ec 1c sub $0x1c,%esp + struct cpu *c = mycpu(); +80103969: e8 92 fc ff ff call 80103600 +8010396e: 89 c6 mov %eax,%esi + c->proc = 0; +80103970: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) +80103977: 00 00 00 +8010397a: 8d 78 04 lea 0x4(%eax),%edi +8010397d: 8d 76 00 lea 0x0(%esi),%esi + asm volatile("sti"); +80103980: fb sti + acquire(&ptable.lock); +80103981: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103988: bb 54 2d 11 80 mov $0x80112d54,%ebx + acquire(&ptable.lock); +8010398d: e8 4e 08 00 00 call 801041e0 +80103992: eb 0f jmp 801039a3 +80103994: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103998: 83 eb 80 sub $0xffffff80,%ebx +8010399b: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx +801039a1: 74 45 je 801039e8 + if (p->state != RUNNABLE) +801039a3: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) +801039a7: 75 ef jne 80103998 + c->proc = p; +801039a9: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) + switchuvm(p); +801039af: 89 1c 24 mov %ebx,(%esp) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +801039b2: 83 eb 80 sub $0xffffff80,%ebx + switchuvm(p); +801039b5: e8 06 2c 00 00 call 801065c0 + swtch(&(c->scheduler), p->context); +801039ba: 8b 43 9c mov -0x64(%ebx),%eax + p->state = RUNNING; +801039bd: c7 43 8c 04 00 00 00 movl $0x4,-0x74(%ebx) + swtch(&(c->scheduler), p->context); +801039c4: 89 3c 24 mov %edi,(%esp) +801039c7: 89 44 24 04 mov %eax,0x4(%esp) +801039cb: e8 0b 0b 00 00 call 801044db + switchkvm(); +801039d0: e8 cb 2b 00 00 call 801065a0 + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +801039d5: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx + c->proc = 0; +801039db: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) +801039e2: 00 00 00 + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +801039e5: 75 bc jne 801039a3 +801039e7: 90 nop + release(&ptable.lock); +801039e8: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801039ef: e8 5c 08 00 00 call 80104250 + } +801039f4: eb 8a jmp 80103980 +801039f6: 8d 76 00 lea 0x0(%esi),%esi +801039f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103a00 : +{ +80103a00: 55 push %ebp +80103a01: 89 e5 mov %esp,%ebp +80103a03: 56 push %esi +80103a04: 53 push %ebx +80103a05: 83 ec 10 sub $0x10,%esp + struct proc *p = myproc(); +80103a08: e8 93 fc ff ff call 801036a0 + if (!holding(&ptable.lock)) +80103a0d: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + struct proc *p = myproc(); +80103a14: 89 c3 mov %eax,%ebx + if (!holding(&ptable.lock)) +80103a16: e8 85 07 00 00 call 801041a0 +80103a1b: 85 c0 test %eax,%eax +80103a1d: 74 4f je 80103a6e + if (mycpu()->ncli != 1) +80103a1f: e8 dc fb ff ff call 80103600 +80103a24: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) +80103a2b: 75 65 jne 80103a92 + if (p->state == RUNNING) +80103a2d: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) +80103a31: 74 53 je 80103a86 + asm volatile("pushfl; popl %0" : "=r" (eflags)); +80103a33: 9c pushf +80103a34: 58 pop %eax + if (readeflags() & FL_IF) +80103a35: f6 c4 02 test $0x2,%ah +80103a38: 75 40 jne 80103a7a + intena = mycpu()->intena; +80103a3a: e8 c1 fb ff ff call 80103600 + swtch(&p->context, mycpu()->scheduler); +80103a3f: 83 c3 1c add $0x1c,%ebx + intena = mycpu()->intena; +80103a42: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi + swtch(&p->context, mycpu()->scheduler); +80103a48: e8 b3 fb ff ff call 80103600 +80103a4d: 8b 40 04 mov 0x4(%eax),%eax +80103a50: 89 1c 24 mov %ebx,(%esp) +80103a53: 89 44 24 04 mov %eax,0x4(%esp) +80103a57: e8 7f 0a 00 00 call 801044db + mycpu()->intena = intena; +80103a5c: e8 9f fb ff ff call 80103600 +80103a61: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) +} +80103a67: 83 c4 10 add $0x10,%esp +80103a6a: 5b pop %ebx +80103a6b: 5e pop %esi +80103a6c: 5d pop %ebp +80103a6d: c3 ret + panic("sched ptable.lock"); +80103a6e: c7 04 24 d0 71 10 80 movl $0x801071d0,(%esp) +80103a75: e8 e6 c8 ff ff call 80100360 + panic("sched interruptible"); +80103a7a: c7 04 24 fc 71 10 80 movl $0x801071fc,(%esp) +80103a81: e8 da c8 ff ff call 80100360 + panic("sched running"); +80103a86: c7 04 24 ee 71 10 80 movl $0x801071ee,(%esp) +80103a8d: e8 ce c8 ff ff call 80100360 + panic("sched locks"); +80103a92: c7 04 24 e2 71 10 80 movl $0x801071e2,(%esp) +80103a99: e8 c2 c8 ff ff call 80100360 +80103a9e: 66 90 xchg %ax,%ax + +80103aa0 : +{ +80103aa0: 55 push %ebp +80103aa1: 89 e5 mov %esp,%ebp +80103aa3: 56 push %esi + if (curproc == initproc) +80103aa4: 31 f6 xor %esi,%esi +{ +80103aa6: 53 push %ebx +80103aa7: 83 ec 10 sub $0x10,%esp + struct proc *curproc = myproc(); +80103aaa: e8 f1 fb ff ff call 801036a0 + if (curproc == initproc) +80103aaf: 3b 05 b8 a5 10 80 cmp 0x8010a5b8,%eax + struct proc *curproc = myproc(); +80103ab5: 89 c3 mov %eax,%ebx + if (curproc == initproc) +80103ab7: 0f 84 ea 00 00 00 je 80103ba7 +80103abd: 8d 76 00 lea 0x0(%esi),%esi + if (curproc->ofile[fd]) +80103ac0: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax +80103ac4: 85 c0 test %eax,%eax +80103ac6: 74 10 je 80103ad8 + fileclose(curproc->ofile[fd]); +80103ac8: 89 04 24 mov %eax,(%esp) +80103acb: e8 60 d3 ff ff call 80100e30 + curproc->ofile[fd] = 0; +80103ad0: c7 44 b3 28 00 00 00 movl $0x0,0x28(%ebx,%esi,4) +80103ad7: 00 + for (fd = 0; fd < NOFILE; fd++) +80103ad8: 83 c6 01 add $0x1,%esi +80103adb: 83 fe 10 cmp $0x10,%esi +80103ade: 75 e0 jne 80103ac0 + begin_op(); +80103ae0: e8 2b f0 ff ff call 80102b10 + iput(curproc->cwd); +80103ae5: 8b 43 68 mov 0x68(%ebx),%eax +80103ae8: 89 04 24 mov %eax,(%esp) +80103aeb: e8 e0 dc ff ff call 801017d0 + end_op(); +80103af0: e8 8b f0 ff ff call 80102b80 + curproc->cwd = 0; +80103af5: c7 43 68 00 00 00 00 movl $0x0,0x68(%ebx) + acquire(&ptable.lock); +80103afc: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103b03: e8 d8 06 00 00 call 801041e0 + wakeup1(curproc->parent); +80103b08: 8b 43 14 mov 0x14(%ebx),%eax +static void +wakeup1(void *chan) +{ + struct proc *p; + + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103b0b: ba 54 2d 11 80 mov $0x80112d54,%edx +80103b10: eb 11 jmp 80103b23 +80103b12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80103b18: 83 ea 80 sub $0xffffff80,%edx +80103b1b: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx +80103b21: 74 1d je 80103b40 + if (p->state == SLEEPING && p->chan == chan) +80103b23: 83 7a 0c 02 cmpl $0x2,0xc(%edx) +80103b27: 75 ef jne 80103b18 +80103b29: 3b 42 20 cmp 0x20(%edx),%eax +80103b2c: 75 ea jne 80103b18 + p->state = RUNNABLE; +80103b2e: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103b35: 83 ea 80 sub $0xffffff80,%edx +80103b38: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx +80103b3e: 75 e3 jne 80103b23 + p->parent = initproc; +80103b40: a1 b8 a5 10 80 mov 0x8010a5b8,%eax +80103b45: b9 54 2d 11 80 mov $0x80112d54,%ecx +80103b4a: eb 0f jmp 80103b5b +80103b4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103b50: 83 e9 80 sub $0xffffff80,%ecx +80103b53: 81 f9 54 4d 11 80 cmp $0x80114d54,%ecx +80103b59: 74 34 je 80103b8f + if (p->parent == curproc) +80103b5b: 39 59 14 cmp %ebx,0x14(%ecx) +80103b5e: 75 f0 jne 80103b50 + if (p->state == ZOMBIE) +80103b60: 83 79 0c 05 cmpl $0x5,0xc(%ecx) + p->parent = initproc; +80103b64: 89 41 14 mov %eax,0x14(%ecx) + if (p->state == ZOMBIE) +80103b67: 75 e7 jne 80103b50 +80103b69: ba 54 2d 11 80 mov $0x80112d54,%edx +80103b6e: eb 0b jmp 80103b7b + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103b70: 83 ea 80 sub $0xffffff80,%edx +80103b73: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx +80103b79: 74 d5 je 80103b50 + if (p->state == SLEEPING && p->chan == chan) +80103b7b: 83 7a 0c 02 cmpl $0x2,0xc(%edx) +80103b7f: 75 ef jne 80103b70 +80103b81: 3b 42 20 cmp 0x20(%edx),%eax +80103b84: 75 ea jne 80103b70 + p->state = RUNNABLE; +80103b86: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) +80103b8d: eb e1 jmp 80103b70 + curproc->state = ZOMBIE; +80103b8f: c7 43 0c 05 00 00 00 movl $0x5,0xc(%ebx) + sched(); +80103b96: e8 65 fe ff ff call 80103a00 + panic("zombie exit"); +80103b9b: c7 04 24 1d 72 10 80 movl $0x8010721d,(%esp) +80103ba2: e8 b9 c7 ff ff call 80100360 + panic("init exiting"); +80103ba7: c7 04 24 10 72 10 80 movl $0x80107210,(%esp) +80103bae: e8 ad c7 ff ff call 80100360 +80103bb3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80103bb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103bc0 : +{ +80103bc0: 55 push %ebp +80103bc1: 89 e5 mov %esp,%ebp +80103bc3: 83 ec 18 sub $0x18,%esp + acquire(&ptable.lock); // DOC: yieldlock +80103bc6: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103bcd: e8 0e 06 00 00 call 801041e0 + myproc()->state = RUNNABLE; +80103bd2: e8 c9 fa ff ff call 801036a0 +80103bd7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) + sched(); +80103bde: e8 1d fe ff ff call 80103a00 + release(&ptable.lock); +80103be3: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103bea: e8 61 06 00 00 call 80104250 +} +80103bef: c9 leave +80103bf0: c3 ret +80103bf1: eb 0d jmp 80103c00 +80103bf3: 90 nop +80103bf4: 90 nop +80103bf5: 90 nop +80103bf6: 90 nop +80103bf7: 90 nop +80103bf8: 90 nop +80103bf9: 90 nop +80103bfa: 90 nop +80103bfb: 90 nop +80103bfc: 90 nop +80103bfd: 90 nop +80103bfe: 90 nop +80103bff: 90 nop + +80103c00 : +{ +80103c00: 55 push %ebp +80103c01: 89 e5 mov %esp,%ebp +80103c03: 57 push %edi +80103c04: 56 push %esi +80103c05: 53 push %ebx +80103c06: 83 ec 1c sub $0x1c,%esp +80103c09: 8b 7d 08 mov 0x8(%ebp),%edi +80103c0c: 8b 75 0c mov 0xc(%ebp),%esi + struct proc *p = myproc(); +80103c0f: e8 8c fa ff ff call 801036a0 + if (p == 0) +80103c14: 85 c0 test %eax,%eax + struct proc *p = myproc(); +80103c16: 89 c3 mov %eax,%ebx + if (p == 0) +80103c18: 0f 84 7c 00 00 00 je 80103c9a + if (lk == 0) +80103c1e: 85 f6 test %esi,%esi +80103c20: 74 6c je 80103c8e + if (lk != &ptable.lock) +80103c22: 81 fe 20 2d 11 80 cmp $0x80112d20,%esi +80103c28: 74 46 je 80103c70 + acquire(&ptable.lock); // DOC: sleeplock1 +80103c2a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103c31: e8 aa 05 00 00 call 801041e0 + release(lk); +80103c36: 89 34 24 mov %esi,(%esp) +80103c39: e8 12 06 00 00 call 80104250 + p->chan = chan; +80103c3e: 89 7b 20 mov %edi,0x20(%ebx) + p->state = SLEEPING; +80103c41: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) + sched(); +80103c48: e8 b3 fd ff ff call 80103a00 + p->chan = 0; +80103c4d: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) + release(&ptable.lock); +80103c54: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103c5b: e8 f0 05 00 00 call 80104250 + acquire(lk); +80103c60: 89 75 08 mov %esi,0x8(%ebp) +} +80103c63: 83 c4 1c add $0x1c,%esp +80103c66: 5b pop %ebx +80103c67: 5e pop %esi +80103c68: 5f pop %edi +80103c69: 5d pop %ebp + acquire(lk); +80103c6a: e9 71 05 00 00 jmp 801041e0 +80103c6f: 90 nop + p->chan = chan; +80103c70: 89 78 20 mov %edi,0x20(%eax) + p->state = SLEEPING; +80103c73: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax) + sched(); +80103c7a: e8 81 fd ff ff call 80103a00 + p->chan = 0; +80103c7f: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) +} +80103c86: 83 c4 1c add $0x1c,%esp +80103c89: 5b pop %ebx +80103c8a: 5e pop %esi +80103c8b: 5f pop %edi +80103c8c: 5d pop %ebp +80103c8d: c3 ret + panic("sleep without lk"); +80103c8e: c7 04 24 2f 72 10 80 movl $0x8010722f,(%esp) +80103c95: e8 c6 c6 ff ff call 80100360 + panic("sleep"); +80103c9a: c7 04 24 29 72 10 80 movl $0x80107229,(%esp) +80103ca1: e8 ba c6 ff ff call 80100360 +80103ca6: 8d 76 00 lea 0x0(%esi),%esi +80103ca9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103cb0 : +{ +80103cb0: 55 push %ebp +80103cb1: 89 e5 mov %esp,%ebp +80103cb3: 56 push %esi +80103cb4: 53 push %ebx +80103cb5: 83 ec 10 sub $0x10,%esp + struct proc *curproc = myproc(); +80103cb8: e8 e3 f9 ff ff call 801036a0 + acquire(&ptable.lock); +80103cbd: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + struct proc *curproc = myproc(); +80103cc4: 89 c6 mov %eax,%esi + acquire(&ptable.lock); +80103cc6: e8 15 05 00 00 call 801041e0 + havekids = 0; +80103ccb: 31 c0 xor %eax,%eax + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103ccd: bb 54 2d 11 80 mov $0x80112d54,%ebx +80103cd2: eb 0f jmp 80103ce3 +80103cd4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80103cd8: 83 eb 80 sub $0xffffff80,%ebx +80103cdb: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx +80103ce1: 74 1d je 80103d00 + if (p->parent != curproc) +80103ce3: 39 73 14 cmp %esi,0x14(%ebx) +80103ce6: 75 f0 jne 80103cd8 + if (p->state == ZOMBIE) +80103ce8: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) +80103cec: 74 2f je 80103d1d + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103cee: 83 eb 80 sub $0xffffff80,%ebx + havekids = 1; +80103cf1: b8 01 00 00 00 mov $0x1,%eax + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103cf6: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx +80103cfc: 75 e5 jne 80103ce3 +80103cfe: 66 90 xchg %ax,%ax + if (!havekids || curproc->killed) +80103d00: 85 c0 test %eax,%eax +80103d02: 74 6e je 80103d72 +80103d04: 8b 46 24 mov 0x24(%esi),%eax +80103d07: 85 c0 test %eax,%eax +80103d09: 75 67 jne 80103d72 + sleep(curproc, &ptable.lock); // DOC: wait-sleep +80103d0b: c7 44 24 04 20 2d 11 movl $0x80112d20,0x4(%esp) +80103d12: 80 +80103d13: 89 34 24 mov %esi,(%esp) +80103d16: e8 e5 fe ff ff call 80103c00 + } +80103d1b: eb ae jmp 80103ccb + kfree(p->kstack); +80103d1d: 8b 43 08 mov 0x8(%ebx),%eax + pid = p->pid; +80103d20: 8b 73 10 mov 0x10(%ebx),%esi + kfree(p->kstack); +80103d23: 89 04 24 mov %eax,(%esp) +80103d26: e8 c5 e5 ff ff call 801022f0 + freevm(p->pgdir); +80103d2b: 8b 43 04 mov 0x4(%ebx),%eax + p->kstack = 0; +80103d2e: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) + freevm(p->pgdir); +80103d35: 89 04 24 mov %eax,(%esp) +80103d38: e8 e3 2b 00 00 call 80106920 + release(&ptable.lock); +80103d3d: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + p->pid = 0; +80103d44: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) + p->parent = 0; +80103d4b: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) + p->name[0] = 0; +80103d52: c6 43 6c 00 movb $0x0,0x6c(%ebx) + p->killed = 0; +80103d56: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) + p->state = UNUSED; +80103d5d: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) + release(&ptable.lock); +80103d64: e8 e7 04 00 00 call 80104250 +} +80103d69: 83 c4 10 add $0x10,%esp + return pid; +80103d6c: 89 f0 mov %esi,%eax +} +80103d6e: 5b pop %ebx +80103d6f: 5e pop %esi +80103d70: 5d pop %ebp +80103d71: c3 ret + release(&ptable.lock); +80103d72: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103d79: e8 d2 04 00 00 call 80104250 +} +80103d7e: 83 c4 10 add $0x10,%esp + return -1; +80103d81: b8 ff ff ff ff mov $0xffffffff,%eax +} +80103d86: 5b pop %ebx +80103d87: 5e pop %esi +80103d88: 5d pop %ebp +80103d89: c3 ret +80103d8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80103d90 : +} + +// Wake up all processes sleeping on chan. +void wakeup(void *chan) +{ +80103d90: 55 push %ebp +80103d91: 89 e5 mov %esp,%ebp +80103d93: 53 push %ebx +80103d94: 83 ec 14 sub $0x14,%esp +80103d97: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&ptable.lock); +80103d9a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103da1: e8 3a 04 00 00 call 801041e0 + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103da6: b8 54 2d 11 80 mov $0x80112d54,%eax +80103dab: eb 0d jmp 80103dba +80103dad: 8d 76 00 lea 0x0(%esi),%esi +80103db0: 83 e8 80 sub $0xffffff80,%eax +80103db3: 3d 54 4d 11 80 cmp $0x80114d54,%eax +80103db8: 74 1e je 80103dd8 + if (p->state == SLEEPING && p->chan == chan) +80103dba: 83 78 0c 02 cmpl $0x2,0xc(%eax) +80103dbe: 75 f0 jne 80103db0 +80103dc0: 3b 58 20 cmp 0x20(%eax),%ebx +80103dc3: 75 eb jne 80103db0 + p->state = RUNNABLE; +80103dc5: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103dcc: 83 e8 80 sub $0xffffff80,%eax +80103dcf: 3d 54 4d 11 80 cmp $0x80114d54,%eax +80103dd4: 75 e4 jne 80103dba +80103dd6: 66 90 xchg %ax,%ax + wakeup1(chan); + release(&ptable.lock); +80103dd8: c7 45 08 20 2d 11 80 movl $0x80112d20,0x8(%ebp) +} +80103ddf: 83 c4 14 add $0x14,%esp +80103de2: 5b pop %ebx +80103de3: 5d pop %ebp + release(&ptable.lock); +80103de4: e9 67 04 00 00 jmp 80104250 +80103de9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80103df0 : + +// 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) +{ +80103df0: 55 push %ebp +80103df1: 89 e5 mov %esp,%ebp +80103df3: 53 push %ebx +80103df4: 83 ec 14 sub $0x14,%esp +80103df7: 8b 5d 08 mov 0x8(%ebp),%ebx + struct proc *p; + + acquire(&ptable.lock); +80103dfa: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103e01: e8 da 03 00 00 call 801041e0 + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103e06: b8 54 2d 11 80 mov $0x80112d54,%eax +80103e0b: eb 0d jmp 80103e1a +80103e0d: 8d 76 00 lea 0x0(%esi),%esi +80103e10: 83 e8 80 sub $0xffffff80,%eax +80103e13: 3d 54 4d 11 80 cmp $0x80114d54,%eax +80103e18: 74 36 je 80103e50 + { + if (p->pid == pid) +80103e1a: 39 58 10 cmp %ebx,0x10(%eax) +80103e1d: 75 f1 jne 80103e10 + { + p->killed = 1; + // Wake process from sleep if necessary. + if (p->state == SLEEPING) +80103e1f: 83 78 0c 02 cmpl $0x2,0xc(%eax) + p->killed = 1; +80103e23: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) + if (p->state == SLEEPING) +80103e2a: 74 14 je 80103e40 + p->state = RUNNABLE; + release(&ptable.lock); +80103e2c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103e33: e8 18 04 00 00 call 80104250 + return 0; + } + } + release(&ptable.lock); + return -1; +} +80103e38: 83 c4 14 add $0x14,%esp + return 0; +80103e3b: 31 c0 xor %eax,%eax +} +80103e3d: 5b pop %ebx +80103e3e: 5d pop %ebp +80103e3f: c3 ret + p->state = RUNNABLE; +80103e40: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) +80103e47: eb e3 jmp 80103e2c +80103e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + release(&ptable.lock); +80103e50: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103e57: e8 f4 03 00 00 call 80104250 +} +80103e5c: 83 c4 14 add $0x14,%esp + return -1; +80103e5f: b8 ff ff ff ff mov $0xffffffff,%eax +} +80103e64: 5b pop %ebx +80103e65: 5d pop %ebp +80103e66: c3 ret +80103e67: 89 f6 mov %esi,%esi +80103e69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103e70 : +// PAGEBREAK: 36 +// 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) +{ +80103e70: 55 push %ebp +80103e71: 89 e5 mov %esp,%ebp +80103e73: 57 push %edi +80103e74: 56 push %esi +80103e75: 53 push %ebx +80103e76: bb c0 2d 11 80 mov $0x80112dc0,%ebx +80103e7b: 83 ec 4c sub $0x4c,%esp +80103e7e: 8d 75 e8 lea -0x18(%ebp),%esi +80103e81: eb 20 jmp 80103ea3 +80103e83: 90 nop +80103e84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + { + getcallerpcs((uint *)p->context->ebp + 2, pc); + for (i = 0; i < 10 && pc[i] != 0; i++) + cprintf(" %p", pc[i]); + } + cprintf("\n"); +80103e88: c7 04 24 b7 75 10 80 movl $0x801075b7,(%esp) +80103e8f: e8 bc c7 ff ff call 80100650 +80103e94: 83 eb 80 sub $0xffffff80,%ebx + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) +80103e97: 81 fb c0 4d 11 80 cmp $0x80114dc0,%ebx +80103e9d: 0f 84 8d 00 00 00 je 80103f30 + if (p->state == UNUSED) +80103ea3: 8b 43 a0 mov -0x60(%ebx),%eax +80103ea6: 85 c0 test %eax,%eax +80103ea8: 74 ea je 80103e94 + if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) +80103eaa: 83 f8 05 cmp $0x5,%eax + state = "???"; +80103ead: ba 40 72 10 80 mov $0x80107240,%edx + if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) +80103eb2: 77 11 ja 80103ec5 +80103eb4: 8b 14 85 a0 72 10 80 mov -0x7fef8d60(,%eax,4),%edx + state = "???"; +80103ebb: b8 40 72 10 80 mov $0x80107240,%eax +80103ec0: 85 d2 test %edx,%edx +80103ec2: 0f 44 d0 cmove %eax,%edx + cprintf("%d %s %s", p->pid, state, p->name); +80103ec5: 8b 43 a4 mov -0x5c(%ebx),%eax +80103ec8: 89 5c 24 0c mov %ebx,0xc(%esp) +80103ecc: 89 54 24 08 mov %edx,0x8(%esp) +80103ed0: c7 04 24 44 72 10 80 movl $0x80107244,(%esp) +80103ed7: 89 44 24 04 mov %eax,0x4(%esp) +80103edb: e8 70 c7 ff ff call 80100650 + if (p->state == SLEEPING) +80103ee0: 83 7b a0 02 cmpl $0x2,-0x60(%ebx) +80103ee4: 75 a2 jne 80103e88 + getcallerpcs((uint *)p->context->ebp + 2, pc); +80103ee6: 8d 45 c0 lea -0x40(%ebp),%eax +80103ee9: 89 44 24 04 mov %eax,0x4(%esp) +80103eed: 8b 43 b0 mov -0x50(%ebx),%eax +80103ef0: 8d 7d c0 lea -0x40(%ebp),%edi +80103ef3: 8b 40 0c mov 0xc(%eax),%eax +80103ef6: 83 c0 08 add $0x8,%eax +80103ef9: 89 04 24 mov %eax,(%esp) +80103efc: e8 8f 01 00 00 call 80104090 +80103f01: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + for (i = 0; i < 10 && pc[i] != 0; i++) +80103f08: 8b 17 mov (%edi),%edx +80103f0a: 85 d2 test %edx,%edx +80103f0c: 0f 84 76 ff ff ff je 80103e88 + cprintf(" %p", pc[i]); +80103f12: 89 54 24 04 mov %edx,0x4(%esp) +80103f16: 83 c7 04 add $0x4,%edi +80103f19: c7 04 24 81 6c 10 80 movl $0x80106c81,(%esp) +80103f20: e8 2b c7 ff ff call 80100650 + for (i = 0; i < 10 && pc[i] != 0; i++) +80103f25: 39 f7 cmp %esi,%edi +80103f27: 75 df jne 80103f08 +80103f29: e9 5a ff ff ff jmp 80103e88 +80103f2e: 66 90 xchg %ax,%ax + } +} +80103f30: 83 c4 4c add $0x4c,%esp +80103f33: 5b pop %ebx +80103f34: 5e pop %esi +80103f35: 5f pop %edi +80103f36: 5d pop %ebp +80103f37: c3 ret +80103f38: 66 90 xchg %ax,%ax +80103f3a: 66 90 xchg %ax,%ax +80103f3c: 66 90 xchg %ax,%ax +80103f3e: 66 90 xchg %ax,%ax + +80103f40 : +#include "spinlock.h" +#include "sleeplock.h" + +void +initsleeplock(struct sleeplock *lk, char *name) +{ +80103f40: 55 push %ebp +80103f41: 89 e5 mov %esp,%ebp +80103f43: 53 push %ebx +80103f44: 83 ec 14 sub $0x14,%esp +80103f47: 8b 5d 08 mov 0x8(%ebp),%ebx + initlock(&lk->lk, "sleep lock"); +80103f4a: c7 44 24 04 b8 72 10 movl $0x801072b8,0x4(%esp) +80103f51: 80 +80103f52: 8d 43 04 lea 0x4(%ebx),%eax +80103f55: 89 04 24 mov %eax,(%esp) +80103f58: e8 13 01 00 00 call 80104070 + lk->name = name; +80103f5d: 8b 45 0c mov 0xc(%ebp),%eax + lk->locked = 0; +80103f60: c7 03 00 00 00 00 movl $0x0,(%ebx) + lk->pid = 0; +80103f66: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) + lk->name = name; +80103f6d: 89 43 38 mov %eax,0x38(%ebx) +} +80103f70: 83 c4 14 add $0x14,%esp +80103f73: 5b pop %ebx +80103f74: 5d pop %ebp +80103f75: c3 ret +80103f76: 8d 76 00 lea 0x0(%esi),%esi +80103f79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80103f80 : + +void +acquiresleep(struct sleeplock *lk) +{ +80103f80: 55 push %ebp +80103f81: 89 e5 mov %esp,%ebp +80103f83: 56 push %esi +80103f84: 53 push %ebx +80103f85: 83 ec 10 sub $0x10,%esp +80103f88: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&lk->lk); +80103f8b: 8d 73 04 lea 0x4(%ebx),%esi +80103f8e: 89 34 24 mov %esi,(%esp) +80103f91: e8 4a 02 00 00 call 801041e0 + while (lk->locked) { +80103f96: 8b 13 mov (%ebx),%edx +80103f98: 85 d2 test %edx,%edx +80103f9a: 74 16 je 80103fb2 +80103f9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + sleep(lk, &lk->lk); +80103fa0: 89 74 24 04 mov %esi,0x4(%esp) +80103fa4: 89 1c 24 mov %ebx,(%esp) +80103fa7: e8 54 fc ff ff call 80103c00 + while (lk->locked) { +80103fac: 8b 03 mov (%ebx),%eax +80103fae: 85 c0 test %eax,%eax +80103fb0: 75 ee jne 80103fa0 + } + lk->locked = 1; +80103fb2: c7 03 01 00 00 00 movl $0x1,(%ebx) + lk->pid = myproc()->pid; +80103fb8: e8 e3 f6 ff ff call 801036a0 +80103fbd: 8b 40 10 mov 0x10(%eax),%eax +80103fc0: 89 43 3c mov %eax,0x3c(%ebx) + release(&lk->lk); +80103fc3: 89 75 08 mov %esi,0x8(%ebp) +} +80103fc6: 83 c4 10 add $0x10,%esp +80103fc9: 5b pop %ebx +80103fca: 5e pop %esi +80103fcb: 5d pop %ebp + release(&lk->lk); +80103fcc: e9 7f 02 00 00 jmp 80104250 +80103fd1: eb 0d jmp 80103fe0 +80103fd3: 90 nop +80103fd4: 90 nop +80103fd5: 90 nop +80103fd6: 90 nop +80103fd7: 90 nop +80103fd8: 90 nop +80103fd9: 90 nop +80103fda: 90 nop +80103fdb: 90 nop +80103fdc: 90 nop +80103fdd: 90 nop +80103fde: 90 nop +80103fdf: 90 nop + +80103fe0 : + +void +releasesleep(struct sleeplock *lk) +{ +80103fe0: 55 push %ebp +80103fe1: 89 e5 mov %esp,%ebp +80103fe3: 56 push %esi +80103fe4: 53 push %ebx +80103fe5: 83 ec 10 sub $0x10,%esp +80103fe8: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&lk->lk); +80103feb: 8d 73 04 lea 0x4(%ebx),%esi +80103fee: 89 34 24 mov %esi,(%esp) +80103ff1: e8 ea 01 00 00 call 801041e0 + lk->locked = 0; +80103ff6: c7 03 00 00 00 00 movl $0x0,(%ebx) + lk->pid = 0; +80103ffc: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) + wakeup(lk); +80104003: 89 1c 24 mov %ebx,(%esp) +80104006: e8 85 fd ff ff call 80103d90 + release(&lk->lk); +8010400b: 89 75 08 mov %esi,0x8(%ebp) +} +8010400e: 83 c4 10 add $0x10,%esp +80104011: 5b pop %ebx +80104012: 5e pop %esi +80104013: 5d pop %ebp + release(&lk->lk); +80104014: e9 37 02 00 00 jmp 80104250 +80104019: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80104020 : + +int +holdingsleep(struct sleeplock *lk) +{ +80104020: 55 push %ebp +80104021: 89 e5 mov %esp,%ebp +80104023: 57 push %edi + int r; + + acquire(&lk->lk); + r = lk->locked && (lk->pid == myproc()->pid); +80104024: 31 ff xor %edi,%edi +{ +80104026: 56 push %esi +80104027: 53 push %ebx +80104028: 83 ec 1c sub $0x1c,%esp +8010402b: 8b 5d 08 mov 0x8(%ebp),%ebx + acquire(&lk->lk); +8010402e: 8d 73 04 lea 0x4(%ebx),%esi +80104031: 89 34 24 mov %esi,(%esp) +80104034: e8 a7 01 00 00 call 801041e0 + r = lk->locked && (lk->pid == myproc()->pid); +80104039: 8b 03 mov (%ebx),%eax +8010403b: 85 c0 test %eax,%eax +8010403d: 74 13 je 80104052 +8010403f: 8b 5b 3c mov 0x3c(%ebx),%ebx +80104042: e8 59 f6 ff ff call 801036a0 +80104047: 3b 58 10 cmp 0x10(%eax),%ebx +8010404a: 0f 94 c0 sete %al +8010404d: 0f b6 c0 movzbl %al,%eax +80104050: 89 c7 mov %eax,%edi + release(&lk->lk); +80104052: 89 34 24 mov %esi,(%esp) +80104055: e8 f6 01 00 00 call 80104250 + return r; +} +8010405a: 83 c4 1c add $0x1c,%esp +8010405d: 89 f8 mov %edi,%eax +8010405f: 5b pop %ebx +80104060: 5e pop %esi +80104061: 5f pop %edi +80104062: 5d pop %ebp +80104063: c3 ret +80104064: 66 90 xchg %ax,%ax +80104066: 66 90 xchg %ax,%ax +80104068: 66 90 xchg %ax,%ax +8010406a: 66 90 xchg %ax,%ax +8010406c: 66 90 xchg %ax,%ax +8010406e: 66 90 xchg %ax,%ax + +80104070 : +#include "proc.h" +#include "spinlock.h" + +void +initlock(struct spinlock *lk, char *name) +{ +80104070: 55 push %ebp +80104071: 89 e5 mov %esp,%ebp +80104073: 8b 45 08 mov 0x8(%ebp),%eax + lk->name = name; +80104076: 8b 55 0c mov 0xc(%ebp),%edx + lk->locked = 0; +80104079: c7 00 00 00 00 00 movl $0x0,(%eax) + lk->name = name; +8010407f: 89 50 04 mov %edx,0x4(%eax) + lk->cpu = 0; +80104082: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) +} +80104089: 5d pop %ebp +8010408a: c3 ret +8010408b: 90 nop +8010408c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104090 : +} + +// Record the current call stack in pcs[] by following the %ebp chain. +void +getcallerpcs(void *v, uint pcs[]) +{ +80104090: 55 push %ebp +80104091: 89 e5 mov %esp,%ebp + uint *ebp; + int i; + + ebp = (uint*)v - 2; +80104093: 8b 45 08 mov 0x8(%ebp),%eax +{ +80104096: 8b 4d 0c mov 0xc(%ebp),%ecx +80104099: 53 push %ebx + ebp = (uint*)v - 2; +8010409a: 8d 50 f8 lea -0x8(%eax),%edx + for(i = 0; i < 10; i++){ +8010409d: 31 c0 xor %eax,%eax +8010409f: 90 nop + if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) +801040a0: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx +801040a6: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx +801040ac: 77 1a ja 801040c8 + break; + pcs[i] = ebp[1]; // saved %eip +801040ae: 8b 5a 04 mov 0x4(%edx),%ebx +801040b1: 89 1c 81 mov %ebx,(%ecx,%eax,4) + for(i = 0; i < 10; i++){ +801040b4: 83 c0 01 add $0x1,%eax + ebp = (uint*)ebp[0]; // saved %ebp +801040b7: 8b 12 mov (%edx),%edx + for(i = 0; i < 10; i++){ +801040b9: 83 f8 0a cmp $0xa,%eax +801040bc: 75 e2 jne 801040a0 + } + for(; i < 10; i++) + pcs[i] = 0; +} +801040be: 5b pop %ebx +801040bf: 5d pop %ebp +801040c0: c3 ret +801040c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + pcs[i] = 0; +801040c8: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) + for(; i < 10; i++) +801040cf: 83 c0 01 add $0x1,%eax +801040d2: 83 f8 0a cmp $0xa,%eax +801040d5: 74 e7 je 801040be + pcs[i] = 0; +801040d7: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) + for(; i < 10; i++) +801040de: 83 c0 01 add $0x1,%eax +801040e1: 83 f8 0a cmp $0xa,%eax +801040e4: 75 e2 jne 801040c8 +801040e6: eb d6 jmp 801040be +801040e8: 90 nop +801040e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +801040f0 : +// it takes two popcli to undo two pushcli. Also, if interrupts +// are off, then pushcli, popcli leaves them off. + +void +pushcli(void) +{ +801040f0: 55 push %ebp +801040f1: 89 e5 mov %esp,%ebp +801040f3: 53 push %ebx +801040f4: 83 ec 04 sub $0x4,%esp +801040f7: 9c pushf +801040f8: 5b pop %ebx + asm volatile("cli"); +801040f9: fa cli + int eflags; + + eflags = readeflags(); + cli(); + if(mycpu()->ncli == 0) +801040fa: e8 01 f5 ff ff call 80103600 +801040ff: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax +80104105: 85 c0 test %eax,%eax +80104107: 75 11 jne 8010411a + mycpu()->intena = eflags & FL_IF; +80104109: e8 f2 f4 ff ff call 80103600 +8010410e: 81 e3 00 02 00 00 and $0x200,%ebx +80104114: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) + mycpu()->ncli += 1; +8010411a: e8 e1 f4 ff ff call 80103600 +8010411f: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) +} +80104126: 83 c4 04 add $0x4,%esp +80104129: 5b pop %ebx +8010412a: 5d pop %ebp +8010412b: c3 ret +8010412c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104130 : + +void +popcli(void) +{ +80104130: 55 push %ebp +80104131: 89 e5 mov %esp,%ebp +80104133: 83 ec 18 sub $0x18,%esp + asm volatile("pushfl; popl %0" : "=r" (eflags)); +80104136: 9c pushf +80104137: 58 pop %eax + if(readeflags()&FL_IF) +80104138: f6 c4 02 test $0x2,%ah +8010413b: 75 49 jne 80104186 + panic("popcli - interruptible"); + if(--mycpu()->ncli < 0) +8010413d: e8 be f4 ff ff call 80103600 +80104142: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx +80104148: 8d 51 ff lea -0x1(%ecx),%edx +8010414b: 85 d2 test %edx,%edx +8010414d: 89 90 a4 00 00 00 mov %edx,0xa4(%eax) +80104153: 78 25 js 8010417a + panic("popcli"); + if(mycpu()->ncli == 0 && mycpu()->intena) +80104155: e8 a6 f4 ff ff call 80103600 +8010415a: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx +80104160: 85 d2 test %edx,%edx +80104162: 74 04 je 80104168 + sti(); +} +80104164: c9 leave +80104165: c3 ret +80104166: 66 90 xchg %ax,%ax + if(mycpu()->ncli == 0 && mycpu()->intena) +80104168: e8 93 f4 ff ff call 80103600 +8010416d: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax +80104173: 85 c0 test %eax,%eax +80104175: 74 ed je 80104164 + asm volatile("sti"); +80104177: fb sti +} +80104178: c9 leave +80104179: c3 ret + panic("popcli"); +8010417a: c7 04 24 da 72 10 80 movl $0x801072da,(%esp) +80104181: e8 da c1 ff ff call 80100360 + panic("popcli - interruptible"); +80104186: c7 04 24 c3 72 10 80 movl $0x801072c3,(%esp) +8010418d: e8 ce c1 ff ff call 80100360 +80104192: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80104199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801041a0 : +{ +801041a0: 55 push %ebp +801041a1: 89 e5 mov %esp,%ebp +801041a3: 56 push %esi + r = lock->locked && lock->cpu == mycpu(); +801041a4: 31 f6 xor %esi,%esi +{ +801041a6: 53 push %ebx +801041a7: 8b 5d 08 mov 0x8(%ebp),%ebx + pushcli(); +801041aa: e8 41 ff ff ff call 801040f0 + r = lock->locked && lock->cpu == mycpu(); +801041af: 8b 03 mov (%ebx),%eax +801041b1: 85 c0 test %eax,%eax +801041b3: 74 12 je 801041c7 +801041b5: 8b 5b 08 mov 0x8(%ebx),%ebx +801041b8: e8 43 f4 ff ff call 80103600 +801041bd: 39 c3 cmp %eax,%ebx +801041bf: 0f 94 c0 sete %al +801041c2: 0f b6 c0 movzbl %al,%eax +801041c5: 89 c6 mov %eax,%esi + popcli(); +801041c7: e8 64 ff ff ff call 80104130 +} +801041cc: 89 f0 mov %esi,%eax +801041ce: 5b pop %ebx +801041cf: 5e pop %esi +801041d0: 5d pop %ebp +801041d1: c3 ret +801041d2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +801041d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801041e0 : +{ +801041e0: 55 push %ebp +801041e1: 89 e5 mov %esp,%ebp +801041e3: 53 push %ebx +801041e4: 83 ec 14 sub $0x14,%esp + pushcli(); // disable interrupts to avoid deadlock. +801041e7: e8 04 ff ff ff call 801040f0 + if(holding(lk)) +801041ec: 8b 45 08 mov 0x8(%ebp),%eax +801041ef: 89 04 24 mov %eax,(%esp) +801041f2: e8 a9 ff ff ff call 801041a0 +801041f7: 85 c0 test %eax,%eax +801041f9: 75 3a jne 80104235 + asm volatile("lock; xchgl %0, %1" : +801041fb: b9 01 00 00 00 mov $0x1,%ecx + while(xchg(&lk->locked, 1) != 0) +80104200: 8b 55 08 mov 0x8(%ebp),%edx +80104203: 89 c8 mov %ecx,%eax +80104205: f0 87 02 lock xchg %eax,(%edx) +80104208: 85 c0 test %eax,%eax +8010420a: 75 f4 jne 80104200 + __sync_synchronize(); +8010420c: 0f ae f0 mfence + lk->cpu = mycpu(); +8010420f: 8b 5d 08 mov 0x8(%ebp),%ebx +80104212: e8 e9 f3 ff ff call 80103600 +80104217: 89 43 08 mov %eax,0x8(%ebx) + getcallerpcs(&lk, lk->pcs); +8010421a: 8b 45 08 mov 0x8(%ebp),%eax +8010421d: 83 c0 0c add $0xc,%eax +80104220: 89 44 24 04 mov %eax,0x4(%esp) +80104224: 8d 45 08 lea 0x8(%ebp),%eax +80104227: 89 04 24 mov %eax,(%esp) +8010422a: e8 61 fe ff ff call 80104090 +} +8010422f: 83 c4 14 add $0x14,%esp +80104232: 5b pop %ebx +80104233: 5d pop %ebp +80104234: c3 ret + panic("acquire"); +80104235: c7 04 24 e1 72 10 80 movl $0x801072e1,(%esp) +8010423c: e8 1f c1 ff ff call 80100360 +80104241: eb 0d jmp 80104250 +80104243: 90 nop +80104244: 90 nop +80104245: 90 nop +80104246: 90 nop +80104247: 90 nop +80104248: 90 nop +80104249: 90 nop +8010424a: 90 nop +8010424b: 90 nop +8010424c: 90 nop +8010424d: 90 nop +8010424e: 90 nop +8010424f: 90 nop + +80104250 : +{ +80104250: 55 push %ebp +80104251: 89 e5 mov %esp,%ebp +80104253: 53 push %ebx +80104254: 83 ec 14 sub $0x14,%esp +80104257: 8b 5d 08 mov 0x8(%ebp),%ebx + if(!holding(lk)) +8010425a: 89 1c 24 mov %ebx,(%esp) +8010425d: e8 3e ff ff ff call 801041a0 +80104262: 85 c0 test %eax,%eax +80104264: 74 21 je 80104287 + lk->pcs[0] = 0; +80104266: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) + lk->cpu = 0; +8010426d: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) + __sync_synchronize(); +80104274: 0f ae f0 mfence + asm volatile("movl $0, %0" : "+m" (lk->locked) : ); +80104277: c7 03 00 00 00 00 movl $0x0,(%ebx) +} +8010427d: 83 c4 14 add $0x14,%esp +80104280: 5b pop %ebx +80104281: 5d pop %ebp + popcli(); +80104282: e9 a9 fe ff ff jmp 80104130 + panic("release"); +80104287: c7 04 24 e9 72 10 80 movl $0x801072e9,(%esp) +8010428e: e8 cd c0 ff ff call 80100360 +80104293: 66 90 xchg %ax,%ax +80104295: 66 90 xchg %ax,%ax +80104297: 66 90 xchg %ax,%ax +80104299: 66 90 xchg %ax,%ax +8010429b: 66 90 xchg %ax,%ax +8010429d: 66 90 xchg %ax,%ax +8010429f: 90 nop + +801042a0 : +801042a0: 55 push %ebp +801042a1: 89 e5 mov %esp,%ebp +801042a3: 8b 55 08 mov 0x8(%ebp),%edx +801042a6: 57 push %edi +801042a7: 8b 4d 10 mov 0x10(%ebp),%ecx +801042aa: 53 push %ebx +801042ab: f6 c2 03 test $0x3,%dl +801042ae: 75 05 jne 801042b5 +801042b0: f6 c1 03 test $0x3,%cl +801042b3: 74 13 je 801042c8 +801042b5: 89 d7 mov %edx,%edi +801042b7: 8b 45 0c mov 0xc(%ebp),%eax +801042ba: fc cld +801042bb: f3 aa rep stos %al,%es:(%edi) +801042bd: 5b pop %ebx +801042be: 89 d0 mov %edx,%eax +801042c0: 5f pop %edi +801042c1: 5d pop %ebp +801042c2: c3 ret +801042c3: 90 nop +801042c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801042c8: 0f b6 7d 0c movzbl 0xc(%ebp),%edi +801042cc: c1 e9 02 shr $0x2,%ecx +801042cf: 89 f8 mov %edi,%eax +801042d1: 89 fb mov %edi,%ebx +801042d3: c1 e0 18 shl $0x18,%eax +801042d6: c1 e3 10 shl $0x10,%ebx +801042d9: 09 d8 or %ebx,%eax +801042db: 09 f8 or %edi,%eax +801042dd: c1 e7 08 shl $0x8,%edi +801042e0: 09 f8 or %edi,%eax +801042e2: 89 d7 mov %edx,%edi +801042e4: fc cld +801042e5: f3 ab rep stos %eax,%es:(%edi) +801042e7: 5b pop %ebx +801042e8: 89 d0 mov %edx,%eax +801042ea: 5f pop %edi +801042eb: 5d pop %ebp +801042ec: c3 ret +801042ed: 8d 76 00 lea 0x0(%esi),%esi + +801042f0 : +801042f0: 55 push %ebp +801042f1: 89 e5 mov %esp,%ebp +801042f3: 8b 45 10 mov 0x10(%ebp),%eax +801042f6: 57 push %edi +801042f7: 56 push %esi +801042f8: 8b 75 0c mov 0xc(%ebp),%esi +801042fb: 53 push %ebx +801042fc: 8b 5d 08 mov 0x8(%ebp),%ebx +801042ff: 85 c0 test %eax,%eax +80104301: 8d 78 ff lea -0x1(%eax),%edi +80104304: 74 26 je 8010432c +80104306: 0f b6 03 movzbl (%ebx),%eax +80104309: 31 d2 xor %edx,%edx +8010430b: 0f b6 0e movzbl (%esi),%ecx +8010430e: 38 c8 cmp %cl,%al +80104310: 74 16 je 80104328 +80104312: eb 24 jmp 80104338 +80104314: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80104318: 0f b6 44 13 01 movzbl 0x1(%ebx,%edx,1),%eax +8010431d: 83 c2 01 add $0x1,%edx +80104320: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +80104324: 38 c8 cmp %cl,%al +80104326: 75 10 jne 80104338 +80104328: 39 fa cmp %edi,%edx +8010432a: 75 ec jne 80104318 +8010432c: 5b pop %ebx +8010432d: 31 c0 xor %eax,%eax +8010432f: 5e pop %esi +80104330: 5f pop %edi +80104331: 5d pop %ebp +80104332: c3 ret +80104333: 90 nop +80104334: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80104338: 5b pop %ebx +80104339: 29 c8 sub %ecx,%eax +8010433b: 5e pop %esi +8010433c: 5f pop %edi +8010433d: 5d pop %ebp +8010433e: c3 ret +8010433f: 90 nop + +80104340 : +80104340: 55 push %ebp +80104341: 89 e5 mov %esp,%ebp +80104343: 57 push %edi +80104344: 8b 45 08 mov 0x8(%ebp),%eax +80104347: 56 push %esi +80104348: 8b 75 0c mov 0xc(%ebp),%esi +8010434b: 53 push %ebx +8010434c: 8b 5d 10 mov 0x10(%ebp),%ebx +8010434f: 39 c6 cmp %eax,%esi +80104351: 73 35 jae 80104388 +80104353: 8d 0c 1e lea (%esi,%ebx,1),%ecx +80104356: 39 c8 cmp %ecx,%eax +80104358: 73 2e jae 80104388 +8010435a: 85 db test %ebx,%ebx +8010435c: 8d 3c 18 lea (%eax,%ebx,1),%edi +8010435f: 8d 53 ff lea -0x1(%ebx),%edx +80104362: 74 1b je 8010437f +80104364: f7 db neg %ebx +80104366: 8d 34 19 lea (%ecx,%ebx,1),%esi +80104369: 01 fb add %edi,%ebx +8010436b: 90 nop +8010436c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80104370: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +80104374: 88 0c 13 mov %cl,(%ebx,%edx,1) +80104377: 83 ea 01 sub $0x1,%edx +8010437a: 83 fa ff cmp $0xffffffff,%edx +8010437d: 75 f1 jne 80104370 +8010437f: 5b pop %ebx +80104380: 5e pop %esi +80104381: 5f pop %edi +80104382: 5d pop %ebp +80104383: c3 ret +80104384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80104388: 31 d2 xor %edx,%edx +8010438a: 85 db test %ebx,%ebx +8010438c: 74 f1 je 8010437f +8010438e: 66 90 xchg %ax,%ax +80104390: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +80104394: 88 0c 10 mov %cl,(%eax,%edx,1) +80104397: 83 c2 01 add $0x1,%edx +8010439a: 39 da cmp %ebx,%edx +8010439c: 75 f2 jne 80104390 +8010439e: 5b pop %ebx +8010439f: 5e pop %esi +801043a0: 5f pop %edi +801043a1: 5d pop %ebp +801043a2: c3 ret +801043a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801043a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801043b0 : +801043b0: 55 push %ebp +801043b1: 89 e5 mov %esp,%ebp +801043b3: 5d pop %ebp +801043b4: eb 8a jmp 80104340 +801043b6: 8d 76 00 lea 0x0(%esi),%esi +801043b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801043c0 : +801043c0: 55 push %ebp +801043c1: 89 e5 mov %esp,%ebp +801043c3: 56 push %esi +801043c4: 8b 75 10 mov 0x10(%ebp),%esi +801043c7: 53 push %ebx +801043c8: 8b 4d 08 mov 0x8(%ebp),%ecx +801043cb: 8b 5d 0c mov 0xc(%ebp),%ebx +801043ce: 85 f6 test %esi,%esi +801043d0: 74 30 je 80104402 +801043d2: 0f b6 01 movzbl (%ecx),%eax +801043d5: 84 c0 test %al,%al +801043d7: 74 2f je 80104408 +801043d9: 0f b6 13 movzbl (%ebx),%edx +801043dc: 38 d0 cmp %dl,%al +801043de: 75 46 jne 80104426 +801043e0: 8d 51 01 lea 0x1(%ecx),%edx +801043e3: 01 ce add %ecx,%esi +801043e5: eb 14 jmp 801043fb +801043e7: 90 nop +801043e8: 0f b6 02 movzbl (%edx),%eax +801043eb: 84 c0 test %al,%al +801043ed: 74 31 je 80104420 +801043ef: 0f b6 19 movzbl (%ecx),%ebx +801043f2: 83 c2 01 add $0x1,%edx +801043f5: 38 d8 cmp %bl,%al +801043f7: 75 17 jne 80104410 +801043f9: 89 cb mov %ecx,%ebx +801043fb: 39 f2 cmp %esi,%edx +801043fd: 8d 4b 01 lea 0x1(%ebx),%ecx +80104400: 75 e6 jne 801043e8 +80104402: 5b pop %ebx +80104403: 31 c0 xor %eax,%eax +80104405: 5e pop %esi +80104406: 5d pop %ebp +80104407: c3 ret +80104408: 0f b6 1b movzbl (%ebx),%ebx +8010440b: 31 c0 xor %eax,%eax +8010440d: 8d 76 00 lea 0x0(%esi),%esi +80104410: 0f b6 d3 movzbl %bl,%edx +80104413: 29 d0 sub %edx,%eax +80104415: 5b pop %ebx +80104416: 5e pop %esi +80104417: 5d pop %ebp +80104418: c3 ret +80104419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80104420: 0f b6 5b 01 movzbl 0x1(%ebx),%ebx +80104424: eb ea jmp 80104410 +80104426: 89 d3 mov %edx,%ebx +80104428: eb e6 jmp 80104410 +8010442a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80104430 : +80104430: 55 push %ebp +80104431: 89 e5 mov %esp,%ebp +80104433: 8b 45 08 mov 0x8(%ebp),%eax +80104436: 56 push %esi +80104437: 8b 4d 10 mov 0x10(%ebp),%ecx +8010443a: 53 push %ebx +8010443b: 8b 5d 0c mov 0xc(%ebp),%ebx +8010443e: 89 c2 mov %eax,%edx +80104440: eb 19 jmp 8010445b +80104442: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80104448: 83 c3 01 add $0x1,%ebx +8010444b: 0f b6 4b ff movzbl -0x1(%ebx),%ecx +8010444f: 83 c2 01 add $0x1,%edx +80104452: 84 c9 test %cl,%cl +80104454: 88 4a ff mov %cl,-0x1(%edx) +80104457: 74 09 je 80104462 +80104459: 89 f1 mov %esi,%ecx +8010445b: 85 c9 test %ecx,%ecx +8010445d: 8d 71 ff lea -0x1(%ecx),%esi +80104460: 7f e6 jg 80104448 +80104462: 31 c9 xor %ecx,%ecx +80104464: 85 f6 test %esi,%esi +80104466: 7e 0f jle 80104477 +80104468: c6 04 0a 00 movb $0x0,(%edx,%ecx,1) +8010446c: 89 f3 mov %esi,%ebx +8010446e: 83 c1 01 add $0x1,%ecx +80104471: 29 cb sub %ecx,%ebx +80104473: 85 db test %ebx,%ebx +80104475: 7f f1 jg 80104468 +80104477: 5b pop %ebx +80104478: 5e pop %esi +80104479: 5d pop %ebp +8010447a: c3 ret +8010447b: 90 nop +8010447c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104480 : +80104480: 55 push %ebp +80104481: 89 e5 mov %esp,%ebp +80104483: 8b 4d 10 mov 0x10(%ebp),%ecx +80104486: 56 push %esi +80104487: 8b 45 08 mov 0x8(%ebp),%eax +8010448a: 53 push %ebx +8010448b: 8b 55 0c mov 0xc(%ebp),%edx +8010448e: 85 c9 test %ecx,%ecx +80104490: 7e 26 jle 801044b8 +80104492: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi +80104496: 89 c1 mov %eax,%ecx +80104498: eb 17 jmp 801044b1 +8010449a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801044a0: 83 c2 01 add $0x1,%edx +801044a3: 0f b6 5a ff movzbl -0x1(%edx),%ebx +801044a7: 83 c1 01 add $0x1,%ecx +801044aa: 84 db test %bl,%bl +801044ac: 88 59 ff mov %bl,-0x1(%ecx) +801044af: 74 04 je 801044b5 +801044b1: 39 f2 cmp %esi,%edx +801044b3: 75 eb jne 801044a0 +801044b5: c6 01 00 movb $0x0,(%ecx) +801044b8: 5b pop %ebx +801044b9: 5e pop %esi +801044ba: 5d pop %ebp +801044bb: c3 ret +801044bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +801044c0 : +801044c0: 55 push %ebp +801044c1: 31 c0 xor %eax,%eax +801044c3: 89 e5 mov %esp,%ebp +801044c5: 8b 55 08 mov 0x8(%ebp),%edx +801044c8: 80 3a 00 cmpb $0x0,(%edx) +801044cb: 74 0c je 801044d9 +801044cd: 8d 76 00 lea 0x0(%esi),%esi +801044d0: 83 c0 01 add $0x1,%eax +801044d3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) +801044d7: 75 f7 jne 801044d0 +801044d9: 5d pop %ebp +801044da: c3 ret + +801044db : +801044db: 8b 44 24 04 mov 0x4(%esp),%eax +801044df: 8b 54 24 08 mov 0x8(%esp),%edx +801044e3: 55 push %ebp +801044e4: 53 push %ebx +801044e5: 56 push %esi +801044e6: 57 push %edi +801044e7: 89 20 mov %esp,(%eax) +801044e9: 89 d4 mov %edx,%esp +801044eb: 5f pop %edi +801044ec: 5e pop %esi +801044ed: 5b pop %ebx +801044ee: 5d pop %ebp +801044ef: c3 ret + +801044f0 : +// 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) +{ +801044f0: 55 push %ebp +801044f1: 89 e5 mov %esp,%ebp +801044f3: 53 push %ebx +801044f4: 83 ec 04 sub $0x4,%esp +801044f7: 8b 5d 08 mov 0x8(%ebp),%ebx + struct proc *curproc = myproc(); +801044fa: e8 a1 f1 ff ff call 801036a0 + + if(addr >= curproc->sz || addr+4 > curproc->sz) +801044ff: 8b 00 mov (%eax),%eax +80104501: 39 d8 cmp %ebx,%eax +80104503: 76 1b jbe 80104520 +80104505: 8d 53 04 lea 0x4(%ebx),%edx +80104508: 39 d0 cmp %edx,%eax +8010450a: 72 14 jb 80104520 + return -1; + *ip = *(int*)(addr); +8010450c: 8b 45 0c mov 0xc(%ebp),%eax +8010450f: 8b 13 mov (%ebx),%edx +80104511: 89 10 mov %edx,(%eax) + return 0; +80104513: 31 c0 xor %eax,%eax +} +80104515: 83 c4 04 add $0x4,%esp +80104518: 5b pop %ebx +80104519: 5d pop %ebp +8010451a: c3 ret +8010451b: 90 nop +8010451c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +80104520: b8 ff ff ff ff mov $0xffffffff,%eax +80104525: eb ee jmp 80104515 +80104527: 89 f6 mov %esi,%esi +80104529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80104530 : +// 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) +{ +80104530: 55 push %ebp +80104531: 89 e5 mov %esp,%ebp +80104533: 53 push %ebx +80104534: 83 ec 04 sub $0x4,%esp +80104537: 8b 5d 08 mov 0x8(%ebp),%ebx + char *s, *ep; + struct proc *curproc = myproc(); +8010453a: e8 61 f1 ff ff call 801036a0 + + if(addr >= curproc->sz) +8010453f: 39 18 cmp %ebx,(%eax) +80104541: 76 26 jbe 80104569 + return -1; + *pp = (char*)addr; +80104543: 8b 4d 0c mov 0xc(%ebp),%ecx +80104546: 89 da mov %ebx,%edx +80104548: 89 19 mov %ebx,(%ecx) + ep = (char*)curproc->sz; +8010454a: 8b 00 mov (%eax),%eax + for(s = *pp; s < ep; s++){ +8010454c: 39 c3 cmp %eax,%ebx +8010454e: 73 19 jae 80104569 + if(*s == 0) +80104550: 80 3b 00 cmpb $0x0,(%ebx) +80104553: 75 0d jne 80104562 +80104555: eb 21 jmp 80104578 +80104557: 90 nop +80104558: 80 3a 00 cmpb $0x0,(%edx) +8010455b: 90 nop +8010455c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80104560: 74 16 je 80104578 + for(s = *pp; s < ep; s++){ +80104562: 83 c2 01 add $0x1,%edx +80104565: 39 d0 cmp %edx,%eax +80104567: 77 ef ja 80104558 + return s - *pp; + } + return -1; +} +80104569: 83 c4 04 add $0x4,%esp + return -1; +8010456c: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104571: 5b pop %ebx +80104572: 5d pop %ebp +80104573: c3 ret +80104574: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80104578: 83 c4 04 add $0x4,%esp + return s - *pp; +8010457b: 89 d0 mov %edx,%eax +8010457d: 29 d8 sub %ebx,%eax +} +8010457f: 5b pop %ebx +80104580: 5d pop %ebp +80104581: c3 ret +80104582: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80104589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80104590 : + +// Fetch the nth 32-bit system call argument. +int +argint(int n, int *ip) +{ +80104590: 55 push %ebp +80104591: 89 e5 mov %esp,%ebp +80104593: 56 push %esi +80104594: 8b 75 0c mov 0xc(%ebp),%esi +80104597: 53 push %ebx +80104598: 8b 5d 08 mov 0x8(%ebp),%ebx + return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); +8010459b: e8 00 f1 ff ff call 801036a0 +801045a0: 89 75 0c mov %esi,0xc(%ebp) +801045a3: 8b 40 18 mov 0x18(%eax),%eax +801045a6: 8b 40 44 mov 0x44(%eax),%eax +801045a9: 8d 44 98 04 lea 0x4(%eax,%ebx,4),%eax +801045ad: 89 45 08 mov %eax,0x8(%ebp) +} +801045b0: 5b pop %ebx +801045b1: 5e pop %esi +801045b2: 5d pop %ebp + return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); +801045b3: e9 38 ff ff ff jmp 801044f0 +801045b8: 90 nop +801045b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +801045c0 : +// Fetch the nth word-sized system call argument as a pointer +// to a block of memory of size bytes. Check that the pointer +// lies within the process address space. +int +argptr(int n, char **pp, int size) +{ +801045c0: 55 push %ebp +801045c1: 89 e5 mov %esp,%ebp +801045c3: 56 push %esi +801045c4: 53 push %ebx +801045c5: 83 ec 20 sub $0x20,%esp +801045c8: 8b 5d 10 mov 0x10(%ebp),%ebx + int i; + struct proc *curproc = myproc(); +801045cb: e8 d0 f0 ff ff call 801036a0 +801045d0: 89 c6 mov %eax,%esi + + if(argint(n, &i) < 0) +801045d2: 8d 45 f4 lea -0xc(%ebp),%eax +801045d5: 89 44 24 04 mov %eax,0x4(%esp) +801045d9: 8b 45 08 mov 0x8(%ebp),%eax +801045dc: 89 04 24 mov %eax,(%esp) +801045df: e8 ac ff ff ff call 80104590 +801045e4: 85 c0 test %eax,%eax +801045e6: 78 28 js 80104610 + return -1; + if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) +801045e8: 85 db test %ebx,%ebx +801045ea: 78 24 js 80104610 +801045ec: 8b 55 f4 mov -0xc(%ebp),%edx +801045ef: 8b 06 mov (%esi),%eax +801045f1: 39 c2 cmp %eax,%edx +801045f3: 73 1b jae 80104610 +801045f5: 01 d3 add %edx,%ebx +801045f7: 39 d8 cmp %ebx,%eax +801045f9: 72 15 jb 80104610 + return -1; + *pp = (char*)i; +801045fb: 8b 45 0c mov 0xc(%ebp),%eax +801045fe: 89 10 mov %edx,(%eax) + return 0; +} +80104600: 83 c4 20 add $0x20,%esp + return 0; +80104603: 31 c0 xor %eax,%eax +} +80104605: 5b pop %ebx +80104606: 5e pop %esi +80104607: 5d pop %ebp +80104608: c3 ret +80104609: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80104610: 83 c4 20 add $0x20,%esp + return -1; +80104613: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104618: 5b pop %ebx +80104619: 5e pop %esi +8010461a: 5d pop %ebp +8010461b: c3 ret +8010461c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104620 : +// 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) +{ +80104620: 55 push %ebp +80104621: 89 e5 mov %esp,%ebp +80104623: 83 ec 28 sub $0x28,%esp + int addr; + if(argint(n, &addr) < 0) +80104626: 8d 45 f4 lea -0xc(%ebp),%eax +80104629: 89 44 24 04 mov %eax,0x4(%esp) +8010462d: 8b 45 08 mov 0x8(%ebp),%eax +80104630: 89 04 24 mov %eax,(%esp) +80104633: e8 58 ff ff ff call 80104590 +80104638: 85 c0 test %eax,%eax +8010463a: 78 14 js 80104650 + return -1; + return fetchstr(addr, pp); +8010463c: 8b 45 0c mov 0xc(%ebp),%eax +8010463f: 89 44 24 04 mov %eax,0x4(%esp) +80104643: 8b 45 f4 mov -0xc(%ebp),%eax +80104646: 89 04 24 mov %eax,(%esp) +80104649: e8 e2 fe ff ff call 80104530 +} +8010464e: c9 leave +8010464f: c3 ret + return -1; +80104650: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104655: c9 leave +80104656: c3 ret +80104657: 89 f6 mov %esi,%esi +80104659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80104660 : +[SYS_close] sys_close, +}; + +void +syscall(void) +{ +80104660: 55 push %ebp +80104661: 89 e5 mov %esp,%ebp +80104663: 56 push %esi +80104664: 53 push %ebx +80104665: 83 ec 10 sub $0x10,%esp + int num; + struct proc *curproc = myproc(); +80104668: e8 33 f0 ff ff call 801036a0 + + num = curproc->tf->eax; +8010466d: 8b 70 18 mov 0x18(%eax),%esi + struct proc *curproc = myproc(); +80104670: 89 c3 mov %eax,%ebx + num = curproc->tf->eax; +80104672: 8b 46 1c mov 0x1c(%esi),%eax + if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { +80104675: 8d 50 ff lea -0x1(%eax),%edx +80104678: 83 fa 14 cmp $0x14,%edx +8010467b: 77 1b ja 80104698 +8010467d: 8b 14 85 20 73 10 80 mov -0x7fef8ce0(,%eax,4),%edx +80104684: 85 d2 test %edx,%edx +80104686: 74 10 je 80104698 + curproc->tf->eax = syscalls[num](); +80104688: ff d2 call *%edx +8010468a: 89 46 1c mov %eax,0x1c(%esi) + } else { + cprintf("%d %s: unknown sys call %d\n", + curproc->pid, curproc->name, num); + curproc->tf->eax = -1; + } +} +8010468d: 83 c4 10 add $0x10,%esp +80104690: 5b pop %ebx +80104691: 5e pop %esi +80104692: 5d pop %ebp +80104693: c3 ret +80104694: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + cprintf("%d %s: unknown sys call %d\n", +80104698: 89 44 24 0c mov %eax,0xc(%esp) + curproc->pid, curproc->name, num); +8010469c: 8d 43 6c lea 0x6c(%ebx),%eax +8010469f: 89 44 24 08 mov %eax,0x8(%esp) + cprintf("%d %s: unknown sys call %d\n", +801046a3: 8b 43 10 mov 0x10(%ebx),%eax +801046a6: c7 04 24 f1 72 10 80 movl $0x801072f1,(%esp) +801046ad: 89 44 24 04 mov %eax,0x4(%esp) +801046b1: e8 9a bf ff ff call 80100650 + curproc->tf->eax = -1; +801046b6: 8b 43 18 mov 0x18(%ebx),%eax +801046b9: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) +} +801046c0: 83 c4 10 add $0x10,%esp +801046c3: 5b pop %ebx +801046c4: 5e pop %esi +801046c5: 5d pop %ebp +801046c6: c3 ret +801046c7: 66 90 xchg %ax,%ax +801046c9: 66 90 xchg %ax,%ax +801046cb: 66 90 xchg %ax,%ax +801046cd: 66 90 xchg %ax,%ax +801046cf: 90 nop + +801046d0 : + +// Allocate a file descriptor for the given file. +// Takes over file reference from caller on success. +static int +fdalloc(struct file *f) +{ +801046d0: 55 push %ebp +801046d1: 89 e5 mov %esp,%ebp +801046d3: 53 push %ebx +801046d4: 89 c3 mov %eax,%ebx +801046d6: 83 ec 04 sub $0x4,%esp + int fd; + struct proc *curproc = myproc(); +801046d9: e8 c2 ef ff ff call 801036a0 + + for(fd = 0; fd < NOFILE; fd++){ +801046de: 31 d2 xor %edx,%edx + if(curproc->ofile[fd] == 0){ +801046e0: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx +801046e4: 85 c9 test %ecx,%ecx +801046e6: 74 18 je 80104700 + for(fd = 0; fd < NOFILE; fd++){ +801046e8: 83 c2 01 add $0x1,%edx +801046eb: 83 fa 10 cmp $0x10,%edx +801046ee: 75 f0 jne 801046e0 + curproc->ofile[fd] = f; + return fd; + } + } + return -1; +} +801046f0: 83 c4 04 add $0x4,%esp + return -1; +801046f3: b8 ff ff ff ff mov $0xffffffff,%eax +} +801046f8: 5b pop %ebx +801046f9: 5d pop %ebp +801046fa: c3 ret +801046fb: 90 nop +801046fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + curproc->ofile[fd] = f; +80104700: 89 5c 90 28 mov %ebx,0x28(%eax,%edx,4) +} +80104704: 83 c4 04 add $0x4,%esp + return fd; +80104707: 89 d0 mov %edx,%eax +} +80104709: 5b pop %ebx +8010470a: 5d pop %ebp +8010470b: c3 ret +8010470c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104710 : + return -1; +} + +static struct inode* +create(char *path, short type, short major, short minor) +{ +80104710: 55 push %ebp +80104711: 89 e5 mov %esp,%ebp +80104713: 57 push %edi +80104714: 56 push %esi +80104715: 53 push %ebx +80104716: 83 ec 3c sub $0x3c,%esp +80104719: 89 4d d0 mov %ecx,-0x30(%ebp) +8010471c: 8b 4d 08 mov 0x8(%ebp),%ecx + struct inode *ip, *dp; + char name[DIRSIZ]; + + if((dp = nameiparent(path, name)) == 0) +8010471f: 8d 5d da lea -0x26(%ebp),%ebx +80104722: 89 5c 24 04 mov %ebx,0x4(%esp) +80104726: 89 04 24 mov %eax,(%esp) +{ +80104729: 89 55 d4 mov %edx,-0x2c(%ebp) +8010472c: 89 4d cc mov %ecx,-0x34(%ebp) + if((dp = nameiparent(path, name)) == 0) +8010472f: e8 ec d7 ff ff call 80101f20 +80104734: 85 c0 test %eax,%eax +80104736: 89 c7 mov %eax,%edi +80104738: 0f 84 da 00 00 00 je 80104818 + return 0; + ilock(dp); +8010473e: 89 04 24 mov %eax,(%esp) +80104741: e8 6a cf ff ff call 801016b0 + + if((ip = dirlookup(dp, name, 0)) != 0){ +80104746: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +8010474d: 00 +8010474e: 89 5c 24 04 mov %ebx,0x4(%esp) +80104752: 89 3c 24 mov %edi,(%esp) +80104755: e8 66 d4 ff ff call 80101bc0 +8010475a: 85 c0 test %eax,%eax +8010475c: 89 c6 mov %eax,%esi +8010475e: 74 40 je 801047a0 + iunlockput(dp); +80104760: 89 3c 24 mov %edi,(%esp) +80104763: e8 a8 d1 ff ff call 80101910 + ilock(ip); +80104768: 89 34 24 mov %esi,(%esp) +8010476b: e8 40 cf ff ff call 801016b0 + if(type == T_FILE && ip->type == T_FILE) +80104770: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) +80104775: 75 11 jne 80104788 +80104777: 66 83 7e 50 02 cmpw $0x2,0x50(%esi) +8010477c: 89 f0 mov %esi,%eax +8010477e: 75 08 jne 80104788 + panic("create: dirlink"); + + iunlockput(dp); + + return ip; +} +80104780: 83 c4 3c add $0x3c,%esp +80104783: 5b pop %ebx +80104784: 5e pop %esi +80104785: 5f pop %edi +80104786: 5d pop %ebp +80104787: c3 ret + iunlockput(ip); +80104788: 89 34 24 mov %esi,(%esp) +8010478b: e8 80 d1 ff ff call 80101910 +} +80104790: 83 c4 3c add $0x3c,%esp + return 0; +80104793: 31 c0 xor %eax,%eax +} +80104795: 5b pop %ebx +80104796: 5e pop %esi +80104797: 5f pop %edi +80104798: 5d pop %ebp +80104799: c3 ret +8010479a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if((ip = ialloc(dp->dev, type)) == 0) +801047a0: 0f bf 45 d4 movswl -0x2c(%ebp),%eax +801047a4: 89 44 24 04 mov %eax,0x4(%esp) +801047a8: 8b 07 mov (%edi),%eax +801047aa: 89 04 24 mov %eax,(%esp) +801047ad: e8 6e cd ff ff call 80101520 +801047b2: 85 c0 test %eax,%eax +801047b4: 89 c6 mov %eax,%esi +801047b6: 0f 84 bf 00 00 00 je 8010487b + ilock(ip); +801047bc: 89 04 24 mov %eax,(%esp) +801047bf: e8 ec ce ff ff call 801016b0 + ip->major = major; +801047c4: 0f b7 45 d0 movzwl -0x30(%ebp),%eax +801047c8: 66 89 46 52 mov %ax,0x52(%esi) + ip->minor = minor; +801047cc: 0f b7 45 cc movzwl -0x34(%ebp),%eax +801047d0: 66 89 46 54 mov %ax,0x54(%esi) + ip->nlink = 1; +801047d4: b8 01 00 00 00 mov $0x1,%eax +801047d9: 66 89 46 56 mov %ax,0x56(%esi) + iupdate(ip); +801047dd: 89 34 24 mov %esi,(%esp) +801047e0: e8 0b ce ff ff call 801015f0 + if(type == T_DIR){ // Create . and .. entries. +801047e5: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) +801047ea: 74 34 je 80104820 + if(dirlink(dp, name, ip->inum) < 0) +801047ec: 8b 46 04 mov 0x4(%esi),%eax +801047ef: 89 5c 24 04 mov %ebx,0x4(%esp) +801047f3: 89 3c 24 mov %edi,(%esp) +801047f6: 89 44 24 08 mov %eax,0x8(%esp) +801047fa: e8 21 d6 ff ff call 80101e20 +801047ff: 85 c0 test %eax,%eax +80104801: 78 6c js 8010486f + iunlockput(dp); +80104803: 89 3c 24 mov %edi,(%esp) +80104806: e8 05 d1 ff ff call 80101910 +} +8010480b: 83 c4 3c add $0x3c,%esp + return ip; +8010480e: 89 f0 mov %esi,%eax +} +80104810: 5b pop %ebx +80104811: 5e pop %esi +80104812: 5f pop %edi +80104813: 5d pop %ebp +80104814: c3 ret +80104815: 8d 76 00 lea 0x0(%esi),%esi + return 0; +80104818: 31 c0 xor %eax,%eax +8010481a: e9 61 ff ff ff jmp 80104780 +8010481f: 90 nop + dp->nlink++; // for ".." +80104820: 66 83 47 56 01 addw $0x1,0x56(%edi) + iupdate(dp); +80104825: 89 3c 24 mov %edi,(%esp) +80104828: e8 c3 cd ff ff call 801015f0 + if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) +8010482d: 8b 46 04 mov 0x4(%esi),%eax +80104830: c7 44 24 04 94 73 10 movl $0x80107394,0x4(%esp) +80104837: 80 +80104838: 89 34 24 mov %esi,(%esp) +8010483b: 89 44 24 08 mov %eax,0x8(%esp) +8010483f: e8 dc d5 ff ff call 80101e20 +80104844: 85 c0 test %eax,%eax +80104846: 78 1b js 80104863 +80104848: 8b 47 04 mov 0x4(%edi),%eax +8010484b: c7 44 24 04 93 73 10 movl $0x80107393,0x4(%esp) +80104852: 80 +80104853: 89 34 24 mov %esi,(%esp) +80104856: 89 44 24 08 mov %eax,0x8(%esp) +8010485a: e8 c1 d5 ff ff call 80101e20 +8010485f: 85 c0 test %eax,%eax +80104861: 79 89 jns 801047ec + panic("create dots"); +80104863: c7 04 24 87 73 10 80 movl $0x80107387,(%esp) +8010486a: e8 f1 ba ff ff call 80100360 + panic("create: dirlink"); +8010486f: c7 04 24 96 73 10 80 movl $0x80107396,(%esp) +80104876: e8 e5 ba ff ff call 80100360 + panic("create: ialloc"); +8010487b: c7 04 24 78 73 10 80 movl $0x80107378,(%esp) +80104882: e8 d9 ba ff ff call 80100360 +80104887: 89 f6 mov %esi,%esi +80104889: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80104890 : +argfd(int n, int *pfd, struct file **pf) +80104890: 55 push %ebp +80104891: 89 e5 mov %esp,%ebp +80104893: 56 push %esi +80104894: 89 c6 mov %eax,%esi +80104896: 53 push %ebx +80104897: 89 d3 mov %edx,%ebx +80104899: 83 ec 20 sub $0x20,%esp + if(argint(n, &fd) < 0) +8010489c: 8d 45 f4 lea -0xc(%ebp),%eax +8010489f: 89 44 24 04 mov %eax,0x4(%esp) +801048a3: c7 04 24 00 00 00 00 movl $0x0,(%esp) +801048aa: e8 e1 fc ff ff call 80104590 +801048af: 85 c0 test %eax,%eax +801048b1: 78 2d js 801048e0 + if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) +801048b3: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) +801048b7: 77 27 ja 801048e0 +801048b9: e8 e2 ed ff ff call 801036a0 +801048be: 8b 55 f4 mov -0xc(%ebp),%edx +801048c1: 8b 44 90 28 mov 0x28(%eax,%edx,4),%eax +801048c5: 85 c0 test %eax,%eax +801048c7: 74 17 je 801048e0 + if(pfd) +801048c9: 85 f6 test %esi,%esi +801048cb: 74 02 je 801048cf + *pfd = fd; +801048cd: 89 16 mov %edx,(%esi) + if(pf) +801048cf: 85 db test %ebx,%ebx +801048d1: 74 1d je 801048f0 + *pf = f; +801048d3: 89 03 mov %eax,(%ebx) + return 0; +801048d5: 31 c0 xor %eax,%eax +} +801048d7: 83 c4 20 add $0x20,%esp +801048da: 5b pop %ebx +801048db: 5e pop %esi +801048dc: 5d pop %ebp +801048dd: c3 ret +801048de: 66 90 xchg %ax,%ax +801048e0: 83 c4 20 add $0x20,%esp + return -1; +801048e3: b8 ff ff ff ff mov $0xffffffff,%eax +} +801048e8: 5b pop %ebx +801048e9: 5e pop %esi +801048ea: 5d pop %ebp +801048eb: c3 ret +801048ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +801048f0: 31 c0 xor %eax,%eax +801048f2: eb e3 jmp 801048d7 +801048f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801048fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +80104900 : +{ +80104900: 55 push %ebp + if(argfd(0, 0, &f) < 0) +80104901: 31 c0 xor %eax,%eax +{ +80104903: 89 e5 mov %esp,%ebp +80104905: 53 push %ebx +80104906: 83 ec 24 sub $0x24,%esp + if(argfd(0, 0, &f) < 0) +80104909: 8d 55 f4 lea -0xc(%ebp),%edx +8010490c: e8 7f ff ff ff call 80104890 +80104911: 85 c0 test %eax,%eax +80104913: 78 23 js 80104938 + if((fd=fdalloc(f)) < 0) +80104915: 8b 45 f4 mov -0xc(%ebp),%eax +80104918: e8 b3 fd ff ff call 801046d0 +8010491d: 85 c0 test %eax,%eax +8010491f: 89 c3 mov %eax,%ebx +80104921: 78 15 js 80104938 + filedup(f); +80104923: 8b 45 f4 mov -0xc(%ebp),%eax +80104926: 89 04 24 mov %eax,(%esp) +80104929: e8 b2 c4 ff ff call 80100de0 + return fd; +8010492e: 89 d8 mov %ebx,%eax +} +80104930: 83 c4 24 add $0x24,%esp +80104933: 5b pop %ebx +80104934: 5d pop %ebp +80104935: c3 ret +80104936: 66 90 xchg %ax,%ax + return -1; +80104938: b8 ff ff ff ff mov $0xffffffff,%eax +8010493d: eb f1 jmp 80104930 +8010493f: 90 nop + +80104940 : +{ +80104940: 55 push %ebp + if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) +80104941: 31 c0 xor %eax,%eax +{ +80104943: 89 e5 mov %esp,%ebp +80104945: 83 ec 28 sub $0x28,%esp + if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) +80104948: 8d 55 ec lea -0x14(%ebp),%edx +8010494b: e8 40 ff ff ff call 80104890 +80104950: 85 c0 test %eax,%eax +80104952: 78 54 js 801049a8 +80104954: 8d 45 f0 lea -0x10(%ebp),%eax +80104957: 89 44 24 04 mov %eax,0x4(%esp) +8010495b: c7 04 24 02 00 00 00 movl $0x2,(%esp) +80104962: e8 29 fc ff ff call 80104590 +80104967: 85 c0 test %eax,%eax +80104969: 78 3d js 801049a8 +8010496b: 8b 45 f0 mov -0x10(%ebp),%eax +8010496e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +80104975: 89 44 24 08 mov %eax,0x8(%esp) +80104979: 8d 45 f4 lea -0xc(%ebp),%eax +8010497c: 89 44 24 04 mov %eax,0x4(%esp) +80104980: e8 3b fc ff ff call 801045c0 +80104985: 85 c0 test %eax,%eax +80104987: 78 1f js 801049a8 + return fileread(f, p, n); +80104989: 8b 45 f0 mov -0x10(%ebp),%eax +8010498c: 89 44 24 08 mov %eax,0x8(%esp) +80104990: 8b 45 f4 mov -0xc(%ebp),%eax +80104993: 89 44 24 04 mov %eax,0x4(%esp) +80104997: 8b 45 ec mov -0x14(%ebp),%eax +8010499a: 89 04 24 mov %eax,(%esp) +8010499d: e8 9e c5 ff ff call 80100f40 +} +801049a2: c9 leave +801049a3: c3 ret +801049a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +801049a8: b8 ff ff ff ff mov $0xffffffff,%eax +} +801049ad: c9 leave +801049ae: c3 ret +801049af: 90 nop + +801049b0 : +{ +801049b0: 55 push %ebp + if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) +801049b1: 31 c0 xor %eax,%eax +{ +801049b3: 89 e5 mov %esp,%ebp +801049b5: 83 ec 28 sub $0x28,%esp + if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) +801049b8: 8d 55 ec lea -0x14(%ebp),%edx +801049bb: e8 d0 fe ff ff call 80104890 +801049c0: 85 c0 test %eax,%eax +801049c2: 78 54 js 80104a18 +801049c4: 8d 45 f0 lea -0x10(%ebp),%eax +801049c7: 89 44 24 04 mov %eax,0x4(%esp) +801049cb: c7 04 24 02 00 00 00 movl $0x2,(%esp) +801049d2: e8 b9 fb ff ff call 80104590 +801049d7: 85 c0 test %eax,%eax +801049d9: 78 3d js 80104a18 +801049db: 8b 45 f0 mov -0x10(%ebp),%eax +801049de: c7 04 24 01 00 00 00 movl $0x1,(%esp) +801049e5: 89 44 24 08 mov %eax,0x8(%esp) +801049e9: 8d 45 f4 lea -0xc(%ebp),%eax +801049ec: 89 44 24 04 mov %eax,0x4(%esp) +801049f0: e8 cb fb ff ff call 801045c0 +801049f5: 85 c0 test %eax,%eax +801049f7: 78 1f js 80104a18 + return filewrite(f, p, n); +801049f9: 8b 45 f0 mov -0x10(%ebp),%eax +801049fc: 89 44 24 08 mov %eax,0x8(%esp) +80104a00: 8b 45 f4 mov -0xc(%ebp),%eax +80104a03: 89 44 24 04 mov %eax,0x4(%esp) +80104a07: 8b 45 ec mov -0x14(%ebp),%eax +80104a0a: 89 04 24 mov %eax,(%esp) +80104a0d: e8 ce c5 ff ff call 80100fe0 +} +80104a12: c9 leave +80104a13: c3 ret +80104a14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +80104a18: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104a1d: c9 leave +80104a1e: c3 ret +80104a1f: 90 nop + +80104a20 : +{ +80104a20: 55 push %ebp +80104a21: 89 e5 mov %esp,%ebp +80104a23: 83 ec 28 sub $0x28,%esp + if(argfd(0, &fd, &f) < 0) +80104a26: 8d 55 f4 lea -0xc(%ebp),%edx +80104a29: 8d 45 f0 lea -0x10(%ebp),%eax +80104a2c: e8 5f fe ff ff call 80104890 +80104a31: 85 c0 test %eax,%eax +80104a33: 78 23 js 80104a58 + myproc()->ofile[fd] = 0; +80104a35: e8 66 ec ff ff call 801036a0 +80104a3a: 8b 55 f0 mov -0x10(%ebp),%edx +80104a3d: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4) +80104a44: 00 + fileclose(f); +80104a45: 8b 45 f4 mov -0xc(%ebp),%eax +80104a48: 89 04 24 mov %eax,(%esp) +80104a4b: e8 e0 c3 ff ff call 80100e30 + return 0; +80104a50: 31 c0 xor %eax,%eax +} +80104a52: c9 leave +80104a53: c3 ret +80104a54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +80104a58: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104a5d: c9 leave +80104a5e: c3 ret +80104a5f: 90 nop + +80104a60 : +{ +80104a60: 55 push %ebp + if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) +80104a61: 31 c0 xor %eax,%eax +{ +80104a63: 89 e5 mov %esp,%ebp +80104a65: 83 ec 28 sub $0x28,%esp + if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) +80104a68: 8d 55 f0 lea -0x10(%ebp),%edx +80104a6b: e8 20 fe ff ff call 80104890 +80104a70: 85 c0 test %eax,%eax +80104a72: 78 34 js 80104aa8 +80104a74: 8d 45 f4 lea -0xc(%ebp),%eax +80104a77: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) +80104a7e: 00 +80104a7f: 89 44 24 04 mov %eax,0x4(%esp) +80104a83: c7 04 24 01 00 00 00 movl $0x1,(%esp) +80104a8a: e8 31 fb ff ff call 801045c0 +80104a8f: 85 c0 test %eax,%eax +80104a91: 78 15 js 80104aa8 + return filestat(f, st); +80104a93: 8b 45 f4 mov -0xc(%ebp),%eax +80104a96: 89 44 24 04 mov %eax,0x4(%esp) +80104a9a: 8b 45 f0 mov -0x10(%ebp),%eax +80104a9d: 89 04 24 mov %eax,(%esp) +80104aa0: e8 4b c4 ff ff call 80100ef0 +} +80104aa5: c9 leave +80104aa6: c3 ret +80104aa7: 90 nop + return -1; +80104aa8: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104aad: c9 leave +80104aae: c3 ret +80104aaf: 90 nop + +80104ab0 : +{ +80104ab0: 55 push %ebp +80104ab1: 89 e5 mov %esp,%ebp +80104ab3: 57 push %edi +80104ab4: 56 push %esi +80104ab5: 53 push %ebx +80104ab6: 83 ec 3c sub $0x3c,%esp + if(argstr(0, &old) < 0 || argstr(1, &new) < 0) +80104ab9: 8d 45 d4 lea -0x2c(%ebp),%eax +80104abc: 89 44 24 04 mov %eax,0x4(%esp) +80104ac0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104ac7: e8 54 fb ff ff call 80104620 +80104acc: 85 c0 test %eax,%eax +80104ace: 0f 88 e6 00 00 00 js 80104bba +80104ad4: 8d 45 d0 lea -0x30(%ebp),%eax +80104ad7: 89 44 24 04 mov %eax,0x4(%esp) +80104adb: c7 04 24 01 00 00 00 movl $0x1,(%esp) +80104ae2: e8 39 fb ff ff call 80104620 +80104ae7: 85 c0 test %eax,%eax +80104ae9: 0f 88 cb 00 00 00 js 80104bba + begin_op(); +80104aef: e8 1c e0 ff ff call 80102b10 + if((ip = namei(old)) == 0){ +80104af4: 8b 45 d4 mov -0x2c(%ebp),%eax +80104af7: 89 04 24 mov %eax,(%esp) +80104afa: e8 01 d4 ff ff call 80101f00 +80104aff: 85 c0 test %eax,%eax +80104b01: 89 c3 mov %eax,%ebx +80104b03: 0f 84 ac 00 00 00 je 80104bb5 + ilock(ip); +80104b09: 89 04 24 mov %eax,(%esp) +80104b0c: e8 9f cb ff ff call 801016b0 + if(ip->type == T_DIR){ +80104b11: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +80104b16: 0f 84 91 00 00 00 je 80104bad + ip->nlink++; +80104b1c: 66 83 43 56 01 addw $0x1,0x56(%ebx) + if((dp = nameiparent(new, name)) == 0) +80104b21: 8d 7d da lea -0x26(%ebp),%edi + iupdate(ip); +80104b24: 89 1c 24 mov %ebx,(%esp) +80104b27: e8 c4 ca ff ff call 801015f0 + iunlock(ip); +80104b2c: 89 1c 24 mov %ebx,(%esp) +80104b2f: e8 5c cc ff ff call 80101790 + if((dp = nameiparent(new, name)) == 0) +80104b34: 8b 45 d0 mov -0x30(%ebp),%eax +80104b37: 89 7c 24 04 mov %edi,0x4(%esp) +80104b3b: 89 04 24 mov %eax,(%esp) +80104b3e: e8 dd d3 ff ff call 80101f20 +80104b43: 85 c0 test %eax,%eax +80104b45: 89 c6 mov %eax,%esi +80104b47: 74 4f je 80104b98 + ilock(dp); +80104b49: 89 04 24 mov %eax,(%esp) +80104b4c: e8 5f cb ff ff call 801016b0 + if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ +80104b51: 8b 03 mov (%ebx),%eax +80104b53: 39 06 cmp %eax,(%esi) +80104b55: 75 39 jne 80104b90 +80104b57: 8b 43 04 mov 0x4(%ebx),%eax +80104b5a: 89 7c 24 04 mov %edi,0x4(%esp) +80104b5e: 89 34 24 mov %esi,(%esp) +80104b61: 89 44 24 08 mov %eax,0x8(%esp) +80104b65: e8 b6 d2 ff ff call 80101e20 +80104b6a: 85 c0 test %eax,%eax +80104b6c: 78 22 js 80104b90 + iunlockput(dp); +80104b6e: 89 34 24 mov %esi,(%esp) +80104b71: e8 9a cd ff ff call 80101910 + iput(ip); +80104b76: 89 1c 24 mov %ebx,(%esp) +80104b79: e8 52 cc ff ff call 801017d0 + end_op(); +80104b7e: e8 fd df ff ff call 80102b80 +} +80104b83: 83 c4 3c add $0x3c,%esp + return 0; +80104b86: 31 c0 xor %eax,%eax +} +80104b88: 5b pop %ebx +80104b89: 5e pop %esi +80104b8a: 5f pop %edi +80104b8b: 5d pop %ebp +80104b8c: c3 ret +80104b8d: 8d 76 00 lea 0x0(%esi),%esi + iunlockput(dp); +80104b90: 89 34 24 mov %esi,(%esp) +80104b93: e8 78 cd ff ff call 80101910 + ilock(ip); +80104b98: 89 1c 24 mov %ebx,(%esp) +80104b9b: e8 10 cb ff ff call 801016b0 + ip->nlink--; +80104ba0: 66 83 6b 56 01 subw $0x1,0x56(%ebx) + iupdate(ip); +80104ba5: 89 1c 24 mov %ebx,(%esp) +80104ba8: e8 43 ca ff ff call 801015f0 + iunlockput(ip); +80104bad: 89 1c 24 mov %ebx,(%esp) +80104bb0: e8 5b cd ff ff call 80101910 + end_op(); +80104bb5: e8 c6 df ff ff call 80102b80 +} +80104bba: 83 c4 3c add $0x3c,%esp + return -1; +80104bbd: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104bc2: 5b pop %ebx +80104bc3: 5e pop %esi +80104bc4: 5f pop %edi +80104bc5: 5d pop %ebp +80104bc6: c3 ret +80104bc7: 89 f6 mov %esi,%esi +80104bc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80104bd0 : +{ +80104bd0: 55 push %ebp +80104bd1: 89 e5 mov %esp,%ebp +80104bd3: 57 push %edi +80104bd4: 56 push %esi +80104bd5: 53 push %ebx +80104bd6: 83 ec 5c sub $0x5c,%esp + if(argstr(0, &path) < 0) +80104bd9: 8d 45 c0 lea -0x40(%ebp),%eax +80104bdc: 89 44 24 04 mov %eax,0x4(%esp) +80104be0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104be7: e8 34 fa ff ff call 80104620 +80104bec: 85 c0 test %eax,%eax +80104bee: 0f 88 76 01 00 00 js 80104d6a + begin_op(); +80104bf4: e8 17 df ff ff call 80102b10 + if((dp = nameiparent(path, name)) == 0){ +80104bf9: 8b 45 c0 mov -0x40(%ebp),%eax +80104bfc: 8d 5d ca lea -0x36(%ebp),%ebx +80104bff: 89 5c 24 04 mov %ebx,0x4(%esp) +80104c03: 89 04 24 mov %eax,(%esp) +80104c06: e8 15 d3 ff ff call 80101f20 +80104c0b: 85 c0 test %eax,%eax +80104c0d: 89 45 b4 mov %eax,-0x4c(%ebp) +80104c10: 0f 84 4f 01 00 00 je 80104d65 + ilock(dp); +80104c16: 8b 75 b4 mov -0x4c(%ebp),%esi +80104c19: 89 34 24 mov %esi,(%esp) +80104c1c: e8 8f ca ff ff call 801016b0 + if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) +80104c21: c7 44 24 04 94 73 10 movl $0x80107394,0x4(%esp) +80104c28: 80 +80104c29: 89 1c 24 mov %ebx,(%esp) +80104c2c: e8 5f cf ff ff call 80101b90 +80104c31: 85 c0 test %eax,%eax +80104c33: 0f 84 21 01 00 00 je 80104d5a +80104c39: c7 44 24 04 93 73 10 movl $0x80107393,0x4(%esp) +80104c40: 80 +80104c41: 89 1c 24 mov %ebx,(%esp) +80104c44: e8 47 cf ff ff call 80101b90 +80104c49: 85 c0 test %eax,%eax +80104c4b: 0f 84 09 01 00 00 je 80104d5a + if((ip = dirlookup(dp, name, &off)) == 0) +80104c51: 8d 45 c4 lea -0x3c(%ebp),%eax +80104c54: 89 5c 24 04 mov %ebx,0x4(%esp) +80104c58: 89 44 24 08 mov %eax,0x8(%esp) +80104c5c: 89 34 24 mov %esi,(%esp) +80104c5f: e8 5c cf ff ff call 80101bc0 +80104c64: 85 c0 test %eax,%eax +80104c66: 89 c3 mov %eax,%ebx +80104c68: 0f 84 ec 00 00 00 je 80104d5a + ilock(ip); +80104c6e: 89 04 24 mov %eax,(%esp) +80104c71: e8 3a ca ff ff call 801016b0 + if(ip->nlink < 1) +80104c76: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) +80104c7b: 0f 8e 24 01 00 00 jle 80104da5 + if(ip->type == T_DIR && !isdirempty(ip)){ +80104c81: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +80104c86: 8d 75 d8 lea -0x28(%ebp),%esi +80104c89: 74 7d je 80104d08 + memset(&de, 0, sizeof(de)); +80104c8b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) +80104c92: 00 +80104c93: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80104c9a: 00 +80104c9b: 89 34 24 mov %esi,(%esp) +80104c9e: e8 fd f5 ff ff call 801042a0 + if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) +80104ca3: 8b 45 c4 mov -0x3c(%ebp),%eax +80104ca6: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) +80104cad: 00 +80104cae: 89 74 24 04 mov %esi,0x4(%esp) +80104cb2: 89 44 24 08 mov %eax,0x8(%esp) +80104cb6: 8b 45 b4 mov -0x4c(%ebp),%eax +80104cb9: 89 04 24 mov %eax,(%esp) +80104cbc: e8 9f cd ff ff call 80101a60 +80104cc1: 83 f8 10 cmp $0x10,%eax +80104cc4: 0f 85 cf 00 00 00 jne 80104d99 + if(ip->type == T_DIR){ +80104cca: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +80104ccf: 0f 84 a3 00 00 00 je 80104d78 + iunlockput(dp); +80104cd5: 8b 45 b4 mov -0x4c(%ebp),%eax +80104cd8: 89 04 24 mov %eax,(%esp) +80104cdb: e8 30 cc ff ff call 80101910 + ip->nlink--; +80104ce0: 66 83 6b 56 01 subw $0x1,0x56(%ebx) + iupdate(ip); +80104ce5: 89 1c 24 mov %ebx,(%esp) +80104ce8: e8 03 c9 ff ff call 801015f0 + iunlockput(ip); +80104ced: 89 1c 24 mov %ebx,(%esp) +80104cf0: e8 1b cc ff ff call 80101910 + end_op(); +80104cf5: e8 86 de ff ff call 80102b80 +} +80104cfa: 83 c4 5c add $0x5c,%esp + return 0; +80104cfd: 31 c0 xor %eax,%eax +} +80104cff: 5b pop %ebx +80104d00: 5e pop %esi +80104d01: 5f pop %edi +80104d02: 5d pop %ebp +80104d03: c3 ret +80104d04: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + for(off=2*sizeof(de); offsize; off+=sizeof(de)){ +80104d08: 83 7b 58 20 cmpl $0x20,0x58(%ebx) +80104d0c: 0f 86 79 ff ff ff jbe 80104c8b +80104d12: bf 20 00 00 00 mov $0x20,%edi +80104d17: eb 15 jmp 80104d2e +80104d19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80104d20: 8d 57 10 lea 0x10(%edi),%edx +80104d23: 3b 53 58 cmp 0x58(%ebx),%edx +80104d26: 0f 83 5f ff ff ff jae 80104c8b +80104d2c: 89 d7 mov %edx,%edi + if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) +80104d2e: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) +80104d35: 00 +80104d36: 89 7c 24 08 mov %edi,0x8(%esp) +80104d3a: 89 74 24 04 mov %esi,0x4(%esp) +80104d3e: 89 1c 24 mov %ebx,(%esp) +80104d41: e8 1a cc ff ff call 80101960 +80104d46: 83 f8 10 cmp $0x10,%eax +80104d49: 75 42 jne 80104d8d + if(de.inum != 0) +80104d4b: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) +80104d50: 74 ce je 80104d20 + iunlockput(ip); +80104d52: 89 1c 24 mov %ebx,(%esp) +80104d55: e8 b6 cb ff ff call 80101910 + iunlockput(dp); +80104d5a: 8b 45 b4 mov -0x4c(%ebp),%eax +80104d5d: 89 04 24 mov %eax,(%esp) +80104d60: e8 ab cb ff ff call 80101910 + end_op(); +80104d65: e8 16 de ff ff call 80102b80 +} +80104d6a: 83 c4 5c add $0x5c,%esp + return -1; +80104d6d: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104d72: 5b pop %ebx +80104d73: 5e pop %esi +80104d74: 5f pop %edi +80104d75: 5d pop %ebp +80104d76: c3 ret +80104d77: 90 nop + dp->nlink--; +80104d78: 8b 45 b4 mov -0x4c(%ebp),%eax +80104d7b: 66 83 68 56 01 subw $0x1,0x56(%eax) + iupdate(dp); +80104d80: 89 04 24 mov %eax,(%esp) +80104d83: e8 68 c8 ff ff call 801015f0 +80104d88: e9 48 ff ff ff jmp 80104cd5 + panic("isdirempty: readi"); +80104d8d: c7 04 24 b8 73 10 80 movl $0x801073b8,(%esp) +80104d94: e8 c7 b5 ff ff call 80100360 + panic("unlink: writei"); +80104d99: c7 04 24 ca 73 10 80 movl $0x801073ca,(%esp) +80104da0: e8 bb b5 ff ff call 80100360 + panic("unlink: nlink < 1"); +80104da5: c7 04 24 a6 73 10 80 movl $0x801073a6,(%esp) +80104dac: e8 af b5 ff ff call 80100360 +80104db1: eb 0d jmp 80104dc0 +80104db3: 90 nop +80104db4: 90 nop +80104db5: 90 nop +80104db6: 90 nop +80104db7: 90 nop +80104db8: 90 nop +80104db9: 90 nop +80104dba: 90 nop +80104dbb: 90 nop +80104dbc: 90 nop +80104dbd: 90 nop +80104dbe: 90 nop +80104dbf: 90 nop + +80104dc0 : + +int +sys_open(void) +{ +80104dc0: 55 push %ebp +80104dc1: 89 e5 mov %esp,%ebp +80104dc3: 57 push %edi +80104dc4: 56 push %esi +80104dc5: 53 push %ebx +80104dc6: 83 ec 2c sub $0x2c,%esp + char *path; + int fd, omode; + struct file *f; + struct inode *ip; + + if(argstr(0, &path) < 0 || argint(1, &omode) < 0) +80104dc9: 8d 45 e0 lea -0x20(%ebp),%eax +80104dcc: 89 44 24 04 mov %eax,0x4(%esp) +80104dd0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104dd7: e8 44 f8 ff ff call 80104620 +80104ddc: 85 c0 test %eax,%eax +80104dde: 0f 88 d1 00 00 00 js 80104eb5 +80104de4: 8d 45 e4 lea -0x1c(%ebp),%eax +80104de7: 89 44 24 04 mov %eax,0x4(%esp) +80104deb: c7 04 24 01 00 00 00 movl $0x1,(%esp) +80104df2: e8 99 f7 ff ff call 80104590 +80104df7: 85 c0 test %eax,%eax +80104df9: 0f 88 b6 00 00 00 js 80104eb5 + return -1; + + begin_op(); +80104dff: e8 0c dd ff ff call 80102b10 + + if(omode & O_CREATE){ +80104e04: f6 45 e5 02 testb $0x2,-0x1b(%ebp) +80104e08: 0f 85 82 00 00 00 jne 80104e90 + if(ip == 0){ + end_op(); + return -1; + } + } else { + if((ip = namei(path)) == 0){ +80104e0e: 8b 45 e0 mov -0x20(%ebp),%eax +80104e11: 89 04 24 mov %eax,(%esp) +80104e14: e8 e7 d0 ff ff call 80101f00 +80104e19: 85 c0 test %eax,%eax +80104e1b: 89 c6 mov %eax,%esi +80104e1d: 0f 84 8d 00 00 00 je 80104eb0 + end_op(); + return -1; + } + ilock(ip); +80104e23: 89 04 24 mov %eax,(%esp) +80104e26: e8 85 c8 ff ff call 801016b0 + if(ip->type == T_DIR && omode != O_RDONLY){ +80104e2b: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) +80104e30: 0f 84 92 00 00 00 je 80104ec8 + end_op(); + return -1; + } + } + + if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ +80104e36: e8 35 bf ff ff call 80100d70 +80104e3b: 85 c0 test %eax,%eax +80104e3d: 89 c3 mov %eax,%ebx +80104e3f: 0f 84 93 00 00 00 je 80104ed8 +80104e45: e8 86 f8 ff ff call 801046d0 +80104e4a: 85 c0 test %eax,%eax +80104e4c: 89 c7 mov %eax,%edi +80104e4e: 0f 88 94 00 00 00 js 80104ee8 + fileclose(f); + iunlockput(ip); + end_op(); + return -1; + } + iunlock(ip); +80104e54: 89 34 24 mov %esi,(%esp) +80104e57: e8 34 c9 ff ff call 80101790 + end_op(); +80104e5c: e8 1f dd ff ff call 80102b80 + + f->type = FD_INODE; +80104e61: c7 03 02 00 00 00 movl $0x2,(%ebx) + f->ip = ip; + f->off = 0; + f->readable = !(omode & O_WRONLY); +80104e67: 8b 45 e4 mov -0x1c(%ebp),%eax + f->ip = ip; +80104e6a: 89 73 10 mov %esi,0x10(%ebx) + f->off = 0; +80104e6d: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) + f->readable = !(omode & O_WRONLY); +80104e74: 89 c2 mov %eax,%edx +80104e76: 83 e2 01 and $0x1,%edx +80104e79: 83 f2 01 xor $0x1,%edx + f->writable = (omode & O_WRONLY) || (omode & O_RDWR); +80104e7c: a8 03 test $0x3,%al + f->readable = !(omode & O_WRONLY); +80104e7e: 88 53 08 mov %dl,0x8(%ebx) + return fd; +80104e81: 89 f8 mov %edi,%eax + f->writable = (omode & O_WRONLY) || (omode & O_RDWR); +80104e83: 0f 95 43 09 setne 0x9(%ebx) +} +80104e87: 83 c4 2c add $0x2c,%esp +80104e8a: 5b pop %ebx +80104e8b: 5e pop %esi +80104e8c: 5f pop %edi +80104e8d: 5d pop %ebp +80104e8e: c3 ret +80104e8f: 90 nop + ip = create(path, T_FILE, 0, 0); +80104e90: 8b 45 e0 mov -0x20(%ebp),%eax +80104e93: 31 c9 xor %ecx,%ecx +80104e95: ba 02 00 00 00 mov $0x2,%edx +80104e9a: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104ea1: e8 6a f8 ff ff call 80104710 + if(ip == 0){ +80104ea6: 85 c0 test %eax,%eax + ip = create(path, T_FILE, 0, 0); +80104ea8: 89 c6 mov %eax,%esi + if(ip == 0){ +80104eaa: 75 8a jne 80104e36 +80104eac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + end_op(); +80104eb0: e8 cb dc ff ff call 80102b80 +} +80104eb5: 83 c4 2c add $0x2c,%esp + return -1; +80104eb8: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104ebd: 5b pop %ebx +80104ebe: 5e pop %esi +80104ebf: 5f pop %edi +80104ec0: 5d pop %ebp +80104ec1: c3 ret +80104ec2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if(ip->type == T_DIR && omode != O_RDONLY){ +80104ec8: 8b 45 e4 mov -0x1c(%ebp),%eax +80104ecb: 85 c0 test %eax,%eax +80104ecd: 0f 84 63 ff ff ff je 80104e36 +80104ed3: 90 nop +80104ed4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + iunlockput(ip); +80104ed8: 89 34 24 mov %esi,(%esp) +80104edb: e8 30 ca ff ff call 80101910 +80104ee0: eb ce jmp 80104eb0 +80104ee2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + fileclose(f); +80104ee8: 89 1c 24 mov %ebx,(%esp) +80104eeb: e8 40 bf ff ff call 80100e30 +80104ef0: eb e6 jmp 80104ed8 +80104ef2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80104ef9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80104f00 : + +int +sys_mkdir(void) +{ +80104f00: 55 push %ebp +80104f01: 89 e5 mov %esp,%ebp +80104f03: 83 ec 28 sub $0x28,%esp + char *path; + struct inode *ip; + + begin_op(); +80104f06: e8 05 dc ff ff call 80102b10 + if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ +80104f0b: 8d 45 f4 lea -0xc(%ebp),%eax +80104f0e: 89 44 24 04 mov %eax,0x4(%esp) +80104f12: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104f19: e8 02 f7 ff ff call 80104620 +80104f1e: 85 c0 test %eax,%eax +80104f20: 78 2e js 80104f50 +80104f22: 8b 45 f4 mov -0xc(%ebp),%eax +80104f25: 31 c9 xor %ecx,%ecx +80104f27: ba 01 00 00 00 mov $0x1,%edx +80104f2c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104f33: e8 d8 f7 ff ff call 80104710 +80104f38: 85 c0 test %eax,%eax +80104f3a: 74 14 je 80104f50 + end_op(); + return -1; + } + iunlockput(ip); +80104f3c: 89 04 24 mov %eax,(%esp) +80104f3f: e8 cc c9 ff ff call 80101910 + end_op(); +80104f44: e8 37 dc ff ff call 80102b80 + return 0; +80104f49: 31 c0 xor %eax,%eax +} +80104f4b: c9 leave +80104f4c: c3 ret +80104f4d: 8d 76 00 lea 0x0(%esi),%esi + end_op(); +80104f50: e8 2b dc ff ff call 80102b80 + return -1; +80104f55: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104f5a: c9 leave +80104f5b: c3 ret +80104f5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104f60 : + +int +sys_mknod(void) +{ +80104f60: 55 push %ebp +80104f61: 89 e5 mov %esp,%ebp +80104f63: 83 ec 28 sub $0x28,%esp + struct inode *ip; + char *path; + int major, minor; + + begin_op(); +80104f66: e8 a5 db ff ff call 80102b10 + if((argstr(0, &path)) < 0 || +80104f6b: 8d 45 ec lea -0x14(%ebp),%eax +80104f6e: 89 44 24 04 mov %eax,0x4(%esp) +80104f72: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80104f79: e8 a2 f6 ff ff call 80104620 +80104f7e: 85 c0 test %eax,%eax +80104f80: 78 5e js 80104fe0 + argint(1, &major) < 0 || +80104f82: 8d 45 f0 lea -0x10(%ebp),%eax +80104f85: 89 44 24 04 mov %eax,0x4(%esp) +80104f89: c7 04 24 01 00 00 00 movl $0x1,(%esp) +80104f90: e8 fb f5 ff ff call 80104590 + if((argstr(0, &path)) < 0 || +80104f95: 85 c0 test %eax,%eax +80104f97: 78 47 js 80104fe0 + argint(2, &minor) < 0 || +80104f99: 8d 45 f4 lea -0xc(%ebp),%eax +80104f9c: 89 44 24 04 mov %eax,0x4(%esp) +80104fa0: c7 04 24 02 00 00 00 movl $0x2,(%esp) +80104fa7: e8 e4 f5 ff ff call 80104590 + argint(1, &major) < 0 || +80104fac: 85 c0 test %eax,%eax +80104fae: 78 30 js 80104fe0 + (ip = create(path, T_DEV, major, minor)) == 0){ +80104fb0: 0f bf 45 f4 movswl -0xc(%ebp),%eax + argint(2, &minor) < 0 || +80104fb4: ba 03 00 00 00 mov $0x3,%edx + (ip = create(path, T_DEV, major, minor)) == 0){ +80104fb9: 0f bf 4d f0 movswl -0x10(%ebp),%ecx +80104fbd: 89 04 24 mov %eax,(%esp) + argint(2, &minor) < 0 || +80104fc0: 8b 45 ec mov -0x14(%ebp),%eax +80104fc3: e8 48 f7 ff ff call 80104710 +80104fc8: 85 c0 test %eax,%eax +80104fca: 74 14 je 80104fe0 + end_op(); + return -1; + } + iunlockput(ip); +80104fcc: 89 04 24 mov %eax,(%esp) +80104fcf: e8 3c c9 ff ff call 80101910 + end_op(); +80104fd4: e8 a7 db ff ff call 80102b80 + return 0; +80104fd9: 31 c0 xor %eax,%eax +} +80104fdb: c9 leave +80104fdc: c3 ret +80104fdd: 8d 76 00 lea 0x0(%esi),%esi + end_op(); +80104fe0: e8 9b db ff ff call 80102b80 + return -1; +80104fe5: b8 ff ff ff ff mov $0xffffffff,%eax +} +80104fea: c9 leave +80104feb: c3 ret +80104fec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80104ff0 : + +int +sys_chdir(void) +{ +80104ff0: 55 push %ebp +80104ff1: 89 e5 mov %esp,%ebp +80104ff3: 56 push %esi +80104ff4: 53 push %ebx +80104ff5: 83 ec 20 sub $0x20,%esp + char *path; + struct inode *ip; + struct proc *curproc = myproc(); +80104ff8: e8 a3 e6 ff ff call 801036a0 +80104ffd: 89 c6 mov %eax,%esi + + begin_op(); +80104fff: e8 0c db ff ff call 80102b10 + if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ +80105004: 8d 45 f4 lea -0xc(%ebp),%eax +80105007: 89 44 24 04 mov %eax,0x4(%esp) +8010500b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80105012: e8 09 f6 ff ff call 80104620 +80105017: 85 c0 test %eax,%eax +80105019: 78 4a js 80105065 +8010501b: 8b 45 f4 mov -0xc(%ebp),%eax +8010501e: 89 04 24 mov %eax,(%esp) +80105021: e8 da ce ff ff call 80101f00 +80105026: 85 c0 test %eax,%eax +80105028: 89 c3 mov %eax,%ebx +8010502a: 74 39 je 80105065 + end_op(); + return -1; + } + ilock(ip); +8010502c: 89 04 24 mov %eax,(%esp) +8010502f: e8 7c c6 ff ff call 801016b0 + if(ip->type != T_DIR){ +80105034: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) + iunlockput(ip); +80105039: 89 1c 24 mov %ebx,(%esp) + if(ip->type != T_DIR){ +8010503c: 75 22 jne 80105060 + end_op(); + return -1; + } + iunlock(ip); +8010503e: e8 4d c7 ff ff call 80101790 + iput(curproc->cwd); +80105043: 8b 46 68 mov 0x68(%esi),%eax +80105046: 89 04 24 mov %eax,(%esp) +80105049: e8 82 c7 ff ff call 801017d0 + end_op(); +8010504e: e8 2d db ff ff call 80102b80 + curproc->cwd = ip; + return 0; +80105053: 31 c0 xor %eax,%eax + curproc->cwd = ip; +80105055: 89 5e 68 mov %ebx,0x68(%esi) +} +80105058: 83 c4 20 add $0x20,%esp +8010505b: 5b pop %ebx +8010505c: 5e pop %esi +8010505d: 5d pop %ebp +8010505e: c3 ret +8010505f: 90 nop + iunlockput(ip); +80105060: e8 ab c8 ff ff call 80101910 + end_op(); +80105065: e8 16 db ff ff call 80102b80 +} +8010506a: 83 c4 20 add $0x20,%esp + return -1; +8010506d: b8 ff ff ff ff mov $0xffffffff,%eax +} +80105072: 5b pop %ebx +80105073: 5e pop %esi +80105074: 5d pop %ebp +80105075: c3 ret +80105076: 8d 76 00 lea 0x0(%esi),%esi +80105079: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80105080 : + +int +sys_exec(void) +{ +80105080: 55 push %ebp +80105081: 89 e5 mov %esp,%ebp +80105083: 57 push %edi +80105084: 56 push %esi +80105085: 53 push %ebx +80105086: 81 ec ac 00 00 00 sub $0xac,%esp + char *path, *argv[MAXARG]; + int i; + uint uargv, uarg; + + if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ +8010508c: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax +80105092: 89 44 24 04 mov %eax,0x4(%esp) +80105096: c7 04 24 00 00 00 00 movl $0x0,(%esp) +8010509d: e8 7e f5 ff ff call 80104620 +801050a2: 85 c0 test %eax,%eax +801050a4: 0f 88 84 00 00 00 js 8010512e +801050aa: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax +801050b0: 89 44 24 04 mov %eax,0x4(%esp) +801050b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +801050bb: e8 d0 f4 ff ff call 80104590 +801050c0: 85 c0 test %eax,%eax +801050c2: 78 6a js 8010512e + return -1; + } + memset(argv, 0, sizeof(argv)); +801050c4: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax + for(i=0;; i++){ +801050ca: 31 db xor %ebx,%ebx + memset(argv, 0, sizeof(argv)); +801050cc: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp) +801050d3: 00 +801050d4: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi +801050da: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +801050e1: 00 +801050e2: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi +801050e8: 89 04 24 mov %eax,(%esp) +801050eb: e8 b0 f1 ff ff call 801042a0 + if(i >= NELEM(argv)) + return -1; + if(fetchint(uargv+4*i, (int*)&uarg) < 0) +801050f0: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax +801050f6: 89 7c 24 04 mov %edi,0x4(%esp) +801050fa: 8d 04 98 lea (%eax,%ebx,4),%eax +801050fd: 89 04 24 mov %eax,(%esp) +80105100: e8 eb f3 ff ff call 801044f0 +80105105: 85 c0 test %eax,%eax +80105107: 78 25 js 8010512e + return -1; + if(uarg == 0){ +80105109: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax +8010510f: 85 c0 test %eax,%eax +80105111: 74 2d je 80105140 + argv[i] = 0; + break; + } + if(fetchstr(uarg, &argv[i]) < 0) +80105113: 89 74 24 04 mov %esi,0x4(%esp) +80105117: 89 04 24 mov %eax,(%esp) +8010511a: e8 11 f4 ff ff call 80104530 +8010511f: 85 c0 test %eax,%eax +80105121: 78 0b js 8010512e + for(i=0;; i++){ +80105123: 83 c3 01 add $0x1,%ebx +80105126: 83 c6 04 add $0x4,%esi + if(i >= NELEM(argv)) +80105129: 83 fb 20 cmp $0x20,%ebx +8010512c: 75 c2 jne 801050f0 + return -1; + } + return exec(path, argv); +} +8010512e: 81 c4 ac 00 00 00 add $0xac,%esp + return -1; +80105134: b8 ff ff ff ff mov $0xffffffff,%eax +} +80105139: 5b pop %ebx +8010513a: 5e pop %esi +8010513b: 5f pop %edi +8010513c: 5d pop %ebp +8010513d: c3 ret +8010513e: 66 90 xchg %ax,%ax + return exec(path, argv); +80105140: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax +80105146: 89 44 24 04 mov %eax,0x4(%esp) +8010514a: 8b 85 5c ff ff ff mov -0xa4(%ebp),%eax + argv[i] = 0; +80105150: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4) +80105157: 00 00 00 00 + return exec(path, argv); +8010515b: 89 04 24 mov %eax,(%esp) +8010515e: e8 3d b8 ff ff call 801009a0 +} +80105163: 81 c4 ac 00 00 00 add $0xac,%esp +80105169: 5b pop %ebx +8010516a: 5e pop %esi +8010516b: 5f pop %edi +8010516c: 5d pop %ebp +8010516d: c3 ret +8010516e: 66 90 xchg %ax,%ax + +80105170 : + +int +sys_pipe(void) +{ +80105170: 55 push %ebp +80105171: 89 e5 mov %esp,%ebp +80105173: 53 push %ebx +80105174: 83 ec 24 sub $0x24,%esp + int *fd; + struct file *rf, *wf; + int fd0, fd1; + + if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) +80105177: 8d 45 ec lea -0x14(%ebp),%eax +8010517a: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) +80105181: 00 +80105182: 89 44 24 04 mov %eax,0x4(%esp) +80105186: c7 04 24 00 00 00 00 movl $0x0,(%esp) +8010518d: e8 2e f4 ff ff call 801045c0 +80105192: 85 c0 test %eax,%eax +80105194: 78 6d js 80105203 + return -1; + if(pipealloc(&rf, &wf) < 0) +80105196: 8d 45 f4 lea -0xc(%ebp),%eax +80105199: 89 44 24 04 mov %eax,0x4(%esp) +8010519d: 8d 45 f0 lea -0x10(%ebp),%eax +801051a0: 89 04 24 mov %eax,(%esp) +801051a3: e8 c8 df ff ff call 80103170 +801051a8: 85 c0 test %eax,%eax +801051aa: 78 57 js 80105203 + return -1; + fd0 = -1; + if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ +801051ac: 8b 45 f0 mov -0x10(%ebp),%eax +801051af: e8 1c f5 ff ff call 801046d0 +801051b4: 85 c0 test %eax,%eax +801051b6: 89 c3 mov %eax,%ebx +801051b8: 78 33 js 801051ed +801051ba: 8b 45 f4 mov -0xc(%ebp),%eax +801051bd: e8 0e f5 ff ff call 801046d0 +801051c2: 85 c0 test %eax,%eax +801051c4: 78 1a js 801051e0 + myproc()->ofile[fd0] = 0; + fileclose(rf); + fileclose(wf); + return -1; + } + fd[0] = fd0; +801051c6: 8b 55 ec mov -0x14(%ebp),%edx +801051c9: 89 1a mov %ebx,(%edx) + fd[1] = fd1; +801051cb: 8b 55 ec mov -0x14(%ebp),%edx +801051ce: 89 42 04 mov %eax,0x4(%edx) + return 0; +} +801051d1: 83 c4 24 add $0x24,%esp + return 0; +801051d4: 31 c0 xor %eax,%eax +} +801051d6: 5b pop %ebx +801051d7: 5d pop %ebp +801051d8: c3 ret +801051d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + myproc()->ofile[fd0] = 0; +801051e0: e8 bb e4 ff ff call 801036a0 +801051e5: c7 44 98 28 00 00 00 movl $0x0,0x28(%eax,%ebx,4) +801051ec: 00 + fileclose(rf); +801051ed: 8b 45 f0 mov -0x10(%ebp),%eax +801051f0: 89 04 24 mov %eax,(%esp) +801051f3: e8 38 bc ff ff call 80100e30 + fileclose(wf); +801051f8: 8b 45 f4 mov -0xc(%ebp),%eax +801051fb: 89 04 24 mov %eax,(%esp) +801051fe: e8 2d bc ff ff call 80100e30 +} +80105203: 83 c4 24 add $0x24,%esp + return -1; +80105206: b8 ff ff ff ff mov $0xffffffff,%eax +} +8010520b: 5b pop %ebx +8010520c: 5d pop %ebp +8010520d: c3 ret +8010520e: 66 90 xchg %ax,%ax + +80105210 : +#include "memlayout.h" +#include "mmu.h" +#include "proc.h" + +int sys_fork(void) +{ +80105210: 55 push %ebp +80105211: 89 e5 mov %esp,%ebp + return fork(); +} +80105213: 5d pop %ebp + return fork(); +80105214: e9 37 e6 ff ff jmp 80103850 +80105219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80105220 : + +int sys_exit(void) +{ +80105220: 55 push %ebp +80105221: 89 e5 mov %esp,%ebp +80105223: 83 ec 28 sub $0x28,%esp + int status; + argint(0, &status); +80105226: 8d 45 f4 lea -0xc(%ebp),%eax +80105229: 89 44 24 04 mov %eax,0x4(%esp) +8010522d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80105234: e8 57 f3 ff ff call 80104590 + exit(status); +80105239: 8b 45 f4 mov -0xc(%ebp),%eax +8010523c: 89 04 24 mov %eax,(%esp) +8010523f: e8 5c e8 ff ff call 80103aa0 + return 0; // not reached +} +80105244: 31 c0 xor %eax,%eax +80105246: c9 leave +80105247: c3 ret +80105248: 90 nop +80105249: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80105250 : + +int sys_wait(void) +{ +80105250: 55 push %ebp +80105251: 89 e5 mov %esp,%ebp +80105253: 83 ec 28 sub $0x28,%esp + int *status; + if (argptr(0, (void *)&status, sizeof(status)) < 0) +80105256: 8d 45 f4 lea -0xc(%ebp),%eax +80105259: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) +80105260: 00 +80105261: 89 44 24 04 mov %eax,0x4(%esp) +80105265: c7 04 24 00 00 00 00 movl $0x0,(%esp) +8010526c: e8 4f f3 ff ff call 801045c0 +80105271: 85 c0 test %eax,%eax +80105273: 78 13 js 80105288 + { + return -1; + } + + return wait(status); +80105275: 8b 45 f4 mov -0xc(%ebp),%eax +80105278: 89 04 24 mov %eax,(%esp) +8010527b: e8 30 ea ff ff call 80103cb0 +} +80105280: c9 leave +80105281: c3 ret +80105282: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + return -1; +80105288: b8 ff ff ff ff mov $0xffffffff,%eax +} +8010528d: c9 leave +8010528e: c3 ret +8010528f: 90 nop + +80105290 : + +int sys_kill(void) +{ +80105290: 55 push %ebp +80105291: 89 e5 mov %esp,%ebp +80105293: 83 ec 28 sub $0x28,%esp + int pid; + + if (argint(0, &pid) < 0) +80105296: 8d 45 f4 lea -0xc(%ebp),%eax +80105299: 89 44 24 04 mov %eax,0x4(%esp) +8010529d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +801052a4: e8 e7 f2 ff ff call 80104590 +801052a9: 85 c0 test %eax,%eax +801052ab: 78 13 js 801052c0 + return -1; + return kill(pid); +801052ad: 8b 45 f4 mov -0xc(%ebp),%eax +801052b0: 89 04 24 mov %eax,(%esp) +801052b3: e8 38 eb ff ff call 80103df0 +} +801052b8: c9 leave +801052b9: c3 ret +801052ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + return -1; +801052c0: b8 ff ff ff ff mov $0xffffffff,%eax +} +801052c5: c9 leave +801052c6: c3 ret +801052c7: 89 f6 mov %esi,%esi +801052c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801052d0 : + +int sys_getpid(void) +{ +801052d0: 55 push %ebp +801052d1: 89 e5 mov %esp,%ebp +801052d3: 83 ec 08 sub $0x8,%esp + return myproc()->pid; +801052d6: e8 c5 e3 ff ff call 801036a0 +801052db: 8b 40 10 mov 0x10(%eax),%eax +} +801052de: c9 leave +801052df: c3 ret + +801052e0 : + +int sys_sbrk(void) +{ +801052e0: 55 push %ebp +801052e1: 89 e5 mov %esp,%ebp +801052e3: 53 push %ebx +801052e4: 83 ec 24 sub $0x24,%esp + int addr; + int n; + + if (argint(0, &n) < 0) +801052e7: 8d 45 f4 lea -0xc(%ebp),%eax +801052ea: 89 44 24 04 mov %eax,0x4(%esp) +801052ee: c7 04 24 00 00 00 00 movl $0x0,(%esp) +801052f5: e8 96 f2 ff ff call 80104590 +801052fa: 85 c0 test %eax,%eax +801052fc: 78 22 js 80105320 + return -1; + addr = myproc()->sz; +801052fe: e8 9d e3 ff ff call 801036a0 + if (growproc(n) < 0) +80105303: 8b 55 f4 mov -0xc(%ebp),%edx + addr = myproc()->sz; +80105306: 8b 18 mov (%eax),%ebx + if (growproc(n) < 0) +80105308: 89 14 24 mov %edx,(%esp) +8010530b: e8 d0 e4 ff ff call 801037e0 +80105310: 85 c0 test %eax,%eax +80105312: 78 0c js 80105320 + return -1; + return addr; +80105314: 89 d8 mov %ebx,%eax +} +80105316: 83 c4 24 add $0x24,%esp +80105319: 5b pop %ebx +8010531a: 5d pop %ebp +8010531b: c3 ret +8010531c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +80105320: b8 ff ff ff ff mov $0xffffffff,%eax +80105325: eb ef jmp 80105316 +80105327: 89 f6 mov %esi,%esi +80105329: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80105330 : + +int sys_sleep(void) +{ +80105330: 55 push %ebp +80105331: 89 e5 mov %esp,%ebp +80105333: 53 push %ebx +80105334: 83 ec 24 sub $0x24,%esp + int n; + uint ticks0; + + if (argint(0, &n) < 0) +80105337: 8d 45 f4 lea -0xc(%ebp),%eax +8010533a: 89 44 24 04 mov %eax,0x4(%esp) +8010533e: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80105345: e8 46 f2 ff ff call 80104590 +8010534a: 85 c0 test %eax,%eax +8010534c: 78 7e js 801053cc + return -1; + acquire(&tickslock); +8010534e: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +80105355: e8 86 ee ff ff call 801041e0 + ticks0 = ticks; + while (ticks - ticks0 < n) +8010535a: 8b 55 f4 mov -0xc(%ebp),%edx + ticks0 = ticks; +8010535d: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx + while (ticks - ticks0 < n) +80105363: 85 d2 test %edx,%edx +80105365: 75 29 jne 80105390 +80105367: eb 4f jmp 801053b8 +80105369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if (myproc()->killed) + { + release(&tickslock); + return -1; + } + sleep(&ticks, &tickslock); +80105370: c7 44 24 04 60 4d 11 movl $0x80114d60,0x4(%esp) +80105377: 80 +80105378: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp) +8010537f: e8 7c e8 ff ff call 80103c00 + while (ticks - ticks0 < n) +80105384: a1 a0 55 11 80 mov 0x801155a0,%eax +80105389: 29 d8 sub %ebx,%eax +8010538b: 3b 45 f4 cmp -0xc(%ebp),%eax +8010538e: 73 28 jae 801053b8 + if (myproc()->killed) +80105390: e8 0b e3 ff ff call 801036a0 +80105395: 8b 40 24 mov 0x24(%eax),%eax +80105398: 85 c0 test %eax,%eax +8010539a: 74 d4 je 80105370 + release(&tickslock); +8010539c: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +801053a3: e8 a8 ee ff ff call 80104250 + return -1; +801053a8: b8 ff ff ff ff mov $0xffffffff,%eax + } + release(&tickslock); + return 0; +} +801053ad: 83 c4 24 add $0x24,%esp +801053b0: 5b pop %ebx +801053b1: 5d pop %ebp +801053b2: c3 ret +801053b3: 90 nop +801053b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + release(&tickslock); +801053b8: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +801053bf: e8 8c ee ff ff call 80104250 +} +801053c4: 83 c4 24 add $0x24,%esp + return 0; +801053c7: 31 c0 xor %eax,%eax +} +801053c9: 5b pop %ebx +801053ca: 5d pop %ebp +801053cb: c3 ret + return -1; +801053cc: b8 ff ff ff ff mov $0xffffffff,%eax +801053d1: eb da jmp 801053ad +801053d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801053d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801053e0 : + +// return how many clock tick interrupts have occurred +// since start. +int sys_uptime(void) +{ +801053e0: 55 push %ebp +801053e1: 89 e5 mov %esp,%ebp +801053e3: 53 push %ebx +801053e4: 83 ec 14 sub $0x14,%esp + uint xticks; + + acquire(&tickslock); +801053e7: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +801053ee: e8 ed ed ff ff call 801041e0 + xticks = ticks; +801053f3: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx + release(&tickslock); +801053f9: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +80105400: e8 4b ee ff ff call 80104250 + return xticks; +} +80105405: 83 c4 14 add $0x14,%esp +80105408: 89 d8 mov %ebx,%eax +8010540a: 5b pop %ebx +8010540b: 5d pop %ebp +8010540c: c3 ret + +8010540d : +8010540d: 1e push %ds +8010540e: 06 push %es +8010540f: 0f a0 push %fs +80105411: 0f a8 push %gs +80105413: 60 pusha +80105414: 66 b8 10 00 mov $0x10,%ax +80105418: 8e d8 mov %eax,%ds +8010541a: 8e c0 mov %eax,%es +8010541c: 54 push %esp +8010541d: e8 de 00 00 00 call 80105500 +80105422: 83 c4 04 add $0x4,%esp + +80105425 : +80105425: 61 popa +80105426: 0f a9 pop %gs +80105428: 0f a1 pop %fs +8010542a: 07 pop %es +8010542b: 1f pop %ds +8010542c: 83 c4 08 add $0x8,%esp +8010542f: cf iret + +80105430 : +void +tvinit(void) +{ + int i; + + for(i = 0; i < 256; i++) +80105430: 31 c0 xor %eax,%eax +80105432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); +80105438: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx +8010543f: b9 08 00 00 00 mov $0x8,%ecx +80105444: 66 89 0c c5 a2 4d 11 mov %cx,-0x7feeb25e(,%eax,8) +8010544b: 80 +8010544c: c6 04 c5 a4 4d 11 80 movb $0x0,-0x7feeb25c(,%eax,8) +80105453: 00 +80105454: c6 04 c5 a5 4d 11 80 movb $0x8e,-0x7feeb25b(,%eax,8) +8010545b: 8e +8010545c: 66 89 14 c5 a0 4d 11 mov %dx,-0x7feeb260(,%eax,8) +80105463: 80 +80105464: c1 ea 10 shr $0x10,%edx +80105467: 66 89 14 c5 a6 4d 11 mov %dx,-0x7feeb25a(,%eax,8) +8010546e: 80 + for(i = 0; i < 256; i++) +8010546f: 83 c0 01 add $0x1,%eax +80105472: 3d 00 01 00 00 cmp $0x100,%eax +80105477: 75 bf jne 80105438 +{ +80105479: 55 push %ebp + SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); +8010547a: ba 08 00 00 00 mov $0x8,%edx +{ +8010547f: 89 e5 mov %esp,%ebp +80105481: 83 ec 18 sub $0x18,%esp + SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); +80105484: a1 08 a1 10 80 mov 0x8010a108,%eax + + initlock(&tickslock, "time"); +80105489: c7 44 24 04 d9 73 10 movl $0x801073d9,0x4(%esp) +80105490: 80 +80105491: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) + SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); +80105498: 66 89 15 a2 4f 11 80 mov %dx,0x80114fa2 +8010549f: 66 a3 a0 4f 11 80 mov %ax,0x80114fa0 +801054a5: c1 e8 10 shr $0x10,%eax +801054a8: c6 05 a4 4f 11 80 00 movb $0x0,0x80114fa4 +801054af: c6 05 a5 4f 11 80 ef movb $0xef,0x80114fa5 +801054b6: 66 a3 a6 4f 11 80 mov %ax,0x80114fa6 + initlock(&tickslock, "time"); +801054bc: e8 af eb ff ff call 80104070 +} +801054c1: c9 leave +801054c2: c3 ret +801054c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +801054c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801054d0 : + +void +idtinit(void) +{ +801054d0: 55 push %ebp + pd[0] = size-1; +801054d1: b8 ff 07 00 00 mov $0x7ff,%eax +801054d6: 89 e5 mov %esp,%ebp +801054d8: 83 ec 10 sub $0x10,%esp +801054db: 66 89 45 fa mov %ax,-0x6(%ebp) + pd[1] = (uint)p; +801054df: b8 a0 4d 11 80 mov $0x80114da0,%eax +801054e4: 66 89 45 fc mov %ax,-0x4(%ebp) + pd[2] = (uint)p >> 16; +801054e8: c1 e8 10 shr $0x10,%eax +801054eb: 66 89 45 fe mov %ax,-0x2(%ebp) + asm volatile("lidt (%0)" : : "r" (pd)); +801054ef: 8d 45 fa lea -0x6(%ebp),%eax +801054f2: 0f 01 18 lidtl (%eax) + lidt(idt, sizeof(idt)); +} +801054f5: c9 leave +801054f6: c3 ret +801054f7: 89 f6 mov %esi,%esi +801054f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +80105500 : + +//PAGEBREAK: 41 +void +trap(struct trapframe *tf) +{ +80105500: 55 push %ebp +80105501: 89 e5 mov %esp,%ebp +80105503: 57 push %edi +80105504: 56 push %esi +80105505: 53 push %ebx +80105506: 83 ec 3c sub $0x3c,%esp +80105509: 8b 5d 08 mov 0x8(%ebp),%ebx + if(tf->trapno == T_SYSCALL){ +8010550c: 8b 43 30 mov 0x30(%ebx),%eax +8010550f: 83 f8 40 cmp $0x40,%eax +80105512: 0f 84 a0 01 00 00 je 801056b8 + if(myproc()->killed) + exit(0); + return; + } + + switch(tf->trapno){ +80105518: 83 e8 20 sub $0x20,%eax +8010551b: 83 f8 1f cmp $0x1f,%eax +8010551e: 77 08 ja 80105528 +80105520: ff 24 85 80 74 10 80 jmp *-0x7fef8b80(,%eax,4) +80105527: 90 nop + lapiceoi(); + break; + + //PAGEBREAK: 13 + default: + if(myproc() == 0 || (tf->cs&3) == 0){ +80105528: e8 73 e1 ff ff call 801036a0 +8010552d: 85 c0 test %eax,%eax +8010552f: 90 nop +80105530: 0f 84 0a 02 00 00 je 80105740 +80105536: f6 43 3c 03 testb $0x3,0x3c(%ebx) +8010553a: 0f 84 00 02 00 00 je 80105740 + +static inline uint +rcr2(void) +{ + uint val; + asm volatile("movl %%cr2,%0" : "=r" (val)); +80105540: 0f 20 d1 mov %cr2,%ecx + cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", + tf->trapno, cpuid(), tf->eip, rcr2()); + panic("trap"); + } + // In user space, assume process misbehaved. + cprintf("pid %d %s: trap %d err %d on cpu %d " +80105543: 8b 53 38 mov 0x38(%ebx),%edx +80105546: 89 4d d8 mov %ecx,-0x28(%ebp) +80105549: 89 55 dc mov %edx,-0x24(%ebp) +8010554c: e8 2f e1 ff ff call 80103680 +80105551: 8b 73 30 mov 0x30(%ebx),%esi +80105554: 89 c7 mov %eax,%edi +80105556: 8b 43 34 mov 0x34(%ebx),%eax +80105559: 89 45 e4 mov %eax,-0x1c(%ebp) + "eip 0x%x addr 0x%x--kill proc\n", + myproc()->pid, myproc()->name, tf->trapno, +8010555c: e8 3f e1 ff ff call 801036a0 +80105561: 89 45 e0 mov %eax,-0x20(%ebp) +80105564: e8 37 e1 ff ff call 801036a0 + cprintf("pid %d %s: trap %d err %d on cpu %d " +80105569: 8b 55 dc mov -0x24(%ebp),%edx +8010556c: 89 74 24 0c mov %esi,0xc(%esp) + myproc()->pid, myproc()->name, tf->trapno, +80105570: 8b 75 e0 mov -0x20(%ebp),%esi + cprintf("pid %d %s: trap %d err %d on cpu %d " +80105573: 8b 4d d8 mov -0x28(%ebp),%ecx +80105576: 89 7c 24 14 mov %edi,0x14(%esp) +8010557a: 89 54 24 18 mov %edx,0x18(%esp) +8010557e: 8b 55 e4 mov -0x1c(%ebp),%edx + myproc()->pid, myproc()->name, tf->trapno, +80105581: 83 c6 6c add $0x6c,%esi + cprintf("pid %d %s: trap %d err %d on cpu %d " +80105584: 89 4c 24 1c mov %ecx,0x1c(%esp) + myproc()->pid, myproc()->name, tf->trapno, +80105588: 89 74 24 08 mov %esi,0x8(%esp) + cprintf("pid %d %s: trap %d err %d on cpu %d " +8010558c: 89 54 24 10 mov %edx,0x10(%esp) +80105590: 8b 40 10 mov 0x10(%eax),%eax +80105593: c7 04 24 3c 74 10 80 movl $0x8010743c,(%esp) +8010559a: 89 44 24 04 mov %eax,0x4(%esp) +8010559e: e8 ad b0 ff ff call 80100650 + tf->err, cpuid(), tf->eip, rcr2()); + myproc()->killed = 1; +801055a3: e8 f8 e0 ff ff call 801036a0 +801055a8: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) +801055af: 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(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +801055b0: e8 eb e0 ff ff call 801036a0 +801055b5: 85 c0 test %eax,%eax +801055b7: 74 0c je 801055c5 +801055b9: e8 e2 e0 ff ff call 801036a0 +801055be: 8b 50 24 mov 0x24(%eax),%edx +801055c1: 85 d2 test %edx,%edx +801055c3: 75 4b jne 80105610 + exit(0); + + // Force process to give up CPU on clock tick. + // If interrupts were on while locks held, would need to check nlock. + if(myproc() && myproc()->state == RUNNING && +801055c5: e8 d6 e0 ff ff call 801036a0 +801055ca: 85 c0 test %eax,%eax +801055cc: 74 0d je 801055db +801055ce: 66 90 xchg %ax,%ax +801055d0: e8 cb e0 ff ff call 801036a0 +801055d5: 83 78 0c 04 cmpl $0x4,0xc(%eax) +801055d9: 74 55 je 80105630 + tf->trapno == T_IRQ0+IRQ_TIMER) + yield(); + + // Check if the process has been killed since we yielded + if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +801055db: e8 c0 e0 ff ff call 801036a0 +801055e0: 85 c0 test %eax,%eax +801055e2: 74 1d je 80105601 +801055e4: e8 b7 e0 ff ff call 801036a0 +801055e9: 8b 40 24 mov 0x24(%eax),%eax +801055ec: 85 c0 test %eax,%eax +801055ee: 74 11 je 80105601 +801055f0: 0f b7 43 3c movzwl 0x3c(%ebx),%eax +801055f4: 83 e0 03 and $0x3,%eax +801055f7: 66 83 f8 03 cmp $0x3,%ax +801055fb: 0f 84 e8 00 00 00 je 801056e9 + exit(0); +} +80105601: 83 c4 3c add $0x3c,%esp +80105604: 5b pop %ebx +80105605: 5e pop %esi +80105606: 5f pop %edi +80105607: 5d pop %ebp +80105608: c3 ret +80105609: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +80105610: 0f b7 43 3c movzwl 0x3c(%ebx),%eax +80105614: 83 e0 03 and $0x3,%eax +80105617: 66 83 f8 03 cmp $0x3,%ax +8010561b: 75 a8 jne 801055c5 + exit(0); +8010561d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80105624: e8 77 e4 ff ff call 80103aa0 +80105629: eb 9a jmp 801055c5 +8010562b: 90 nop +8010562c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(myproc() && myproc()->state == RUNNING && +80105630: 83 7b 30 20 cmpl $0x20,0x30(%ebx) +80105634: 75 a5 jne 801055db + yield(); +80105636: e8 85 e5 ff ff call 80103bc0 +8010563b: eb 9e jmp 801055db +8010563d: 8d 76 00 lea 0x0(%esi),%esi + if(cpuid() == 0){ +80105640: e8 3b e0 ff ff call 80103680 +80105645: 85 c0 test %eax,%eax +80105647: 0f 84 c3 00 00 00 je 80105710 +8010564d: 8d 76 00 lea 0x0(%esi),%esi + lapiceoi(); +80105650: e8 2b d1 ff ff call 80102780 + break; +80105655: e9 56 ff ff ff jmp 801055b0 +8010565a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + kbdintr(); +80105660: e8 6b cf ff ff call 801025d0 + lapiceoi(); +80105665: e8 16 d1 ff ff call 80102780 + break; +8010566a: e9 41 ff ff ff jmp 801055b0 +8010566f: 90 nop + uartintr(); +80105670: e8 2b 02 00 00 call 801058a0 + lapiceoi(); +80105675: e8 06 d1 ff ff call 80102780 + break; +8010567a: e9 31 ff ff ff jmp 801055b0 +8010567f: 90 nop + cprintf("cpu%d: spurious interrupt at %x:%x\n", +80105680: 8b 7b 38 mov 0x38(%ebx),%edi +80105683: 0f b7 73 3c movzwl 0x3c(%ebx),%esi +80105687: e8 f4 df ff ff call 80103680 +8010568c: c7 04 24 e4 73 10 80 movl $0x801073e4,(%esp) +80105693: 89 7c 24 0c mov %edi,0xc(%esp) +80105697: 89 74 24 08 mov %esi,0x8(%esp) +8010569b: 89 44 24 04 mov %eax,0x4(%esp) +8010569f: e8 ac af ff ff call 80100650 + lapiceoi(); +801056a4: e8 d7 d0 ff ff call 80102780 + break; +801056a9: e9 02 ff ff ff jmp 801055b0 +801056ae: 66 90 xchg %ax,%ax + ideintr(); +801056b0: e8 cb c9 ff ff call 80102080 +801056b5: eb 96 jmp 8010564d +801056b7: 90 nop +801056b8: 90 nop +801056b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(myproc()->killed) +801056c0: e8 db df ff ff call 801036a0 +801056c5: 8b 70 24 mov 0x24(%eax),%esi +801056c8: 85 f6 test %esi,%esi +801056ca: 75 34 jne 80105700 + myproc()->tf = tf; +801056cc: e8 cf df ff ff call 801036a0 +801056d1: 89 58 18 mov %ebx,0x18(%eax) + syscall(); +801056d4: e8 87 ef ff ff call 80104660 + if(myproc()->killed) +801056d9: e8 c2 df ff ff call 801036a0 +801056de: 8b 48 24 mov 0x24(%eax),%ecx +801056e1: 85 c9 test %ecx,%ecx +801056e3: 0f 84 18 ff ff ff je 80105601 + exit(0); +801056e9: c7 45 08 00 00 00 00 movl $0x0,0x8(%ebp) +} +801056f0: 83 c4 3c add $0x3c,%esp +801056f3: 5b pop %ebx +801056f4: 5e pop %esi +801056f5: 5f pop %edi +801056f6: 5d pop %ebp + exit(0); +801056f7: e9 a4 e3 ff ff jmp 80103aa0 +801056fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + exit(0); +80105700: c7 04 24 00 00 00 00 movl $0x0,(%esp) +80105707: e8 94 e3 ff ff call 80103aa0 +8010570c: eb be jmp 801056cc +8010570e: 66 90 xchg %ax,%ax + acquire(&tickslock); +80105710: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +80105717: e8 c4 ea ff ff call 801041e0 + wakeup(&ticks); +8010571c: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp) + ticks++; +80105723: 83 05 a0 55 11 80 01 addl $0x1,0x801155a0 + wakeup(&ticks); +8010572a: e8 61 e6 ff ff call 80103d90 + release(&tickslock); +8010572f: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +80105736: e8 15 eb ff ff call 80104250 +8010573b: e9 0d ff ff ff jmp 8010564d +80105740: 0f 20 d7 mov %cr2,%edi + cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", +80105743: 8b 73 38 mov 0x38(%ebx),%esi +80105746: e8 35 df ff ff call 80103680 +8010574b: 89 7c 24 10 mov %edi,0x10(%esp) +8010574f: 89 74 24 0c mov %esi,0xc(%esp) +80105753: 89 44 24 08 mov %eax,0x8(%esp) +80105757: 8b 43 30 mov 0x30(%ebx),%eax +8010575a: c7 04 24 08 74 10 80 movl $0x80107408,(%esp) +80105761: 89 44 24 04 mov %eax,0x4(%esp) +80105765: e8 e6 ae ff ff call 80100650 + panic("trap"); +8010576a: c7 04 24 de 73 10 80 movl $0x801073de,(%esp) +80105771: e8 ea ab ff ff call 80100360 +80105776: 66 90 xchg %ax,%ax +80105778: 66 90 xchg %ax,%ax +8010577a: 66 90 xchg %ax,%ax +8010577c: 66 90 xchg %ax,%ax +8010577e: 66 90 xchg %ax,%ax + +80105780 : +} + +static int +uartgetc(void) +{ + if (!uart) +80105780: a1 bc a5 10 80 mov 0x8010a5bc,%eax +{ +80105785: 55 push %ebp +80105786: 89 e5 mov %esp,%ebp + if (!uart) +80105788: 85 c0 test %eax,%eax +8010578a: 74 14 je 801057a0 + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +8010578c: ba fd 03 00 00 mov $0x3fd,%edx +80105791: ec in (%dx),%al + return -1; + if (!(inb(COM1 + 5) & 0x01)) +80105792: a8 01 test $0x1,%al +80105794: 74 0a je 801057a0 +80105796: b2 f8 mov $0xf8,%dl +80105798: ec in (%dx),%al + return -1; + return inb(COM1 + 0); +80105799: 0f b6 c0 movzbl %al,%eax +} +8010579c: 5d pop %ebp +8010579d: c3 ret +8010579e: 66 90 xchg %ax,%ax + return -1; +801057a0: b8 ff ff ff ff mov $0xffffffff,%eax +} +801057a5: 5d pop %ebp +801057a6: c3 ret +801057a7: 89 f6 mov %esi,%esi +801057a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801057b0 : + if (!uart) +801057b0: a1 bc a5 10 80 mov 0x8010a5bc,%eax +801057b5: 85 c0 test %eax,%eax +801057b7: 74 3f je 801057f8 +{ +801057b9: 55 push %ebp +801057ba: 89 e5 mov %esp,%ebp +801057bc: 56 push %esi +801057bd: be fd 03 00 00 mov $0x3fd,%esi +801057c2: 53 push %ebx + if (!uart) +801057c3: bb 80 00 00 00 mov $0x80,%ebx +{ +801057c8: 83 ec 10 sub $0x10,%esp +801057cb: eb 14 jmp 801057e1 +801057cd: 8d 76 00 lea 0x0(%esi),%esi + microdelay(10); +801057d0: c7 04 24 0a 00 00 00 movl $0xa,(%esp) +801057d7: e8 c4 cf ff ff call 801027a0 + for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) +801057dc: 83 eb 01 sub $0x1,%ebx +801057df: 74 07 je 801057e8 +801057e1: 89 f2 mov %esi,%edx +801057e3: ec in (%dx),%al +801057e4: a8 20 test $0x20,%al +801057e6: 74 e8 je 801057d0 + outb(COM1 + 0, c); +801057e8: 0f b6 45 08 movzbl 0x8(%ebp),%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +801057ec: ba f8 03 00 00 mov $0x3f8,%edx +801057f1: ee out %al,(%dx) +} +801057f2: 83 c4 10 add $0x10,%esp +801057f5: 5b pop %ebx +801057f6: 5e pop %esi +801057f7: 5d pop %ebp +801057f8: f3 c3 repz ret +801057fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80105800 : +{ +80105800: 55 push %ebp +80105801: 31 c9 xor %ecx,%ecx +80105803: 89 e5 mov %esp,%ebp +80105805: 89 c8 mov %ecx,%eax +80105807: 57 push %edi +80105808: bf fa 03 00 00 mov $0x3fa,%edi +8010580d: 56 push %esi +8010580e: 89 fa mov %edi,%edx +80105810: 53 push %ebx +80105811: 83 ec 1c sub $0x1c,%esp +80105814: ee out %al,(%dx) +80105815: be fb 03 00 00 mov $0x3fb,%esi +8010581a: b8 80 ff ff ff mov $0xffffff80,%eax +8010581f: 89 f2 mov %esi,%edx +80105821: ee out %al,(%dx) +80105822: b8 0c 00 00 00 mov $0xc,%eax +80105827: b2 f8 mov $0xf8,%dl +80105829: ee out %al,(%dx) +8010582a: bb f9 03 00 00 mov $0x3f9,%ebx +8010582f: 89 c8 mov %ecx,%eax +80105831: 89 da mov %ebx,%edx +80105833: ee out %al,(%dx) +80105834: b8 03 00 00 00 mov $0x3,%eax +80105839: 89 f2 mov %esi,%edx +8010583b: ee out %al,(%dx) +8010583c: b2 fc mov $0xfc,%dl +8010583e: 89 c8 mov %ecx,%eax +80105840: ee out %al,(%dx) +80105841: b8 01 00 00 00 mov $0x1,%eax +80105846: 89 da mov %ebx,%edx +80105848: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +80105849: b2 fd mov $0xfd,%dl +8010584b: ec in (%dx),%al + if (inb(COM1 + 5) == 0xFF) +8010584c: 3c ff cmp $0xff,%al +8010584e: 74 42 je 80105892 + uart = 1; +80105850: c7 05 bc a5 10 80 01 movl $0x1,0x8010a5bc +80105857: 00 00 00 +8010585a: 89 fa mov %edi,%edx +8010585c: ec in (%dx),%al +8010585d: b2 f8 mov $0xf8,%dl +8010585f: ec in (%dx),%al + ioapicenable(IRQ_COM1, 0); +80105860: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80105867: 00 + for (p = "xv6...\n"; *p; p++) +80105868: bb 00 75 10 80 mov $0x80107500,%ebx + ioapicenable(IRQ_COM1, 0); +8010586d: c7 04 24 04 00 00 00 movl $0x4,(%esp) +80105874: e8 37 ca ff ff call 801022b0 + for (p = "xv6...\n"; *p; p++) +80105879: b8 78 00 00 00 mov $0x78,%eax +8010587e: 66 90 xchg %ax,%ax + uartputc(*p); +80105880: 89 04 24 mov %eax,(%esp) + for (p = "xv6...\n"; *p; p++) +80105883: 83 c3 01 add $0x1,%ebx + uartputc(*p); +80105886: e8 25 ff ff ff call 801057b0 + for (p = "xv6...\n"; *p; p++) +8010588b: 0f be 03 movsbl (%ebx),%eax +8010588e: 84 c0 test %al,%al +80105890: 75 ee jne 80105880 +} +80105892: 83 c4 1c add $0x1c,%esp +80105895: 5b pop %ebx +80105896: 5e pop %esi +80105897: 5f pop %edi +80105898: 5d pop %ebp +80105899: c3 ret +8010589a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +801058a0 : + +void uartintr(void) +{ +801058a0: 55 push %ebp +801058a1: 89 e5 mov %esp,%ebp +801058a3: 83 ec 18 sub $0x18,%esp + consoleintr(uartgetc); +801058a6: c7 04 24 80 57 10 80 movl $0x80105780,(%esp) +801058ad: e8 fe ae ff ff call 801007b0 +} +801058b2: c9 leave +801058b3: c3 ret + +801058b4 : +801058b4: 6a 00 push $0x0 +801058b6: 6a 00 push $0x0 +801058b8: e9 50 fb ff ff jmp 8010540d + +801058bd : +801058bd: 6a 00 push $0x0 +801058bf: 6a 01 push $0x1 +801058c1: e9 47 fb ff ff jmp 8010540d + +801058c6 : +801058c6: 6a 00 push $0x0 +801058c8: 6a 02 push $0x2 +801058ca: e9 3e fb ff ff jmp 8010540d + +801058cf : +801058cf: 6a 00 push $0x0 +801058d1: 6a 03 push $0x3 +801058d3: e9 35 fb ff ff jmp 8010540d + +801058d8 : +801058d8: 6a 00 push $0x0 +801058da: 6a 04 push $0x4 +801058dc: e9 2c fb ff ff jmp 8010540d + +801058e1 : +801058e1: 6a 00 push $0x0 +801058e3: 6a 05 push $0x5 +801058e5: e9 23 fb ff ff jmp 8010540d + +801058ea : +801058ea: 6a 00 push $0x0 +801058ec: 6a 06 push $0x6 +801058ee: e9 1a fb ff ff jmp 8010540d + +801058f3 : +801058f3: 6a 00 push $0x0 +801058f5: 6a 07 push $0x7 +801058f7: e9 11 fb ff ff jmp 8010540d + +801058fc : +801058fc: 6a 08 push $0x8 +801058fe: e9 0a fb ff ff jmp 8010540d + +80105903 : +80105903: 6a 00 push $0x0 +80105905: 6a 09 push $0x9 +80105907: e9 01 fb ff ff jmp 8010540d + +8010590c : +8010590c: 6a 0a push $0xa +8010590e: e9 fa fa ff ff jmp 8010540d + +80105913 : +80105913: 6a 0b push $0xb +80105915: e9 f3 fa ff ff jmp 8010540d + +8010591a : +8010591a: 6a 0c push $0xc +8010591c: e9 ec fa ff ff jmp 8010540d + +80105921 : +80105921: 6a 0d push $0xd +80105923: e9 e5 fa ff ff jmp 8010540d + +80105928 : +80105928: 6a 0e push $0xe +8010592a: e9 de fa ff ff jmp 8010540d + +8010592f : +8010592f: 6a 00 push $0x0 +80105931: 6a 0f push $0xf +80105933: e9 d5 fa ff ff jmp 8010540d + +80105938 : +80105938: 6a 00 push $0x0 +8010593a: 6a 10 push $0x10 +8010593c: e9 cc fa ff ff jmp 8010540d + +80105941 : +80105941: 6a 11 push $0x11 +80105943: e9 c5 fa ff ff jmp 8010540d + +80105948 : +80105948: 6a 00 push $0x0 +8010594a: 6a 12 push $0x12 +8010594c: e9 bc fa ff ff jmp 8010540d + +80105951 : +80105951: 6a 00 push $0x0 +80105953: 6a 13 push $0x13 +80105955: e9 b3 fa ff ff jmp 8010540d + +8010595a : +8010595a: 6a 00 push $0x0 +8010595c: 6a 14 push $0x14 +8010595e: e9 aa fa ff ff jmp 8010540d + +80105963 : +80105963: 6a 00 push $0x0 +80105965: 6a 15 push $0x15 +80105967: e9 a1 fa ff ff jmp 8010540d + +8010596c : +8010596c: 6a 00 push $0x0 +8010596e: 6a 16 push $0x16 +80105970: e9 98 fa ff ff jmp 8010540d + +80105975 : +80105975: 6a 00 push $0x0 +80105977: 6a 17 push $0x17 +80105979: e9 8f fa ff ff jmp 8010540d + +8010597e : +8010597e: 6a 00 push $0x0 +80105980: 6a 18 push $0x18 +80105982: e9 86 fa ff ff jmp 8010540d + +80105987 : +80105987: 6a 00 push $0x0 +80105989: 6a 19 push $0x19 +8010598b: e9 7d fa ff ff jmp 8010540d + +80105990 : +80105990: 6a 00 push $0x0 +80105992: 6a 1a push $0x1a +80105994: e9 74 fa ff ff jmp 8010540d + +80105999 : +80105999: 6a 00 push $0x0 +8010599b: 6a 1b push $0x1b +8010599d: e9 6b fa ff ff jmp 8010540d + +801059a2 : +801059a2: 6a 00 push $0x0 +801059a4: 6a 1c push $0x1c +801059a6: e9 62 fa ff ff jmp 8010540d + +801059ab : +801059ab: 6a 00 push $0x0 +801059ad: 6a 1d push $0x1d +801059af: e9 59 fa ff ff jmp 8010540d + +801059b4 : +801059b4: 6a 00 push $0x0 +801059b6: 6a 1e push $0x1e +801059b8: e9 50 fa ff ff jmp 8010540d + +801059bd : +801059bd: 6a 00 push $0x0 +801059bf: 6a 1f push $0x1f +801059c1: e9 47 fa ff ff jmp 8010540d + +801059c6 : +801059c6: 6a 00 push $0x0 +801059c8: 6a 20 push $0x20 +801059ca: e9 3e fa ff ff jmp 8010540d + +801059cf : +801059cf: 6a 00 push $0x0 +801059d1: 6a 21 push $0x21 +801059d3: e9 35 fa ff ff jmp 8010540d + +801059d8 : +801059d8: 6a 00 push $0x0 +801059da: 6a 22 push $0x22 +801059dc: e9 2c fa ff ff jmp 8010540d + +801059e1 : +801059e1: 6a 00 push $0x0 +801059e3: 6a 23 push $0x23 +801059e5: e9 23 fa ff ff jmp 8010540d + +801059ea : +801059ea: 6a 00 push $0x0 +801059ec: 6a 24 push $0x24 +801059ee: e9 1a fa ff ff jmp 8010540d + +801059f3 : +801059f3: 6a 00 push $0x0 +801059f5: 6a 25 push $0x25 +801059f7: e9 11 fa ff ff jmp 8010540d + +801059fc : +801059fc: 6a 00 push $0x0 +801059fe: 6a 26 push $0x26 +80105a00: e9 08 fa ff ff jmp 8010540d + +80105a05 : +80105a05: 6a 00 push $0x0 +80105a07: 6a 27 push $0x27 +80105a09: e9 ff f9 ff ff jmp 8010540d + +80105a0e : +80105a0e: 6a 00 push $0x0 +80105a10: 6a 28 push $0x28 +80105a12: e9 f6 f9 ff ff jmp 8010540d + +80105a17 : +80105a17: 6a 00 push $0x0 +80105a19: 6a 29 push $0x29 +80105a1b: e9 ed f9 ff ff jmp 8010540d + +80105a20 : +80105a20: 6a 00 push $0x0 +80105a22: 6a 2a push $0x2a +80105a24: e9 e4 f9 ff ff jmp 8010540d + +80105a29 : +80105a29: 6a 00 push $0x0 +80105a2b: 6a 2b push $0x2b +80105a2d: e9 db f9 ff ff jmp 8010540d + +80105a32 : +80105a32: 6a 00 push $0x0 +80105a34: 6a 2c push $0x2c +80105a36: e9 d2 f9 ff ff jmp 8010540d + +80105a3b : +80105a3b: 6a 00 push $0x0 +80105a3d: 6a 2d push $0x2d +80105a3f: e9 c9 f9 ff ff jmp 8010540d + +80105a44 : +80105a44: 6a 00 push $0x0 +80105a46: 6a 2e push $0x2e +80105a48: e9 c0 f9 ff ff jmp 8010540d + +80105a4d : +80105a4d: 6a 00 push $0x0 +80105a4f: 6a 2f push $0x2f +80105a51: e9 b7 f9 ff ff jmp 8010540d + +80105a56 : +80105a56: 6a 00 push $0x0 +80105a58: 6a 30 push $0x30 +80105a5a: e9 ae f9 ff ff jmp 8010540d + +80105a5f : +80105a5f: 6a 00 push $0x0 +80105a61: 6a 31 push $0x31 +80105a63: e9 a5 f9 ff ff jmp 8010540d + +80105a68 : +80105a68: 6a 00 push $0x0 +80105a6a: 6a 32 push $0x32 +80105a6c: e9 9c f9 ff ff jmp 8010540d + +80105a71 : +80105a71: 6a 00 push $0x0 +80105a73: 6a 33 push $0x33 +80105a75: e9 93 f9 ff ff jmp 8010540d + +80105a7a : +80105a7a: 6a 00 push $0x0 +80105a7c: 6a 34 push $0x34 +80105a7e: e9 8a f9 ff ff jmp 8010540d + +80105a83 : +80105a83: 6a 00 push $0x0 +80105a85: 6a 35 push $0x35 +80105a87: e9 81 f9 ff ff jmp 8010540d + +80105a8c : +80105a8c: 6a 00 push $0x0 +80105a8e: 6a 36 push $0x36 +80105a90: e9 78 f9 ff ff jmp 8010540d + +80105a95 : +80105a95: 6a 00 push $0x0 +80105a97: 6a 37 push $0x37 +80105a99: e9 6f f9 ff ff jmp 8010540d + +80105a9e : +80105a9e: 6a 00 push $0x0 +80105aa0: 6a 38 push $0x38 +80105aa2: e9 66 f9 ff ff jmp 8010540d + +80105aa7 : +80105aa7: 6a 00 push $0x0 +80105aa9: 6a 39 push $0x39 +80105aab: e9 5d f9 ff ff jmp 8010540d + +80105ab0 : +80105ab0: 6a 00 push $0x0 +80105ab2: 6a 3a push $0x3a +80105ab4: e9 54 f9 ff ff jmp 8010540d + +80105ab9 : +80105ab9: 6a 00 push $0x0 +80105abb: 6a 3b push $0x3b +80105abd: e9 4b f9 ff ff jmp 8010540d + +80105ac2 : +80105ac2: 6a 00 push $0x0 +80105ac4: 6a 3c push $0x3c +80105ac6: e9 42 f9 ff ff jmp 8010540d + +80105acb : +80105acb: 6a 00 push $0x0 +80105acd: 6a 3d push $0x3d +80105acf: e9 39 f9 ff ff jmp 8010540d + +80105ad4 : +80105ad4: 6a 00 push $0x0 +80105ad6: 6a 3e push $0x3e +80105ad8: e9 30 f9 ff ff jmp 8010540d + +80105add : +80105add: 6a 00 push $0x0 +80105adf: 6a 3f push $0x3f +80105ae1: e9 27 f9 ff ff jmp 8010540d + +80105ae6 : +80105ae6: 6a 00 push $0x0 +80105ae8: 6a 40 push $0x40 +80105aea: e9 1e f9 ff ff jmp 8010540d + +80105aef : +80105aef: 6a 00 push $0x0 +80105af1: 6a 41 push $0x41 +80105af3: e9 15 f9 ff ff jmp 8010540d + +80105af8 : +80105af8: 6a 00 push $0x0 +80105afa: 6a 42 push $0x42 +80105afc: e9 0c f9 ff ff jmp 8010540d + +80105b01 : +80105b01: 6a 00 push $0x0 +80105b03: 6a 43 push $0x43 +80105b05: e9 03 f9 ff ff jmp 8010540d + +80105b0a : +80105b0a: 6a 00 push $0x0 +80105b0c: 6a 44 push $0x44 +80105b0e: e9 fa f8 ff ff jmp 8010540d + +80105b13 : +80105b13: 6a 00 push $0x0 +80105b15: 6a 45 push $0x45 +80105b17: e9 f1 f8 ff ff jmp 8010540d + +80105b1c : +80105b1c: 6a 00 push $0x0 +80105b1e: 6a 46 push $0x46 +80105b20: e9 e8 f8 ff ff jmp 8010540d + +80105b25 : +80105b25: 6a 00 push $0x0 +80105b27: 6a 47 push $0x47 +80105b29: e9 df f8 ff ff jmp 8010540d + +80105b2e : +80105b2e: 6a 00 push $0x0 +80105b30: 6a 48 push $0x48 +80105b32: e9 d6 f8 ff ff jmp 8010540d + +80105b37 : +80105b37: 6a 00 push $0x0 +80105b39: 6a 49 push $0x49 +80105b3b: e9 cd f8 ff ff jmp 8010540d + +80105b40 : +80105b40: 6a 00 push $0x0 +80105b42: 6a 4a push $0x4a +80105b44: e9 c4 f8 ff ff jmp 8010540d + +80105b49 : +80105b49: 6a 00 push $0x0 +80105b4b: 6a 4b push $0x4b +80105b4d: e9 bb f8 ff ff jmp 8010540d + +80105b52 : +80105b52: 6a 00 push $0x0 +80105b54: 6a 4c push $0x4c +80105b56: e9 b2 f8 ff ff jmp 8010540d + +80105b5b : +80105b5b: 6a 00 push $0x0 +80105b5d: 6a 4d push $0x4d +80105b5f: e9 a9 f8 ff ff jmp 8010540d + +80105b64 : +80105b64: 6a 00 push $0x0 +80105b66: 6a 4e push $0x4e +80105b68: e9 a0 f8 ff ff jmp 8010540d + +80105b6d : +80105b6d: 6a 00 push $0x0 +80105b6f: 6a 4f push $0x4f +80105b71: e9 97 f8 ff ff jmp 8010540d + +80105b76 : +80105b76: 6a 00 push $0x0 +80105b78: 6a 50 push $0x50 +80105b7a: e9 8e f8 ff ff jmp 8010540d + +80105b7f : +80105b7f: 6a 00 push $0x0 +80105b81: 6a 51 push $0x51 +80105b83: e9 85 f8 ff ff jmp 8010540d + +80105b88 : +80105b88: 6a 00 push $0x0 +80105b8a: 6a 52 push $0x52 +80105b8c: e9 7c f8 ff ff jmp 8010540d + +80105b91 : +80105b91: 6a 00 push $0x0 +80105b93: 6a 53 push $0x53 +80105b95: e9 73 f8 ff ff jmp 8010540d + +80105b9a : +80105b9a: 6a 00 push $0x0 +80105b9c: 6a 54 push $0x54 +80105b9e: e9 6a f8 ff ff jmp 8010540d + +80105ba3 : +80105ba3: 6a 00 push $0x0 +80105ba5: 6a 55 push $0x55 +80105ba7: e9 61 f8 ff ff jmp 8010540d + +80105bac : +80105bac: 6a 00 push $0x0 +80105bae: 6a 56 push $0x56 +80105bb0: e9 58 f8 ff ff jmp 8010540d + +80105bb5 : +80105bb5: 6a 00 push $0x0 +80105bb7: 6a 57 push $0x57 +80105bb9: e9 4f f8 ff ff jmp 8010540d + +80105bbe : +80105bbe: 6a 00 push $0x0 +80105bc0: 6a 58 push $0x58 +80105bc2: e9 46 f8 ff ff jmp 8010540d + +80105bc7 : +80105bc7: 6a 00 push $0x0 +80105bc9: 6a 59 push $0x59 +80105bcb: e9 3d f8 ff ff jmp 8010540d + +80105bd0 : +80105bd0: 6a 00 push $0x0 +80105bd2: 6a 5a push $0x5a +80105bd4: e9 34 f8 ff ff jmp 8010540d + +80105bd9 : +80105bd9: 6a 00 push $0x0 +80105bdb: 6a 5b push $0x5b +80105bdd: e9 2b f8 ff ff jmp 8010540d + +80105be2 : +80105be2: 6a 00 push $0x0 +80105be4: 6a 5c push $0x5c +80105be6: e9 22 f8 ff ff jmp 8010540d + +80105beb : +80105beb: 6a 00 push $0x0 +80105bed: 6a 5d push $0x5d +80105bef: e9 19 f8 ff ff jmp 8010540d + +80105bf4 : +80105bf4: 6a 00 push $0x0 +80105bf6: 6a 5e push $0x5e +80105bf8: e9 10 f8 ff ff jmp 8010540d + +80105bfd : +80105bfd: 6a 00 push $0x0 +80105bff: 6a 5f push $0x5f +80105c01: e9 07 f8 ff ff jmp 8010540d + +80105c06 : +80105c06: 6a 00 push $0x0 +80105c08: 6a 60 push $0x60 +80105c0a: e9 fe f7 ff ff jmp 8010540d + +80105c0f : +80105c0f: 6a 00 push $0x0 +80105c11: 6a 61 push $0x61 +80105c13: e9 f5 f7 ff ff jmp 8010540d + +80105c18 : +80105c18: 6a 00 push $0x0 +80105c1a: 6a 62 push $0x62 +80105c1c: e9 ec f7 ff ff jmp 8010540d + +80105c21 : +80105c21: 6a 00 push $0x0 +80105c23: 6a 63 push $0x63 +80105c25: e9 e3 f7 ff ff jmp 8010540d + +80105c2a : +80105c2a: 6a 00 push $0x0 +80105c2c: 6a 64 push $0x64 +80105c2e: e9 da f7 ff ff jmp 8010540d + +80105c33 : +80105c33: 6a 00 push $0x0 +80105c35: 6a 65 push $0x65 +80105c37: e9 d1 f7 ff ff jmp 8010540d + +80105c3c : +80105c3c: 6a 00 push $0x0 +80105c3e: 6a 66 push $0x66 +80105c40: e9 c8 f7 ff ff jmp 8010540d + +80105c45 : +80105c45: 6a 00 push $0x0 +80105c47: 6a 67 push $0x67 +80105c49: e9 bf f7 ff ff jmp 8010540d + +80105c4e : +80105c4e: 6a 00 push $0x0 +80105c50: 6a 68 push $0x68 +80105c52: e9 b6 f7 ff ff jmp 8010540d + +80105c57 : +80105c57: 6a 00 push $0x0 +80105c59: 6a 69 push $0x69 +80105c5b: e9 ad f7 ff ff jmp 8010540d + +80105c60 : +80105c60: 6a 00 push $0x0 +80105c62: 6a 6a push $0x6a +80105c64: e9 a4 f7 ff ff jmp 8010540d + +80105c69 : +80105c69: 6a 00 push $0x0 +80105c6b: 6a 6b push $0x6b +80105c6d: e9 9b f7 ff ff jmp 8010540d + +80105c72 : +80105c72: 6a 00 push $0x0 +80105c74: 6a 6c push $0x6c +80105c76: e9 92 f7 ff ff jmp 8010540d + +80105c7b : +80105c7b: 6a 00 push $0x0 +80105c7d: 6a 6d push $0x6d +80105c7f: e9 89 f7 ff ff jmp 8010540d + +80105c84 : +80105c84: 6a 00 push $0x0 +80105c86: 6a 6e push $0x6e +80105c88: e9 80 f7 ff ff jmp 8010540d + +80105c8d : +80105c8d: 6a 00 push $0x0 +80105c8f: 6a 6f push $0x6f +80105c91: e9 77 f7 ff ff jmp 8010540d + +80105c96 : +80105c96: 6a 00 push $0x0 +80105c98: 6a 70 push $0x70 +80105c9a: e9 6e f7 ff ff jmp 8010540d + +80105c9f : +80105c9f: 6a 00 push $0x0 +80105ca1: 6a 71 push $0x71 +80105ca3: e9 65 f7 ff ff jmp 8010540d + +80105ca8 : +80105ca8: 6a 00 push $0x0 +80105caa: 6a 72 push $0x72 +80105cac: e9 5c f7 ff ff jmp 8010540d + +80105cb1 : +80105cb1: 6a 00 push $0x0 +80105cb3: 6a 73 push $0x73 +80105cb5: e9 53 f7 ff ff jmp 8010540d + +80105cba : +80105cba: 6a 00 push $0x0 +80105cbc: 6a 74 push $0x74 +80105cbe: e9 4a f7 ff ff jmp 8010540d + +80105cc3 : +80105cc3: 6a 00 push $0x0 +80105cc5: 6a 75 push $0x75 +80105cc7: e9 41 f7 ff ff jmp 8010540d + +80105ccc : +80105ccc: 6a 00 push $0x0 +80105cce: 6a 76 push $0x76 +80105cd0: e9 38 f7 ff ff jmp 8010540d + +80105cd5 : +80105cd5: 6a 00 push $0x0 +80105cd7: 6a 77 push $0x77 +80105cd9: e9 2f f7 ff ff jmp 8010540d + +80105cde : +80105cde: 6a 00 push $0x0 +80105ce0: 6a 78 push $0x78 +80105ce2: e9 26 f7 ff ff jmp 8010540d + +80105ce7 : +80105ce7: 6a 00 push $0x0 +80105ce9: 6a 79 push $0x79 +80105ceb: e9 1d f7 ff ff jmp 8010540d + +80105cf0 : +80105cf0: 6a 00 push $0x0 +80105cf2: 6a 7a push $0x7a +80105cf4: e9 14 f7 ff ff jmp 8010540d + +80105cf9 : +80105cf9: 6a 00 push $0x0 +80105cfb: 6a 7b push $0x7b +80105cfd: e9 0b f7 ff ff jmp 8010540d + +80105d02 : +80105d02: 6a 00 push $0x0 +80105d04: 6a 7c push $0x7c +80105d06: e9 02 f7 ff ff jmp 8010540d + +80105d0b : +80105d0b: 6a 00 push $0x0 +80105d0d: 6a 7d push $0x7d +80105d0f: e9 f9 f6 ff ff jmp 8010540d + +80105d14 : +80105d14: 6a 00 push $0x0 +80105d16: 6a 7e push $0x7e +80105d18: e9 f0 f6 ff ff jmp 8010540d + +80105d1d : +80105d1d: 6a 00 push $0x0 +80105d1f: 6a 7f push $0x7f +80105d21: e9 e7 f6 ff ff jmp 8010540d + +80105d26 : +80105d26: 6a 00 push $0x0 +80105d28: 68 80 00 00 00 push $0x80 +80105d2d: e9 db f6 ff ff jmp 8010540d + +80105d32 : +80105d32: 6a 00 push $0x0 +80105d34: 68 81 00 00 00 push $0x81 +80105d39: e9 cf f6 ff ff jmp 8010540d + +80105d3e : +80105d3e: 6a 00 push $0x0 +80105d40: 68 82 00 00 00 push $0x82 +80105d45: e9 c3 f6 ff ff jmp 8010540d + +80105d4a : +80105d4a: 6a 00 push $0x0 +80105d4c: 68 83 00 00 00 push $0x83 +80105d51: e9 b7 f6 ff ff jmp 8010540d + +80105d56 : +80105d56: 6a 00 push $0x0 +80105d58: 68 84 00 00 00 push $0x84 +80105d5d: e9 ab f6 ff ff jmp 8010540d + +80105d62 : +80105d62: 6a 00 push $0x0 +80105d64: 68 85 00 00 00 push $0x85 +80105d69: e9 9f f6 ff ff jmp 8010540d + +80105d6e : +80105d6e: 6a 00 push $0x0 +80105d70: 68 86 00 00 00 push $0x86 +80105d75: e9 93 f6 ff ff jmp 8010540d + +80105d7a : +80105d7a: 6a 00 push $0x0 +80105d7c: 68 87 00 00 00 push $0x87 +80105d81: e9 87 f6 ff ff jmp 8010540d + +80105d86 : +80105d86: 6a 00 push $0x0 +80105d88: 68 88 00 00 00 push $0x88 +80105d8d: e9 7b f6 ff ff jmp 8010540d + +80105d92 : +80105d92: 6a 00 push $0x0 +80105d94: 68 89 00 00 00 push $0x89 +80105d99: e9 6f f6 ff ff jmp 8010540d + +80105d9e : +80105d9e: 6a 00 push $0x0 +80105da0: 68 8a 00 00 00 push $0x8a +80105da5: e9 63 f6 ff ff jmp 8010540d + +80105daa : +80105daa: 6a 00 push $0x0 +80105dac: 68 8b 00 00 00 push $0x8b +80105db1: e9 57 f6 ff ff jmp 8010540d + +80105db6 : +80105db6: 6a 00 push $0x0 +80105db8: 68 8c 00 00 00 push $0x8c +80105dbd: e9 4b f6 ff ff jmp 8010540d + +80105dc2 : +80105dc2: 6a 00 push $0x0 +80105dc4: 68 8d 00 00 00 push $0x8d +80105dc9: e9 3f f6 ff ff jmp 8010540d + +80105dce : +80105dce: 6a 00 push $0x0 +80105dd0: 68 8e 00 00 00 push $0x8e +80105dd5: e9 33 f6 ff ff jmp 8010540d + +80105dda : +80105dda: 6a 00 push $0x0 +80105ddc: 68 8f 00 00 00 push $0x8f +80105de1: e9 27 f6 ff ff jmp 8010540d + +80105de6 : +80105de6: 6a 00 push $0x0 +80105de8: 68 90 00 00 00 push $0x90 +80105ded: e9 1b f6 ff ff jmp 8010540d + +80105df2 : +80105df2: 6a 00 push $0x0 +80105df4: 68 91 00 00 00 push $0x91 +80105df9: e9 0f f6 ff ff jmp 8010540d + +80105dfe : +80105dfe: 6a 00 push $0x0 +80105e00: 68 92 00 00 00 push $0x92 +80105e05: e9 03 f6 ff ff jmp 8010540d + +80105e0a : +80105e0a: 6a 00 push $0x0 +80105e0c: 68 93 00 00 00 push $0x93 +80105e11: e9 f7 f5 ff ff jmp 8010540d + +80105e16 : +80105e16: 6a 00 push $0x0 +80105e18: 68 94 00 00 00 push $0x94 +80105e1d: e9 eb f5 ff ff jmp 8010540d + +80105e22 : +80105e22: 6a 00 push $0x0 +80105e24: 68 95 00 00 00 push $0x95 +80105e29: e9 df f5 ff ff jmp 8010540d + +80105e2e : +80105e2e: 6a 00 push $0x0 +80105e30: 68 96 00 00 00 push $0x96 +80105e35: e9 d3 f5 ff ff jmp 8010540d + +80105e3a : +80105e3a: 6a 00 push $0x0 +80105e3c: 68 97 00 00 00 push $0x97 +80105e41: e9 c7 f5 ff ff jmp 8010540d + +80105e46 : +80105e46: 6a 00 push $0x0 +80105e48: 68 98 00 00 00 push $0x98 +80105e4d: e9 bb f5 ff ff jmp 8010540d + +80105e52 : +80105e52: 6a 00 push $0x0 +80105e54: 68 99 00 00 00 push $0x99 +80105e59: e9 af f5 ff ff jmp 8010540d + +80105e5e : +80105e5e: 6a 00 push $0x0 +80105e60: 68 9a 00 00 00 push $0x9a +80105e65: e9 a3 f5 ff ff jmp 8010540d + +80105e6a : +80105e6a: 6a 00 push $0x0 +80105e6c: 68 9b 00 00 00 push $0x9b +80105e71: e9 97 f5 ff ff jmp 8010540d + +80105e76 : +80105e76: 6a 00 push $0x0 +80105e78: 68 9c 00 00 00 push $0x9c +80105e7d: e9 8b f5 ff ff jmp 8010540d + +80105e82 : +80105e82: 6a 00 push $0x0 +80105e84: 68 9d 00 00 00 push $0x9d +80105e89: e9 7f f5 ff ff jmp 8010540d + +80105e8e : +80105e8e: 6a 00 push $0x0 +80105e90: 68 9e 00 00 00 push $0x9e +80105e95: e9 73 f5 ff ff jmp 8010540d + +80105e9a : +80105e9a: 6a 00 push $0x0 +80105e9c: 68 9f 00 00 00 push $0x9f +80105ea1: e9 67 f5 ff ff jmp 8010540d + +80105ea6 : +80105ea6: 6a 00 push $0x0 +80105ea8: 68 a0 00 00 00 push $0xa0 +80105ead: e9 5b f5 ff ff jmp 8010540d + +80105eb2 : +80105eb2: 6a 00 push $0x0 +80105eb4: 68 a1 00 00 00 push $0xa1 +80105eb9: e9 4f f5 ff ff jmp 8010540d + +80105ebe : +80105ebe: 6a 00 push $0x0 +80105ec0: 68 a2 00 00 00 push $0xa2 +80105ec5: e9 43 f5 ff ff jmp 8010540d + +80105eca : +80105eca: 6a 00 push $0x0 +80105ecc: 68 a3 00 00 00 push $0xa3 +80105ed1: e9 37 f5 ff ff jmp 8010540d + +80105ed6 : +80105ed6: 6a 00 push $0x0 +80105ed8: 68 a4 00 00 00 push $0xa4 +80105edd: e9 2b f5 ff ff jmp 8010540d + +80105ee2 : +80105ee2: 6a 00 push $0x0 +80105ee4: 68 a5 00 00 00 push $0xa5 +80105ee9: e9 1f f5 ff ff jmp 8010540d + +80105eee : +80105eee: 6a 00 push $0x0 +80105ef0: 68 a6 00 00 00 push $0xa6 +80105ef5: e9 13 f5 ff ff jmp 8010540d + +80105efa : +80105efa: 6a 00 push $0x0 +80105efc: 68 a7 00 00 00 push $0xa7 +80105f01: e9 07 f5 ff ff jmp 8010540d + +80105f06 : +80105f06: 6a 00 push $0x0 +80105f08: 68 a8 00 00 00 push $0xa8 +80105f0d: e9 fb f4 ff ff jmp 8010540d + +80105f12 : +80105f12: 6a 00 push $0x0 +80105f14: 68 a9 00 00 00 push $0xa9 +80105f19: e9 ef f4 ff ff jmp 8010540d + +80105f1e : +80105f1e: 6a 00 push $0x0 +80105f20: 68 aa 00 00 00 push $0xaa +80105f25: e9 e3 f4 ff ff jmp 8010540d + +80105f2a : +80105f2a: 6a 00 push $0x0 +80105f2c: 68 ab 00 00 00 push $0xab +80105f31: e9 d7 f4 ff ff jmp 8010540d + +80105f36 : +80105f36: 6a 00 push $0x0 +80105f38: 68 ac 00 00 00 push $0xac +80105f3d: e9 cb f4 ff ff jmp 8010540d + +80105f42 : +80105f42: 6a 00 push $0x0 +80105f44: 68 ad 00 00 00 push $0xad +80105f49: e9 bf f4 ff ff jmp 8010540d + +80105f4e : +80105f4e: 6a 00 push $0x0 +80105f50: 68 ae 00 00 00 push $0xae +80105f55: e9 b3 f4 ff ff jmp 8010540d + +80105f5a : +80105f5a: 6a 00 push $0x0 +80105f5c: 68 af 00 00 00 push $0xaf +80105f61: e9 a7 f4 ff ff jmp 8010540d + +80105f66 : +80105f66: 6a 00 push $0x0 +80105f68: 68 b0 00 00 00 push $0xb0 +80105f6d: e9 9b f4 ff ff jmp 8010540d + +80105f72 : +80105f72: 6a 00 push $0x0 +80105f74: 68 b1 00 00 00 push $0xb1 +80105f79: e9 8f f4 ff ff jmp 8010540d + +80105f7e : +80105f7e: 6a 00 push $0x0 +80105f80: 68 b2 00 00 00 push $0xb2 +80105f85: e9 83 f4 ff ff jmp 8010540d + +80105f8a : +80105f8a: 6a 00 push $0x0 +80105f8c: 68 b3 00 00 00 push $0xb3 +80105f91: e9 77 f4 ff ff jmp 8010540d + +80105f96 : +80105f96: 6a 00 push $0x0 +80105f98: 68 b4 00 00 00 push $0xb4 +80105f9d: e9 6b f4 ff ff jmp 8010540d + +80105fa2 : +80105fa2: 6a 00 push $0x0 +80105fa4: 68 b5 00 00 00 push $0xb5 +80105fa9: e9 5f f4 ff ff jmp 8010540d + +80105fae : +80105fae: 6a 00 push $0x0 +80105fb0: 68 b6 00 00 00 push $0xb6 +80105fb5: e9 53 f4 ff ff jmp 8010540d + +80105fba : +80105fba: 6a 00 push $0x0 +80105fbc: 68 b7 00 00 00 push $0xb7 +80105fc1: e9 47 f4 ff ff jmp 8010540d + +80105fc6 : +80105fc6: 6a 00 push $0x0 +80105fc8: 68 b8 00 00 00 push $0xb8 +80105fcd: e9 3b f4 ff ff jmp 8010540d + +80105fd2 : +80105fd2: 6a 00 push $0x0 +80105fd4: 68 b9 00 00 00 push $0xb9 +80105fd9: e9 2f f4 ff ff jmp 8010540d + +80105fde : +80105fde: 6a 00 push $0x0 +80105fe0: 68 ba 00 00 00 push $0xba +80105fe5: e9 23 f4 ff ff jmp 8010540d + +80105fea : +80105fea: 6a 00 push $0x0 +80105fec: 68 bb 00 00 00 push $0xbb +80105ff1: e9 17 f4 ff ff jmp 8010540d + +80105ff6 : +80105ff6: 6a 00 push $0x0 +80105ff8: 68 bc 00 00 00 push $0xbc +80105ffd: e9 0b f4 ff ff jmp 8010540d + +80106002 : +80106002: 6a 00 push $0x0 +80106004: 68 bd 00 00 00 push $0xbd +80106009: e9 ff f3 ff ff jmp 8010540d + +8010600e : +8010600e: 6a 00 push $0x0 +80106010: 68 be 00 00 00 push $0xbe +80106015: e9 f3 f3 ff ff jmp 8010540d + +8010601a : +8010601a: 6a 00 push $0x0 +8010601c: 68 bf 00 00 00 push $0xbf +80106021: e9 e7 f3 ff ff jmp 8010540d + +80106026 : +80106026: 6a 00 push $0x0 +80106028: 68 c0 00 00 00 push $0xc0 +8010602d: e9 db f3 ff ff jmp 8010540d + +80106032 : +80106032: 6a 00 push $0x0 +80106034: 68 c1 00 00 00 push $0xc1 +80106039: e9 cf f3 ff ff jmp 8010540d + +8010603e : +8010603e: 6a 00 push $0x0 +80106040: 68 c2 00 00 00 push $0xc2 +80106045: e9 c3 f3 ff ff jmp 8010540d + +8010604a : +8010604a: 6a 00 push $0x0 +8010604c: 68 c3 00 00 00 push $0xc3 +80106051: e9 b7 f3 ff ff jmp 8010540d + +80106056 : +80106056: 6a 00 push $0x0 +80106058: 68 c4 00 00 00 push $0xc4 +8010605d: e9 ab f3 ff ff jmp 8010540d + +80106062 : +80106062: 6a 00 push $0x0 +80106064: 68 c5 00 00 00 push $0xc5 +80106069: e9 9f f3 ff ff jmp 8010540d + +8010606e : +8010606e: 6a 00 push $0x0 +80106070: 68 c6 00 00 00 push $0xc6 +80106075: e9 93 f3 ff ff jmp 8010540d + +8010607a : +8010607a: 6a 00 push $0x0 +8010607c: 68 c7 00 00 00 push $0xc7 +80106081: e9 87 f3 ff ff jmp 8010540d + +80106086 : +80106086: 6a 00 push $0x0 +80106088: 68 c8 00 00 00 push $0xc8 +8010608d: e9 7b f3 ff ff jmp 8010540d + +80106092 : +80106092: 6a 00 push $0x0 +80106094: 68 c9 00 00 00 push $0xc9 +80106099: e9 6f f3 ff ff jmp 8010540d + +8010609e : +8010609e: 6a 00 push $0x0 +801060a0: 68 ca 00 00 00 push $0xca +801060a5: e9 63 f3 ff ff jmp 8010540d + +801060aa : +801060aa: 6a 00 push $0x0 +801060ac: 68 cb 00 00 00 push $0xcb +801060b1: e9 57 f3 ff ff jmp 8010540d + +801060b6 : +801060b6: 6a 00 push $0x0 +801060b8: 68 cc 00 00 00 push $0xcc +801060bd: e9 4b f3 ff ff jmp 8010540d + +801060c2 : +801060c2: 6a 00 push $0x0 +801060c4: 68 cd 00 00 00 push $0xcd +801060c9: e9 3f f3 ff ff jmp 8010540d + +801060ce : +801060ce: 6a 00 push $0x0 +801060d0: 68 ce 00 00 00 push $0xce +801060d5: e9 33 f3 ff ff jmp 8010540d + +801060da : +801060da: 6a 00 push $0x0 +801060dc: 68 cf 00 00 00 push $0xcf +801060e1: e9 27 f3 ff ff jmp 8010540d + +801060e6 : +801060e6: 6a 00 push $0x0 +801060e8: 68 d0 00 00 00 push $0xd0 +801060ed: e9 1b f3 ff ff jmp 8010540d + +801060f2 : +801060f2: 6a 00 push $0x0 +801060f4: 68 d1 00 00 00 push $0xd1 +801060f9: e9 0f f3 ff ff jmp 8010540d + +801060fe : +801060fe: 6a 00 push $0x0 +80106100: 68 d2 00 00 00 push $0xd2 +80106105: e9 03 f3 ff ff jmp 8010540d + +8010610a : +8010610a: 6a 00 push $0x0 +8010610c: 68 d3 00 00 00 push $0xd3 +80106111: e9 f7 f2 ff ff jmp 8010540d + +80106116 : +80106116: 6a 00 push $0x0 +80106118: 68 d4 00 00 00 push $0xd4 +8010611d: e9 eb f2 ff ff jmp 8010540d + +80106122 : +80106122: 6a 00 push $0x0 +80106124: 68 d5 00 00 00 push $0xd5 +80106129: e9 df f2 ff ff jmp 8010540d + +8010612e : +8010612e: 6a 00 push $0x0 +80106130: 68 d6 00 00 00 push $0xd6 +80106135: e9 d3 f2 ff ff jmp 8010540d + +8010613a : +8010613a: 6a 00 push $0x0 +8010613c: 68 d7 00 00 00 push $0xd7 +80106141: e9 c7 f2 ff ff jmp 8010540d + +80106146 : +80106146: 6a 00 push $0x0 +80106148: 68 d8 00 00 00 push $0xd8 +8010614d: e9 bb f2 ff ff jmp 8010540d + +80106152 : +80106152: 6a 00 push $0x0 +80106154: 68 d9 00 00 00 push $0xd9 +80106159: e9 af f2 ff ff jmp 8010540d + +8010615e : +8010615e: 6a 00 push $0x0 +80106160: 68 da 00 00 00 push $0xda +80106165: e9 a3 f2 ff ff jmp 8010540d + +8010616a : +8010616a: 6a 00 push $0x0 +8010616c: 68 db 00 00 00 push $0xdb +80106171: e9 97 f2 ff ff jmp 8010540d + +80106176 : +80106176: 6a 00 push $0x0 +80106178: 68 dc 00 00 00 push $0xdc +8010617d: e9 8b f2 ff ff jmp 8010540d + +80106182 : +80106182: 6a 00 push $0x0 +80106184: 68 dd 00 00 00 push $0xdd +80106189: e9 7f f2 ff ff jmp 8010540d + +8010618e : +8010618e: 6a 00 push $0x0 +80106190: 68 de 00 00 00 push $0xde +80106195: e9 73 f2 ff ff jmp 8010540d + +8010619a : +8010619a: 6a 00 push $0x0 +8010619c: 68 df 00 00 00 push $0xdf +801061a1: e9 67 f2 ff ff jmp 8010540d + +801061a6 : +801061a6: 6a 00 push $0x0 +801061a8: 68 e0 00 00 00 push $0xe0 +801061ad: e9 5b f2 ff ff jmp 8010540d + +801061b2 : +801061b2: 6a 00 push $0x0 +801061b4: 68 e1 00 00 00 push $0xe1 +801061b9: e9 4f f2 ff ff jmp 8010540d + +801061be : +801061be: 6a 00 push $0x0 +801061c0: 68 e2 00 00 00 push $0xe2 +801061c5: e9 43 f2 ff ff jmp 8010540d + +801061ca : +801061ca: 6a 00 push $0x0 +801061cc: 68 e3 00 00 00 push $0xe3 +801061d1: e9 37 f2 ff ff jmp 8010540d + +801061d6 : +801061d6: 6a 00 push $0x0 +801061d8: 68 e4 00 00 00 push $0xe4 +801061dd: e9 2b f2 ff ff jmp 8010540d + +801061e2 : +801061e2: 6a 00 push $0x0 +801061e4: 68 e5 00 00 00 push $0xe5 +801061e9: e9 1f f2 ff ff jmp 8010540d + +801061ee : +801061ee: 6a 00 push $0x0 +801061f0: 68 e6 00 00 00 push $0xe6 +801061f5: e9 13 f2 ff ff jmp 8010540d + +801061fa : +801061fa: 6a 00 push $0x0 +801061fc: 68 e7 00 00 00 push $0xe7 +80106201: e9 07 f2 ff ff jmp 8010540d + +80106206 : +80106206: 6a 00 push $0x0 +80106208: 68 e8 00 00 00 push $0xe8 +8010620d: e9 fb f1 ff ff jmp 8010540d + +80106212 : +80106212: 6a 00 push $0x0 +80106214: 68 e9 00 00 00 push $0xe9 +80106219: e9 ef f1 ff ff jmp 8010540d + +8010621e : +8010621e: 6a 00 push $0x0 +80106220: 68 ea 00 00 00 push $0xea +80106225: e9 e3 f1 ff ff jmp 8010540d + +8010622a : +8010622a: 6a 00 push $0x0 +8010622c: 68 eb 00 00 00 push $0xeb +80106231: e9 d7 f1 ff ff jmp 8010540d + +80106236 : +80106236: 6a 00 push $0x0 +80106238: 68 ec 00 00 00 push $0xec +8010623d: e9 cb f1 ff ff jmp 8010540d + +80106242 : +80106242: 6a 00 push $0x0 +80106244: 68 ed 00 00 00 push $0xed +80106249: e9 bf f1 ff ff jmp 8010540d + +8010624e : +8010624e: 6a 00 push $0x0 +80106250: 68 ee 00 00 00 push $0xee +80106255: e9 b3 f1 ff ff jmp 8010540d + +8010625a : +8010625a: 6a 00 push $0x0 +8010625c: 68 ef 00 00 00 push $0xef +80106261: e9 a7 f1 ff ff jmp 8010540d + +80106266 : +80106266: 6a 00 push $0x0 +80106268: 68 f0 00 00 00 push $0xf0 +8010626d: e9 9b f1 ff ff jmp 8010540d + +80106272 : +80106272: 6a 00 push $0x0 +80106274: 68 f1 00 00 00 push $0xf1 +80106279: e9 8f f1 ff ff jmp 8010540d + +8010627e : +8010627e: 6a 00 push $0x0 +80106280: 68 f2 00 00 00 push $0xf2 +80106285: e9 83 f1 ff ff jmp 8010540d + +8010628a : +8010628a: 6a 00 push $0x0 +8010628c: 68 f3 00 00 00 push $0xf3 +80106291: e9 77 f1 ff ff jmp 8010540d + +80106296 : +80106296: 6a 00 push $0x0 +80106298: 68 f4 00 00 00 push $0xf4 +8010629d: e9 6b f1 ff ff jmp 8010540d + +801062a2 : +801062a2: 6a 00 push $0x0 +801062a4: 68 f5 00 00 00 push $0xf5 +801062a9: e9 5f f1 ff ff jmp 8010540d + +801062ae : +801062ae: 6a 00 push $0x0 +801062b0: 68 f6 00 00 00 push $0xf6 +801062b5: e9 53 f1 ff ff jmp 8010540d + +801062ba : +801062ba: 6a 00 push $0x0 +801062bc: 68 f7 00 00 00 push $0xf7 +801062c1: e9 47 f1 ff ff jmp 8010540d + +801062c6 : +801062c6: 6a 00 push $0x0 +801062c8: 68 f8 00 00 00 push $0xf8 +801062cd: e9 3b f1 ff ff jmp 8010540d + +801062d2 : +801062d2: 6a 00 push $0x0 +801062d4: 68 f9 00 00 00 push $0xf9 +801062d9: e9 2f f1 ff ff jmp 8010540d + +801062de : +801062de: 6a 00 push $0x0 +801062e0: 68 fa 00 00 00 push $0xfa +801062e5: e9 23 f1 ff ff jmp 8010540d + +801062ea : +801062ea: 6a 00 push $0x0 +801062ec: 68 fb 00 00 00 push $0xfb +801062f1: e9 17 f1 ff ff jmp 8010540d + +801062f6 : +801062f6: 6a 00 push $0x0 +801062f8: 68 fc 00 00 00 push $0xfc +801062fd: e9 0b f1 ff ff jmp 8010540d + +80106302 : +80106302: 6a 00 push $0x0 +80106304: 68 fd 00 00 00 push $0xfd +80106309: e9 ff f0 ff ff jmp 8010540d + +8010630e : +8010630e: 6a 00 push $0x0 +80106310: 68 fe 00 00 00 push $0xfe +80106315: e9 f3 f0 ff ff jmp 8010540d + +8010631a : +8010631a: 6a 00 push $0x0 +8010631c: 68 ff 00 00 00 push $0xff +80106321: e9 e7 f0 ff ff jmp 8010540d +80106326: 66 90 xchg %ax,%ax +80106328: 66 90 xchg %ax,%ax +8010632a: 66 90 xchg %ax,%ax +8010632c: 66 90 xchg %ax,%ax +8010632e: 66 90 xchg %ax,%ax + +80106330 : +// 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) +{ +80106330: 55 push %ebp +80106331: 89 e5 mov %esp,%ebp +80106333: 57 push %edi +80106334: 56 push %esi +80106335: 89 d6 mov %edx,%esi + pde_t *pde; + pte_t *pgtab; + + pde = &pgdir[PDX(va)]; +80106337: c1 ea 16 shr $0x16,%edx +{ +8010633a: 53 push %ebx + pde = &pgdir[PDX(va)]; +8010633b: 8d 3c 90 lea (%eax,%edx,4),%edi +{ +8010633e: 83 ec 1c sub $0x1c,%esp + if(*pde & PTE_P){ +80106341: 8b 1f mov (%edi),%ebx +80106343: f6 c3 01 test $0x1,%bl +80106346: 74 28 je 80106370 + pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); +80106348: 81 e3 00 f0 ff ff and $0xfffff000,%ebx +8010634e: 81 c3 00 00 00 80 add $0x80000000,%ebx + // The permissions here are overly generous, but they can + // be further restricted by the permissions in the page table + // entries, if necessary. + *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; + } + return &pgtab[PTX(va)]; +80106354: c1 ee 0a shr $0xa,%esi +} +80106357: 83 c4 1c add $0x1c,%esp + return &pgtab[PTX(va)]; +8010635a: 89 f2 mov %esi,%edx +8010635c: 81 e2 fc 0f 00 00 and $0xffc,%edx +80106362: 8d 04 13 lea (%ebx,%edx,1),%eax +} +80106365: 5b pop %ebx +80106366: 5e pop %esi +80106367: 5f pop %edi +80106368: 5d pop %ebp +80106369: c3 ret +8010636a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) +80106370: 85 c9 test %ecx,%ecx +80106372: 74 34 je 801063a8 +80106374: e8 27 c1 ff ff call 801024a0 +80106379: 85 c0 test %eax,%eax +8010637b: 89 c3 mov %eax,%ebx +8010637d: 74 29 je 801063a8 + memset(pgtab, 0, PGSIZE); +8010637f: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +80106386: 00 +80106387: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +8010638e: 00 +8010638f: 89 04 24 mov %eax,(%esp) +80106392: e8 09 df ff ff call 801042a0 + *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; +80106397: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +8010639d: 83 c8 07 or $0x7,%eax +801063a0: 89 07 mov %eax,(%edi) +801063a2: eb b0 jmp 80106354 +801063a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +} +801063a8: 83 c4 1c add $0x1c,%esp + return 0; +801063ab: 31 c0 xor %eax,%eax +} +801063ad: 5b pop %ebx +801063ae: 5e pop %esi +801063af: 5f pop %edi +801063b0: 5d pop %ebp +801063b1: c3 ret +801063b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +801063b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801063c0 : +// 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) +{ +801063c0: 55 push %ebp +801063c1: 89 e5 mov %esp,%ebp +801063c3: 57 push %edi +801063c4: 56 push %esi +801063c5: 53 push %ebx + char *a, *last; + pte_t *pte; + + a = (char*)PGROUNDDOWN((uint)va); +801063c6: 89 d3 mov %edx,%ebx +{ +801063c8: 83 ec 1c sub $0x1c,%esp +801063cb: 8b 7d 08 mov 0x8(%ebp),%edi + a = (char*)PGROUNDDOWN((uint)va); +801063ce: 81 e3 00 f0 ff ff and $0xfffff000,%ebx +{ +801063d4: 89 45 e0 mov %eax,-0x20(%ebp) + last = (char*)PGROUNDDOWN(((uint)va) + size - 1); +801063d7: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax +801063db: 89 45 e4 mov %eax,-0x1c(%ebp) + for(;;){ + if((pte = walkpgdir(pgdir, a, 1)) == 0) + return -1; + if(*pte & PTE_P) + panic("remap"); + *pte = pa | perm | PTE_P; +801063de: 83 4d 0c 01 orl $0x1,0xc(%ebp) + last = (char*)PGROUNDDOWN(((uint)va) + size - 1); +801063e2: 81 65 e4 00 f0 ff ff andl $0xfffff000,-0x1c(%ebp) +801063e9: 29 df sub %ebx,%edi +801063eb: eb 18 jmp 80106405 +801063ed: 8d 76 00 lea 0x0(%esi),%esi + if(*pte & PTE_P) +801063f0: f6 00 01 testb $0x1,(%eax) +801063f3: 75 3d jne 80106432 + *pte = pa | perm | PTE_P; +801063f5: 0b 75 0c or 0xc(%ebp),%esi + if(a == last) +801063f8: 3b 5d e4 cmp -0x1c(%ebp),%ebx + *pte = pa | perm | PTE_P; +801063fb: 89 30 mov %esi,(%eax) + if(a == last) +801063fd: 74 29 je 80106428 + break; + a += PGSIZE; +801063ff: 81 c3 00 10 00 00 add $0x1000,%ebx + if((pte = walkpgdir(pgdir, a, 1)) == 0) +80106405: 8b 45 e0 mov -0x20(%ebp),%eax +80106408: b9 01 00 00 00 mov $0x1,%ecx +8010640d: 89 da mov %ebx,%edx +8010640f: 8d 34 3b lea (%ebx,%edi,1),%esi +80106412: e8 19 ff ff ff call 80106330 +80106417: 85 c0 test %eax,%eax +80106419: 75 d5 jne 801063f0 + pa += PGSIZE; + } + return 0; +} +8010641b: 83 c4 1c add $0x1c,%esp + return -1; +8010641e: b8 ff ff ff ff mov $0xffffffff,%eax +} +80106423: 5b pop %ebx +80106424: 5e pop %esi +80106425: 5f pop %edi +80106426: 5d pop %ebp +80106427: c3 ret +80106428: 83 c4 1c add $0x1c,%esp + return 0; +8010642b: 31 c0 xor %eax,%eax +} +8010642d: 5b pop %ebx +8010642e: 5e pop %esi +8010642f: 5f pop %edi +80106430: 5d pop %ebp +80106431: c3 ret + panic("remap"); +80106432: c7 04 24 08 75 10 80 movl $0x80107508,(%esp) +80106439: e8 22 9f ff ff call 80100360 +8010643e: 66 90 xchg %ax,%ax + +80106440 : +// Deallocate user pages to bring the process size from oldsz to +// newsz. oldsz and newsz need not be page-aligned, nor does newsz +// need to be less than oldsz. oldsz can be larger than the actual +// process size. Returns the new process size. +int +deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) +80106440: 55 push %ebp +80106441: 89 e5 mov %esp,%ebp +80106443: 57 push %edi +80106444: 89 c7 mov %eax,%edi +80106446: 56 push %esi +80106447: 89 d6 mov %edx,%esi +80106449: 53 push %ebx + uint a, pa; + + if(newsz >= oldsz) + return oldsz; + + a = PGROUNDUP(newsz); +8010644a: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx +deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) +80106450: 83 ec 1c sub $0x1c,%esp + a = PGROUNDUP(newsz); +80106453: 81 e3 00 f0 ff ff and $0xfffff000,%ebx + for(; a < oldsz; a += PGSIZE){ +80106459: 39 d3 cmp %edx,%ebx +deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) +8010645b: 89 4d e0 mov %ecx,-0x20(%ebp) + for(; a < oldsz; a += PGSIZE){ +8010645e: 72 3b jb 8010649b +80106460: eb 5e jmp 801064c0 +80106462: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + pte = walkpgdir(pgdir, (char*)a, 0); + if(!pte) + a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; + else if((*pte & PTE_P) != 0){ +80106468: 8b 10 mov (%eax),%edx +8010646a: f6 c2 01 test $0x1,%dl +8010646d: 74 22 je 80106491 + pa = PTE_ADDR(*pte); + if(pa == 0) +8010646f: 81 e2 00 f0 ff ff and $0xfffff000,%edx +80106475: 74 54 je 801064cb + panic("kfree"); + char *v = P2V(pa); +80106477: 81 c2 00 00 00 80 add $0x80000000,%edx + kfree(v); +8010647d: 89 14 24 mov %edx,(%esp) +80106480: 89 45 e4 mov %eax,-0x1c(%ebp) +80106483: e8 68 be ff ff call 801022f0 + *pte = 0; +80106488: 8b 45 e4 mov -0x1c(%ebp),%eax +8010648b: c7 00 00 00 00 00 movl $0x0,(%eax) + for(; a < oldsz; a += PGSIZE){ +80106491: 81 c3 00 10 00 00 add $0x1000,%ebx +80106497: 39 f3 cmp %esi,%ebx +80106499: 73 25 jae 801064c0 + pte = walkpgdir(pgdir, (char*)a, 0); +8010649b: 31 c9 xor %ecx,%ecx +8010649d: 89 da mov %ebx,%edx +8010649f: 89 f8 mov %edi,%eax +801064a1: e8 8a fe ff ff call 80106330 + if(!pte) +801064a6: 85 c0 test %eax,%eax +801064a8: 75 be jne 80106468 + a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; +801064aa: 81 e3 00 00 c0 ff and $0xffc00000,%ebx +801064b0: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx + for(; a < oldsz; a += PGSIZE){ +801064b6: 81 c3 00 10 00 00 add $0x1000,%ebx +801064bc: 39 f3 cmp %esi,%ebx +801064be: 72 db jb 8010649b + } + } + return newsz; +} +801064c0: 8b 45 e0 mov -0x20(%ebp),%eax +801064c3: 83 c4 1c add $0x1c,%esp +801064c6: 5b pop %ebx +801064c7: 5e pop %esi +801064c8: 5f pop %edi +801064c9: 5d pop %ebp +801064ca: c3 ret + panic("kfree"); +801064cb: c7 04 24 a6 6e 10 80 movl $0x80106ea6,(%esp) +801064d2: e8 89 9e ff ff call 80100360 +801064d7: 89 f6 mov %esi,%esi +801064d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801064e0 : +{ +801064e0: 55 push %ebp +801064e1: 89 e5 mov %esp,%ebp +801064e3: 83 ec 18 sub $0x18,%esp + c = &cpus[cpuid()]; +801064e6: e8 95 d1 ff ff call 80103680 + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +801064eb: 31 c9 xor %ecx,%ecx +801064ed: ba ff ff ff ff mov $0xffffffff,%edx + c = &cpus[cpuid()]; +801064f2: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax +801064f8: 05 80 27 11 80 add $0x80112780,%eax + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +801064fd: 66 89 50 78 mov %dx,0x78(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +80106501: ba ff ff ff ff mov $0xffffffff,%edx + lgdt(c->gdt, sizeof(c->gdt)); +80106506: 83 c0 70 add $0x70,%eax + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +80106509: 66 89 48 0a mov %cx,0xa(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +8010650d: 31 c9 xor %ecx,%ecx +8010650f: 66 89 50 10 mov %dx,0x10(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +80106513: ba ff ff ff ff mov $0xffffffff,%edx + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +80106518: 66 89 48 12 mov %cx,0x12(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +8010651c: 31 c9 xor %ecx,%ecx +8010651e: 66 89 50 18 mov %dx,0x18(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +80106522: ba ff ff ff ff mov $0xffffffff,%edx + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +80106527: 66 89 48 1a mov %cx,0x1a(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +8010652b: 31 c9 xor %ecx,%ecx + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +8010652d: c6 40 0d 9a movb $0x9a,0xd(%eax) +80106531: c6 40 0e cf movb $0xcf,0xe(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +80106535: c6 40 15 92 movb $0x92,0x15(%eax) +80106539: c6 40 16 cf movb $0xcf,0x16(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +8010653d: c6 40 1d fa movb $0xfa,0x1d(%eax) +80106541: c6 40 1e cf movb $0xcf,0x1e(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +80106545: c6 40 25 f2 movb $0xf2,0x25(%eax) +80106549: c6 40 26 cf movb $0xcf,0x26(%eax) +8010654d: 66 89 50 20 mov %dx,0x20(%eax) + pd[0] = size-1; +80106551: ba 2f 00 00 00 mov $0x2f,%edx + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +80106556: c6 40 0c 00 movb $0x0,0xc(%eax) +8010655a: c6 40 0f 00 movb $0x0,0xf(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +8010655e: c6 40 14 00 movb $0x0,0x14(%eax) +80106562: c6 40 17 00 movb $0x0,0x17(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +80106566: c6 40 1c 00 movb $0x0,0x1c(%eax) +8010656a: c6 40 1f 00 movb $0x0,0x1f(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +8010656e: 66 89 48 22 mov %cx,0x22(%eax) +80106572: c6 40 24 00 movb $0x0,0x24(%eax) +80106576: c6 40 27 00 movb $0x0,0x27(%eax) +8010657a: 66 89 55 f2 mov %dx,-0xe(%ebp) + pd[1] = (uint)p; +8010657e: 66 89 45 f4 mov %ax,-0xc(%ebp) + pd[2] = (uint)p >> 16; +80106582: c1 e8 10 shr $0x10,%eax +80106585: 66 89 45 f6 mov %ax,-0xa(%ebp) + asm volatile("lgdt (%0)" : : "r" (pd)); +80106589: 8d 45 f2 lea -0xe(%ebp),%eax +8010658c: 0f 01 10 lgdtl (%eax) +} +8010658f: c9 leave +80106590: c3 ret +80106591: eb 0d jmp 801065a0 +80106593: 90 nop +80106594: 90 nop +80106595: 90 nop +80106596: 90 nop +80106597: 90 nop +80106598: 90 nop +80106599: 90 nop +8010659a: 90 nop +8010659b: 90 nop +8010659c: 90 nop +8010659d: 90 nop +8010659e: 90 nop +8010659f: 90 nop + +801065a0 : + lcr3(V2P(kpgdir)); // switch to the kernel page table +801065a0: a1 a4 55 11 80 mov 0x801155a4,%eax +{ +801065a5: 55 push %ebp +801065a6: 89 e5 mov %esp,%ebp + lcr3(V2P(kpgdir)); // switch to the kernel page table +801065a8: 05 00 00 00 80 add $0x80000000,%eax +} + +static inline void +lcr3(uint val) +{ + asm volatile("movl %0,%%cr3" : : "r" (val)); +801065ad: 0f 22 d8 mov %eax,%cr3 +} +801065b0: 5d pop %ebp +801065b1: c3 ret +801065b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +801065b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801065c0 : +{ +801065c0: 55 push %ebp +801065c1: 89 e5 mov %esp,%ebp +801065c3: 57 push %edi +801065c4: 56 push %esi +801065c5: 53 push %ebx +801065c6: 83 ec 1c sub $0x1c,%esp +801065c9: 8b 75 08 mov 0x8(%ebp),%esi + if(p == 0) +801065cc: 85 f6 test %esi,%esi +801065ce: 0f 84 cd 00 00 00 je 801066a1 + if(p->kstack == 0) +801065d4: 8b 46 08 mov 0x8(%esi),%eax +801065d7: 85 c0 test %eax,%eax +801065d9: 0f 84 da 00 00 00 je 801066b9 + if(p->pgdir == 0) +801065df: 8b 7e 04 mov 0x4(%esi),%edi +801065e2: 85 ff test %edi,%edi +801065e4: 0f 84 c3 00 00 00 je 801066ad + pushcli(); +801065ea: e8 01 db ff ff call 801040f0 + mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, +801065ef: e8 0c d0 ff ff call 80103600 +801065f4: 89 c3 mov %eax,%ebx +801065f6: e8 05 d0 ff ff call 80103600 +801065fb: 89 c7 mov %eax,%edi +801065fd: e8 fe cf ff ff call 80103600 +80106602: 83 c7 08 add $0x8,%edi +80106605: 89 45 e4 mov %eax,-0x1c(%ebp) +80106608: e8 f3 cf ff ff call 80103600 +8010660d: 8b 4d e4 mov -0x1c(%ebp),%ecx +80106610: ba 67 00 00 00 mov $0x67,%edx +80106615: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) +8010661c: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) +80106623: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) +8010662a: 83 c1 08 add $0x8,%ecx +8010662d: c1 e9 10 shr $0x10,%ecx +80106630: 83 c0 08 add $0x8,%eax +80106633: c1 e8 18 shr $0x18,%eax +80106636: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) +8010663c: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) +80106643: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) + mycpu()->ts.iomb = (ushort) 0xFFFF; +80106649: bb ff ff ff ff mov $0xffffffff,%ebx + mycpu()->gdt[SEG_TSS].s = 0; +8010664e: e8 ad cf ff ff call 80103600 +80106653: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) + mycpu()->ts.ss0 = SEG_KDATA << 3; +8010665a: e8 a1 cf ff ff call 80103600 +8010665f: b9 10 00 00 00 mov $0x10,%ecx +80106664: 66 89 48 10 mov %cx,0x10(%eax) + mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; +80106668: e8 93 cf ff ff call 80103600 +8010666d: 8b 56 08 mov 0x8(%esi),%edx +80106670: 8d 8a 00 10 00 00 lea 0x1000(%edx),%ecx +80106676: 89 48 0c mov %ecx,0xc(%eax) + mycpu()->ts.iomb = (ushort) 0xFFFF; +80106679: e8 82 cf ff ff call 80103600 +8010667e: 66 89 58 6e mov %bx,0x6e(%eax) + asm volatile("ltr %0" : : "r" (sel)); +80106682: b8 28 00 00 00 mov $0x28,%eax +80106687: 0f 00 d8 ltr %ax + lcr3(V2P(p->pgdir)); // switch to process's address space +8010668a: 8b 46 04 mov 0x4(%esi),%eax +8010668d: 05 00 00 00 80 add $0x80000000,%eax + asm volatile("movl %0,%%cr3" : : "r" (val)); +80106692: 0f 22 d8 mov %eax,%cr3 +} +80106695: 83 c4 1c add $0x1c,%esp +80106698: 5b pop %ebx +80106699: 5e pop %esi +8010669a: 5f pop %edi +8010669b: 5d pop %ebp + popcli(); +8010669c: e9 8f da ff ff jmp 80104130 + panic("switchuvm: no process"); +801066a1: c7 04 24 0e 75 10 80 movl $0x8010750e,(%esp) +801066a8: e8 b3 9c ff ff call 80100360 + panic("switchuvm: no pgdir"); +801066ad: c7 04 24 39 75 10 80 movl $0x80107539,(%esp) +801066b4: e8 a7 9c ff ff call 80100360 + panic("switchuvm: no kstack"); +801066b9: c7 04 24 24 75 10 80 movl $0x80107524,(%esp) +801066c0: e8 9b 9c ff ff call 80100360 +801066c5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801066c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +801066d0 : +{ +801066d0: 55 push %ebp +801066d1: 89 e5 mov %esp,%ebp +801066d3: 57 push %edi +801066d4: 56 push %esi +801066d5: 53 push %ebx +801066d6: 83 ec 1c sub $0x1c,%esp +801066d9: 8b 75 10 mov 0x10(%ebp),%esi +801066dc: 8b 45 08 mov 0x8(%ebp),%eax +801066df: 8b 7d 0c mov 0xc(%ebp),%edi + if(sz >= PGSIZE) +801066e2: 81 fe ff 0f 00 00 cmp $0xfff,%esi +{ +801066e8: 89 45 e4 mov %eax,-0x1c(%ebp) + if(sz >= PGSIZE) +801066eb: 77 54 ja 80106741 + mem = kalloc(); +801066ed: e8 ae bd ff ff call 801024a0 + memset(mem, 0, PGSIZE); +801066f2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +801066f9: 00 +801066fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +80106701: 00 + mem = kalloc(); +80106702: 89 c3 mov %eax,%ebx + memset(mem, 0, PGSIZE); +80106704: 89 04 24 mov %eax,(%esp) +80106707: e8 94 db ff ff call 801042a0 + mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); +8010670c: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +80106712: b9 00 10 00 00 mov $0x1000,%ecx +80106717: 89 04 24 mov %eax,(%esp) +8010671a: 8b 45 e4 mov -0x1c(%ebp),%eax +8010671d: 31 d2 xor %edx,%edx +8010671f: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) +80106726: 00 +80106727: e8 94 fc ff ff call 801063c0 + memmove(mem, init, sz); +8010672c: 89 75 10 mov %esi,0x10(%ebp) +8010672f: 89 7d 0c mov %edi,0xc(%ebp) +80106732: 89 5d 08 mov %ebx,0x8(%ebp) +} +80106735: 83 c4 1c add $0x1c,%esp +80106738: 5b pop %ebx +80106739: 5e pop %esi +8010673a: 5f pop %edi +8010673b: 5d pop %ebp + memmove(mem, init, sz); +8010673c: e9 ff db ff ff jmp 80104340 + panic("inituvm: more than a page"); +80106741: c7 04 24 4d 75 10 80 movl $0x8010754d,(%esp) +80106748: e8 13 9c ff ff call 80100360 +8010674d: 8d 76 00 lea 0x0(%esi),%esi + +80106750 : +{ +80106750: 55 push %ebp +80106751: 89 e5 mov %esp,%ebp +80106753: 57 push %edi +80106754: 56 push %esi +80106755: 53 push %ebx +80106756: 83 ec 1c sub $0x1c,%esp + if((uint) addr % PGSIZE != 0) +80106759: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp) +80106760: 0f 85 98 00 00 00 jne 801067fe + for(i = 0; i < sz; i += PGSIZE){ +80106766: 8b 75 18 mov 0x18(%ebp),%esi +80106769: 31 db xor %ebx,%ebx +8010676b: 85 f6 test %esi,%esi +8010676d: 75 1a jne 80106789 +8010676f: eb 77 jmp 801067e8 +80106771: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80106778: 81 c3 00 10 00 00 add $0x1000,%ebx +8010677e: 81 ee 00 10 00 00 sub $0x1000,%esi +80106784: 39 5d 18 cmp %ebx,0x18(%ebp) +80106787: 76 5f jbe 801067e8 +80106789: 8b 55 0c mov 0xc(%ebp),%edx + if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) +8010678c: 31 c9 xor %ecx,%ecx +8010678e: 8b 45 08 mov 0x8(%ebp),%eax +80106791: 01 da add %ebx,%edx +80106793: e8 98 fb ff ff call 80106330 +80106798: 85 c0 test %eax,%eax +8010679a: 74 56 je 801067f2 + pa = PTE_ADDR(*pte); +8010679c: 8b 00 mov (%eax),%eax + n = PGSIZE; +8010679e: bf 00 10 00 00 mov $0x1000,%edi +801067a3: 8b 4d 14 mov 0x14(%ebp),%ecx + pa = PTE_ADDR(*pte); +801067a6: 25 00 f0 ff ff and $0xfffff000,%eax + n = PGSIZE; +801067ab: 81 fe 00 10 00 00 cmp $0x1000,%esi +801067b1: 0f 42 fe cmovb %esi,%edi + if(readi(ip, P2V(pa), offset+i, n) != n) +801067b4: 05 00 00 00 80 add $0x80000000,%eax +801067b9: 89 44 24 04 mov %eax,0x4(%esp) +801067bd: 8b 45 10 mov 0x10(%ebp),%eax +801067c0: 01 d9 add %ebx,%ecx +801067c2: 89 7c 24 0c mov %edi,0xc(%esp) +801067c6: 89 4c 24 08 mov %ecx,0x8(%esp) +801067ca: 89 04 24 mov %eax,(%esp) +801067cd: e8 8e b1 ff ff call 80101960 +801067d2: 39 f8 cmp %edi,%eax +801067d4: 74 a2 je 80106778 +} +801067d6: 83 c4 1c add $0x1c,%esp + return -1; +801067d9: b8 ff ff ff ff mov $0xffffffff,%eax +} +801067de: 5b pop %ebx +801067df: 5e pop %esi +801067e0: 5f pop %edi +801067e1: 5d pop %ebp +801067e2: c3 ret +801067e3: 90 nop +801067e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801067e8: 83 c4 1c add $0x1c,%esp + return 0; +801067eb: 31 c0 xor %eax,%eax +} +801067ed: 5b pop %ebx +801067ee: 5e pop %esi +801067ef: 5f pop %edi +801067f0: 5d pop %ebp +801067f1: c3 ret + panic("loaduvm: address should exist"); +801067f2: c7 04 24 67 75 10 80 movl $0x80107567,(%esp) +801067f9: e8 62 9b ff ff call 80100360 + panic("loaduvm: addr must be page aligned"); +801067fe: c7 04 24 08 76 10 80 movl $0x80107608,(%esp) +80106805: e8 56 9b ff ff call 80100360 +8010680a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80106810 : +{ +80106810: 55 push %ebp +80106811: 89 e5 mov %esp,%ebp +80106813: 57 push %edi +80106814: 56 push %esi +80106815: 53 push %ebx +80106816: 83 ec 1c sub $0x1c,%esp +80106819: 8b 7d 10 mov 0x10(%ebp),%edi + if(newsz >= KERNBASE) +8010681c: 85 ff test %edi,%edi +8010681e: 0f 88 7e 00 00 00 js 801068a2 + if(newsz < oldsz) +80106824: 3b 7d 0c cmp 0xc(%ebp),%edi + return oldsz; +80106827: 8b 45 0c mov 0xc(%ebp),%eax + if(newsz < oldsz) +8010682a: 72 78 jb 801068a4 + a = PGROUNDUP(oldsz); +8010682c: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx +80106832: 81 e3 00 f0 ff ff and $0xfffff000,%ebx + for(; a < newsz; a += PGSIZE){ +80106838: 39 df cmp %ebx,%edi +8010683a: 77 4a ja 80106886 +8010683c: eb 72 jmp 801068b0 +8010683e: 66 90 xchg %ax,%ax + memset(mem, 0, PGSIZE); +80106840: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +80106847: 00 +80106848: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +8010684f: 00 +80106850: 89 04 24 mov %eax,(%esp) +80106853: e8 48 da ff ff call 801042a0 + if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ +80106858: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax +8010685e: b9 00 10 00 00 mov $0x1000,%ecx +80106863: 89 04 24 mov %eax,(%esp) +80106866: 8b 45 08 mov 0x8(%ebp),%eax +80106869: 89 da mov %ebx,%edx +8010686b: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) +80106872: 00 +80106873: e8 48 fb ff ff call 801063c0 +80106878: 85 c0 test %eax,%eax +8010687a: 78 44 js 801068c0 + for(; a < newsz; a += PGSIZE){ +8010687c: 81 c3 00 10 00 00 add $0x1000,%ebx +80106882: 39 df cmp %ebx,%edi +80106884: 76 2a jbe 801068b0 + mem = kalloc(); +80106886: e8 15 bc ff ff call 801024a0 + if(mem == 0){ +8010688b: 85 c0 test %eax,%eax + mem = kalloc(); +8010688d: 89 c6 mov %eax,%esi + if(mem == 0){ +8010688f: 75 af jne 80106840 + cprintf("allocuvm out of memory\n"); +80106891: c7 04 24 85 75 10 80 movl $0x80107585,(%esp) +80106898: e8 b3 9d ff ff call 80100650 + if(newsz >= oldsz) +8010689d: 3b 7d 0c cmp 0xc(%ebp),%edi +801068a0: 77 48 ja 801068ea + return 0; +801068a2: 31 c0 xor %eax,%eax +} +801068a4: 83 c4 1c add $0x1c,%esp +801068a7: 5b pop %ebx +801068a8: 5e pop %esi +801068a9: 5f pop %edi +801068aa: 5d pop %ebp +801068ab: c3 ret +801068ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +801068b0: 83 c4 1c add $0x1c,%esp +801068b3: 89 f8 mov %edi,%eax +801068b5: 5b pop %ebx +801068b6: 5e pop %esi +801068b7: 5f pop %edi +801068b8: 5d pop %ebp +801068b9: c3 ret +801068ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + cprintf("allocuvm out of memory (2)\n"); +801068c0: c7 04 24 9d 75 10 80 movl $0x8010759d,(%esp) +801068c7: e8 84 9d ff ff call 80100650 + if(newsz >= oldsz) +801068cc: 3b 7d 0c cmp 0xc(%ebp),%edi +801068cf: 76 0d jbe 801068de +801068d1: 8b 4d 0c mov 0xc(%ebp),%ecx +801068d4: 89 fa mov %edi,%edx +801068d6: 8b 45 08 mov 0x8(%ebp),%eax +801068d9: e8 62 fb ff ff call 80106440 + kfree(mem); +801068de: 89 34 24 mov %esi,(%esp) +801068e1: e8 0a ba ff ff call 801022f0 + return 0; +801068e6: 31 c0 xor %eax,%eax +801068e8: eb ba jmp 801068a4 +801068ea: 8b 4d 0c mov 0xc(%ebp),%ecx +801068ed: 89 fa mov %edi,%edx +801068ef: 8b 45 08 mov 0x8(%ebp),%eax +801068f2: e8 49 fb ff ff call 80106440 + return 0; +801068f7: 31 c0 xor %eax,%eax +801068f9: eb a9 jmp 801068a4 +801068fb: 90 nop +801068fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80106900 : +{ +80106900: 55 push %ebp +80106901: 89 e5 mov %esp,%ebp +80106903: 8b 55 0c mov 0xc(%ebp),%edx +80106906: 8b 4d 10 mov 0x10(%ebp),%ecx +80106909: 8b 45 08 mov 0x8(%ebp),%eax + if(newsz >= oldsz) +8010690c: 39 d1 cmp %edx,%ecx +8010690e: 73 08 jae 80106918 +} +80106910: 5d pop %ebp +80106911: e9 2a fb ff ff jmp 80106440 +80106916: 66 90 xchg %ax,%ax +80106918: 89 d0 mov %edx,%eax +8010691a: 5d pop %ebp +8010691b: c3 ret +8010691c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +80106920 : + +// Free a page table and all the physical memory pages +// in the user part. +void +freevm(pde_t *pgdir) +{ +80106920: 55 push %ebp +80106921: 89 e5 mov %esp,%ebp +80106923: 56 push %esi +80106924: 53 push %ebx +80106925: 83 ec 10 sub $0x10,%esp +80106928: 8b 75 08 mov 0x8(%ebp),%esi + uint i; + + if(pgdir == 0) +8010692b: 85 f6 test %esi,%esi +8010692d: 74 59 je 80106988 +8010692f: 31 c9 xor %ecx,%ecx +80106931: ba 00 00 00 80 mov $0x80000000,%edx +80106936: 89 f0 mov %esi,%eax + panic("freevm: no pgdir"); + deallocuvm(pgdir, KERNBASE, 0); + for(i = 0; i < NPDENTRIES; i++){ +80106938: 31 db xor %ebx,%ebx +8010693a: e8 01 fb ff ff call 80106440 +8010693f: eb 12 jmp 80106953 +80106941: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +80106948: 83 c3 01 add $0x1,%ebx +8010694b: 81 fb 00 04 00 00 cmp $0x400,%ebx +80106951: 74 27 je 8010697a + if(pgdir[i] & PTE_P){ +80106953: 8b 14 9e mov (%esi,%ebx,4),%edx +80106956: f6 c2 01 test $0x1,%dl +80106959: 74 ed je 80106948 + char * v = P2V(PTE_ADDR(pgdir[i])); +8010695b: 81 e2 00 f0 ff ff and $0xfffff000,%edx + for(i = 0; i < NPDENTRIES; i++){ +80106961: 83 c3 01 add $0x1,%ebx + char * v = P2V(PTE_ADDR(pgdir[i])); +80106964: 81 c2 00 00 00 80 add $0x80000000,%edx + kfree(v); +8010696a: 89 14 24 mov %edx,(%esp) +8010696d: e8 7e b9 ff ff call 801022f0 + for(i = 0; i < NPDENTRIES; i++){ +80106972: 81 fb 00 04 00 00 cmp $0x400,%ebx +80106978: 75 d9 jne 80106953 + } + } + kfree((char*)pgdir); +8010697a: 89 75 08 mov %esi,0x8(%ebp) +} +8010697d: 83 c4 10 add $0x10,%esp +80106980: 5b pop %ebx +80106981: 5e pop %esi +80106982: 5d pop %ebp + kfree((char*)pgdir); +80106983: e9 68 b9 ff ff jmp 801022f0 + panic("freevm: no pgdir"); +80106988: c7 04 24 b9 75 10 80 movl $0x801075b9,(%esp) +8010698f: e8 cc 99 ff ff call 80100360 +80106994: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +8010699a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +801069a0 : +{ +801069a0: 55 push %ebp +801069a1: 89 e5 mov %esp,%ebp +801069a3: 56 push %esi +801069a4: 53 push %ebx +801069a5: 83 ec 10 sub $0x10,%esp + if((pgdir = (pde_t*)kalloc()) == 0) +801069a8: e8 f3 ba ff ff call 801024a0 +801069ad: 85 c0 test %eax,%eax +801069af: 89 c6 mov %eax,%esi +801069b1: 74 6d je 80106a20 + memset(pgdir, 0, PGSIZE); +801069b3: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +801069ba: 00 + for(k = kmap; k < &kmap[NELEM(kmap)]; k++) +801069bb: bb 20 a4 10 80 mov $0x8010a420,%ebx + memset(pgdir, 0, PGSIZE); +801069c0: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +801069c7: 00 +801069c8: 89 04 24 mov %eax,(%esp) +801069cb: e8 d0 d8 ff ff call 801042a0 + if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, +801069d0: 8b 53 0c mov 0xc(%ebx),%edx +801069d3: 8b 43 04 mov 0x4(%ebx),%eax +801069d6: 8b 4b 08 mov 0x8(%ebx),%ecx +801069d9: 89 54 24 04 mov %edx,0x4(%esp) +801069dd: 8b 13 mov (%ebx),%edx +801069df: 89 04 24 mov %eax,(%esp) +801069e2: 29 c1 sub %eax,%ecx +801069e4: 89 f0 mov %esi,%eax +801069e6: e8 d5 f9 ff ff call 801063c0 +801069eb: 85 c0 test %eax,%eax +801069ed: 78 19 js 80106a08 + for(k = kmap; k < &kmap[NELEM(kmap)]; k++) +801069ef: 83 c3 10 add $0x10,%ebx +801069f2: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx +801069f8: 72 d6 jb 801069d0 +801069fa: 89 f0 mov %esi,%eax +} +801069fc: 83 c4 10 add $0x10,%esp +801069ff: 5b pop %ebx +80106a00: 5e pop %esi +80106a01: 5d pop %ebp +80106a02: c3 ret +80106a03: 90 nop +80106a04: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + freevm(pgdir); +80106a08: 89 34 24 mov %esi,(%esp) +80106a0b: e8 10 ff ff ff call 80106920 +} +80106a10: 83 c4 10 add $0x10,%esp + return 0; +80106a13: 31 c0 xor %eax,%eax +} +80106a15: 5b pop %ebx +80106a16: 5e pop %esi +80106a17: 5d pop %ebp +80106a18: c3 ret +80106a19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +80106a20: 31 c0 xor %eax,%eax +80106a22: eb d8 jmp 801069fc +80106a24: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80106a2a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +80106a30 : +{ +80106a30: 55 push %ebp +80106a31: 89 e5 mov %esp,%ebp +80106a33: 83 ec 08 sub $0x8,%esp + kpgdir = setupkvm(); +80106a36: e8 65 ff ff ff call 801069a0 +80106a3b: a3 a4 55 11 80 mov %eax,0x801155a4 + lcr3(V2P(kpgdir)); // switch to the kernel page table +80106a40: 05 00 00 00 80 add $0x80000000,%eax +80106a45: 0f 22 d8 mov %eax,%cr3 +} +80106a48: c9 leave +80106a49: c3 ret +80106a4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +80106a50 : + +// Clear PTE_U on a page. Used to create an inaccessible +// page beneath the user stack. +void +clearpteu(pde_t *pgdir, char *uva) +{ +80106a50: 55 push %ebp + pte_t *pte; + + pte = walkpgdir(pgdir, uva, 0); +80106a51: 31 c9 xor %ecx,%ecx +{ +80106a53: 89 e5 mov %esp,%ebp +80106a55: 83 ec 18 sub $0x18,%esp + pte = walkpgdir(pgdir, uva, 0); +80106a58: 8b 55 0c mov 0xc(%ebp),%edx +80106a5b: 8b 45 08 mov 0x8(%ebp),%eax +80106a5e: e8 cd f8 ff ff call 80106330 + if(pte == 0) +80106a63: 85 c0 test %eax,%eax +80106a65: 74 05 je 80106a6c + panic("clearpteu"); + *pte &= ~PTE_U; +80106a67: 83 20 fb andl $0xfffffffb,(%eax) +} +80106a6a: c9 leave +80106a6b: c3 ret + panic("clearpteu"); +80106a6c: c7 04 24 ca 75 10 80 movl $0x801075ca,(%esp) +80106a73: e8 e8 98 ff ff call 80100360 +80106a78: 90 nop +80106a79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +80106a80 : + +// Given a parent process's page table, create a copy +// of it for a child. +pde_t* +copyuvm(pde_t *pgdir, uint sz) +{ +80106a80: 55 push %ebp +80106a81: 89 e5 mov %esp,%ebp +80106a83: 57 push %edi +80106a84: 56 push %esi +80106a85: 53 push %ebx +80106a86: 83 ec 2c sub $0x2c,%esp + pde_t *d; + pte_t *pte; + uint pa, i, flags; + char *mem; + + if((d = setupkvm()) == 0) +80106a89: e8 12 ff ff ff call 801069a0 +80106a8e: 85 c0 test %eax,%eax +80106a90: 89 45 e0 mov %eax,-0x20(%ebp) +80106a93: 0f 84 b9 00 00 00 je 80106b52 + return 0; + for(i = 0; i < sz; i += PGSIZE){ +80106a99: 8b 45 0c mov 0xc(%ebp),%eax +80106a9c: 85 c0 test %eax,%eax +80106a9e: 0f 84 94 00 00 00 je 80106b38 +80106aa4: 31 ff xor %edi,%edi +80106aa6: eb 48 jmp 80106af0 + panic("copyuvm: page not present"); + pa = PTE_ADDR(*pte); + flags = PTE_FLAGS(*pte); + if((mem = kalloc()) == 0) + goto bad; + memmove(mem, (char*)P2V(pa), PGSIZE); +80106aa8: 81 c6 00 00 00 80 add $0x80000000,%esi +80106aae: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +80106ab5: 00 +80106ab6: 89 74 24 04 mov %esi,0x4(%esp) +80106aba: 89 04 24 mov %eax,(%esp) +80106abd: e8 7e d8 ff ff call 80104340 + if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { +80106ac2: 8b 45 e4 mov -0x1c(%ebp),%eax +80106ac5: b9 00 10 00 00 mov $0x1000,%ecx +80106aca: 89 fa mov %edi,%edx +80106acc: 89 44 24 04 mov %eax,0x4(%esp) +80106ad0: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +80106ad6: 89 04 24 mov %eax,(%esp) +80106ad9: 8b 45 e0 mov -0x20(%ebp),%eax +80106adc: e8 df f8 ff ff call 801063c0 +80106ae1: 85 c0 test %eax,%eax +80106ae3: 78 63 js 80106b48 + for(i = 0; i < sz; i += PGSIZE){ +80106ae5: 81 c7 00 10 00 00 add $0x1000,%edi +80106aeb: 39 7d 0c cmp %edi,0xc(%ebp) +80106aee: 76 48 jbe 80106b38 + if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) +80106af0: 8b 45 08 mov 0x8(%ebp),%eax +80106af3: 31 c9 xor %ecx,%ecx +80106af5: 89 fa mov %edi,%edx +80106af7: e8 34 f8 ff ff call 80106330 +80106afc: 85 c0 test %eax,%eax +80106afe: 74 62 je 80106b62 + if(!(*pte & PTE_P)) +80106b00: 8b 00 mov (%eax),%eax +80106b02: a8 01 test $0x1,%al +80106b04: 74 50 je 80106b56 + pa = PTE_ADDR(*pte); +80106b06: 89 c6 mov %eax,%esi + flags = PTE_FLAGS(*pte); +80106b08: 25 ff 0f 00 00 and $0xfff,%eax +80106b0d: 89 45 e4 mov %eax,-0x1c(%ebp) + pa = PTE_ADDR(*pte); +80106b10: 81 e6 00 f0 ff ff and $0xfffff000,%esi + if((mem = kalloc()) == 0) +80106b16: e8 85 b9 ff ff call 801024a0 +80106b1b: 85 c0 test %eax,%eax +80106b1d: 89 c3 mov %eax,%ebx +80106b1f: 75 87 jne 80106aa8 + } + } + return d; + +bad: + freevm(d); +80106b21: 8b 45 e0 mov -0x20(%ebp),%eax +80106b24: 89 04 24 mov %eax,(%esp) +80106b27: e8 f4 fd ff ff call 80106920 + return 0; +80106b2c: 31 c0 xor %eax,%eax +} +80106b2e: 83 c4 2c add $0x2c,%esp +80106b31: 5b pop %ebx +80106b32: 5e pop %esi +80106b33: 5f pop %edi +80106b34: 5d pop %ebp +80106b35: c3 ret +80106b36: 66 90 xchg %ax,%ax +80106b38: 8b 45 e0 mov -0x20(%ebp),%eax +80106b3b: 83 c4 2c add $0x2c,%esp +80106b3e: 5b pop %ebx +80106b3f: 5e pop %esi +80106b40: 5f pop %edi +80106b41: 5d pop %ebp +80106b42: c3 ret +80106b43: 90 nop +80106b44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + kfree(mem); +80106b48: 89 1c 24 mov %ebx,(%esp) +80106b4b: e8 a0 b7 ff ff call 801022f0 + goto bad; +80106b50: eb cf jmp 80106b21 + return 0; +80106b52: 31 c0 xor %eax,%eax +80106b54: eb d8 jmp 80106b2e + panic("copyuvm: page not present"); +80106b56: c7 04 24 ee 75 10 80 movl $0x801075ee,(%esp) +80106b5d: e8 fe 97 ff ff call 80100360 + panic("copyuvm: pte should exist"); +80106b62: c7 04 24 d4 75 10 80 movl $0x801075d4,(%esp) +80106b69: e8 f2 97 ff ff call 80100360 +80106b6e: 66 90 xchg %ax,%ax + +80106b70 : + +//PAGEBREAK! +// Map user virtual address to kernel address. +char* +uva2ka(pde_t *pgdir, char *uva) +{ +80106b70: 55 push %ebp + pte_t *pte; + + pte = walkpgdir(pgdir, uva, 0); +80106b71: 31 c9 xor %ecx,%ecx +{ +80106b73: 89 e5 mov %esp,%ebp +80106b75: 83 ec 08 sub $0x8,%esp + pte = walkpgdir(pgdir, uva, 0); +80106b78: 8b 55 0c mov 0xc(%ebp),%edx +80106b7b: 8b 45 08 mov 0x8(%ebp),%eax +80106b7e: e8 ad f7 ff ff call 80106330 + if((*pte & PTE_P) == 0) +80106b83: 8b 00 mov (%eax),%eax +80106b85: 89 c2 mov %eax,%edx +80106b87: 83 e2 05 and $0x5,%edx + return 0; + if((*pte & PTE_U) == 0) +80106b8a: 83 fa 05 cmp $0x5,%edx +80106b8d: 75 11 jne 80106ba0 + return 0; + return (char*)P2V(PTE_ADDR(*pte)); +80106b8f: 25 00 f0 ff ff and $0xfffff000,%eax +80106b94: 05 00 00 00 80 add $0x80000000,%eax +} +80106b99: c9 leave +80106b9a: c3 ret +80106b9b: 90 nop +80106b9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +80106ba0: 31 c0 xor %eax,%eax +} +80106ba2: c9 leave +80106ba3: c3 ret +80106ba4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +80106baa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +80106bb0 : +// 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) +{ +80106bb0: 55 push %ebp +80106bb1: 89 e5 mov %esp,%ebp +80106bb3: 57 push %edi +80106bb4: 56 push %esi +80106bb5: 53 push %ebx +80106bb6: 83 ec 1c sub $0x1c,%esp +80106bb9: 8b 5d 14 mov 0x14(%ebp),%ebx +80106bbc: 8b 4d 0c mov 0xc(%ebp),%ecx +80106bbf: 8b 7d 10 mov 0x10(%ebp),%edi + char *buf, *pa0; + uint n, va0; + + buf = (char*)p; + while(len > 0){ +80106bc2: 85 db test %ebx,%ebx +80106bc4: 75 3a jne 80106c00 +80106bc6: eb 68 jmp 80106c30 + va0 = (uint)PGROUNDDOWN(va); + pa0 = uva2ka(pgdir, (char*)va0); + if(pa0 == 0) + return -1; + n = PGSIZE - (va - va0); +80106bc8: 8b 4d e4 mov -0x1c(%ebp),%ecx +80106bcb: 89 f2 mov %esi,%edx + if(n > len) + n = len; + memmove(pa0 + (va - va0), buf, n); +80106bcd: 89 7c 24 04 mov %edi,0x4(%esp) + n = PGSIZE - (va - va0); +80106bd1: 29 ca sub %ecx,%edx +80106bd3: 81 c2 00 10 00 00 add $0x1000,%edx +80106bd9: 39 da cmp %ebx,%edx +80106bdb: 0f 47 d3 cmova %ebx,%edx + memmove(pa0 + (va - va0), buf, n); +80106bde: 29 f1 sub %esi,%ecx +80106be0: 01 c8 add %ecx,%eax +80106be2: 89 54 24 08 mov %edx,0x8(%esp) +80106be6: 89 04 24 mov %eax,(%esp) +80106be9: 89 55 e4 mov %edx,-0x1c(%ebp) +80106bec: e8 4f d7 ff ff call 80104340 + len -= n; + buf += n; +80106bf1: 8b 55 e4 mov -0x1c(%ebp),%edx + va = va0 + PGSIZE; +80106bf4: 8d 8e 00 10 00 00 lea 0x1000(%esi),%ecx + buf += n; +80106bfa: 01 d7 add %edx,%edi + while(len > 0){ +80106bfc: 29 d3 sub %edx,%ebx +80106bfe: 74 30 je 80106c30 + pa0 = uva2ka(pgdir, (char*)va0); +80106c00: 8b 45 08 mov 0x8(%ebp),%eax + va0 = (uint)PGROUNDDOWN(va); +80106c03: 89 ce mov %ecx,%esi +80106c05: 81 e6 00 f0 ff ff and $0xfffff000,%esi + pa0 = uva2ka(pgdir, (char*)va0); +80106c0b: 89 74 24 04 mov %esi,0x4(%esp) + va0 = (uint)PGROUNDDOWN(va); +80106c0f: 89 4d e4 mov %ecx,-0x1c(%ebp) + pa0 = uva2ka(pgdir, (char*)va0); +80106c12: 89 04 24 mov %eax,(%esp) +80106c15: e8 56 ff ff ff call 80106b70 + if(pa0 == 0) +80106c1a: 85 c0 test %eax,%eax +80106c1c: 75 aa jne 80106bc8 + } + return 0; +} +80106c1e: 83 c4 1c add $0x1c,%esp + return -1; +80106c21: b8 ff ff ff ff mov $0xffffffff,%eax +} +80106c26: 5b pop %ebx +80106c27: 5e pop %esi +80106c28: 5f pop %edi +80106c29: 5d pop %ebp +80106c2a: c3 ret +80106c2b: 90 nop +80106c2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +80106c30: 83 c4 1c add $0x1c,%esp + return 0; +80106c33: 31 c0 xor %eax,%eax +} +80106c35: 5b pop %ebx +80106c36: 5e pop %esi +80106c37: 5f pop %edi +80106c38: 5d pop %ebp +80106c39: c3 ret diff --git a/kernel.sym b/kernel.sym new file mode 100644 index 0000000000..c44986b8ed --- /dev/null +++ b/kernel.sym @@ -0,0 +1,517 @@ +80100000 .text +80106c40 .rodata +80108000 .data +8010a520 .bss +00000000 .debug_line +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_aranges +00000000 .debug_loc +00000000 .debug_ranges +00000000 .debug_str +00000000 .comment +00000000 bio.c +00000000 console.c +8010a520 cons +8010a558 panicked +801003e0 consputc +80100570 printint +80106cb0 digits.1847 +00000000 exec.c +00000000 file.c +00000000 fs.c +80101100 bfree +80101180 balloc +801012a0 iget +80101360 bmap +80101c80 namex +00000000 ide.c +80101f40 idestart +8010a580 idelock +8010a560 havedisk1 +8010a564 idequeue +00000000 ioapic.c +00000000 kalloc.c +00000000 kbd.c +8010a5b4 shift.1687 +80106fe0 shiftcode +80106ee0 togglecode +80106ec0 charcode.1688 +80108200 normalmap +80108100 shiftmap +80108000 ctlmap +00000000 lapic.c +801025f0 fill_rtcdate +00000000 log.c +80102960 install_trans +80102a00 write_head +00000000 main.c +80102d80 mpmain +80102dd0 mpenter +00000000 mp.c +80102f20 mpsearch1 +00000000 picirq.c +00000000 pipe.c +00000000 proc.c +801034c0 allocproc +8010a000 first.1889 +8010a5b8 initproc +801072a0 states.1915 +00000000 sleeplock.c +00000000 spinlock.c +00000000 string.c +00000000 syscall.c +80107320 syscalls +00000000 sysfile.c +801046d0 fdalloc +80104710 create +80104890 argfd.constprop.0 +00000000 sysproc.c +00000000 trap.c +00000000 uart.c +80105780 uartgetc +8010a5bc uart +00000000 vm.c +80106330 walkpgdir +801063c0 mappages +80106440 deallocuvm.part.0 +8010a420 kmap +80100270 consoleread +8010627e vector242 +80105cd5 vector119 +8010000c entry +80105bb5 vector87 +80105bac vector86 +80104480 safestrcpy +80104a20 sys_close +801062ea vector251 +80105bd9 vector91 +801059cf vector33 +80105ebe vector162 +80103bc0 yield +80112680 log +80112640 kmem +80106122 vector213 +80105c72 vector108 +80105800 uartinit +80105a29 vector43 +80102780 lapiceoi +80105ee2 vector165 +80105fd2 vector185 +80102200 ioapicinit +80105cb1 vector115 +80100f40 fileread +80105cf0 vector122 +801052e0 sys_sbrk +80112760 ioapicid +80105e76 vector156 +801062a2 vector245 +80112634 ioapic +80106002 vector189 +801058f3 vector7 +80105acb vector61 +8010597e vector24 +80105c8d vector111 +80106086 vector200 +80105b01 vector67 +80105d9e vector138 +80105b40 vector74 +80103a00 sched +80104340 memmove +80105aa7 vector57 +80104660 syscall +8010612e vector214 +80105c21 vector99 +80103680 cpuid +80101a60 writei +80105dc2 vector141 +80105210 sys_fork +8010b5c0 bcache +80105f36 vector172 +80106272 vector241 +80104090 getcallerpcs +80104f00 sys_mkdir +80106302 vector253 +801058cf vector3 +801058c6 vector2 +80101b90 namecmp +801061ca vector227 +801060fe vector210 +80104620 argstr +801061a6 vector224 +80105a17 vector41 +80100650 cprintf +80100de0 filedup +80101f00 namei +80105963 vector21 +80100040 binit +80105f72 vector177 +80105ccc vector118 +80105b1c vector70 +80105b13 vector69 +80106242 vector237 +80105ae6 vector64 +80105999 vector27 +80105d56 vector132 +80105fde vector186 +80104940 sys_read +80106152 vector217 +801044f0 fetchint +801069a0 setupkvm +801043b0 memcpy +80106920 freevm +801058bd vector1 +80105f7e vector178 +801059fc vector38 +801022f0 kfree +8010624e vector238 +80103600 mycpu +801017d0 iput +80105d62 vector133 +80105b37 vector73 +80105de6 vector144 +8010630e vector254 +80101420 readsb +8010a004 nextpid +80105c33 vector101 +8010610a vector211 +80102f90 mpinit +80105f4e vector174 +8010628a vector243 +80100d50 fileinit +80104070 initlock +80105d26 vector128 +80106bb0 copyout +80105b7f vector81 +80103c00 sleep +801027a0 microdelay +80105921 vector13 +80105a71 vector51 +80105938 vector16 +8010ff20 input +80106266 vector240 +80105a8c vector54 +80105951 vector19 +80105be2 vector92 +80106296 vector244 +80101930 stati +80105db6 vector140 +80105290 sys_kill +80105a3b vector45 +80105b6d vector79 +80103260 pipeclose +801061e2 vector229 +80105e8e vector158 +80104a60 sys_fstat +801005f0 consolewrite +80105a05 vector39 +80105f06 vector168 +80102b80 end_op +801059e1 vector35 +80105c9f vector113 +80102390 freerange +80105d0b vector125 +80106810 allocuvm +80105425 trapret +80106146 vector216 +80105add vector63 +80105990 vector26 +80106032 vector193 +80102670 lapicinit +80106056 vector196 +801060f2 vector209 +801058d8 vector4 +80105f1e vector170 +8010a5c0 stack +80105d86 vector136 +8010590c vector10 +801060ce vector206 +80101790 iunlock +80105330 sys_sleep +8010631a vector255 +80105fa2 vector181 +80105ab9 vector59 +80105ba3 vector85 +80105b9a vector84 +80105fba vector183 +80105e9a vector159 +80106116 vector212 +80104ab0 sys_link +80105a4d vector47 +801061d6 vector228 +80105a20 vector42 +80105ca8 vector114 +80106b70 uva2ka +80105f5a vector175 +80105dda vector143 +80100d70 filealloc +80103d90 wakeup +80105d3e vector130 +801062ae vector246 +80105903 vector9 +80105dce vector142 +80105c2a vector100 +80106092 vector201 +80106a50 clearpteu +801036a0 myproc +80105430 tvinit +80105ac2 vector60 +80105975 vector23 +80101680 idup +80106236 vector236 +801025d0 kbdintr +80104dc0 sys_open +801061fa vector231 +80105af8 vector66 +801059ab vector29 +80101960 readi +80105d7a vector135 +801007b0 consoleintr +80103df0 kill +80105b5b vector77 +80101520 ialloc +80105f96 vector180 +801155a4 kpgdir +801060e6 vector208 +80102840 cmostime +801058a0 uartintr +80105c18 vector98 +80105c0f vector97 +80105f66 vector176 +8010603e vector194 +801059c6 vector32 +801155a8 end +8010607a vector199 +80105d4a vector131 +801062f6 vector252 +80100fe0 filewrite +801058b4 vector0 +80104590 argint +801009a0 exec +80105df2 vector145 +801049b0 sys_write +80104250 release +80104530 fetchstr +80105c69 vector107 +80105a0e vector40 +80103cb0 wait +80105c3c vector102 +80109000 entrypgdir +0010000c _start +80105a9e vector56 +80105b0a vector68 +801058ea vector6 +8010a48c _binary_initcode_end +80100000 multiboot_header +80105d32 vector129 +80103960 scheduler +80101bc0 dirlookup +80106062 vector197 +80100e30 fileclose +80102b10 begin_op +80105e46 vector152 +80106a30 kvmalloc +801061ee vector230 +801043c0 strncmp +801059f3 vector37 +801060c2 vector205 +80105eb2 vector161 +80114d60 tickslock +801032f0 pipewrite +80104430 strncpy +80105b25 vector71 +80106a80 copyuvm +8010ffc0 ftable +80105ea6 vector160 +801045c0 argptr +8010613a vector215 +80105e82 vector157 +80104900 sys_dup +80105c96 vector112 +80100360 panic +80103590 forkret +80105fae vector182 +8010591a vector12 +801042f0 memcmp +80102500 kbdgetc +80105c7b vector109 +8010595a vector20 +80103850 fork +80105a83 vector53 +80105948 vector18 +0000008a _binary_entryother_size +80112780 cpus +80103fe0 releasesleep +80105bfd vector95 +801041a0 holding +801109c0 sb +801041e0 acquire +801061be vector226 +80101f20 nameiparent +80105a5f vector49 +80105a32 vector44 +8011267c lapic +80105b64 vector78 +8010540d alltraps +80105f42 vector173 +80105cc3 vector117 +80105b88 vector82 +8010618e vector222 +801058fc vector8 +80105e22 vector149 +801015f0 iupdate +80108000 data +801042a0 memset +80106206 vector232 +80102df0 main +801065a0 switchkvm +80105c60 vector106 +80106176 vector220 +80105bd0 vector90 +80105eca vector163 +8010621e vector234 +80102cb0 log_write +80103f80 acquiresleep +80104bd0 sys_unlink +80105ad4 vector62 +80105987 vector25 +8010606e vector198 +80105cde vector120 +8010a48c _binary_entryother_start +801023e0 kinit1 +80105a68 vector50 +8010592f vector15 +80105e3a vector151 +80105b91 vector83 +80105bc7 vector89 +80105bbe vector88 +80105500 trap +801053e0 sys_uptime +80105f8a vector179 +801059d8 vector34 +80105a44 vector46 +80105d6e vector134 +8010619a vector223 +80114da0 idt +8010615e vector218 +801035e0 pinit +80106900 deallocuvm +801061b2 vector225 +80102760 lapicid +80105fea vector187 +801037e0 growproc +80104020 holdingsleep +80112d00 ncpu +801059b4 vector30 +801036d0 userinit +801000d0 bread +80105d1d vector127 +801033e0 piperead +801155a0 ticks +80106026 vector192 +80105eee vector166 +80100950 consoleinit +80105b52 vector76 +80105b49 vector75 +80102080 ideintr +8010604a vector195 +80105e2e vector150 +80105ab0 vector58 +801062c6 vector248 +80105cf9 vector123 +80105c06 vector96 +801059bd vector31 +801060aa vector203 +80105daa vector139 +80105e52 vector153 +80105ed6 vector164 +80103e70 procdump +80105ce7 vector121 +801057b0 uartputc +801058e1 vector5 +80105efa vector167 +80105e6a vector155 +801062d2 vector249 +801001e0 brelse +801062de vector250 +80105d02 vector124 +80105c84 vector110 +801060b6 vector204 +801016b0 ilock +80105080 sys_exec +80105d92 vector137 +8010a460 _binary_initcode_start +801044db swtch +801062ba vector247 +8010596c vector22 +8010609e vector202 +801064e0 seginit +80101910 iunlockput +80105b2e vector72 +80105a95 vector55 +80105d14 vector126 +80105aef vector65 +801059a2 vector28 +8010a516 _binary_entryother_end +80105f12 vector169 +801001a0 bwrite +80106212 vector233 +801054d0 idtinit +80103aa0 exit +80105250 sys_wait +80105220 sys_exit +80101e20 dirlink +0000002c _binary_initcode_size +80105e0a vector147 +80103f40 initsleeplock +80102000 ideinit +80106750 loaduvm +80105c4e vector104 +80105cba vector116 +80112d20 ptable +801022b0 ioapicenable +80104130 popcli +8010a008 vectors +80105a7a vector52 +80105941 vector17 +80105fc6 vector184 +801044c0 strlen +80105170 sys_pipe +80101470 iinit +80103150 picinit +801060da vector207 +801066d0 inituvm +8010600e vector190 +8010625a vector239 +80105bf4 vector94 +80105beb vector93 +80102a70 initlog +80105ff6 vector188 +80105a56 vector48 +80102120 iderw +8010616a vector219 +80105e16 vector148 +80106182 vector221 +801024a0 kalloc +80110960 devsw +801052d0 sys_getpid +80105b76 vector80 +80105f2a vector171 +80105e5e vector154 +801059ea vector36 +80103170 pipealloc +8010622a vector235 +80105c57 vector105 +80104ff0 sys_chdir +801109e0 icache +80105dfe vector146 +8010601a vector191 +80105c45 vector103 +80104f60 sys_mknod +801027b0 lapicstartap +801065c0 switchuvm +801040f0 pushcli +80102450 kinit2 +80105913 vector11 +80105928 vector14 +80100ef0 filestat diff --git a/kill.asm b/kill.asm new file mode 100644 index 0000000000..214df6a6e4 --- /dev/null +++ b/kill.asm @@ -0,0 +1,1128 @@ + +_kill: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "stat.h" +#include "user.h" + +int +main(int argc, char **argv) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + 5: 53 push %ebx + int i; + + if(argc < 2){ + 6: bb 01 00 00 00 mov $0x1,%ebx +{ + b: 83 e4 f0 and $0xfffffff0,%esp + e: 83 ec 10 sub $0x10,%esp + 11: 8b 75 08 mov 0x8(%ebp),%esi + 14: 8b 7d 0c mov 0xc(%ebp),%edi + if(argc < 2){ + 17: 83 fe 01 cmp $0x1,%esi + 1a: 7e 2a jle 46 + 1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(2, "usage: kill pid...\n"); + exit(0); + } + for(i=1; i + 2e: 89 04 24 mov %eax,(%esp) + 31: e8 8c 02 00 00 call 2c2 + for(i=1; i + exit(0); + 3a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 41: e8 4c 02 00 00 call 292 + printf(2, "usage: kill pid...\n"); + 46: c7 44 24 04 46 07 00 movl $0x746,0x4(%esp) + 4d: 00 + 4e: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 55: e8 86 03 00 00 call 3e0 + exit(0); + 5a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 61: e8 2c 02 00 00 call 292 + 66: 66 90 xchg %ax,%ax + 68: 66 90 xchg %ax,%ax + 6a: 66 90 xchg %ax,%ax + 6c: 66 90 xchg %ax,%ax + 6e: 66 90 xchg %ax,%ax + +00000070 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 70: 55 push %ebp + 71: 89 e5 mov %esp,%ebp + 73: 8b 45 08 mov 0x8(%ebp),%eax + 76: 8b 4d 0c mov 0xc(%ebp),%ecx + 79: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 7a: 89 c2 mov %eax,%edx + 7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 80: 83 c1 01 add $0x1,%ecx + 83: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 87: 83 c2 01 add $0x1,%edx + 8a: 84 db test %bl,%bl + 8c: 88 5a ff mov %bl,-0x1(%edx) + 8f: 75 ef jne 80 + ; + return os; +} + 91: 5b pop %ebx + 92: 5d pop %ebp + 93: c3 ret + 94: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 9a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000000a0 : + +int +strcmp(const char *p, const char *q) +{ + a0: 55 push %ebp + a1: 89 e5 mov %esp,%ebp + a3: 8b 55 08 mov 0x8(%ebp),%edx + a6: 53 push %ebx + a7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + aa: 0f b6 02 movzbl (%edx),%eax + ad: 84 c0 test %al,%al + af: 74 2d je de + b1: 0f b6 19 movzbl (%ecx),%ebx + b4: 38 d8 cmp %bl,%al + b6: 74 0e je c6 + b8: eb 2b jmp e5 + ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + c0: 38 c8 cmp %cl,%al + c2: 75 15 jne d9 + p++, q++; + c4: 89 d9 mov %ebx,%ecx + c6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + c9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + cc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + cf: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + d3: 84 c0 test %al,%al + d5: 75 e9 jne c0 + d7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + d9: 29 c8 sub %ecx,%eax +} + db: 5b pop %ebx + dc: 5d pop %ebp + dd: c3 ret + de: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + e1: 31 c0 xor %eax,%eax + e3: eb f4 jmp d9 + e5: 0f b6 cb movzbl %bl,%ecx + e8: eb ef jmp d9 + ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000000f0 : + +uint +strlen(const char *s) +{ + f0: 55 push %ebp + f1: 89 e5 mov %esp,%ebp + f3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + f6: 80 39 00 cmpb $0x0,(%ecx) + f9: 74 12 je 10d + fb: 31 d2 xor %edx,%edx + fd: 8d 76 00 lea 0x0(%esi),%esi + 100: 83 c2 01 add $0x1,%edx + 103: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 107: 89 d0 mov %edx,%eax + 109: 75 f5 jne 100 + ; + return n; +} + 10b: 5d pop %ebp + 10c: c3 ret + for(n = 0; s[n]; n++) + 10d: 31 c0 xor %eax,%eax +} + 10f: 5d pop %ebp + 110: c3 ret + 111: eb 0d jmp 120 + 113: 90 nop + 114: 90 nop + 115: 90 nop + 116: 90 nop + 117: 90 nop + 118: 90 nop + 119: 90 nop + 11a: 90 nop + 11b: 90 nop + 11c: 90 nop + 11d: 90 nop + 11e: 90 nop + 11f: 90 nop + +00000120 : + +void* +memset(void *dst, int c, uint n) +{ + 120: 55 push %ebp + 121: 89 e5 mov %esp,%ebp + 123: 8b 55 08 mov 0x8(%ebp),%edx + 126: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 127: 8b 4d 10 mov 0x10(%ebp),%ecx + 12a: 8b 45 0c mov 0xc(%ebp),%eax + 12d: 89 d7 mov %edx,%edi + 12f: fc cld + 130: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 132: 89 d0 mov %edx,%eax + 134: 5f pop %edi + 135: 5d pop %ebp + 136: c3 ret + 137: 89 f6 mov %esi,%esi + 139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000140 : + +char* +strchr(const char *s, char c) +{ + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 8b 45 08 mov 0x8(%ebp),%eax + 146: 53 push %ebx + 147: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 14a: 0f b6 18 movzbl (%eax),%ebx + 14d: 84 db test %bl,%bl + 14f: 74 1d je 16e + if(*s == c) + 151: 38 d3 cmp %dl,%bl + 153: 89 d1 mov %edx,%ecx + 155: 75 0d jne 164 + 157: eb 17 jmp 170 + 159: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 160: 38 ca cmp %cl,%dl + 162: 74 0c je 170 + for(; *s; s++) + 164: 83 c0 01 add $0x1,%eax + 167: 0f b6 10 movzbl (%eax),%edx + 16a: 84 d2 test %dl,%dl + 16c: 75 f2 jne 160 + return (char*)s; + return 0; + 16e: 31 c0 xor %eax,%eax +} + 170: 5b pop %ebx + 171: 5d pop %ebp + 172: c3 ret + 173: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 179: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000180 : + +char* +gets(char *buf, int max) +{ + 180: 55 push %ebp + 181: 89 e5 mov %esp,%ebp + 183: 57 push %edi + 184: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 185: 31 f6 xor %esi,%esi +{ + 187: 53 push %ebx + 188: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 18b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 18e: eb 31 jmp 1c1 + cc = read(0, &c, 1); + 190: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 197: 00 + 198: 89 7c 24 04 mov %edi,0x4(%esp) + 19c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1a3: e8 02 01 00 00 call 2aa + if(cc < 1) + 1a8: 85 c0 test %eax,%eax + 1aa: 7e 1d jle 1c9 + break; + buf[i++] = c; + 1ac: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 1b0: 89 de mov %ebx,%esi + buf[i++] = c; + 1b2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 1b5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 1b7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 1bb: 74 0c je 1c9 + 1bd: 3c 0a cmp $0xa,%al + 1bf: 74 08 je 1c9 + for(i=0; i+1 < max; ){ + 1c1: 8d 5e 01 lea 0x1(%esi),%ebx + 1c4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1c7: 7c c7 jl 190 + break; + } + buf[i] = '\0'; + 1c9: 8b 45 08 mov 0x8(%ebp),%eax + 1cc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 1d0: 83 c4 2c add $0x2c,%esp + 1d3: 5b pop %ebx + 1d4: 5e pop %esi + 1d5: 5f pop %edi + 1d6: 5d pop %ebp + 1d7: c3 ret + 1d8: 90 nop + 1d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001e0 : + +int +stat(const char *n, struct stat *st) +{ + 1e0: 55 push %ebp + 1e1: 89 e5 mov %esp,%ebp + 1e3: 56 push %esi + 1e4: 53 push %ebx + 1e5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1e8: 8b 45 08 mov 0x8(%ebp),%eax + 1eb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1f2: 00 + 1f3: 89 04 24 mov %eax,(%esp) + 1f6: e8 d7 00 00 00 call 2d2 + if(fd < 0) + 1fb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 1fd: 89 c3 mov %eax,%ebx + if(fd < 0) + 1ff: 78 27 js 228 + return -1; + r = fstat(fd, st); + 201: 8b 45 0c mov 0xc(%ebp),%eax + 204: 89 1c 24 mov %ebx,(%esp) + 207: 89 44 24 04 mov %eax,0x4(%esp) + 20b: e8 da 00 00 00 call 2ea + close(fd); + 210: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 213: 89 c6 mov %eax,%esi + close(fd); + 215: e8 a0 00 00 00 call 2ba + return r; + 21a: 89 f0 mov %esi,%eax +} + 21c: 83 c4 10 add $0x10,%esp + 21f: 5b pop %ebx + 220: 5e pop %esi + 221: 5d pop %ebp + 222: c3 ret + 223: 90 nop + 224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 228: b8 ff ff ff ff mov $0xffffffff,%eax + 22d: eb ed jmp 21c + 22f: 90 nop + +00000230 : + +int +atoi(const char *s) +{ + 230: 55 push %ebp + 231: 89 e5 mov %esp,%ebp + 233: 8b 4d 08 mov 0x8(%ebp),%ecx + 236: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 237: 0f be 11 movsbl (%ecx),%edx + 23a: 8d 42 d0 lea -0x30(%edx),%eax + 23d: 3c 09 cmp $0x9,%al + n = 0; + 23f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 244: 77 17 ja 25d + 246: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 248: 83 c1 01 add $0x1,%ecx + 24b: 8d 04 80 lea (%eax,%eax,4),%eax + 24e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 252: 0f be 11 movsbl (%ecx),%edx + 255: 8d 5a d0 lea -0x30(%edx),%ebx + 258: 80 fb 09 cmp $0x9,%bl + 25b: 76 eb jbe 248 + return n; +} + 25d: 5b pop %ebx + 25e: 5d pop %ebp + 25f: c3 ret + +00000260 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 260: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 261: 31 d2 xor %edx,%edx +{ + 263: 89 e5 mov %esp,%ebp + 265: 56 push %esi + 266: 8b 45 08 mov 0x8(%ebp),%eax + 269: 53 push %ebx + 26a: 8b 5d 10 mov 0x10(%ebp),%ebx + 26d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 270: 85 db test %ebx,%ebx + 272: 7e 12 jle 286 + 274: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 278: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 27c: 88 0c 10 mov %cl,(%eax,%edx,1) + 27f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 282: 39 da cmp %ebx,%edx + 284: 75 f2 jne 278 + return vdst; +} + 286: 5b pop %ebx + 287: 5e pop %esi + 288: 5d pop %ebp + 289: c3 ret + +0000028a : + 28a: b8 01 00 00 00 mov $0x1,%eax + 28f: cd 40 int $0x40 + 291: c3 ret + +00000292 : + 292: b8 02 00 00 00 mov $0x2,%eax + 297: cd 40 int $0x40 + 299: c3 ret + +0000029a : + 29a: b8 03 00 00 00 mov $0x3,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 04 00 00 00 mov $0x4,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 05 00 00 00 mov $0x5,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 10 00 00 00 mov $0x10,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 15 00 00 00 mov $0x15,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 06 00 00 00 mov $0x6,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 07 00 00 00 mov $0x7,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 0f 00 00 00 mov $0xf,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 11 00 00 00 mov $0x11,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 12 00 00 00 mov $0x12,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 08 00 00 00 mov $0x8,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + +000002f2 : + 2f2: b8 13 00 00 00 mov $0x13,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + +000002fa : + 2fa: b8 14 00 00 00 mov $0x14,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + +00000302 : + 302: b8 09 00 00 00 mov $0x9,%eax + 307: cd 40 int $0x40 + 309: c3 ret + +0000030a : + 30a: b8 0a 00 00 00 mov $0xa,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + +00000312 : + 312: b8 0b 00 00 00 mov $0xb,%eax + 317: cd 40 int $0x40 + 319: c3 ret + +0000031a : + 31a: b8 0c 00 00 00 mov $0xc,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + +00000322 : + 322: b8 0d 00 00 00 mov $0xd,%eax + 327: cd 40 int $0x40 + 329: c3 ret + +0000032a : + 32a: b8 0e 00 00 00 mov $0xe,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + 332: 66 90 xchg %ax,%ax + 334: 66 90 xchg %ax,%ax + 336: 66 90 xchg %ax,%ax + 338: 66 90 xchg %ax,%ax + 33a: 66 90 xchg %ax,%ax + 33c: 66 90 xchg %ax,%ax + 33e: 66 90 xchg %ax,%ax + +00000340 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 340: 55 push %ebp + 341: 89 e5 mov %esp,%ebp + 343: 57 push %edi + 344: 56 push %esi + 345: 89 c6 mov %eax,%esi + 347: 53 push %ebx + 348: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 34b: 8b 5d 08 mov 0x8(%ebp),%ebx + 34e: 85 db test %ebx,%ebx + 350: 74 09 je 35b + 352: 89 d0 mov %edx,%eax + 354: c1 e8 1f shr $0x1f,%eax + 357: 84 c0 test %al,%al + 359: 75 75 jne 3d0 + neg = 1; + x = -xx; + } else { + x = xx; + 35b: 89 d0 mov %edx,%eax + neg = 0; + 35d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 364: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 367: 31 ff xor %edi,%edi + 369: 89 ce mov %ecx,%esi + 36b: 8d 5d d7 lea -0x29(%ebp),%ebx + 36e: eb 02 jmp 372 + do{ + buf[i++] = digits[x % base]; + 370: 89 cf mov %ecx,%edi + 372: 31 d2 xor %edx,%edx + 374: f7 f6 div %esi + 376: 8d 4f 01 lea 0x1(%edi),%ecx + 379: 0f b6 92 61 07 00 00 movzbl 0x761(%edx),%edx + }while((x /= base) != 0); + 380: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 382: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 385: 75 e9 jne 370 + if(neg) + 387: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 38a: 89 c8 mov %ecx,%eax + 38c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 38f: 85 d2 test %edx,%edx + 391: 74 08 je 39b + buf[i++] = '-'; + 393: 8d 4f 02 lea 0x2(%edi),%ecx + 396: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 39b: 8d 79 ff lea -0x1(%ecx),%edi + 39e: 66 90 xchg %ax,%ax + 3a0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 3a5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 3a8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3af: 00 + 3b0: 89 5c 24 04 mov %ebx,0x4(%esp) + 3b4: 89 34 24 mov %esi,(%esp) + 3b7: 88 45 d7 mov %al,-0x29(%ebp) + 3ba: e8 f3 fe ff ff call 2b2 + while(--i >= 0) + 3bf: 83 ff ff cmp $0xffffffff,%edi + 3c2: 75 dc jne 3a0 + putc(fd, buf[i]); +} + 3c4: 83 c4 4c add $0x4c,%esp + 3c7: 5b pop %ebx + 3c8: 5e pop %esi + 3c9: 5f pop %edi + 3ca: 5d pop %ebp + 3cb: c3 ret + 3cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 3d0: 89 d0 mov %edx,%eax + 3d2: f7 d8 neg %eax + neg = 1; + 3d4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 3db: eb 87 jmp 364 + 3dd: 8d 76 00 lea 0x0(%esi),%esi + +000003e0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3e0: 55 push %ebp + 3e1: 89 e5 mov %esp,%ebp + 3e3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3e4: 31 ff xor %edi,%edi +{ + 3e6: 56 push %esi + 3e7: 53 push %ebx + 3e8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3eb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3ee: 8d 45 10 lea 0x10(%ebp),%eax +{ + 3f1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 3f4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 3f7: 0f b6 13 movzbl (%ebx),%edx + 3fa: 83 c3 01 add $0x1,%ebx + 3fd: 84 d2 test %dl,%dl + 3ff: 75 39 jne 43a + 401: e9 c2 00 00 00 jmp 4c8 + 406: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 408: 83 fa 25 cmp $0x25,%edx + 40b: 0f 84 bf 00 00 00 je 4d0 + write(fd, &c, 1); + 411: 8d 45 e2 lea -0x1e(%ebp),%eax + 414: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 41b: 00 + 41c: 89 44 24 04 mov %eax,0x4(%esp) + 420: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 423: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 426: e8 87 fe ff ff call 2b2 + 42b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 42e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 432: 84 d2 test %dl,%dl + 434: 0f 84 8e 00 00 00 je 4c8 + if(state == 0){ + 43a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 43c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 43f: 74 c7 je 408 + } + } else if(state == '%'){ + 441: 83 ff 25 cmp $0x25,%edi + 444: 75 e5 jne 42b + if(c == 'd'){ + 446: 83 fa 64 cmp $0x64,%edx + 449: 0f 84 31 01 00 00 je 580 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 44f: 25 f7 00 00 00 and $0xf7,%eax + 454: 83 f8 70 cmp $0x70,%eax + 457: 0f 84 83 00 00 00 je 4e0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 45d: 83 fa 73 cmp $0x73,%edx + 460: 0f 84 a2 00 00 00 je 508 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 466: 83 fa 63 cmp $0x63,%edx + 469: 0f 84 35 01 00 00 je 5a4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 46f: 83 fa 25 cmp $0x25,%edx + 472: 0f 84 e0 00 00 00 je 558 + write(fd, &c, 1); + 478: 8d 45 e6 lea -0x1a(%ebp),%eax + 47b: 83 c3 01 add $0x1,%ebx + 47e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 485: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 486: 31 ff xor %edi,%edi + write(fd, &c, 1); + 488: 89 44 24 04 mov %eax,0x4(%esp) + 48c: 89 34 24 mov %esi,(%esp) + 48f: 89 55 d0 mov %edx,-0x30(%ebp) + 492: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 496: e8 17 fe ff ff call 2b2 + putc(fd, c); + 49b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 49e: 8d 45 e7 lea -0x19(%ebp),%eax + 4a1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4a8: 00 + 4a9: 89 44 24 04 mov %eax,0x4(%esp) + 4ad: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4b0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4b3: e8 fa fd ff ff call 2b2 + for(i = 0; fmt[i]; i++){ + 4b8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4bc: 84 d2 test %dl,%dl + 4be: 0f 85 76 ff ff ff jne 43a + 4c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4c8: 83 c4 3c add $0x3c,%esp + 4cb: 5b pop %ebx + 4cc: 5e pop %esi + 4cd: 5f pop %edi + 4ce: 5d pop %ebp + 4cf: c3 ret + state = '%'; + 4d0: bf 25 00 00 00 mov $0x25,%edi + 4d5: e9 51 ff ff ff jmp 42b + 4da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4e0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4e3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4e8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4ea: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 4f1: 8b 10 mov (%eax),%edx + 4f3: 89 f0 mov %esi,%eax + 4f5: e8 46 fe ff ff call 340 + ap++; + 4fa: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 4fe: e9 28 ff ff ff jmp 42b + 503: 90 nop + 504: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 508: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 50b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 50f: 8b 38 mov (%eax),%edi + s = "(null)"; + 511: b8 5a 07 00 00 mov $0x75a,%eax + 516: 85 ff test %edi,%edi + 518: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 51b: 0f b6 07 movzbl (%edi),%eax + 51e: 84 c0 test %al,%al + 520: 74 2a je 54c + 522: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 528: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 52b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 52e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 531: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 538: 00 + 539: 89 44 24 04 mov %eax,0x4(%esp) + 53d: 89 34 24 mov %esi,(%esp) + 540: e8 6d fd ff ff call 2b2 + while(*s != 0){ + 545: 0f b6 07 movzbl (%edi),%eax + 548: 84 c0 test %al,%al + 54a: 75 dc jne 528 + state = 0; + 54c: 31 ff xor %edi,%edi + 54e: e9 d8 fe ff ff jmp 42b + 553: 90 nop + 554: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 558: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 55b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 55d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 564: 00 + 565: 89 44 24 04 mov %eax,0x4(%esp) + 569: 89 34 24 mov %esi,(%esp) + 56c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 570: e8 3d fd ff ff call 2b2 + 575: e9 b1 fe ff ff jmp 42b + 57a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 580: 8b 45 d4 mov -0x2c(%ebp),%eax + 583: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 588: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 58b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 592: 8b 10 mov (%eax),%edx + 594: 89 f0 mov %esi,%eax + 596: e8 a5 fd ff ff call 340 + ap++; + 59b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 59f: e9 87 fe ff ff jmp 42b + putc(fd, *ap); + 5a4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 5a7: 31 ff xor %edi,%edi + putc(fd, *ap); + 5a9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 5ab: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5b2: 00 + 5b3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 5b6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 5b9: 8d 45 e4 lea -0x1c(%ebp),%eax + 5bc: 89 44 24 04 mov %eax,0x4(%esp) + 5c0: e8 ed fc ff ff call 2b2 + ap++; + 5c5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5c9: e9 5d fe ff ff jmp 42b + 5ce: 66 90 xchg %ax,%ax + +000005d0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 5d0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5d1: a1 dc 09 00 00 mov 0x9dc,%eax +{ + 5d6: 89 e5 mov %esp,%ebp + 5d8: 57 push %edi + 5d9: 56 push %esi + 5da: 53 push %ebx + 5db: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5de: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5e0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e3: 39 d0 cmp %edx,%eax + 5e5: 72 11 jb 5f8 + 5e7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5e8: 39 c8 cmp %ecx,%eax + 5ea: 72 04 jb 5f0 + 5ec: 39 ca cmp %ecx,%edx + 5ee: 72 10 jb 600 + 5f0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5f2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5f4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5f6: 73 f0 jae 5e8 + 5f8: 39 ca cmp %ecx,%edx + 5fa: 72 04 jb 600 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5fc: 39 c8 cmp %ecx,%eax + 5fe: 72 f0 jb 5f0 + break; + if(bp + bp->s.size == p->s.ptr){ + 600: 8b 73 fc mov -0x4(%ebx),%esi + 603: 8d 3c f2 lea (%edx,%esi,8),%edi + 606: 39 cf cmp %ecx,%edi + 608: 74 1e je 628 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 60a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 60d: 8b 48 04 mov 0x4(%eax),%ecx + 610: 8d 34 c8 lea (%eax,%ecx,8),%esi + 613: 39 f2 cmp %esi,%edx + 615: 74 28 je 63f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 617: 89 10 mov %edx,(%eax) + freep = p; + 619: a3 dc 09 00 00 mov %eax,0x9dc +} + 61e: 5b pop %ebx + 61f: 5e pop %esi + 620: 5f pop %edi + 621: 5d pop %ebp + 622: c3 ret + 623: 90 nop + 624: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 628: 03 71 04 add 0x4(%ecx),%esi + 62b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 62e: 8b 08 mov (%eax),%ecx + 630: 8b 09 mov (%ecx),%ecx + 632: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 635: 8b 48 04 mov 0x4(%eax),%ecx + 638: 8d 34 c8 lea (%eax,%ecx,8),%esi + 63b: 39 f2 cmp %esi,%edx + 63d: 75 d8 jne 617 + p->s.size += bp->s.size; + 63f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 642: a3 dc 09 00 00 mov %eax,0x9dc + p->s.size += bp->s.size; + 647: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 64a: 8b 53 f8 mov -0x8(%ebx),%edx + 64d: 89 10 mov %edx,(%eax) +} + 64f: 5b pop %ebx + 650: 5e pop %esi + 651: 5f pop %edi + 652: 5d pop %ebp + 653: c3 ret + 654: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 65a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000660 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 660: 55 push %ebp + 661: 89 e5 mov %esp,%ebp + 663: 57 push %edi + 664: 56 push %esi + 665: 53 push %ebx + 666: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 669: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 66c: 8b 1d dc 09 00 00 mov 0x9dc,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 672: 8d 48 07 lea 0x7(%eax),%ecx + 675: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 678: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 67a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 67d: 0f 84 9b 00 00 00 je 71e + 683: 8b 13 mov (%ebx),%edx + 685: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 688: 39 fe cmp %edi,%esi + 68a: 76 64 jbe 6f0 + 68c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 693: bb 00 80 00 00 mov $0x8000,%ebx + 698: 89 45 e4 mov %eax,-0x1c(%ebp) + 69b: eb 0e jmp 6ab + 69d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 6a0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 6a2: 8b 78 04 mov 0x4(%eax),%edi + 6a5: 39 fe cmp %edi,%esi + 6a7: 76 4f jbe 6f8 + 6a9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 6ab: 3b 15 dc 09 00 00 cmp 0x9dc,%edx + 6b1: 75 ed jne 6a0 + if(nu < 4096) + 6b3: 8b 45 e4 mov -0x1c(%ebp),%eax + 6b6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 6bc: bf 00 10 00 00 mov $0x1000,%edi + 6c1: 0f 43 fe cmovae %esi,%edi + 6c4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 6c7: 89 04 24 mov %eax,(%esp) + 6ca: e8 4b fc ff ff call 31a + if(p == (char*)-1) + 6cf: 83 f8 ff cmp $0xffffffff,%eax + 6d2: 74 18 je 6ec + hp->s.size = nu; + 6d4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 6d7: 83 c0 08 add $0x8,%eax + 6da: 89 04 24 mov %eax,(%esp) + 6dd: e8 ee fe ff ff call 5d0 + return freep; + 6e2: 8b 15 dc 09 00 00 mov 0x9dc,%edx + if((p = morecore(nunits)) == 0) + 6e8: 85 d2 test %edx,%edx + 6ea: 75 b4 jne 6a0 + return 0; + 6ec: 31 c0 xor %eax,%eax + 6ee: eb 20 jmp 710 + if(p->s.size >= nunits){ + 6f0: 89 d0 mov %edx,%eax + 6f2: 89 da mov %ebx,%edx + 6f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 6f8: 39 fe cmp %edi,%esi + 6fa: 74 1c je 718 + p->s.size -= nunits; + 6fc: 29 f7 sub %esi,%edi + 6fe: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 701: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 704: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 707: 89 15 dc 09 00 00 mov %edx,0x9dc + return (void*)(p + 1); + 70d: 83 c0 08 add $0x8,%eax + } +} + 710: 83 c4 1c add $0x1c,%esp + 713: 5b pop %ebx + 714: 5e pop %esi + 715: 5f pop %edi + 716: 5d pop %ebp + 717: c3 ret + prevp->s.ptr = p->s.ptr; + 718: 8b 08 mov (%eax),%ecx + 71a: 89 0a mov %ecx,(%edx) + 71c: eb e9 jmp 707 + base.s.ptr = freep = prevp = &base; + 71e: c7 05 dc 09 00 00 e0 movl $0x9e0,0x9dc + 725: 09 00 00 + base.s.size = 0; + 728: ba e0 09 00 00 mov $0x9e0,%edx + base.s.ptr = freep = prevp = &base; + 72d: c7 05 e0 09 00 00 e0 movl $0x9e0,0x9e0 + 734: 09 00 00 + base.s.size = 0; + 737: c7 05 e4 09 00 00 00 movl $0x0,0x9e4 + 73e: 00 00 00 + 741: e9 46 ff ff ff jmp 68c diff --git a/kill.c b/kill.c index 364f6af2eb..5a2e450c0c 100644 --- a/kill.c +++ b/kill.c @@ -9,9 +9,9 @@ main(int argc, char **argv) if(argc < 2){ printf(2, "usage: kill pid...\n"); - exit(); + exit(0); } for(i=1; i: +#include "stat.h" +#include "user.h" + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 53 push %ebx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: 83 ec 10 sub $0x10,%esp + a: 8b 5d 0c mov 0xc(%ebp),%ebx + if(argc != 3){ + d: 83 7d 08 03 cmpl $0x3,0x8(%ebp) + 11: 74 20 je 33 + printf(2, "Usage: ln old new\n"); + 13: c7 44 24 04 56 07 00 movl $0x756,0x4(%esp) + 1a: 00 + 1b: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 22: e8 c9 03 00 00 call 3f0 + exit(0); + 27: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2e: e8 6f 02 00 00 call 2a2 + } + if(link(argv[1], argv[2]) < 0) + 33: 8b 43 08 mov 0x8(%ebx),%eax + 36: 89 44 24 04 mov %eax,0x4(%esp) + 3a: 8b 43 04 mov 0x4(%ebx),%eax + 3d: 89 04 24 mov %eax,(%esp) + 40: e8 bd 02 00 00 call 302 + 45: 85 c0 test %eax,%eax + 47: 78 0c js 55 + printf(2, "link %s %s: failed\n", argv[1], argv[2]); + exit(0); + 49: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 50: e8 4d 02 00 00 call 2a2 + printf(2, "link %s %s: failed\n", argv[1], argv[2]); + 55: 8b 43 08 mov 0x8(%ebx),%eax + 58: 89 44 24 0c mov %eax,0xc(%esp) + 5c: 8b 43 04 mov 0x4(%ebx),%eax + 5f: c7 44 24 04 69 07 00 movl $0x769,0x4(%esp) + 66: 00 + 67: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 6e: 89 44 24 08 mov %eax,0x8(%esp) + 72: e8 79 03 00 00 call 3f0 + 77: eb d0 jmp 49 + 79: 66 90 xchg %ax,%ax + 7b: 66 90 xchg %ax,%ax + 7d: 66 90 xchg %ax,%ax + 7f: 90 nop + +00000080 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 80: 55 push %ebp + 81: 89 e5 mov %esp,%ebp + 83: 8b 45 08 mov 0x8(%ebp),%eax + 86: 8b 4d 0c mov 0xc(%ebp),%ecx + 89: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 8a: 89 c2 mov %eax,%edx + 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 90: 83 c1 01 add $0x1,%ecx + 93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 97: 83 c2 01 add $0x1,%edx + 9a: 84 db test %bl,%bl + 9c: 88 5a ff mov %bl,-0x1(%edx) + 9f: 75 ef jne 90 + ; + return os; +} + a1: 5b pop %ebx + a2: 5d pop %ebp + a3: c3 ret + a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000000b0 : + +int +strcmp(const char *p, const char *q) +{ + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 8b 55 08 mov 0x8(%ebp),%edx + b6: 53 push %ebx + b7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + ba: 0f b6 02 movzbl (%edx),%eax + bd: 84 c0 test %al,%al + bf: 74 2d je ee + c1: 0f b6 19 movzbl (%ecx),%ebx + c4: 38 d8 cmp %bl,%al + c6: 74 0e je d6 + c8: eb 2b jmp f5 + ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + d0: 38 c8 cmp %cl,%al + d2: 75 15 jne e9 + p++, q++; + d4: 89 d9 mov %ebx,%ecx + d6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + d9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + dc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + df: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + e3: 84 c0 test %al,%al + e5: 75 e9 jne d0 + e7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + e9: 29 c8 sub %ecx,%eax +} + eb: 5b pop %ebx + ec: 5d pop %ebp + ed: c3 ret + ee: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + f1: 31 c0 xor %eax,%eax + f3: eb f4 jmp e9 + f5: 0f b6 cb movzbl %bl,%ecx + f8: eb ef jmp e9 + fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000100 : + +uint +strlen(const char *s) +{ + 100: 55 push %ebp + 101: 89 e5 mov %esp,%ebp + 103: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 106: 80 39 00 cmpb $0x0,(%ecx) + 109: 74 12 je 11d + 10b: 31 d2 xor %edx,%edx + 10d: 8d 76 00 lea 0x0(%esi),%esi + 110: 83 c2 01 add $0x1,%edx + 113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 117: 89 d0 mov %edx,%eax + 119: 75 f5 jne 110 + ; + return n; +} + 11b: 5d pop %ebp + 11c: c3 ret + for(n = 0; s[n]; n++) + 11d: 31 c0 xor %eax,%eax +} + 11f: 5d pop %ebp + 120: c3 ret + 121: eb 0d jmp 130 + 123: 90 nop + 124: 90 nop + 125: 90 nop + 126: 90 nop + 127: 90 nop + 128: 90 nop + 129: 90 nop + 12a: 90 nop + 12b: 90 nop + 12c: 90 nop + 12d: 90 nop + 12e: 90 nop + 12f: 90 nop + +00000130 : + +void* +memset(void *dst, int c, uint n) +{ + 130: 55 push %ebp + 131: 89 e5 mov %esp,%ebp + 133: 8b 55 08 mov 0x8(%ebp),%edx + 136: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 137: 8b 4d 10 mov 0x10(%ebp),%ecx + 13a: 8b 45 0c mov 0xc(%ebp),%eax + 13d: 89 d7 mov %edx,%edi + 13f: fc cld + 140: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 142: 89 d0 mov %edx,%eax + 144: 5f pop %edi + 145: 5d pop %ebp + 146: c3 ret + 147: 89 f6 mov %esi,%esi + 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000150 : + +char* +strchr(const char *s, char c) +{ + 150: 55 push %ebp + 151: 89 e5 mov %esp,%ebp + 153: 8b 45 08 mov 0x8(%ebp),%eax + 156: 53 push %ebx + 157: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 15a: 0f b6 18 movzbl (%eax),%ebx + 15d: 84 db test %bl,%bl + 15f: 74 1d je 17e + if(*s == c) + 161: 38 d3 cmp %dl,%bl + 163: 89 d1 mov %edx,%ecx + 165: 75 0d jne 174 + 167: eb 17 jmp 180 + 169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 170: 38 ca cmp %cl,%dl + 172: 74 0c je 180 + for(; *s; s++) + 174: 83 c0 01 add $0x1,%eax + 177: 0f b6 10 movzbl (%eax),%edx + 17a: 84 d2 test %dl,%dl + 17c: 75 f2 jne 170 + return (char*)s; + return 0; + 17e: 31 c0 xor %eax,%eax +} + 180: 5b pop %ebx + 181: 5d pop %ebp + 182: c3 ret + 183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000190 : + +char* +gets(char *buf, int max) +{ + 190: 55 push %ebp + 191: 89 e5 mov %esp,%ebp + 193: 57 push %edi + 194: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 195: 31 f6 xor %esi,%esi +{ + 197: 53 push %ebx + 198: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 19b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 19e: eb 31 jmp 1d1 + cc = read(0, &c, 1); + 1a0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 1a7: 00 + 1a8: 89 7c 24 04 mov %edi,0x4(%esp) + 1ac: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1b3: e8 02 01 00 00 call 2ba + if(cc < 1) + 1b8: 85 c0 test %eax,%eax + 1ba: 7e 1d jle 1d9 + break; + buf[i++] = c; + 1bc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 1c0: 89 de mov %ebx,%esi + buf[i++] = c; + 1c2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 1c5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 1c7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 1cb: 74 0c je 1d9 + 1cd: 3c 0a cmp $0xa,%al + 1cf: 74 08 je 1d9 + for(i=0; i+1 < max; ){ + 1d1: 8d 5e 01 lea 0x1(%esi),%ebx + 1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1d7: 7c c7 jl 1a0 + break; + } + buf[i] = '\0'; + 1d9: 8b 45 08 mov 0x8(%ebp),%eax + 1dc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 1e0: 83 c4 2c add $0x2c,%esp + 1e3: 5b pop %ebx + 1e4: 5e pop %esi + 1e5: 5f pop %edi + 1e6: 5d pop %ebp + 1e7: c3 ret + 1e8: 90 nop + 1e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001f0 : + +int +stat(const char *n, struct stat *st) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 56 push %esi + 1f4: 53 push %ebx + 1f5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1f8: 8b 45 08 mov 0x8(%ebp),%eax + 1fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 202: 00 + 203: 89 04 24 mov %eax,(%esp) + 206: e8 d7 00 00 00 call 2e2 + if(fd < 0) + 20b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 20d: 89 c3 mov %eax,%ebx + if(fd < 0) + 20f: 78 27 js 238 + return -1; + r = fstat(fd, st); + 211: 8b 45 0c mov 0xc(%ebp),%eax + 214: 89 1c 24 mov %ebx,(%esp) + 217: 89 44 24 04 mov %eax,0x4(%esp) + 21b: e8 da 00 00 00 call 2fa + close(fd); + 220: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 223: 89 c6 mov %eax,%esi + close(fd); + 225: e8 a0 00 00 00 call 2ca + return r; + 22a: 89 f0 mov %esi,%eax +} + 22c: 83 c4 10 add $0x10,%esp + 22f: 5b pop %ebx + 230: 5e pop %esi + 231: 5d pop %ebp + 232: c3 ret + 233: 90 nop + 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 238: b8 ff ff ff ff mov $0xffffffff,%eax + 23d: eb ed jmp 22c + 23f: 90 nop + +00000240 : + +int +atoi(const char *s) +{ + 240: 55 push %ebp + 241: 89 e5 mov %esp,%ebp + 243: 8b 4d 08 mov 0x8(%ebp),%ecx + 246: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 247: 0f be 11 movsbl (%ecx),%edx + 24a: 8d 42 d0 lea -0x30(%edx),%eax + 24d: 3c 09 cmp $0x9,%al + n = 0; + 24f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 254: 77 17 ja 26d + 256: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 258: 83 c1 01 add $0x1,%ecx + 25b: 8d 04 80 lea (%eax,%eax,4),%eax + 25e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 262: 0f be 11 movsbl (%ecx),%edx + 265: 8d 5a d0 lea -0x30(%edx),%ebx + 268: 80 fb 09 cmp $0x9,%bl + 26b: 76 eb jbe 258 + return n; +} + 26d: 5b pop %ebx + 26e: 5d pop %ebp + 26f: c3 ret + +00000270 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 270: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 271: 31 d2 xor %edx,%edx +{ + 273: 89 e5 mov %esp,%ebp + 275: 56 push %esi + 276: 8b 45 08 mov 0x8(%ebp),%eax + 279: 53 push %ebx + 27a: 8b 5d 10 mov 0x10(%ebp),%ebx + 27d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 280: 85 db test %ebx,%ebx + 282: 7e 12 jle 296 + 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 28c: 88 0c 10 mov %cl,(%eax,%edx,1) + 28f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 292: 39 da cmp %ebx,%edx + 294: 75 f2 jne 288 + return vdst; +} + 296: 5b pop %ebx + 297: 5e pop %esi + 298: 5d pop %ebp + 299: c3 ret + +0000029a : + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + +000002f2 : + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + +000002fa : + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + +00000302 : + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + +0000030a : + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + +00000312 : + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + +0000031a : + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + +00000322 : + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + +0000032a : + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + +00000332 : + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + +0000033a : + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret + 342: 66 90 xchg %ax,%ax + 344: 66 90 xchg %ax,%ax + 346: 66 90 xchg %ax,%ax + 348: 66 90 xchg %ax,%ax + 34a: 66 90 xchg %ax,%ax + 34c: 66 90 xchg %ax,%ax + 34e: 66 90 xchg %ax,%ax + +00000350 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 350: 55 push %ebp + 351: 89 e5 mov %esp,%ebp + 353: 57 push %edi + 354: 56 push %esi + 355: 89 c6 mov %eax,%esi + 357: 53 push %ebx + 358: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 35b: 8b 5d 08 mov 0x8(%ebp),%ebx + 35e: 85 db test %ebx,%ebx + 360: 74 09 je 36b + 362: 89 d0 mov %edx,%eax + 364: c1 e8 1f shr $0x1f,%eax + 367: 84 c0 test %al,%al + 369: 75 75 jne 3e0 + neg = 1; + x = -xx; + } else { + x = xx; + 36b: 89 d0 mov %edx,%eax + neg = 0; + 36d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 374: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 377: 31 ff xor %edi,%edi + 379: 89 ce mov %ecx,%esi + 37b: 8d 5d d7 lea -0x29(%ebp),%ebx + 37e: eb 02 jmp 382 + do{ + buf[i++] = digits[x % base]; + 380: 89 cf mov %ecx,%edi + 382: 31 d2 xor %edx,%edx + 384: f7 f6 div %esi + 386: 8d 4f 01 lea 0x1(%edi),%ecx + 389: 0f b6 92 84 07 00 00 movzbl 0x784(%edx),%edx + }while((x /= base) != 0); + 390: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 392: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 395: 75 e9 jne 380 + if(neg) + 397: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 39a: 89 c8 mov %ecx,%eax + 39c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 39f: 85 d2 test %edx,%edx + 3a1: 74 08 je 3ab + buf[i++] = '-'; + 3a3: 8d 4f 02 lea 0x2(%edi),%ecx + 3a6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 3ab: 8d 79 ff lea -0x1(%ecx),%edi + 3ae: 66 90 xchg %ax,%ax + 3b0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 3b5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 3b8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3bf: 00 + 3c0: 89 5c 24 04 mov %ebx,0x4(%esp) + 3c4: 89 34 24 mov %esi,(%esp) + 3c7: 88 45 d7 mov %al,-0x29(%ebp) + 3ca: e8 f3 fe ff ff call 2c2 + while(--i >= 0) + 3cf: 83 ff ff cmp $0xffffffff,%edi + 3d2: 75 dc jne 3b0 + putc(fd, buf[i]); +} + 3d4: 83 c4 4c add $0x4c,%esp + 3d7: 5b pop %ebx + 3d8: 5e pop %esi + 3d9: 5f pop %edi + 3da: 5d pop %ebp + 3db: c3 ret + 3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 3e0: 89 d0 mov %edx,%eax + 3e2: f7 d8 neg %eax + neg = 1; + 3e4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 3eb: eb 87 jmp 374 + 3ed: 8d 76 00 lea 0x0(%esi),%esi + +000003f0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3f0: 55 push %ebp + 3f1: 89 e5 mov %esp,%ebp + 3f3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3f4: 31 ff xor %edi,%edi +{ + 3f6: 56 push %esi + 3f7: 53 push %ebx + 3f8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3fb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3fe: 8d 45 10 lea 0x10(%ebp),%eax +{ + 401: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 404: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 407: 0f b6 13 movzbl (%ebx),%edx + 40a: 83 c3 01 add $0x1,%ebx + 40d: 84 d2 test %dl,%dl + 40f: 75 39 jne 44a + 411: e9 c2 00 00 00 jmp 4d8 + 416: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 418: 83 fa 25 cmp $0x25,%edx + 41b: 0f 84 bf 00 00 00 je 4e0 + write(fd, &c, 1); + 421: 8d 45 e2 lea -0x1e(%ebp),%eax + 424: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 42b: 00 + 42c: 89 44 24 04 mov %eax,0x4(%esp) + 430: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 433: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 436: e8 87 fe ff ff call 2c2 + 43b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 43e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 442: 84 d2 test %dl,%dl + 444: 0f 84 8e 00 00 00 je 4d8 + if(state == 0){ + 44a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 44c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 44f: 74 c7 je 418 + } + } else if(state == '%'){ + 451: 83 ff 25 cmp $0x25,%edi + 454: 75 e5 jne 43b + if(c == 'd'){ + 456: 83 fa 64 cmp $0x64,%edx + 459: 0f 84 31 01 00 00 je 590 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 45f: 25 f7 00 00 00 and $0xf7,%eax + 464: 83 f8 70 cmp $0x70,%eax + 467: 0f 84 83 00 00 00 je 4f0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 46d: 83 fa 73 cmp $0x73,%edx + 470: 0f 84 a2 00 00 00 je 518 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 476: 83 fa 63 cmp $0x63,%edx + 479: 0f 84 35 01 00 00 je 5b4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 47f: 83 fa 25 cmp $0x25,%edx + 482: 0f 84 e0 00 00 00 je 568 + write(fd, &c, 1); + 488: 8d 45 e6 lea -0x1a(%ebp),%eax + 48b: 83 c3 01 add $0x1,%ebx + 48e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 495: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 496: 31 ff xor %edi,%edi + write(fd, &c, 1); + 498: 89 44 24 04 mov %eax,0x4(%esp) + 49c: 89 34 24 mov %esi,(%esp) + 49f: 89 55 d0 mov %edx,-0x30(%ebp) + 4a2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 4a6: e8 17 fe ff ff call 2c2 + putc(fd, c); + 4ab: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 4ae: 8d 45 e7 lea -0x19(%ebp),%eax + 4b1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4b8: 00 + 4b9: 89 44 24 04 mov %eax,0x4(%esp) + 4bd: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4c0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4c3: e8 fa fd ff ff call 2c2 + for(i = 0; fmt[i]; i++){ + 4c8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4cc: 84 d2 test %dl,%dl + 4ce: 0f 85 76 ff ff ff jne 44a + 4d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4d8: 83 c4 3c add $0x3c,%esp + 4db: 5b pop %ebx + 4dc: 5e pop %esi + 4dd: 5f pop %edi + 4de: 5d pop %ebp + 4df: c3 ret + state = '%'; + 4e0: bf 25 00 00 00 mov $0x25,%edi + 4e5: e9 51 ff ff ff jmp 43b + 4ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4f0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4f3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4f8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4fa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 501: 8b 10 mov (%eax),%edx + 503: 89 f0 mov %esi,%eax + 505: e8 46 fe ff ff call 350 + ap++; + 50a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 50e: e9 28 ff ff ff jmp 43b + 513: 90 nop + 514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 518: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 51b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 51f: 8b 38 mov (%eax),%edi + s = "(null)"; + 521: b8 7d 07 00 00 mov $0x77d,%eax + 526: 85 ff test %edi,%edi + 528: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 52b: 0f b6 07 movzbl (%edi),%eax + 52e: 84 c0 test %al,%al + 530: 74 2a je 55c + 532: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 538: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 53b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 53e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 541: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 548: 00 + 549: 89 44 24 04 mov %eax,0x4(%esp) + 54d: 89 34 24 mov %esi,(%esp) + 550: e8 6d fd ff ff call 2c2 + while(*s != 0){ + 555: 0f b6 07 movzbl (%edi),%eax + 558: 84 c0 test %al,%al + 55a: 75 dc jne 538 + state = 0; + 55c: 31 ff xor %edi,%edi + 55e: e9 d8 fe ff ff jmp 43b + 563: 90 nop + 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 568: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 56b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 56d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 574: 00 + 575: 89 44 24 04 mov %eax,0x4(%esp) + 579: 89 34 24 mov %esi,(%esp) + 57c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 580: e8 3d fd ff ff call 2c2 + 585: e9 b1 fe ff ff jmp 43b + 58a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 590: 8b 45 d4 mov -0x2c(%ebp),%eax + 593: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 598: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 59b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 5a2: 8b 10 mov (%eax),%edx + 5a4: 89 f0 mov %esi,%eax + 5a6: e8 a5 fd ff ff call 350 + ap++; + 5ab: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5af: e9 87 fe ff ff jmp 43b + putc(fd, *ap); + 5b4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 5b7: 31 ff xor %edi,%edi + putc(fd, *ap); + 5b9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 5bb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5c2: 00 + 5c3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 5c6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 5c9: 8d 45 e4 lea -0x1c(%ebp),%eax + 5cc: 89 44 24 04 mov %eax,0x4(%esp) + 5d0: e8 ed fc ff ff call 2c2 + ap++; + 5d5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5d9: e9 5d fe ff ff jmp 43b + 5de: 66 90 xchg %ax,%ax + +000005e0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 5e0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e1: a1 fc 09 00 00 mov 0x9fc,%eax +{ + 5e6: 89 e5 mov %esp,%ebp + 5e8: 57 push %edi + 5e9: 56 push %esi + 5ea: 53 push %ebx + 5eb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5ee: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5f0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5f3: 39 d0 cmp %edx,%eax + 5f5: 72 11 jb 608 + 5f7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5f8: 39 c8 cmp %ecx,%eax + 5fa: 72 04 jb 600 + 5fc: 39 ca cmp %ecx,%edx + 5fe: 72 10 jb 610 + 600: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 602: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 604: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 606: 73 f0 jae 5f8 + 608: 39 ca cmp %ecx,%edx + 60a: 72 04 jb 610 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 60c: 39 c8 cmp %ecx,%eax + 60e: 72 f0 jb 600 + break; + if(bp + bp->s.size == p->s.ptr){ + 610: 8b 73 fc mov -0x4(%ebx),%esi + 613: 8d 3c f2 lea (%edx,%esi,8),%edi + 616: 39 cf cmp %ecx,%edi + 618: 74 1e je 638 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 61a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 61d: 8b 48 04 mov 0x4(%eax),%ecx + 620: 8d 34 c8 lea (%eax,%ecx,8),%esi + 623: 39 f2 cmp %esi,%edx + 625: 74 28 je 64f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 627: 89 10 mov %edx,(%eax) + freep = p; + 629: a3 fc 09 00 00 mov %eax,0x9fc +} + 62e: 5b pop %ebx + 62f: 5e pop %esi + 630: 5f pop %edi + 631: 5d pop %ebp + 632: c3 ret + 633: 90 nop + 634: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 638: 03 71 04 add 0x4(%ecx),%esi + 63b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 63e: 8b 08 mov (%eax),%ecx + 640: 8b 09 mov (%ecx),%ecx + 642: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 645: 8b 48 04 mov 0x4(%eax),%ecx + 648: 8d 34 c8 lea (%eax,%ecx,8),%esi + 64b: 39 f2 cmp %esi,%edx + 64d: 75 d8 jne 627 + p->s.size += bp->s.size; + 64f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 652: a3 fc 09 00 00 mov %eax,0x9fc + p->s.size += bp->s.size; + 657: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 65a: 8b 53 f8 mov -0x8(%ebx),%edx + 65d: 89 10 mov %edx,(%eax) +} + 65f: 5b pop %ebx + 660: 5e pop %esi + 661: 5f pop %edi + 662: 5d pop %ebp + 663: c3 ret + 664: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 66a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000670 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 670: 55 push %ebp + 671: 89 e5 mov %esp,%ebp + 673: 57 push %edi + 674: 56 push %esi + 675: 53 push %ebx + 676: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 679: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 67c: 8b 1d fc 09 00 00 mov 0x9fc,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 682: 8d 48 07 lea 0x7(%eax),%ecx + 685: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 688: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 68a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 68d: 0f 84 9b 00 00 00 je 72e + 693: 8b 13 mov (%ebx),%edx + 695: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 698: 39 fe cmp %edi,%esi + 69a: 76 64 jbe 700 + 69c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 6a3: bb 00 80 00 00 mov $0x8000,%ebx + 6a8: 89 45 e4 mov %eax,-0x1c(%ebp) + 6ab: eb 0e jmp 6bb + 6ad: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 6b0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 6b2: 8b 78 04 mov 0x4(%eax),%edi + 6b5: 39 fe cmp %edi,%esi + 6b7: 76 4f jbe 708 + 6b9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 6bb: 3b 15 fc 09 00 00 cmp 0x9fc,%edx + 6c1: 75 ed jne 6b0 + if(nu < 4096) + 6c3: 8b 45 e4 mov -0x1c(%ebp),%eax + 6c6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 6cc: bf 00 10 00 00 mov $0x1000,%edi + 6d1: 0f 43 fe cmovae %esi,%edi + 6d4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 6d7: 89 04 24 mov %eax,(%esp) + 6da: e8 4b fc ff ff call 32a + if(p == (char*)-1) + 6df: 83 f8 ff cmp $0xffffffff,%eax + 6e2: 74 18 je 6fc + hp->s.size = nu; + 6e4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 6e7: 83 c0 08 add $0x8,%eax + 6ea: 89 04 24 mov %eax,(%esp) + 6ed: e8 ee fe ff ff call 5e0 + return freep; + 6f2: 8b 15 fc 09 00 00 mov 0x9fc,%edx + if((p = morecore(nunits)) == 0) + 6f8: 85 d2 test %edx,%edx + 6fa: 75 b4 jne 6b0 + return 0; + 6fc: 31 c0 xor %eax,%eax + 6fe: eb 20 jmp 720 + if(p->s.size >= nunits){ + 700: 89 d0 mov %edx,%eax + 702: 89 da mov %ebx,%edx + 704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 708: 39 fe cmp %edi,%esi + 70a: 74 1c je 728 + p->s.size -= nunits; + 70c: 29 f7 sub %esi,%edi + 70e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 711: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 714: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 717: 89 15 fc 09 00 00 mov %edx,0x9fc + return (void*)(p + 1); + 71d: 83 c0 08 add $0x8,%eax + } +} + 720: 83 c4 1c add $0x1c,%esp + 723: 5b pop %ebx + 724: 5e pop %esi + 725: 5f pop %edi + 726: 5d pop %ebp + 727: c3 ret + prevp->s.ptr = p->s.ptr; + 728: 8b 08 mov (%eax),%ecx + 72a: 89 0a mov %ecx,(%edx) + 72c: eb e9 jmp 717 + base.s.ptr = freep = prevp = &base; + 72e: c7 05 fc 09 00 00 00 movl $0xa00,0x9fc + 735: 0a 00 00 + base.s.size = 0; + 738: ba 00 0a 00 00 mov $0xa00,%edx + base.s.ptr = freep = prevp = &base; + 73d: c7 05 00 0a 00 00 00 movl $0xa00,0xa00 + 744: 0a 00 00 + base.s.size = 0; + 747: c7 05 04 0a 00 00 00 movl $0x0,0xa04 + 74e: 00 00 00 + 751: e9 46 ff ff ff jmp 69c diff --git a/ln.c b/ln.c index cf8a64e0e0..14acdc87c6 100644 --- a/ln.c +++ b/ln.c @@ -7,9 +7,9 @@ main(int argc, char *argv[]) { if(argc != 3){ printf(2, "Usage: ln old new\n"); - exit(); + exit(0); } if(link(argv[1], argv[2]) < 0) printf(2, "link %s %s: failed\n", argv[1], argv[2]); - exit(); + exit(0); } diff --git a/ln.d b/ln.d new file mode 100644 index 0000000000..6728be9e4e --- /dev/null +++ b/ln.d @@ -0,0 +1 @@ +ln.o: ln.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/ln.o b/ln.o new file mode 100644 index 0000000000..b532648f89 Binary files /dev/null and b/ln.o differ diff --git a/ln.sym b/ln.sym new file mode 100644 index 0000000000..6258f540be --- /dev/null +++ b/ln.sym @@ -0,0 +1,57 @@ +00000000 .text +00000756 .rodata +00000798 .eh_frame +000009fc .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 ln.c +00000000 ulib.c +00000000 printf.c +00000350 printint +00000784 digits.1354 +00000000 umalloc.c +000009fc freep +00000a00 base +00000080 strcpy +000003f0 printf +00000270 memmove +000002ea mknod +00000190 gets +00000322 getpid +00000670 malloc +00000332 sleep +000002b2 pipe +000002c2 write +000002fa fstat +000002d2 kill +00000312 chdir +000002da exec +000002aa wait +000002ba read +000002f2 unlink +0000029a fork +0000032a sbrk +0000033a uptime +000009fc __bss_start +00000130 memset +00000000 main +000000b0 strcmp +0000031a dup +000001f0 stat +000009fc _edata +00000a08 _end +00000302 link +000002a2 exit +00000240 atoi +00000100 strlen +000002e2 open +00000150 strchr +0000030a mkdir +000002ca close +000005e0 free diff --git a/log.d b/log.d new file mode 100644 index 0000000000..04c8930142 --- /dev/null +++ b/log.d @@ -0,0 +1,2 @@ +log.o: log.c /usr/include/stdc-predef.h types.h defs.h param.h spinlock.h \ + sleeplock.h fs.h buf.h diff --git a/log.o b/log.o new file mode 100644 index 0000000000..447f2bd0fb Binary files /dev/null and b/log.o differ diff --git a/ls.asm b/ls.asm new file mode 100644 index 0000000000..d5bfbdbf92 --- /dev/null +++ b/ls.asm @@ -0,0 +1,1373 @@ + +_ls: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + close(fd); +} + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + 5: 53 push %ebx + int i; + + if(argc < 2){ + 6: bb 01 00 00 00 mov $0x1,%ebx +{ + b: 83 e4 f0 and $0xfffffff0,%esp + e: 83 ec 10 sub $0x10,%esp + 11: 8b 75 08 mov 0x8(%ebp),%esi + 14: 8b 7d 0c mov 0xc(%ebp),%edi + if(argc < 2){ + 17: 83 fe 01 cmp $0x1,%esi + 1a: 7e 22 jle 3e + 1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + ls("."); + exit(0); + } + for(i=1; i + for(i=1; i + exit(0); + 32: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 39: e8 74 05 00 00 call 5b2 + ls("."); + 3e: c7 04 24 ae 0a 00 00 movl $0xaae,(%esp) + 45: e8 b6 00 00 00 call 100 + exit(0); + 4a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 51: e8 5c 05 00 00 call 5b2 + 56: 66 90 xchg %ax,%ax + 58: 66 90 xchg %ax,%ax + 5a: 66 90 xchg %ax,%ax + 5c: 66 90 xchg %ax,%ax + 5e: 66 90 xchg %ax,%ax + +00000060 : +{ + 60: 55 push %ebp + 61: 89 e5 mov %esp,%ebp + 63: 56 push %esi + 64: 53 push %ebx + 65: 83 ec 10 sub $0x10,%esp + 68: 8b 5d 08 mov 0x8(%ebp),%ebx + for(p=path+strlen(path); p >= path && *p != '/'; p--) + 6b: 89 1c 24 mov %ebx,(%esp) + 6e: e8 9d 03 00 00 call 410 + 73: 01 d8 add %ebx,%eax + 75: 73 10 jae 87 + 77: eb 13 jmp 8c + 79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 80: 83 e8 01 sub $0x1,%eax + 83: 39 c3 cmp %eax,%ebx + 85: 77 05 ja 8c + 87: 80 38 2f cmpb $0x2f,(%eax) + 8a: 75 f4 jne 80 + p++; + 8c: 8d 58 01 lea 0x1(%eax),%ebx + if(strlen(p) >= DIRSIZ) + 8f: 89 1c 24 mov %ebx,(%esp) + 92: e8 79 03 00 00 call 410 + 97: 83 f8 0d cmp $0xd,%eax + 9a: 77 53 ja ef + memmove(buf, p, strlen(p)); + 9c: 89 1c 24 mov %ebx,(%esp) + 9f: e8 6c 03 00 00 call 410 + a4: 89 5c 24 04 mov %ebx,0x4(%esp) + a8: c7 04 24 98 0d 00 00 movl $0xd98,(%esp) + af: 89 44 24 08 mov %eax,0x8(%esp) + b3: e8 c8 04 00 00 call 580 + memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); + b8: 89 1c 24 mov %ebx,(%esp) + bb: e8 50 03 00 00 call 410 + c0: 89 1c 24 mov %ebx,(%esp) + return buf; + c3: bb 98 0d 00 00 mov $0xd98,%ebx + memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); + c8: 89 c6 mov %eax,%esi + ca: e8 41 03 00 00 call 410 + cf: ba 0e 00 00 00 mov $0xe,%edx + d4: 29 f2 sub %esi,%edx + d6: 89 54 24 08 mov %edx,0x8(%esp) + da: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp) + e1: 00 + e2: 05 98 0d 00 00 add $0xd98,%eax + e7: 89 04 24 mov %eax,(%esp) + ea: e8 51 03 00 00 call 440 +} + ef: 83 c4 10 add $0x10,%esp + f2: 89 d8 mov %ebx,%eax + f4: 5b pop %ebx + f5: 5e pop %esi + f6: 5d pop %ebp + f7: c3 ret + f8: 90 nop + f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000100 : +{ + 100: 55 push %ebp + 101: 89 e5 mov %esp,%ebp + 103: 57 push %edi + 104: 56 push %esi + 105: 53 push %ebx + 106: 81 ec 6c 02 00 00 sub $0x26c,%esp + 10c: 8b 7d 08 mov 0x8(%ebp),%edi + if((fd = open(path, 0)) < 0){ + 10f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 116: 00 + 117: 89 3c 24 mov %edi,(%esp) + 11a: e8 d3 04 00 00 call 5f2 + 11f: 85 c0 test %eax,%eax + 121: 89 c3 mov %eax,%ebx + 123: 0f 88 c7 01 00 00 js 2f0 + if(fstat(fd, &st) < 0){ + 129: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi + 12f: 89 74 24 04 mov %esi,0x4(%esp) + 133: 89 04 24 mov %eax,(%esp) + 136: e8 cf 04 00 00 call 60a + 13b: 85 c0 test %eax,%eax + 13d: 0f 88 f5 01 00 00 js 338 + switch(st.type){ + 143: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax + 14a: 66 83 f8 01 cmp $0x1,%ax + 14e: 74 68 je 1b8 + 150: 66 83 f8 02 cmp $0x2,%ax + 154: 75 48 jne 19e + printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size); + 156: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx + 15c: 89 3c 24 mov %edi,(%esp) + 15f: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi + 165: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp) + 16b: e8 f0 fe ff ff call 60 + 170: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx + 176: 89 74 24 10 mov %esi,0x10(%esp) + 17a: c7 44 24 0c 02 00 00 movl $0x2,0xc(%esp) + 181: 00 + 182: c7 44 24 04 8e 0a 00 movl $0xa8e,0x4(%esp) + 189: 00 + 18a: 89 54 24 14 mov %edx,0x14(%esp) + 18e: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 195: 89 44 24 08 mov %eax,0x8(%esp) + 199: e8 62 05 00 00 call 700 + close(fd); + 19e: 89 1c 24 mov %ebx,(%esp) + 1a1: e8 34 04 00 00 call 5da +} + 1a6: 81 c4 6c 02 00 00 add $0x26c,%esp + 1ac: 5b pop %ebx + 1ad: 5e pop %esi + 1ae: 5f pop %edi + 1af: 5d pop %ebp + 1b0: c3 ret + 1b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ + 1b8: 89 3c 24 mov %edi,(%esp) + 1bb: e8 50 02 00 00 call 410 + 1c0: 83 c0 10 add $0x10,%eax + 1c3: 3d 00 02 00 00 cmp $0x200,%eax + 1c8: 0f 87 4a 01 00 00 ja 318 + strcpy(buf, path); + 1ce: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 1d4: 89 7c 24 04 mov %edi,0x4(%esp) + 1d8: 8d bd c4 fd ff ff lea -0x23c(%ebp),%edi + 1de: 89 04 24 mov %eax,(%esp) + 1e1: e8 aa 01 00 00 call 390 + p = buf+strlen(buf); + 1e6: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 1ec: 89 04 24 mov %eax,(%esp) + 1ef: e8 1c 02 00 00 call 410 + 1f4: 8d 8d e8 fd ff ff lea -0x218(%ebp),%ecx + 1fa: 01 c8 add %ecx,%eax + *p++ = '/'; + 1fc: 8d 48 01 lea 0x1(%eax),%ecx + p = buf+strlen(buf); + 1ff: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp) + *p++ = '/'; + 205: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp) + 20b: c6 00 2f movb $0x2f,(%eax) + 20e: 66 90 xchg %ax,%ax + while(read(fd, &de, sizeof(de)) == sizeof(de)){ + 210: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) + 217: 00 + 218: 89 7c 24 04 mov %edi,0x4(%esp) + 21c: 89 1c 24 mov %ebx,(%esp) + 21f: e8 a6 03 00 00 call 5ca + 224: 83 f8 10 cmp $0x10,%eax + 227: 0f 85 71 ff ff ff jne 19e + if(de.inum == 0) + 22d: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp) + 234: 00 + 235: 74 d9 je 210 + memmove(p, de.name, DIRSIZ); + 237: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax + 23d: 89 44 24 04 mov %eax,0x4(%esp) + 241: 8b 85 a4 fd ff ff mov -0x25c(%ebp),%eax + 247: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) + 24e: 00 + 24f: 89 04 24 mov %eax,(%esp) + 252: e8 29 03 00 00 call 580 + p[DIRSIZ] = 0; + 257: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax + 25d: c6 40 0f 00 movb $0x0,0xf(%eax) + if(stat(buf, &st) < 0){ + 261: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 267: 89 74 24 04 mov %esi,0x4(%esp) + 26b: 89 04 24 mov %eax,(%esp) + 26e: e8 8d 02 00 00 call 500 + 273: 85 c0 test %eax,%eax + 275: 0f 88 e5 00 00 00 js 360 + printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); + 27b: 0f bf 95 d4 fd ff ff movswl -0x22c(%ebp),%edx + 282: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx + 288: 8b 85 dc fd ff ff mov -0x224(%ebp),%eax + 28e: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp) + 294: 8d 95 e8 fd ff ff lea -0x218(%ebp),%edx + 29a: 89 14 24 mov %edx,(%esp) + 29d: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp) + 2a3: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) + 2a9: e8 b2 fd ff ff call 60 + 2ae: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx + 2b4: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx + 2ba: c7 44 24 04 8e 0a 00 movl $0xa8e,0x4(%esp) + 2c1: 00 + 2c2: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c9: 89 4c 24 14 mov %ecx,0x14(%esp) + 2cd: 8b 8d b4 fd ff ff mov -0x24c(%ebp),%ecx + 2d3: 89 54 24 0c mov %edx,0xc(%esp) + 2d7: 89 44 24 08 mov %eax,0x8(%esp) + 2db: 89 4c 24 10 mov %ecx,0x10(%esp) + 2df: e8 1c 04 00 00 call 700 + 2e4: e9 27 ff ff ff jmp 210 + 2e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + printf(2, "ls: cannot open %s\n", path); + 2f0: 89 7c 24 08 mov %edi,0x8(%esp) + 2f4: c7 44 24 04 66 0a 00 movl $0xa66,0x4(%esp) + 2fb: 00 + 2fc: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 303: e8 f8 03 00 00 call 700 +} + 308: 81 c4 6c 02 00 00 add $0x26c,%esp + 30e: 5b pop %ebx + 30f: 5e pop %esi + 310: 5f pop %edi + 311: 5d pop %ebp + 312: c3 ret + 313: 90 nop + 314: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(1, "ls: path too long\n"); + 318: c7 44 24 04 9b 0a 00 movl $0xa9b,0x4(%esp) + 31f: 00 + 320: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 327: e8 d4 03 00 00 call 700 + break; + 32c: e9 6d fe ff ff jmp 19e + 331: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + printf(2, "ls: cannot stat %s\n", path); + 338: 89 7c 24 08 mov %edi,0x8(%esp) + 33c: c7 44 24 04 7a 0a 00 movl $0xa7a,0x4(%esp) + 343: 00 + 344: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 34b: e8 b0 03 00 00 call 700 + close(fd); + 350: 89 1c 24 mov %ebx,(%esp) + 353: e8 82 02 00 00 call 5da + return; + 358: e9 49 fe ff ff jmp 1a6 + 35d: 8d 76 00 lea 0x0(%esi),%esi + printf(1, "ls: cannot stat %s\n", buf); + 360: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 366: 89 44 24 08 mov %eax,0x8(%esp) + 36a: c7 44 24 04 7a 0a 00 movl $0xa7a,0x4(%esp) + 371: 00 + 372: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 379: e8 82 03 00 00 call 700 + continue; + 37e: e9 8d fe ff ff jmp 210 + 383: 66 90 xchg %ax,%ax + 385: 66 90 xchg %ax,%ax + 387: 66 90 xchg %ax,%ax + 389: 66 90 xchg %ax,%ax + 38b: 66 90 xchg %ax,%ax + 38d: 66 90 xchg %ax,%ax + 38f: 90 nop + +00000390 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 390: 55 push %ebp + 391: 89 e5 mov %esp,%ebp + 393: 8b 45 08 mov 0x8(%ebp),%eax + 396: 8b 4d 0c mov 0xc(%ebp),%ecx + 399: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 39a: 89 c2 mov %eax,%edx + 39c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 3a0: 83 c1 01 add $0x1,%ecx + 3a3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 3a7: 83 c2 01 add $0x1,%edx + 3aa: 84 db test %bl,%bl + 3ac: 88 5a ff mov %bl,-0x1(%edx) + 3af: 75 ef jne 3a0 + ; + return os; +} + 3b1: 5b pop %ebx + 3b2: 5d pop %ebp + 3b3: c3 ret + 3b4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 3ba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000003c0 : + +int +strcmp(const char *p, const char *q) +{ + 3c0: 55 push %ebp + 3c1: 89 e5 mov %esp,%ebp + 3c3: 8b 55 08 mov 0x8(%ebp),%edx + 3c6: 53 push %ebx + 3c7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 3ca: 0f b6 02 movzbl (%edx),%eax + 3cd: 84 c0 test %al,%al + 3cf: 74 2d je 3fe + 3d1: 0f b6 19 movzbl (%ecx),%ebx + 3d4: 38 d8 cmp %bl,%al + 3d6: 74 0e je 3e6 + 3d8: eb 2b jmp 405 + 3da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 3e0: 38 c8 cmp %cl,%al + 3e2: 75 15 jne 3f9 + p++, q++; + 3e4: 89 d9 mov %ebx,%ecx + 3e6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 3e9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 3ec: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 3ef: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 3f3: 84 c0 test %al,%al + 3f5: 75 e9 jne 3e0 + 3f7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 3f9: 29 c8 sub %ecx,%eax +} + 3fb: 5b pop %ebx + 3fc: 5d pop %ebp + 3fd: c3 ret + 3fe: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 401: 31 c0 xor %eax,%eax + 403: eb f4 jmp 3f9 + 405: 0f b6 cb movzbl %bl,%ecx + 408: eb ef jmp 3f9 + 40a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000410 : + +uint +strlen(const char *s) +{ + 410: 55 push %ebp + 411: 89 e5 mov %esp,%ebp + 413: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 416: 80 39 00 cmpb $0x0,(%ecx) + 419: 74 12 je 42d + 41b: 31 d2 xor %edx,%edx + 41d: 8d 76 00 lea 0x0(%esi),%esi + 420: 83 c2 01 add $0x1,%edx + 423: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 427: 89 d0 mov %edx,%eax + 429: 75 f5 jne 420 + ; + return n; +} + 42b: 5d pop %ebp + 42c: c3 ret + for(n = 0; s[n]; n++) + 42d: 31 c0 xor %eax,%eax +} + 42f: 5d pop %ebp + 430: c3 ret + 431: eb 0d jmp 440 + 433: 90 nop + 434: 90 nop + 435: 90 nop + 436: 90 nop + 437: 90 nop + 438: 90 nop + 439: 90 nop + 43a: 90 nop + 43b: 90 nop + 43c: 90 nop + 43d: 90 nop + 43e: 90 nop + 43f: 90 nop + +00000440 : + +void* +memset(void *dst, int c, uint n) +{ + 440: 55 push %ebp + 441: 89 e5 mov %esp,%ebp + 443: 8b 55 08 mov 0x8(%ebp),%edx + 446: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 447: 8b 4d 10 mov 0x10(%ebp),%ecx + 44a: 8b 45 0c mov 0xc(%ebp),%eax + 44d: 89 d7 mov %edx,%edi + 44f: fc cld + 450: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 452: 89 d0 mov %edx,%eax + 454: 5f pop %edi + 455: 5d pop %ebp + 456: c3 ret + 457: 89 f6 mov %esi,%esi + 459: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000460 : + +char* +strchr(const char *s, char c) +{ + 460: 55 push %ebp + 461: 89 e5 mov %esp,%ebp + 463: 8b 45 08 mov 0x8(%ebp),%eax + 466: 53 push %ebx + 467: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 46a: 0f b6 18 movzbl (%eax),%ebx + 46d: 84 db test %bl,%bl + 46f: 74 1d je 48e + if(*s == c) + 471: 38 d3 cmp %dl,%bl + 473: 89 d1 mov %edx,%ecx + 475: 75 0d jne 484 + 477: eb 17 jmp 490 + 479: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 480: 38 ca cmp %cl,%dl + 482: 74 0c je 490 + for(; *s; s++) + 484: 83 c0 01 add $0x1,%eax + 487: 0f b6 10 movzbl (%eax),%edx + 48a: 84 d2 test %dl,%dl + 48c: 75 f2 jne 480 + return (char*)s; + return 0; + 48e: 31 c0 xor %eax,%eax +} + 490: 5b pop %ebx + 491: 5d pop %ebp + 492: c3 ret + 493: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 499: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000004a0 : + +char* +gets(char *buf, int max) +{ + 4a0: 55 push %ebp + 4a1: 89 e5 mov %esp,%ebp + 4a3: 57 push %edi + 4a4: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 4a5: 31 f6 xor %esi,%esi +{ + 4a7: 53 push %ebx + 4a8: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 4ab: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 4ae: eb 31 jmp 4e1 + cc = read(0, &c, 1); + 4b0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4b7: 00 + 4b8: 89 7c 24 04 mov %edi,0x4(%esp) + 4bc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 4c3: e8 02 01 00 00 call 5ca + if(cc < 1) + 4c8: 85 c0 test %eax,%eax + 4ca: 7e 1d jle 4e9 + break; + buf[i++] = c; + 4cc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 4d0: 89 de mov %ebx,%esi + buf[i++] = c; + 4d2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 4d5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 4d7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 4db: 74 0c je 4e9 + 4dd: 3c 0a cmp $0xa,%al + 4df: 74 08 je 4e9 + for(i=0; i+1 < max; ){ + 4e1: 8d 5e 01 lea 0x1(%esi),%ebx + 4e4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 4e7: 7c c7 jl 4b0 + break; + } + buf[i] = '\0'; + 4e9: 8b 45 08 mov 0x8(%ebp),%eax + 4ec: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 4f0: 83 c4 2c add $0x2c,%esp + 4f3: 5b pop %ebx + 4f4: 5e pop %esi + 4f5: 5f pop %edi + 4f6: 5d pop %ebp + 4f7: c3 ret + 4f8: 90 nop + 4f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000500 : + +int +stat(const char *n, struct stat *st) +{ + 500: 55 push %ebp + 501: 89 e5 mov %esp,%ebp + 503: 56 push %esi + 504: 53 push %ebx + 505: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 508: 8b 45 08 mov 0x8(%ebp),%eax + 50b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 512: 00 + 513: 89 04 24 mov %eax,(%esp) + 516: e8 d7 00 00 00 call 5f2 + if(fd < 0) + 51b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 51d: 89 c3 mov %eax,%ebx + if(fd < 0) + 51f: 78 27 js 548 + return -1; + r = fstat(fd, st); + 521: 8b 45 0c mov 0xc(%ebp),%eax + 524: 89 1c 24 mov %ebx,(%esp) + 527: 89 44 24 04 mov %eax,0x4(%esp) + 52b: e8 da 00 00 00 call 60a + close(fd); + 530: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 533: 89 c6 mov %eax,%esi + close(fd); + 535: e8 a0 00 00 00 call 5da + return r; + 53a: 89 f0 mov %esi,%eax +} + 53c: 83 c4 10 add $0x10,%esp + 53f: 5b pop %ebx + 540: 5e pop %esi + 541: 5d pop %ebp + 542: c3 ret + 543: 90 nop + 544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 548: b8 ff ff ff ff mov $0xffffffff,%eax + 54d: eb ed jmp 53c + 54f: 90 nop + +00000550 : + +int +atoi(const char *s) +{ + 550: 55 push %ebp + 551: 89 e5 mov %esp,%ebp + 553: 8b 4d 08 mov 0x8(%ebp),%ecx + 556: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 557: 0f be 11 movsbl (%ecx),%edx + 55a: 8d 42 d0 lea -0x30(%edx),%eax + 55d: 3c 09 cmp $0x9,%al + n = 0; + 55f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 564: 77 17 ja 57d + 566: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 568: 83 c1 01 add $0x1,%ecx + 56b: 8d 04 80 lea (%eax,%eax,4),%eax + 56e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 572: 0f be 11 movsbl (%ecx),%edx + 575: 8d 5a d0 lea -0x30(%edx),%ebx + 578: 80 fb 09 cmp $0x9,%bl + 57b: 76 eb jbe 568 + return n; +} + 57d: 5b pop %ebx + 57e: 5d pop %ebp + 57f: c3 ret + +00000580 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 580: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 581: 31 d2 xor %edx,%edx +{ + 583: 89 e5 mov %esp,%ebp + 585: 56 push %esi + 586: 8b 45 08 mov 0x8(%ebp),%eax + 589: 53 push %ebx + 58a: 8b 5d 10 mov 0x10(%ebp),%ebx + 58d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 590: 85 db test %ebx,%ebx + 592: 7e 12 jle 5a6 + 594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 598: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 59c: 88 0c 10 mov %cl,(%eax,%edx,1) + 59f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 5a2: 39 da cmp %ebx,%edx + 5a4: 75 f2 jne 598 + return vdst; +} + 5a6: 5b pop %ebx + 5a7: 5e pop %esi + 5a8: 5d pop %ebp + 5a9: c3 ret + +000005aa : + 5aa: b8 01 00 00 00 mov $0x1,%eax + 5af: cd 40 int $0x40 + 5b1: c3 ret + +000005b2 : + 5b2: b8 02 00 00 00 mov $0x2,%eax + 5b7: cd 40 int $0x40 + 5b9: c3 ret + +000005ba : + 5ba: b8 03 00 00 00 mov $0x3,%eax + 5bf: cd 40 int $0x40 + 5c1: c3 ret + +000005c2 : + 5c2: b8 04 00 00 00 mov $0x4,%eax + 5c7: cd 40 int $0x40 + 5c9: c3 ret + +000005ca : + 5ca: b8 05 00 00 00 mov $0x5,%eax + 5cf: cd 40 int $0x40 + 5d1: c3 ret + +000005d2 : + 5d2: b8 10 00 00 00 mov $0x10,%eax + 5d7: cd 40 int $0x40 + 5d9: c3 ret + +000005da : + 5da: b8 15 00 00 00 mov $0x15,%eax + 5df: cd 40 int $0x40 + 5e1: c3 ret + +000005e2 : + 5e2: b8 06 00 00 00 mov $0x6,%eax + 5e7: cd 40 int $0x40 + 5e9: c3 ret + +000005ea : + 5ea: b8 07 00 00 00 mov $0x7,%eax + 5ef: cd 40 int $0x40 + 5f1: c3 ret + +000005f2 : + 5f2: b8 0f 00 00 00 mov $0xf,%eax + 5f7: cd 40 int $0x40 + 5f9: c3 ret + +000005fa : + 5fa: b8 11 00 00 00 mov $0x11,%eax + 5ff: cd 40 int $0x40 + 601: c3 ret + +00000602 : + 602: b8 12 00 00 00 mov $0x12,%eax + 607: cd 40 int $0x40 + 609: c3 ret + +0000060a : + 60a: b8 08 00 00 00 mov $0x8,%eax + 60f: cd 40 int $0x40 + 611: c3 ret + +00000612 : + 612: b8 13 00 00 00 mov $0x13,%eax + 617: cd 40 int $0x40 + 619: c3 ret + +0000061a : + 61a: b8 14 00 00 00 mov $0x14,%eax + 61f: cd 40 int $0x40 + 621: c3 ret + +00000622 : + 622: b8 09 00 00 00 mov $0x9,%eax + 627: cd 40 int $0x40 + 629: c3 ret + +0000062a : + 62a: b8 0a 00 00 00 mov $0xa,%eax + 62f: cd 40 int $0x40 + 631: c3 ret + +00000632 : + 632: b8 0b 00 00 00 mov $0xb,%eax + 637: cd 40 int $0x40 + 639: c3 ret + +0000063a : + 63a: b8 0c 00 00 00 mov $0xc,%eax + 63f: cd 40 int $0x40 + 641: c3 ret + +00000642 : + 642: b8 0d 00 00 00 mov $0xd,%eax + 647: cd 40 int $0x40 + 649: c3 ret + +0000064a : + 64a: b8 0e 00 00 00 mov $0xe,%eax + 64f: cd 40 int $0x40 + 651: c3 ret + 652: 66 90 xchg %ax,%ax + 654: 66 90 xchg %ax,%ax + 656: 66 90 xchg %ax,%ax + 658: 66 90 xchg %ax,%ax + 65a: 66 90 xchg %ax,%ax + 65c: 66 90 xchg %ax,%ax + 65e: 66 90 xchg %ax,%ax + +00000660 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 660: 55 push %ebp + 661: 89 e5 mov %esp,%ebp + 663: 57 push %edi + 664: 56 push %esi + 665: 89 c6 mov %eax,%esi + 667: 53 push %ebx + 668: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 66b: 8b 5d 08 mov 0x8(%ebp),%ebx + 66e: 85 db test %ebx,%ebx + 670: 74 09 je 67b + 672: 89 d0 mov %edx,%eax + 674: c1 e8 1f shr $0x1f,%eax + 677: 84 c0 test %al,%al + 679: 75 75 jne 6f0 + neg = 1; + x = -xx; + } else { + x = xx; + 67b: 89 d0 mov %edx,%eax + neg = 0; + 67d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 684: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 687: 31 ff xor %edi,%edi + 689: 89 ce mov %ecx,%esi + 68b: 8d 5d d7 lea -0x29(%ebp),%ebx + 68e: eb 02 jmp 692 + do{ + buf[i++] = digits[x % base]; + 690: 89 cf mov %ecx,%edi + 692: 31 d2 xor %edx,%edx + 694: f7 f6 div %esi + 696: 8d 4f 01 lea 0x1(%edi),%ecx + 699: 0f b6 92 b7 0a 00 00 movzbl 0xab7(%edx),%edx + }while((x /= base) != 0); + 6a0: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 6a2: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 6a5: 75 e9 jne 690 + if(neg) + 6a7: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 6aa: 89 c8 mov %ecx,%eax + 6ac: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 6af: 85 d2 test %edx,%edx + 6b1: 74 08 je 6bb + buf[i++] = '-'; + 6b3: 8d 4f 02 lea 0x2(%edi),%ecx + 6b6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 6bb: 8d 79 ff lea -0x1(%ecx),%edi + 6be: 66 90 xchg %ax,%ax + 6c0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 6c5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 6c8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 6cf: 00 + 6d0: 89 5c 24 04 mov %ebx,0x4(%esp) + 6d4: 89 34 24 mov %esi,(%esp) + 6d7: 88 45 d7 mov %al,-0x29(%ebp) + 6da: e8 f3 fe ff ff call 5d2 + while(--i >= 0) + 6df: 83 ff ff cmp $0xffffffff,%edi + 6e2: 75 dc jne 6c0 + putc(fd, buf[i]); +} + 6e4: 83 c4 4c add $0x4c,%esp + 6e7: 5b pop %ebx + 6e8: 5e pop %esi + 6e9: 5f pop %edi + 6ea: 5d pop %ebp + 6eb: c3 ret + 6ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 6f0: 89 d0 mov %edx,%eax + 6f2: f7 d8 neg %eax + neg = 1; + 6f4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 6fb: eb 87 jmp 684 + 6fd: 8d 76 00 lea 0x0(%esi),%esi + +00000700 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 700: 55 push %ebp + 701: 89 e5 mov %esp,%ebp + 703: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 704: 31 ff xor %edi,%edi +{ + 706: 56 push %esi + 707: 53 push %ebx + 708: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 70b: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 70e: 8d 45 10 lea 0x10(%ebp),%eax +{ + 711: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 714: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 717: 0f b6 13 movzbl (%ebx),%edx + 71a: 83 c3 01 add $0x1,%ebx + 71d: 84 d2 test %dl,%dl + 71f: 75 39 jne 75a + 721: e9 c2 00 00 00 jmp 7e8 + 726: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 728: 83 fa 25 cmp $0x25,%edx + 72b: 0f 84 bf 00 00 00 je 7f0 + write(fd, &c, 1); + 731: 8d 45 e2 lea -0x1e(%ebp),%eax + 734: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 73b: 00 + 73c: 89 44 24 04 mov %eax,0x4(%esp) + 740: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 743: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 746: e8 87 fe ff ff call 5d2 + 74b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 74e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 752: 84 d2 test %dl,%dl + 754: 0f 84 8e 00 00 00 je 7e8 + if(state == 0){ + 75a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 75c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 75f: 74 c7 je 728 + } + } else if(state == '%'){ + 761: 83 ff 25 cmp $0x25,%edi + 764: 75 e5 jne 74b + if(c == 'd'){ + 766: 83 fa 64 cmp $0x64,%edx + 769: 0f 84 31 01 00 00 je 8a0 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 76f: 25 f7 00 00 00 and $0xf7,%eax + 774: 83 f8 70 cmp $0x70,%eax + 777: 0f 84 83 00 00 00 je 800 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 77d: 83 fa 73 cmp $0x73,%edx + 780: 0f 84 a2 00 00 00 je 828 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 786: 83 fa 63 cmp $0x63,%edx + 789: 0f 84 35 01 00 00 je 8c4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 78f: 83 fa 25 cmp $0x25,%edx + 792: 0f 84 e0 00 00 00 je 878 + write(fd, &c, 1); + 798: 8d 45 e6 lea -0x1a(%ebp),%eax + 79b: 83 c3 01 add $0x1,%ebx + 79e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 7a5: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 7a6: 31 ff xor %edi,%edi + write(fd, &c, 1); + 7a8: 89 44 24 04 mov %eax,0x4(%esp) + 7ac: 89 34 24 mov %esi,(%esp) + 7af: 89 55 d0 mov %edx,-0x30(%ebp) + 7b2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 7b6: e8 17 fe ff ff call 5d2 + putc(fd, c); + 7bb: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 7be: 8d 45 e7 lea -0x19(%ebp),%eax + 7c1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 7c8: 00 + 7c9: 89 44 24 04 mov %eax,0x4(%esp) + 7cd: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 7d0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 7d3: e8 fa fd ff ff call 5d2 + for(i = 0; fmt[i]; i++){ + 7d8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 7dc: 84 d2 test %dl,%dl + 7de: 0f 85 76 ff ff ff jne 75a + 7e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 7e8: 83 c4 3c add $0x3c,%esp + 7eb: 5b pop %ebx + 7ec: 5e pop %esi + 7ed: 5f pop %edi + 7ee: 5d pop %ebp + 7ef: c3 ret + state = '%'; + 7f0: bf 25 00 00 00 mov $0x25,%edi + 7f5: e9 51 ff ff ff jmp 74b + 7fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 800: 8b 45 d4 mov -0x2c(%ebp),%eax + 803: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 808: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 80a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 811: 8b 10 mov (%eax),%edx + 813: 89 f0 mov %esi,%eax + 815: e8 46 fe ff ff call 660 + ap++; + 81a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 81e: e9 28 ff ff ff jmp 74b + 823: 90 nop + 824: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 828: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 82b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 82f: 8b 38 mov (%eax),%edi + s = "(null)"; + 831: b8 b0 0a 00 00 mov $0xab0,%eax + 836: 85 ff test %edi,%edi + 838: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 83b: 0f b6 07 movzbl (%edi),%eax + 83e: 84 c0 test %al,%al + 840: 74 2a je 86c + 842: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 848: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 84b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 84e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 851: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 858: 00 + 859: 89 44 24 04 mov %eax,0x4(%esp) + 85d: 89 34 24 mov %esi,(%esp) + 860: e8 6d fd ff ff call 5d2 + while(*s != 0){ + 865: 0f b6 07 movzbl (%edi),%eax + 868: 84 c0 test %al,%al + 86a: 75 dc jne 848 + state = 0; + 86c: 31 ff xor %edi,%edi + 86e: e9 d8 fe ff ff jmp 74b + 873: 90 nop + 874: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 878: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 87b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 87d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 884: 00 + 885: 89 44 24 04 mov %eax,0x4(%esp) + 889: 89 34 24 mov %esi,(%esp) + 88c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 890: e8 3d fd ff ff call 5d2 + 895: e9 b1 fe ff ff jmp 74b + 89a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 8a0: 8b 45 d4 mov -0x2c(%ebp),%eax + 8a3: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 8a8: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 8ab: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 8b2: 8b 10 mov (%eax),%edx + 8b4: 89 f0 mov %esi,%eax + 8b6: e8 a5 fd ff ff call 660 + ap++; + 8bb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 8bf: e9 87 fe ff ff jmp 74b + putc(fd, *ap); + 8c4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 8c7: 31 ff xor %edi,%edi + putc(fd, *ap); + 8c9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 8cb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 8d2: 00 + 8d3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 8d6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 8d9: 8d 45 e4 lea -0x1c(%ebp),%eax + 8dc: 89 44 24 04 mov %eax,0x4(%esp) + 8e0: e8 ed fc ff ff call 5d2 + ap++; + 8e5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 8e9: e9 5d fe ff ff jmp 74b + 8ee: 66 90 xchg %ax,%ax + +000008f0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 8f0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 8f1: a1 a8 0d 00 00 mov 0xda8,%eax +{ + 8f6: 89 e5 mov %esp,%ebp + 8f8: 57 push %edi + 8f9: 56 push %esi + 8fa: 53 push %ebx + 8fb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 8fe: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 900: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 903: 39 d0 cmp %edx,%eax + 905: 72 11 jb 918 + 907: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 908: 39 c8 cmp %ecx,%eax + 90a: 72 04 jb 910 + 90c: 39 ca cmp %ecx,%edx + 90e: 72 10 jb 920 + 910: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 912: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 914: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 916: 73 f0 jae 908 + 918: 39 ca cmp %ecx,%edx + 91a: 72 04 jb 920 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 91c: 39 c8 cmp %ecx,%eax + 91e: 72 f0 jb 910 + break; + if(bp + bp->s.size == p->s.ptr){ + 920: 8b 73 fc mov -0x4(%ebx),%esi + 923: 8d 3c f2 lea (%edx,%esi,8),%edi + 926: 39 cf cmp %ecx,%edi + 928: 74 1e je 948 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 92a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 92d: 8b 48 04 mov 0x4(%eax),%ecx + 930: 8d 34 c8 lea (%eax,%ecx,8),%esi + 933: 39 f2 cmp %esi,%edx + 935: 74 28 je 95f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 937: 89 10 mov %edx,(%eax) + freep = p; + 939: a3 a8 0d 00 00 mov %eax,0xda8 +} + 93e: 5b pop %ebx + 93f: 5e pop %esi + 940: 5f pop %edi + 941: 5d pop %ebp + 942: c3 ret + 943: 90 nop + 944: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 948: 03 71 04 add 0x4(%ecx),%esi + 94b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 94e: 8b 08 mov (%eax),%ecx + 950: 8b 09 mov (%ecx),%ecx + 952: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 955: 8b 48 04 mov 0x4(%eax),%ecx + 958: 8d 34 c8 lea (%eax,%ecx,8),%esi + 95b: 39 f2 cmp %esi,%edx + 95d: 75 d8 jne 937 + p->s.size += bp->s.size; + 95f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 962: a3 a8 0d 00 00 mov %eax,0xda8 + p->s.size += bp->s.size; + 967: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 96a: 8b 53 f8 mov -0x8(%ebx),%edx + 96d: 89 10 mov %edx,(%eax) +} + 96f: 5b pop %ebx + 970: 5e pop %esi + 971: 5f pop %edi + 972: 5d pop %ebp + 973: c3 ret + 974: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 97a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000980 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 980: 55 push %ebp + 981: 89 e5 mov %esp,%ebp + 983: 57 push %edi + 984: 56 push %esi + 985: 53 push %ebx + 986: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 989: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 98c: 8b 1d a8 0d 00 00 mov 0xda8,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 992: 8d 48 07 lea 0x7(%eax),%ecx + 995: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 998: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 99a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 99d: 0f 84 9b 00 00 00 je a3e + 9a3: 8b 13 mov (%ebx),%edx + 9a5: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 9a8: 39 fe cmp %edi,%esi + 9aa: 76 64 jbe a10 + 9ac: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 9b3: bb 00 80 00 00 mov $0x8000,%ebx + 9b8: 89 45 e4 mov %eax,-0x1c(%ebp) + 9bb: eb 0e jmp 9cb + 9bd: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 9c0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 9c2: 8b 78 04 mov 0x4(%eax),%edi + 9c5: 39 fe cmp %edi,%esi + 9c7: 76 4f jbe a18 + 9c9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 9cb: 3b 15 a8 0d 00 00 cmp 0xda8,%edx + 9d1: 75 ed jne 9c0 + if(nu < 4096) + 9d3: 8b 45 e4 mov -0x1c(%ebp),%eax + 9d6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 9dc: bf 00 10 00 00 mov $0x1000,%edi + 9e1: 0f 43 fe cmovae %esi,%edi + 9e4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 9e7: 89 04 24 mov %eax,(%esp) + 9ea: e8 4b fc ff ff call 63a + if(p == (char*)-1) + 9ef: 83 f8 ff cmp $0xffffffff,%eax + 9f2: 74 18 je a0c + hp->s.size = nu; + 9f4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 9f7: 83 c0 08 add $0x8,%eax + 9fa: 89 04 24 mov %eax,(%esp) + 9fd: e8 ee fe ff ff call 8f0 + return freep; + a02: 8b 15 a8 0d 00 00 mov 0xda8,%edx + if((p = morecore(nunits)) == 0) + a08: 85 d2 test %edx,%edx + a0a: 75 b4 jne 9c0 + return 0; + a0c: 31 c0 xor %eax,%eax + a0e: eb 20 jmp a30 + if(p->s.size >= nunits){ + a10: 89 d0 mov %edx,%eax + a12: 89 da mov %ebx,%edx + a14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + a18: 39 fe cmp %edi,%esi + a1a: 74 1c je a38 + p->s.size -= nunits; + a1c: 29 f7 sub %esi,%edi + a1e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + a21: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + a24: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + a27: 89 15 a8 0d 00 00 mov %edx,0xda8 + return (void*)(p + 1); + a2d: 83 c0 08 add $0x8,%eax + } +} + a30: 83 c4 1c add $0x1c,%esp + a33: 5b pop %ebx + a34: 5e pop %esi + a35: 5f pop %edi + a36: 5d pop %ebp + a37: c3 ret + prevp->s.ptr = p->s.ptr; + a38: 8b 08 mov (%eax),%ecx + a3a: 89 0a mov %ecx,(%edx) + a3c: eb e9 jmp a27 + base.s.ptr = freep = prevp = &base; + a3e: c7 05 a8 0d 00 00 ac movl $0xdac,0xda8 + a45: 0d 00 00 + base.s.size = 0; + a48: ba ac 0d 00 00 mov $0xdac,%edx + base.s.ptr = freep = prevp = &base; + a4d: c7 05 ac 0d 00 00 ac movl $0xdac,0xdac + a54: 0d 00 00 + base.s.size = 0; + a57: c7 05 b0 0d 00 00 00 movl $0x0,0xdb0 + a5e: 00 00 00 + a61: e9 46 ff ff ff jmp 9ac diff --git a/ls.c b/ls.c index 2862913514..27742c2b33 100644 --- a/ls.c +++ b/ls.c @@ -77,9 +77,9 @@ main(int argc, char *argv[]) if(argc < 2){ ls("."); - exit(); + exit(0); } for(i=1; i: +#include "stat.h" +#include "user.h" + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + int i; + + if(argc < 2){ + 5: be 01 00 00 00 mov $0x1,%esi +{ + a: 53 push %ebx + b: 83 e4 f0 and $0xfffffff0,%esp + e: 83 ec 10 sub $0x10,%esp + 11: 8b 7d 08 mov 0x8(%ebp),%edi + 14: 8b 45 0c mov 0xc(%ebp),%eax + if(argc < 2){ + 17: 83 ff 01 cmp $0x1,%edi + 1a: 8d 58 04 lea 0x4(%eax),%ebx + 1d: 7e 41 jle 60 + 1f: 90 nop + printf(2, "Usage: mkdir files...\n"); + exit(0); + } + + for(i = 1; i < argc; i++){ + if(mkdir(argv[i]) < 0){ + 20: 8b 03 mov (%ebx),%eax + 22: 89 04 24 mov %eax,(%esp) + 25: e8 e0 02 00 00 call 30a + 2a: 85 c0 test %eax,%eax + 2c: 78 16 js 44 + for(i = 1; i < argc; i++){ + 2e: 83 c6 01 add $0x1,%esi + 31: 83 c3 04 add $0x4,%ebx + 34: 39 fe cmp %edi,%esi + 36: 75 e8 jne 20 + printf(2, "mkdir: %s failed to create\n", argv[i]); + break; + } + } + + exit(0); + 38: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3f: e8 5e 02 00 00 call 2a2 + printf(2, "mkdir: %s failed to create\n", argv[i]); + 44: 8b 03 mov (%ebx),%eax + 46: c7 44 24 04 6d 07 00 movl $0x76d,0x4(%esp) + 4d: 00 + 4e: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 55: 89 44 24 08 mov %eax,0x8(%esp) + 59: e8 92 03 00 00 call 3f0 + break; + 5e: eb d8 jmp 38 + printf(2, "Usage: mkdir files...\n"); + 60: c7 44 24 04 56 07 00 movl $0x756,0x4(%esp) + 67: 00 + 68: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 6f: e8 7c 03 00 00 call 3f0 + exit(0); + 74: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 7b: e8 22 02 00 00 call 2a2 + +00000080 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 80: 55 push %ebp + 81: 89 e5 mov %esp,%ebp + 83: 8b 45 08 mov 0x8(%ebp),%eax + 86: 8b 4d 0c mov 0xc(%ebp),%ecx + 89: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 8a: 89 c2 mov %eax,%edx + 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 90: 83 c1 01 add $0x1,%ecx + 93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 97: 83 c2 01 add $0x1,%edx + 9a: 84 db test %bl,%bl + 9c: 88 5a ff mov %bl,-0x1(%edx) + 9f: 75 ef jne 90 + ; + return os; +} + a1: 5b pop %ebx + a2: 5d pop %ebp + a3: c3 ret + a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000000b0 : + +int +strcmp(const char *p, const char *q) +{ + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 8b 55 08 mov 0x8(%ebp),%edx + b6: 53 push %ebx + b7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + ba: 0f b6 02 movzbl (%edx),%eax + bd: 84 c0 test %al,%al + bf: 74 2d je ee + c1: 0f b6 19 movzbl (%ecx),%ebx + c4: 38 d8 cmp %bl,%al + c6: 74 0e je d6 + c8: eb 2b jmp f5 + ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + d0: 38 c8 cmp %cl,%al + d2: 75 15 jne e9 + p++, q++; + d4: 89 d9 mov %ebx,%ecx + d6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + d9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + dc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + df: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + e3: 84 c0 test %al,%al + e5: 75 e9 jne d0 + e7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + e9: 29 c8 sub %ecx,%eax +} + eb: 5b pop %ebx + ec: 5d pop %ebp + ed: c3 ret + ee: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + f1: 31 c0 xor %eax,%eax + f3: eb f4 jmp e9 + f5: 0f b6 cb movzbl %bl,%ecx + f8: eb ef jmp e9 + fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000100 : + +uint +strlen(const char *s) +{ + 100: 55 push %ebp + 101: 89 e5 mov %esp,%ebp + 103: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 106: 80 39 00 cmpb $0x0,(%ecx) + 109: 74 12 je 11d + 10b: 31 d2 xor %edx,%edx + 10d: 8d 76 00 lea 0x0(%esi),%esi + 110: 83 c2 01 add $0x1,%edx + 113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 117: 89 d0 mov %edx,%eax + 119: 75 f5 jne 110 + ; + return n; +} + 11b: 5d pop %ebp + 11c: c3 ret + for(n = 0; s[n]; n++) + 11d: 31 c0 xor %eax,%eax +} + 11f: 5d pop %ebp + 120: c3 ret + 121: eb 0d jmp 130 + 123: 90 nop + 124: 90 nop + 125: 90 nop + 126: 90 nop + 127: 90 nop + 128: 90 nop + 129: 90 nop + 12a: 90 nop + 12b: 90 nop + 12c: 90 nop + 12d: 90 nop + 12e: 90 nop + 12f: 90 nop + +00000130 : + +void* +memset(void *dst, int c, uint n) +{ + 130: 55 push %ebp + 131: 89 e5 mov %esp,%ebp + 133: 8b 55 08 mov 0x8(%ebp),%edx + 136: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 137: 8b 4d 10 mov 0x10(%ebp),%ecx + 13a: 8b 45 0c mov 0xc(%ebp),%eax + 13d: 89 d7 mov %edx,%edi + 13f: fc cld + 140: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 142: 89 d0 mov %edx,%eax + 144: 5f pop %edi + 145: 5d pop %ebp + 146: c3 ret + 147: 89 f6 mov %esi,%esi + 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000150 : + +char* +strchr(const char *s, char c) +{ + 150: 55 push %ebp + 151: 89 e5 mov %esp,%ebp + 153: 8b 45 08 mov 0x8(%ebp),%eax + 156: 53 push %ebx + 157: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 15a: 0f b6 18 movzbl (%eax),%ebx + 15d: 84 db test %bl,%bl + 15f: 74 1d je 17e + if(*s == c) + 161: 38 d3 cmp %dl,%bl + 163: 89 d1 mov %edx,%ecx + 165: 75 0d jne 174 + 167: eb 17 jmp 180 + 169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 170: 38 ca cmp %cl,%dl + 172: 74 0c je 180 + for(; *s; s++) + 174: 83 c0 01 add $0x1,%eax + 177: 0f b6 10 movzbl (%eax),%edx + 17a: 84 d2 test %dl,%dl + 17c: 75 f2 jne 170 + return (char*)s; + return 0; + 17e: 31 c0 xor %eax,%eax +} + 180: 5b pop %ebx + 181: 5d pop %ebp + 182: c3 ret + 183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000190 : + +char* +gets(char *buf, int max) +{ + 190: 55 push %ebp + 191: 89 e5 mov %esp,%ebp + 193: 57 push %edi + 194: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 195: 31 f6 xor %esi,%esi +{ + 197: 53 push %ebx + 198: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 19b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 19e: eb 31 jmp 1d1 + cc = read(0, &c, 1); + 1a0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 1a7: 00 + 1a8: 89 7c 24 04 mov %edi,0x4(%esp) + 1ac: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1b3: e8 02 01 00 00 call 2ba + if(cc < 1) + 1b8: 85 c0 test %eax,%eax + 1ba: 7e 1d jle 1d9 + break; + buf[i++] = c; + 1bc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 1c0: 89 de mov %ebx,%esi + buf[i++] = c; + 1c2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 1c5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 1c7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 1cb: 74 0c je 1d9 + 1cd: 3c 0a cmp $0xa,%al + 1cf: 74 08 je 1d9 + for(i=0; i+1 < max; ){ + 1d1: 8d 5e 01 lea 0x1(%esi),%ebx + 1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1d7: 7c c7 jl 1a0 + break; + } + buf[i] = '\0'; + 1d9: 8b 45 08 mov 0x8(%ebp),%eax + 1dc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 1e0: 83 c4 2c add $0x2c,%esp + 1e3: 5b pop %ebx + 1e4: 5e pop %esi + 1e5: 5f pop %edi + 1e6: 5d pop %ebp + 1e7: c3 ret + 1e8: 90 nop + 1e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001f0 : + +int +stat(const char *n, struct stat *st) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 56 push %esi + 1f4: 53 push %ebx + 1f5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1f8: 8b 45 08 mov 0x8(%ebp),%eax + 1fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 202: 00 + 203: 89 04 24 mov %eax,(%esp) + 206: e8 d7 00 00 00 call 2e2 + if(fd < 0) + 20b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 20d: 89 c3 mov %eax,%ebx + if(fd < 0) + 20f: 78 27 js 238 + return -1; + r = fstat(fd, st); + 211: 8b 45 0c mov 0xc(%ebp),%eax + 214: 89 1c 24 mov %ebx,(%esp) + 217: 89 44 24 04 mov %eax,0x4(%esp) + 21b: e8 da 00 00 00 call 2fa + close(fd); + 220: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 223: 89 c6 mov %eax,%esi + close(fd); + 225: e8 a0 00 00 00 call 2ca + return r; + 22a: 89 f0 mov %esi,%eax +} + 22c: 83 c4 10 add $0x10,%esp + 22f: 5b pop %ebx + 230: 5e pop %esi + 231: 5d pop %ebp + 232: c3 ret + 233: 90 nop + 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 238: b8 ff ff ff ff mov $0xffffffff,%eax + 23d: eb ed jmp 22c + 23f: 90 nop + +00000240 : + +int +atoi(const char *s) +{ + 240: 55 push %ebp + 241: 89 e5 mov %esp,%ebp + 243: 8b 4d 08 mov 0x8(%ebp),%ecx + 246: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 247: 0f be 11 movsbl (%ecx),%edx + 24a: 8d 42 d0 lea -0x30(%edx),%eax + 24d: 3c 09 cmp $0x9,%al + n = 0; + 24f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 254: 77 17 ja 26d + 256: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 258: 83 c1 01 add $0x1,%ecx + 25b: 8d 04 80 lea (%eax,%eax,4),%eax + 25e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 262: 0f be 11 movsbl (%ecx),%edx + 265: 8d 5a d0 lea -0x30(%edx),%ebx + 268: 80 fb 09 cmp $0x9,%bl + 26b: 76 eb jbe 258 + return n; +} + 26d: 5b pop %ebx + 26e: 5d pop %ebp + 26f: c3 ret + +00000270 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 270: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 271: 31 d2 xor %edx,%edx +{ + 273: 89 e5 mov %esp,%ebp + 275: 56 push %esi + 276: 8b 45 08 mov 0x8(%ebp),%eax + 279: 53 push %ebx + 27a: 8b 5d 10 mov 0x10(%ebp),%ebx + 27d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 280: 85 db test %ebx,%ebx + 282: 7e 12 jle 296 + 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 28c: 88 0c 10 mov %cl,(%eax,%edx,1) + 28f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 292: 39 da cmp %ebx,%edx + 294: 75 f2 jne 288 + return vdst; +} + 296: 5b pop %ebx + 297: 5e pop %esi + 298: 5d pop %ebp + 299: c3 ret + +0000029a : + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + +000002f2 : + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + +000002fa : + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + +00000302 : + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + +0000030a : + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + +00000312 : + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + +0000031a : + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + +00000322 : + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + +0000032a : + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + +00000332 : + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + +0000033a : + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret + 342: 66 90 xchg %ax,%ax + 344: 66 90 xchg %ax,%ax + 346: 66 90 xchg %ax,%ax + 348: 66 90 xchg %ax,%ax + 34a: 66 90 xchg %ax,%ax + 34c: 66 90 xchg %ax,%ax + 34e: 66 90 xchg %ax,%ax + +00000350 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 350: 55 push %ebp + 351: 89 e5 mov %esp,%ebp + 353: 57 push %edi + 354: 56 push %esi + 355: 89 c6 mov %eax,%esi + 357: 53 push %ebx + 358: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 35b: 8b 5d 08 mov 0x8(%ebp),%ebx + 35e: 85 db test %ebx,%ebx + 360: 74 09 je 36b + 362: 89 d0 mov %edx,%eax + 364: c1 e8 1f shr $0x1f,%eax + 367: 84 c0 test %al,%al + 369: 75 75 jne 3e0 + neg = 1; + x = -xx; + } else { + x = xx; + 36b: 89 d0 mov %edx,%eax + neg = 0; + 36d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 374: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 377: 31 ff xor %edi,%edi + 379: 89 ce mov %ecx,%esi + 37b: 8d 5d d7 lea -0x29(%ebp),%ebx + 37e: eb 02 jmp 382 + do{ + buf[i++] = digits[x % base]; + 380: 89 cf mov %ecx,%edi + 382: 31 d2 xor %edx,%edx + 384: f7 f6 div %esi + 386: 8d 4f 01 lea 0x1(%edi),%ecx + 389: 0f b6 92 90 07 00 00 movzbl 0x790(%edx),%edx + }while((x /= base) != 0); + 390: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 392: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 395: 75 e9 jne 380 + if(neg) + 397: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 39a: 89 c8 mov %ecx,%eax + 39c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 39f: 85 d2 test %edx,%edx + 3a1: 74 08 je 3ab + buf[i++] = '-'; + 3a3: 8d 4f 02 lea 0x2(%edi),%ecx + 3a6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 3ab: 8d 79 ff lea -0x1(%ecx),%edi + 3ae: 66 90 xchg %ax,%ax + 3b0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 3b5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 3b8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3bf: 00 + 3c0: 89 5c 24 04 mov %ebx,0x4(%esp) + 3c4: 89 34 24 mov %esi,(%esp) + 3c7: 88 45 d7 mov %al,-0x29(%ebp) + 3ca: e8 f3 fe ff ff call 2c2 + while(--i >= 0) + 3cf: 83 ff ff cmp $0xffffffff,%edi + 3d2: 75 dc jne 3b0 + putc(fd, buf[i]); +} + 3d4: 83 c4 4c add $0x4c,%esp + 3d7: 5b pop %ebx + 3d8: 5e pop %esi + 3d9: 5f pop %edi + 3da: 5d pop %ebp + 3db: c3 ret + 3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 3e0: 89 d0 mov %edx,%eax + 3e2: f7 d8 neg %eax + neg = 1; + 3e4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 3eb: eb 87 jmp 374 + 3ed: 8d 76 00 lea 0x0(%esi),%esi + +000003f0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3f0: 55 push %ebp + 3f1: 89 e5 mov %esp,%ebp + 3f3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3f4: 31 ff xor %edi,%edi +{ + 3f6: 56 push %esi + 3f7: 53 push %ebx + 3f8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3fb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3fe: 8d 45 10 lea 0x10(%ebp),%eax +{ + 401: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 404: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 407: 0f b6 13 movzbl (%ebx),%edx + 40a: 83 c3 01 add $0x1,%ebx + 40d: 84 d2 test %dl,%dl + 40f: 75 39 jne 44a + 411: e9 c2 00 00 00 jmp 4d8 + 416: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 418: 83 fa 25 cmp $0x25,%edx + 41b: 0f 84 bf 00 00 00 je 4e0 + write(fd, &c, 1); + 421: 8d 45 e2 lea -0x1e(%ebp),%eax + 424: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 42b: 00 + 42c: 89 44 24 04 mov %eax,0x4(%esp) + 430: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 433: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 436: e8 87 fe ff ff call 2c2 + 43b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 43e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 442: 84 d2 test %dl,%dl + 444: 0f 84 8e 00 00 00 je 4d8 + if(state == 0){ + 44a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 44c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 44f: 74 c7 je 418 + } + } else if(state == '%'){ + 451: 83 ff 25 cmp $0x25,%edi + 454: 75 e5 jne 43b + if(c == 'd'){ + 456: 83 fa 64 cmp $0x64,%edx + 459: 0f 84 31 01 00 00 je 590 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 45f: 25 f7 00 00 00 and $0xf7,%eax + 464: 83 f8 70 cmp $0x70,%eax + 467: 0f 84 83 00 00 00 je 4f0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 46d: 83 fa 73 cmp $0x73,%edx + 470: 0f 84 a2 00 00 00 je 518 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 476: 83 fa 63 cmp $0x63,%edx + 479: 0f 84 35 01 00 00 je 5b4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 47f: 83 fa 25 cmp $0x25,%edx + 482: 0f 84 e0 00 00 00 je 568 + write(fd, &c, 1); + 488: 8d 45 e6 lea -0x1a(%ebp),%eax + 48b: 83 c3 01 add $0x1,%ebx + 48e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 495: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 496: 31 ff xor %edi,%edi + write(fd, &c, 1); + 498: 89 44 24 04 mov %eax,0x4(%esp) + 49c: 89 34 24 mov %esi,(%esp) + 49f: 89 55 d0 mov %edx,-0x30(%ebp) + 4a2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 4a6: e8 17 fe ff ff call 2c2 + putc(fd, c); + 4ab: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 4ae: 8d 45 e7 lea -0x19(%ebp),%eax + 4b1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4b8: 00 + 4b9: 89 44 24 04 mov %eax,0x4(%esp) + 4bd: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4c0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4c3: e8 fa fd ff ff call 2c2 + for(i = 0; fmt[i]; i++){ + 4c8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4cc: 84 d2 test %dl,%dl + 4ce: 0f 85 76 ff ff ff jne 44a + 4d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4d8: 83 c4 3c add $0x3c,%esp + 4db: 5b pop %ebx + 4dc: 5e pop %esi + 4dd: 5f pop %edi + 4de: 5d pop %ebp + 4df: c3 ret + state = '%'; + 4e0: bf 25 00 00 00 mov $0x25,%edi + 4e5: e9 51 ff ff ff jmp 43b + 4ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4f0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4f3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4f8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4fa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 501: 8b 10 mov (%eax),%edx + 503: 89 f0 mov %esi,%eax + 505: e8 46 fe ff ff call 350 + ap++; + 50a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 50e: e9 28 ff ff ff jmp 43b + 513: 90 nop + 514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 518: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 51b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 51f: 8b 38 mov (%eax),%edi + s = "(null)"; + 521: b8 89 07 00 00 mov $0x789,%eax + 526: 85 ff test %edi,%edi + 528: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 52b: 0f b6 07 movzbl (%edi),%eax + 52e: 84 c0 test %al,%al + 530: 74 2a je 55c + 532: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 538: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 53b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 53e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 541: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 548: 00 + 549: 89 44 24 04 mov %eax,0x4(%esp) + 54d: 89 34 24 mov %esi,(%esp) + 550: e8 6d fd ff ff call 2c2 + while(*s != 0){ + 555: 0f b6 07 movzbl (%edi),%eax + 558: 84 c0 test %al,%al + 55a: 75 dc jne 538 + state = 0; + 55c: 31 ff xor %edi,%edi + 55e: e9 d8 fe ff ff jmp 43b + 563: 90 nop + 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 568: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 56b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 56d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 574: 00 + 575: 89 44 24 04 mov %eax,0x4(%esp) + 579: 89 34 24 mov %esi,(%esp) + 57c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 580: e8 3d fd ff ff call 2c2 + 585: e9 b1 fe ff ff jmp 43b + 58a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 590: 8b 45 d4 mov -0x2c(%ebp),%eax + 593: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 598: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 59b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 5a2: 8b 10 mov (%eax),%edx + 5a4: 89 f0 mov %esi,%eax + 5a6: e8 a5 fd ff ff call 350 + ap++; + 5ab: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5af: e9 87 fe ff ff jmp 43b + putc(fd, *ap); + 5b4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 5b7: 31 ff xor %edi,%edi + putc(fd, *ap); + 5b9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 5bb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5c2: 00 + 5c3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 5c6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 5c9: 8d 45 e4 lea -0x1c(%ebp),%eax + 5cc: 89 44 24 04 mov %eax,0x4(%esp) + 5d0: e8 ed fc ff ff call 2c2 + ap++; + 5d5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5d9: e9 5d fe ff ff jmp 43b + 5de: 66 90 xchg %ax,%ax + +000005e0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 5e0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e1: a1 10 0a 00 00 mov 0xa10,%eax +{ + 5e6: 89 e5 mov %esp,%ebp + 5e8: 57 push %edi + 5e9: 56 push %esi + 5ea: 53 push %ebx + 5eb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5ee: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5f0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5f3: 39 d0 cmp %edx,%eax + 5f5: 72 11 jb 608 + 5f7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5f8: 39 c8 cmp %ecx,%eax + 5fa: 72 04 jb 600 + 5fc: 39 ca cmp %ecx,%edx + 5fe: 72 10 jb 610 + 600: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 602: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 604: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 606: 73 f0 jae 5f8 + 608: 39 ca cmp %ecx,%edx + 60a: 72 04 jb 610 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 60c: 39 c8 cmp %ecx,%eax + 60e: 72 f0 jb 600 + break; + if(bp + bp->s.size == p->s.ptr){ + 610: 8b 73 fc mov -0x4(%ebx),%esi + 613: 8d 3c f2 lea (%edx,%esi,8),%edi + 616: 39 cf cmp %ecx,%edi + 618: 74 1e je 638 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 61a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 61d: 8b 48 04 mov 0x4(%eax),%ecx + 620: 8d 34 c8 lea (%eax,%ecx,8),%esi + 623: 39 f2 cmp %esi,%edx + 625: 74 28 je 64f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 627: 89 10 mov %edx,(%eax) + freep = p; + 629: a3 10 0a 00 00 mov %eax,0xa10 +} + 62e: 5b pop %ebx + 62f: 5e pop %esi + 630: 5f pop %edi + 631: 5d pop %ebp + 632: c3 ret + 633: 90 nop + 634: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 638: 03 71 04 add 0x4(%ecx),%esi + 63b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 63e: 8b 08 mov (%eax),%ecx + 640: 8b 09 mov (%ecx),%ecx + 642: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 645: 8b 48 04 mov 0x4(%eax),%ecx + 648: 8d 34 c8 lea (%eax,%ecx,8),%esi + 64b: 39 f2 cmp %esi,%edx + 64d: 75 d8 jne 627 + p->s.size += bp->s.size; + 64f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 652: a3 10 0a 00 00 mov %eax,0xa10 + p->s.size += bp->s.size; + 657: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 65a: 8b 53 f8 mov -0x8(%ebx),%edx + 65d: 89 10 mov %edx,(%eax) +} + 65f: 5b pop %ebx + 660: 5e pop %esi + 661: 5f pop %edi + 662: 5d pop %ebp + 663: c3 ret + 664: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 66a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000670 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 670: 55 push %ebp + 671: 89 e5 mov %esp,%ebp + 673: 57 push %edi + 674: 56 push %esi + 675: 53 push %ebx + 676: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 679: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 67c: 8b 1d 10 0a 00 00 mov 0xa10,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 682: 8d 48 07 lea 0x7(%eax),%ecx + 685: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 688: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 68a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 68d: 0f 84 9b 00 00 00 je 72e + 693: 8b 13 mov (%ebx),%edx + 695: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 698: 39 fe cmp %edi,%esi + 69a: 76 64 jbe 700 + 69c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 6a3: bb 00 80 00 00 mov $0x8000,%ebx + 6a8: 89 45 e4 mov %eax,-0x1c(%ebp) + 6ab: eb 0e jmp 6bb + 6ad: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 6b0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 6b2: 8b 78 04 mov 0x4(%eax),%edi + 6b5: 39 fe cmp %edi,%esi + 6b7: 76 4f jbe 708 + 6b9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 6bb: 3b 15 10 0a 00 00 cmp 0xa10,%edx + 6c1: 75 ed jne 6b0 + if(nu < 4096) + 6c3: 8b 45 e4 mov -0x1c(%ebp),%eax + 6c6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 6cc: bf 00 10 00 00 mov $0x1000,%edi + 6d1: 0f 43 fe cmovae %esi,%edi + 6d4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 6d7: 89 04 24 mov %eax,(%esp) + 6da: e8 4b fc ff ff call 32a + if(p == (char*)-1) + 6df: 83 f8 ff cmp $0xffffffff,%eax + 6e2: 74 18 je 6fc + hp->s.size = nu; + 6e4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 6e7: 83 c0 08 add $0x8,%eax + 6ea: 89 04 24 mov %eax,(%esp) + 6ed: e8 ee fe ff ff call 5e0 + return freep; + 6f2: 8b 15 10 0a 00 00 mov 0xa10,%edx + if((p = morecore(nunits)) == 0) + 6f8: 85 d2 test %edx,%edx + 6fa: 75 b4 jne 6b0 + return 0; + 6fc: 31 c0 xor %eax,%eax + 6fe: eb 20 jmp 720 + if(p->s.size >= nunits){ + 700: 89 d0 mov %edx,%eax + 702: 89 da mov %ebx,%edx + 704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 708: 39 fe cmp %edi,%esi + 70a: 74 1c je 728 + p->s.size -= nunits; + 70c: 29 f7 sub %esi,%edi + 70e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 711: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 714: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 717: 89 15 10 0a 00 00 mov %edx,0xa10 + return (void*)(p + 1); + 71d: 83 c0 08 add $0x8,%eax + } +} + 720: 83 c4 1c add $0x1c,%esp + 723: 5b pop %ebx + 724: 5e pop %esi + 725: 5f pop %edi + 726: 5d pop %ebp + 727: c3 ret + prevp->s.ptr = p->s.ptr; + 728: 8b 08 mov (%eax),%ecx + 72a: 89 0a mov %ecx,(%edx) + 72c: eb e9 jmp 717 + base.s.ptr = freep = prevp = &base; + 72e: c7 05 10 0a 00 00 14 movl $0xa14,0xa10 + 735: 0a 00 00 + base.s.size = 0; + 738: ba 14 0a 00 00 mov $0xa14,%edx + base.s.ptr = freep = prevp = &base; + 73d: c7 05 14 0a 00 00 14 movl $0xa14,0xa14 + 744: 0a 00 00 + base.s.size = 0; + 747: c7 05 18 0a 00 00 00 movl $0x0,0xa18 + 74e: 00 00 00 + 751: e9 46 ff ff ff jmp 69c diff --git a/mkdir.c b/mkdir.c index 6e4c9541ed..d10183882f 100644 --- a/mkdir.c +++ b/mkdir.c @@ -9,7 +9,7 @@ main(int argc, char *argv[]) if(argc < 2){ printf(2, "Usage: mkdir files...\n"); - exit(); + exit(0); } for(i = 1; i < argc; i++){ @@ -19,5 +19,5 @@ main(int argc, char *argv[]) } } - exit(); + exit(0); } diff --git a/mkdir.d b/mkdir.d new file mode 100644 index 0000000000..0c77808be9 --- /dev/null +++ b/mkdir.d @@ -0,0 +1 @@ +mkdir.o: mkdir.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/mkdir.o b/mkdir.o new file mode 100644 index 0000000000..d3eeecac7b Binary files /dev/null and b/mkdir.o differ diff --git a/mkdir.sym b/mkdir.sym new file mode 100644 index 0000000000..f440cf0059 --- /dev/null +++ b/mkdir.sym @@ -0,0 +1,57 @@ +00000000 .text +00000756 .rodata +000007a4 .eh_frame +00000a10 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 mkdir.c +00000000 ulib.c +00000000 printf.c +00000350 printint +00000790 digits.1354 +00000000 umalloc.c +00000a10 freep +00000a14 base +00000080 strcpy +000003f0 printf +00000270 memmove +000002ea mknod +00000190 gets +00000322 getpid +00000670 malloc +00000332 sleep +000002b2 pipe +000002c2 write +000002fa fstat +000002d2 kill +00000312 chdir +000002da exec +000002aa wait +000002ba read +000002f2 unlink +0000029a fork +0000032a sbrk +0000033a uptime +00000a10 __bss_start +00000130 memset +00000000 main +000000b0 strcmp +0000031a dup +000001f0 stat +00000a10 _edata +00000a1c _end +00000302 link +000002a2 exit +00000240 atoi +00000100 strlen +000002e2 open +00000150 strchr +0000030a mkdir +000002ca close +000005e0 free diff --git a/mkfs b/mkfs new file mode 100755 index 0000000000..d5343935b6 Binary files /dev/null and b/mkfs differ diff --git a/mp.d b/mp.d new file mode 100644 index 0000000000..0714441d1c --- /dev/null +++ b/mp.d @@ -0,0 +1,2 @@ +mp.o: mp.c /usr/include/stdc-predef.h types.h defs.h param.h memlayout.h \ + mp.h x86.h mmu.h proc.h diff --git a/mp.o b/mp.o new file mode 100644 index 0000000000..c3c74d51cc Binary files /dev/null and b/mp.o differ diff --git a/mycode.diff b/mycode.diff new file mode 100644 index 0000000000..86921ee1d3 --- /dev/null +++ b/mycode.diff @@ -0,0 +1,36562 @@ +diff --git a/_cat b/_cat +index 32aa545..7872ec4 100755 +Binary files a/_cat and b/_cat differ +diff --git a/_echo b/_echo +index f460f09..1a2ccf9 100755 +Binary files a/_echo and b/_echo differ +diff --git a/_forktest b/_forktest +index 8410a51..9aa28ca 100755 +Binary files a/_forktest and b/_forktest differ +diff --git a/_grep b/_grep +index 6e188d8..a2f04d3 100755 +Binary files a/_grep and b/_grep differ +diff --git a/_hello b/_hello +index 3320189..d47354b 100755 +Binary files a/_hello and b/_hello differ +diff --git a/_init b/_init +index 8f5a2b2..132022a 100755 +Binary files a/_init and b/_init differ +diff --git a/_kill b/_kill +index 85d6836..03a9c80 100755 +Binary files a/_kill and b/_kill differ +diff --git a/_ln b/_ln +index 9e2214b..b7a1501 100755 +Binary files a/_ln and b/_ln differ +diff --git a/_ls b/_ls +index 821e5e0..9effa31 100755 +Binary files a/_ls and b/_ls differ +diff --git a/_mkdir b/_mkdir +index 4c18164..9231b10 100755 +Binary files a/_mkdir and b/_mkdir differ +diff --git a/_rm b/_rm +index 95a9b00..6aae6f3 100755 +Binary files a/_rm and b/_rm differ +diff --git a/_sh b/_sh +index 932b63a..66b7fc6 100755 +Binary files a/_sh and b/_sh differ +diff --git a/_stressfs b/_stressfs +index 0badf81..5b1fde4 100755 +Binary files a/_stressfs and b/_stressfs differ +diff --git a/_usertests b/_usertests +index 0313e2b..2b9dd12 100755 +Binary files a/_usertests and b/_usertests differ +diff --git a/_wc b/_wc +index e7578be..6a5a851 100755 +Binary files a/_wc and b/_wc differ +diff --git a/_zombie b/_zombie +index 0e12d23..27b905a 100755 +Binary files a/_zombie and b/_zombie differ +diff --git a/bio.o b/bio.o +index e6fdfba..a90f710 100644 +Binary files a/bio.o and b/bio.o differ +diff --git a/cat.asm b/cat.asm +index cc9e0c2..f8e847a 100644 +--- a/cat.asm ++++ b/cat.asm +@@ -525,132 +525,106 @@ memmove(void *vdst, const void *vsrc, int n) + 359: c3 ret + + 0000035a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 35a: b8 01 00 00 00 mov $0x1,%eax + 35f: cd 40 int $0x40 + 361: c3 ret + + 00000362 : +-SYSCALL(exit) + 362: b8 02 00 00 00 mov $0x2,%eax + 367: cd 40 int $0x40 + 369: c3 ret + + 0000036a : +-SYSCALL(wait) + 36a: b8 03 00 00 00 mov $0x3,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + + 00000372 : +-SYSCALL(pipe) + 372: b8 04 00 00 00 mov $0x4,%eax + 377: cd 40 int $0x40 + 379: c3 ret + + 0000037a : +-SYSCALL(read) + 37a: b8 05 00 00 00 mov $0x5,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + + 00000382 : +-SYSCALL(write) + 382: b8 10 00 00 00 mov $0x10,%eax + 387: cd 40 int $0x40 + 389: c3 ret + + 0000038a : +-SYSCALL(close) + 38a: b8 15 00 00 00 mov $0x15,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + + 00000392 : +-SYSCALL(kill) + 392: b8 06 00 00 00 mov $0x6,%eax + 397: cd 40 int $0x40 + 399: c3 ret + + 0000039a : +-SYSCALL(exec) + 39a: b8 07 00 00 00 mov $0x7,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + + 000003a2 : +-SYSCALL(open) + 3a2: b8 0f 00 00 00 mov $0xf,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + + 000003aa : +-SYSCALL(mknod) + 3aa: b8 11 00 00 00 mov $0x11,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + + 000003b2 : +-SYSCALL(unlink) + 3b2: b8 12 00 00 00 mov $0x12,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + + 000003ba : +-SYSCALL(fstat) + 3ba: b8 08 00 00 00 mov $0x8,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + + 000003c2 : +-SYSCALL(link) + 3c2: b8 13 00 00 00 mov $0x13,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + + 000003ca : +-SYSCALL(mkdir) + 3ca: b8 14 00 00 00 mov $0x14,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + + 000003d2 : +-SYSCALL(chdir) + 3d2: b8 09 00 00 00 mov $0x9,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + + 000003da : +-SYSCALL(dup) + 3da: b8 0a 00 00 00 mov $0xa,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + + 000003e2 : +-SYSCALL(getpid) + 3e2: b8 0b 00 00 00 mov $0xb,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + + 000003ea : +-SYSCALL(sbrk) + 3ea: b8 0c 00 00 00 mov $0xc,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + + 000003f2 : +-SYSCALL(sleep) + 3f2: b8 0d 00 00 00 mov $0xd,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + + 000003fa : +-SYSCALL(uptime) + 3fa: b8 0e 00 00 00 mov $0xe,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret +diff --git a/cat.o b/cat.o +index 923cece..725c555 100644 +Binary files a/cat.o and b/cat.o differ +diff --git a/console.o b/console.o +index 96b309b..fd21e3c 100644 +Binary files a/console.o and b/console.o differ +diff --git a/defs.h b/defs.h +index 94cda70..49b824a 100644 +--- a/defs.h ++++ b/defs.h +@@ -11,180 +11,180 @@ struct stat; + struct superblock; + + // bio.c +-void binit(void); +-struct buf* bread(uint, uint); +-void brelse(struct buf*); +-void bwrite(struct buf*); ++void binit(void); ++struct buf *bread(uint, uint); ++void brelse(struct buf *); ++void bwrite(struct buf *); + + // console.c +-void consoleinit(void); +-void cprintf(char*, ...); +-void consoleintr(int(*)(void)); +-void panic(char*) __attribute__((noreturn)); ++void consoleinit(void); ++void cprintf(char *, ...); ++void consoleintr(int (*)(void)); ++void panic(char *) __attribute__((noreturn)); + + // exec.c +-int exec(char*, char**); ++int exec(char *, char **); + + // file.c +-struct file* filealloc(void); +-void fileclose(struct file*); +-struct file* filedup(struct file*); +-void fileinit(void); +-int fileread(struct file*, char*, int n); +-int filestat(struct file*, struct stat*); +-int filewrite(struct file*, char*, int n); ++struct file *filealloc(void); ++void fileclose(struct file *); ++struct file *filedup(struct file *); ++void fileinit(void); ++int fileread(struct file *, char *, int n); ++int filestat(struct file *, struct stat *); ++int filewrite(struct file *, char *, int n); + + // fs.c +-void readsb(int dev, struct superblock *sb); +-int dirlink(struct inode*, char*, uint); +-struct inode* dirlookup(struct inode*, char*, uint*); +-struct inode* ialloc(uint, short); +-struct inode* idup(struct inode*); +-void iinit(int dev); +-void ilock(struct inode*); +-void iput(struct inode*); +-void iunlock(struct inode*); +-void iunlockput(struct inode*); +-void iupdate(struct inode*); +-int namecmp(const char*, const char*); +-struct inode* namei(char*); +-struct inode* nameiparent(char*, char*); +-int readi(struct inode*, char*, uint, uint); +-void stati(struct inode*, struct stat*); +-int writei(struct inode*, char*, uint, uint); ++void readsb(int dev, struct superblock *sb); ++int dirlink(struct inode *, char *, uint); ++struct inode *dirlookup(struct inode *, char *, uint *); ++struct inode *ialloc(uint, short); ++struct inode *idup(struct inode *); ++void iinit(int dev); ++void ilock(struct inode *); ++void iput(struct inode *); ++void iunlock(struct inode *); ++void iunlockput(struct inode *); ++void iupdate(struct inode *); ++int namecmp(const char *, const char *); ++struct inode *namei(char *); ++struct inode *nameiparent(char *, char *); ++int readi(struct inode *, char *, uint, uint); ++void stati(struct inode *, struct stat *); ++int writei(struct inode *, char *, uint, uint); + + // ide.c +-void ideinit(void); +-void ideintr(void); +-void iderw(struct buf*); ++void ideinit(void); ++void ideintr(void); ++void iderw(struct buf *); + + // ioapic.c +-void ioapicenable(int irq, int cpu); +-extern uchar ioapicid; +-void ioapicinit(void); ++void ioapicenable(int irq, int cpu); ++extern uchar ioapicid; ++void ioapicinit(void); + + // kalloc.c +-char* kalloc(void); +-void kfree(char*); +-void kinit1(void*, void*); +-void kinit2(void*, void*); ++char *kalloc(void); ++void kfree(char *); ++void kinit1(void *, void *); ++void kinit2(void *, void *); + + // kbd.c +-void kbdintr(void); ++void kbdintr(void); + + // lapic.c +-void cmostime(struct rtcdate *r); +-int lapicid(void); +-extern volatile uint* lapic; +-void lapiceoi(void); +-void lapicinit(void); +-void lapicstartap(uchar, uint); +-void microdelay(int); ++void cmostime(struct rtcdate *r); ++int lapicid(void); ++extern volatile uint *lapic; ++void lapiceoi(void); ++void lapicinit(void); ++void lapicstartap(uchar, uint); ++void microdelay(int); + + // log.c +-void initlog(int dev); +-void log_write(struct buf*); +-void begin_op(); +-void end_op(); ++void initlog(int dev); ++void log_write(struct buf *); ++void begin_op(); ++void end_op(); + + // mp.c +-extern int ismp; +-void mpinit(void); ++extern int ismp; ++void mpinit(void); + + // picirq.c +-void picenable(int); +-void picinit(void); ++void picenable(int); ++void picinit(void); + + // pipe.c +-int pipealloc(struct file**, struct file**); +-void pipeclose(struct pipe*, int); +-int piperead(struct pipe*, char*, int); +-int pipewrite(struct pipe*, char*, int); +- +-//PAGEBREAK: 16 +-// proc.c +-int cpuid(void); +-void exit(int); //change to have status parameter +-int fork(void); +-int growproc(int); +-int kill(int); +-struct cpu* mycpu(void); +-struct proc* myproc(); +-void pinit(void); +-void procdump(void); +-void scheduler(void) __attribute__((noreturn)); +-void sched(void); +-void setproc(struct proc*); +-void sleep(void*, struct spinlock*); +-void userinit(void); +-int wait(void); +-void wakeup(void*); +-void yield(void); ++int pipealloc(struct file **, struct file **); ++void pipeclose(struct pipe *, int); ++int piperead(struct pipe *, char *, int); ++int pipewrite(struct pipe *, char *, int); ++ ++// PAGEBREAK: 16 ++// proc.c ++int cpuid(void); ++void exit(int); // change to have status parameter ++int fork(void); ++int growproc(int); ++int kill(int); ++struct cpu *mycpu(void); ++struct proc *myproc(); ++void pinit(void); ++void procdump(void); ++void scheduler(void) __attribute__((noreturn)); ++void sched(void); ++void setproc(struct proc *); ++void sleep(void *, struct spinlock *); ++void userinit(void); ++int wait(int *); ++void wakeup(void *); ++void yield(void); + + // swtch.S +-void swtch(struct context**, struct context*); ++void swtch(struct context **, struct context *); + + // spinlock.c +-void acquire(struct spinlock*); +-void getcallerpcs(void*, uint*); +-int holding(struct spinlock*); +-void initlock(struct spinlock*, char*); +-void release(struct spinlock*); +-void pushcli(void); +-void popcli(void); ++void acquire(struct spinlock *); ++void getcallerpcs(void *, uint *); ++int holding(struct spinlock *); ++void initlock(struct spinlock *, char *); ++void release(struct spinlock *); ++void pushcli(void); ++void popcli(void); + + // sleeplock.c +-void acquiresleep(struct sleeplock*); +-void releasesleep(struct sleeplock*); +-int holdingsleep(struct sleeplock*); +-void initsleeplock(struct sleeplock*, char*); ++void acquiresleep(struct sleeplock *); ++void releasesleep(struct sleeplock *); ++int holdingsleep(struct sleeplock *); ++void initsleeplock(struct sleeplock *, char *); + + // string.c +-int memcmp(const void*, const void*, uint); +-void* memmove(void*, const void*, uint); +-void* memset(void*, int, uint); +-char* safestrcpy(char*, const char*, int); +-int strlen(const char*); +-int strncmp(const char*, const char*, uint); +-char* strncpy(char*, const char*, int); ++int memcmp(const void *, const void *, uint); ++void *memmove(void *, const void *, uint); ++void *memset(void *, int, uint); ++char *safestrcpy(char *, const char *, int); ++int strlen(const char *); ++int strncmp(const char *, const char *, uint); ++char *strncpy(char *, const char *, int); + + // syscall.c +-int argint(int, int*); +-int argptr(int, char**, int); +-int argstr(int, char**); +-int fetchint(uint, int*); +-int fetchstr(uint, char**); +-void syscall(void); ++int argint(int, int *); ++int argptr(int, char **, int); ++int argstr(int, char **); ++int fetchint(uint, int *); ++int fetchstr(uint, char **); ++void syscall(void); + + // timer.c +-void timerinit(void); ++void timerinit(void); + + // trap.c +-void idtinit(void); +-extern uint ticks; +-void tvinit(void); ++void idtinit(void); ++extern uint ticks; ++void tvinit(void); + extern struct spinlock tickslock; + + // uart.c +-void uartinit(void); +-void uartintr(void); +-void uartputc(int); ++void uartinit(void); ++void uartintr(void); ++void uartputc(int); + + // vm.c +-void seginit(void); +-void kvmalloc(void); +-pde_t* setupkvm(void); +-char* uva2ka(pde_t*, char*); +-int allocuvm(pde_t*, uint, uint); +-int deallocuvm(pde_t*, uint, uint); +-void freevm(pde_t*); +-void inituvm(pde_t*, char*, uint); +-int loaduvm(pde_t*, char*, struct inode*, uint, uint); +-pde_t* copyuvm(pde_t*, uint); +-void switchuvm(struct proc*); +-void switchkvm(void); +-int copyout(pde_t*, uint, void*, uint); +-void clearpteu(pde_t *pgdir, char *uva); ++void seginit(void); ++void kvmalloc(void); ++pde_t *setupkvm(void); ++char *uva2ka(pde_t *, char *); ++int allocuvm(pde_t *, uint, uint); ++int deallocuvm(pde_t *, uint, uint); ++void freevm(pde_t *); ++void inituvm(pde_t *, char *, uint); ++int loaduvm(pde_t *, char *, struct inode *, uint, uint); ++pde_t *copyuvm(pde_t *, uint); ++void switchuvm(struct proc *); ++void switchkvm(void); ++int copyout(pde_t *, uint, void *, uint); ++void clearpteu(pde_t *pgdir, char *uva); + + // number of elements in fixed-size array +-#define NELEM(x) (sizeof(x)/sizeof((x)[0])) ++#define NELEM(x) (sizeof(x) / sizeof((x)[0])) +diff --git a/echo.asm b/echo.asm +index 8910671..df9a659 100644 +--- a/echo.asm ++++ b/echo.asm +@@ -438,132 +438,106 @@ memmove(void *vdst, const void *vsrc, int n) + 299: c3 ret + + 0000029a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + + 000002a2 : +-SYSCALL(exit) + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + + 000002aa : +-SYSCALL(wait) + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + + 000002b2 : +-SYSCALL(pipe) + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + + 000002ba : +-SYSCALL(read) + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + + 000002c2 : +-SYSCALL(write) + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + + 000002ca : +-SYSCALL(close) + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + + 000002d2 : +-SYSCALL(kill) + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + + 000002da : +-SYSCALL(exec) + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + + 000002e2 : +-SYSCALL(open) + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + + 000002ea : +-SYSCALL(mknod) + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + + 000002f2 : +-SYSCALL(unlink) + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + + 000002fa : +-SYSCALL(fstat) + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + + 00000302 : +-SYSCALL(link) + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + + 0000030a : +-SYSCALL(mkdir) + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + + 00000312 : +-SYSCALL(chdir) + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + + 0000031a : +-SYSCALL(dup) + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + + 00000322 : +-SYSCALL(getpid) + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + + 0000032a : +-SYSCALL(sbrk) + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + + 00000332 : +-SYSCALL(sleep) + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + + 0000033a : +-SYSCALL(uptime) + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret +diff --git a/echo.o b/echo.o +index b4511d0..1b62806 100644 +Binary files a/echo.o and b/echo.o differ +diff --git a/exec.o b/exec.o +index 3d03707..2fad1f3 100644 +Binary files a/exec.o and b/exec.o differ +diff --git a/file.o b/file.o +index cec2a9b..7a7c5e2 100644 +Binary files a/file.o and b/file.o differ +diff --git a/forktest.asm b/forktest.asm +index 86814a0..f5c1257 100644 +--- a/forktest.asm ++++ b/forktest.asm +@@ -5,11 +5,11 @@ _forktest: file format elf32-i386 + Disassembly of section .text: + + 00000000
: ++ + printf(1, "fork test OK\n"); + } + +-int +-main(void) ++int main(void) + { + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp +@@ -19,7 +19,7 @@ main(void) + 9: e8 42 00 00 00 call 50 + exit(0); + e: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 15: e8 48 03 00 00 call 362 ++ 15: e8 58 03 00 00 call 372 + 1a: 66 90 xchg %ax,%ax + 1c: 66 90 xchg %ax,%ax + 1e: 66 90 xchg %ax,%ax +@@ -33,12 +33,12 @@ main(void) + 27: 8b 5d 0c mov 0xc(%ebp),%ebx + write(fd, s, strlen(s)); + 2a: 89 1c 24 mov %ebx,(%esp) +- 2d: e8 8e 01 00 00 call 1c0 ++ 2d: e8 9e 01 00 00 call 1d0 + 32: 89 5c 24 04 mov %ebx,0x4(%esp) + 36: 89 44 24 08 mov %eax,0x8(%esp) + 3a: 8b 45 08 mov 0x8(%ebp),%eax + 3d: 89 04 24 mov %eax,(%esp) +- 40: e8 3d 03 00 00 call 382 ++ 40: e8 4d 03 00 00 call 392 + } + 45: 83 c4 14 add $0x14,%esp + 48: 5b pop %ebx +@@ -52,595 +52,572 @@ main(void) + 50: 55 push %ebp + 51: 89 e5 mov %esp,%ebp + 53: 53 push %ebx +- for(n=0; n + 6d: eb 13 jmp 82 + 6f: 90 nop +- if(pid == 0) +- 70: 0f 84 9e 00 00 00 je 114 +- for(n=0; n ++ for (n = 0; n < N; n++) + 76: 83 c3 01 add $0x1,%ebx + 79: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 7f: 90 nop +- 80: 74 4e je d0 ++ 80: 74 56 je d8 + pid = fork(); +- 82: e8 d3 02 00 00 call 35a +- if(pid < 0) ++ 82: e8 e3 02 00 00 call 36a ++ if (pid < 0) + 87: 85 c0 test %eax,%eax + 89: 79 e5 jns 70 +- for(; n > 0; n--){ ++ for (; n > 0; n--) + 8b: 85 db test %ebx,%ebx + 8d: 8d 76 00 lea 0x0(%esi),%esi +- 90: 74 15 je a7 ++ 90: 74 1b je ad + 92: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- if(wait() < 0){ +- 98: e8 cd 02 00 00 call 36a +- 9d: 85 c0 test %eax,%eax +- 9f: 90 nop +- a0: 78 5e js 100 +- for(; n > 0; n--){ +- a2: 83 eb 01 sub $0x1,%ebx +- a5: 75 f1 jne 98 +- if(wait() != -1){ +- a7: e8 be 02 00 00 call 36a +- ac: 83 f8 ff cmp $0xffffffff,%eax +- af: 90 nop +- b0: 75 6e jne 120 ++ if (wait(0) < 0) ++ 98: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 9f: e8 d6 02 00 00 call 37a ++ a4: 85 c0 test %eax,%eax ++ a6: 78 60 js 108 ++ for (; n > 0; n--) ++ a8: 83 eb 01 sub $0x1,%ebx ++ ab: 75 eb jne 98 ++ if (wait(0) != -1) ++ ad: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ b4: e8 c1 02 00 00 call 37a ++ b9: 83 f8 ff cmp $0xffffffff,%eax ++ bc: 75 6a jne 128 + printf(1, "fork test OK\n"); +- b2: c7 44 24 04 36 04 00 movl $0x436,0x4(%esp) +- b9: 00 +- ba: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- c1: e8 5a ff ff ff call 20 ++ be: c7 44 24 04 46 04 00 movl $0x446,0x4(%esp) ++ c5: 00 ++ c6: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ cd: e8 4e ff ff ff call 20 + } +- c6: 83 c4 14 add $0x14,%esp +- c9: 5b pop %ebx +- ca: 5d pop %ebp +- cb: c3 ret +- cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ d2: 83 c4 14 add $0x14,%esp ++ d5: 5b pop %ebx ++ d6: 5d pop %ebp ++ d7: c3 ret + write(fd, s, strlen(s)); +- d0: c7 04 24 44 04 00 00 movl $0x444,(%esp) +- d7: e8 e4 00 00 00 call 1c0 +- dc: c7 44 24 04 44 04 00 movl $0x444,0x4(%esp) +- e3: 00 +- e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- eb: 89 44 24 08 mov %eax,0x8(%esp) +- ef: e8 8e 02 00 00 call 382 ++ d8: c7 04 24 54 04 00 00 movl $0x454,(%esp) ++ df: e8 ec 00 00 00 call 1d0 ++ e4: c7 44 24 04 54 04 00 movl $0x454,0x4(%esp) ++ eb: 00 ++ ec: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ f3: 89 44 24 08 mov %eax,0x8(%esp) ++ f7: e8 96 02 00 00 call 392 + exit(0); +- f4: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- fb: e8 62 02 00 00 call 362 ++ fc: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 103: e8 6a 02 00 00 call 372 + printf(1, "wait stopped early\n"); +- 100: c7 44 24 04 0f 04 00 movl $0x40f,0x4(%esp) +- 107: 00 +- 108: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 10f: e8 0c ff ff ff call 20 ++ 108: c7 44 24 04 1f 04 00 movl $0x41f,0x4(%esp) ++ 10f: 00 ++ 110: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 117: e8 04 ff ff ff call 20 + exit(0); +- 114: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 11b: e8 42 02 00 00 call 362 ++ 11c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 123: e8 4a 02 00 00 call 372 + printf(1, "wait got too many\n"); +- 120: c7 44 24 04 23 04 00 movl $0x423,0x4(%esp) +- 127: 00 +- 128: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 12f: e8 ec fe ff ff call 20 ++ 128: c7 44 24 04 33 04 00 movl $0x433,0x4(%esp) ++ 12f: 00 ++ 130: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 137: e8 e4 fe ff ff call 20 + exit(0); +- 134: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 13b: e8 22 02 00 00 call 362 +- +-00000140 : ++ 13c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 143: e8 2a 02 00 00 call 372 ++ 148: 66 90 xchg %ax,%ax ++ 14a: 66 90 xchg %ax,%ax ++ 14c: 66 90 xchg %ax,%ax ++ 14e: 66 90 xchg %ax,%ax ++ ++00000150 : + #include "user.h" + #include "x86.h" + + char* + strcpy(char *s, const char *t) + { +- 140: 55 push %ebp +- 141: 89 e5 mov %esp,%ebp +- 143: 8b 45 08 mov 0x8(%ebp),%eax +- 146: 8b 4d 0c mov 0xc(%ebp),%ecx +- 149: 53 push %ebx ++ 150: 55 push %ebp ++ 151: 89 e5 mov %esp,%ebp ++ 153: 8b 45 08 mov 0x8(%ebp),%eax ++ 156: 8b 4d 0c mov 0xc(%ebp),%ecx ++ 159: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) +- 14a: 89 c2 mov %eax,%edx +- 14c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 150: 83 c1 01 add $0x1,%ecx +- 153: 0f b6 59 ff movzbl -0x1(%ecx),%ebx +- 157: 83 c2 01 add $0x1,%edx +- 15a: 84 db test %bl,%bl +- 15c: 88 5a ff mov %bl,-0x1(%edx) +- 15f: 75 ef jne 150 ++ 15a: 89 c2 mov %eax,%edx ++ 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 160: 83 c1 01 add $0x1,%ecx ++ 163: 0f b6 59 ff movzbl -0x1(%ecx),%ebx ++ 167: 83 c2 01 add $0x1,%edx ++ 16a: 84 db test %bl,%bl ++ 16c: 88 5a ff mov %bl,-0x1(%edx) ++ 16f: 75 ef jne 160 + ; + return os; + } +- 161: 5b pop %ebx +- 162: 5d pop %ebp +- 163: c3 ret +- 164: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 16a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ 171: 5b pop %ebx ++ 172: 5d pop %ebp ++ 173: c3 ret ++ 174: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 17a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00000170 : ++00000180 : + + int + strcmp(const char *p, const char *q) + { +- 170: 55 push %ebp +- 171: 89 e5 mov %esp,%ebp +- 173: 8b 55 08 mov 0x8(%ebp),%edx +- 176: 53 push %ebx +- 177: 8b 4d 0c mov 0xc(%ebp),%ecx ++ 180: 55 push %ebp ++ 181: 89 e5 mov %esp,%ebp ++ 183: 8b 55 08 mov 0x8(%ebp),%edx ++ 186: 53 push %ebx ++ 187: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) +- 17a: 0f b6 02 movzbl (%edx),%eax +- 17d: 84 c0 test %al,%al +- 17f: 74 2d je 1ae +- 181: 0f b6 19 movzbl (%ecx),%ebx +- 184: 38 d8 cmp %bl,%al +- 186: 74 0e je 196 +- 188: eb 2b jmp 1b5 +- 18a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 190: 38 c8 cmp %cl,%al +- 192: 75 15 jne 1a9 ++ 18a: 0f b6 02 movzbl (%edx),%eax ++ 18d: 84 c0 test %al,%al ++ 18f: 74 2d je 1be ++ 191: 0f b6 19 movzbl (%ecx),%ebx ++ 194: 38 d8 cmp %bl,%al ++ 196: 74 0e je 1a6 ++ 198: eb 2b jmp 1c5 ++ 19a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 1a0: 38 c8 cmp %cl,%al ++ 1a2: 75 15 jne 1b9 + p++, q++; +- 194: 89 d9 mov %ebx,%ecx +- 196: 83 c2 01 add $0x1,%edx ++ 1a4: 89 d9 mov %ebx,%ecx ++ 1a6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) +- 199: 0f b6 02 movzbl (%edx),%eax ++ 1a9: 0f b6 02 movzbl (%edx),%eax + p++, q++; +- 19c: 8d 59 01 lea 0x1(%ecx),%ebx ++ 1ac: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) +- 19f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx +- 1a3: 84 c0 test %al,%al +- 1a5: 75 e9 jne 190 +- 1a7: 31 c0 xor %eax,%eax ++ 1af: 0f b6 49 01 movzbl 0x1(%ecx),%ecx ++ 1b3: 84 c0 test %al,%al ++ 1b5: 75 e9 jne 1a0 ++ 1b7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; +- 1a9: 29 c8 sub %ecx,%eax ++ 1b9: 29 c8 sub %ecx,%eax + } +- 1ab: 5b pop %ebx +- 1ac: 5d pop %ebp +- 1ad: c3 ret +- 1ae: 0f b6 09 movzbl (%ecx),%ecx ++ 1bb: 5b pop %ebx ++ 1bc: 5d pop %ebp ++ 1bd: c3 ret ++ 1be: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) +- 1b1: 31 c0 xor %eax,%eax +- 1b3: eb f4 jmp 1a9 +- 1b5: 0f b6 cb movzbl %bl,%ecx +- 1b8: eb ef jmp 1a9 +- 1ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 1c1: 31 c0 xor %eax,%eax ++ 1c3: eb f4 jmp 1b9 ++ 1c5: 0f b6 cb movzbl %bl,%ecx ++ 1c8: eb ef jmp 1b9 ++ 1ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-000001c0 : ++000001d0 : + + uint + strlen(const char *s) + { +- 1c0: 55 push %ebp +- 1c1: 89 e5 mov %esp,%ebp +- 1c3: 8b 4d 08 mov 0x8(%ebp),%ecx ++ 1d0: 55 push %ebp ++ 1d1: 89 e5 mov %esp,%ebp ++ 1d3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) +- 1c6: 80 39 00 cmpb $0x0,(%ecx) +- 1c9: 74 12 je 1dd +- 1cb: 31 d2 xor %edx,%edx +- 1cd: 8d 76 00 lea 0x0(%esi),%esi +- 1d0: 83 c2 01 add $0x1,%edx +- 1d3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) +- 1d7: 89 d0 mov %edx,%eax +- 1d9: 75 f5 jne 1d0 ++ 1d6: 80 39 00 cmpb $0x0,(%ecx) ++ 1d9: 74 12 je 1ed ++ 1db: 31 d2 xor %edx,%edx ++ 1dd: 8d 76 00 lea 0x0(%esi),%esi ++ 1e0: 83 c2 01 add $0x1,%edx ++ 1e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) ++ 1e7: 89 d0 mov %edx,%eax ++ 1e9: 75 f5 jne 1e0 + ; + return n; + } +- 1db: 5d pop %ebp +- 1dc: c3 ret ++ 1eb: 5d pop %ebp ++ 1ec: c3 ret + for(n = 0; s[n]; n++) +- 1dd: 31 c0 xor %eax,%eax ++ 1ed: 31 c0 xor %eax,%eax + } +- 1df: 5d pop %ebp +- 1e0: c3 ret +- 1e1: eb 0d jmp 1f0 +- 1e3: 90 nop +- 1e4: 90 nop +- 1e5: 90 nop +- 1e6: 90 nop +- 1e7: 90 nop +- 1e8: 90 nop +- 1e9: 90 nop +- 1ea: 90 nop +- 1eb: 90 nop +- 1ec: 90 nop +- 1ed: 90 nop +- 1ee: 90 nop +- 1ef: 90 nop +- +-000001f0 : ++ 1ef: 5d pop %ebp ++ 1f0: c3 ret ++ 1f1: eb 0d jmp 200 ++ 1f3: 90 nop ++ 1f4: 90 nop ++ 1f5: 90 nop ++ 1f6: 90 nop ++ 1f7: 90 nop ++ 1f8: 90 nop ++ 1f9: 90 nop ++ 1fa: 90 nop ++ 1fb: 90 nop ++ 1fc: 90 nop ++ 1fd: 90 nop ++ 1fe: 90 nop ++ 1ff: 90 nop ++ ++00000200 : + + void* + memset(void *dst, int c, uint n) + { +- 1f0: 55 push %ebp +- 1f1: 89 e5 mov %esp,%ebp +- 1f3: 8b 55 08 mov 0x8(%ebp),%edx +- 1f6: 57 push %edi ++ 200: 55 push %ebp ++ 201: 89 e5 mov %esp,%ebp ++ 203: 8b 55 08 mov 0x8(%ebp),%edx ++ 206: 57 push %edi + } + + static inline void + stosb(void *addr, int data, int cnt) + { + asm volatile("cld; rep stosb" : +- 1f7: 8b 4d 10 mov 0x10(%ebp),%ecx +- 1fa: 8b 45 0c mov 0xc(%ebp),%eax +- 1fd: 89 d7 mov %edx,%edi +- 1ff: fc cld +- 200: f3 aa rep stos %al,%es:(%edi) ++ 207: 8b 4d 10 mov 0x10(%ebp),%ecx ++ 20a: 8b 45 0c mov 0xc(%ebp),%eax ++ 20d: 89 d7 mov %edx,%edi ++ 20f: fc cld ++ 210: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; + } +- 202: 89 d0 mov %edx,%eax +- 204: 5f pop %edi +- 205: 5d pop %ebp +- 206: c3 ret +- 207: 89 f6 mov %esi,%esi +- 209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 212: 89 d0 mov %edx,%eax ++ 214: 5f pop %edi ++ 215: 5d pop %ebp ++ 216: c3 ret ++ 217: 89 f6 mov %esi,%esi ++ 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000210 : ++00000220 : + + char* + strchr(const char *s, char c) + { +- 210: 55 push %ebp +- 211: 89 e5 mov %esp,%ebp +- 213: 8b 45 08 mov 0x8(%ebp),%eax +- 216: 53 push %ebx +- 217: 8b 55 0c mov 0xc(%ebp),%edx ++ 220: 55 push %ebp ++ 221: 89 e5 mov %esp,%ebp ++ 223: 8b 45 08 mov 0x8(%ebp),%eax ++ 226: 53 push %ebx ++ 227: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) +- 21a: 0f b6 18 movzbl (%eax),%ebx +- 21d: 84 db test %bl,%bl +- 21f: 74 1d je 23e ++ 22a: 0f b6 18 movzbl (%eax),%ebx ++ 22d: 84 db test %bl,%bl ++ 22f: 74 1d je 24e + if(*s == c) +- 221: 38 d3 cmp %dl,%bl +- 223: 89 d1 mov %edx,%ecx +- 225: 75 0d jne 234 +- 227: eb 17 jmp 240 +- 229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- 230: 38 ca cmp %cl,%dl +- 232: 74 0c je 240 ++ 231: 38 d3 cmp %dl,%bl ++ 233: 89 d1 mov %edx,%ecx ++ 235: 75 0d jne 244 ++ 237: eb 17 jmp 250 ++ 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 240: 38 ca cmp %cl,%dl ++ 242: 74 0c je 250 + for(; *s; s++) +- 234: 83 c0 01 add $0x1,%eax +- 237: 0f b6 10 movzbl (%eax),%edx +- 23a: 84 d2 test %dl,%dl +- 23c: 75 f2 jne 230 ++ 244: 83 c0 01 add $0x1,%eax ++ 247: 0f b6 10 movzbl (%eax),%edx ++ 24a: 84 d2 test %dl,%dl ++ 24c: 75 f2 jne 240 + return (char*)s; + return 0; +- 23e: 31 c0 xor %eax,%eax ++ 24e: 31 c0 xor %eax,%eax + } +- 240: 5b pop %ebx +- 241: 5d pop %ebp +- 242: c3 ret +- 243: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 250: 5b pop %ebx ++ 251: 5d pop %ebp ++ 252: c3 ret ++ 253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000250 : ++00000260 : + + char* + gets(char *buf, int max) + { +- 250: 55 push %ebp +- 251: 89 e5 mov %esp,%ebp +- 253: 57 push %edi +- 254: 56 push %esi ++ 260: 55 push %ebp ++ 261: 89 e5 mov %esp,%ebp ++ 263: 57 push %edi ++ 264: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ +- 255: 31 f6 xor %esi,%esi ++ 265: 31 f6 xor %esi,%esi + { +- 257: 53 push %ebx +- 258: 83 ec 2c sub $0x2c,%esp ++ 267: 53 push %ebx ++ 268: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); +- 25b: 8d 7d e7 lea -0x19(%ebp),%edi ++ 26b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ +- 25e: eb 31 jmp 291 ++ 26e: eb 31 jmp 2a1 + cc = read(0, &c, 1); +- 260: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 267: 00 +- 268: 89 7c 24 04 mov %edi,0x4(%esp) +- 26c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 273: e8 02 01 00 00 call 37a ++ 270: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 277: 00 ++ 278: 89 7c 24 04 mov %edi,0x4(%esp) ++ 27c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 283: e8 02 01 00 00 call 38a + if(cc < 1) +- 278: 85 c0 test %eax,%eax +- 27a: 7e 1d jle 299 ++ 288: 85 c0 test %eax,%eax ++ 28a: 7e 1d jle 2a9 + break; + buf[i++] = c; +- 27c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax ++ 28c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ +- 280: 89 de mov %ebx,%esi ++ 290: 89 de mov %ebx,%esi + buf[i++] = c; +- 282: 8b 55 08 mov 0x8(%ebp),%edx ++ 292: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') +- 285: 3c 0d cmp $0xd,%al ++ 295: 3c 0d cmp $0xd,%al + buf[i++] = c; +- 287: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) ++ 297: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') +- 28b: 74 0c je 299 +- 28d: 3c 0a cmp $0xa,%al +- 28f: 74 08 je 299 ++ 29b: 74 0c je 2a9 ++ 29d: 3c 0a cmp $0xa,%al ++ 29f: 74 08 je 2a9 + for(i=0; i+1 < max; ){ +- 291: 8d 5e 01 lea 0x1(%esi),%ebx +- 294: 3b 5d 0c cmp 0xc(%ebp),%ebx +- 297: 7c c7 jl 260 ++ 2a1: 8d 5e 01 lea 0x1(%esi),%ebx ++ 2a4: 3b 5d 0c cmp 0xc(%ebp),%ebx ++ 2a7: 7c c7 jl 270 + break; + } + buf[i] = '\0'; +- 299: 8b 45 08 mov 0x8(%ebp),%eax +- 29c: c6 04 30 00 movb $0x0,(%eax,%esi,1) ++ 2a9: 8b 45 08 mov 0x8(%ebp),%eax ++ 2ac: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; + } +- 2a0: 83 c4 2c add $0x2c,%esp +- 2a3: 5b pop %ebx +- 2a4: 5e pop %esi +- 2a5: 5f pop %edi +- 2a6: 5d pop %ebp +- 2a7: c3 ret +- 2a8: 90 nop +- 2a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 2b0: 83 c4 2c add $0x2c,%esp ++ 2b3: 5b pop %ebx ++ 2b4: 5e pop %esi ++ 2b5: 5f pop %edi ++ 2b6: 5d pop %ebp ++ 2b7: c3 ret ++ 2b8: 90 nop ++ 2b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-000002b0 : ++000002c0 : + + int + stat(const char *n, struct stat *st) + { +- 2b0: 55 push %ebp +- 2b1: 89 e5 mov %esp,%ebp +- 2b3: 56 push %esi +- 2b4: 53 push %ebx +- 2b5: 83 ec 10 sub $0x10,%esp ++ 2c0: 55 push %ebp ++ 2c1: 89 e5 mov %esp,%ebp ++ 2c3: 56 push %esi ++ 2c4: 53 push %ebx ++ 2c5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); +- 2b8: 8b 45 08 mov 0x8(%ebp),%eax +- 2bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2c2: 00 +- 2c3: 89 04 24 mov %eax,(%esp) +- 2c6: e8 d7 00 00 00 call 3a2 ++ 2c8: 8b 45 08 mov 0x8(%ebp),%eax ++ 2cb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 2d2: 00 ++ 2d3: 89 04 24 mov %eax,(%esp) ++ 2d6: e8 d7 00 00 00 call 3b2 + if(fd < 0) +- 2cb: 85 c0 test %eax,%eax ++ 2db: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); +- 2cd: 89 c3 mov %eax,%ebx ++ 2dd: 89 c3 mov %eax,%ebx + if(fd < 0) +- 2cf: 78 27 js 2f8 ++ 2df: 78 27 js 308 + return -1; + r = fstat(fd, st); +- 2d1: 8b 45 0c mov 0xc(%ebp),%eax +- 2d4: 89 1c 24 mov %ebx,(%esp) +- 2d7: 89 44 24 04 mov %eax,0x4(%esp) +- 2db: e8 da 00 00 00 call 3ba ++ 2e1: 8b 45 0c mov 0xc(%ebp),%eax ++ 2e4: 89 1c 24 mov %ebx,(%esp) ++ 2e7: 89 44 24 04 mov %eax,0x4(%esp) ++ 2eb: e8 da 00 00 00 call 3ca + close(fd); +- 2e0: 89 1c 24 mov %ebx,(%esp) ++ 2f0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); +- 2e3: 89 c6 mov %eax,%esi ++ 2f3: 89 c6 mov %eax,%esi + close(fd); +- 2e5: e8 a0 00 00 00 call 38a ++ 2f5: e8 a0 00 00 00 call 39a + return r; +- 2ea: 89 f0 mov %esi,%eax ++ 2fa: 89 f0 mov %esi,%eax + } +- 2ec: 83 c4 10 add $0x10,%esp +- 2ef: 5b pop %ebx +- 2f0: 5e pop %esi +- 2f1: 5d pop %ebp +- 2f2: c3 ret +- 2f3: 90 nop +- 2f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 2fc: 83 c4 10 add $0x10,%esp ++ 2ff: 5b pop %ebx ++ 300: 5e pop %esi ++ 301: 5d pop %ebp ++ 302: c3 ret ++ 303: 90 nop ++ 304: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +- 2f8: b8 ff ff ff ff mov $0xffffffff,%eax +- 2fd: eb ed jmp 2ec +- 2ff: 90 nop ++ 308: b8 ff ff ff ff mov $0xffffffff,%eax ++ 30d: eb ed jmp 2fc ++ 30f: 90 nop + +-00000300 : ++00000310 : + + int + atoi(const char *s) + { +- 300: 55 push %ebp +- 301: 89 e5 mov %esp,%ebp +- 303: 8b 4d 08 mov 0x8(%ebp),%ecx +- 306: 53 push %ebx ++ 310: 55 push %ebp ++ 311: 89 e5 mov %esp,%ebp ++ 313: 8b 4d 08 mov 0x8(%ebp),%ecx ++ 316: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') +- 307: 0f be 11 movsbl (%ecx),%edx +- 30a: 8d 42 d0 lea -0x30(%edx),%eax +- 30d: 3c 09 cmp $0x9,%al ++ 317: 0f be 11 movsbl (%ecx),%edx ++ 31a: 8d 42 d0 lea -0x30(%edx),%eax ++ 31d: 3c 09 cmp $0x9,%al + n = 0; +- 30f: b8 00 00 00 00 mov $0x0,%eax ++ 31f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') +- 314: 77 17 ja 32d +- 316: 66 90 xchg %ax,%ax ++ 324: 77 17 ja 33d ++ 326: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; +- 318: 83 c1 01 add $0x1,%ecx +- 31b: 8d 04 80 lea (%eax,%eax,4),%eax +- 31e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ++ 328: 83 c1 01 add $0x1,%ecx ++ 32b: 8d 04 80 lea (%eax,%eax,4),%eax ++ 32e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') +- 322: 0f be 11 movsbl (%ecx),%edx +- 325: 8d 5a d0 lea -0x30(%edx),%ebx +- 328: 80 fb 09 cmp $0x9,%bl +- 32b: 76 eb jbe 318 ++ 332: 0f be 11 movsbl (%ecx),%edx ++ 335: 8d 5a d0 lea -0x30(%edx),%ebx ++ 338: 80 fb 09 cmp $0x9,%bl ++ 33b: 76 eb jbe 328 + return n; + } +- 32d: 5b pop %ebx +- 32e: 5d pop %ebp +- 32f: c3 ret ++ 33d: 5b pop %ebx ++ 33e: 5d pop %ebp ++ 33f: c3 ret + +-00000330 : ++00000340 : + + void* + memmove(void *vdst, const void *vsrc, int n) + { +- 330: 55 push %ebp ++ 340: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) +- 331: 31 d2 xor %edx,%edx ++ 341: 31 d2 xor %edx,%edx + { +- 333: 89 e5 mov %esp,%ebp +- 335: 56 push %esi +- 336: 8b 45 08 mov 0x8(%ebp),%eax +- 339: 53 push %ebx +- 33a: 8b 5d 10 mov 0x10(%ebp),%ebx +- 33d: 8b 75 0c mov 0xc(%ebp),%esi ++ 343: 89 e5 mov %esp,%ebp ++ 345: 56 push %esi ++ 346: 8b 45 08 mov 0x8(%ebp),%eax ++ 349: 53 push %ebx ++ 34a: 8b 5d 10 mov 0x10(%ebp),%ebx ++ 34d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) +- 340: 85 db test %ebx,%ebx +- 342: 7e 12 jle 356 +- 344: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 350: 85 db test %ebx,%ebx ++ 352: 7e 12 jle 366 ++ 354: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; +- 348: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +- 34c: 88 0c 10 mov %cl,(%eax,%edx,1) +- 34f: 83 c2 01 add $0x1,%edx ++ 358: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx ++ 35c: 88 0c 10 mov %cl,(%eax,%edx,1) ++ 35f: 83 c2 01 add $0x1,%edx + while(n-- > 0) +- 352: 39 da cmp %ebx,%edx +- 354: 75 f2 jne 348 ++ 362: 39 da cmp %ebx,%edx ++ 364: 75 f2 jne 358 + return vdst; + } +- 356: 5b pop %ebx +- 357: 5e pop %esi +- 358: 5d pop %ebp +- 359: c3 ret +- +-0000035a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) +- 35a: b8 01 00 00 00 mov $0x1,%eax +- 35f: cd 40 int $0x40 +- 361: c3 ret +- +-00000362 : +-SYSCALL(exit) +- 362: b8 02 00 00 00 mov $0x2,%eax +- 367: cd 40 int $0x40 ++ 366: 5b pop %ebx ++ 367: 5e pop %esi ++ 368: 5d pop %ebp + 369: c3 ret + +-0000036a : +-SYSCALL(wait) +- 36a: b8 03 00 00 00 mov $0x3,%eax ++0000036a : ++ 36a: b8 01 00 00 00 mov $0x1,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + +-00000372 : +-SYSCALL(pipe) +- 372: b8 04 00 00 00 mov $0x4,%eax ++00000372 : ++ 372: b8 02 00 00 00 mov $0x2,%eax + 377: cd 40 int $0x40 + 379: c3 ret + +-0000037a : +-SYSCALL(read) +- 37a: b8 05 00 00 00 mov $0x5,%eax ++0000037a : ++ 37a: b8 03 00 00 00 mov $0x3,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + +-00000382 : +-SYSCALL(write) +- 382: b8 10 00 00 00 mov $0x10,%eax ++00000382 : ++ 382: b8 04 00 00 00 mov $0x4,%eax + 387: cd 40 int $0x40 + 389: c3 ret + +-0000038a : +-SYSCALL(close) +- 38a: b8 15 00 00 00 mov $0x15,%eax ++0000038a : ++ 38a: b8 05 00 00 00 mov $0x5,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + +-00000392 : +-SYSCALL(kill) +- 392: b8 06 00 00 00 mov $0x6,%eax ++00000392 : ++ 392: b8 10 00 00 00 mov $0x10,%eax + 397: cd 40 int $0x40 + 399: c3 ret + +-0000039a : +-SYSCALL(exec) +- 39a: b8 07 00 00 00 mov $0x7,%eax ++0000039a : ++ 39a: b8 15 00 00 00 mov $0x15,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + +-000003a2 : +-SYSCALL(open) +- 3a2: b8 0f 00 00 00 mov $0xf,%eax ++000003a2 : ++ 3a2: b8 06 00 00 00 mov $0x6,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + +-000003aa : +-SYSCALL(mknod) +- 3aa: b8 11 00 00 00 mov $0x11,%eax ++000003aa : ++ 3aa: b8 07 00 00 00 mov $0x7,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + +-000003b2 : +-SYSCALL(unlink) +- 3b2: b8 12 00 00 00 mov $0x12,%eax ++000003b2 : ++ 3b2: b8 0f 00 00 00 mov $0xf,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + +-000003ba : +-SYSCALL(fstat) +- 3ba: b8 08 00 00 00 mov $0x8,%eax ++000003ba : ++ 3ba: b8 11 00 00 00 mov $0x11,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + +-000003c2 : +-SYSCALL(link) +- 3c2: b8 13 00 00 00 mov $0x13,%eax ++000003c2 : ++ 3c2: b8 12 00 00 00 mov $0x12,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + +-000003ca : +-SYSCALL(mkdir) +- 3ca: b8 14 00 00 00 mov $0x14,%eax ++000003ca : ++ 3ca: b8 08 00 00 00 mov $0x8,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + +-000003d2 : +-SYSCALL(chdir) +- 3d2: b8 09 00 00 00 mov $0x9,%eax ++000003d2 : ++ 3d2: b8 13 00 00 00 mov $0x13,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + +-000003da : +-SYSCALL(dup) +- 3da: b8 0a 00 00 00 mov $0xa,%eax ++000003da : ++ 3da: b8 14 00 00 00 mov $0x14,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + +-000003e2 : +-SYSCALL(getpid) +- 3e2: b8 0b 00 00 00 mov $0xb,%eax ++000003e2 : ++ 3e2: b8 09 00 00 00 mov $0x9,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + +-000003ea : +-SYSCALL(sbrk) +- 3ea: b8 0c 00 00 00 mov $0xc,%eax ++000003ea : ++ 3ea: b8 0a 00 00 00 mov $0xa,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + +-000003f2 : +-SYSCALL(sleep) +- 3f2: b8 0d 00 00 00 mov $0xd,%eax ++000003f2 : ++ 3f2: b8 0b 00 00 00 mov $0xb,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + +-000003fa : +-SYSCALL(uptime) +- 3fa: b8 0e 00 00 00 mov $0xe,%eax ++000003fa : ++ 3fa: b8 0c 00 00 00 mov $0xc,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret ++ ++00000402 : ++ 402: b8 0d 00 00 00 mov $0xd,%eax ++ 407: cd 40 int $0x40 ++ 409: c3 ret ++ ++0000040a : ++ 40a: b8 0e 00 00 00 mov $0xe,%eax ++ 40f: cd 40 int $0x40 ++ 411: c3 ret +diff --git a/forktest.c b/forktest.c +index 227810c..a9d0f38 100644 +--- a/forktest.c ++++ b/forktest.c +@@ -5,42 +5,45 @@ + #include "stat.h" + #include "user.h" + +-#define N 1000 ++#define N 1000 + +-void +-printf(int fd, const char *s, ...) ++void printf(int fd, const char *s, ...) + { + write(fd, s, strlen(s)); + } + +-void +-forktest(void) ++void forktest(void) + { + int n, pid; + + printf(1, "fork test\n"); + +- for(n=0; n 0; n--){ +- if(wait() < 0){ ++ for (; n > 0; n--) ++ { ++ if (wait(0) < 0) ++ { + printf(1, "wait stopped early\n"); + exit(0); + } + } + +- if(wait() != -1){ ++ if (wait(0) != -1) ++ { + printf(1, "wait got too many\n"); + exit(0); + } +@@ -48,8 +51,7 @@ forktest(void) + printf(1, "fork test OK\n"); + } + +-int +-main(void) ++int main(void) + { + forktest(); + exit(0); +diff --git a/forktest.o b/forktest.o +index e27294a..9cc01e4 100644 +Binary files a/forktest.o and b/forktest.o differ +diff --git a/fs.img b/fs.img +index 316f0e2..ff887b9 100644 +Binary files a/fs.img and b/fs.img differ +diff --git a/fs.o b/fs.o +index bcec088..80c8b12 100644 +Binary files a/fs.o and b/fs.o differ +diff --git a/grep.asm b/grep.asm +index cf12e4b..00a27e1 100644 +--- a/grep.asm ++++ b/grep.asm +@@ -772,132 +772,106 @@ memmove(void *vdst, const void *vsrc, int n) + 549: c3 ret + + 0000054a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 54a: b8 01 00 00 00 mov $0x1,%eax + 54f: cd 40 int $0x40 + 551: c3 ret + + 00000552 : +-SYSCALL(exit) + 552: b8 02 00 00 00 mov $0x2,%eax + 557: cd 40 int $0x40 + 559: c3 ret + + 0000055a : +-SYSCALL(wait) + 55a: b8 03 00 00 00 mov $0x3,%eax + 55f: cd 40 int $0x40 + 561: c3 ret + + 00000562 : +-SYSCALL(pipe) + 562: b8 04 00 00 00 mov $0x4,%eax + 567: cd 40 int $0x40 + 569: c3 ret + + 0000056a : +-SYSCALL(read) + 56a: b8 05 00 00 00 mov $0x5,%eax + 56f: cd 40 int $0x40 + 571: c3 ret + + 00000572 : +-SYSCALL(write) + 572: b8 10 00 00 00 mov $0x10,%eax + 577: cd 40 int $0x40 + 579: c3 ret + + 0000057a : +-SYSCALL(close) + 57a: b8 15 00 00 00 mov $0x15,%eax + 57f: cd 40 int $0x40 + 581: c3 ret + + 00000582 : +-SYSCALL(kill) + 582: b8 06 00 00 00 mov $0x6,%eax + 587: cd 40 int $0x40 + 589: c3 ret + + 0000058a : +-SYSCALL(exec) + 58a: b8 07 00 00 00 mov $0x7,%eax + 58f: cd 40 int $0x40 + 591: c3 ret + + 00000592 : +-SYSCALL(open) + 592: b8 0f 00 00 00 mov $0xf,%eax + 597: cd 40 int $0x40 + 599: c3 ret + + 0000059a : +-SYSCALL(mknod) + 59a: b8 11 00 00 00 mov $0x11,%eax + 59f: cd 40 int $0x40 + 5a1: c3 ret + + 000005a2 : +-SYSCALL(unlink) + 5a2: b8 12 00 00 00 mov $0x12,%eax + 5a7: cd 40 int $0x40 + 5a9: c3 ret + + 000005aa : +-SYSCALL(fstat) + 5aa: b8 08 00 00 00 mov $0x8,%eax + 5af: cd 40 int $0x40 + 5b1: c3 ret + + 000005b2 : +-SYSCALL(link) + 5b2: b8 13 00 00 00 mov $0x13,%eax + 5b7: cd 40 int $0x40 + 5b9: c3 ret + + 000005ba : +-SYSCALL(mkdir) + 5ba: b8 14 00 00 00 mov $0x14,%eax + 5bf: cd 40 int $0x40 + 5c1: c3 ret + + 000005c2 : +-SYSCALL(chdir) + 5c2: b8 09 00 00 00 mov $0x9,%eax + 5c7: cd 40 int $0x40 + 5c9: c3 ret + + 000005ca : +-SYSCALL(dup) + 5ca: b8 0a 00 00 00 mov $0xa,%eax + 5cf: cd 40 int $0x40 + 5d1: c3 ret + + 000005d2 : +-SYSCALL(getpid) + 5d2: b8 0b 00 00 00 mov $0xb,%eax + 5d7: cd 40 int $0x40 + 5d9: c3 ret + + 000005da : +-SYSCALL(sbrk) + 5da: b8 0c 00 00 00 mov $0xc,%eax + 5df: cd 40 int $0x40 + 5e1: c3 ret + + 000005e2 : +-SYSCALL(sleep) + 5e2: b8 0d 00 00 00 mov $0xd,%eax + 5e7: cd 40 int $0x40 + 5e9: c3 ret + + 000005ea : +-SYSCALL(uptime) + 5ea: b8 0e 00 00 00 mov $0xe,%eax + 5ef: cd 40 int $0x40 + 5f1: c3 ret +diff --git a/grep.o b/grep.o +index 62fc26e..c6dcbc6 100644 +Binary files a/grep.o and b/grep.o differ +diff --git a/hello.asm b/hello.asm +index cc8a0e1..0aed89c 100644 +--- a/hello.asm ++++ b/hello.asm +@@ -8,1112 +8,1104 @@ Disassembly of section .text: + #include "types.h" + #include "user.h" + +-int main( int argc, char **argv) { ++int main(int argc, char **argv) ++{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp +- 6: 83 ec 10 sub $0x10,%esp +- +- printf(1, "Hello World!\n"); +- 9: c7 44 24 04 06 07 00 movl $0x706,0x4(%esp) ++ 6: 83 ec 20 sub $0x20,%esp ++ int exitStatus = 10000000; ++ printf(1, "Waiting...\n"); ++ 9: c7 44 24 04 36 07 00 movl $0x736,0x4(%esp) + 10: 00 + 11: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 18: e8 83 03 00 00 call 3a0 ++ int exitStatus = 10000000; ++ 18: c7 44 24 1c 80 96 98 movl $0x989680,0x1c(%esp) ++ 1f: 00 ++ printf(1, "Waiting...\n"); ++ 20: e8 ab 03 00 00 call 3d0 ++ wait(&exitStatus); ++ 25: 8d 44 24 1c lea 0x1c(%esp),%eax ++ 29: 89 04 24 mov %eax,(%esp) ++ 2c: e8 59 02 00 00 call 28a ++ printf(1, "Hello World!\n"); ++ 31: c7 44 24 04 42 07 00 movl $0x742,0x4(%esp) ++ 38: 00 ++ 39: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 40: e8 8b 03 00 00 call 3d0 + exit(0); +- 1d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 24: e8 29 02 00 00 call 252 +- 29: 66 90 xchg %ax,%ax +- 2b: 66 90 xchg %ax,%ax +- 2d: 66 90 xchg %ax,%ax +- 2f: 90 nop +- +-00000030 : ++ 45: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 4c: e8 31 02 00 00 call 282 ++ 51: 66 90 xchg %ax,%ax ++ 53: 66 90 xchg %ax,%ax ++ 55: 66 90 xchg %ax,%ax ++ 57: 66 90 xchg %ax,%ax ++ 59: 66 90 xchg %ax,%ax ++ 5b: 66 90 xchg %ax,%ax ++ 5d: 66 90 xchg %ax,%ax ++ 5f: 90 nop ++ ++00000060 : + #include "user.h" + #include "x86.h" + + char* + strcpy(char *s, const char *t) + { +- 30: 55 push %ebp +- 31: 89 e5 mov %esp,%ebp +- 33: 8b 45 08 mov 0x8(%ebp),%eax +- 36: 8b 4d 0c mov 0xc(%ebp),%ecx +- 39: 53 push %ebx ++ 60: 55 push %ebp ++ 61: 89 e5 mov %esp,%ebp ++ 63: 8b 45 08 mov 0x8(%ebp),%eax ++ 66: 8b 4d 0c mov 0xc(%ebp),%ecx ++ 69: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) +- 3a: 89 c2 mov %eax,%edx +- 3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 40: 83 c1 01 add $0x1,%ecx +- 43: 0f b6 59 ff movzbl -0x1(%ecx),%ebx +- 47: 83 c2 01 add $0x1,%edx +- 4a: 84 db test %bl,%bl +- 4c: 88 5a ff mov %bl,-0x1(%edx) +- 4f: 75 ef jne 40 ++ 6a: 89 c2 mov %eax,%edx ++ 6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 70: 83 c1 01 add $0x1,%ecx ++ 73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx ++ 77: 83 c2 01 add $0x1,%edx ++ 7a: 84 db test %bl,%bl ++ 7c: 88 5a ff mov %bl,-0x1(%edx) ++ 7f: 75 ef jne 70 + ; + return os; + } +- 51: 5b pop %ebx +- 52: 5d pop %ebp +- 53: c3 ret +- 54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ 81: 5b pop %ebx ++ 82: 5d pop %ebp ++ 83: c3 ret ++ 84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00000060 : ++00000090 : + + int + strcmp(const char *p, const char *q) + { +- 60: 55 push %ebp +- 61: 89 e5 mov %esp,%ebp +- 63: 8b 55 08 mov 0x8(%ebp),%edx +- 66: 53 push %ebx +- 67: 8b 4d 0c mov 0xc(%ebp),%ecx ++ 90: 55 push %ebp ++ 91: 89 e5 mov %esp,%ebp ++ 93: 8b 55 08 mov 0x8(%ebp),%edx ++ 96: 53 push %ebx ++ 97: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) +- 6a: 0f b6 02 movzbl (%edx),%eax +- 6d: 84 c0 test %al,%al +- 6f: 74 2d je 9e +- 71: 0f b6 19 movzbl (%ecx),%ebx +- 74: 38 d8 cmp %bl,%al +- 76: 74 0e je 86 +- 78: eb 2b jmp a5 +- 7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 80: 38 c8 cmp %cl,%al +- 82: 75 15 jne 99 ++ 9a: 0f b6 02 movzbl (%edx),%eax ++ 9d: 84 c0 test %al,%al ++ 9f: 74 2d je ce ++ a1: 0f b6 19 movzbl (%ecx),%ebx ++ a4: 38 d8 cmp %bl,%al ++ a6: 74 0e je b6 ++ a8: eb 2b jmp d5 ++ aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ b0: 38 c8 cmp %cl,%al ++ b2: 75 15 jne c9 + p++, q++; +- 84: 89 d9 mov %ebx,%ecx +- 86: 83 c2 01 add $0x1,%edx ++ b4: 89 d9 mov %ebx,%ecx ++ b6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) +- 89: 0f b6 02 movzbl (%edx),%eax ++ b9: 0f b6 02 movzbl (%edx),%eax + p++, q++; +- 8c: 8d 59 01 lea 0x1(%ecx),%ebx ++ bc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) +- 8f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx +- 93: 84 c0 test %al,%al +- 95: 75 e9 jne 80 +- 97: 31 c0 xor %eax,%eax ++ bf: 0f b6 49 01 movzbl 0x1(%ecx),%ecx ++ c3: 84 c0 test %al,%al ++ c5: 75 e9 jne b0 ++ c7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; +- 99: 29 c8 sub %ecx,%eax ++ c9: 29 c8 sub %ecx,%eax + } +- 9b: 5b pop %ebx +- 9c: 5d pop %ebp +- 9d: c3 ret +- 9e: 0f b6 09 movzbl (%ecx),%ecx ++ cb: 5b pop %ebx ++ cc: 5d pop %ebp ++ cd: c3 ret ++ ce: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) +- a1: 31 c0 xor %eax,%eax +- a3: eb f4 jmp 99 +- a5: 0f b6 cb movzbl %bl,%ecx +- a8: eb ef jmp 99 +- aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ d1: 31 c0 xor %eax,%eax ++ d3: eb f4 jmp c9 ++ d5: 0f b6 cb movzbl %bl,%ecx ++ d8: eb ef jmp c9 ++ da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-000000b0 : ++000000e0 : + + uint + strlen(const char *s) + { +- b0: 55 push %ebp +- b1: 89 e5 mov %esp,%ebp +- b3: 8b 4d 08 mov 0x8(%ebp),%ecx ++ e0: 55 push %ebp ++ e1: 89 e5 mov %esp,%ebp ++ e3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) +- b6: 80 39 00 cmpb $0x0,(%ecx) +- b9: 74 12 je cd +- bb: 31 d2 xor %edx,%edx +- bd: 8d 76 00 lea 0x0(%esi),%esi +- c0: 83 c2 01 add $0x1,%edx +- c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) +- c7: 89 d0 mov %edx,%eax +- c9: 75 f5 jne c0 ++ e6: 80 39 00 cmpb $0x0,(%ecx) ++ e9: 74 12 je fd ++ eb: 31 d2 xor %edx,%edx ++ ed: 8d 76 00 lea 0x0(%esi),%esi ++ f0: 83 c2 01 add $0x1,%edx ++ f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) ++ f7: 89 d0 mov %edx,%eax ++ f9: 75 f5 jne f0 + ; + return n; + } +- cb: 5d pop %ebp +- cc: c3 ret ++ fb: 5d pop %ebp ++ fc: c3 ret + for(n = 0; s[n]; n++) +- cd: 31 c0 xor %eax,%eax ++ fd: 31 c0 xor %eax,%eax + } +- cf: 5d pop %ebp +- d0: c3 ret +- d1: eb 0d jmp e0 +- d3: 90 nop +- d4: 90 nop +- d5: 90 nop +- d6: 90 nop +- d7: 90 nop +- d8: 90 nop +- d9: 90 nop +- da: 90 nop +- db: 90 nop +- dc: 90 nop +- dd: 90 nop +- de: 90 nop +- df: 90 nop +- +-000000e0 : ++ ff: 5d pop %ebp ++ 100: c3 ret ++ 101: eb 0d jmp 110 ++ 103: 90 nop ++ 104: 90 nop ++ 105: 90 nop ++ 106: 90 nop ++ 107: 90 nop ++ 108: 90 nop ++ 109: 90 nop ++ 10a: 90 nop ++ 10b: 90 nop ++ 10c: 90 nop ++ 10d: 90 nop ++ 10e: 90 nop ++ 10f: 90 nop ++ ++00000110 : + + void* + memset(void *dst, int c, uint n) + { +- e0: 55 push %ebp +- e1: 89 e5 mov %esp,%ebp +- e3: 8b 55 08 mov 0x8(%ebp),%edx +- e6: 57 push %edi ++ 110: 55 push %ebp ++ 111: 89 e5 mov %esp,%ebp ++ 113: 8b 55 08 mov 0x8(%ebp),%edx ++ 116: 57 push %edi + } + + static inline void + stosb(void *addr, int data, int cnt) + { + asm volatile("cld; rep stosb" : +- e7: 8b 4d 10 mov 0x10(%ebp),%ecx +- ea: 8b 45 0c mov 0xc(%ebp),%eax +- ed: 89 d7 mov %edx,%edi +- ef: fc cld +- f0: f3 aa rep stos %al,%es:(%edi) ++ 117: 8b 4d 10 mov 0x10(%ebp),%ecx ++ 11a: 8b 45 0c mov 0xc(%ebp),%eax ++ 11d: 89 d7 mov %edx,%edi ++ 11f: fc cld ++ 120: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; + } +- f2: 89 d0 mov %edx,%eax +- f4: 5f pop %edi +- f5: 5d pop %ebp +- f6: c3 ret +- f7: 89 f6 mov %esi,%esi +- f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 122: 89 d0 mov %edx,%eax ++ 124: 5f pop %edi ++ 125: 5d pop %ebp ++ 126: c3 ret ++ 127: 89 f6 mov %esi,%esi ++ 129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000100 : ++00000130 : + + char* + strchr(const char *s, char c) + { +- 100: 55 push %ebp +- 101: 89 e5 mov %esp,%ebp +- 103: 8b 45 08 mov 0x8(%ebp),%eax +- 106: 53 push %ebx +- 107: 8b 55 0c mov 0xc(%ebp),%edx ++ 130: 55 push %ebp ++ 131: 89 e5 mov %esp,%ebp ++ 133: 8b 45 08 mov 0x8(%ebp),%eax ++ 136: 53 push %ebx ++ 137: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) +- 10a: 0f b6 18 movzbl (%eax),%ebx +- 10d: 84 db test %bl,%bl +- 10f: 74 1d je 12e ++ 13a: 0f b6 18 movzbl (%eax),%ebx ++ 13d: 84 db test %bl,%bl ++ 13f: 74 1d je 15e + if(*s == c) +- 111: 38 d3 cmp %dl,%bl +- 113: 89 d1 mov %edx,%ecx +- 115: 75 0d jne 124 +- 117: eb 17 jmp 130 +- 119: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- 120: 38 ca cmp %cl,%dl +- 122: 74 0c je 130 ++ 141: 38 d3 cmp %dl,%bl ++ 143: 89 d1 mov %edx,%ecx ++ 145: 75 0d jne 154 ++ 147: eb 17 jmp 160 ++ 149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 150: 38 ca cmp %cl,%dl ++ 152: 74 0c je 160 + for(; *s; s++) +- 124: 83 c0 01 add $0x1,%eax +- 127: 0f b6 10 movzbl (%eax),%edx +- 12a: 84 d2 test %dl,%dl +- 12c: 75 f2 jne 120 ++ 154: 83 c0 01 add $0x1,%eax ++ 157: 0f b6 10 movzbl (%eax),%edx ++ 15a: 84 d2 test %dl,%dl ++ 15c: 75 f2 jne 150 + return (char*)s; + return 0; +- 12e: 31 c0 xor %eax,%eax ++ 15e: 31 c0 xor %eax,%eax + } +- 130: 5b pop %ebx +- 131: 5d pop %ebp +- 132: c3 ret +- 133: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 160: 5b pop %ebx ++ 161: 5d pop %ebp ++ 162: c3 ret ++ 163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000140 : ++00000170 : + + char* + gets(char *buf, int max) + { +- 140: 55 push %ebp +- 141: 89 e5 mov %esp,%ebp +- 143: 57 push %edi +- 144: 56 push %esi ++ 170: 55 push %ebp ++ 171: 89 e5 mov %esp,%ebp ++ 173: 57 push %edi ++ 174: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ +- 145: 31 f6 xor %esi,%esi ++ 175: 31 f6 xor %esi,%esi + { +- 147: 53 push %ebx +- 148: 83 ec 2c sub $0x2c,%esp ++ 177: 53 push %ebx ++ 178: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); +- 14b: 8d 7d e7 lea -0x19(%ebp),%edi ++ 17b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ +- 14e: eb 31 jmp 181 ++ 17e: eb 31 jmp 1b1 + cc = read(0, &c, 1); +- 150: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 157: 00 +- 158: 89 7c 24 04 mov %edi,0x4(%esp) +- 15c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 163: e8 02 01 00 00 call 26a ++ 180: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 187: 00 ++ 188: 89 7c 24 04 mov %edi,0x4(%esp) ++ 18c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 193: e8 02 01 00 00 call 29a + if(cc < 1) +- 168: 85 c0 test %eax,%eax +- 16a: 7e 1d jle 189 ++ 198: 85 c0 test %eax,%eax ++ 19a: 7e 1d jle 1b9 + break; + buf[i++] = c; +- 16c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax ++ 19c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ +- 170: 89 de mov %ebx,%esi ++ 1a0: 89 de mov %ebx,%esi + buf[i++] = c; +- 172: 8b 55 08 mov 0x8(%ebp),%edx ++ 1a2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') +- 175: 3c 0d cmp $0xd,%al ++ 1a5: 3c 0d cmp $0xd,%al + buf[i++] = c; +- 177: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) ++ 1a7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') +- 17b: 74 0c je 189 +- 17d: 3c 0a cmp $0xa,%al +- 17f: 74 08 je 189 ++ 1ab: 74 0c je 1b9 ++ 1ad: 3c 0a cmp $0xa,%al ++ 1af: 74 08 je 1b9 + for(i=0; i+1 < max; ){ +- 181: 8d 5e 01 lea 0x1(%esi),%ebx +- 184: 3b 5d 0c cmp 0xc(%ebp),%ebx +- 187: 7c c7 jl 150 ++ 1b1: 8d 5e 01 lea 0x1(%esi),%ebx ++ 1b4: 3b 5d 0c cmp 0xc(%ebp),%ebx ++ 1b7: 7c c7 jl 180 + break; + } + buf[i] = '\0'; +- 189: 8b 45 08 mov 0x8(%ebp),%eax +- 18c: c6 04 30 00 movb $0x0,(%eax,%esi,1) ++ 1b9: 8b 45 08 mov 0x8(%ebp),%eax ++ 1bc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; + } +- 190: 83 c4 2c add $0x2c,%esp +- 193: 5b pop %ebx +- 194: 5e pop %esi +- 195: 5f pop %edi +- 196: 5d pop %ebp +- 197: c3 ret +- 198: 90 nop +- 199: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 1c0: 83 c4 2c add $0x2c,%esp ++ 1c3: 5b pop %ebx ++ 1c4: 5e pop %esi ++ 1c5: 5f pop %edi ++ 1c6: 5d pop %ebp ++ 1c7: c3 ret ++ 1c8: 90 nop ++ 1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-000001a0 : ++000001d0 : + + int + stat(const char *n, struct stat *st) + { +- 1a0: 55 push %ebp +- 1a1: 89 e5 mov %esp,%ebp +- 1a3: 56 push %esi +- 1a4: 53 push %ebx +- 1a5: 83 ec 10 sub $0x10,%esp ++ 1d0: 55 push %ebp ++ 1d1: 89 e5 mov %esp,%ebp ++ 1d3: 56 push %esi ++ 1d4: 53 push %ebx ++ 1d5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); +- 1a8: 8b 45 08 mov 0x8(%ebp),%eax +- 1ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1b2: 00 +- 1b3: 89 04 24 mov %eax,(%esp) +- 1b6: e8 d7 00 00 00 call 292 ++ 1d8: 8b 45 08 mov 0x8(%ebp),%eax ++ 1db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1e2: 00 ++ 1e3: 89 04 24 mov %eax,(%esp) ++ 1e6: e8 d7 00 00 00 call 2c2 + if(fd < 0) +- 1bb: 85 c0 test %eax,%eax ++ 1eb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); +- 1bd: 89 c3 mov %eax,%ebx ++ 1ed: 89 c3 mov %eax,%ebx + if(fd < 0) +- 1bf: 78 27 js 1e8 ++ 1ef: 78 27 js 218 + return -1; + r = fstat(fd, st); +- 1c1: 8b 45 0c mov 0xc(%ebp),%eax +- 1c4: 89 1c 24 mov %ebx,(%esp) +- 1c7: 89 44 24 04 mov %eax,0x4(%esp) +- 1cb: e8 da 00 00 00 call 2aa ++ 1f1: 8b 45 0c mov 0xc(%ebp),%eax ++ 1f4: 89 1c 24 mov %ebx,(%esp) ++ 1f7: 89 44 24 04 mov %eax,0x4(%esp) ++ 1fb: e8 da 00 00 00 call 2da + close(fd); +- 1d0: 89 1c 24 mov %ebx,(%esp) ++ 200: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); +- 1d3: 89 c6 mov %eax,%esi ++ 203: 89 c6 mov %eax,%esi + close(fd); +- 1d5: e8 a0 00 00 00 call 27a ++ 205: e8 a0 00 00 00 call 2aa + return r; +- 1da: 89 f0 mov %esi,%eax ++ 20a: 89 f0 mov %esi,%eax + } +- 1dc: 83 c4 10 add $0x10,%esp +- 1df: 5b pop %ebx +- 1e0: 5e pop %esi +- 1e1: 5d pop %ebp +- 1e2: c3 ret +- 1e3: 90 nop +- 1e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 20c: 83 c4 10 add $0x10,%esp ++ 20f: 5b pop %ebx ++ 210: 5e pop %esi ++ 211: 5d pop %ebp ++ 212: c3 ret ++ 213: 90 nop ++ 214: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +- 1e8: b8 ff ff ff ff mov $0xffffffff,%eax +- 1ed: eb ed jmp 1dc +- 1ef: 90 nop ++ 218: b8 ff ff ff ff mov $0xffffffff,%eax ++ 21d: eb ed jmp 20c ++ 21f: 90 nop + +-000001f0 : ++00000220 : + + int + atoi(const char *s) + { +- 1f0: 55 push %ebp +- 1f1: 89 e5 mov %esp,%ebp +- 1f3: 8b 4d 08 mov 0x8(%ebp),%ecx +- 1f6: 53 push %ebx ++ 220: 55 push %ebp ++ 221: 89 e5 mov %esp,%ebp ++ 223: 8b 4d 08 mov 0x8(%ebp),%ecx ++ 226: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') +- 1f7: 0f be 11 movsbl (%ecx),%edx +- 1fa: 8d 42 d0 lea -0x30(%edx),%eax +- 1fd: 3c 09 cmp $0x9,%al ++ 227: 0f be 11 movsbl (%ecx),%edx ++ 22a: 8d 42 d0 lea -0x30(%edx),%eax ++ 22d: 3c 09 cmp $0x9,%al + n = 0; +- 1ff: b8 00 00 00 00 mov $0x0,%eax ++ 22f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') +- 204: 77 17 ja 21d +- 206: 66 90 xchg %ax,%ax ++ 234: 77 17 ja 24d ++ 236: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; +- 208: 83 c1 01 add $0x1,%ecx +- 20b: 8d 04 80 lea (%eax,%eax,4),%eax +- 20e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ++ 238: 83 c1 01 add $0x1,%ecx ++ 23b: 8d 04 80 lea (%eax,%eax,4),%eax ++ 23e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') +- 212: 0f be 11 movsbl (%ecx),%edx +- 215: 8d 5a d0 lea -0x30(%edx),%ebx +- 218: 80 fb 09 cmp $0x9,%bl +- 21b: 76 eb jbe 208 ++ 242: 0f be 11 movsbl (%ecx),%edx ++ 245: 8d 5a d0 lea -0x30(%edx),%ebx ++ 248: 80 fb 09 cmp $0x9,%bl ++ 24b: 76 eb jbe 238 + return n; + } +- 21d: 5b pop %ebx +- 21e: 5d pop %ebp +- 21f: c3 ret ++ 24d: 5b pop %ebx ++ 24e: 5d pop %ebp ++ 24f: c3 ret + +-00000220 : ++00000250 : + + void* + memmove(void *vdst, const void *vsrc, int n) + { +- 220: 55 push %ebp ++ 250: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) +- 221: 31 d2 xor %edx,%edx ++ 251: 31 d2 xor %edx,%edx + { +- 223: 89 e5 mov %esp,%ebp +- 225: 56 push %esi +- 226: 8b 45 08 mov 0x8(%ebp),%eax +- 229: 53 push %ebx +- 22a: 8b 5d 10 mov 0x10(%ebp),%ebx +- 22d: 8b 75 0c mov 0xc(%ebp),%esi ++ 253: 89 e5 mov %esp,%ebp ++ 255: 56 push %esi ++ 256: 8b 45 08 mov 0x8(%ebp),%eax ++ 259: 53 push %ebx ++ 25a: 8b 5d 10 mov 0x10(%ebp),%ebx ++ 25d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) +- 230: 85 db test %ebx,%ebx +- 232: 7e 12 jle 246 +- 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 260: 85 db test %ebx,%ebx ++ 262: 7e 12 jle 276 ++ 264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; +- 238: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +- 23c: 88 0c 10 mov %cl,(%eax,%edx,1) +- 23f: 83 c2 01 add $0x1,%edx ++ 268: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx ++ 26c: 88 0c 10 mov %cl,(%eax,%edx,1) ++ 26f: 83 c2 01 add $0x1,%edx + while(n-- > 0) +- 242: 39 da cmp %ebx,%edx +- 244: 75 f2 jne 238 ++ 272: 39 da cmp %ebx,%edx ++ 274: 75 f2 jne 268 + return vdst; + } +- 246: 5b pop %ebx +- 247: 5e pop %esi +- 248: 5d pop %ebp +- 249: c3 ret +- +-0000024a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) +- 24a: b8 01 00 00 00 mov $0x1,%eax +- 24f: cd 40 int $0x40 +- 251: c3 ret +- +-00000252 : +-SYSCALL(exit) +- 252: b8 02 00 00 00 mov $0x2,%eax +- 257: cd 40 int $0x40 +- 259: c3 ret +- +-0000025a : +-SYSCALL(wait) +- 25a: b8 03 00 00 00 mov $0x3,%eax +- 25f: cd 40 int $0x40 +- 261: c3 ret +- +-00000262 : +-SYSCALL(pipe) +- 262: b8 04 00 00 00 mov $0x4,%eax +- 267: cd 40 int $0x40 +- 269: c3 ret +- +-0000026a : +-SYSCALL(read) +- 26a: b8 05 00 00 00 mov $0x5,%eax +- 26f: cd 40 int $0x40 +- 271: c3 ret +- +-00000272 : +-SYSCALL(write) +- 272: b8 10 00 00 00 mov $0x10,%eax +- 277: cd 40 int $0x40 ++ 276: 5b pop %ebx ++ 277: 5e pop %esi ++ 278: 5d pop %ebp + 279: c3 ret + +-0000027a : +-SYSCALL(close) +- 27a: b8 15 00 00 00 mov $0x15,%eax ++0000027a : ++ 27a: b8 01 00 00 00 mov $0x1,%eax + 27f: cd 40 int $0x40 + 281: c3 ret + +-00000282 : +-SYSCALL(kill) +- 282: b8 06 00 00 00 mov $0x6,%eax ++00000282 : ++ 282: b8 02 00 00 00 mov $0x2,%eax + 287: cd 40 int $0x40 + 289: c3 ret + +-0000028a : +-SYSCALL(exec) +- 28a: b8 07 00 00 00 mov $0x7,%eax ++0000028a : ++ 28a: b8 03 00 00 00 mov $0x3,%eax + 28f: cd 40 int $0x40 + 291: c3 ret + +-00000292 : +-SYSCALL(open) +- 292: b8 0f 00 00 00 mov $0xf,%eax ++00000292 : ++ 292: b8 04 00 00 00 mov $0x4,%eax + 297: cd 40 int $0x40 + 299: c3 ret + +-0000029a : +-SYSCALL(mknod) +- 29a: b8 11 00 00 00 mov $0x11,%eax ++0000029a : ++ 29a: b8 05 00 00 00 mov $0x5,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +-000002a2 : +-SYSCALL(unlink) +- 2a2: b8 12 00 00 00 mov $0x12,%eax ++000002a2 : ++ 2a2: b8 10 00 00 00 mov $0x10,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +-000002aa : +-SYSCALL(fstat) +- 2aa: b8 08 00 00 00 mov $0x8,%eax ++000002aa : ++ 2aa: b8 15 00 00 00 mov $0x15,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +-000002b2 : +-SYSCALL(link) +- 2b2: b8 13 00 00 00 mov $0x13,%eax ++000002b2 : ++ 2b2: b8 06 00 00 00 mov $0x6,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +-000002ba : +-SYSCALL(mkdir) +- 2ba: b8 14 00 00 00 mov $0x14,%eax ++000002ba : ++ 2ba: b8 07 00 00 00 mov $0x7,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +-000002c2 : +-SYSCALL(chdir) +- 2c2: b8 09 00 00 00 mov $0x9,%eax ++000002c2 : ++ 2c2: b8 0f 00 00 00 mov $0xf,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +-000002ca : +-SYSCALL(dup) +- 2ca: b8 0a 00 00 00 mov $0xa,%eax ++000002ca : ++ 2ca: b8 11 00 00 00 mov $0x11,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +-000002d2 : +-SYSCALL(getpid) +- 2d2: b8 0b 00 00 00 mov $0xb,%eax ++000002d2 : ++ 2d2: b8 12 00 00 00 mov $0x12,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +-000002da : +-SYSCALL(sbrk) +- 2da: b8 0c 00 00 00 mov $0xc,%eax ++000002da : ++ 2da: b8 08 00 00 00 mov $0x8,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +-000002e2 : +-SYSCALL(sleep) +- 2e2: b8 0d 00 00 00 mov $0xd,%eax ++000002e2 : ++ 2e2: b8 13 00 00 00 mov $0x13,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +-000002ea : +-SYSCALL(uptime) +- 2ea: b8 0e 00 00 00 mov $0xe,%eax ++000002ea : ++ 2ea: b8 14 00 00 00 mov $0x14,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret +- 2f2: 66 90 xchg %ax,%ax +- 2f4: 66 90 xchg %ax,%ax +- 2f6: 66 90 xchg %ax,%ax +- 2f8: 66 90 xchg %ax,%ax +- 2fa: 66 90 xchg %ax,%ax +- 2fc: 66 90 xchg %ax,%ax +- 2fe: 66 90 xchg %ax,%ax +- +-00000300 : ++ ++000002f2 : ++ 2f2: b8 09 00 00 00 mov $0x9,%eax ++ 2f7: cd 40 int $0x40 ++ 2f9: c3 ret ++ ++000002fa : ++ 2fa: b8 0a 00 00 00 mov $0xa,%eax ++ 2ff: cd 40 int $0x40 ++ 301: c3 ret ++ ++00000302 : ++ 302: b8 0b 00 00 00 mov $0xb,%eax ++ 307: cd 40 int $0x40 ++ 309: c3 ret ++ ++0000030a : ++ 30a: b8 0c 00 00 00 mov $0xc,%eax ++ 30f: cd 40 int $0x40 ++ 311: c3 ret ++ ++00000312 : ++ 312: b8 0d 00 00 00 mov $0xd,%eax ++ 317: cd 40 int $0x40 ++ 319: c3 ret ++ ++0000031a : ++ 31a: b8 0e 00 00 00 mov $0xe,%eax ++ 31f: cd 40 int $0x40 ++ 321: c3 ret ++ 322: 66 90 xchg %ax,%ax ++ 324: 66 90 xchg %ax,%ax ++ 326: 66 90 xchg %ax,%ax ++ 328: 66 90 xchg %ax,%ax ++ 32a: 66 90 xchg %ax,%ax ++ 32c: 66 90 xchg %ax,%ax ++ 32e: 66 90 xchg %ax,%ax ++ ++00000330 : + write(fd, &c, 1); + } + + static void + printint(int fd, int xx, int base, int sgn) + { +- 300: 55 push %ebp +- 301: 89 e5 mov %esp,%ebp +- 303: 57 push %edi +- 304: 56 push %esi +- 305: 89 c6 mov %eax,%esi +- 307: 53 push %ebx +- 308: 83 ec 4c sub $0x4c,%esp ++ 330: 55 push %ebp ++ 331: 89 e5 mov %esp,%ebp ++ 333: 57 push %edi ++ 334: 56 push %esi ++ 335: 89 c6 mov %eax,%esi ++ 337: 53 push %ebx ++ 338: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ +- 30b: 8b 5d 08 mov 0x8(%ebp),%ebx +- 30e: 85 db test %ebx,%ebx +- 310: 74 09 je 31b +- 312: 89 d0 mov %edx,%eax +- 314: c1 e8 1f shr $0x1f,%eax +- 317: 84 c0 test %al,%al +- 319: 75 75 jne 390 ++ 33b: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 33e: 85 db test %ebx,%ebx ++ 340: 74 09 je 34b ++ 342: 89 d0 mov %edx,%eax ++ 344: c1 e8 1f shr $0x1f,%eax ++ 347: 84 c0 test %al,%al ++ 349: 75 75 jne 3c0 + neg = 1; + x = -xx; + } else { + x = xx; +- 31b: 89 d0 mov %edx,%eax ++ 34b: 89 d0 mov %edx,%eax + neg = 0; +- 31d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) +- 324: 89 75 c0 mov %esi,-0x40(%ebp) ++ 34d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) ++ 354: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; +- 327: 31 ff xor %edi,%edi +- 329: 89 ce mov %ecx,%esi +- 32b: 8d 5d d7 lea -0x29(%ebp),%ebx +- 32e: eb 02 jmp 332 ++ 357: 31 ff xor %edi,%edi ++ 359: 89 ce mov %ecx,%esi ++ 35b: 8d 5d d7 lea -0x29(%ebp),%ebx ++ 35e: eb 02 jmp 362 + do{ + buf[i++] = digits[x % base]; +- 330: 89 cf mov %ecx,%edi +- 332: 31 d2 xor %edx,%edx +- 334: f7 f6 div %esi +- 336: 8d 4f 01 lea 0x1(%edi),%ecx +- 339: 0f b6 92 1b 07 00 00 movzbl 0x71b(%edx),%edx ++ 360: 89 cf mov %ecx,%edi ++ 362: 31 d2 xor %edx,%edx ++ 364: f7 f6 div %esi ++ 366: 8d 4f 01 lea 0x1(%edi),%ecx ++ 369: 0f b6 92 57 07 00 00 movzbl 0x757(%edx),%edx + }while((x /= base) != 0); +- 340: 85 c0 test %eax,%eax ++ 370: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; +- 342: 88 14 0b mov %dl,(%ebx,%ecx,1) ++ 372: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); +- 345: 75 e9 jne 330 ++ 375: 75 e9 jne 360 + if(neg) +- 347: 8b 55 c4 mov -0x3c(%ebp),%edx ++ 377: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; +- 34a: 89 c8 mov %ecx,%eax +- 34c: 8b 75 c0 mov -0x40(%ebp),%esi ++ 37a: 89 c8 mov %ecx,%eax ++ 37c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) +- 34f: 85 d2 test %edx,%edx +- 351: 74 08 je 35b ++ 37f: 85 d2 test %edx,%edx ++ 381: 74 08 je 38b + buf[i++] = '-'; +- 353: 8d 4f 02 lea 0x2(%edi),%ecx +- 356: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) ++ 383: 8d 4f 02 lea 0x2(%edi),%ecx ++ 386: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) +- 35b: 8d 79 ff lea -0x1(%ecx),%edi +- 35e: 66 90 xchg %ax,%ax +- 360: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax +- 365: 83 ef 01 sub $0x1,%edi ++ 38b: 8d 79 ff lea -0x1(%ecx),%edi ++ 38e: 66 90 xchg %ax,%ax ++ 390: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax ++ 395: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); +- 368: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 36f: 00 +- 370: 89 5c 24 04 mov %ebx,0x4(%esp) +- 374: 89 34 24 mov %esi,(%esp) +- 377: 88 45 d7 mov %al,-0x29(%ebp) +- 37a: e8 f3 fe ff ff call 272 ++ 398: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 39f: 00 ++ 3a0: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 3a4: 89 34 24 mov %esi,(%esp) ++ 3a7: 88 45 d7 mov %al,-0x29(%ebp) ++ 3aa: e8 f3 fe ff ff call 2a2 + while(--i >= 0) +- 37f: 83 ff ff cmp $0xffffffff,%edi +- 382: 75 dc jne 360 ++ 3af: 83 ff ff cmp $0xffffffff,%edi ++ 3b2: 75 dc jne 390 + putc(fd, buf[i]); + } +- 384: 83 c4 4c add $0x4c,%esp +- 387: 5b pop %ebx +- 388: 5e pop %esi +- 389: 5f pop %edi +- 38a: 5d pop %ebp +- 38b: c3 ret +- 38c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3b4: 83 c4 4c add $0x4c,%esp ++ 3b7: 5b pop %ebx ++ 3b8: 5e pop %esi ++ 3b9: 5f pop %edi ++ 3ba: 5d pop %ebp ++ 3bb: c3 ret ++ 3bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; +- 390: 89 d0 mov %edx,%eax +- 392: f7 d8 neg %eax ++ 3c0: 89 d0 mov %edx,%eax ++ 3c2: f7 d8 neg %eax + neg = 1; +- 394: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) +- 39b: eb 87 jmp 324 +- 39d: 8d 76 00 lea 0x0(%esi),%esi ++ 3c4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) ++ 3cb: eb 87 jmp 354 ++ 3cd: 8d 76 00 lea 0x0(%esi),%esi + +-000003a0 : ++000003d0 : + + // Print to the given fd. Only understands %d, %x, %p, %s. + void + printf(int fd, const char *fmt, ...) + { +- 3a0: 55 push %ebp +- 3a1: 89 e5 mov %esp,%ebp +- 3a3: 57 push %edi ++ 3d0: 55 push %ebp ++ 3d1: 89 e5 mov %esp,%ebp ++ 3d3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; +- 3a4: 31 ff xor %edi,%edi ++ 3d4: 31 ff xor %edi,%edi + { +- 3a6: 56 push %esi +- 3a7: 53 push %ebx +- 3a8: 83 ec 3c sub $0x3c,%esp ++ 3d6: 56 push %esi ++ 3d7: 53 push %ebx ++ 3d8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ +- 3ab: 8b 5d 0c mov 0xc(%ebp),%ebx ++ 3db: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; +- 3ae: 8d 45 10 lea 0x10(%ebp),%eax ++ 3de: 8d 45 10 lea 0x10(%ebp),%eax + { +- 3b1: 8b 75 08 mov 0x8(%ebp),%esi ++ 3e1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; +- 3b4: 89 45 d4 mov %eax,-0x2c(%ebp) ++ 3e4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ +- 3b7: 0f b6 13 movzbl (%ebx),%edx +- 3ba: 83 c3 01 add $0x1,%ebx +- 3bd: 84 d2 test %dl,%dl +- 3bf: 75 39 jne 3fa +- 3c1: e9 c2 00 00 00 jmp 488 +- 3c6: 66 90 xchg %ax,%ax ++ 3e7: 0f b6 13 movzbl (%ebx),%edx ++ 3ea: 83 c3 01 add $0x1,%ebx ++ 3ed: 84 d2 test %dl,%dl ++ 3ef: 75 39 jne 42a ++ 3f1: e9 c2 00 00 00 jmp 4b8 ++ 3f6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ +- 3c8: 83 fa 25 cmp $0x25,%edx +- 3cb: 0f 84 bf 00 00 00 je 490 ++ 3f8: 83 fa 25 cmp $0x25,%edx ++ 3fb: 0f 84 bf 00 00 00 je 4c0 + write(fd, &c, 1); +- 3d1: 8d 45 e2 lea -0x1e(%ebp),%eax +- 3d4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 3db: 00 +- 3dc: 89 44 24 04 mov %eax,0x4(%esp) +- 3e0: 89 34 24 mov %esi,(%esp) ++ 401: 8d 45 e2 lea -0x1e(%ebp),%eax ++ 404: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 40b: 00 ++ 40c: 89 44 24 04 mov %eax,0x4(%esp) ++ 410: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); +- 3e3: 88 55 e2 mov %dl,-0x1e(%ebp) ++ 413: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); +- 3e6: e8 87 fe ff ff call 272 +- 3eb: 83 c3 01 add $0x1,%ebx ++ 416: e8 87 fe ff ff call 2a2 ++ 41b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ +- 3ee: 0f b6 53 ff movzbl -0x1(%ebx),%edx +- 3f2: 84 d2 test %dl,%dl +- 3f4: 0f 84 8e 00 00 00 je 488 ++ 41e: 0f b6 53 ff movzbl -0x1(%ebx),%edx ++ 422: 84 d2 test %dl,%dl ++ 424: 0f 84 8e 00 00 00 je 4b8 + if(state == 0){ +- 3fa: 85 ff test %edi,%edi ++ 42a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; +- 3fc: 0f be c2 movsbl %dl,%eax ++ 42c: 0f be c2 movsbl %dl,%eax + if(state == 0){ +- 3ff: 74 c7 je 3c8 ++ 42f: 74 c7 je 3f8 + } + } else if(state == '%'){ +- 401: 83 ff 25 cmp $0x25,%edi +- 404: 75 e5 jne 3eb ++ 431: 83 ff 25 cmp $0x25,%edi ++ 434: 75 e5 jne 41b + if(c == 'd'){ +- 406: 83 fa 64 cmp $0x64,%edx +- 409: 0f 84 31 01 00 00 je 540 ++ 436: 83 fa 64 cmp $0x64,%edx ++ 439: 0f 84 31 01 00 00 je 570 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ +- 40f: 25 f7 00 00 00 and $0xf7,%eax +- 414: 83 f8 70 cmp $0x70,%eax +- 417: 0f 84 83 00 00 00 je 4a0 ++ 43f: 25 f7 00 00 00 and $0xf7,%eax ++ 444: 83 f8 70 cmp $0x70,%eax ++ 447: 0f 84 83 00 00 00 je 4d0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ +- 41d: 83 fa 73 cmp $0x73,%edx +- 420: 0f 84 a2 00 00 00 je 4c8 ++ 44d: 83 fa 73 cmp $0x73,%edx ++ 450: 0f 84 a2 00 00 00 je 4f8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ +- 426: 83 fa 63 cmp $0x63,%edx +- 429: 0f 84 35 01 00 00 je 564 ++ 456: 83 fa 63 cmp $0x63,%edx ++ 459: 0f 84 35 01 00 00 je 594 + putc(fd, *ap); + ap++; + } else if(c == '%'){ +- 42f: 83 fa 25 cmp $0x25,%edx +- 432: 0f 84 e0 00 00 00 je 518 ++ 45f: 83 fa 25 cmp $0x25,%edx ++ 462: 0f 84 e0 00 00 00 je 548 + write(fd, &c, 1); +- 438: 8d 45 e6 lea -0x1a(%ebp),%eax +- 43b: 83 c3 01 add $0x1,%ebx +- 43e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 445: 00 ++ 468: 8d 45 e6 lea -0x1a(%ebp),%eax ++ 46b: 83 c3 01 add $0x1,%ebx ++ 46e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 475: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; +- 446: 31 ff xor %edi,%edi ++ 476: 31 ff xor %edi,%edi + write(fd, &c, 1); +- 448: 89 44 24 04 mov %eax,0x4(%esp) +- 44c: 89 34 24 mov %esi,(%esp) +- 44f: 89 55 d0 mov %edx,-0x30(%ebp) +- 452: c6 45 e6 25 movb $0x25,-0x1a(%ebp) +- 456: e8 17 fe ff ff call 272 ++ 478: 89 44 24 04 mov %eax,0x4(%esp) ++ 47c: 89 34 24 mov %esi,(%esp) ++ 47f: 89 55 d0 mov %edx,-0x30(%ebp) ++ 482: c6 45 e6 25 movb $0x25,-0x1a(%ebp) ++ 486: e8 17 fe ff ff call 2a2 + putc(fd, c); +- 45b: 8b 55 d0 mov -0x30(%ebp),%edx ++ 48b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); +- 45e: 8d 45 e7 lea -0x19(%ebp),%eax +- 461: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 468: 00 +- 469: 89 44 24 04 mov %eax,0x4(%esp) +- 46d: 89 34 24 mov %esi,(%esp) ++ 48e: 8d 45 e7 lea -0x19(%ebp),%eax ++ 491: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 498: 00 ++ 499: 89 44 24 04 mov %eax,0x4(%esp) ++ 49d: 89 34 24 mov %esi,(%esp) + putc(fd, c); +- 470: 88 55 e7 mov %dl,-0x19(%ebp) ++ 4a0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); +- 473: e8 fa fd ff ff call 272 ++ 4a3: e8 fa fd ff ff call 2a2 + for(i = 0; fmt[i]; i++){ +- 478: 0f b6 53 ff movzbl -0x1(%ebx),%edx +- 47c: 84 d2 test %dl,%dl +- 47e: 0f 85 76 ff ff ff jne 3fa +- 484: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 4a8: 0f b6 53 ff movzbl -0x1(%ebx),%edx ++ 4ac: 84 d2 test %dl,%dl ++ 4ae: 0f 85 76 ff ff ff jne 42a ++ 4b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } + } +- 488: 83 c4 3c add $0x3c,%esp +- 48b: 5b pop %ebx +- 48c: 5e pop %esi +- 48d: 5f pop %edi +- 48e: 5d pop %ebp +- 48f: c3 ret ++ 4b8: 83 c4 3c add $0x3c,%esp ++ 4bb: 5b pop %ebx ++ 4bc: 5e pop %esi ++ 4bd: 5f pop %edi ++ 4be: 5d pop %ebp ++ 4bf: c3 ret + state = '%'; +- 490: bf 25 00 00 00 mov $0x25,%edi +- 495: e9 51 ff ff ff jmp 3eb +- 49a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 4c0: bf 25 00 00 00 mov $0x25,%edi ++ 4c5: e9 51 ff ff ff jmp 41b ++ 4ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); +- 4a0: 8b 45 d4 mov -0x2c(%ebp),%eax +- 4a3: b9 10 00 00 00 mov $0x10,%ecx ++ 4d0: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 4d3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; +- 4a8: 31 ff xor %edi,%edi ++ 4d8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); +- 4aa: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 4b1: 8b 10 mov (%eax),%edx +- 4b3: 89 f0 mov %esi,%eax +- 4b5: e8 46 fe ff ff call 300 ++ 4da: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 4e1: 8b 10 mov (%eax),%edx ++ 4e3: 89 f0 mov %esi,%eax ++ 4e5: e8 46 fe ff ff call 330 + ap++; +- 4ba: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 4be: e9 28 ff ff ff jmp 3eb +- 4c3: 90 nop +- 4c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 4ea: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 4ee: e9 28 ff ff ff jmp 41b ++ 4f3: 90 nop ++ 4f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; +- 4c8: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 4f8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; +- 4cb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 4fb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; +- 4cf: 8b 38 mov (%eax),%edi ++ 4ff: 8b 38 mov (%eax),%edi + s = "(null)"; +- 4d1: b8 14 07 00 00 mov $0x714,%eax +- 4d6: 85 ff test %edi,%edi +- 4d8: 0f 44 f8 cmove %eax,%edi ++ 501: b8 50 07 00 00 mov $0x750,%eax ++ 506: 85 ff test %edi,%edi ++ 508: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ +- 4db: 0f b6 07 movzbl (%edi),%eax +- 4de: 84 c0 test %al,%al +- 4e0: 74 2a je 50c +- 4e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 4e8: 88 45 e3 mov %al,-0x1d(%ebp) ++ 50b: 0f b6 07 movzbl (%edi),%eax ++ 50e: 84 c0 test %al,%al ++ 510: 74 2a je 53c ++ 512: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 518: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); +- 4eb: 8d 45 e3 lea -0x1d(%ebp),%eax ++ 51b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; +- 4ee: 83 c7 01 add $0x1,%edi ++ 51e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); +- 4f1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 4f8: 00 +- 4f9: 89 44 24 04 mov %eax,0x4(%esp) +- 4fd: 89 34 24 mov %esi,(%esp) +- 500: e8 6d fd ff ff call 272 ++ 521: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 528: 00 ++ 529: 89 44 24 04 mov %eax,0x4(%esp) ++ 52d: 89 34 24 mov %esi,(%esp) ++ 530: e8 6d fd ff ff call 2a2 + while(*s != 0){ +- 505: 0f b6 07 movzbl (%edi),%eax +- 508: 84 c0 test %al,%al +- 50a: 75 dc jne 4e8 ++ 535: 0f b6 07 movzbl (%edi),%eax ++ 538: 84 c0 test %al,%al ++ 53a: 75 dc jne 518 + state = 0; +- 50c: 31 ff xor %edi,%edi +- 50e: e9 d8 fe ff ff jmp 3eb +- 513: 90 nop +- 514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 53c: 31 ff xor %edi,%edi ++ 53e: e9 d8 fe ff ff jmp 41b ++ 543: 90 nop ++ 544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); +- 518: 8d 45 e5 lea -0x1b(%ebp),%eax ++ 548: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; +- 51b: 31 ff xor %edi,%edi ++ 54b: 31 ff xor %edi,%edi + write(fd, &c, 1); +- 51d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 524: 00 +- 525: 89 44 24 04 mov %eax,0x4(%esp) +- 529: 89 34 24 mov %esi,(%esp) +- 52c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) +- 530: e8 3d fd ff ff call 272 +- 535: e9 b1 fe ff ff jmp 3eb +- 53a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 54d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 554: 00 ++ 555: 89 44 24 04 mov %eax,0x4(%esp) ++ 559: 89 34 24 mov %esi,(%esp) ++ 55c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) ++ 560: e8 3d fd ff ff call 2a2 ++ 565: e9 b1 fe ff ff jmp 41b ++ 56a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); +- 540: 8b 45 d4 mov -0x2c(%ebp),%eax +- 543: b9 0a 00 00 00 mov $0xa,%ecx ++ 570: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 573: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; +- 548: 66 31 ff xor %di,%di ++ 578: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); +- 54b: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 552: 8b 10 mov (%eax),%edx +- 554: 89 f0 mov %esi,%eax +- 556: e8 a5 fd ff ff call 300 ++ 57b: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 582: 8b 10 mov (%eax),%edx ++ 584: 89 f0 mov %esi,%eax ++ 586: e8 a5 fd ff ff call 330 + ap++; +- 55b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 55f: e9 87 fe ff ff jmp 3eb ++ 58b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 58f: e9 87 fe ff ff jmp 41b + putc(fd, *ap); +- 564: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 594: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; +- 567: 31 ff xor %edi,%edi ++ 597: 31 ff xor %edi,%edi + putc(fd, *ap); +- 569: 8b 00 mov (%eax),%eax ++ 599: 8b 00 mov (%eax),%eax + write(fd, &c, 1); +- 56b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 572: 00 +- 573: 89 34 24 mov %esi,(%esp) ++ 59b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 5a2: 00 ++ 5a3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); +- 576: 88 45 e4 mov %al,-0x1c(%ebp) ++ 5a6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); +- 579: 8d 45 e4 lea -0x1c(%ebp),%eax +- 57c: 89 44 24 04 mov %eax,0x4(%esp) +- 580: e8 ed fc ff ff call 272 ++ 5a9: 8d 45 e4 lea -0x1c(%ebp),%eax ++ 5ac: 89 44 24 04 mov %eax,0x4(%esp) ++ 5b0: e8 ed fc ff ff call 2a2 + ap++; +- 585: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 589: e9 5d fe ff ff jmp 3eb +- 58e: 66 90 xchg %ax,%ax ++ 5b5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 5b9: e9 5d fe ff ff jmp 41b ++ 5be: 66 90 xchg %ax,%ax + +-00000590 : ++000005c0 : + static Header base; + static Header *freep; + + void + free(void *ap) + { +- 590: 55 push %ebp ++ 5c0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 591: a1 90 09 00 00 mov 0x990,%eax ++ 5c1: a1 cc 09 00 00 mov 0x9cc,%eax + { +- 596: 89 e5 mov %esp,%ebp +- 598: 57 push %edi +- 599: 56 push %esi +- 59a: 53 push %ebx +- 59b: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 5c6: 89 e5 mov %esp,%ebp ++ 5c8: 57 push %edi ++ 5c9: 56 push %esi ++ 5ca: 53 push %ebx ++ 5cb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 59e: 8b 08 mov (%eax),%ecx ++ 5ce: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; +- 5a0: 8d 53 f8 lea -0x8(%ebx),%edx ++ 5d0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 5a3: 39 d0 cmp %edx,%eax +- 5a5: 72 11 jb 5b8 +- 5a7: 90 nop ++ 5d3: 39 d0 cmp %edx,%eax ++ 5d5: 72 11 jb 5e8 ++ 5d7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 5a8: 39 c8 cmp %ecx,%eax +- 5aa: 72 04 jb 5b0 +- 5ac: 39 ca cmp %ecx,%edx +- 5ae: 72 10 jb 5c0 +- 5b0: 89 c8 mov %ecx,%eax ++ 5d8: 39 c8 cmp %ecx,%eax ++ 5da: 72 04 jb 5e0 ++ 5dc: 39 ca cmp %ecx,%edx ++ 5de: 72 10 jb 5f0 ++ 5e0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 5b2: 39 d0 cmp %edx,%eax ++ 5e2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 5b4: 8b 08 mov (%eax),%ecx ++ 5e4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 5b6: 73 f0 jae 5a8 +- 5b8: 39 ca cmp %ecx,%edx +- 5ba: 72 04 jb 5c0 ++ 5e6: 73 f0 jae 5d8 ++ 5e8: 39 ca cmp %ecx,%edx ++ 5ea: 72 04 jb 5f0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 5bc: 39 c8 cmp %ecx,%eax +- 5be: 72 f0 jb 5b0 ++ 5ec: 39 c8 cmp %ecx,%eax ++ 5ee: 72 f0 jb 5e0 + break; + if(bp + bp->s.size == p->s.ptr){ +- 5c0: 8b 73 fc mov -0x4(%ebx),%esi +- 5c3: 8d 3c f2 lea (%edx,%esi,8),%edi +- 5c6: 39 cf cmp %ecx,%edi +- 5c8: 74 1e je 5e8 ++ 5f0: 8b 73 fc mov -0x4(%ebx),%esi ++ 5f3: 8d 3c f2 lea (%edx,%esi,8),%edi ++ 5f6: 39 cf cmp %ecx,%edi ++ 5f8: 74 1e je 618 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; +- 5ca: 89 4b f8 mov %ecx,-0x8(%ebx) ++ 5fa: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ +- 5cd: 8b 48 04 mov 0x4(%eax),%ecx +- 5d0: 8d 34 c8 lea (%eax,%ecx,8),%esi +- 5d3: 39 f2 cmp %esi,%edx +- 5d5: 74 28 je 5ff ++ 5fd: 8b 48 04 mov 0x4(%eax),%ecx ++ 600: 8d 34 c8 lea (%eax,%ecx,8),%esi ++ 603: 39 f2 cmp %esi,%edx ++ 605: 74 28 je 62f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; +- 5d7: 89 10 mov %edx,(%eax) ++ 607: 89 10 mov %edx,(%eax) + freep = p; +- 5d9: a3 90 09 00 00 mov %eax,0x990 ++ 609: a3 cc 09 00 00 mov %eax,0x9cc + } +- 5de: 5b pop %ebx +- 5df: 5e pop %esi +- 5e0: 5f pop %edi +- 5e1: 5d pop %ebp +- 5e2: c3 ret +- 5e3: 90 nop +- 5e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 60e: 5b pop %ebx ++ 60f: 5e pop %esi ++ 610: 5f pop %edi ++ 611: 5d pop %ebp ++ 612: c3 ret ++ 613: 90 nop ++ 614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; +- 5e8: 03 71 04 add 0x4(%ecx),%esi +- 5eb: 89 73 fc mov %esi,-0x4(%ebx) ++ 618: 03 71 04 add 0x4(%ecx),%esi ++ 61b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; +- 5ee: 8b 08 mov (%eax),%ecx +- 5f0: 8b 09 mov (%ecx),%ecx +- 5f2: 89 4b f8 mov %ecx,-0x8(%ebx) ++ 61e: 8b 08 mov (%eax),%ecx ++ 620: 8b 09 mov (%ecx),%ecx ++ 622: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ +- 5f5: 8b 48 04 mov 0x4(%eax),%ecx +- 5f8: 8d 34 c8 lea (%eax,%ecx,8),%esi +- 5fb: 39 f2 cmp %esi,%edx +- 5fd: 75 d8 jne 5d7 ++ 625: 8b 48 04 mov 0x4(%eax),%ecx ++ 628: 8d 34 c8 lea (%eax,%ecx,8),%esi ++ 62b: 39 f2 cmp %esi,%edx ++ 62d: 75 d8 jne 607 + p->s.size += bp->s.size; +- 5ff: 03 4b fc add -0x4(%ebx),%ecx ++ 62f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; +- 602: a3 90 09 00 00 mov %eax,0x990 ++ 632: a3 cc 09 00 00 mov %eax,0x9cc + p->s.size += bp->s.size; +- 607: 89 48 04 mov %ecx,0x4(%eax) ++ 637: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; +- 60a: 8b 53 f8 mov -0x8(%ebx),%edx +- 60d: 89 10 mov %edx,(%eax) ++ 63a: 8b 53 f8 mov -0x8(%ebx),%edx ++ 63d: 89 10 mov %edx,(%eax) + } +- 60f: 5b pop %ebx +- 610: 5e pop %esi +- 611: 5f pop %edi +- 612: 5d pop %ebp +- 613: c3 ret +- 614: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 61a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi +- +-00000620 : ++ 63f: 5b pop %ebx ++ 640: 5e pop %esi ++ 641: 5f pop %edi ++ 642: 5d pop %ebp ++ 643: c3 ret ++ 644: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 64a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ ++00000650 : + return freep; + } + + void* + malloc(uint nbytes) + { +- 620: 55 push %ebp +- 621: 89 e5 mov %esp,%ebp +- 623: 57 push %edi +- 624: 56 push %esi +- 625: 53 push %ebx +- 626: 83 ec 1c sub $0x1c,%esp ++ 650: 55 push %ebp ++ 651: 89 e5 mov %esp,%ebp ++ 653: 57 push %edi ++ 654: 56 push %esi ++ 655: 53 push %ebx ++ 656: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 629: 8b 45 08 mov 0x8(%ebp),%eax ++ 659: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ +- 62c: 8b 1d 90 09 00 00 mov 0x990,%ebx ++ 65c: 8b 1d cc 09 00 00 mov 0x9cc,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 632: 8d 48 07 lea 0x7(%eax),%ecx +- 635: c1 e9 03 shr $0x3,%ecx ++ 662: 8d 48 07 lea 0x7(%eax),%ecx ++ 665: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ +- 638: 85 db test %ebx,%ebx ++ 668: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 63a: 8d 71 01 lea 0x1(%ecx),%esi ++ 66a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ +- 63d: 0f 84 9b 00 00 00 je 6de +- 643: 8b 13 mov (%ebx),%edx +- 645: 8b 7a 04 mov 0x4(%edx),%edi ++ 66d: 0f 84 9b 00 00 00 je 70e ++ 673: 8b 13 mov (%ebx),%edx ++ 675: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ +- 648: 39 fe cmp %edi,%esi +- 64a: 76 64 jbe 6b0 +- 64c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax ++ 678: 39 fe cmp %edi,%esi ++ 67a: 76 64 jbe 6e0 ++ 67c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) +- 653: bb 00 80 00 00 mov $0x8000,%ebx +- 658: 89 45 e4 mov %eax,-0x1c(%ebp) +- 65b: eb 0e jmp 66b +- 65d: 8d 76 00 lea 0x0(%esi),%esi ++ 683: bb 00 80 00 00 mov $0x8000,%ebx ++ 688: 89 45 e4 mov %eax,-0x1c(%ebp) ++ 68b: eb 0e jmp 69b ++ 68d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ +- 660: 8b 02 mov (%edx),%eax ++ 690: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ +- 662: 8b 78 04 mov 0x4(%eax),%edi +- 665: 39 fe cmp %edi,%esi +- 667: 76 4f jbe 6b8 +- 669: 89 c2 mov %eax,%edx ++ 692: 8b 78 04 mov 0x4(%eax),%edi ++ 695: 39 fe cmp %edi,%esi ++ 697: 76 4f jbe 6e8 ++ 699: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) +- 66b: 3b 15 90 09 00 00 cmp 0x990,%edx +- 671: 75 ed jne 660 ++ 69b: 3b 15 cc 09 00 00 cmp 0x9cc,%edx ++ 6a1: 75 ed jne 690 + if(nu < 4096) +- 673: 8b 45 e4 mov -0x1c(%ebp),%eax +- 676: 81 fe 00 10 00 00 cmp $0x1000,%esi +- 67c: bf 00 10 00 00 mov $0x1000,%edi +- 681: 0f 43 fe cmovae %esi,%edi +- 684: 0f 42 c3 cmovb %ebx,%eax ++ 6a3: 8b 45 e4 mov -0x1c(%ebp),%eax ++ 6a6: 81 fe 00 10 00 00 cmp $0x1000,%esi ++ 6ac: bf 00 10 00 00 mov $0x1000,%edi ++ 6b1: 0f 43 fe cmovae %esi,%edi ++ 6b4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); +- 687: 89 04 24 mov %eax,(%esp) +- 68a: e8 4b fc ff ff call 2da ++ 6b7: 89 04 24 mov %eax,(%esp) ++ 6ba: e8 4b fc ff ff call 30a + if(p == (char*)-1) +- 68f: 83 f8 ff cmp $0xffffffff,%eax +- 692: 74 18 je 6ac ++ 6bf: 83 f8 ff cmp $0xffffffff,%eax ++ 6c2: 74 18 je 6dc + hp->s.size = nu; +- 694: 89 78 04 mov %edi,0x4(%eax) ++ 6c4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); +- 697: 83 c0 08 add $0x8,%eax +- 69a: 89 04 24 mov %eax,(%esp) +- 69d: e8 ee fe ff ff call 590 ++ 6c7: 83 c0 08 add $0x8,%eax ++ 6ca: 89 04 24 mov %eax,(%esp) ++ 6cd: e8 ee fe ff ff call 5c0 + return freep; +- 6a2: 8b 15 90 09 00 00 mov 0x990,%edx ++ 6d2: 8b 15 cc 09 00 00 mov 0x9cc,%edx + if((p = morecore(nunits)) == 0) +- 6a8: 85 d2 test %edx,%edx +- 6aa: 75 b4 jne 660 ++ 6d8: 85 d2 test %edx,%edx ++ 6da: 75 b4 jne 690 + return 0; +- 6ac: 31 c0 xor %eax,%eax +- 6ae: eb 20 jmp 6d0 ++ 6dc: 31 c0 xor %eax,%eax ++ 6de: eb 20 jmp 700 + if(p->s.size >= nunits){ +- 6b0: 89 d0 mov %edx,%eax +- 6b2: 89 da mov %ebx,%edx +- 6b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 6e0: 89 d0 mov %edx,%eax ++ 6e2: 89 da mov %ebx,%edx ++ 6e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) +- 6b8: 39 fe cmp %edi,%esi +- 6ba: 74 1c je 6d8 ++ 6e8: 39 fe cmp %edi,%esi ++ 6ea: 74 1c je 708 + p->s.size -= nunits; +- 6bc: 29 f7 sub %esi,%edi +- 6be: 89 78 04 mov %edi,0x4(%eax) ++ 6ec: 29 f7 sub %esi,%edi ++ 6ee: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; +- 6c1: 8d 04 f8 lea (%eax,%edi,8),%eax ++ 6f1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; +- 6c4: 89 70 04 mov %esi,0x4(%eax) ++ 6f4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; +- 6c7: 89 15 90 09 00 00 mov %edx,0x990 ++ 6f7: 89 15 cc 09 00 00 mov %edx,0x9cc + return (void*)(p + 1); +- 6cd: 83 c0 08 add $0x8,%eax ++ 6fd: 83 c0 08 add $0x8,%eax + } + } +- 6d0: 83 c4 1c add $0x1c,%esp +- 6d3: 5b pop %ebx +- 6d4: 5e pop %esi +- 6d5: 5f pop %edi +- 6d6: 5d pop %ebp +- 6d7: c3 ret ++ 700: 83 c4 1c add $0x1c,%esp ++ 703: 5b pop %ebx ++ 704: 5e pop %esi ++ 705: 5f pop %edi ++ 706: 5d pop %ebp ++ 707: c3 ret + prevp->s.ptr = p->s.ptr; +- 6d8: 8b 08 mov (%eax),%ecx +- 6da: 89 0a mov %ecx,(%edx) +- 6dc: eb e9 jmp 6c7 ++ 708: 8b 08 mov (%eax),%ecx ++ 70a: 89 0a mov %ecx,(%edx) ++ 70c: eb e9 jmp 6f7 + base.s.ptr = freep = prevp = &base; +- 6de: c7 05 90 09 00 00 94 movl $0x994,0x990 +- 6e5: 09 00 00 ++ 70e: c7 05 cc 09 00 00 d0 movl $0x9d0,0x9cc ++ 715: 09 00 00 + base.s.size = 0; +- 6e8: ba 94 09 00 00 mov $0x994,%edx ++ 718: ba d0 09 00 00 mov $0x9d0,%edx + base.s.ptr = freep = prevp = &base; +- 6ed: c7 05 94 09 00 00 94 movl $0x994,0x994 +- 6f4: 09 00 00 ++ 71d: c7 05 d0 09 00 00 d0 movl $0x9d0,0x9d0 ++ 724: 09 00 00 + base.s.size = 0; +- 6f7: c7 05 98 09 00 00 00 movl $0x0,0x998 +- 6fe: 00 00 00 +- 701: e9 46 ff ff ff jmp 64c ++ 727: c7 05 d4 09 00 00 00 movl $0x0,0x9d4 ++ 72e: 00 00 00 ++ 731: e9 46 ff ff ff jmp 67c +diff --git a/hello.c b/hello.c +index 702f187..50e7b29 100644 +--- a/hello.c ++++ b/hello.c +@@ -1,8 +1,11 @@ + #include "types.h" + #include "user.h" + +-int main( int argc, char **argv) { ++int main(int argc, char **argv) ++{ + ++ printf(1, "Waiting...\n"); ++ wait(0); + printf(1, "Hello World!\n"); + exit(0); + } +diff --git a/hello.o b/hello.o +index 1e4d377..a903947 100644 +Binary files a/hello.o and b/hello.o differ +diff --git a/hello.sym b/hello.sym +index 30a2ff2..6040663 100644 +--- a/hello.sym ++++ b/hello.sym +@@ -1,7 +1,7 @@ + 00000000 .text +-00000706 .rodata +-0000072c .eh_frame +-00000990 .bss ++00000736 .rodata ++00000768 .eh_frame ++000009cc .bss + 00000000 .comment + 00000000 .debug_aranges + 00000000 .debug_info +@@ -13,45 +13,45 @@ + 00000000 hello.c + 00000000 ulib.c + 00000000 printf.c +-00000300 printint +-0000071b digits.1354 ++00000330 printint ++00000757 digits.1354 + 00000000 umalloc.c +-00000990 freep +-00000994 base +-00000030 strcpy +-000003a0 printf +-00000220 memmove +-0000029a mknod +-00000140 gets +-000002d2 getpid +-00000620 malloc +-000002e2 sleep +-00000262 pipe +-00000272 write +-000002aa fstat +-00000282 kill +-000002c2 chdir +-0000028a exec +-0000025a wait +-0000026a read +-000002a2 unlink +-0000024a fork +-000002da sbrk +-000002ea uptime +-00000990 __bss_start +-000000e0 memset ++000009cc freep ++000009d0 base ++00000060 strcpy ++000003d0 printf ++00000250 memmove ++000002ca mknod ++00000170 gets ++00000302 getpid ++00000650 malloc ++00000312 sleep ++00000292 pipe ++000002a2 write ++000002da fstat ++000002b2 kill ++000002f2 chdir ++000002ba exec ++0000028a wait ++0000029a read ++000002d2 unlink ++0000027a fork ++0000030a sbrk ++0000031a uptime ++000009cc __bss_start ++00000110 memset + 00000000 main +-00000060 strcmp +-000002ca dup +-000001a0 stat +-00000990 _edata +-0000099c _end +-000002b2 link +-00000252 exit +-000001f0 atoi +-000000b0 strlen +-00000292 open +-00000100 strchr +-000002ba mkdir +-0000027a close +-00000590 free ++00000090 strcmp ++000002fa dup ++000001d0 stat ++000009cc _edata ++000009d8 _end ++000002e2 link ++00000282 exit ++00000220 atoi ++000000e0 strlen ++000002c2 open ++00000130 strchr ++000002ea mkdir ++000002aa close ++000005c0 free +diff --git a/ide.o b/ide.o +index 9f12490..9d86db0 100644 +Binary files a/ide.o and b/ide.o differ +diff --git a/init.asm b/init.asm +index 7cc5afb..a3a86aa 100644 +--- a/init.asm ++++ b/init.asm +@@ -5,11 +5,11 @@ _init: file format elf32-i386 + Disassembly of section .text: + + 00000000
: ++#include "fcntl.h" + +-char *argv[] = { "sh", 0 }; ++char *argv[] = {"sh", 0}; + +-int +-main(void) ++int main(void) + { + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp +@@ -18,25 +18,27 @@ main(void) + 7: 83 ec 10 sub $0x10,%esp + int pid, wpid; + +- if(open("console", O_RDWR) < 0){ ++ if (open("console", O_RDWR) < 0) + a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 11: 00 + 12: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) + 19: e8 64 03 00 00 call 382 + 1e: 85 c0 test %eax,%eax +- 20: 0f 88 ba 00 00 00 js e0 ++ 20: 0f 88 c0 00 00 00 js e6 ++ { + mknod("console", 1, 1); + open("console", O_RDWR); + } +- dup(0); // stdout ++ dup(0); // stdout + 26: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2d: e8 88 03 00 00 call 3ba +- dup(0); // stderr ++ dup(0); // stderr + 32: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 39: e8 7c 03 00 00 call 3ba + 3e: 66 90 xchg %ax,%ax + +- for(;;){ ++ for (;;) ++ { + printf(1, "init: starting sh\n"); + 40: c7 44 24 04 fe 07 00 movl $0x7fe,0x4(%esp) + 47: 00 +@@ -44,73 +46,72 @@ main(void) + 4f: e8 3c 04 00 00 call 490 + pid = fork(); + 54: e8 e1 02 00 00 call 33a +- if(pid < 0){ ++ if (pid < 0) + 59: 85 c0 test %eax,%eax + pid = fork(); + 5b: 89 c3 mov %eax,%ebx +- if(pid < 0){ +- 5d: 78 2d js 8c ++ if (pid < 0) ++ 5d: 78 33 js 92 + 5f: 90 nop ++ { + printf(1, "init: fork failed\n"); + exit(0); + } +- if(pid == 0){ +- 60: 74 4a je ac ++ if (pid == 0) ++ 60: 74 50 je b2 + 62: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ { + exec("sh", argv); + printf(1, "init: exec sh failed\n"); + exit(0); + } +- while((wpid=wait()) >= 0 && wpid != pid) +- 68: e8 dd 02 00 00 call 34a +- 6d: 85 c0 test %eax,%eax +- 6f: 90 nop +- 70: 78 ce js 40 +- 72: 39 d8 cmp %ebx,%eax +- 74: 74 ca je 40 ++ while ((wpid = wait(0)) >= 0 && wpid != pid) ++ 68: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 6f: e8 d6 02 00 00 call 34a ++ 74: 85 c0 test %eax,%eax ++ 76: 78 c8 js 40 ++ 78: 39 d8 cmp %ebx,%eax ++ 7a: 74 c4 je 40 + printf(1, "zombie!\n"); +- 76: c7 44 24 04 3d 08 00 movl $0x83d,0x4(%esp) +- 7d: 00 +- 7e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 85: e8 06 04 00 00 call 490 +- 8a: eb dc jmp 68 ++ 7c: c7 44 24 04 3d 08 00 movl $0x83d,0x4(%esp) ++ 83: 00 ++ 84: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 8b: e8 00 04 00 00 call 490 ++ 90: eb d6 jmp 68 + printf(1, "init: fork failed\n"); +- 8c: c7 44 24 04 11 08 00 movl $0x811,0x4(%esp) +- 93: 00 +- 94: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 9b: e8 f0 03 00 00 call 490 ++ 92: c7 44 24 04 11 08 00 movl $0x811,0x4(%esp) ++ 99: 00 ++ 9a: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ a1: e8 ea 03 00 00 call 490 + exit(0); +- a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- a7: e8 96 02 00 00 call 342 ++ a6: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ ad: e8 90 02 00 00 call 342 + exec("sh", argv); +- ac: c7 44 24 04 c4 0a 00 movl $0xac4,0x4(%esp) +- b3: 00 +- b4: c7 04 24 24 08 00 00 movl $0x824,(%esp) +- bb: e8 ba 02 00 00 call 37a ++ b2: c7 44 24 04 c4 0a 00 movl $0xac4,0x4(%esp) ++ b9: 00 ++ ba: c7 04 24 24 08 00 00 movl $0x824,(%esp) ++ c1: e8 b4 02 00 00 call 37a + printf(1, "init: exec sh failed\n"); +- c0: c7 44 24 04 27 08 00 movl $0x827,0x4(%esp) +- c7: 00 +- c8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- cf: e8 bc 03 00 00 call 490 ++ c6: c7 44 24 04 27 08 00 movl $0x827,0x4(%esp) ++ cd: 00 ++ ce: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ d5: e8 b6 03 00 00 call 490 + exit(0); +- d4: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- db: e8 62 02 00 00 call 342 ++ da: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ e1: e8 5c 02 00 00 call 342 + mknod("console", 1, 1); +- e0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- e7: 00 +- e8: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) +- ef: 00 +- f0: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) +- f7: e8 8e 02 00 00 call 38a ++ e6: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ ed: 00 ++ ee: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) ++ f5: 00 ++ f6: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) ++ fd: e8 88 02 00 00 call 38a + open("console", O_RDWR); +- fc: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) +- 103: 00 +- 104: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) +- 10b: e8 72 02 00 00 call 382 +- 110: e9 11 ff ff ff jmp 26 +- 115: 66 90 xchg %ax,%ax +- 117: 66 90 xchg %ax,%ax +- 119: 66 90 xchg %ax,%ax ++ 102: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) ++ 109: 00 ++ 10a: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) ++ 111: e8 6c 02 00 00 call 382 ++ 116: e9 0b ff ff ff jmp 26 + 11b: 66 90 xchg %ax,%ax + 11d: 66 90 xchg %ax,%ax + 11f: 90 nop +@@ -498,132 +499,106 @@ memmove(void *vdst, const void *vsrc, int n) + 339: c3 ret + + 0000033a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 33a: b8 01 00 00 00 mov $0x1,%eax + 33f: cd 40 int $0x40 + 341: c3 ret + + 00000342 : +-SYSCALL(exit) + 342: b8 02 00 00 00 mov $0x2,%eax + 347: cd 40 int $0x40 + 349: c3 ret + + 0000034a : +-SYSCALL(wait) + 34a: b8 03 00 00 00 mov $0x3,%eax + 34f: cd 40 int $0x40 + 351: c3 ret + + 00000352 : +-SYSCALL(pipe) + 352: b8 04 00 00 00 mov $0x4,%eax + 357: cd 40 int $0x40 + 359: c3 ret + + 0000035a : +-SYSCALL(read) + 35a: b8 05 00 00 00 mov $0x5,%eax + 35f: cd 40 int $0x40 + 361: c3 ret + + 00000362 : +-SYSCALL(write) + 362: b8 10 00 00 00 mov $0x10,%eax + 367: cd 40 int $0x40 + 369: c3 ret + + 0000036a : +-SYSCALL(close) + 36a: b8 15 00 00 00 mov $0x15,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + + 00000372 : +-SYSCALL(kill) + 372: b8 06 00 00 00 mov $0x6,%eax + 377: cd 40 int $0x40 + 379: c3 ret + + 0000037a : +-SYSCALL(exec) + 37a: b8 07 00 00 00 mov $0x7,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + + 00000382 : +-SYSCALL(open) + 382: b8 0f 00 00 00 mov $0xf,%eax + 387: cd 40 int $0x40 + 389: c3 ret + + 0000038a : +-SYSCALL(mknod) + 38a: b8 11 00 00 00 mov $0x11,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + + 00000392 : +-SYSCALL(unlink) + 392: b8 12 00 00 00 mov $0x12,%eax + 397: cd 40 int $0x40 + 399: c3 ret + + 0000039a : +-SYSCALL(fstat) + 39a: b8 08 00 00 00 mov $0x8,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + + 000003a2 : +-SYSCALL(link) + 3a2: b8 13 00 00 00 mov $0x13,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + + 000003aa : +-SYSCALL(mkdir) + 3aa: b8 14 00 00 00 mov $0x14,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + + 000003b2 : +-SYSCALL(chdir) + 3b2: b8 09 00 00 00 mov $0x9,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + + 000003ba : +-SYSCALL(dup) + 3ba: b8 0a 00 00 00 mov $0xa,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + + 000003c2 : +-SYSCALL(getpid) + 3c2: b8 0b 00 00 00 mov $0xb,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + + 000003ca : +-SYSCALL(sbrk) + 3ca: b8 0c 00 00 00 mov $0xc,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + + 000003d2 : +-SYSCALL(sleep) + 3d2: b8 0d 00 00 00 mov $0xd,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + + 000003da : +-SYSCALL(uptime) + 3da: b8 0e 00 00 00 mov $0xe,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret +diff --git a/init.c b/init.c +index dd46de4..b4cf955 100644 +--- a/init.c ++++ b/init.c +@@ -5,33 +5,36 @@ + #include "user.h" + #include "fcntl.h" + +-char *argv[] = { "sh", 0 }; ++char *argv[] = {"sh", 0}; + +-int +-main(void) ++int main(void) + { + int pid, wpid; + +- if(open("console", O_RDWR) < 0){ ++ if (open("console", O_RDWR) < 0) ++ { + mknod("console", 1, 1); + open("console", O_RDWR); + } +- dup(0); // stdout +- dup(0); // stderr ++ dup(0); // stdout ++ dup(0); // stderr + +- for(;;){ ++ for (;;) ++ { + printf(1, "init: starting sh\n"); + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(1, "init: fork failed\n"); + exit(0); + } +- if(pid == 0){ ++ if (pid == 0) ++ { + exec("sh", argv); + printf(1, "init: exec sh failed\n"); + exit(0); + } +- while((wpid=wait()) >= 0 && wpid != pid) ++ while ((wpid = wait(0)) >= 0 && wpid != pid) + printf(1, "zombie!\n"); + } + } +diff --git a/init.o b/init.o +index 6d15620..bfc015b 100644 +Binary files a/init.o and b/init.o differ +diff --git a/ioapic.o b/ioapic.o +index e30cc5a..20496a1 100644 +Binary files a/ioapic.o and b/ioapic.o differ +diff --git a/kalloc.o b/kalloc.o +index 60bb217..470c707 100644 +Binary files a/kalloc.o and b/kalloc.o differ +diff --git a/kbd.o b/kbd.o +index b30e5e6..246ac7a 100644 +Binary files a/kbd.o and b/kbd.o differ +diff --git a/kernel b/kernel +index ab45472..1aa714c 100755 +Binary files a/kernel and b/kernel differ +diff --git a/kernel.asm b/kernel.asm +index e08b9f1..6b1eee2 100644 +--- a/kernel.asm ++++ b/kernel.asm +@@ -11,41 +11,16 @@ Disassembly of section .text: + 8010000b: e4 .byte 0xe4 + + 8010000c : +- +-# Entering xv6 on boot processor, with paging off. +-.globl entry +-entry: +- # Turn on page size extension for 4Mbyte pages +- movl %cr4, %eax + 8010000c: 0f 20 e0 mov %cr4,%eax +- orl $(CR4_PSE), %eax + 8010000f: 83 c8 10 or $0x10,%eax +- movl %eax, %cr4 + 80100012: 0f 22 e0 mov %eax,%cr4 +- # Set page directory +- movl $(V2P_WO(entrypgdir)), %eax + 80100015: b8 00 90 10 00 mov $0x109000,%eax +- movl %eax, %cr3 + 8010001a: 0f 22 d8 mov %eax,%cr3 +- # Turn on paging. +- movl %cr0, %eax + 8010001d: 0f 20 c0 mov %cr0,%eax +- orl $(CR0_PG|CR0_WP), %eax + 80100020: 0d 00 00 01 80 or $0x80010000,%eax +- movl %eax, %cr0 + 80100025: 0f 22 c0 mov %eax,%cr0 +- +- # Set up the stack pointer. +- movl $(stack + KSTACKSIZE), %esp + 80100028: bc c0 b5 10 80 mov $0x8010b5c0,%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 f0 2d 10 80 mov $0x80102df0,%eax +- jmp *%eax + 80100032: ff e0 jmp *%eax + 80100034: 66 90 xchg %ax,%ax + 80100036: 66 90 xchg %ax,%ax +@@ -74,7 +49,7 @@ binit(void) + { + 80100049: 83 ec 14 sub $0x14,%esp + initlock(&bcache.lock, "bcache"); +-8010004c: c7 44 24 04 20 6c 10 movl $0x80106c20,0x4(%esp) ++8010004c: c7 44 24 04 40 6c 10 movl $0x80106c40,0x4(%esp) + 80100053: 80 + 80100054: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) + 8010005b: e8 10 40 00 00 call 80104070 +@@ -99,7 +74,7 @@ binit(void) + 8010008a: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) + initsleeplock(&b->lock, "buffer"); + 80100091: 89 04 24 mov %eax,(%esp) +-80100094: c7 44 24 04 27 6c 10 movl $0x80106c27,0x4(%esp) ++80100094: c7 44 24 04 47 6c 10 movl $0x80106c47,0x4(%esp) + 8010009b: 80 + 8010009c: e8 9f 3e 00 00 call 80103f40 + bcache.head.next->prev = b; +@@ -210,7 +185,7 @@ bread(uint dev, uint blockno) + 80100186: 5d pop %ebp + 80100187: c3 ret + panic("bget: no buffers"); +-80100188: c7 04 24 2e 6c 10 80 movl $0x80106c2e,(%esp) ++80100188: c7 04 24 4e 6c 10 80 movl $0x80106c4e,(%esp) + 8010018f: e8 cc 01 00 00 call 80100360 + 80100194: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 8010019a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi +@@ -244,7 +219,7 @@ bwrite(struct buf *b) + iderw(b); + 801001c4: e9 57 1f 00 00 jmp 80102120 + panic("bwrite"); +-801001c9: c7 04 24 3f 6c 10 80 movl $0x80106c3f,(%esp) ++801001c9: c7 04 24 5f 6c 10 80 movl $0x80106c5f,(%esp) + 801001d0: e8 8b 01 00 00 call 80100360 + 801001d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -313,7 +288,7 @@ brelse(struct buf *b) + release(&bcache.lock); + 80100250: e9 fb 3f 00 00 jmp 80104250 + panic("brelse"); +-80100255: c7 04 24 46 6c 10 80 movl $0x80106c46,(%esp) ++80100255: c7 04 24 66 6c 10 80 movl $0x80106c66,(%esp) + 8010025c: e8 ff 00 00 00 call 80100360 + 80100261: 66 90 xchg %ax,%ax + 80100263: 66 90 xchg %ax,%ax +@@ -471,7 +446,7 @@ cli(void) + cprintf("lapicid %d: panic: ", lapicid()); + 80100376: e8 e5 23 00 00 call 80102760 + 8010037b: 8d 75 f8 lea -0x8(%ebp),%esi +-8010037e: c7 04 24 4d 6c 10 80 movl $0x80106c4d,(%esp) ++8010037e: c7 04 24 6d 6c 10 80 movl $0x80106c6d,(%esp) + 80100385: 89 44 24 04 mov %eax,0x4(%esp) + 80100389: e8 c2 02 00 00 call 80100650 + cprintf(s); +@@ -479,7 +454,7 @@ cli(void) + 80100391: 89 04 24 mov %eax,(%esp) + 80100394: e8 b7 02 00 00 call 80100650 + cprintf("\n"); +-80100399: c7 04 24 97 75 10 80 movl $0x80107597,(%esp) ++80100399: c7 04 24 b7 75 10 80 movl $0x801075b7,(%esp) + 801003a0: e8 ab 02 00 00 call 80100650 + getcallerpcs(&s, pcs); + 801003a5: 8d 45 08 lea 0x8(%ebp),%eax +@@ -490,7 +465,7 @@ cli(void) + cprintf(" %p", pcs[i]); + 801003b8: 8b 03 mov (%ebx),%eax + 801003ba: 83 c3 04 add $0x4,%ebx +-801003bd: c7 04 24 61 6c 10 80 movl $0x80106c61,(%esp) ++801003bd: c7 04 24 81 6c 10 80 movl $0x80106c81,(%esp) + 801003c4: 89 44 24 04 mov %eax,0x4(%esp) + 801003c8: e8 83 02 00 00 call 80100650 + for(i=0; i<10; i++) +@@ -523,7 +498,7 @@ cli(void) + 80100400: 0f 84 ac 00 00 00 je 801004b2 + uartputc(c); + 80100406: 89 04 24 mov %eax,(%esp) +-80100409: e8 72 53 00 00 call 80105780 ++80100409: e8 a2 53 00 00 call 801057b0 + asm volatile("out %0,%1" : : "a" (data), "d" (port)); + 8010040e: bf d4 03 00 00 mov $0x3d4,%edi + 80100413: b8 0e 00 00 00 mov $0xe,%eax +@@ -595,11 +570,11 @@ cli(void) + 801004b1: c3 ret + uartputc('\b'); uartputc(' '); uartputc('\b'); + 801004b2: c7 04 24 08 00 00 00 movl $0x8,(%esp) +-801004b9: e8 c2 52 00 00 call 80105780 ++801004b9: e8 f2 52 00 00 call 801057b0 + 801004be: c7 04 24 20 00 00 00 movl $0x20,(%esp) +-801004c5: e8 b6 52 00 00 call 80105780 ++801004c5: e8 e6 52 00 00 call 801057b0 + 801004ca: c7 04 24 08 00 00 00 movl $0x8,(%esp) +-801004d1: e8 aa 52 00 00 call 80105780 ++801004d1: e8 da 52 00 00 call 801057b0 + 801004d6: e9 33 ff ff ff jmp 8010040e + memmove(crt, crt+80, sizeof(crt[0])*23*80); + 801004db: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp) +@@ -627,7 +602,7 @@ cli(void) + 80100520: be 07 00 00 00 mov $0x7,%esi + 80100525: e9 59 ff ff ff jmp 80100483 + panic("pos under/overflow"); +-8010052a: c7 04 24 65 6c 10 80 movl $0x80106c65,(%esp) ++8010052a: c7 04 24 85 6c 10 80 movl $0x80106c85,(%esp) + 80100531: e8 2a fe ff ff call 80100360 + if(pos > 0) --pos; + 80100536: 85 c9 test %ecx,%ecx +@@ -674,7 +649,7 @@ cli(void) + 80100592: 31 d2 xor %edx,%edx + 80100594: f7 f6 div %esi + 80100596: 8d 59 01 lea 0x1(%ecx),%ebx +-80100599: 0f b6 92 90 6c 10 80 movzbl -0x7fef9370(%edx),%edx ++80100599: 0f b6 92 b0 6c 10 80 movzbl -0x7fef9350(%edx),%edx + }while((x /= base) != 0); + 801005a0: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; +@@ -890,7 +865,7 @@ consolewrite(struct inode *ip, char *buf, int n) + 8010075b: 8b 36 mov (%esi),%esi + 8010075d: 89 45 e4 mov %eax,-0x1c(%ebp) + s = "(null)"; +-80100760: b8 78 6c 10 80 mov $0x80106c78,%eax ++80100760: b8 98 6c 10 80 mov $0x80106c98,%eax + 80100765: 85 f6 test %esi,%esi + 80100767: 0f 44 f0 cmove %eax,%esi + for(; *s; s++) +@@ -914,7 +889,7 @@ consolewrite(struct inode *ip, char *buf, int n) + 80100797: e8 44 3a 00 00 call 801041e0 + 8010079c: e9 c8 fe ff ff jmp 80100669 + panic("null fmt"); +-801007a1: c7 04 24 7f 6c 10 80 movl $0x80106c7f,(%esp) ++801007a1: c7 04 24 9f 6c 10 80 movl $0x80106c9f,(%esp) + 801007a8: e8 b3 fb ff ff call 80100360 + 801007ad: 8d 76 00 lea 0x0(%esi),%esi + +@@ -1077,7 +1052,7 @@ consoleinit(void) + 80100951: 89 e5 mov %esp,%ebp + 80100953: 83 ec 18 sub $0x18,%esp + initlock(&cons.lock, "console"); +-80100956: c7 44 24 04 88 6c 10 movl $0x80106c88,0x4(%esp) ++80100956: c7 44 24 04 a8 6c 10 movl $0x80106ca8,0x4(%esp) + 8010095d: 80 + 8010095e: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) + 80100965: e8 06 37 00 00 call 80104070 +@@ -1185,7 +1160,7 @@ exec(char *path, char **argv) + 80100a27: 45 4c 46 + 80100a2a: 75 d4 jne 80100a00 + if((pgdir = setupkvm()) == 0) +-80100a2c: e8 3f 5f 00 00 call 80106970 ++80100a2c: e8 6f 5f 00 00 call 801069a0 + 80100a31: 85 c0 test %eax,%eax + 80100a33: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) + 80100a39: 74 c5 je 80100a00 +@@ -1232,7 +1207,7 @@ exec(char *path, char **argv) + 80100ac5: 89 44 24 04 mov %eax,0x4(%esp) + 80100ac9: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax + 80100acf: 89 04 24 mov %eax,(%esp) +-80100ad2: e8 09 5d 00 00 call 801067e0 ++80100ad2: e8 39 5d 00 00 call 80106810 + 80100ad7: 85 c0 test %eax,%eax + 80100ad9: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) + 80100adf: 74 3f je 80100b20 +@@ -1249,13 +1224,13 @@ exec(char *path, char **argv) + 80100b06: 8b 95 08 ff ff ff mov -0xf8(%ebp),%edx + 80100b0c: 89 04 24 mov %eax,(%esp) + 80100b0f: 89 54 24 0c mov %edx,0xc(%esp) +-80100b13: e8 08 5c 00 00 call 80106720 ++80100b13: e8 38 5c 00 00 call 80106750 + 80100b18: 85 c0 test %eax,%eax + 80100b1a: 0f 89 40 ff ff ff jns 80100a60 + freevm(pgdir); + 80100b20: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax + 80100b26: 89 04 24 mov %eax,(%esp) +-80100b29: e8 c2 5d 00 00 call 801068f0 ++80100b29: e8 f2 5d 00 00 call 80106920 + 80100b2e: e9 cd fe ff ff jmp 80100a00 + iunlockput(ip); + 80100b33: 89 1c 24 mov %ebx,(%esp) +@@ -1274,21 +1249,21 @@ exec(char *path, char **argv) + 80100b5f: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax + 80100b65: 89 54 24 08 mov %edx,0x8(%esp) + 80100b69: 89 04 24 mov %eax,(%esp) +-80100b6c: e8 6f 5c 00 00 call 801067e0 ++80100b6c: e8 9f 5c 00 00 call 80106810 + 80100b71: 85 c0 test %eax,%eax + 80100b73: 89 85 e8 fe ff ff mov %eax,-0x118(%ebp) + 80100b79: 75 33 jne 80100bae + freevm(pgdir); + 80100b7b: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax + 80100b81: 89 04 24 mov %eax,(%esp) +-80100b84: e8 67 5d 00 00 call 801068f0 ++80100b84: e8 97 5d 00 00 call 80106920 + return -1; + 80100b89: b8 ff ff ff ff mov $0xffffffff,%eax + 80100b8e: e9 7f fe ff ff jmp 80100a12 + end_op(); + 80100b93: e8 e8 1f 00 00 call 80102b80 + cprintf("exec: fail\n"); +-80100b98: c7 04 24 a1 6c 10 80 movl $0x80106ca1,(%esp) ++80100b98: c7 04 24 c1 6c 10 80 movl $0x80106cc1,(%esp) + 80100b9f: e8 ac fa ff ff call 80100650 + return -1; + 80100ba4: b8 ff ff ff ff mov $0xffffffff,%eax +@@ -1300,7 +1275,7 @@ exec(char *path, char **argv) + 80100bbb: 89 44 24 04 mov %eax,0x4(%esp) + 80100bbf: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax + 80100bc5: 89 04 24 mov %eax,(%esp) +-80100bc8: e8 53 5e 00 00 call 80106a20 ++80100bc8: e8 83 5e 00 00 call 80106a50 + for(argc = 0; argv[argc]; argc++) { + 80100bcd: 8b 45 0c mov 0xc(%ebp),%eax + 80100bd0: 8b 00 mov (%eax),%eax +@@ -1340,7 +1315,7 @@ exec(char *path, char **argv) + 80100c24: 89 44 24 08 mov %eax,0x8(%esp) + 80100c28: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax + 80100c2e: 89 04 24 mov %eax,(%esp) +-80100c31: e8 4a 5f 00 00 call 80106b80 ++80100c31: e8 7a 5f 00 00 call 80106bb0 + 80100c36: 85 c0 test %eax,%eax + 80100c38: 0f 88 3d ff ff ff js 80100b7b + for(argc = 0; argv[argc]; argc++) { +@@ -1381,7 +1356,7 @@ exec(char *path, char **argv) + ustack[2] = sp - (argc+1)*4; // argv pointer + 80100c9e: 89 95 60 ff ff ff mov %edx,-0xa0(%ebp) + if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) +-80100ca4: e8 d7 5e 00 00 call 80106b80 ++80100ca4: e8 07 5f 00 00 call 80106bb0 + 80100ca9: 85 c0 test %eax,%eax + 80100cab: 0f 88 ca fe ff ff js 80100b7b + for(last=s=path; *s; s++) +@@ -1431,10 +1406,10 @@ exec(char *path, char **argv) + 80100d19: 89 58 44 mov %ebx,0x44(%eax) + switchuvm(curproc); + 80100d1c: 89 3c 24 mov %edi,(%esp) +-80100d1f: e8 6c 58 00 00 call 80106590 ++80100d1f: e8 9c 58 00 00 call 801065c0 + freevm(oldpgdir); + 80100d24: 89 34 24 mov %esi,(%esp) +-80100d27: e8 c4 5b 00 00 call 801068f0 ++80100d27: e8 f4 5b 00 00 call 80106920 + return 0; + 80100d2c: 31 c0 xor %eax,%eax + 80100d2e: e9 df fc ff ff jmp 80100a12 +@@ -1460,7 +1435,7 @@ fileinit(void) + 80100d51: 89 e5 mov %esp,%ebp + 80100d53: 83 ec 18 sub $0x18,%esp + initlock(&ftable.lock, "ftable"); +-80100d56: c7 44 24 04 ad 6c 10 movl $0x80106cad,0x4(%esp) ++80100d56: c7 44 24 04 cd 6c 10 movl $0x80106ccd,0x4(%esp) + 80100d5d: 80 + 80100d5e: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) + 80100d65: e8 06 33 00 00 call 80104070 +@@ -1566,7 +1541,7 @@ filedup(struct file *f) + 80100e15: 5d pop %ebp + 80100e16: c3 ret + panic("filedup"); +-80100e17: c7 04 24 b4 6c 10 80 movl $0x80106cb4,(%esp) ++80100e17: c7 04 24 d4 6c 10 80 movl $0x80106cd4,(%esp) + 80100e1e: e8 3d f5 ff ff call 80100360 + 80100e23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 80100e29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -1665,7 +1640,7 @@ fileclose(struct file *f) + end_op(); + 80100ed7: e9 a4 1c 00 00 jmp 80102b80 + panic("fileclose"); +-80100edc: c7 04 24 bc 6c 10 80 movl $0x80106cbc,(%esp) ++80100edc: c7 04 24 dc 6c 10 80 movl $0x80106cdc,(%esp) + 80100ee3: e8 78 f4 ff ff call 80100360 + 80100ee8: 90 nop + 80100ee9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +@@ -1799,7 +1774,7 @@ fileread(struct file *f, char *addr, int n) + 80100fc0: b8 ff ff ff ff mov $0xffffffff,%eax + 80100fc5: eb d8 jmp 80100f9f + panic("fileread"); +-80100fc7: c7 04 24 c6 6c 10 80 movl $0x80106cc6,(%esp) ++80100fc7: c7 04 24 e6 6c 10 80 movl $0x80106ce6,(%esp) + 80100fce: e8 8d f3 ff ff call 80100360 + 80100fd3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 80100fd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -1951,10 +1926,10 @@ filewrite(struct file *f, char *addr, int n) + return pipewrite(f->pipe, addr, n); + 801010dc: e9 0f 22 00 00 jmp 801032f0 + panic("short filewrite"); +-801010e1: c7 04 24 cf 6c 10 80 movl $0x80106ccf,(%esp) ++801010e1: c7 04 24 ef 6c 10 80 movl $0x80106cef,(%esp) + 801010e8: e8 73 f2 ff ff call 80100360 + panic("filewrite"); +-801010ed: c7 04 24 d5 6c 10 80 movl $0x80106cd5,(%esp) ++801010ed: c7 04 24 f5 6c 10 80 movl $0x80106cf5,(%esp) + 801010f4: e8 67 f2 ff ff call 80100360 + 801010f9: 66 90 xchg %ax,%ax + 801010fb: 66 90 xchg %ax,%ax +@@ -2026,7 +2001,7 @@ bfree(int dev, uint b) + 80101163: 5d pop %ebp + 80101164: c3 ret + panic("freeing free block"); +-80101165: c7 04 24 df 6c 10 80 movl $0x80106cdf,(%esp) ++80101165: c7 04 24 ff 6c 10 80 movl $0x80106cff,(%esp) + 8010116c: e8 ef f1 ff ff call 80100360 + 80101171: eb 0d jmp 80101180 + 80101173: 90 nop +@@ -2109,7 +2084,7 @@ bfree(int dev, uint b) + 80101219: 3b 05 c0 09 11 80 cmp 0x801109c0,%eax + 8010121f: 0f 82 7b ff ff ff jb 801011a0 + panic("balloc: out of blocks"); +-80101225: c7 04 24 f2 6c 10 80 movl $0x80106cf2,(%esp) ++80101225: c7 04 24 12 6d 10 80 movl $0x80106d12,(%esp) + 8010122c: e8 2f f1 ff ff call 80100360 + 80101231: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + bp->data[bi/8] |= m; // Mark block in use. +@@ -2264,7 +2239,7 @@ iget(uint dev, uint inum) + 8010134b: 5d pop %ebp + 8010134c: c3 ret + panic("iget: no inodes"); +-8010134d: c7 04 24 08 6d 10 80 movl $0x80106d08,(%esp) ++8010134d: c7 04 24 28 6d 10 80 movl $0x80106d28,(%esp) + 80101354: e8 07 f0 ff ff call 80100360 + 80101359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +@@ -2370,7 +2345,7 @@ bmap(struct inode *ip, uint bn) + 801013ff: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx) + 80101405: eb 93 jmp 8010139a + panic("bmap: out of range"); +-80101407: c7 04 24 18 6d 10 80 movl $0x80106d18,(%esp) ++80101407: c7 04 24 38 6d 10 80 movl $0x80106d38,(%esp) + 8010140e: e8 4d ef ff ff call 80100360 + 80101413: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 80101419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -2421,14 +2396,14 @@ bmap(struct inode *ip, uint bn) + 80101474: bb 20 0a 11 80 mov $0x80110a20,%ebx + 80101479: 83 ec 24 sub $0x24,%esp + initlock(&icache.lock, "icache"); +-8010147c: c7 44 24 04 2b 6d 10 movl $0x80106d2b,0x4(%esp) ++8010147c: c7 44 24 04 4b 6d 10 movl $0x80106d4b,0x4(%esp) + 80101483: 80 + 80101484: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) + 8010148b: e8 e0 2b 00 00 call 80104070 + initsleeplock(&icache.inode[i].lock, "inode"); + 80101490: 89 1c 24 mov %ebx,(%esp) + 80101493: 81 c3 90 00 00 00 add $0x90,%ebx +-80101499: c7 44 24 04 32 6d 10 movl $0x80106d32,0x4(%esp) ++80101499: c7 44 24 04 52 6d 10 movl $0x80106d52,0x4(%esp) + 801014a0: 80 + 801014a1: e8 9a 2a 00 00 call 80103f40 + for(i = 0; i < NINODE; i++) { +@@ -2442,7 +2417,7 @@ bmap(struct inode *ip, uint bn) + 801014bc: e8 5f ff ff ff call 80101420 + cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ + 801014c1: a1 d8 09 11 80 mov 0x801109d8,%eax +-801014c6: c7 04 24 98 6d 10 80 movl $0x80106d98,(%esp) ++801014c6: c7 04 24 b8 6d 10 80 movl $0x80106db8,(%esp) + 801014cd: 89 44 24 1c mov %eax,0x1c(%esp) + 801014d1: a1 d4 09 11 80 mov 0x801109d4,%eax + 801014d6: 89 44 24 18 mov %eax,0x18(%esp) +@@ -2553,7 +2528,7 @@ bmap(struct inode *ip, uint bn) + return iget(dev, inum); + 801015dc: e9 bf fc ff ff jmp 801012a0 + panic("ialloc: no inodes"); +-801015e1: c7 04 24 38 6d 10 80 movl $0x80106d38,(%esp) ++801015e1: c7 04 24 58 6d 10 80 movl $0x80106d58,(%esp) + 801015e8: e8 73 ed ff ff call 80100360 + 801015ed: 8d 76 00 lea 0x0(%esi),%esi + +@@ -2724,10 +2699,10 @@ bmap(struct inode *ip, uint bn) + if(ip->type == 0) + 80101764: 0f 85 76 ff ff ff jne 801016e0 + panic("ilock: no type"); +-8010176a: c7 04 24 50 6d 10 80 movl $0x80106d50,(%esp) ++8010176a: c7 04 24 70 6d 10 80 movl $0x80106d70,(%esp) + 80101771: e8 ea eb ff ff call 80100360 + panic("ilock"); +-80101776: c7 04 24 4a 6d 10 80 movl $0x80106d4a,(%esp) ++80101776: c7 04 24 6a 6d 10 80 movl $0x80106d6a,(%esp) + 8010177d: e8 de eb ff ff call 80100360 + 80101782: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 80101789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -2761,7 +2736,7 @@ bmap(struct inode *ip, uint bn) + releasesleep(&ip->lock); + 801017be: e9 1d 28 00 00 jmp 80103fe0 + panic("iunlock"); +-801017c3: c7 04 24 5f 6d 10 80 movl $0x80106d5f,(%esp) ++801017c3: c7 04 24 7f 6d 10 80 movl $0x80106d7f,(%esp) + 801017ca: e8 91 eb ff ff call 80100360 + 801017cf: 90 nop + +@@ -3379,10 +3354,10 @@ dirlookup(struct inode *dp, char *name, uint *poff) + 80101c60: 5d pop %ebp + 80101c61: c3 ret + panic("dirlookup read"); +-80101c62: c7 04 24 79 6d 10 80 movl $0x80106d79,(%esp) ++80101c62: c7 04 24 99 6d 10 80 movl $0x80106d99,(%esp) + 80101c69: e8 f2 e6 ff ff call 80100360 + panic("dirlookup not DIR"); +-80101c6e: c7 04 24 67 6d 10 80 movl $0x80106d67,(%esp) ++80101c6e: c7 04 24 87 6d 10 80 movl $0x80106d87,(%esp) + 80101c75: e8 e6 e6 ff ff call 80100360 + 80101c7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +@@ -3674,10 +3649,10 @@ namex(char *path, int nameiparent, char *name) + 80101ede: b8 ff ff ff ff mov $0xffffffff,%eax + 80101ee3: eb e9 jmp 80101ece + panic("dirlink read"); +-80101ee5: c7 04 24 88 6d 10 80 movl $0x80106d88,(%esp) ++80101ee5: c7 04 24 a8 6d 10 80 movl $0x80106da8,(%esp) + 80101eec: e8 6f e4 ff ff call 80100360 + panic("dirlink"); +-80101ef1: c7 04 24 7e 73 10 80 movl $0x8010737e,(%esp) ++80101ef1: c7 04 24 9e 73 10 80 movl $0x8010739e,(%esp) + 80101ef8: e8 63 e4 ff ff call 80100360 + 80101efd: 8d 76 00 lea 0x0(%esi),%esi + +@@ -3823,10 +3798,10 @@ idestart(struct buf *b) + 80101fdd: 5d pop %ebp + 80101fde: c3 ret + panic("incorrect blockno"); +-80101fdf: c7 04 24 f4 6d 10 80 movl $0x80106df4,(%esp) ++80101fdf: c7 04 24 14 6e 10 80 movl $0x80106e14,(%esp) + 80101fe6: e8 75 e3 ff ff call 80100360 + panic("idestart"); +-80101feb: c7 04 24 eb 6d 10 80 movl $0x80106deb,(%esp) ++80101feb: c7 04 24 0b 6e 10 80 movl $0x80106e0b,(%esp) + 80101ff2: e8 69 e3 ff ff call 80100360 + 80101ff7: 89 f6 mov %esi,%esi + 80101ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -3837,7 +3812,7 @@ idestart(struct buf *b) + 80102001: 89 e5 mov %esp,%ebp + 80102003: 83 ec 18 sub $0x18,%esp + initlock(&idelock, "ide"); +-80102006: c7 44 24 04 06 6e 10 movl $0x80106e06,0x4(%esp) ++80102006: c7 44 24 04 26 6e 10 movl $0x80106e26,0x4(%esp) + 8010200d: 80 + 8010200e: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp) + 80102015: e8 56 20 00 00 call 80104070 +@@ -4076,13 +4051,13 @@ iderw(struct buf *b) + 801021d4: e8 67 fd ff ff call 80101f40 + 801021d9: eb bb jmp 80102196 + panic("iderw: buf not locked"); +-801021db: c7 04 24 0a 6e 10 80 movl $0x80106e0a,(%esp) ++801021db: c7 04 24 2a 6e 10 80 movl $0x80106e2a,(%esp) + 801021e2: e8 79 e1 ff ff call 80100360 + panic("iderw: ide disk 1 not present"); +-801021e7: c7 04 24 35 6e 10 80 movl $0x80106e35,(%esp) ++801021e7: c7 04 24 55 6e 10 80 movl $0x80106e55,(%esp) + 801021ee: e8 6d e1 ff ff call 80100360 + panic("iderw: nothing to do"); +-801021f3: c7 04 24 20 6e 10 80 movl $0x80106e20,(%esp) ++801021f3: c7 04 24 40 6e 10 80 movl $0x80106e40,(%esp) + 801021fa: e8 61 e1 ff ff call 80100360 + 801021ff: 90 nop + +@@ -4128,7 +4103,7 @@ ioapicinit(void) + 80102244: 39 c2 cmp %eax,%edx + 80102246: 74 12 je 8010225a + cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); +-80102248: c7 04 24 54 6e 10 80 movl $0x80106e54,(%esp) ++80102248: c7 04 24 74 6e 10 80 movl $0x80106e74,(%esp) + 8010224f: e8 fc e3 ff ff call 80100650 + 80102254: 8b 1d 34 26 11 80 mov 0x80112634,%ebx + 8010225a: ba 10 00 00 00 mov $0x10,%edx +@@ -4301,7 +4276,7 @@ kfree(char *v) + 80102377: e8 64 1e 00 00 call 801041e0 + 8010237c: eb bb jmp 80102339 + panic("kfree"); +-8010237e: c7 04 24 86 6e 10 80 movl $0x80106e86,(%esp) ++8010237e: c7 04 24 a6 6e 10 80 movl $0x80106ea6,(%esp) + 80102385: e8 d6 df ff ff call 80100360 + 8010238a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +@@ -4352,7 +4327,7 @@ kfree(char *v) + 801023e5: 83 ec 10 sub $0x10,%esp + 801023e8: 8b 75 0c mov 0xc(%ebp),%esi + initlock(&kmem.lock, "kmem"); +-801023eb: c7 44 24 04 8c 6e 10 movl $0x80106e8c,0x4(%esp) ++801023eb: c7 44 24 04 ac 6e 10 movl $0x80106eac,0x4(%esp) + 801023f2: 80 + 801023f3: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) + 801023fa: e8 71 1c 00 00 call 80104070 +@@ -4515,7 +4490,7 @@ kalloc(void) + 8010252f: 89 c1 mov %eax,%ecx + 80102531: 83 e1 7f and $0x7f,%ecx + shift &= ~(shiftcode[data] | E0ESC); +-80102534: 0f b6 81 c0 6f 10 80 movzbl -0x7fef9040(%ecx),%eax ++80102534: 0f b6 81 e0 6f 10 80 movzbl -0x7fef9020(%ecx),%eax + 8010253b: 83 c8 40 or $0x40,%eax + 8010253e: 0f b6 c0 movzbl %al,%eax + 80102541: f7 d0 not %eax +@@ -4543,9 +4518,9 @@ kalloc(void) + } + + shift |= shiftcode[data]; +-80102568: 0f b6 91 c0 6f 10 80 movzbl -0x7fef9040(%ecx),%edx ++80102568: 0f b6 91 e0 6f 10 80 movzbl -0x7fef9020(%ecx),%edx + shift ^= togglecode[data]; +-8010256f: 0f b6 81 c0 6e 10 80 movzbl -0x7fef9140(%ecx),%eax ++8010256f: 0f b6 81 e0 6e 10 80 movzbl -0x7fef9120(%ecx),%eax + shift |= shiftcode[data]; + 80102576: 09 da or %ebx,%edx + shift ^= togglecode[data]; +@@ -4553,7 +4528,7 @@ kalloc(void) + c = charcode[shift & (CTL | SHIFT)][data]; + 8010257a: 89 d0 mov %edx,%eax + 8010257c: 83 e0 03 and $0x3,%eax +-8010257f: 8b 04 85 a0 6e 10 80 mov -0x7fef9160(,%eax,4),%eax ++8010257f: 8b 04 85 c0 6e 10 80 mov -0x7fef9140(,%eax,4),%eax + shift ^= togglecode[data]; + 80102586: 89 15 b4 a5 10 80 mov %edx,0x8010a5b4 + if(shift & CAPSLOCK){ +@@ -5204,7 +5179,7 @@ write_head(void) + 80102a75: 83 ec 30 sub $0x30,%esp + 80102a78: 8b 5d 08 mov 0x8(%ebp),%ebx + initlock(&log.lock, "log"); +-80102a7b: c7 44 24 04 c0 70 10 movl $0x801070c0,0x4(%esp) ++80102a7b: c7 44 24 04 e0 70 10 movl $0x801070e0,0x4(%esp) + 80102a82: 80 + 80102a83: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) + 80102a8a: e8 e1 15 00 00 call 80104070 +@@ -5466,7 +5441,7 @@ commit() + 80102ca1: 5d pop %ebp + 80102ca2: c3 ret + panic("log.committing"); +-80102ca3: c7 04 24 c4 70 10 80 movl $0x801070c4,(%esp) ++80102ca3: c7 04 24 e4 70 10 80 movl $0x801070e4,(%esp) + 80102caa: e8 b1 d6 ff ff call 80100360 + 80102caf: 90 nop + +@@ -5552,10 +5527,10 @@ log_write(struct buf *b) + 80102d5b: eb ca jmp 80102d27 + 80102d5d: 8d 76 00 lea 0x0(%esi),%esi + panic("too big a transaction"); +-80102d60: c7 04 24 d3 70 10 80 movl $0x801070d3,(%esp) ++80102d60: c7 04 24 f3 70 10 80 movl $0x801070f3,(%esp) + 80102d67: e8 f4 d5 ff ff call 80100360 + panic("log_write outside of trans"); +-80102d6c: c7 04 24 e9 70 10 80 movl $0x801070e9,(%esp) ++80102d6c: c7 04 24 09 71 10 80 movl $0x80107109,(%esp) + 80102d73: e8 e8 d5 ff ff call 80100360 + 80102d78: 66 90 xchg %ax,%ax + 80102d7a: 66 90 xchg %ax,%ax +@@ -5578,11 +5553,11 @@ mpmain(void) + 80102d8c: 89 c3 mov %eax,%ebx + 80102d8e: e8 ed 08 00 00 call 80103680 + 80102d93: 89 5c 24 08 mov %ebx,0x8(%esp) +-80102d97: c7 04 24 04 71 10 80 movl $0x80107104,(%esp) ++80102d97: c7 04 24 24 71 10 80 movl $0x80107124,(%esp) + 80102d9e: 89 44 24 04 mov %eax,0x4(%esp) + 80102da2: e8 a9 d8 ff ff call 80100650 + idtinit(); // load idt register +-80102da7: e8 f4 26 00 00 call 801054a0 ++80102da7: e8 24 27 00 00 call 801054d0 + xchg(&(mycpu()->started), 1); // tell startothers() we're up + 80102dac: e8 4f 08 00 00 call 80103600 + 80102db1: 89 c2 mov %eax,%edx +@@ -5605,9 +5580,9 @@ xchg(volatile uint *addr, uint newval) + 80102dd1: 89 e5 mov %esp,%ebp + 80102dd3: 83 ec 08 sub $0x8,%esp + switchkvm(); +-80102dd6: e8 95 37 00 00 call 80106570 ++80102dd6: e8 c5 37 00 00 call 801065a0 + seginit(); +-80102ddb: e8 d0 36 00 00 call 801064b0 ++80102ddb: e8 00 37 00 00 call 801064e0 + lapicinit(); + 80102de0: e8 8b f8 ff ff call 80102670 + mpmain(); +@@ -5637,14 +5612,14 @@ xchg(volatile uint *addr, uint newval) + 80102e07: c7 04 24 a8 55 11 80 movl $0x801155a8,(%esp) + 80102e0e: e8 cd f5 ff ff call 801023e0 + kvmalloc(); // kernel page table +-80102e13: e8 e8 3b 00 00 call 80106a00 ++80102e13: e8 18 3c 00 00 call 80106a30 + mpinit(); // detect other processors + 80102e18: e8 73 01 00 00 call 80102f90 + 80102e1d: 8d 76 00 lea 0x0(%esi),%esi + lapicinit(); // interrupt controller + 80102e20: e8 4b f8 ff ff call 80102670 + seginit(); // segment descriptors +-80102e25: e8 86 36 00 00 call 801064b0 ++80102e25: e8 b6 36 00 00 call 801064e0 + picinit(); // disable pic + 80102e2a: e8 21 03 00 00 call 80103150 + 80102e2f: 90 nop +@@ -5653,12 +5628,12 @@ xchg(volatile uint *addr, uint newval) + consoleinit(); // console hardware + 80102e35: e8 16 db ff ff call 80100950 + uartinit(); // serial port +-80102e3a: e8 91 29 00 00 call 801057d0 ++80102e3a: e8 c1 29 00 00 call 80105800 + 80102e3f: 90 nop + pinit(); // process table + 80102e40: e8 9b 07 00 00 call 801035e0 + tvinit(); // trap vectors +-80102e45: e8 b6 25 00 00 call 80105400 ++80102e45: e8 e6 25 00 00 call 80105430 + binit(); // buffer cache + 80102e4a: e8 f1 d1 ff ff call 80100040 + 80102e4f: 90 nop +@@ -5767,7 +5742,7 @@ mpsearch1(uint a, int len) + if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) + 80102f38: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) + 80102f3f: 00 +-80102f40: c7 44 24 04 18 71 10 movl $0x80107118,0x4(%esp) ++80102f40: c7 44 24 04 38 71 10 movl $0x80107138,0x4(%esp) + 80102f47: 80 + 80102f48: 89 34 24 mov %esi,(%esp) + 80102f4b: e8 a0 13 00 00 call 801042f0 +@@ -5855,7 +5830,7 @@ mpinit(void) + if(memcmp(conf, "PCMP", 4) != 0) + 80102ff3: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) + 80102ffa: 00 +-80102ffb: c7 44 24 04 1d 71 10 movl $0x8010711d,0x4(%esp) ++80102ffb: c7 44 24 04 3d 71 10 movl $0x8010713d,0x4(%esp) + 80103002: 80 + 80103003: 89 04 24 mov %eax,(%esp) + conf = (struct mpconf*) P2V((uint) mp->physaddr); +@@ -5919,7 +5894,7 @@ mpinit(void) + switch(*p){ + 80103087: 80 f9 04 cmp $0x4,%cl + 8010308a: 77 74 ja 80103100 +-8010308c: ff 24 8d 5c 71 10 80 jmp *-0x7fef8ea4(,%ecx,4) ++8010308c: ff 24 8d 7c 71 10 80 jmp *-0x7fef8e84(,%ecx,4) + 80103093: 90 nop + 80103094: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + p += sizeof(struct mpioapic); +@@ -6007,7 +5982,7 @@ mpinit(void) + if((mp = mpsearch()) == 0 || mp->physaddr == 0) + 80103117: 0f 85 c5 fe ff ff jne 80102fe2 + panic("Expect to run on an SMP"); +-8010311d: c7 04 24 22 71 10 80 movl $0x80107122,(%esp) ++8010311d: c7 04 24 42 71 10 80 movl $0x80107142,(%esp) + 80103124: e8 37 d2 ff ff call 80100360 + 80103129: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(conf->version != 1 && conf->version != 4) +@@ -6015,7 +5990,7 @@ mpinit(void) + 80103132: 0f 84 ed fe ff ff je 80103025 + 80103138: eb e3 jmp 8010311d + panic("Didn't find a suitable machine"); +-8010313a: c7 04 24 3c 71 10 80 movl $0x8010713c,(%esp) ++8010313a: c7 04 24 5c 71 10 80 movl $0x8010715c,(%esp) + 80103141: e8 1a d2 ff ff call 80100360 + 80103146: 66 90 xchg %ax,%ax + 80103148: 66 90 xchg %ax,%ax +@@ -6024,12 +5999,6 @@ mpinit(void) + 8010314e: 66 90 xchg %ax,%ax + + 80103150 : +-#define IO_PIC2 0xA0 // Slave (IRQs 8-15) +- +-// Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware. +-void +-picinit(void) +-{ + 80103150: 55 push %ebp + 80103151: ba 21 00 00 00 mov $0x21,%edx + 80103156: 89 e5 mov %esp,%ebp +@@ -6037,10 +6006,6 @@ picinit(void) + 8010315d: ee out %al,(%dx) + 8010315e: b2 a1 mov $0xa1,%dl + 80103160: ee out %al,(%dx) +- // mask all interrupts +- outb(IO_PIC1+1, 0xFF); +- outb(IO_PIC2+1, 0xFF); +-} + 80103161: 5d pop %ebp + 80103162: c3 ret + 80103163: 66 90 xchg %ax,%ax +@@ -6102,7 +6067,7 @@ pipealloc(struct file **f0, struct file **f1) + 801031d9: 00 00 00 + initlock(&p->lock, "pipe"); + 801031dc: 89 04 24 mov %eax,(%esp) +-801031df: c7 44 24 04 70 71 10 movl $0x80107170,0x4(%esp) ++801031df: c7 44 24 04 90 71 10 movl $0x80107190,0x4(%esp) + 801031e6: 80 + 801031e7: e8 84 0e 00 00 call 80104070 + (*f0)->type = FD_PIPE; +@@ -6470,10 +6435,10 @@ piperead(struct pipe *p, char *addr, int n) + 801034be: 66 90 xchg %ax,%ax + + 801034c0 : +-// If found, change state to EMBRYO and initialize +-// state required to run in the kernel. +-// Otherwise return 0. +-static struct proc* ++// If found, change state to EMBRYO and initialize ++// state required to run in the kernel. ++// Otherwise return 0. ++static struct proc * + allocproc(void) + { + 801034c0: 55 push %ebp +@@ -6484,7 +6449,7 @@ allocproc(void) + + acquire(&ptable.lock); + +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 801034c4: bb 54 2d 11 80 mov $0x80112d54,%ebx + { + 801034c9: 83 ec 14 sub $0x14,%esp +@@ -6493,11 +6458,11 @@ allocproc(void) + 801034d3: e8 08 0d 00 00 call 801041e0 + 801034d8: eb 11 jmp 801034eb + 801034da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 801034e0: 83 eb 80 sub $0xffffff80,%ebx + 801034e3: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx + 801034e9: 74 7d je 80103568 +- if(p->state == UNUSED) ++ if (p->state == UNUSED) + 801034eb: 8b 43 0c mov 0xc(%ebx),%eax + 801034ee: 85 c0 test %eax,%eax + 801034f0: 75 ee jne 801034e0 +@@ -6521,7 +6486,7 @@ found: + 80103511: e8 3a 0d 00 00 call 80104250 + + // Allocate kernel stack. +- if((p->kstack = kalloc()) == 0){ ++ if ((p->kstack = kalloc()) == 0) + 80103516: e8 85 ef ff ff call 801024a0 + 8010351b: 85 c0 test %eax,%eax + 8010351d: 89 43 08 mov %eax,0x8(%ebx) +@@ -6536,22 +6501,22 @@ found: + // Set up new context to start executing at forkret, + // which returns to trapret. + sp -= 4; +- *(uint*)sp = (uint)trapret; ++ *(uint *)sp = (uint)trapret; + + sp -= sizeof *p->context; + 80103528: 05 9c 0f 00 00 add $0xf9c,%eax + sp -= sizeof *p->tf; + 8010352d: 89 53 18 mov %edx,0x18(%ebx) +- *(uint*)sp = (uint)trapret; +-80103530: c7 40 14 f5 53 10 80 movl $0x801053f5,0x14(%eax) +- p->context = (struct context*)sp; ++ *(uint *)sp = (uint)trapret; ++80103530: c7 40 14 25 54 10 80 movl $0x80105425,0x14(%eax) ++ p->context = (struct context *)sp; + memset(p->context, 0, sizeof *p->context); + 80103537: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) + 8010353e: 00 + 8010353f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 80103546: 00 + 80103547: 89 04 24 mov %eax,(%esp) +- p->context = (struct context*)sp; ++ p->context = (struct context *)sp; + 8010354a: 89 43 1c mov %eax,0x1c(%ebx) + memset(p->context, 0, sizeof *p->context); + 8010354d: e8 4e 0d 00 00 call 801042a0 +@@ -6586,11 +6551,11 @@ found: + 80103589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + + 80103590 : ++} + + // A fork child's very first scheduling by scheduler() + // will swtch here. "Return" to user space. +-void +-forkret(void) ++void forkret(void) + { + 80103590: 55 push %ebp + 80103591: 89 e5 mov %esp,%ebp +@@ -6601,7 +6566,7 @@ forkret(void) + 80103596: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + 8010359d: e8 ae 0c 00 00 call 80104250 + +- if (first) { ++ if (first) + 801035a2: a1 00 a0 10 80 mov 0x8010a000,%eax + 801035a7: 85 c0 test %eax,%eax + 801035a9: 75 05 jne 801035b0 +@@ -6636,7 +6601,7 @@ forkret(void) + 801035e1: 89 e5 mov %esp,%ebp + 801035e3: 83 ec 18 sub $0x18,%esp + initlock(&ptable.lock, "ptable"); +-801035e6: c7 44 24 04 75 71 10 movl $0x80107175,0x4(%esp) ++801035e6: c7 44 24 04 95 71 10 movl $0x80107195,0x4(%esp) + 801035ed: 80 + 801035ee: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + 801035f5: e8 76 0a 00 00 call 80104070 +@@ -6655,12 +6620,12 @@ forkret(void) + asm volatile("pushfl; popl %0" : "=r" (eflags)); + 80103608: 9c pushf + 80103609: 58 pop %eax +- if(readeflags()&FL_IF) ++ if (readeflags() & FL_IF) + 8010360a: f6 c4 02 test $0x2,%ah + 8010360d: 75 57 jne 80103666 + apicid = lapicid(); + 8010360f: e8 4c f1 ff ff call 80102760 +- for (i = 0; i < ncpu; ++i) { ++ for (i = 0; i < ncpu; ++i) + 80103614: 8b 35 00 2d 11 80 mov 0x80112d00,%esi + 8010361a: 85 f6 test %esi,%esi + 8010361c: 7e 3c jle 8010365a +@@ -6669,7 +6634,7 @@ forkret(void) + 80103625: 39 c2 cmp %eax,%edx + 80103627: 74 2d je 80103656 + 80103629: b9 30 28 11 80 mov $0x80112830,%ecx +- for (i = 0; i < ncpu; ++i) { ++ for (i = 0; i < ncpu; ++i) + 8010362e: 31 d2 xor %edx,%edx + 80103630: 83 c2 01 add $0x1,%edx + 80103633: 39 f2 cmp %esi,%edx +@@ -6690,28 +6655,28 @@ forkret(void) + 80103650: 05 80 27 11 80 add $0x80112780,%eax + } + 80103655: c3 ret +- for (i = 0; i < ncpu; ++i) { ++ for (i = 0; i < ncpu; ++i) + 80103656: 31 d2 xor %edx,%edx + 80103658: eb ea jmp 80103644 + panic("unknown apicid\n"); +-8010365a: c7 04 24 7c 71 10 80 movl $0x8010717c,(%esp) ++8010365a: c7 04 24 9c 71 10 80 movl $0x8010719c,(%esp) + 80103661: e8 fa cc ff ff call 80100360 + panic("mycpu called with interrupts enabled\n"); +-80103666: c7 04 24 58 72 10 80 movl $0x80107258,(%esp) ++80103666: c7 04 24 78 72 10 80 movl $0x80107278,(%esp) + 8010366d: e8 ee cc ff ff call 80100360 + 80103672: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 80103679: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + + 80103680 : +-cpuid() { ++{ + 80103680: 55 push %ebp + 80103681: 89 e5 mov %esp,%ebp + 80103683: 83 ec 08 sub $0x8,%esp +- return mycpu()-cpus; ++ return mycpu() - cpus; + 80103686: e8 75 ff ff ff call 80103600 + } + 8010368b: c9 leave +- return mycpu()-cpus; ++ return mycpu() - cpus; + 8010368c: 2d 80 27 11 80 sub $0x80112780,%eax + 80103691: c1 f8 04 sar $0x4,%eax + 80103694: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax +@@ -6721,7 +6686,7 @@ cpuid() { + 8010369c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + + 801036a0 : +-myproc(void) { ++{ + 801036a0: 55 push %ebp + 801036a1: 89 e5 mov %esp,%ebp + 801036a3: 53 push %ebx +@@ -6754,8 +6719,8 @@ myproc(void) { + 801036dc: 89 c3 mov %eax,%ebx + initproc = p; + 801036de: a3 b8 a5 10 80 mov %eax,0x8010a5b8 +- if((p->pgdir = setupkvm()) == 0) +-801036e3: e8 88 32 00 00 call 80106970 ++ if ((p->pgdir = setupkvm()) == 0) ++801036e3: e8 b8 32 00 00 call 801069a0 + 801036e8: 85 c0 test %eax,%eax + 801036ea: 89 43 04 mov %eax,0x4(%ebx) + 801036ed: 0f 84 d4 00 00 00 je 801037c7 +@@ -6765,7 +6730,7 @@ myproc(void) { + 801036fd: 00 + 801036fe: c7 44 24 04 60 a4 10 movl $0x8010a460,0x4(%esp) + 80103705: 80 +-80103706: e8 95 2f 00 00 call 801066a0 ++80103706: e8 c5 2f 00 00 call 801066d0 + p->sz = PGSIZE; + 8010370b: c7 03 00 10 00 00 movl $0x1000,(%ebx) + memset(p->tf, 0, sizeof(*p->tf)); +@@ -6800,19 +6765,19 @@ myproc(void) { + p->tf->esp = PGSIZE; + 80103764: 8b 43 18 mov 0x18(%ebx),%eax + 80103767: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) +- p->tf->eip = 0; // beginning of initcode.S ++ p->tf->eip = 0; // beginning of initcode.S + 8010376e: 8b 43 18 mov 0x18(%ebx),%eax + 80103771: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) + safestrcpy(p->name, "initcode", sizeof(p->name)); + 80103778: 8d 43 6c lea 0x6c(%ebx),%eax + 8010377b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) + 80103782: 00 +-80103783: c7 44 24 04 a5 71 10 movl $0x801071a5,0x4(%esp) ++80103783: c7 44 24 04 c5 71 10 movl $0x801071c5,0x4(%esp) + 8010378a: 80 + 8010378b: 89 04 24 mov %eax,(%esp) + 8010378e: e8 ed 0c 00 00 call 80104480 + p->cwd = namei("/"); +-80103793: c7 04 24 ae 71 10 80 movl $0x801071ae,(%esp) ++80103793: c7 04 24 ce 71 10 80 movl $0x801071ce,(%esp) + 8010379a: e8 61 e7 ff ff call 80101f00 + 8010379f: 89 43 68 mov %eax,0x68(%ebx) + acquire(&ptable.lock); +@@ -6829,7 +6794,7 @@ myproc(void) { + 801037c5: 5d pop %ebp + 801037c6: c3 ret + panic("userinit: out of memory?"); +-801037c7: c7 04 24 8c 71 10 80 movl $0x8010718c,(%esp) ++801037c7: c7 04 24 ac 71 10 80 movl $0x801071ac,(%esp) + 801037ce: e8 8d cb ff ff call 80100360 + 801037d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 801037d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -6844,28 +6809,28 @@ myproc(void) { + 801037e8: 8b 75 08 mov 0x8(%ebp),%esi + struct proc *curproc = myproc(); + 801037eb: e8 b0 fe ff ff call 801036a0 +- if(n > 0){ ++ if (n > 0) + 801037f0: 83 fe 00 cmp $0x0,%esi + struct proc *curproc = myproc(); + 801037f3: 89 c3 mov %eax,%ebx + sz = curproc->sz; + 801037f5: 8b 00 mov (%eax),%eax +- if(n > 0){ ++ if (n > 0) + 801037f7: 7e 2f jle 80103828 +- if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) ++ if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) + 801037f9: 01 c6 add %eax,%esi + 801037fb: 89 74 24 08 mov %esi,0x8(%esp) + 801037ff: 89 44 24 04 mov %eax,0x4(%esp) + 80103803: 8b 43 04 mov 0x4(%ebx),%eax + 80103806: 89 04 24 mov %eax,(%esp) +-80103809: e8 d2 2f 00 00 call 801067e0 ++80103809: e8 02 30 00 00 call 80106810 + 8010380e: 85 c0 test %eax,%eax + 80103810: 74 36 je 80103848 + curproc->sz = sz; + 80103812: 89 03 mov %eax,(%ebx) + switchuvm(curproc); + 80103814: 89 1c 24 mov %ebx,(%esp) +-80103817: e8 74 2d 00 00 call 80106590 ++80103817: e8 a4 2d 00 00 call 801065c0 + return 0; + 8010381c: 31 c0 xor %eax,%eax + } +@@ -6875,15 +6840,15 @@ myproc(void) { + 80103823: 5d pop %ebp + 80103824: c3 ret + 80103825: 8d 76 00 lea 0x0(%esi),%esi +- } else if(n < 0){ ++ else if (n < 0) + 80103828: 74 e8 je 80103812 +- if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) ++ if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) + 8010382a: 01 c6 add %eax,%esi + 8010382c: 89 74 24 08 mov %esi,0x8(%esp) + 80103830: 89 44 24 04 mov %eax,0x4(%esp) + 80103834: 8b 43 04 mov 0x4(%ebx),%eax + 80103837: 89 04 24 mov %eax,(%esp) +-8010383a: e8 91 30 00 00 call 801068d0 ++8010383a: e8 c1 30 00 00 call 80106900 + 8010383f: 85 c0 test %eax,%eax + 80103841: 75 cf jne 80103812 + 80103843: 90 nop +@@ -6904,18 +6869,18 @@ myproc(void) { + struct proc *curproc = myproc(); + 80103859: e8 42 fe ff ff call 801036a0 + 8010385e: 89 c3 mov %eax,%ebx +- if((np = allocproc()) == 0){ ++ if ((np = allocproc()) == 0) + 80103860: e8 5b fc ff ff call 801034c0 + 80103865: 85 c0 test %eax,%eax + 80103867: 89 c7 mov %eax,%edi + 80103869: 89 45 e4 mov %eax,-0x1c(%ebp) + 8010386c: 0f 84 bc 00 00 00 je 8010392e +- if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ ++ if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) + 80103872: 8b 03 mov (%ebx),%eax + 80103874: 89 44 24 04 mov %eax,0x4(%esp) + 80103878: 8b 43 04 mov 0x4(%ebx),%eax + 8010387b: 89 04 24 mov %eax,(%esp) +-8010387e: e8 cd 31 00 00 call 80106a50 ++8010387e: e8 fd 31 00 00 call 80106a80 + 80103883: 85 c0 test %eax,%eax + 80103885: 89 47 04 mov %eax,0x4(%edi) + 80103888: 0f 84 a7 00 00 00 je 80103935 +@@ -6932,14 +6897,14 @@ myproc(void) { + 8010389d: 8b 73 18 mov 0x18(%ebx),%esi + 801038a0: b9 13 00 00 00 mov $0x13,%ecx + 801038a5: f3 a5 rep movsl %ds:(%esi),%es:(%edi) +- for(i = 0; i < NOFILE; i++) ++ for (i = 0; i < NOFILE; i++) + 801038a7: 31 f6 xor %esi,%esi + np->tf->eax = 0; + 801038a9: 8b 40 18 mov 0x18(%eax),%eax + 801038ac: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) + 801038b3: 90 nop + 801038b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- if(curproc->ofile[i]) ++ if (curproc->ofile[i]) + 801038b8: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax + 801038bc: 85 c0 test %eax,%eax + 801038be: 74 0f je 801038cf +@@ -6948,7 +6913,7 @@ myproc(void) { + 801038c3: e8 18 d5 ff ff call 80100de0 + 801038c8: 8b 55 e4 mov -0x1c(%ebp),%edx + 801038cb: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) +- for(i = 0; i < NOFILE; i++) ++ for (i = 0; i < NOFILE; i++) + 801038cf: 83 c6 01 add $0x1,%esi + 801038d2: 83 fe 10 cmp $0x10,%esi + 801038d5: 75 e1 jne 801038b8 +@@ -7026,27 +6991,27 @@ myproc(void) { + 80103980: fb sti + acquire(&ptable.lock); + 80103981: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103988: bb 54 2d 11 80 mov $0x80112d54,%ebx + acquire(&ptable.lock); + 8010398d: e8 4e 08 00 00 call 801041e0 + 80103992: eb 0f jmp 801039a3 + 80103994: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103998: 83 eb 80 sub $0xffffff80,%ebx + 8010399b: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx + 801039a1: 74 45 je 801039e8 +- if(p->state != RUNNABLE) ++ if (p->state != RUNNABLE) + 801039a3: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) + 801039a7: 75 ef jne 80103998 + c->proc = p; + 801039a9: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) + switchuvm(p); + 801039af: 89 1c 24 mov %ebx,(%esp) +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 801039b2: 83 eb 80 sub $0xffffff80,%ebx + switchuvm(p); +-801039b5: e8 d6 2b 00 00 call 80106590 ++801039b5: e8 06 2c 00 00 call 801065c0 + swtch(&(c->scheduler), p->context); + 801039ba: 8b 43 9c mov -0x64(%ebx),%eax + p->state = RUNNING; +@@ -7056,13 +7021,13 @@ myproc(void) { + 801039c7: 89 44 24 04 mov %eax,0x4(%esp) + 801039cb: e8 0b 0b 00 00 call 801044db + switchkvm(); +-801039d0: e8 9b 2b 00 00 call 80106570 +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++801039d0: e8 cb 2b 00 00 call 801065a0 ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 801039d5: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx + c->proc = 0; + 801039db: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) + 801039e2: 00 00 00 +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 801039e5: 75 bc jne 801039a3 + 801039e7: 90 nop + release(&ptable.lock); +@@ -7082,25 +7047,25 @@ myproc(void) { + 80103a05: 83 ec 10 sub $0x10,%esp + struct proc *p = myproc(); + 80103a08: e8 93 fc ff ff call 801036a0 +- if(!holding(&ptable.lock)) ++ if (!holding(&ptable.lock)) + 80103a0d: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + struct proc *p = myproc(); + 80103a14: 89 c3 mov %eax,%ebx +- if(!holding(&ptable.lock)) ++ if (!holding(&ptable.lock)) + 80103a16: e8 85 07 00 00 call 801041a0 + 80103a1b: 85 c0 test %eax,%eax + 80103a1d: 74 4f je 80103a6e +- if(mycpu()->ncli != 1) ++ if (mycpu()->ncli != 1) + 80103a1f: e8 dc fb ff ff call 80103600 + 80103a24: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) + 80103a2b: 75 65 jne 80103a92 +- if(p->state == RUNNING) ++ if (p->state == RUNNING) + 80103a2d: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) + 80103a31: 74 53 je 80103a86 + asm volatile("pushfl; popl %0" : "=r" (eflags)); + 80103a33: 9c pushf + 80103a34: 58 pop %eax +- if(readeflags()&FL_IF) ++ if (readeflags() & FL_IF) + 80103a35: f6 c4 02 test $0x2,%ah + 80103a38: 75 40 jne 80103a7a + intena = mycpu()->intena; +@@ -7125,16 +7090,16 @@ myproc(void) { + 80103a6c: 5d pop %ebp + 80103a6d: c3 ret + panic("sched ptable.lock"); +-80103a6e: c7 04 24 b0 71 10 80 movl $0x801071b0,(%esp) ++80103a6e: c7 04 24 d0 71 10 80 movl $0x801071d0,(%esp) + 80103a75: e8 e6 c8 ff ff call 80100360 + panic("sched interruptible"); +-80103a7a: c7 04 24 dc 71 10 80 movl $0x801071dc,(%esp) ++80103a7a: c7 04 24 fc 71 10 80 movl $0x801071fc,(%esp) + 80103a81: e8 da c8 ff ff call 80100360 + panic("sched running"); +-80103a86: c7 04 24 ce 71 10 80 movl $0x801071ce,(%esp) ++80103a86: c7 04 24 ee 71 10 80 movl $0x801071ee,(%esp) + 80103a8d: e8 ce c8 ff ff call 80100360 + panic("sched locks"); +-80103a92: c7 04 24 c2 71 10 80 movl $0x801071c2,(%esp) ++80103a92: c7 04 24 e2 71 10 80 movl $0x801071e2,(%esp) + 80103a99: e8 c2 c8 ff ff call 80100360 + 80103a9e: 66 90 xchg %ax,%ax + +@@ -7143,21 +7108,21 @@ myproc(void) { + 80103aa0: 55 push %ebp + 80103aa1: 89 e5 mov %esp,%ebp + 80103aa3: 56 push %esi +- if(curproc == initproc) ++ if (curproc == initproc) + 80103aa4: 31 f6 xor %esi,%esi + { + 80103aa6: 53 push %ebx + 80103aa7: 83 ec 10 sub $0x10,%esp + struct proc *curproc = myproc(); + 80103aaa: e8 f1 fb ff ff call 801036a0 +- if(curproc == initproc) ++ if (curproc == initproc) + 80103aaf: 3b 05 b8 a5 10 80 cmp 0x8010a5b8,%eax + struct proc *curproc = myproc(); + 80103ab5: 89 c3 mov %eax,%ebx +- if(curproc == initproc) ++ if (curproc == initproc) + 80103ab7: 0f 84 ea 00 00 00 je 80103ba7 + 80103abd: 8d 76 00 lea 0x0(%esi),%esi +- if(curproc->ofile[fd]){ ++ if (curproc->ofile[fd]) + 80103ac0: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax + 80103ac4: 85 c0 test %eax,%eax + 80103ac6: 74 10 je 80103ad8 +@@ -7167,7 +7132,7 @@ myproc(void) { + curproc->ofile[fd] = 0; + 80103ad0: c7 44 b3 28 00 00 00 movl $0x0,0x28(%ebx,%esi,4) + 80103ad7: 00 +- for(fd = 0; fd < NOFILE; fd++){ ++ for (fd = 0; fd < NOFILE; fd++) + 80103ad8: 83 c6 01 add $0x1,%esi + 80103adb: 83 fe 10 cmp $0x10,%esi + 80103ade: 75 e0 jne 80103ac0 +@@ -7191,21 +7156,21 @@ wakeup1(void *chan) + { + struct proc *p; + +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103b0b: ba 54 2d 11 80 mov $0x80112d54,%edx + 80103b10: eb 11 jmp 80103b23 + 80103b12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 80103b18: 83 ea 80 sub $0xffffff80,%edx + 80103b1b: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx + 80103b21: 74 1d je 80103b40 +- if(p->state == SLEEPING && p->chan == chan) ++ if (p->state == SLEEPING && p->chan == chan) + 80103b23: 83 7a 0c 02 cmpl $0x2,0xc(%edx) + 80103b27: 75 ef jne 80103b18 + 80103b29: 3b 42 20 cmp 0x20(%edx),%eax + 80103b2c: 75 ea jne 80103b18 + p->state = RUNNABLE; + 80103b2e: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103b35: 83 ea 80 sub $0xffffff80,%edx + 80103b38: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx + 80103b3e: 75 e3 jne 80103b23 +@@ -7214,26 +7179,26 @@ wakeup1(void *chan) + 80103b45: b9 54 2d 11 80 mov $0x80112d54,%ecx + 80103b4a: eb 0f jmp 80103b5b + 80103b4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103b50: 83 e9 80 sub $0xffffff80,%ecx + 80103b53: 81 f9 54 4d 11 80 cmp $0x80114d54,%ecx + 80103b59: 74 34 je 80103b8f +- if(p->parent == curproc){ ++ if (p->parent == curproc) + 80103b5b: 39 59 14 cmp %ebx,0x14(%ecx) + 80103b5e: 75 f0 jne 80103b50 +- if(p->state == ZOMBIE) ++ if (p->state == ZOMBIE) + 80103b60: 83 79 0c 05 cmpl $0x5,0xc(%ecx) + p->parent = initproc; + 80103b64: 89 41 14 mov %eax,0x14(%ecx) +- if(p->state == ZOMBIE) ++ if (p->state == ZOMBIE) + 80103b67: 75 e7 jne 80103b50 + 80103b69: ba 54 2d 11 80 mov $0x80112d54,%edx + 80103b6e: eb 0b jmp 80103b7b +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103b70: 83 ea 80 sub $0xffffff80,%edx + 80103b73: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx + 80103b79: 74 d5 je 80103b50 +- if(p->state == SLEEPING && p->chan == chan) ++ if (p->state == SLEEPING && p->chan == chan) + 80103b7b: 83 7a 0c 02 cmpl $0x2,0xc(%edx) + 80103b7f: 75 ef jne 80103b70 + 80103b81: 3b 42 20 cmp 0x20(%edx),%eax +@@ -7246,10 +7211,10 @@ wakeup1(void *chan) + sched(); + 80103b96: e8 65 fe ff ff call 80103a00 + panic("zombie exit"); +-80103b9b: c7 04 24 fd 71 10 80 movl $0x801071fd,(%esp) ++80103b9b: c7 04 24 1d 72 10 80 movl $0x8010721d,(%esp) + 80103ba2: e8 b9 c7 ff ff call 80100360 + panic("init exiting"); +-80103ba7: c7 04 24 f0 71 10 80 movl $0x801071f0,(%esp) ++80103ba7: c7 04 24 10 72 10 80 movl $0x80107210,(%esp) + 80103bae: e8 ad c7 ff ff call 80100360 + 80103bb3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 80103bb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -7259,7 +7224,7 @@ wakeup1(void *chan) + 80103bc0: 55 push %ebp + 80103bc1: 89 e5 mov %esp,%ebp + 80103bc3: 83 ec 18 sub $0x18,%esp +- acquire(&ptable.lock); //DOC: yieldlock ++ acquire(&ptable.lock); // DOC: yieldlock + 80103bc6: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + 80103bcd: e8 0e 06 00 00 call 801041e0 + myproc()->state = RUNNABLE; +@@ -7300,19 +7265,19 @@ wakeup1(void *chan) + 80103c0c: 8b 75 0c mov 0xc(%ebp),%esi + struct proc *p = myproc(); + 80103c0f: e8 8c fa ff ff call 801036a0 +- if(p == 0) ++ if (p == 0) + 80103c14: 85 c0 test %eax,%eax + struct proc *p = myproc(); + 80103c16: 89 c3 mov %eax,%ebx +- if(p == 0) ++ if (p == 0) + 80103c18: 0f 84 7c 00 00 00 je 80103c9a +- if(lk == 0) ++ if (lk == 0) + 80103c1e: 85 f6 test %esi,%esi + 80103c20: 74 6c je 80103c8e +- if(lk != &ptable.lock){ //DOC: sleeplock0 ++ if (lk != &ptable.lock) + 80103c22: 81 fe 20 2d 11 80 cmp $0x80112d20,%esi + 80103c28: 74 46 je 80103c70 +- acquire(&ptable.lock); //DOC: sleeplock1 ++ acquire(&ptable.lock); // DOC: sleeplock1 + 80103c2a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + 80103c31: e8 aa 05 00 00 call 801041e0 + release(lk); +@@ -7356,10 +7321,10 @@ wakeup1(void *chan) + 80103c8c: 5d pop %ebp + 80103c8d: c3 ret + panic("sleep without lk"); +-80103c8e: c7 04 24 0f 72 10 80 movl $0x8010720f,(%esp) ++80103c8e: c7 04 24 2f 72 10 80 movl $0x8010722f,(%esp) + 80103c95: e8 c6 c6 ff ff call 80100360 + panic("sleep"); +-80103c9a: c7 04 24 09 72 10 80 movl $0x80107209,(%esp) ++80103c9a: c7 04 24 29 72 10 80 movl $0x80107229,(%esp) + 80103ca1: e8 ba c6 ff ff call 80100360 + 80103ca6: 8d 76 00 lea 0x0(%esi),%esi + 80103ca9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -7381,34 +7346,34 @@ wakeup1(void *chan) + 80103cc6: e8 15 05 00 00 call 801041e0 + havekids = 0; + 80103ccb: 31 c0 xor %eax,%eax +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103ccd: bb 54 2d 11 80 mov $0x80112d54,%ebx + 80103cd2: eb 0f jmp 80103ce3 + 80103cd4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 80103cd8: 83 eb 80 sub $0xffffff80,%ebx + 80103cdb: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx + 80103ce1: 74 1d je 80103d00 +- if(p->parent != curproc) ++ if (p->parent != curproc) + 80103ce3: 39 73 14 cmp %esi,0x14(%ebx) + 80103ce6: 75 f0 jne 80103cd8 +- if(p->state == ZOMBIE){ ++ if (p->state == ZOMBIE) + 80103ce8: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) + 80103cec: 74 2f je 80103d1d +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103cee: 83 eb 80 sub $0xffffff80,%ebx + havekids = 1; + 80103cf1: b8 01 00 00 00 mov $0x1,%eax +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103cf6: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx + 80103cfc: 75 e5 jne 80103ce3 + 80103cfe: 66 90 xchg %ax,%ax +- if(!havekids || curproc->killed){ ++ if (!havekids || curproc->killed) + 80103d00: 85 c0 test %eax,%eax + 80103d02: 74 6e je 80103d72 + 80103d04: 8b 46 24 mov 0x24(%esi),%eax + 80103d07: 85 c0 test %eax,%eax + 80103d09: 75 67 jne 80103d72 +- sleep(curproc, &ptable.lock); //DOC: wait-sleep ++ sleep(curproc, &ptable.lock); // DOC: wait-sleep + 80103d0b: c7 44 24 04 20 2d 11 movl $0x80112d20,0x4(%esp) + 80103d12: 80 + 80103d13: 89 34 24 mov %esi,(%esp) +@@ -7428,7 +7393,7 @@ wakeup1(void *chan) + 80103d2e: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) + freevm(p->pgdir); + 80103d35: 89 04 24 mov %eax,(%esp) +-80103d38: e8 b3 2b 00 00 call 801068f0 ++80103d38: e8 e3 2b 00 00 call 80106920 + release(&ptable.lock); + 80103d3d: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + p->pid = 0; +@@ -7470,8 +7435,7 @@ wakeup1(void *chan) + } + + // Wake up all processes sleeping on chan. +-void +-wakeup(void *chan) ++void wakeup(void *chan) + { + 80103d90: 55 push %ebp + 80103d91: 89 e5 mov %esp,%ebp +@@ -7481,21 +7445,21 @@ wakeup(void *chan) + acquire(&ptable.lock); + 80103d9a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + 80103da1: e8 3a 04 00 00 call 801041e0 +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103da6: b8 54 2d 11 80 mov $0x80112d54,%eax + 80103dab: eb 0d jmp 80103dba + 80103dad: 8d 76 00 lea 0x0(%esi),%esi + 80103db0: 83 e8 80 sub $0xffffff80,%eax + 80103db3: 3d 54 4d 11 80 cmp $0x80114d54,%eax + 80103db8: 74 1e je 80103dd8 +- if(p->state == SLEEPING && p->chan == chan) ++ if (p->state == SLEEPING && p->chan == chan) + 80103dba: 83 78 0c 02 cmpl $0x2,0xc(%eax) + 80103dbe: 75 f0 jne 80103db0 + 80103dc0: 3b 58 20 cmp 0x20(%eax),%ebx + 80103dc3: 75 eb jne 80103db0 + p->state = RUNNABLE; + 80103dc5: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103dcc: 83 e8 80 sub $0xffffff80,%eax + 80103dcf: 3d 54 4d 11 80 cmp $0x80114d54,%eax + 80103dd4: 75 e4 jne 80103dba +@@ -7512,11 +7476,11 @@ wakeup(void *chan) + 80103de9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + + 80103df0 : ++ + // 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) ++int kill(int pid) + { + 80103df0: 55 push %ebp + 80103df1: 89 e5 mov %esp,%ebp +@@ -7528,23 +7492,25 @@ kill(int pid) + acquire(&ptable.lock); + 80103dfa: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) + 80103e01: e8 da 03 00 00 call 801041e0 +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103e06: b8 54 2d 11 80 mov $0x80112d54,%eax + 80103e0b: eb 0d jmp 80103e1a + 80103e0d: 8d 76 00 lea 0x0(%esi),%esi + 80103e10: 83 e8 80 sub $0xffffff80,%eax + 80103e13: 3d 54 4d 11 80 cmp $0x80114d54,%eax + 80103e18: 74 36 je 80103e50 +- if(p->pid == pid){ ++ { ++ if (p->pid == pid) + 80103e1a: 39 58 10 cmp %ebx,0x10(%eax) + 80103e1d: 75 f1 jne 80103e10 ++ { + p->killed = 1; + // Wake process from sleep if necessary. +- if(p->state == SLEEPING) ++ if (p->state == SLEEPING) + 80103e1f: 83 78 0c 02 cmpl $0x2,0xc(%eax) + p->killed = 1; + 80103e23: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) +- if(p->state == SLEEPING) ++ if (p->state == SLEEPING) + 80103e2a: 74 14 je 80103e40 + p->state = RUNNABLE; + release(&ptable.lock); +@@ -7582,11 +7548,11 @@ kill(int pid) + 80103e69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + + 80103e70 : +-// 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) ++// PAGEBREAK: 36 ++// 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) + { + 80103e70: 55 push %ebp + 80103e71: 89 e5 mov %esp,%ebp +@@ -7599,44 +7565,44 @@ procdump(void) + 80103e81: eb 20 jmp 80103ea3 + 80103e83: 90 nop + 80103e84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- if(p->state == SLEEPING){ +- getcallerpcs((uint*)p->context->ebp+2, pc); +- for(i=0; i<10 && pc[i] != 0; i++) ++ { ++ getcallerpcs((uint *)p->context->ebp + 2, pc); ++ for (i = 0; i < 10 && pc[i] != 0; i++) + cprintf(" %p", pc[i]); + } + cprintf("\n"); +-80103e88: c7 04 24 97 75 10 80 movl $0x80107597,(%esp) ++80103e88: c7 04 24 b7 75 10 80 movl $0x801075b7,(%esp) + 80103e8f: e8 bc c7 ff ff call 80100650 + 80103e94: 83 eb 80 sub $0xffffff80,%ebx +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + 80103e97: 81 fb c0 4d 11 80 cmp $0x80114dc0,%ebx + 80103e9d: 0f 84 8d 00 00 00 je 80103f30 +- if(p->state == UNUSED) ++ if (p->state == UNUSED) + 80103ea3: 8b 43 a0 mov -0x60(%ebx),%eax + 80103ea6: 85 c0 test %eax,%eax + 80103ea8: 74 ea je 80103e94 +- if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) ++ if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) + 80103eaa: 83 f8 05 cmp $0x5,%eax + state = "???"; +-80103ead: ba 20 72 10 80 mov $0x80107220,%edx +- if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) ++80103ead: ba 40 72 10 80 mov $0x80107240,%edx ++ if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) + 80103eb2: 77 11 ja 80103ec5 +-80103eb4: 8b 14 85 80 72 10 80 mov -0x7fef8d80(,%eax,4),%edx ++80103eb4: 8b 14 85 a0 72 10 80 mov -0x7fef8d60(,%eax,4),%edx + state = "???"; +-80103ebb: b8 20 72 10 80 mov $0x80107220,%eax ++80103ebb: b8 40 72 10 80 mov $0x80107240,%eax + 80103ec0: 85 d2 test %edx,%edx + 80103ec2: 0f 44 d0 cmove %eax,%edx + cprintf("%d %s %s", p->pid, state, p->name); + 80103ec5: 8b 43 a4 mov -0x5c(%ebx),%eax + 80103ec8: 89 5c 24 0c mov %ebx,0xc(%esp) + 80103ecc: 89 54 24 08 mov %edx,0x8(%esp) +-80103ed0: c7 04 24 24 72 10 80 movl $0x80107224,(%esp) ++80103ed0: c7 04 24 44 72 10 80 movl $0x80107244,(%esp) + 80103ed7: 89 44 24 04 mov %eax,0x4(%esp) + 80103edb: e8 70 c7 ff ff call 80100650 +- if(p->state == SLEEPING){ ++ if (p->state == SLEEPING) + 80103ee0: 83 7b a0 02 cmpl $0x2,-0x60(%ebx) + 80103ee4: 75 a2 jne 80103e88 +- getcallerpcs((uint*)p->context->ebp+2, pc); ++ getcallerpcs((uint *)p->context->ebp + 2, pc); + 80103ee6: 8d 45 c0 lea -0x40(%ebp),%eax + 80103ee9: 89 44 24 04 mov %eax,0x4(%esp) + 80103eed: 8b 43 b0 mov -0x50(%ebx),%eax +@@ -7646,16 +7612,16 @@ procdump(void) + 80103ef9: 89 04 24 mov %eax,(%esp) + 80103efc: e8 8f 01 00 00 call 80104090 + 80103f01: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- for(i=0; i<10 && pc[i] != 0; i++) ++ for (i = 0; i < 10 && pc[i] != 0; i++) + 80103f08: 8b 17 mov (%edi),%edx + 80103f0a: 85 d2 test %edx,%edx + 80103f0c: 0f 84 76 ff ff ff je 80103e88 + cprintf(" %p", pc[i]); + 80103f12: 89 54 24 04 mov %edx,0x4(%esp) + 80103f16: 83 c7 04 add $0x4,%edi +-80103f19: c7 04 24 61 6c 10 80 movl $0x80106c61,(%esp) ++80103f19: c7 04 24 81 6c 10 80 movl $0x80106c81,(%esp) + 80103f20: e8 2b c7 ff ff call 80100650 +- for(i=0; i<10 && pc[i] != 0; i++) ++ for (i = 0; i < 10 && pc[i] != 0; i++) + 80103f25: 39 f7 cmp %esi,%edi + 80103f27: 75 df jne 80103f08 + 80103f29: e9 5a ff ff ff jmp 80103e88 +@@ -7686,7 +7652,7 @@ initsleeplock(struct sleeplock *lk, char *name) + 80103f44: 83 ec 14 sub $0x14,%esp + 80103f47: 8b 5d 08 mov 0x8(%ebp),%ebx + initlock(&lk->lk, "sleep lock"); +-80103f4a: c7 44 24 04 98 72 10 movl $0x80107298,0x4(%esp) ++80103f4a: c7 44 24 04 b8 72 10 movl $0x801072b8,0x4(%esp) + 80103f51: 80 + 80103f52: 8d 43 04 lea 0x4(%ebx),%eax + 80103f55: 89 04 24 mov %eax,(%esp) +@@ -8017,10 +7983,10 @@ popcli(void) + 80104178: c9 leave + 80104179: c3 ret + panic("popcli"); +-8010417a: c7 04 24 ba 72 10 80 movl $0x801072ba,(%esp) ++8010417a: c7 04 24 da 72 10 80 movl $0x801072da,(%esp) + 80104181: e8 da c1 ff ff call 80100360 + panic("popcli - interruptible"); +-80104186: c7 04 24 a3 72 10 80 movl $0x801072a3,(%esp) ++80104186: c7 04 24 c3 72 10 80 movl $0x801072c3,(%esp) + 8010418d: e8 ce c1 ff ff call 80100360 + 80104192: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 80104199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -8099,7 +8065,7 @@ popcli(void) + 80104233: 5d pop %ebp + 80104234: c3 ret + panic("acquire"); +-80104235: c7 04 24 c1 72 10 80 movl $0x801072c1,(%esp) ++80104235: c7 04 24 e1 72 10 80 movl $0x801072e1,(%esp) + 8010423c: e8 1f c1 ff ff call 80100360 + 80104241: eb 0d jmp 80104250 + 80104243: 90 nop +@@ -8143,7 +8109,7 @@ popcli(void) + popcli(); + 80104282: e9 a9 fe ff ff jmp 80104130 + panic("release"); +-80104287: c7 04 24 c9 72 10 80 movl $0x801072c9,(%esp) ++80104287: c7 04 24 e9 72 10 80 movl $0x801072e9,(%esp) + 8010428e: e8 cd c0 ff ff call 80100360 + 80104293: 66 90 xchg %ax,%ax + 80104295: 66 90 xchg %ax,%ax +@@ -8154,34 +8120,20 @@ popcli(void) + 8010429f: 90 nop + + 801042a0 : +-#include "types.h" +-#include "x86.h" +- +-void* +-memset(void *dst, int c, uint n) +-{ + 801042a0: 55 push %ebp + 801042a1: 89 e5 mov %esp,%ebp + 801042a3: 8b 55 08 mov 0x8(%ebp),%edx + 801042a6: 57 push %edi + 801042a7: 8b 4d 10 mov 0x10(%ebp),%ecx + 801042aa: 53 push %ebx +- if ((int)dst%4 == 0 && n%4 == 0){ + 801042ab: f6 c2 03 test $0x3,%dl + 801042ae: 75 05 jne 801042b5 + 801042b0: f6 c1 03 test $0x3,%cl + 801042b3: 74 13 je 801042c8 +- asm volatile("cld; rep stosb" : + 801042b5: 89 d7 mov %edx,%edi + 801042b7: 8b 45 0c mov 0xc(%ebp),%eax + 801042ba: fc cld + 801042bb: f3 aa rep stos %al,%es:(%edi) +- c &= 0xFF; +- stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); +- } else +- stosb(dst, c, n); +- return dst; +-} + 801042bd: 5b pop %ebx + 801042be: 89 d0 mov %edx,%eax + 801042c0: 5f pop %edi +@@ -8189,9 +8141,7 @@ memset(void *dst, int c, uint n) + 801042c2: c3 ret + 801042c3: 90 nop + 801042c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- c &= 0xFF; + 801042c8: 0f b6 7d 0c movzbl 0xc(%ebp),%edi +- stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); + 801042cc: c1 e9 02 shr $0x2,%ecx + 801042cf: 89 f8 mov %edi,%eax + 801042d1: 89 fb mov %edi,%ebx +@@ -8201,11 +8151,9 @@ memset(void *dst, int c, uint n) + 801042db: 09 f8 or %edi,%eax + 801042dd: c1 e7 08 shl $0x8,%edi + 801042e0: 09 f8 or %edi,%eax +- asm volatile("cld; rep stosl" : + 801042e2: 89 d7 mov %edx,%edi + 801042e4: fc cld + 801042e5: f3 ab rep stos %eax,%es:(%edi) +-} + 801042e7: 5b pop %ebx + 801042e8: 89 d0 mov %edx,%eax + 801042ea: 5f pop %edi +@@ -8214,10 +8162,6 @@ memset(void *dst, int c, uint n) + 801042ed: 8d 76 00 lea 0x0(%esi),%esi + + 801042f0 : +- +-int +-memcmp(const void *v1, const void *v2, uint n) +-{ + 801042f0: 55 push %ebp + 801042f1: 89 e5 mov %esp,%ebp + 801042f3: 8b 45 10 mov 0x10(%ebp),%eax +@@ -8226,15 +8170,9 @@ memcmp(const void *v1, const void *v2, uint n) + 801042f8: 8b 75 0c mov 0xc(%ebp),%esi + 801042fb: 53 push %ebx + 801042fc: 8b 5d 08 mov 0x8(%ebp),%ebx +- const uchar *s1, *s2; +- +- s1 = v1; +- s2 = v2; +- while(n-- > 0){ + 801042ff: 85 c0 test %eax,%eax + 80104301: 8d 78 ff lea -0x1(%eax),%edi + 80104304: 74 26 je 8010432c +- if(*s1 != *s2) + 80104306: 0f b6 03 movzbl (%ebx),%eax + 80104309: 31 d2 xor %edx,%edx + 8010430b: 0f b6 0e movzbl (%esi),%ecx +@@ -8247,19 +8185,10 @@ memcmp(const void *v1, const void *v2, uint n) + 80104320: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 80104324: 38 c8 cmp %cl,%al + 80104326: 75 10 jne 80104338 +- while(n-- > 0){ + 80104328: 39 fa cmp %edi,%edx + 8010432a: 75 ec jne 80104318 +- return *s1 - *s2; +- s1++, s2++; +- } +- +- return 0; +-} + 8010432c: 5b pop %ebx +- return 0; + 8010432d: 31 c0 xor %eax,%eax +-} + 8010432f: 5e pop %esi + 80104330: 5f pop %edi + 80104331: 5d pop %ebp +@@ -8267,9 +8196,7 @@ memcmp(const void *v1, const void *v2, uint n) + 80104333: 90 nop + 80104334: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 80104338: 5b pop %ebx +- return *s1 - *s2; + 80104339: 29 c8 sub %ecx,%eax +-} + 8010433b: 5e pop %esi + 8010433c: 5f pop %edi + 8010433d: 5d pop %ebp +@@ -8277,10 +8204,6 @@ memcmp(const void *v1, const void *v2, uint n) + 8010433f: 90 nop + + 80104340 : +- +-void* +-memmove(void *dst, const void *src, uint n) +-{ + 80104340: 55 push %ebp + 80104341: 89 e5 mov %esp,%ebp + 80104343: 57 push %edi +@@ -8289,24 +8212,13 @@ memmove(void *dst, const void *src, uint n) + 80104348: 8b 75 0c mov 0xc(%ebp),%esi + 8010434b: 53 push %ebx + 8010434c: 8b 5d 10 mov 0x10(%ebp),%ebx +- const char *s; +- char *d; +- +- s = src; +- d = dst; +- if(s < d && s + n > d){ + 8010434f: 39 c6 cmp %eax,%esi + 80104351: 73 35 jae 80104388 + 80104353: 8d 0c 1e lea (%esi,%ebx,1),%ecx + 80104356: 39 c8 cmp %ecx,%eax + 80104358: 73 2e jae 80104388 +- s += n; +- d += n; +- while(n-- > 0) + 8010435a: 85 db test %ebx,%ebx +- d += n; + 8010435c: 8d 3c 18 lea (%eax,%ebx,1),%edi +- while(n-- > 0) + 8010435f: 8d 53 ff lea -0x1(%ebx),%edx + 80104362: 74 1b je 8010437f + 80104364: f7 db neg %ebx +@@ -8314,38 +8226,26 @@ memmove(void *dst, const void *src, uint n) + 80104369: 01 fb add %edi,%ebx + 8010436b: 90 nop + 8010436c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- *--d = *--s; + 80104370: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 80104374: 88 0c 13 mov %cl,(%ebx,%edx,1) +- while(n-- > 0) + 80104377: 83 ea 01 sub $0x1,%edx + 8010437a: 83 fa ff cmp $0xffffffff,%edx + 8010437d: 75 f1 jne 80104370 +- } else +- while(n-- > 0) +- *d++ = *s++; +- +- return dst; +-} + 8010437f: 5b pop %ebx + 80104380: 5e pop %esi + 80104381: 5f pop %edi + 80104382: 5d pop %ebp + 80104383: c3 ret + 80104384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- while(n-- > 0) + 80104388: 31 d2 xor %edx,%edx + 8010438a: 85 db test %ebx,%ebx + 8010438c: 74 f1 je 8010437f + 8010438e: 66 90 xchg %ax,%ax +- *d++ = *s++; + 80104390: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 80104394: 88 0c 10 mov %cl,(%eax,%edx,1) + 80104397: 83 c2 01 add $0x1,%edx +- while(n-- > 0) + 8010439a: 39 da cmp %ebx,%edx + 8010439c: 75 f2 jne 80104390 +-} + 8010439e: 5b pop %ebx + 8010439f: 5e pop %esi + 801043a0: 5f pop %edi +@@ -8355,26 +8255,14 @@ memmove(void *dst, const void *src, uint n) + 801043a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + + 801043b0 : +- +-// memcpy exists to placate GCC. Use memmove. +-void* +-memcpy(void *dst, const void *src, uint n) +-{ + 801043b0: 55 push %ebp + 801043b1: 89 e5 mov %esp,%ebp +- return memmove(dst, src, n); +-} + 801043b3: 5d pop %ebp +- return memmove(dst, src, n); + 801043b4: eb 8a jmp 80104340 + 801043b6: 8d 76 00 lea 0x0(%esi),%esi + 801043b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + + 801043c0 : +- +-int +-strncmp(const char *p, const char *q, uint n) +-{ + 801043c0: 55 push %ebp + 801043c1: 89 e5 mov %esp,%ebp + 801043c3: 56 push %esi +@@ -8382,7 +8270,6 @@ strncmp(const char *p, const char *q, uint n) + 801043c7: 53 push %ebx + 801043c8: 8b 4d 08 mov 0x8(%ebp),%ecx + 801043cb: 8b 5d 0c mov 0xc(%ebp),%ebx +- while(n > 0 && *p && *p == *q) + 801043ce: 85 f6 test %esi,%esi + 801043d0: 74 30 je 80104402 + 801043d2: 0f b6 01 movzbl (%ecx),%eax +@@ -8402,33 +8289,20 @@ strncmp(const char *p, const char *q, uint n) + 801043f2: 83 c2 01 add $0x1,%edx + 801043f5: 38 d8 cmp %bl,%al + 801043f7: 75 17 jne 80104410 +- n--, p++, q++; + 801043f9: 89 cb mov %ecx,%ebx +- while(n > 0 && *p && *p == *q) + 801043fb: 39 f2 cmp %esi,%edx +- n--, p++, q++; + 801043fd: 8d 4b 01 lea 0x1(%ebx),%ecx +- while(n > 0 && *p && *p == *q) + 80104400: 75 e6 jne 801043e8 +- if(n == 0) +- return 0; +- return (uchar)*p - (uchar)*q; +-} + 80104402: 5b pop %ebx +- return 0; + 80104403: 31 c0 xor %eax,%eax +-} + 80104405: 5e pop %esi + 80104406: 5d pop %ebp + 80104407: c3 ret + 80104408: 0f b6 1b movzbl (%ebx),%ebx +- while(n > 0 && *p && *p == *q) + 8010440b: 31 c0 xor %eax,%eax + 8010440d: 8d 76 00 lea 0x0(%esi),%esi +- return (uchar)*p - (uchar)*q; + 80104410: 0f b6 d3 movzbl %bl,%edx + 80104413: 29 d0 sub %edx,%eax +-} + 80104415: 5b pop %ebx + 80104416: 5e pop %esi + 80104417: 5d pop %ebp +@@ -8436,16 +8310,11 @@ strncmp(const char *p, const char *q, uint n) + 80104419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 80104420: 0f b6 5b 01 movzbl 0x1(%ebx),%ebx + 80104424: eb ea jmp 80104410 +- while(n > 0 && *p && *p == *q) + 80104426: 89 d3 mov %edx,%ebx + 80104428: eb e6 jmp 80104410 + 8010442a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + + 80104430 : +- +-char* +-strncpy(char *s, const char *t, int n) +-{ + 80104430: 55 push %ebp + 80104431: 89 e5 mov %esp,%ebp + 80104433: 8b 45 08 mov 0x8(%ebp),%eax +@@ -8453,10 +8322,6 @@ strncpy(char *s, const char *t, int n) + 80104437: 8b 4d 10 mov 0x10(%ebp),%ecx + 8010443a: 53 push %ebx + 8010443b: 8b 5d 0c mov 0xc(%ebp),%ebx +- char *os; +- +- os = s; +- while(n-- > 0 && (*s++ = *t++) != 0) + 8010443e: 89 c2 mov %eax,%edx + 80104440: eb 19 jmp 8010445b + 80104442: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +@@ -8470,21 +8335,15 @@ strncpy(char *s, const char *t, int n) + 8010445b: 85 c9 test %ecx,%ecx + 8010445d: 8d 71 ff lea -0x1(%ecx),%esi + 80104460: 7f e6 jg 80104448 +- ; +- while(n-- > 0) + 80104462: 31 c9 xor %ecx,%ecx + 80104464: 85 f6 test %esi,%esi + 80104466: 7e 0f jle 80104477 +- *s++ = 0; + 80104468: c6 04 0a 00 movb $0x0,(%edx,%ecx,1) + 8010446c: 89 f3 mov %esi,%ebx + 8010446e: 83 c1 01 add $0x1,%ecx + 80104471: 29 cb sub %ecx,%ebx +- while(n-- > 0) + 80104473: 85 db test %ebx,%ebx + 80104475: 7f f1 jg 80104468 +- return os; +-} + 80104477: 5b pop %ebx + 80104478: 5e pop %esi + 80104479: 5d pop %ebp +@@ -8493,11 +8352,6 @@ strncpy(char *s, const char *t, int n) + 8010447c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + + 80104480 : +- +-// Like strncpy but guaranteed to NUL-terminate. +-char* +-safestrcpy(char *s, const char *t, int n) +-{ + 80104480: 55 push %ebp + 80104481: 89 e5 mov %esp,%ebp + 80104483: 8b 4d 10 mov 0x10(%ebp),%ecx +@@ -8505,18 +8359,12 @@ safestrcpy(char *s, const char *t, int n) + 80104487: 8b 45 08 mov 0x8(%ebp),%eax + 8010448a: 53 push %ebx + 8010448b: 8b 55 0c mov 0xc(%ebp),%edx +- char *os; +- +- os = s; +- if(n <= 0) + 8010448e: 85 c9 test %ecx,%ecx + 80104490: 7e 26 jle 801044b8 + 80104492: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi + 80104496: 89 c1 mov %eax,%ecx + 80104498: eb 17 jmp 801044b1 + 8010449a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- return os; +- while(--n > 0 && (*s++ = *t++) != 0) + 801044a0: 83 c2 01 add $0x1,%edx + 801044a3: 0f b6 5a ff movzbl -0x1(%edx),%ebx + 801044a7: 83 c1 01 add $0x1,%ecx +@@ -8525,11 +8373,7 @@ safestrcpy(char *s, const char *t, int n) + 801044af: 74 04 je 801044b5 + 801044b1: 39 f2 cmp %esi,%edx + 801044b3: 75 eb jne 801044a0 +- ; +- *s = 0; + 801044b5: c6 01 00 movb $0x0,(%ecx) +- return os; +-} + 801044b8: 5b pop %ebx + 801044b9: 5e pop %esi + 801044ba: 5d pop %ebp +@@ -8537,68 +8381,32 @@ safestrcpy(char *s, const char *t, int n) + 801044bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + + 801044c0 : +- +-int +-strlen(const char *s) +-{ + 801044c0: 55 push %ebp +- int n; +- +- for(n = 0; s[n]; n++) + 801044c1: 31 c0 xor %eax,%eax +-{ + 801044c3: 89 e5 mov %esp,%ebp + 801044c5: 8b 55 08 mov 0x8(%ebp),%edx +- for(n = 0; s[n]; n++) + 801044c8: 80 3a 00 cmpb $0x0,(%edx) + 801044cb: 74 0c je 801044d9 + 801044cd: 8d 76 00 lea 0x0(%esi),%esi + 801044d0: 83 c0 01 add $0x1,%eax + 801044d3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 801044d7: 75 f7 jne 801044d0 +- ; +- return n; +-} + 801044d9: 5d pop %ebp + 801044da: c3 ret + + 801044db : +-# a struct context, and save its address in *old. +-# Switch stacks to new and pop previously-saved registers. +- +-.globl swtch +-swtch: +- movl 4(%esp), %eax + 801044db: 8b 44 24 04 mov 0x4(%esp),%eax +- movl 8(%esp), %edx + 801044df: 8b 54 24 08 mov 0x8(%esp),%edx +- +- # Save old callee-saved registers +- pushl %ebp + 801044e3: 55 push %ebp +- pushl %ebx + 801044e4: 53 push %ebx +- pushl %esi + 801044e5: 56 push %esi +- pushl %edi + 801044e6: 57 push %edi +- +- # Switch stacks +- movl %esp, (%eax) + 801044e7: 89 20 mov %esp,(%eax) +- movl %edx, %esp + 801044e9: 89 d4 mov %edx,%esp +- +- # Load new callee-saved registers +- popl %edi + 801044eb: 5f pop %edi +- popl %esi + 801044ec: 5e pop %esi +- popl %ebx + 801044ed: 5b pop %ebx +- popl %ebp + 801044ee: 5d pop %ebp +- ret + 801044ef: c3 ret + + 801044f0 : +@@ -8861,7 +8669,7 @@ syscall(void) + 80104675: 8d 50 ff lea -0x1(%eax),%edx + 80104678: 83 fa 14 cmp $0x14,%edx + 8010467b: 77 1b ja 80104698 +-8010467d: 8b 14 85 00 73 10 80 mov -0x7fef8d00(,%eax,4),%edx ++8010467d: 8b 14 85 20 73 10 80 mov -0x7fef8ce0(,%eax,4),%edx + 80104684: 85 d2 test %edx,%edx + 80104686: 74 10 je 80104698 + curproc->tf->eax = syscalls[num](); +@@ -8886,7 +8694,7 @@ syscall(void) + 8010469f: 89 44 24 08 mov %eax,0x8(%esp) + cprintf("%d %s: unknown sys call %d\n", + 801046a3: 8b 43 10 mov 0x10(%ebx),%eax +-801046a6: c7 04 24 d1 72 10 80 movl $0x801072d1,(%esp) ++801046a6: c7 04 24 f1 72 10 80 movl $0x801072f1,(%esp) + 801046ad: 89 44 24 04 mov %eax,0x4(%esp) + 801046b1: e8 9a bf ff ff call 80100650 + curproc->tf->eax = -1; +@@ -9099,7 +8907,7 @@ create(char *path, short type, short major, short minor) + 80104828: e8 c3 cd ff ff call 801015f0 + if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) + 8010482d: 8b 46 04 mov 0x4(%esi),%eax +-80104830: c7 44 24 04 74 73 10 movl $0x80107374,0x4(%esp) ++80104830: c7 44 24 04 94 73 10 movl $0x80107394,0x4(%esp) + 80104837: 80 + 80104838: 89 34 24 mov %esi,(%esp) + 8010483b: 89 44 24 08 mov %eax,0x8(%esp) +@@ -9107,7 +8915,7 @@ create(char *path, short type, short major, short minor) + 80104844: 85 c0 test %eax,%eax + 80104846: 78 1b js 80104863 + 80104848: 8b 47 04 mov 0x4(%edi),%eax +-8010484b: c7 44 24 04 73 73 10 movl $0x80107373,0x4(%esp) ++8010484b: c7 44 24 04 93 73 10 movl $0x80107393,0x4(%esp) + 80104852: 80 + 80104853: 89 34 24 mov %esi,(%esp) + 80104856: 89 44 24 08 mov %eax,0x8(%esp) +@@ -9115,13 +8923,13 @@ create(char *path, short type, short major, short minor) + 8010485f: 85 c0 test %eax,%eax + 80104861: 79 89 jns 801047ec + panic("create dots"); +-80104863: c7 04 24 67 73 10 80 movl $0x80107367,(%esp) ++80104863: c7 04 24 87 73 10 80 movl $0x80107387,(%esp) + 8010486a: e8 f1 ba ff ff call 80100360 + panic("create: dirlink"); +-8010486f: c7 04 24 76 73 10 80 movl $0x80107376,(%esp) ++8010486f: c7 04 24 96 73 10 80 movl $0x80107396,(%esp) + 80104876: e8 e5 ba ff ff call 80100360 + panic("create: ialloc"); +-8010487b: c7 04 24 58 73 10 80 movl $0x80107358,(%esp) ++8010487b: c7 04 24 78 73 10 80 movl $0x80107378,(%esp) + 80104882: e8 d9 ba ff ff call 80100360 + 80104887: 89 f6 mov %esi,%esi + 80104889: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +@@ -9531,13 +9339,13 @@ argfd(int n, int *pfd, struct file **pf) + 80104c19: 89 34 24 mov %esi,(%esp) + 80104c1c: e8 8f ca ff ff call 801016b0 + if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) +-80104c21: c7 44 24 04 74 73 10 movl $0x80107374,0x4(%esp) ++80104c21: c7 44 24 04 94 73 10 movl $0x80107394,0x4(%esp) + 80104c28: 80 + 80104c29: 89 1c 24 mov %ebx,(%esp) + 80104c2c: e8 5f cf ff ff call 80101b90 + 80104c31: 85 c0 test %eax,%eax + 80104c33: 0f 84 21 01 00 00 je 80104d5a +-80104c39: c7 44 24 04 73 73 10 movl $0x80107373,0x4(%esp) ++80104c39: c7 44 24 04 93 73 10 movl $0x80107393,0x4(%esp) + 80104c40: 80 + 80104c41: 89 1c 24 mov %ebx,(%esp) + 80104c44: e8 47 cf ff ff call 80101b90 +@@ -9658,13 +9466,13 @@ argfd(int n, int *pfd, struct file **pf) + 80104d83: e8 68 c8 ff ff call 801015f0 + 80104d88: e9 48 ff ff ff jmp 80104cd5 + panic("isdirempty: readi"); +-80104d8d: c7 04 24 98 73 10 80 movl $0x80107398,(%esp) ++80104d8d: c7 04 24 b8 73 10 80 movl $0x801073b8,(%esp) + 80104d94: e8 c7 b5 ff ff call 80100360 + panic("unlink: writei"); +-80104d99: c7 04 24 aa 73 10 80 movl $0x801073aa,(%esp) ++80104d99: c7 04 24 ca 73 10 80 movl $0x801073ca,(%esp) + 80104da0: e8 bb b5 ff ff call 80100360 + panic("unlink: nlink < 1"); +-80104da5: c7 04 24 86 73 10 80 movl $0x80107386,(%esp) ++80104da5: c7 04 24 a6 73 10 80 movl $0x801073a6,(%esp) + 80104dac: e8 af b5 ff ff call 80100360 + 80104db1: eb 0d jmp 80104dc0 + 80104db3: 90 nop +@@ -10235,11 +10043,11 @@ sys_pipe(void) + 8010520e: 66 90 xchg %ax,%ax + + 80105210 : ++#include "memlayout.h" + #include "mmu.h" + #include "proc.h" + +-int +-sys_fork(void) ++int sys_fork(void) + { + 80105210: 55 push %ebp + 80105211: 89 e5 mov %esp,%ebp +@@ -10252,8 +10060,7 @@ sys_fork(void) + + 80105220 : + +-int +-sys_exit(void) ++int sys_exit(void) + { + 80105220: 55 push %ebp + 80105221: 89 e5 mov %esp,%ebp +@@ -10268,7 +10075,7 @@ sys_exit(void) + 80105239: 8b 45 f4 mov -0xc(%ebp),%eax + 8010523c: 89 04 24 mov %eax,(%esp) + 8010523f: e8 5c e8 ff ff call 80103aa0 +- return 0; // not reached ++ return 0; // not reached + } + 80105244: 31 c0 xor %eax,%eax + 80105246: c9 leave +@@ -10278,4516 +10085,3226 @@ sys_exit(void) + + 80105250 : + +-int +-sys_wait(void) ++int sys_wait(void) + { + 80105250: 55 push %ebp + 80105251: 89 e5 mov %esp,%ebp +- return wait(); ++80105253: 83 ec 28 sub $0x28,%esp ++ int *status; ++ if (argptr(0, (void *)&status, sizeof(status)) < 0) ++80105256: 8d 45 f4 lea -0xc(%ebp),%eax ++80105259: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) ++80105260: 00 ++80105261: 89 44 24 04 mov %eax,0x4(%esp) ++80105265: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++8010526c: e8 4f f3 ff ff call 801045c0 ++80105271: 85 c0 test %eax,%eax ++80105273: 78 13 js 80105288 ++ { ++ return -1; ++ } ++ ++ return wait(status); ++80105275: 8b 45 f4 mov -0xc(%ebp),%eax ++80105278: 89 04 24 mov %eax,(%esp) ++8010527b: e8 30 ea ff ff call 80103cb0 + } +-80105253: 5d pop %ebp +- return wait(); +-80105254: e9 57 ea ff ff jmp 80103cb0 +-80105259: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++80105280: c9 leave ++80105281: c3 ret ++80105282: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ return -1; ++80105288: b8 ff ff ff ff mov $0xffffffff,%eax ++} ++8010528d: c9 leave ++8010528e: c3 ret ++8010528f: 90 nop + +-80105260 : ++80105290 : + +-int +-sys_kill(void) ++int sys_kill(void) + { +-80105260: 55 push %ebp +-80105261: 89 e5 mov %esp,%ebp +-80105263: 83 ec 28 sub $0x28,%esp ++80105290: 55 push %ebp ++80105291: 89 e5 mov %esp,%ebp ++80105293: 83 ec 28 sub $0x28,%esp + int pid; + +- if(argint(0, &pid) < 0) +-80105266: 8d 45 f4 lea -0xc(%ebp),%eax +-80105269: 89 44 24 04 mov %eax,0x4(%esp) +-8010526d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +-80105274: e8 17 f3 ff ff call 80104590 +-80105279: 85 c0 test %eax,%eax +-8010527b: 78 13 js 80105290 ++ if (argint(0, &pid) < 0) ++80105296: 8d 45 f4 lea -0xc(%ebp),%eax ++80105299: 89 44 24 04 mov %eax,0x4(%esp) ++8010529d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++801052a4: e8 e7 f2 ff ff call 80104590 ++801052a9: 85 c0 test %eax,%eax ++801052ab: 78 13 js 801052c0 + return -1; + return kill(pid); +-8010527d: 8b 45 f4 mov -0xc(%ebp),%eax +-80105280: 89 04 24 mov %eax,(%esp) +-80105283: e8 68 eb ff ff call 80103df0 ++801052ad: 8b 45 f4 mov -0xc(%ebp),%eax ++801052b0: 89 04 24 mov %eax,(%esp) ++801052b3: e8 38 eb ff ff call 80103df0 + } +-80105288: c9 leave +-80105289: c3 ret +-8010528a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++801052b8: c9 leave ++801052b9: c3 ret ++801052ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + return -1; +-80105290: b8 ff ff ff ff mov $0xffffffff,%eax ++801052c0: b8 ff ff ff ff mov $0xffffffff,%eax + } +-80105295: c9 leave +-80105296: c3 ret +-80105297: 89 f6 mov %esi,%esi +-80105299: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++801052c5: c9 leave ++801052c6: c3 ret ++801052c7: 89 f6 mov %esi,%esi ++801052c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-801052a0 : ++801052d0 : + +-int +-sys_getpid(void) ++int sys_getpid(void) + { +-801052a0: 55 push %ebp +-801052a1: 89 e5 mov %esp,%ebp +-801052a3: 83 ec 08 sub $0x8,%esp ++801052d0: 55 push %ebp ++801052d1: 89 e5 mov %esp,%ebp ++801052d3: 83 ec 08 sub $0x8,%esp + return myproc()->pid; +-801052a6: e8 f5 e3 ff ff call 801036a0 +-801052ab: 8b 40 10 mov 0x10(%eax),%eax ++801052d6: e8 c5 e3 ff ff call 801036a0 ++801052db: 8b 40 10 mov 0x10(%eax),%eax + } +-801052ae: c9 leave +-801052af: c3 ret ++801052de: c9 leave ++801052df: c3 ret + +-801052b0 : ++801052e0 : + +-int +-sys_sbrk(void) ++int sys_sbrk(void) + { +-801052b0: 55 push %ebp +-801052b1: 89 e5 mov %esp,%ebp +-801052b3: 53 push %ebx +-801052b4: 83 ec 24 sub $0x24,%esp ++801052e0: 55 push %ebp ++801052e1: 89 e5 mov %esp,%ebp ++801052e3: 53 push %ebx ++801052e4: 83 ec 24 sub $0x24,%esp + int addr; + int n; + +- if(argint(0, &n) < 0) +-801052b7: 8d 45 f4 lea -0xc(%ebp),%eax +-801052ba: 89 44 24 04 mov %eax,0x4(%esp) +-801052be: c7 04 24 00 00 00 00 movl $0x0,(%esp) +-801052c5: e8 c6 f2 ff ff call 80104590 +-801052ca: 85 c0 test %eax,%eax +-801052cc: 78 22 js 801052f0 ++ if (argint(0, &n) < 0) ++801052e7: 8d 45 f4 lea -0xc(%ebp),%eax ++801052ea: 89 44 24 04 mov %eax,0x4(%esp) ++801052ee: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++801052f5: e8 96 f2 ff ff call 80104590 ++801052fa: 85 c0 test %eax,%eax ++801052fc: 78 22 js 80105320 + return -1; + addr = myproc()->sz; +-801052ce: e8 cd e3 ff ff call 801036a0 +- if(growproc(n) < 0) +-801052d3: 8b 55 f4 mov -0xc(%ebp),%edx ++801052fe: e8 9d e3 ff ff call 801036a0 ++ if (growproc(n) < 0) ++80105303: 8b 55 f4 mov -0xc(%ebp),%edx + addr = myproc()->sz; +-801052d6: 8b 18 mov (%eax),%ebx +- if(growproc(n) < 0) +-801052d8: 89 14 24 mov %edx,(%esp) +-801052db: e8 00 e5 ff ff call 801037e0 +-801052e0: 85 c0 test %eax,%eax +-801052e2: 78 0c js 801052f0 ++80105306: 8b 18 mov (%eax),%ebx ++ if (growproc(n) < 0) ++80105308: 89 14 24 mov %edx,(%esp) ++8010530b: e8 d0 e4 ff ff call 801037e0 ++80105310: 85 c0 test %eax,%eax ++80105312: 78 0c js 80105320 + return -1; + return addr; +-801052e4: 89 d8 mov %ebx,%eax ++80105314: 89 d8 mov %ebx,%eax + } +-801052e6: 83 c4 24 add $0x24,%esp +-801052e9: 5b pop %ebx +-801052ea: 5d pop %ebp +-801052eb: c3 ret +-801052ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++80105316: 83 c4 24 add $0x24,%esp ++80105319: 5b pop %ebx ++8010531a: 5d pop %ebp ++8010531b: c3 ret ++8010531c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +-801052f0: b8 ff ff ff ff mov $0xffffffff,%eax +-801052f5: eb ef jmp 801052e6 +-801052f7: 89 f6 mov %esi,%esi +-801052f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++80105320: b8 ff ff ff ff mov $0xffffffff,%eax ++80105325: eb ef jmp 80105316 ++80105327: 89 f6 mov %esi,%esi ++80105329: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-80105300 : ++80105330 : + +-int +-sys_sleep(void) ++int sys_sleep(void) + { +-80105300: 55 push %ebp +-80105301: 89 e5 mov %esp,%ebp +-80105303: 53 push %ebx +-80105304: 83 ec 24 sub $0x24,%esp ++80105330: 55 push %ebp ++80105331: 89 e5 mov %esp,%ebp ++80105333: 53 push %ebx ++80105334: 83 ec 24 sub $0x24,%esp + int n; + uint ticks0; + +- if(argint(0, &n) < 0) +-80105307: 8d 45 f4 lea -0xc(%ebp),%eax +-8010530a: 89 44 24 04 mov %eax,0x4(%esp) +-8010530e: c7 04 24 00 00 00 00 movl $0x0,(%esp) +-80105315: e8 76 f2 ff ff call 80104590 +-8010531a: 85 c0 test %eax,%eax +-8010531c: 78 7e js 8010539c ++ if (argint(0, &n) < 0) ++80105337: 8d 45 f4 lea -0xc(%ebp),%eax ++8010533a: 89 44 24 04 mov %eax,0x4(%esp) ++8010533e: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++80105345: e8 46 f2 ff ff call 80104590 ++8010534a: 85 c0 test %eax,%eax ++8010534c: 78 7e js 801053cc + return -1; + acquire(&tickslock); +-8010531e: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-80105325: e8 b6 ee ff ff call 801041e0 ++8010534e: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++80105355: e8 86 ee ff ff call 801041e0 + ticks0 = ticks; +- while(ticks - ticks0 < n){ +-8010532a: 8b 55 f4 mov -0xc(%ebp),%edx ++ while (ticks - ticks0 < n) ++8010535a: 8b 55 f4 mov -0xc(%ebp),%edx + ticks0 = ticks; +-8010532d: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx +- while(ticks - ticks0 < n){ +-80105333: 85 d2 test %edx,%edx +-80105335: 75 29 jne 80105360 +-80105337: eb 4f jmp 80105388 +-80105339: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- if(myproc()->killed){ ++8010535d: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx ++ while (ticks - ticks0 < n) ++80105363: 85 d2 test %edx,%edx ++80105365: 75 29 jne 80105390 ++80105367: eb 4f jmp 801053b8 ++80105369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ if (myproc()->killed) ++ { + release(&tickslock); + return -1; + } + sleep(&ticks, &tickslock); +-80105340: c7 44 24 04 60 4d 11 movl $0x80114d60,0x4(%esp) +-80105347: 80 +-80105348: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp) +-8010534f: e8 ac e8 ff ff call 80103c00 +- while(ticks - ticks0 < n){ +-80105354: a1 a0 55 11 80 mov 0x801155a0,%eax +-80105359: 29 d8 sub %ebx,%eax +-8010535b: 3b 45 f4 cmp -0xc(%ebp),%eax +-8010535e: 73 28 jae 80105388 +- if(myproc()->killed){ +-80105360: e8 3b e3 ff ff call 801036a0 +-80105365: 8b 40 24 mov 0x24(%eax),%eax +-80105368: 85 c0 test %eax,%eax +-8010536a: 74 d4 je 80105340 ++80105370: c7 44 24 04 60 4d 11 movl $0x80114d60,0x4(%esp) ++80105377: 80 ++80105378: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp) ++8010537f: e8 7c e8 ff ff call 80103c00 ++ while (ticks - ticks0 < n) ++80105384: a1 a0 55 11 80 mov 0x801155a0,%eax ++80105389: 29 d8 sub %ebx,%eax ++8010538b: 3b 45 f4 cmp -0xc(%ebp),%eax ++8010538e: 73 28 jae 801053b8 ++ if (myproc()->killed) ++80105390: e8 0b e3 ff ff call 801036a0 ++80105395: 8b 40 24 mov 0x24(%eax),%eax ++80105398: 85 c0 test %eax,%eax ++8010539a: 74 d4 je 80105370 + release(&tickslock); +-8010536c: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-80105373: e8 d8 ee ff ff call 80104250 ++8010539c: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++801053a3: e8 a8 ee ff ff call 80104250 + return -1; +-80105378: b8 ff ff ff ff mov $0xffffffff,%eax ++801053a8: b8 ff ff ff ff mov $0xffffffff,%eax + } + release(&tickslock); + return 0; + } +-8010537d: 83 c4 24 add $0x24,%esp +-80105380: 5b pop %ebx +-80105381: 5d pop %ebp +-80105382: c3 ret +-80105383: 90 nop +-80105384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++801053ad: 83 c4 24 add $0x24,%esp ++801053b0: 5b pop %ebx ++801053b1: 5d pop %ebp ++801053b2: c3 ret ++801053b3: 90 nop ++801053b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + release(&tickslock); +-80105388: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-8010538f: e8 bc ee ff ff call 80104250 ++801053b8: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++801053bf: e8 8c ee ff ff call 80104250 + } +-80105394: 83 c4 24 add $0x24,%esp ++801053c4: 83 c4 24 add $0x24,%esp + return 0; +-80105397: 31 c0 xor %eax,%eax ++801053c7: 31 c0 xor %eax,%eax + } +-80105399: 5b pop %ebx +-8010539a: 5d pop %ebp +-8010539b: c3 ret ++801053c9: 5b pop %ebx ++801053ca: 5d pop %ebp ++801053cb: c3 ret + return -1; +-8010539c: b8 ff ff ff ff mov $0xffffffff,%eax +-801053a1: eb da jmp 8010537d +-801053a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +-801053a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++801053cc: b8 ff ff ff ff mov $0xffffffff,%eax ++801053d1: eb da jmp 801053ad ++801053d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++801053d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-801053b0 : ++801053e0 : + + // return how many clock tick interrupts have occurred + // since start. +-int +-sys_uptime(void) ++int sys_uptime(void) + { +-801053b0: 55 push %ebp +-801053b1: 89 e5 mov %esp,%ebp +-801053b3: 53 push %ebx +-801053b4: 83 ec 14 sub $0x14,%esp ++801053e0: 55 push %ebp ++801053e1: 89 e5 mov %esp,%ebp ++801053e3: 53 push %ebx ++801053e4: 83 ec 14 sub $0x14,%esp + uint xticks; + + acquire(&tickslock); +-801053b7: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-801053be: e8 1d ee ff ff call 801041e0 ++801053e7: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++801053ee: e8 ed ed ff ff call 801041e0 + xticks = ticks; +-801053c3: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx ++801053f3: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx + release(&tickslock); +-801053c9: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-801053d0: e8 7b ee ff ff call 80104250 ++801053f9: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++80105400: e8 4b ee ff ff call 80104250 + return xticks; + } +-801053d5: 83 c4 14 add $0x14,%esp +-801053d8: 89 d8 mov %ebx,%eax +-801053da: 5b pop %ebx +-801053db: 5d pop %ebp +-801053dc: c3 ret +- +-801053dd : +- +- # vectors.S sends all traps here. +-.globl alltraps +-alltraps: +- # Build trap frame. +- pushl %ds +-801053dd: 1e push %ds +- pushl %es +-801053de: 06 push %es +- pushl %fs +-801053df: 0f a0 push %fs +- pushl %gs +-801053e1: 0f a8 push %gs +- pushal +-801053e3: 60 pusha +- +- # Set up data segments. +- movw $(SEG_KDATA<<3), %ax +-801053e4: 66 b8 10 00 mov $0x10,%ax +- movw %ax, %ds +-801053e8: 8e d8 mov %eax,%ds +- movw %ax, %es +-801053ea: 8e c0 mov %eax,%es +- +- # Call trap(tf), where tf=%esp +- pushl %esp +-801053ec: 54 push %esp +- call trap +-801053ed: e8 de 00 00 00 call 801054d0 +- addl $4, %esp +-801053f2: 83 c4 04 add $0x4,%esp +- +-801053f5 : +- +- # Return falls through to trapret... +-.globl trapret +-trapret: +- popal +-801053f5: 61 popa +- popl %gs +-801053f6: 0f a9 pop %gs +- popl %fs +-801053f8: 0f a1 pop %fs +- popl %es +-801053fa: 07 pop %es +- popl %ds +-801053fb: 1f pop %ds +- addl $0x8, %esp # trapno and errcode +-801053fc: 83 c4 08 add $0x8,%esp +- iret +-801053ff: cf iret +- +-80105400 : ++80105405: 83 c4 14 add $0x14,%esp ++80105408: 89 d8 mov %ebx,%eax ++8010540a: 5b pop %ebx ++8010540b: 5d pop %ebp ++8010540c: c3 ret ++ ++8010540d : ++8010540d: 1e push %ds ++8010540e: 06 push %es ++8010540f: 0f a0 push %fs ++80105411: 0f a8 push %gs ++80105413: 60 pusha ++80105414: 66 b8 10 00 mov $0x10,%ax ++80105418: 8e d8 mov %eax,%ds ++8010541a: 8e c0 mov %eax,%es ++8010541c: 54 push %esp ++8010541d: e8 de 00 00 00 call 80105500 ++80105422: 83 c4 04 add $0x4,%esp ++ ++80105425 : ++80105425: 61 popa ++80105426: 0f a9 pop %gs ++80105428: 0f a1 pop %fs ++8010542a: 07 pop %es ++8010542b: 1f pop %ds ++8010542c: 83 c4 08 add $0x8,%esp ++8010542f: cf iret ++ ++80105430 : + void + tvinit(void) + { + int i; + + for(i = 0; i < 256; i++) +-80105400: 31 c0 xor %eax,%eax +-80105402: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++80105430: 31 c0 xor %eax,%eax ++80105432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); +-80105408: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx +-8010540f: b9 08 00 00 00 mov $0x8,%ecx +-80105414: 66 89 0c c5 a2 4d 11 mov %cx,-0x7feeb25e(,%eax,8) +-8010541b: 80 +-8010541c: c6 04 c5 a4 4d 11 80 movb $0x0,-0x7feeb25c(,%eax,8) +-80105423: 00 +-80105424: c6 04 c5 a5 4d 11 80 movb $0x8e,-0x7feeb25b(,%eax,8) +-8010542b: 8e +-8010542c: 66 89 14 c5 a0 4d 11 mov %dx,-0x7feeb260(,%eax,8) +-80105433: 80 +-80105434: c1 ea 10 shr $0x10,%edx +-80105437: 66 89 14 c5 a6 4d 11 mov %dx,-0x7feeb25a(,%eax,8) +-8010543e: 80 ++80105438: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx ++8010543f: b9 08 00 00 00 mov $0x8,%ecx ++80105444: 66 89 0c c5 a2 4d 11 mov %cx,-0x7feeb25e(,%eax,8) ++8010544b: 80 ++8010544c: c6 04 c5 a4 4d 11 80 movb $0x0,-0x7feeb25c(,%eax,8) ++80105453: 00 ++80105454: c6 04 c5 a5 4d 11 80 movb $0x8e,-0x7feeb25b(,%eax,8) ++8010545b: 8e ++8010545c: 66 89 14 c5 a0 4d 11 mov %dx,-0x7feeb260(,%eax,8) ++80105463: 80 ++80105464: c1 ea 10 shr $0x10,%edx ++80105467: 66 89 14 c5 a6 4d 11 mov %dx,-0x7feeb25a(,%eax,8) ++8010546e: 80 + for(i = 0; i < 256; i++) +-8010543f: 83 c0 01 add $0x1,%eax +-80105442: 3d 00 01 00 00 cmp $0x100,%eax +-80105447: 75 bf jne 80105408 ++8010546f: 83 c0 01 add $0x1,%eax ++80105472: 3d 00 01 00 00 cmp $0x100,%eax ++80105477: 75 bf jne 80105438 + { +-80105449: 55 push %ebp ++80105479: 55 push %ebp + SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); +-8010544a: ba 08 00 00 00 mov $0x8,%edx ++8010547a: ba 08 00 00 00 mov $0x8,%edx + { +-8010544f: 89 e5 mov %esp,%ebp +-80105451: 83 ec 18 sub $0x18,%esp ++8010547f: 89 e5 mov %esp,%ebp ++80105481: 83 ec 18 sub $0x18,%esp + SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); +-80105454: a1 08 a1 10 80 mov 0x8010a108,%eax ++80105484: a1 08 a1 10 80 mov 0x8010a108,%eax + + initlock(&tickslock, "time"); +-80105459: c7 44 24 04 b9 73 10 movl $0x801073b9,0x4(%esp) +-80105460: 80 +-80105461: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++80105489: c7 44 24 04 d9 73 10 movl $0x801073d9,0x4(%esp) ++80105490: 80 ++80105491: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) + SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); +-80105468: 66 89 15 a2 4f 11 80 mov %dx,0x80114fa2 +-8010546f: 66 a3 a0 4f 11 80 mov %ax,0x80114fa0 +-80105475: c1 e8 10 shr $0x10,%eax +-80105478: c6 05 a4 4f 11 80 00 movb $0x0,0x80114fa4 +-8010547f: c6 05 a5 4f 11 80 ef movb $0xef,0x80114fa5 +-80105486: 66 a3 a6 4f 11 80 mov %ax,0x80114fa6 ++80105498: 66 89 15 a2 4f 11 80 mov %dx,0x80114fa2 ++8010549f: 66 a3 a0 4f 11 80 mov %ax,0x80114fa0 ++801054a5: c1 e8 10 shr $0x10,%eax ++801054a8: c6 05 a4 4f 11 80 00 movb $0x0,0x80114fa4 ++801054af: c6 05 a5 4f 11 80 ef movb $0xef,0x80114fa5 ++801054b6: 66 a3 a6 4f 11 80 mov %ax,0x80114fa6 + initlock(&tickslock, "time"); +-8010548c: e8 df eb ff ff call 80104070 ++801054bc: e8 af eb ff ff call 80104070 + } +-80105491: c9 leave +-80105492: c3 ret +-80105493: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +-80105499: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++801054c1: c9 leave ++801054c2: c3 ret ++801054c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++801054c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-801054a0 : ++801054d0 : + + void + idtinit(void) + { +-801054a0: 55 push %ebp ++801054d0: 55 push %ebp + pd[0] = size-1; +-801054a1: b8 ff 07 00 00 mov $0x7ff,%eax +-801054a6: 89 e5 mov %esp,%ebp +-801054a8: 83 ec 10 sub $0x10,%esp +-801054ab: 66 89 45 fa mov %ax,-0x6(%ebp) ++801054d1: b8 ff 07 00 00 mov $0x7ff,%eax ++801054d6: 89 e5 mov %esp,%ebp ++801054d8: 83 ec 10 sub $0x10,%esp ++801054db: 66 89 45 fa mov %ax,-0x6(%ebp) + pd[1] = (uint)p; +-801054af: b8 a0 4d 11 80 mov $0x80114da0,%eax +-801054b4: 66 89 45 fc mov %ax,-0x4(%ebp) ++801054df: b8 a0 4d 11 80 mov $0x80114da0,%eax ++801054e4: 66 89 45 fc mov %ax,-0x4(%ebp) + pd[2] = (uint)p >> 16; +-801054b8: c1 e8 10 shr $0x10,%eax +-801054bb: 66 89 45 fe mov %ax,-0x2(%ebp) ++801054e8: c1 e8 10 shr $0x10,%eax ++801054eb: 66 89 45 fe mov %ax,-0x2(%ebp) + asm volatile("lidt (%0)" : : "r" (pd)); +-801054bf: 8d 45 fa lea -0x6(%ebp),%eax +-801054c2: 0f 01 18 lidtl (%eax) ++801054ef: 8d 45 fa lea -0x6(%ebp),%eax ++801054f2: 0f 01 18 lidtl (%eax) + lidt(idt, sizeof(idt)); + } +-801054c5: c9 leave +-801054c6: c3 ret +-801054c7: 89 f6 mov %esi,%esi +-801054c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++801054f5: c9 leave ++801054f6: c3 ret ++801054f7: 89 f6 mov %esi,%esi ++801054f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-801054d0 : ++80105500 : + + //PAGEBREAK: 41 + void + trap(struct trapframe *tf) + { +-801054d0: 55 push %ebp +-801054d1: 89 e5 mov %esp,%ebp +-801054d3: 57 push %edi +-801054d4: 56 push %esi +-801054d5: 53 push %ebx +-801054d6: 83 ec 3c sub $0x3c,%esp +-801054d9: 8b 5d 08 mov 0x8(%ebp),%ebx ++80105500: 55 push %ebp ++80105501: 89 e5 mov %esp,%ebp ++80105503: 57 push %edi ++80105504: 56 push %esi ++80105505: 53 push %ebx ++80105506: 83 ec 3c sub $0x3c,%esp ++80105509: 8b 5d 08 mov 0x8(%ebp),%ebx + if(tf->trapno == T_SYSCALL){ +-801054dc: 8b 43 30 mov 0x30(%ebx),%eax +-801054df: 83 f8 40 cmp $0x40,%eax +-801054e2: 0f 84 a0 01 00 00 je 80105688 ++8010550c: 8b 43 30 mov 0x30(%ebx),%eax ++8010550f: 83 f8 40 cmp $0x40,%eax ++80105512: 0f 84 a0 01 00 00 je 801056b8 + if(myproc()->killed) + exit(0); + return; + } + + switch(tf->trapno){ +-801054e8: 83 e8 20 sub $0x20,%eax +-801054eb: 83 f8 1f cmp $0x1f,%eax +-801054ee: 77 08 ja 801054f8 +-801054f0: ff 24 85 60 74 10 80 jmp *-0x7fef8ba0(,%eax,4) +-801054f7: 90 nop ++80105518: 83 e8 20 sub $0x20,%eax ++8010551b: 83 f8 1f cmp $0x1f,%eax ++8010551e: 77 08 ja 80105528 ++80105520: ff 24 85 80 74 10 80 jmp *-0x7fef8b80(,%eax,4) ++80105527: 90 nop + lapiceoi(); + break; + + //PAGEBREAK: 13 + default: + if(myproc() == 0 || (tf->cs&3) == 0){ +-801054f8: e8 a3 e1 ff ff call 801036a0 +-801054fd: 85 c0 test %eax,%eax +-801054ff: 90 nop +-80105500: 0f 84 0a 02 00 00 je 80105710 +-80105506: f6 43 3c 03 testb $0x3,0x3c(%ebx) +-8010550a: 0f 84 00 02 00 00 je 80105710 ++80105528: e8 73 e1 ff ff call 801036a0 ++8010552d: 85 c0 test %eax,%eax ++8010552f: 90 nop ++80105530: 0f 84 0a 02 00 00 je 80105740 ++80105536: f6 43 3c 03 testb $0x3,0x3c(%ebx) ++8010553a: 0f 84 00 02 00 00 je 80105740 + + static inline uint + rcr2(void) + { + uint val; + asm volatile("movl %%cr2,%0" : "=r" (val)); +-80105510: 0f 20 d1 mov %cr2,%ecx ++80105540: 0f 20 d1 mov %cr2,%ecx + cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", + tf->trapno, cpuid(), tf->eip, rcr2()); + panic("trap"); + } + // In user space, assume process misbehaved. + cprintf("pid %d %s: trap %d err %d on cpu %d " +-80105513: 8b 53 38 mov 0x38(%ebx),%edx +-80105516: 89 4d d8 mov %ecx,-0x28(%ebp) +-80105519: 89 55 dc mov %edx,-0x24(%ebp) +-8010551c: e8 5f e1 ff ff call 80103680 +-80105521: 8b 73 30 mov 0x30(%ebx),%esi +-80105524: 89 c7 mov %eax,%edi +-80105526: 8b 43 34 mov 0x34(%ebx),%eax +-80105529: 89 45 e4 mov %eax,-0x1c(%ebp) ++80105543: 8b 53 38 mov 0x38(%ebx),%edx ++80105546: 89 4d d8 mov %ecx,-0x28(%ebp) ++80105549: 89 55 dc mov %edx,-0x24(%ebp) ++8010554c: e8 2f e1 ff ff call 80103680 ++80105551: 8b 73 30 mov 0x30(%ebx),%esi ++80105554: 89 c7 mov %eax,%edi ++80105556: 8b 43 34 mov 0x34(%ebx),%eax ++80105559: 89 45 e4 mov %eax,-0x1c(%ebp) + "eip 0x%x addr 0x%x--kill proc\n", + myproc()->pid, myproc()->name, tf->trapno, +-8010552c: e8 6f e1 ff ff call 801036a0 +-80105531: 89 45 e0 mov %eax,-0x20(%ebp) +-80105534: e8 67 e1 ff ff call 801036a0 ++8010555c: e8 3f e1 ff ff call 801036a0 ++80105561: 89 45 e0 mov %eax,-0x20(%ebp) ++80105564: e8 37 e1 ff ff call 801036a0 + cprintf("pid %d %s: trap %d err %d on cpu %d " +-80105539: 8b 55 dc mov -0x24(%ebp),%edx +-8010553c: 89 74 24 0c mov %esi,0xc(%esp) ++80105569: 8b 55 dc mov -0x24(%ebp),%edx ++8010556c: 89 74 24 0c mov %esi,0xc(%esp) + myproc()->pid, myproc()->name, tf->trapno, +-80105540: 8b 75 e0 mov -0x20(%ebp),%esi ++80105570: 8b 75 e0 mov -0x20(%ebp),%esi + cprintf("pid %d %s: trap %d err %d on cpu %d " +-80105543: 8b 4d d8 mov -0x28(%ebp),%ecx +-80105546: 89 7c 24 14 mov %edi,0x14(%esp) +-8010554a: 89 54 24 18 mov %edx,0x18(%esp) +-8010554e: 8b 55 e4 mov -0x1c(%ebp),%edx ++80105573: 8b 4d d8 mov -0x28(%ebp),%ecx ++80105576: 89 7c 24 14 mov %edi,0x14(%esp) ++8010557a: 89 54 24 18 mov %edx,0x18(%esp) ++8010557e: 8b 55 e4 mov -0x1c(%ebp),%edx + myproc()->pid, myproc()->name, tf->trapno, +-80105551: 83 c6 6c add $0x6c,%esi ++80105581: 83 c6 6c add $0x6c,%esi + cprintf("pid %d %s: trap %d err %d on cpu %d " +-80105554: 89 4c 24 1c mov %ecx,0x1c(%esp) ++80105584: 89 4c 24 1c mov %ecx,0x1c(%esp) + myproc()->pid, myproc()->name, tf->trapno, +-80105558: 89 74 24 08 mov %esi,0x8(%esp) ++80105588: 89 74 24 08 mov %esi,0x8(%esp) + cprintf("pid %d %s: trap %d err %d on cpu %d " +-8010555c: 89 54 24 10 mov %edx,0x10(%esp) +-80105560: 8b 40 10 mov 0x10(%eax),%eax +-80105563: c7 04 24 1c 74 10 80 movl $0x8010741c,(%esp) +-8010556a: 89 44 24 04 mov %eax,0x4(%esp) +-8010556e: e8 dd b0 ff ff call 80100650 ++8010558c: 89 54 24 10 mov %edx,0x10(%esp) ++80105590: 8b 40 10 mov 0x10(%eax),%eax ++80105593: c7 04 24 3c 74 10 80 movl $0x8010743c,(%esp) ++8010559a: 89 44 24 04 mov %eax,0x4(%esp) ++8010559e: e8 ad b0 ff ff call 80100650 + tf->err, cpuid(), tf->eip, rcr2()); + myproc()->killed = 1; +-80105573: e8 28 e1 ff ff call 801036a0 +-80105578: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) +-8010557f: 90 nop ++801055a3: e8 f8 e0 ff ff call 801036a0 ++801055a8: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) ++801055af: 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(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +-80105580: e8 1b e1 ff ff call 801036a0 +-80105585: 85 c0 test %eax,%eax +-80105587: 74 0c je 80105595 +-80105589: e8 12 e1 ff ff call 801036a0 +-8010558e: 8b 50 24 mov 0x24(%eax),%edx +-80105591: 85 d2 test %edx,%edx +-80105593: 75 4b jne 801055e0 ++801055b0: e8 eb e0 ff ff call 801036a0 ++801055b5: 85 c0 test %eax,%eax ++801055b7: 74 0c je 801055c5 ++801055b9: e8 e2 e0 ff ff call 801036a0 ++801055be: 8b 50 24 mov 0x24(%eax),%edx ++801055c1: 85 d2 test %edx,%edx ++801055c3: 75 4b jne 80105610 + exit(0); + + // Force process to give up CPU on clock tick. + // If interrupts were on while locks held, would need to check nlock. + if(myproc() && myproc()->state == RUNNING && +-80105595: e8 06 e1 ff ff call 801036a0 +-8010559a: 85 c0 test %eax,%eax +-8010559c: 74 0d je 801055ab +-8010559e: 66 90 xchg %ax,%ax +-801055a0: e8 fb e0 ff ff call 801036a0 +-801055a5: 83 78 0c 04 cmpl $0x4,0xc(%eax) +-801055a9: 74 55 je 80105600 ++801055c5: e8 d6 e0 ff ff call 801036a0 ++801055ca: 85 c0 test %eax,%eax ++801055cc: 74 0d je 801055db ++801055ce: 66 90 xchg %ax,%ax ++801055d0: e8 cb e0 ff ff call 801036a0 ++801055d5: 83 78 0c 04 cmpl $0x4,0xc(%eax) ++801055d9: 74 55 je 80105630 + tf->trapno == T_IRQ0+IRQ_TIMER) + yield(); + + // Check if the process has been killed since we yielded + if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +-801055ab: e8 f0 e0 ff ff call 801036a0 +-801055b0: 85 c0 test %eax,%eax +-801055b2: 74 1d je 801055d1 +-801055b4: e8 e7 e0 ff ff call 801036a0 +-801055b9: 8b 40 24 mov 0x24(%eax),%eax +-801055bc: 85 c0 test %eax,%eax +-801055be: 74 11 je 801055d1 +-801055c0: 0f b7 43 3c movzwl 0x3c(%ebx),%eax +-801055c4: 83 e0 03 and $0x3,%eax +-801055c7: 66 83 f8 03 cmp $0x3,%ax +-801055cb: 0f 84 e8 00 00 00 je 801056b9 ++801055db: e8 c0 e0 ff ff call 801036a0 ++801055e0: 85 c0 test %eax,%eax ++801055e2: 74 1d je 80105601 ++801055e4: e8 b7 e0 ff ff call 801036a0 ++801055e9: 8b 40 24 mov 0x24(%eax),%eax ++801055ec: 85 c0 test %eax,%eax ++801055ee: 74 11 je 80105601 ++801055f0: 0f b7 43 3c movzwl 0x3c(%ebx),%eax ++801055f4: 83 e0 03 and $0x3,%eax ++801055f7: 66 83 f8 03 cmp $0x3,%ax ++801055fb: 0f 84 e8 00 00 00 je 801056e9 + exit(0); + } +-801055d1: 83 c4 3c add $0x3c,%esp +-801055d4: 5b pop %ebx +-801055d5: 5e pop %esi +-801055d6: 5f pop %edi +-801055d7: 5d pop %ebp +-801055d8: c3 ret +-801055d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++80105601: 83 c4 3c add $0x3c,%esp ++80105604: 5b pop %ebx ++80105605: 5e pop %esi ++80105606: 5f pop %edi ++80105607: 5d pop %ebp ++80105608: c3 ret ++80105609: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +-801055e0: 0f b7 43 3c movzwl 0x3c(%ebx),%eax +-801055e4: 83 e0 03 and $0x3,%eax +-801055e7: 66 83 f8 03 cmp $0x3,%ax +-801055eb: 75 a8 jne 80105595 ++80105610: 0f b7 43 3c movzwl 0x3c(%ebx),%eax ++80105614: 83 e0 03 and $0x3,%eax ++80105617: 66 83 f8 03 cmp $0x3,%ax ++8010561b: 75 a8 jne 801055c5 + exit(0); +-801055ed: c7 04 24 00 00 00 00 movl $0x0,(%esp) +-801055f4: e8 a7 e4 ff ff call 80103aa0 +-801055f9: eb 9a jmp 80105595 +-801055fb: 90 nop +-801055fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++8010561d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++80105624: e8 77 e4 ff ff call 80103aa0 ++80105629: eb 9a jmp 801055c5 ++8010562b: 90 nop ++8010562c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(myproc() && myproc()->state == RUNNING && +-80105600: 83 7b 30 20 cmpl $0x20,0x30(%ebx) +-80105604: 75 a5 jne 801055ab ++80105630: 83 7b 30 20 cmpl $0x20,0x30(%ebx) ++80105634: 75 a5 jne 801055db + yield(); +-80105606: e8 b5 e5 ff ff call 80103bc0 +-8010560b: eb 9e jmp 801055ab +-8010560d: 8d 76 00 lea 0x0(%esi),%esi ++80105636: e8 85 e5 ff ff call 80103bc0 ++8010563b: eb 9e jmp 801055db ++8010563d: 8d 76 00 lea 0x0(%esi),%esi + if(cpuid() == 0){ +-80105610: e8 6b e0 ff ff call 80103680 +-80105615: 85 c0 test %eax,%eax +-80105617: 0f 84 c3 00 00 00 je 801056e0 +-8010561d: 8d 76 00 lea 0x0(%esi),%esi ++80105640: e8 3b e0 ff ff call 80103680 ++80105645: 85 c0 test %eax,%eax ++80105647: 0f 84 c3 00 00 00 je 80105710 ++8010564d: 8d 76 00 lea 0x0(%esi),%esi + lapiceoi(); +-80105620: e8 5b d1 ff ff call 80102780 ++80105650: e8 2b d1 ff ff call 80102780 + break; +-80105625: e9 56 ff ff ff jmp 80105580 +-8010562a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++80105655: e9 56 ff ff ff jmp 801055b0 ++8010565a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + kbdintr(); +-80105630: e8 9b cf ff ff call 801025d0 ++80105660: e8 6b cf ff ff call 801025d0 + lapiceoi(); +-80105635: e8 46 d1 ff ff call 80102780 ++80105665: e8 16 d1 ff ff call 80102780 + break; +-8010563a: e9 41 ff ff ff jmp 80105580 +-8010563f: 90 nop ++8010566a: e9 41 ff ff ff jmp 801055b0 ++8010566f: 90 nop + uartintr(); +-80105640: e8 2b 02 00 00 call 80105870 ++80105670: e8 2b 02 00 00 call 801058a0 + lapiceoi(); +-80105645: e8 36 d1 ff ff call 80102780 ++80105675: e8 06 d1 ff ff call 80102780 + break; +-8010564a: e9 31 ff ff ff jmp 80105580 +-8010564f: 90 nop ++8010567a: e9 31 ff ff ff jmp 801055b0 ++8010567f: 90 nop + cprintf("cpu%d: spurious interrupt at %x:%x\n", +-80105650: 8b 7b 38 mov 0x38(%ebx),%edi +-80105653: 0f b7 73 3c movzwl 0x3c(%ebx),%esi +-80105657: e8 24 e0 ff ff call 80103680 +-8010565c: c7 04 24 c4 73 10 80 movl $0x801073c4,(%esp) +-80105663: 89 7c 24 0c mov %edi,0xc(%esp) +-80105667: 89 74 24 08 mov %esi,0x8(%esp) +-8010566b: 89 44 24 04 mov %eax,0x4(%esp) +-8010566f: e8 dc af ff ff call 80100650 ++80105680: 8b 7b 38 mov 0x38(%ebx),%edi ++80105683: 0f b7 73 3c movzwl 0x3c(%ebx),%esi ++80105687: e8 f4 df ff ff call 80103680 ++8010568c: c7 04 24 e4 73 10 80 movl $0x801073e4,(%esp) ++80105693: 89 7c 24 0c mov %edi,0xc(%esp) ++80105697: 89 74 24 08 mov %esi,0x8(%esp) ++8010569b: 89 44 24 04 mov %eax,0x4(%esp) ++8010569f: e8 ac af ff ff call 80100650 + lapiceoi(); +-80105674: e8 07 d1 ff ff call 80102780 ++801056a4: e8 d7 d0 ff ff call 80102780 + break; +-80105679: e9 02 ff ff ff jmp 80105580 +-8010567e: 66 90 xchg %ax,%ax ++801056a9: e9 02 ff ff ff jmp 801055b0 ++801056ae: 66 90 xchg %ax,%ax + ideintr(); +-80105680: e8 fb c9 ff ff call 80102080 +-80105685: eb 96 jmp 8010561d +-80105687: 90 nop +-80105688: 90 nop +-80105689: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++801056b0: e8 cb c9 ff ff call 80102080 ++801056b5: eb 96 jmp 8010564d ++801056b7: 90 nop ++801056b8: 90 nop ++801056b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if(myproc()->killed) +-80105690: e8 0b e0 ff ff call 801036a0 +-80105695: 8b 70 24 mov 0x24(%eax),%esi +-80105698: 85 f6 test %esi,%esi +-8010569a: 75 34 jne 801056d0 ++801056c0: e8 db df ff ff call 801036a0 ++801056c5: 8b 70 24 mov 0x24(%eax),%esi ++801056c8: 85 f6 test %esi,%esi ++801056ca: 75 34 jne 80105700 + myproc()->tf = tf; +-8010569c: e8 ff df ff ff call 801036a0 +-801056a1: 89 58 18 mov %ebx,0x18(%eax) ++801056cc: e8 cf df ff ff call 801036a0 ++801056d1: 89 58 18 mov %ebx,0x18(%eax) + syscall(); +-801056a4: e8 b7 ef ff ff call 80104660 ++801056d4: e8 87 ef ff ff call 80104660 + if(myproc()->killed) +-801056a9: e8 f2 df ff ff call 801036a0 +-801056ae: 8b 48 24 mov 0x24(%eax),%ecx +-801056b1: 85 c9 test %ecx,%ecx +-801056b3: 0f 84 18 ff ff ff je 801055d1 ++801056d9: e8 c2 df ff ff call 801036a0 ++801056de: 8b 48 24 mov 0x24(%eax),%ecx ++801056e1: 85 c9 test %ecx,%ecx ++801056e3: 0f 84 18 ff ff ff je 80105601 + exit(0); +-801056b9: c7 45 08 00 00 00 00 movl $0x0,0x8(%ebp) ++801056e9: c7 45 08 00 00 00 00 movl $0x0,0x8(%ebp) + } +-801056c0: 83 c4 3c add $0x3c,%esp +-801056c3: 5b pop %ebx +-801056c4: 5e pop %esi +-801056c5: 5f pop %edi +-801056c6: 5d pop %ebp ++801056f0: 83 c4 3c add $0x3c,%esp ++801056f3: 5b pop %ebx ++801056f4: 5e pop %esi ++801056f5: 5f pop %edi ++801056f6: 5d pop %ebp + exit(0); +-801056c7: e9 d4 e3 ff ff jmp 80103aa0 +-801056cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++801056f7: e9 a4 e3 ff ff jmp 80103aa0 ++801056fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + exit(0); +-801056d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +-801056d7: e8 c4 e3 ff ff call 80103aa0 +-801056dc: eb be jmp 8010569c +-801056de: 66 90 xchg %ax,%ax ++80105700: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++80105707: e8 94 e3 ff ff call 80103aa0 ++8010570c: eb be jmp 801056cc ++8010570e: 66 90 xchg %ax,%ax + acquire(&tickslock); +-801056e0: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-801056e7: e8 f4 ea ff ff call 801041e0 ++80105710: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++80105717: e8 c4 ea ff ff call 801041e0 + wakeup(&ticks); +-801056ec: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp) ++8010571c: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp) + ticks++; +-801056f3: 83 05 a0 55 11 80 01 addl $0x1,0x801155a0 ++80105723: 83 05 a0 55 11 80 01 addl $0x1,0x801155a0 + wakeup(&ticks); +-801056fa: e8 91 e6 ff ff call 80103d90 ++8010572a: e8 61 e6 ff ff call 80103d90 + release(&tickslock); +-801056ff: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) +-80105706: e8 45 eb ff ff call 80104250 +-8010570b: e9 0d ff ff ff jmp 8010561d +-80105710: 0f 20 d7 mov %cr2,%edi ++8010572f: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp) ++80105736: e8 15 eb ff ff call 80104250 ++8010573b: e9 0d ff ff ff jmp 8010564d ++80105740: 0f 20 d7 mov %cr2,%edi + cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", +-80105713: 8b 73 38 mov 0x38(%ebx),%esi +-80105716: e8 65 df ff ff call 80103680 +-8010571b: 89 7c 24 10 mov %edi,0x10(%esp) +-8010571f: 89 74 24 0c mov %esi,0xc(%esp) +-80105723: 89 44 24 08 mov %eax,0x8(%esp) +-80105727: 8b 43 30 mov 0x30(%ebx),%eax +-8010572a: c7 04 24 e8 73 10 80 movl $0x801073e8,(%esp) +-80105731: 89 44 24 04 mov %eax,0x4(%esp) +-80105735: e8 16 af ff ff call 80100650 ++80105743: 8b 73 38 mov 0x38(%ebx),%esi ++80105746: e8 35 df ff ff call 80103680 ++8010574b: 89 7c 24 10 mov %edi,0x10(%esp) ++8010574f: 89 74 24 0c mov %esi,0xc(%esp) ++80105753: 89 44 24 08 mov %eax,0x8(%esp) ++80105757: 8b 43 30 mov 0x30(%ebx),%eax ++8010575a: c7 04 24 08 74 10 80 movl $0x80107408,(%esp) ++80105761: 89 44 24 04 mov %eax,0x4(%esp) ++80105765: e8 e6 ae ff ff call 80100650 + panic("trap"); +-8010573a: c7 04 24 be 73 10 80 movl $0x801073be,(%esp) +-80105741: e8 1a ac ff ff call 80100360 +-80105746: 66 90 xchg %ax,%ax +-80105748: 66 90 xchg %ax,%ax +-8010574a: 66 90 xchg %ax,%ax +-8010574c: 66 90 xchg %ax,%ax +-8010574e: 66 90 xchg %ax,%ax ++8010576a: c7 04 24 de 73 10 80 movl $0x801073de,(%esp) ++80105771: e8 ea ab ff ff call 80100360 ++80105776: 66 90 xchg %ax,%ax ++80105778: 66 90 xchg %ax,%ax ++8010577a: 66 90 xchg %ax,%ax ++8010577c: 66 90 xchg %ax,%ax ++8010577e: 66 90 xchg %ax,%ax + +-80105750 : ++80105780 : + } + + static int + uartgetc(void) + { +- if(!uart) +-80105750: a1 bc a5 10 80 mov 0x8010a5bc,%eax ++ if (!uart) ++80105780: a1 bc a5 10 80 mov 0x8010a5bc,%eax + { +-80105755: 55 push %ebp +-80105756: 89 e5 mov %esp,%ebp +- if(!uart) +-80105758: 85 c0 test %eax,%eax +-8010575a: 74 14 je 80105770 ++80105785: 55 push %ebp ++80105786: 89 e5 mov %esp,%ebp ++ if (!uart) ++80105788: 85 c0 test %eax,%eax ++8010578a: 74 14 je 801057a0 + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +-8010575c: ba fd 03 00 00 mov $0x3fd,%edx +-80105761: ec in (%dx),%al ++8010578c: ba fd 03 00 00 mov $0x3fd,%edx ++80105791: ec in (%dx),%al + return -1; +- if(!(inb(COM1+5) & 0x01)) +-80105762: a8 01 test $0x1,%al +-80105764: 74 0a je 80105770 +-80105766: b2 f8 mov $0xf8,%dl +-80105768: ec in (%dx),%al ++ if (!(inb(COM1 + 5) & 0x01)) ++80105792: a8 01 test $0x1,%al ++80105794: 74 0a je 801057a0 ++80105796: b2 f8 mov $0xf8,%dl ++80105798: ec in (%dx),%al + return -1; +- return inb(COM1+0); +-80105769: 0f b6 c0 movzbl %al,%eax ++ return inb(COM1 + 0); ++80105799: 0f b6 c0 movzbl %al,%eax + } +-8010576c: 5d pop %ebp +-8010576d: c3 ret +-8010576e: 66 90 xchg %ax,%ax ++8010579c: 5d pop %ebp ++8010579d: c3 ret ++8010579e: 66 90 xchg %ax,%ax + return -1; +-80105770: b8 ff ff ff ff mov $0xffffffff,%eax +-} +-80105775: 5d pop %ebp +-80105776: c3 ret +-80105777: 89 f6 mov %esi,%esi +-80105779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +- +-80105780 : +- if(!uart) +-80105780: a1 bc a5 10 80 mov 0x8010a5bc,%eax +-80105785: 85 c0 test %eax,%eax +-80105787: 74 3f je 801057c8 +-{ +-80105789: 55 push %ebp +-8010578a: 89 e5 mov %esp,%ebp +-8010578c: 56 push %esi +-8010578d: be fd 03 00 00 mov $0x3fd,%esi +-80105792: 53 push %ebx +- if(!uart) +-80105793: bb 80 00 00 00 mov $0x80,%ebx +-{ +-80105798: 83 ec 10 sub $0x10,%esp +-8010579b: eb 14 jmp 801057b1 +-8010579d: 8d 76 00 lea 0x0(%esi),%esi ++801057a0: b8 ff ff ff ff mov $0xffffffff,%eax ++} ++801057a5: 5d pop %ebp ++801057a6: c3 ret ++801057a7: 89 f6 mov %esi,%esi ++801057a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ ++801057b0 : ++ if (!uart) ++801057b0: a1 bc a5 10 80 mov 0x8010a5bc,%eax ++801057b5: 85 c0 test %eax,%eax ++801057b7: 74 3f je 801057f8 ++{ ++801057b9: 55 push %ebp ++801057ba: 89 e5 mov %esp,%ebp ++801057bc: 56 push %esi ++801057bd: be fd 03 00 00 mov $0x3fd,%esi ++801057c2: 53 push %ebx ++ if (!uart) ++801057c3: bb 80 00 00 00 mov $0x80,%ebx ++{ ++801057c8: 83 ec 10 sub $0x10,%esp ++801057cb: eb 14 jmp 801057e1 ++801057cd: 8d 76 00 lea 0x0(%esi),%esi + microdelay(10); +-801057a0: c7 04 24 0a 00 00 00 movl $0xa,(%esp) +-801057a7: e8 f4 cf ff ff call 801027a0 +- for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) +-801057ac: 83 eb 01 sub $0x1,%ebx +-801057af: 74 07 je 801057b8 +-801057b1: 89 f2 mov %esi,%edx +-801057b3: ec in (%dx),%al +-801057b4: a8 20 test $0x20,%al +-801057b6: 74 e8 je 801057a0 +- outb(COM1+0, c); +-801057b8: 0f b6 45 08 movzbl 0x8(%ebp),%eax ++801057d0: c7 04 24 0a 00 00 00 movl $0xa,(%esp) ++801057d7: e8 c4 cf ff ff call 801027a0 ++ for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) ++801057dc: 83 eb 01 sub $0x1,%ebx ++801057df: 74 07 je 801057e8 ++801057e1: 89 f2 mov %esi,%edx ++801057e3: ec in (%dx),%al ++801057e4: a8 20 test $0x20,%al ++801057e6: 74 e8 je 801057d0 ++ outb(COM1 + 0, c); ++801057e8: 0f b6 45 08 movzbl 0x8(%ebp),%eax + asm volatile("out %0,%1" : : "a" (data), "d" (port)); +-801057bc: ba f8 03 00 00 mov $0x3f8,%edx +-801057c1: ee out %al,(%dx) +-} +-801057c2: 83 c4 10 add $0x10,%esp +-801057c5: 5b pop %ebx +-801057c6: 5e pop %esi +-801057c7: 5d pop %ebp +-801057c8: f3 c3 repz ret +-801057ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- +-801057d0 : +-{ +-801057d0: 55 push %ebp +-801057d1: 31 c9 xor %ecx,%ecx +-801057d3: 89 e5 mov %esp,%ebp +-801057d5: 89 c8 mov %ecx,%eax +-801057d7: 57 push %edi +-801057d8: bf fa 03 00 00 mov $0x3fa,%edi +-801057dd: 56 push %esi +-801057de: 89 fa mov %edi,%edx +-801057e0: 53 push %ebx +-801057e1: 83 ec 1c sub $0x1c,%esp +-801057e4: ee out %al,(%dx) +-801057e5: be fb 03 00 00 mov $0x3fb,%esi +-801057ea: b8 80 ff ff ff mov $0xffffff80,%eax +-801057ef: 89 f2 mov %esi,%edx ++801057ec: ba f8 03 00 00 mov $0x3f8,%edx + 801057f1: ee out %al,(%dx) +-801057f2: b8 0c 00 00 00 mov $0xc,%eax +-801057f7: b2 f8 mov $0xf8,%dl +-801057f9: ee out %al,(%dx) +-801057fa: bb f9 03 00 00 mov $0x3f9,%ebx +-801057ff: 89 c8 mov %ecx,%eax +-80105801: 89 da mov %ebx,%edx +-80105803: ee out %al,(%dx) +-80105804: b8 03 00 00 00 mov $0x3,%eax +-80105809: 89 f2 mov %esi,%edx +-8010580b: ee out %al,(%dx) +-8010580c: b2 fc mov $0xfc,%dl +-8010580e: 89 c8 mov %ecx,%eax +-80105810: ee out %al,(%dx) +-80105811: b8 01 00 00 00 mov $0x1,%eax +-80105816: 89 da mov %ebx,%edx +-80105818: ee out %al,(%dx) ++} ++801057f2: 83 c4 10 add $0x10,%esp ++801057f5: 5b pop %ebx ++801057f6: 5e pop %esi ++801057f7: 5d pop %ebp ++801057f8: f3 c3 repz ret ++801057fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ ++80105800 : ++{ ++80105800: 55 push %ebp ++80105801: 31 c9 xor %ecx,%ecx ++80105803: 89 e5 mov %esp,%ebp ++80105805: 89 c8 mov %ecx,%eax ++80105807: 57 push %edi ++80105808: bf fa 03 00 00 mov $0x3fa,%edi ++8010580d: 56 push %esi ++8010580e: 89 fa mov %edi,%edx ++80105810: 53 push %ebx ++80105811: 83 ec 1c sub $0x1c,%esp ++80105814: ee out %al,(%dx) ++80105815: be fb 03 00 00 mov $0x3fb,%esi ++8010581a: b8 80 ff ff ff mov $0xffffff80,%eax ++8010581f: 89 f2 mov %esi,%edx ++80105821: ee out %al,(%dx) ++80105822: b8 0c 00 00 00 mov $0xc,%eax ++80105827: b2 f8 mov $0xf8,%dl ++80105829: ee out %al,(%dx) ++8010582a: bb f9 03 00 00 mov $0x3f9,%ebx ++8010582f: 89 c8 mov %ecx,%eax ++80105831: 89 da mov %ebx,%edx ++80105833: ee out %al,(%dx) ++80105834: b8 03 00 00 00 mov $0x3,%eax ++80105839: 89 f2 mov %esi,%edx ++8010583b: ee out %al,(%dx) ++8010583c: b2 fc mov $0xfc,%dl ++8010583e: 89 c8 mov %ecx,%eax ++80105840: ee out %al,(%dx) ++80105841: b8 01 00 00 00 mov $0x1,%eax ++80105846: 89 da mov %ebx,%edx ++80105848: ee out %al,(%dx) + asm volatile("in %1,%0" : "=a" (data) : "d" (port)); +-80105819: b2 fd mov $0xfd,%dl +-8010581b: ec in (%dx),%al +- if(inb(COM1+5) == 0xFF) +-8010581c: 3c ff cmp $0xff,%al +-8010581e: 74 42 je 80105862 ++80105849: b2 fd mov $0xfd,%dl ++8010584b: ec in (%dx),%al ++ if (inb(COM1 + 5) == 0xFF) ++8010584c: 3c ff cmp $0xff,%al ++8010584e: 74 42 je 80105892 + uart = 1; +-80105820: c7 05 bc a5 10 80 01 movl $0x1,0x8010a5bc +-80105827: 00 00 00 +-8010582a: 89 fa mov %edi,%edx +-8010582c: ec in (%dx),%al +-8010582d: b2 f8 mov $0xf8,%dl +-8010582f: ec in (%dx),%al ++80105850: c7 05 bc a5 10 80 01 movl $0x1,0x8010a5bc ++80105857: 00 00 00 ++8010585a: 89 fa mov %edi,%edx ++8010585c: ec in (%dx),%al ++8010585d: b2 f8 mov $0xf8,%dl ++8010585f: ec in (%dx),%al + ioapicenable(IRQ_COM1, 0); +-80105830: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +-80105837: 00 +- for(p="xv6...\n"; *p; p++) +-80105838: bb e0 74 10 80 mov $0x801074e0,%ebx ++80105860: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++80105867: 00 ++ for (p = "xv6...\n"; *p; p++) ++80105868: bb 00 75 10 80 mov $0x80107500,%ebx + ioapicenable(IRQ_COM1, 0); +-8010583d: c7 04 24 04 00 00 00 movl $0x4,(%esp) +-80105844: e8 67 ca ff ff call 801022b0 +- for(p="xv6...\n"; *p; p++) +-80105849: b8 78 00 00 00 mov $0x78,%eax +-8010584e: 66 90 xchg %ax,%ax ++8010586d: c7 04 24 04 00 00 00 movl $0x4,(%esp) ++80105874: e8 37 ca ff ff call 801022b0 ++ for (p = "xv6...\n"; *p; p++) ++80105879: b8 78 00 00 00 mov $0x78,%eax ++8010587e: 66 90 xchg %ax,%ax + uartputc(*p); +-80105850: 89 04 24 mov %eax,(%esp) +- for(p="xv6...\n"; *p; p++) +-80105853: 83 c3 01 add $0x1,%ebx ++80105880: 89 04 24 mov %eax,(%esp) ++ for (p = "xv6...\n"; *p; p++) ++80105883: 83 c3 01 add $0x1,%ebx + uartputc(*p); +-80105856: e8 25 ff ff ff call 80105780 +- for(p="xv6...\n"; *p; p++) +-8010585b: 0f be 03 movsbl (%ebx),%eax +-8010585e: 84 c0 test %al,%al +-80105860: 75 ee jne 80105850 +-} +-80105862: 83 c4 1c add $0x1c,%esp +-80105865: 5b pop %ebx +-80105866: 5e pop %esi +-80105867: 5f pop %edi +-80105868: 5d pop %ebp +-80105869: c3 ret +-8010586a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- +-80105870 : +- +-void +-uartintr(void) +-{ +-80105870: 55 push %ebp +-80105871: 89 e5 mov %esp,%ebp +-80105873: 83 ec 18 sub $0x18,%esp ++80105886: e8 25 ff ff ff call 801057b0 ++ for (p = "xv6...\n"; *p; p++) ++8010588b: 0f be 03 movsbl (%ebx),%eax ++8010588e: 84 c0 test %al,%al ++80105890: 75 ee jne 80105880 ++} ++80105892: 83 c4 1c add $0x1c,%esp ++80105895: 5b pop %ebx ++80105896: 5e pop %esi ++80105897: 5f pop %edi ++80105898: 5d pop %ebp ++80105899: c3 ret ++8010589a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ ++801058a0 : ++ ++void uartintr(void) ++{ ++801058a0: 55 push %ebp ++801058a1: 89 e5 mov %esp,%ebp ++801058a3: 83 ec 18 sub $0x18,%esp + consoleintr(uartgetc); +-80105876: c7 04 24 50 57 10 80 movl $0x80105750,(%esp) +-8010587d: e8 2e af ff ff call 801007b0 +-} +-80105882: c9 leave +-80105883: c3 ret +- +-80105884 : +-# generated by vectors.pl - do not edit +-# handlers +-.globl alltraps +-.globl vector0 +-vector0: +- pushl $0 +-80105884: 6a 00 push $0x0 +- pushl $0 +-80105886: 6a 00 push $0x0 +- jmp alltraps +-80105888: e9 50 fb ff ff jmp 801053dd +- +-8010588d : +-.globl vector1 +-vector1: +- pushl $0 +-8010588d: 6a 00 push $0x0 +- pushl $1 +-8010588f: 6a 01 push $0x1 +- jmp alltraps +-80105891: e9 47 fb ff ff jmp 801053dd +- +-80105896 : +-.globl vector2 +-vector2: +- pushl $0 +-80105896: 6a 00 push $0x0 +- pushl $2 +-80105898: 6a 02 push $0x2 +- jmp alltraps +-8010589a: e9 3e fb ff ff jmp 801053dd +- +-8010589f : +-.globl vector3 +-vector3: +- pushl $0 +-8010589f: 6a 00 push $0x0 +- pushl $3 +-801058a1: 6a 03 push $0x3 +- jmp alltraps +-801058a3: e9 35 fb ff ff jmp 801053dd +- +-801058a8 : +-.globl vector4 +-vector4: +- pushl $0 +-801058a8: 6a 00 push $0x0 +- pushl $4 +-801058aa: 6a 04 push $0x4 +- jmp alltraps +-801058ac: e9 2c fb ff ff jmp 801053dd +- +-801058b1 : +-.globl vector5 +-vector5: +- pushl $0 +-801058b1: 6a 00 push $0x0 +- pushl $5 +-801058b3: 6a 05 push $0x5 +- jmp alltraps +-801058b5: e9 23 fb ff ff jmp 801053dd +- +-801058ba : +-.globl vector6 +-vector6: +- pushl $0 +-801058ba: 6a 00 push $0x0 +- pushl $6 +-801058bc: 6a 06 push $0x6 +- jmp alltraps +-801058be: e9 1a fb ff ff jmp 801053dd +- +-801058c3 : +-.globl vector7 +-vector7: +- pushl $0 +-801058c3: 6a 00 push $0x0 +- pushl $7 +-801058c5: 6a 07 push $0x7 +- jmp alltraps +-801058c7: e9 11 fb ff ff jmp 801053dd +- +-801058cc : +-.globl vector8 +-vector8: +- pushl $8 +-801058cc: 6a 08 push $0x8 +- jmp alltraps +-801058ce: e9 0a fb ff ff jmp 801053dd +- +-801058d3 : +-.globl vector9 +-vector9: +- pushl $0 +-801058d3: 6a 00 push $0x0 +- pushl $9 +-801058d5: 6a 09 push $0x9 +- jmp alltraps +-801058d7: e9 01 fb ff ff jmp 801053dd +- +-801058dc : +-.globl vector10 +-vector10: +- pushl $10 +-801058dc: 6a 0a push $0xa +- jmp alltraps +-801058de: e9 fa fa ff ff jmp 801053dd +- +-801058e3 : +-.globl vector11 +-vector11: +- pushl $11 +-801058e3: 6a 0b push $0xb +- jmp alltraps +-801058e5: e9 f3 fa ff ff jmp 801053dd +- +-801058ea : +-.globl vector12 +-vector12: +- pushl $12 +-801058ea: 6a 0c push $0xc +- jmp alltraps +-801058ec: e9 ec fa ff ff jmp 801053dd +- +-801058f1 : +-.globl vector13 +-vector13: +- pushl $13 +-801058f1: 6a 0d push $0xd +- jmp alltraps +-801058f3: e9 e5 fa ff ff jmp 801053dd +- +-801058f8 : +-.globl vector14 +-vector14: +- pushl $14 +-801058f8: 6a 0e push $0xe +- jmp alltraps +-801058fa: e9 de fa ff ff jmp 801053dd +- +-801058ff : +-.globl vector15 +-vector15: +- pushl $0 +-801058ff: 6a 00 push $0x0 +- pushl $15 +-80105901: 6a 0f push $0xf +- jmp alltraps +-80105903: e9 d5 fa ff ff jmp 801053dd +- +-80105908 : +-.globl vector16 +-vector16: +- pushl $0 +-80105908: 6a 00 push $0x0 +- pushl $16 +-8010590a: 6a 10 push $0x10 +- jmp alltraps +-8010590c: e9 cc fa ff ff jmp 801053dd +- +-80105911 : +-.globl vector17 +-vector17: +- pushl $17 +-80105911: 6a 11 push $0x11 +- jmp alltraps +-80105913: e9 c5 fa ff ff jmp 801053dd +- +-80105918 : +-.globl vector18 +-vector18: +- pushl $0 +-80105918: 6a 00 push $0x0 +- pushl $18 +-8010591a: 6a 12 push $0x12 +- jmp alltraps +-8010591c: e9 bc fa ff ff jmp 801053dd +- +-80105921 : +-.globl vector19 +-vector19: +- pushl $0 +-80105921: 6a 00 push $0x0 +- pushl $19 +-80105923: 6a 13 push $0x13 +- jmp alltraps +-80105925: e9 b3 fa ff ff jmp 801053dd +- +-8010592a : +-.globl vector20 +-vector20: +- pushl $0 +-8010592a: 6a 00 push $0x0 +- pushl $20 +-8010592c: 6a 14 push $0x14 +- jmp alltraps +-8010592e: e9 aa fa ff ff jmp 801053dd +- +-80105933 : +-.globl vector21 +-vector21: +- pushl $0 +-80105933: 6a 00 push $0x0 +- pushl $21 +-80105935: 6a 15 push $0x15 +- jmp alltraps +-80105937: e9 a1 fa ff ff jmp 801053dd +- +-8010593c : +-.globl vector22 +-vector22: +- pushl $0 +-8010593c: 6a 00 push $0x0 +- pushl $22 +-8010593e: 6a 16 push $0x16 +- jmp alltraps +-80105940: e9 98 fa ff ff jmp 801053dd +- +-80105945 : +-.globl vector23 +-vector23: +- pushl $0 +-80105945: 6a 00 push $0x0 +- pushl $23 +-80105947: 6a 17 push $0x17 +- jmp alltraps +-80105949: e9 8f fa ff ff jmp 801053dd +- +-8010594e : +-.globl vector24 +-vector24: +- pushl $0 +-8010594e: 6a 00 push $0x0 +- pushl $24 +-80105950: 6a 18 push $0x18 +- jmp alltraps +-80105952: e9 86 fa ff ff jmp 801053dd +- +-80105957 : +-.globl vector25 +-vector25: +- pushl $0 +-80105957: 6a 00 push $0x0 +- pushl $25 +-80105959: 6a 19 push $0x19 +- jmp alltraps +-8010595b: e9 7d fa ff ff jmp 801053dd +- +-80105960 : +-.globl vector26 +-vector26: +- pushl $0 +-80105960: 6a 00 push $0x0 +- pushl $26 +-80105962: 6a 1a push $0x1a +- jmp alltraps +-80105964: e9 74 fa ff ff jmp 801053dd +- +-80105969 : +-.globl vector27 +-vector27: +- pushl $0 +-80105969: 6a 00 push $0x0 +- pushl $27 +-8010596b: 6a 1b push $0x1b +- jmp alltraps +-8010596d: e9 6b fa ff ff jmp 801053dd +- +-80105972 : +-.globl vector28 +-vector28: +- pushl $0 +-80105972: 6a 00 push $0x0 +- pushl $28 +-80105974: 6a 1c push $0x1c +- jmp alltraps +-80105976: e9 62 fa ff ff jmp 801053dd +- +-8010597b : +-.globl vector29 +-vector29: +- pushl $0 +-8010597b: 6a 00 push $0x0 +- pushl $29 +-8010597d: 6a 1d push $0x1d +- jmp alltraps +-8010597f: e9 59 fa ff ff jmp 801053dd +- +-80105984 : +-.globl vector30 +-vector30: +- pushl $0 +-80105984: 6a 00 push $0x0 +- pushl $30 +-80105986: 6a 1e push $0x1e +- jmp alltraps +-80105988: e9 50 fa ff ff jmp 801053dd +- +-8010598d : +-.globl vector31 +-vector31: +- pushl $0 +-8010598d: 6a 00 push $0x0 +- pushl $31 +-8010598f: 6a 1f push $0x1f +- jmp alltraps +-80105991: e9 47 fa ff ff jmp 801053dd +- +-80105996 : +-.globl vector32 +-vector32: +- pushl $0 +-80105996: 6a 00 push $0x0 +- pushl $32 +-80105998: 6a 20 push $0x20 +- jmp alltraps +-8010599a: e9 3e fa ff ff jmp 801053dd +- +-8010599f : +-.globl vector33 +-vector33: +- pushl $0 +-8010599f: 6a 00 push $0x0 +- pushl $33 +-801059a1: 6a 21 push $0x21 +- jmp alltraps +-801059a3: e9 35 fa ff ff jmp 801053dd +- +-801059a8 : +-.globl vector34 +-vector34: +- pushl $0 +-801059a8: 6a 00 push $0x0 +- pushl $34 +-801059aa: 6a 22 push $0x22 +- jmp alltraps +-801059ac: e9 2c fa ff ff jmp 801053dd +- +-801059b1 : +-.globl vector35 +-vector35: +- pushl $0 +-801059b1: 6a 00 push $0x0 +- pushl $35 +-801059b3: 6a 23 push $0x23 +- jmp alltraps +-801059b5: e9 23 fa ff ff jmp 801053dd +- +-801059ba : +-.globl vector36 +-vector36: +- pushl $0 +-801059ba: 6a 00 push $0x0 +- pushl $36 +-801059bc: 6a 24 push $0x24 +- jmp alltraps +-801059be: e9 1a fa ff ff jmp 801053dd +- +-801059c3 : +-.globl vector37 +-vector37: +- pushl $0 +-801059c3: 6a 00 push $0x0 +- pushl $37 +-801059c5: 6a 25 push $0x25 +- jmp alltraps +-801059c7: e9 11 fa ff ff jmp 801053dd +- +-801059cc : +-.globl vector38 +-vector38: +- pushl $0 +-801059cc: 6a 00 push $0x0 +- pushl $38 +-801059ce: 6a 26 push $0x26 +- jmp alltraps +-801059d0: e9 08 fa ff ff jmp 801053dd +- +-801059d5 : +-.globl vector39 +-vector39: +- pushl $0 +-801059d5: 6a 00 push $0x0 +- pushl $39 +-801059d7: 6a 27 push $0x27 +- jmp alltraps +-801059d9: e9 ff f9 ff ff jmp 801053dd +- +-801059de : +-.globl vector40 +-vector40: +- pushl $0 +-801059de: 6a 00 push $0x0 +- pushl $40 +-801059e0: 6a 28 push $0x28 +- jmp alltraps +-801059e2: e9 f6 f9 ff ff jmp 801053dd +- +-801059e7 : +-.globl vector41 +-vector41: +- pushl $0 +-801059e7: 6a 00 push $0x0 +- pushl $41 +-801059e9: 6a 29 push $0x29 +- jmp alltraps +-801059eb: e9 ed f9 ff ff jmp 801053dd +- +-801059f0 : +-.globl vector42 +-vector42: +- pushl $0 +-801059f0: 6a 00 push $0x0 +- pushl $42 +-801059f2: 6a 2a push $0x2a +- jmp alltraps +-801059f4: e9 e4 f9 ff ff jmp 801053dd +- +-801059f9 : +-.globl vector43 +-vector43: +- pushl $0 +-801059f9: 6a 00 push $0x0 +- pushl $43 +-801059fb: 6a 2b push $0x2b +- jmp alltraps +-801059fd: e9 db f9 ff ff jmp 801053dd +- +-80105a02 : +-.globl vector44 +-vector44: +- pushl $0 +-80105a02: 6a 00 push $0x0 +- pushl $44 +-80105a04: 6a 2c push $0x2c +- jmp alltraps +-80105a06: e9 d2 f9 ff ff jmp 801053dd +- +-80105a0b : +-.globl vector45 +-vector45: +- pushl $0 +-80105a0b: 6a 00 push $0x0 +- pushl $45 +-80105a0d: 6a 2d push $0x2d +- jmp alltraps +-80105a0f: e9 c9 f9 ff ff jmp 801053dd +- +-80105a14 : +-.globl vector46 +-vector46: +- pushl $0 +-80105a14: 6a 00 push $0x0 +- pushl $46 +-80105a16: 6a 2e push $0x2e +- jmp alltraps +-80105a18: e9 c0 f9 ff ff jmp 801053dd +- +-80105a1d : +-.globl vector47 +-vector47: +- pushl $0 +-80105a1d: 6a 00 push $0x0 +- pushl $47 +-80105a1f: 6a 2f push $0x2f +- jmp alltraps +-80105a21: e9 b7 f9 ff ff jmp 801053dd +- +-80105a26 : +-.globl vector48 +-vector48: +- pushl $0 +-80105a26: 6a 00 push $0x0 +- pushl $48 +-80105a28: 6a 30 push $0x30 +- jmp alltraps +-80105a2a: e9 ae f9 ff ff jmp 801053dd +- +-80105a2f : +-.globl vector49 +-vector49: +- pushl $0 +-80105a2f: 6a 00 push $0x0 +- pushl $49 +-80105a31: 6a 31 push $0x31 +- jmp alltraps +-80105a33: e9 a5 f9 ff ff jmp 801053dd +- +-80105a38 : +-.globl vector50 +-vector50: +- pushl $0 +-80105a38: 6a 00 push $0x0 +- pushl $50 +-80105a3a: 6a 32 push $0x32 +- jmp alltraps +-80105a3c: e9 9c f9 ff ff jmp 801053dd +- +-80105a41 : +-.globl vector51 +-vector51: +- pushl $0 +-80105a41: 6a 00 push $0x0 +- pushl $51 +-80105a43: 6a 33 push $0x33 +- jmp alltraps +-80105a45: e9 93 f9 ff ff jmp 801053dd +- +-80105a4a : +-.globl vector52 +-vector52: +- pushl $0 +-80105a4a: 6a 00 push $0x0 +- pushl $52 +-80105a4c: 6a 34 push $0x34 +- jmp alltraps +-80105a4e: e9 8a f9 ff ff jmp 801053dd +- +-80105a53 : +-.globl vector53 +-vector53: +- pushl $0 +-80105a53: 6a 00 push $0x0 +- pushl $53 +-80105a55: 6a 35 push $0x35 +- jmp alltraps +-80105a57: e9 81 f9 ff ff jmp 801053dd +- +-80105a5c : +-.globl vector54 +-vector54: +- pushl $0 +-80105a5c: 6a 00 push $0x0 +- pushl $54 +-80105a5e: 6a 36 push $0x36 +- jmp alltraps +-80105a60: e9 78 f9 ff ff jmp 801053dd +- +-80105a65 : +-.globl vector55 +-vector55: +- pushl $0 +-80105a65: 6a 00 push $0x0 +- pushl $55 +-80105a67: 6a 37 push $0x37 +- jmp alltraps +-80105a69: e9 6f f9 ff ff jmp 801053dd +- +-80105a6e : +-.globl vector56 +-vector56: +- pushl $0 +-80105a6e: 6a 00 push $0x0 +- pushl $56 +-80105a70: 6a 38 push $0x38 +- jmp alltraps +-80105a72: e9 66 f9 ff ff jmp 801053dd +- +-80105a77 : +-.globl vector57 +-vector57: +- pushl $0 +-80105a77: 6a 00 push $0x0 +- pushl $57 +-80105a79: 6a 39 push $0x39 +- jmp alltraps +-80105a7b: e9 5d f9 ff ff jmp 801053dd +- +-80105a80 : +-.globl vector58 +-vector58: +- pushl $0 +-80105a80: 6a 00 push $0x0 +- pushl $58 +-80105a82: 6a 3a push $0x3a +- jmp alltraps +-80105a84: e9 54 f9 ff ff jmp 801053dd +- +-80105a89 : +-.globl vector59 +-vector59: +- pushl $0 +-80105a89: 6a 00 push $0x0 +- pushl $59 +-80105a8b: 6a 3b push $0x3b +- jmp alltraps +-80105a8d: e9 4b f9 ff ff jmp 801053dd +- +-80105a92 : +-.globl vector60 +-vector60: +- pushl $0 +-80105a92: 6a 00 push $0x0 +- pushl $60 +-80105a94: 6a 3c push $0x3c +- jmp alltraps +-80105a96: e9 42 f9 ff ff jmp 801053dd +- +-80105a9b : +-.globl vector61 +-vector61: +- pushl $0 +-80105a9b: 6a 00 push $0x0 +- pushl $61 +-80105a9d: 6a 3d push $0x3d +- jmp alltraps +-80105a9f: e9 39 f9 ff ff jmp 801053dd +- +-80105aa4 : +-.globl vector62 +-vector62: +- pushl $0 +-80105aa4: 6a 00 push $0x0 +- pushl $62 +-80105aa6: 6a 3e push $0x3e +- jmp alltraps +-80105aa8: e9 30 f9 ff ff jmp 801053dd +- +-80105aad : +-.globl vector63 +-vector63: +- pushl $0 +-80105aad: 6a 00 push $0x0 +- pushl $63 +-80105aaf: 6a 3f push $0x3f +- jmp alltraps +-80105ab1: e9 27 f9 ff ff jmp 801053dd +- +-80105ab6 : +-.globl vector64 +-vector64: +- pushl $0 +-80105ab6: 6a 00 push $0x0 +- pushl $64 +-80105ab8: 6a 40 push $0x40 +- jmp alltraps +-80105aba: e9 1e f9 ff ff jmp 801053dd +- +-80105abf : +-.globl vector65 +-vector65: +- pushl $0 +-80105abf: 6a 00 push $0x0 +- pushl $65 +-80105ac1: 6a 41 push $0x41 +- jmp alltraps +-80105ac3: e9 15 f9 ff ff jmp 801053dd +- +-80105ac8 : +-.globl vector66 +-vector66: +- pushl $0 +-80105ac8: 6a 00 push $0x0 +- pushl $66 +-80105aca: 6a 42 push $0x42 +- jmp alltraps +-80105acc: e9 0c f9 ff ff jmp 801053dd +- +-80105ad1 : +-.globl vector67 +-vector67: +- pushl $0 +-80105ad1: 6a 00 push $0x0 +- pushl $67 +-80105ad3: 6a 43 push $0x43 +- jmp alltraps +-80105ad5: e9 03 f9 ff ff jmp 801053dd +- +-80105ada : +-.globl vector68 +-vector68: +- pushl $0 +-80105ada: 6a 00 push $0x0 +- pushl $68 +-80105adc: 6a 44 push $0x44 +- jmp alltraps +-80105ade: e9 fa f8 ff ff jmp 801053dd +- +-80105ae3 : +-.globl vector69 +-vector69: +- pushl $0 +-80105ae3: 6a 00 push $0x0 +- pushl $69 +-80105ae5: 6a 45 push $0x45 +- jmp alltraps +-80105ae7: e9 f1 f8 ff ff jmp 801053dd +- +-80105aec : +-.globl vector70 +-vector70: +- pushl $0 +-80105aec: 6a 00 push $0x0 +- pushl $70 +-80105aee: 6a 46 push $0x46 +- jmp alltraps +-80105af0: e9 e8 f8 ff ff jmp 801053dd +- +-80105af5 : +-.globl vector71 +-vector71: +- pushl $0 +-80105af5: 6a 00 push $0x0 +- pushl $71 +-80105af7: 6a 47 push $0x47 +- jmp alltraps +-80105af9: e9 df f8 ff ff jmp 801053dd +- +-80105afe : +-.globl vector72 +-vector72: +- pushl $0 +-80105afe: 6a 00 push $0x0 +- pushl $72 +-80105b00: 6a 48 push $0x48 +- jmp alltraps +-80105b02: e9 d6 f8 ff ff jmp 801053dd +- +-80105b07 : +-.globl vector73 +-vector73: +- pushl $0 +-80105b07: 6a 00 push $0x0 +- pushl $73 +-80105b09: 6a 49 push $0x49 +- jmp alltraps +-80105b0b: e9 cd f8 ff ff jmp 801053dd +- +-80105b10 : +-.globl vector74 +-vector74: +- pushl $0 +-80105b10: 6a 00 push $0x0 +- pushl $74 +-80105b12: 6a 4a push $0x4a +- jmp alltraps +-80105b14: e9 c4 f8 ff ff jmp 801053dd +- +-80105b19 : +-.globl vector75 +-vector75: +- pushl $0 +-80105b19: 6a 00 push $0x0 +- pushl $75 +-80105b1b: 6a 4b push $0x4b +- jmp alltraps +-80105b1d: e9 bb f8 ff ff jmp 801053dd +- +-80105b22 : +-.globl vector76 +-vector76: +- pushl $0 +-80105b22: 6a 00 push $0x0 +- pushl $76 +-80105b24: 6a 4c push $0x4c +- jmp alltraps +-80105b26: e9 b2 f8 ff ff jmp 801053dd +- +-80105b2b : +-.globl vector77 +-vector77: +- pushl $0 +-80105b2b: 6a 00 push $0x0 +- pushl $77 +-80105b2d: 6a 4d push $0x4d +- jmp alltraps +-80105b2f: e9 a9 f8 ff ff jmp 801053dd +- +-80105b34 : +-.globl vector78 +-vector78: +- pushl $0 +-80105b34: 6a 00 push $0x0 +- pushl $78 +-80105b36: 6a 4e push $0x4e +- jmp alltraps +-80105b38: e9 a0 f8 ff ff jmp 801053dd +- +-80105b3d : +-.globl vector79 +-vector79: +- pushl $0 +-80105b3d: 6a 00 push $0x0 +- pushl $79 +-80105b3f: 6a 4f push $0x4f +- jmp alltraps +-80105b41: e9 97 f8 ff ff jmp 801053dd +- +-80105b46 : +-.globl vector80 +-vector80: +- pushl $0 +-80105b46: 6a 00 push $0x0 +- pushl $80 +-80105b48: 6a 50 push $0x50 +- jmp alltraps +-80105b4a: e9 8e f8 ff ff jmp 801053dd +- +-80105b4f : +-.globl vector81 +-vector81: +- pushl $0 +-80105b4f: 6a 00 push $0x0 +- pushl $81 +-80105b51: 6a 51 push $0x51 +- jmp alltraps +-80105b53: e9 85 f8 ff ff jmp 801053dd +- +-80105b58 : +-.globl vector82 +-vector82: +- pushl $0 +-80105b58: 6a 00 push $0x0 +- pushl $82 +-80105b5a: 6a 52 push $0x52 +- jmp alltraps +-80105b5c: e9 7c f8 ff ff jmp 801053dd +- +-80105b61 : +-.globl vector83 +-vector83: +- pushl $0 +-80105b61: 6a 00 push $0x0 +- pushl $83 +-80105b63: 6a 53 push $0x53 +- jmp alltraps +-80105b65: e9 73 f8 ff ff jmp 801053dd +- +-80105b6a : +-.globl vector84 +-vector84: +- pushl $0 +-80105b6a: 6a 00 push $0x0 +- pushl $84 +-80105b6c: 6a 54 push $0x54 +- jmp alltraps +-80105b6e: e9 6a f8 ff ff jmp 801053dd +- +-80105b73 : +-.globl vector85 +-vector85: +- pushl $0 +-80105b73: 6a 00 push $0x0 +- pushl $85 +-80105b75: 6a 55 push $0x55 +- jmp alltraps +-80105b77: e9 61 f8 ff ff jmp 801053dd +- +-80105b7c : +-.globl vector86 +-vector86: +- pushl $0 +-80105b7c: 6a 00 push $0x0 +- pushl $86 +-80105b7e: 6a 56 push $0x56 +- jmp alltraps +-80105b80: e9 58 f8 ff ff jmp 801053dd +- +-80105b85 : +-.globl vector87 +-vector87: +- pushl $0 +-80105b85: 6a 00 push $0x0 +- pushl $87 +-80105b87: 6a 57 push $0x57 +- jmp alltraps +-80105b89: e9 4f f8 ff ff jmp 801053dd +- +-80105b8e : +-.globl vector88 +-vector88: +- pushl $0 +-80105b8e: 6a 00 push $0x0 +- pushl $88 +-80105b90: 6a 58 push $0x58 +- jmp alltraps +-80105b92: e9 46 f8 ff ff jmp 801053dd +- +-80105b97 : +-.globl vector89 +-vector89: +- pushl $0 +-80105b97: 6a 00 push $0x0 +- pushl $89 +-80105b99: 6a 59 push $0x59 +- jmp alltraps +-80105b9b: e9 3d f8 ff ff jmp 801053dd +- +-80105ba0 : +-.globl vector90 +-vector90: +- pushl $0 +-80105ba0: 6a 00 push $0x0 +- pushl $90 +-80105ba2: 6a 5a push $0x5a +- jmp alltraps +-80105ba4: e9 34 f8 ff ff jmp 801053dd +- +-80105ba9 : +-.globl vector91 +-vector91: +- pushl $0 +-80105ba9: 6a 00 push $0x0 +- pushl $91 +-80105bab: 6a 5b push $0x5b +- jmp alltraps +-80105bad: e9 2b f8 ff ff jmp 801053dd +- +-80105bb2 : +-.globl vector92 +-vector92: +- pushl $0 +-80105bb2: 6a 00 push $0x0 +- pushl $92 +-80105bb4: 6a 5c push $0x5c +- jmp alltraps +-80105bb6: e9 22 f8 ff ff jmp 801053dd +- +-80105bbb : +-.globl vector93 +-vector93: +- pushl $0 +-80105bbb: 6a 00 push $0x0 +- pushl $93 +-80105bbd: 6a 5d push $0x5d +- jmp alltraps +-80105bbf: e9 19 f8 ff ff jmp 801053dd +- +-80105bc4 : +-.globl vector94 +-vector94: +- pushl $0 +-80105bc4: 6a 00 push $0x0 +- pushl $94 +-80105bc6: 6a 5e push $0x5e +- jmp alltraps +-80105bc8: e9 10 f8 ff ff jmp 801053dd +- +-80105bcd : +-.globl vector95 +-vector95: +- pushl $0 +-80105bcd: 6a 00 push $0x0 +- pushl $95 +-80105bcf: 6a 5f push $0x5f +- jmp alltraps +-80105bd1: e9 07 f8 ff ff jmp 801053dd +- +-80105bd6 : +-.globl vector96 +-vector96: +- pushl $0 +-80105bd6: 6a 00 push $0x0 +- pushl $96 +-80105bd8: 6a 60 push $0x60 +- jmp alltraps +-80105bda: e9 fe f7 ff ff jmp 801053dd +- +-80105bdf : +-.globl vector97 +-vector97: +- pushl $0 +-80105bdf: 6a 00 push $0x0 +- pushl $97 +-80105be1: 6a 61 push $0x61 +- jmp alltraps +-80105be3: e9 f5 f7 ff ff jmp 801053dd +- +-80105be8 : +-.globl vector98 +-vector98: +- pushl $0 +-80105be8: 6a 00 push $0x0 +- pushl $98 +-80105bea: 6a 62 push $0x62 +- jmp alltraps +-80105bec: e9 ec f7 ff ff jmp 801053dd +- +-80105bf1 : +-.globl vector99 +-vector99: +- pushl $0 +-80105bf1: 6a 00 push $0x0 +- pushl $99 +-80105bf3: 6a 63 push $0x63 +- jmp alltraps +-80105bf5: e9 e3 f7 ff ff jmp 801053dd +- +-80105bfa : +-.globl vector100 +-vector100: +- pushl $0 +-80105bfa: 6a 00 push $0x0 +- pushl $100 +-80105bfc: 6a 64 push $0x64 +- jmp alltraps +-80105bfe: e9 da f7 ff ff jmp 801053dd +- +-80105c03 : +-.globl vector101 +-vector101: +- pushl $0 +-80105c03: 6a 00 push $0x0 +- pushl $101 +-80105c05: 6a 65 push $0x65 +- jmp alltraps +-80105c07: e9 d1 f7 ff ff jmp 801053dd +- +-80105c0c : +-.globl vector102 +-vector102: +- pushl $0 +-80105c0c: 6a 00 push $0x0 +- pushl $102 +-80105c0e: 6a 66 push $0x66 +- jmp alltraps +-80105c10: e9 c8 f7 ff ff jmp 801053dd +- +-80105c15 : +-.globl vector103 +-vector103: +- pushl $0 +-80105c15: 6a 00 push $0x0 +- pushl $103 +-80105c17: 6a 67 push $0x67 +- jmp alltraps +-80105c19: e9 bf f7 ff ff jmp 801053dd +- +-80105c1e : +-.globl vector104 +-vector104: +- pushl $0 +-80105c1e: 6a 00 push $0x0 +- pushl $104 +-80105c20: 6a 68 push $0x68 +- jmp alltraps +-80105c22: e9 b6 f7 ff ff jmp 801053dd +- +-80105c27 : +-.globl vector105 +-vector105: +- pushl $0 +-80105c27: 6a 00 push $0x0 +- pushl $105 +-80105c29: 6a 69 push $0x69 +- jmp alltraps +-80105c2b: e9 ad f7 ff ff jmp 801053dd +- +-80105c30 : +-.globl vector106 +-vector106: +- pushl $0 +-80105c30: 6a 00 push $0x0 +- pushl $106 +-80105c32: 6a 6a push $0x6a +- jmp alltraps +-80105c34: e9 a4 f7 ff ff jmp 801053dd +- +-80105c39 : +-.globl vector107 +-vector107: +- pushl $0 +-80105c39: 6a 00 push $0x0 +- pushl $107 +-80105c3b: 6a 6b push $0x6b +- jmp alltraps +-80105c3d: e9 9b f7 ff ff jmp 801053dd +- +-80105c42 : +-.globl vector108 +-vector108: +- pushl $0 +-80105c42: 6a 00 push $0x0 +- pushl $108 +-80105c44: 6a 6c push $0x6c +- jmp alltraps +-80105c46: e9 92 f7 ff ff jmp 801053dd +- +-80105c4b : +-.globl vector109 +-vector109: +- pushl $0 +-80105c4b: 6a 00 push $0x0 +- pushl $109 +-80105c4d: 6a 6d push $0x6d +- jmp alltraps +-80105c4f: e9 89 f7 ff ff jmp 801053dd +- +-80105c54 : +-.globl vector110 +-vector110: +- pushl $0 +-80105c54: 6a 00 push $0x0 +- pushl $110 +-80105c56: 6a 6e push $0x6e +- jmp alltraps +-80105c58: e9 80 f7 ff ff jmp 801053dd +- +-80105c5d : +-.globl vector111 +-vector111: +- pushl $0 +-80105c5d: 6a 00 push $0x0 +- pushl $111 +-80105c5f: 6a 6f push $0x6f +- jmp alltraps +-80105c61: e9 77 f7 ff ff jmp 801053dd +- +-80105c66 : +-.globl vector112 +-vector112: +- pushl $0 +-80105c66: 6a 00 push $0x0 +- pushl $112 +-80105c68: 6a 70 push $0x70 +- jmp alltraps +-80105c6a: e9 6e f7 ff ff jmp 801053dd +- +-80105c6f : +-.globl vector113 +-vector113: +- pushl $0 +-80105c6f: 6a 00 push $0x0 +- pushl $113 +-80105c71: 6a 71 push $0x71 +- jmp alltraps +-80105c73: e9 65 f7 ff ff jmp 801053dd +- +-80105c78 : +-.globl vector114 +-vector114: +- pushl $0 +-80105c78: 6a 00 push $0x0 +- pushl $114 +-80105c7a: 6a 72 push $0x72 +- jmp alltraps +-80105c7c: e9 5c f7 ff ff jmp 801053dd +- +-80105c81 : +-.globl vector115 +-vector115: +- pushl $0 +-80105c81: 6a 00 push $0x0 +- pushl $115 +-80105c83: 6a 73 push $0x73 +- jmp alltraps +-80105c85: e9 53 f7 ff ff jmp 801053dd +- +-80105c8a : +-.globl vector116 +-vector116: +- pushl $0 +-80105c8a: 6a 00 push $0x0 +- pushl $116 +-80105c8c: 6a 74 push $0x74 +- jmp alltraps +-80105c8e: e9 4a f7 ff ff jmp 801053dd +- +-80105c93 : +-.globl vector117 +-vector117: +- pushl $0 +-80105c93: 6a 00 push $0x0 +- pushl $117 +-80105c95: 6a 75 push $0x75 +- jmp alltraps +-80105c97: e9 41 f7 ff ff jmp 801053dd +- +-80105c9c : +-.globl vector118 +-vector118: +- pushl $0 +-80105c9c: 6a 00 push $0x0 +- pushl $118 +-80105c9e: 6a 76 push $0x76 +- jmp alltraps +-80105ca0: e9 38 f7 ff ff jmp 801053dd +- +-80105ca5 : +-.globl vector119 +-vector119: +- pushl $0 +-80105ca5: 6a 00 push $0x0 +- pushl $119 +-80105ca7: 6a 77 push $0x77 +- jmp alltraps +-80105ca9: e9 2f f7 ff ff jmp 801053dd +- +-80105cae : +-.globl vector120 +-vector120: +- pushl $0 +-80105cae: 6a 00 push $0x0 +- pushl $120 +-80105cb0: 6a 78 push $0x78 +- jmp alltraps +-80105cb2: e9 26 f7 ff ff jmp 801053dd +- +-80105cb7 : +-.globl vector121 +-vector121: +- pushl $0 +-80105cb7: 6a 00 push $0x0 +- pushl $121 +-80105cb9: 6a 79 push $0x79 +- jmp alltraps +-80105cbb: e9 1d f7 ff ff jmp 801053dd +- +-80105cc0 : +-.globl vector122 +-vector122: +- pushl $0 +-80105cc0: 6a 00 push $0x0 +- pushl $122 +-80105cc2: 6a 7a push $0x7a +- jmp alltraps +-80105cc4: e9 14 f7 ff ff jmp 801053dd +- +-80105cc9 : +-.globl vector123 +-vector123: +- pushl $0 +-80105cc9: 6a 00 push $0x0 +- pushl $123 +-80105ccb: 6a 7b push $0x7b +- jmp alltraps +-80105ccd: e9 0b f7 ff ff jmp 801053dd +- +-80105cd2 : +-.globl vector124 +-vector124: +- pushl $0 +-80105cd2: 6a 00 push $0x0 +- pushl $124 +-80105cd4: 6a 7c push $0x7c +- jmp alltraps +-80105cd6: e9 02 f7 ff ff jmp 801053dd +- +-80105cdb : +-.globl vector125 +-vector125: +- pushl $0 +-80105cdb: 6a 00 push $0x0 +- pushl $125 +-80105cdd: 6a 7d push $0x7d +- jmp alltraps +-80105cdf: e9 f9 f6 ff ff jmp 801053dd +- +-80105ce4 : +-.globl vector126 +-vector126: +- pushl $0 +-80105ce4: 6a 00 push $0x0 +- pushl $126 +-80105ce6: 6a 7e push $0x7e +- jmp alltraps +-80105ce8: e9 f0 f6 ff ff jmp 801053dd +- +-80105ced : +-.globl vector127 +-vector127: +- pushl $0 +-80105ced: 6a 00 push $0x0 +- pushl $127 +-80105cef: 6a 7f push $0x7f +- jmp alltraps +-80105cf1: e9 e7 f6 ff ff jmp 801053dd +- +-80105cf6 : +-.globl vector128 +-vector128: +- pushl $0 +-80105cf6: 6a 00 push $0x0 +- pushl $128 +-80105cf8: 68 80 00 00 00 push $0x80 +- jmp alltraps +-80105cfd: e9 db f6 ff ff jmp 801053dd +- +-80105d02 : +-.globl vector129 +-vector129: +- pushl $0 ++801058a6: c7 04 24 80 57 10 80 movl $0x80105780,(%esp) ++801058ad: e8 fe ae ff ff call 801007b0 ++} ++801058b2: c9 leave ++801058b3: c3 ret ++ ++801058b4 : ++801058b4: 6a 00 push $0x0 ++801058b6: 6a 00 push $0x0 ++801058b8: e9 50 fb ff ff jmp 8010540d ++ ++801058bd : ++801058bd: 6a 00 push $0x0 ++801058bf: 6a 01 push $0x1 ++801058c1: e9 47 fb ff ff jmp 8010540d ++ ++801058c6 : ++801058c6: 6a 00 push $0x0 ++801058c8: 6a 02 push $0x2 ++801058ca: e9 3e fb ff ff jmp 8010540d ++ ++801058cf : ++801058cf: 6a 00 push $0x0 ++801058d1: 6a 03 push $0x3 ++801058d3: e9 35 fb ff ff jmp 8010540d ++ ++801058d8 : ++801058d8: 6a 00 push $0x0 ++801058da: 6a 04 push $0x4 ++801058dc: e9 2c fb ff ff jmp 8010540d ++ ++801058e1 : ++801058e1: 6a 00 push $0x0 ++801058e3: 6a 05 push $0x5 ++801058e5: e9 23 fb ff ff jmp 8010540d ++ ++801058ea : ++801058ea: 6a 00 push $0x0 ++801058ec: 6a 06 push $0x6 ++801058ee: e9 1a fb ff ff jmp 8010540d ++ ++801058f3 : ++801058f3: 6a 00 push $0x0 ++801058f5: 6a 07 push $0x7 ++801058f7: e9 11 fb ff ff jmp 8010540d ++ ++801058fc : ++801058fc: 6a 08 push $0x8 ++801058fe: e9 0a fb ff ff jmp 8010540d ++ ++80105903 : ++80105903: 6a 00 push $0x0 ++80105905: 6a 09 push $0x9 ++80105907: e9 01 fb ff ff jmp 8010540d ++ ++8010590c : ++8010590c: 6a 0a push $0xa ++8010590e: e9 fa fa ff ff jmp 8010540d ++ ++80105913 : ++80105913: 6a 0b push $0xb ++80105915: e9 f3 fa ff ff jmp 8010540d ++ ++8010591a : ++8010591a: 6a 0c push $0xc ++8010591c: e9 ec fa ff ff jmp 8010540d ++ ++80105921 : ++80105921: 6a 0d push $0xd ++80105923: e9 e5 fa ff ff jmp 8010540d ++ ++80105928 : ++80105928: 6a 0e push $0xe ++8010592a: e9 de fa ff ff jmp 8010540d ++ ++8010592f : ++8010592f: 6a 00 push $0x0 ++80105931: 6a 0f push $0xf ++80105933: e9 d5 fa ff ff jmp 8010540d ++ ++80105938 : ++80105938: 6a 00 push $0x0 ++8010593a: 6a 10 push $0x10 ++8010593c: e9 cc fa ff ff jmp 8010540d ++ ++80105941 : ++80105941: 6a 11 push $0x11 ++80105943: e9 c5 fa ff ff jmp 8010540d ++ ++80105948 : ++80105948: 6a 00 push $0x0 ++8010594a: 6a 12 push $0x12 ++8010594c: e9 bc fa ff ff jmp 8010540d ++ ++80105951 : ++80105951: 6a 00 push $0x0 ++80105953: 6a 13 push $0x13 ++80105955: e9 b3 fa ff ff jmp 8010540d ++ ++8010595a : ++8010595a: 6a 00 push $0x0 ++8010595c: 6a 14 push $0x14 ++8010595e: e9 aa fa ff ff jmp 8010540d ++ ++80105963 : ++80105963: 6a 00 push $0x0 ++80105965: 6a 15 push $0x15 ++80105967: e9 a1 fa ff ff jmp 8010540d ++ ++8010596c : ++8010596c: 6a 00 push $0x0 ++8010596e: 6a 16 push $0x16 ++80105970: e9 98 fa ff ff jmp 8010540d ++ ++80105975 : ++80105975: 6a 00 push $0x0 ++80105977: 6a 17 push $0x17 ++80105979: e9 8f fa ff ff jmp 8010540d ++ ++8010597e : ++8010597e: 6a 00 push $0x0 ++80105980: 6a 18 push $0x18 ++80105982: e9 86 fa ff ff jmp 8010540d ++ ++80105987 : ++80105987: 6a 00 push $0x0 ++80105989: 6a 19 push $0x19 ++8010598b: e9 7d fa ff ff jmp 8010540d ++ ++80105990 : ++80105990: 6a 00 push $0x0 ++80105992: 6a 1a push $0x1a ++80105994: e9 74 fa ff ff jmp 8010540d ++ ++80105999 : ++80105999: 6a 00 push $0x0 ++8010599b: 6a 1b push $0x1b ++8010599d: e9 6b fa ff ff jmp 8010540d ++ ++801059a2 : ++801059a2: 6a 00 push $0x0 ++801059a4: 6a 1c push $0x1c ++801059a6: e9 62 fa ff ff jmp 8010540d ++ ++801059ab : ++801059ab: 6a 00 push $0x0 ++801059ad: 6a 1d push $0x1d ++801059af: e9 59 fa ff ff jmp 8010540d ++ ++801059b4 : ++801059b4: 6a 00 push $0x0 ++801059b6: 6a 1e push $0x1e ++801059b8: e9 50 fa ff ff jmp 8010540d ++ ++801059bd : ++801059bd: 6a 00 push $0x0 ++801059bf: 6a 1f push $0x1f ++801059c1: e9 47 fa ff ff jmp 8010540d ++ ++801059c6 : ++801059c6: 6a 00 push $0x0 ++801059c8: 6a 20 push $0x20 ++801059ca: e9 3e fa ff ff jmp 8010540d ++ ++801059cf : ++801059cf: 6a 00 push $0x0 ++801059d1: 6a 21 push $0x21 ++801059d3: e9 35 fa ff ff jmp 8010540d ++ ++801059d8 : ++801059d8: 6a 00 push $0x0 ++801059da: 6a 22 push $0x22 ++801059dc: e9 2c fa ff ff jmp 8010540d ++ ++801059e1 : ++801059e1: 6a 00 push $0x0 ++801059e3: 6a 23 push $0x23 ++801059e5: e9 23 fa ff ff jmp 8010540d ++ ++801059ea : ++801059ea: 6a 00 push $0x0 ++801059ec: 6a 24 push $0x24 ++801059ee: e9 1a fa ff ff jmp 8010540d ++ ++801059f3 : ++801059f3: 6a 00 push $0x0 ++801059f5: 6a 25 push $0x25 ++801059f7: e9 11 fa ff ff jmp 8010540d ++ ++801059fc : ++801059fc: 6a 00 push $0x0 ++801059fe: 6a 26 push $0x26 ++80105a00: e9 08 fa ff ff jmp 8010540d ++ ++80105a05 : ++80105a05: 6a 00 push $0x0 ++80105a07: 6a 27 push $0x27 ++80105a09: e9 ff f9 ff ff jmp 8010540d ++ ++80105a0e : ++80105a0e: 6a 00 push $0x0 ++80105a10: 6a 28 push $0x28 ++80105a12: e9 f6 f9 ff ff jmp 8010540d ++ ++80105a17 : ++80105a17: 6a 00 push $0x0 ++80105a19: 6a 29 push $0x29 ++80105a1b: e9 ed f9 ff ff jmp 8010540d ++ ++80105a20 : ++80105a20: 6a 00 push $0x0 ++80105a22: 6a 2a push $0x2a ++80105a24: e9 e4 f9 ff ff jmp 8010540d ++ ++80105a29 : ++80105a29: 6a 00 push $0x0 ++80105a2b: 6a 2b push $0x2b ++80105a2d: e9 db f9 ff ff jmp 8010540d ++ ++80105a32 : ++80105a32: 6a 00 push $0x0 ++80105a34: 6a 2c push $0x2c ++80105a36: e9 d2 f9 ff ff jmp 8010540d ++ ++80105a3b : ++80105a3b: 6a 00 push $0x0 ++80105a3d: 6a 2d push $0x2d ++80105a3f: e9 c9 f9 ff ff jmp 8010540d ++ ++80105a44 : ++80105a44: 6a 00 push $0x0 ++80105a46: 6a 2e push $0x2e ++80105a48: e9 c0 f9 ff ff jmp 8010540d ++ ++80105a4d : ++80105a4d: 6a 00 push $0x0 ++80105a4f: 6a 2f push $0x2f ++80105a51: e9 b7 f9 ff ff jmp 8010540d ++ ++80105a56 : ++80105a56: 6a 00 push $0x0 ++80105a58: 6a 30 push $0x30 ++80105a5a: e9 ae f9 ff ff jmp 8010540d ++ ++80105a5f : ++80105a5f: 6a 00 push $0x0 ++80105a61: 6a 31 push $0x31 ++80105a63: e9 a5 f9 ff ff jmp 8010540d ++ ++80105a68 : ++80105a68: 6a 00 push $0x0 ++80105a6a: 6a 32 push $0x32 ++80105a6c: e9 9c f9 ff ff jmp 8010540d ++ ++80105a71 : ++80105a71: 6a 00 push $0x0 ++80105a73: 6a 33 push $0x33 ++80105a75: e9 93 f9 ff ff jmp 8010540d ++ ++80105a7a : ++80105a7a: 6a 00 push $0x0 ++80105a7c: 6a 34 push $0x34 ++80105a7e: e9 8a f9 ff ff jmp 8010540d ++ ++80105a83 : ++80105a83: 6a 00 push $0x0 ++80105a85: 6a 35 push $0x35 ++80105a87: e9 81 f9 ff ff jmp 8010540d ++ ++80105a8c : ++80105a8c: 6a 00 push $0x0 ++80105a8e: 6a 36 push $0x36 ++80105a90: e9 78 f9 ff ff jmp 8010540d ++ ++80105a95 : ++80105a95: 6a 00 push $0x0 ++80105a97: 6a 37 push $0x37 ++80105a99: e9 6f f9 ff ff jmp 8010540d ++ ++80105a9e : ++80105a9e: 6a 00 push $0x0 ++80105aa0: 6a 38 push $0x38 ++80105aa2: e9 66 f9 ff ff jmp 8010540d ++ ++80105aa7 : ++80105aa7: 6a 00 push $0x0 ++80105aa9: 6a 39 push $0x39 ++80105aab: e9 5d f9 ff ff jmp 8010540d ++ ++80105ab0 : ++80105ab0: 6a 00 push $0x0 ++80105ab2: 6a 3a push $0x3a ++80105ab4: e9 54 f9 ff ff jmp 8010540d ++ ++80105ab9 : ++80105ab9: 6a 00 push $0x0 ++80105abb: 6a 3b push $0x3b ++80105abd: e9 4b f9 ff ff jmp 8010540d ++ ++80105ac2 : ++80105ac2: 6a 00 push $0x0 ++80105ac4: 6a 3c push $0x3c ++80105ac6: e9 42 f9 ff ff jmp 8010540d ++ ++80105acb : ++80105acb: 6a 00 push $0x0 ++80105acd: 6a 3d push $0x3d ++80105acf: e9 39 f9 ff ff jmp 8010540d ++ ++80105ad4 : ++80105ad4: 6a 00 push $0x0 ++80105ad6: 6a 3e push $0x3e ++80105ad8: e9 30 f9 ff ff jmp 8010540d ++ ++80105add : ++80105add: 6a 00 push $0x0 ++80105adf: 6a 3f push $0x3f ++80105ae1: e9 27 f9 ff ff jmp 8010540d ++ ++80105ae6 : ++80105ae6: 6a 00 push $0x0 ++80105ae8: 6a 40 push $0x40 ++80105aea: e9 1e f9 ff ff jmp 8010540d ++ ++80105aef : ++80105aef: 6a 00 push $0x0 ++80105af1: 6a 41 push $0x41 ++80105af3: e9 15 f9 ff ff jmp 8010540d ++ ++80105af8 : ++80105af8: 6a 00 push $0x0 ++80105afa: 6a 42 push $0x42 ++80105afc: e9 0c f9 ff ff jmp 8010540d ++ ++80105b01 : ++80105b01: 6a 00 push $0x0 ++80105b03: 6a 43 push $0x43 ++80105b05: e9 03 f9 ff ff jmp 8010540d ++ ++80105b0a : ++80105b0a: 6a 00 push $0x0 ++80105b0c: 6a 44 push $0x44 ++80105b0e: e9 fa f8 ff ff jmp 8010540d ++ ++80105b13 : ++80105b13: 6a 00 push $0x0 ++80105b15: 6a 45 push $0x45 ++80105b17: e9 f1 f8 ff ff jmp 8010540d ++ ++80105b1c : ++80105b1c: 6a 00 push $0x0 ++80105b1e: 6a 46 push $0x46 ++80105b20: e9 e8 f8 ff ff jmp 8010540d ++ ++80105b25 : ++80105b25: 6a 00 push $0x0 ++80105b27: 6a 47 push $0x47 ++80105b29: e9 df f8 ff ff jmp 8010540d ++ ++80105b2e : ++80105b2e: 6a 00 push $0x0 ++80105b30: 6a 48 push $0x48 ++80105b32: e9 d6 f8 ff ff jmp 8010540d ++ ++80105b37 : ++80105b37: 6a 00 push $0x0 ++80105b39: 6a 49 push $0x49 ++80105b3b: e9 cd f8 ff ff jmp 8010540d ++ ++80105b40 : ++80105b40: 6a 00 push $0x0 ++80105b42: 6a 4a push $0x4a ++80105b44: e9 c4 f8 ff ff jmp 8010540d ++ ++80105b49 : ++80105b49: 6a 00 push $0x0 ++80105b4b: 6a 4b push $0x4b ++80105b4d: e9 bb f8 ff ff jmp 8010540d ++ ++80105b52 : ++80105b52: 6a 00 push $0x0 ++80105b54: 6a 4c push $0x4c ++80105b56: e9 b2 f8 ff ff jmp 8010540d ++ ++80105b5b : ++80105b5b: 6a 00 push $0x0 ++80105b5d: 6a 4d push $0x4d ++80105b5f: e9 a9 f8 ff ff jmp 8010540d ++ ++80105b64 : ++80105b64: 6a 00 push $0x0 ++80105b66: 6a 4e push $0x4e ++80105b68: e9 a0 f8 ff ff jmp 8010540d ++ ++80105b6d : ++80105b6d: 6a 00 push $0x0 ++80105b6f: 6a 4f push $0x4f ++80105b71: e9 97 f8 ff ff jmp 8010540d ++ ++80105b76 : ++80105b76: 6a 00 push $0x0 ++80105b78: 6a 50 push $0x50 ++80105b7a: e9 8e f8 ff ff jmp 8010540d ++ ++80105b7f : ++80105b7f: 6a 00 push $0x0 ++80105b81: 6a 51 push $0x51 ++80105b83: e9 85 f8 ff ff jmp 8010540d ++ ++80105b88 : ++80105b88: 6a 00 push $0x0 ++80105b8a: 6a 52 push $0x52 ++80105b8c: e9 7c f8 ff ff jmp 8010540d ++ ++80105b91 : ++80105b91: 6a 00 push $0x0 ++80105b93: 6a 53 push $0x53 ++80105b95: e9 73 f8 ff ff jmp 8010540d ++ ++80105b9a : ++80105b9a: 6a 00 push $0x0 ++80105b9c: 6a 54 push $0x54 ++80105b9e: e9 6a f8 ff ff jmp 8010540d ++ ++80105ba3 : ++80105ba3: 6a 00 push $0x0 ++80105ba5: 6a 55 push $0x55 ++80105ba7: e9 61 f8 ff ff jmp 8010540d ++ ++80105bac : ++80105bac: 6a 00 push $0x0 ++80105bae: 6a 56 push $0x56 ++80105bb0: e9 58 f8 ff ff jmp 8010540d ++ ++80105bb5 : ++80105bb5: 6a 00 push $0x0 ++80105bb7: 6a 57 push $0x57 ++80105bb9: e9 4f f8 ff ff jmp 8010540d ++ ++80105bbe : ++80105bbe: 6a 00 push $0x0 ++80105bc0: 6a 58 push $0x58 ++80105bc2: e9 46 f8 ff ff jmp 8010540d ++ ++80105bc7 : ++80105bc7: 6a 00 push $0x0 ++80105bc9: 6a 59 push $0x59 ++80105bcb: e9 3d f8 ff ff jmp 8010540d ++ ++80105bd0 : ++80105bd0: 6a 00 push $0x0 ++80105bd2: 6a 5a push $0x5a ++80105bd4: e9 34 f8 ff ff jmp 8010540d ++ ++80105bd9 : ++80105bd9: 6a 00 push $0x0 ++80105bdb: 6a 5b push $0x5b ++80105bdd: e9 2b f8 ff ff jmp 8010540d ++ ++80105be2 : ++80105be2: 6a 00 push $0x0 ++80105be4: 6a 5c push $0x5c ++80105be6: e9 22 f8 ff ff jmp 8010540d ++ ++80105beb : ++80105beb: 6a 00 push $0x0 ++80105bed: 6a 5d push $0x5d ++80105bef: e9 19 f8 ff ff jmp 8010540d ++ ++80105bf4 : ++80105bf4: 6a 00 push $0x0 ++80105bf6: 6a 5e push $0x5e ++80105bf8: e9 10 f8 ff ff jmp 8010540d ++ ++80105bfd : ++80105bfd: 6a 00 push $0x0 ++80105bff: 6a 5f push $0x5f ++80105c01: e9 07 f8 ff ff jmp 8010540d ++ ++80105c06 : ++80105c06: 6a 00 push $0x0 ++80105c08: 6a 60 push $0x60 ++80105c0a: e9 fe f7 ff ff jmp 8010540d ++ ++80105c0f : ++80105c0f: 6a 00 push $0x0 ++80105c11: 6a 61 push $0x61 ++80105c13: e9 f5 f7 ff ff jmp 8010540d ++ ++80105c18 : ++80105c18: 6a 00 push $0x0 ++80105c1a: 6a 62 push $0x62 ++80105c1c: e9 ec f7 ff ff jmp 8010540d ++ ++80105c21 : ++80105c21: 6a 00 push $0x0 ++80105c23: 6a 63 push $0x63 ++80105c25: e9 e3 f7 ff ff jmp 8010540d ++ ++80105c2a : ++80105c2a: 6a 00 push $0x0 ++80105c2c: 6a 64 push $0x64 ++80105c2e: e9 da f7 ff ff jmp 8010540d ++ ++80105c33 : ++80105c33: 6a 00 push $0x0 ++80105c35: 6a 65 push $0x65 ++80105c37: e9 d1 f7 ff ff jmp 8010540d ++ ++80105c3c : ++80105c3c: 6a 00 push $0x0 ++80105c3e: 6a 66 push $0x66 ++80105c40: e9 c8 f7 ff ff jmp 8010540d ++ ++80105c45 : ++80105c45: 6a 00 push $0x0 ++80105c47: 6a 67 push $0x67 ++80105c49: e9 bf f7 ff ff jmp 8010540d ++ ++80105c4e : ++80105c4e: 6a 00 push $0x0 ++80105c50: 6a 68 push $0x68 ++80105c52: e9 b6 f7 ff ff jmp 8010540d ++ ++80105c57 : ++80105c57: 6a 00 push $0x0 ++80105c59: 6a 69 push $0x69 ++80105c5b: e9 ad f7 ff ff jmp 8010540d ++ ++80105c60 : ++80105c60: 6a 00 push $0x0 ++80105c62: 6a 6a push $0x6a ++80105c64: e9 a4 f7 ff ff jmp 8010540d ++ ++80105c69 : ++80105c69: 6a 00 push $0x0 ++80105c6b: 6a 6b push $0x6b ++80105c6d: e9 9b f7 ff ff jmp 8010540d ++ ++80105c72 : ++80105c72: 6a 00 push $0x0 ++80105c74: 6a 6c push $0x6c ++80105c76: e9 92 f7 ff ff jmp 8010540d ++ ++80105c7b : ++80105c7b: 6a 00 push $0x0 ++80105c7d: 6a 6d push $0x6d ++80105c7f: e9 89 f7 ff ff jmp 8010540d ++ ++80105c84 : ++80105c84: 6a 00 push $0x0 ++80105c86: 6a 6e push $0x6e ++80105c88: e9 80 f7 ff ff jmp 8010540d ++ ++80105c8d : ++80105c8d: 6a 00 push $0x0 ++80105c8f: 6a 6f push $0x6f ++80105c91: e9 77 f7 ff ff jmp 8010540d ++ ++80105c96 : ++80105c96: 6a 00 push $0x0 ++80105c98: 6a 70 push $0x70 ++80105c9a: e9 6e f7 ff ff jmp 8010540d ++ ++80105c9f : ++80105c9f: 6a 00 push $0x0 ++80105ca1: 6a 71 push $0x71 ++80105ca3: e9 65 f7 ff ff jmp 8010540d ++ ++80105ca8 : ++80105ca8: 6a 00 push $0x0 ++80105caa: 6a 72 push $0x72 ++80105cac: e9 5c f7 ff ff jmp 8010540d ++ ++80105cb1 : ++80105cb1: 6a 00 push $0x0 ++80105cb3: 6a 73 push $0x73 ++80105cb5: e9 53 f7 ff ff jmp 8010540d ++ ++80105cba : ++80105cba: 6a 00 push $0x0 ++80105cbc: 6a 74 push $0x74 ++80105cbe: e9 4a f7 ff ff jmp 8010540d ++ ++80105cc3 : ++80105cc3: 6a 00 push $0x0 ++80105cc5: 6a 75 push $0x75 ++80105cc7: e9 41 f7 ff ff jmp 8010540d ++ ++80105ccc : ++80105ccc: 6a 00 push $0x0 ++80105cce: 6a 76 push $0x76 ++80105cd0: e9 38 f7 ff ff jmp 8010540d ++ ++80105cd5 : ++80105cd5: 6a 00 push $0x0 ++80105cd7: 6a 77 push $0x77 ++80105cd9: e9 2f f7 ff ff jmp 8010540d ++ ++80105cde : ++80105cde: 6a 00 push $0x0 ++80105ce0: 6a 78 push $0x78 ++80105ce2: e9 26 f7 ff ff jmp 8010540d ++ ++80105ce7 : ++80105ce7: 6a 00 push $0x0 ++80105ce9: 6a 79 push $0x79 ++80105ceb: e9 1d f7 ff ff jmp 8010540d ++ ++80105cf0 : ++80105cf0: 6a 00 push $0x0 ++80105cf2: 6a 7a push $0x7a ++80105cf4: e9 14 f7 ff ff jmp 8010540d ++ ++80105cf9 : ++80105cf9: 6a 00 push $0x0 ++80105cfb: 6a 7b push $0x7b ++80105cfd: e9 0b f7 ff ff jmp 8010540d ++ ++80105d02 : + 80105d02: 6a 00 push $0x0 +- pushl $129 +-80105d04: 68 81 00 00 00 push $0x81 +- jmp alltraps +-80105d09: e9 cf f6 ff ff jmp 801053dd +- +-80105d0e : +-.globl vector130 +-vector130: +- pushl $0 +-80105d0e: 6a 00 push $0x0 +- pushl $130 +-80105d10: 68 82 00 00 00 push $0x82 +- jmp alltraps +-80105d15: e9 c3 f6 ff ff jmp 801053dd +- +-80105d1a : +-.globl vector131 +-vector131: +- pushl $0 +-80105d1a: 6a 00 push $0x0 +- pushl $131 +-80105d1c: 68 83 00 00 00 push $0x83 +- jmp alltraps +-80105d21: e9 b7 f6 ff ff jmp 801053dd +- +-80105d26 : +-.globl vector132 +-vector132: +- pushl $0 ++80105d04: 6a 7c push $0x7c ++80105d06: e9 02 f7 ff ff jmp 8010540d ++ ++80105d0b : ++80105d0b: 6a 00 push $0x0 ++80105d0d: 6a 7d push $0x7d ++80105d0f: e9 f9 f6 ff ff jmp 8010540d ++ ++80105d14 : ++80105d14: 6a 00 push $0x0 ++80105d16: 6a 7e push $0x7e ++80105d18: e9 f0 f6 ff ff jmp 8010540d ++ ++80105d1d : ++80105d1d: 6a 00 push $0x0 ++80105d1f: 6a 7f push $0x7f ++80105d21: e9 e7 f6 ff ff jmp 8010540d ++ ++80105d26 : + 80105d26: 6a 00 push $0x0 +- pushl $132 +-80105d28: 68 84 00 00 00 push $0x84 +- jmp alltraps +-80105d2d: e9 ab f6 ff ff jmp 801053dd +- +-80105d32 : +-.globl vector133 +-vector133: +- pushl $0 ++80105d28: 68 80 00 00 00 push $0x80 ++80105d2d: e9 db f6 ff ff jmp 8010540d ++ ++80105d32 : + 80105d32: 6a 00 push $0x0 +- pushl $133 +-80105d34: 68 85 00 00 00 push $0x85 +- jmp alltraps +-80105d39: e9 9f f6 ff ff jmp 801053dd +- +-80105d3e : +-.globl vector134 +-vector134: +- pushl $0 ++80105d34: 68 81 00 00 00 push $0x81 ++80105d39: e9 cf f6 ff ff jmp 8010540d ++ ++80105d3e : + 80105d3e: 6a 00 push $0x0 +- pushl $134 +-80105d40: 68 86 00 00 00 push $0x86 +- jmp alltraps +-80105d45: e9 93 f6 ff ff jmp 801053dd +- +-80105d4a : +-.globl vector135 +-vector135: +- pushl $0 ++80105d40: 68 82 00 00 00 push $0x82 ++80105d45: e9 c3 f6 ff ff jmp 8010540d ++ ++80105d4a : + 80105d4a: 6a 00 push $0x0 +- pushl $135 +-80105d4c: 68 87 00 00 00 push $0x87 +- jmp alltraps +-80105d51: e9 87 f6 ff ff jmp 801053dd +- +-80105d56 : +-.globl vector136 +-vector136: +- pushl $0 ++80105d4c: 68 83 00 00 00 push $0x83 ++80105d51: e9 b7 f6 ff ff jmp 8010540d ++ ++80105d56 : + 80105d56: 6a 00 push $0x0 +- pushl $136 +-80105d58: 68 88 00 00 00 push $0x88 +- jmp alltraps +-80105d5d: e9 7b f6 ff ff jmp 801053dd +- +-80105d62 : +-.globl vector137 +-vector137: +- pushl $0 ++80105d58: 68 84 00 00 00 push $0x84 ++80105d5d: e9 ab f6 ff ff jmp 8010540d ++ ++80105d62 : + 80105d62: 6a 00 push $0x0 +- pushl $137 +-80105d64: 68 89 00 00 00 push $0x89 +- jmp alltraps +-80105d69: e9 6f f6 ff ff jmp 801053dd +- +-80105d6e : +-.globl vector138 +-vector138: +- pushl $0 ++80105d64: 68 85 00 00 00 push $0x85 ++80105d69: e9 9f f6 ff ff jmp 8010540d ++ ++80105d6e : + 80105d6e: 6a 00 push $0x0 +- pushl $138 +-80105d70: 68 8a 00 00 00 push $0x8a +- jmp alltraps +-80105d75: e9 63 f6 ff ff jmp 801053dd +- +-80105d7a : +-.globl vector139 +-vector139: +- pushl $0 ++80105d70: 68 86 00 00 00 push $0x86 ++80105d75: e9 93 f6 ff ff jmp 8010540d ++ ++80105d7a : + 80105d7a: 6a 00 push $0x0 +- pushl $139 +-80105d7c: 68 8b 00 00 00 push $0x8b +- jmp alltraps +-80105d81: e9 57 f6 ff ff jmp 801053dd +- +-80105d86 : +-.globl vector140 +-vector140: +- pushl $0 ++80105d7c: 68 87 00 00 00 push $0x87 ++80105d81: e9 87 f6 ff ff jmp 8010540d ++ ++80105d86 : + 80105d86: 6a 00 push $0x0 +- pushl $140 +-80105d88: 68 8c 00 00 00 push $0x8c +- jmp alltraps +-80105d8d: e9 4b f6 ff ff jmp 801053dd +- +-80105d92 : +-.globl vector141 +-vector141: +- pushl $0 ++80105d88: 68 88 00 00 00 push $0x88 ++80105d8d: e9 7b f6 ff ff jmp 8010540d ++ ++80105d92 : + 80105d92: 6a 00 push $0x0 +- pushl $141 +-80105d94: 68 8d 00 00 00 push $0x8d +- jmp alltraps +-80105d99: e9 3f f6 ff ff jmp 801053dd +- +-80105d9e : +-.globl vector142 +-vector142: +- pushl $0 ++80105d94: 68 89 00 00 00 push $0x89 ++80105d99: e9 6f f6 ff ff jmp 8010540d ++ ++80105d9e : + 80105d9e: 6a 00 push $0x0 +- pushl $142 +-80105da0: 68 8e 00 00 00 push $0x8e +- jmp alltraps +-80105da5: e9 33 f6 ff ff jmp 801053dd +- +-80105daa : +-.globl vector143 +-vector143: +- pushl $0 ++80105da0: 68 8a 00 00 00 push $0x8a ++80105da5: e9 63 f6 ff ff jmp 8010540d ++ ++80105daa : + 80105daa: 6a 00 push $0x0 +- pushl $143 +-80105dac: 68 8f 00 00 00 push $0x8f +- jmp alltraps +-80105db1: e9 27 f6 ff ff jmp 801053dd +- +-80105db6 : +-.globl vector144 +-vector144: +- pushl $0 ++80105dac: 68 8b 00 00 00 push $0x8b ++80105db1: e9 57 f6 ff ff jmp 8010540d ++ ++80105db6 : + 80105db6: 6a 00 push $0x0 +- pushl $144 +-80105db8: 68 90 00 00 00 push $0x90 +- jmp alltraps +-80105dbd: e9 1b f6 ff ff jmp 801053dd +- +-80105dc2 : +-.globl vector145 +-vector145: +- pushl $0 ++80105db8: 68 8c 00 00 00 push $0x8c ++80105dbd: e9 4b f6 ff ff jmp 8010540d ++ ++80105dc2 : + 80105dc2: 6a 00 push $0x0 +- pushl $145 +-80105dc4: 68 91 00 00 00 push $0x91 +- jmp alltraps +-80105dc9: e9 0f f6 ff ff jmp 801053dd +- +-80105dce : +-.globl vector146 +-vector146: +- pushl $0 ++80105dc4: 68 8d 00 00 00 push $0x8d ++80105dc9: e9 3f f6 ff ff jmp 8010540d ++ ++80105dce : + 80105dce: 6a 00 push $0x0 +- pushl $146 +-80105dd0: 68 92 00 00 00 push $0x92 +- jmp alltraps +-80105dd5: e9 03 f6 ff ff jmp 801053dd +- +-80105dda : +-.globl vector147 +-vector147: +- pushl $0 ++80105dd0: 68 8e 00 00 00 push $0x8e ++80105dd5: e9 33 f6 ff ff jmp 8010540d ++ ++80105dda : + 80105dda: 6a 00 push $0x0 +- pushl $147 +-80105ddc: 68 93 00 00 00 push $0x93 +- jmp alltraps +-80105de1: e9 f7 f5 ff ff jmp 801053dd +- +-80105de6 : +-.globl vector148 +-vector148: +- pushl $0 ++80105ddc: 68 8f 00 00 00 push $0x8f ++80105de1: e9 27 f6 ff ff jmp 8010540d ++ ++80105de6 : + 80105de6: 6a 00 push $0x0 +- pushl $148 +-80105de8: 68 94 00 00 00 push $0x94 +- jmp alltraps +-80105ded: e9 eb f5 ff ff jmp 801053dd +- +-80105df2 : +-.globl vector149 +-vector149: +- pushl $0 ++80105de8: 68 90 00 00 00 push $0x90 ++80105ded: e9 1b f6 ff ff jmp 8010540d ++ ++80105df2 : + 80105df2: 6a 00 push $0x0 +- pushl $149 +-80105df4: 68 95 00 00 00 push $0x95 +- jmp alltraps +-80105df9: e9 df f5 ff ff jmp 801053dd +- +-80105dfe : +-.globl vector150 +-vector150: +- pushl $0 ++80105df4: 68 91 00 00 00 push $0x91 ++80105df9: e9 0f f6 ff ff jmp 8010540d ++ ++80105dfe : + 80105dfe: 6a 00 push $0x0 +- pushl $150 +-80105e00: 68 96 00 00 00 push $0x96 +- jmp alltraps +-80105e05: e9 d3 f5 ff ff jmp 801053dd +- +-80105e0a : +-.globl vector151 +-vector151: +- pushl $0 ++80105e00: 68 92 00 00 00 push $0x92 ++80105e05: e9 03 f6 ff ff jmp 8010540d ++ ++80105e0a : + 80105e0a: 6a 00 push $0x0 +- pushl $151 +-80105e0c: 68 97 00 00 00 push $0x97 +- jmp alltraps +-80105e11: e9 c7 f5 ff ff jmp 801053dd +- +-80105e16 : +-.globl vector152 +-vector152: +- pushl $0 ++80105e0c: 68 93 00 00 00 push $0x93 ++80105e11: e9 f7 f5 ff ff jmp 8010540d ++ ++80105e16 : + 80105e16: 6a 00 push $0x0 +- pushl $152 +-80105e18: 68 98 00 00 00 push $0x98 +- jmp alltraps +-80105e1d: e9 bb f5 ff ff jmp 801053dd +- +-80105e22 : +-.globl vector153 +-vector153: +- pushl $0 ++80105e18: 68 94 00 00 00 push $0x94 ++80105e1d: e9 eb f5 ff ff jmp 8010540d ++ ++80105e22 : + 80105e22: 6a 00 push $0x0 +- pushl $153 +-80105e24: 68 99 00 00 00 push $0x99 +- jmp alltraps +-80105e29: e9 af f5 ff ff jmp 801053dd +- +-80105e2e : +-.globl vector154 +-vector154: +- pushl $0 ++80105e24: 68 95 00 00 00 push $0x95 ++80105e29: e9 df f5 ff ff jmp 8010540d ++ ++80105e2e : + 80105e2e: 6a 00 push $0x0 +- pushl $154 +-80105e30: 68 9a 00 00 00 push $0x9a +- jmp alltraps +-80105e35: e9 a3 f5 ff ff jmp 801053dd +- +-80105e3a : +-.globl vector155 +-vector155: +- pushl $0 ++80105e30: 68 96 00 00 00 push $0x96 ++80105e35: e9 d3 f5 ff ff jmp 8010540d ++ ++80105e3a : + 80105e3a: 6a 00 push $0x0 +- pushl $155 +-80105e3c: 68 9b 00 00 00 push $0x9b +- jmp alltraps +-80105e41: e9 97 f5 ff ff jmp 801053dd +- +-80105e46 : +-.globl vector156 +-vector156: +- pushl $0 ++80105e3c: 68 97 00 00 00 push $0x97 ++80105e41: e9 c7 f5 ff ff jmp 8010540d ++ ++80105e46 : + 80105e46: 6a 00 push $0x0 +- pushl $156 +-80105e48: 68 9c 00 00 00 push $0x9c +- jmp alltraps +-80105e4d: e9 8b f5 ff ff jmp 801053dd +- +-80105e52 : +-.globl vector157 +-vector157: +- pushl $0 ++80105e48: 68 98 00 00 00 push $0x98 ++80105e4d: e9 bb f5 ff ff jmp 8010540d ++ ++80105e52 : + 80105e52: 6a 00 push $0x0 +- pushl $157 +-80105e54: 68 9d 00 00 00 push $0x9d +- jmp alltraps +-80105e59: e9 7f f5 ff ff jmp 801053dd +- +-80105e5e : +-.globl vector158 +-vector158: +- pushl $0 ++80105e54: 68 99 00 00 00 push $0x99 ++80105e59: e9 af f5 ff ff jmp 8010540d ++ ++80105e5e : + 80105e5e: 6a 00 push $0x0 +- pushl $158 +-80105e60: 68 9e 00 00 00 push $0x9e +- jmp alltraps +-80105e65: e9 73 f5 ff ff jmp 801053dd +- +-80105e6a : +-.globl vector159 +-vector159: +- pushl $0 ++80105e60: 68 9a 00 00 00 push $0x9a ++80105e65: e9 a3 f5 ff ff jmp 8010540d ++ ++80105e6a : + 80105e6a: 6a 00 push $0x0 +- pushl $159 +-80105e6c: 68 9f 00 00 00 push $0x9f +- jmp alltraps +-80105e71: e9 67 f5 ff ff jmp 801053dd +- +-80105e76 : +-.globl vector160 +-vector160: +- pushl $0 ++80105e6c: 68 9b 00 00 00 push $0x9b ++80105e71: e9 97 f5 ff ff jmp 8010540d ++ ++80105e76 : + 80105e76: 6a 00 push $0x0 +- pushl $160 +-80105e78: 68 a0 00 00 00 push $0xa0 +- jmp alltraps +-80105e7d: e9 5b f5 ff ff jmp 801053dd +- +-80105e82 : +-.globl vector161 +-vector161: +- pushl $0 ++80105e78: 68 9c 00 00 00 push $0x9c ++80105e7d: e9 8b f5 ff ff jmp 8010540d ++ ++80105e82 : + 80105e82: 6a 00 push $0x0 +- pushl $161 +-80105e84: 68 a1 00 00 00 push $0xa1 +- jmp alltraps +-80105e89: e9 4f f5 ff ff jmp 801053dd +- +-80105e8e : +-.globl vector162 +-vector162: +- pushl $0 ++80105e84: 68 9d 00 00 00 push $0x9d ++80105e89: e9 7f f5 ff ff jmp 8010540d ++ ++80105e8e : + 80105e8e: 6a 00 push $0x0 +- pushl $162 +-80105e90: 68 a2 00 00 00 push $0xa2 +- jmp alltraps +-80105e95: e9 43 f5 ff ff jmp 801053dd +- +-80105e9a : +-.globl vector163 +-vector163: +- pushl $0 ++80105e90: 68 9e 00 00 00 push $0x9e ++80105e95: e9 73 f5 ff ff jmp 8010540d ++ ++80105e9a : + 80105e9a: 6a 00 push $0x0 +- pushl $163 +-80105e9c: 68 a3 00 00 00 push $0xa3 +- jmp alltraps +-80105ea1: e9 37 f5 ff ff jmp 801053dd +- +-80105ea6 : +-.globl vector164 +-vector164: +- pushl $0 ++80105e9c: 68 9f 00 00 00 push $0x9f ++80105ea1: e9 67 f5 ff ff jmp 8010540d ++ ++80105ea6 : + 80105ea6: 6a 00 push $0x0 +- pushl $164 +-80105ea8: 68 a4 00 00 00 push $0xa4 +- jmp alltraps +-80105ead: e9 2b f5 ff ff jmp 801053dd +- +-80105eb2 : +-.globl vector165 +-vector165: +- pushl $0 ++80105ea8: 68 a0 00 00 00 push $0xa0 ++80105ead: e9 5b f5 ff ff jmp 8010540d ++ ++80105eb2 : + 80105eb2: 6a 00 push $0x0 +- pushl $165 +-80105eb4: 68 a5 00 00 00 push $0xa5 +- jmp alltraps +-80105eb9: e9 1f f5 ff ff jmp 801053dd +- +-80105ebe : +-.globl vector166 +-vector166: +- pushl $0 ++80105eb4: 68 a1 00 00 00 push $0xa1 ++80105eb9: e9 4f f5 ff ff jmp 8010540d ++ ++80105ebe : + 80105ebe: 6a 00 push $0x0 +- pushl $166 +-80105ec0: 68 a6 00 00 00 push $0xa6 +- jmp alltraps +-80105ec5: e9 13 f5 ff ff jmp 801053dd +- +-80105eca : +-.globl vector167 +-vector167: +- pushl $0 ++80105ec0: 68 a2 00 00 00 push $0xa2 ++80105ec5: e9 43 f5 ff ff jmp 8010540d ++ ++80105eca : + 80105eca: 6a 00 push $0x0 +- pushl $167 +-80105ecc: 68 a7 00 00 00 push $0xa7 +- jmp alltraps +-80105ed1: e9 07 f5 ff ff jmp 801053dd +- +-80105ed6 : +-.globl vector168 +-vector168: +- pushl $0 ++80105ecc: 68 a3 00 00 00 push $0xa3 ++80105ed1: e9 37 f5 ff ff jmp 8010540d ++ ++80105ed6 : + 80105ed6: 6a 00 push $0x0 +- pushl $168 +-80105ed8: 68 a8 00 00 00 push $0xa8 +- jmp alltraps +-80105edd: e9 fb f4 ff ff jmp 801053dd +- +-80105ee2 : +-.globl vector169 +-vector169: +- pushl $0 ++80105ed8: 68 a4 00 00 00 push $0xa4 ++80105edd: e9 2b f5 ff ff jmp 8010540d ++ ++80105ee2 : + 80105ee2: 6a 00 push $0x0 +- pushl $169 +-80105ee4: 68 a9 00 00 00 push $0xa9 +- jmp alltraps +-80105ee9: e9 ef f4 ff ff jmp 801053dd +- +-80105eee : +-.globl vector170 +-vector170: +- pushl $0 ++80105ee4: 68 a5 00 00 00 push $0xa5 ++80105ee9: e9 1f f5 ff ff jmp 8010540d ++ ++80105eee : + 80105eee: 6a 00 push $0x0 +- pushl $170 +-80105ef0: 68 aa 00 00 00 push $0xaa +- jmp alltraps +-80105ef5: e9 e3 f4 ff ff jmp 801053dd +- +-80105efa : +-.globl vector171 +-vector171: +- pushl $0 ++80105ef0: 68 a6 00 00 00 push $0xa6 ++80105ef5: e9 13 f5 ff ff jmp 8010540d ++ ++80105efa : + 80105efa: 6a 00 push $0x0 +- pushl $171 +-80105efc: 68 ab 00 00 00 push $0xab +- jmp alltraps +-80105f01: e9 d7 f4 ff ff jmp 801053dd +- +-80105f06 : +-.globl vector172 +-vector172: +- pushl $0 ++80105efc: 68 a7 00 00 00 push $0xa7 ++80105f01: e9 07 f5 ff ff jmp 8010540d ++ ++80105f06 : + 80105f06: 6a 00 push $0x0 +- pushl $172 +-80105f08: 68 ac 00 00 00 push $0xac +- jmp alltraps +-80105f0d: e9 cb f4 ff ff jmp 801053dd +- +-80105f12 : +-.globl vector173 +-vector173: +- pushl $0 ++80105f08: 68 a8 00 00 00 push $0xa8 ++80105f0d: e9 fb f4 ff ff jmp 8010540d ++ ++80105f12 : + 80105f12: 6a 00 push $0x0 +- pushl $173 +-80105f14: 68 ad 00 00 00 push $0xad +- jmp alltraps +-80105f19: e9 bf f4 ff ff jmp 801053dd +- +-80105f1e : +-.globl vector174 +-vector174: +- pushl $0 ++80105f14: 68 a9 00 00 00 push $0xa9 ++80105f19: e9 ef f4 ff ff jmp 8010540d ++ ++80105f1e : + 80105f1e: 6a 00 push $0x0 +- pushl $174 +-80105f20: 68 ae 00 00 00 push $0xae +- jmp alltraps +-80105f25: e9 b3 f4 ff ff jmp 801053dd +- +-80105f2a : +-.globl vector175 +-vector175: +- pushl $0 ++80105f20: 68 aa 00 00 00 push $0xaa ++80105f25: e9 e3 f4 ff ff jmp 8010540d ++ ++80105f2a : + 80105f2a: 6a 00 push $0x0 +- pushl $175 +-80105f2c: 68 af 00 00 00 push $0xaf +- jmp alltraps +-80105f31: e9 a7 f4 ff ff jmp 801053dd +- +-80105f36 : +-.globl vector176 +-vector176: +- pushl $0 ++80105f2c: 68 ab 00 00 00 push $0xab ++80105f31: e9 d7 f4 ff ff jmp 8010540d ++ ++80105f36 : + 80105f36: 6a 00 push $0x0 +- pushl $176 +-80105f38: 68 b0 00 00 00 push $0xb0 +- jmp alltraps +-80105f3d: e9 9b f4 ff ff jmp 801053dd +- +-80105f42 : +-.globl vector177 +-vector177: +- pushl $0 ++80105f38: 68 ac 00 00 00 push $0xac ++80105f3d: e9 cb f4 ff ff jmp 8010540d ++ ++80105f42 : + 80105f42: 6a 00 push $0x0 +- pushl $177 +-80105f44: 68 b1 00 00 00 push $0xb1 +- jmp alltraps +-80105f49: e9 8f f4 ff ff jmp 801053dd +- +-80105f4e : +-.globl vector178 +-vector178: +- pushl $0 ++80105f44: 68 ad 00 00 00 push $0xad ++80105f49: e9 bf f4 ff ff jmp 8010540d ++ ++80105f4e : + 80105f4e: 6a 00 push $0x0 +- pushl $178 +-80105f50: 68 b2 00 00 00 push $0xb2 +- jmp alltraps +-80105f55: e9 83 f4 ff ff jmp 801053dd +- +-80105f5a : +-.globl vector179 +-vector179: +- pushl $0 ++80105f50: 68 ae 00 00 00 push $0xae ++80105f55: e9 b3 f4 ff ff jmp 8010540d ++ ++80105f5a : + 80105f5a: 6a 00 push $0x0 +- pushl $179 +-80105f5c: 68 b3 00 00 00 push $0xb3 +- jmp alltraps +-80105f61: e9 77 f4 ff ff jmp 801053dd +- +-80105f66 : +-.globl vector180 +-vector180: +- pushl $0 ++80105f5c: 68 af 00 00 00 push $0xaf ++80105f61: e9 a7 f4 ff ff jmp 8010540d ++ ++80105f66 : + 80105f66: 6a 00 push $0x0 +- pushl $180 +-80105f68: 68 b4 00 00 00 push $0xb4 +- jmp alltraps +-80105f6d: e9 6b f4 ff ff jmp 801053dd +- +-80105f72 : +-.globl vector181 +-vector181: +- pushl $0 ++80105f68: 68 b0 00 00 00 push $0xb0 ++80105f6d: e9 9b f4 ff ff jmp 8010540d ++ ++80105f72 : + 80105f72: 6a 00 push $0x0 +- pushl $181 +-80105f74: 68 b5 00 00 00 push $0xb5 +- jmp alltraps +-80105f79: e9 5f f4 ff ff jmp 801053dd +- +-80105f7e : +-.globl vector182 +-vector182: +- pushl $0 ++80105f74: 68 b1 00 00 00 push $0xb1 ++80105f79: e9 8f f4 ff ff jmp 8010540d ++ ++80105f7e : + 80105f7e: 6a 00 push $0x0 +- pushl $182 +-80105f80: 68 b6 00 00 00 push $0xb6 +- jmp alltraps +-80105f85: e9 53 f4 ff ff jmp 801053dd +- +-80105f8a : +-.globl vector183 +-vector183: +- pushl $0 ++80105f80: 68 b2 00 00 00 push $0xb2 ++80105f85: e9 83 f4 ff ff jmp 8010540d ++ ++80105f8a : + 80105f8a: 6a 00 push $0x0 +- pushl $183 +-80105f8c: 68 b7 00 00 00 push $0xb7 +- jmp alltraps +-80105f91: e9 47 f4 ff ff jmp 801053dd +- +-80105f96 : +-.globl vector184 +-vector184: +- pushl $0 ++80105f8c: 68 b3 00 00 00 push $0xb3 ++80105f91: e9 77 f4 ff ff jmp 8010540d ++ ++80105f96 : + 80105f96: 6a 00 push $0x0 +- pushl $184 +-80105f98: 68 b8 00 00 00 push $0xb8 +- jmp alltraps +-80105f9d: e9 3b f4 ff ff jmp 801053dd +- +-80105fa2 : +-.globl vector185 +-vector185: +- pushl $0 ++80105f98: 68 b4 00 00 00 push $0xb4 ++80105f9d: e9 6b f4 ff ff jmp 8010540d ++ ++80105fa2 : + 80105fa2: 6a 00 push $0x0 +- pushl $185 +-80105fa4: 68 b9 00 00 00 push $0xb9 +- jmp alltraps +-80105fa9: e9 2f f4 ff ff jmp 801053dd +- +-80105fae : +-.globl vector186 +-vector186: +- pushl $0 ++80105fa4: 68 b5 00 00 00 push $0xb5 ++80105fa9: e9 5f f4 ff ff jmp 8010540d ++ ++80105fae : + 80105fae: 6a 00 push $0x0 +- pushl $186 +-80105fb0: 68 ba 00 00 00 push $0xba +- jmp alltraps +-80105fb5: e9 23 f4 ff ff jmp 801053dd +- +-80105fba : +-.globl vector187 +-vector187: +- pushl $0 ++80105fb0: 68 b6 00 00 00 push $0xb6 ++80105fb5: e9 53 f4 ff ff jmp 8010540d ++ ++80105fba : + 80105fba: 6a 00 push $0x0 +- pushl $187 +-80105fbc: 68 bb 00 00 00 push $0xbb +- jmp alltraps +-80105fc1: e9 17 f4 ff ff jmp 801053dd +- +-80105fc6 : +-.globl vector188 +-vector188: +- pushl $0 ++80105fbc: 68 b7 00 00 00 push $0xb7 ++80105fc1: e9 47 f4 ff ff jmp 8010540d ++ ++80105fc6 : + 80105fc6: 6a 00 push $0x0 +- pushl $188 +-80105fc8: 68 bc 00 00 00 push $0xbc +- jmp alltraps +-80105fcd: e9 0b f4 ff ff jmp 801053dd +- +-80105fd2 : +-.globl vector189 +-vector189: +- pushl $0 ++80105fc8: 68 b8 00 00 00 push $0xb8 ++80105fcd: e9 3b f4 ff ff jmp 8010540d ++ ++80105fd2 : + 80105fd2: 6a 00 push $0x0 +- pushl $189 +-80105fd4: 68 bd 00 00 00 push $0xbd +- jmp alltraps +-80105fd9: e9 ff f3 ff ff jmp 801053dd +- +-80105fde : +-.globl vector190 +-vector190: +- pushl $0 ++80105fd4: 68 b9 00 00 00 push $0xb9 ++80105fd9: e9 2f f4 ff ff jmp 8010540d ++ ++80105fde : + 80105fde: 6a 00 push $0x0 +- pushl $190 +-80105fe0: 68 be 00 00 00 push $0xbe +- jmp alltraps +-80105fe5: e9 f3 f3 ff ff jmp 801053dd +- +-80105fea : +-.globl vector191 +-vector191: +- pushl $0 ++80105fe0: 68 ba 00 00 00 push $0xba ++80105fe5: e9 23 f4 ff ff jmp 8010540d ++ ++80105fea : + 80105fea: 6a 00 push $0x0 +- pushl $191 +-80105fec: 68 bf 00 00 00 push $0xbf +- jmp alltraps +-80105ff1: e9 e7 f3 ff ff jmp 801053dd +- +-80105ff6 : +-.globl vector192 +-vector192: +- pushl $0 ++80105fec: 68 bb 00 00 00 push $0xbb ++80105ff1: e9 17 f4 ff ff jmp 8010540d ++ ++80105ff6 : + 80105ff6: 6a 00 push $0x0 +- pushl $192 +-80105ff8: 68 c0 00 00 00 push $0xc0 +- jmp alltraps +-80105ffd: e9 db f3 ff ff jmp 801053dd +- +-80106002 : +-.globl vector193 +-vector193: +- pushl $0 ++80105ff8: 68 bc 00 00 00 push $0xbc ++80105ffd: e9 0b f4 ff ff jmp 8010540d ++ ++80106002 : + 80106002: 6a 00 push $0x0 +- pushl $193 +-80106004: 68 c1 00 00 00 push $0xc1 +- jmp alltraps +-80106009: e9 cf f3 ff ff jmp 801053dd +- +-8010600e : +-.globl vector194 +-vector194: +- pushl $0 ++80106004: 68 bd 00 00 00 push $0xbd ++80106009: e9 ff f3 ff ff jmp 8010540d ++ ++8010600e : + 8010600e: 6a 00 push $0x0 +- pushl $194 +-80106010: 68 c2 00 00 00 push $0xc2 +- jmp alltraps +-80106015: e9 c3 f3 ff ff jmp 801053dd +- +-8010601a : +-.globl vector195 +-vector195: +- pushl $0 ++80106010: 68 be 00 00 00 push $0xbe ++80106015: e9 f3 f3 ff ff jmp 8010540d ++ ++8010601a : + 8010601a: 6a 00 push $0x0 +- pushl $195 +-8010601c: 68 c3 00 00 00 push $0xc3 +- jmp alltraps +-80106021: e9 b7 f3 ff ff jmp 801053dd +- +-80106026 : +-.globl vector196 +-vector196: +- pushl $0 ++8010601c: 68 bf 00 00 00 push $0xbf ++80106021: e9 e7 f3 ff ff jmp 8010540d ++ ++80106026 : + 80106026: 6a 00 push $0x0 +- pushl $196 +-80106028: 68 c4 00 00 00 push $0xc4 +- jmp alltraps +-8010602d: e9 ab f3 ff ff jmp 801053dd +- +-80106032 : +-.globl vector197 +-vector197: +- pushl $0 ++80106028: 68 c0 00 00 00 push $0xc0 ++8010602d: e9 db f3 ff ff jmp 8010540d ++ ++80106032 : + 80106032: 6a 00 push $0x0 +- pushl $197 +-80106034: 68 c5 00 00 00 push $0xc5 +- jmp alltraps +-80106039: e9 9f f3 ff ff jmp 801053dd +- +-8010603e : +-.globl vector198 +-vector198: +- pushl $0 ++80106034: 68 c1 00 00 00 push $0xc1 ++80106039: e9 cf f3 ff ff jmp 8010540d ++ ++8010603e : + 8010603e: 6a 00 push $0x0 +- pushl $198 +-80106040: 68 c6 00 00 00 push $0xc6 +- jmp alltraps +-80106045: e9 93 f3 ff ff jmp 801053dd +- +-8010604a : +-.globl vector199 +-vector199: +- pushl $0 ++80106040: 68 c2 00 00 00 push $0xc2 ++80106045: e9 c3 f3 ff ff jmp 8010540d ++ ++8010604a : + 8010604a: 6a 00 push $0x0 +- pushl $199 +-8010604c: 68 c7 00 00 00 push $0xc7 +- jmp alltraps +-80106051: e9 87 f3 ff ff jmp 801053dd +- +-80106056 : +-.globl vector200 +-vector200: +- pushl $0 ++8010604c: 68 c3 00 00 00 push $0xc3 ++80106051: e9 b7 f3 ff ff jmp 8010540d ++ ++80106056 : + 80106056: 6a 00 push $0x0 +- pushl $200 +-80106058: 68 c8 00 00 00 push $0xc8 +- jmp alltraps +-8010605d: e9 7b f3 ff ff jmp 801053dd +- +-80106062 : +-.globl vector201 +-vector201: +- pushl $0 ++80106058: 68 c4 00 00 00 push $0xc4 ++8010605d: e9 ab f3 ff ff jmp 8010540d ++ ++80106062 : + 80106062: 6a 00 push $0x0 +- pushl $201 +-80106064: 68 c9 00 00 00 push $0xc9 +- jmp alltraps +-80106069: e9 6f f3 ff ff jmp 801053dd +- +-8010606e : +-.globl vector202 +-vector202: +- pushl $0 ++80106064: 68 c5 00 00 00 push $0xc5 ++80106069: e9 9f f3 ff ff jmp 8010540d ++ ++8010606e : + 8010606e: 6a 00 push $0x0 +- pushl $202 +-80106070: 68 ca 00 00 00 push $0xca +- jmp alltraps +-80106075: e9 63 f3 ff ff jmp 801053dd +- +-8010607a : +-.globl vector203 +-vector203: +- pushl $0 ++80106070: 68 c6 00 00 00 push $0xc6 ++80106075: e9 93 f3 ff ff jmp 8010540d ++ ++8010607a : + 8010607a: 6a 00 push $0x0 +- pushl $203 +-8010607c: 68 cb 00 00 00 push $0xcb +- jmp alltraps +-80106081: e9 57 f3 ff ff jmp 801053dd +- +-80106086 : +-.globl vector204 +-vector204: +- pushl $0 ++8010607c: 68 c7 00 00 00 push $0xc7 ++80106081: e9 87 f3 ff ff jmp 8010540d ++ ++80106086 : + 80106086: 6a 00 push $0x0 +- pushl $204 +-80106088: 68 cc 00 00 00 push $0xcc +- jmp alltraps +-8010608d: e9 4b f3 ff ff jmp 801053dd +- +-80106092 : +-.globl vector205 +-vector205: +- pushl $0 ++80106088: 68 c8 00 00 00 push $0xc8 ++8010608d: e9 7b f3 ff ff jmp 8010540d ++ ++80106092 : + 80106092: 6a 00 push $0x0 +- pushl $205 +-80106094: 68 cd 00 00 00 push $0xcd +- jmp alltraps +-80106099: e9 3f f3 ff ff jmp 801053dd +- +-8010609e : +-.globl vector206 +-vector206: +- pushl $0 ++80106094: 68 c9 00 00 00 push $0xc9 ++80106099: e9 6f f3 ff ff jmp 8010540d ++ ++8010609e : + 8010609e: 6a 00 push $0x0 +- pushl $206 +-801060a0: 68 ce 00 00 00 push $0xce +- jmp alltraps +-801060a5: e9 33 f3 ff ff jmp 801053dd +- +-801060aa : +-.globl vector207 +-vector207: +- pushl $0 ++801060a0: 68 ca 00 00 00 push $0xca ++801060a5: e9 63 f3 ff ff jmp 8010540d ++ ++801060aa : + 801060aa: 6a 00 push $0x0 +- pushl $207 +-801060ac: 68 cf 00 00 00 push $0xcf +- jmp alltraps +-801060b1: e9 27 f3 ff ff jmp 801053dd +- +-801060b6 : +-.globl vector208 +-vector208: +- pushl $0 ++801060ac: 68 cb 00 00 00 push $0xcb ++801060b1: e9 57 f3 ff ff jmp 8010540d ++ ++801060b6 : + 801060b6: 6a 00 push $0x0 +- pushl $208 +-801060b8: 68 d0 00 00 00 push $0xd0 +- jmp alltraps +-801060bd: e9 1b f3 ff ff jmp 801053dd +- +-801060c2 : +-.globl vector209 +-vector209: +- pushl $0 ++801060b8: 68 cc 00 00 00 push $0xcc ++801060bd: e9 4b f3 ff ff jmp 8010540d ++ ++801060c2 : + 801060c2: 6a 00 push $0x0 +- pushl $209 +-801060c4: 68 d1 00 00 00 push $0xd1 +- jmp alltraps +-801060c9: e9 0f f3 ff ff jmp 801053dd +- +-801060ce : +-.globl vector210 +-vector210: +- pushl $0 ++801060c4: 68 cd 00 00 00 push $0xcd ++801060c9: e9 3f f3 ff ff jmp 8010540d ++ ++801060ce : + 801060ce: 6a 00 push $0x0 +- pushl $210 +-801060d0: 68 d2 00 00 00 push $0xd2 +- jmp alltraps +-801060d5: e9 03 f3 ff ff jmp 801053dd +- +-801060da : +-.globl vector211 +-vector211: +- pushl $0 ++801060d0: 68 ce 00 00 00 push $0xce ++801060d5: e9 33 f3 ff ff jmp 8010540d ++ ++801060da : + 801060da: 6a 00 push $0x0 +- pushl $211 +-801060dc: 68 d3 00 00 00 push $0xd3 +- jmp alltraps +-801060e1: e9 f7 f2 ff ff jmp 801053dd +- +-801060e6 : +-.globl vector212 +-vector212: +- pushl $0 ++801060dc: 68 cf 00 00 00 push $0xcf ++801060e1: e9 27 f3 ff ff jmp 8010540d ++ ++801060e6 : + 801060e6: 6a 00 push $0x0 +- pushl $212 +-801060e8: 68 d4 00 00 00 push $0xd4 +- jmp alltraps +-801060ed: e9 eb f2 ff ff jmp 801053dd +- +-801060f2 : +-.globl vector213 +-vector213: +- pushl $0 ++801060e8: 68 d0 00 00 00 push $0xd0 ++801060ed: e9 1b f3 ff ff jmp 8010540d ++ ++801060f2 : + 801060f2: 6a 00 push $0x0 +- pushl $213 +-801060f4: 68 d5 00 00 00 push $0xd5 +- jmp alltraps +-801060f9: e9 df f2 ff ff jmp 801053dd +- +-801060fe : +-.globl vector214 +-vector214: +- pushl $0 ++801060f4: 68 d1 00 00 00 push $0xd1 ++801060f9: e9 0f f3 ff ff jmp 8010540d ++ ++801060fe : + 801060fe: 6a 00 push $0x0 +- pushl $214 +-80106100: 68 d6 00 00 00 push $0xd6 +- jmp alltraps +-80106105: e9 d3 f2 ff ff jmp 801053dd +- +-8010610a : +-.globl vector215 +-vector215: +- pushl $0 ++80106100: 68 d2 00 00 00 push $0xd2 ++80106105: e9 03 f3 ff ff jmp 8010540d ++ ++8010610a : + 8010610a: 6a 00 push $0x0 +- pushl $215 +-8010610c: 68 d7 00 00 00 push $0xd7 +- jmp alltraps +-80106111: e9 c7 f2 ff ff jmp 801053dd +- +-80106116 : +-.globl vector216 +-vector216: +- pushl $0 ++8010610c: 68 d3 00 00 00 push $0xd3 ++80106111: e9 f7 f2 ff ff jmp 8010540d ++ ++80106116 : + 80106116: 6a 00 push $0x0 +- pushl $216 +-80106118: 68 d8 00 00 00 push $0xd8 +- jmp alltraps +-8010611d: e9 bb f2 ff ff jmp 801053dd +- +-80106122 : +-.globl vector217 +-vector217: +- pushl $0 ++80106118: 68 d4 00 00 00 push $0xd4 ++8010611d: e9 eb f2 ff ff jmp 8010540d ++ ++80106122 : + 80106122: 6a 00 push $0x0 +- pushl $217 +-80106124: 68 d9 00 00 00 push $0xd9 +- jmp alltraps +-80106129: e9 af f2 ff ff jmp 801053dd +- +-8010612e : +-.globl vector218 +-vector218: +- pushl $0 ++80106124: 68 d5 00 00 00 push $0xd5 ++80106129: e9 df f2 ff ff jmp 8010540d ++ ++8010612e : + 8010612e: 6a 00 push $0x0 +- pushl $218 +-80106130: 68 da 00 00 00 push $0xda +- jmp alltraps +-80106135: e9 a3 f2 ff ff jmp 801053dd +- +-8010613a : +-.globl vector219 +-vector219: +- pushl $0 ++80106130: 68 d6 00 00 00 push $0xd6 ++80106135: e9 d3 f2 ff ff jmp 8010540d ++ ++8010613a : + 8010613a: 6a 00 push $0x0 +- pushl $219 +-8010613c: 68 db 00 00 00 push $0xdb +- jmp alltraps +-80106141: e9 97 f2 ff ff jmp 801053dd +- +-80106146 : +-.globl vector220 +-vector220: +- pushl $0 ++8010613c: 68 d7 00 00 00 push $0xd7 ++80106141: e9 c7 f2 ff ff jmp 8010540d ++ ++80106146 : + 80106146: 6a 00 push $0x0 +- pushl $220 +-80106148: 68 dc 00 00 00 push $0xdc +- jmp alltraps +-8010614d: e9 8b f2 ff ff jmp 801053dd +- +-80106152 : +-.globl vector221 +-vector221: +- pushl $0 ++80106148: 68 d8 00 00 00 push $0xd8 ++8010614d: e9 bb f2 ff ff jmp 8010540d ++ ++80106152 : + 80106152: 6a 00 push $0x0 +- pushl $221 +-80106154: 68 dd 00 00 00 push $0xdd +- jmp alltraps +-80106159: e9 7f f2 ff ff jmp 801053dd +- +-8010615e : +-.globl vector222 +-vector222: +- pushl $0 ++80106154: 68 d9 00 00 00 push $0xd9 ++80106159: e9 af f2 ff ff jmp 8010540d ++ ++8010615e : + 8010615e: 6a 00 push $0x0 +- pushl $222 +-80106160: 68 de 00 00 00 push $0xde +- jmp alltraps +-80106165: e9 73 f2 ff ff jmp 801053dd +- +-8010616a : +-.globl vector223 +-vector223: +- pushl $0 ++80106160: 68 da 00 00 00 push $0xda ++80106165: e9 a3 f2 ff ff jmp 8010540d ++ ++8010616a : + 8010616a: 6a 00 push $0x0 +- pushl $223 +-8010616c: 68 df 00 00 00 push $0xdf +- jmp alltraps +-80106171: e9 67 f2 ff ff jmp 801053dd +- +-80106176 : +-.globl vector224 +-vector224: +- pushl $0 ++8010616c: 68 db 00 00 00 push $0xdb ++80106171: e9 97 f2 ff ff jmp 8010540d ++ ++80106176 : + 80106176: 6a 00 push $0x0 +- pushl $224 +-80106178: 68 e0 00 00 00 push $0xe0 +- jmp alltraps +-8010617d: e9 5b f2 ff ff jmp 801053dd +- +-80106182 : +-.globl vector225 +-vector225: +- pushl $0 ++80106178: 68 dc 00 00 00 push $0xdc ++8010617d: e9 8b f2 ff ff jmp 8010540d ++ ++80106182 : + 80106182: 6a 00 push $0x0 +- pushl $225 +-80106184: 68 e1 00 00 00 push $0xe1 +- jmp alltraps +-80106189: e9 4f f2 ff ff jmp 801053dd +- +-8010618e : +-.globl vector226 +-vector226: +- pushl $0 ++80106184: 68 dd 00 00 00 push $0xdd ++80106189: e9 7f f2 ff ff jmp 8010540d ++ ++8010618e : + 8010618e: 6a 00 push $0x0 +- pushl $226 +-80106190: 68 e2 00 00 00 push $0xe2 +- jmp alltraps +-80106195: e9 43 f2 ff ff jmp 801053dd +- +-8010619a : +-.globl vector227 +-vector227: +- pushl $0 ++80106190: 68 de 00 00 00 push $0xde ++80106195: e9 73 f2 ff ff jmp 8010540d ++ ++8010619a : + 8010619a: 6a 00 push $0x0 +- pushl $227 +-8010619c: 68 e3 00 00 00 push $0xe3 +- jmp alltraps +-801061a1: e9 37 f2 ff ff jmp 801053dd +- +-801061a6 : +-.globl vector228 +-vector228: +- pushl $0 ++8010619c: 68 df 00 00 00 push $0xdf ++801061a1: e9 67 f2 ff ff jmp 8010540d ++ ++801061a6 : + 801061a6: 6a 00 push $0x0 +- pushl $228 +-801061a8: 68 e4 00 00 00 push $0xe4 +- jmp alltraps +-801061ad: e9 2b f2 ff ff jmp 801053dd +- +-801061b2 : +-.globl vector229 +-vector229: +- pushl $0 ++801061a8: 68 e0 00 00 00 push $0xe0 ++801061ad: e9 5b f2 ff ff jmp 8010540d ++ ++801061b2 : + 801061b2: 6a 00 push $0x0 +- pushl $229 +-801061b4: 68 e5 00 00 00 push $0xe5 +- jmp alltraps +-801061b9: e9 1f f2 ff ff jmp 801053dd +- +-801061be : +-.globl vector230 +-vector230: +- pushl $0 ++801061b4: 68 e1 00 00 00 push $0xe1 ++801061b9: e9 4f f2 ff ff jmp 8010540d ++ ++801061be : + 801061be: 6a 00 push $0x0 +- pushl $230 +-801061c0: 68 e6 00 00 00 push $0xe6 +- jmp alltraps +-801061c5: e9 13 f2 ff ff jmp 801053dd +- +-801061ca : +-.globl vector231 +-vector231: +- pushl $0 ++801061c0: 68 e2 00 00 00 push $0xe2 ++801061c5: e9 43 f2 ff ff jmp 8010540d ++ ++801061ca : + 801061ca: 6a 00 push $0x0 +- pushl $231 +-801061cc: 68 e7 00 00 00 push $0xe7 +- jmp alltraps +-801061d1: e9 07 f2 ff ff jmp 801053dd +- +-801061d6 : +-.globl vector232 +-vector232: +- pushl $0 ++801061cc: 68 e3 00 00 00 push $0xe3 ++801061d1: e9 37 f2 ff ff jmp 8010540d ++ ++801061d6 : + 801061d6: 6a 00 push $0x0 +- pushl $232 +-801061d8: 68 e8 00 00 00 push $0xe8 +- jmp alltraps +-801061dd: e9 fb f1 ff ff jmp 801053dd +- +-801061e2 : +-.globl vector233 +-vector233: +- pushl $0 ++801061d8: 68 e4 00 00 00 push $0xe4 ++801061dd: e9 2b f2 ff ff jmp 8010540d ++ ++801061e2 : + 801061e2: 6a 00 push $0x0 +- pushl $233 +-801061e4: 68 e9 00 00 00 push $0xe9 +- jmp alltraps +-801061e9: e9 ef f1 ff ff jmp 801053dd +- +-801061ee : +-.globl vector234 +-vector234: +- pushl $0 ++801061e4: 68 e5 00 00 00 push $0xe5 ++801061e9: e9 1f f2 ff ff jmp 8010540d ++ ++801061ee : + 801061ee: 6a 00 push $0x0 +- pushl $234 +-801061f0: 68 ea 00 00 00 push $0xea +- jmp alltraps +-801061f5: e9 e3 f1 ff ff jmp 801053dd +- +-801061fa : +-.globl vector235 +-vector235: +- pushl $0 ++801061f0: 68 e6 00 00 00 push $0xe6 ++801061f5: e9 13 f2 ff ff jmp 8010540d ++ ++801061fa : + 801061fa: 6a 00 push $0x0 +- pushl $235 +-801061fc: 68 eb 00 00 00 push $0xeb +- jmp alltraps +-80106201: e9 d7 f1 ff ff jmp 801053dd +- +-80106206 : +-.globl vector236 +-vector236: +- pushl $0 ++801061fc: 68 e7 00 00 00 push $0xe7 ++80106201: e9 07 f2 ff ff jmp 8010540d ++ ++80106206 : + 80106206: 6a 00 push $0x0 +- pushl $236 +-80106208: 68 ec 00 00 00 push $0xec +- jmp alltraps +-8010620d: e9 cb f1 ff ff jmp 801053dd +- +-80106212 : +-.globl vector237 +-vector237: +- pushl $0 ++80106208: 68 e8 00 00 00 push $0xe8 ++8010620d: e9 fb f1 ff ff jmp 8010540d ++ ++80106212 : + 80106212: 6a 00 push $0x0 +- pushl $237 +-80106214: 68 ed 00 00 00 push $0xed +- jmp alltraps +-80106219: e9 bf f1 ff ff jmp 801053dd +- +-8010621e : +-.globl vector238 +-vector238: +- pushl $0 ++80106214: 68 e9 00 00 00 push $0xe9 ++80106219: e9 ef f1 ff ff jmp 8010540d ++ ++8010621e : + 8010621e: 6a 00 push $0x0 +- pushl $238 +-80106220: 68 ee 00 00 00 push $0xee +- jmp alltraps +-80106225: e9 b3 f1 ff ff jmp 801053dd +- +-8010622a : +-.globl vector239 +-vector239: +- pushl $0 ++80106220: 68 ea 00 00 00 push $0xea ++80106225: e9 e3 f1 ff ff jmp 8010540d ++ ++8010622a : + 8010622a: 6a 00 push $0x0 +- pushl $239 +-8010622c: 68 ef 00 00 00 push $0xef +- jmp alltraps +-80106231: e9 a7 f1 ff ff jmp 801053dd +- +-80106236 : +-.globl vector240 +-vector240: +- pushl $0 ++8010622c: 68 eb 00 00 00 push $0xeb ++80106231: e9 d7 f1 ff ff jmp 8010540d ++ ++80106236 : + 80106236: 6a 00 push $0x0 +- pushl $240 +-80106238: 68 f0 00 00 00 push $0xf0 +- jmp alltraps +-8010623d: e9 9b f1 ff ff jmp 801053dd +- +-80106242 : +-.globl vector241 +-vector241: +- pushl $0 ++80106238: 68 ec 00 00 00 push $0xec ++8010623d: e9 cb f1 ff ff jmp 8010540d ++ ++80106242 : + 80106242: 6a 00 push $0x0 +- pushl $241 +-80106244: 68 f1 00 00 00 push $0xf1 +- jmp alltraps +-80106249: e9 8f f1 ff ff jmp 801053dd +- +-8010624e : +-.globl vector242 +-vector242: +- pushl $0 ++80106244: 68 ed 00 00 00 push $0xed ++80106249: e9 bf f1 ff ff jmp 8010540d ++ ++8010624e : + 8010624e: 6a 00 push $0x0 +- pushl $242 +-80106250: 68 f2 00 00 00 push $0xf2 +- jmp alltraps +-80106255: e9 83 f1 ff ff jmp 801053dd +- +-8010625a : +-.globl vector243 +-vector243: +- pushl $0 ++80106250: 68 ee 00 00 00 push $0xee ++80106255: e9 b3 f1 ff ff jmp 8010540d ++ ++8010625a : + 8010625a: 6a 00 push $0x0 +- pushl $243 +-8010625c: 68 f3 00 00 00 push $0xf3 +- jmp alltraps +-80106261: e9 77 f1 ff ff jmp 801053dd +- +-80106266 : +-.globl vector244 +-vector244: +- pushl $0 ++8010625c: 68 ef 00 00 00 push $0xef ++80106261: e9 a7 f1 ff ff jmp 8010540d ++ ++80106266 : + 80106266: 6a 00 push $0x0 +- pushl $244 +-80106268: 68 f4 00 00 00 push $0xf4 +- jmp alltraps +-8010626d: e9 6b f1 ff ff jmp 801053dd +- +-80106272 : +-.globl vector245 +-vector245: +- pushl $0 ++80106268: 68 f0 00 00 00 push $0xf0 ++8010626d: e9 9b f1 ff ff jmp 8010540d ++ ++80106272 : + 80106272: 6a 00 push $0x0 +- pushl $245 +-80106274: 68 f5 00 00 00 push $0xf5 +- jmp alltraps +-80106279: e9 5f f1 ff ff jmp 801053dd +- +-8010627e : +-.globl vector246 +-vector246: +- pushl $0 ++80106274: 68 f1 00 00 00 push $0xf1 ++80106279: e9 8f f1 ff ff jmp 8010540d ++ ++8010627e : + 8010627e: 6a 00 push $0x0 +- pushl $246 +-80106280: 68 f6 00 00 00 push $0xf6 +- jmp alltraps +-80106285: e9 53 f1 ff ff jmp 801053dd +- +-8010628a : +-.globl vector247 +-vector247: +- pushl $0 ++80106280: 68 f2 00 00 00 push $0xf2 ++80106285: e9 83 f1 ff ff jmp 8010540d ++ ++8010628a : + 8010628a: 6a 00 push $0x0 +- pushl $247 +-8010628c: 68 f7 00 00 00 push $0xf7 +- jmp alltraps +-80106291: e9 47 f1 ff ff jmp 801053dd +- +-80106296 : +-.globl vector248 +-vector248: +- pushl $0 ++8010628c: 68 f3 00 00 00 push $0xf3 ++80106291: e9 77 f1 ff ff jmp 8010540d ++ ++80106296 : + 80106296: 6a 00 push $0x0 +- pushl $248 +-80106298: 68 f8 00 00 00 push $0xf8 +- jmp alltraps +-8010629d: e9 3b f1 ff ff jmp 801053dd +- +-801062a2 : +-.globl vector249 +-vector249: +- pushl $0 ++80106298: 68 f4 00 00 00 push $0xf4 ++8010629d: e9 6b f1 ff ff jmp 8010540d ++ ++801062a2 : + 801062a2: 6a 00 push $0x0 +- pushl $249 +-801062a4: 68 f9 00 00 00 push $0xf9 +- jmp alltraps +-801062a9: e9 2f f1 ff ff jmp 801053dd +- +-801062ae : +-.globl vector250 +-vector250: +- pushl $0 ++801062a4: 68 f5 00 00 00 push $0xf5 ++801062a9: e9 5f f1 ff ff jmp 8010540d ++ ++801062ae : + 801062ae: 6a 00 push $0x0 +- pushl $250 +-801062b0: 68 fa 00 00 00 push $0xfa +- jmp alltraps +-801062b5: e9 23 f1 ff ff jmp 801053dd +- +-801062ba : +-.globl vector251 +-vector251: +- pushl $0 ++801062b0: 68 f6 00 00 00 push $0xf6 ++801062b5: e9 53 f1 ff ff jmp 8010540d ++ ++801062ba : + 801062ba: 6a 00 push $0x0 +- pushl $251 +-801062bc: 68 fb 00 00 00 push $0xfb +- jmp alltraps +-801062c1: e9 17 f1 ff ff jmp 801053dd +- +-801062c6 : +-.globl vector252 +-vector252: +- pushl $0 ++801062bc: 68 f7 00 00 00 push $0xf7 ++801062c1: e9 47 f1 ff ff jmp 8010540d ++ ++801062c6 : + 801062c6: 6a 00 push $0x0 +- pushl $252 +-801062c8: 68 fc 00 00 00 push $0xfc +- jmp alltraps +-801062cd: e9 0b f1 ff ff jmp 801053dd +- +-801062d2 : +-.globl vector253 +-vector253: +- pushl $0 ++801062c8: 68 f8 00 00 00 push $0xf8 ++801062cd: e9 3b f1 ff ff jmp 8010540d ++ ++801062d2 : + 801062d2: 6a 00 push $0x0 +- pushl $253 +-801062d4: 68 fd 00 00 00 push $0xfd +- jmp alltraps +-801062d9: e9 ff f0 ff ff jmp 801053dd +- +-801062de : +-.globl vector254 +-vector254: +- pushl $0 ++801062d4: 68 f9 00 00 00 push $0xf9 ++801062d9: e9 2f f1 ff ff jmp 8010540d ++ ++801062de : + 801062de: 6a 00 push $0x0 +- pushl $254 +-801062e0: 68 fe 00 00 00 push $0xfe +- jmp alltraps +-801062e5: e9 f3 f0 ff ff jmp 801053dd +- +-801062ea : +-.globl vector255 +-vector255: +- pushl $0 ++801062e0: 68 fa 00 00 00 push $0xfa ++801062e5: e9 23 f1 ff ff jmp 8010540d ++ ++801062ea : + 801062ea: 6a 00 push $0x0 +- pushl $255 +-801062ec: 68 ff 00 00 00 push $0xff +- jmp alltraps +-801062f1: e9 e7 f0 ff ff jmp 801053dd +-801062f6: 66 90 xchg %ax,%ax +-801062f8: 66 90 xchg %ax,%ax +-801062fa: 66 90 xchg %ax,%ax +-801062fc: 66 90 xchg %ax,%ax +-801062fe: 66 90 xchg %ax,%ax +- +-80106300 : ++801062ec: 68 fb 00 00 00 push $0xfb ++801062f1: e9 17 f1 ff ff jmp 8010540d ++ ++801062f6 : ++801062f6: 6a 00 push $0x0 ++801062f8: 68 fc 00 00 00 push $0xfc ++801062fd: e9 0b f1 ff ff jmp 8010540d ++ ++80106302 : ++80106302: 6a 00 push $0x0 ++80106304: 68 fd 00 00 00 push $0xfd ++80106309: e9 ff f0 ff ff jmp 8010540d ++ ++8010630e : ++8010630e: 6a 00 push $0x0 ++80106310: 68 fe 00 00 00 push $0xfe ++80106315: e9 f3 f0 ff ff jmp 8010540d ++ ++8010631a : ++8010631a: 6a 00 push $0x0 ++8010631c: 68 ff 00 00 00 push $0xff ++80106321: e9 e7 f0 ff ff jmp 8010540d ++80106326: 66 90 xchg %ax,%ax ++80106328: 66 90 xchg %ax,%ax ++8010632a: 66 90 xchg %ax,%ax ++8010632c: 66 90 xchg %ax,%ax ++8010632e: 66 90 xchg %ax,%ax ++ ++80106330 : + // 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) + { +-80106300: 55 push %ebp +-80106301: 89 e5 mov %esp,%ebp +-80106303: 57 push %edi +-80106304: 56 push %esi +-80106305: 89 d6 mov %edx,%esi ++80106330: 55 push %ebp ++80106331: 89 e5 mov %esp,%ebp ++80106333: 57 push %edi ++80106334: 56 push %esi ++80106335: 89 d6 mov %edx,%esi + pde_t *pde; + pte_t *pgtab; + + pde = &pgdir[PDX(va)]; +-80106307: c1 ea 16 shr $0x16,%edx ++80106337: c1 ea 16 shr $0x16,%edx + { +-8010630a: 53 push %ebx ++8010633a: 53 push %ebx + pde = &pgdir[PDX(va)]; +-8010630b: 8d 3c 90 lea (%eax,%edx,4),%edi ++8010633b: 8d 3c 90 lea (%eax,%edx,4),%edi + { +-8010630e: 83 ec 1c sub $0x1c,%esp ++8010633e: 83 ec 1c sub $0x1c,%esp + if(*pde & PTE_P){ +-80106311: 8b 1f mov (%edi),%ebx +-80106313: f6 c3 01 test $0x1,%bl +-80106316: 74 28 je 80106340 ++80106341: 8b 1f mov (%edi),%ebx ++80106343: f6 c3 01 test $0x1,%bl ++80106346: 74 28 je 80106370 + pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); +-80106318: 81 e3 00 f0 ff ff and $0xfffff000,%ebx +-8010631e: 81 c3 00 00 00 80 add $0x80000000,%ebx ++80106348: 81 e3 00 f0 ff ff and $0xfffff000,%ebx ++8010634e: 81 c3 00 00 00 80 add $0x80000000,%ebx + // The permissions here are overly generous, but they can + // be further restricted by the permissions in the page table + // entries, if necessary. + *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; + } + return &pgtab[PTX(va)]; +-80106324: c1 ee 0a shr $0xa,%esi ++80106354: c1 ee 0a shr $0xa,%esi + } +-80106327: 83 c4 1c add $0x1c,%esp ++80106357: 83 c4 1c add $0x1c,%esp + return &pgtab[PTX(va)]; +-8010632a: 89 f2 mov %esi,%edx +-8010632c: 81 e2 fc 0f 00 00 and $0xffc,%edx +-80106332: 8d 04 13 lea (%ebx,%edx,1),%eax +-} +-80106335: 5b pop %ebx +-80106336: 5e pop %esi +-80106337: 5f pop %edi +-80106338: 5d pop %ebp +-80106339: c3 ret +-8010633a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++8010635a: 89 f2 mov %esi,%edx ++8010635c: 81 e2 fc 0f 00 00 and $0xffc,%edx ++80106362: 8d 04 13 lea (%ebx,%edx,1),%eax ++} ++80106365: 5b pop %ebx ++80106366: 5e pop %esi ++80106367: 5f pop %edi ++80106368: 5d pop %ebp ++80106369: c3 ret ++8010636a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) +-80106340: 85 c9 test %ecx,%ecx +-80106342: 74 34 je 80106378 +-80106344: e8 57 c1 ff ff call 801024a0 +-80106349: 85 c0 test %eax,%eax +-8010634b: 89 c3 mov %eax,%ebx +-8010634d: 74 29 je 80106378 ++80106370: 85 c9 test %ecx,%ecx ++80106372: 74 34 je 801063a8 ++80106374: e8 27 c1 ff ff call 801024a0 ++80106379: 85 c0 test %eax,%eax ++8010637b: 89 c3 mov %eax,%ebx ++8010637d: 74 29 je 801063a8 + memset(pgtab, 0, PGSIZE); +-8010634f: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +-80106356: 00 +-80106357: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +-8010635e: 00 +-8010635f: 89 04 24 mov %eax,(%esp) +-80106362: e8 39 df ff ff call 801042a0 ++8010637f: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) ++80106386: 00 ++80106387: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++8010638e: 00 ++8010638f: 89 04 24 mov %eax,(%esp) ++80106392: e8 09 df ff ff call 801042a0 + *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; +-80106367: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +-8010636d: 83 c8 07 or $0x7,%eax +-80106370: 89 07 mov %eax,(%edi) +-80106372: eb b0 jmp 80106324 +-80106374: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++80106397: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax ++8010639d: 83 c8 07 or $0x7,%eax ++801063a0: 89 07 mov %eax,(%edi) ++801063a2: eb b0 jmp 80106354 ++801063a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } +-80106378: 83 c4 1c add $0x1c,%esp ++801063a8: 83 c4 1c add $0x1c,%esp + return 0; +-8010637b: 31 c0 xor %eax,%eax ++801063ab: 31 c0 xor %eax,%eax + } +-8010637d: 5b pop %ebx +-8010637e: 5e pop %esi +-8010637f: 5f pop %edi +-80106380: 5d pop %ebp +-80106381: c3 ret +-80106382: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +-80106389: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++801063ad: 5b pop %ebx ++801063ae: 5e pop %esi ++801063af: 5f pop %edi ++801063b0: 5d pop %ebp ++801063b1: c3 ret ++801063b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++801063b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-80106390 : ++801063c0 : + // 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) + { +-80106390: 55 push %ebp +-80106391: 89 e5 mov %esp,%ebp +-80106393: 57 push %edi +-80106394: 56 push %esi +-80106395: 53 push %ebx ++801063c0: 55 push %ebp ++801063c1: 89 e5 mov %esp,%ebp ++801063c3: 57 push %edi ++801063c4: 56 push %esi ++801063c5: 53 push %ebx + char *a, *last; + pte_t *pte; + + a = (char*)PGROUNDDOWN((uint)va); +-80106396: 89 d3 mov %edx,%ebx ++801063c6: 89 d3 mov %edx,%ebx + { +-80106398: 83 ec 1c sub $0x1c,%esp +-8010639b: 8b 7d 08 mov 0x8(%ebp),%edi ++801063c8: 83 ec 1c sub $0x1c,%esp ++801063cb: 8b 7d 08 mov 0x8(%ebp),%edi + a = (char*)PGROUNDDOWN((uint)va); +-8010639e: 81 e3 00 f0 ff ff and $0xfffff000,%ebx ++801063ce: 81 e3 00 f0 ff ff and $0xfffff000,%ebx + { +-801063a4: 89 45 e0 mov %eax,-0x20(%ebp) ++801063d4: 89 45 e0 mov %eax,-0x20(%ebp) + last = (char*)PGROUNDDOWN(((uint)va) + size - 1); +-801063a7: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax +-801063ab: 89 45 e4 mov %eax,-0x1c(%ebp) ++801063d7: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax ++801063db: 89 45 e4 mov %eax,-0x1c(%ebp) + for(;;){ + if((pte = walkpgdir(pgdir, a, 1)) == 0) + return -1; + if(*pte & PTE_P) + panic("remap"); + *pte = pa | perm | PTE_P; +-801063ae: 83 4d 0c 01 orl $0x1,0xc(%ebp) ++801063de: 83 4d 0c 01 orl $0x1,0xc(%ebp) + last = (char*)PGROUNDDOWN(((uint)va) + size - 1); +-801063b2: 81 65 e4 00 f0 ff ff andl $0xfffff000,-0x1c(%ebp) +-801063b9: 29 df sub %ebx,%edi +-801063bb: eb 18 jmp 801063d5 +-801063bd: 8d 76 00 lea 0x0(%esi),%esi ++801063e2: 81 65 e4 00 f0 ff ff andl $0xfffff000,-0x1c(%ebp) ++801063e9: 29 df sub %ebx,%edi ++801063eb: eb 18 jmp 80106405 ++801063ed: 8d 76 00 lea 0x0(%esi),%esi + if(*pte & PTE_P) +-801063c0: f6 00 01 testb $0x1,(%eax) +-801063c3: 75 3d jne 80106402 ++801063f0: f6 00 01 testb $0x1,(%eax) ++801063f3: 75 3d jne 80106432 + *pte = pa | perm | PTE_P; +-801063c5: 0b 75 0c or 0xc(%ebp),%esi ++801063f5: 0b 75 0c or 0xc(%ebp),%esi + if(a == last) +-801063c8: 3b 5d e4 cmp -0x1c(%ebp),%ebx ++801063f8: 3b 5d e4 cmp -0x1c(%ebp),%ebx + *pte = pa | perm | PTE_P; +-801063cb: 89 30 mov %esi,(%eax) ++801063fb: 89 30 mov %esi,(%eax) + if(a == last) +-801063cd: 74 29 je 801063f8 ++801063fd: 74 29 je 80106428 + break; + a += PGSIZE; +-801063cf: 81 c3 00 10 00 00 add $0x1000,%ebx ++801063ff: 81 c3 00 10 00 00 add $0x1000,%ebx + if((pte = walkpgdir(pgdir, a, 1)) == 0) +-801063d5: 8b 45 e0 mov -0x20(%ebp),%eax +-801063d8: b9 01 00 00 00 mov $0x1,%ecx +-801063dd: 89 da mov %ebx,%edx +-801063df: 8d 34 3b lea (%ebx,%edi,1),%esi +-801063e2: e8 19 ff ff ff call 80106300 +-801063e7: 85 c0 test %eax,%eax +-801063e9: 75 d5 jne 801063c0 ++80106405: 8b 45 e0 mov -0x20(%ebp),%eax ++80106408: b9 01 00 00 00 mov $0x1,%ecx ++8010640d: 89 da mov %ebx,%edx ++8010640f: 8d 34 3b lea (%ebx,%edi,1),%esi ++80106412: e8 19 ff ff ff call 80106330 ++80106417: 85 c0 test %eax,%eax ++80106419: 75 d5 jne 801063f0 + pa += PGSIZE; + } + return 0; + } +-801063eb: 83 c4 1c add $0x1c,%esp ++8010641b: 83 c4 1c add $0x1c,%esp + return -1; +-801063ee: b8 ff ff ff ff mov $0xffffffff,%eax +-} +-801063f3: 5b pop %ebx +-801063f4: 5e pop %esi +-801063f5: 5f pop %edi +-801063f6: 5d pop %ebp +-801063f7: c3 ret +-801063f8: 83 c4 1c add $0x1c,%esp ++8010641e: b8 ff ff ff ff mov $0xffffffff,%eax ++} ++80106423: 5b pop %ebx ++80106424: 5e pop %esi ++80106425: 5f pop %edi ++80106426: 5d pop %ebp ++80106427: c3 ret ++80106428: 83 c4 1c add $0x1c,%esp + return 0; +-801063fb: 31 c0 xor %eax,%eax ++8010642b: 31 c0 xor %eax,%eax + } +-801063fd: 5b pop %ebx +-801063fe: 5e pop %esi +-801063ff: 5f pop %edi +-80106400: 5d pop %ebp +-80106401: c3 ret ++8010642d: 5b pop %ebx ++8010642e: 5e pop %esi ++8010642f: 5f pop %edi ++80106430: 5d pop %ebp ++80106431: c3 ret + panic("remap"); +-80106402: c7 04 24 e8 74 10 80 movl $0x801074e8,(%esp) +-80106409: e8 52 9f ff ff call 80100360 +-8010640e: 66 90 xchg %ax,%ax ++80106432: c7 04 24 08 75 10 80 movl $0x80107508,(%esp) ++80106439: e8 22 9f ff ff call 80100360 ++8010643e: 66 90 xchg %ax,%ax + +-80106410 : ++80106440 : + // Deallocate user pages to bring the process size from oldsz to + // newsz. oldsz and newsz need not be page-aligned, nor does newsz + // need to be less than oldsz. oldsz can be larger than the actual + // process size. Returns the new process size. + int + deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) +-80106410: 55 push %ebp +-80106411: 89 e5 mov %esp,%ebp +-80106413: 57 push %edi +-80106414: 89 c7 mov %eax,%edi +-80106416: 56 push %esi +-80106417: 89 d6 mov %edx,%esi +-80106419: 53 push %ebx ++80106440: 55 push %ebp ++80106441: 89 e5 mov %esp,%ebp ++80106443: 57 push %edi ++80106444: 89 c7 mov %eax,%edi ++80106446: 56 push %esi ++80106447: 89 d6 mov %edx,%esi ++80106449: 53 push %ebx + uint a, pa; + + if(newsz >= oldsz) + return oldsz; + + a = PGROUNDUP(newsz); +-8010641a: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx ++8010644a: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx + deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) +-80106420: 83 ec 1c sub $0x1c,%esp ++80106450: 83 ec 1c sub $0x1c,%esp + a = PGROUNDUP(newsz); +-80106423: 81 e3 00 f0 ff ff and $0xfffff000,%ebx ++80106453: 81 e3 00 f0 ff ff and $0xfffff000,%ebx + for(; a < oldsz; a += PGSIZE){ +-80106429: 39 d3 cmp %edx,%ebx ++80106459: 39 d3 cmp %edx,%ebx + deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) +-8010642b: 89 4d e0 mov %ecx,-0x20(%ebp) ++8010645b: 89 4d e0 mov %ecx,-0x20(%ebp) + for(; a < oldsz; a += PGSIZE){ +-8010642e: 72 3b jb 8010646b +-80106430: eb 5e jmp 80106490 +-80106432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++8010645e: 72 3b jb 8010649b ++80106460: eb 5e jmp 801064c0 ++80106462: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + pte = walkpgdir(pgdir, (char*)a, 0); + if(!pte) + a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; + else if((*pte & PTE_P) != 0){ +-80106438: 8b 10 mov (%eax),%edx +-8010643a: f6 c2 01 test $0x1,%dl +-8010643d: 74 22 je 80106461 ++80106468: 8b 10 mov (%eax),%edx ++8010646a: f6 c2 01 test $0x1,%dl ++8010646d: 74 22 je 80106491 + pa = PTE_ADDR(*pte); + if(pa == 0) +-8010643f: 81 e2 00 f0 ff ff and $0xfffff000,%edx +-80106445: 74 54 je 8010649b ++8010646f: 81 e2 00 f0 ff ff and $0xfffff000,%edx ++80106475: 74 54 je 801064cb + panic("kfree"); + char *v = P2V(pa); +-80106447: 81 c2 00 00 00 80 add $0x80000000,%edx ++80106477: 81 c2 00 00 00 80 add $0x80000000,%edx + kfree(v); +-8010644d: 89 14 24 mov %edx,(%esp) +-80106450: 89 45 e4 mov %eax,-0x1c(%ebp) +-80106453: e8 98 be ff ff call 801022f0 ++8010647d: 89 14 24 mov %edx,(%esp) ++80106480: 89 45 e4 mov %eax,-0x1c(%ebp) ++80106483: e8 68 be ff ff call 801022f0 + *pte = 0; +-80106458: 8b 45 e4 mov -0x1c(%ebp),%eax +-8010645b: c7 00 00 00 00 00 movl $0x0,(%eax) ++80106488: 8b 45 e4 mov -0x1c(%ebp),%eax ++8010648b: c7 00 00 00 00 00 movl $0x0,(%eax) + for(; a < oldsz; a += PGSIZE){ +-80106461: 81 c3 00 10 00 00 add $0x1000,%ebx +-80106467: 39 f3 cmp %esi,%ebx +-80106469: 73 25 jae 80106490 ++80106491: 81 c3 00 10 00 00 add $0x1000,%ebx ++80106497: 39 f3 cmp %esi,%ebx ++80106499: 73 25 jae 801064c0 + pte = walkpgdir(pgdir, (char*)a, 0); +-8010646b: 31 c9 xor %ecx,%ecx +-8010646d: 89 da mov %ebx,%edx +-8010646f: 89 f8 mov %edi,%eax +-80106471: e8 8a fe ff ff call 80106300 ++8010649b: 31 c9 xor %ecx,%ecx ++8010649d: 89 da mov %ebx,%edx ++8010649f: 89 f8 mov %edi,%eax ++801064a1: e8 8a fe ff ff call 80106330 + if(!pte) +-80106476: 85 c0 test %eax,%eax +-80106478: 75 be jne 80106438 ++801064a6: 85 c0 test %eax,%eax ++801064a8: 75 be jne 80106468 + a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; +-8010647a: 81 e3 00 00 c0 ff and $0xffc00000,%ebx +-80106480: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx ++801064aa: 81 e3 00 00 c0 ff and $0xffc00000,%ebx ++801064b0: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx + for(; a < oldsz; a += PGSIZE){ +-80106486: 81 c3 00 10 00 00 add $0x1000,%ebx +-8010648c: 39 f3 cmp %esi,%ebx +-8010648e: 72 db jb 8010646b ++801064b6: 81 c3 00 10 00 00 add $0x1000,%ebx ++801064bc: 39 f3 cmp %esi,%ebx ++801064be: 72 db jb 8010649b + } + } + return newsz; + } +-80106490: 8b 45 e0 mov -0x20(%ebp),%eax +-80106493: 83 c4 1c add $0x1c,%esp +-80106496: 5b pop %ebx +-80106497: 5e pop %esi +-80106498: 5f pop %edi +-80106499: 5d pop %ebp +-8010649a: c3 ret ++801064c0: 8b 45 e0 mov -0x20(%ebp),%eax ++801064c3: 83 c4 1c add $0x1c,%esp ++801064c6: 5b pop %ebx ++801064c7: 5e pop %esi ++801064c8: 5f pop %edi ++801064c9: 5d pop %ebp ++801064ca: c3 ret + panic("kfree"); +-8010649b: c7 04 24 86 6e 10 80 movl $0x80106e86,(%esp) +-801064a2: e8 b9 9e ff ff call 80100360 +-801064a7: 89 f6 mov %esi,%esi +-801064a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++801064cb: c7 04 24 a6 6e 10 80 movl $0x80106ea6,(%esp) ++801064d2: e8 89 9e ff ff call 80100360 ++801064d7: 89 f6 mov %esi,%esi ++801064d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-801064b0 : ++801064e0 : + { +-801064b0: 55 push %ebp +-801064b1: 89 e5 mov %esp,%ebp +-801064b3: 83 ec 18 sub $0x18,%esp ++801064e0: 55 push %ebp ++801064e1: 89 e5 mov %esp,%ebp ++801064e3: 83 ec 18 sub $0x18,%esp + c = &cpus[cpuid()]; +-801064b6: e8 c5 d1 ff ff call 80103680 ++801064e6: e8 95 d1 ff ff call 80103680 + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +-801064bb: 31 c9 xor %ecx,%ecx +-801064bd: ba ff ff ff ff mov $0xffffffff,%edx ++801064eb: 31 c9 xor %ecx,%ecx ++801064ed: ba ff ff ff ff mov $0xffffffff,%edx + c = &cpus[cpuid()]; +-801064c2: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax +-801064c8: 05 80 27 11 80 add $0x80112780,%eax ++801064f2: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax ++801064f8: 05 80 27 11 80 add $0x80112780,%eax + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +-801064cd: 66 89 50 78 mov %dx,0x78(%eax) ++801064fd: 66 89 50 78 mov %dx,0x78(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +-801064d1: ba ff ff ff ff mov $0xffffffff,%edx ++80106501: ba ff ff ff ff mov $0xffffffff,%edx + lgdt(c->gdt, sizeof(c->gdt)); +-801064d6: 83 c0 70 add $0x70,%eax ++80106506: 83 c0 70 add $0x70,%eax + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +-801064d9: 66 89 48 0a mov %cx,0xa(%eax) ++80106509: 66 89 48 0a mov %cx,0xa(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +-801064dd: 31 c9 xor %ecx,%ecx +-801064df: 66 89 50 10 mov %dx,0x10(%eax) ++8010650d: 31 c9 xor %ecx,%ecx ++8010650f: 66 89 50 10 mov %dx,0x10(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +-801064e3: ba ff ff ff ff mov $0xffffffff,%edx ++80106513: ba ff ff ff ff mov $0xffffffff,%edx + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +-801064e8: 66 89 48 12 mov %cx,0x12(%eax) ++80106518: 66 89 48 12 mov %cx,0x12(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +-801064ec: 31 c9 xor %ecx,%ecx +-801064ee: 66 89 50 18 mov %dx,0x18(%eax) ++8010651c: 31 c9 xor %ecx,%ecx ++8010651e: 66 89 50 18 mov %dx,0x18(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +-801064f2: ba ff ff ff ff mov $0xffffffff,%edx ++80106522: ba ff ff ff ff mov $0xffffffff,%edx + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +-801064f7: 66 89 48 1a mov %cx,0x1a(%eax) ++80106527: 66 89 48 1a mov %cx,0x1a(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +-801064fb: 31 c9 xor %ecx,%ecx ++8010652b: 31 c9 xor %ecx,%ecx + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +-801064fd: c6 40 0d 9a movb $0x9a,0xd(%eax) +-80106501: c6 40 0e cf movb $0xcf,0xe(%eax) ++8010652d: c6 40 0d 9a movb $0x9a,0xd(%eax) ++80106531: c6 40 0e cf movb $0xcf,0xe(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +-80106505: c6 40 15 92 movb $0x92,0x15(%eax) +-80106509: c6 40 16 cf movb $0xcf,0x16(%eax) ++80106535: c6 40 15 92 movb $0x92,0x15(%eax) ++80106539: c6 40 16 cf movb $0xcf,0x16(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +-8010650d: c6 40 1d fa movb $0xfa,0x1d(%eax) +-80106511: c6 40 1e cf movb $0xcf,0x1e(%eax) ++8010653d: c6 40 1d fa movb $0xfa,0x1d(%eax) ++80106541: c6 40 1e cf movb $0xcf,0x1e(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +-80106515: c6 40 25 f2 movb $0xf2,0x25(%eax) +-80106519: c6 40 26 cf movb $0xcf,0x26(%eax) +-8010651d: 66 89 50 20 mov %dx,0x20(%eax) ++80106545: c6 40 25 f2 movb $0xf2,0x25(%eax) ++80106549: c6 40 26 cf movb $0xcf,0x26(%eax) ++8010654d: 66 89 50 20 mov %dx,0x20(%eax) + pd[0] = size-1; +-80106521: ba 2f 00 00 00 mov $0x2f,%edx ++80106551: ba 2f 00 00 00 mov $0x2f,%edx + c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); +-80106526: c6 40 0c 00 movb $0x0,0xc(%eax) +-8010652a: c6 40 0f 00 movb $0x0,0xf(%eax) ++80106556: c6 40 0c 00 movb $0x0,0xc(%eax) ++8010655a: c6 40 0f 00 movb $0x0,0xf(%eax) + c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); +-8010652e: c6 40 14 00 movb $0x0,0x14(%eax) +-80106532: c6 40 17 00 movb $0x0,0x17(%eax) ++8010655e: c6 40 14 00 movb $0x0,0x14(%eax) ++80106562: c6 40 17 00 movb $0x0,0x17(%eax) + c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); +-80106536: c6 40 1c 00 movb $0x0,0x1c(%eax) +-8010653a: c6 40 1f 00 movb $0x0,0x1f(%eax) ++80106566: c6 40 1c 00 movb $0x0,0x1c(%eax) ++8010656a: c6 40 1f 00 movb $0x0,0x1f(%eax) + c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); +-8010653e: 66 89 48 22 mov %cx,0x22(%eax) +-80106542: c6 40 24 00 movb $0x0,0x24(%eax) +-80106546: c6 40 27 00 movb $0x0,0x27(%eax) +-8010654a: 66 89 55 f2 mov %dx,-0xe(%ebp) ++8010656e: 66 89 48 22 mov %cx,0x22(%eax) ++80106572: c6 40 24 00 movb $0x0,0x24(%eax) ++80106576: c6 40 27 00 movb $0x0,0x27(%eax) ++8010657a: 66 89 55 f2 mov %dx,-0xe(%ebp) + pd[1] = (uint)p; +-8010654e: 66 89 45 f4 mov %ax,-0xc(%ebp) ++8010657e: 66 89 45 f4 mov %ax,-0xc(%ebp) + pd[2] = (uint)p >> 16; +-80106552: c1 e8 10 shr $0x10,%eax +-80106555: 66 89 45 f6 mov %ax,-0xa(%ebp) ++80106582: c1 e8 10 shr $0x10,%eax ++80106585: 66 89 45 f6 mov %ax,-0xa(%ebp) + asm volatile("lgdt (%0)" : : "r" (pd)); +-80106559: 8d 45 f2 lea -0xe(%ebp),%eax +-8010655c: 0f 01 10 lgdtl (%eax) +-} +-8010655f: c9 leave +-80106560: c3 ret +-80106561: eb 0d jmp 80106570 +-80106563: 90 nop +-80106564: 90 nop +-80106565: 90 nop +-80106566: 90 nop +-80106567: 90 nop +-80106568: 90 nop +-80106569: 90 nop +-8010656a: 90 nop +-8010656b: 90 nop +-8010656c: 90 nop +-8010656d: 90 nop +-8010656e: 90 nop +-8010656f: 90 nop +- +-80106570 : ++80106589: 8d 45 f2 lea -0xe(%ebp),%eax ++8010658c: 0f 01 10 lgdtl (%eax) ++} ++8010658f: c9 leave ++80106590: c3 ret ++80106591: eb 0d jmp 801065a0 ++80106593: 90 nop ++80106594: 90 nop ++80106595: 90 nop ++80106596: 90 nop ++80106597: 90 nop ++80106598: 90 nop ++80106599: 90 nop ++8010659a: 90 nop ++8010659b: 90 nop ++8010659c: 90 nop ++8010659d: 90 nop ++8010659e: 90 nop ++8010659f: 90 nop ++ ++801065a0 : + lcr3(V2P(kpgdir)); // switch to the kernel page table +-80106570: a1 a4 55 11 80 mov 0x801155a4,%eax ++801065a0: a1 a4 55 11 80 mov 0x801155a4,%eax + { +-80106575: 55 push %ebp +-80106576: 89 e5 mov %esp,%ebp ++801065a5: 55 push %ebp ++801065a6: 89 e5 mov %esp,%ebp + lcr3(V2P(kpgdir)); // switch to the kernel page table +-80106578: 05 00 00 00 80 add $0x80000000,%eax ++801065a8: 05 00 00 00 80 add $0x80000000,%eax + } + + static inline void + lcr3(uint val) + { + asm volatile("movl %0,%%cr3" : : "r" (val)); +-8010657d: 0f 22 d8 mov %eax,%cr3 +-} +-80106580: 5d pop %ebp +-80106581: c3 ret +-80106582: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +-80106589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +- +-80106590 : +-{ +-80106590: 55 push %ebp +-80106591: 89 e5 mov %esp,%ebp +-80106593: 57 push %edi +-80106594: 56 push %esi +-80106595: 53 push %ebx +-80106596: 83 ec 1c sub $0x1c,%esp +-80106599: 8b 75 08 mov 0x8(%ebp),%esi ++801065ad: 0f 22 d8 mov %eax,%cr3 ++} ++801065b0: 5d pop %ebp ++801065b1: c3 ret ++801065b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++801065b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ ++801065c0 : ++{ ++801065c0: 55 push %ebp ++801065c1: 89 e5 mov %esp,%ebp ++801065c3: 57 push %edi ++801065c4: 56 push %esi ++801065c5: 53 push %ebx ++801065c6: 83 ec 1c sub $0x1c,%esp ++801065c9: 8b 75 08 mov 0x8(%ebp),%esi + if(p == 0) +-8010659c: 85 f6 test %esi,%esi +-8010659e: 0f 84 cd 00 00 00 je 80106671 ++801065cc: 85 f6 test %esi,%esi ++801065ce: 0f 84 cd 00 00 00 je 801066a1 + if(p->kstack == 0) +-801065a4: 8b 46 08 mov 0x8(%esi),%eax +-801065a7: 85 c0 test %eax,%eax +-801065a9: 0f 84 da 00 00 00 je 80106689 ++801065d4: 8b 46 08 mov 0x8(%esi),%eax ++801065d7: 85 c0 test %eax,%eax ++801065d9: 0f 84 da 00 00 00 je 801066b9 + if(p->pgdir == 0) +-801065af: 8b 7e 04 mov 0x4(%esi),%edi +-801065b2: 85 ff test %edi,%edi +-801065b4: 0f 84 c3 00 00 00 je 8010667d ++801065df: 8b 7e 04 mov 0x4(%esi),%edi ++801065e2: 85 ff test %edi,%edi ++801065e4: 0f 84 c3 00 00 00 je 801066ad + pushcli(); +-801065ba: e8 31 db ff ff call 801040f0 ++801065ea: e8 01 db ff ff call 801040f0 + mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, +-801065bf: e8 3c d0 ff ff call 80103600 +-801065c4: 89 c3 mov %eax,%ebx +-801065c6: e8 35 d0 ff ff call 80103600 +-801065cb: 89 c7 mov %eax,%edi +-801065cd: e8 2e d0 ff ff call 80103600 +-801065d2: 83 c7 08 add $0x8,%edi +-801065d5: 89 45 e4 mov %eax,-0x1c(%ebp) +-801065d8: e8 23 d0 ff ff call 80103600 +-801065dd: 8b 4d e4 mov -0x1c(%ebp),%ecx +-801065e0: ba 67 00 00 00 mov $0x67,%edx +-801065e5: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) +-801065ec: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) +-801065f3: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) +-801065fa: 83 c1 08 add $0x8,%ecx +-801065fd: c1 e9 10 shr $0x10,%ecx +-80106600: 83 c0 08 add $0x8,%eax +-80106603: c1 e8 18 shr $0x18,%eax +-80106606: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) +-8010660c: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) +-80106613: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) ++801065ef: e8 0c d0 ff ff call 80103600 ++801065f4: 89 c3 mov %eax,%ebx ++801065f6: e8 05 d0 ff ff call 80103600 ++801065fb: 89 c7 mov %eax,%edi ++801065fd: e8 fe cf ff ff call 80103600 ++80106602: 83 c7 08 add $0x8,%edi ++80106605: 89 45 e4 mov %eax,-0x1c(%ebp) ++80106608: e8 f3 cf ff ff call 80103600 ++8010660d: 8b 4d e4 mov -0x1c(%ebp),%ecx ++80106610: ba 67 00 00 00 mov $0x67,%edx ++80106615: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) ++8010661c: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) ++80106623: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) ++8010662a: 83 c1 08 add $0x8,%ecx ++8010662d: c1 e9 10 shr $0x10,%ecx ++80106630: 83 c0 08 add $0x8,%eax ++80106633: c1 e8 18 shr $0x18,%eax ++80106636: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) ++8010663c: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) ++80106643: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) + mycpu()->ts.iomb = (ushort) 0xFFFF; +-80106619: bb ff ff ff ff mov $0xffffffff,%ebx ++80106649: bb ff ff ff ff mov $0xffffffff,%ebx + mycpu()->gdt[SEG_TSS].s = 0; +-8010661e: e8 dd cf ff ff call 80103600 +-80106623: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) ++8010664e: e8 ad cf ff ff call 80103600 ++80106653: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) + mycpu()->ts.ss0 = SEG_KDATA << 3; +-8010662a: e8 d1 cf ff ff call 80103600 +-8010662f: b9 10 00 00 00 mov $0x10,%ecx +-80106634: 66 89 48 10 mov %cx,0x10(%eax) ++8010665a: e8 a1 cf ff ff call 80103600 ++8010665f: b9 10 00 00 00 mov $0x10,%ecx ++80106664: 66 89 48 10 mov %cx,0x10(%eax) + mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; +-80106638: e8 c3 cf ff ff call 80103600 +-8010663d: 8b 56 08 mov 0x8(%esi),%edx +-80106640: 8d 8a 00 10 00 00 lea 0x1000(%edx),%ecx +-80106646: 89 48 0c mov %ecx,0xc(%eax) ++80106668: e8 93 cf ff ff call 80103600 ++8010666d: 8b 56 08 mov 0x8(%esi),%edx ++80106670: 8d 8a 00 10 00 00 lea 0x1000(%edx),%ecx ++80106676: 89 48 0c mov %ecx,0xc(%eax) + mycpu()->ts.iomb = (ushort) 0xFFFF; +-80106649: e8 b2 cf ff ff call 80103600 +-8010664e: 66 89 58 6e mov %bx,0x6e(%eax) ++80106679: e8 82 cf ff ff call 80103600 ++8010667e: 66 89 58 6e mov %bx,0x6e(%eax) + asm volatile("ltr %0" : : "r" (sel)); +-80106652: b8 28 00 00 00 mov $0x28,%eax +-80106657: 0f 00 d8 ltr %ax ++80106682: b8 28 00 00 00 mov $0x28,%eax ++80106687: 0f 00 d8 ltr %ax + lcr3(V2P(p->pgdir)); // switch to process's address space +-8010665a: 8b 46 04 mov 0x4(%esi),%eax +-8010665d: 05 00 00 00 80 add $0x80000000,%eax ++8010668a: 8b 46 04 mov 0x4(%esi),%eax ++8010668d: 05 00 00 00 80 add $0x80000000,%eax + asm volatile("movl %0,%%cr3" : : "r" (val)); +-80106662: 0f 22 d8 mov %eax,%cr3 ++80106692: 0f 22 d8 mov %eax,%cr3 + } +-80106665: 83 c4 1c add $0x1c,%esp +-80106668: 5b pop %ebx +-80106669: 5e pop %esi +-8010666a: 5f pop %edi +-8010666b: 5d pop %ebp ++80106695: 83 c4 1c add $0x1c,%esp ++80106698: 5b pop %ebx ++80106699: 5e pop %esi ++8010669a: 5f pop %edi ++8010669b: 5d pop %ebp + popcli(); +-8010666c: e9 bf da ff ff jmp 80104130 ++8010669c: e9 8f da ff ff jmp 80104130 + panic("switchuvm: no process"); +-80106671: c7 04 24 ee 74 10 80 movl $0x801074ee,(%esp) +-80106678: e8 e3 9c ff ff call 80100360 ++801066a1: c7 04 24 0e 75 10 80 movl $0x8010750e,(%esp) ++801066a8: e8 b3 9c ff ff call 80100360 + panic("switchuvm: no pgdir"); +-8010667d: c7 04 24 19 75 10 80 movl $0x80107519,(%esp) +-80106684: e8 d7 9c ff ff call 80100360 ++801066ad: c7 04 24 39 75 10 80 movl $0x80107539,(%esp) ++801066b4: e8 a7 9c ff ff call 80100360 + panic("switchuvm: no kstack"); +-80106689: c7 04 24 04 75 10 80 movl $0x80107504,(%esp) +-80106690: e8 cb 9c ff ff call 80100360 +-80106695: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +-80106699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +- +-801066a0 : +-{ +-801066a0: 55 push %ebp +-801066a1: 89 e5 mov %esp,%ebp +-801066a3: 57 push %edi +-801066a4: 56 push %esi +-801066a5: 53 push %ebx +-801066a6: 83 ec 1c sub $0x1c,%esp +-801066a9: 8b 75 10 mov 0x10(%ebp),%esi +-801066ac: 8b 45 08 mov 0x8(%ebp),%eax +-801066af: 8b 7d 0c mov 0xc(%ebp),%edi ++801066b9: c7 04 24 24 75 10 80 movl $0x80107524,(%esp) ++801066c0: e8 9b 9c ff ff call 80100360 ++801066c5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++801066c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ ++801066d0 : ++{ ++801066d0: 55 push %ebp ++801066d1: 89 e5 mov %esp,%ebp ++801066d3: 57 push %edi ++801066d4: 56 push %esi ++801066d5: 53 push %ebx ++801066d6: 83 ec 1c sub $0x1c,%esp ++801066d9: 8b 75 10 mov 0x10(%ebp),%esi ++801066dc: 8b 45 08 mov 0x8(%ebp),%eax ++801066df: 8b 7d 0c mov 0xc(%ebp),%edi + if(sz >= PGSIZE) +-801066b2: 81 fe ff 0f 00 00 cmp $0xfff,%esi ++801066e2: 81 fe ff 0f 00 00 cmp $0xfff,%esi + { +-801066b8: 89 45 e4 mov %eax,-0x1c(%ebp) ++801066e8: 89 45 e4 mov %eax,-0x1c(%ebp) + if(sz >= PGSIZE) +-801066bb: 77 54 ja 80106711 ++801066eb: 77 54 ja 80106741 + mem = kalloc(); +-801066bd: e8 de bd ff ff call 801024a0 ++801066ed: e8 ae bd ff ff call 801024a0 + memset(mem, 0, PGSIZE); +-801066c2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +-801066c9: 00 +-801066ca: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +-801066d1: 00 ++801066f2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) ++801066f9: 00 ++801066fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++80106701: 00 + mem = kalloc(); +-801066d2: 89 c3 mov %eax,%ebx ++80106702: 89 c3 mov %eax,%ebx + memset(mem, 0, PGSIZE); +-801066d4: 89 04 24 mov %eax,(%esp) +-801066d7: e8 c4 db ff ff call 801042a0 ++80106704: 89 04 24 mov %eax,(%esp) ++80106707: e8 94 db ff ff call 801042a0 + mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); +-801066dc: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +-801066e2: b9 00 10 00 00 mov $0x1000,%ecx +-801066e7: 89 04 24 mov %eax,(%esp) +-801066ea: 8b 45 e4 mov -0x1c(%ebp),%eax +-801066ed: 31 d2 xor %edx,%edx +-801066ef: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) +-801066f6: 00 +-801066f7: e8 94 fc ff ff call 80106390 ++8010670c: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax ++80106712: b9 00 10 00 00 mov $0x1000,%ecx ++80106717: 89 04 24 mov %eax,(%esp) ++8010671a: 8b 45 e4 mov -0x1c(%ebp),%eax ++8010671d: 31 d2 xor %edx,%edx ++8010671f: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) ++80106726: 00 ++80106727: e8 94 fc ff ff call 801063c0 + memmove(mem, init, sz); +-801066fc: 89 75 10 mov %esi,0x10(%ebp) +-801066ff: 89 7d 0c mov %edi,0xc(%ebp) +-80106702: 89 5d 08 mov %ebx,0x8(%ebp) +-} +-80106705: 83 c4 1c add $0x1c,%esp +-80106708: 5b pop %ebx +-80106709: 5e pop %esi +-8010670a: 5f pop %edi +-8010670b: 5d pop %ebp ++8010672c: 89 75 10 mov %esi,0x10(%ebp) ++8010672f: 89 7d 0c mov %edi,0xc(%ebp) ++80106732: 89 5d 08 mov %ebx,0x8(%ebp) ++} ++80106735: 83 c4 1c add $0x1c,%esp ++80106738: 5b pop %ebx ++80106739: 5e pop %esi ++8010673a: 5f pop %edi ++8010673b: 5d pop %ebp + memmove(mem, init, sz); +-8010670c: e9 2f dc ff ff jmp 80104340 ++8010673c: e9 ff db ff ff jmp 80104340 + panic("inituvm: more than a page"); +-80106711: c7 04 24 2d 75 10 80 movl $0x8010752d,(%esp) +-80106718: e8 43 9c ff ff call 80100360 +-8010671d: 8d 76 00 lea 0x0(%esi),%esi +- +-80106720 : +-{ +-80106720: 55 push %ebp +-80106721: 89 e5 mov %esp,%ebp +-80106723: 57 push %edi +-80106724: 56 push %esi +-80106725: 53 push %ebx +-80106726: 83 ec 1c sub $0x1c,%esp ++80106741: c7 04 24 4d 75 10 80 movl $0x8010754d,(%esp) ++80106748: e8 13 9c ff ff call 80100360 ++8010674d: 8d 76 00 lea 0x0(%esi),%esi ++ ++80106750 : ++{ ++80106750: 55 push %ebp ++80106751: 89 e5 mov %esp,%ebp ++80106753: 57 push %edi ++80106754: 56 push %esi ++80106755: 53 push %ebx ++80106756: 83 ec 1c sub $0x1c,%esp + if((uint) addr % PGSIZE != 0) +-80106729: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp) +-80106730: 0f 85 98 00 00 00 jne 801067ce ++80106759: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp) ++80106760: 0f 85 98 00 00 00 jne 801067fe + for(i = 0; i < sz; i += PGSIZE){ +-80106736: 8b 75 18 mov 0x18(%ebp),%esi +-80106739: 31 db xor %ebx,%ebx +-8010673b: 85 f6 test %esi,%esi +-8010673d: 75 1a jne 80106759 +-8010673f: eb 77 jmp 801067b8 +-80106741: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +-80106748: 81 c3 00 10 00 00 add $0x1000,%ebx +-8010674e: 81 ee 00 10 00 00 sub $0x1000,%esi +-80106754: 39 5d 18 cmp %ebx,0x18(%ebp) +-80106757: 76 5f jbe 801067b8 +-80106759: 8b 55 0c mov 0xc(%ebp),%edx ++80106766: 8b 75 18 mov 0x18(%ebp),%esi ++80106769: 31 db xor %ebx,%ebx ++8010676b: 85 f6 test %esi,%esi ++8010676d: 75 1a jne 80106789 ++8010676f: eb 77 jmp 801067e8 ++80106771: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++80106778: 81 c3 00 10 00 00 add $0x1000,%ebx ++8010677e: 81 ee 00 10 00 00 sub $0x1000,%esi ++80106784: 39 5d 18 cmp %ebx,0x18(%ebp) ++80106787: 76 5f jbe 801067e8 ++80106789: 8b 55 0c mov 0xc(%ebp),%edx + if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) +-8010675c: 31 c9 xor %ecx,%ecx +-8010675e: 8b 45 08 mov 0x8(%ebp),%eax +-80106761: 01 da add %ebx,%edx +-80106763: e8 98 fb ff ff call 80106300 +-80106768: 85 c0 test %eax,%eax +-8010676a: 74 56 je 801067c2 ++8010678c: 31 c9 xor %ecx,%ecx ++8010678e: 8b 45 08 mov 0x8(%ebp),%eax ++80106791: 01 da add %ebx,%edx ++80106793: e8 98 fb ff ff call 80106330 ++80106798: 85 c0 test %eax,%eax ++8010679a: 74 56 je 801067f2 + pa = PTE_ADDR(*pte); +-8010676c: 8b 00 mov (%eax),%eax ++8010679c: 8b 00 mov (%eax),%eax + n = PGSIZE; +-8010676e: bf 00 10 00 00 mov $0x1000,%edi +-80106773: 8b 4d 14 mov 0x14(%ebp),%ecx ++8010679e: bf 00 10 00 00 mov $0x1000,%edi ++801067a3: 8b 4d 14 mov 0x14(%ebp),%ecx + pa = PTE_ADDR(*pte); +-80106776: 25 00 f0 ff ff and $0xfffff000,%eax ++801067a6: 25 00 f0 ff ff and $0xfffff000,%eax + n = PGSIZE; +-8010677b: 81 fe 00 10 00 00 cmp $0x1000,%esi +-80106781: 0f 42 fe cmovb %esi,%edi ++801067ab: 81 fe 00 10 00 00 cmp $0x1000,%esi ++801067b1: 0f 42 fe cmovb %esi,%edi + if(readi(ip, P2V(pa), offset+i, n) != n) +-80106784: 05 00 00 00 80 add $0x80000000,%eax +-80106789: 89 44 24 04 mov %eax,0x4(%esp) +-8010678d: 8b 45 10 mov 0x10(%ebp),%eax +-80106790: 01 d9 add %ebx,%ecx +-80106792: 89 7c 24 0c mov %edi,0xc(%esp) +-80106796: 89 4c 24 08 mov %ecx,0x8(%esp) +-8010679a: 89 04 24 mov %eax,(%esp) +-8010679d: e8 be b1 ff ff call 80101960 +-801067a2: 39 f8 cmp %edi,%eax +-801067a4: 74 a2 je 80106748 +-} +-801067a6: 83 c4 1c add $0x1c,%esp ++801067b4: 05 00 00 00 80 add $0x80000000,%eax ++801067b9: 89 44 24 04 mov %eax,0x4(%esp) ++801067bd: 8b 45 10 mov 0x10(%ebp),%eax ++801067c0: 01 d9 add %ebx,%ecx ++801067c2: 89 7c 24 0c mov %edi,0xc(%esp) ++801067c6: 89 4c 24 08 mov %ecx,0x8(%esp) ++801067ca: 89 04 24 mov %eax,(%esp) ++801067cd: e8 8e b1 ff ff call 80101960 ++801067d2: 39 f8 cmp %edi,%eax ++801067d4: 74 a2 je 80106778 ++} ++801067d6: 83 c4 1c add $0x1c,%esp + return -1; +-801067a9: b8 ff ff ff ff mov $0xffffffff,%eax +-} +-801067ae: 5b pop %ebx +-801067af: 5e pop %esi +-801067b0: 5f pop %edi +-801067b1: 5d pop %ebp +-801067b2: c3 ret +-801067b3: 90 nop +-801067b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +-801067b8: 83 c4 1c add $0x1c,%esp ++801067d9: b8 ff ff ff ff mov $0xffffffff,%eax ++} ++801067de: 5b pop %ebx ++801067df: 5e pop %esi ++801067e0: 5f pop %edi ++801067e1: 5d pop %ebp ++801067e2: c3 ret ++801067e3: 90 nop ++801067e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++801067e8: 83 c4 1c add $0x1c,%esp + return 0; +-801067bb: 31 c0 xor %eax,%eax ++801067eb: 31 c0 xor %eax,%eax + } +-801067bd: 5b pop %ebx +-801067be: 5e pop %esi +-801067bf: 5f pop %edi +-801067c0: 5d pop %ebp +-801067c1: c3 ret ++801067ed: 5b pop %ebx ++801067ee: 5e pop %esi ++801067ef: 5f pop %edi ++801067f0: 5d pop %ebp ++801067f1: c3 ret + panic("loaduvm: address should exist"); +-801067c2: c7 04 24 47 75 10 80 movl $0x80107547,(%esp) +-801067c9: e8 92 9b ff ff call 80100360 ++801067f2: c7 04 24 67 75 10 80 movl $0x80107567,(%esp) ++801067f9: e8 62 9b ff ff call 80100360 + panic("loaduvm: addr must be page aligned"); +-801067ce: c7 04 24 e8 75 10 80 movl $0x801075e8,(%esp) +-801067d5: e8 86 9b ff ff call 80100360 +-801067da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- +-801067e0 : +-{ +-801067e0: 55 push %ebp +-801067e1: 89 e5 mov %esp,%ebp +-801067e3: 57 push %edi +-801067e4: 56 push %esi +-801067e5: 53 push %ebx +-801067e6: 83 ec 1c sub $0x1c,%esp +-801067e9: 8b 7d 10 mov 0x10(%ebp),%edi ++801067fe: c7 04 24 08 76 10 80 movl $0x80107608,(%esp) ++80106805: e8 56 9b ff ff call 80100360 ++8010680a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ ++80106810 : ++{ ++80106810: 55 push %ebp ++80106811: 89 e5 mov %esp,%ebp ++80106813: 57 push %edi ++80106814: 56 push %esi ++80106815: 53 push %ebx ++80106816: 83 ec 1c sub $0x1c,%esp ++80106819: 8b 7d 10 mov 0x10(%ebp),%edi + if(newsz >= KERNBASE) +-801067ec: 85 ff test %edi,%edi +-801067ee: 0f 88 7e 00 00 00 js 80106872 ++8010681c: 85 ff test %edi,%edi ++8010681e: 0f 88 7e 00 00 00 js 801068a2 + if(newsz < oldsz) +-801067f4: 3b 7d 0c cmp 0xc(%ebp),%edi ++80106824: 3b 7d 0c cmp 0xc(%ebp),%edi + return oldsz; +-801067f7: 8b 45 0c mov 0xc(%ebp),%eax ++80106827: 8b 45 0c mov 0xc(%ebp),%eax + if(newsz < oldsz) +-801067fa: 72 78 jb 80106874 ++8010682a: 72 78 jb 801068a4 + a = PGROUNDUP(oldsz); +-801067fc: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx +-80106802: 81 e3 00 f0 ff ff and $0xfffff000,%ebx ++8010682c: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx ++80106832: 81 e3 00 f0 ff ff and $0xfffff000,%ebx + for(; a < newsz; a += PGSIZE){ +-80106808: 39 df cmp %ebx,%edi +-8010680a: 77 4a ja 80106856 +-8010680c: eb 72 jmp 80106880 +-8010680e: 66 90 xchg %ax,%ax ++80106838: 39 df cmp %ebx,%edi ++8010683a: 77 4a ja 80106886 ++8010683c: eb 72 jmp 801068b0 ++8010683e: 66 90 xchg %ax,%ax + memset(mem, 0, PGSIZE); +-80106810: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +-80106817: 00 +-80106818: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +-8010681f: 00 +-80106820: 89 04 24 mov %eax,(%esp) +-80106823: e8 78 da ff ff call 801042a0 ++80106840: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) ++80106847: 00 ++80106848: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++8010684f: 00 ++80106850: 89 04 24 mov %eax,(%esp) ++80106853: e8 48 da ff ff call 801042a0 + if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ +-80106828: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax +-8010682e: b9 00 10 00 00 mov $0x1000,%ecx +-80106833: 89 04 24 mov %eax,(%esp) +-80106836: 8b 45 08 mov 0x8(%ebp),%eax +-80106839: 89 da mov %ebx,%edx +-8010683b: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) +-80106842: 00 +-80106843: e8 48 fb ff ff call 80106390 +-80106848: 85 c0 test %eax,%eax +-8010684a: 78 44 js 80106890 ++80106858: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax ++8010685e: b9 00 10 00 00 mov $0x1000,%ecx ++80106863: 89 04 24 mov %eax,(%esp) ++80106866: 8b 45 08 mov 0x8(%ebp),%eax ++80106869: 89 da mov %ebx,%edx ++8010686b: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) ++80106872: 00 ++80106873: e8 48 fb ff ff call 801063c0 ++80106878: 85 c0 test %eax,%eax ++8010687a: 78 44 js 801068c0 + for(; a < newsz; a += PGSIZE){ +-8010684c: 81 c3 00 10 00 00 add $0x1000,%ebx +-80106852: 39 df cmp %ebx,%edi +-80106854: 76 2a jbe 80106880 ++8010687c: 81 c3 00 10 00 00 add $0x1000,%ebx ++80106882: 39 df cmp %ebx,%edi ++80106884: 76 2a jbe 801068b0 + mem = kalloc(); +-80106856: e8 45 bc ff ff call 801024a0 ++80106886: e8 15 bc ff ff call 801024a0 + if(mem == 0){ +-8010685b: 85 c0 test %eax,%eax ++8010688b: 85 c0 test %eax,%eax + mem = kalloc(); +-8010685d: 89 c6 mov %eax,%esi ++8010688d: 89 c6 mov %eax,%esi + if(mem == 0){ +-8010685f: 75 af jne 80106810 ++8010688f: 75 af jne 80106840 + cprintf("allocuvm out of memory\n"); +-80106861: c7 04 24 65 75 10 80 movl $0x80107565,(%esp) +-80106868: e8 e3 9d ff ff call 80100650 ++80106891: c7 04 24 85 75 10 80 movl $0x80107585,(%esp) ++80106898: e8 b3 9d ff ff call 80100650 + if(newsz >= oldsz) +-8010686d: 3b 7d 0c cmp 0xc(%ebp),%edi +-80106870: 77 48 ja 801068ba ++8010689d: 3b 7d 0c cmp 0xc(%ebp),%edi ++801068a0: 77 48 ja 801068ea + return 0; +-80106872: 31 c0 xor %eax,%eax +-} +-80106874: 83 c4 1c add $0x1c,%esp +-80106877: 5b pop %ebx +-80106878: 5e pop %esi +-80106879: 5f pop %edi +-8010687a: 5d pop %ebp +-8010687b: c3 ret +-8010687c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +-80106880: 83 c4 1c add $0x1c,%esp +-80106883: 89 f8 mov %edi,%eax +-80106885: 5b pop %ebx +-80106886: 5e pop %esi +-80106887: 5f pop %edi +-80106888: 5d pop %ebp +-80106889: c3 ret +-8010688a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++801068a2: 31 c0 xor %eax,%eax ++} ++801068a4: 83 c4 1c add $0x1c,%esp ++801068a7: 5b pop %ebx ++801068a8: 5e pop %esi ++801068a9: 5f pop %edi ++801068aa: 5d pop %ebp ++801068ab: c3 ret ++801068ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++801068b0: 83 c4 1c add $0x1c,%esp ++801068b3: 89 f8 mov %edi,%eax ++801068b5: 5b pop %ebx ++801068b6: 5e pop %esi ++801068b7: 5f pop %edi ++801068b8: 5d pop %ebp ++801068b9: c3 ret ++801068ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + cprintf("allocuvm out of memory (2)\n"); +-80106890: c7 04 24 7d 75 10 80 movl $0x8010757d,(%esp) +-80106897: e8 b4 9d ff ff call 80100650 ++801068c0: c7 04 24 9d 75 10 80 movl $0x8010759d,(%esp) ++801068c7: e8 84 9d ff ff call 80100650 + if(newsz >= oldsz) +-8010689c: 3b 7d 0c cmp 0xc(%ebp),%edi +-8010689f: 76 0d jbe 801068ae +-801068a1: 8b 4d 0c mov 0xc(%ebp),%ecx +-801068a4: 89 fa mov %edi,%edx +-801068a6: 8b 45 08 mov 0x8(%ebp),%eax +-801068a9: e8 62 fb ff ff call 80106410 ++801068cc: 3b 7d 0c cmp 0xc(%ebp),%edi ++801068cf: 76 0d jbe 801068de ++801068d1: 8b 4d 0c mov 0xc(%ebp),%ecx ++801068d4: 89 fa mov %edi,%edx ++801068d6: 8b 45 08 mov 0x8(%ebp),%eax ++801068d9: e8 62 fb ff ff call 80106440 + kfree(mem); +-801068ae: 89 34 24 mov %esi,(%esp) +-801068b1: e8 3a ba ff ff call 801022f0 ++801068de: 89 34 24 mov %esi,(%esp) ++801068e1: e8 0a ba ff ff call 801022f0 + return 0; +-801068b6: 31 c0 xor %eax,%eax +-801068b8: eb ba jmp 80106874 +-801068ba: 8b 4d 0c mov 0xc(%ebp),%ecx +-801068bd: 89 fa mov %edi,%edx +-801068bf: 8b 45 08 mov 0x8(%ebp),%eax +-801068c2: e8 49 fb ff ff call 80106410 ++801068e6: 31 c0 xor %eax,%eax ++801068e8: eb ba jmp 801068a4 ++801068ea: 8b 4d 0c mov 0xc(%ebp),%ecx ++801068ed: 89 fa mov %edi,%edx ++801068ef: 8b 45 08 mov 0x8(%ebp),%eax ++801068f2: e8 49 fb ff ff call 80106440 + return 0; +-801068c7: 31 c0 xor %eax,%eax +-801068c9: eb a9 jmp 80106874 +-801068cb: 90 nop +-801068cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- +-801068d0 : +-{ +-801068d0: 55 push %ebp +-801068d1: 89 e5 mov %esp,%ebp +-801068d3: 8b 55 0c mov 0xc(%ebp),%edx +-801068d6: 8b 4d 10 mov 0x10(%ebp),%ecx +-801068d9: 8b 45 08 mov 0x8(%ebp),%eax ++801068f7: 31 c0 xor %eax,%eax ++801068f9: eb a9 jmp 801068a4 ++801068fb: 90 nop ++801068fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ ++80106900 : ++{ ++80106900: 55 push %ebp ++80106901: 89 e5 mov %esp,%ebp ++80106903: 8b 55 0c mov 0xc(%ebp),%edx ++80106906: 8b 4d 10 mov 0x10(%ebp),%ecx ++80106909: 8b 45 08 mov 0x8(%ebp),%eax + if(newsz >= oldsz) +-801068dc: 39 d1 cmp %edx,%ecx +-801068de: 73 08 jae 801068e8 ++8010690c: 39 d1 cmp %edx,%ecx ++8010690e: 73 08 jae 80106918 + } +-801068e0: 5d pop %ebp +-801068e1: e9 2a fb ff ff jmp 80106410 +-801068e6: 66 90 xchg %ax,%ax +-801068e8: 89 d0 mov %edx,%eax +-801068ea: 5d pop %ebp +-801068eb: c3 ret +-801068ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++80106910: 5d pop %ebp ++80106911: e9 2a fb ff ff jmp 80106440 ++80106916: 66 90 xchg %ax,%ax ++80106918: 89 d0 mov %edx,%eax ++8010691a: 5d pop %ebp ++8010691b: c3 ret ++8010691c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +-801068f0 : ++80106920 : + + // Free a page table and all the physical memory pages + // in the user part. + void + freevm(pde_t *pgdir) + { +-801068f0: 55 push %ebp +-801068f1: 89 e5 mov %esp,%ebp +-801068f3: 56 push %esi +-801068f4: 53 push %ebx +-801068f5: 83 ec 10 sub $0x10,%esp +-801068f8: 8b 75 08 mov 0x8(%ebp),%esi ++80106920: 55 push %ebp ++80106921: 89 e5 mov %esp,%ebp ++80106923: 56 push %esi ++80106924: 53 push %ebx ++80106925: 83 ec 10 sub $0x10,%esp ++80106928: 8b 75 08 mov 0x8(%ebp),%esi + uint i; + + if(pgdir == 0) +-801068fb: 85 f6 test %esi,%esi +-801068fd: 74 59 je 80106958 +-801068ff: 31 c9 xor %ecx,%ecx +-80106901: ba 00 00 00 80 mov $0x80000000,%edx +-80106906: 89 f0 mov %esi,%eax ++8010692b: 85 f6 test %esi,%esi ++8010692d: 74 59 je 80106988 ++8010692f: 31 c9 xor %ecx,%ecx ++80106931: ba 00 00 00 80 mov $0x80000000,%edx ++80106936: 89 f0 mov %esi,%eax + panic("freevm: no pgdir"); + deallocuvm(pgdir, KERNBASE, 0); + for(i = 0; i < NPDENTRIES; i++){ +-80106908: 31 db xor %ebx,%ebx +-8010690a: e8 01 fb ff ff call 80106410 +-8010690f: eb 12 jmp 80106923 +-80106911: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +-80106918: 83 c3 01 add $0x1,%ebx +-8010691b: 81 fb 00 04 00 00 cmp $0x400,%ebx +-80106921: 74 27 je 8010694a ++80106938: 31 db xor %ebx,%ebx ++8010693a: e8 01 fb ff ff call 80106440 ++8010693f: eb 12 jmp 80106953 ++80106941: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++80106948: 83 c3 01 add $0x1,%ebx ++8010694b: 81 fb 00 04 00 00 cmp $0x400,%ebx ++80106951: 74 27 je 8010697a + if(pgdir[i] & PTE_P){ +-80106923: 8b 14 9e mov (%esi,%ebx,4),%edx +-80106926: f6 c2 01 test $0x1,%dl +-80106929: 74 ed je 80106918 ++80106953: 8b 14 9e mov (%esi,%ebx,4),%edx ++80106956: f6 c2 01 test $0x1,%dl ++80106959: 74 ed je 80106948 + char * v = P2V(PTE_ADDR(pgdir[i])); +-8010692b: 81 e2 00 f0 ff ff and $0xfffff000,%edx ++8010695b: 81 e2 00 f0 ff ff and $0xfffff000,%edx + for(i = 0; i < NPDENTRIES; i++){ +-80106931: 83 c3 01 add $0x1,%ebx ++80106961: 83 c3 01 add $0x1,%ebx + char * v = P2V(PTE_ADDR(pgdir[i])); +-80106934: 81 c2 00 00 00 80 add $0x80000000,%edx ++80106964: 81 c2 00 00 00 80 add $0x80000000,%edx + kfree(v); +-8010693a: 89 14 24 mov %edx,(%esp) +-8010693d: e8 ae b9 ff ff call 801022f0 ++8010696a: 89 14 24 mov %edx,(%esp) ++8010696d: e8 7e b9 ff ff call 801022f0 + for(i = 0; i < NPDENTRIES; i++){ +-80106942: 81 fb 00 04 00 00 cmp $0x400,%ebx +-80106948: 75 d9 jne 80106923 ++80106972: 81 fb 00 04 00 00 cmp $0x400,%ebx ++80106978: 75 d9 jne 80106953 + } + } + kfree((char*)pgdir); +-8010694a: 89 75 08 mov %esi,0x8(%ebp) ++8010697a: 89 75 08 mov %esi,0x8(%ebp) + } +-8010694d: 83 c4 10 add $0x10,%esp +-80106950: 5b pop %ebx +-80106951: 5e pop %esi +-80106952: 5d pop %ebp ++8010697d: 83 c4 10 add $0x10,%esp ++80106980: 5b pop %ebx ++80106981: 5e pop %esi ++80106982: 5d pop %ebp + kfree((char*)pgdir); +-80106953: e9 98 b9 ff ff jmp 801022f0 ++80106983: e9 68 b9 ff ff jmp 801022f0 + panic("freevm: no pgdir"); +-80106958: c7 04 24 99 75 10 80 movl $0x80107599,(%esp) +-8010695f: e8 fc 99 ff ff call 80100360 +-80106964: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +-8010696a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi +- +-80106970 : +-{ +-80106970: 55 push %ebp +-80106971: 89 e5 mov %esp,%ebp +-80106973: 56 push %esi +-80106974: 53 push %ebx +-80106975: 83 ec 10 sub $0x10,%esp ++80106988: c7 04 24 b9 75 10 80 movl $0x801075b9,(%esp) ++8010698f: e8 cc 99 ff ff call 80100360 ++80106994: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++8010699a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ ++801069a0 : ++{ ++801069a0: 55 push %ebp ++801069a1: 89 e5 mov %esp,%ebp ++801069a3: 56 push %esi ++801069a4: 53 push %ebx ++801069a5: 83 ec 10 sub $0x10,%esp + if((pgdir = (pde_t*)kalloc()) == 0) +-80106978: e8 23 bb ff ff call 801024a0 +-8010697d: 85 c0 test %eax,%eax +-8010697f: 89 c6 mov %eax,%esi +-80106981: 74 6d je 801069f0 ++801069a8: e8 f3 ba ff ff call 801024a0 ++801069ad: 85 c0 test %eax,%eax ++801069af: 89 c6 mov %eax,%esi ++801069b1: 74 6d je 80106a20 + memset(pgdir, 0, PGSIZE); +-80106983: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +-8010698a: 00 ++801069b3: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) ++801069ba: 00 + for(k = kmap; k < &kmap[NELEM(kmap)]; k++) +-8010698b: bb 20 a4 10 80 mov $0x8010a420,%ebx ++801069bb: bb 20 a4 10 80 mov $0x8010a420,%ebx + memset(pgdir, 0, PGSIZE); +-80106990: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +-80106997: 00 +-80106998: 89 04 24 mov %eax,(%esp) +-8010699b: e8 00 d9 ff ff call 801042a0 ++801069c0: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++801069c7: 00 ++801069c8: 89 04 24 mov %eax,(%esp) ++801069cb: e8 d0 d8 ff ff call 801042a0 + if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, +-801069a0: 8b 53 0c mov 0xc(%ebx),%edx +-801069a3: 8b 43 04 mov 0x4(%ebx),%eax +-801069a6: 8b 4b 08 mov 0x8(%ebx),%ecx +-801069a9: 89 54 24 04 mov %edx,0x4(%esp) +-801069ad: 8b 13 mov (%ebx),%edx +-801069af: 89 04 24 mov %eax,(%esp) +-801069b2: 29 c1 sub %eax,%ecx +-801069b4: 89 f0 mov %esi,%eax +-801069b6: e8 d5 f9 ff ff call 80106390 +-801069bb: 85 c0 test %eax,%eax +-801069bd: 78 19 js 801069d8 ++801069d0: 8b 53 0c mov 0xc(%ebx),%edx ++801069d3: 8b 43 04 mov 0x4(%ebx),%eax ++801069d6: 8b 4b 08 mov 0x8(%ebx),%ecx ++801069d9: 89 54 24 04 mov %edx,0x4(%esp) ++801069dd: 8b 13 mov (%ebx),%edx ++801069df: 89 04 24 mov %eax,(%esp) ++801069e2: 29 c1 sub %eax,%ecx ++801069e4: 89 f0 mov %esi,%eax ++801069e6: e8 d5 f9 ff ff call 801063c0 ++801069eb: 85 c0 test %eax,%eax ++801069ed: 78 19 js 80106a08 + for(k = kmap; k < &kmap[NELEM(kmap)]; k++) +-801069bf: 83 c3 10 add $0x10,%ebx +-801069c2: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx +-801069c8: 72 d6 jb 801069a0 +-801069ca: 89 f0 mov %esi,%eax +-} +-801069cc: 83 c4 10 add $0x10,%esp +-801069cf: 5b pop %ebx +-801069d0: 5e pop %esi +-801069d1: 5d pop %ebp +-801069d2: c3 ret +-801069d3: 90 nop +-801069d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++801069ef: 83 c3 10 add $0x10,%ebx ++801069f2: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx ++801069f8: 72 d6 jb 801069d0 ++801069fa: 89 f0 mov %esi,%eax ++} ++801069fc: 83 c4 10 add $0x10,%esp ++801069ff: 5b pop %ebx ++80106a00: 5e pop %esi ++80106a01: 5d pop %ebp ++80106a02: c3 ret ++80106a03: 90 nop ++80106a04: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + freevm(pgdir); +-801069d8: 89 34 24 mov %esi,(%esp) +-801069db: e8 10 ff ff ff call 801068f0 ++80106a08: 89 34 24 mov %esi,(%esp) ++80106a0b: e8 10 ff ff ff call 80106920 + } +-801069e0: 83 c4 10 add $0x10,%esp ++80106a10: 83 c4 10 add $0x10,%esp + return 0; +-801069e3: 31 c0 xor %eax,%eax ++80106a13: 31 c0 xor %eax,%eax + } +-801069e5: 5b pop %ebx +-801069e6: 5e pop %esi +-801069e7: 5d pop %ebp +-801069e8: c3 ret +-801069e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++80106a15: 5b pop %ebx ++80106a16: 5e pop %esi ++80106a17: 5d pop %ebp ++80106a18: c3 ret ++80106a19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +-801069f0: 31 c0 xor %eax,%eax +-801069f2: eb d8 jmp 801069cc +-801069f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +-801069fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++80106a20: 31 c0 xor %eax,%eax ++80106a22: eb d8 jmp 801069fc ++80106a24: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++80106a2a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-80106a00 : ++80106a30 : + { +-80106a00: 55 push %ebp +-80106a01: 89 e5 mov %esp,%ebp +-80106a03: 83 ec 08 sub $0x8,%esp ++80106a30: 55 push %ebp ++80106a31: 89 e5 mov %esp,%ebp ++80106a33: 83 ec 08 sub $0x8,%esp + kpgdir = setupkvm(); +-80106a06: e8 65 ff ff ff call 80106970 +-80106a0b: a3 a4 55 11 80 mov %eax,0x801155a4 ++80106a36: e8 65 ff ff ff call 801069a0 ++80106a3b: a3 a4 55 11 80 mov %eax,0x801155a4 + lcr3(V2P(kpgdir)); // switch to the kernel page table +-80106a10: 05 00 00 00 80 add $0x80000000,%eax +-80106a15: 0f 22 d8 mov %eax,%cr3 ++80106a40: 05 00 00 00 80 add $0x80000000,%eax ++80106a45: 0f 22 d8 mov %eax,%cr3 + } +-80106a18: c9 leave +-80106a19: c3 ret +-80106a1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++80106a48: c9 leave ++80106a49: c3 ret ++80106a4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-80106a20 : ++80106a50 : + + // Clear PTE_U on a page. Used to create an inaccessible + // page beneath the user stack. + void + clearpteu(pde_t *pgdir, char *uva) + { +-80106a20: 55 push %ebp ++80106a50: 55 push %ebp + pte_t *pte; + + pte = walkpgdir(pgdir, uva, 0); +-80106a21: 31 c9 xor %ecx,%ecx ++80106a51: 31 c9 xor %ecx,%ecx + { +-80106a23: 89 e5 mov %esp,%ebp +-80106a25: 83 ec 18 sub $0x18,%esp ++80106a53: 89 e5 mov %esp,%ebp ++80106a55: 83 ec 18 sub $0x18,%esp + pte = walkpgdir(pgdir, uva, 0); +-80106a28: 8b 55 0c mov 0xc(%ebp),%edx +-80106a2b: 8b 45 08 mov 0x8(%ebp),%eax +-80106a2e: e8 cd f8 ff ff call 80106300 ++80106a58: 8b 55 0c mov 0xc(%ebp),%edx ++80106a5b: 8b 45 08 mov 0x8(%ebp),%eax ++80106a5e: e8 cd f8 ff ff call 80106330 + if(pte == 0) +-80106a33: 85 c0 test %eax,%eax +-80106a35: 74 05 je 80106a3c ++80106a63: 85 c0 test %eax,%eax ++80106a65: 74 05 je 80106a6c + panic("clearpteu"); + *pte &= ~PTE_U; +-80106a37: 83 20 fb andl $0xfffffffb,(%eax) ++80106a67: 83 20 fb andl $0xfffffffb,(%eax) + } +-80106a3a: c9 leave +-80106a3b: c3 ret ++80106a6a: c9 leave ++80106a6b: c3 ret + panic("clearpteu"); +-80106a3c: c7 04 24 aa 75 10 80 movl $0x801075aa,(%esp) +-80106a43: e8 18 99 ff ff call 80100360 +-80106a48: 90 nop +-80106a49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++80106a6c: c7 04 24 ca 75 10 80 movl $0x801075ca,(%esp) ++80106a73: e8 e8 98 ff ff call 80100360 ++80106a78: 90 nop ++80106a79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-80106a50 : ++80106a80 : + + // Given a parent process's page table, create a copy + // of it for a child. + pde_t* + copyuvm(pde_t *pgdir, uint sz) + { +-80106a50: 55 push %ebp +-80106a51: 89 e5 mov %esp,%ebp +-80106a53: 57 push %edi +-80106a54: 56 push %esi +-80106a55: 53 push %ebx +-80106a56: 83 ec 2c sub $0x2c,%esp ++80106a80: 55 push %ebp ++80106a81: 89 e5 mov %esp,%ebp ++80106a83: 57 push %edi ++80106a84: 56 push %esi ++80106a85: 53 push %ebx ++80106a86: 83 ec 2c sub $0x2c,%esp + pde_t *d; + pte_t *pte; + uint pa, i, flags; + char *mem; + + if((d = setupkvm()) == 0) +-80106a59: e8 12 ff ff ff call 80106970 +-80106a5e: 85 c0 test %eax,%eax +-80106a60: 89 45 e0 mov %eax,-0x20(%ebp) +-80106a63: 0f 84 b9 00 00 00 je 80106b22 ++80106a89: e8 12 ff ff ff call 801069a0 ++80106a8e: 85 c0 test %eax,%eax ++80106a90: 89 45 e0 mov %eax,-0x20(%ebp) ++80106a93: 0f 84 b9 00 00 00 je 80106b52 + return 0; + for(i = 0; i < sz; i += PGSIZE){ +-80106a69: 8b 45 0c mov 0xc(%ebp),%eax +-80106a6c: 85 c0 test %eax,%eax +-80106a6e: 0f 84 94 00 00 00 je 80106b08 +-80106a74: 31 ff xor %edi,%edi +-80106a76: eb 48 jmp 80106ac0 ++80106a99: 8b 45 0c mov 0xc(%ebp),%eax ++80106a9c: 85 c0 test %eax,%eax ++80106a9e: 0f 84 94 00 00 00 je 80106b38 ++80106aa4: 31 ff xor %edi,%edi ++80106aa6: eb 48 jmp 80106af0 + panic("copyuvm: page not present"); + pa = PTE_ADDR(*pte); + flags = PTE_FLAGS(*pte); + if((mem = kalloc()) == 0) + goto bad; + memmove(mem, (char*)P2V(pa), PGSIZE); +-80106a78: 81 c6 00 00 00 80 add $0x80000000,%esi +-80106a7e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) +-80106a85: 00 +-80106a86: 89 74 24 04 mov %esi,0x4(%esp) +-80106a8a: 89 04 24 mov %eax,(%esp) +-80106a8d: e8 ae d8 ff ff call 80104340 ++80106aa8: 81 c6 00 00 00 80 add $0x80000000,%esi ++80106aae: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) ++80106ab5: 00 ++80106ab6: 89 74 24 04 mov %esi,0x4(%esp) ++80106aba: 89 04 24 mov %eax,(%esp) ++80106abd: e8 7e d8 ff ff call 80104340 + if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { +-80106a92: 8b 45 e4 mov -0x1c(%ebp),%eax +-80106a95: b9 00 10 00 00 mov $0x1000,%ecx +-80106a9a: 89 fa mov %edi,%edx +-80106a9c: 89 44 24 04 mov %eax,0x4(%esp) +-80106aa0: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +-80106aa6: 89 04 24 mov %eax,(%esp) +-80106aa9: 8b 45 e0 mov -0x20(%ebp),%eax +-80106aac: e8 df f8 ff ff call 80106390 +-80106ab1: 85 c0 test %eax,%eax +-80106ab3: 78 63 js 80106b18 ++80106ac2: 8b 45 e4 mov -0x1c(%ebp),%eax ++80106ac5: b9 00 10 00 00 mov $0x1000,%ecx ++80106aca: 89 fa mov %edi,%edx ++80106acc: 89 44 24 04 mov %eax,0x4(%esp) ++80106ad0: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax ++80106ad6: 89 04 24 mov %eax,(%esp) ++80106ad9: 8b 45 e0 mov -0x20(%ebp),%eax ++80106adc: e8 df f8 ff ff call 801063c0 ++80106ae1: 85 c0 test %eax,%eax ++80106ae3: 78 63 js 80106b48 + for(i = 0; i < sz; i += PGSIZE){ +-80106ab5: 81 c7 00 10 00 00 add $0x1000,%edi +-80106abb: 39 7d 0c cmp %edi,0xc(%ebp) +-80106abe: 76 48 jbe 80106b08 ++80106ae5: 81 c7 00 10 00 00 add $0x1000,%edi ++80106aeb: 39 7d 0c cmp %edi,0xc(%ebp) ++80106aee: 76 48 jbe 80106b38 + if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) +-80106ac0: 8b 45 08 mov 0x8(%ebp),%eax +-80106ac3: 31 c9 xor %ecx,%ecx +-80106ac5: 89 fa mov %edi,%edx +-80106ac7: e8 34 f8 ff ff call 80106300 +-80106acc: 85 c0 test %eax,%eax +-80106ace: 74 62 je 80106b32 ++80106af0: 8b 45 08 mov 0x8(%ebp),%eax ++80106af3: 31 c9 xor %ecx,%ecx ++80106af5: 89 fa mov %edi,%edx ++80106af7: e8 34 f8 ff ff call 80106330 ++80106afc: 85 c0 test %eax,%eax ++80106afe: 74 62 je 80106b62 + if(!(*pte & PTE_P)) +-80106ad0: 8b 00 mov (%eax),%eax +-80106ad2: a8 01 test $0x1,%al +-80106ad4: 74 50 je 80106b26 ++80106b00: 8b 00 mov (%eax),%eax ++80106b02: a8 01 test $0x1,%al ++80106b04: 74 50 je 80106b56 + pa = PTE_ADDR(*pte); +-80106ad6: 89 c6 mov %eax,%esi ++80106b06: 89 c6 mov %eax,%esi + flags = PTE_FLAGS(*pte); +-80106ad8: 25 ff 0f 00 00 and $0xfff,%eax +-80106add: 89 45 e4 mov %eax,-0x1c(%ebp) ++80106b08: 25 ff 0f 00 00 and $0xfff,%eax ++80106b0d: 89 45 e4 mov %eax,-0x1c(%ebp) + pa = PTE_ADDR(*pte); +-80106ae0: 81 e6 00 f0 ff ff and $0xfffff000,%esi ++80106b10: 81 e6 00 f0 ff ff and $0xfffff000,%esi + if((mem = kalloc()) == 0) +-80106ae6: e8 b5 b9 ff ff call 801024a0 +-80106aeb: 85 c0 test %eax,%eax +-80106aed: 89 c3 mov %eax,%ebx +-80106aef: 75 87 jne 80106a78 ++80106b16: e8 85 b9 ff ff call 801024a0 ++80106b1b: 85 c0 test %eax,%eax ++80106b1d: 89 c3 mov %eax,%ebx ++80106b1f: 75 87 jne 80106aa8 + } + } + return d; + + bad: + freevm(d); +-80106af1: 8b 45 e0 mov -0x20(%ebp),%eax +-80106af4: 89 04 24 mov %eax,(%esp) +-80106af7: e8 f4 fd ff ff call 801068f0 ++80106b21: 8b 45 e0 mov -0x20(%ebp),%eax ++80106b24: 89 04 24 mov %eax,(%esp) ++80106b27: e8 f4 fd ff ff call 80106920 + return 0; +-80106afc: 31 c0 xor %eax,%eax +-} +-80106afe: 83 c4 2c add $0x2c,%esp +-80106b01: 5b pop %ebx +-80106b02: 5e pop %esi +-80106b03: 5f pop %edi +-80106b04: 5d pop %ebp +-80106b05: c3 ret +-80106b06: 66 90 xchg %ax,%ax +-80106b08: 8b 45 e0 mov -0x20(%ebp),%eax +-80106b0b: 83 c4 2c add $0x2c,%esp +-80106b0e: 5b pop %ebx +-80106b0f: 5e pop %esi +-80106b10: 5f pop %edi +-80106b11: 5d pop %ebp +-80106b12: c3 ret +-80106b13: 90 nop +-80106b14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++80106b2c: 31 c0 xor %eax,%eax ++} ++80106b2e: 83 c4 2c add $0x2c,%esp ++80106b31: 5b pop %ebx ++80106b32: 5e pop %esi ++80106b33: 5f pop %edi ++80106b34: 5d pop %ebp ++80106b35: c3 ret ++80106b36: 66 90 xchg %ax,%ax ++80106b38: 8b 45 e0 mov -0x20(%ebp),%eax ++80106b3b: 83 c4 2c add $0x2c,%esp ++80106b3e: 5b pop %ebx ++80106b3f: 5e pop %esi ++80106b40: 5f pop %edi ++80106b41: 5d pop %ebp ++80106b42: c3 ret ++80106b43: 90 nop ++80106b44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + kfree(mem); +-80106b18: 89 1c 24 mov %ebx,(%esp) +-80106b1b: e8 d0 b7 ff ff call 801022f0 ++80106b48: 89 1c 24 mov %ebx,(%esp) ++80106b4b: e8 a0 b7 ff ff call 801022f0 + goto bad; +-80106b20: eb cf jmp 80106af1 ++80106b50: eb cf jmp 80106b21 + return 0; +-80106b22: 31 c0 xor %eax,%eax +-80106b24: eb d8 jmp 80106afe ++80106b52: 31 c0 xor %eax,%eax ++80106b54: eb d8 jmp 80106b2e + panic("copyuvm: page not present"); +-80106b26: c7 04 24 ce 75 10 80 movl $0x801075ce,(%esp) +-80106b2d: e8 2e 98 ff ff call 80100360 ++80106b56: c7 04 24 ee 75 10 80 movl $0x801075ee,(%esp) ++80106b5d: e8 fe 97 ff ff call 80100360 + panic("copyuvm: pte should exist"); +-80106b32: c7 04 24 b4 75 10 80 movl $0x801075b4,(%esp) +-80106b39: e8 22 98 ff ff call 80100360 +-80106b3e: 66 90 xchg %ax,%ax ++80106b62: c7 04 24 d4 75 10 80 movl $0x801075d4,(%esp) ++80106b69: e8 f2 97 ff ff call 80100360 ++80106b6e: 66 90 xchg %ax,%ax + +-80106b40 : ++80106b70 : + + //PAGEBREAK! + // Map user virtual address to kernel address. + char* + uva2ka(pde_t *pgdir, char *uva) + { +-80106b40: 55 push %ebp ++80106b70: 55 push %ebp + pte_t *pte; + + pte = walkpgdir(pgdir, uva, 0); +-80106b41: 31 c9 xor %ecx,%ecx ++80106b71: 31 c9 xor %ecx,%ecx + { +-80106b43: 89 e5 mov %esp,%ebp +-80106b45: 83 ec 08 sub $0x8,%esp ++80106b73: 89 e5 mov %esp,%ebp ++80106b75: 83 ec 08 sub $0x8,%esp + pte = walkpgdir(pgdir, uva, 0); +-80106b48: 8b 55 0c mov 0xc(%ebp),%edx +-80106b4b: 8b 45 08 mov 0x8(%ebp),%eax +-80106b4e: e8 ad f7 ff ff call 80106300 ++80106b78: 8b 55 0c mov 0xc(%ebp),%edx ++80106b7b: 8b 45 08 mov 0x8(%ebp),%eax ++80106b7e: e8 ad f7 ff ff call 80106330 + if((*pte & PTE_P) == 0) +-80106b53: 8b 00 mov (%eax),%eax +-80106b55: 89 c2 mov %eax,%edx +-80106b57: 83 e2 05 and $0x5,%edx ++80106b83: 8b 00 mov (%eax),%eax ++80106b85: 89 c2 mov %eax,%edx ++80106b87: 83 e2 05 and $0x5,%edx + return 0; + if((*pte & PTE_U) == 0) +-80106b5a: 83 fa 05 cmp $0x5,%edx +-80106b5d: 75 11 jne 80106b70 ++80106b8a: 83 fa 05 cmp $0x5,%edx ++80106b8d: 75 11 jne 80106ba0 + return 0; + return (char*)P2V(PTE_ADDR(*pte)); +-80106b5f: 25 00 f0 ff ff and $0xfffff000,%eax +-80106b64: 05 00 00 00 80 add $0x80000000,%eax ++80106b8f: 25 00 f0 ff ff and $0xfffff000,%eax ++80106b94: 05 00 00 00 80 add $0x80000000,%eax + } +-80106b69: c9 leave +-80106b6a: c3 ret +-80106b6b: 90 nop +-80106b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++80106b99: c9 leave ++80106b9a: c3 ret ++80106b9b: 90 nop ++80106b9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +-80106b70: 31 c0 xor %eax,%eax ++80106ba0: 31 c0 xor %eax,%eax + } +-80106b72: c9 leave +-80106b73: c3 ret +-80106b74: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +-80106b7a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++80106ba2: c9 leave ++80106ba3: c3 ret ++80106ba4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++80106baa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-80106b80 : ++80106bb0 : + // 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) + { +-80106b80: 55 push %ebp +-80106b81: 89 e5 mov %esp,%ebp +-80106b83: 57 push %edi +-80106b84: 56 push %esi +-80106b85: 53 push %ebx +-80106b86: 83 ec 1c sub $0x1c,%esp +-80106b89: 8b 5d 14 mov 0x14(%ebp),%ebx +-80106b8c: 8b 4d 0c mov 0xc(%ebp),%ecx +-80106b8f: 8b 7d 10 mov 0x10(%ebp),%edi ++80106bb0: 55 push %ebp ++80106bb1: 89 e5 mov %esp,%ebp ++80106bb3: 57 push %edi ++80106bb4: 56 push %esi ++80106bb5: 53 push %ebx ++80106bb6: 83 ec 1c sub $0x1c,%esp ++80106bb9: 8b 5d 14 mov 0x14(%ebp),%ebx ++80106bbc: 8b 4d 0c mov 0xc(%ebp),%ecx ++80106bbf: 8b 7d 10 mov 0x10(%ebp),%edi + char *buf, *pa0; + uint n, va0; + + buf = (char*)p; + while(len > 0){ +-80106b92: 85 db test %ebx,%ebx +-80106b94: 75 3a jne 80106bd0 +-80106b96: eb 68 jmp 80106c00 ++80106bc2: 85 db test %ebx,%ebx ++80106bc4: 75 3a jne 80106c00 ++80106bc6: eb 68 jmp 80106c30 + va0 = (uint)PGROUNDDOWN(va); + pa0 = uva2ka(pgdir, (char*)va0); + if(pa0 == 0) + return -1; + n = PGSIZE - (va - va0); +-80106b98: 8b 4d e4 mov -0x1c(%ebp),%ecx +-80106b9b: 89 f2 mov %esi,%edx ++80106bc8: 8b 4d e4 mov -0x1c(%ebp),%ecx ++80106bcb: 89 f2 mov %esi,%edx + if(n > len) + n = len; + memmove(pa0 + (va - va0), buf, n); +-80106b9d: 89 7c 24 04 mov %edi,0x4(%esp) ++80106bcd: 89 7c 24 04 mov %edi,0x4(%esp) + n = PGSIZE - (va - va0); +-80106ba1: 29 ca sub %ecx,%edx +-80106ba3: 81 c2 00 10 00 00 add $0x1000,%edx +-80106ba9: 39 da cmp %ebx,%edx +-80106bab: 0f 47 d3 cmova %ebx,%edx ++80106bd1: 29 ca sub %ecx,%edx ++80106bd3: 81 c2 00 10 00 00 add $0x1000,%edx ++80106bd9: 39 da cmp %ebx,%edx ++80106bdb: 0f 47 d3 cmova %ebx,%edx + memmove(pa0 + (va - va0), buf, n); +-80106bae: 29 f1 sub %esi,%ecx +-80106bb0: 01 c8 add %ecx,%eax +-80106bb2: 89 54 24 08 mov %edx,0x8(%esp) +-80106bb6: 89 04 24 mov %eax,(%esp) +-80106bb9: 89 55 e4 mov %edx,-0x1c(%ebp) +-80106bbc: e8 7f d7 ff ff call 80104340 ++80106bde: 29 f1 sub %esi,%ecx ++80106be0: 01 c8 add %ecx,%eax ++80106be2: 89 54 24 08 mov %edx,0x8(%esp) ++80106be6: 89 04 24 mov %eax,(%esp) ++80106be9: 89 55 e4 mov %edx,-0x1c(%ebp) ++80106bec: e8 4f d7 ff ff call 80104340 + len -= n; + buf += n; +-80106bc1: 8b 55 e4 mov -0x1c(%ebp),%edx ++80106bf1: 8b 55 e4 mov -0x1c(%ebp),%edx + va = va0 + PGSIZE; +-80106bc4: 8d 8e 00 10 00 00 lea 0x1000(%esi),%ecx ++80106bf4: 8d 8e 00 10 00 00 lea 0x1000(%esi),%ecx + buf += n; +-80106bca: 01 d7 add %edx,%edi ++80106bfa: 01 d7 add %edx,%edi + while(len > 0){ +-80106bcc: 29 d3 sub %edx,%ebx +-80106bce: 74 30 je 80106c00 ++80106bfc: 29 d3 sub %edx,%ebx ++80106bfe: 74 30 je 80106c30 + pa0 = uva2ka(pgdir, (char*)va0); +-80106bd0: 8b 45 08 mov 0x8(%ebp),%eax ++80106c00: 8b 45 08 mov 0x8(%ebp),%eax + va0 = (uint)PGROUNDDOWN(va); +-80106bd3: 89 ce mov %ecx,%esi +-80106bd5: 81 e6 00 f0 ff ff and $0xfffff000,%esi ++80106c03: 89 ce mov %ecx,%esi ++80106c05: 81 e6 00 f0 ff ff and $0xfffff000,%esi + pa0 = uva2ka(pgdir, (char*)va0); +-80106bdb: 89 74 24 04 mov %esi,0x4(%esp) ++80106c0b: 89 74 24 04 mov %esi,0x4(%esp) + va0 = (uint)PGROUNDDOWN(va); +-80106bdf: 89 4d e4 mov %ecx,-0x1c(%ebp) ++80106c0f: 89 4d e4 mov %ecx,-0x1c(%ebp) + pa0 = uva2ka(pgdir, (char*)va0); +-80106be2: 89 04 24 mov %eax,(%esp) +-80106be5: e8 56 ff ff ff call 80106b40 ++80106c12: 89 04 24 mov %eax,(%esp) ++80106c15: e8 56 ff ff ff call 80106b70 + if(pa0 == 0) +-80106bea: 85 c0 test %eax,%eax +-80106bec: 75 aa jne 80106b98 ++80106c1a: 85 c0 test %eax,%eax ++80106c1c: 75 aa jne 80106bc8 + } + return 0; + } +-80106bee: 83 c4 1c add $0x1c,%esp ++80106c1e: 83 c4 1c add $0x1c,%esp + return -1; +-80106bf1: b8 ff ff ff ff mov $0xffffffff,%eax +-} +-80106bf6: 5b pop %ebx +-80106bf7: 5e pop %esi +-80106bf8: 5f pop %edi +-80106bf9: 5d pop %ebp +-80106bfa: c3 ret +-80106bfb: 90 nop +-80106bfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +-80106c00: 83 c4 1c add $0x1c,%esp ++80106c21: b8 ff ff ff ff mov $0xffffffff,%eax ++} ++80106c26: 5b pop %ebx ++80106c27: 5e pop %esi ++80106c28: 5f pop %edi ++80106c29: 5d pop %ebp ++80106c2a: c3 ret ++80106c2b: 90 nop ++80106c2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++80106c30: 83 c4 1c add $0x1c,%esp + return 0; +-80106c03: 31 c0 xor %eax,%eax ++80106c33: 31 c0 xor %eax,%eax + } +-80106c05: 5b pop %ebx +-80106c06: 5e pop %esi +-80106c07: 5f pop %edi +-80106c08: 5d pop %ebp +-80106c09: c3 ret ++80106c35: 5b pop %ebx ++80106c36: 5e pop %esi ++80106c37: 5f pop %edi ++80106c38: 5d pop %ebp ++80106c39: c3 ret +diff --git a/kernel.sym b/kernel.sym +index 363573f..c44986b 100644 +--- a/kernel.sym ++++ b/kernel.sym +@@ -1,5 +1,5 @@ + 80100000 .text +-80106c20 .rodata ++80106c40 .rodata + 80108000 .data + 8010a520 .bss + 00000000 .debug_line +@@ -16,7 +16,7 @@ + 8010a558 panicked + 801003e0 consputc + 80100570 printint +-80106c90 digits.1847 ++80106cb0 digits.1847 + 00000000 exec.c + 00000000 file.c + 00000000 fs.c +@@ -34,9 +34,9 @@ + 00000000 kalloc.c + 00000000 kbd.c + 8010a5b4 shift.1687 +-80106fc0 shiftcode +-80106ec0 togglecode +-80106ea0 charcode.1688 ++80106fe0 shiftcode ++80106ee0 togglecode ++80106ec0 charcode.1688 + 80108200 normalmap + 80108100 shiftmap + 80108000 ctlmap +@@ -56,12 +56,12 @@ + 801034c0 allocproc + 8010a000 first.1889 + 8010a5b8 initproc +-80107280 states.1915 ++801072a0 states.1915 + 00000000 sleeplock.c + 00000000 spinlock.c + 00000000 string.c + 00000000 syscall.c +-80107300 syscalls ++80107320 syscalls + 00000000 sysfile.c + 801046d0 fdalloc + 80104710 create +@@ -69,449 +69,449 @@ + 00000000 sysproc.c + 00000000 trap.c + 00000000 uart.c +-80105750 uartgetc ++80105780 uartgetc + 8010a5bc uart + 00000000 vm.c +-80106300 walkpgdir +-80106390 mappages +-80106410 deallocuvm.part.0 ++80106330 walkpgdir ++801063c0 mappages ++80106440 deallocuvm.part.0 + 8010a420 kmap + 80100270 consoleread +-8010624e vector242 +-80105ca5 vector119 ++8010627e vector242 ++80105cd5 vector119 + 8010000c entry +-80105b85 vector87 +-80105b7c vector86 ++80105bb5 vector87 ++80105bac vector86 + 80104480 safestrcpy + 80104a20 sys_close +-801062ba vector251 +-80105ba9 vector91 +-8010599f vector33 +-80105e8e vector162 ++801062ea vector251 ++80105bd9 vector91 ++801059cf vector33 ++80105ebe vector162 + 80103bc0 yield + 80112680 log + 80112640 kmem +-801060f2 vector213 +-80105c42 vector108 +-801057d0 uartinit +-801059f9 vector43 ++80106122 vector213 ++80105c72 vector108 ++80105800 uartinit ++80105a29 vector43 + 80102780 lapiceoi +-80105eb2 vector165 +-80105fa2 vector185 ++80105ee2 vector165 ++80105fd2 vector185 + 80102200 ioapicinit +-80105c81 vector115 ++80105cb1 vector115 + 80100f40 fileread +-80105cc0 vector122 +-801052b0 sys_sbrk ++80105cf0 vector122 ++801052e0 sys_sbrk + 80112760 ioapicid +-80105e46 vector156 +-80106272 vector245 ++80105e76 vector156 ++801062a2 vector245 + 80112634 ioapic +-80105fd2 vector189 +-801058c3 vector7 +-80105a9b vector61 +-8010594e vector24 +-80105c5d vector111 +-80106056 vector200 +-80105ad1 vector67 +-80105d6e vector138 +-80105b10 vector74 ++80106002 vector189 ++801058f3 vector7 ++80105acb vector61 ++8010597e vector24 ++80105c8d vector111 ++80106086 vector200 ++80105b01 vector67 ++80105d9e vector138 ++80105b40 vector74 + 80103a00 sched + 80104340 memmove +-80105a77 vector57 ++80105aa7 vector57 + 80104660 syscall +-801060fe vector214 +-80105bf1 vector99 ++8010612e vector214 ++80105c21 vector99 + 80103680 cpuid + 80101a60 writei +-80105d92 vector141 ++80105dc2 vector141 + 80105210 sys_fork + 8010b5c0 bcache +-80105f06 vector172 +-80106242 vector241 ++80105f36 vector172 ++80106272 vector241 + 80104090 getcallerpcs + 80104f00 sys_mkdir +-801062d2 vector253 +-8010589f vector3 +-80105896 vector2 ++80106302 vector253 ++801058cf vector3 ++801058c6 vector2 + 80101b90 namecmp +-8010619a vector227 +-801060ce vector210 ++801061ca vector227 ++801060fe vector210 + 80104620 argstr +-80106176 vector224 +-801059e7 vector41 ++801061a6 vector224 ++80105a17 vector41 + 80100650 cprintf + 80100de0 filedup + 80101f00 namei +-80105933 vector21 ++80105963 vector21 + 80100040 binit +-80105f42 vector177 +-80105c9c vector118 +-80105aec vector70 +-80105ae3 vector69 +-80106212 vector237 +-80105ab6 vector64 +-80105969 vector27 +-80105d26 vector132 +-80105fae vector186 ++80105f72 vector177 ++80105ccc vector118 ++80105b1c vector70 ++80105b13 vector69 ++80106242 vector237 ++80105ae6 vector64 ++80105999 vector27 ++80105d56 vector132 ++80105fde vector186 + 80104940 sys_read +-80106122 vector217 ++80106152 vector217 + 801044f0 fetchint +-80106970 setupkvm ++801069a0 setupkvm + 801043b0 memcpy +-801068f0 freevm +-8010588d vector1 +-80105f4e vector178 +-801059cc vector38 ++80106920 freevm ++801058bd vector1 ++80105f7e vector178 ++801059fc vector38 + 801022f0 kfree +-8010621e vector238 ++8010624e vector238 + 80103600 mycpu + 801017d0 iput +-80105d32 vector133 +-80105b07 vector73 +-80105db6 vector144 +-801062de vector254 ++80105d62 vector133 ++80105b37 vector73 ++80105de6 vector144 ++8010630e vector254 + 80101420 readsb + 8010a004 nextpid +-80105c03 vector101 +-801060da vector211 ++80105c33 vector101 ++8010610a vector211 + 80102f90 mpinit +-80105f1e vector174 +-8010625a vector243 ++80105f4e vector174 ++8010628a vector243 + 80100d50 fileinit + 80104070 initlock +-80105cf6 vector128 +-80106b80 copyout +-80105b4f vector81 ++80105d26 vector128 ++80106bb0 copyout ++80105b7f vector81 + 80103c00 sleep + 801027a0 microdelay +-801058f1 vector13 +-80105a41 vector51 +-80105908 vector16 ++80105921 vector13 ++80105a71 vector51 ++80105938 vector16 + 8010ff20 input +-80106236 vector240 +-80105a5c vector54 +-80105921 vector19 +-80105bb2 vector92 +-80106266 vector244 ++80106266 vector240 ++80105a8c vector54 ++80105951 vector19 ++80105be2 vector92 ++80106296 vector244 + 80101930 stati +-80105d86 vector140 +-80105260 sys_kill +-80105a0b vector45 +-80105b3d vector79 ++80105db6 vector140 ++80105290 sys_kill ++80105a3b vector45 ++80105b6d vector79 + 80103260 pipeclose +-801061b2 vector229 +-80105e5e vector158 ++801061e2 vector229 ++80105e8e vector158 + 80104a60 sys_fstat + 801005f0 consolewrite +-801059d5 vector39 +-80105ed6 vector168 ++80105a05 vector39 ++80105f06 vector168 + 80102b80 end_op +-801059b1 vector35 +-80105c6f vector113 ++801059e1 vector35 ++80105c9f vector113 + 80102390 freerange +-80105cdb vector125 +-801067e0 allocuvm +-801053f5 trapret +-80106116 vector216 +-80105aad vector63 +-80105960 vector26 +-80106002 vector193 ++80105d0b vector125 ++80106810 allocuvm ++80105425 trapret ++80106146 vector216 ++80105add vector63 ++80105990 vector26 ++80106032 vector193 + 80102670 lapicinit +-80106026 vector196 +-801060c2 vector209 +-801058a8 vector4 +-80105eee vector170 ++80106056 vector196 ++801060f2 vector209 ++801058d8 vector4 ++80105f1e vector170 + 8010a5c0 stack +-80105d56 vector136 +-801058dc vector10 +-8010609e vector206 ++80105d86 vector136 ++8010590c vector10 ++801060ce vector206 + 80101790 iunlock +-80105300 sys_sleep +-801062ea vector255 +-80105f72 vector181 +-80105a89 vector59 +-80105b73 vector85 +-80105b6a vector84 +-80105f8a vector183 +-80105e6a vector159 +-801060e6 vector212 ++80105330 sys_sleep ++8010631a vector255 ++80105fa2 vector181 ++80105ab9 vector59 ++80105ba3 vector85 ++80105b9a vector84 ++80105fba vector183 ++80105e9a vector159 ++80106116 vector212 + 80104ab0 sys_link +-80105a1d vector47 +-801061a6 vector228 +-801059f0 vector42 +-80105c78 vector114 +-80106b40 uva2ka +-80105f2a vector175 +-80105daa vector143 ++80105a4d vector47 ++801061d6 vector228 ++80105a20 vector42 ++80105ca8 vector114 ++80106b70 uva2ka ++80105f5a vector175 ++80105dda vector143 + 80100d70 filealloc + 80103d90 wakeup +-80105d0e vector130 +-8010627e vector246 +-801058d3 vector9 +-80105d9e vector142 +-80105bfa vector100 +-80106062 vector201 +-80106a20 clearpteu ++80105d3e vector130 ++801062ae vector246 ++80105903 vector9 ++80105dce vector142 ++80105c2a vector100 ++80106092 vector201 ++80106a50 clearpteu + 801036a0 myproc +-80105400 tvinit +-80105a92 vector60 +-80105945 vector23 ++80105430 tvinit ++80105ac2 vector60 ++80105975 vector23 + 80101680 idup +-80106206 vector236 ++80106236 vector236 + 801025d0 kbdintr + 80104dc0 sys_open +-801061ca vector231 +-80105ac8 vector66 +-8010597b vector29 ++801061fa vector231 ++80105af8 vector66 ++801059ab vector29 + 80101960 readi +-80105d4a vector135 ++80105d7a vector135 + 801007b0 consoleintr + 80103df0 kill +-80105b2b vector77 ++80105b5b vector77 + 80101520 ialloc +-80105f66 vector180 ++80105f96 vector180 + 801155a4 kpgdir +-801060b6 vector208 ++801060e6 vector208 + 80102840 cmostime +-80105870 uartintr +-80105be8 vector98 +-80105bdf vector97 +-80105f36 vector176 +-8010600e vector194 +-80105996 vector32 ++801058a0 uartintr ++80105c18 vector98 ++80105c0f vector97 ++80105f66 vector176 ++8010603e vector194 ++801059c6 vector32 + 801155a8 end +-8010604a vector199 +-80105d1a vector131 +-801062c6 vector252 ++8010607a vector199 ++80105d4a vector131 ++801062f6 vector252 + 80100fe0 filewrite +-80105884 vector0 ++801058b4 vector0 + 80104590 argint + 801009a0 exec +-80105dc2 vector145 ++80105df2 vector145 + 801049b0 sys_write + 80104250 release + 80104530 fetchstr +-80105c39 vector107 +-801059de vector40 ++80105c69 vector107 ++80105a0e vector40 + 80103cb0 wait +-80105c0c vector102 ++80105c3c vector102 + 80109000 entrypgdir + 0010000c _start +-80105a6e vector56 +-80105ada vector68 +-801058ba vector6 ++80105a9e vector56 ++80105b0a vector68 ++801058ea vector6 + 8010a48c _binary_initcode_end + 80100000 multiboot_header +-80105d02 vector129 ++80105d32 vector129 + 80103960 scheduler + 80101bc0 dirlookup +-80106032 vector197 ++80106062 vector197 + 80100e30 fileclose + 80102b10 begin_op +-80105e16 vector152 +-80106a00 kvmalloc +-801061be vector230 ++80105e46 vector152 ++80106a30 kvmalloc ++801061ee vector230 + 801043c0 strncmp +-801059c3 vector37 +-80106092 vector205 +-80105e82 vector161 ++801059f3 vector37 ++801060c2 vector205 ++80105eb2 vector161 + 80114d60 tickslock + 801032f0 pipewrite + 80104430 strncpy +-80105af5 vector71 +-80106a50 copyuvm ++80105b25 vector71 ++80106a80 copyuvm + 8010ffc0 ftable +-80105e76 vector160 ++80105ea6 vector160 + 801045c0 argptr +-8010610a vector215 +-80105e52 vector157 ++8010613a vector215 ++80105e82 vector157 + 80104900 sys_dup +-80105c66 vector112 ++80105c96 vector112 + 80100360 panic + 80103590 forkret +-80105f7e vector182 +-801058ea vector12 ++80105fae vector182 ++8010591a vector12 + 801042f0 memcmp + 80102500 kbdgetc +-80105c4b vector109 +-8010592a vector20 ++80105c7b vector109 ++8010595a vector20 + 80103850 fork +-80105a53 vector53 +-80105918 vector18 ++80105a83 vector53 ++80105948 vector18 + 0000008a _binary_entryother_size + 80112780 cpus + 80103fe0 releasesleep +-80105bcd vector95 ++80105bfd vector95 + 801041a0 holding + 801109c0 sb + 801041e0 acquire +-8010618e vector226 ++801061be vector226 + 80101f20 nameiparent +-80105a2f vector49 +-80105a02 vector44 ++80105a5f vector49 ++80105a32 vector44 + 8011267c lapic +-80105b34 vector78 +-801053dd alltraps +-80105f12 vector173 +-80105c93 vector117 +-80105b58 vector82 +-8010615e vector222 +-801058cc vector8 +-80105df2 vector149 ++80105b64 vector78 ++8010540d alltraps ++80105f42 vector173 ++80105cc3 vector117 ++80105b88 vector82 ++8010618e vector222 ++801058fc vector8 ++80105e22 vector149 + 801015f0 iupdate + 80108000 data + 801042a0 memset +-801061d6 vector232 ++80106206 vector232 + 80102df0 main +-80106570 switchkvm +-80105c30 vector106 +-80106146 vector220 +-80105ba0 vector90 +-80105e9a vector163 +-801061ee vector234 ++801065a0 switchkvm ++80105c60 vector106 ++80106176 vector220 ++80105bd0 vector90 ++80105eca vector163 ++8010621e vector234 + 80102cb0 log_write + 80103f80 acquiresleep + 80104bd0 sys_unlink +-80105aa4 vector62 +-80105957 vector25 +-8010603e vector198 +-80105cae vector120 ++80105ad4 vector62 ++80105987 vector25 ++8010606e vector198 ++80105cde vector120 + 8010a48c _binary_entryother_start + 801023e0 kinit1 +-80105a38 vector50 +-801058ff vector15 +-80105e0a vector151 +-80105b61 vector83 +-80105b97 vector89 +-80105b8e vector88 +-801054d0 trap +-801053b0 sys_uptime +-80105f5a vector179 +-801059a8 vector34 +-80105a14 vector46 +-80105d3e vector134 +-8010616a vector223 ++80105a68 vector50 ++8010592f vector15 ++80105e3a vector151 ++80105b91 vector83 ++80105bc7 vector89 ++80105bbe vector88 ++80105500 trap ++801053e0 sys_uptime ++80105f8a vector179 ++801059d8 vector34 ++80105a44 vector46 ++80105d6e vector134 ++8010619a vector223 + 80114da0 idt +-8010612e vector218 ++8010615e vector218 + 801035e0 pinit +-801068d0 deallocuvm +-80106182 vector225 ++80106900 deallocuvm ++801061b2 vector225 + 80102760 lapicid +-80105fba vector187 ++80105fea vector187 + 801037e0 growproc + 80104020 holdingsleep + 80112d00 ncpu +-80105984 vector30 ++801059b4 vector30 + 801036d0 userinit + 801000d0 bread +-80105ced vector127 ++80105d1d vector127 + 801033e0 piperead + 801155a0 ticks +-80105ff6 vector192 +-80105ebe vector166 ++80106026 vector192 ++80105eee vector166 + 80100950 consoleinit +-80105b22 vector76 +-80105b19 vector75 ++80105b52 vector76 ++80105b49 vector75 + 80102080 ideintr +-8010601a vector195 +-80105dfe vector150 +-80105a80 vector58 +-80106296 vector248 +-80105cc9 vector123 +-80105bd6 vector96 +-8010598d vector31 +-8010607a vector203 +-80105d7a vector139 +-80105e22 vector153 +-80105ea6 vector164 ++8010604a vector195 ++80105e2e vector150 ++80105ab0 vector58 ++801062c6 vector248 ++80105cf9 vector123 ++80105c06 vector96 ++801059bd vector31 ++801060aa vector203 ++80105daa vector139 ++80105e52 vector153 ++80105ed6 vector164 + 80103e70 procdump +-80105cb7 vector121 +-80105780 uartputc +-801058b1 vector5 +-80105eca vector167 +-80105e3a vector155 +-801062a2 vector249 ++80105ce7 vector121 ++801057b0 uartputc ++801058e1 vector5 ++80105efa vector167 ++80105e6a vector155 ++801062d2 vector249 + 801001e0 brelse +-801062ae vector250 +-80105cd2 vector124 +-80105c54 vector110 +-80106086 vector204 ++801062de vector250 ++80105d02 vector124 ++80105c84 vector110 ++801060b6 vector204 + 801016b0 ilock + 80105080 sys_exec +-80105d62 vector137 ++80105d92 vector137 + 8010a460 _binary_initcode_start + 801044db swtch +-8010628a vector247 +-8010593c vector22 +-8010606e vector202 +-801064b0 seginit ++801062ba vector247 ++8010596c vector22 ++8010609e vector202 ++801064e0 seginit + 80101910 iunlockput +-80105afe vector72 +-80105a65 vector55 +-80105ce4 vector126 +-80105abf vector65 +-80105972 vector28 ++80105b2e vector72 ++80105a95 vector55 ++80105d14 vector126 ++80105aef vector65 ++801059a2 vector28 + 8010a516 _binary_entryother_end +-80105ee2 vector169 ++80105f12 vector169 + 801001a0 bwrite +-801061e2 vector233 +-801054a0 idtinit ++80106212 vector233 ++801054d0 idtinit + 80103aa0 exit + 80105250 sys_wait + 80105220 sys_exit + 80101e20 dirlink + 0000002c _binary_initcode_size +-80105dda vector147 ++80105e0a vector147 + 80103f40 initsleeplock + 80102000 ideinit +-80106720 loaduvm +-80105c1e vector104 +-80105c8a vector116 ++80106750 loaduvm ++80105c4e vector104 ++80105cba vector116 + 80112d20 ptable + 801022b0 ioapicenable + 80104130 popcli + 8010a008 vectors +-80105a4a vector52 +-80105911 vector17 +-80105f96 vector184 ++80105a7a vector52 ++80105941 vector17 ++80105fc6 vector184 + 801044c0 strlen + 80105170 sys_pipe + 80101470 iinit + 80103150 picinit +-801060aa vector207 +-801066a0 inituvm +-80105fde vector190 +-8010622a vector239 +-80105bc4 vector94 +-80105bbb vector93 ++801060da vector207 ++801066d0 inituvm ++8010600e vector190 ++8010625a vector239 ++80105bf4 vector94 ++80105beb vector93 + 80102a70 initlog +-80105fc6 vector188 +-80105a26 vector48 ++80105ff6 vector188 ++80105a56 vector48 + 80102120 iderw +-8010613a vector219 +-80105de6 vector148 +-80106152 vector221 ++8010616a vector219 ++80105e16 vector148 ++80106182 vector221 + 801024a0 kalloc + 80110960 devsw +-801052a0 sys_getpid +-80105b46 vector80 +-80105efa vector171 +-80105e2e vector154 +-801059ba vector36 ++801052d0 sys_getpid ++80105b76 vector80 ++80105f2a vector171 ++80105e5e vector154 ++801059ea vector36 + 80103170 pipealloc +-801061fa vector235 +-80105c27 vector105 ++8010622a vector235 ++80105c57 vector105 + 80104ff0 sys_chdir + 801109e0 icache +-80105dce vector146 +-80105fea vector191 +-80105c15 vector103 ++80105dfe vector146 ++8010601a vector191 ++80105c45 vector103 + 80104f60 sys_mknod + 801027b0 lapicstartap +-80106590 switchuvm ++801065c0 switchuvm + 801040f0 pushcli + 80102450 kinit2 +-801058e3 vector11 +-801058f8 vector14 ++80105913 vector11 ++80105928 vector14 + 80100ef0 filestat +diff --git a/kill.asm b/kill.asm +index 6ceed17..214df6a 100644 +--- a/kill.asm ++++ b/kill.asm +@@ -445,132 +445,106 @@ memmove(void *vdst, const void *vsrc, int n) + 289: c3 ret + + 0000028a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 28a: b8 01 00 00 00 mov $0x1,%eax + 28f: cd 40 int $0x40 + 291: c3 ret + + 00000292 : +-SYSCALL(exit) + 292: b8 02 00 00 00 mov $0x2,%eax + 297: cd 40 int $0x40 + 299: c3 ret + + 0000029a : +-SYSCALL(wait) + 29a: b8 03 00 00 00 mov $0x3,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + + 000002a2 : +-SYSCALL(pipe) + 2a2: b8 04 00 00 00 mov $0x4,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + + 000002aa : +-SYSCALL(read) + 2aa: b8 05 00 00 00 mov $0x5,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + + 000002b2 : +-SYSCALL(write) + 2b2: b8 10 00 00 00 mov $0x10,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + + 000002ba : +-SYSCALL(close) + 2ba: b8 15 00 00 00 mov $0x15,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + + 000002c2 : +-SYSCALL(kill) + 2c2: b8 06 00 00 00 mov $0x6,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + + 000002ca : +-SYSCALL(exec) + 2ca: b8 07 00 00 00 mov $0x7,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + + 000002d2 : +-SYSCALL(open) + 2d2: b8 0f 00 00 00 mov $0xf,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + + 000002da : +-SYSCALL(mknod) + 2da: b8 11 00 00 00 mov $0x11,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + + 000002e2 : +-SYSCALL(unlink) + 2e2: b8 12 00 00 00 mov $0x12,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + + 000002ea : +-SYSCALL(fstat) + 2ea: b8 08 00 00 00 mov $0x8,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + + 000002f2 : +-SYSCALL(link) + 2f2: b8 13 00 00 00 mov $0x13,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + + 000002fa : +-SYSCALL(mkdir) + 2fa: b8 14 00 00 00 mov $0x14,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + + 00000302 : +-SYSCALL(chdir) + 302: b8 09 00 00 00 mov $0x9,%eax + 307: cd 40 int $0x40 + 309: c3 ret + + 0000030a : +-SYSCALL(dup) + 30a: b8 0a 00 00 00 mov $0xa,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + + 00000312 : +-SYSCALL(getpid) + 312: b8 0b 00 00 00 mov $0xb,%eax + 317: cd 40 int $0x40 + 319: c3 ret + + 0000031a : +-SYSCALL(sbrk) + 31a: b8 0c 00 00 00 mov $0xc,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + + 00000322 : +-SYSCALL(sleep) + 322: b8 0d 00 00 00 mov $0xd,%eax + 327: cd 40 int $0x40 + 329: c3 ret + + 0000032a : +-SYSCALL(uptime) + 32a: b8 0e 00 00 00 mov $0xe,%eax + 32f: cd 40 int $0x40 + 331: c3 ret +diff --git a/kill.o b/kill.o +index 24e3a1d..50af6fc 100644 +Binary files a/kill.o and b/kill.o differ +diff --git a/lapic.o b/lapic.o +index 0d53d1d..425323d 100644 +Binary files a/lapic.o and b/lapic.o differ +diff --git a/ln.asm b/ln.asm +index ff0123f..385df16 100644 +--- a/ln.asm ++++ b/ln.asm +@@ -439,132 +439,106 @@ memmove(void *vdst, const void *vsrc, int n) + 299: c3 ret + + 0000029a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + + 000002a2 : +-SYSCALL(exit) + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + + 000002aa : +-SYSCALL(wait) + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + + 000002b2 : +-SYSCALL(pipe) + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + + 000002ba : +-SYSCALL(read) + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + + 000002c2 : +-SYSCALL(write) + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + + 000002ca : +-SYSCALL(close) + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + + 000002d2 : +-SYSCALL(kill) + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + + 000002da : +-SYSCALL(exec) + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + + 000002e2 : +-SYSCALL(open) + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + + 000002ea : +-SYSCALL(mknod) + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + + 000002f2 : +-SYSCALL(unlink) + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + + 000002fa : +-SYSCALL(fstat) + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + + 00000302 : +-SYSCALL(link) + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + + 0000030a : +-SYSCALL(mkdir) + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + + 00000312 : +-SYSCALL(chdir) + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + + 0000031a : +-SYSCALL(dup) + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + + 00000322 : +-SYSCALL(getpid) + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + + 0000032a : +-SYSCALL(sbrk) + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + + 00000332 : +-SYSCALL(sleep) + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + + 0000033a : +-SYSCALL(uptime) + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret +diff --git a/ln.o b/ln.o +index a656291..b532648 100644 +Binary files a/ln.o and b/ln.o differ +diff --git a/log.o b/log.o +index 153ceb7..447f2bd 100644 +Binary files a/log.o and b/log.o differ +diff --git a/ls.asm b/ls.asm +index edd7177..d5bfbdb 100644 +--- a/ls.asm ++++ b/ls.asm +@@ -690,132 +690,106 @@ memmove(void *vdst, const void *vsrc, int n) + 5a9: c3 ret + + 000005aa : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 5aa: b8 01 00 00 00 mov $0x1,%eax + 5af: cd 40 int $0x40 + 5b1: c3 ret + + 000005b2 : +-SYSCALL(exit) + 5b2: b8 02 00 00 00 mov $0x2,%eax + 5b7: cd 40 int $0x40 + 5b9: c3 ret + + 000005ba : +-SYSCALL(wait) + 5ba: b8 03 00 00 00 mov $0x3,%eax + 5bf: cd 40 int $0x40 + 5c1: c3 ret + + 000005c2 : +-SYSCALL(pipe) + 5c2: b8 04 00 00 00 mov $0x4,%eax + 5c7: cd 40 int $0x40 + 5c9: c3 ret + + 000005ca : +-SYSCALL(read) + 5ca: b8 05 00 00 00 mov $0x5,%eax + 5cf: cd 40 int $0x40 + 5d1: c3 ret + + 000005d2 : +-SYSCALL(write) + 5d2: b8 10 00 00 00 mov $0x10,%eax + 5d7: cd 40 int $0x40 + 5d9: c3 ret + + 000005da : +-SYSCALL(close) + 5da: b8 15 00 00 00 mov $0x15,%eax + 5df: cd 40 int $0x40 + 5e1: c3 ret + + 000005e2 : +-SYSCALL(kill) + 5e2: b8 06 00 00 00 mov $0x6,%eax + 5e7: cd 40 int $0x40 + 5e9: c3 ret + + 000005ea : +-SYSCALL(exec) + 5ea: b8 07 00 00 00 mov $0x7,%eax + 5ef: cd 40 int $0x40 + 5f1: c3 ret + + 000005f2 : +-SYSCALL(open) + 5f2: b8 0f 00 00 00 mov $0xf,%eax + 5f7: cd 40 int $0x40 + 5f9: c3 ret + + 000005fa : +-SYSCALL(mknod) + 5fa: b8 11 00 00 00 mov $0x11,%eax + 5ff: cd 40 int $0x40 + 601: c3 ret + + 00000602 : +-SYSCALL(unlink) + 602: b8 12 00 00 00 mov $0x12,%eax + 607: cd 40 int $0x40 + 609: c3 ret + + 0000060a : +-SYSCALL(fstat) + 60a: b8 08 00 00 00 mov $0x8,%eax + 60f: cd 40 int $0x40 + 611: c3 ret + + 00000612 : +-SYSCALL(link) + 612: b8 13 00 00 00 mov $0x13,%eax + 617: cd 40 int $0x40 + 619: c3 ret + + 0000061a : +-SYSCALL(mkdir) + 61a: b8 14 00 00 00 mov $0x14,%eax + 61f: cd 40 int $0x40 + 621: c3 ret + + 00000622 : +-SYSCALL(chdir) + 622: b8 09 00 00 00 mov $0x9,%eax + 627: cd 40 int $0x40 + 629: c3 ret + + 0000062a : +-SYSCALL(dup) + 62a: b8 0a 00 00 00 mov $0xa,%eax + 62f: cd 40 int $0x40 + 631: c3 ret + + 00000632 : +-SYSCALL(getpid) + 632: b8 0b 00 00 00 mov $0xb,%eax + 637: cd 40 int $0x40 + 639: c3 ret + + 0000063a : +-SYSCALL(sbrk) + 63a: b8 0c 00 00 00 mov $0xc,%eax + 63f: cd 40 int $0x40 + 641: c3 ret + + 00000642 : +-SYSCALL(sleep) + 642: b8 0d 00 00 00 mov $0xd,%eax + 647: cd 40 int $0x40 + 649: c3 ret + + 0000064a : +-SYSCALL(uptime) + 64a: b8 0e 00 00 00 mov $0xe,%eax + 64f: cd 40 int $0x40 + 651: c3 ret +diff --git a/ls.o b/ls.o +index d404964..e9be43b 100644 +Binary files a/ls.o and b/ls.o differ +diff --git a/main.o b/main.o +index 3dd7a07..3c7c71e 100644 +Binary files a/main.o and b/main.o differ +diff --git a/mkdir.asm b/mkdir.asm +index ea3076c..499ec60 100644 +--- a/mkdir.asm ++++ b/mkdir.asm +@@ -455,132 +455,106 @@ memmove(void *vdst, const void *vsrc, int n) + 299: c3 ret + + 0000029a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + + 000002a2 : +-SYSCALL(exit) + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + + 000002aa : +-SYSCALL(wait) + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + + 000002b2 : +-SYSCALL(pipe) + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + + 000002ba : +-SYSCALL(read) + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + + 000002c2 : +-SYSCALL(write) + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + + 000002ca : +-SYSCALL(close) + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + + 000002d2 : +-SYSCALL(kill) + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + + 000002da : +-SYSCALL(exec) + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + + 000002e2 : +-SYSCALL(open) + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + + 000002ea : +-SYSCALL(mknod) + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + + 000002f2 : +-SYSCALL(unlink) + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + + 000002fa : +-SYSCALL(fstat) + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + + 00000302 : +-SYSCALL(link) + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + + 0000030a : +-SYSCALL(mkdir) + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + + 00000312 : +-SYSCALL(chdir) + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + + 0000031a : +-SYSCALL(dup) + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + + 00000322 : +-SYSCALL(getpid) + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + + 0000032a : +-SYSCALL(sbrk) + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + + 00000332 : +-SYSCALL(sleep) + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + + 0000033a : +-SYSCALL(uptime) + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret +diff --git a/mkdir.o b/mkdir.o +index 026691f..d3eeeca 100644 +Binary files a/mkdir.o and b/mkdir.o differ +diff --git a/mp.o b/mp.o +index baae68d..c3c74d5 100644 +Binary files a/mp.o and b/mp.o differ +diff --git a/mycode.diff b/mycode.diff +index c091f0c..741a2da 100644 +--- a/mycode.diff ++++ b/mycode.diff +@@ -1,1745 +0,0 @@ +-diff --git a/cat.c b/cat.c +-index 5ddc820..ed1987d 100644 +---- a/cat.c +-+++ b/cat.c +-@@ -12,12 +12,12 @@ cat(int fd) +- while((n = read(fd, buf, sizeof(buf))) > 0) { +- if (write(1, buf, n) != n) { +- printf(1, "cat: write error\n"); +-- exit(); +-+ exit(0); +- } +- } +- if(n < 0){ +- printf(1, "cat: read error\n"); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -28,16 +28,16 @@ main(int argc, char *argv[]) +- +- if(argc <= 1){ +- cat(0); +-- exit(); +-+ exit(0); +- } +- +- for(i = 1; i < argc; i++){ +- if((fd = open(argv[i], 0)) < 0){ +- printf(1, "cat: cannot open %s\n", argv[i]); +-- exit(); +-+ exit(0); +- } +- cat(fd); +- close(fd); +- } +-- exit(); +-+ exit(0); +- } +-diff --git a/defs.h b/defs.h +-index 82fb982..94cda70 100644 +---- a/defs.h +-+++ b/defs.h +-@@ -104,7 +104,7 @@ int pipewrite(struct pipe*, char*, int); +- //PAGEBREAK: 16 +- // proc.c +- int cpuid(void); +--void exit(void); +-+void exit(int); //change to have status parameter +- int fork(void); +- int growproc(int); +- int kill(int); +-diff --git a/echo.c b/echo.c +-index 806dee0..eed68a0 100644 +---- a/echo.c +-+++ b/echo.c +-@@ -9,5 +9,5 @@ main(int argc, char *argv[]) +- +- for(i = 1; i < argc; i++) +- printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); +-- exit(); +-+ exit(0); +- } +-diff --git a/forktest.c b/forktest.c +-index 8bc984d..227810c 100644 +---- a/forktest.c +-+++ b/forktest.c +-@@ -25,24 +25,24 @@ forktest(void) +- if(pid < 0) +- break; +- if(pid == 0) +-- exit(); +-+ exit(0); +- } +- +- if(n == N){ +- printf(1, "fork claimed to work N times!\n", N); +-- exit(); +-+ exit(0); +- } +- +- for(; n > 0; n--){ +- if(wait() < 0){ +- printf(1, "wait stopped early\n"); +-- exit(); +-+ exit(0); +- } +- } +- +- if(wait() != -1){ +- printf(1, "wait got too many\n"); +-- exit(); +-+ exit(0); +- } +- +- printf(1, "fork test OK\n"); +-@@ -52,5 +52,5 @@ int +- main(void) +- { +- forktest(); +-- exit(); +-+ exit(0); +- } +-diff --git a/grep.c b/grep.c +-index adc4835..1aa1081 100644 +---- a/grep.c +-+++ b/grep.c +-@@ -43,24 +43,24 @@ main(int argc, char *argv[]) +- +- if(argc <= 1){ +- printf(2, "usage: grep pattern [file ...]\n"); +-- exit(); +-+ exit(0); +- } +- pattern = argv[1]; +- +- if(argc <= 2){ +- grep(pattern, 0); +-- exit(); +-+ exit(0); +- } +- +- for(i = 2; i < argc; i++){ +- if((fd = open(argv[i], 0)) < 0){ +- printf(1, "grep: cannot open %s\n", argv[i]); +-- exit(); +-+ exit(0); +- } +- grep(pattern, fd); +- close(fd); +- } +-- exit(); +-+ exit(0); +- } +- +- // Regexp matcher from Kernighan & Pike, +-diff --git a/hello.c b/hello.c +-index c5c30a6..702f187 100644 +---- a/hello.c +-+++ b/hello.c +-@@ -4,5 +4,5 @@ +- int main( int argc, char **argv) { +- +- printf(1, "Hello World!\n"); +-- exit(); +-+ exit(0); +- } +-diff --git a/init.c b/init.c +-index 046b551..dd46de4 100644 +---- a/init.c +-+++ b/init.c +-@@ -24,12 +24,12 @@ main(void) +- pid = fork(); +- if(pid < 0){ +- printf(1, "init: fork failed\n"); +-- exit(); +-+ exit(0); +- } +- if(pid == 0){ +- exec("sh", argv); +- printf(1, "init: exec sh failed\n"); +-- exit(); +-+ exit(0); +- } +- while((wpid=wait()) >= 0 && wpid != pid) +- printf(1, "zombie!\n"); +-diff --git a/initcode.S b/initcode.S +-index 80ac5d8..b8229b8 100644 +---- a/initcode.S +-+++ b/initcode.S +-@@ -14,7 +14,7 @@ start: +- movl $SYS_exec, %eax +- int $T_SYSCALL +- +--# for(;;) exit(); +-+# for(;;) exit(0); +- exit: +- movl $SYS_exit, %eax +- int $T_SYSCALL +-diff --git a/kill.c b/kill.c +-index 364f6af..5a2e450 100644 +---- a/kill.c +-+++ b/kill.c +-@@ -9,9 +9,9 @@ main(int argc, char **argv) +- +- if(argc < 2){ +- printf(2, "usage: kill pid...\n"); +-- exit(); +-+ exit(0); +- } +- for(i=1; itype){ +- default: +-@@ -74,7 +74,7 @@ runcmd(struct cmd *cmd) +- case EXEC: +- ecmd = (struct execcmd*)cmd; +- if(ecmd->argv[0] == 0) +-- exit(); +-+ exit(0); +- exec(ecmd->argv[0], ecmd->argv); +- printf(2, "exec %s failed\n", ecmd->argv[0]); +- break; +-@@ -84,7 +84,7 @@ runcmd(struct cmd *cmd) +- close(rcmd->fd); +- if(open(rcmd->file, rcmd->mode) < 0){ +- printf(2, "open %s failed\n", rcmd->file); +-- exit(); +-+ exit(0); +- } +- runcmd(rcmd->cmd); +- break; +-@@ -127,7 +127,7 @@ runcmd(struct cmd *cmd) +- runcmd(bcmd->cmd); +- break; +- } +-- exit(); +-+ exit(0); +- } +- +- int +-@@ -168,14 +168,14 @@ main(void) +- runcmd(parsecmd(buf)); +- wait(); +- } +-- exit(); +-+ exit(0); +- } +- +- void +- panic(char *s) +- { +- printf(2, "%s\n", s); +-- exit(); +-+ exit(0); +- } +- +- int +-diff --git a/stressfs.c b/stressfs.c +-index c0a4743..8829be2 100644 +---- a/stressfs.c +-+++ b/stressfs.c +-@@ -45,5 +45,5 @@ main(int argc, char *argv[]) +- +- wait(); +- +-- exit(); +-+ exit(0); +- } +-diff --git a/sysproc.c b/sysproc.c +-index 0686d29..1ccc484 100644 +---- a/sysproc.c +-+++ b/sysproc.c +-@@ -16,7 +16,9 @@ sys_fork(void) +- int +- sys_exit(void) +- { +-- exit(); +-+ int status; +-+ argint(0, &status); +-+ exit(status); +- return 0; // not reached +- } +- +-diff --git a/trap.c b/trap.c +-index 41c66eb..dbc9f6f 100644 +---- a/trap.c +-+++ b/trap.c +-@@ -38,11 +38,11 @@ trap(struct trapframe *tf) +- { +- if(tf->trapno == T_SYSCALL){ +- if(myproc()->killed) +-- exit(); +-+ exit(0); +- myproc()->tf = tf; +- syscall(); +- if(myproc()->killed) +-- exit(); +-+ exit(0); +- return; +- } +- +-@@ -98,7 +98,7 @@ trap(struct trapframe *tf) +- // (If it is still executing in the kernel, let it keep running +- // until it gets to the regular system call return.) +- if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +-- exit(); +-+ exit(0); +- +- // Force process to give up CPU on clock tick. +- // If interrupts were on while locks held, would need to check nlock. +-@@ -108,5 +108,5 @@ trap(struct trapframe *tf) +- +- // Check if the process has been killed since we yielded +- if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) +-- exit(); +-+ exit(0); +- } +-diff --git a/user.h b/user.h +-index 4f99c52..3498e6d 100644 +---- a/user.h +-+++ b/user.h +-@@ -3,7 +3,7 @@ struct rtcdate; +- +- // system calls +- int fork(void); +--int exit(void) __attribute__((noreturn)); +-+int exit(int) __attribute__((noreturn)); +- int wait(void); +- int pipe(int*); +- int write(int, const void*, int); +-diff --git a/usertests.c b/usertests.c +-index a1e97e7..d25d9ef 100644 +---- a/usertests.c +-+++ b/usertests.c +-@@ -21,24 +21,24 @@ iputtest(void) +- +- if(mkdir("iputdir") < 0){ +- printf(stdout, "mkdir failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("iputdir") < 0){ +- printf(stdout, "chdir iputdir failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("../iputdir") < 0){ +- printf(stdout, "unlink ../iputdir failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("/") < 0){ +- printf(stdout, "chdir / failed\n"); +-- exit(); +-+ exit(0); +- } +- printf(stdout, "iput test ok\n"); +- } +- +--// does exit() call iput(p->cwd) in a transaction? +-+// does exit(0) call iput(p->cwd) in a transaction? +- void +- exitiputtest(void) +- { +-@@ -49,22 +49,22 @@ exitiputtest(void) +- pid = fork(); +- if(pid < 0){ +- printf(stdout, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- if(pid == 0){ +- if(mkdir("iputdir") < 0){ +- printf(stdout, "mkdir failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("iputdir") < 0){ +- printf(stdout, "child chdir failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("../iputdir") < 0){ +- printf(stdout, "unlink ../iputdir failed\n"); +-- exit(); +-+ exit(0); +- } +-- exit(); +-+ exit(0); +- } +- wait(); +- printf(stdout, "exitiput test ok\n"); +-@@ -89,25 +89,25 @@ openiputtest(void) +- printf(stdout, "openiput test\n"); +- if(mkdir("oidir") < 0){ +- printf(stdout, "mkdir oidir failed\n"); +-- exit(); +-+ exit(0); +- } +- pid = fork(); +- if(pid < 0){ +- printf(stdout, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- if(pid == 0){ +- int fd = open("oidir", O_RDWR); +- if(fd >= 0){ +- printf(stdout, "open directory for write succeeded\n"); +-- exit(); +-+ exit(0); +- } +-- exit(); +-+ exit(0); +- } +- sleep(1); +- if(unlink("oidir") != 0){ +- printf(stdout, "unlink failed\n"); +-- exit(); +-+ exit(0); +- } +- wait(); +- printf(stdout, "openiput test ok\n"); +-@@ -124,13 +124,13 @@ opentest(void) +- fd = open("echo", 0); +- if(fd < 0){ +- printf(stdout, "open echo failed!\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- fd = open("doesnotexist", 0); +- if(fd >= 0){ +- printf(stdout, "open doesnotexist succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- printf(stdout, "open test ok\n"); +- } +-@@ -147,16 +147,16 @@ writetest(void) +- printf(stdout, "creat small succeeded; ok\n"); +- } else { +- printf(stdout, "error: creat small failed!\n"); +-- exit(); +-+ exit(0); +- } +- for(i = 0; i < 100; i++){ +- if(write(fd, "aaaaaaaaaa", 10) != 10){ +- printf(stdout, "error: write aa %d new file failed\n", i); +-- exit(); +-+ exit(0); +- } +- if(write(fd, "bbbbbbbbbb", 10) != 10){ +- printf(stdout, "error: write bb %d new file failed\n", i); +-- exit(); +-+ exit(0); +- } +- } +- printf(stdout, "writes ok\n"); +-@@ -166,20 +166,20 @@ writetest(void) +- printf(stdout, "open small succeeded ok\n"); +- } else { +- printf(stdout, "error: open small failed!\n"); +-- exit(); +-+ exit(0); +- } +- i = read(fd, buf, 2000); +- if(i == 2000){ +- printf(stdout, "read succeeded ok\n"); +- } else { +- printf(stdout, "read failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +- if(unlink("small") < 0){ +- printf(stdout, "unlink small failed\n"); +-- exit(); +-+ exit(0); +- } +- printf(stdout, "small file test ok\n"); +- } +-@@ -194,14 +194,14 @@ writetest1(void) +- fd = open("big", O_CREATE|O_RDWR); +- if(fd < 0){ +- printf(stdout, "error: creat big failed!\n"); +-- exit(); +-+ exit(0); +- } +- +- for(i = 0; i < MAXFILE; i++){ +- ((int*)buf)[0] = i; +- if(write(fd, buf, 512) != 512){ +- printf(stdout, "error: write big file failed\n", i); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -210,7 +210,7 @@ writetest1(void) +- fd = open("big", O_RDONLY); +- if(fd < 0){ +- printf(stdout, "error: open big failed!\n"); +-- exit(); +-+ exit(0); +- } +- +- n = 0; +-@@ -219,24 +219,24 @@ writetest1(void) +- if(i == 0){ +- if(n == MAXFILE - 1){ +- printf(stdout, "read only %d blocks from big", n); +-- exit(); +-+ exit(0); +- } +- break; +- } else if(i != 512){ +- printf(stdout, "read failed %d\n", i); +-- exit(); +-+ exit(0); +- } +- if(((int*)buf)[0] != n){ +- printf(stdout, "read content of block %d is %d\n", +- n, ((int*)buf)[0]); +-- exit(); +-+ exit(0); +- } +- n++; +- } +- close(fd); +- if(unlink("big") < 0){ +- printf(stdout, "unlink big failed\n"); +-- exit(); +-+ exit(0); +- } +- printf(stdout, "big files ok\n"); +- } +-@@ -270,22 +270,22 @@ void dirtest(void) +- +- if(mkdir("dir0") < 0){ +- printf(stdout, "mkdir failed\n"); +-- exit(); +-+ exit(0); +- } +- +- if(chdir("dir0") < 0){ +- printf(stdout, "chdir dir0 failed\n"); +-- exit(); +-+ exit(0); +- } +- +- if(chdir("..") < 0){ +- printf(stdout, "chdir .. failed\n"); +-- exit(); +-+ exit(0); +- } +- +- if(unlink("dir0") < 0){ +- printf(stdout, "unlink dir0 failed\n"); +-- exit(); +-+ exit(0); +- } +- printf(stdout, "mkdir test ok\n"); +- } +-@@ -296,7 +296,7 @@ exectest(void) +- printf(stdout, "exec test\n"); +- if(exec("echo", echoargv) < 0){ +- printf(stdout, "exec echo failed\n"); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -310,7 +310,7 @@ pipe1(void) +- +- if(pipe(fds) != 0){ +- printf(1, "pipe() failed\n"); +-- exit(); +-+ exit(0); +- } +- pid = fork(); +- seq = 0; +-@@ -321,10 +321,10 @@ pipe1(void) +- buf[i] = seq++; +- if(write(fds[1], buf, 1033) != 1033){ +- printf(1, "pipe1 oops 1\n"); +-- exit(); +-+ exit(0); +- } +- } +-- exit(); +-+ exit(0); +- } else if(pid > 0){ +- close(fds[1]); +- total = 0; +-@@ -343,13 +343,13 @@ pipe1(void) +- } +- if(total != 5 * 1033){ +- printf(1, "pipe1 oops 3 total %d\n", total); +-- exit(); +-+ exit(0); +- } +- close(fds[0]); +- wait(); +- } else { +- printf(1, "fork() failed\n"); +-- exit(); +-+ exit(0); +- } +- printf(1, "pipe1 ok\n"); +- } +-@@ -418,7 +418,7 @@ exitwait(void) +- return; +- } +- } else { +-- exit(); +-+ exit(0); +- } +- } +- printf(1, "exitwait ok\n"); +-@@ -447,11 +447,11 @@ mem(void) +- if(m1 == 0){ +- printf(1, "couldn't allocate mem?!!\n"); +- kill(ppid); +-- exit(); +-+ exit(0); +- } +- free(m1); +- printf(1, "mem ok\n"); +-- exit(); +-+ exit(0); +- } else { +- wait(); +- } +-@@ -484,7 +484,7 @@ sharedfd(void) +- } +- } +- if(pid == 0) +-- exit(); +-+ exit(0); +- else +- wait(); +- close(fd); +-@@ -508,7 +508,7 @@ sharedfd(void) +- printf(1, "sharedfd ok\n"); +- } else { +- printf(1, "sharedfd oops %d %d\n", nc, np); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -530,24 +530,24 @@ fourfiles(void) +- pid = fork(); +- if(pid < 0){ +- printf(1, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- +- if(pid == 0){ +- fd = open(fname, O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "create failed\n"); +-- exit(); +-+ exit(0); +- } +- +- memset(buf, '0'+pi, 512); +- for(i = 0; i < 12; i++){ +- if((n = write(fd, buf, 500)) != 500){ +- printf(1, "write failed %d\n", n); +-- exit(); +-+ exit(0); +- } +- } +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -563,7 +563,7 @@ fourfiles(void) +- for(j = 0; j < n; j++){ +- if(buf[j] != '0'+i){ +- printf(1, "wrong char\n"); +-- exit(); +-+ exit(0); +- } +- } +- total += n; +-@@ -571,7 +571,7 @@ fourfiles(void) +- close(fd); +- if(total != 12*500){ +- printf(1, "wrong length %d\n", total); +-- exit(); +-+ exit(0); +- } +- unlink(fname); +- } +-@@ -593,7 +593,7 @@ createdelete(void) +- pid = fork(); +- if(pid < 0){ +- printf(1, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- +- if(pid == 0){ +-@@ -604,18 +604,18 @@ createdelete(void) +- fd = open(name, O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "create failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- if(i > 0 && (i % 2 ) == 0){ +- name[1] = '0' + (i / 2); +- if(unlink(name) < 0){ +- printf(1, "unlink failed\n"); +-- exit(); +-+ exit(0); +- } +- } +- } +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -631,10 +631,10 @@ createdelete(void) +- fd = open(name, 0); +- if((i == 0 || i >= N/2) && fd < 0){ +- printf(1, "oops createdelete %s didn't exist\n", name); +-- exit(); +-+ exit(0); +- } else if((i >= 1 && i < N/2) && fd >= 0){ +- printf(1, "oops createdelete %s did exist\n", name); +-- exit(); +-+ exit(0); +- } +- if(fd >= 0) +- close(fd); +-@@ -662,7 +662,7 @@ unlinkread(void) +- fd = open("unlinkread", O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "create unlinkread failed\n"); +-- exit(); +-+ exit(0); +- } +- write(fd, "hello", 5); +- close(fd); +-@@ -670,11 +670,11 @@ unlinkread(void) +- fd = open("unlinkread", O_RDWR); +- if(fd < 0){ +- printf(1, "open unlinkread failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("unlinkread") != 0){ +- printf(1, "unlink unlinkread failed\n"); +-- exit(); +-+ exit(0); +- } +- +- fd1 = open("unlinkread", O_CREATE | O_RDWR); +-@@ -683,15 +683,15 @@ unlinkread(void) +- +- if(read(fd, buf, sizeof(buf)) != 5){ +- printf(1, "unlinkread read failed"); +-- exit(); +-+ exit(0); +- } +- if(buf[0] != 'h'){ +- printf(1, "unlinkread wrong data\n"); +-- exit(); +-+ exit(0); +- } +- if(write(fd, buf, 10) != 10){ +- printf(1, "unlinkread write failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- unlink("unlinkread"); +-@@ -711,50 +711,50 @@ linktest(void) +- fd = open("lf1", O_CREATE|O_RDWR); +- if(fd < 0){ +- printf(1, "create lf1 failed\n"); +-- exit(); +-+ exit(0); +- } +- if(write(fd, "hello", 5) != 5){ +- printf(1, "write lf1 failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +- if(link("lf1", "lf2") < 0){ +- printf(1, "link lf1 lf2 failed\n"); +-- exit(); +-+ exit(0); +- } +- unlink("lf1"); +- +- if(open("lf1", 0) >= 0){ +- printf(1, "unlinked lf1 but it is still there!\n"); +-- exit(); +-+ exit(0); +- } +- +- fd = open("lf2", 0); +- if(fd < 0){ +- printf(1, "open lf2 failed\n"); +-- exit(); +-+ exit(0); +- } +- if(read(fd, buf, sizeof(buf)) != 5){ +- printf(1, "read lf2 failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +- if(link("lf2", "lf2") >= 0){ +- printf(1, "link lf2 lf2 succeeded! oops\n"); +-- exit(); +-+ exit(0); +- } +- +- unlink("lf2"); +- if(link("lf2", "lf1") >= 0){ +- printf(1, "link non-existant succeeded! oops\n"); +-- exit(); +-+ exit(0); +- } +- +- if(link(".", "lf1") >= 0){ +- printf(1, "link . lf1 succeeded! oops\n"); +-- exit(); +-+ exit(0); +- } +- +- printf(1, "linktest ok\n"); +-@@ -787,12 +787,12 @@ concreate(void) +- fd = open(file, O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "concreate create %s failed\n", file); +-- exit(); +-+ exit(0); +- } +- close(fd); +- } +- if(pid == 0) +-- exit(); +-+ exit(0); +- else +- wait(); +- } +-@@ -807,11 +807,11 @@ concreate(void) +- i = de.name[1] - '0'; +- if(i < 0 || i >= sizeof(fa)){ +- printf(1, "concreate weird file %s\n", de.name); +-- exit(); +-+ exit(0); +- } +- if(fa[i]){ +- printf(1, "concreate duplicate file %s\n", de.name); +-- exit(); +-+ exit(0); +- } +- fa[i] = 1; +- n++; +-@@ -821,7 +821,7 @@ concreate(void) +- +- if(n != 40){ +- printf(1, "concreate not enough files in directory listing\n"); +-- exit(); +-+ exit(0); +- } +- +- for(i = 0; i < 40; i++){ +-@@ -829,7 +829,7 @@ concreate(void) +- pid = fork(); +- if(pid < 0){ +- printf(1, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- if(((i % 3) == 0 && pid == 0) || +- ((i % 3) == 1 && pid != 0)){ +-@@ -844,7 +844,7 @@ concreate(void) +- unlink(file); +- } +- if(pid == 0) +-- exit(); +-+ exit(0); +- else +- wait(); +- } +-@@ -865,7 +865,7 @@ linkunlink() +- pid = fork(); +- if(pid < 0){ +- printf(1, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- +- unsigned int x = (pid ? 1 : 97); +-@@ -883,7 +883,7 @@ linkunlink() +- if(pid) +- wait(); +- else +-- exit(); +-+ exit(0); +- +- printf(1, "linkunlink ok\n"); +- } +-@@ -901,7 +901,7 @@ bigdir(void) +- fd = open("bd", O_CREATE); +- if(fd < 0){ +- printf(1, "bigdir create failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +-@@ -912,7 +912,7 @@ bigdir(void) +- name[3] = '\0'; +- if(link("bd", name) != 0){ +- printf(1, "bigdir link failed\n"); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -924,7 +924,7 @@ bigdir(void) +- name[3] = '\0'; +- if(unlink(name) != 0){ +- printf(1, "bigdir unlink failed"); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -941,31 +941,31 @@ subdir(void) +- unlink("ff"); +- if(mkdir("dd") != 0){ +- printf(1, "subdir mkdir dd failed\n"); +-- exit(); +-+ exit(0); +- } +- +- fd = open("dd/ff", O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "create dd/ff failed\n"); +-- exit(); +-+ exit(0); +- } +- write(fd, "ff", 2); +- close(fd); +- +- if(unlink("dd") >= 0){ +- printf(1, "unlink dd (non-empty dir) succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- +- if(mkdir("/dd/dd") != 0){ +- printf(1, "subdir mkdir dd/dd failed\n"); +-- exit(); +-+ exit(0); +- } +- +- fd = open("dd/dd/ff", O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "create dd/dd/ff failed\n"); +-- exit(); +-+ exit(0); +- } +- write(fd, "FF", 2); +- close(fd); +-@@ -973,142 +973,142 @@ subdir(void) +- fd = open("dd/dd/../ff", 0); +- if(fd < 0){ +- printf(1, "open dd/dd/../ff failed\n"); +-- exit(); +-+ exit(0); +- } +- cc = read(fd, buf, sizeof(buf)); +- if(cc != 2 || buf[0] != 'f'){ +- printf(1, "dd/dd/../ff wrong content\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +- if(link("dd/dd/ff", "dd/dd/ffff") != 0){ +- printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); +-- exit(); +-+ exit(0); +- } +- +- if(unlink("dd/dd/ff") != 0){ +- printf(1, "unlink dd/dd/ff failed\n"); +-- exit(); +-+ exit(0); +- } +- if(open("dd/dd/ff", O_RDONLY) >= 0){ +- printf(1, "open (unlinked) dd/dd/ff succeeded\n"); +-- exit(); +-+ exit(0); +- } +- +- if(chdir("dd") != 0){ +- printf(1, "chdir dd failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("dd/../../dd") != 0){ +- printf(1, "chdir dd/../../dd failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("dd/../../../dd") != 0){ +- printf(1, "chdir dd/../../dd failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("./..") != 0){ +- printf(1, "chdir ./.. failed\n"); +-- exit(); +-+ exit(0); +- } +- +- fd = open("dd/dd/ffff", 0); +- if(fd < 0){ +- printf(1, "open dd/dd/ffff failed\n"); +-- exit(); +-+ exit(0); +- } +- if(read(fd, buf, sizeof(buf)) != 2){ +- printf(1, "read dd/dd/ffff wrong len\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +- if(open("dd/dd/ff", O_RDONLY) >= 0){ +- printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- +- if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){ +- printf(1, "create dd/ff/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){ +- printf(1, "create dd/xx/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(open("dd", O_CREATE) >= 0){ +- printf(1, "create dd succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(open("dd", O_RDWR) >= 0){ +- printf(1, "open dd rdwr succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(open("dd", O_WRONLY) >= 0){ +- printf(1, "open dd wronly succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(link("dd/ff/ff", "dd/dd/xx") == 0){ +- printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(link("dd/xx/ff", "dd/dd/xx") == 0){ +- printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(link("dd/ff", "dd/dd/ffff") == 0){ +- printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(mkdir("dd/ff/ff") == 0){ +- printf(1, "mkdir dd/ff/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(mkdir("dd/xx/ff") == 0){ +- printf(1, "mkdir dd/xx/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(mkdir("dd/dd/ffff") == 0){ +- printf(1, "mkdir dd/dd/ffff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dd/xx/ff") == 0){ +- printf(1, "unlink dd/xx/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dd/ff/ff") == 0){ +- printf(1, "unlink dd/ff/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("dd/ff") == 0){ +- printf(1, "chdir dd/ff succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("dd/xx") == 0){ +- printf(1, "chdir dd/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- +- if(unlink("dd/dd/ffff") != 0){ +- printf(1, "unlink dd/dd/ff failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dd/ff") != 0){ +- printf(1, "unlink dd/ff failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dd") == 0){ +- printf(1, "unlink non-empty dd succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dd/dd") < 0){ +- printf(1, "unlink dd/dd failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dd") < 0){ +- printf(1, "unlink dd failed\n"); +-- exit(); +-+ exit(0); +- } +- +- printf(1, "subdir ok\n"); +-@@ -1127,14 +1127,14 @@ bigwrite(void) +- fd = open("bigwrite", O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "cannot create bigwrite\n"); +-- exit(); +-+ exit(0); +- } +- int i; +- for(i = 0; i < 2; i++){ +- int cc = write(fd, buf, sz); +- if(cc != sz){ +- printf(1, "write(%d) ret %d\n", sz, cc); +-- exit(); +-+ exit(0); +- } +- } +- close(fd); +-@@ -1155,13 +1155,13 @@ bigfile(void) +- fd = open("bigfile", O_CREATE | O_RDWR); +- if(fd < 0){ +- printf(1, "cannot create bigfile"); +-- exit(); +-+ exit(0); +- } +- for(i = 0; i < 20; i++){ +- memset(buf, i, 600); +- if(write(fd, buf, 600) != 600){ +- printf(1, "write bigfile failed\n"); +-- exit(); +-+ exit(0); +- } +- } +- close(fd); +-@@ -1169,31 +1169,31 @@ bigfile(void) +- fd = open("bigfile", 0); +- if(fd < 0){ +- printf(1, "cannot open bigfile\n"); +-- exit(); +-+ exit(0); +- } +- total = 0; +- for(i = 0; ; i++){ +- cc = read(fd, buf, 300); +- if(cc < 0){ +- printf(1, "read bigfile failed\n"); +-- exit(); +-+ exit(0); +- } +- if(cc == 0) +- break; +- if(cc != 300){ +- printf(1, "short read bigfile\n"); +-- exit(); +-+ exit(0); +- } +- if(buf[0] != i/2 || buf[299] != i/2){ +- printf(1, "read bigfile wrong data\n"); +-- exit(); +-+ exit(0); +- } +- total += cc; +- } +- close(fd); +- if(total != 20*600){ +- printf(1, "read bigfile wrong total\n"); +-- exit(); +-+ exit(0); +- } +- unlink("bigfile"); +- +-@@ -1210,32 +1210,32 @@ fourteen(void) +- +- if(mkdir("12345678901234") != 0){ +- printf(1, "mkdir 12345678901234 failed\n"); +-- exit(); +-+ exit(0); +- } +- if(mkdir("12345678901234/123456789012345") != 0){ +- printf(1, "mkdir 12345678901234/123456789012345 failed\n"); +-- exit(); +-+ exit(0); +- } +- fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); +- if(fd < 0){ +- printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- fd = open("12345678901234/12345678901234/12345678901234", 0); +- if(fd < 0){ +- printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +- if(mkdir("12345678901234/12345678901234") == 0){ +- printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(mkdir("123456789012345/12345678901234") == 0){ +- printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- +- printf(1, "fourteen ok\n"); +-@@ -1247,35 +1247,35 @@ rmdot(void) +- printf(1, "rmdot test\n"); +- if(mkdir("dots") != 0){ +- printf(1, "mkdir dots failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("dots") != 0){ +- printf(1, "chdir dots failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink(".") == 0){ +- printf(1, "rm . worked!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("..") == 0){ +- printf(1, "rm .. worked!\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("/") != 0){ +- printf(1, "chdir / failed\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dots/.") == 0){ +- printf(1, "unlink dots/. worked!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dots/..") == 0){ +- printf(1, "unlink dots/.. worked!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dots") != 0){ +- printf(1, "unlink dots failed!\n"); +-- exit(); +-+ exit(0); +- } +- printf(1, "rmdot ok\n"); +- } +-@@ -1290,49 +1290,49 @@ dirfile(void) +- fd = open("dirfile", O_CREATE); +- if(fd < 0){ +- printf(1, "create dirfile failed\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- if(chdir("dirfile") == 0){ +- printf(1, "chdir dirfile succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- fd = open("dirfile/xx", 0); +- if(fd >= 0){ +- printf(1, "create dirfile/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- fd = open("dirfile/xx", O_CREATE); +- if(fd >= 0){ +- printf(1, "create dirfile/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(mkdir("dirfile/xx") == 0){ +- printf(1, "mkdir dirfile/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dirfile/xx") == 0){ +- printf(1, "unlink dirfile/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(link("README", "dirfile/xx") == 0){ +- printf(1, "link to dirfile/xx succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- if(unlink("dirfile") != 0){ +- printf(1, "unlink dirfile failed!\n"); +-- exit(); +-+ exit(0); +- } +- +- fd = open(".", O_RDWR); +- if(fd >= 0){ +- printf(1, "open . for writing succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- fd = open(".", 0); +- if(write(fd, "x", 1) > 0){ +- printf(1, "write . succeeded!\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- +-@@ -1351,11 +1351,11 @@ iref(void) +- for(i = 0; i < 50 + 1; i++){ +- if(mkdir("irefd") != 0){ +- printf(1, "mkdir irefd failed\n"); +-- exit(); +-+ exit(0); +- } +- if(chdir("irefd") != 0){ +- printf(1, "chdir irefd failed\n"); +-- exit(); +-+ exit(0); +- } +- +- mkdir(""); +-@@ -1388,24 +1388,24 @@ forktest(void) +- if(pid < 0) +- break; +- if(pid == 0) +-- exit(); +-+ exit(0); +- } +- +- if(n == 1000){ +- printf(1, "fork claimed to work 1000 times!\n"); +-- exit(); +-+ exit(0); +- } +- +- for(; n > 0; n--){ +- if(wait() < 0){ +- printf(1, "wait stopped early\n"); +-- exit(); +-+ exit(0); +- } +- } +- +- if(wait() != -1){ +- printf(1, "wait got too many\n"); +-- exit(); +-+ exit(0); +- } +- +- printf(1, "fork test OK\n"); +-@@ -1428,7 +1428,7 @@ sbrktest(void) +- b = sbrk(1); +- if(b != a){ +- printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); +-- exit(); +-+ exit(0); +- } +- *b = 1; +- a = b + 1; +-@@ -1436,16 +1436,16 @@ sbrktest(void) +- pid = fork(); +- if(pid < 0){ +- printf(stdout, "sbrk test fork failed\n"); +-- exit(); +-+ exit(0); +- } +- c = sbrk(1); +- c = sbrk(1); +- if(c != a + 1){ +- printf(stdout, "sbrk test failed post-fork\n"); +-- exit(); +-+ exit(0); +- } +- if(pid == 0) +-- exit(); +-+ exit(0); +- wait(); +- +- // can one grow address space to something big? +-@@ -1455,7 +1455,7 @@ sbrktest(void) +- p = sbrk(amt); +- if (p != a) { +- printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); +-- exit(); +-+ exit(0); +- } +- lastaddr = (char*) (BIG-1); +- *lastaddr = 99; +-@@ -1465,12 +1465,12 @@ sbrktest(void) +- c = sbrk(-4096); +- if(c == (char*)0xffffffff){ +- printf(stdout, "sbrk could not deallocate\n"); +-- exit(); +-+ exit(0); +- } +- c = sbrk(0); +- if(c != a - 4096){ +- printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); +-- exit(); +-+ exit(0); +- } +- +- // can one re-allocate that page? +-@@ -1478,19 +1478,19 @@ sbrktest(void) +- c = sbrk(4096); +- if(c != a || sbrk(0) != a + 4096){ +- printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); +-- exit(); +-+ exit(0); +- } +- if(*lastaddr == 99){ +- // should be zero +- printf(stdout, "sbrk de-allocation didn't really deallocate\n"); +-- exit(); +-+ exit(0); +- } +- +- a = sbrk(0); +- c = sbrk(-(sbrk(0) - oldbrk)); +- if(c != a){ +- printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); +-- exit(); +-+ exit(0); +- } +- +- // can we read the kernel's memory? +-@@ -1499,12 +1499,12 @@ sbrktest(void) +- pid = fork(); +- if(pid < 0){ +- printf(stdout, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- if(pid == 0){ +- printf(stdout, "oops could read %x = %x\n", a, *a); +- kill(ppid); +-- exit(); +-+ exit(0); +- } +- wait(); +- } +-@@ -1513,7 +1513,7 @@ sbrktest(void) +- // failed allocation? +- if(pipe(fds) != 0){ +- printf(1, "pipe() failed\n"); +-- exit(); +-+ exit(0); +- } +- for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ +- if((pids[i] = fork()) == 0){ +-@@ -1537,7 +1537,7 @@ sbrktest(void) +- } +- if(c == (char*)0xffffffff){ +- printf(stdout, "failed sbrk leaked memory\n"); +-- exit(); +-+ exit(0); +- } +- +- if(sbrk(0) > oldbrk) +-@@ -1572,7 +1572,7 @@ validatetest(void) +- if((pid = fork()) == 0){ +- // try to crash the kernel by passing in a badly placed integer +- validateint((int*)p); +-- exit(); +-+ exit(0); +- } +- sleep(0); +- sleep(0); +-@@ -1582,7 +1582,7 @@ validatetest(void) +- // try to crash the kernel by passing in a bad string pointer +- if(link("nosuchfile", (char*)p) != -1){ +- printf(stdout, "link should not succeed\n"); +-- exit(); +-+ exit(0); +- } +- } +- +-@@ -1600,7 +1600,7 @@ bsstest(void) +- for(i = 0; i < sizeof(uninit); i++){ +- if(uninit[i] != '\0'){ +- printf(stdout, "bss test failed\n"); +-- exit(); +-+ exit(0); +- } +- } +- printf(stdout, "bss test ok\n"); +-@@ -1627,16 +1627,16 @@ bigargtest(void) +- printf(stdout, "bigarg test ok\n"); +- fd = open("bigarg-ok", O_CREATE); +- close(fd); +-- exit(); +-+ exit(0); +- } else if(pid < 0){ +- printf(stdout, "bigargtest: fork failed\n"); +-- exit(); +-+ exit(0); +- } +- wait(); +- fd = open("bigarg-ok", 0); +- if(fd < 0){ +- printf(stdout, "bigarg test failed!\n"); +-- exit(); +-+ exit(0); +- } +- close(fd); +- unlink("bigarg-ok"); +-@@ -1715,10 +1715,10 @@ uio() +- port = RTC_DATA; +- asm volatile("inb %1,%0" : "=a" (val) : "d" (port)); +- printf(1, "uio: uio succeeded; test FAILED\n"); +-- exit(); +-+ exit(0); +- } else if(pid < 0){ +- printf (1, "fork failed\n"); +-- exit(); +-+ exit(0); +- } +- wait(); +- printf(1, "uio test done\n"); +-@@ -1730,7 +1730,7 @@ void argptest() +- fd = open("init", O_RDONLY); +- if (fd < 0) { +- printf(2, "open failed\n"); +-- exit(); +-+ exit(0); +- } +- read(fd, sbrk(0) - 1, -1); +- close(fd); +-@@ -1752,7 +1752,7 @@ main(int argc, char *argv[]) +- +- if(open("usertests.ran", 0) >= 0){ +- printf(1, "already ran user tests -- rebuild fs.img\n"); +-- exit(); +-+ exit(0); +- } +- close(open("usertests.ran", O_CREATE)); +- +-@@ -1799,5 +1799,5 @@ main(int argc, char *argv[]) +- +- exectest(); +- +-- exit(); +-+ exit(0); +- } +-diff --git a/wc.c b/wc.c +-index d6a54df..1d4f708 100644 +---- a/wc.c +-+++ b/wc.c +-@@ -27,7 +27,7 @@ wc(int fd, char *name) +- } +- if(n < 0){ +- printf(1, "wc: read error\n"); +-- exit(); +-+ exit(0); +- } +- printf(1, "%d %d %d %s\n", l, w, c, name); +- } +-@@ -39,16 +39,16 @@ main(int argc, char *argv[]) +- +- if(argc <= 1){ +- wc(0, ""); +-- exit(); +-+ exit(0); +- } +- +- for(i = 1; i < argc; i++){ +- if((fd = open(argv[i], 0)) < 0){ +- printf(1, "wc: cannot open %s\n", argv[i]); +-- exit(); +-+ exit(0); +- } +- wc(fd, argv[i]); +- close(fd); +- } +-- exit(); +-+ exit(0); +- } +-diff --git a/zombie.c b/zombie.c +-index ee817da..c96b92d 100644 +---- a/zombie.c +-+++ b/zombie.c +-@@ -10,5 +10,5 @@ main(void) +- { +- if(fork() > 0) +- sleep(5); // Let child exit before parent. +-- exit(); +-+ exit(0); +- } +diff --git a/pipe.o b/pipe.o +index 5673452..9ae157c 100644 +Binary files a/pipe.o and b/pipe.o differ +diff --git a/printf.o b/printf.o +index 979384c..e429caa 100644 +Binary files a/printf.o and b/printf.o differ +diff --git a/proc.c b/proc.c +index 622d42d..7933a38 100644 +--- a/proc.c ++++ b/proc.c +@@ -7,7 +7,8 @@ + #include "proc.h" + #include "spinlock.h" + +-struct { ++struct ++{ + struct spinlock lock; + struct proc proc[NPROC]; + } ptable; +@@ -20,32 +21,32 @@ extern void trapret(void); + + static void wakeup1(void *chan); + +-void +-pinit(void) ++void pinit(void) + { + initlock(&ptable.lock, "ptable"); + } + + // Must be called with interrupts disabled +-int +-cpuid() { +- return mycpu()-cpus; ++int cpuid() ++{ ++ return mycpu() - cpus; + } + + // Must be called with interrupts disabled to avoid the caller being + // rescheduled between reading lapicid and running through the loop. +-struct cpu* ++struct cpu * + mycpu(void) + { + int apicid, i; +- +- if(readeflags()&FL_IF) ++ ++ if (readeflags() & FL_IF) + panic("mycpu called with interrupts enabled\n"); +- ++ + apicid = lapicid(); + // APIC IDs are not guaranteed to be contiguous. Maybe we should have + // a reverse map, or reserve a register to store &cpus[i]. +- for (i = 0; i < ncpu; ++i) { ++ for (i = 0; i < ncpu; ++i) ++ { + if (cpus[i].apicid == apicid) + return &cpus[i]; + } +@@ -54,8 +55,9 @@ mycpu(void) + + // Disable interrupts so that we are not rescheduled + // while reading proc from the cpu structure +-struct proc* +-myproc(void) { ++struct proc * ++myproc(void) ++{ + struct cpu *c; + struct proc *p; + pushcli(); +@@ -65,12 +67,12 @@ myproc(void) { + return p; + } + +-//PAGEBREAK: 32 +-// Look in the process table for an UNUSED proc. +-// If found, change state to EMBRYO and initialize +-// state required to run in the kernel. +-// Otherwise return 0. +-static struct proc* ++// PAGEBREAK: 32 ++// Look in the process table for an UNUSED proc. ++// If found, change state to EMBRYO and initialize ++// state required to run in the kernel. ++// Otherwise return 0. ++static struct proc * + allocproc(void) + { + struct proc *p; +@@ -78,8 +80,8 @@ allocproc(void) + + acquire(&ptable.lock); + +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) +- if(p->state == UNUSED) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ if (p->state == UNUSED) + goto found; + + release(&ptable.lock); +@@ -92,7 +94,8 @@ found: + release(&ptable.lock); + + // Allocate kernel stack. +- if((p->kstack = kalloc()) == 0){ ++ if ((p->kstack = kalloc()) == 0) ++ { + p->state = UNUSED; + return 0; + } +@@ -100,33 +103,32 @@ found: + + // Leave room for trap frame. + sp -= sizeof *p->tf; +- p->tf = (struct trapframe*)sp; ++ p->tf = (struct trapframe *)sp; + + // Set up new context to start executing at forkret, + // which returns to trapret. + sp -= 4; +- *(uint*)sp = (uint)trapret; ++ *(uint *)sp = (uint)trapret; + + sp -= sizeof *p->context; +- p->context = (struct context*)sp; ++ p->context = (struct context *)sp; + memset(p->context, 0, sizeof *p->context); + p->context->eip = (uint)forkret; + + return p; + } + +-//PAGEBREAK: 32 +-// Set up first user process. +-void +-userinit(void) ++// PAGEBREAK: 32 ++// Set up first user process. ++void userinit(void) + { + struct proc *p; + extern char _binary_initcode_start[], _binary_initcode_size[]; + + p = allocproc(); +- ++ + initproc = p; +- if((p->pgdir = setupkvm()) == 0) ++ if ((p->pgdir = setupkvm()) == 0) + panic("userinit: out of memory?"); + inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); + p->sz = PGSIZE; +@@ -137,7 +139,7 @@ userinit(void) + p->tf->ss = p->tf->ds; + p->tf->eflags = FL_IF; + p->tf->esp = PGSIZE; +- p->tf->eip = 0; // beginning of initcode.S ++ p->tf->eip = 0; // beginning of initcode.S + + safestrcpy(p->name, "initcode", sizeof(p->name)); + p->cwd = namei("/"); +@@ -155,18 +157,20 @@ userinit(void) + + // Grow current process's memory by n bytes. + // Return 0 on success, -1 on failure. +-int +-growproc(int n) ++int growproc(int n) + { + uint sz; + struct proc *curproc = myproc(); + + sz = curproc->sz; +- if(n > 0){ +- if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) ++ if (n > 0) ++ { ++ if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) + return -1; +- } else if(n < 0){ +- if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) ++ } ++ else if (n < 0) ++ { ++ if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) + return -1; + } + curproc->sz = sz; +@@ -177,20 +181,21 @@ growproc(int n) + // 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) ++int fork(void) + { + int i, pid; + struct proc *np; + struct proc *curproc = myproc(); + + // Allocate process. +- if((np = allocproc()) == 0){ ++ if ((np = allocproc()) == 0) ++ { + return -1; + } + + // Copy process state from proc. +- if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ ++ if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) ++ { + kfree(np->kstack); + np->kstack = 0; + np->state = UNUSED; +@@ -203,8 +208,8 @@ fork(void) + // Clear %eax so that fork returns 0 in the child. + np->tf->eax = 0; + +- for(i = 0; i < NOFILE; i++) +- if(curproc->ofile[i]) ++ for (i = 0; i < NOFILE; i++) ++ if (curproc->ofile[i]) + np->ofile[i] = filedup(curproc->ofile[i]); + np->cwd = idup(curproc->cwd); + +@@ -223,20 +228,21 @@ fork(void) + + // 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(int status) ++// until its parent calls wait(0) to find out it exited. ++void exit(int status) + { + struct proc *curproc = myproc(); + struct proc *p; + int fd; + +- if(curproc == initproc) ++ if (curproc == initproc) + panic("init exiting"); + + // Close all open files. +- for(fd = 0; fd < NOFILE; fd++){ +- if(curproc->ofile[fd]){ ++ for (fd = 0; fd < NOFILE; fd++) ++ { ++ if (curproc->ofile[fd]) ++ { + fileclose(curproc->ofile[fd]); + curproc->ofile[fd] = 0; + } +@@ -249,14 +255,16 @@ exit(int status) + + acquire(&ptable.lock); + +- // Parent might be sleeping in wait(). ++ // Parent might be sleeping in wait(0);. + wakeup1(curproc->parent); + + // Pass abandoned children to init. +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ +- if(p->parent == curproc){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ { ++ if (p->parent == curproc) ++ { + p->parent = initproc; +- if(p->state == ZOMBIE) ++ if (p->state == ZOMBIE) + wakeup1(initproc); + } + } +@@ -269,22 +277,24 @@ exit(int status) + + // Wait for a child process to exit and return its pid. + // Return -1 if this process has no children. +-int +-wait(void) ++int wait(int *status) + { + struct proc *p; + int havekids, pid; + struct proc *curproc = myproc(); +- ++ + acquire(&ptable.lock); +- for(;;){ ++ for (;;) ++ { + // Scan through table looking for exited children. + havekids = 0; +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ +- if(p->parent != curproc) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ { ++ if (p->parent != curproc) + continue; + havekids = 1; +- if(p->state == ZOMBIE){ ++ if (p->state == ZOMBIE) ++ { + // Found one. + pid = p->pid; + kfree(p->kstack); +@@ -301,39 +311,41 @@ wait(void) + } + + // No point waiting if we don't have any children. +- if(!havekids || curproc->killed){ ++ if (!havekids || curproc->killed) ++ { + release(&ptable.lock); + return -1; + } + + // Wait for children to exit. (See wakeup1 call in proc_exit.) +- sleep(curproc, &ptable.lock); //DOC: wait-sleep ++ sleep(curproc, &ptable.lock); // DOC: wait-sleep + } + } + +-//PAGEBREAK: 42 +-// Per-CPU process scheduler. +-// Each CPU calls scheduler() after setting itself up. +-// Scheduler never returns. It loops, doing: +-// - choose a process to run +-// - swtch to start running that process +-// - eventually that process transfers control +-// via swtch back to the scheduler. +-void +-scheduler(void) ++// PAGEBREAK: 42 ++// Per-CPU process scheduler. ++// Each CPU calls scheduler() after setting itself up. ++// Scheduler never returns. It loops, doing: ++// - choose a process to run ++// - swtch to start running that process ++// - eventually that process transfers control ++// via swtch back to the scheduler. ++void scheduler(void) + { + struct proc *p; + struct cpu *c = mycpu(); + c->proc = 0; +- +- for(;;){ ++ ++ for (;;) ++ { + // 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++){ +- if(p->state != RUNNABLE) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ { ++ if (p->state != RUNNABLE) + continue; + + // Switch to chosen process. It is the process's job +@@ -351,7 +363,6 @@ scheduler(void) + c->proc = 0; + } + release(&ptable.lock); +- + } + } + +@@ -362,19 +373,18 @@ scheduler(void) + // be proc->intena and proc->ncli, but that would + // break in the few places where a lock is held but + // there's no process. +-void +-sched(void) ++void sched(void) + { + int intena; + struct proc *p = myproc(); + +- if(!holding(&ptable.lock)) ++ if (!holding(&ptable.lock)) + panic("sched ptable.lock"); +- if(mycpu()->ncli != 1) ++ if (mycpu()->ncli != 1) + panic("sched locks"); +- if(p->state == RUNNING) ++ if (p->state == RUNNING) + panic("sched running"); +- if(readeflags()&FL_IF) ++ if (readeflags() & FL_IF) + panic("sched interruptible"); + intena = mycpu()->intena; + swtch(&p->context, mycpu()->scheduler); +@@ -382,10 +392,9 @@ sched(void) + } + + // Give up the CPU for one scheduling round. +-void +-yield(void) ++void yield(void) + { +- acquire(&ptable.lock); //DOC: yieldlock ++ acquire(&ptable.lock); // DOC: yieldlock + myproc()->state = RUNNABLE; + sched(); + release(&ptable.lock); +@@ -393,14 +402,14 @@ yield(void) + + // A fork child's very first scheduling by scheduler() + // will swtch here. "Return" to user space. +-void +-forkret(void) ++void forkret(void) + { + static int first = 1; + // Still holding ptable.lock from scheduler. + release(&ptable.lock); + +- if (first) { ++ if (first) ++ { + // 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(). +@@ -414,15 +423,14 @@ forkret(void) + + // Atomically release lock and sleep on chan. + // Reacquires lock when awakened. +-void +-sleep(void *chan, struct spinlock *lk) ++void sleep(void *chan, struct spinlock *lk) + { + struct proc *p = myproc(); +- +- if(p == 0) ++ ++ if (p == 0) + panic("sleep"); + +- if(lk == 0) ++ if (lk == 0) + panic("sleep without lk"); + + // Must acquire ptable.lock in order to +@@ -431,8 +439,9 @@ sleep(void *chan, struct spinlock *lk) + // 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 +- acquire(&ptable.lock); //DOC: sleeplock1 ++ if (lk != &ptable.lock) ++ { // DOC: sleeplock0 ++ acquire(&ptable.lock); // DOC: sleeplock1 + release(lk); + } + // Go to sleep. +@@ -445,28 +454,28 @@ sleep(void *chan, struct spinlock *lk) + p->chan = 0; + + // Reacquire original lock. +- if(lk != &ptable.lock){ //DOC: sleeplock2 ++ if (lk != &ptable.lock) ++ { // DOC: sleeplock2 + release(&ptable.lock); + acquire(lk); + } + } + +-//PAGEBREAK! +-// Wake up all processes sleeping on chan. +-// The ptable lock must be held. ++// PAGEBREAK! ++// Wake up all processes sleeping on chan. ++// The ptable lock must be held. + static void + wakeup1(void *chan) + { + struct proc *p; + +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) +- if(p->state == SLEEPING && p->chan == chan) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ if (p->state == SLEEPING && p->chan == chan) + p->state = RUNNABLE; + } + + // Wake up all processes sleeping on chan. +-void +-wakeup(void *chan) ++void wakeup(void *chan) + { + acquire(&ptable.lock); + wakeup1(chan); +@@ -476,17 +485,18 @@ wakeup(void *chan) + // 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) ++int kill(int pid) + { + struct proc *p; + + acquire(&ptable.lock); +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ +- if(p->pid == pid){ ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ { ++ if (p->pid == pid) ++ { + p->killed = 1; + // Wake process from sleep if necessary. +- if(p->state == SLEEPING) ++ if (p->state == SLEEPING) + p->state = RUNNABLE; + release(&ptable.lock); + return 0; +@@ -496,37 +506,37 @@ kill(int pid) + return -1; + } + +-//PAGEBREAK: 36 +-// 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) ++// PAGEBREAK: 36 ++// 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) + { + static char *states[] = { +- [UNUSED] "unused", +- [EMBRYO] "embryo", +- [SLEEPING] "sleep ", +- [RUNNABLE] "runble", +- [RUNNING] "run ", +- [ZOMBIE] "zombie" +- }; ++ [UNUSED] "unused", ++ [EMBRYO] "embryo", ++ [SLEEPING] "sleep ", ++ [RUNNABLE] "runble", ++ [RUNNING] "run ", ++ [ZOMBIE] "zombie"}; + int i; + struct proc *p; + char *state; + uint pc[10]; + +- for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ +- if(p->state == UNUSED) ++ for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) ++ { ++ if (p->state == UNUSED) + continue; +- if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) ++ if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) + state = states[p->state]; + 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++) ++ if (p->state == SLEEPING) ++ { ++ getcallerpcs((uint *)p->context->ebp + 2, pc); ++ for (i = 0; i < 10 && pc[i] != 0; i++) + cprintf(" %p", pc[i]); + } + cprintf("\n"); +diff --git a/proc.o b/proc.o +index 3e4140f..7c27fc3 100644 +Binary files a/proc.o and b/proc.o differ +diff --git a/rm.asm b/rm.asm +index 7c65a29..ec5bd3d 100644 +--- a/rm.asm ++++ b/rm.asm +@@ -455,132 +455,106 @@ memmove(void *vdst, const void *vsrc, int n) + 299: c3 ret + + 0000029a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + + 000002a2 : +-SYSCALL(exit) + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + + 000002aa : +-SYSCALL(wait) + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + + 000002b2 : +-SYSCALL(pipe) + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + + 000002ba : +-SYSCALL(read) + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + + 000002c2 : +-SYSCALL(write) + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + + 000002ca : +-SYSCALL(close) + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + + 000002d2 : +-SYSCALL(kill) + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + + 000002da : +-SYSCALL(exec) + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + + 000002e2 : +-SYSCALL(open) + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + + 000002ea : +-SYSCALL(mknod) + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + + 000002f2 : +-SYSCALL(unlink) + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + + 000002fa : +-SYSCALL(fstat) + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + + 00000302 : +-SYSCALL(link) + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + + 0000030a : +-SYSCALL(mkdir) + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + + 00000312 : +-SYSCALL(chdir) + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + + 0000031a : +-SYSCALL(dup) + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + + 00000322 : +-SYSCALL(getpid) + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + + 0000032a : +-SYSCALL(sbrk) + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + + 00000332 : +-SYSCALL(sleep) + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + + 0000033a : +-SYSCALL(uptime) + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret +diff --git a/rm.o b/rm.o +index 0d6340d..ac9b714 100644 +Binary files a/rm.o and b/rm.o differ +diff --git a/sh.asm b/sh.asm +index c1325cf..ccb7431 100644 +--- a/sh.asm ++++ b/sh.asm +@@ -5,11 +5,11 @@ _sh: file format elf32-i386 + Disassembly of section .text: + + 00000000
: ++ return -1; + return 0; + } + +-int +-main(void) ++int main(void) + { + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp +@@ -19,2477 +19,2458 @@ main(void) + int fd; + + // Ensure that three file descriptors are open. +- while((fd = open("console", O_RDWR)) >= 0){ ++ while ((fd = open("console", O_RDWR)) >= 0) + 9: eb 0e jmp 19 + b: 90 nop + c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- if(fd >= 3){ ++ { ++ if (fd >= 3) + 10: 83 f8 02 cmp $0x2,%eax +- 13: 0f 8f d4 00 00 00 jg ed +- while((fd = open("console", O_RDWR)) >= 0){ ++ 13: 0f 8f db 00 00 00 jg f4 ++ while ((fd = open("console", O_RDWR)) >= 0) + 19: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 20: 00 +- 21: c7 04 24 39 13 00 00 movl $0x1339,(%esp) +- 28: e8 f5 0d 00 00 call e22 ++ 21: c7 04 24 59 13 00 00 movl $0x1359,(%esp) ++ 28: e8 15 0e 00 00 call e42 + 2d: 85 c0 test %eax,%eax + 2f: 79 df jns 10 +- 31: eb 23 jmp 56 ++ 31: eb 2a jmp 5d + 33: 90 nop + 34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- } + } + + // Read and run input commands. +- while(getcmd(buf, sizeof(buf)) >= 0){ +- if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ +- 38: 80 3d 42 19 00 00 20 cmpb $0x20,0x1942 ++ while (getcmd(buf, sizeof(buf)) >= 0) ++ { ++ if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') ++ 38: 80 3d 62 19 00 00 20 cmpb $0x20,0x1962 + 3f: 90 nop +- 40: 74 67 je a9 ++ 40: 74 6e je b0 + 42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- buf[strlen(buf)-1] = 0; // chop \n +- if(chdir(buf+3) < 0) +- printf(2, "cannot cd %s\n", buf+3); ++ buf[strlen(buf) - 1] = 0; // chop \n ++ if (chdir(buf + 3) < 0) ++ printf(2, "cannot cd %s\n", buf + 3); + continue; + } +- if(fork1() == 0) +- 48: e8 43 01 00 00 call 190 ++ if (fork1() == 0) ++ 48: e8 53 01 00 00 call 1a0 + 4d: 85 c0 test %eax,%eax +- 4f: 74 38 je 89 ++ 4f: 74 3f je 90 + runcmd(parsecmd(buf)); +- wait(); +- 51: e8 94 0d 00 00 call dea +- while(getcmd(buf, sizeof(buf)) >= 0){ +- 56: c7 44 24 04 64 00 00 movl $0x64,0x4(%esp) +- 5d: 00 +- 5e: c7 04 24 40 19 00 00 movl $0x1940,(%esp) +- 65: e8 96 00 00 00 call 100 +- 6a: 85 c0 test %eax,%eax +- 6c: 78 2f js 9d +- if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ +- 6e: 80 3d 40 19 00 00 63 cmpb $0x63,0x1940 +- 75: 75 d1 jne 48 +- 77: 80 3d 41 19 00 00 64 cmpb $0x64,0x1941 +- 7e: 74 b8 je 38 +- if(fork1() == 0) +- 80: e8 0b 01 00 00 call 190 +- 85: 85 c0 test %eax,%eax +- 87: 75 c8 jne 51 ++ wait(0); ++ 51: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 58: e8 ad 0d 00 00 call e0a ++ while (getcmd(buf, sizeof(buf)) >= 0) ++ 5d: c7 44 24 04 64 00 00 movl $0x64,0x4(%esp) ++ 64: 00 ++ 65: c7 04 24 60 19 00 00 movl $0x1960,(%esp) ++ 6c: e8 9f 00 00 00 call 110 ++ 71: 85 c0 test %eax,%eax ++ 73: 78 2f js a4 ++ if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') ++ 75: 80 3d 60 19 00 00 63 cmpb $0x63,0x1960 ++ 7c: 75 ca jne 48 ++ 7e: 80 3d 61 19 00 00 64 cmpb $0x64,0x1961 ++ 85: 74 b1 je 38 ++ if (fork1() == 0) ++ 87: e8 14 01 00 00 call 1a0 ++ 8c: 85 c0 test %eax,%eax ++ 8e: 75 c1 jne 51 + runcmd(parsecmd(buf)); +- 89: c7 04 24 40 19 00 00 movl $0x1940,(%esp) +- 90: e8 ab 0a 00 00 call b40 +- 95: 89 04 24 mov %eax,(%esp) +- 98: e8 13 01 00 00 call 1b0 ++ 90: c7 04 24 60 19 00 00 movl $0x1960,(%esp) ++ 97: e8 c4 0a 00 00 call b60 ++ 9c: 89 04 24 mov %eax,(%esp) ++ 9f: e8 1c 01 00 00 call 1c0 ++ ; + } + exit(0); +- 9d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- a4: e8 39 0d 00 00 call de2 +- buf[strlen(buf)-1] = 0; // chop \n +- a9: c7 04 24 40 19 00 00 movl $0x1940,(%esp) +- b0: e8 8b 0b 00 00 call c40 +- if(chdir(buf+3) < 0) +- b5: c7 04 24 43 19 00 00 movl $0x1943,(%esp) +- buf[strlen(buf)-1] = 0; // chop \n +- bc: c6 80 3f 19 00 00 00 movb $0x0,0x193f(%eax) +- if(chdir(buf+3) < 0) +- c3: e8 8a 0d 00 00 call e52 +- c8: 85 c0 test %eax,%eax +- ca: 79 8a jns 56 +- printf(2, "cannot cd %s\n", buf+3); +- cc: c7 44 24 08 43 19 00 movl $0x1943,0x8(%esp) +- d3: 00 +- d4: c7 44 24 04 41 13 00 movl $0x1341,0x4(%esp) +- db: 00 +- dc: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- e3: e8 48 0e 00 00 call f30 +- e8: e9 69 ff ff ff jmp 56 ++ a4: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ ab: e8 52 0d 00 00 call e02 ++ buf[strlen(buf) - 1] = 0; // chop \n ++ b0: c7 04 24 60 19 00 00 movl $0x1960,(%esp) ++ b7: e8 a4 0b 00 00 call c60 ++ if (chdir(buf + 3) < 0) ++ bc: c7 04 24 63 19 00 00 movl $0x1963,(%esp) ++ buf[strlen(buf) - 1] = 0; // chop \n ++ c3: c6 80 5f 19 00 00 00 movb $0x0,0x195f(%eax) ++ if (chdir(buf + 3) < 0) ++ ca: e8 a3 0d 00 00 call e72 ++ cf: 85 c0 test %eax,%eax ++ d1: 79 8a jns 5d ++ printf(2, "cannot cd %s\n", buf + 3); ++ d3: c7 44 24 08 63 19 00 movl $0x1963,0x8(%esp) ++ da: 00 ++ db: c7 44 24 04 61 13 00 movl $0x1361,0x4(%esp) ++ e2: 00 ++ e3: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ ea: e8 61 0e 00 00 call f50 ++ ef: e9 69 ff ff ff jmp 5d + close(fd); +- ed: 89 04 24 mov %eax,(%esp) +- f0: e8 15 0d 00 00 call e0a ++ f4: 89 04 24 mov %eax,(%esp) ++ f7: e8 2e 0d 00 00 call e2a ++ fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + break; +- f5: e9 5c ff ff ff jmp 56 +- fa: 66 90 xchg %ax,%ax +- fc: 66 90 xchg %ax,%ax +- fe: 66 90 xchg %ax,%ax +- +-00000100 : ++ 100: e9 58 ff ff ff jmp 5d ++ 105: 66 90 xchg %ax,%ax ++ 107: 66 90 xchg %ax,%ax ++ 109: 66 90 xchg %ax,%ax ++ 10b: 66 90 xchg %ax,%ax ++ 10d: 66 90 xchg %ax,%ax ++ 10f: 90 nop ++ ++00000110 : + { +- 100: 55 push %ebp +- 101: 89 e5 mov %esp,%ebp +- 103: 56 push %esi +- 104: 53 push %ebx +- 105: 83 ec 10 sub $0x10,%esp +- 108: 8b 5d 08 mov 0x8(%ebp),%ebx +- 10b: 8b 75 0c mov 0xc(%ebp),%esi ++ 110: 55 push %ebp ++ 111: 89 e5 mov %esp,%ebp ++ 113: 56 push %esi ++ 114: 53 push %ebx ++ 115: 83 ec 10 sub $0x10,%esp ++ 118: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 11b: 8b 75 0c mov 0xc(%ebp),%esi + printf(2, "$ "); +- 10e: c7 44 24 04 98 12 00 movl $0x1298,0x4(%esp) +- 115: 00 +- 116: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- 11d: e8 0e 0e 00 00 call f30 ++ 11e: c7 44 24 04 b8 12 00 movl $0x12b8,0x4(%esp) ++ 125: 00 ++ 126: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ 12d: e8 1e 0e 00 00 call f50 + memset(buf, 0, nbuf); +- 122: 89 74 24 08 mov %esi,0x8(%esp) +- 126: 89 1c 24 mov %ebx,(%esp) +- 129: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 130: 00 +- 131: e8 3a 0b 00 00 call c70 ++ 132: 89 74 24 08 mov %esi,0x8(%esp) ++ 136: 89 1c 24 mov %ebx,(%esp) ++ 139: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 140: 00 ++ 141: e8 4a 0b 00 00 call c90 + gets(buf, nbuf); +- 136: 89 74 24 04 mov %esi,0x4(%esp) +- 13a: 89 1c 24 mov %ebx,(%esp) +- 13d: e8 8e 0b 00 00 call cd0 +- if(buf[0] == 0) // EOF +- 142: 31 c0 xor %eax,%eax +- 144: 80 3b 00 cmpb $0x0,(%ebx) +- 147: 0f 94 c0 sete %al ++ 146: 89 74 24 04 mov %esi,0x4(%esp) ++ 14a: 89 1c 24 mov %ebx,(%esp) ++ 14d: e8 9e 0b 00 00 call cf0 ++ if (buf[0] == 0) // EOF ++ 152: 31 c0 xor %eax,%eax ++ 154: 80 3b 00 cmpb $0x0,(%ebx) ++ 157: 0f 94 c0 sete %al + } +- 14a: 83 c4 10 add $0x10,%esp +- 14d: 5b pop %ebx +- if(buf[0] == 0) // EOF +- 14e: f7 d8 neg %eax ++ 15a: 83 c4 10 add $0x10,%esp ++ 15d: 5b pop %ebx ++ if (buf[0] == 0) // EOF ++ 15e: f7 d8 neg %eax + } +- 150: 5e pop %esi +- 151: 5d pop %ebp +- 152: c3 ret +- 153: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 160: 5e pop %esi ++ 161: 5d pop %ebp ++ 162: c3 ret ++ 163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000160 : ++00000170 : + } + +-void +-panic(char *s) ++void panic(char *s) + { +- 160: 55 push %ebp +- 161: 89 e5 mov %esp,%ebp +- 163: 83 ec 18 sub $0x18,%esp ++ 170: 55 push %ebp ++ 171: 89 e5 mov %esp,%ebp ++ 173: 83 ec 18 sub $0x18,%esp + printf(2, "%s\n", s); +- 166: 8b 45 08 mov 0x8(%ebp),%eax +- 169: c7 44 24 04 35 13 00 movl $0x1335,0x4(%esp) +- 170: 00 +- 171: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- 178: 89 44 24 08 mov %eax,0x8(%esp) +- 17c: e8 af 0d 00 00 call f30 ++ 176: 8b 45 08 mov 0x8(%ebp),%eax ++ 179: c7 44 24 04 55 13 00 movl $0x1355,0x4(%esp) ++ 180: 00 ++ 181: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ 188: 89 44 24 08 mov %eax,0x8(%esp) ++ 18c: e8 bf 0d 00 00 call f50 + exit(0); +- 181: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 188: e8 55 0c 00 00 call de2 +- 18d: 8d 76 00 lea 0x0(%esi),%esi ++ 191: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 198: e8 65 0c 00 00 call e02 ++ 19d: 8d 76 00 lea 0x0(%esi),%esi + +-00000190 : ++000001a0 : + } + +-int +-fork1(void) ++int fork1(void) + { +- 190: 55 push %ebp +- 191: 89 e5 mov %esp,%ebp +- 193: 83 ec 18 sub $0x18,%esp ++ 1a0: 55 push %ebp ++ 1a1: 89 e5 mov %esp,%ebp ++ 1a3: 83 ec 18 sub $0x18,%esp + int pid; + + pid = fork(); +- 196: e8 3f 0c 00 00 call dda +- if(pid == -1) +- 19b: 83 f8 ff cmp $0xffffffff,%eax +- 19e: 74 02 je 1a2 ++ 1a6: e8 4f 0c 00 00 call dfa ++ if (pid == -1) ++ 1ab: 83 f8 ff cmp $0xffffffff,%eax ++ 1ae: 74 02 je 1b2 + panic("fork"); + return pid; + } +- 1a0: c9 leave +- 1a1: c3 ret ++ 1b0: c9 leave ++ 1b1: c3 ret + panic("fork"); +- 1a2: c7 04 24 9b 12 00 00 movl $0x129b,(%esp) +- 1a9: e8 b2 ff ff ff call 160 +- 1ae: 66 90 xchg %ax,%ax ++ 1b2: c7 04 24 bb 12 00 00 movl $0x12bb,(%esp) ++ 1b9: e8 b2 ff ff ff call 170 ++ 1be: 66 90 xchg %ax,%ax + +-000001b0 : ++000001c0 : + { +- 1b0: 55 push %ebp +- 1b1: 89 e5 mov %esp,%ebp +- 1b3: 53 push %ebx +- 1b4: 83 ec 24 sub $0x24,%esp +- 1b7: 8b 5d 08 mov 0x8(%ebp),%ebx +- if(cmd == 0) +- 1ba: 85 db test %ebx,%ebx +- 1bc: 74 5f je 21d +- switch(cmd->type){ +- 1be: 83 3b 05 cmpl $0x5,(%ebx) +- 1c1: 0f 87 e7 00 00 00 ja 2ae +- 1c7: 8b 03 mov (%ebx),%eax +- 1c9: ff 24 85 50 13 00 00 jmp *0x1350(,%eax,4) +- if(pipe(p) < 0) +- 1d0: 8d 45 f0 lea -0x10(%ebp),%eax +- 1d3: 89 04 24 mov %eax,(%esp) +- 1d6: e8 17 0c 00 00 call df2 +- 1db: 85 c0 test %eax,%eax +- 1dd: 0f 88 d7 00 00 00 js 2ba +- if(fork1() == 0){ +- 1e3: e8 a8 ff ff ff call 190 +- 1e8: 85 c0 test %eax,%eax +- 1ea: 0f 84 2e 01 00 00 je 31e +- if(fork1() == 0){ +- 1f0: e8 9b ff ff ff call 190 +- 1f5: 85 c0 test %eax,%eax +- 1f7: 0f 84 e9 00 00 00 je 2e6 ++ 1c0: 55 push %ebp ++ 1c1: 89 e5 mov %esp,%ebp ++ 1c3: 53 push %ebx ++ 1c4: 83 ec 24 sub $0x24,%esp ++ 1c7: 8b 5d 08 mov 0x8(%ebp),%ebx ++ if (cmd == 0) ++ 1ca: 85 db test %ebx,%ebx ++ 1cc: 74 6d je 23b ++ switch (cmd->type) ++ 1ce: 83 3b 05 cmpl $0x5,(%ebx) ++ 1d1: 0f 87 fe 00 00 00 ja 2d5 ++ 1d7: 8b 03 mov (%ebx),%eax ++ 1d9: ff 24 85 70 13 00 00 jmp *0x1370(,%eax,4) ++ if (pipe(p) < 0) ++ 1e0: 8d 45 f0 lea -0x10(%ebp),%eax ++ 1e3: 89 04 24 mov %eax,(%esp) ++ 1e6: e8 27 0c 00 00 call e12 ++ 1eb: 85 c0 test %eax,%eax ++ 1ed: 0f 88 ee 00 00 00 js 2e1 ++ if (fork1() == 0) ++ 1f3: e8 a8 ff ff ff call 1a0 ++ 1f8: 85 c0 test %eax,%eax ++ 1fa: 0f 84 45 01 00 00 je 345 ++ if (fork1() == 0) ++ 200: e8 9b ff ff ff call 1a0 ++ 205: 85 c0 test %eax,%eax ++ 207: 0f 84 00 01 00 00 je 30d + close(p[0]); +- 1fd: 8b 45 f0 mov -0x10(%ebp),%eax +- 200: 89 04 24 mov %eax,(%esp) +- 203: e8 02 0c 00 00 call e0a ++ 20d: 8b 45 f0 mov -0x10(%ebp),%eax ++ 210: 89 04 24 mov %eax,(%esp) ++ 213: e8 12 0c 00 00 call e2a + close(p[1]); +- 208: 8b 45 f4 mov -0xc(%ebp),%eax +- 20b: 89 04 24 mov %eax,(%esp) +- 20e: e8 f7 0b 00 00 call e0a +- wait(); +- 213: e8 d2 0b 00 00 call dea +- wait(); +- 218: e8 cd 0b 00 00 call dea ++ 218: 8b 45 f4 mov -0xc(%ebp),%eax ++ 21b: 89 04 24 mov %eax,(%esp) ++ 21e: e8 07 0c 00 00 call e2a ++ wait(0); ++ 223: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 22a: e8 db 0b 00 00 call e0a ++ wait(0); ++ 22f: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 236: e8 cf 0b 00 00 call e0a + exit(0); +- 21d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 224: e8 b9 0b 00 00 call de2 +- if(fork1() == 0) +- 229: e8 62 ff ff ff call 190 +- 22e: 85 c0 test %eax,%eax +- 230: 75 eb jne 21d +- 232: eb 6f jmp 2a3 +- if(ecmd->argv[0] == 0) +- 234: 8b 43 04 mov 0x4(%ebx),%eax +- 237: 85 c0 test %eax,%eax +- 239: 74 e2 je 21d ++ 23b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 242: e8 bb 0b 00 00 call e02 ++ if (fork1() == 0) ++ 247: e8 54 ff ff ff call 1a0 ++ 24c: 85 c0 test %eax,%eax ++ 24e: 75 eb jne 23b ++ 250: eb 78 jmp 2ca ++ if (ecmd->argv[0] == 0) ++ 252: 8b 43 04 mov 0x4(%ebx),%eax ++ 255: 85 c0 test %eax,%eax ++ 257: 74 e2 je 23b + exec(ecmd->argv[0], ecmd->argv); +- 23b: 8d 53 04 lea 0x4(%ebx),%edx +- 23e: 89 54 24 04 mov %edx,0x4(%esp) +- 242: 89 04 24 mov %eax,(%esp) +- 245: e8 d0 0b 00 00 call e1a ++ 259: 8d 53 04 lea 0x4(%ebx),%edx ++ 25c: 89 54 24 04 mov %edx,0x4(%esp) ++ 260: 89 04 24 mov %eax,(%esp) ++ 263: e8 d2 0b 00 00 call e3a + printf(2, "exec %s failed\n", ecmd->argv[0]); +- 24a: 8b 43 04 mov 0x4(%ebx),%eax +- 24d: c7 44 24 04 a7 12 00 movl $0x12a7,0x4(%esp) +- 254: 00 +- 255: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- 25c: 89 44 24 08 mov %eax,0x8(%esp) +- 260: e8 cb 0c 00 00 call f30 ++ 268: 8b 43 04 mov 0x4(%ebx),%eax ++ 26b: c7 44 24 04 c7 12 00 movl $0x12c7,0x4(%esp) ++ 272: 00 ++ 273: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ 27a: 89 44 24 08 mov %eax,0x8(%esp) ++ 27e: e8 cd 0c 00 00 call f50 + break; +- 265: eb b6 jmp 21d +- if(fork1() == 0) +- 267: e8 24 ff ff ff call 190 +- 26c: 85 c0 test %eax,%eax +- 26e: 66 90 xchg %ax,%ax +- 270: 74 31 je 2a3 +- wait(); +- 272: e8 73 0b 00 00 call dea ++ 283: eb b6 jmp 23b ++ if (fork1() == 0) ++ 285: e8 16 ff ff ff call 1a0 ++ 28a: 85 c0 test %eax,%eax ++ 28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 290: 74 38 je 2ca ++ wait(0); ++ 292: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 299: e8 6c 0b 00 00 call e0a + runcmd(lcmd->right); +- 277: 8b 43 08 mov 0x8(%ebx),%eax +- 27a: 89 04 24 mov %eax,(%esp) +- 27d: e8 2e ff ff ff call 1b0 ++ 29e: 8b 43 08 mov 0x8(%ebx),%eax ++ 2a1: 89 04 24 mov %eax,(%esp) ++ 2a4: e8 17 ff ff ff call 1c0 + close(rcmd->fd); +- 282: 8b 43 14 mov 0x14(%ebx),%eax +- 285: 89 04 24 mov %eax,(%esp) +- 288: e8 7d 0b 00 00 call e0a +- if(open(rcmd->file, rcmd->mode) < 0){ +- 28d: 8b 43 10 mov 0x10(%ebx),%eax +- 290: 89 44 24 04 mov %eax,0x4(%esp) +- 294: 8b 43 08 mov 0x8(%ebx),%eax +- 297: 89 04 24 mov %eax,(%esp) +- 29a: e8 83 0b 00 00 call e22 +- 29f: 85 c0 test %eax,%eax +- 2a1: 78 23 js 2c6 ++ 2a9: 8b 43 14 mov 0x14(%ebx),%eax ++ 2ac: 89 04 24 mov %eax,(%esp) ++ 2af: e8 76 0b 00 00 call e2a ++ if (open(rcmd->file, rcmd->mode) < 0) ++ 2b4: 8b 43 10 mov 0x10(%ebx),%eax ++ 2b7: 89 44 24 04 mov %eax,0x4(%esp) ++ 2bb: 8b 43 08 mov 0x8(%ebx),%eax ++ 2be: 89 04 24 mov %eax,(%esp) ++ 2c1: e8 7c 0b 00 00 call e42 ++ 2c6: 85 c0 test %eax,%eax ++ 2c8: 78 23 js 2ed + runcmd(bcmd->cmd); +- 2a3: 8b 43 04 mov 0x4(%ebx),%eax +- 2a6: 89 04 24 mov %eax,(%esp) +- 2a9: e8 02 ff ff ff call 1b0 ++ 2ca: 8b 43 04 mov 0x4(%ebx),%eax ++ 2cd: 89 04 24 mov %eax,(%esp) ++ 2d0: e8 eb fe ff ff call 1c0 + panic("runcmd"); +- 2ae: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp) +- 2b5: e8 a6 fe ff ff call 160 ++ 2d5: c7 04 24 c0 12 00 00 movl $0x12c0,(%esp) ++ 2dc: e8 8f fe ff ff call 170 + panic("pipe"); +- 2ba: c7 04 24 c7 12 00 00 movl $0x12c7,(%esp) +- 2c1: e8 9a fe ff ff call 160 ++ 2e1: c7 04 24 e7 12 00 00 movl $0x12e7,(%esp) ++ 2e8: e8 83 fe ff ff call 170 + printf(2, "open %s failed\n", rcmd->file); +- 2c6: 8b 43 08 mov 0x8(%ebx),%eax +- 2c9: c7 44 24 04 b7 12 00 movl $0x12b7,0x4(%esp) +- 2d0: 00 +- 2d1: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- 2d8: 89 44 24 08 mov %eax,0x8(%esp) +- 2dc: e8 4f 0c 00 00 call f30 +- 2e1: e9 37 ff ff ff jmp 21d ++ 2ed: 8b 43 08 mov 0x8(%ebx),%eax ++ 2f0: c7 44 24 04 d7 12 00 movl $0x12d7,0x4(%esp) ++ 2f7: 00 ++ 2f8: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ 2ff: 89 44 24 08 mov %eax,0x8(%esp) ++ 303: e8 48 0c 00 00 call f50 ++ 308: e9 2e ff ff ff jmp 23b + close(0); +- 2e6: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2ed: e8 18 0b 00 00 call e0a ++ 30d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 314: e8 11 0b 00 00 call e2a + dup(p[0]); +- 2f2: 8b 45 f0 mov -0x10(%ebp),%eax +- 2f5: 89 04 24 mov %eax,(%esp) +- 2f8: e8 5d 0b 00 00 call e5a ++ 319: 8b 45 f0 mov -0x10(%ebp),%eax ++ 31c: 89 04 24 mov %eax,(%esp) ++ 31f: e8 56 0b 00 00 call e7a + close(p[0]); +- 2fd: 8b 45 f0 mov -0x10(%ebp),%eax +- 300: 89 04 24 mov %eax,(%esp) +- 303: e8 02 0b 00 00 call e0a ++ 324: 8b 45 f0 mov -0x10(%ebp),%eax ++ 327: 89 04 24 mov %eax,(%esp) ++ 32a: e8 fb 0a 00 00 call e2a + close(p[1]); +- 308: 8b 45 f4 mov -0xc(%ebp),%eax +- 30b: 89 04 24 mov %eax,(%esp) +- 30e: e8 f7 0a 00 00 call e0a ++ 32f: 8b 45 f4 mov -0xc(%ebp),%eax ++ 332: 89 04 24 mov %eax,(%esp) ++ 335: e8 f0 0a 00 00 call e2a + runcmd(pcmd->right); +- 313: 8b 43 08 mov 0x8(%ebx),%eax +- 316: 89 04 24 mov %eax,(%esp) +- 319: e8 92 fe ff ff call 1b0 ++ 33a: 8b 43 08 mov 0x8(%ebx),%eax ++ 33d: 89 04 24 mov %eax,(%esp) ++ 340: e8 7b fe ff ff call 1c0 + close(1); +- 31e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 325: e8 e0 0a 00 00 call e0a ++ 345: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 34c: e8 d9 0a 00 00 call e2a + dup(p[1]); +- 32a: 8b 45 f4 mov -0xc(%ebp),%eax +- 32d: 89 04 24 mov %eax,(%esp) +- 330: e8 25 0b 00 00 call e5a ++ 351: 8b 45 f4 mov -0xc(%ebp),%eax ++ 354: 89 04 24 mov %eax,(%esp) ++ 357: e8 1e 0b 00 00 call e7a + close(p[0]); +- 335: 8b 45 f0 mov -0x10(%ebp),%eax +- 338: 89 04 24 mov %eax,(%esp) +- 33b: e8 ca 0a 00 00 call e0a ++ 35c: 8b 45 f0 mov -0x10(%ebp),%eax ++ 35f: 89 04 24 mov %eax,(%esp) ++ 362: e8 c3 0a 00 00 call e2a + close(p[1]); +- 340: 8b 45 f4 mov -0xc(%ebp),%eax +- 343: 89 04 24 mov %eax,(%esp) +- 346: e8 bf 0a 00 00 call e0a ++ 367: 8b 45 f4 mov -0xc(%ebp),%eax ++ 36a: 89 04 24 mov %eax,(%esp) ++ 36d: e8 b8 0a 00 00 call e2a + runcmd(pcmd->left); +- 34b: 8b 43 04 mov 0x4(%ebx),%eax +- 34e: 89 04 24 mov %eax,(%esp) +- 351: e8 5a fe ff ff call 1b0 +- 356: 8d 76 00 lea 0x0(%esi),%esi +- 359: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 372: 8b 43 04 mov 0x4(%ebx),%eax ++ 375: 89 04 24 mov %eax,(%esp) ++ 378: e8 43 fe ff ff call 1c0 ++ 37d: 8d 76 00 lea 0x0(%esi),%esi + +-00000360 : +-//PAGEBREAK! +-// Constructors ++00000380 : ++// PAGEBREAK! ++// Constructors + +-struct cmd* ++struct cmd * + execcmd(void) + { +- 360: 55 push %ebp +- 361: 89 e5 mov %esp,%ebp +- 363: 53 push %ebx +- 364: 83 ec 14 sub $0x14,%esp ++ 380: 55 push %ebp ++ 381: 89 e5 mov %esp,%ebp ++ 383: 53 push %ebx ++ 384: 83 ec 14 sub $0x14,%esp + struct execcmd *cmd; + + cmd = malloc(sizeof(*cmd)); +- 367: c7 04 24 54 00 00 00 movl $0x54,(%esp) +- 36e: e8 3d 0e 00 00 call 11b0 ++ 387: c7 04 24 54 00 00 00 movl $0x54,(%esp) ++ 38e: e8 3d 0e 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); +- 373: c7 44 24 08 54 00 00 movl $0x54,0x8(%esp) +- 37a: 00 +- 37b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 382: 00 ++ 393: c7 44 24 08 54 00 00 movl $0x54,0x8(%esp) ++ 39a: 00 ++ 39b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 3a2: 00 + cmd = malloc(sizeof(*cmd)); +- 383: 89 c3 mov %eax,%ebx ++ 3a3: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); +- 385: 89 04 24 mov %eax,(%esp) +- 388: e8 e3 08 00 00 call c70 ++ 3a5: 89 04 24 mov %eax,(%esp) ++ 3a8: e8 e3 08 00 00 call c90 + cmd->type = EXEC; +- return (struct cmd*)cmd; ++ return (struct cmd *)cmd; + } +- 38d: 89 d8 mov %ebx,%eax ++ 3ad: 89 d8 mov %ebx,%eax + cmd->type = EXEC; +- 38f: c7 03 01 00 00 00 movl $0x1,(%ebx) ++ 3af: c7 03 01 00 00 00 movl $0x1,(%ebx) + } +- 395: 83 c4 14 add $0x14,%esp +- 398: 5b pop %ebx +- 399: 5d pop %ebp +- 39a: c3 ret +- 39b: 90 nop +- 39c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3b5: 83 c4 14 add $0x14,%esp ++ 3b8: 5b pop %ebx ++ 3b9: 5d pop %ebp ++ 3ba: c3 ret ++ 3bb: 90 nop ++ 3bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +-000003a0 : ++000003c0 : + +-struct cmd* ++struct cmd * + redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) + { +- 3a0: 55 push %ebp +- 3a1: 89 e5 mov %esp,%ebp +- 3a3: 53 push %ebx +- 3a4: 83 ec 14 sub $0x14,%esp ++ 3c0: 55 push %ebp ++ 3c1: 89 e5 mov %esp,%ebp ++ 3c3: 53 push %ebx ++ 3c4: 83 ec 14 sub $0x14,%esp + struct redircmd *cmd; + + cmd = malloc(sizeof(*cmd)); +- 3a7: c7 04 24 18 00 00 00 movl $0x18,(%esp) +- 3ae: e8 fd 0d 00 00 call 11b0 ++ 3c7: c7 04 24 18 00 00 00 movl $0x18,(%esp) ++ 3ce: e8 fd 0d 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); +- 3b3: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) +- 3ba: 00 +- 3bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 3c2: 00 +- 3c3: 89 04 24 mov %eax,(%esp) ++ 3d3: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) ++ 3da: 00 ++ 3db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 3e2: 00 ++ 3e3: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); +- 3c6: 89 c3 mov %eax,%ebx ++ 3e6: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); +- 3c8: e8 a3 08 00 00 call c70 ++ 3e8: e8 a3 08 00 00 call c90 + cmd->type = REDIR; + cmd->cmd = subcmd; +- 3cd: 8b 45 08 mov 0x8(%ebp),%eax ++ 3ed: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = REDIR; +- 3d0: c7 03 02 00 00 00 movl $0x2,(%ebx) ++ 3f0: c7 03 02 00 00 00 movl $0x2,(%ebx) + cmd->cmd = subcmd; +- 3d6: 89 43 04 mov %eax,0x4(%ebx) ++ 3f6: 89 43 04 mov %eax,0x4(%ebx) + cmd->file = file; +- 3d9: 8b 45 0c mov 0xc(%ebp),%eax +- 3dc: 89 43 08 mov %eax,0x8(%ebx) ++ 3f9: 8b 45 0c mov 0xc(%ebp),%eax ++ 3fc: 89 43 08 mov %eax,0x8(%ebx) + cmd->efile = efile; +- 3df: 8b 45 10 mov 0x10(%ebp),%eax +- 3e2: 89 43 0c mov %eax,0xc(%ebx) ++ 3ff: 8b 45 10 mov 0x10(%ebp),%eax ++ 402: 89 43 0c mov %eax,0xc(%ebx) + cmd->mode = mode; +- 3e5: 8b 45 14 mov 0x14(%ebp),%eax +- 3e8: 89 43 10 mov %eax,0x10(%ebx) ++ 405: 8b 45 14 mov 0x14(%ebp),%eax ++ 408: 89 43 10 mov %eax,0x10(%ebx) + cmd->fd = fd; +- 3eb: 8b 45 18 mov 0x18(%ebp),%eax +- 3ee: 89 43 14 mov %eax,0x14(%ebx) +- return (struct cmd*)cmd; ++ 40b: 8b 45 18 mov 0x18(%ebp),%eax ++ 40e: 89 43 14 mov %eax,0x14(%ebx) ++ return (struct cmd *)cmd; + } +- 3f1: 83 c4 14 add $0x14,%esp +- 3f4: 89 d8 mov %ebx,%eax +- 3f6: 5b pop %ebx +- 3f7: 5d pop %ebp +- 3f8: c3 ret +- 3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 411: 83 c4 14 add $0x14,%esp ++ 414: 89 d8 mov %ebx,%eax ++ 416: 5b pop %ebx ++ 417: 5d pop %ebp ++ 418: c3 ret ++ 419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00000400 : ++00000420 : + +-struct cmd* ++struct cmd * + pipecmd(struct cmd *left, struct cmd *right) + { +- 400: 55 push %ebp +- 401: 89 e5 mov %esp,%ebp +- 403: 53 push %ebx +- 404: 83 ec 14 sub $0x14,%esp ++ 420: 55 push %ebp ++ 421: 89 e5 mov %esp,%ebp ++ 423: 53 push %ebx ++ 424: 83 ec 14 sub $0x14,%esp + struct pipecmd *cmd; + + cmd = malloc(sizeof(*cmd)); +- 407: c7 04 24 0c 00 00 00 movl $0xc,(%esp) +- 40e: e8 9d 0d 00 00 call 11b0 ++ 427: c7 04 24 0c 00 00 00 movl $0xc,(%esp) ++ 42e: e8 9d 0d 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); +- 413: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) +- 41a: 00 +- 41b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 422: 00 +- 423: 89 04 24 mov %eax,(%esp) ++ 433: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) ++ 43a: 00 ++ 43b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 442: 00 ++ 443: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); +- 426: 89 c3 mov %eax,%ebx ++ 446: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); +- 428: e8 43 08 00 00 call c70 ++ 448: e8 43 08 00 00 call c90 + cmd->type = PIPE; + cmd->left = left; +- 42d: 8b 45 08 mov 0x8(%ebp),%eax ++ 44d: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = PIPE; +- 430: c7 03 03 00 00 00 movl $0x3,(%ebx) ++ 450: c7 03 03 00 00 00 movl $0x3,(%ebx) + cmd->left = left; +- 436: 89 43 04 mov %eax,0x4(%ebx) ++ 456: 89 43 04 mov %eax,0x4(%ebx) + cmd->right = right; +- 439: 8b 45 0c mov 0xc(%ebp),%eax +- 43c: 89 43 08 mov %eax,0x8(%ebx) +- return (struct cmd*)cmd; ++ 459: 8b 45 0c mov 0xc(%ebp),%eax ++ 45c: 89 43 08 mov %eax,0x8(%ebx) ++ return (struct cmd *)cmd; + } +- 43f: 83 c4 14 add $0x14,%esp +- 442: 89 d8 mov %ebx,%eax +- 444: 5b pop %ebx +- 445: 5d pop %ebp +- 446: c3 ret +- 447: 89 f6 mov %esi,%esi +- 449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 45f: 83 c4 14 add $0x14,%esp ++ 462: 89 d8 mov %ebx,%eax ++ 464: 5b pop %ebx ++ 465: 5d pop %ebp ++ 466: c3 ret ++ 467: 89 f6 mov %esi,%esi ++ 469: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000450 : ++00000470 : + +-struct cmd* ++struct cmd * + listcmd(struct cmd *left, struct cmd *right) + { +- 450: 55 push %ebp +- 451: 89 e5 mov %esp,%ebp +- 453: 53 push %ebx +- 454: 83 ec 14 sub $0x14,%esp ++ 470: 55 push %ebp ++ 471: 89 e5 mov %esp,%ebp ++ 473: 53 push %ebx ++ 474: 83 ec 14 sub $0x14,%esp + struct listcmd *cmd; + + cmd = malloc(sizeof(*cmd)); +- 457: c7 04 24 0c 00 00 00 movl $0xc,(%esp) +- 45e: e8 4d 0d 00 00 call 11b0 ++ 477: c7 04 24 0c 00 00 00 movl $0xc,(%esp) ++ 47e: e8 4d 0d 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); +- 463: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) +- 46a: 00 +- 46b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 472: 00 +- 473: 89 04 24 mov %eax,(%esp) ++ 483: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) ++ 48a: 00 ++ 48b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 492: 00 ++ 493: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); +- 476: 89 c3 mov %eax,%ebx ++ 496: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); +- 478: e8 f3 07 00 00 call c70 ++ 498: e8 f3 07 00 00 call c90 + cmd->type = LIST; + cmd->left = left; +- 47d: 8b 45 08 mov 0x8(%ebp),%eax ++ 49d: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = LIST; +- 480: c7 03 04 00 00 00 movl $0x4,(%ebx) ++ 4a0: c7 03 04 00 00 00 movl $0x4,(%ebx) + cmd->left = left; +- 486: 89 43 04 mov %eax,0x4(%ebx) ++ 4a6: 89 43 04 mov %eax,0x4(%ebx) + cmd->right = right; +- 489: 8b 45 0c mov 0xc(%ebp),%eax +- 48c: 89 43 08 mov %eax,0x8(%ebx) +- return (struct cmd*)cmd; ++ 4a9: 8b 45 0c mov 0xc(%ebp),%eax ++ 4ac: 89 43 08 mov %eax,0x8(%ebx) ++ return (struct cmd *)cmd; + } +- 48f: 83 c4 14 add $0x14,%esp +- 492: 89 d8 mov %ebx,%eax +- 494: 5b pop %ebx +- 495: 5d pop %ebp +- 496: c3 ret +- 497: 89 f6 mov %esi,%esi +- 499: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 4af: 83 c4 14 add $0x14,%esp ++ 4b2: 89 d8 mov %ebx,%eax ++ 4b4: 5b pop %ebx ++ 4b5: 5d pop %ebp ++ 4b6: c3 ret ++ 4b7: 89 f6 mov %esi,%esi ++ 4b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000004a0 : ++000004c0 : + +-struct cmd* ++struct cmd * + backcmd(struct cmd *subcmd) + { +- 4a0: 55 push %ebp +- 4a1: 89 e5 mov %esp,%ebp +- 4a3: 53 push %ebx +- 4a4: 83 ec 14 sub $0x14,%esp ++ 4c0: 55 push %ebp ++ 4c1: 89 e5 mov %esp,%ebp ++ 4c3: 53 push %ebx ++ 4c4: 83 ec 14 sub $0x14,%esp + struct backcmd *cmd; + + cmd = malloc(sizeof(*cmd)); +- 4a7: c7 04 24 08 00 00 00 movl $0x8,(%esp) +- 4ae: e8 fd 0c 00 00 call 11b0 ++ 4c7: c7 04 24 08 00 00 00 movl $0x8,(%esp) ++ 4ce: e8 fd 0c 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); +- 4b3: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) +- 4ba: 00 +- 4bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 4c2: 00 +- 4c3: 89 04 24 mov %eax,(%esp) ++ 4d3: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) ++ 4da: 00 ++ 4db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 4e2: 00 ++ 4e3: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); +- 4c6: 89 c3 mov %eax,%ebx ++ 4e6: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); +- 4c8: e8 a3 07 00 00 call c70 ++ 4e8: e8 a3 07 00 00 call c90 + cmd->type = BACK; + cmd->cmd = subcmd; +- 4cd: 8b 45 08 mov 0x8(%ebp),%eax ++ 4ed: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = BACK; +- 4d0: c7 03 05 00 00 00 movl $0x5,(%ebx) ++ 4f0: c7 03 05 00 00 00 movl $0x5,(%ebx) + cmd->cmd = subcmd; +- 4d6: 89 43 04 mov %eax,0x4(%ebx) +- return (struct cmd*)cmd; ++ 4f6: 89 43 04 mov %eax,0x4(%ebx) ++ return (struct cmd *)cmd; + } +- 4d9: 83 c4 14 add $0x14,%esp +- 4dc: 89 d8 mov %ebx,%eax +- 4de: 5b pop %ebx +- 4df: 5d pop %ebp +- 4e0: c3 ret +- 4e1: eb 0d jmp 4f0 +- 4e3: 90 nop +- 4e4: 90 nop +- 4e5: 90 nop +- 4e6: 90 nop +- 4e7: 90 nop +- 4e8: 90 nop +- 4e9: 90 nop +- 4ea: 90 nop +- 4eb: 90 nop +- 4ec: 90 nop +- 4ed: 90 nop +- 4ee: 90 nop +- 4ef: 90 nop +- +-000004f0 : ++ 4f9: 83 c4 14 add $0x14,%esp ++ 4fc: 89 d8 mov %ebx,%eax ++ 4fe: 5b pop %ebx ++ 4ff: 5d pop %ebp ++ 500: c3 ret ++ 501: eb 0d jmp 510 ++ 503: 90 nop ++ 504: 90 nop ++ 505: 90 nop ++ 506: 90 nop ++ 507: 90 nop ++ 508: 90 nop ++ 509: 90 nop ++ 50a: 90 nop ++ 50b: 90 nop ++ 50c: 90 nop ++ 50d: 90 nop ++ 50e: 90 nop ++ 50f: 90 nop ++ ++00000510 : ++ + char whitespace[] = " \t\r\n\v"; + char symbols[] = "<|>&;()"; + +-int +-gettoken(char **ps, char *es, char **q, char **eq) ++int gettoken(char **ps, char *es, char **q, char **eq) + { +- 4f0: 55 push %ebp +- 4f1: 89 e5 mov %esp,%ebp +- 4f3: 57 push %edi +- 4f4: 56 push %esi +- 4f5: 53 push %ebx +- 4f6: 83 ec 1c sub $0x1c,%esp ++ 510: 55 push %ebp ++ 511: 89 e5 mov %esp,%ebp ++ 513: 57 push %edi ++ 514: 56 push %esi ++ 515: 53 push %ebx ++ 516: 83 ec 1c sub $0x1c,%esp + char *s; + int ret; + + s = *ps; +- 4f9: 8b 45 08 mov 0x8(%ebp),%eax ++ 519: 8b 45 08 mov 0x8(%ebp),%eax + { +- 4fc: 8b 5d 0c mov 0xc(%ebp),%ebx +- 4ff: 8b 75 10 mov 0x10(%ebp),%esi ++ 51c: 8b 5d 0c mov 0xc(%ebp),%ebx ++ 51f: 8b 75 10 mov 0x10(%ebp),%esi + s = *ps; +- 502: 8b 38 mov (%eax),%edi +- while(s < es && strchr(whitespace, *s)) +- 504: 39 df cmp %ebx,%edi +- 506: 72 0f jb 517 +- 508: eb 24 jmp 52e +- 50a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 522: 8b 38 mov (%eax),%edi ++ while (s < es && strchr(whitespace, *s)) ++ 524: 39 df cmp %ebx,%edi ++ 526: 72 0f jb 537 ++ 528: eb 24 jmp 54e ++ 52a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + s++; +- 510: 83 c7 01 add $0x1,%edi +- while(s < es && strchr(whitespace, *s)) +- 513: 39 df cmp %ebx,%edi +- 515: 74 17 je 52e +- 517: 0f be 07 movsbl (%edi),%eax +- 51a: c7 04 24 20 19 00 00 movl $0x1920,(%esp) +- 521: 89 44 24 04 mov %eax,0x4(%esp) +- 525: e8 66 07 00 00 call c90 +- 52a: 85 c0 test %eax,%eax +- 52c: 75 e2 jne 510 +- if(q) +- 52e: 85 f6 test %esi,%esi +- 530: 74 02 je 534 ++ 530: 83 c7 01 add $0x1,%edi ++ while (s < es && strchr(whitespace, *s)) ++ 533: 39 df cmp %ebx,%edi ++ 535: 74 17 je 54e ++ 537: 0f be 07 movsbl (%edi),%eax ++ 53a: c7 04 24 40 19 00 00 movl $0x1940,(%esp) ++ 541: 89 44 24 04 mov %eax,0x4(%esp) ++ 545: e8 66 07 00 00 call cb0 ++ 54a: 85 c0 test %eax,%eax ++ 54c: 75 e2 jne 530 ++ if (q) ++ 54e: 85 f6 test %esi,%esi ++ 550: 74 02 je 554 + *q = s; +- 532: 89 3e mov %edi,(%esi) ++ 552: 89 3e mov %edi,(%esi) + ret = *s; +- 534: 0f b6 0f movzbl (%edi),%ecx +- 537: 0f be f1 movsbl %cl,%esi +- switch(*s){ +- 53a: 80 f9 29 cmp $0x29,%cl ++ 554: 0f b6 0f movzbl (%edi),%ecx ++ 557: 0f be f1 movsbl %cl,%esi ++ switch (*s) ++ 55a: 80 f9 29 cmp $0x29,%cl + ret = *s; +- 53d: 89 f0 mov %esi,%eax +- switch(*s){ +- 53f: 7f 4f jg 590 +- 541: 80 f9 28 cmp $0x28,%cl +- 544: 7d 55 jge 59b +- 546: 84 c9 test %cl,%cl +- 548: 0f 85 ca 00 00 00 jne 618 ++ 55d: 89 f0 mov %esi,%eax ++ switch (*s) ++ 55f: 7f 4f jg 5b0 ++ 561: 80 f9 28 cmp $0x28,%cl ++ 564: 7d 55 jge 5bb ++ 566: 84 c9 test %cl,%cl ++ 568: 0f 85 ca 00 00 00 jne 638 + ret = 'a'; +- while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) ++ while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) + s++; + break; + } +- if(eq) +- 54e: 8b 45 14 mov 0x14(%ebp),%eax +- 551: 85 c0 test %eax,%eax +- 553: 74 05 je 55a ++ if (eq) ++ 56e: 8b 45 14 mov 0x14(%ebp),%eax ++ 571: 85 c0 test %eax,%eax ++ 573: 74 05 je 57a + *eq = s; +- 555: 8b 45 14 mov 0x14(%ebp),%eax +- 558: 89 38 mov %edi,(%eax) ++ 575: 8b 45 14 mov 0x14(%ebp),%eax ++ 578: 89 38 mov %edi,(%eax) + +- while(s < es && strchr(whitespace, *s)) +- 55a: 39 df cmp %ebx,%edi +- 55c: 72 09 jb 567 +- 55e: eb 1e jmp 57e ++ while (s < es && strchr(whitespace, *s)) ++ 57a: 39 df cmp %ebx,%edi ++ 57c: 72 09 jb 587 ++ 57e: eb 1e jmp 59e + s++; +- 560: 83 c7 01 add $0x1,%edi +- while(s < es && strchr(whitespace, *s)) +- 563: 39 df cmp %ebx,%edi +- 565: 74 17 je 57e +- 567: 0f be 07 movsbl (%edi),%eax +- 56a: c7 04 24 20 19 00 00 movl $0x1920,(%esp) +- 571: 89 44 24 04 mov %eax,0x4(%esp) +- 575: e8 16 07 00 00 call c90 +- 57a: 85 c0 test %eax,%eax +- 57c: 75 e2 jne 560 ++ 580: 83 c7 01 add $0x1,%edi ++ while (s < es && strchr(whitespace, *s)) ++ 583: 39 df cmp %ebx,%edi ++ 585: 74 17 je 59e ++ 587: 0f be 07 movsbl (%edi),%eax ++ 58a: c7 04 24 40 19 00 00 movl $0x1940,(%esp) ++ 591: 89 44 24 04 mov %eax,0x4(%esp) ++ 595: e8 16 07 00 00 call cb0 ++ 59a: 85 c0 test %eax,%eax ++ 59c: 75 e2 jne 580 + *ps = s; +- 57e: 8b 45 08 mov 0x8(%ebp),%eax +- 581: 89 38 mov %edi,(%eax) ++ 59e: 8b 45 08 mov 0x8(%ebp),%eax ++ 5a1: 89 38 mov %edi,(%eax) + return ret; + } +- 583: 83 c4 1c add $0x1c,%esp +- 586: 89 f0 mov %esi,%eax +- 588: 5b pop %ebx +- 589: 5e pop %esi +- 58a: 5f pop %edi +- 58b: 5d pop %ebp +- 58c: c3 ret +- 58d: 8d 76 00 lea 0x0(%esi),%esi +- switch(*s){ +- 590: 80 f9 3e cmp $0x3e,%cl +- 593: 75 0b jne 5a0 +- if(*s == '>'){ +- 595: 80 7f 01 3e cmpb $0x3e,0x1(%edi) +- 599: 74 6d je 608 ++ 5a3: 83 c4 1c add $0x1c,%esp ++ 5a6: 89 f0 mov %esi,%eax ++ 5a8: 5b pop %ebx ++ 5a9: 5e pop %esi ++ 5aa: 5f pop %edi ++ 5ab: 5d pop %ebp ++ 5ac: c3 ret ++ 5ad: 8d 76 00 lea 0x0(%esi),%esi ++ switch (*s) ++ 5b0: 80 f9 3e cmp $0x3e,%cl ++ 5b3: 75 0b jne 5c0 ++ if (*s == '>') ++ 5b5: 80 7f 01 3e cmpb $0x3e,0x1(%edi) ++ 5b9: 74 6d je 628 + s++; +- 59b: 83 c7 01 add $0x1,%edi +- 59e: eb ae jmp 54e +- switch(*s){ +- 5a0: 7f 56 jg 5f8 +- 5a2: 83 e9 3b sub $0x3b,%ecx +- 5a5: 80 f9 01 cmp $0x1,%cl +- 5a8: 76 f1 jbe 59b +- while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) +- 5aa: 39 fb cmp %edi,%ebx +- 5ac: 77 2b ja 5d9 +- 5ae: 66 90 xchg %ax,%ax +- 5b0: eb 3b jmp 5ed +- 5b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 5b8: 0f be 07 movsbl (%edi),%eax +- 5bb: c7 04 24 18 19 00 00 movl $0x1918,(%esp) +- 5c2: 89 44 24 04 mov %eax,0x4(%esp) +- 5c6: e8 c5 06 00 00 call c90 +- 5cb: 85 c0 test %eax,%eax +- 5cd: 75 1e jne 5ed ++ 5bb: 83 c7 01 add $0x1,%edi ++ 5be: eb ae jmp 56e ++ switch (*s) ++ 5c0: 7f 56 jg 618 ++ 5c2: 83 e9 3b sub $0x3b,%ecx ++ 5c5: 80 f9 01 cmp $0x1,%cl ++ 5c8: 76 f1 jbe 5bb ++ while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) ++ 5ca: 39 fb cmp %edi,%ebx ++ 5cc: 77 2b ja 5f9 ++ 5ce: 66 90 xchg %ax,%ax ++ 5d0: eb 3b jmp 60d ++ 5d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 5d8: 0f be 07 movsbl (%edi),%eax ++ 5db: c7 04 24 38 19 00 00 movl $0x1938,(%esp) ++ 5e2: 89 44 24 04 mov %eax,0x4(%esp) ++ 5e6: e8 c5 06 00 00 call cb0 ++ 5eb: 85 c0 test %eax,%eax ++ 5ed: 75 1e jne 60d + s++; +- 5cf: 83 c7 01 add $0x1,%edi +- while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) +- 5d2: 39 df cmp %ebx,%edi +- 5d4: 74 17 je 5ed +- 5d6: 0f be 07 movsbl (%edi),%eax +- 5d9: 89 44 24 04 mov %eax,0x4(%esp) +- 5dd: c7 04 24 20 19 00 00 movl $0x1920,(%esp) +- 5e4: e8 a7 06 00 00 call c90 +- 5e9: 85 c0 test %eax,%eax +- 5eb: 74 cb je 5b8 ++ 5ef: 83 c7 01 add $0x1,%edi ++ while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) ++ 5f2: 39 df cmp %ebx,%edi ++ 5f4: 74 17 je 60d ++ 5f6: 0f be 07 movsbl (%edi),%eax ++ 5f9: 89 44 24 04 mov %eax,0x4(%esp) ++ 5fd: c7 04 24 40 19 00 00 movl $0x1940,(%esp) ++ 604: e8 a7 06 00 00 call cb0 ++ 609: 85 c0 test %eax,%eax ++ 60b: 74 cb je 5d8 + ret = 'a'; +- 5ed: be 61 00 00 00 mov $0x61,%esi +- 5f2: e9 57 ff ff ff jmp 54e +- 5f7: 90 nop +- switch(*s){ +- 5f8: 80 f9 7c cmp $0x7c,%cl +- 5fb: 74 9e je 59b +- 5fd: 8d 76 00 lea 0x0(%esi),%esi +- 600: eb a8 jmp 5aa +- 602: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 60d: be 61 00 00 00 mov $0x61,%esi ++ 612: e9 57 ff ff ff jmp 56e ++ 617: 90 nop ++ switch (*s) ++ 618: 80 f9 7c cmp $0x7c,%cl ++ 61b: 74 9e je 5bb ++ 61d: 8d 76 00 lea 0x0(%esi),%esi ++ 620: eb a8 jmp 5ca ++ 622: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + s++; +- 608: 83 c7 02 add $0x2,%edi ++ 628: 83 c7 02 add $0x2,%edi + ret = '+'; +- 60b: be 2b 00 00 00 mov $0x2b,%esi +- 610: e9 39 ff ff ff jmp 54e +- 615: 8d 76 00 lea 0x0(%esi),%esi +- switch(*s){ +- 618: 80 f9 26 cmp $0x26,%cl +- 61b: 75 8d jne 5aa +- 61d: e9 79 ff ff ff jmp 59b +- 622: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- 629: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi +- +-00000630 : +- +-int +-peek(char **ps, char *es, char *toks) ++ 62b: be 2b 00 00 00 mov $0x2b,%esi ++ 630: e9 39 ff ff ff jmp 56e ++ 635: 8d 76 00 lea 0x0(%esi),%esi ++ switch (*s) ++ 638: 80 f9 26 cmp $0x26,%cl ++ 63b: 75 8d jne 5ca ++ 63d: e9 79 ff ff ff jmp 5bb ++ 642: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ ++00000650 : ++ ++int peek(char **ps, char *es, char *toks) + { +- 630: 55 push %ebp +- 631: 89 e5 mov %esp,%ebp +- 633: 57 push %edi +- 634: 56 push %esi +- 635: 53 push %ebx +- 636: 83 ec 1c sub $0x1c,%esp +- 639: 8b 7d 08 mov 0x8(%ebp),%edi +- 63c: 8b 75 0c mov 0xc(%ebp),%esi ++ 650: 55 push %ebp ++ 651: 89 e5 mov %esp,%ebp ++ 653: 57 push %edi ++ 654: 56 push %esi ++ 655: 53 push %ebx ++ 656: 83 ec 1c sub $0x1c,%esp ++ 659: 8b 7d 08 mov 0x8(%ebp),%edi ++ 65c: 8b 75 0c mov 0xc(%ebp),%esi + char *s; + + s = *ps; +- 63f: 8b 1f mov (%edi),%ebx +- while(s < es && strchr(whitespace, *s)) +- 641: 39 f3 cmp %esi,%ebx +- 643: 72 0a jb 64f +- 645: eb 1f jmp 666 +- 647: 90 nop ++ 65f: 8b 1f mov (%edi),%ebx ++ while (s < es && strchr(whitespace, *s)) ++ 661: 39 f3 cmp %esi,%ebx ++ 663: 72 0a jb 66f ++ 665: eb 1f jmp 686 ++ 667: 90 nop + s++; +- 648: 83 c3 01 add $0x1,%ebx +- while(s < es && strchr(whitespace, *s)) +- 64b: 39 f3 cmp %esi,%ebx +- 64d: 74 17 je 666 +- 64f: 0f be 03 movsbl (%ebx),%eax +- 652: c7 04 24 20 19 00 00 movl $0x1920,(%esp) +- 659: 89 44 24 04 mov %eax,0x4(%esp) +- 65d: e8 2e 06 00 00 call c90 +- 662: 85 c0 test %eax,%eax +- 664: 75 e2 jne 648 ++ 668: 83 c3 01 add $0x1,%ebx ++ while (s < es && strchr(whitespace, *s)) ++ 66b: 39 f3 cmp %esi,%ebx ++ 66d: 74 17 je 686 ++ 66f: 0f be 03 movsbl (%ebx),%eax ++ 672: c7 04 24 40 19 00 00 movl $0x1940,(%esp) ++ 679: 89 44 24 04 mov %eax,0x4(%esp) ++ 67d: e8 2e 06 00 00 call cb0 ++ 682: 85 c0 test %eax,%eax ++ 684: 75 e2 jne 668 + *ps = s; +- 666: 89 1f mov %ebx,(%edi) ++ 686: 89 1f mov %ebx,(%edi) + return *s && strchr(toks, *s); +- 668: 0f be 13 movsbl (%ebx),%edx +- 66b: 31 c0 xor %eax,%eax +- 66d: 84 d2 test %dl,%dl +- 66f: 74 17 je 688 +- 671: 8b 45 10 mov 0x10(%ebp),%eax +- 674: 89 54 24 04 mov %edx,0x4(%esp) +- 678: 89 04 24 mov %eax,(%esp) +- 67b: e8 10 06 00 00 call c90 +- 680: 85 c0 test %eax,%eax +- 682: 0f 95 c0 setne %al +- 685: 0f b6 c0 movzbl %al,%eax ++ 688: 0f be 13 movsbl (%ebx),%edx ++ 68b: 31 c0 xor %eax,%eax ++ 68d: 84 d2 test %dl,%dl ++ 68f: 74 17 je 6a8 ++ 691: 8b 45 10 mov 0x10(%ebp),%eax ++ 694: 89 54 24 04 mov %edx,0x4(%esp) ++ 698: 89 04 24 mov %eax,(%esp) ++ 69b: e8 10 06 00 00 call cb0 ++ 6a0: 85 c0 test %eax,%eax ++ 6a2: 0f 95 c0 setne %al ++ 6a5: 0f b6 c0 movzbl %al,%eax + } +- 688: 83 c4 1c add $0x1c,%esp +- 68b: 5b pop %ebx +- 68c: 5e pop %esi +- 68d: 5f pop %edi +- 68e: 5d pop %ebp +- 68f: c3 ret +- +-00000690 : ++ 6a8: 83 c4 1c add $0x1c,%esp ++ 6ab: 5b pop %ebx ++ 6ac: 5e pop %esi ++ 6ad: 5f pop %edi ++ 6ae: 5d pop %ebp ++ 6af: c3 ret ++ ++000006b0 : + return cmd; + } + +-struct cmd* ++struct cmd * + parseredirs(struct cmd *cmd, char **ps, char *es) + { +- 690: 55 push %ebp +- 691: 89 e5 mov %esp,%ebp +- 693: 57 push %edi +- 694: 56 push %esi +- 695: 53 push %ebx +- 696: 83 ec 3c sub $0x3c,%esp +- 699: 8b 75 0c mov 0xc(%ebp),%esi +- 69c: 8b 5d 10 mov 0x10(%ebp),%ebx +- 69f: 90 nop ++ 6b0: 55 push %ebp ++ 6b1: 89 e5 mov %esp,%ebp ++ 6b3: 57 push %edi ++ 6b4: 56 push %esi ++ 6b5: 53 push %ebx ++ 6b6: 83 ec 3c sub $0x3c,%esp ++ 6b9: 8b 75 0c mov 0xc(%ebp),%esi ++ 6bc: 8b 5d 10 mov 0x10(%ebp),%ebx ++ 6bf: 90 nop + int tok; + char *q, *eq; + +- while(peek(ps, es, "<>")){ +- 6a0: c7 44 24 08 e9 12 00 movl $0x12e9,0x8(%esp) +- 6a7: 00 +- 6a8: 89 5c 24 04 mov %ebx,0x4(%esp) +- 6ac: 89 34 24 mov %esi,(%esp) +- 6af: e8 7c ff ff ff call 630 +- 6b4: 85 c0 test %eax,%eax +- 6b6: 0f 84 9c 00 00 00 je 758 ++ while (peek(ps, es, "<>")) ++ 6c0: c7 44 24 08 09 13 00 movl $0x1309,0x8(%esp) ++ 6c7: 00 ++ 6c8: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 6cc: 89 34 24 mov %esi,(%esp) ++ 6cf: e8 7c ff ff ff call 650 ++ 6d4: 85 c0 test %eax,%eax ++ 6d6: 0f 84 9c 00 00 00 je 778 ++ { + tok = gettoken(ps, es, 0, 0); +- 6bc: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- 6c3: 00 +- 6c4: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +- 6cb: 00 +- 6cc: 89 5c 24 04 mov %ebx,0x4(%esp) +- 6d0: 89 34 24 mov %esi,(%esp) +- 6d3: e8 18 fe ff ff call 4f0 +- if(gettoken(ps, es, &q, &eq) != 'a') +- 6d8: 89 5c 24 04 mov %ebx,0x4(%esp) +- 6dc: 89 34 24 mov %esi,(%esp) ++ 6dc: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ 6e3: 00 ++ 6e4: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) ++ 6eb: 00 ++ 6ec: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 6f0: 89 34 24 mov %esi,(%esp) ++ 6f3: e8 18 fe ff ff call 510 ++ if (gettoken(ps, es, &q, &eq) != 'a') ++ 6f8: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 6fc: 89 34 24 mov %esi,(%esp) + tok = gettoken(ps, es, 0, 0); +- 6df: 89 c7 mov %eax,%edi +- if(gettoken(ps, es, &q, &eq) != 'a') +- 6e1: 8d 45 e4 lea -0x1c(%ebp),%eax +- 6e4: 89 44 24 0c mov %eax,0xc(%esp) +- 6e8: 8d 45 e0 lea -0x20(%ebp),%eax +- 6eb: 89 44 24 08 mov %eax,0x8(%esp) +- 6ef: e8 fc fd ff ff call 4f0 +- 6f4: 83 f8 61 cmp $0x61,%eax +- 6f7: 75 6a jne 763 ++ 6ff: 89 c7 mov %eax,%edi ++ if (gettoken(ps, es, &q, &eq) != 'a') ++ 701: 8d 45 e4 lea -0x1c(%ebp),%eax ++ 704: 89 44 24 0c mov %eax,0xc(%esp) ++ 708: 8d 45 e0 lea -0x20(%ebp),%eax ++ 70b: 89 44 24 08 mov %eax,0x8(%esp) ++ 70f: e8 fc fd ff ff call 510 ++ 714: 83 f8 61 cmp $0x61,%eax ++ 717: 75 6a jne 783 + panic("missing file for redirection"); +- switch(tok){ +- 6f9: 83 ff 3c cmp $0x3c,%edi +- 6fc: 74 42 je 740 +- 6fe: 83 ff 3e cmp $0x3e,%edi +- 701: 74 05 je 708 +- 703: 83 ff 2b cmp $0x2b,%edi +- 706: 75 98 jne 6a0 ++ switch (tok) ++ 719: 83 ff 3c cmp $0x3c,%edi ++ 71c: 74 42 je 760 ++ 71e: 83 ff 3e cmp $0x3e,%edi ++ 721: 74 05 je 728 ++ 723: 83 ff 2b cmp $0x2b,%edi ++ 726: 75 98 jne 6c0 + break; + case '>': +- cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); ++ cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); + break; +- case '+': // >> +- cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); +- 708: c7 44 24 10 01 00 00 movl $0x1,0x10(%esp) +- 70f: 00 +- 710: c7 44 24 0c 01 02 00 movl $0x201,0xc(%esp) +- 717: 00 +- 718: 8b 45 e4 mov -0x1c(%ebp),%eax +- 71b: 89 44 24 08 mov %eax,0x8(%esp) +- 71f: 8b 45 e0 mov -0x20(%ebp),%eax +- 722: 89 44 24 04 mov %eax,0x4(%esp) +- 726: 8b 45 08 mov 0x8(%ebp),%eax +- 729: 89 04 24 mov %eax,(%esp) +- 72c: e8 6f fc ff ff call 3a0 +- 731: 89 45 08 mov %eax,0x8(%ebp) ++ case '+': // >> ++ cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); ++ 728: c7 44 24 10 01 00 00 movl $0x1,0x10(%esp) ++ 72f: 00 ++ 730: c7 44 24 0c 01 02 00 movl $0x201,0xc(%esp) ++ 737: 00 ++ 738: 8b 45 e4 mov -0x1c(%ebp),%eax ++ 73b: 89 44 24 08 mov %eax,0x8(%esp) ++ 73f: 8b 45 e0 mov -0x20(%ebp),%eax ++ 742: 89 44 24 04 mov %eax,0x4(%esp) ++ 746: 8b 45 08 mov 0x8(%ebp),%eax ++ 749: 89 04 24 mov %eax,(%esp) ++ 74c: e8 6f fc ff ff call 3c0 ++ 751: 89 45 08 mov %eax,0x8(%ebp) + break; +- 734: e9 67 ff ff ff jmp 6a0 +- 739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 754: e9 67 ff ff ff jmp 6c0 ++ 759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + cmd = redircmd(cmd, q, eq, O_RDONLY, 0); +- 740: c7 44 24 10 00 00 00 movl $0x0,0x10(%esp) +- 747: 00 +- 748: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- 74f: 00 +- 750: eb c6 jmp 718 +- 752: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 760: c7 44 24 10 00 00 00 movl $0x0,0x10(%esp) ++ 767: 00 ++ 768: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ 76f: 00 ++ 770: eb c6 jmp 738 ++ 772: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + } + } + return cmd; + } +- 758: 8b 45 08 mov 0x8(%ebp),%eax +- 75b: 83 c4 3c add $0x3c,%esp +- 75e: 5b pop %ebx +- 75f: 5e pop %esi +- 760: 5f pop %edi +- 761: 5d pop %ebp +- 762: c3 ret ++ 778: 8b 45 08 mov 0x8(%ebp),%eax ++ 77b: 83 c4 3c add $0x3c,%esp ++ 77e: 5b pop %ebx ++ 77f: 5e pop %esi ++ 780: 5f pop %edi ++ 781: 5d pop %ebp ++ 782: c3 ret + panic("missing file for redirection"); +- 763: c7 04 24 cc 12 00 00 movl $0x12cc,(%esp) +- 76a: e8 f1 f9 ff ff call 160 +- 76f: 90 nop ++ 783: c7 04 24 ec 12 00 00 movl $0x12ec,(%esp) ++ 78a: e8 e1 f9 ff ff call 170 ++ 78f: 90 nop + +-00000770 : ++00000790 : + return cmd; + } + +-struct cmd* ++struct cmd * + parseexec(char **ps, char *es) + { +- 770: 55 push %ebp +- 771: 89 e5 mov %esp,%ebp +- 773: 57 push %edi +- 774: 56 push %esi +- 775: 53 push %ebx +- 776: 83 ec 3c sub $0x3c,%esp +- 779: 8b 75 08 mov 0x8(%ebp),%esi +- 77c: 8b 7d 0c mov 0xc(%ebp),%edi ++ 790: 55 push %ebp ++ 791: 89 e5 mov %esp,%ebp ++ 793: 57 push %edi ++ 794: 56 push %esi ++ 795: 53 push %ebx ++ 796: 83 ec 3c sub $0x3c,%esp ++ 799: 8b 75 08 mov 0x8(%ebp),%esi ++ 79c: 8b 7d 0c mov 0xc(%ebp),%edi + char *q, *eq; + int tok, argc; + struct execcmd *cmd; + struct cmd *ret; + +- if(peek(ps, es, "(")) +- 77f: c7 44 24 08 ec 12 00 movl $0x12ec,0x8(%esp) +- 786: 00 +- 787: 89 34 24 mov %esi,(%esp) +- 78a: 89 7c 24 04 mov %edi,0x4(%esp) +- 78e: e8 9d fe ff ff call 630 +- 793: 85 c0 test %eax,%eax +- 795: 0f 85 a5 00 00 00 jne 840 ++ if (peek(ps, es, "(")) ++ 79f: c7 44 24 08 0c 13 00 movl $0x130c,0x8(%esp) ++ 7a6: 00 ++ 7a7: 89 34 24 mov %esi,(%esp) ++ 7aa: 89 7c 24 04 mov %edi,0x4(%esp) ++ 7ae: e8 9d fe ff ff call 650 ++ 7b3: 85 c0 test %eax,%eax ++ 7b5: 0f 85 a5 00 00 00 jne 860 + return parseblock(ps, es); + + ret = execcmd(); +- 79b: e8 c0 fb ff ff call 360 +- cmd = (struct execcmd*)ret; ++ 7bb: e8 c0 fb ff ff call 380 ++ cmd = (struct execcmd *)ret; + + argc = 0; + ret = parseredirs(ret, ps, es); +- 7a0: 89 7c 24 08 mov %edi,0x8(%esp) +- 7a4: 89 74 24 04 mov %esi,0x4(%esp) +- 7a8: 89 04 24 mov %eax,(%esp) ++ 7c0: 89 7c 24 08 mov %edi,0x8(%esp) ++ 7c4: 89 74 24 04 mov %esi,0x4(%esp) ++ 7c8: 89 04 24 mov %eax,(%esp) + ret = execcmd(); +- 7ab: 89 c3 mov %eax,%ebx +- 7ad: 89 45 cc mov %eax,-0x34(%ebp) ++ 7cb: 89 c3 mov %eax,%ebx ++ 7cd: 89 45 cc mov %eax,-0x34(%ebp) + ret = parseredirs(ret, ps, es); +- 7b0: e8 db fe ff ff call 690 ++ 7d0: e8 db fe ff ff call 6b0 + argc = 0; +- 7b5: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) ++ 7d5: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) + ret = parseredirs(ret, ps, es); +- 7bc: 89 45 d0 mov %eax,-0x30(%ebp) +- while(!peek(ps, es, "|)&;")){ +- 7bf: eb 1d jmp 7de +- 7c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 7dc: 89 45 d0 mov %eax,-0x30(%ebp) ++ while (!peek(ps, es, "|)&;")) ++ 7df: eb 1d jmp 7fe ++ 7e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + cmd->argv[argc] = q; + cmd->eargv[argc] = eq; + argc++; +- if(argc >= MAXARGS) ++ if (argc >= MAXARGS) + panic("too many args"); + ret = parseredirs(ret, ps, es); +- 7c8: 8b 45 d0 mov -0x30(%ebp),%eax +- 7cb: 89 7c 24 08 mov %edi,0x8(%esp) +- 7cf: 89 74 24 04 mov %esi,0x4(%esp) +- 7d3: 89 04 24 mov %eax,(%esp) +- 7d6: e8 b5 fe ff ff call 690 +- 7db: 89 45 d0 mov %eax,-0x30(%ebp) +- while(!peek(ps, es, "|)&;")){ +- 7de: c7 44 24 08 03 13 00 movl $0x1303,0x8(%esp) +- 7e5: 00 +- 7e6: 89 7c 24 04 mov %edi,0x4(%esp) +- 7ea: 89 34 24 mov %esi,(%esp) +- 7ed: e8 3e fe ff ff call 630 +- 7f2: 85 c0 test %eax,%eax +- 7f4: 75 62 jne 858 +- if((tok=gettoken(ps, es, &q, &eq)) == 0) +- 7f6: 8d 45 e4 lea -0x1c(%ebp),%eax +- 7f9: 89 44 24 0c mov %eax,0xc(%esp) +- 7fd: 8d 45 e0 lea -0x20(%ebp),%eax +- 800: 89 44 24 08 mov %eax,0x8(%esp) +- 804: 89 7c 24 04 mov %edi,0x4(%esp) +- 808: 89 34 24 mov %esi,(%esp) +- 80b: e8 e0 fc ff ff call 4f0 +- 810: 85 c0 test %eax,%eax +- 812: 74 44 je 858 +- if(tok != 'a') +- 814: 83 f8 61 cmp $0x61,%eax +- 817: 75 61 jne 87a ++ 7e8: 8b 45 d0 mov -0x30(%ebp),%eax ++ 7eb: 89 7c 24 08 mov %edi,0x8(%esp) ++ 7ef: 89 74 24 04 mov %esi,0x4(%esp) ++ 7f3: 89 04 24 mov %eax,(%esp) ++ 7f6: e8 b5 fe ff ff call 6b0 ++ 7fb: 89 45 d0 mov %eax,-0x30(%ebp) ++ while (!peek(ps, es, "|)&;")) ++ 7fe: c7 44 24 08 23 13 00 movl $0x1323,0x8(%esp) ++ 805: 00 ++ 806: 89 7c 24 04 mov %edi,0x4(%esp) ++ 80a: 89 34 24 mov %esi,(%esp) ++ 80d: e8 3e fe ff ff call 650 ++ 812: 85 c0 test %eax,%eax ++ 814: 75 62 jne 878 ++ if ((tok = gettoken(ps, es, &q, &eq)) == 0) ++ 816: 8d 45 e4 lea -0x1c(%ebp),%eax ++ 819: 89 44 24 0c mov %eax,0xc(%esp) ++ 81d: 8d 45 e0 lea -0x20(%ebp),%eax ++ 820: 89 44 24 08 mov %eax,0x8(%esp) ++ 824: 89 7c 24 04 mov %edi,0x4(%esp) ++ 828: 89 34 24 mov %esi,(%esp) ++ 82b: e8 e0 fc ff ff call 510 ++ 830: 85 c0 test %eax,%eax ++ 832: 74 44 je 878 ++ if (tok != 'a') ++ 834: 83 f8 61 cmp $0x61,%eax ++ 837: 75 61 jne 89a + cmd->argv[argc] = q; +- 819: 8b 45 e0 mov -0x20(%ebp),%eax +- 81c: 83 c3 04 add $0x4,%ebx ++ 839: 8b 45 e0 mov -0x20(%ebp),%eax ++ 83c: 83 c3 04 add $0x4,%ebx + argc++; +- 81f: 83 45 d4 01 addl $0x1,-0x2c(%ebp) ++ 83f: 83 45 d4 01 addl $0x1,-0x2c(%ebp) + cmd->argv[argc] = q; +- 823: 89 03 mov %eax,(%ebx) ++ 843: 89 03 mov %eax,(%ebx) + cmd->eargv[argc] = eq; +- 825: 8b 45 e4 mov -0x1c(%ebp),%eax +- 828: 89 43 28 mov %eax,0x28(%ebx) +- if(argc >= MAXARGS) +- 82b: 83 7d d4 0a cmpl $0xa,-0x2c(%ebp) +- 82f: 75 97 jne 7c8 ++ 845: 8b 45 e4 mov -0x1c(%ebp),%eax ++ 848: 89 43 28 mov %eax,0x28(%ebx) ++ if (argc >= MAXARGS) ++ 84b: 83 7d d4 0a cmpl $0xa,-0x2c(%ebp) ++ 84f: 75 97 jne 7e8 + panic("too many args"); +- 831: c7 04 24 f5 12 00 00 movl $0x12f5,(%esp) +- 838: e8 23 f9 ff ff call 160 +- 83d: 8d 76 00 lea 0x0(%esi),%esi ++ 851: c7 04 24 15 13 00 00 movl $0x1315,(%esp) ++ 858: e8 13 f9 ff ff call 170 ++ 85d: 8d 76 00 lea 0x0(%esi),%esi + return parseblock(ps, es); +- 840: 89 7c 24 04 mov %edi,0x4(%esp) +- 844: 89 34 24 mov %esi,(%esp) +- 847: e8 84 01 00 00 call 9d0 ++ 860: 89 7c 24 04 mov %edi,0x4(%esp) ++ 864: 89 34 24 mov %esi,(%esp) ++ 867: e8 84 01 00 00 call 9f0 + } + cmd->argv[argc] = 0; + cmd->eargv[argc] = 0; + return ret; + } +- 84c: 83 c4 3c add $0x3c,%esp +- 84f: 5b pop %ebx +- 850: 5e pop %esi +- 851: 5f pop %edi +- 852: 5d pop %ebp +- 853: c3 ret +- 854: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 858: 8b 45 cc mov -0x34(%ebp),%eax +- 85b: 8b 55 d4 mov -0x2c(%ebp),%edx +- 85e: 8d 04 90 lea (%eax,%edx,4),%eax ++ 86c: 83 c4 3c add $0x3c,%esp ++ 86f: 5b pop %ebx ++ 870: 5e pop %esi ++ 871: 5f pop %edi ++ 872: 5d pop %ebp ++ 873: c3 ret ++ 874: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 878: 8b 45 cc mov -0x34(%ebp),%eax ++ 87b: 8b 55 d4 mov -0x2c(%ebp),%edx ++ 87e: 8d 04 90 lea (%eax,%edx,4),%eax + cmd->argv[argc] = 0; +- 861: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) ++ 881: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) + cmd->eargv[argc] = 0; +- 868: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax) ++ 888: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax) + return ret; +- 86f: 8b 45 d0 mov -0x30(%ebp),%eax ++ 88f: 8b 45 d0 mov -0x30(%ebp),%eax + } +- 872: 83 c4 3c add $0x3c,%esp +- 875: 5b pop %ebx +- 876: 5e pop %esi +- 877: 5f pop %edi +- 878: 5d pop %ebp +- 879: c3 ret ++ 892: 83 c4 3c add $0x3c,%esp ++ 895: 5b pop %ebx ++ 896: 5e pop %esi ++ 897: 5f pop %edi ++ 898: 5d pop %ebp ++ 899: c3 ret + panic("syntax"); +- 87a: c7 04 24 ee 12 00 00 movl $0x12ee,(%esp) +- 881: e8 da f8 ff ff call 160 +- 886: 8d 76 00 lea 0x0(%esi),%esi +- 889: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 89a: c7 04 24 0e 13 00 00 movl $0x130e,(%esp) ++ 8a1: e8 ca f8 ff ff call 170 ++ 8a6: 8d 76 00 lea 0x0(%esi),%esi ++ 8a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000890 : ++000008b0 : + { +- 890: 55 push %ebp +- 891: 89 e5 mov %esp,%ebp +- 893: 57 push %edi +- 894: 56 push %esi +- 895: 53 push %ebx +- 896: 83 ec 1c sub $0x1c,%esp +- 899: 8b 5d 08 mov 0x8(%ebp),%ebx +- 89c: 8b 75 0c mov 0xc(%ebp),%esi ++ 8b0: 55 push %ebp ++ 8b1: 89 e5 mov %esp,%ebp ++ 8b3: 57 push %edi ++ 8b4: 56 push %esi ++ 8b5: 53 push %ebx ++ 8b6: 83 ec 1c sub $0x1c,%esp ++ 8b9: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 8bc: 8b 75 0c mov 0xc(%ebp),%esi + cmd = parseexec(ps, es); +- 89f: 89 1c 24 mov %ebx,(%esp) +- 8a2: 89 74 24 04 mov %esi,0x4(%esp) +- 8a6: e8 c5 fe ff ff call 770 +- if(peek(ps, es, "|")){ +- 8ab: c7 44 24 08 08 13 00 movl $0x1308,0x8(%esp) +- 8b2: 00 +- 8b3: 89 74 24 04 mov %esi,0x4(%esp) +- 8b7: 89 1c 24 mov %ebx,(%esp) ++ 8bf: 89 1c 24 mov %ebx,(%esp) ++ 8c2: 89 74 24 04 mov %esi,0x4(%esp) ++ 8c6: e8 c5 fe ff ff call 790 ++ if (peek(ps, es, "|")) ++ 8cb: c7 44 24 08 28 13 00 movl $0x1328,0x8(%esp) ++ 8d2: 00 ++ 8d3: 89 74 24 04 mov %esi,0x4(%esp) ++ 8d7: 89 1c 24 mov %ebx,(%esp) + cmd = parseexec(ps, es); +- 8ba: 89 c7 mov %eax,%edi +- if(peek(ps, es, "|")){ +- 8bc: e8 6f fd ff ff call 630 +- 8c1: 85 c0 test %eax,%eax +- 8c3: 75 0b jne 8d0 ++ 8da: 89 c7 mov %eax,%edi ++ if (peek(ps, es, "|")) ++ 8dc: e8 6f fd ff ff call 650 ++ 8e1: 85 c0 test %eax,%eax ++ 8e3: 75 0b jne 8f0 + } +- 8c5: 83 c4 1c add $0x1c,%esp +- 8c8: 89 f8 mov %edi,%eax +- 8ca: 5b pop %ebx +- 8cb: 5e pop %esi +- 8cc: 5f pop %edi +- 8cd: 5d pop %ebp +- 8ce: c3 ret +- 8cf: 90 nop ++ 8e5: 83 c4 1c add $0x1c,%esp ++ 8e8: 89 f8 mov %edi,%eax ++ 8ea: 5b pop %ebx ++ 8eb: 5e pop %esi ++ 8ec: 5f pop %edi ++ 8ed: 5d pop %ebp ++ 8ee: c3 ret ++ 8ef: 90 nop + gettoken(ps, es, 0, 0); +- 8d0: 89 74 24 04 mov %esi,0x4(%esp) +- 8d4: 89 1c 24 mov %ebx,(%esp) +- 8d7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- 8de: 00 +- 8df: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +- 8e6: 00 +- 8e7: e8 04 fc ff ff call 4f0 ++ 8f0: 89 74 24 04 mov %esi,0x4(%esp) ++ 8f4: 89 1c 24 mov %ebx,(%esp) ++ 8f7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ 8fe: 00 ++ 8ff: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) ++ 906: 00 ++ 907: e8 04 fc ff ff call 510 + cmd = pipecmd(cmd, parsepipe(ps, es)); +- 8ec: 89 74 24 04 mov %esi,0x4(%esp) +- 8f0: 89 1c 24 mov %ebx,(%esp) +- 8f3: e8 98 ff ff ff call 890 +- 8f8: 89 7d 08 mov %edi,0x8(%ebp) +- 8fb: 89 45 0c mov %eax,0xc(%ebp) ++ 90c: 89 74 24 04 mov %esi,0x4(%esp) ++ 910: 89 1c 24 mov %ebx,(%esp) ++ 913: e8 98 ff ff ff call 8b0 ++ 918: 89 7d 08 mov %edi,0x8(%ebp) ++ 91b: 89 45 0c mov %eax,0xc(%ebp) + } +- 8fe: 83 c4 1c add $0x1c,%esp +- 901: 5b pop %ebx +- 902: 5e pop %esi +- 903: 5f pop %edi +- 904: 5d pop %ebp ++ 91e: 83 c4 1c add $0x1c,%esp ++ 921: 5b pop %ebx ++ 922: 5e pop %esi ++ 923: 5f pop %edi ++ 924: 5d pop %ebp + cmd = pipecmd(cmd, parsepipe(ps, es)); +- 905: e9 f6 fa ff ff jmp 400 +- 90a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 925: e9 f6 fa ff ff jmp 420 ++ 92a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-00000910 : ++00000930 : + { +- 910: 55 push %ebp +- 911: 89 e5 mov %esp,%ebp +- 913: 57 push %edi +- 914: 56 push %esi +- 915: 53 push %ebx +- 916: 83 ec 1c sub $0x1c,%esp +- 919: 8b 5d 08 mov 0x8(%ebp),%ebx +- 91c: 8b 75 0c mov 0xc(%ebp),%esi ++ 930: 55 push %ebp ++ 931: 89 e5 mov %esp,%ebp ++ 933: 57 push %edi ++ 934: 56 push %esi ++ 935: 53 push %ebx ++ 936: 83 ec 1c sub $0x1c,%esp ++ 939: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 93c: 8b 75 0c mov 0xc(%ebp),%esi + cmd = parsepipe(ps, es); +- 91f: 89 1c 24 mov %ebx,(%esp) +- 922: 89 74 24 04 mov %esi,0x4(%esp) +- 926: e8 65 ff ff ff call 890 +- 92b: 89 c7 mov %eax,%edi +- while(peek(ps, es, "&")){ +- 92d: eb 27 jmp 956 +- 92f: 90 nop ++ 93f: 89 1c 24 mov %ebx,(%esp) ++ 942: 89 74 24 04 mov %esi,0x4(%esp) ++ 946: e8 65 ff ff ff call 8b0 ++ 94b: 89 c7 mov %eax,%edi ++ while (peek(ps, es, "&")) ++ 94d: eb 27 jmp 976 ++ 94f: 90 nop + gettoken(ps, es, 0, 0); +- 930: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- 937: 00 +- 938: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +- 93f: 00 +- 940: 89 74 24 04 mov %esi,0x4(%esp) +- 944: 89 1c 24 mov %ebx,(%esp) +- 947: e8 a4 fb ff ff call 4f0 ++ 950: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ 957: 00 ++ 958: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) ++ 95f: 00 ++ 960: 89 74 24 04 mov %esi,0x4(%esp) ++ 964: 89 1c 24 mov %ebx,(%esp) ++ 967: e8 a4 fb ff ff call 510 + cmd = backcmd(cmd); +- 94c: 89 3c 24 mov %edi,(%esp) +- 94f: e8 4c fb ff ff call 4a0 +- 954: 89 c7 mov %eax,%edi +- while(peek(ps, es, "&")){ +- 956: c7 44 24 08 0a 13 00 movl $0x130a,0x8(%esp) +- 95d: 00 +- 95e: 89 74 24 04 mov %esi,0x4(%esp) +- 962: 89 1c 24 mov %ebx,(%esp) +- 965: e8 c6 fc ff ff call 630 +- 96a: 85 c0 test %eax,%eax +- 96c: 75 c2 jne 930 +- if(peek(ps, es, ";")){ +- 96e: c7 44 24 08 06 13 00 movl $0x1306,0x8(%esp) +- 975: 00 +- 976: 89 74 24 04 mov %esi,0x4(%esp) +- 97a: 89 1c 24 mov %ebx,(%esp) +- 97d: e8 ae fc ff ff call 630 +- 982: 85 c0 test %eax,%eax +- 984: 75 0a jne 990 ++ 96c: 89 3c 24 mov %edi,(%esp) ++ 96f: e8 4c fb ff ff call 4c0 ++ 974: 89 c7 mov %eax,%edi ++ while (peek(ps, es, "&")) ++ 976: c7 44 24 08 2a 13 00 movl $0x132a,0x8(%esp) ++ 97d: 00 ++ 97e: 89 74 24 04 mov %esi,0x4(%esp) ++ 982: 89 1c 24 mov %ebx,(%esp) ++ 985: e8 c6 fc ff ff call 650 ++ 98a: 85 c0 test %eax,%eax ++ 98c: 75 c2 jne 950 ++ if (peek(ps, es, ";")) ++ 98e: c7 44 24 08 26 13 00 movl $0x1326,0x8(%esp) ++ 995: 00 ++ 996: 89 74 24 04 mov %esi,0x4(%esp) ++ 99a: 89 1c 24 mov %ebx,(%esp) ++ 99d: e8 ae fc ff ff call 650 ++ 9a2: 85 c0 test %eax,%eax ++ 9a4: 75 0a jne 9b0 + } +- 986: 83 c4 1c add $0x1c,%esp +- 989: 89 f8 mov %edi,%eax +- 98b: 5b pop %ebx +- 98c: 5e pop %esi +- 98d: 5f pop %edi +- 98e: 5d pop %ebp +- 98f: c3 ret ++ 9a6: 83 c4 1c add $0x1c,%esp ++ 9a9: 89 f8 mov %edi,%eax ++ 9ab: 5b pop %ebx ++ 9ac: 5e pop %esi ++ 9ad: 5f pop %edi ++ 9ae: 5d pop %ebp ++ 9af: c3 ret + gettoken(ps, es, 0, 0); +- 990: 89 74 24 04 mov %esi,0x4(%esp) +- 994: 89 1c 24 mov %ebx,(%esp) +- 997: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- 99e: 00 +- 99f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +- 9a6: 00 +- 9a7: e8 44 fb ff ff call 4f0 ++ 9b0: 89 74 24 04 mov %esi,0x4(%esp) ++ 9b4: 89 1c 24 mov %ebx,(%esp) ++ 9b7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ 9be: 00 ++ 9bf: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) ++ 9c6: 00 ++ 9c7: e8 44 fb ff ff call 510 + cmd = listcmd(cmd, parseline(ps, es)); +- 9ac: 89 74 24 04 mov %esi,0x4(%esp) +- 9b0: 89 1c 24 mov %ebx,(%esp) +- 9b3: e8 58 ff ff ff call 910 +- 9b8: 89 7d 08 mov %edi,0x8(%ebp) +- 9bb: 89 45 0c mov %eax,0xc(%ebp) ++ 9cc: 89 74 24 04 mov %esi,0x4(%esp) ++ 9d0: 89 1c 24 mov %ebx,(%esp) ++ 9d3: e8 58 ff ff ff call 930 ++ 9d8: 89 7d 08 mov %edi,0x8(%ebp) ++ 9db: 89 45 0c mov %eax,0xc(%ebp) + } +- 9be: 83 c4 1c add $0x1c,%esp +- 9c1: 5b pop %ebx +- 9c2: 5e pop %esi +- 9c3: 5f pop %edi +- 9c4: 5d pop %ebp ++ 9de: 83 c4 1c add $0x1c,%esp ++ 9e1: 5b pop %ebx ++ 9e2: 5e pop %esi ++ 9e3: 5f pop %edi ++ 9e4: 5d pop %ebp + cmd = listcmd(cmd, parseline(ps, es)); +- 9c5: e9 86 fa ff ff jmp 450 +- 9ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 9e5: e9 86 fa ff ff jmp 470 ++ 9ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-000009d0 : ++000009f0 : + { +- 9d0: 55 push %ebp +- 9d1: 89 e5 mov %esp,%ebp +- 9d3: 57 push %edi +- 9d4: 56 push %esi +- 9d5: 53 push %ebx +- 9d6: 83 ec 1c sub $0x1c,%esp +- 9d9: 8b 5d 08 mov 0x8(%ebp),%ebx +- 9dc: 8b 75 0c mov 0xc(%ebp),%esi +- if(!peek(ps, es, "(")) +- 9df: c7 44 24 08 ec 12 00 movl $0x12ec,0x8(%esp) +- 9e6: 00 +- 9e7: 89 1c 24 mov %ebx,(%esp) +- 9ea: 89 74 24 04 mov %esi,0x4(%esp) +- 9ee: e8 3d fc ff ff call 630 +- 9f3: 85 c0 test %eax,%eax +- 9f5: 74 76 je a6d +- gettoken(ps, es, 0, 0); +- 9f7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- 9fe: 00 +- 9ff: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) ++ 9f0: 55 push %ebp ++ 9f1: 89 e5 mov %esp,%ebp ++ 9f3: 57 push %edi ++ 9f4: 56 push %esi ++ 9f5: 53 push %ebx ++ 9f6: 83 ec 1c sub $0x1c,%esp ++ 9f9: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 9fc: 8b 75 0c mov 0xc(%ebp),%esi ++ if (!peek(ps, es, "(")) ++ 9ff: c7 44 24 08 0c 13 00 movl $0x130c,0x8(%esp) + a06: 00 +- a07: 89 74 24 04 mov %esi,0x4(%esp) +- a0b: 89 1c 24 mov %ebx,(%esp) +- a0e: e8 dd fa ff ff call 4f0 +- cmd = parseline(ps, es); +- a13: 89 74 24 04 mov %esi,0x4(%esp) +- a17: 89 1c 24 mov %ebx,(%esp) +- a1a: e8 f1 fe ff ff call 910 +- if(!peek(ps, es, ")")) +- a1f: c7 44 24 08 28 13 00 movl $0x1328,0x8(%esp) ++ a07: 89 1c 24 mov %ebx,(%esp) ++ a0a: 89 74 24 04 mov %esi,0x4(%esp) ++ a0e: e8 3d fc ff ff call 650 ++ a13: 85 c0 test %eax,%eax ++ a15: 74 76 je a8d ++ gettoken(ps, es, 0, 0); ++ a17: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ a1e: 00 ++ a1f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + a26: 00 + a27: 89 74 24 04 mov %esi,0x4(%esp) + a2b: 89 1c 24 mov %ebx,(%esp) ++ a2e: e8 dd fa ff ff call 510 + cmd = parseline(ps, es); +- a2e: 89 c7 mov %eax,%edi +- if(!peek(ps, es, ")")) +- a30: e8 fb fb ff ff call 630 +- a35: 85 c0 test %eax,%eax +- a37: 74 40 je a79 ++ a33: 89 74 24 04 mov %esi,0x4(%esp) ++ a37: 89 1c 24 mov %ebx,(%esp) ++ a3a: e8 f1 fe ff ff call 930 ++ if (!peek(ps, es, ")")) ++ a3f: c7 44 24 08 48 13 00 movl $0x1348,0x8(%esp) ++ a46: 00 ++ a47: 89 74 24 04 mov %esi,0x4(%esp) ++ a4b: 89 1c 24 mov %ebx,(%esp) ++ cmd = parseline(ps, es); ++ a4e: 89 c7 mov %eax,%edi ++ if (!peek(ps, es, ")")) ++ a50: e8 fb fb ff ff call 650 ++ a55: 85 c0 test %eax,%eax ++ a57: 74 40 je a99 + gettoken(ps, es, 0, 0); +- a39: 89 74 24 04 mov %esi,0x4(%esp) +- a3d: 89 1c 24 mov %ebx,(%esp) +- a40: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) +- a47: 00 +- a48: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) +- a4f: 00 +- a50: e8 9b fa ff ff call 4f0 ++ a59: 89 74 24 04 mov %esi,0x4(%esp) ++ a5d: 89 1c 24 mov %ebx,(%esp) ++ a60: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) ++ a67: 00 ++ a68: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) ++ a6f: 00 ++ a70: e8 9b fa ff ff call 510 + cmd = parseredirs(cmd, ps, es); +- a55: 89 74 24 08 mov %esi,0x8(%esp) +- a59: 89 5c 24 04 mov %ebx,0x4(%esp) +- a5d: 89 3c 24 mov %edi,(%esp) +- a60: e8 2b fc ff ff call 690 ++ a75: 89 74 24 08 mov %esi,0x8(%esp) ++ a79: 89 5c 24 04 mov %ebx,0x4(%esp) ++ a7d: 89 3c 24 mov %edi,(%esp) ++ a80: e8 2b fc ff ff call 6b0 + } +- a65: 83 c4 1c add $0x1c,%esp +- a68: 5b pop %ebx +- a69: 5e pop %esi +- a6a: 5f pop %edi +- a6b: 5d pop %ebp +- a6c: c3 ret ++ a85: 83 c4 1c add $0x1c,%esp ++ a88: 5b pop %ebx ++ a89: 5e pop %esi ++ a8a: 5f pop %edi ++ a8b: 5d pop %ebp ++ a8c: c3 ret + panic("parseblock"); +- a6d: c7 04 24 0c 13 00 00 movl $0x130c,(%esp) +- a74: e8 e7 f6 ff ff call 160 ++ a8d: c7 04 24 2c 13 00 00 movl $0x132c,(%esp) ++ a94: e8 d7 f6 ff ff call 170 + panic("syntax - missing )"); +- a79: c7 04 24 17 13 00 00 movl $0x1317,(%esp) +- a80: e8 db f6 ff ff call 160 +- a85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- a89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ a99: c7 04 24 37 13 00 00 movl $0x1337,(%esp) ++ aa0: e8 cb f6 ff ff call 170 ++ aa5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ aa9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000a90 : ++00000ab0 : + + // NUL-terminate all the counted strings. +-struct cmd* ++struct cmd * + nulterminate(struct cmd *cmd) + { +- a90: 55 push %ebp +- a91: 89 e5 mov %esp,%ebp +- a93: 53 push %ebx +- a94: 83 ec 14 sub $0x14,%esp +- a97: 8b 5d 08 mov 0x8(%ebp),%ebx ++ ab0: 55 push %ebp ++ ab1: 89 e5 mov %esp,%ebp ++ ab3: 53 push %ebx ++ ab4: 83 ec 14 sub $0x14,%esp ++ ab7: 8b 5d 08 mov 0x8(%ebp),%ebx + struct execcmd *ecmd; + struct listcmd *lcmd; + struct pipecmd *pcmd; + struct redircmd *rcmd; + +- if(cmd == 0) +- a9a: 85 db test %ebx,%ebx +- a9c: 0f 84 8e 00 00 00 je b30 ++ if (cmd == 0) ++ aba: 85 db test %ebx,%ebx ++ abc: 0f 84 8e 00 00 00 je b50 + return 0; + +- switch(cmd->type){ +- aa2: 83 3b 05 cmpl $0x5,(%ebx) +- aa5: 77 49 ja af0 +- aa7: 8b 03 mov (%ebx),%eax +- aa9: ff 24 85 68 13 00 00 jmp *0x1368(,%eax,4) ++ switch (cmd->type) ++ ac2: 83 3b 05 cmpl $0x5,(%ebx) ++ ac5: 77 49 ja b10 ++ ac7: 8b 03 mov (%ebx),%eax ++ ac9: ff 24 85 88 13 00 00 jmp *0x1388(,%eax,4) + nulterminate(pcmd->right); + break; + + case LIST: +- lcmd = (struct listcmd*)cmd; ++ lcmd = (struct listcmd *)cmd; + nulterminate(lcmd->left); +- ab0: 8b 43 04 mov 0x4(%ebx),%eax +- ab3: 89 04 24 mov %eax,(%esp) +- ab6: e8 d5 ff ff ff call a90 ++ ad0: 8b 43 04 mov 0x4(%ebx),%eax ++ ad3: 89 04 24 mov %eax,(%esp) ++ ad6: e8 d5 ff ff ff call ab0 + nulterminate(lcmd->right); +- abb: 8b 43 08 mov 0x8(%ebx),%eax +- abe: 89 04 24 mov %eax,(%esp) +- ac1: e8 ca ff ff ff call a90 ++ adb: 8b 43 08 mov 0x8(%ebx),%eax ++ ade: 89 04 24 mov %eax,(%esp) ++ ae1: e8 ca ff ff ff call ab0 + break; +- ac6: 89 d8 mov %ebx,%eax +- bcmd = (struct backcmd*)cmd; ++ ae6: 89 d8 mov %ebx,%eax ++ bcmd = (struct backcmd *)cmd; + nulterminate(bcmd->cmd); + break; + } + return cmd; + } +- ac8: 83 c4 14 add $0x14,%esp +- acb: 5b pop %ebx +- acc: 5d pop %ebp +- acd: c3 ret +- ace: 66 90 xchg %ax,%ax +- for(i=0; ecmd->argv[i]; i++) +- ad0: 8b 4b 04 mov 0x4(%ebx),%ecx +- ad3: 89 d8 mov %ebx,%eax +- ad5: 85 c9 test %ecx,%ecx +- ad7: 74 17 je af0 +- ad9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ ae8: 83 c4 14 add $0x14,%esp ++ aeb: 5b pop %ebx ++ aec: 5d pop %ebp ++ aed: c3 ret ++ aee: 66 90 xchg %ax,%ax ++ for (i = 0; ecmd->argv[i]; i++) ++ af0: 8b 4b 04 mov 0x4(%ebx),%ecx ++ af3: 89 d8 mov %ebx,%eax ++ af5: 85 c9 test %ecx,%ecx ++ af7: 74 17 je b10 ++ af9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + *ecmd->eargv[i] = 0; +- ae0: 8b 50 2c mov 0x2c(%eax),%edx +- ae3: 83 c0 04 add $0x4,%eax +- ae6: c6 02 00 movb $0x0,(%edx) +- for(i=0; ecmd->argv[i]; i++) +- ae9: 8b 50 04 mov 0x4(%eax),%edx +- aec: 85 d2 test %edx,%edx +- aee: 75 f0 jne ae0 ++ b00: 8b 50 2c mov 0x2c(%eax),%edx ++ b03: 83 c0 04 add $0x4,%eax ++ b06: c6 02 00 movb $0x0,(%edx) ++ for (i = 0; ecmd->argv[i]; i++) ++ b09: 8b 50 04 mov 0x4(%eax),%edx ++ b0c: 85 d2 test %edx,%edx ++ b0e: 75 f0 jne b00 + } +- af0: 83 c4 14 add $0x14,%esp +- switch(cmd->type){ +- af3: 89 d8 mov %ebx,%eax ++ b10: 83 c4 14 add $0x14,%esp ++ switch (cmd->type) ++ b13: 89 d8 mov %ebx,%eax + } +- af5: 5b pop %ebx +- af6: 5d pop %ebp +- af7: c3 ret ++ b15: 5b pop %ebx ++ b16: 5d pop %ebp ++ b17: c3 ret + nulterminate(bcmd->cmd); +- af8: 8b 43 04 mov 0x4(%ebx),%eax +- afb: 89 04 24 mov %eax,(%esp) +- afe: e8 8d ff ff ff call a90 ++ b18: 8b 43 04 mov 0x4(%ebx),%eax ++ b1b: 89 04 24 mov %eax,(%esp) ++ b1e: e8 8d ff ff ff call ab0 + } +- b03: 83 c4 14 add $0x14,%esp ++ b23: 83 c4 14 add $0x14,%esp + break; +- b06: 89 d8 mov %ebx,%eax ++ b26: 89 d8 mov %ebx,%eax + } +- b08: 5b pop %ebx +- b09: 5d pop %ebp +- b0a: c3 ret +- b0b: 90 nop +- b0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ b28: 5b pop %ebx ++ b29: 5d pop %ebp ++ b2a: c3 ret ++ b2b: 90 nop ++ b2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + nulterminate(rcmd->cmd); +- b10: 8b 43 04 mov 0x4(%ebx),%eax +- b13: 89 04 24 mov %eax,(%esp) +- b16: e8 75 ff ff ff call a90 ++ b30: 8b 43 04 mov 0x4(%ebx),%eax ++ b33: 89 04 24 mov %eax,(%esp) ++ b36: e8 75 ff ff ff call ab0 + *rcmd->efile = 0; +- b1b: 8b 43 0c mov 0xc(%ebx),%eax +- b1e: c6 00 00 movb $0x0,(%eax) ++ b3b: 8b 43 0c mov 0xc(%ebx),%eax ++ b3e: c6 00 00 movb $0x0,(%eax) + } +- b21: 83 c4 14 add $0x14,%esp ++ b41: 83 c4 14 add $0x14,%esp + break; +- b24: 89 d8 mov %ebx,%eax ++ b44: 89 d8 mov %ebx,%eax + } +- b26: 5b pop %ebx +- b27: 5d pop %ebp +- b28: c3 ret +- b29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ b46: 5b pop %ebx ++ b47: 5d pop %ebp ++ b48: c3 ret ++ b49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + return 0; +- b30: 31 c0 xor %eax,%eax +- b32: eb 94 jmp ac8 +- b34: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- b3a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ b50: 31 c0 xor %eax,%eax ++ b52: eb 94 jmp ae8 ++ b54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ b5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00000b40 : ++00000b60 : + { +- b40: 55 push %ebp +- b41: 89 e5 mov %esp,%ebp +- b43: 56 push %esi +- b44: 53 push %ebx +- b45: 83 ec 10 sub $0x10,%esp ++ b60: 55 push %ebp ++ b61: 89 e5 mov %esp,%ebp ++ b63: 56 push %esi ++ b64: 53 push %ebx ++ b65: 83 ec 10 sub $0x10,%esp + es = s + strlen(s); +- b48: 8b 5d 08 mov 0x8(%ebp),%ebx +- b4b: 89 1c 24 mov %ebx,(%esp) +- b4e: e8 ed 00 00 00 call c40 +- b53: 01 c3 add %eax,%ebx ++ b68: 8b 5d 08 mov 0x8(%ebp),%ebx ++ b6b: 89 1c 24 mov %ebx,(%esp) ++ b6e: e8 ed 00 00 00 call c60 ++ b73: 01 c3 add %eax,%ebx + cmd = parseline(&s, es); +- b55: 8d 45 08 lea 0x8(%ebp),%eax +- b58: 89 5c 24 04 mov %ebx,0x4(%esp) +- b5c: 89 04 24 mov %eax,(%esp) +- b5f: e8 ac fd ff ff call 910 ++ b75: 8d 45 08 lea 0x8(%ebp),%eax ++ b78: 89 5c 24 04 mov %ebx,0x4(%esp) ++ b7c: 89 04 24 mov %eax,(%esp) ++ b7f: e8 ac fd ff ff call 930 + peek(&s, es, ""); +- b64: c7 44 24 08 b6 12 00 movl $0x12b6,0x8(%esp) +- b6b: 00 +- b6c: 89 5c 24 04 mov %ebx,0x4(%esp) ++ b84: c7 44 24 08 d6 12 00 movl $0x12d6,0x8(%esp) ++ b8b: 00 ++ b8c: 89 5c 24 04 mov %ebx,0x4(%esp) + cmd = parseline(&s, es); +- b70: 89 c6 mov %eax,%esi ++ b90: 89 c6 mov %eax,%esi + peek(&s, es, ""); +- b72: 8d 45 08 lea 0x8(%ebp),%eax +- b75: 89 04 24 mov %eax,(%esp) +- b78: e8 b3 fa ff ff call 630 +- if(s != es){ +- b7d: 8b 45 08 mov 0x8(%ebp),%eax +- b80: 39 d8 cmp %ebx,%eax +- b82: 75 11 jne b95 ++ b92: 8d 45 08 lea 0x8(%ebp),%eax ++ b95: 89 04 24 mov %eax,(%esp) ++ b98: e8 b3 fa ff ff call 650 ++ if (s != es) ++ b9d: 8b 45 08 mov 0x8(%ebp),%eax ++ ba0: 39 d8 cmp %ebx,%eax ++ ba2: 75 11 jne bb5 + nulterminate(cmd); +- b84: 89 34 24 mov %esi,(%esp) +- b87: e8 04 ff ff ff call a90 ++ ba4: 89 34 24 mov %esi,(%esp) ++ ba7: e8 04 ff ff ff call ab0 + } +- b8c: 83 c4 10 add $0x10,%esp +- b8f: 89 f0 mov %esi,%eax +- b91: 5b pop %ebx +- b92: 5e pop %esi +- b93: 5d pop %ebp +- b94: c3 ret ++ bac: 83 c4 10 add $0x10,%esp ++ baf: 89 f0 mov %esi,%eax ++ bb1: 5b pop %ebx ++ bb2: 5e pop %esi ++ bb3: 5d pop %ebp ++ bb4: c3 ret + printf(2, "leftovers: %s\n", s); +- b95: 89 44 24 08 mov %eax,0x8(%esp) +- b99: c7 44 24 04 2a 13 00 movl $0x132a,0x4(%esp) +- ba0: 00 +- ba1: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- ba8: e8 83 03 00 00 call f30 ++ bb5: 89 44 24 08 mov %eax,0x8(%esp) ++ bb9: c7 44 24 04 4a 13 00 movl $0x134a,0x4(%esp) ++ bc0: 00 ++ bc1: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ bc8: e8 83 03 00 00 call f50 + panic("syntax"); +- bad: c7 04 24 ee 12 00 00 movl $0x12ee,(%esp) +- bb4: e8 a7 f5 ff ff call 160 +- bb9: 66 90 xchg %ax,%ax +- bbb: 66 90 xchg %ax,%ax +- bbd: 66 90 xchg %ax,%ax +- bbf: 90 nop +- +-00000bc0 : ++ bcd: c7 04 24 0e 13 00 00 movl $0x130e,(%esp) ++ bd4: e8 97 f5 ff ff call 170 ++ bd9: 66 90 xchg %ax,%ax ++ bdb: 66 90 xchg %ax,%ax ++ bdd: 66 90 xchg %ax,%ax ++ bdf: 90 nop ++ ++00000be0 : + #include "user.h" + #include "x86.h" + + char* + strcpy(char *s, const char *t) + { +- bc0: 55 push %ebp +- bc1: 89 e5 mov %esp,%ebp +- bc3: 8b 45 08 mov 0x8(%ebp),%eax +- bc6: 8b 4d 0c mov 0xc(%ebp),%ecx +- bc9: 53 push %ebx ++ be0: 55 push %ebp ++ be1: 89 e5 mov %esp,%ebp ++ be3: 8b 45 08 mov 0x8(%ebp),%eax ++ be6: 8b 4d 0c mov 0xc(%ebp),%ecx ++ be9: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) +- bca: 89 c2 mov %eax,%edx +- bcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- bd0: 83 c1 01 add $0x1,%ecx +- bd3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx +- bd7: 83 c2 01 add $0x1,%edx +- bda: 84 db test %bl,%bl +- bdc: 88 5a ff mov %bl,-0x1(%edx) +- bdf: 75 ef jne bd0 ++ bea: 89 c2 mov %eax,%edx ++ bec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ bf0: 83 c1 01 add $0x1,%ecx ++ bf3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx ++ bf7: 83 c2 01 add $0x1,%edx ++ bfa: 84 db test %bl,%bl ++ bfc: 88 5a ff mov %bl,-0x1(%edx) ++ bff: 75 ef jne bf0 + ; + return os; + } +- be1: 5b pop %ebx +- be2: 5d pop %ebp +- be3: c3 ret +- be4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- bea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ c01: 5b pop %ebx ++ c02: 5d pop %ebp ++ c03: c3 ret ++ c04: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ c0a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00000bf0 : ++00000c10 : + + int + strcmp(const char *p, const char *q) + { +- bf0: 55 push %ebp +- bf1: 89 e5 mov %esp,%ebp +- bf3: 8b 55 08 mov 0x8(%ebp),%edx +- bf6: 53 push %ebx +- bf7: 8b 4d 0c mov 0xc(%ebp),%ecx ++ c10: 55 push %ebp ++ c11: 89 e5 mov %esp,%ebp ++ c13: 8b 55 08 mov 0x8(%ebp),%edx ++ c16: 53 push %ebx ++ c17: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) +- bfa: 0f b6 02 movzbl (%edx),%eax +- bfd: 84 c0 test %al,%al +- bff: 74 2d je c2e +- c01: 0f b6 19 movzbl (%ecx),%ebx +- c04: 38 d8 cmp %bl,%al +- c06: 74 0e je c16 +- c08: eb 2b jmp c35 +- c0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- c10: 38 c8 cmp %cl,%al +- c12: 75 15 jne c29 ++ c1a: 0f b6 02 movzbl (%edx),%eax ++ c1d: 84 c0 test %al,%al ++ c1f: 74 2d je c4e ++ c21: 0f b6 19 movzbl (%ecx),%ebx ++ c24: 38 d8 cmp %bl,%al ++ c26: 74 0e je c36 ++ c28: eb 2b jmp c55 ++ c2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ c30: 38 c8 cmp %cl,%al ++ c32: 75 15 jne c49 + p++, q++; +- c14: 89 d9 mov %ebx,%ecx +- c16: 83 c2 01 add $0x1,%edx ++ c34: 89 d9 mov %ebx,%ecx ++ c36: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) +- c19: 0f b6 02 movzbl (%edx),%eax ++ c39: 0f b6 02 movzbl (%edx),%eax + p++, q++; +- c1c: 8d 59 01 lea 0x1(%ecx),%ebx ++ c3c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) +- c1f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx +- c23: 84 c0 test %al,%al +- c25: 75 e9 jne c10 +- c27: 31 c0 xor %eax,%eax ++ c3f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx ++ c43: 84 c0 test %al,%al ++ c45: 75 e9 jne c30 ++ c47: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; +- c29: 29 c8 sub %ecx,%eax ++ c49: 29 c8 sub %ecx,%eax + } +- c2b: 5b pop %ebx +- c2c: 5d pop %ebp +- c2d: c3 ret +- c2e: 0f b6 09 movzbl (%ecx),%ecx ++ c4b: 5b pop %ebx ++ c4c: 5d pop %ebp ++ c4d: c3 ret ++ c4e: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) +- c31: 31 c0 xor %eax,%eax +- c33: eb f4 jmp c29 +- c35: 0f b6 cb movzbl %bl,%ecx +- c38: eb ef jmp c29 +- c3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ c51: 31 c0 xor %eax,%eax ++ c53: eb f4 jmp c49 ++ c55: 0f b6 cb movzbl %bl,%ecx ++ c58: eb ef jmp c49 ++ c5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-00000c40 : ++00000c60 : + + uint + strlen(const char *s) + { +- c40: 55 push %ebp +- c41: 89 e5 mov %esp,%ebp +- c43: 8b 4d 08 mov 0x8(%ebp),%ecx ++ c60: 55 push %ebp ++ c61: 89 e5 mov %esp,%ebp ++ c63: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) +- c46: 80 39 00 cmpb $0x0,(%ecx) +- c49: 74 12 je c5d +- c4b: 31 d2 xor %edx,%edx +- c4d: 8d 76 00 lea 0x0(%esi),%esi +- c50: 83 c2 01 add $0x1,%edx +- c53: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) +- c57: 89 d0 mov %edx,%eax +- c59: 75 f5 jne c50 ++ c66: 80 39 00 cmpb $0x0,(%ecx) ++ c69: 74 12 je c7d ++ c6b: 31 d2 xor %edx,%edx ++ c6d: 8d 76 00 lea 0x0(%esi),%esi ++ c70: 83 c2 01 add $0x1,%edx ++ c73: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) ++ c77: 89 d0 mov %edx,%eax ++ c79: 75 f5 jne c70 + ; + return n; + } +- c5b: 5d pop %ebp +- c5c: c3 ret ++ c7b: 5d pop %ebp ++ c7c: c3 ret + for(n = 0; s[n]; n++) +- c5d: 31 c0 xor %eax,%eax ++ c7d: 31 c0 xor %eax,%eax + } +- c5f: 5d pop %ebp +- c60: c3 ret +- c61: eb 0d jmp c70 +- c63: 90 nop +- c64: 90 nop +- c65: 90 nop +- c66: 90 nop +- c67: 90 nop +- c68: 90 nop +- c69: 90 nop +- c6a: 90 nop +- c6b: 90 nop +- c6c: 90 nop +- c6d: 90 nop +- c6e: 90 nop +- c6f: 90 nop +- +-00000c70 : ++ c7f: 5d pop %ebp ++ c80: c3 ret ++ c81: eb 0d jmp c90 ++ c83: 90 nop ++ c84: 90 nop ++ c85: 90 nop ++ c86: 90 nop ++ c87: 90 nop ++ c88: 90 nop ++ c89: 90 nop ++ c8a: 90 nop ++ c8b: 90 nop ++ c8c: 90 nop ++ c8d: 90 nop ++ c8e: 90 nop ++ c8f: 90 nop ++ ++00000c90 : + + void* + memset(void *dst, int c, uint n) + { +- c70: 55 push %ebp +- c71: 89 e5 mov %esp,%ebp +- c73: 8b 55 08 mov 0x8(%ebp),%edx +- c76: 57 push %edi ++ c90: 55 push %ebp ++ c91: 89 e5 mov %esp,%ebp ++ c93: 8b 55 08 mov 0x8(%ebp),%edx ++ c96: 57 push %edi + } + + static inline void + stosb(void *addr, int data, int cnt) + { + asm volatile("cld; rep stosb" : +- c77: 8b 4d 10 mov 0x10(%ebp),%ecx +- c7a: 8b 45 0c mov 0xc(%ebp),%eax +- c7d: 89 d7 mov %edx,%edi +- c7f: fc cld +- c80: f3 aa rep stos %al,%es:(%edi) ++ c97: 8b 4d 10 mov 0x10(%ebp),%ecx ++ c9a: 8b 45 0c mov 0xc(%ebp),%eax ++ c9d: 89 d7 mov %edx,%edi ++ c9f: fc cld ++ ca0: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; + } +- c82: 89 d0 mov %edx,%eax +- c84: 5f pop %edi +- c85: 5d pop %ebp +- c86: c3 ret +- c87: 89 f6 mov %esi,%esi +- c89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ ca2: 89 d0 mov %edx,%eax ++ ca4: 5f pop %edi ++ ca5: 5d pop %ebp ++ ca6: c3 ret ++ ca7: 89 f6 mov %esi,%esi ++ ca9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000c90 : ++00000cb0 : + + char* + strchr(const char *s, char c) + { +- c90: 55 push %ebp +- c91: 89 e5 mov %esp,%ebp +- c93: 8b 45 08 mov 0x8(%ebp),%eax +- c96: 53 push %ebx +- c97: 8b 55 0c mov 0xc(%ebp),%edx ++ cb0: 55 push %ebp ++ cb1: 89 e5 mov %esp,%ebp ++ cb3: 8b 45 08 mov 0x8(%ebp),%eax ++ cb6: 53 push %ebx ++ cb7: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) +- c9a: 0f b6 18 movzbl (%eax),%ebx +- c9d: 84 db test %bl,%bl +- c9f: 74 1d je cbe ++ cba: 0f b6 18 movzbl (%eax),%ebx ++ cbd: 84 db test %bl,%bl ++ cbf: 74 1d je cde + if(*s == c) +- ca1: 38 d3 cmp %dl,%bl +- ca3: 89 d1 mov %edx,%ecx +- ca5: 75 0d jne cb4 +- ca7: eb 17 jmp cc0 +- ca9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- cb0: 38 ca cmp %cl,%dl +- cb2: 74 0c je cc0 ++ cc1: 38 d3 cmp %dl,%bl ++ cc3: 89 d1 mov %edx,%ecx ++ cc5: 75 0d jne cd4 ++ cc7: eb 17 jmp ce0 ++ cc9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ cd0: 38 ca cmp %cl,%dl ++ cd2: 74 0c je ce0 + for(; *s; s++) +- cb4: 83 c0 01 add $0x1,%eax +- cb7: 0f b6 10 movzbl (%eax),%edx +- cba: 84 d2 test %dl,%dl +- cbc: 75 f2 jne cb0 ++ cd4: 83 c0 01 add $0x1,%eax ++ cd7: 0f b6 10 movzbl (%eax),%edx ++ cda: 84 d2 test %dl,%dl ++ cdc: 75 f2 jne cd0 + return (char*)s; + return 0; +- cbe: 31 c0 xor %eax,%eax ++ cde: 31 c0 xor %eax,%eax + } +- cc0: 5b pop %ebx +- cc1: 5d pop %ebp +- cc2: c3 ret +- cc3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- cc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ ce0: 5b pop %ebx ++ ce1: 5d pop %ebp ++ ce2: c3 ret ++ ce3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000cd0 : ++00000cf0 : + + char* + gets(char *buf, int max) + { +- cd0: 55 push %ebp +- cd1: 89 e5 mov %esp,%ebp +- cd3: 57 push %edi +- cd4: 56 push %esi ++ cf0: 55 push %ebp ++ cf1: 89 e5 mov %esp,%ebp ++ cf3: 57 push %edi ++ cf4: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ +- cd5: 31 f6 xor %esi,%esi ++ cf5: 31 f6 xor %esi,%esi + { +- cd7: 53 push %ebx +- cd8: 83 ec 2c sub $0x2c,%esp ++ cf7: 53 push %ebx ++ cf8: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); +- cdb: 8d 7d e7 lea -0x19(%ebp),%edi ++ cfb: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ +- cde: eb 31 jmp d11 ++ cfe: eb 31 jmp d31 + cc = read(0, &c, 1); +- ce0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- ce7: 00 +- ce8: 89 7c 24 04 mov %edi,0x4(%esp) +- cec: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- cf3: e8 02 01 00 00 call dfa ++ d00: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ d07: 00 ++ d08: 89 7c 24 04 mov %edi,0x4(%esp) ++ d0c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ d13: e8 02 01 00 00 call e1a + if(cc < 1) +- cf8: 85 c0 test %eax,%eax +- cfa: 7e 1d jle d19 ++ d18: 85 c0 test %eax,%eax ++ d1a: 7e 1d jle d39 + break; + buf[i++] = c; +- cfc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax ++ d1c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ +- d00: 89 de mov %ebx,%esi ++ d20: 89 de mov %ebx,%esi + buf[i++] = c; +- d02: 8b 55 08 mov 0x8(%ebp),%edx ++ d22: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') +- d05: 3c 0d cmp $0xd,%al ++ d25: 3c 0d cmp $0xd,%al + buf[i++] = c; +- d07: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) ++ d27: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') +- d0b: 74 0c je d19 +- d0d: 3c 0a cmp $0xa,%al +- d0f: 74 08 je d19 ++ d2b: 74 0c je d39 ++ d2d: 3c 0a cmp $0xa,%al ++ d2f: 74 08 je d39 + for(i=0; i+1 < max; ){ +- d11: 8d 5e 01 lea 0x1(%esi),%ebx +- d14: 3b 5d 0c cmp 0xc(%ebp),%ebx +- d17: 7c c7 jl ce0 ++ d31: 8d 5e 01 lea 0x1(%esi),%ebx ++ d34: 3b 5d 0c cmp 0xc(%ebp),%ebx ++ d37: 7c c7 jl d00 + break; + } + buf[i] = '\0'; +- d19: 8b 45 08 mov 0x8(%ebp),%eax +- d1c: c6 04 30 00 movb $0x0,(%eax,%esi,1) ++ d39: 8b 45 08 mov 0x8(%ebp),%eax ++ d3c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; + } +- d20: 83 c4 2c add $0x2c,%esp +- d23: 5b pop %ebx +- d24: 5e pop %esi +- d25: 5f pop %edi +- d26: 5d pop %ebp +- d27: c3 ret +- d28: 90 nop +- d29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ d40: 83 c4 2c add $0x2c,%esp ++ d43: 5b pop %ebx ++ d44: 5e pop %esi ++ d45: 5f pop %edi ++ d46: 5d pop %ebp ++ d47: c3 ret ++ d48: 90 nop ++ d49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00000d30 : ++00000d50 : + + int + stat(const char *n, struct stat *st) + { +- d30: 55 push %ebp +- d31: 89 e5 mov %esp,%ebp +- d33: 56 push %esi +- d34: 53 push %ebx +- d35: 83 ec 10 sub $0x10,%esp ++ d50: 55 push %ebp ++ d51: 89 e5 mov %esp,%ebp ++ d53: 56 push %esi ++ d54: 53 push %ebx ++ d55: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); +- d38: 8b 45 08 mov 0x8(%ebp),%eax +- d3b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- d42: 00 +- d43: 89 04 24 mov %eax,(%esp) +- d46: e8 d7 00 00 00 call e22 ++ d58: 8b 45 08 mov 0x8(%ebp),%eax ++ d5b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ d62: 00 ++ d63: 89 04 24 mov %eax,(%esp) ++ d66: e8 d7 00 00 00 call e42 + if(fd < 0) +- d4b: 85 c0 test %eax,%eax ++ d6b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); +- d4d: 89 c3 mov %eax,%ebx ++ d6d: 89 c3 mov %eax,%ebx + if(fd < 0) +- d4f: 78 27 js d78 ++ d6f: 78 27 js d98 + return -1; + r = fstat(fd, st); +- d51: 8b 45 0c mov 0xc(%ebp),%eax +- d54: 89 1c 24 mov %ebx,(%esp) +- d57: 89 44 24 04 mov %eax,0x4(%esp) +- d5b: e8 da 00 00 00 call e3a ++ d71: 8b 45 0c mov 0xc(%ebp),%eax ++ d74: 89 1c 24 mov %ebx,(%esp) ++ d77: 89 44 24 04 mov %eax,0x4(%esp) ++ d7b: e8 da 00 00 00 call e5a + close(fd); +- d60: 89 1c 24 mov %ebx,(%esp) ++ d80: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); +- d63: 89 c6 mov %eax,%esi ++ d83: 89 c6 mov %eax,%esi + close(fd); +- d65: e8 a0 00 00 00 call e0a ++ d85: e8 a0 00 00 00 call e2a + return r; +- d6a: 89 f0 mov %esi,%eax ++ d8a: 89 f0 mov %esi,%eax + } +- d6c: 83 c4 10 add $0x10,%esp +- d6f: 5b pop %ebx +- d70: 5e pop %esi +- d71: 5d pop %ebp +- d72: c3 ret +- d73: 90 nop +- d74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ d8c: 83 c4 10 add $0x10,%esp ++ d8f: 5b pop %ebx ++ d90: 5e pop %esi ++ d91: 5d pop %ebp ++ d92: c3 ret ++ d93: 90 nop ++ d94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +- d78: b8 ff ff ff ff mov $0xffffffff,%eax +- d7d: eb ed jmp d6c +- d7f: 90 nop ++ d98: b8 ff ff ff ff mov $0xffffffff,%eax ++ d9d: eb ed jmp d8c ++ d9f: 90 nop + +-00000d80 : ++00000da0 : + + int + atoi(const char *s) + { +- d80: 55 push %ebp +- d81: 89 e5 mov %esp,%ebp +- d83: 8b 4d 08 mov 0x8(%ebp),%ecx +- d86: 53 push %ebx ++ da0: 55 push %ebp ++ da1: 89 e5 mov %esp,%ebp ++ da3: 8b 4d 08 mov 0x8(%ebp),%ecx ++ da6: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') +- d87: 0f be 11 movsbl (%ecx),%edx +- d8a: 8d 42 d0 lea -0x30(%edx),%eax +- d8d: 3c 09 cmp $0x9,%al ++ da7: 0f be 11 movsbl (%ecx),%edx ++ daa: 8d 42 d0 lea -0x30(%edx),%eax ++ dad: 3c 09 cmp $0x9,%al + n = 0; +- d8f: b8 00 00 00 00 mov $0x0,%eax ++ daf: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') +- d94: 77 17 ja dad +- d96: 66 90 xchg %ax,%ax ++ db4: 77 17 ja dcd ++ db6: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; +- d98: 83 c1 01 add $0x1,%ecx +- d9b: 8d 04 80 lea (%eax,%eax,4),%eax +- d9e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ++ db8: 83 c1 01 add $0x1,%ecx ++ dbb: 8d 04 80 lea (%eax,%eax,4),%eax ++ dbe: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') +- da2: 0f be 11 movsbl (%ecx),%edx +- da5: 8d 5a d0 lea -0x30(%edx),%ebx +- da8: 80 fb 09 cmp $0x9,%bl +- dab: 76 eb jbe d98 ++ dc2: 0f be 11 movsbl (%ecx),%edx ++ dc5: 8d 5a d0 lea -0x30(%edx),%ebx ++ dc8: 80 fb 09 cmp $0x9,%bl ++ dcb: 76 eb jbe db8 + return n; + } +- dad: 5b pop %ebx +- dae: 5d pop %ebp +- daf: c3 ret ++ dcd: 5b pop %ebx ++ dce: 5d pop %ebp ++ dcf: c3 ret + +-00000db0 : ++00000dd0 : + + void* + memmove(void *vdst, const void *vsrc, int n) + { +- db0: 55 push %ebp ++ dd0: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) +- db1: 31 d2 xor %edx,%edx ++ dd1: 31 d2 xor %edx,%edx + { +- db3: 89 e5 mov %esp,%ebp +- db5: 56 push %esi +- db6: 8b 45 08 mov 0x8(%ebp),%eax +- db9: 53 push %ebx +- dba: 8b 5d 10 mov 0x10(%ebp),%ebx +- dbd: 8b 75 0c mov 0xc(%ebp),%esi ++ dd3: 89 e5 mov %esp,%ebp ++ dd5: 56 push %esi ++ dd6: 8b 45 08 mov 0x8(%ebp),%eax ++ dd9: 53 push %ebx ++ dda: 8b 5d 10 mov 0x10(%ebp),%ebx ++ ddd: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) +- dc0: 85 db test %ebx,%ebx +- dc2: 7e 12 jle dd6 +- dc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ de0: 85 db test %ebx,%ebx ++ de2: 7e 12 jle df6 ++ de4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; +- dc8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +- dcc: 88 0c 10 mov %cl,(%eax,%edx,1) +- dcf: 83 c2 01 add $0x1,%edx ++ de8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx ++ dec: 88 0c 10 mov %cl,(%eax,%edx,1) ++ def: 83 c2 01 add $0x1,%edx + while(n-- > 0) +- dd2: 39 da cmp %ebx,%edx +- dd4: 75 f2 jne dc8 ++ df2: 39 da cmp %ebx,%edx ++ df4: 75 f2 jne de8 + return vdst; + } +- dd6: 5b pop %ebx +- dd7: 5e pop %esi +- dd8: 5d pop %ebp +- dd9: c3 ret +- +-00000dda : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) +- dda: b8 01 00 00 00 mov $0x1,%eax +- ddf: cd 40 int $0x40 +- de1: c3 ret +- +-00000de2 : +-SYSCALL(exit) +- de2: b8 02 00 00 00 mov $0x2,%eax +- de7: cd 40 int $0x40 +- de9: c3 ret +- +-00000dea : +-SYSCALL(wait) +- dea: b8 03 00 00 00 mov $0x3,%eax +- def: cd 40 int $0x40 +- df1: c3 ret +- +-00000df2 : +-SYSCALL(pipe) +- df2: b8 04 00 00 00 mov $0x4,%eax +- df7: cd 40 int $0x40 ++ df6: 5b pop %ebx ++ df7: 5e pop %esi ++ df8: 5d pop %ebp + df9: c3 ret + +-00000dfa : +-SYSCALL(read) +- dfa: b8 05 00 00 00 mov $0x5,%eax ++00000dfa : ++ dfa: b8 01 00 00 00 mov $0x1,%eax + dff: cd 40 int $0x40 + e01: c3 ret + +-00000e02 : +-SYSCALL(write) +- e02: b8 10 00 00 00 mov $0x10,%eax ++00000e02 : ++ e02: b8 02 00 00 00 mov $0x2,%eax + e07: cd 40 int $0x40 + e09: c3 ret + +-00000e0a : +-SYSCALL(close) +- e0a: b8 15 00 00 00 mov $0x15,%eax ++00000e0a : ++ e0a: b8 03 00 00 00 mov $0x3,%eax + e0f: cd 40 int $0x40 + e11: c3 ret + +-00000e12 : +-SYSCALL(kill) +- e12: b8 06 00 00 00 mov $0x6,%eax ++00000e12 : ++ e12: b8 04 00 00 00 mov $0x4,%eax + e17: cd 40 int $0x40 + e19: c3 ret + +-00000e1a : +-SYSCALL(exec) +- e1a: b8 07 00 00 00 mov $0x7,%eax ++00000e1a : ++ e1a: b8 05 00 00 00 mov $0x5,%eax + e1f: cd 40 int $0x40 + e21: c3 ret + +-00000e22 : +-SYSCALL(open) +- e22: b8 0f 00 00 00 mov $0xf,%eax ++00000e22 : ++ e22: b8 10 00 00 00 mov $0x10,%eax + e27: cd 40 int $0x40 + e29: c3 ret + +-00000e2a : +-SYSCALL(mknod) +- e2a: b8 11 00 00 00 mov $0x11,%eax ++00000e2a : ++ e2a: b8 15 00 00 00 mov $0x15,%eax + e2f: cd 40 int $0x40 + e31: c3 ret + +-00000e32 : +-SYSCALL(unlink) +- e32: b8 12 00 00 00 mov $0x12,%eax ++00000e32 : ++ e32: b8 06 00 00 00 mov $0x6,%eax + e37: cd 40 int $0x40 + e39: c3 ret + +-00000e3a : +-SYSCALL(fstat) +- e3a: b8 08 00 00 00 mov $0x8,%eax ++00000e3a : ++ e3a: b8 07 00 00 00 mov $0x7,%eax + e3f: cd 40 int $0x40 + e41: c3 ret + +-00000e42 : +-SYSCALL(link) +- e42: b8 13 00 00 00 mov $0x13,%eax ++00000e42 : ++ e42: b8 0f 00 00 00 mov $0xf,%eax + e47: cd 40 int $0x40 + e49: c3 ret + +-00000e4a : +-SYSCALL(mkdir) +- e4a: b8 14 00 00 00 mov $0x14,%eax ++00000e4a : ++ e4a: b8 11 00 00 00 mov $0x11,%eax + e4f: cd 40 int $0x40 + e51: c3 ret + +-00000e52 : +-SYSCALL(chdir) +- e52: b8 09 00 00 00 mov $0x9,%eax ++00000e52 : ++ e52: b8 12 00 00 00 mov $0x12,%eax + e57: cd 40 int $0x40 + e59: c3 ret + +-00000e5a : +-SYSCALL(dup) +- e5a: b8 0a 00 00 00 mov $0xa,%eax ++00000e5a : ++ e5a: b8 08 00 00 00 mov $0x8,%eax + e5f: cd 40 int $0x40 + e61: c3 ret + +-00000e62 : +-SYSCALL(getpid) +- e62: b8 0b 00 00 00 mov $0xb,%eax ++00000e62 : ++ e62: b8 13 00 00 00 mov $0x13,%eax + e67: cd 40 int $0x40 + e69: c3 ret + +-00000e6a : +-SYSCALL(sbrk) +- e6a: b8 0c 00 00 00 mov $0xc,%eax ++00000e6a : ++ e6a: b8 14 00 00 00 mov $0x14,%eax + e6f: cd 40 int $0x40 + e71: c3 ret + +-00000e72 : +-SYSCALL(sleep) +- e72: b8 0d 00 00 00 mov $0xd,%eax ++00000e72 : ++ e72: b8 09 00 00 00 mov $0x9,%eax + e77: cd 40 int $0x40 + e79: c3 ret + +-00000e7a : +-SYSCALL(uptime) +- e7a: b8 0e 00 00 00 mov $0xe,%eax ++00000e7a : ++ e7a: b8 0a 00 00 00 mov $0xa,%eax + e7f: cd 40 int $0x40 + e81: c3 ret +- e82: 66 90 xchg %ax,%ax +- e84: 66 90 xchg %ax,%ax +- e86: 66 90 xchg %ax,%ax +- e88: 66 90 xchg %ax,%ax +- e8a: 66 90 xchg %ax,%ax +- e8c: 66 90 xchg %ax,%ax +- e8e: 66 90 xchg %ax,%ax +- +-00000e90 : ++ ++00000e82 : ++ e82: b8 0b 00 00 00 mov $0xb,%eax ++ e87: cd 40 int $0x40 ++ e89: c3 ret ++ ++00000e8a : ++ e8a: b8 0c 00 00 00 mov $0xc,%eax ++ e8f: cd 40 int $0x40 ++ e91: c3 ret ++ ++00000e92 : ++ e92: b8 0d 00 00 00 mov $0xd,%eax ++ e97: cd 40 int $0x40 ++ e99: c3 ret ++ ++00000e9a : ++ e9a: b8 0e 00 00 00 mov $0xe,%eax ++ e9f: cd 40 int $0x40 ++ ea1: c3 ret ++ ea2: 66 90 xchg %ax,%ax ++ ea4: 66 90 xchg %ax,%ax ++ ea6: 66 90 xchg %ax,%ax ++ ea8: 66 90 xchg %ax,%ax ++ eaa: 66 90 xchg %ax,%ax ++ eac: 66 90 xchg %ax,%ax ++ eae: 66 90 xchg %ax,%ax ++ ++00000eb0 : + write(fd, &c, 1); + } + + static void + printint(int fd, int xx, int base, int sgn) + { +- e90: 55 push %ebp +- e91: 89 e5 mov %esp,%ebp +- e93: 57 push %edi +- e94: 56 push %esi +- e95: 89 c6 mov %eax,%esi +- e97: 53 push %ebx +- e98: 83 ec 4c sub $0x4c,%esp ++ eb0: 55 push %ebp ++ eb1: 89 e5 mov %esp,%ebp ++ eb3: 57 push %edi ++ eb4: 56 push %esi ++ eb5: 89 c6 mov %eax,%esi ++ eb7: 53 push %ebx ++ eb8: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ +- e9b: 8b 5d 08 mov 0x8(%ebp),%ebx +- e9e: 85 db test %ebx,%ebx +- ea0: 74 09 je eab +- ea2: 89 d0 mov %edx,%eax +- ea4: c1 e8 1f shr $0x1f,%eax +- ea7: 84 c0 test %al,%al +- ea9: 75 75 jne f20 ++ ebb: 8b 5d 08 mov 0x8(%ebp),%ebx ++ ebe: 85 db test %ebx,%ebx ++ ec0: 74 09 je ecb ++ ec2: 89 d0 mov %edx,%eax ++ ec4: c1 e8 1f shr $0x1f,%eax ++ ec7: 84 c0 test %al,%al ++ ec9: 75 75 jne f40 + neg = 1; + x = -xx; + } else { + x = xx; +- eab: 89 d0 mov %edx,%eax ++ ecb: 89 d0 mov %edx,%eax + neg = 0; +- ead: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) +- eb4: 89 75 c0 mov %esi,-0x40(%ebp) ++ ecd: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) ++ ed4: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; +- eb7: 31 ff xor %edi,%edi +- eb9: 89 ce mov %ecx,%esi +- ebb: 8d 5d d7 lea -0x29(%ebp),%ebx +- ebe: eb 02 jmp ec2 ++ ed7: 31 ff xor %edi,%edi ++ ed9: 89 ce mov %ecx,%esi ++ edb: 8d 5d d7 lea -0x29(%ebp),%ebx ++ ede: eb 02 jmp ee2 + do{ + buf[i++] = digits[x % base]; +- ec0: 89 cf mov %ecx,%edi +- ec2: 31 d2 xor %edx,%edx +- ec4: f7 f6 div %esi +- ec6: 8d 4f 01 lea 0x1(%edi),%ecx +- ec9: 0f b6 92 87 13 00 00 movzbl 0x1387(%edx),%edx ++ ee0: 89 cf mov %ecx,%edi ++ ee2: 31 d2 xor %edx,%edx ++ ee4: f7 f6 div %esi ++ ee6: 8d 4f 01 lea 0x1(%edi),%ecx ++ ee9: 0f b6 92 a7 13 00 00 movzbl 0x13a7(%edx),%edx + }while((x /= base) != 0); +- ed0: 85 c0 test %eax,%eax ++ ef0: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; +- ed2: 88 14 0b mov %dl,(%ebx,%ecx,1) ++ ef2: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); +- ed5: 75 e9 jne ec0 ++ ef5: 75 e9 jne ee0 + if(neg) +- ed7: 8b 55 c4 mov -0x3c(%ebp),%edx ++ ef7: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; +- eda: 89 c8 mov %ecx,%eax +- edc: 8b 75 c0 mov -0x40(%ebp),%esi ++ efa: 89 c8 mov %ecx,%eax ++ efc: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) +- edf: 85 d2 test %edx,%edx +- ee1: 74 08 je eeb ++ eff: 85 d2 test %edx,%edx ++ f01: 74 08 je f0b + buf[i++] = '-'; +- ee3: 8d 4f 02 lea 0x2(%edi),%ecx +- ee6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) ++ f03: 8d 4f 02 lea 0x2(%edi),%ecx ++ f06: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) +- eeb: 8d 79 ff lea -0x1(%ecx),%edi +- eee: 66 90 xchg %ax,%ax +- ef0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax +- ef5: 83 ef 01 sub $0x1,%edi ++ f0b: 8d 79 ff lea -0x1(%ecx),%edi ++ f0e: 66 90 xchg %ax,%ax ++ f10: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax ++ f15: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); +- ef8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- eff: 00 +- f00: 89 5c 24 04 mov %ebx,0x4(%esp) +- f04: 89 34 24 mov %esi,(%esp) +- f07: 88 45 d7 mov %al,-0x29(%ebp) +- f0a: e8 f3 fe ff ff call e02 ++ f18: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ f1f: 00 ++ f20: 89 5c 24 04 mov %ebx,0x4(%esp) ++ f24: 89 34 24 mov %esi,(%esp) ++ f27: 88 45 d7 mov %al,-0x29(%ebp) ++ f2a: e8 f3 fe ff ff call e22 + while(--i >= 0) +- f0f: 83 ff ff cmp $0xffffffff,%edi +- f12: 75 dc jne ef0 ++ f2f: 83 ff ff cmp $0xffffffff,%edi ++ f32: 75 dc jne f10 + putc(fd, buf[i]); + } +- f14: 83 c4 4c add $0x4c,%esp +- f17: 5b pop %ebx +- f18: 5e pop %esi +- f19: 5f pop %edi +- f1a: 5d pop %ebp +- f1b: c3 ret +- f1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ f34: 83 c4 4c add $0x4c,%esp ++ f37: 5b pop %ebx ++ f38: 5e pop %esi ++ f39: 5f pop %edi ++ f3a: 5d pop %ebp ++ f3b: c3 ret ++ f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; +- f20: 89 d0 mov %edx,%eax +- f22: f7 d8 neg %eax ++ f40: 89 d0 mov %edx,%eax ++ f42: f7 d8 neg %eax + neg = 1; +- f24: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) +- f2b: eb 87 jmp eb4 +- f2d: 8d 76 00 lea 0x0(%esi),%esi ++ f44: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) ++ f4b: eb 87 jmp ed4 ++ f4d: 8d 76 00 lea 0x0(%esi),%esi + +-00000f30 : ++00000f50 : + + // Print to the given fd. Only understands %d, %x, %p, %s. + void + printf(int fd, const char *fmt, ...) + { +- f30: 55 push %ebp +- f31: 89 e5 mov %esp,%ebp +- f33: 57 push %edi ++ f50: 55 push %ebp ++ f51: 89 e5 mov %esp,%ebp ++ f53: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; +- f34: 31 ff xor %edi,%edi ++ f54: 31 ff xor %edi,%edi + { +- f36: 56 push %esi +- f37: 53 push %ebx +- f38: 83 ec 3c sub $0x3c,%esp ++ f56: 56 push %esi ++ f57: 53 push %ebx ++ f58: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ +- f3b: 8b 5d 0c mov 0xc(%ebp),%ebx ++ f5b: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; +- f3e: 8d 45 10 lea 0x10(%ebp),%eax ++ f5e: 8d 45 10 lea 0x10(%ebp),%eax + { +- f41: 8b 75 08 mov 0x8(%ebp),%esi ++ f61: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; +- f44: 89 45 d4 mov %eax,-0x2c(%ebp) ++ f64: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ +- f47: 0f b6 13 movzbl (%ebx),%edx +- f4a: 83 c3 01 add $0x1,%ebx +- f4d: 84 d2 test %dl,%dl +- f4f: 75 39 jne f8a +- f51: e9 c2 00 00 00 jmp 1018 +- f56: 66 90 xchg %ax,%ax ++ f67: 0f b6 13 movzbl (%ebx),%edx ++ f6a: 83 c3 01 add $0x1,%ebx ++ f6d: 84 d2 test %dl,%dl ++ f6f: 75 39 jne faa ++ f71: e9 c2 00 00 00 jmp 1038 ++ f76: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ +- f58: 83 fa 25 cmp $0x25,%edx +- f5b: 0f 84 bf 00 00 00 je 1020 ++ f78: 83 fa 25 cmp $0x25,%edx ++ f7b: 0f 84 bf 00 00 00 je 1040 + write(fd, &c, 1); +- f61: 8d 45 e2 lea -0x1e(%ebp),%eax +- f64: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- f6b: 00 +- f6c: 89 44 24 04 mov %eax,0x4(%esp) +- f70: 89 34 24 mov %esi,(%esp) ++ f81: 8d 45 e2 lea -0x1e(%ebp),%eax ++ f84: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ f8b: 00 ++ f8c: 89 44 24 04 mov %eax,0x4(%esp) ++ f90: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); +- f73: 88 55 e2 mov %dl,-0x1e(%ebp) ++ f93: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); +- f76: e8 87 fe ff ff call e02 +- f7b: 83 c3 01 add $0x1,%ebx ++ f96: e8 87 fe ff ff call e22 ++ f9b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ +- f7e: 0f b6 53 ff movzbl -0x1(%ebx),%edx +- f82: 84 d2 test %dl,%dl +- f84: 0f 84 8e 00 00 00 je 1018 ++ f9e: 0f b6 53 ff movzbl -0x1(%ebx),%edx ++ fa2: 84 d2 test %dl,%dl ++ fa4: 0f 84 8e 00 00 00 je 1038 + if(state == 0){ +- f8a: 85 ff test %edi,%edi ++ faa: 85 ff test %edi,%edi + c = fmt[i] & 0xff; +- f8c: 0f be c2 movsbl %dl,%eax ++ fac: 0f be c2 movsbl %dl,%eax + if(state == 0){ +- f8f: 74 c7 je f58 ++ faf: 74 c7 je f78 + } + } else if(state == '%'){ +- f91: 83 ff 25 cmp $0x25,%edi +- f94: 75 e5 jne f7b ++ fb1: 83 ff 25 cmp $0x25,%edi ++ fb4: 75 e5 jne f9b + if(c == 'd'){ +- f96: 83 fa 64 cmp $0x64,%edx +- f99: 0f 84 31 01 00 00 je 10d0 ++ fb6: 83 fa 64 cmp $0x64,%edx ++ fb9: 0f 84 31 01 00 00 je 10f0 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ +- f9f: 25 f7 00 00 00 and $0xf7,%eax +- fa4: 83 f8 70 cmp $0x70,%eax +- fa7: 0f 84 83 00 00 00 je 1030 ++ fbf: 25 f7 00 00 00 and $0xf7,%eax ++ fc4: 83 f8 70 cmp $0x70,%eax ++ fc7: 0f 84 83 00 00 00 je 1050 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ +- fad: 83 fa 73 cmp $0x73,%edx +- fb0: 0f 84 a2 00 00 00 je 1058 ++ fcd: 83 fa 73 cmp $0x73,%edx ++ fd0: 0f 84 a2 00 00 00 je 1078 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ +- fb6: 83 fa 63 cmp $0x63,%edx +- fb9: 0f 84 35 01 00 00 je 10f4 ++ fd6: 83 fa 63 cmp $0x63,%edx ++ fd9: 0f 84 35 01 00 00 je 1114 + putc(fd, *ap); + ap++; + } else if(c == '%'){ +- fbf: 83 fa 25 cmp $0x25,%edx +- fc2: 0f 84 e0 00 00 00 je 10a8 ++ fdf: 83 fa 25 cmp $0x25,%edx ++ fe2: 0f 84 e0 00 00 00 je 10c8 + write(fd, &c, 1); +- fc8: 8d 45 e6 lea -0x1a(%ebp),%eax +- fcb: 83 c3 01 add $0x1,%ebx +- fce: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- fd5: 00 ++ fe8: 8d 45 e6 lea -0x1a(%ebp),%eax ++ feb: 83 c3 01 add $0x1,%ebx ++ fee: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ ff5: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; +- fd6: 31 ff xor %edi,%edi ++ ff6: 31 ff xor %edi,%edi + write(fd, &c, 1); +- fd8: 89 44 24 04 mov %eax,0x4(%esp) +- fdc: 89 34 24 mov %esi,(%esp) +- fdf: 89 55 d0 mov %edx,-0x30(%ebp) +- fe2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) +- fe6: e8 17 fe ff ff call e02 ++ ff8: 89 44 24 04 mov %eax,0x4(%esp) ++ ffc: 89 34 24 mov %esi,(%esp) ++ fff: 89 55 d0 mov %edx,-0x30(%ebp) ++ 1002: c6 45 e6 25 movb $0x25,-0x1a(%ebp) ++ 1006: e8 17 fe ff ff call e22 + putc(fd, c); +- feb: 8b 55 d0 mov -0x30(%ebp),%edx ++ 100b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); +- fee: 8d 45 e7 lea -0x19(%ebp),%eax +- ff1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- ff8: 00 +- ff9: 89 44 24 04 mov %eax,0x4(%esp) +- ffd: 89 34 24 mov %esi,(%esp) ++ 100e: 8d 45 e7 lea -0x19(%ebp),%eax ++ 1011: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 1018: 00 ++ 1019: 89 44 24 04 mov %eax,0x4(%esp) ++ 101d: 89 34 24 mov %esi,(%esp) + putc(fd, c); +- 1000: 88 55 e7 mov %dl,-0x19(%ebp) ++ 1020: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); +- 1003: e8 fa fd ff ff call e02 ++ 1023: e8 fa fd ff ff call e22 + for(i = 0; fmt[i]; i++){ +- 1008: 0f b6 53 ff movzbl -0x1(%ebx),%edx +- 100c: 84 d2 test %dl,%dl +- 100e: 0f 85 76 ff ff ff jne f8a +- 1014: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 1028: 0f b6 53 ff movzbl -0x1(%ebx),%edx ++ 102c: 84 d2 test %dl,%dl ++ 102e: 0f 85 76 ff ff ff jne faa ++ 1034: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } + } +- 1018: 83 c4 3c add $0x3c,%esp +- 101b: 5b pop %ebx +- 101c: 5e pop %esi +- 101d: 5f pop %edi +- 101e: 5d pop %ebp +- 101f: c3 ret ++ 1038: 83 c4 3c add $0x3c,%esp ++ 103b: 5b pop %ebx ++ 103c: 5e pop %esi ++ 103d: 5f pop %edi ++ 103e: 5d pop %ebp ++ 103f: c3 ret + state = '%'; +- 1020: bf 25 00 00 00 mov $0x25,%edi +- 1025: e9 51 ff ff ff jmp f7b +- 102a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 1040: bf 25 00 00 00 mov $0x25,%edi ++ 1045: e9 51 ff ff ff jmp f9b ++ 104a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); +- 1030: 8b 45 d4 mov -0x2c(%ebp),%eax +- 1033: b9 10 00 00 00 mov $0x10,%ecx ++ 1050: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 1053: b9 10 00 00 00 mov $0x10,%ecx + state = 0; +- 1038: 31 ff xor %edi,%edi ++ 1058: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); +- 103a: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1041: 8b 10 mov (%eax),%edx +- 1043: 89 f0 mov %esi,%eax +- 1045: e8 46 fe ff ff call e90 ++ 105a: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1061: 8b 10 mov (%eax),%edx ++ 1063: 89 f0 mov %esi,%eax ++ 1065: e8 46 fe ff ff call eb0 + ap++; +- 104a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 104e: e9 28 ff ff ff jmp f7b +- 1053: 90 nop +- 1054: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 106a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 106e: e9 28 ff ff ff jmp f9b ++ 1073: 90 nop ++ 1074: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; +- 1058: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 1078: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; +- 105b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 107b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; +- 105f: 8b 38 mov (%eax),%edi ++ 107f: 8b 38 mov (%eax),%edi + s = "(null)"; +- 1061: b8 80 13 00 00 mov $0x1380,%eax +- 1066: 85 ff test %edi,%edi +- 1068: 0f 44 f8 cmove %eax,%edi ++ 1081: b8 a0 13 00 00 mov $0x13a0,%eax ++ 1086: 85 ff test %edi,%edi ++ 1088: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ +- 106b: 0f b6 07 movzbl (%edi),%eax +- 106e: 84 c0 test %al,%al +- 1070: 74 2a je 109c +- 1072: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 1078: 88 45 e3 mov %al,-0x1d(%ebp) ++ 108b: 0f b6 07 movzbl (%edi),%eax ++ 108e: 84 c0 test %al,%al ++ 1090: 74 2a je 10bc ++ 1092: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 1098: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); +- 107b: 8d 45 e3 lea -0x1d(%ebp),%eax ++ 109b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; +- 107e: 83 c7 01 add $0x1,%edi ++ 109e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); +- 1081: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 1088: 00 +- 1089: 89 44 24 04 mov %eax,0x4(%esp) +- 108d: 89 34 24 mov %esi,(%esp) +- 1090: e8 6d fd ff ff call e02 ++ 10a1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 10a8: 00 ++ 10a9: 89 44 24 04 mov %eax,0x4(%esp) ++ 10ad: 89 34 24 mov %esi,(%esp) ++ 10b0: e8 6d fd ff ff call e22 + while(*s != 0){ +- 1095: 0f b6 07 movzbl (%edi),%eax +- 1098: 84 c0 test %al,%al +- 109a: 75 dc jne 1078 ++ 10b5: 0f b6 07 movzbl (%edi),%eax ++ 10b8: 84 c0 test %al,%al ++ 10ba: 75 dc jne 1098 + state = 0; +- 109c: 31 ff xor %edi,%edi +- 109e: e9 d8 fe ff ff jmp f7b +- 10a3: 90 nop +- 10a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 10bc: 31 ff xor %edi,%edi ++ 10be: e9 d8 fe ff ff jmp f9b ++ 10c3: 90 nop ++ 10c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); +- 10a8: 8d 45 e5 lea -0x1b(%ebp),%eax ++ 10c8: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; +- 10ab: 31 ff xor %edi,%edi ++ 10cb: 31 ff xor %edi,%edi + write(fd, &c, 1); +- 10ad: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 10b4: 00 +- 10b5: 89 44 24 04 mov %eax,0x4(%esp) +- 10b9: 89 34 24 mov %esi,(%esp) +- 10bc: c6 45 e5 25 movb $0x25,-0x1b(%ebp) +- 10c0: e8 3d fd ff ff call e02 +- 10c5: e9 b1 fe ff ff jmp f7b +- 10ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 10cd: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 10d4: 00 ++ 10d5: 89 44 24 04 mov %eax,0x4(%esp) ++ 10d9: 89 34 24 mov %esi,(%esp) ++ 10dc: c6 45 e5 25 movb $0x25,-0x1b(%ebp) ++ 10e0: e8 3d fd ff ff call e22 ++ 10e5: e9 b1 fe ff ff jmp f9b ++ 10ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); +- 10d0: 8b 45 d4 mov -0x2c(%ebp),%eax +- 10d3: b9 0a 00 00 00 mov $0xa,%ecx ++ 10f0: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 10f3: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; +- 10d8: 66 31 ff xor %di,%di ++ 10f8: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); +- 10db: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 10e2: 8b 10 mov (%eax),%edx +- 10e4: 89 f0 mov %esi,%eax +- 10e6: e8 a5 fd ff ff call e90 ++ 10fb: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1102: 8b 10 mov (%eax),%edx ++ 1104: 89 f0 mov %esi,%eax ++ 1106: e8 a5 fd ff ff call eb0 + ap++; +- 10eb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 10ef: e9 87 fe ff ff jmp f7b ++ 110b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 110f: e9 87 fe ff ff jmp f9b + putc(fd, *ap); +- 10f4: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 1114: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; +- 10f7: 31 ff xor %edi,%edi ++ 1117: 31 ff xor %edi,%edi + putc(fd, *ap); +- 10f9: 8b 00 mov (%eax),%eax ++ 1119: 8b 00 mov (%eax),%eax + write(fd, &c, 1); +- 10fb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 1102: 00 +- 1103: 89 34 24 mov %esi,(%esp) ++ 111b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 1122: 00 ++ 1123: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); +- 1106: 88 45 e4 mov %al,-0x1c(%ebp) ++ 1126: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); +- 1109: 8d 45 e4 lea -0x1c(%ebp),%eax +- 110c: 89 44 24 04 mov %eax,0x4(%esp) +- 1110: e8 ed fc ff ff call e02 ++ 1129: 8d 45 e4 lea -0x1c(%ebp),%eax ++ 112c: 89 44 24 04 mov %eax,0x4(%esp) ++ 1130: e8 ed fc ff ff call e22 + ap++; +- 1115: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 1119: e9 5d fe ff ff jmp f7b +- 111e: 66 90 xchg %ax,%ax ++ 1135: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 1139: e9 5d fe ff ff jmp f9b ++ 113e: 66 90 xchg %ax,%ax + +-00001120 : ++00001140 : + static Header base; + static Header *freep; + + void + free(void *ap) + { +- 1120: 55 push %ebp ++ 1140: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 1121: a1 a4 19 00 00 mov 0x19a4,%eax ++ 1141: a1 c4 19 00 00 mov 0x19c4,%eax + { +- 1126: 89 e5 mov %esp,%ebp +- 1128: 57 push %edi +- 1129: 56 push %esi +- 112a: 53 push %ebx +- 112b: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 1146: 89 e5 mov %esp,%ebp ++ 1148: 57 push %edi ++ 1149: 56 push %esi ++ 114a: 53 push %ebx ++ 114b: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 112e: 8b 08 mov (%eax),%ecx ++ 114e: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; +- 1130: 8d 53 f8 lea -0x8(%ebx),%edx ++ 1150: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 1133: 39 d0 cmp %edx,%eax +- 1135: 72 11 jb 1148 +- 1137: 90 nop ++ 1153: 39 d0 cmp %edx,%eax ++ 1155: 72 11 jb 1168 ++ 1157: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 1138: 39 c8 cmp %ecx,%eax +- 113a: 72 04 jb 1140 +- 113c: 39 ca cmp %ecx,%edx +- 113e: 72 10 jb 1150 +- 1140: 89 c8 mov %ecx,%eax ++ 1158: 39 c8 cmp %ecx,%eax ++ 115a: 72 04 jb 1160 ++ 115c: 39 ca cmp %ecx,%edx ++ 115e: 72 10 jb 1170 ++ 1160: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 1142: 39 d0 cmp %edx,%eax ++ 1162: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 1144: 8b 08 mov (%eax),%ecx ++ 1164: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 1146: 73 f0 jae 1138 +- 1148: 39 ca cmp %ecx,%edx +- 114a: 72 04 jb 1150 ++ 1166: 73 f0 jae 1158 ++ 1168: 39 ca cmp %ecx,%edx ++ 116a: 72 04 jb 1170 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 114c: 39 c8 cmp %ecx,%eax +- 114e: 72 f0 jb 1140 ++ 116c: 39 c8 cmp %ecx,%eax ++ 116e: 72 f0 jb 1160 + break; + if(bp + bp->s.size == p->s.ptr){ +- 1150: 8b 73 fc mov -0x4(%ebx),%esi +- 1153: 8d 3c f2 lea (%edx,%esi,8),%edi +- 1156: 39 cf cmp %ecx,%edi +- 1158: 74 1e je 1178 ++ 1170: 8b 73 fc mov -0x4(%ebx),%esi ++ 1173: 8d 3c f2 lea (%edx,%esi,8),%edi ++ 1176: 39 cf cmp %ecx,%edi ++ 1178: 74 1e je 1198 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; +- 115a: 89 4b f8 mov %ecx,-0x8(%ebx) ++ 117a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ +- 115d: 8b 48 04 mov 0x4(%eax),%ecx +- 1160: 8d 34 c8 lea (%eax,%ecx,8),%esi +- 1163: 39 f2 cmp %esi,%edx +- 1165: 74 28 je 118f ++ 117d: 8b 48 04 mov 0x4(%eax),%ecx ++ 1180: 8d 34 c8 lea (%eax,%ecx,8),%esi ++ 1183: 39 f2 cmp %esi,%edx ++ 1185: 74 28 je 11af + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; +- 1167: 89 10 mov %edx,(%eax) ++ 1187: 89 10 mov %edx,(%eax) + freep = p; +- 1169: a3 a4 19 00 00 mov %eax,0x19a4 ++ 1189: a3 c4 19 00 00 mov %eax,0x19c4 + } +- 116e: 5b pop %ebx +- 116f: 5e pop %esi +- 1170: 5f pop %edi +- 1171: 5d pop %ebp +- 1172: c3 ret +- 1173: 90 nop +- 1174: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 118e: 5b pop %ebx ++ 118f: 5e pop %esi ++ 1190: 5f pop %edi ++ 1191: 5d pop %ebp ++ 1192: c3 ret ++ 1193: 90 nop ++ 1194: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; +- 1178: 03 71 04 add 0x4(%ecx),%esi +- 117b: 89 73 fc mov %esi,-0x4(%ebx) ++ 1198: 03 71 04 add 0x4(%ecx),%esi ++ 119b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; +- 117e: 8b 08 mov (%eax),%ecx +- 1180: 8b 09 mov (%ecx),%ecx +- 1182: 89 4b f8 mov %ecx,-0x8(%ebx) ++ 119e: 8b 08 mov (%eax),%ecx ++ 11a0: 8b 09 mov (%ecx),%ecx ++ 11a2: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ +- 1185: 8b 48 04 mov 0x4(%eax),%ecx +- 1188: 8d 34 c8 lea (%eax,%ecx,8),%esi +- 118b: 39 f2 cmp %esi,%edx +- 118d: 75 d8 jne 1167 ++ 11a5: 8b 48 04 mov 0x4(%eax),%ecx ++ 11a8: 8d 34 c8 lea (%eax,%ecx,8),%esi ++ 11ab: 39 f2 cmp %esi,%edx ++ 11ad: 75 d8 jne 1187 + p->s.size += bp->s.size; +- 118f: 03 4b fc add -0x4(%ebx),%ecx ++ 11af: 03 4b fc add -0x4(%ebx),%ecx + freep = p; +- 1192: a3 a4 19 00 00 mov %eax,0x19a4 ++ 11b2: a3 c4 19 00 00 mov %eax,0x19c4 + p->s.size += bp->s.size; +- 1197: 89 48 04 mov %ecx,0x4(%eax) ++ 11b7: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; +- 119a: 8b 53 f8 mov -0x8(%ebx),%edx +- 119d: 89 10 mov %edx,(%eax) ++ 11ba: 8b 53 f8 mov -0x8(%ebx),%edx ++ 11bd: 89 10 mov %edx,(%eax) + } +- 119f: 5b pop %ebx +- 11a0: 5e pop %esi +- 11a1: 5f pop %edi +- 11a2: 5d pop %ebp +- 11a3: c3 ret +- 11a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 11aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi +- +-000011b0 : ++ 11bf: 5b pop %ebx ++ 11c0: 5e pop %esi ++ 11c1: 5f pop %edi ++ 11c2: 5d pop %ebp ++ 11c3: c3 ret ++ 11c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 11ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ ++000011d0 : + return freep; + } + + void* + malloc(uint nbytes) + { +- 11b0: 55 push %ebp +- 11b1: 89 e5 mov %esp,%ebp +- 11b3: 57 push %edi +- 11b4: 56 push %esi +- 11b5: 53 push %ebx +- 11b6: 83 ec 1c sub $0x1c,%esp ++ 11d0: 55 push %ebp ++ 11d1: 89 e5 mov %esp,%ebp ++ 11d3: 57 push %edi ++ 11d4: 56 push %esi ++ 11d5: 53 push %ebx ++ 11d6: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 11b9: 8b 45 08 mov 0x8(%ebp),%eax ++ 11d9: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ +- 11bc: 8b 1d a4 19 00 00 mov 0x19a4,%ebx ++ 11dc: 8b 1d c4 19 00 00 mov 0x19c4,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 11c2: 8d 48 07 lea 0x7(%eax),%ecx +- 11c5: c1 e9 03 shr $0x3,%ecx ++ 11e2: 8d 48 07 lea 0x7(%eax),%ecx ++ 11e5: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ +- 11c8: 85 db test %ebx,%ebx ++ 11e8: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 11ca: 8d 71 01 lea 0x1(%ecx),%esi ++ 11ea: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ +- 11cd: 0f 84 9b 00 00 00 je 126e +- 11d3: 8b 13 mov (%ebx),%edx +- 11d5: 8b 7a 04 mov 0x4(%edx),%edi ++ 11ed: 0f 84 9b 00 00 00 je 128e ++ 11f3: 8b 13 mov (%ebx),%edx ++ 11f5: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ +- 11d8: 39 fe cmp %edi,%esi +- 11da: 76 64 jbe 1240 +- 11dc: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax ++ 11f8: 39 fe cmp %edi,%esi ++ 11fa: 76 64 jbe 1260 ++ 11fc: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) +- 11e3: bb 00 80 00 00 mov $0x8000,%ebx +- 11e8: 89 45 e4 mov %eax,-0x1c(%ebp) +- 11eb: eb 0e jmp 11fb +- 11ed: 8d 76 00 lea 0x0(%esi),%esi ++ 1203: bb 00 80 00 00 mov $0x8000,%ebx ++ 1208: 89 45 e4 mov %eax,-0x1c(%ebp) ++ 120b: eb 0e jmp 121b ++ 120d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ +- 11f0: 8b 02 mov (%edx),%eax ++ 1210: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ +- 11f2: 8b 78 04 mov 0x4(%eax),%edi +- 11f5: 39 fe cmp %edi,%esi +- 11f7: 76 4f jbe 1248 +- 11f9: 89 c2 mov %eax,%edx ++ 1212: 8b 78 04 mov 0x4(%eax),%edi ++ 1215: 39 fe cmp %edi,%esi ++ 1217: 76 4f jbe 1268 ++ 1219: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) +- 11fb: 3b 15 a4 19 00 00 cmp 0x19a4,%edx +- 1201: 75 ed jne 11f0 ++ 121b: 3b 15 c4 19 00 00 cmp 0x19c4,%edx ++ 1221: 75 ed jne 1210 + if(nu < 4096) +- 1203: 8b 45 e4 mov -0x1c(%ebp),%eax +- 1206: 81 fe 00 10 00 00 cmp $0x1000,%esi +- 120c: bf 00 10 00 00 mov $0x1000,%edi +- 1211: 0f 43 fe cmovae %esi,%edi +- 1214: 0f 42 c3 cmovb %ebx,%eax ++ 1223: 8b 45 e4 mov -0x1c(%ebp),%eax ++ 1226: 81 fe 00 10 00 00 cmp $0x1000,%esi ++ 122c: bf 00 10 00 00 mov $0x1000,%edi ++ 1231: 0f 43 fe cmovae %esi,%edi ++ 1234: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); +- 1217: 89 04 24 mov %eax,(%esp) +- 121a: e8 4b fc ff ff call e6a ++ 1237: 89 04 24 mov %eax,(%esp) ++ 123a: e8 4b fc ff ff call e8a + if(p == (char*)-1) +- 121f: 83 f8 ff cmp $0xffffffff,%eax +- 1222: 74 18 je 123c ++ 123f: 83 f8 ff cmp $0xffffffff,%eax ++ 1242: 74 18 je 125c + hp->s.size = nu; +- 1224: 89 78 04 mov %edi,0x4(%eax) ++ 1244: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); +- 1227: 83 c0 08 add $0x8,%eax +- 122a: 89 04 24 mov %eax,(%esp) +- 122d: e8 ee fe ff ff call 1120 ++ 1247: 83 c0 08 add $0x8,%eax ++ 124a: 89 04 24 mov %eax,(%esp) ++ 124d: e8 ee fe ff ff call 1140 + return freep; +- 1232: 8b 15 a4 19 00 00 mov 0x19a4,%edx ++ 1252: 8b 15 c4 19 00 00 mov 0x19c4,%edx + if((p = morecore(nunits)) == 0) +- 1238: 85 d2 test %edx,%edx +- 123a: 75 b4 jne 11f0 ++ 1258: 85 d2 test %edx,%edx ++ 125a: 75 b4 jne 1210 + return 0; +- 123c: 31 c0 xor %eax,%eax +- 123e: eb 20 jmp 1260 ++ 125c: 31 c0 xor %eax,%eax ++ 125e: eb 20 jmp 1280 + if(p->s.size >= nunits){ +- 1240: 89 d0 mov %edx,%eax +- 1242: 89 da mov %ebx,%edx +- 1244: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 1260: 89 d0 mov %edx,%eax ++ 1262: 89 da mov %ebx,%edx ++ 1264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) +- 1248: 39 fe cmp %edi,%esi +- 124a: 74 1c je 1268 ++ 1268: 39 fe cmp %edi,%esi ++ 126a: 74 1c je 1288 + p->s.size -= nunits; +- 124c: 29 f7 sub %esi,%edi +- 124e: 89 78 04 mov %edi,0x4(%eax) ++ 126c: 29 f7 sub %esi,%edi ++ 126e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; +- 1251: 8d 04 f8 lea (%eax,%edi,8),%eax ++ 1271: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; +- 1254: 89 70 04 mov %esi,0x4(%eax) ++ 1274: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; +- 1257: 89 15 a4 19 00 00 mov %edx,0x19a4 ++ 1277: 89 15 c4 19 00 00 mov %edx,0x19c4 + return (void*)(p + 1); +- 125d: 83 c0 08 add $0x8,%eax ++ 127d: 83 c0 08 add $0x8,%eax + } + } +- 1260: 83 c4 1c add $0x1c,%esp +- 1263: 5b pop %ebx +- 1264: 5e pop %esi +- 1265: 5f pop %edi +- 1266: 5d pop %ebp +- 1267: c3 ret ++ 1280: 83 c4 1c add $0x1c,%esp ++ 1283: 5b pop %ebx ++ 1284: 5e pop %esi ++ 1285: 5f pop %edi ++ 1286: 5d pop %ebp ++ 1287: c3 ret + prevp->s.ptr = p->s.ptr; +- 1268: 8b 08 mov (%eax),%ecx +- 126a: 89 0a mov %ecx,(%edx) +- 126c: eb e9 jmp 1257 ++ 1288: 8b 08 mov (%eax),%ecx ++ 128a: 89 0a mov %ecx,(%edx) ++ 128c: eb e9 jmp 1277 + base.s.ptr = freep = prevp = &base; +- 126e: c7 05 a4 19 00 00 a8 movl $0x19a8,0x19a4 +- 1275: 19 00 00 ++ 128e: c7 05 c4 19 00 00 c8 movl $0x19c8,0x19c4 ++ 1295: 19 00 00 + base.s.size = 0; +- 1278: ba a8 19 00 00 mov $0x19a8,%edx ++ 1298: ba c8 19 00 00 mov $0x19c8,%edx + base.s.ptr = freep = prevp = &base; +- 127d: c7 05 a8 19 00 00 a8 movl $0x19a8,0x19a8 +- 1284: 19 00 00 ++ 129d: c7 05 c8 19 00 00 c8 movl $0x19c8,0x19c8 ++ 12a4: 19 00 00 + base.s.size = 0; +- 1287: c7 05 ac 19 00 00 00 movl $0x0,0x19ac +- 128e: 00 00 00 +- 1291: e9 46 ff ff ff jmp 11dc ++ 12a7: c7 05 cc 19 00 00 00 movl $0x0,0x19cc ++ 12ae: 00 00 00 ++ 12b1: e9 46 ff ff ff jmp 11fc +diff --git a/sh.c b/sh.c +index 238ff10..6adf66a 100644 +--- a/sh.c ++++ b/sh.c +@@ -5,25 +5,28 @@ + #include "fcntl.h" + + // Parsed command representation +-#define EXEC 1 ++#define EXEC 1 + #define REDIR 2 +-#define PIPE 3 +-#define LIST 4 +-#define BACK 5 ++#define PIPE 3 ++#define LIST 4 ++#define BACK 5 + + #define MAXARGS 10 + +-struct cmd { ++struct cmd ++{ + int type; + }; + +-struct execcmd { ++struct execcmd ++{ + int type; + char *argv[MAXARGS]; + char *eargv[MAXARGS]; + }; + +-struct redircmd { ++struct redircmd ++{ + int type; + struct cmd *cmd; + char *file; +@@ -32,30 +35,32 @@ struct redircmd { + int fd; + }; + +-struct pipecmd { ++struct pipecmd ++{ + int type; + struct cmd *left; + struct cmd *right; + }; + +-struct listcmd { ++struct listcmd ++{ + int type; + struct cmd *left; + struct cmd *right; + }; + +-struct backcmd { ++struct backcmd ++{ + int type; + struct cmd *cmd; + }; + +-int fork1(void); // Fork but panics on failure. +-void panic(char*); +-struct cmd *parsecmd(char*); ++int fork1(void); // Fork but panics on failure. ++void panic(char *); ++struct cmd *parsecmd(char *); + + // Execute cmd. Never returns. +-void +-runcmd(struct cmd *cmd) ++void runcmd(struct cmd *cmd) + { + int p[2]; + struct backcmd *bcmd; +@@ -64,25 +69,27 @@ runcmd(struct cmd *cmd) + struct pipecmd *pcmd; + struct redircmd *rcmd; + +- if(cmd == 0) ++ if (cmd == 0) + exit(0); + +- switch(cmd->type){ ++ switch (cmd->type) ++ { + default: + panic("runcmd"); + + case EXEC: +- ecmd = (struct execcmd*)cmd; +- if(ecmd->argv[0] == 0) ++ ecmd = (struct execcmd *)cmd; ++ if (ecmd->argv[0] == 0) + exit(0); + exec(ecmd->argv[0], ecmd->argv); + printf(2, "exec %s failed\n", ecmd->argv[0]); + break; + + case REDIR: +- rcmd = (struct redircmd*)cmd; ++ rcmd = (struct redircmd *)cmd; + close(rcmd->fd); +- if(open(rcmd->file, rcmd->mode) < 0){ ++ if (open(rcmd->file, rcmd->mode) < 0) ++ { + printf(2, "open %s failed\n", rcmd->file); + exit(0); + } +@@ -90,25 +97,28 @@ runcmd(struct cmd *cmd) + break; + + case LIST: +- lcmd = (struct listcmd*)cmd; +- if(fork1() == 0) ++ lcmd = (struct listcmd *)cmd; ++ if (fork1() == 0) + runcmd(lcmd->left); +- wait(); ++ wait(0); ++ ; + runcmd(lcmd->right); + break; + + case PIPE: +- pcmd = (struct pipecmd*)cmd; +- if(pipe(p) < 0) ++ pcmd = (struct pipecmd *)cmd; ++ if (pipe(p) < 0) + panic("pipe"); +- if(fork1() == 0){ ++ if (fork1() == 0) ++ { + close(1); + dup(p[1]); + close(p[0]); + close(p[1]); + runcmd(pcmd->left); + } +- if(fork1() == 0){ ++ if (fork1() == 0) ++ { + close(0); + dup(p[0]); + close(p[0]); +@@ -117,82 +127,85 @@ runcmd(struct cmd *cmd) + } + close(p[0]); + close(p[1]); +- wait(); +- wait(); ++ wait(0); ++ ; ++ wait(0); ++ ; + break; + + case BACK: +- bcmd = (struct backcmd*)cmd; +- if(fork1() == 0) ++ bcmd = (struct backcmd *)cmd; ++ if (fork1() == 0) + runcmd(bcmd->cmd); + break; + } + exit(0); + } + +-int +-getcmd(char *buf, int nbuf) ++int getcmd(char *buf, int nbuf) + { + printf(2, "$ "); + memset(buf, 0, nbuf); + gets(buf, nbuf); +- if(buf[0] == 0) // EOF ++ if (buf[0] == 0) // EOF + return -1; + return 0; + } + +-int +-main(void) ++int main(void) + { + static char buf[100]; + int fd; + + // Ensure that three file descriptors are open. +- while((fd = open("console", O_RDWR)) >= 0){ +- if(fd >= 3){ ++ while ((fd = open("console", O_RDWR)) >= 0) ++ { ++ if (fd >= 3) ++ { + close(fd); + break; + } + } + + // Read and run input commands. +- while(getcmd(buf, sizeof(buf)) >= 0){ +- if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ ++ while (getcmd(buf, sizeof(buf)) >= 0) ++ { ++ if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') ++ { + // Chdir must be called by the parent, not the child. +- buf[strlen(buf)-1] = 0; // chop \n +- if(chdir(buf+3) < 0) +- printf(2, "cannot cd %s\n", buf+3); ++ buf[strlen(buf) - 1] = 0; // chop \n ++ if (chdir(buf + 3) < 0) ++ printf(2, "cannot cd %s\n", buf + 3); + continue; + } +- if(fork1() == 0) ++ if (fork1() == 0) + runcmd(parsecmd(buf)); +- wait(); ++ wait(0); ++ ; + } + exit(0); + } + +-void +-panic(char *s) ++void panic(char *s) + { + printf(2, "%s\n", s); + exit(0); + } + +-int +-fork1(void) ++int fork1(void) + { + int pid; + + pid = fork(); +- if(pid == -1) ++ if (pid == -1) + panic("fork"); + return pid; + } + +-//PAGEBREAK! +-// Constructors ++// PAGEBREAK! ++// Constructors + +-struct cmd* ++struct cmd * + execcmd(void) + { + struct execcmd *cmd; +@@ -200,10 +213,10 @@ execcmd(void) + cmd = malloc(sizeof(*cmd)); + memset(cmd, 0, sizeof(*cmd)); + cmd->type = EXEC; +- return (struct cmd*)cmd; ++ return (struct cmd *)cmd; + } + +-struct cmd* ++struct cmd * + redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) + { + struct redircmd *cmd; +@@ -216,10 +229,10 @@ redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) + cmd->efile = efile; + cmd->mode = mode; + cmd->fd = fd; +- return (struct cmd*)cmd; ++ return (struct cmd *)cmd; + } + +-struct cmd* ++struct cmd * + pipecmd(struct cmd *left, struct cmd *right) + { + struct pipecmd *cmd; +@@ -229,10 +242,10 @@ pipecmd(struct cmd *left, struct cmd *right) + cmd->type = PIPE; + cmd->left = left; + cmd->right = right; +- return (struct cmd*)cmd; ++ return (struct cmd *)cmd; + } + +-struct cmd* ++struct cmd * + listcmd(struct cmd *left, struct cmd *right) + { + struct listcmd *cmd; +@@ -242,10 +255,10 @@ listcmd(struct cmd *left, struct cmd *right) + cmd->type = LIST; + cmd->left = left; + cmd->right = right; +- return (struct cmd*)cmd; ++ return (struct cmd *)cmd; + } + +-struct cmd* ++struct cmd * + backcmd(struct cmd *subcmd) + { + struct backcmd *cmd; +@@ -254,27 +267,27 @@ backcmd(struct cmd *subcmd) + memset(cmd, 0, sizeof(*cmd)); + cmd->type = BACK; + cmd->cmd = subcmd; +- return (struct cmd*)cmd; ++ return (struct cmd *)cmd; + } +-//PAGEBREAK! +-// Parsing ++// PAGEBREAK! ++// Parsing + + char whitespace[] = " \t\r\n\v"; + char symbols[] = "<|>&;()"; + +-int +-gettoken(char **ps, char *es, char **q, char **eq) ++int gettoken(char **ps, char *es, char **q, char **eq) + { + char *s; + int ret; + + s = *ps; +- while(s < es && strchr(whitespace, *s)) ++ while (s < es && strchr(whitespace, *s)) + s++; +- if(q) ++ if (q) + *q = s; + ret = *s; +- switch(*s){ ++ switch (*s) ++ { + case 0: + break; + case '|': +@@ -287,44 +300,44 @@ gettoken(char **ps, char *es, char **q, char **eq) + break; + case '>': + s++; +- if(*s == '>'){ ++ if (*s == '>') ++ { + ret = '+'; + s++; + } + break; + default: + ret = 'a'; +- while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) ++ while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) + s++; + break; + } +- if(eq) ++ if (eq) + *eq = s; + +- while(s < es && strchr(whitespace, *s)) ++ while (s < es && strchr(whitespace, *s)) + s++; + *ps = s; + return ret; + } + +-int +-peek(char **ps, char *es, char *toks) ++int peek(char **ps, char *es, char *toks) + { + char *s; + + s = *ps; +- while(s < es && strchr(whitespace, *s)) ++ while (s < es && strchr(whitespace, *s)) + s++; + *ps = s; + return *s && strchr(toks, *s); + } + +-struct cmd *parseline(char**, char*); +-struct cmd *parsepipe(char**, char*); +-struct cmd *parseexec(char**, char*); +-struct cmd *nulterminate(struct cmd*); ++struct cmd *parseline(char **, char *); ++struct cmd *parsepipe(char **, char *); ++struct cmd *parseexec(char **, char *); ++struct cmd *nulterminate(struct cmd *); + +-struct cmd* ++struct cmd * + parsecmd(char *s) + { + char *es; +@@ -333,7 +346,8 @@ parsecmd(char *s) + es = s + strlen(s); + cmd = parseline(&s, es); + peek(&s, es, ""); +- if(s != es){ ++ if (s != es) ++ { + printf(2, "leftovers: %s\n", s); + panic("syntax"); + } +@@ -341,78 +355,83 @@ parsecmd(char *s) + return cmd; + } + +-struct cmd* ++struct cmd * + parseline(char **ps, char *es) + { + struct cmd *cmd; + + cmd = parsepipe(ps, es); +- while(peek(ps, es, "&")){ ++ while (peek(ps, es, "&")) ++ { + gettoken(ps, es, 0, 0); + cmd = backcmd(cmd); + } +- if(peek(ps, es, ";")){ ++ if (peek(ps, es, ";")) ++ { + gettoken(ps, es, 0, 0); + cmd = listcmd(cmd, parseline(ps, es)); + } + return cmd; + } + +-struct cmd* ++struct cmd * + parsepipe(char **ps, char *es) + { + struct cmd *cmd; + + cmd = parseexec(ps, es); +- if(peek(ps, es, "|")){ ++ if (peek(ps, es, "|")) ++ { + gettoken(ps, es, 0, 0); + cmd = pipecmd(cmd, parsepipe(ps, es)); + } + return cmd; + } + +-struct cmd* ++struct cmd * + parseredirs(struct cmd *cmd, char **ps, char *es) + { + int tok; + char *q, *eq; + +- while(peek(ps, es, "<>")){ ++ while (peek(ps, es, "<>")) ++ { + tok = gettoken(ps, es, 0, 0); +- if(gettoken(ps, es, &q, &eq) != 'a') ++ if (gettoken(ps, es, &q, &eq) != 'a') + panic("missing file for redirection"); +- switch(tok){ ++ switch (tok) ++ { + case '<': + cmd = redircmd(cmd, q, eq, O_RDONLY, 0); + break; + case '>': +- cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); ++ cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); + break; +- case '+': // >> +- cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); ++ case '+': // >> ++ cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); + break; + } + } + return cmd; + } + +-struct cmd* ++struct cmd * + parseblock(char **ps, char *es) + { + struct cmd *cmd; + +- if(!peek(ps, es, "(")) ++ if (!peek(ps, es, "(")) + panic("parseblock"); + gettoken(ps, es, 0, 0); + cmd = parseline(ps, es); +- if(!peek(ps, es, ")")) ++ if (!peek(ps, es, ")")) + panic("syntax - missing )"); + gettoken(ps, es, 0, 0); + cmd = parseredirs(cmd, ps, es); + return cmd; + } + +-struct cmd* ++struct cmd * + parseexec(char **ps, char *es) + { + char *q, *eq; +@@ -420,23 +439,24 @@ parseexec(char **ps, char *es) + struct execcmd *cmd; + struct cmd *ret; + +- if(peek(ps, es, "(")) ++ if (peek(ps, es, "(")) + return parseblock(ps, es); + + ret = execcmd(); +- cmd = (struct execcmd*)ret; ++ cmd = (struct execcmd *)ret; + + argc = 0; + ret = parseredirs(ret, ps, es); +- while(!peek(ps, es, "|)&;")){ +- if((tok=gettoken(ps, es, &q, &eq)) == 0) ++ while (!peek(ps, es, "|)&;")) ++ { ++ if ((tok = gettoken(ps, es, &q, &eq)) == 0) + break; +- if(tok != 'a') ++ if (tok != 'a') + panic("syntax"); + cmd->argv[argc] = q; + cmd->eargv[argc] = eq; + argc++; +- if(argc >= MAXARGS) ++ if (argc >= MAXARGS) + panic("too many args"); + ret = parseredirs(ret, ps, es); + } +@@ -446,7 +466,7 @@ parseexec(char **ps, char *es) + } + + // NUL-terminate all the counted strings. +-struct cmd* ++struct cmd * + nulterminate(struct cmd *cmd) + { + int i; +@@ -456,36 +476,37 @@ nulterminate(struct cmd *cmd) + struct pipecmd *pcmd; + struct redircmd *rcmd; + +- if(cmd == 0) ++ if (cmd == 0) + return 0; + +- switch(cmd->type){ ++ switch (cmd->type) ++ { + case EXEC: +- ecmd = (struct execcmd*)cmd; +- for(i=0; ecmd->argv[i]; i++) ++ ecmd = (struct execcmd *)cmd; ++ for (i = 0; ecmd->argv[i]; i++) + *ecmd->eargv[i] = 0; + break; + + case REDIR: +- rcmd = (struct redircmd*)cmd; ++ rcmd = (struct redircmd *)cmd; + nulterminate(rcmd->cmd); + *rcmd->efile = 0; + break; + + case PIPE: +- pcmd = (struct pipecmd*)cmd; ++ pcmd = (struct pipecmd *)cmd; + nulterminate(pcmd->left); + nulterminate(pcmd->right); + break; + + case LIST: +- lcmd = (struct listcmd*)cmd; ++ lcmd = (struct listcmd *)cmd; + nulterminate(lcmd->left); + nulterminate(lcmd->right); + break; + + case BACK: +- bcmd = (struct backcmd*)cmd; ++ bcmd = (struct backcmd *)cmd; + nulterminate(bcmd->cmd); + break; + } +diff --git a/sh.o b/sh.o +index 872f8c2..c5ff1f0 100644 +Binary files a/sh.o and b/sh.o differ +diff --git a/sh.sym b/sh.sym +index abf39b1..ed3bbb3 100644 +--- a/sh.sym ++++ b/sh.sym +@@ -1,8 +1,8 @@ + 00000000 .text +-00001298 .rodata +-00001398 .eh_frame +-00001918 .data +-00001940 .bss ++000012b8 .rodata ++000013b8 .eh_frame ++00001938 .data ++00001960 .bss + 00000000 .comment + 00000000 .debug_aranges + 00000000 .debug_info +@@ -12,68 +12,68 @@ + 00000000 .debug_loc + 00000000 .debug_ranges + 00000000 sh.c +-00001940 buf.1392 ++00001960 buf.1392 + 00000000 ulib.c + 00000000 printf.c +-00000e90 printint +-00001387 digits.1354 ++00000eb0 printint ++000013a7 digits.1354 + 00000000 umalloc.c +-000019a4 freep +-000019a8 base +-00000bc0 strcpy +-00000f30 printf +-00000db0 memmove +-00000e2a mknod +-00000360 execcmd +-00000cd0 gets +-00000e62 getpid +-00000890 parsepipe +-00000b40 parsecmd +-000004a0 backcmd +-00000630 peek +-00000690 parseredirs +-000004f0 gettoken +-000011b0 malloc +-00000e72 sleep +-00001920 whitespace +-00000190 fork1 +-00000a90 nulterminate +-00000df2 pipe +-00000100 getcmd +-00000e02 write +-00000e3a fstat +-00000e12 kill +-00000e52 chdir +-00000910 parseline +-000001b0 runcmd +-000009d0 parseblock +-00000e1a exec +-00000dea wait +-00001918 symbols +-00000dfa read +-00000770 parseexec +-00000e32 unlink +-00000160 panic +-00000dda fork +-00000e6a sbrk +-00000e7a uptime +-00001926 __bss_start +-00000c70 memset ++000019c4 freep ++000019c8 base ++00000be0 strcpy ++00000f50 printf ++00000dd0 memmove ++00000e4a mknod ++00000380 execcmd ++00000cf0 gets ++00000e82 getpid ++000008b0 parsepipe ++00000b60 parsecmd ++000004c0 backcmd ++00000650 peek ++000006b0 parseredirs ++00000510 gettoken ++000011d0 malloc ++00000e92 sleep ++00001940 whitespace ++000001a0 fork1 ++00000ab0 nulterminate ++00000e12 pipe ++00000110 getcmd ++00000e22 write ++00000e5a fstat ++00000e32 kill ++00000e72 chdir ++00000930 parseline ++000001c0 runcmd ++000009f0 parseblock ++00000e3a exec ++00000e0a wait ++00001938 symbols ++00000e1a read ++00000790 parseexec ++00000e52 unlink ++00000170 panic ++00000dfa fork ++00000e8a sbrk ++00000e9a uptime ++00001946 __bss_start ++00000c90 memset + 00000000 main +-00000bf0 strcmp +-00000e5a dup +-00000400 pipecmd +-000003a0 redircmd +-00000d30 stat +-00001926 _edata +-000019b0 _end +-00000e42 link +-00000de2 exit +-00000d80 atoi +-00000c40 strlen +-00000e22 open +-00000c90 strchr +-00000e4a mkdir +-00000e0a close +-00000450 listcmd +-00001120 free ++00000c10 strcmp ++00000e7a dup ++00000420 pipecmd ++000003c0 redircmd ++00000d50 stat ++00001946 _edata ++000019d0 _end ++00000e62 link ++00000e02 exit ++00000da0 atoi ++00000c60 strlen ++00000e42 open ++00000cb0 strchr ++00000e6a mkdir ++00000e2a close ++00000470 listcmd ++00001140 free +diff --git a/sleeplock.o b/sleeplock.o +index 7b291e5..6c3c28c 100644 +Binary files a/sleeplock.o and b/sleeplock.o differ +diff --git a/spinlock.o b/spinlock.o +index 91ba524..2a504a0 100644 +Binary files a/spinlock.o and b/spinlock.o differ +diff --git a/stressfs.asm b/stressfs.asm +index ba906ab..fe50684 100644 +--- a/stressfs.asm ++++ b/stressfs.asm +@@ -5,11 +5,11 @@ _stressfs: file format elf32-i386 + Disassembly of section .text: + + 00000000
: ++#include "user.h" + #include "fs.h" + #include "fcntl.h" + +-int +-main(int argc, char *argv[]) ++int main(int argc, char *argv[]) + { + 0: 55 push %ebp + int fd, i; +@@ -25,7 +25,7 @@ main(int argc, char *argv[]) + printf(1, "stressfs starting\n"); + memset(data, 'a', sizeof(data)); + +- for(i = 0; i < 4; i++) ++ for (i = 0; i < 4; i++) + b: 31 db xor %ebx,%ebx + { + d: 83 e4 f0 and $0xfffffff0,%esp +@@ -52,11 +52,11 @@ main(int argc, char *argv[]) + 52: 00 + 53: 89 34 24 mov %esi,(%esp) + 56: e8 95 01 00 00 call 1f0 +- if(fork() > 0) ++ if (fork() > 0) + 5b: e8 fa 02 00 00 call 35a + 60: 85 c0 test %eax,%eax +- 62: 0f 8f ca 00 00 00 jg 132 +- for(i = 0; i < 4; i++) ++ 62: 0f 8f d1 00 00 00 jg 139 ++ for (i = 0; i < 4; i++) + 68: 83 c3 01 add $0x1,%ebx + 6b: 83 fb 04 cmp $0x4,%ebx + 6e: 75 eb jne 5b +@@ -85,15 +85,15 @@ main(int argc, char *argv[]) + a7: e8 f6 02 00 00 call 3a2 + ac: 89 c7 mov %eax,%edi + ae: 66 90 xchg %ax,%ax +- for(i = 0; i < 20; i++) +-// printf(fd, "%d\n", i); ++ for (i = 0; i < 20; i++) ++ // printf(fd, "%d\n", i); + write(fd, data, sizeof(data)); + b0: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + b7: 00 + b8: 89 74 24 04 mov %esi,0x4(%esp) + bc: 89 3c 24 mov %edi,(%esp) + bf: e8 be 02 00 00 call 382 +- for(i = 0; i < 20; i++) ++ for (i = 0; i < 20; i++) + c4: 83 eb 01 sub $0x1,%ebx + c7: 75 e7 jne b0 + close(fd); +@@ -131,18 +131,16 @@ main(int argc, char *argv[]) + 119: 89 3c 24 mov %edi,(%esp) + 11c: e8 69 02 00 00 call 38a + +- wait(); +- 121: e8 44 02 00 00 call 36a ++ wait(0); ++ 121: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 128: e8 3d 02 00 00 call 36a ++ ; + + exit(0); +- 126: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 12d: e8 30 02 00 00 call 362 +- 132: 89 df mov %ebx,%edi +- 134: e9 3c ff ff ff jmp 75 +- 139: 66 90 xchg %ax,%ax +- 13b: 66 90 xchg %ax,%ax +- 13d: 66 90 xchg %ax,%ax +- 13f: 90 nop ++ 12d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 134: e8 29 02 00 00 call 362 ++ 139: 89 df mov %ebx,%edi ++ 13b: e9 35 ff ff ff jmp 75 + + 00000140 : + #include "user.h" +@@ -527,132 +525,106 @@ memmove(void *vdst, const void *vsrc, int n) + 359: c3 ret + + 0000035a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 35a: b8 01 00 00 00 mov $0x1,%eax + 35f: cd 40 int $0x40 + 361: c3 ret + + 00000362 : +-SYSCALL(exit) + 362: b8 02 00 00 00 mov $0x2,%eax + 367: cd 40 int $0x40 + 369: c3 ret + + 0000036a : +-SYSCALL(wait) + 36a: b8 03 00 00 00 mov $0x3,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + + 00000372 : +-SYSCALL(pipe) + 372: b8 04 00 00 00 mov $0x4,%eax + 377: cd 40 int $0x40 + 379: c3 ret + + 0000037a : +-SYSCALL(read) + 37a: b8 05 00 00 00 mov $0x5,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + + 00000382 : +-SYSCALL(write) + 382: b8 10 00 00 00 mov $0x10,%eax + 387: cd 40 int $0x40 + 389: c3 ret + + 0000038a : +-SYSCALL(close) + 38a: b8 15 00 00 00 mov $0x15,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + + 00000392 : +-SYSCALL(kill) + 392: b8 06 00 00 00 mov $0x6,%eax + 397: cd 40 int $0x40 + 399: c3 ret + + 0000039a : +-SYSCALL(exec) + 39a: b8 07 00 00 00 mov $0x7,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + + 000003a2 : +-SYSCALL(open) + 3a2: b8 0f 00 00 00 mov $0xf,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + + 000003aa : +-SYSCALL(mknod) + 3aa: b8 11 00 00 00 mov $0x11,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + + 000003b2 : +-SYSCALL(unlink) + 3b2: b8 12 00 00 00 mov $0x12,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + + 000003ba : +-SYSCALL(fstat) + 3ba: b8 08 00 00 00 mov $0x8,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + + 000003c2 : +-SYSCALL(link) + 3c2: b8 13 00 00 00 mov $0x13,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + + 000003ca : +-SYSCALL(mkdir) + 3ca: b8 14 00 00 00 mov $0x14,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + + 000003d2 : +-SYSCALL(chdir) + 3d2: b8 09 00 00 00 mov $0x9,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + + 000003da : +-SYSCALL(dup) + 3da: b8 0a 00 00 00 mov $0xa,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + + 000003e2 : +-SYSCALL(getpid) + 3e2: b8 0b 00 00 00 mov $0xb,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + + 000003ea : +-SYSCALL(sbrk) + 3ea: b8 0c 00 00 00 mov $0xc,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + + 000003f2 : +-SYSCALL(sleep) + 3f2: b8 0d 00 00 00 mov $0xd,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + + 000003fa : +-SYSCALL(uptime) + 3fa: b8 0e 00 00 00 mov $0xe,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret +diff --git a/stressfs.c b/stressfs.c +index 8829be2..1e78e18 100644 +--- a/stressfs.c ++++ b/stressfs.c +@@ -13,8 +13,7 @@ + #include "fs.h" + #include "fcntl.h" + +-int +-main(int argc, char *argv[]) ++int main(int argc, char *argv[]) + { + int fd, i; + char path[] = "stressfs0"; +@@ -23,16 +22,16 @@ main(int argc, char *argv[]) + printf(1, "stressfs starting\n"); + memset(data, 'a', sizeof(data)); + +- for(i = 0; i < 4; i++) +- if(fork() > 0) ++ for (i = 0; i < 4; i++) ++ if (fork() > 0) + break; + + printf(1, "write %d\n", i); + + path[8] += i; + fd = open(path, O_CREATE | O_RDWR); +- for(i = 0; i < 20; i++) +-// printf(fd, "%d\n", i); ++ for (i = 0; i < 20; i++) ++ // printf(fd, "%d\n", i); + write(fd, data, sizeof(data)); + close(fd); + +@@ -43,7 +42,8 @@ main(int argc, char *argv[]) + read(fd, data, sizeof(data)); + close(fd); + +- wait(); ++ wait(0); ++ ; + + exit(0); + } +diff --git a/stressfs.o b/stressfs.o +index 9a76e26..900a131 100644 +Binary files a/stressfs.o and b/stressfs.o differ +diff --git a/syscall.o b/syscall.o +index e20c2c5..d159933 100644 +Binary files a/syscall.o and b/syscall.o differ +diff --git a/sysfile.o b/sysfile.o +index 10d3278..426943d 100644 +Binary files a/sysfile.o and b/sysfile.o differ +diff --git a/sysproc.c b/sysproc.c +index 1ccc484..4d73f05 100644 +--- a/sysproc.c ++++ b/sysproc.c +@@ -7,69 +7,70 @@ + #include "mmu.h" + #include "proc.h" + +-int +-sys_fork(void) ++int sys_fork(void) + { + return fork(); + } + +-int +-sys_exit(void) ++int sys_exit(void) + { + int status; + argint(0, &status); + exit(status); +- return 0; // not reached ++ return 0; // not reached + } + +-int +-sys_wait(void) ++int sys_wait(void) + { +- return wait(); ++ int *status; ++ if (argptr(0, (void *)&status, sizeof(status)) < 0) ++ { ++ return -1; ++ } ++ ++ return wait(status); + } + +-int +-sys_kill(void) ++int sys_kill(void) + { + int pid; + +- if(argint(0, &pid) < 0) ++ if (argint(0, &pid) < 0) + return -1; + return kill(pid); + } + +-int +-sys_getpid(void) ++int sys_getpid(void) + { + return myproc()->pid; + } + +-int +-sys_sbrk(void) ++int sys_sbrk(void) + { + int addr; + int n; + +- if(argint(0, &n) < 0) ++ if (argint(0, &n) < 0) + return -1; + addr = myproc()->sz; +- if(growproc(n) < 0) ++ if (growproc(n) < 0) + return -1; + return addr; + } + +-int +-sys_sleep(void) ++int sys_sleep(void) + { + int n; + uint ticks0; + +- if(argint(0, &n) < 0) ++ if (argint(0, &n) < 0) + return -1; + acquire(&tickslock); + ticks0 = ticks; +- while(ticks - ticks0 < n){ +- if(myproc()->killed){ ++ while (ticks - ticks0 < n) ++ { ++ if (myproc()->killed) ++ { + release(&tickslock); + return -1; + } +@@ -81,8 +82,7 @@ sys_sleep(void) + + // return how many clock tick interrupts have occurred + // since start. +-int +-sys_uptime(void) ++int sys_uptime(void) + { + uint xticks; + +diff --git a/sysproc.o b/sysproc.o +index b9dceff..0509812 100644 +Binary files a/sysproc.o and b/sysproc.o differ +diff --git a/trap.o b/trap.o +index 6f09b70..86a1276 100644 +Binary files a/trap.o and b/trap.o differ +diff --git a/uart.c b/uart.c +index b8946da..7de2015 100644 +--- a/uart.c ++++ b/uart.c +@@ -12,66 +12,63 @@ + #include "proc.h" + #include "x86.h" + +-#define COM1 0x3f8 ++#define COM1 0x3f8 + +-static int uart; // is there a uart? ++static int uart; // is there a uart? + +-void +-uartinit(void) ++void uartinit(void) + { + char *p; + + // Turn off the FIFO +- outb(COM1+2, 0); ++ outb(COM1 + 2, 0); + + // 9600 baud, 8 data bits, 1 stop bit, parity off. +- outb(COM1+3, 0x80); // Unlock divisor +- outb(COM1+0, 115200/9600); +- outb(COM1+1, 0); +- outb(COM1+3, 0x03); // Lock divisor, 8 data bits. +- outb(COM1+4, 0); +- outb(COM1+1, 0x01); // Enable receive interrupts. ++ outb(COM1 + 3, 0x80); // Unlock divisor ++ outb(COM1 + 0, 115200 / 9600); ++ outb(COM1 + 1, 0); ++ outb(COM1 + 3, 0x03); // Lock divisor, 8 data bits. ++ outb(COM1 + 4, 0); ++ outb(COM1 + 1, 0x01); // Enable receive interrupts. + + // If status is 0xFF, no serial port. +- if(inb(COM1+5) == 0xFF) ++ if (inb(COM1 + 5) == 0xFF) + return; + uart = 1; + + // Acknowledge pre-existing interrupt conditions; + // enable interrupts. +- inb(COM1+2); +- inb(COM1+0); ++ inb(COM1 + 2); ++ inb(COM1 + 0); + ioapicenable(IRQ_COM1, 0); + + // Announce that we're here. +- for(p="xv6...\n"; *p; p++) ++ for (p = "xv6...\n"; *p; p++) + uartputc(*p); + } + +-void +-uartputc(int c) ++void uartputc(int c) + { + int i; + +- if(!uart) ++ if (!uart) + return; +- for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) ++ for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) + microdelay(10); +- outb(COM1+0, c); ++ outb(COM1 + 0, c); + } + + static int + uartgetc(void) + { +- if(!uart) ++ if (!uart) + return -1; +- if(!(inb(COM1+5) & 0x01)) ++ if (!(inb(COM1 + 5) & 0x01)) + return -1; +- return inb(COM1+0); ++ return inb(COM1 + 0); + } + +-void +-uartintr(void) ++void uartintr(void) + { + consoleintr(uartgetc); + } +diff --git a/uart.o b/uart.o +index bbdc927..098d4fc 100644 +Binary files a/uart.o and b/uart.o differ +diff --git a/ulib.o b/ulib.o +index 60c0110..f1995da 100644 +Binary files a/ulib.o and b/ulib.o differ +diff --git a/umalloc.o b/umalloc.o +index f9e608f..56165e8 100644 +Binary files a/umalloc.o and b/umalloc.o differ +diff --git a/user.h b/user.h +index 3498e6d..d4d3040 100644 +--- a/user.h ++++ b/user.h +@@ -4,36 +4,36 @@ struct rtcdate; + // system calls + int fork(void); + int exit(int) __attribute__((noreturn)); +-int wait(void); +-int pipe(int*); +-int write(int, const void*, int); +-int read(int, void*, int); ++int wait(int *); ++int pipe(int *); ++int write(int, const void *, int); ++int read(int, void *, int); + int close(int); + int kill(int); +-int exec(char*, char**); +-int open(const char*, int); +-int mknod(const char*, short, short); +-int unlink(const char*); +-int fstat(int fd, struct stat*); +-int link(const char*, const char*); +-int mkdir(const char*); +-int chdir(const char*); ++int exec(char *, char **); ++int open(const char *, int); ++int mknod(const char *, short, short); ++int unlink(const char *); ++int fstat(int fd, struct stat *); ++int link(const char *, const char *); ++int mkdir(const char *); ++int chdir(const char *); + int dup(int); + int getpid(void); +-char* sbrk(int); ++char *sbrk(int); + int sleep(int); + int uptime(void); + + // ulib.c +-int stat(const char*, struct stat*); +-char* strcpy(char*, const char*); +-void *memmove(void*, const void*, int); +-char* strchr(const char*, char c); +-int strcmp(const char*, const char*); +-void printf(int, const char*, ...); +-char* gets(char*, int max); +-uint strlen(const char*); +-void* memset(void*, int, uint); +-void* malloc(uint); +-void free(void*); +-int atoi(const char*); ++int stat(const char *, struct stat *); ++char *strcpy(char *, const char *); ++void *memmove(void *, const void *, int); ++char *strchr(const char *, char c); ++int strcmp(const char *, const char *); ++void printf(int, const char *, ...); ++char *gets(char *, int max); ++uint strlen(const char *); ++void *memset(void *, int, uint); ++void *malloc(uint); ++void free(void *); ++int atoi(const char *); +diff --git a/usertests.asm b/usertests.asm +index 55f26e4..f29872b 100644 +--- a/usertests.asm ++++ b/usertests.asm +@@ -5,89 +5,90 @@ _usertests: file format elf32-i386 + Disassembly of section .text: + + 00000000
: ++ randstate = randstate * 1664525 + 1013904223; + return randstate; + } + +-int +-main(int argc, char *argv[]) ++int main(int argc, char *argv[]) + { + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp + 6: 83 ec 10 sub $0x10,%esp + printf(1, "usertests starting\n"); +- 9: c7 44 24 04 36 53 00 movl $0x5336,0x4(%esp) ++ 9: c7 44 24 04 06 54 00 movl $0x5406,0x4(%esp) + 10: 00 + 11: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 18: e8 c3 3f 00 00 call 3fe0 ++ 18: e8 93 40 00 00 call 40b0 + +- if(open("usertests.ran", 0) >= 0){ ++ if (open("usertests.ran", 0) >= 0) + 1d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 24: 00 +- 25: c7 04 24 4a 53 00 00 movl $0x534a,(%esp) +- 2c: e8 a1 3e 00 00 call 3ed2 ++ 25: c7 04 24 1a 54 00 00 movl $0x541a,(%esp) ++ 2c: e8 71 3f 00 00 call 3fa2 + 31: 85 c0 test %eax,%eax + 33: 78 20 js 55 ++ { + printf(1, "already ran user tests -- rebuild fs.img\n"); +- 35: c7 44 24 04 b4 5a 00 movl $0x5ab4,0x4(%esp) ++ 35: c7 44 24 04 84 5b 00 movl $0x5b84,0x4(%esp) + 3c: 00 + 3d: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 44: e8 97 3f 00 00 call 3fe0 ++ 44: e8 67 40 00 00 call 40b0 + exit(0); + 49: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 50: e8 3d 3e 00 00 call 3e92 ++ 50: e8 0d 3f 00 00 call 3f62 + } + close(open("usertests.ran", O_CREATE)); + 55: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 5c: 00 +- 5d: c7 04 24 4a 53 00 00 movl $0x534a,(%esp) +- 64: e8 69 3e 00 00 call 3ed2 ++ 5d: c7 04 24 1a 54 00 00 movl $0x541a,(%esp) ++ 64: e8 39 3f 00 00 call 3fa2 + 69: 89 04 24 mov %eax,(%esp) +- 6c: e8 49 3e 00 00 call 3eba ++ 6c: e8 19 3f 00 00 call 3f8a + + argptest(); +- 71: e8 4a 3b 00 00 call 3bc0 ++ 71: e8 1a 3c 00 00 call 3c90 + createdelete(); +- 76: e8 05 12 00 00 call 1280 ++ 76: e8 55 12 00 00 call 12d0 + 7b: 90 nop + 7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + linkunlink(); +- 80: e8 3b 1c 00 00 call 1cc0 ++ 80: e8 ab 1c 00 00 call 1d30 + concreate(); +- 85: e8 f6 18 00 00 call 1980 ++ 85: e8 56 19 00 00 call 19e0 + fourfiles(); +- 8a: e8 b1 0f 00 00 call 1040 ++ 8a: e8 e1 0f 00 00 call 1070 + 8f: 90 nop + sharedfd(); +- 90: e8 bb 0d 00 00 call e50 ++ 90: e8 eb 0d 00 00 call e80 + + bigargtest(); +- 95: e8 86 37 00 00 call 3820 ++ 95: e8 36 38 00 00 call 38d0 + bigwrite(); +- 9a: e8 21 27 00 00 call 27c0 ++ 9a: e8 91 27 00 00 call 2830 + 9f: 90 nop + bigargtest(); +- a0: e8 7b 37 00 00 call 3820 ++ a0: e8 2b 38 00 00 call 38d0 + bsstest(); +- a5: e8 f6 36 00 00 call 37a0 ++ a5: e8 a6 37 00 00 call 3850 + sbrktest(); +- aa: e8 31 32 00 00 call 32e0 ++ aa: e8 b1 32 00 00 call 3360 + af: 90 nop + validatetest(); +- b0: e8 3b 36 00 00 call 36f0 ++ b0: e8 db 36 00 00 call 3790 + + opentest(); +- b5: e8 e6 02 00 00 call 3a0 ++ b5: e8 06 03 00 00 call 3c0 + writetest(); +- ba: e8 81 03 00 00 call 440 ++ ba: e8 a1 03 00 00 call 460 + bf: 90 nop + writetest1(); +- c0: e8 4b 05 00 00 call 610 ++ c0: e8 6b 05 00 00 call 630 + createtest(); +- c5: e8 06 07 00 00 call 7d0 ++ c5: e8 26 07 00 00 call 7f0 + + openiputtest(); +- ca: e8 01 02 00 00 call 2d0 ++ ca: e8 11 02 00 00 call 2e0 + cf: 90 nop + exitiputtest(); + d0: e8 2b 01 00 00 call 200 +@@ -95,49 +96,50 @@ main(int argc, char *argv[]) + d5: e8 66 00 00 00 call 140 + + mem(); +- da: e8 91 0c 00 00 call d70 ++ da: e8 c1 0c 00 00 call da0 + df: 90 nop + pipe1(); +- e0: e8 bb 08 00 00 call 9a0 ++ e0: e8 db 08 00 00 call 9c0 + preempt(); +- e5: e8 96 0a 00 00 call b80 ++ e5: e8 b6 0a 00 00 call ba0 + exitwait(); +- ea: e8 f1 0b 00 00 call ce0 ++ ea: e8 21 0c 00 00 call d10 + ef: 90 nop ++ ; + + rmdot(); +- f0: e8 8b 2b 00 00 call 2c80 ++ f0: e8 fb 2b 00 00 call 2cf0 + fourteen(); +- f5: e8 06 2a 00 00 call 2b00 ++ f5: e8 76 2a 00 00 call 2b70 + bigfile(); +- fa: e8 d1 27 00 00 call 28d0 ++ fa: e8 41 28 00 00 call 2940 + ff: 90 nop + subdir(); +- 100: e8 3b 1e 00 00 call 1f40 ++ 100: e8 ab 1e 00 00 call 1fb0 + linktest(); +- 105: e8 d6 15 00 00 call 16e0 ++ 105: e8 36 16 00 00 call 1740 + unlinkread(); +- 10a: e8 d1 13 00 00 call 14e0 ++ 10a: e8 31 14 00 00 call 1540 + 10f: 90 nop + dirfile(); +- 110: e8 3b 2d 00 00 call 2e50 ++ 110: e8 ab 2d 00 00 call 2ec0 + iref(); +- 115: e8 b6 2f 00 00 call 30d0 ++ 115: e8 26 30 00 00 call 3140 + forktest(); +- 11a: e8 e1 30 00 00 call 3200 ++ 11a: e8 51 31 00 00 call 3270 + 11f: 90 nop + bigdir(); // slow +- 120: e8 bb 1c 00 00 call 1de0 ++ 120: e8 2b 1d 00 00 call 1e50 + + uio(); +- 125: e8 06 3a 00 00 call 3b30 ++ 125: e8 c6 3a 00 00 call 3bf0 + + exectest(); +- 12a: e8 11 08 00 00 call 940 ++ 12a: e8 31 08 00 00 call 960 + + exit(0); + 12f: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 136: e8 57 3d 00 00 call 3e92 ++ 136: e8 27 3e 00 00 call 3f62 + 13b: 66 90 xchg %ax,%ax + 13d: 66 90 xchg %ax,%ax + 13f: 90 nop +@@ -148,60 +150,60 @@ main(int argc, char *argv[]) + 141: 89 e5 mov %esp,%ebp + 143: 83 ec 18 sub $0x18,%esp + printf(stdout, "iput test\n"); +- 146: a1 c4 63 00 00 mov 0x63c4,%eax +- 14b: c7 44 24 04 dc 43 00 movl $0x43dc,0x4(%esp) ++ 146: a1 94 64 00 00 mov 0x6494,%eax ++ 14b: c7 44 24 04 ac 44 00 movl $0x44ac,0x4(%esp) + 152: 00 + 153: 89 04 24 mov %eax,(%esp) +- 156: e8 85 3e 00 00 call 3fe0 +- if(mkdir("iputdir") < 0){ +- 15b: c7 04 24 6f 43 00 00 movl $0x436f,(%esp) +- 162: e8 93 3d 00 00 call 3efa ++ 156: e8 55 3f 00 00 call 40b0 ++ if (mkdir("iputdir") < 0) ++ 15b: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) ++ 162: e8 63 3e 00 00 call 3fca + 167: 85 c0 test %eax,%eax + 169: 78 47 js 1b2 +- if(chdir("iputdir") < 0){ +- 16b: c7 04 24 6f 43 00 00 movl $0x436f,(%esp) +- 172: e8 8b 3d 00 00 call 3f02 ++ if (chdir("iputdir") < 0) ++ 16b: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) ++ 172: e8 5b 3e 00 00 call 3fd2 + 177: 85 c0 test %eax,%eax + 179: 78 6c js 1e7 +- if(unlink("../iputdir") < 0){ +- 17b: c7 04 24 6c 43 00 00 movl $0x436c,(%esp) +- 182: e8 5b 3d 00 00 call 3ee2 ++ if (unlink("../iputdir") < 0) ++ 17b: c7 04 24 3c 44 00 00 movl $0x443c,(%esp) ++ 182: e8 2b 3e 00 00 call 3fb2 + 187: 85 c0 test %eax,%eax + 189: 78 52 js 1dd +- if(chdir("/") < 0){ +- 18b: c7 04 24 91 43 00 00 movl $0x4391,(%esp) +- 192: e8 6b 3d 00 00 call 3f02 ++ if (chdir("/") < 0) ++ 18b: c7 04 24 61 44 00 00 movl $0x4461,(%esp) ++ 192: e8 3b 3e 00 00 call 3fd2 + 197: 85 c0 test %eax,%eax + 199: 78 38 js 1d3 + printf(stdout, "iput test ok\n"); +- 19b: a1 c4 63 00 00 mov 0x63c4,%eax +- 1a0: c7 44 24 04 14 44 00 movl $0x4414,0x4(%esp) ++ 19b: a1 94 64 00 00 mov 0x6494,%eax ++ 1a0: c7 44 24 04 e4 44 00 movl $0x44e4,0x4(%esp) + 1a7: 00 + 1a8: 89 04 24 mov %eax,(%esp) +- 1ab: e8 30 3e 00 00 call 3fe0 ++ 1ab: e8 00 3f 00 00 call 40b0 + } + 1b0: c9 leave + 1b1: c3 ret + printf(stdout, "mkdir failed\n"); +- 1b2: c7 44 24 04 48 43 00 movl $0x4348,0x4(%esp) ++ 1b2: c7 44 24 04 18 44 00 movl $0x4418,0x4(%esp) + 1b9: 00 + printf(stdout, "chdir iputdir failed\n"); +- 1ba: a1 c4 63 00 00 mov 0x63c4,%eax ++ 1ba: a1 94 64 00 00 mov 0x6494,%eax + 1bf: 89 04 24 mov %eax,(%esp) +- 1c2: e8 19 3e 00 00 call 3fe0 ++ 1c2: e8 e9 3e 00 00 call 40b0 + exit(0); + 1c7: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1ce: e8 bf 3c 00 00 call 3e92 ++ 1ce: e8 8f 3d 00 00 call 3f62 + printf(stdout, "chdir / failed\n"); +- 1d3: c7 44 24 04 93 43 00 movl $0x4393,0x4(%esp) ++ 1d3: c7 44 24 04 63 44 00 movl $0x4463,0x4(%esp) + 1da: 00 + 1db: eb dd jmp 1ba + printf(stdout, "unlink ../iputdir failed\n"); +- 1dd: c7 44 24 04 77 43 00 movl $0x4377,0x4(%esp) ++ 1dd: c7 44 24 04 47 44 00 movl $0x4447,0x4(%esp) + 1e4: 00 + 1e5: eb d3 jmp 1ba + printf(stdout, "chdir iputdir failed\n"); +- 1e7: c7 44 24 04 56 43 00 movl $0x4356,0x4(%esp) ++ 1e7: c7 44 24 04 26 44 00 movl $0x4426,0x4(%esp) + 1ee: 00 + 1ef: eb c9 jmp 1ba + 1f1: eb 0d jmp 200 +@@ -225,1315 +227,1287 @@ main(int argc, char *argv[]) + 201: 89 e5 mov %esp,%ebp + 203: 83 ec 18 sub $0x18,%esp + printf(stdout, "exitiput test\n"); +- 206: a1 c4 63 00 00 mov 0x63c4,%eax +- 20b: c7 44 24 04 a3 43 00 movl $0x43a3,0x4(%esp) ++ 206: a1 94 64 00 00 mov 0x6494,%eax ++ 20b: c7 44 24 04 73 44 00 movl $0x4473,0x4(%esp) + 212: 00 + 213: 89 04 24 mov %eax,(%esp) +- 216: e8 c5 3d 00 00 call 3fe0 ++ 216: e8 95 3e 00 00 call 40b0 + pid = fork(); +- 21b: e8 6a 3c 00 00 call 3e8a +- if(pid < 0){ ++ 21b: e8 3a 3d 00 00 call 3f5a ++ if (pid < 0) + 220: 85 c0 test %eax,%eax +- 222: 0f 88 89 00 00 00 js 2b1 +- if(pid == 0){ ++ 222: 0f 88 91 00 00 00 js 2b9 ++ if (pid == 0) + 228: 75 46 jne 270 +- if(mkdir("iputdir") < 0){ +- 22a: c7 04 24 6f 43 00 00 movl $0x436f,(%esp) +- 231: e8 c4 3c 00 00 call 3efa ++ if (mkdir("iputdir") < 0) ++ 22a: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) ++ 231: e8 94 3d 00 00 call 3fca + 236: 85 c0 test %eax,%eax +- 238: 0f 88 87 00 00 00 js 2c5 +- if(chdir("iputdir") < 0){ +- 23e: c7 04 24 6f 43 00 00 movl $0x436f,(%esp) +- 245: e8 b8 3c 00 00 call 3f02 ++ 238: 0f 88 8f 00 00 00 js 2cd ++ if (chdir("iputdir") < 0) ++ 23e: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) ++ 245: e8 88 3d 00 00 call 3fd2 + 24a: 85 c0 test %eax,%eax +- 24c: 78 6d js 2bb +- if(unlink("../iputdir") < 0){ +- 24e: c7 04 24 6c 43 00 00 movl $0x436c,(%esp) +- 255: e8 88 3c 00 00 call 3ee2 ++ 24c: 78 75 js 2c3 ++ if (unlink("../iputdir") < 0) ++ 24e: c7 04 24 3c 44 00 00 movl $0x443c,(%esp) ++ 255: e8 58 3d 00 00 call 3fb2 + 25a: 85 c0 test %eax,%eax +- 25c: 78 32 js 290 ++ 25c: 78 3a js 298 + exit(0); + 25e: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 265: e8 28 3c 00 00 call 3e92 ++ 265: e8 f8 3c 00 00 call 3f62 + 26a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- wait(); +- 270: e8 25 3c 00 00 call 3e9a ++ wait(0); ++ 270: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 277: e8 ee 3c 00 00 call 3f6a + printf(stdout, "exitiput test ok\n"); +- 275: a1 c4 63 00 00 mov 0x63c4,%eax +- 27a: c7 44 24 04 c6 43 00 movl $0x43c6,0x4(%esp) +- 281: 00 +- 282: 89 04 24 mov %eax,(%esp) +- 285: e8 56 3d 00 00 call 3fe0 ++ 27c: a1 94 64 00 00 mov 0x6494,%eax ++ 281: c7 44 24 04 96 44 00 movl $0x4496,0x4(%esp) ++ 288: 00 ++ 289: 89 04 24 mov %eax,(%esp) ++ 28c: e8 1f 3e 00 00 call 40b0 + } +- 28a: c9 leave +- 28b: c3 ret +- 28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 291: c9 leave ++ 292: c3 ret ++ 293: 90 nop ++ 294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(stdout, "unlink ../iputdir failed\n"); +- 290: c7 44 24 04 77 43 00 movl $0x4377,0x4(%esp) +- 297: 00 ++ 298: c7 44 24 04 47 44 00 movl $0x4447,0x4(%esp) ++ 29f: 00 + printf(stdout, "mkdir failed\n"); +- 298: a1 c4 63 00 00 mov 0x63c4,%eax +- 29d: 89 04 24 mov %eax,(%esp) +- 2a0: e8 3b 3d 00 00 call 3fe0 ++ 2a0: a1 94 64 00 00 mov 0x6494,%eax ++ 2a5: 89 04 24 mov %eax,(%esp) ++ 2a8: e8 03 3e 00 00 call 40b0 + exit(0); +- 2a5: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2ac: e8 e1 3b 00 00 call 3e92 ++ 2ad: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2b4: e8 a9 3c 00 00 call 3f62 + printf(stdout, "fork failed\n"); +- 2b1: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 2b8: 00 +- 2b9: eb dd jmp 298 ++ 2b9: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 2c0: 00 ++ 2c1: eb dd jmp 2a0 + printf(stdout, "child chdir failed\n"); +- 2bb: c7 44 24 04 b2 43 00 movl $0x43b2,0x4(%esp) +- 2c2: 00 +- 2c3: eb d3 jmp 298 ++ 2c3: c7 44 24 04 82 44 00 movl $0x4482,0x4(%esp) ++ 2ca: 00 ++ 2cb: eb d3 jmp 2a0 + printf(stdout, "mkdir failed\n"); +- 2c5: c7 44 24 04 48 43 00 movl $0x4348,0x4(%esp) +- 2cc: 00 +- 2cd: eb c9 jmp 298 +- 2cf: 90 nop ++ 2cd: c7 44 24 04 18 44 00 movl $0x4418,0x4(%esp) ++ 2d4: 00 ++ 2d5: eb c9 jmp 2a0 ++ 2d7: 89 f6 mov %esi,%esi ++ 2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000002d0 : ++000002e0 : + { +- 2d0: 55 push %ebp +- 2d1: 89 e5 mov %esp,%ebp +- 2d3: 83 ec 18 sub $0x18,%esp ++ 2e0: 55 push %ebp ++ 2e1: 89 e5 mov %esp,%ebp ++ 2e3: 83 ec 18 sub $0x18,%esp + printf(stdout, "openiput test\n"); +- 2d6: a1 c4 63 00 00 mov 0x63c4,%eax +- 2db: c7 44 24 04 d8 43 00 movl $0x43d8,0x4(%esp) +- 2e2: 00 +- 2e3: 89 04 24 mov %eax,(%esp) +- 2e6: e8 f5 3c 00 00 call 3fe0 +- if(mkdir("oidir") < 0){ +- 2eb: c7 04 24 e7 43 00 00 movl $0x43e7,(%esp) +- 2f2: e8 03 3c 00 00 call 3efa +- 2f7: 85 c0 test %eax,%eax +- 2f9: 0f 88 8b 00 00 00 js 38a ++ 2e6: a1 94 64 00 00 mov 0x6494,%eax ++ 2eb: c7 44 24 04 a8 44 00 movl $0x44a8,0x4(%esp) ++ 2f2: 00 ++ 2f3: 89 04 24 mov %eax,(%esp) ++ 2f6: e8 b5 3d 00 00 call 40b0 ++ if (mkdir("oidir") < 0) ++ 2fb: c7 04 24 b7 44 00 00 movl $0x44b7,(%esp) ++ 302: e8 c3 3c 00 00 call 3fca ++ 307: 85 c0 test %eax,%eax ++ 309: 0f 88 92 00 00 00 js 3a1 + pid = fork(); +- 2ff: e8 86 3b 00 00 call 3e8a +- if(pid < 0){ +- 304: 85 c0 test %eax,%eax +- 306: 78 78 js 380 +- if(pid == 0){ +- 308: 75 3e jne 348 ++ 30f: e8 46 3c 00 00 call 3f5a ++ if (pid < 0) ++ 314: 85 c0 test %eax,%eax ++ 316: 78 7f js 397 ++ if (pid == 0) ++ 318: 75 3e jne 358 + int fd = open("oidir", O_RDWR); +- 30a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) +- 311: 00 +- 312: c7 04 24 e7 43 00 00 movl $0x43e7,(%esp) +- 319: e8 b4 3b 00 00 call 3ed2 +- if(fd >= 0){ +- 31e: 85 c0 test %eax,%eax +- 320: 78 15 js 337 ++ 31a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) ++ 321: 00 ++ 322: c7 04 24 b7 44 00 00 movl $0x44b7,(%esp) ++ 329: e8 74 3c 00 00 call 3fa2 ++ if (fd >= 0) ++ 32e: 85 c0 test %eax,%eax ++ 330: 78 15 js 347 + printf(stdout, "open directory for write succeeded\n"); +- 322: c7 44 24 04 6c 53 00 movl $0x536c,0x4(%esp) +- 329: 00 ++ 332: c7 44 24 04 3c 54 00 movl $0x543c,0x4(%esp) ++ 339: 00 + printf(stdout, "fork failed\n"); +- 32a: a1 c4 63 00 00 mov 0x63c4,%eax +- 32f: 89 04 24 mov %eax,(%esp) +- 332: e8 a9 3c 00 00 call 3fe0 ++ 33a: a1 94 64 00 00 mov 0x6494,%eax ++ 33f: 89 04 24 mov %eax,(%esp) ++ 342: e8 69 3d 00 00 call 40b0 + exit(0); +- 337: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 33e: e8 4f 3b 00 00 call 3e92 +- 343: 90 nop +- 344: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 347: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 34e: e8 0f 3c 00 00 call 3f62 ++ 353: 90 nop ++ 354: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + sleep(1); +- 348: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 34f: e8 ce 3b 00 00 call 3f22 +- if(unlink("oidir") != 0){ +- 354: c7 04 24 e7 43 00 00 movl $0x43e7,(%esp) +- 35b: e8 82 3b 00 00 call 3ee2 +- 360: 85 c0 test %eax,%eax +- 362: 75 30 jne 394 +- wait(); +- 364: e8 31 3b 00 00 call 3e9a ++ 358: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 35f: e8 8e 3c 00 00 call 3ff2 ++ if (unlink("oidir") != 0) ++ 364: c7 04 24 b7 44 00 00 movl $0x44b7,(%esp) ++ 36b: e8 42 3c 00 00 call 3fb2 ++ 370: 85 c0 test %eax,%eax ++ 372: 75 37 jne 3ab ++ wait(0); ++ 374: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 37b: e8 ea 3b 00 00 call 3f6a + printf(stdout, "openiput test ok\n"); +- 369: a1 c4 63 00 00 mov 0x63c4,%eax +- 36e: c7 44 24 04 10 44 00 movl $0x4410,0x4(%esp) +- 375: 00 +- 376: 89 04 24 mov %eax,(%esp) +- 379: e8 62 3c 00 00 call 3fe0 ++ 380: a1 94 64 00 00 mov 0x6494,%eax ++ 385: c7 44 24 04 e0 44 00 movl $0x44e0,0x4(%esp) ++ 38c: 00 ++ 38d: 89 04 24 mov %eax,(%esp) ++ 390: e8 1b 3d 00 00 call 40b0 + } +- 37e: c9 leave +- 37f: c3 ret ++ 395: c9 leave ++ 396: c3 ret + printf(stdout, "fork failed\n"); +- 380: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 387: 00 +- 388: eb a0 jmp 32a ++ 397: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 39e: 00 ++ 39f: eb 99 jmp 33a + printf(stdout, "mkdir oidir failed\n"); +- 38a: c7 44 24 04 ed 43 00 movl $0x43ed,0x4(%esp) +- 391: 00 +- 392: eb 96 jmp 32a ++ 3a1: c7 44 24 04 bd 44 00 movl $0x44bd,0x4(%esp) ++ 3a8: 00 ++ 3a9: eb 8f jmp 33a + printf(stdout, "unlink failed\n"); +- 394: c7 44 24 04 01 44 00 movl $0x4401,0x4(%esp) +- 39b: 00 +- 39c: eb 8c jmp 32a +- 39e: 66 90 xchg %ax,%ax ++ 3ab: c7 44 24 04 d1 44 00 movl $0x44d1,0x4(%esp) ++ 3b2: 00 ++ 3b3: eb 85 jmp 33a ++ 3b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000003a0 : ++000003c0 : + { +- 3a0: 55 push %ebp +- 3a1: 89 e5 mov %esp,%ebp +- 3a3: 83 ec 18 sub $0x18,%esp ++ 3c0: 55 push %ebp ++ 3c1: 89 e5 mov %esp,%ebp ++ 3c3: 83 ec 18 sub $0x18,%esp + printf(stdout, "open test\n"); +- 3a6: a1 c4 63 00 00 mov 0x63c4,%eax +- 3ab: c7 44 24 04 22 44 00 movl $0x4422,0x4(%esp) +- 3b2: 00 +- 3b3: 89 04 24 mov %eax,(%esp) +- 3b6: e8 25 3c 00 00 call 3fe0 +- fd = open("echo", 0); +- 3bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 3c2: 00 +- 3c3: c7 04 24 2d 44 00 00 movl $0x442d,(%esp) +- 3ca: e8 03 3b 00 00 call 3ed2 +- if(fd < 0){ +- 3cf: 85 c0 test %eax,%eax +- 3d1: 78 37 js 40a +- close(fd); ++ 3c6: a1 94 64 00 00 mov 0x6494,%eax ++ 3cb: c7 44 24 04 f2 44 00 movl $0x44f2,0x4(%esp) ++ 3d2: 00 + 3d3: 89 04 24 mov %eax,(%esp) +- 3d6: e8 df 3a 00 00 call 3eba +- fd = open("doesnotexist", 0); ++ 3d6: e8 d5 3c 00 00 call 40b0 ++ fd = open("echo", 0); + 3db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3e2: 00 +- 3e3: c7 04 24 45 44 00 00 movl $0x4445,(%esp) +- 3ea: e8 e3 3a 00 00 call 3ed2 +- if(fd >= 0){ ++ 3e3: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) ++ 3ea: e8 b3 3b 00 00 call 3fa2 ++ if (fd < 0) + 3ef: 85 c0 test %eax,%eax +- 3f1: 79 38 jns 42b ++ 3f1: 78 37 js 42a ++ close(fd); ++ 3f3: 89 04 24 mov %eax,(%esp) ++ 3f6: e8 8f 3b 00 00 call 3f8a ++ fd = open("doesnotexist", 0); ++ 3fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 402: 00 ++ 403: c7 04 24 15 45 00 00 movl $0x4515,(%esp) ++ 40a: e8 93 3b 00 00 call 3fa2 ++ if (fd >= 0) ++ 40f: 85 c0 test %eax,%eax ++ 411: 79 38 jns 44b + printf(stdout, "open test ok\n"); +- 3f3: a1 c4 63 00 00 mov 0x63c4,%eax +- 3f8: c7 44 24 04 70 44 00 movl $0x4470,0x4(%esp) +- 3ff: 00 +- 400: 89 04 24 mov %eax,(%esp) +- 403: e8 d8 3b 00 00 call 3fe0 ++ 413: a1 94 64 00 00 mov 0x6494,%eax ++ 418: c7 44 24 04 40 45 00 movl $0x4540,0x4(%esp) ++ 41f: 00 ++ 420: 89 04 24 mov %eax,(%esp) ++ 423: e8 88 3c 00 00 call 40b0 + } +- 408: c9 leave +- 409: c3 ret ++ 428: c9 leave ++ 429: c3 ret + printf(stdout, "open echo failed!\n"); +- 40a: c7 44 24 04 32 44 00 movl $0x4432,0x4(%esp) +- 411: 00 ++ 42a: c7 44 24 04 02 45 00 movl $0x4502,0x4(%esp) ++ 431: 00 + printf(stdout, "open doesnotexist succeeded!\n"); +- 412: a1 c4 63 00 00 mov 0x63c4,%eax +- 417: 89 04 24 mov %eax,(%esp) +- 41a: e8 c1 3b 00 00 call 3fe0 ++ 432: a1 94 64 00 00 mov 0x6494,%eax ++ 437: 89 04 24 mov %eax,(%esp) ++ 43a: e8 71 3c 00 00 call 40b0 + exit(0); +- 41f: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 426: e8 67 3a 00 00 call 3e92 ++ 43f: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 446: e8 17 3b 00 00 call 3f62 + printf(stdout, "open doesnotexist succeeded!\n"); +- 42b: c7 44 24 04 52 44 00 movl $0x4452,0x4(%esp) +- 432: 00 +- 433: eb dd jmp 412 +- 435: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 44b: c7 44 24 04 22 45 00 movl $0x4522,0x4(%esp) ++ 452: 00 ++ 453: eb dd jmp 432 ++ 455: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 459: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000440 : ++00000460 : + { +- 440: 55 push %ebp +- 441: 89 e5 mov %esp,%ebp +- 443: 56 push %esi +- 444: 53 push %ebx +- 445: 83 ec 10 sub $0x10,%esp ++ 460: 55 push %ebp ++ 461: 89 e5 mov %esp,%ebp ++ 463: 56 push %esi ++ 464: 53 push %ebx ++ 465: 83 ec 10 sub $0x10,%esp + printf(stdout, "small file test\n"); +- 448: a1 c4 63 00 00 mov 0x63c4,%eax +- 44d: c7 44 24 04 7e 44 00 movl $0x447e,0x4(%esp) +- 454: 00 +- 455: 89 04 24 mov %eax,(%esp) +- 458: e8 83 3b 00 00 call 3fe0 +- fd = open("small", O_CREATE|O_RDWR); +- 45d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 464: 00 +- 465: c7 04 24 8f 44 00 00 movl $0x448f,(%esp) +- 46c: e8 61 3a 00 00 call 3ed2 +- if(fd >= 0){ +- 471: 85 c0 test %eax,%eax +- fd = open("small", O_CREATE|O_RDWR); +- 473: 89 c6 mov %eax,%esi +- if(fd >= 0){ +- 475: 0f 88 8b 01 00 00 js 606 ++ 468: a1 94 64 00 00 mov 0x6494,%eax ++ 46d: c7 44 24 04 4e 45 00 movl $0x454e,0x4(%esp) ++ 474: 00 ++ 475: 89 04 24 mov %eax,(%esp) ++ 478: e8 33 3c 00 00 call 40b0 ++ fd = open("small", O_CREATE | O_RDWR); ++ 47d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 484: 00 ++ 485: c7 04 24 5f 45 00 00 movl $0x455f,(%esp) ++ 48c: e8 11 3b 00 00 call 3fa2 ++ if (fd >= 0) ++ 491: 85 c0 test %eax,%eax ++ fd = open("small", O_CREATE | O_RDWR); ++ 493: 89 c6 mov %eax,%esi ++ if (fd >= 0) ++ 495: 0f 88 8b 01 00 00 js 626 + printf(stdout, "creat small succeeded; ok\n"); +- 47b: a1 c4 63 00 00 mov 0x63c4,%eax +- for(i = 0; i < 100; i++){ +- 480: 31 db xor %ebx,%ebx ++ 49b: a1 94 64 00 00 mov 0x6494,%eax ++ for (i = 0; i < 100; i++) ++ 4a0: 31 db xor %ebx,%ebx + printf(stdout, "creat small succeeded; ok\n"); +- 482: c7 44 24 04 95 44 00 movl $0x4495,0x4(%esp) +- 489: 00 +- 48a: 89 04 24 mov %eax,(%esp) +- 48d: e8 4e 3b 00 00 call 3fe0 +- 492: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- if(write(fd, "aaaaaaaaaa", 10) != 10){ +- 498: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) +- 49f: 00 +- 4a0: c7 44 24 04 cc 44 00 movl $0x44cc,0x4(%esp) +- 4a7: 00 +- 4a8: 89 34 24 mov %esi,(%esp) +- 4ab: e8 02 3a 00 00 call 3eb2 +- 4b0: 83 f8 0a cmp $0xa,%eax +- 4b3: 0f 85 e5 00 00 00 jne 59e +- if(write(fd, "bbbbbbbbbb", 10) != 10){ +- 4b9: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) +- 4c0: 00 +- 4c1: c7 44 24 04 d7 44 00 movl $0x44d7,0x4(%esp) +- 4c8: 00 +- 4c9: 89 34 24 mov %esi,(%esp) +- 4cc: e8 e1 39 00 00 call 3eb2 +- 4d1: 83 f8 0a cmp $0xa,%eax +- 4d4: 0f 85 e9 00 00 00 jne 5c3 +- for(i = 0; i < 100; i++){ +- 4da: 83 c3 01 add $0x1,%ebx +- 4dd: 83 fb 64 cmp $0x64,%ebx +- 4e0: 75 b6 jne 498 ++ 4a2: c7 44 24 04 65 45 00 movl $0x4565,0x4(%esp) ++ 4a9: 00 ++ 4aa: 89 04 24 mov %eax,(%esp) ++ 4ad: e8 fe 3b 00 00 call 40b0 ++ 4b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ if (write(fd, "aaaaaaaaaa", 10) != 10) ++ 4b8: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) ++ 4bf: 00 ++ 4c0: c7 44 24 04 9c 45 00 movl $0x459c,0x4(%esp) ++ 4c7: 00 ++ 4c8: 89 34 24 mov %esi,(%esp) ++ 4cb: e8 b2 3a 00 00 call 3f82 ++ 4d0: 83 f8 0a cmp $0xa,%eax ++ 4d3: 0f 85 e5 00 00 00 jne 5be ++ if (write(fd, "bbbbbbbbbb", 10) != 10) ++ 4d9: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) ++ 4e0: 00 ++ 4e1: c7 44 24 04 a7 45 00 movl $0x45a7,0x4(%esp) ++ 4e8: 00 ++ 4e9: 89 34 24 mov %esi,(%esp) ++ 4ec: e8 91 3a 00 00 call 3f82 ++ 4f1: 83 f8 0a cmp $0xa,%eax ++ 4f4: 0f 85 e9 00 00 00 jne 5e3 ++ for (i = 0; i < 100; i++) ++ 4fa: 83 c3 01 add $0x1,%ebx ++ 4fd: 83 fb 64 cmp $0x64,%ebx ++ 500: 75 b6 jne 4b8 + printf(stdout, "writes ok\n"); +- 4e2: a1 c4 63 00 00 mov 0x63c4,%eax +- 4e7: c7 44 24 04 e2 44 00 movl $0x44e2,0x4(%esp) +- 4ee: 00 +- 4ef: 89 04 24 mov %eax,(%esp) +- 4f2: e8 e9 3a 00 00 call 3fe0 ++ 502: a1 94 64 00 00 mov 0x6494,%eax ++ 507: c7 44 24 04 b2 45 00 movl $0x45b2,0x4(%esp) ++ 50e: 00 ++ 50f: 89 04 24 mov %eax,(%esp) ++ 512: e8 99 3b 00 00 call 40b0 + close(fd); +- 4f7: 89 34 24 mov %esi,(%esp) +- 4fa: e8 bb 39 00 00 call 3eba ++ 517: 89 34 24 mov %esi,(%esp) ++ 51a: e8 6b 3a 00 00 call 3f8a + fd = open("small", O_RDONLY); +- 4ff: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 506: 00 +- 507: c7 04 24 8f 44 00 00 movl $0x448f,(%esp) +- 50e: e8 bf 39 00 00 call 3ed2 +- if(fd >= 0){ +- 513: 85 c0 test %eax,%eax ++ 51f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 526: 00 ++ 527: c7 04 24 5f 45 00 00 movl $0x455f,(%esp) ++ 52e: e8 6f 3a 00 00 call 3fa2 ++ if (fd >= 0) ++ 533: 85 c0 test %eax,%eax + fd = open("small", O_RDONLY); +- 515: 89 c3 mov %eax,%ebx +- if(fd >= 0){ +- 517: 0f 88 b4 00 00 00 js 5d1 ++ 535: 89 c3 mov %eax,%ebx ++ if (fd >= 0) ++ 537: 0f 88 b4 00 00 00 js 5f1 + printf(stdout, "open small succeeded ok\n"); +- 51d: a1 c4 63 00 00 mov 0x63c4,%eax +- 522: c7 44 24 04 ed 44 00 movl $0x44ed,0x4(%esp) +- 529: 00 +- 52a: 89 04 24 mov %eax,(%esp) +- 52d: e8 ae 3a 00 00 call 3fe0 ++ 53d: a1 94 64 00 00 mov 0x6494,%eax ++ 542: c7 44 24 04 bd 45 00 movl $0x45bd,0x4(%esp) ++ 549: 00 ++ 54a: 89 04 24 mov %eax,(%esp) ++ 54d: e8 5e 3b 00 00 call 40b0 + i = read(fd, buf, 2000); +- 532: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp) +- 539: 00 +- 53a: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 541: 00 +- 542: 89 1c 24 mov %ebx,(%esp) +- 545: e8 60 39 00 00 call 3eaa +- if(i == 2000){ +- 54a: 3d d0 07 00 00 cmp $0x7d0,%eax +- 54f: 0f 85 9d 00 00 00 jne 5f2 +- printf(stdout, "read succeeded ok\n"); +- 555: a1 c4 63 00 00 mov 0x63c4,%eax +- 55a: c7 44 24 04 21 45 00 movl $0x4521,0x4(%esp) ++ 552: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp) ++ 559: 00 ++ 55a: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 561: 00 +- 562: 89 04 24 mov %eax,(%esp) +- 565: e8 76 3a 00 00 call 3fe0 ++ 562: 89 1c 24 mov %ebx,(%esp) ++ 565: e8 10 3a 00 00 call 3f7a ++ if (i == 2000) ++ 56a: 3d d0 07 00 00 cmp $0x7d0,%eax ++ 56f: 0f 85 9d 00 00 00 jne 612 ++ printf(stdout, "read succeeded ok\n"); ++ 575: a1 94 64 00 00 mov 0x6494,%eax ++ 57a: c7 44 24 04 f1 45 00 movl $0x45f1,0x4(%esp) ++ 581: 00 ++ 582: 89 04 24 mov %eax,(%esp) ++ 585: e8 26 3b 00 00 call 40b0 + close(fd); +- 56a: 89 1c 24 mov %ebx,(%esp) +- 56d: e8 48 39 00 00 call 3eba +- if(unlink("small") < 0){ +- 572: c7 04 24 8f 44 00 00 movl $0x448f,(%esp) +- 579: e8 64 39 00 00 call 3ee2 +- 57e: 85 c0 test %eax,%eax +- 580: 78 7a js 5fc ++ 58a: 89 1c 24 mov %ebx,(%esp) ++ 58d: e8 f8 39 00 00 call 3f8a ++ if (unlink("small") < 0) ++ 592: c7 04 24 5f 45 00 00 movl $0x455f,(%esp) ++ 599: e8 14 3a 00 00 call 3fb2 ++ 59e: 85 c0 test %eax,%eax ++ 5a0: 78 7a js 61c + printf(stdout, "small file test ok\n"); +- 582: a1 c4 63 00 00 mov 0x63c4,%eax +- 587: c7 44 24 04 49 45 00 movl $0x4549,0x4(%esp) +- 58e: 00 +- 58f: 89 04 24 mov %eax,(%esp) +- 592: e8 49 3a 00 00 call 3fe0 ++ 5a2: a1 94 64 00 00 mov 0x6494,%eax ++ 5a7: c7 44 24 04 19 46 00 movl $0x4619,0x4(%esp) ++ 5ae: 00 ++ 5af: 89 04 24 mov %eax,(%esp) ++ 5b2: e8 f9 3a 00 00 call 40b0 + } +- 597: 83 c4 10 add $0x10,%esp +- 59a: 5b pop %ebx +- 59b: 5e pop %esi +- 59c: 5d pop %ebp +- 59d: c3 ret ++ 5b7: 83 c4 10 add $0x10,%esp ++ 5ba: 5b pop %ebx ++ 5bb: 5e pop %esi ++ 5bc: 5d pop %ebp ++ 5bd: c3 ret + printf(stdout, "error: write aa %d new file failed\n", i); +- 59e: 89 5c 24 08 mov %ebx,0x8(%esp) +- 5a2: c7 44 24 04 90 53 00 movl $0x5390,0x4(%esp) +- 5a9: 00 ++ 5be: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 5c2: c7 44 24 04 60 54 00 movl $0x5460,0x4(%esp) ++ 5c9: 00 + printf(stdout, "error: write bb %d new file failed\n", i); +- 5aa: a1 c4 63 00 00 mov 0x63c4,%eax +- 5af: 89 04 24 mov %eax,(%esp) +- 5b2: e8 29 3a 00 00 call 3fe0 ++ 5ca: a1 94 64 00 00 mov 0x6494,%eax ++ 5cf: 89 04 24 mov %eax,(%esp) ++ 5d2: e8 d9 3a 00 00 call 40b0 + exit(0); +- 5b7: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 5be: e8 cf 38 00 00 call 3e92 ++ 5d7: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 5de: e8 7f 39 00 00 call 3f62 + printf(stdout, "error: write bb %d new file failed\n", i); +- 5c3: 89 5c 24 08 mov %ebx,0x8(%esp) +- 5c7: c7 44 24 04 b4 53 00 movl $0x53b4,0x4(%esp) +- 5ce: 00 +- 5cf: eb d9 jmp 5aa ++ 5e3: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 5e7: c7 44 24 04 84 54 00 movl $0x5484,0x4(%esp) ++ 5ee: 00 ++ 5ef: eb d9 jmp 5ca + printf(stdout, "error: open small failed!\n"); +- 5d1: c7 44 24 04 06 45 00 movl $0x4506,0x4(%esp) +- 5d8: 00 +- 5d9: a1 c4 63 00 00 mov 0x63c4,%eax +- 5de: 89 04 24 mov %eax,(%esp) +- 5e1: e8 fa 39 00 00 call 3fe0 ++ 5f1: c7 44 24 04 d6 45 00 movl $0x45d6,0x4(%esp) ++ 5f8: 00 ++ 5f9: a1 94 64 00 00 mov 0x6494,%eax ++ 5fe: 89 04 24 mov %eax,(%esp) ++ 601: e8 aa 3a 00 00 call 40b0 + exit(0); +- 5e6: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 5ed: e8 a0 38 00 00 call 3e92 ++ 606: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 60d: e8 50 39 00 00 call 3f62 + printf(stdout, "read failed\n"); +- 5f2: c7 44 24 04 4d 48 00 movl $0x484d,0x4(%esp) +- 5f9: 00 +- 5fa: eb dd jmp 5d9 ++ 612: c7 44 24 04 1d 49 00 movl $0x491d,0x4(%esp) ++ 619: 00 ++ 61a: eb dd jmp 5f9 + printf(stdout, "unlink small failed\n"); +- 5fc: c7 44 24 04 34 45 00 movl $0x4534,0x4(%esp) +- 603: 00 +- 604: eb d3 jmp 5d9 ++ 61c: c7 44 24 04 04 46 00 movl $0x4604,0x4(%esp) ++ 623: 00 ++ 624: eb d3 jmp 5f9 + printf(stdout, "error: creat small failed!\n"); +- 606: c7 44 24 04 b0 44 00 movl $0x44b0,0x4(%esp) +- 60d: 00 +- 60e: eb c9 jmp 5d9 ++ 626: c7 44 24 04 80 45 00 movl $0x4580,0x4(%esp) ++ 62d: 00 ++ 62e: eb c9 jmp 5f9 + +-00000610 : ++00000630 : + { +- 610: 55 push %ebp +- 611: 89 e5 mov %esp,%ebp +- 613: 56 push %esi +- 614: 53 push %ebx +- 615: 83 ec 10 sub $0x10,%esp ++ 630: 55 push %ebp ++ 631: 89 e5 mov %esp,%ebp ++ 633: 56 push %esi ++ 634: 53 push %ebx ++ 635: 83 ec 10 sub $0x10,%esp + printf(stdout, "big files test\n"); +- 618: a1 c4 63 00 00 mov 0x63c4,%eax +- 61d: c7 44 24 04 5d 45 00 movl $0x455d,0x4(%esp) +- 624: 00 +- 625: 89 04 24 mov %eax,(%esp) +- 628: e8 b3 39 00 00 call 3fe0 +- fd = open("big", O_CREATE|O_RDWR); +- 62d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 634: 00 +- 635: c7 04 24 d7 45 00 00 movl $0x45d7,(%esp) +- 63c: e8 91 38 00 00 call 3ed2 +- if(fd < 0){ +- 641: 85 c0 test %eax,%eax +- fd = open("big", O_CREATE|O_RDWR); +- 643: 89 c6 mov %eax,%esi +- if(fd < 0){ +- 645: 0f 88 6f 01 00 00 js 7ba +- 64b: 31 db xor %ebx,%ebx +- 64d: 8d 76 00 lea 0x0(%esi),%esi +- if(write(fd, buf, 512) != 512){ +- 650: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +- 657: 00 +- 658: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 65f: 00 +- 660: 89 34 24 mov %esi,(%esp) +- ((int*)buf)[0] = i; +- 663: 89 1d a0 8b 00 00 mov %ebx,0x8ba0 +- if(write(fd, buf, 512) != 512){ +- 669: e8 44 38 00 00 call 3eb2 +- 66e: 3d 00 02 00 00 cmp $0x200,%eax +- 673: 0f 85 b2 00 00 00 jne 72b +- for(i = 0; i < MAXFILE; i++){ +- 679: 83 c3 01 add $0x1,%ebx +- 67c: 81 fb 8c 00 00 00 cmp $0x8c,%ebx +- 682: 75 cc jne 650 ++ 638: a1 94 64 00 00 mov 0x6494,%eax ++ 63d: c7 44 24 04 2d 46 00 movl $0x462d,0x4(%esp) ++ 644: 00 ++ 645: 89 04 24 mov %eax,(%esp) ++ 648: e8 63 3a 00 00 call 40b0 ++ fd = open("big", O_CREATE | O_RDWR); ++ 64d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 654: 00 ++ 655: c7 04 24 a7 46 00 00 movl $0x46a7,(%esp) ++ 65c: e8 41 39 00 00 call 3fa2 ++ if (fd < 0) ++ 661: 85 c0 test %eax,%eax ++ fd = open("big", O_CREATE | O_RDWR); ++ 663: 89 c6 mov %eax,%esi ++ if (fd < 0) ++ 665: 0f 88 6f 01 00 00 js 7da ++ 66b: 31 db xor %ebx,%ebx ++ 66d: 8d 76 00 lea 0x0(%esi),%esi ++ if (write(fd, buf, 512) != 512) ++ 670: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) ++ 677: 00 ++ 678: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 67f: 00 ++ 680: 89 34 24 mov %esi,(%esp) ++ ((int *)buf)[0] = i; ++ 683: 89 1d 80 8c 00 00 mov %ebx,0x8c80 ++ if (write(fd, buf, 512) != 512) ++ 689: e8 f4 38 00 00 call 3f82 ++ 68e: 3d 00 02 00 00 cmp $0x200,%eax ++ 693: 0f 85 b2 00 00 00 jne 74b ++ for (i = 0; i < MAXFILE; i++) ++ 699: 83 c3 01 add $0x1,%ebx ++ 69c: 81 fb 8c 00 00 00 cmp $0x8c,%ebx ++ 6a2: 75 cc jne 670 + close(fd); +- 684: 89 34 24 mov %esi,(%esp) +- 687: e8 2e 38 00 00 call 3eba ++ 6a4: 89 34 24 mov %esi,(%esp) ++ 6a7: e8 de 38 00 00 call 3f8a + fd = open("big", O_RDONLY); +- 68c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 693: 00 +- 694: c7 04 24 d7 45 00 00 movl $0x45d7,(%esp) +- 69b: e8 32 38 00 00 call 3ed2 +- if(fd < 0){ +- 6a0: 85 c0 test %eax,%eax ++ 6ac: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 6b3: 00 ++ 6b4: c7 04 24 a7 46 00 00 movl $0x46a7,(%esp) ++ 6bb: e8 e2 38 00 00 call 3fa2 ++ if (fd < 0) ++ 6c0: 85 c0 test %eax,%eax + fd = open("big", O_RDONLY); +- 6a2: 89 c6 mov %eax,%esi +- if(fd < 0){ +- 6a4: 0f 88 ef 00 00 00 js 799 +- 6aa: 31 db xor %ebx,%ebx +- 6ac: eb 1d jmp 6cb +- 6ae: 66 90 xchg %ax,%ax +- } else if(i != 512){ +- 6b0: 3d 00 02 00 00 cmp $0x200,%eax +- 6b5: 0f 85 be 00 00 00 jne 779 +- if(((int*)buf)[0] != n){ +- 6bb: a1 a0 8b 00 00 mov 0x8ba0,%eax +- 6c0: 39 d8 cmp %ebx,%eax +- 6c2: 0f 85 88 00 00 00 jne 750 ++ 6c2: 89 c6 mov %eax,%esi ++ if (fd < 0) ++ 6c4: 0f 88 ef 00 00 00 js 7b9 ++ 6ca: 31 db xor %ebx,%ebx ++ 6cc: eb 1d jmp 6eb ++ 6ce: 66 90 xchg %ax,%ax ++ else if (i != 512) ++ 6d0: 3d 00 02 00 00 cmp $0x200,%eax ++ 6d5: 0f 85 be 00 00 00 jne 799 ++ if (((int *)buf)[0] != n) ++ 6db: a1 80 8c 00 00 mov 0x8c80,%eax ++ 6e0: 39 d8 cmp %ebx,%eax ++ 6e2: 0f 85 88 00 00 00 jne 770 + n++; +- 6c8: 83 c3 01 add $0x1,%ebx ++ 6e8: 83 c3 01 add $0x1,%ebx + i = read(fd, buf, 512); +- 6cb: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +- 6d2: 00 +- 6d3: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 6da: 00 +- 6db: 89 34 24 mov %esi,(%esp) +- 6de: e8 c7 37 00 00 call 3eaa +- if(i == 0){ +- 6e3: 85 c0 test %eax,%eax +- 6e5: 75 c9 jne 6b0 +- if(n == MAXFILE - 1){ +- 6e7: 81 fb 8b 00 00 00 cmp $0x8b,%ebx +- 6ed: 0f 84 94 00 00 00 je 787 ++ 6eb: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) ++ 6f2: 00 ++ 6f3: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 6fa: 00 ++ 6fb: 89 34 24 mov %esi,(%esp) ++ 6fe: e8 77 38 00 00 call 3f7a ++ if (i == 0) ++ 703: 85 c0 test %eax,%eax ++ 705: 75 c9 jne 6d0 ++ if (n == MAXFILE - 1) ++ 707: 81 fb 8b 00 00 00 cmp $0x8b,%ebx ++ 70d: 0f 84 94 00 00 00 je 7a7 + close(fd); +- 6f3: 89 34 24 mov %esi,(%esp) +- 6f6: e8 bf 37 00 00 call 3eba +- if(unlink("big") < 0){ +- 6fb: c7 04 24 d7 45 00 00 movl $0x45d7,(%esp) +- 702: e8 db 37 00 00 call 3ee2 +- 707: 85 c0 test %eax,%eax +- 709: 0f 88 b5 00 00 00 js 7c4 ++ 713: 89 34 24 mov %esi,(%esp) ++ 716: e8 6f 38 00 00 call 3f8a ++ if (unlink("big") < 0) ++ 71b: c7 04 24 a7 46 00 00 movl $0x46a7,(%esp) ++ 722: e8 8b 38 00 00 call 3fb2 ++ 727: 85 c0 test %eax,%eax ++ 729: 0f 88 b5 00 00 00 js 7e4 + printf(stdout, "big files ok\n"); +- 70f: a1 c4 63 00 00 mov 0x63c4,%eax +- 714: c7 44 24 04 fe 45 00 movl $0x45fe,0x4(%esp) +- 71b: 00 +- 71c: 89 04 24 mov %eax,(%esp) +- 71f: e8 bc 38 00 00 call 3fe0 ++ 72f: a1 94 64 00 00 mov 0x6494,%eax ++ 734: c7 44 24 04 ce 46 00 movl $0x46ce,0x4(%esp) ++ 73b: 00 ++ 73c: 89 04 24 mov %eax,(%esp) ++ 73f: e8 6c 39 00 00 call 40b0 + } +- 724: 83 c4 10 add $0x10,%esp +- 727: 5b pop %ebx +- 728: 5e pop %esi +- 729: 5d pop %ebp +- 72a: c3 ret ++ 744: 83 c4 10 add $0x10,%esp ++ 747: 5b pop %ebx ++ 748: 5e pop %esi ++ 749: 5d pop %ebp ++ 74a: c3 ret + printf(stdout, "error: write big file failed\n", i); +- 72b: 89 5c 24 08 mov %ebx,0x8(%esp) +- 72f: c7 44 24 04 87 45 00 movl $0x4587,0x4(%esp) +- 736: 00 ++ 74b: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 74f: c7 44 24 04 57 46 00 movl $0x4657,0x4(%esp) ++ 756: 00 + printf(stdout, "read only %d blocks from big", n); +- 737: a1 c4 63 00 00 mov 0x63c4,%eax +- 73c: 89 04 24 mov %eax,(%esp) +- 73f: e8 9c 38 00 00 call 3fe0 ++ 757: a1 94 64 00 00 mov 0x6494,%eax ++ 75c: 89 04 24 mov %eax,(%esp) ++ 75f: e8 4c 39 00 00 call 40b0 + exit(0); +- 744: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 74b: e8 42 37 00 00 call 3e92 ++ 764: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 76b: e8 f2 37 00 00 call 3f62 + printf(stdout, "read content of block %d is %d\n", +- 750: 89 44 24 0c mov %eax,0xc(%esp) +- 754: a1 c4 63 00 00 mov 0x63c4,%eax +- 759: 89 5c 24 08 mov %ebx,0x8(%esp) +- 75d: c7 44 24 04 d8 53 00 movl $0x53d8,0x4(%esp) +- 764: 00 +- 765: 89 04 24 mov %eax,(%esp) +- 768: e8 73 38 00 00 call 3fe0 ++ 770: 89 44 24 0c mov %eax,0xc(%esp) ++ 774: a1 94 64 00 00 mov 0x6494,%eax ++ 779: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 77d: c7 44 24 04 a8 54 00 movl $0x54a8,0x4(%esp) ++ 784: 00 ++ 785: 89 04 24 mov %eax,(%esp) ++ 788: e8 23 39 00 00 call 40b0 + exit(0); +- 76d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 774: e8 19 37 00 00 call 3e92 ++ 78d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 794: e8 c9 37 00 00 call 3f62 + printf(stdout, "read failed %d\n", i); +- 779: 89 44 24 08 mov %eax,0x8(%esp) +- 77d: c7 44 24 04 db 45 00 movl $0x45db,0x4(%esp) +- 784: 00 +- 785: eb b0 jmp 737 ++ 799: 89 44 24 08 mov %eax,0x8(%esp) ++ 79d: c7 44 24 04 ab 46 00 movl $0x46ab,0x4(%esp) ++ 7a4: 00 ++ 7a5: eb b0 jmp 757 + printf(stdout, "read only %d blocks from big", n); +- 787: c7 44 24 08 8b 00 00 movl $0x8b,0x8(%esp) +- 78e: 00 +- 78f: c7 44 24 04 be 45 00 movl $0x45be,0x4(%esp) +- 796: 00 +- 797: eb 9e jmp 737 ++ 7a7: c7 44 24 08 8b 00 00 movl $0x8b,0x8(%esp) ++ 7ae: 00 ++ 7af: c7 44 24 04 8e 46 00 movl $0x468e,0x4(%esp) ++ 7b6: 00 ++ 7b7: eb 9e jmp 757 + printf(stdout, "error: open big failed!\n"); +- 799: c7 44 24 04 a5 45 00 movl $0x45a5,0x4(%esp) +- 7a0: 00 +- 7a1: a1 c4 63 00 00 mov 0x63c4,%eax +- 7a6: 89 04 24 mov %eax,(%esp) +- 7a9: e8 32 38 00 00 call 3fe0 ++ 7b9: c7 44 24 04 75 46 00 movl $0x4675,0x4(%esp) ++ 7c0: 00 ++ 7c1: a1 94 64 00 00 mov 0x6494,%eax ++ 7c6: 89 04 24 mov %eax,(%esp) ++ 7c9: e8 e2 38 00 00 call 40b0 + exit(0); +- 7ae: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 7b5: e8 d8 36 00 00 call 3e92 ++ 7ce: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 7d5: e8 88 37 00 00 call 3f62 + printf(stdout, "error: creat big failed!\n"); +- 7ba: c7 44 24 04 6d 45 00 movl $0x456d,0x4(%esp) +- 7c1: 00 +- 7c2: eb dd jmp 7a1 ++ 7da: c7 44 24 04 3d 46 00 movl $0x463d,0x4(%esp) ++ 7e1: 00 ++ 7e2: eb dd jmp 7c1 + printf(stdout, "unlink big failed\n"); +- 7c4: c7 44 24 04 eb 45 00 movl $0x45eb,0x4(%esp) +- 7cb: 00 +- 7cc: eb d3 jmp 7a1 +- 7ce: 66 90 xchg %ax,%ax ++ 7e4: c7 44 24 04 bb 46 00 movl $0x46bb,0x4(%esp) ++ 7eb: 00 ++ 7ec: eb d3 jmp 7c1 ++ 7ee: 66 90 xchg %ax,%ax + +-000007d0 : ++000007f0 : + { +- 7d0: 55 push %ebp +- 7d1: 89 e5 mov %esp,%ebp +- 7d3: 53 push %ebx ++ 7f0: 55 push %ebp ++ 7f1: 89 e5 mov %esp,%ebp ++ 7f3: 53 push %ebx + name[2] = '\0'; +- 7d4: bb 30 00 00 00 mov $0x30,%ebx ++ 7f4: bb 30 00 00 00 mov $0x30,%ebx + { +- 7d9: 83 ec 14 sub $0x14,%esp ++ 7f9: 83 ec 14 sub $0x14,%esp + printf(stdout, "many creates, followed by unlink test\n"); +- 7dc: a1 c4 63 00 00 mov 0x63c4,%eax +- 7e1: c7 44 24 04 f8 53 00 movl $0x53f8,0x4(%esp) +- 7e8: 00 +- 7e9: 89 04 24 mov %eax,(%esp) +- 7ec: e8 ef 37 00 00 call 3fe0 ++ 7fc: a1 94 64 00 00 mov 0x6494,%eax ++ 801: c7 44 24 04 c8 54 00 movl $0x54c8,0x4(%esp) ++ 808: 00 ++ 809: 89 04 24 mov %eax,(%esp) ++ 80c: e8 9f 38 00 00 call 40b0 + name[0] = 'a'; +- 7f1: c6 05 a0 ab 00 00 61 movb $0x61,0xaba0 ++ 811: c6 05 80 ac 00 00 61 movb $0x61,0xac80 + name[2] = '\0'; +- 7f8: c6 05 a2 ab 00 00 00 movb $0x0,0xaba2 +- 7ff: 90 nop +- fd = open(name, O_CREATE|O_RDWR); +- 800: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 807: 00 +- 808: c7 04 24 a0 ab 00 00 movl $0xaba0,(%esp) ++ 818: c6 05 82 ac 00 00 00 movb $0x0,0xac82 ++ 81f: 90 nop ++ fd = open(name, O_CREATE | O_RDWR); ++ 820: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 827: 00 ++ 828: c7 04 24 80 ac 00 00 movl $0xac80,(%esp) + name[1] = '0' + i; +- 80f: 88 1d a1 ab 00 00 mov %bl,0xaba1 +- 815: 83 c3 01 add $0x1,%ebx +- fd = open(name, O_CREATE|O_RDWR); +- 818: e8 b5 36 00 00 call 3ed2 ++ 82f: 88 1d 81 ac 00 00 mov %bl,0xac81 ++ 835: 83 c3 01 add $0x1,%ebx ++ fd = open(name, O_CREATE | O_RDWR); ++ 838: e8 65 37 00 00 call 3fa2 + close(fd); +- 81d: 89 04 24 mov %eax,(%esp) +- 820: e8 95 36 00 00 call 3eba +- for(i = 0; i < 52; i++){ +- 825: 80 fb 64 cmp $0x64,%bl +- 828: 75 d6 jne 800 ++ 83d: 89 04 24 mov %eax,(%esp) ++ 840: e8 45 37 00 00 call 3f8a ++ for (i = 0; i < 52; i++) ++ 845: 80 fb 64 cmp $0x64,%bl ++ 848: 75 d6 jne 820 + name[0] = 'a'; +- 82a: c6 05 a0 ab 00 00 61 movb $0x61,0xaba0 ++ 84a: c6 05 80 ac 00 00 61 movb $0x61,0xac80 + name[2] = '\0'; +- 831: bb 30 00 00 00 mov $0x30,%ebx +- 836: c6 05 a2 ab 00 00 00 movb $0x0,0xaba2 +- 83d: 8d 76 00 lea 0x0(%esi),%esi ++ 851: bb 30 00 00 00 mov $0x30,%ebx ++ 856: c6 05 82 ac 00 00 00 movb $0x0,0xac82 ++ 85d: 8d 76 00 lea 0x0(%esi),%esi + name[1] = '0' + i; +- 840: 88 1d a1 ab 00 00 mov %bl,0xaba1 +- 846: 83 c3 01 add $0x1,%ebx ++ 860: 88 1d 81 ac 00 00 mov %bl,0xac81 ++ 866: 83 c3 01 add $0x1,%ebx + unlink(name); +- 849: c7 04 24 a0 ab 00 00 movl $0xaba0,(%esp) +- 850: e8 8d 36 00 00 call 3ee2 +- for(i = 0; i < 52; i++){ +- 855: 80 fb 64 cmp $0x64,%bl +- 858: 75 e6 jne 840 ++ 869: c7 04 24 80 ac 00 00 movl $0xac80,(%esp) ++ 870: e8 3d 37 00 00 call 3fb2 ++ for (i = 0; i < 52; i++) ++ 875: 80 fb 64 cmp $0x64,%bl ++ 878: 75 e6 jne 860 + printf(stdout, "many creates, followed by unlink; ok\n"); +- 85a: a1 c4 63 00 00 mov 0x63c4,%eax +- 85f: c7 44 24 04 20 54 00 movl $0x5420,0x4(%esp) +- 866: 00 +- 867: 89 04 24 mov %eax,(%esp) +- 86a: e8 71 37 00 00 call 3fe0 ++ 87a: a1 94 64 00 00 mov 0x6494,%eax ++ 87f: c7 44 24 04 f0 54 00 movl $0x54f0,0x4(%esp) ++ 886: 00 ++ 887: 89 04 24 mov %eax,(%esp) ++ 88a: e8 21 38 00 00 call 40b0 + } +- 86f: 83 c4 14 add $0x14,%esp +- 872: 5b pop %ebx +- 873: 5d pop %ebp +- 874: c3 ret +- 875: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 879: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 88f: 83 c4 14 add $0x14,%esp ++ 892: 5b pop %ebx ++ 893: 5d pop %ebp ++ 894: c3 ret ++ 895: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 899: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00000880 : ++000008a0 : + { +- 880: 55 push %ebp +- 881: 89 e5 mov %esp,%ebp +- 883: 83 ec 18 sub $0x18,%esp ++ 8a0: 55 push %ebp ++ 8a1: 89 e5 mov %esp,%ebp ++ 8a3: 83 ec 18 sub $0x18,%esp + printf(stdout, "mkdir test\n"); +- 886: a1 c4 63 00 00 mov 0x63c4,%eax +- 88b: c7 44 24 04 0c 46 00 movl $0x460c,0x4(%esp) +- 892: 00 +- 893: 89 04 24 mov %eax,(%esp) +- 896: e8 45 37 00 00 call 3fe0 +- if(mkdir("dir0") < 0){ +- 89b: c7 04 24 18 46 00 00 movl $0x4618,(%esp) +- 8a2: e8 53 36 00 00 call 3efa +- 8a7: 85 c0 test %eax,%eax +- 8a9: 78 47 js 8f2 +- if(chdir("dir0") < 0){ +- 8ab: c7 04 24 18 46 00 00 movl $0x4618,(%esp) +- 8b2: e8 4b 36 00 00 call 3f02 +- 8b7: 85 c0 test %eax,%eax +- 8b9: 78 6c js 927 +- if(chdir("..") < 0){ +- 8bb: c7 04 24 bd 4b 00 00 movl $0x4bbd,(%esp) +- 8c2: e8 3b 36 00 00 call 3f02 ++ 8a6: a1 94 64 00 00 mov 0x6494,%eax ++ 8ab: c7 44 24 04 dc 46 00 movl $0x46dc,0x4(%esp) ++ 8b2: 00 ++ 8b3: 89 04 24 mov %eax,(%esp) ++ 8b6: e8 f5 37 00 00 call 40b0 ++ if (mkdir("dir0") < 0) ++ 8bb: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) ++ 8c2: e8 03 37 00 00 call 3fca + 8c7: 85 c0 test %eax,%eax +- 8c9: 78 52 js 91d +- if(unlink("dir0") < 0){ +- 8cb: c7 04 24 18 46 00 00 movl $0x4618,(%esp) +- 8d2: e8 0b 36 00 00 call 3ee2 ++ 8c9: 78 47 js 912 ++ if (chdir("dir0") < 0) ++ 8cb: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) ++ 8d2: e8 fb 36 00 00 call 3fd2 + 8d7: 85 c0 test %eax,%eax +- 8d9: 78 38 js 913 ++ 8d9: 78 6c js 947 ++ if (chdir("..") < 0) ++ 8db: c7 04 24 8d 4c 00 00 movl $0x4c8d,(%esp) ++ 8e2: e8 eb 36 00 00 call 3fd2 ++ 8e7: 85 c0 test %eax,%eax ++ 8e9: 78 52 js 93d ++ if (unlink("dir0") < 0) ++ 8eb: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) ++ 8f2: e8 bb 36 00 00 call 3fb2 ++ 8f7: 85 c0 test %eax,%eax ++ 8f9: 78 38 js 933 + printf(stdout, "mkdir test ok\n"); +- 8db: a1 c4 63 00 00 mov 0x63c4,%eax +- 8e0: c7 44 24 04 55 46 00 movl $0x4655,0x4(%esp) +- 8e7: 00 +- 8e8: 89 04 24 mov %eax,(%esp) +- 8eb: e8 f0 36 00 00 call 3fe0 ++ 8fb: a1 94 64 00 00 mov 0x6494,%eax ++ 900: c7 44 24 04 25 47 00 movl $0x4725,0x4(%esp) ++ 907: 00 ++ 908: 89 04 24 mov %eax,(%esp) ++ 90b: e8 a0 37 00 00 call 40b0 + } +- 8f0: c9 leave +- 8f1: c3 ret ++ 910: c9 leave ++ 911: c3 ret + printf(stdout, "mkdir failed\n"); +- 8f2: c7 44 24 04 48 43 00 movl $0x4348,0x4(%esp) +- 8f9: 00 ++ 912: c7 44 24 04 18 44 00 movl $0x4418,0x4(%esp) ++ 919: 00 + printf(stdout, "chdir dir0 failed\n"); +- 8fa: a1 c4 63 00 00 mov 0x63c4,%eax +- 8ff: 89 04 24 mov %eax,(%esp) +- 902: e8 d9 36 00 00 call 3fe0 ++ 91a: a1 94 64 00 00 mov 0x6494,%eax ++ 91f: 89 04 24 mov %eax,(%esp) ++ 922: e8 89 37 00 00 call 40b0 + exit(0); +- 907: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 90e: e8 7f 35 00 00 call 3e92 ++ 927: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 92e: e8 2f 36 00 00 call 3f62 + printf(stdout, "unlink dir0 failed\n"); +- 913: c7 44 24 04 41 46 00 movl $0x4641,0x4(%esp) +- 91a: 00 +- 91b: eb dd jmp 8fa ++ 933: c7 44 24 04 11 47 00 movl $0x4711,0x4(%esp) ++ 93a: 00 ++ 93b: eb dd jmp 91a + printf(stdout, "chdir .. failed\n"); +- 91d: c7 44 24 04 30 46 00 movl $0x4630,0x4(%esp) +- 924: 00 +- 925: eb d3 jmp 8fa ++ 93d: c7 44 24 04 00 47 00 movl $0x4700,0x4(%esp) ++ 944: 00 ++ 945: eb d3 jmp 91a + printf(stdout, "chdir dir0 failed\n"); +- 927: c7 44 24 04 1d 46 00 movl $0x461d,0x4(%esp) +- 92e: 00 +- 92f: eb c9 jmp 8fa +- 931: eb 0d jmp 940 +- 933: 90 nop +- 934: 90 nop +- 935: 90 nop +- 936: 90 nop +- 937: 90 nop +- 938: 90 nop +- 939: 90 nop +- 93a: 90 nop +- 93b: 90 nop +- 93c: 90 nop +- 93d: 90 nop +- 93e: 90 nop +- 93f: 90 nop ++ 947: c7 44 24 04 ed 46 00 movl $0x46ed,0x4(%esp) ++ 94e: 00 ++ 94f: eb c9 jmp 91a ++ 951: eb 0d jmp 960 ++ 953: 90 nop ++ 954: 90 nop ++ 955: 90 nop ++ 956: 90 nop ++ 957: 90 nop ++ 958: 90 nop ++ 959: 90 nop ++ 95a: 90 nop ++ 95b: 90 nop ++ 95c: 90 nop ++ 95d: 90 nop ++ 95e: 90 nop ++ 95f: 90 nop + +-00000940 : ++00000960 : + { +- 940: 55 push %ebp +- 941: 89 e5 mov %esp,%ebp +- 943: 83 ec 18 sub $0x18,%esp ++ 960: 55 push %ebp ++ 961: 89 e5 mov %esp,%ebp ++ 963: 83 ec 18 sub $0x18,%esp + printf(stdout, "exec test\n"); +- 946: a1 c4 63 00 00 mov 0x63c4,%eax +- 94b: c7 44 24 04 64 46 00 movl $0x4664,0x4(%esp) +- 952: 00 +- 953: 89 04 24 mov %eax,(%esp) +- 956: e8 85 36 00 00 call 3fe0 +- if(exec("echo", echoargv) < 0){ +- 95b: c7 44 24 04 c8 63 00 movl $0x63c8,0x4(%esp) +- 962: 00 +- 963: c7 04 24 2d 44 00 00 movl $0x442d,(%esp) +- 96a: e8 5b 35 00 00 call 3eca +- 96f: 85 c0 test %eax,%eax +- 971: 78 02 js 975 ++ 966: a1 94 64 00 00 mov 0x6494,%eax ++ 96b: c7 44 24 04 34 47 00 movl $0x4734,0x4(%esp) ++ 972: 00 ++ 973: 89 04 24 mov %eax,(%esp) ++ 976: e8 35 37 00 00 call 40b0 ++ if (exec("echo", echoargv) < 0) ++ 97b: c7 44 24 04 98 64 00 movl $0x6498,0x4(%esp) ++ 982: 00 ++ 983: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) ++ 98a: e8 0b 36 00 00 call 3f9a ++ 98f: 85 c0 test %eax,%eax ++ 991: 78 02 js 995 + } +- 973: c9 leave +- 974: c3 ret ++ 993: c9 leave ++ 994: c3 ret + printf(stdout, "exec echo failed\n"); +- 975: a1 c4 63 00 00 mov 0x63c4,%eax +- 97a: c7 44 24 04 6f 46 00 movl $0x466f,0x4(%esp) +- 981: 00 +- 982: 89 04 24 mov %eax,(%esp) +- 985: e8 56 36 00 00 call 3fe0 ++ 995: a1 94 64 00 00 mov 0x6494,%eax ++ 99a: c7 44 24 04 3f 47 00 movl $0x473f,0x4(%esp) ++ 9a1: 00 ++ 9a2: 89 04 24 mov %eax,(%esp) ++ 9a5: e8 06 37 00 00 call 40b0 + exit(0); +- 98a: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 991: e8 fc 34 00 00 call 3e92 +- 996: 8d 76 00 lea 0x0(%esi),%esi +- 999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 9aa: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 9b1: e8 ac 35 00 00 call 3f62 ++ 9b6: 8d 76 00 lea 0x0(%esi),%esi ++ 9b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000009a0 : ++000009c0 : + { +- 9a0: 55 push %ebp +- 9a1: 89 e5 mov %esp,%ebp +- 9a3: 57 push %edi +- 9a4: 56 push %esi +- 9a5: 53 push %ebx +- 9a6: 83 ec 2c sub $0x2c,%esp +- if(pipe(fds) != 0){ +- 9a9: 8d 45 e0 lea -0x20(%ebp),%eax +- 9ac: 89 04 24 mov %eax,(%esp) +- 9af: e8 ee 34 00 00 call 3ea2 +- 9b4: 85 c0 test %eax,%eax +- 9b6: 0f 85 55 01 00 00 jne b11 ++ 9c0: 55 push %ebp ++ 9c1: 89 e5 mov %esp,%ebp ++ 9c3: 57 push %edi ++ 9c4: 56 push %esi ++ 9c5: 53 push %ebx ++ 9c6: 83 ec 2c sub $0x2c,%esp ++ if (pipe(fds) != 0) ++ 9c9: 8d 45 e0 lea -0x20(%ebp),%eax ++ 9cc: 89 04 24 mov %eax,(%esp) ++ 9cf: e8 9e 35 00 00 call 3f72 ++ 9d4: 85 c0 test %eax,%eax ++ 9d6: 0f 85 5c 01 00 00 jne b38 + pid = fork(); +- 9bc: e8 c9 34 00 00 call 3e8a +- if(pid == 0){ +- 9c1: 83 f8 00 cmp $0x0,%eax +- 9c4: 0f 84 93 00 00 00 je a5d +- } else if(pid > 0){ +- 9ca: 0f 8e 61 01 00 00 jle b31 ++ 9dc: e8 79 35 00 00 call 3f5a ++ if (pid == 0) ++ 9e1: 83 f8 00 cmp $0x0,%eax ++ 9e4: 0f 84 93 00 00 00 je a7d ++ else if (pid > 0) ++ 9ea: 0f 8e 68 01 00 00 jle b58 + close(fds[1]); +- 9d0: 8b 45 e4 mov -0x1c(%ebp),%eax ++ 9f0: 8b 45 e4 mov -0x1c(%ebp),%eax + cc = 1; +- 9d3: bf 01 00 00 00 mov $0x1,%edi ++ 9f3: bf 01 00 00 00 mov $0x1,%edi + seq = 0; +- 9d8: 31 db xor %ebx,%ebx ++ 9f8: 31 db xor %ebx,%ebx + close(fds[1]); +- 9da: 89 04 24 mov %eax,(%esp) +- 9dd: e8 d8 34 00 00 call 3eba ++ 9fa: 89 04 24 mov %eax,(%esp) ++ 9fd: e8 88 35 00 00 call 3f8a + total = 0; +- 9e2: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) +- while((n = read(fds[0], buf, cc)) > 0){ +- 9e9: 8b 45 e0 mov -0x20(%ebp),%eax +- 9ec: 89 7c 24 08 mov %edi,0x8(%esp) +- 9f0: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 9f7: 00 +- 9f8: 89 04 24 mov %eax,(%esp) +- 9fb: e8 aa 34 00 00 call 3eaa +- a00: 85 c0 test %eax,%eax +- a02: 0f 8e ba 00 00 00 jle ac2 +- a08: 89 d9 mov %ebx,%ecx +- a0a: 8d 34 03 lea (%ebx,%eax,1),%esi +- a0d: f7 d9 neg %ecx +- a0f: eb 09 jmp a1a +- a11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- if((buf[i] & 0xff) != (seq++ & 0xff)){ +- a18: 89 d3 mov %edx,%ebx +- a1a: 38 9c 0b a0 8b 00 00 cmp %bl,0x8ba0(%ebx,%ecx,1) +- a21: 8d 53 01 lea 0x1(%ebx),%edx +- a24: 75 1b jne a41 +- for(i = 0; i < n; i++){ +- a26: 39 f2 cmp %esi,%edx +- a28: 75 ee jne a18 ++ a02: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) ++ while ((n = read(fds[0], buf, cc)) > 0) ++ a09: 8b 45 e0 mov -0x20(%ebp),%eax ++ a0c: 89 7c 24 08 mov %edi,0x8(%esp) ++ a10: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ a17: 00 ++ a18: 89 04 24 mov %eax,(%esp) ++ a1b: e8 5a 35 00 00 call 3f7a ++ a20: 85 c0 test %eax,%eax ++ a22: 0f 8e ba 00 00 00 jle ae2 ++ a28: 89 d9 mov %ebx,%ecx ++ a2a: 8d 34 03 lea (%ebx,%eax,1),%esi ++ a2d: f7 d9 neg %ecx ++ a2f: eb 09 jmp a3a ++ a31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ if ((buf[i] & 0xff) != (seq++ & 0xff)) ++ a38: 89 d3 mov %edx,%ebx ++ a3a: 38 9c 0b 80 8c 00 00 cmp %bl,0x8c80(%ebx,%ecx,1) ++ a41: 8d 53 01 lea 0x1(%ebx),%edx ++ a44: 75 1b jne a61 ++ for (i = 0; i < n; i++) ++ a46: 39 f2 cmp %esi,%edx ++ a48: 75 ee jne a38 + cc = cc * 2; +- a2a: 01 ff add %edi,%edi +- if((buf[i] & 0xff) != (seq++ & 0xff)){ +- a2c: 89 f3 mov %esi,%ebx ++ a4a: 01 ff add %edi,%edi ++ if ((buf[i] & 0xff) != (seq++ & 0xff)) ++ a4c: 89 f3 mov %esi,%ebx + total += n; +- a2e: 01 45 d4 add %eax,-0x2c(%ebp) ++ a4e: 01 45 d4 add %eax,-0x2c(%ebp) + cc = sizeof(buf); +- a31: 81 ff 01 20 00 00 cmp $0x2001,%edi +- a37: b8 00 20 00 00 mov $0x2000,%eax +- a3c: 0f 43 f8 cmovae %eax,%edi +- a3f: eb a8 jmp 9e9 ++ a51: 81 ff 01 20 00 00 cmp $0x2001,%edi ++ a57: b8 00 20 00 00 mov $0x2000,%eax ++ a5c: 0f 43 f8 cmovae %eax,%edi ++ a5f: eb a8 jmp a09 + printf(1, "pipe1 oops 2\n"); +- a41: c7 44 24 04 9e 46 00 movl $0x469e,0x4(%esp) +- a48: 00 +- a49: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- a50: e8 8b 35 00 00 call 3fe0 ++ a61: c7 44 24 04 6e 47 00 movl $0x476e,0x4(%esp) ++ a68: 00 ++ a69: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ a70: e8 3b 36 00 00 call 40b0 + } +- a55: 83 c4 2c add $0x2c,%esp +- a58: 5b pop %ebx +- a59: 5e pop %esi +- a5a: 5f pop %edi +- a5b: 5d pop %ebp +- a5c: c3 ret ++ a75: 83 c4 2c add $0x2c,%esp ++ a78: 5b pop %ebx ++ a79: 5e pop %esi ++ a7a: 5f pop %edi ++ a7b: 5d pop %ebp ++ a7c: c3 ret + close(fds[0]); +- a5d: 8b 45 e0 mov -0x20(%ebp),%eax ++ a7d: 8b 45 e0 mov -0x20(%ebp),%eax + seq = 0; +- a60: 31 f6 xor %esi,%esi ++ a80: 31 f6 xor %esi,%esi + close(fds[0]); +- a62: 89 04 24 mov %eax,(%esp) +- a65: e8 50 34 00 00 call 3eba +- a6a: 89 f0 mov %esi,%eax ++ a82: 89 04 24 mov %eax,(%esp) ++ a85: e8 00 35 00 00 call 3f8a ++ a8a: 89 f0 mov %esi,%eax + { +- a6c: 89 f3 mov %esi,%ebx +- a6e: 8d 96 09 04 00 00 lea 0x409(%esi),%edx +- a74: f7 d8 neg %eax +- a76: 66 90 xchg %ax,%ax ++ a8c: 89 f3 mov %esi,%ebx ++ a8e: 8d 96 09 04 00 00 lea 0x409(%esi),%edx ++ a94: f7 d8 neg %eax ++ a96: 66 90 xchg %ax,%ax + buf[i] = seq++; +- a78: 88 9c 18 a0 8b 00 00 mov %bl,0x8ba0(%eax,%ebx,1) +- a7f: 83 c3 01 add $0x1,%ebx +- for(i = 0; i < 1033; i++) +- a82: 39 d3 cmp %edx,%ebx +- a84: 75 f2 jne a78 +- if(write(fds[1], buf, 1033) != 1033){ +- a86: 8b 45 e4 mov -0x1c(%ebp),%eax +- a89: 89 de mov %ebx,%esi +- a8b: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp) +- a92: 00 +- a93: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- a9a: 00 +- a9b: 89 04 24 mov %eax,(%esp) +- a9e: e8 0f 34 00 00 call 3eb2 +- aa3: 3d 09 04 00 00 cmp $0x409,%eax +- aa8: 0f 85 a3 00 00 00 jne b51 +- for(n = 0; n < 5; n++){ +- aae: 81 fb 2d 14 00 00 cmp $0x142d,%ebx +- ab4: 75 b4 jne a6a ++ a98: 88 9c 18 80 8c 00 00 mov %bl,0x8c80(%eax,%ebx,1) ++ a9f: 83 c3 01 add $0x1,%ebx ++ for (i = 0; i < 1033; i++) ++ aa2: 39 d3 cmp %edx,%ebx ++ aa4: 75 f2 jne a98 ++ if (write(fds[1], buf, 1033) != 1033) ++ aa6: 8b 45 e4 mov -0x1c(%ebp),%eax ++ aa9: 89 de mov %ebx,%esi ++ aab: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp) ++ ab2: 00 ++ ab3: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ aba: 00 ++ abb: 89 04 24 mov %eax,(%esp) ++ abe: e8 bf 34 00 00 call 3f82 ++ ac3: 3d 09 04 00 00 cmp $0x409,%eax ++ ac8: 0f 85 aa 00 00 00 jne b78 ++ for (n = 0; n < 5; n++) ++ ace: 81 fb 2d 14 00 00 cmp $0x142d,%ebx ++ ad4: 75 b4 jne a8a + exit(0); +- ab6: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- abd: e8 d0 33 00 00 call 3e92 +- if(total != 5 * 1033){ +- ac2: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp) +- ac9: 75 29 jne af4 ++ ad6: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ add: e8 80 34 00 00 call 3f62 ++ if (total != 5 * 1033) ++ ae2: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp) ++ ae9: 75 30 jne b1b + close(fds[0]); +- acb: 8b 45 e0 mov -0x20(%ebp),%eax +- ace: 89 04 24 mov %eax,(%esp) +- ad1: e8 e4 33 00 00 call 3eba +- wait(); +- ad6: e8 bf 33 00 00 call 3e9a ++ aeb: 8b 45 e0 mov -0x20(%ebp),%eax ++ aee: 89 04 24 mov %eax,(%esp) ++ af1: e8 94 34 00 00 call 3f8a ++ wait(0); ++ af6: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ afd: e8 68 34 00 00 call 3f6a + printf(1, "pipe1 ok\n"); +- adb: c7 44 24 04 c3 46 00 movl $0x46c3,0x4(%esp) +- ae2: 00 +- ae3: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- aea: e8 f1 34 00 00 call 3fe0 +- aef: e9 61 ff ff ff jmp a55 ++ b02: c7 44 24 04 93 47 00 movl $0x4793,0x4(%esp) ++ b09: 00 ++ b0a: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ b11: e8 9a 35 00 00 call 40b0 ++ b16: e9 5a ff ff ff jmp a75 + printf(1, "pipe1 oops 3 total %d\n", total); +- af4: 8b 45 d4 mov -0x2c(%ebp),%eax +- af7: c7 44 24 04 ac 46 00 movl $0x46ac,0x4(%esp) +- afe: 00 +- aff: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- b06: 89 44 24 08 mov %eax,0x8(%esp) +- b0a: e8 d1 34 00 00 call 3fe0 +- b0f: eb a5 jmp ab6 ++ b1b: 8b 45 d4 mov -0x2c(%ebp),%eax ++ b1e: c7 44 24 04 7c 47 00 movl $0x477c,0x4(%esp) ++ b25: 00 ++ b26: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ b2d: 89 44 24 08 mov %eax,0x8(%esp) ++ b31: e8 7a 35 00 00 call 40b0 ++ b36: eb 9e jmp ad6 + printf(1, "pipe() failed\n"); +- b11: c7 44 24 04 81 46 00 movl $0x4681,0x4(%esp) +- b18: 00 +- b19: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- b20: e8 bb 34 00 00 call 3fe0 ++ b38: c7 44 24 04 51 47 00 movl $0x4751,0x4(%esp) ++ b3f: 00 ++ b40: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ b47: e8 64 35 00 00 call 40b0 + exit(0); +- b25: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- b2c: e8 61 33 00 00 call 3e92 ++ b4c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ b53: e8 0a 34 00 00 call 3f62 + printf(1, "fork() failed\n"); +- b31: c7 44 24 04 cd 46 00 movl $0x46cd,0x4(%esp) +- b38: 00 +- b39: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- b40: e8 9b 34 00 00 call 3fe0 ++ b58: c7 44 24 04 9d 47 00 movl $0x479d,0x4(%esp) ++ b5f: 00 ++ b60: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ b67: e8 44 35 00 00 call 40b0 + exit(0); +- b45: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- b4c: e8 41 33 00 00 call 3e92 ++ b6c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ b73: e8 ea 33 00 00 call 3f62 + printf(1, "pipe1 oops 1\n"); +- b51: c7 44 24 04 90 46 00 movl $0x4690,0x4(%esp) +- b58: 00 +- b59: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- b60: e8 7b 34 00 00 call 3fe0 ++ b78: c7 44 24 04 60 47 00 movl $0x4760,0x4(%esp) ++ b7f: 00 ++ b80: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ b87: e8 24 35 00 00 call 40b0 + exit(0); +- b65: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- b6c: e8 21 33 00 00 call 3e92 +- b71: eb 0d jmp b80 +- b73: 90 nop +- b74: 90 nop +- b75: 90 nop +- b76: 90 nop +- b77: 90 nop +- b78: 90 nop +- b79: 90 nop +- b7a: 90 nop +- b7b: 90 nop +- b7c: 90 nop +- b7d: 90 nop +- b7e: 90 nop +- b7f: 90 nop ++ b8c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ b93: e8 ca 33 00 00 call 3f62 ++ b98: 90 nop ++ b99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00000b80 : ++00000ba0 : + { +- b80: 55 push %ebp +- b81: 89 e5 mov %esp,%ebp +- b83: 57 push %edi +- b84: 56 push %esi +- b85: 53 push %ebx +- b86: 83 ec 2c sub $0x2c,%esp ++ ba0: 55 push %ebp ++ ba1: 89 e5 mov %esp,%ebp ++ ba3: 57 push %edi ++ ba4: 56 push %esi ++ ba5: 53 push %ebx ++ ba6: 83 ec 2c sub $0x2c,%esp + printf(1, "preempt: "); +- b89: c7 44 24 04 dc 46 00 movl $0x46dc,0x4(%esp) +- b90: 00 +- b91: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- b98: e8 43 34 00 00 call 3fe0 ++ ba9: c7 44 24 04 ac 47 00 movl $0x47ac,0x4(%esp) ++ bb0: 00 ++ bb1: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ bb8: e8 f3 34 00 00 call 40b0 + pid1 = fork(); +- b9d: e8 e8 32 00 00 call 3e8a +- if(pid1 == 0) +- ba2: 85 c0 test %eax,%eax ++ bbd: e8 98 33 00 00 call 3f5a ++ if (pid1 == 0) ++ bc2: 85 c0 test %eax,%eax + pid1 = fork(); +- ba4: 89 c7 mov %eax,%edi +- if(pid1 == 0) +- ba6: 75 02 jne baa +- ba8: eb fe jmp ba8 +- baa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ bc4: 89 c7 mov %eax,%edi ++ if (pid1 == 0) ++ bc6: 75 02 jne bca ++ bc8: eb fe jmp bc8 ++ bca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + pid2 = fork(); +- bb0: e8 d5 32 00 00 call 3e8a +- if(pid2 == 0) +- bb5: 85 c0 test %eax,%eax ++ bd0: e8 85 33 00 00 call 3f5a ++ if (pid2 == 0) ++ bd5: 85 c0 test %eax,%eax + pid2 = fork(); +- bb7: 89 c6 mov %eax,%esi +- if(pid2 == 0) +- bb9: 75 02 jne bbd +- bbb: eb fe jmp bbb ++ bd7: 89 c6 mov %eax,%esi ++ if (pid2 == 0) ++ bd9: 75 02 jne bdd ++ bdb: eb fe jmp bdb + pipe(pfds); +- bbd: 8d 45 e0 lea -0x20(%ebp),%eax +- bc0: 89 04 24 mov %eax,(%esp) +- bc3: e8 da 32 00 00 call 3ea2 ++ bdd: 8d 45 e0 lea -0x20(%ebp),%eax ++ be0: 89 04 24 mov %eax,(%esp) ++ be3: e8 8a 33 00 00 call 3f72 + pid3 = fork(); +- bc8: e8 bd 32 00 00 call 3e8a +- if(pid3 == 0){ +- bcd: 85 c0 test %eax,%eax ++ be8: e8 6d 33 00 00 call 3f5a ++ if (pid3 == 0) ++ bed: 85 c0 test %eax,%eax + pid3 = fork(); +- bcf: 89 c3 mov %eax,%ebx +- if(pid3 == 0){ +- bd1: 75 4c jne c1f ++ bef: 89 c3 mov %eax,%ebx ++ if (pid3 == 0) ++ bf1: 75 4c jne c3f + close(pfds[0]); +- bd3: 8b 45 e0 mov -0x20(%ebp),%eax +- bd6: 89 04 24 mov %eax,(%esp) +- bd9: e8 dc 32 00 00 call 3eba +- if(write(pfds[1], "x", 1) != 1) +- bde: 8b 45 e4 mov -0x1c(%ebp),%eax +- be1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- be8: 00 +- be9: c7 44 24 04 a1 4c 00 movl $0x4ca1,0x4(%esp) +- bf0: 00 +- bf1: 89 04 24 mov %eax,(%esp) +- bf4: e8 b9 32 00 00 call 3eb2 +- bf9: 83 f8 01 cmp $0x1,%eax +- bfc: 74 14 je c12 ++ bf3: 8b 45 e0 mov -0x20(%ebp),%eax ++ bf6: 89 04 24 mov %eax,(%esp) ++ bf9: e8 8c 33 00 00 call 3f8a ++ if (write(pfds[1], "x", 1) != 1) ++ bfe: 8b 45 e4 mov -0x1c(%ebp),%eax ++ c01: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ c08: 00 ++ c09: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) ++ c10: 00 ++ c11: 89 04 24 mov %eax,(%esp) ++ c14: e8 69 33 00 00 call 3f82 ++ c19: 83 f8 01 cmp $0x1,%eax ++ c1c: 74 14 je c32 + printf(1, "preempt write error"); +- bfe: c7 44 24 04 e6 46 00 movl $0x46e6,0x4(%esp) +- c05: 00 +- c06: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- c0d: e8 ce 33 00 00 call 3fe0 ++ c1e: c7 44 24 04 b6 47 00 movl $0x47b6,0x4(%esp) ++ c25: 00 ++ c26: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ c2d: e8 7e 34 00 00 call 40b0 + close(pfds[1]); +- c12: 8b 45 e4 mov -0x1c(%ebp),%eax +- c15: 89 04 24 mov %eax,(%esp) +- c18: e8 9d 32 00 00 call 3eba +- c1d: eb fe jmp c1d ++ c32: 8b 45 e4 mov -0x1c(%ebp),%eax ++ c35: 89 04 24 mov %eax,(%esp) ++ c38: e8 4d 33 00 00 call 3f8a ++ c3d: eb fe jmp c3d + close(pfds[1]); +- c1f: 8b 45 e4 mov -0x1c(%ebp),%eax +- c22: 89 04 24 mov %eax,(%esp) +- c25: e8 90 32 00 00 call 3eba +- if(read(pfds[0], buf, sizeof(buf)) != 1){ +- c2a: 8b 45 e0 mov -0x20(%ebp),%eax +- c2d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) +- c34: 00 +- c35: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- c3c: 00 +- c3d: 89 04 24 mov %eax,(%esp) +- c40: e8 65 32 00 00 call 3eaa +- c45: 83 f8 01 cmp $0x1,%eax +- c48: 74 1c je c66 ++ c3f: 8b 45 e4 mov -0x1c(%ebp),%eax ++ c42: 89 04 24 mov %eax,(%esp) ++ c45: e8 40 33 00 00 call 3f8a ++ if (read(pfds[0], buf, sizeof(buf)) != 1) ++ c4a: 8b 45 e0 mov -0x20(%ebp),%eax ++ c4d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) ++ c54: 00 ++ c55: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ c5c: 00 ++ c5d: 89 04 24 mov %eax,(%esp) ++ c60: e8 15 33 00 00 call 3f7a ++ c65: 83 f8 01 cmp $0x1,%eax ++ c68: 74 1c je c86 + printf(1, "preempt read error"); +- c4a: c7 44 24 04 fa 46 00 movl $0x46fa,0x4(%esp) +- c51: 00 +- c52: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- c59: e8 82 33 00 00 call 3fe0 ++ c6a: c7 44 24 04 ca 47 00 movl $0x47ca,0x4(%esp) ++ c71: 00 ++ c72: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ c79: e8 32 34 00 00 call 40b0 + } +- c5e: 83 c4 2c add $0x2c,%esp +- c61: 5b pop %ebx +- c62: 5e pop %esi +- c63: 5f pop %edi +- c64: 5d pop %ebp +- c65: c3 ret ++ c7e: 83 c4 2c add $0x2c,%esp ++ c81: 5b pop %ebx ++ c82: 5e pop %esi ++ c83: 5f pop %edi ++ c84: 5d pop %ebp ++ c85: c3 ret + close(pfds[0]); +- c66: 8b 45 e0 mov -0x20(%ebp),%eax +- c69: 89 04 24 mov %eax,(%esp) +- c6c: e8 49 32 00 00 call 3eba ++ c86: 8b 45 e0 mov -0x20(%ebp),%eax ++ c89: 89 04 24 mov %eax,(%esp) ++ c8c: e8 f9 32 00 00 call 3f8a + printf(1, "kill... "); +- c71: c7 44 24 04 0d 47 00 movl $0x470d,0x4(%esp) +- c78: 00 +- c79: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- c80: e8 5b 33 00 00 call 3fe0 ++ c91: c7 44 24 04 dd 47 00 movl $0x47dd,0x4(%esp) ++ c98: 00 ++ c99: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ ca0: e8 0b 34 00 00 call 40b0 + kill(pid1); +- c85: 89 3c 24 mov %edi,(%esp) +- c88: e8 35 32 00 00 call 3ec2 ++ ca5: 89 3c 24 mov %edi,(%esp) ++ ca8: e8 e5 32 00 00 call 3f92 + kill(pid2); +- c8d: 89 34 24 mov %esi,(%esp) +- c90: e8 2d 32 00 00 call 3ec2 ++ cad: 89 34 24 mov %esi,(%esp) ++ cb0: e8 dd 32 00 00 call 3f92 + kill(pid3); +- c95: 89 1c 24 mov %ebx,(%esp) +- c98: e8 25 32 00 00 call 3ec2 ++ cb5: 89 1c 24 mov %ebx,(%esp) ++ cb8: e8 d5 32 00 00 call 3f92 + printf(1, "wait... "); +- c9d: c7 44 24 04 16 47 00 movl $0x4716,0x4(%esp) +- ca4: 00 +- ca5: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- cac: e8 2f 33 00 00 call 3fe0 +- wait(); +- cb1: e8 e4 31 00 00 call 3e9a +- wait(); +- cb6: e8 df 31 00 00 call 3e9a +- cbb: 90 nop +- cbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- wait(); +- cc0: e8 d5 31 00 00 call 3e9a ++ cbd: c7 44 24 04 e6 47 00 movl $0x47e6,0x4(%esp) ++ cc4: 00 ++ cc5: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ ccc: e8 df 33 00 00 call 40b0 ++ wait(0); ++ cd1: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ cd8: e8 8d 32 00 00 call 3f6a ++ wait(0); ++ cdd: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ ce4: e8 81 32 00 00 call 3f6a ++ wait(0); ++ ce9: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ cf0: e8 75 32 00 00 call 3f6a + printf(1, "preempt ok\n"); +- cc5: c7 44 24 04 1f 47 00 movl $0x471f,0x4(%esp) +- ccc: 00 +- ccd: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- cd4: e8 07 33 00 00 call 3fe0 +- cd9: eb 83 jmp c5e +- cdb: 90 nop +- cdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ cf5: c7 44 24 04 ef 47 00 movl $0x47ef,0x4(%esp) ++ cfc: 00 ++ cfd: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ d04: e8 a7 33 00 00 call 40b0 ++ d09: e9 70 ff ff ff jmp c7e ++ d0e: 66 90 xchg %ax,%ax + +-00000ce0 : ++00000d10 : + { +- ce0: 55 push %ebp +- ce1: 89 e5 mov %esp,%ebp +- ce3: 56 push %esi +- ce4: be 64 00 00 00 mov $0x64,%esi +- ce9: 53 push %ebx +- cea: 83 ec 10 sub $0x10,%esp +- ced: eb 13 jmp d02 +- cef: 90 nop +- if(pid){ +- cf0: 74 71 je d63 +- if(wait() != pid){ +- cf2: e8 a3 31 00 00 call 3e9a +- cf7: 39 d8 cmp %ebx,%eax +- cf9: 75 2d jne d28 +- for(i = 0; i < 100; i++){ +- cfb: 83 ee 01 sub $0x1,%esi +- cfe: 66 90 xchg %ax,%ax +- d00: 74 46 je d48 ++ d10: 55 push %ebp ++ d11: 89 e5 mov %esp,%ebp ++ d13: 56 push %esi ++ d14: be 64 00 00 00 mov $0x64,%esi ++ d19: 53 push %ebx ++ d1a: 83 ec 10 sub $0x10,%esp ++ d1d: eb 18 jmp d37 ++ d1f: 90 nop ++ if (wait(0) != pid) ++ d20: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ if (pid) ++ d27: 74 72 je d9b ++ if (wait(0) != pid) ++ d29: e8 3c 32 00 00 call 3f6a ++ d2e: 39 d8 cmp %ebx,%eax ++ d30: 75 2e jne d60 ++ for (i = 0; i < 100; i++) ++ d32: 83 ee 01 sub $0x1,%esi ++ d35: 74 49 je d80 + pid = fork(); +- d02: e8 83 31 00 00 call 3e8a +- if(pid < 0){ +- d07: 85 c0 test %eax,%eax ++ d37: e8 1e 32 00 00 call 3f5a ++ if (pid < 0) ++ d3c: 85 c0 test %eax,%eax + pid = fork(); +- d09: 89 c3 mov %eax,%ebx +- if(pid < 0){ +- d0b: 79 e3 jns cf0 ++ d3e: 89 c3 mov %eax,%ebx ++ if (pid < 0) ++ d40: 79 de jns d20 + printf(1, "fork failed\n"); +- d0d: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- d14: 00 +- d15: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- d1c: e8 bf 32 00 00 call 3fe0 ++ d42: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ d49: 00 ++ d4a: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ d51: e8 5a 33 00 00 call 40b0 + } +- d21: 83 c4 10 add $0x10,%esp +- d24: 5b pop %ebx +- d25: 5e pop %esi +- d26: 5d pop %ebp +- d27: c3 ret ++ d56: 83 c4 10 add $0x10,%esp ++ d59: 5b pop %ebx ++ d5a: 5e pop %esi ++ d5b: 5d pop %ebp ++ d5c: c3 ret ++ d5d: 8d 76 00 lea 0x0(%esi),%esi + printf(1, "wait wrong pid\n"); +- d28: c7 44 24 04 2b 47 00 movl $0x472b,0x4(%esp) +- d2f: 00 +- d30: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- d37: e8 a4 32 00 00 call 3fe0 ++ d60: c7 44 24 04 fb 47 00 movl $0x47fb,0x4(%esp) ++ d67: 00 ++ d68: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ d6f: e8 3c 33 00 00 call 40b0 + } +- d3c: 83 c4 10 add $0x10,%esp +- d3f: 5b pop %ebx +- d40: 5e pop %esi +- d41: 5d pop %ebp +- d42: c3 ret +- d43: 90 nop +- d44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ d74: 83 c4 10 add $0x10,%esp ++ d77: 5b pop %ebx ++ d78: 5e pop %esi ++ d79: 5d pop %ebp ++ d7a: c3 ret ++ d7b: 90 nop ++ d7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(1, "exitwait ok\n"); +- d48: c7 44 24 04 3b 47 00 movl $0x473b,0x4(%esp) +- d4f: 00 +- d50: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- d57: e8 84 32 00 00 call 3fe0 ++ d80: c7 44 24 04 0b 48 00 movl $0x480b,0x4(%esp) ++ d87: 00 ++ d88: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ d8f: e8 1c 33 00 00 call 40b0 + } +- d5c: 83 c4 10 add $0x10,%esp +- d5f: 5b pop %ebx +- d60: 5e pop %esi +- d61: 5d pop %ebp +- d62: c3 ret ++ d94: 83 c4 10 add $0x10,%esp ++ d97: 5b pop %ebx ++ d98: 5e pop %esi ++ d99: 5d pop %ebp ++ d9a: c3 ret + exit(0); +- d63: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- d6a: e8 23 31 00 00 call 3e92 +- d6f: 90 nop ++ d9b: e8 c2 31 00 00 call 3f62 + +-00000d70 : ++00000da0 : + { +- d70: 55 push %ebp +- d71: 89 e5 mov %esp,%ebp +- d73: 57 push %edi +- d74: 56 push %esi +- d75: 53 push %ebx +- d76: 83 ec 1c sub $0x1c,%esp ++ da0: 55 push %ebp ++ da1: 89 e5 mov %esp,%ebp ++ da3: 57 push %edi ++ da4: 56 push %esi ++ da5: 53 push %ebx ++ da6: 83 ec 1c sub $0x1c,%esp + printf(1, "mem test\n"); +- d79: c7 44 24 04 48 47 00 movl $0x4748,0x4(%esp) +- d80: 00 +- d81: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- d88: e8 53 32 00 00 call 3fe0 ++ da9: c7 44 24 04 18 48 00 movl $0x4818,0x4(%esp) ++ db0: 00 ++ db1: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ db8: e8 f3 32 00 00 call 40b0 + ppid = getpid(); +- d8d: e8 80 31 00 00 call 3f12 +- d92: 89 c6 mov %eax,%esi +- if((pid = fork()) == 0){ +- d94: e8 f1 30 00 00 call 3e8a +- d99: 85 c0 test %eax,%eax +- d9b: 75 73 jne e10 +- d9d: 31 db xor %ebx,%ebx +- d9f: 90 nop +- da0: eb 0a jmp dac +- da2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- *(char**)m2 = m1; +- da8: 89 18 mov %ebx,(%eax) +- daa: 89 c3 mov %eax,%ebx +- while((m2 = malloc(10001)) != 0){ +- dac: c7 04 24 11 27 00 00 movl $0x2711,(%esp) +- db3: e8 a8 34 00 00 call 4260 +- db8: 85 c0 test %eax,%eax +- dba: 75 ec jne da8 +- while(m1){ +- dbc: 85 db test %ebx,%ebx +- dbe: 75 0a jne dca +- dc0: eb 16 jmp dd8 +- dc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ dbd: e8 20 32 00 00 call 3fe2 ++ dc2: 89 c6 mov %eax,%esi ++ if ((pid = fork()) == 0) ++ dc4: e8 91 31 00 00 call 3f5a ++ dc9: 85 c0 test %eax,%eax ++ dcb: 75 73 jne e40 ++ dcd: 31 db xor %ebx,%ebx ++ dcf: 90 nop ++ dd0: eb 0a jmp ddc ++ dd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ *(char **)m2 = m1; ++ dd8: 89 18 mov %ebx,(%eax) ++ dda: 89 c3 mov %eax,%ebx ++ while ((m2 = malloc(10001)) != 0) ++ ddc: c7 04 24 11 27 00 00 movl $0x2711,(%esp) ++ de3: e8 48 35 00 00 call 4330 ++ de8: 85 c0 test %eax,%eax ++ dea: 75 ec jne dd8 ++ while (m1) ++ dec: 85 db test %ebx,%ebx ++ dee: 75 0a jne dfa ++ df0: eb 16 jmp e08 ++ df2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + m1 = m2; +- dc8: 89 fb mov %edi,%ebx +- m2 = *(char**)m1; +- dca: 8b 3b mov (%ebx),%edi ++ df8: 89 fb mov %edi,%ebx ++ m2 = *(char **)m1; ++ dfa: 8b 3b mov (%ebx),%edi + free(m1); +- dcc: 89 1c 24 mov %ebx,(%esp) +- dcf: e8 fc 33 00 00 call 41d0 +- while(m1){ +- dd4: 85 ff test %edi,%edi +- dd6: 75 f0 jne dc8 +- m1 = malloc(1024*20); +- dd8: c7 04 24 00 50 00 00 movl $0x5000,(%esp) +- ddf: e8 7c 34 00 00 call 4260 +- if(m1 == 0){ +- de4: 85 c0 test %eax,%eax +- de6: 74 38 je e20 ++ dfc: 89 1c 24 mov %ebx,(%esp) ++ dff: e8 9c 34 00 00 call 42a0 ++ while (m1) ++ e04: 85 ff test %edi,%edi ++ e06: 75 f0 jne df8 ++ m1 = malloc(1024 * 20); ++ e08: c7 04 24 00 50 00 00 movl $0x5000,(%esp) ++ e0f: e8 1c 35 00 00 call 4330 ++ if (m1 == 0) ++ e14: 85 c0 test %eax,%eax ++ e16: 74 40 je e58 + free(m1); +- de8: 89 04 24 mov %eax,(%esp) +- deb: e8 e0 33 00 00 call 41d0 ++ e18: 89 04 24 mov %eax,(%esp) ++ e1b: e8 80 34 00 00 call 42a0 + printf(1, "mem ok\n"); +- df0: c7 44 24 04 6c 47 00 movl $0x476c,0x4(%esp) +- df7: 00 +- df8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- dff: e8 dc 31 00 00 call 3fe0 ++ e20: c7 44 24 04 3c 48 00 movl $0x483c,0x4(%esp) ++ e27: 00 ++ e28: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ e2f: e8 7c 32 00 00 call 40b0 + exit(0); +- e04: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- e0b: e8 82 30 00 00 call 3e92 ++ e34: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ e3b: e8 22 31 00 00 call 3f62 ++ wait(0); ++ e40: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ e47: e8 1e 31 00 00 call 3f6a + } +- e10: 83 c4 1c add $0x1c,%esp +- e13: 5b pop %ebx +- e14: 5e pop %esi +- e15: 5f pop %edi +- e16: 5d pop %ebp +- wait(); +- e17: e9 7e 30 00 00 jmp 3e9a +- e1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ e4c: 83 c4 1c add $0x1c,%esp ++ e4f: 5b pop %ebx ++ e50: 5e pop %esi ++ e51: 5f pop %edi ++ e52: 5d pop %ebp ++ e53: c3 ret ++ e54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(1, "couldn't allocate mem?!!\n"); +- e20: c7 44 24 04 52 47 00 movl $0x4752,0x4(%esp) +- e27: 00 +- e28: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- e2f: e8 ac 31 00 00 call 3fe0 ++ e58: c7 44 24 04 22 48 00 movl $0x4822,0x4(%esp) ++ e5f: 00 ++ e60: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ e67: e8 44 32 00 00 call 40b0 + kill(ppid); +- e34: 89 34 24 mov %esi,(%esp) +- e37: e8 86 30 00 00 call 3ec2 ++ e6c: 89 34 24 mov %esi,(%esp) ++ e6f: e8 1e 31 00 00 call 3f92 + exit(0); +- e3c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- e43: e8 4a 30 00 00 call 3e92 +- e48: 90 nop +- e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ e74: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ e7b: e8 e2 30 00 00 call 3f62 + +-00000e50 : ++00000e80 : + { +- e50: 55 push %ebp +- e51: 89 e5 mov %esp,%ebp +- e53: 57 push %edi +- e54: 56 push %esi +- e55: 53 push %ebx +- e56: 83 ec 3c sub $0x3c,%esp ++ e80: 55 push %ebp ++ e81: 89 e5 mov %esp,%ebp ++ e83: 57 push %edi ++ e84: 56 push %esi ++ e85: 53 push %ebx ++ e86: 83 ec 3c sub $0x3c,%esp + printf(1, "sharedfd test\n"); +- e59: c7 44 24 04 74 47 00 movl $0x4774,0x4(%esp) +- e60: 00 +- e61: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- e68: e8 73 31 00 00 call 3fe0 ++ e89: c7 44 24 04 44 48 00 movl $0x4844,0x4(%esp) ++ e90: 00 ++ e91: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ e98: e8 13 32 00 00 call 40b0 + unlink("sharedfd"); +- e6d: c7 04 24 83 47 00 00 movl $0x4783,(%esp) +- e74: e8 69 30 00 00 call 3ee2 +- fd = open("sharedfd", O_CREATE|O_RDWR); +- e79: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- e80: 00 +- e81: c7 04 24 83 47 00 00 movl $0x4783,(%esp) +- e88: e8 45 30 00 00 call 3ed2 +- if(fd < 0){ +- e8d: 85 c0 test %eax,%eax +- fd = open("sharedfd", O_CREATE|O_RDWR); +- e8f: 89 c7 mov %eax,%edi +- if(fd < 0){ +- e91: 0f 88 40 01 00 00 js fd7 ++ e9d: c7 04 24 53 48 00 00 movl $0x4853,(%esp) ++ ea4: e8 09 31 00 00 call 3fb2 ++ fd = open("sharedfd", O_CREATE | O_RDWR); ++ ea9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ eb0: 00 ++ eb1: c7 04 24 53 48 00 00 movl $0x4853,(%esp) ++ eb8: e8 e5 30 00 00 call 3fa2 ++ if (fd < 0) ++ ebd: 85 c0 test %eax,%eax ++ fd = open("sharedfd", O_CREATE | O_RDWR); ++ ebf: 89 c7 mov %eax,%edi ++ if (fd < 0) ++ ec1: 0f 88 48 01 00 00 js 100f + pid = fork(); +- e97: e8 ee 2f 00 00 call 3e8a +- memset(buf, pid==0?'c':'p', sizeof(buf)); +- e9c: 8d 75 de lea -0x22(%ebp),%esi +- e9f: bb e8 03 00 00 mov $0x3e8,%ebx +- ea4: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) +- eab: 00 +- eac: 89 34 24 mov %esi,(%esp) +- eaf: 83 f8 01 cmp $0x1,%eax ++ ec7: e8 8e 30 00 00 call 3f5a ++ memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); ++ ecc: 8d 75 de lea -0x22(%ebp),%esi ++ ecf: bb e8 03 00 00 mov $0x3e8,%ebx ++ ed4: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) ++ edb: 00 ++ edc: 89 34 24 mov %esi,(%esp) ++ edf: 83 f8 01 cmp $0x1,%eax + pid = fork(); +- eb2: 89 45 d4 mov %eax,-0x2c(%ebp) +- memset(buf, pid==0?'c':'p', sizeof(buf)); +- eb5: 19 c0 sbb %eax,%eax +- eb7: 83 e0 f3 and $0xfffffff3,%eax +- eba: 83 c0 70 add $0x70,%eax +- ebd: 89 44 24 04 mov %eax,0x4(%esp) +- ec1: e8 5a 2e 00 00 call 3d20 +- ec6: eb 05 jmp ecd +- for(i = 0; i < 1000; i++){ +- ec8: 83 eb 01 sub $0x1,%ebx +- ecb: 74 2d je efa +- if(write(fd, buf, sizeof(buf)) != sizeof(buf)){ +- ecd: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) +- ed4: 00 +- ed5: 89 74 24 04 mov %esi,0x4(%esp) +- ed9: 89 3c 24 mov %edi,(%esp) +- edc: e8 d1 2f 00 00 call 3eb2 +- ee1: 83 f8 0a cmp $0xa,%eax +- ee4: 74 e2 je ec8 ++ ee2: 89 45 d4 mov %eax,-0x2c(%ebp) ++ memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); ++ ee5: 19 c0 sbb %eax,%eax ++ ee7: 83 e0 f3 and $0xfffffff3,%eax ++ eea: 83 c0 70 add $0x70,%eax ++ eed: 89 44 24 04 mov %eax,0x4(%esp) ++ ef1: e8 fa 2e 00 00 call 3df0 ++ ef6: eb 05 jmp efd ++ for (i = 0; i < 1000; i++) ++ ef8: 83 eb 01 sub $0x1,%ebx ++ efb: 74 2d je f2a ++ if (write(fd, buf, sizeof(buf)) != sizeof(buf)) ++ efd: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) ++ f04: 00 ++ f05: 89 74 24 04 mov %esi,0x4(%esp) ++ f09: 89 3c 24 mov %edi,(%esp) ++ f0c: e8 71 30 00 00 call 3f82 ++ f11: 83 f8 0a cmp $0xa,%eax ++ f14: 74 e2 je ef8 + printf(1, "fstests: write sharedfd failed\n"); +- ee6: c7 44 24 04 74 54 00 movl $0x5474,0x4(%esp) +- eed: 00 +- eee: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- ef5: e8 e6 30 00 00 call 3fe0 +- if(pid == 0) +- efa: 8b 45 d4 mov -0x2c(%ebp),%eax +- efd: 85 c0 test %eax,%eax +- eff: 0f 84 26 01 00 00 je 102b +- wait(); +- f05: e8 90 2f 00 00 call 3e9a ++ f16: c7 44 24 04 44 55 00 movl $0x5544,0x4(%esp) ++ f1d: 00 ++ f1e: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ f25: e8 86 31 00 00 call 40b0 ++ if (pid == 0) ++ f2a: 8b 45 d4 mov -0x2c(%ebp),%eax ++ exit(0); ++ f2d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ if (pid == 0) ++ f34: 85 c0 test %eax,%eax ++ f36: 0f 84 2e 01 00 00 je 106a ++ wait(0); ++ f3c: e8 29 30 00 00 call 3f6a + close(fd); +- f0a: 89 3c 24 mov %edi,(%esp) +- f0d: e8 a8 2f 00 00 call 3eba ++ f41: 89 3c 24 mov %edi,(%esp) ++ f44: e8 41 30 00 00 call 3f8a + fd = open("sharedfd", 0); +- f12: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- f19: 00 +- f1a: c7 04 24 83 47 00 00 movl $0x4783,(%esp) +- f21: e8 ac 2f 00 00 call 3ed2 +- if(fd < 0){ +- f26: 85 c0 test %eax,%eax ++ f49: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ f50: 00 ++ f51: c7 04 24 53 48 00 00 movl $0x4853,(%esp) ++ f58: e8 45 30 00 00 call 3fa2 ++ if (fd < 0) ++ f5d: 85 c0 test %eax,%eax + fd = open("sharedfd", 0); +- f28: 89 45 d0 mov %eax,-0x30(%ebp) +- if(fd < 0){ +- f2b: 0f 88 c2 00 00 00 js ff3 +- f31: 31 d2 xor %edx,%edx +- f33: 31 db xor %ebx,%ebx +- f35: 8d 7d e8 lea -0x18(%ebp),%edi +- f38: 89 55 d4 mov %edx,-0x2c(%ebp) +- f3b: 90 nop +- f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- while((n = read(fd, buf, sizeof(buf))) > 0){ +- f40: 8b 45 d0 mov -0x30(%ebp),%eax +- f43: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) +- f4a: 00 +- f4b: 89 74 24 04 mov %esi,0x4(%esp) +- f4f: 89 04 24 mov %eax,(%esp) +- f52: e8 53 2f 00 00 call 3eaa +- f57: 85 c0 test %eax,%eax +- f59: 7e 36 jle f91 +- f5b: 89 f0 mov %esi,%eax +- f5d: 8b 55 d4 mov -0x2c(%ebp),%edx +- f60: eb 18 jmp f7a +- f62: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ f5f: 89 45 d0 mov %eax,-0x30(%ebp) ++ if (fd < 0) ++ f62: 0f 88 c3 00 00 00 js 102b ++ f68: 31 d2 xor %edx,%edx ++ f6a: 31 db xor %ebx,%ebx ++ f6c: 8d 7d e8 lea -0x18(%ebp),%edi ++ f6f: 89 55 d4 mov %edx,-0x2c(%ebp) ++ f72: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ while ((n = read(fd, buf, sizeof(buf))) > 0) ++ f78: 8b 45 d0 mov -0x30(%ebp),%eax ++ f7b: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) ++ f82: 00 ++ f83: 89 74 24 04 mov %esi,0x4(%esp) ++ f87: 89 04 24 mov %eax,(%esp) ++ f8a: e8 eb 2f 00 00 call 3f7a ++ f8f: 85 c0 test %eax,%eax ++ f91: 7e 36 jle fc9 ++ f93: 89 f0 mov %esi,%eax ++ f95: 8b 55 d4 mov -0x2c(%ebp),%edx ++ f98: eb 18 jmp fb2 ++ f9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + np++; +- f68: 80 f9 70 cmp $0x70,%cl +- f6b: 0f 94 c1 sete %cl +- f6e: 83 c0 01 add $0x1,%eax +- f71: 0f b6 c9 movzbl %cl,%ecx +- f74: 01 cb add %ecx,%ebx +- for(i = 0; i < sizeof(buf); i++){ +- f76: 39 f8 cmp %edi,%eax +- f78: 74 12 je f8c +- if(buf[i] == 'c') +- f7a: 0f b6 08 movzbl (%eax),%ecx +- f7d: 80 f9 63 cmp $0x63,%cl +- f80: 75 e6 jne f68 +- f82: 83 c0 01 add $0x1,%eax ++ fa0: 80 f9 70 cmp $0x70,%cl ++ fa3: 0f 94 c1 sete %cl ++ fa6: 83 c0 01 add $0x1,%eax ++ fa9: 0f b6 c9 movzbl %cl,%ecx ++ fac: 01 cb add %ecx,%ebx ++ for (i = 0; i < sizeof(buf); i++) ++ fae: 39 f8 cmp %edi,%eax ++ fb0: 74 12 je fc4 ++ if (buf[i] == 'c') ++ fb2: 0f b6 08 movzbl (%eax),%ecx ++ fb5: 80 f9 63 cmp $0x63,%cl ++ fb8: 75 e6 jne fa0 ++ fba: 83 c0 01 add $0x1,%eax + nc++; +- f85: 83 c2 01 add $0x1,%edx +- for(i = 0; i < sizeof(buf); i++){ +- f88: 39 f8 cmp %edi,%eax +- f8a: 75 ee jne f7a +- f8c: 89 55 d4 mov %edx,-0x2c(%ebp) +- f8f: eb af jmp f40 ++ fbd: 83 c2 01 add $0x1,%edx ++ for (i = 0; i < sizeof(buf); i++) ++ fc0: 39 f8 cmp %edi,%eax ++ fc2: 75 ee jne fb2 ++ fc4: 89 55 d4 mov %edx,-0x2c(%ebp) ++ fc7: eb af jmp f78 + close(fd); +- f91: 8b 45 d0 mov -0x30(%ebp),%eax +- f94: 89 04 24 mov %eax,(%esp) +- f97: e8 1e 2f 00 00 call 3eba ++ fc9: 8b 45 d0 mov -0x30(%ebp),%eax ++ fcc: 89 04 24 mov %eax,(%esp) ++ fcf: e8 b6 2f 00 00 call 3f8a + unlink("sharedfd"); +- f9c: c7 04 24 83 47 00 00 movl $0x4783,(%esp) +- fa3: e8 3a 2f 00 00 call 3ee2 +- if(nc == 10000 && np == 10000){ +- fa8: 81 fb 10 27 00 00 cmp $0x2710,%ebx +- fae: 8b 55 d4 mov -0x2c(%ebp),%edx +- fb1: 75 5c jne 100f +- fb3: 81 fa 10 27 00 00 cmp $0x2710,%edx +- fb9: 75 54 jne 100f ++ fd4: c7 04 24 53 48 00 00 movl $0x4853,(%esp) ++ fdb: e8 d2 2f 00 00 call 3fb2 ++ if (nc == 10000 && np == 10000) ++ fe0: 81 fb 10 27 00 00 cmp $0x2710,%ebx ++ fe6: 8b 55 d4 mov -0x2c(%ebp),%edx ++ fe9: 75 5c jne 1047 ++ feb: 81 fa 10 27 00 00 cmp $0x2710,%edx ++ ff1: 75 54 jne 1047 + printf(1, "sharedfd ok\n"); +- fbb: c7 44 24 04 8c 47 00 movl $0x478c,0x4(%esp) +- fc2: 00 +- fc3: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- fca: e8 11 30 00 00 call 3fe0 +-} +- fcf: 83 c4 3c add $0x3c,%esp +- fd2: 5b pop %ebx +- fd3: 5e pop %esi +- fd4: 5f pop %edi +- fd5: 5d pop %ebp +- fd6: c3 ret +- printf(1, "fstests: cannot open sharedfd for writing"); +- fd7: c7 44 24 04 48 54 00 movl $0x5448,0x4(%esp) +- fde: 00 +- fdf: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- fe6: e8 f5 2f 00 00 call 3fe0 +-} +- feb: 83 c4 3c add $0x3c,%esp +- fee: 5b pop %ebx +- fef: 5e pop %esi +- ff0: 5f pop %edi +- ff1: 5d pop %ebp +- ff2: c3 ret +- printf(1, "fstests: cannot open sharedfd for reading\n"); +- ff3: c7 44 24 04 94 54 00 movl $0x5494,0x4(%esp) ++ ff3: c7 44 24 04 5c 48 00 movl $0x485c,0x4(%esp) + ffa: 00 + ffb: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1002: e8 d9 2f 00 00 call 3fe0 ++ 1002: e8 a9 30 00 00 call 40b0 + } + 1007: 83 c4 3c add $0x3c,%esp + 100a: 5b pop %ebx +@@ -1541,4723 +1515,4743 @@ main(int argc, char *argv[]) + 100c: 5f pop %edi + 100d: 5d pop %ebp + 100e: c3 ret ++ printf(1, "fstests: cannot open sharedfd for writing"); ++ 100f: c7 44 24 04 18 55 00 movl $0x5518,0x4(%esp) ++ 1016: 00 ++ 1017: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 101e: e8 8d 30 00 00 call 40b0 ++} ++ 1023: 83 c4 3c add $0x3c,%esp ++ 1026: 5b pop %ebx ++ 1027: 5e pop %esi ++ 1028: 5f pop %edi ++ 1029: 5d pop %ebp ++ 102a: c3 ret ++ printf(1, "fstests: cannot open sharedfd for reading\n"); ++ 102b: c7 44 24 04 64 55 00 movl $0x5564,0x4(%esp) ++ 1032: 00 ++ 1033: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 103a: e8 71 30 00 00 call 40b0 ++} ++ 103f: 83 c4 3c add $0x3c,%esp ++ 1042: 5b pop %ebx ++ 1043: 5e pop %esi ++ 1044: 5f pop %edi ++ 1045: 5d pop %ebp ++ 1046: c3 ret + printf(1, "sharedfd oops %d %d\n", nc, np); +- 100f: 89 5c 24 0c mov %ebx,0xc(%esp) +- 1013: 89 54 24 08 mov %edx,0x8(%esp) +- 1017: c7 44 24 04 99 47 00 movl $0x4799,0x4(%esp) +- 101e: 00 +- 101f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1026: e8 b5 2f 00 00 call 3fe0 ++ 1047: 89 5c 24 0c mov %ebx,0xc(%esp) ++ 104b: 89 54 24 08 mov %edx,0x8(%esp) ++ 104f: c7 44 24 04 69 48 00 movl $0x4869,0x4(%esp) ++ 1056: 00 ++ 1057: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 105e: e8 4d 30 00 00 call 40b0 + exit(0); +- 102b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1032: e8 5b 2e 00 00 call 3e92 +- 1037: 89 f6 mov %esi,%esi +- 1039: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 1063: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 106a: e8 f3 2e 00 00 call 3f62 ++ 106f: 90 nop + +-00001040 : ++00001070 : + { +- 1040: 55 push %ebp +- 1041: 89 e5 mov %esp,%ebp +- 1043: 57 push %edi +- 1044: 56 push %esi ++ 1070: 55 push %ebp ++ 1071: 89 e5 mov %esp,%ebp ++ 1073: 57 push %edi ++ 1074: 56 push %esi + printf(1, "fourfiles test\n"); +- 1045: be ae 47 00 00 mov $0x47ae,%esi ++ 1075: be 7e 48 00 00 mov $0x487e,%esi + { +- 104a: 53 push %ebx +- for(pi = 0; pi < 4; pi++){ +- 104b: 31 db xor %ebx,%ebx ++ 107a: 53 push %ebx ++ for (pi = 0; pi < 4; pi++) ++ 107b: 31 db xor %ebx,%ebx + { +- 104d: 83 ec 2c sub $0x2c,%esp ++ 107d: 83 ec 2c sub $0x2c,%esp + printf(1, "fourfiles test\n"); +- 1050: c7 44 24 04 b4 47 00 movl $0x47b4,0x4(%esp) +- 1057: 00 +- 1058: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- char *names[] = { "f0", "f1", "f2", "f3" }; +- 105f: c7 45 d8 ae 47 00 00 movl $0x47ae,-0x28(%ebp) +- 1066: c7 45 dc f7 48 00 00 movl $0x48f7,-0x24(%ebp) +- 106d: c7 45 e0 fb 48 00 00 movl $0x48fb,-0x20(%ebp) +- 1074: c7 45 e4 b1 47 00 00 movl $0x47b1,-0x1c(%ebp) ++ 1080: c7 44 24 04 84 48 00 movl $0x4884,0x4(%esp) ++ 1087: 00 ++ 1088: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ char *names[] = {"f0", "f1", "f2", "f3"}; ++ 108f: c7 45 d8 7e 48 00 00 movl $0x487e,-0x28(%ebp) ++ 1096: c7 45 dc c7 49 00 00 movl $0x49c7,-0x24(%ebp) ++ 109d: c7 45 e0 cb 49 00 00 movl $0x49cb,-0x20(%ebp) ++ 10a4: c7 45 e4 81 48 00 00 movl $0x4881,-0x1c(%ebp) + printf(1, "fourfiles test\n"); +- 107b: e8 60 2f 00 00 call 3fe0 ++ 10ab: e8 00 30 00 00 call 40b0 + unlink(fname); +- 1080: 89 34 24 mov %esi,(%esp) +- 1083: e8 5a 2e 00 00 call 3ee2 ++ 10b0: 89 34 24 mov %esi,(%esp) ++ 10b3: e8 fa 2e 00 00 call 3fb2 + pid = fork(); +- 1088: e8 fd 2d 00 00 call 3e8a +- if(pid < 0){ +- 108d: 85 c0 test %eax,%eax +- 108f: 0f 88 9f 01 00 00 js 1234 +- if(pid == 0){ +- 1095: 0f 84 eb 00 00 00 je 1186 +- for(pi = 0; pi < 4; pi++){ +- 109b: 83 c3 01 add $0x1,%ebx +- 109e: 83 fb 04 cmp $0x4,%ebx +- 10a1: 74 06 je 10a9 +- 10a3: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi +- 10a7: eb d7 jmp 1080 +- wait(); +- 10a9: e8 ec 2d 00 00 call 3e9a +- 10ae: bf 30 00 00 00 mov $0x30,%edi +- 10b3: e8 e2 2d 00 00 call 3e9a +- 10b8: e8 dd 2d 00 00 call 3e9a +- 10bd: e8 d8 2d 00 00 call 3e9a +- 10c2: c7 45 d4 ae 47 00 00 movl $0x47ae,-0x2c(%ebp) ++ 10b8: e8 9d 2e 00 00 call 3f5a ++ if (pid < 0) ++ 10bd: 85 c0 test %eax,%eax ++ 10bf: 0f 88 9b 01 00 00 js 1260 ++ if (pid == 0) ++ 10c5: 0f 84 0b 01 00 00 je 11d6 ++ for (pi = 0; pi < 4; pi++) ++ 10cb: 83 c3 01 add $0x1,%ebx ++ 10ce: 83 fb 04 cmp $0x4,%ebx ++ 10d1: 74 06 je 10d9 ++ 10d3: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi ++ 10d7: eb d7 jmp 10b0 ++ wait(0); ++ 10d9: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 10e0: bf 30 00 00 00 mov $0x30,%edi ++ 10e5: e8 80 2e 00 00 call 3f6a ++ 10ea: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 10f1: e8 74 2e 00 00 call 3f6a ++ 10f6: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 10fd: e8 68 2e 00 00 call 3f6a ++ 1102: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1109: e8 5c 2e 00 00 call 3f6a ++ 110e: c7 45 d4 7e 48 00 00 movl $0x487e,-0x2c(%ebp) + fd = open(fname, 0); +- 10c9: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 1115: 8b 45 d4 mov -0x2c(%ebp),%eax + total = 0; +- 10cc: 31 db xor %ebx,%ebx ++ 1118: 31 db xor %ebx,%ebx + fd = open(fname, 0); +- 10ce: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 10d5: 00 +- 10d6: 89 04 24 mov %eax,(%esp) +- 10d9: e8 f4 2d 00 00 call 3ed2 +- 10de: 89 c6 mov %eax,%esi +- while((n = read(fd, buf, sizeof(buf))) > 0){ +- 10e0: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) +- 10e7: 00 +- 10e8: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 10ef: 00 +- 10f0: 89 34 24 mov %esi,(%esp) +- 10f3: e8 b2 2d 00 00 call 3eaa +- 10f8: 85 c0 test %eax,%eax +- 10fa: 7e 1a jle 1116 +- 10fc: 31 d2 xor %edx,%edx +- 10fe: 66 90 xchg %ax,%ax +- if(buf[j] != '0'+i){ +- 1100: 0f be 8a a0 8b 00 00 movsbl 0x8ba0(%edx),%ecx +- 1107: 39 cf cmp %ecx,%edi +- 1109: 75 5b jne 1166 +- for(j = 0; j < n; j++){ +- 110b: 83 c2 01 add $0x1,%edx +- 110e: 39 c2 cmp %eax,%edx +- 1110: 75 ee jne 1100 ++ 111a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1121: 00 ++ 1122: 89 04 24 mov %eax,(%esp) ++ 1125: e8 78 2e 00 00 call 3fa2 ++ 112a: 89 c6 mov %eax,%esi ++ 112c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ while ((n = read(fd, buf, sizeof(buf))) > 0) ++ 1130: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) ++ 1137: 00 ++ 1138: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 113f: 00 ++ 1140: 89 34 24 mov %esi,(%esp) ++ 1143: e8 32 2e 00 00 call 3f7a ++ 1148: 85 c0 test %eax,%eax ++ 114a: 7e 1a jle 1166 ++ 114c: 31 d2 xor %edx,%edx ++ 114e: 66 90 xchg %ax,%ax ++ if (buf[j] != '0' + i) ++ 1150: 0f be 8a 80 8c 00 00 movsbl 0x8c80(%edx),%ecx ++ 1157: 39 f9 cmp %edi,%ecx ++ 1159: 75 5b jne 11b6 ++ for (j = 0; j < n; j++) ++ 115b: 83 c2 01 add $0x1,%edx ++ 115e: 39 c2 cmp %eax,%edx ++ 1160: 75 ee jne 1150 + total += n; +- 1112: 01 d3 add %edx,%ebx +- 1114: eb ca jmp 10e0 ++ 1162: 01 d3 add %edx,%ebx ++ 1164: eb ca jmp 1130 + close(fd); +- 1116: 89 34 24 mov %esi,(%esp) +- 1119: e8 9c 2d 00 00 call 3eba +- if(total != 12*500){ +- 111e: 81 fb 70 17 00 00 cmp $0x1770,%ebx +- 1124: 0f 85 e6 00 00 00 jne 1210 ++ 1166: 89 34 24 mov %esi,(%esp) ++ 1169: e8 1c 2e 00 00 call 3f8a ++ if (total != 12 * 500) ++ 116e: 81 fb 70 17 00 00 cmp $0x1770,%ebx ++ 1174: 0f 85 06 01 00 00 jne 1280 + unlink(fname); +- 112a: 8b 45 d4 mov -0x2c(%ebp),%eax +- 112d: 89 04 24 mov %eax,(%esp) +- 1130: e8 ad 2d 00 00 call 3ee2 +- for(i = 0; i < 2; i++){ +- 1135: 83 ff 31 cmp $0x31,%edi +- 1138: 75 1c jne 1156 ++ 117a: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 117d: 89 04 24 mov %eax,(%esp) ++ 1180: e8 2d 2e 00 00 call 3fb2 ++ for (i = 0; i < 2; i++) ++ 1185: 83 ff 31 cmp $0x31,%edi ++ 1188: 75 1c jne 11a6 + printf(1, "fourfiles ok\n"); +- 113a: c7 44 24 04 f2 47 00 movl $0x47f2,0x4(%esp) +- 1141: 00 +- 1142: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1149: e8 92 2e 00 00 call 3fe0 ++ 118a: c7 44 24 04 c2 48 00 movl $0x48c2,0x4(%esp) ++ 1191: 00 ++ 1192: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1199: e8 12 2f 00 00 call 40b0 + } +- 114e: 83 c4 2c add $0x2c,%esp +- 1151: 5b pop %ebx +- 1152: 5e pop %esi +- 1153: 5f pop %edi +- 1154: 5d pop %ebp +- 1155: c3 ret +- 1156: 8b 45 dc mov -0x24(%ebp),%eax +- 1159: bf 31 00 00 00 mov $0x31,%edi +- 115e: 89 45 d4 mov %eax,-0x2c(%ebp) +- 1161: e9 63 ff ff ff jmp 10c9 ++ 119e: 83 c4 2c add $0x2c,%esp ++ 11a1: 5b pop %ebx ++ 11a2: 5e pop %esi ++ 11a3: 5f pop %edi ++ 11a4: 5d pop %ebp ++ 11a5: c3 ret ++ 11a6: 8b 45 dc mov -0x24(%ebp),%eax ++ 11a9: bf 31 00 00 00 mov $0x31,%edi ++ 11ae: 89 45 d4 mov %eax,-0x2c(%ebp) ++ 11b1: e9 5f ff ff ff jmp 1115 + printf(1, "wrong char\n"); +- 1166: c7 44 24 04 d5 47 00 movl $0x47d5,0x4(%esp) +- 116d: 00 +- 116e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1175: e8 66 2e 00 00 call 3fe0 ++ 11b6: c7 44 24 04 a5 48 00 movl $0x48a5,0x4(%esp) ++ 11bd: 00 ++ 11be: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 11c5: e8 e6 2e 00 00 call 40b0 + exit(0); +- 117a: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1181: e8 0c 2d 00 00 call 3e92 ++ 11ca: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 11d1: e8 8c 2d 00 00 call 3f62 + fd = open(fname, O_CREATE | O_RDWR); +- 1186: 89 34 24 mov %esi,(%esp) +- 1189: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 1190: 00 +- 1191: e8 3c 2d 00 00 call 3ed2 +- if(fd < 0){ +- 1196: 85 c0 test %eax,%eax ++ 11d6: 89 34 24 mov %esi,(%esp) ++ 11d9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 11e0: 00 ++ 11e1: e8 bc 2d 00 00 call 3fa2 ++ if (fd < 0) ++ 11e6: 85 c0 test %eax,%eax + fd = open(fname, O_CREATE | O_RDWR); +- 1198: 89 c6 mov %eax,%esi +- if(fd < 0){ +- 119a: 0f 88 b4 00 00 00 js 1254 +- memset(buf, '0'+pi, 512); +- 11a0: 83 c3 30 add $0x30,%ebx +- 11a3: 89 5c 24 04 mov %ebx,0x4(%esp) +- 11a7: bb 0c 00 00 00 mov $0xc,%ebx +- 11ac: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +- 11b3: 00 +- 11b4: c7 04 24 a0 8b 00 00 movl $0x8ba0,(%esp) +- 11bb: e8 60 2b 00 00 call 3d20 +- 11c0: eb 0b jmp 11cd +- 11c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- for(i = 0; i < 12; i++){ +- 11c8: 83 eb 01 sub $0x1,%ebx +- 11cb: 74 ad je 117a +- if((n = write(fd, buf, 500)) != 500){ +- 11cd: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp) +- 11d4: 00 +- 11d5: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 11dc: 00 +- 11dd: 89 34 24 mov %esi,(%esp) +- 11e0: e8 cd 2c 00 00 call 3eb2 +- 11e5: 3d f4 01 00 00 cmp $0x1f4,%eax +- 11ea: 74 dc je 11c8 ++ 11e8: 89 c6 mov %eax,%esi ++ if (fd < 0) ++ 11ea: 0f 88 b4 00 00 00 js 12a4 ++ memset(buf, '0' + pi, 512); ++ 11f0: 83 c3 30 add $0x30,%ebx ++ 11f3: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 11f7: bb 0c 00 00 00 mov $0xc,%ebx ++ 11fc: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) ++ 1203: 00 ++ 1204: c7 04 24 80 8c 00 00 movl $0x8c80,(%esp) ++ 120b: e8 e0 2b 00 00 call 3df0 ++ 1210: eb 0b jmp 121d ++ 1212: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ for (i = 0; i < 12; i++) ++ 1218: 83 eb 01 sub $0x1,%ebx ++ 121b: 74 ad je 11ca ++ if ((n = write(fd, buf, 500)) != 500) ++ 121d: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp) ++ 1224: 00 ++ 1225: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 122c: 00 ++ 122d: 89 34 24 mov %esi,(%esp) ++ 1230: e8 4d 2d 00 00 call 3f82 ++ 1235: 3d f4 01 00 00 cmp $0x1f4,%eax ++ 123a: 74 dc je 1218 + printf(1, "write failed %d\n", n); +- 11ec: 89 44 24 08 mov %eax,0x8(%esp) +- 11f0: c7 44 24 04 c4 47 00 movl $0x47c4,0x4(%esp) +- 11f7: 00 +- 11f8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 11ff: e8 dc 2d 00 00 call 3fe0 ++ 123c: 89 44 24 08 mov %eax,0x8(%esp) ++ 1240: c7 44 24 04 94 48 00 movl $0x4894,0x4(%esp) ++ 1247: 00 ++ 1248: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 124f: e8 5c 2e 00 00 call 40b0 + exit(0); +- 1204: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 120b: e8 82 2c 00 00 call 3e92 +- printf(1, "wrong length %d\n", total); +- 1210: 89 5c 24 08 mov %ebx,0x8(%esp) +- 1214: c7 44 24 04 e1 47 00 movl $0x47e1,0x4(%esp) +- 121b: 00 +- 121c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1223: e8 b8 2d 00 00 call 3fe0 +- exit(0); +- 1228: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 122f: e8 5e 2c 00 00 call 3e92 ++ 1254: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 125b: e8 02 2d 00 00 call 3f62 + printf(1, "fork failed\n"); +- 1234: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 123b: 00 +- 123c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1243: e8 98 2d 00 00 call 3fe0 ++ 1260: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 1267: 00 ++ 1268: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 126f: e8 3c 2e 00 00 call 40b0 + exit(0); +- 1248: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 124f: e8 3e 2c 00 00 call 3e92 ++ 1274: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 127b: e8 e2 2c 00 00 call 3f62 ++ printf(1, "wrong length %d\n", total); ++ 1280: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 1284: c7 44 24 04 b1 48 00 movl $0x48b1,0x4(%esp) ++ 128b: 00 ++ 128c: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1293: e8 18 2e 00 00 call 40b0 ++ exit(0); ++ 1298: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 129f: e8 be 2c 00 00 call 3f62 + printf(1, "create failed\n"); +- 1254: c7 44 24 04 4f 4a 00 movl $0x4a4f,0x4(%esp) +- 125b: 00 +- 125c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1263: e8 78 2d 00 00 call 3fe0 ++ 12a4: c7 44 24 04 1f 4b 00 movl $0x4b1f,0x4(%esp) ++ 12ab: 00 ++ 12ac: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 12b3: e8 f8 2d 00 00 call 40b0 + exit(0); +- 1268: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 126f: e8 1e 2c 00 00 call 3e92 +- 1274: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 127a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ 12b8: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 12bf: e8 9e 2c 00 00 call 3f62 ++ 12c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 12ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00001280 : ++000012d0 : + { +- 1280: 55 push %ebp +- 1281: 89 e5 mov %esp,%ebp +- 1283: 57 push %edi +- 1284: 56 push %esi +- 1285: 53 push %ebx +- for(pi = 0; pi < 4; pi++){ +- 1286: 31 db xor %ebx,%ebx ++ 12d0: 55 push %ebp ++ 12d1: 89 e5 mov %esp,%ebp ++ 12d3: 57 push %edi ++ 12d4: 56 push %esi ++ 12d5: 53 push %ebx ++ for (pi = 0; pi < 4; pi++) ++ 12d6: 31 db xor %ebx,%ebx + { +- 1288: 83 ec 4c sub $0x4c,%esp ++ 12d8: 83 ec 4c sub $0x4c,%esp + printf(1, "createdelete test\n"); +- 128b: c7 44 24 04 00 48 00 movl $0x4800,0x4(%esp) +- 1292: 00 +- 1293: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 129a: e8 41 2d 00 00 call 3fe0 ++ 12db: c7 44 24 04 d0 48 00 movl $0x48d0,0x4(%esp) ++ 12e2: 00 ++ 12e3: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 12ea: e8 c1 2d 00 00 call 40b0 + pid = fork(); +- 129f: e8 e6 2b 00 00 call 3e8a +- if(pid < 0){ +- 12a4: 85 c0 test %eax,%eax +- 12a6: 0f 88 e8 01 00 00 js 1494 +- 12ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- if(pid == 0){ +- 12b0: 0f 84 14 01 00 00 je 13ca +- for(pi = 0; pi < 4; pi++){ +- 12b6: 83 c3 01 add $0x1,%ebx +- 12b9: 83 fb 04 cmp $0x4,%ebx +- 12bc: 75 e1 jne 129f +- 12be: 66 90 xchg %ax,%ax +- wait(); +- 12c0: e8 d5 2b 00 00 call 3e9a +- for(i = 0; i < N; i++){ +- 12c5: 31 f6 xor %esi,%esi +- wait(); +- 12c7: e8 ce 2b 00 00 call 3e9a +- 12cc: 8d 7d c8 lea -0x38(%ebp),%edi +- 12cf: e8 c6 2b 00 00 call 3e9a +- 12d4: e8 c1 2b 00 00 call 3e9a ++ 12ef: e8 66 2c 00 00 call 3f5a ++ if (pid < 0) ++ 12f4: 85 c0 test %eax,%eax ++ 12f6: 0f 88 00 02 00 00 js 14fc ++ 12fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ if (pid == 0) ++ 1300: 0f 84 2c 01 00 00 je 1432 ++ for (pi = 0; pi < 4; pi++) ++ 1306: 83 c3 01 add $0x1,%ebx ++ 1309: 83 fb 04 cmp $0x4,%ebx ++ 130c: 75 e1 jne 12ef ++ wait(0); ++ 130e: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ for (i = 0; i < N; i++) ++ 1315: 31 f6 xor %esi,%esi ++ wait(0); ++ 1317: e8 4e 2c 00 00 call 3f6a ++ 131c: 8d 7d c8 lea -0x38(%ebp),%edi ++ 131f: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1326: e8 3f 2c 00 00 call 3f6a ++ 132b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1332: e8 33 2c 00 00 call 3f6a ++ 1337: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 133e: e8 27 2c 00 00 call 3f6a + name[0] = name[1] = name[2] = 0; +- 12d9: c6 45 ca 00 movb $0x0,-0x36(%ebp) +- 12dd: 8d 76 00 lea 0x0(%esi),%esi +- 12e0: 85 f6 test %esi,%esi ++ 1343: c6 45 ca 00 movb $0x0,-0x36(%ebp) ++ 1347: 90 nop ++ 1348: 83 fe 09 cmp $0x9,%esi + name[2] = '\0'; +- 12e2: bb 70 00 00 00 mov $0x70,%ebx +- 12e7: 8d 46 30 lea 0x30(%esi),%eax +- 12ea: 0f 94 45 c7 sete -0x39(%ebp) +- 12ee: 83 fe 09 cmp $0x9,%esi +- 12f1: 88 45 c6 mov %al,-0x3a(%ebp) +- 12f4: 0f 9f c0 setg %al +- 12f7: 08 45 c7 or %al,-0x39(%ebp) +- 12fa: 8d 46 ff lea -0x1(%esi),%eax +- 12fd: 89 45 c0 mov %eax,-0x40(%ebp) ++ 134b: bb 70 00 00 00 mov $0x70,%ebx ++ 1350: 8d 46 30 lea 0x30(%esi),%eax ++ 1353: 0f 9f 45 c7 setg -0x39(%ebp) ++ 1357: 85 f6 test %esi,%esi ++ 1359: 88 45 c6 mov %al,-0x3a(%ebp) ++ 135c: 0f 94 c0 sete %al ++ 135f: 08 45 c7 or %al,-0x39(%ebp) ++ 1362: 8d 46 ff lea -0x1(%esi),%eax ++ 1365: 89 45 c0 mov %eax,-0x40(%ebp) + name[1] = '0' + i; +- 1300: 0f b6 45 c6 movzbl -0x3a(%ebp),%eax ++ 1368: 0f b6 45 c6 movzbl -0x3a(%ebp),%eax + fd = open(name, 0); +- 1304: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 130b: 00 +- 130c: 89 3c 24 mov %edi,(%esp) ++ 136c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1373: 00 ++ 1374: 89 3c 24 mov %edi,(%esp) + name[0] = 'p' + pi; +- 130f: 88 5d c8 mov %bl,-0x38(%ebp) ++ 1377: 88 5d c8 mov %bl,-0x38(%ebp) + name[1] = '0' + i; +- 1312: 88 45 c9 mov %al,-0x37(%ebp) ++ 137a: 88 45 c9 mov %al,-0x37(%ebp) + fd = open(name, 0); +- 1315: e8 b8 2b 00 00 call 3ed2 +- if((i == 0 || i >= N/2) && fd < 0){ +- 131a: 80 7d c7 00 cmpb $0x0,-0x39(%ebp) +- 131e: 0f 84 84 00 00 00 je 13a8 +- 1324: 85 c0 test %eax,%eax +- 1326: 0f 88 24 01 00 00 js 1450 +- } else if((i >= 1 && i < N/2) && fd >= 0){ +- 132c: 83 7d c0 08 cmpl $0x8,-0x40(%ebp) +- 1330: 0f 86 7e 01 00 00 jbe 14b4 ++ 137d: e8 20 2c 00 00 call 3fa2 ++ if ((i == 0 || i >= N / 2) && fd < 0) ++ 1382: 80 7d c7 00 cmpb $0x0,-0x39(%ebp) ++ 1386: 0f 84 84 00 00 00 je 1410 ++ 138c: 85 c0 test %eax,%eax ++ 138e: 0f 88 24 01 00 00 js 14b8 ++ else if ((i >= 1 && i < N / 2) && fd >= 0) ++ 1394: 83 7d c0 08 cmpl $0x8,-0x40(%ebp) ++ 1398: 0f 86 7e 01 00 00 jbe 151c + close(fd); +- 1336: 89 04 24 mov %eax,(%esp) +- 1339: 83 c3 01 add $0x1,%ebx +- 133c: e8 79 2b 00 00 call 3eba +- for(pi = 0; pi < 4; pi++){ +- 1341: 80 fb 74 cmp $0x74,%bl +- 1344: 75 ba jne 1300 +- for(i = 0; i < N; i++){ +- 1346: 83 c6 01 add $0x1,%esi +- 1349: 83 fe 14 cmp $0x14,%esi +- 134c: 75 92 jne 12e0 +- 134e: be 70 00 00 00 mov $0x70,%esi +- 1353: 90 nop +- 1354: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 1358: 8d 46 c0 lea -0x40(%esi),%eax +- 135b: bb 04 00 00 00 mov $0x4,%ebx +- 1360: 88 45 c7 mov %al,-0x39(%ebp) ++ 139e: 89 04 24 mov %eax,(%esp) ++ 13a1: 83 c3 01 add $0x1,%ebx ++ 13a4: e8 e1 2b 00 00 call 3f8a ++ for (pi = 0; pi < 4; pi++) ++ 13a9: 80 fb 74 cmp $0x74,%bl ++ 13ac: 75 ba jne 1368 ++ for (i = 0; i < N; i++) ++ 13ae: 83 c6 01 add $0x1,%esi ++ 13b1: 83 fe 14 cmp $0x14,%esi ++ 13b4: 75 92 jne 1348 ++ 13b6: be 70 00 00 00 mov $0x70,%esi ++ 13bb: 90 nop ++ 13bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 13c0: 8d 46 c0 lea -0x40(%esi),%eax ++ 13c3: bb 04 00 00 00 mov $0x4,%ebx ++ 13c8: 88 45 c7 mov %al,-0x39(%ebp) + name[0] = 'p' + i; +- 1363: 89 f0 mov %esi,%eax +- 1365: 88 45 c8 mov %al,-0x38(%ebp) ++ 13cb: 89 f0 mov %esi,%eax ++ 13cd: 88 45 c8 mov %al,-0x38(%ebp) + name[1] = '0' + i; +- 1368: 0f b6 45 c7 movzbl -0x39(%ebp),%eax ++ 13d0: 0f b6 45 c7 movzbl -0x39(%ebp),%eax + unlink(name); +- 136c: 89 3c 24 mov %edi,(%esp) ++ 13d4: 89 3c 24 mov %edi,(%esp) + name[1] = '0' + i; +- 136f: 88 45 c9 mov %al,-0x37(%ebp) ++ 13d7: 88 45 c9 mov %al,-0x37(%ebp) + unlink(name); +- 1372: e8 6b 2b 00 00 call 3ee2 +- for(pi = 0; pi < 4; pi++){ +- 1377: 83 eb 01 sub $0x1,%ebx +- 137a: 75 e7 jne 1363 +- 137c: 83 c6 01 add $0x1,%esi +- for(i = 0; i < N; i++){ +- 137f: 89 f0 mov %esi,%eax +- 1381: 3c 84 cmp $0x84,%al +- 1383: 75 d3 jne 1358 ++ 13da: e8 d3 2b 00 00 call 3fb2 ++ for (pi = 0; pi < 4; pi++) ++ 13df: 83 eb 01 sub $0x1,%ebx ++ 13e2: 75 e7 jne 13cb ++ 13e4: 83 c6 01 add $0x1,%esi ++ for (i = 0; i < N; i++) ++ 13e7: 89 f0 mov %esi,%eax ++ 13e9: 3c 84 cmp $0x84,%al ++ 13eb: 75 d3 jne 13c0 + printf(1, "createdelete ok\n"); +- 1385: c7 44 24 04 13 48 00 movl $0x4813,0x4(%esp) +- 138c: 00 +- 138d: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1394: e8 47 2c 00 00 call 3fe0 ++ 13ed: c7 44 24 04 e3 48 00 movl $0x48e3,0x4(%esp) ++ 13f4: 00 ++ 13f5: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 13fc: e8 af 2c 00 00 call 40b0 + } +- 1399: 83 c4 4c add $0x4c,%esp +- 139c: 5b pop %ebx +- 139d: 5e pop %esi +- 139e: 5f pop %edi +- 139f: 5d pop %ebp +- 13a0: c3 ret +- 13a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- } else if((i >= 1 && i < N/2) && fd >= 0){ +- 13a8: 85 c0 test %eax,%eax +- 13aa: 0f 89 04 01 00 00 jns 14b4 +- 13b0: 83 c3 01 add $0x1,%ebx +- for(pi = 0; pi < 4; pi++){ +- 13b3: 80 fb 74 cmp $0x74,%bl +- 13b6: 0f 85 44 ff ff ff jne 1300 +- for(i = 0; i < N; i++){ +- 13bc: 83 c6 01 add $0x1,%esi +- 13bf: 83 fe 14 cmp $0x14,%esi +- 13c2: 0f 85 18 ff ff ff jne 12e0 +- 13c8: eb 84 jmp 134e ++ 1401: 83 c4 4c add $0x4c,%esp ++ 1404: 5b pop %ebx ++ 1405: 5e pop %esi ++ 1406: 5f pop %edi ++ 1407: 5d pop %ebp ++ 1408: c3 ret ++ 1409: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ else if ((i >= 1 && i < N / 2) && fd >= 0) ++ 1410: 85 c0 test %eax,%eax ++ 1412: 0f 89 04 01 00 00 jns 151c ++ 1418: 83 c3 01 add $0x1,%ebx ++ for (pi = 0; pi < 4; pi++) ++ 141b: 80 fb 74 cmp $0x74,%bl ++ 141e: 0f 85 44 ff ff ff jne 1368 ++ for (i = 0; i < N; i++) ++ 1424: 83 c6 01 add $0x1,%esi ++ 1427: 83 fe 14 cmp $0x14,%esi ++ 142a: 0f 85 18 ff ff ff jne 1348 ++ 1430: eb 84 jmp 13b6 + name[0] = 'p' + pi; +- 13ca: 83 c3 70 add $0x70,%ebx ++ 1432: 83 c3 70 add $0x70,%ebx + name[2] = '\0'; +- 13cd: be 01 00 00 00 mov $0x1,%esi ++ 1435: be 01 00 00 00 mov $0x1,%esi + name[0] = 'p' + pi; +- 13d2: 88 5d c8 mov %bl,-0x38(%ebp) +- 13d5: 8d 7d c8 lea -0x38(%ebp),%edi ++ 143a: 88 5d c8 mov %bl,-0x38(%ebp) ++ 143d: 8d 7d c8 lea -0x38(%ebp),%edi + name[2] = '\0'; +- 13d8: 31 db xor %ebx,%ebx +- 13da: c6 45 ca 00 movb $0x0,-0x36(%ebp) +- 13de: eb 0f jmp 13ef +- for(i = 0; i < N; i++){ +- 13e0: 83 fe 14 cmp $0x14,%esi +- 13e3: 0f 84 7f 00 00 00 je 1468 +- 13e9: 83 c3 01 add $0x1,%ebx +- 13ec: 83 c6 01 add $0x1,%esi +- 13ef: 8d 43 30 lea 0x30(%ebx),%eax ++ 1440: 31 db xor %ebx,%ebx ++ 1442: c6 45 ca 00 movb $0x0,-0x36(%ebp) ++ 1446: eb 0f jmp 1457 ++ for (i = 0; i < N; i++) ++ 1448: 83 fe 14 cmp $0x14,%esi ++ 144b: 0f 84 7f 00 00 00 je 14d0 ++ 1451: 83 c3 01 add $0x1,%ebx ++ 1454: 83 c6 01 add $0x1,%esi ++ 1457: 8d 43 30 lea 0x30(%ebx),%eax + fd = open(name, O_CREATE | O_RDWR); +- 13f2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 13f9: 00 +- 13fa: 89 3c 24 mov %edi,(%esp) +- 13fd: 88 45 c9 mov %al,-0x37(%ebp) +- 1400: e8 cd 2a 00 00 call 3ed2 +- if(fd < 0){ +- 1405: 85 c0 test %eax,%eax +- 1407: 78 6b js 1474 ++ 145a: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 1461: 00 ++ 1462: 89 3c 24 mov %edi,(%esp) ++ 1465: 88 45 c9 mov %al,-0x37(%ebp) ++ 1468: e8 35 2b 00 00 call 3fa2 ++ if (fd < 0) ++ 146d: 85 c0 test %eax,%eax ++ 146f: 78 6b js 14dc + close(fd); +- 1409: 89 04 24 mov %eax,(%esp) +- 140c: e8 a9 2a 00 00 call 3eba +- if(i > 0 && (i % 2 ) == 0){ +- 1411: 85 db test %ebx,%ebx +- 1413: 74 d4 je 13e9 +- 1415: f6 c3 01 test $0x1,%bl +- 1418: 75 c6 jne 13e0 ++ 1471: 89 04 24 mov %eax,(%esp) ++ 1474: e8 11 2b 00 00 call 3f8a ++ if (i > 0 && (i % 2) == 0) ++ 1479: 85 db test %ebx,%ebx ++ 147b: 74 d4 je 1451 ++ 147d: f6 c3 01 test $0x1,%bl ++ 1480: 75 c6 jne 1448 + name[1] = '0' + (i / 2); +- 141a: 89 d8 mov %ebx,%eax +- 141c: d1 f8 sar %eax +- 141e: 83 c0 30 add $0x30,%eax +- if(unlink(name) < 0){ +- 1421: 89 3c 24 mov %edi,(%esp) ++ 1482: 89 d8 mov %ebx,%eax ++ 1484: d1 f8 sar %eax ++ 1486: 83 c0 30 add $0x30,%eax ++ if (unlink(name) < 0) ++ 1489: 89 3c 24 mov %edi,(%esp) + name[1] = '0' + (i / 2); +- 1424: 88 45 c9 mov %al,-0x37(%ebp) +- if(unlink(name) < 0){ +- 1427: e8 b6 2a 00 00 call 3ee2 +- 142c: 85 c0 test %eax,%eax +- 142e: 79 b0 jns 13e0 ++ 148c: 88 45 c9 mov %al,-0x37(%ebp) ++ if (unlink(name) < 0) ++ 148f: e8 1e 2b 00 00 call 3fb2 ++ 1494: 85 c0 test %eax,%eax ++ 1496: 79 b0 jns 1448 + printf(1, "unlink failed\n"); +- 1430: c7 44 24 04 01 44 00 movl $0x4401,0x4(%esp) +- 1437: 00 +- 1438: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 143f: e8 9c 2b 00 00 call 3fe0 ++ 1498: c7 44 24 04 d1 44 00 movl $0x44d1,0x4(%esp) ++ 149f: 00 ++ 14a0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 14a7: e8 04 2c 00 00 call 40b0 + exit(0); +- 1444: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 144b: e8 42 2a 00 00 call 3e92 ++ 14ac: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 14b3: e8 aa 2a 00 00 call 3f62 + printf(1, "oops createdelete %s didn't exist\n", name); +- 1450: 89 7c 24 08 mov %edi,0x8(%esp) +- 1454: c7 44 24 04 c0 54 00 movl $0x54c0,0x4(%esp) +- 145b: 00 +- 145c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1463: e8 78 2b 00 00 call 3fe0 ++ 14b8: 89 7c 24 08 mov %edi,0x8(%esp) ++ 14bc: c7 44 24 04 90 55 00 movl $0x5590,0x4(%esp) ++ 14c3: 00 ++ 14c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 14cb: e8 e0 2b 00 00 call 40b0 + exit(0); +- 1468: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 146f: e8 1e 2a 00 00 call 3e92 ++ 14d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 14d7: e8 86 2a 00 00 call 3f62 + printf(1, "create failed\n"); +- 1474: c7 44 24 04 4f 4a 00 movl $0x4a4f,0x4(%esp) +- 147b: 00 +- 147c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1483: e8 58 2b 00 00 call 3fe0 ++ 14dc: c7 44 24 04 1f 4b 00 movl $0x4b1f,0x4(%esp) ++ 14e3: 00 ++ 14e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 14eb: e8 c0 2b 00 00 call 40b0 + exit(0); +- 1488: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 148f: e8 fe 29 00 00 call 3e92 ++ 14f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 14f7: e8 66 2a 00 00 call 3f62 + printf(1, "fork failed\n"); +- 1494: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 149b: 00 +- 149c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 14a3: e8 38 2b 00 00 call 3fe0 ++ 14fc: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 1503: 00 ++ 1504: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 150b: e8 a0 2b 00 00 call 40b0 + exit(0); +- 14a8: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 14af: e8 de 29 00 00 call 3e92 ++ 1510: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1517: e8 46 2a 00 00 call 3f62 + printf(1, "oops createdelete %s did exist\n", name); +- 14b4: 89 7c 24 08 mov %edi,0x8(%esp) +- 14b8: c7 44 24 04 e4 54 00 movl $0x54e4,0x4(%esp) +- 14bf: 00 +- 14c0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 14c7: e8 14 2b 00 00 call 3fe0 ++ 151c: 89 7c 24 08 mov %edi,0x8(%esp) ++ 1520: c7 44 24 04 b4 55 00 movl $0x55b4,0x4(%esp) ++ 1527: 00 ++ 1528: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 152f: e8 7c 2b 00 00 call 40b0 + exit(0); +- 14cc: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 14d3: e8 ba 29 00 00 call 3e92 +- 14d8: 90 nop +- 14d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 1534: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 153b: e8 22 2a 00 00 call 3f62 + +-000014e0 : ++00001540 : + { +- 14e0: 55 push %ebp +- 14e1: 89 e5 mov %esp,%ebp +- 14e3: 56 push %esi +- 14e4: 53 push %ebx +- 14e5: 83 ec 10 sub $0x10,%esp ++ 1540: 55 push %ebp ++ 1541: 89 e5 mov %esp,%ebp ++ 1543: 56 push %esi ++ 1544: 53 push %ebx ++ 1545: 83 ec 10 sub $0x10,%esp + printf(1, "unlinkread test\n"); +- 14e8: c7 44 24 04 24 48 00 movl $0x4824,0x4(%esp) +- 14ef: 00 +- 14f0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 14f7: e8 e4 2a 00 00 call 3fe0 ++ 1548: c7 44 24 04 f4 48 00 movl $0x48f4,0x4(%esp) ++ 154f: 00 ++ 1550: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1557: e8 54 2b 00 00 call 40b0 + fd = open("unlinkread", O_CREATE | O_RDWR); +- 14fc: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 1503: 00 +- 1504: c7 04 24 35 48 00 00 movl $0x4835,(%esp) +- 150b: e8 c2 29 00 00 call 3ed2 +- if(fd < 0){ +- 1510: 85 c0 test %eax,%eax ++ 155c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 1563: 00 ++ 1564: c7 04 24 05 49 00 00 movl $0x4905,(%esp) ++ 156b: e8 32 2a 00 00 call 3fa2 ++ if (fd < 0) ++ 1570: 85 c0 test %eax,%eax + fd = open("unlinkread", O_CREATE | O_RDWR); +- 1512: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 1514: 0f 88 02 01 00 00 js 161c ++ 1572: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 1574: 0f 88 02 01 00 00 js 167c + write(fd, "hello", 5); +- 151a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp) +- 1521: 00 +- 1522: c7 44 24 04 5a 48 00 movl $0x485a,0x4(%esp) +- 1529: 00 +- 152a: 89 04 24 mov %eax,(%esp) +- 152d: e8 80 29 00 00 call 3eb2 ++ 157a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp) ++ 1581: 00 ++ 1582: c7 44 24 04 2a 49 00 movl $0x492a,0x4(%esp) ++ 1589: 00 ++ 158a: 89 04 24 mov %eax,(%esp) ++ 158d: e8 f0 29 00 00 call 3f82 + close(fd); +- 1532: 89 1c 24 mov %ebx,(%esp) +- 1535: e8 80 29 00 00 call 3eba ++ 1592: 89 1c 24 mov %ebx,(%esp) ++ 1595: e8 f0 29 00 00 call 3f8a + fd = open("unlinkread", O_RDWR); +- 153a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) +- 1541: 00 +- 1542: c7 04 24 35 48 00 00 movl $0x4835,(%esp) +- 1549: e8 84 29 00 00 call 3ed2 +- if(fd < 0){ +- 154e: 85 c0 test %eax,%eax ++ 159a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) ++ 15a1: 00 ++ 15a2: c7 04 24 05 49 00 00 movl $0x4905,(%esp) ++ 15a9: e8 f4 29 00 00 call 3fa2 ++ if (fd < 0) ++ 15ae: 85 c0 test %eax,%eax + fd = open("unlinkread", O_RDWR); +- 1550: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 1552: 0f 88 64 01 00 00 js 16bc +- if(unlink("unlinkread") != 0){ +- 1558: c7 04 24 35 48 00 00 movl $0x4835,(%esp) +- 155f: e8 7e 29 00 00 call 3ee2 +- 1564: 85 c0 test %eax,%eax +- 1566: 0f 85 30 01 00 00 jne 169c ++ 15b0: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 15b2: 0f 88 64 01 00 00 js 171c ++ if (unlink("unlinkread") != 0) ++ 15b8: c7 04 24 05 49 00 00 movl $0x4905,(%esp) ++ 15bf: e8 ee 29 00 00 call 3fb2 ++ 15c4: 85 c0 test %eax,%eax ++ 15c6: 0f 85 30 01 00 00 jne 16fc + fd1 = open("unlinkread", O_CREATE | O_RDWR); +- 156c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 1573: 00 +- 1574: c7 04 24 35 48 00 00 movl $0x4835,(%esp) +- 157b: e8 52 29 00 00 call 3ed2 ++ 15cc: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 15d3: 00 ++ 15d4: c7 04 24 05 49 00 00 movl $0x4905,(%esp) ++ 15db: e8 c2 29 00 00 call 3fa2 + write(fd1, "yyy", 3); +- 1580: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp) +- 1587: 00 +- 1588: c7 44 24 04 92 48 00 movl $0x4892,0x4(%esp) +- 158f: 00 ++ 15e0: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp) ++ 15e7: 00 ++ 15e8: c7 44 24 04 62 49 00 movl $0x4962,0x4(%esp) ++ 15ef: 00 + fd1 = open("unlinkread", O_CREATE | O_RDWR); +- 1590: 89 c6 mov %eax,%esi ++ 15f0: 89 c6 mov %eax,%esi + write(fd1, "yyy", 3); +- 1592: 89 04 24 mov %eax,(%esp) +- 1595: e8 18 29 00 00 call 3eb2 ++ 15f2: 89 04 24 mov %eax,(%esp) ++ 15f5: e8 88 29 00 00 call 3f82 + close(fd1); +- 159a: 89 34 24 mov %esi,(%esp) +- 159d: e8 18 29 00 00 call 3eba +- if(read(fd, buf, sizeof(buf)) != 5){ +- 15a2: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) +- 15a9: 00 +- 15aa: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 15b1: 00 +- 15b2: 89 1c 24 mov %ebx,(%esp) +- 15b5: e8 f0 28 00 00 call 3eaa +- 15ba: 83 f8 05 cmp $0x5,%eax +- 15bd: 0f 85 b9 00 00 00 jne 167c +- if(buf[0] != 'h'){ +- 15c3: 80 3d a0 8b 00 00 68 cmpb $0x68,0x8ba0 +- 15ca: 0f 85 8c 00 00 00 jne 165c +- if(write(fd, buf, 10) != 10){ +- 15d0: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) +- 15d7: 00 +- 15d8: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 15df: 00 +- 15e0: 89 1c 24 mov %ebx,(%esp) +- 15e3: e8 ca 28 00 00 call 3eb2 +- 15e8: 83 f8 0a cmp $0xa,%eax +- 15eb: 75 4f jne 163c ++ 15fa: 89 34 24 mov %esi,(%esp) ++ 15fd: e8 88 29 00 00 call 3f8a ++ if (read(fd, buf, sizeof(buf)) != 5) ++ 1602: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) ++ 1609: 00 ++ 160a: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 1611: 00 ++ 1612: 89 1c 24 mov %ebx,(%esp) ++ 1615: e8 60 29 00 00 call 3f7a ++ 161a: 83 f8 05 cmp $0x5,%eax ++ 161d: 0f 85 b9 00 00 00 jne 16dc ++ if (buf[0] != 'h') ++ 1623: 80 3d 80 8c 00 00 68 cmpb $0x68,0x8c80 ++ 162a: 0f 85 8c 00 00 00 jne 16bc ++ if (write(fd, buf, 10) != 10) ++ 1630: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) ++ 1637: 00 ++ 1638: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 163f: 00 ++ 1640: 89 1c 24 mov %ebx,(%esp) ++ 1643: e8 3a 29 00 00 call 3f82 ++ 1648: 83 f8 0a cmp $0xa,%eax ++ 164b: 75 4f jne 169c + close(fd); +- 15ed: 89 1c 24 mov %ebx,(%esp) +- 15f0: e8 c5 28 00 00 call 3eba ++ 164d: 89 1c 24 mov %ebx,(%esp) ++ 1650: e8 35 29 00 00 call 3f8a + unlink("unlinkread"); +- 15f5: c7 04 24 35 48 00 00 movl $0x4835,(%esp) +- 15fc: e8 e1 28 00 00 call 3ee2 ++ 1655: c7 04 24 05 49 00 00 movl $0x4905,(%esp) ++ 165c: e8 51 29 00 00 call 3fb2 + printf(1, "unlinkread ok\n"); +- 1601: c7 44 24 04 dd 48 00 movl $0x48dd,0x4(%esp) +- 1608: 00 +- 1609: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1610: e8 cb 29 00 00 call 3fe0 ++ 1661: c7 44 24 04 ad 49 00 movl $0x49ad,0x4(%esp) ++ 1668: 00 ++ 1669: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1670: e8 3b 2a 00 00 call 40b0 + } +- 1615: 83 c4 10 add $0x10,%esp +- 1618: 5b pop %ebx +- 1619: 5e pop %esi +- 161a: 5d pop %ebp +- 161b: c3 ret ++ 1675: 83 c4 10 add $0x10,%esp ++ 1678: 5b pop %ebx ++ 1679: 5e pop %esi ++ 167a: 5d pop %ebp ++ 167b: c3 ret + printf(1, "create unlinkread failed\n"); +- 161c: c7 44 24 04 40 48 00 movl $0x4840,0x4(%esp) +- 1623: 00 +- 1624: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 162b: e8 b0 29 00 00 call 3fe0 +- exit(0); +- 1630: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1637: e8 56 28 00 00 call 3e92 +- printf(1, "unlinkread write failed\n"); +- 163c: c7 44 24 04 c4 48 00 movl $0x48c4,0x4(%esp) +- 1643: 00 +- 1644: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 164b: e8 90 29 00 00 call 3fe0 +- exit(0); +- 1650: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1657: e8 36 28 00 00 call 3e92 +- printf(1, "unlinkread wrong data\n"); +- 165c: c7 44 24 04 ad 48 00 movl $0x48ad,0x4(%esp) +- 1663: 00 +- 1664: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 166b: e8 70 29 00 00 call 3fe0 +- exit(0); +- 1670: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1677: e8 16 28 00 00 call 3e92 +- printf(1, "unlinkread read failed"); +- 167c: c7 44 24 04 96 48 00 movl $0x4896,0x4(%esp) ++ 167c: c7 44 24 04 10 49 00 movl $0x4910,0x4(%esp) + 1683: 00 + 1684: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 168b: e8 50 29 00 00 call 3fe0 ++ 168b: e8 20 2a 00 00 call 40b0 + exit(0); + 1690: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1697: e8 f6 27 00 00 call 3e92 +- printf(1, "unlink unlinkread failed\n"); +- 169c: c7 44 24 04 78 48 00 movl $0x4878,0x4(%esp) ++ 1697: e8 c6 28 00 00 call 3f62 ++ printf(1, "unlinkread write failed\n"); ++ 169c: c7 44 24 04 94 49 00 movl $0x4994,0x4(%esp) + 16a3: 00 + 16a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 16ab: e8 30 29 00 00 call 3fe0 ++ 16ab: e8 00 2a 00 00 call 40b0 + exit(0); + 16b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 16b7: e8 d6 27 00 00 call 3e92 +- printf(1, "open unlinkread failed\n"); +- 16bc: c7 44 24 04 60 48 00 movl $0x4860,0x4(%esp) ++ 16b7: e8 a6 28 00 00 call 3f62 ++ printf(1, "unlinkread wrong data\n"); ++ 16bc: c7 44 24 04 7d 49 00 movl $0x497d,0x4(%esp) + 16c3: 00 + 16c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 16cb: e8 10 29 00 00 call 3fe0 ++ 16cb: e8 e0 29 00 00 call 40b0 + exit(0); + 16d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 16d7: e8 b6 27 00 00 call 3e92 +- 16dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 16d7: e8 86 28 00 00 call 3f62 ++ printf(1, "unlinkread read failed"); ++ 16dc: c7 44 24 04 66 49 00 movl $0x4966,0x4(%esp) ++ 16e3: 00 ++ 16e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 16eb: e8 c0 29 00 00 call 40b0 ++ exit(0); ++ 16f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 16f7: e8 66 28 00 00 call 3f62 ++ printf(1, "unlink unlinkread failed\n"); ++ 16fc: c7 44 24 04 48 49 00 movl $0x4948,0x4(%esp) ++ 1703: 00 ++ 1704: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 170b: e8 a0 29 00 00 call 40b0 ++ exit(0); ++ 1710: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1717: e8 46 28 00 00 call 3f62 ++ printf(1, "open unlinkread failed\n"); ++ 171c: c7 44 24 04 30 49 00 movl $0x4930,0x4(%esp) ++ 1723: 00 ++ 1724: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 172b: e8 80 29 00 00 call 40b0 ++ exit(0); ++ 1730: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1737: e8 26 28 00 00 call 3f62 ++ 173c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +-000016e0 : ++00001740 : + { +- 16e0: 55 push %ebp +- 16e1: 89 e5 mov %esp,%ebp +- 16e3: 53 push %ebx +- 16e4: 83 ec 14 sub $0x14,%esp ++ 1740: 55 push %ebp ++ 1741: 89 e5 mov %esp,%ebp ++ 1743: 53 push %ebx ++ 1744: 83 ec 14 sub $0x14,%esp + printf(1, "linktest\n"); +- 16e7: c7 44 24 04 ec 48 00 movl $0x48ec,0x4(%esp) +- 16ee: 00 +- 16ef: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 16f6: e8 e5 28 00 00 call 3fe0 ++ 1747: c7 44 24 04 bc 49 00 movl $0x49bc,0x4(%esp) ++ 174e: 00 ++ 174f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1756: e8 55 29 00 00 call 40b0 + unlink("lf1"); +- 16fb: c7 04 24 f6 48 00 00 movl $0x48f6,(%esp) +- 1702: e8 db 27 00 00 call 3ee2 ++ 175b: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) ++ 1762: e8 4b 28 00 00 call 3fb2 + unlink("lf2"); +- 1707: c7 04 24 fa 48 00 00 movl $0x48fa,(%esp) +- 170e: e8 cf 27 00 00 call 3ee2 +- fd = open("lf1", O_CREATE|O_RDWR); +- 1713: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 171a: 00 +- 171b: c7 04 24 f6 48 00 00 movl $0x48f6,(%esp) +- 1722: e8 ab 27 00 00 call 3ed2 +- if(fd < 0){ +- 1727: 85 c0 test %eax,%eax +- fd = open("lf1", O_CREATE|O_RDWR); +- 1729: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 172b: 0f 88 26 01 00 00 js 1857 +- if(write(fd, "hello", 5) != 5){ +- 1731: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp) +- 1738: 00 +- 1739: c7 44 24 04 5a 48 00 movl $0x485a,0x4(%esp) +- 1740: 00 +- 1741: 89 04 24 mov %eax,(%esp) +- 1744: e8 69 27 00 00 call 3eb2 +- 1749: 83 f8 05 cmp $0x5,%eax +- 174c: 0f 85 05 02 00 00 jne 1957 ++ 1767: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) ++ 176e: e8 3f 28 00 00 call 3fb2 ++ fd = open("lf1", O_CREATE | O_RDWR); ++ 1773: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 177a: 00 ++ 177b: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) ++ 1782: e8 1b 28 00 00 call 3fa2 ++ if (fd < 0) ++ 1787: 85 c0 test %eax,%eax ++ fd = open("lf1", O_CREATE | O_RDWR); ++ 1789: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 178b: 0f 88 26 01 00 00 js 18b7 ++ if (write(fd, "hello", 5) != 5) ++ 1791: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp) ++ 1798: 00 ++ 1799: c7 44 24 04 2a 49 00 movl $0x492a,0x4(%esp) ++ 17a0: 00 ++ 17a1: 89 04 24 mov %eax,(%esp) ++ 17a4: e8 d9 27 00 00 call 3f82 ++ 17a9: 83 f8 05 cmp $0x5,%eax ++ 17ac: 0f 85 05 02 00 00 jne 19b7 + close(fd); +- 1752: 89 1c 24 mov %ebx,(%esp) +- 1755: e8 60 27 00 00 call 3eba +- if(link("lf1", "lf2") < 0){ +- 175a: c7 44 24 04 fa 48 00 movl $0x48fa,0x4(%esp) +- 1761: 00 +- 1762: c7 04 24 f6 48 00 00 movl $0x48f6,(%esp) +- 1769: e8 84 27 00 00 call 3ef2 +- 176e: 85 c0 test %eax,%eax +- 1770: 0f 88 c1 01 00 00 js 1937 ++ 17b2: 89 1c 24 mov %ebx,(%esp) ++ 17b5: e8 d0 27 00 00 call 3f8a ++ if (link("lf1", "lf2") < 0) ++ 17ba: c7 44 24 04 ca 49 00 movl $0x49ca,0x4(%esp) ++ 17c1: 00 ++ 17c2: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) ++ 17c9: e8 f4 27 00 00 call 3fc2 ++ 17ce: 85 c0 test %eax,%eax ++ 17d0: 0f 88 c1 01 00 00 js 1997 + unlink("lf1"); +- 1776: c7 04 24 f6 48 00 00 movl $0x48f6,(%esp) +- 177d: e8 60 27 00 00 call 3ee2 +- if(open("lf1", 0) >= 0){ +- 1782: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1789: 00 +- 178a: c7 04 24 f6 48 00 00 movl $0x48f6,(%esp) +- 1791: e8 3c 27 00 00 call 3ed2 +- 1796: 85 c0 test %eax,%eax +- 1798: 0f 89 79 01 00 00 jns 1917 ++ 17d6: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) ++ 17dd: e8 d0 27 00 00 call 3fb2 ++ if (open("lf1", 0) >= 0) ++ 17e2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 17e9: 00 ++ 17ea: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) ++ 17f1: e8 ac 27 00 00 call 3fa2 ++ 17f6: 85 c0 test %eax,%eax ++ 17f8: 0f 89 79 01 00 00 jns 1977 + fd = open("lf2", 0); +- 179e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 17a5: 00 +- 17a6: c7 04 24 fa 48 00 00 movl $0x48fa,(%esp) +- 17ad: e8 20 27 00 00 call 3ed2 +- if(fd < 0){ +- 17b2: 85 c0 test %eax,%eax ++ 17fe: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1805: 00 ++ 1806: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) ++ 180d: e8 90 27 00 00 call 3fa2 ++ if (fd < 0) ++ 1812: 85 c0 test %eax,%eax + fd = open("lf2", 0); +- 17b4: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 17b6: 0f 88 3b 01 00 00 js 18f7 +- if(read(fd, buf, sizeof(buf)) != 5){ +- 17bc: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) +- 17c3: 00 +- 17c4: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 17cb: 00 +- 17cc: 89 04 24 mov %eax,(%esp) +- 17cf: e8 d6 26 00 00 call 3eaa +- 17d4: 83 f8 05 cmp $0x5,%eax +- 17d7: 0f 85 fa 00 00 00 jne 18d7 ++ 1814: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 1816: 0f 88 3b 01 00 00 js 1957 ++ if (read(fd, buf, sizeof(buf)) != 5) ++ 181c: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) ++ 1823: 00 ++ 1824: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 182b: 00 ++ 182c: 89 04 24 mov %eax,(%esp) ++ 182f: e8 46 27 00 00 call 3f7a ++ 1834: 83 f8 05 cmp $0x5,%eax ++ 1837: 0f 85 fa 00 00 00 jne 1937 + close(fd); +- 17dd: 89 1c 24 mov %ebx,(%esp) +- 17e0: e8 d5 26 00 00 call 3eba +- if(link("lf2", "lf2") >= 0){ +- 17e5: c7 44 24 04 fa 48 00 movl $0x48fa,0x4(%esp) +- 17ec: 00 +- 17ed: c7 04 24 fa 48 00 00 movl $0x48fa,(%esp) +- 17f4: e8 f9 26 00 00 call 3ef2 +- 17f9: 85 c0 test %eax,%eax +- 17fb: 0f 89 b6 00 00 00 jns 18b7 ++ 183d: 89 1c 24 mov %ebx,(%esp) ++ 1840: e8 45 27 00 00 call 3f8a ++ if (link("lf2", "lf2") >= 0) ++ 1845: c7 44 24 04 ca 49 00 movl $0x49ca,0x4(%esp) ++ 184c: 00 ++ 184d: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) ++ 1854: e8 69 27 00 00 call 3fc2 ++ 1859: 85 c0 test %eax,%eax ++ 185b: 0f 89 b6 00 00 00 jns 1917 + unlink("lf2"); +- 1801: c7 04 24 fa 48 00 00 movl $0x48fa,(%esp) +- 1808: e8 d5 26 00 00 call 3ee2 +- if(link("lf2", "lf1") >= 0){ +- 180d: c7 44 24 04 f6 48 00 movl $0x48f6,0x4(%esp) +- 1814: 00 +- 1815: c7 04 24 fa 48 00 00 movl $0x48fa,(%esp) +- 181c: e8 d1 26 00 00 call 3ef2 +- 1821: 85 c0 test %eax,%eax +- 1823: 79 72 jns 1897 +- if(link(".", "lf1") >= 0){ +- 1825: c7 44 24 04 f6 48 00 movl $0x48f6,0x4(%esp) +- 182c: 00 +- 182d: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) +- 1834: e8 b9 26 00 00 call 3ef2 +- 1839: 85 c0 test %eax,%eax +- 183b: 79 3a jns 1877 ++ 1861: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) ++ 1868: e8 45 27 00 00 call 3fb2 ++ if (link("lf2", "lf1") >= 0) ++ 186d: c7 44 24 04 c6 49 00 movl $0x49c6,0x4(%esp) ++ 1874: 00 ++ 1875: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) ++ 187c: e8 41 27 00 00 call 3fc2 ++ 1881: 85 c0 test %eax,%eax ++ 1883: 79 72 jns 18f7 ++ if (link(".", "lf1") >= 0) ++ 1885: c7 44 24 04 c6 49 00 movl $0x49c6,0x4(%esp) ++ 188c: 00 ++ 188d: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) ++ 1894: e8 29 27 00 00 call 3fc2 ++ 1899: 85 c0 test %eax,%eax ++ 189b: 79 3a jns 18d7 + printf(1, "linktest ok\n"); +- 183d: c7 44 24 04 94 49 00 movl $0x4994,0x4(%esp) +- 1844: 00 +- 1845: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 184c: e8 8f 27 00 00 call 3fe0 ++ 189d: c7 44 24 04 64 4a 00 movl $0x4a64,0x4(%esp) ++ 18a4: 00 ++ 18a5: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 18ac: e8 ff 27 00 00 call 40b0 + } +- 1851: 83 c4 14 add $0x14,%esp +- 1854: 5b pop %ebx +- 1855: 5d pop %ebp +- 1856: c3 ret ++ 18b1: 83 c4 14 add $0x14,%esp ++ 18b4: 5b pop %ebx ++ 18b5: 5d pop %ebp ++ 18b6: c3 ret + printf(1, "create lf1 failed\n"); +- 1857: c7 44 24 04 fe 48 00 movl $0x48fe,0x4(%esp) +- 185e: 00 +- 185f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1866: e8 75 27 00 00 call 3fe0 +- exit(0); +- 186b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1872: e8 1b 26 00 00 call 3e92 +- printf(1, "link . lf1 succeeded! oops\n"); +- 1877: c7 44 24 04 78 49 00 movl $0x4978,0x4(%esp) +- 187e: 00 +- 187f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1886: e8 55 27 00 00 call 3fe0 +- exit(0); +- 188b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1892: e8 fb 25 00 00 call 3e92 +- printf(1, "link non-existant succeeded! oops\n"); +- 1897: c7 44 24 04 2c 55 00 movl $0x552c,0x4(%esp) +- 189e: 00 +- 189f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 18a6: e8 35 27 00 00 call 3fe0 +- exit(0); +- 18ab: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 18b2: e8 db 25 00 00 call 3e92 +- printf(1, "link lf2 lf2 succeeded! oops\n"); +- 18b7: c7 44 24 04 5a 49 00 movl $0x495a,0x4(%esp) ++ 18b7: c7 44 24 04 ce 49 00 movl $0x49ce,0x4(%esp) + 18be: 00 + 18bf: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 18c6: e8 15 27 00 00 call 3fe0 ++ 18c6: e8 e5 27 00 00 call 40b0 + exit(0); + 18cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 18d2: e8 bb 25 00 00 call 3e92 +- printf(1, "read lf2 failed\n"); +- 18d7: c7 44 24 04 49 49 00 movl $0x4949,0x4(%esp) ++ 18d2: e8 8b 26 00 00 call 3f62 ++ printf(1, "link . lf1 succeeded! oops\n"); ++ 18d7: c7 44 24 04 48 4a 00 movl $0x4a48,0x4(%esp) + 18de: 00 + 18df: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 18e6: e8 f5 26 00 00 call 3fe0 ++ 18e6: e8 c5 27 00 00 call 40b0 + exit(0); + 18eb: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 18f2: e8 9b 25 00 00 call 3e92 +- printf(1, "open lf2 failed\n"); +- 18f7: c7 44 24 04 38 49 00 movl $0x4938,0x4(%esp) ++ 18f2: e8 6b 26 00 00 call 3f62 ++ printf(1, "link non-existant succeeded! oops\n"); ++ 18f7: c7 44 24 04 fc 55 00 movl $0x55fc,0x4(%esp) + 18fe: 00 + 18ff: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1906: e8 d5 26 00 00 call 3fe0 ++ 1906: e8 a5 27 00 00 call 40b0 + exit(0); + 190b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1912: e8 7b 25 00 00 call 3e92 +- printf(1, "unlinked lf1 but it is still there!\n"); +- 1917: c7 44 24 04 04 55 00 movl $0x5504,0x4(%esp) ++ 1912: e8 4b 26 00 00 call 3f62 ++ printf(1, "link lf2 lf2 succeeded! oops\n"); ++ 1917: c7 44 24 04 2a 4a 00 movl $0x4a2a,0x4(%esp) + 191e: 00 + 191f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1926: e8 b5 26 00 00 call 3fe0 ++ 1926: e8 85 27 00 00 call 40b0 + exit(0); + 192b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1932: e8 5b 25 00 00 call 3e92 +- printf(1, "link lf1 lf2 failed\n"); +- 1937: c7 44 24 04 23 49 00 movl $0x4923,0x4(%esp) ++ 1932: e8 2b 26 00 00 call 3f62 ++ printf(1, "read lf2 failed\n"); ++ 1937: c7 44 24 04 19 4a 00 movl $0x4a19,0x4(%esp) + 193e: 00 + 193f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1946: e8 95 26 00 00 call 3fe0 ++ 1946: e8 65 27 00 00 call 40b0 + exit(0); + 194b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1952: e8 3b 25 00 00 call 3e92 +- printf(1, "write lf1 failed\n"); +- 1957: c7 44 24 04 11 49 00 movl $0x4911,0x4(%esp) ++ 1952: e8 0b 26 00 00 call 3f62 ++ printf(1, "open lf2 failed\n"); ++ 1957: c7 44 24 04 08 4a 00 movl $0x4a08,0x4(%esp) + 195e: 00 + 195f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1966: e8 75 26 00 00 call 3fe0 ++ 1966: e8 45 27 00 00 call 40b0 + exit(0); + 196b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1972: e8 1b 25 00 00 call 3e92 +- 1977: 89 f6 mov %esi,%esi +- 1979: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 1972: e8 eb 25 00 00 call 3f62 ++ printf(1, "unlinked lf1 but it is still there!\n"); ++ 1977: c7 44 24 04 d4 55 00 movl $0x55d4,0x4(%esp) ++ 197e: 00 ++ 197f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1986: e8 25 27 00 00 call 40b0 ++ exit(0); ++ 198b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1992: e8 cb 25 00 00 call 3f62 ++ printf(1, "link lf1 lf2 failed\n"); ++ 1997: c7 44 24 04 f3 49 00 movl $0x49f3,0x4(%esp) ++ 199e: 00 ++ 199f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 19a6: e8 05 27 00 00 call 40b0 ++ exit(0); ++ 19ab: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 19b2: e8 ab 25 00 00 call 3f62 ++ printf(1, "write lf1 failed\n"); ++ 19b7: c7 44 24 04 e1 49 00 movl $0x49e1,0x4(%esp) ++ 19be: 00 ++ 19bf: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 19c6: e8 e5 26 00 00 call 40b0 ++ exit(0); ++ 19cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 19d2: e8 8b 25 00 00 call 3f62 ++ 19d7: 89 f6 mov %esi,%esi ++ 19d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00001980 : ++000019e0 : + { +- 1980: 55 push %ebp +- 1981: 89 e5 mov %esp,%ebp +- 1983: 57 push %edi +- 1984: 56 push %esi +- for(i = 0; i < 40; i++){ +- 1985: 31 f6 xor %esi,%esi ++ 19e0: 55 push %ebp ++ 19e1: 89 e5 mov %esp,%ebp ++ 19e3: 57 push %edi ++ 19e4: 56 push %esi ++ for (i = 0; i < 40; i++) ++ 19e5: 31 f6 xor %esi,%esi + { +- 1987: 53 push %ebx +- 1988: 83 ec 5c sub $0x5c,%esp ++ 19e7: 53 push %ebx ++ 19e8: 83 ec 5c sub $0x5c,%esp + printf(1, "concreate test\n"); +- 198b: c7 44 24 04 a1 49 00 movl $0x49a1,0x4(%esp) +- 1992: 00 +- 1993: 8d 5d ad lea -0x53(%ebp),%ebx +- 1996: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 199d: e8 3e 26 00 00 call 3fe0 ++ 19eb: c7 44 24 04 71 4a 00 movl $0x4a71,0x4(%esp) ++ 19f2: 00 ++ 19f3: 8d 5d ad lea -0x53(%ebp),%ebx ++ 19f6: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 19fd: e8 ae 26 00 00 call 40b0 + file[0] = 'C'; +- 19a2: c6 45 ad 43 movb $0x43,-0x53(%ebp) ++ 1a02: c6 45 ad 43 movb $0x43,-0x53(%ebp) + file[2] = '\0'; +- 19a6: c6 45 af 00 movb $0x0,-0x51(%ebp) +- 19aa: eb 53 jmp 19ff +- 19ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- if(pid && (i % 3) == 1){ +- 19b0: b8 56 55 55 55 mov $0x55555556,%eax +- 19b5: 89 f1 mov %esi,%ecx +- 19b7: f7 ee imul %esi +- 19b9: 89 f0 mov %esi,%eax +- 19bb: c1 f8 1f sar $0x1f,%eax +- 19be: 29 c2 sub %eax,%edx +- 19c0: 8d 04 52 lea (%edx,%edx,2),%eax +- 19c3: 29 c1 sub %eax,%ecx +- 19c5: 83 f9 01 cmp $0x1,%ecx +- 19c8: 0f 84 82 00 00 00 je 1a50 ++ 1a06: c6 45 af 00 movb $0x0,-0x51(%ebp) ++ 1a0a: eb 5a jmp 1a66 ++ 1a0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ if (pid && (i % 3) == 1) ++ 1a10: b8 56 55 55 55 mov $0x55555556,%eax ++ 1a15: 89 f1 mov %esi,%ecx ++ 1a17: f7 ee imul %esi ++ 1a19: 89 f0 mov %esi,%eax ++ 1a1b: c1 f8 1f sar $0x1f,%eax ++ 1a1e: 29 c2 sub %eax,%edx ++ 1a20: 8d 04 52 lea (%edx,%edx,2),%eax ++ 1a23: 29 c1 sub %eax,%ecx ++ 1a25: 83 f9 01 cmp $0x1,%ecx ++ 1a28: 0f 84 8a 00 00 00 je 1ab8 + fd = open(file, O_CREATE | O_RDWR); +- 19ce: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 19d5: 00 +- 19d6: 89 1c 24 mov %ebx,(%esp) +- 19d9: e8 f4 24 00 00 call 3ed2 +- if(fd < 0){ +- 19de: 85 c0 test %eax,%eax +- 19e0: 0f 88 4e 02 00 00 js 1c34 ++ 1a2e: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 1a35: 00 ++ 1a36: 89 1c 24 mov %ebx,(%esp) ++ 1a39: e8 64 25 00 00 call 3fa2 ++ if (fd < 0) ++ 1a3e: 85 c0 test %eax,%eax ++ 1a40: 0f 88 5e 02 00 00 js 1ca4 + close(fd); +- 19e6: 89 04 24 mov %eax,(%esp) +- 19e9: e8 cc 24 00 00 call 3eba +- if(pid == 0) +- 19ee: 85 ff test %edi,%edi +- 19f0: 74 52 je 1a44 +- for(i = 0; i < 40; i++){ +- 19f2: 83 c6 01 add $0x1,%esi +- wait(); +- 19f5: e8 a0 24 00 00 call 3e9a +- for(i = 0; i < 40; i++){ +- 19fa: 83 fe 28 cmp $0x28,%esi +- 19fd: 74 71 je 1a70 +- 19ff: 8d 46 30 lea 0x30(%esi),%eax ++ 1a46: 89 04 24 mov %eax,(%esp) ++ 1a49: e8 3c 25 00 00 call 3f8a ++ if (pid == 0) ++ 1a4e: 85 ff test %edi,%edi ++ 1a50: 74 59 je 1aab ++ wait(0); ++ 1a52: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ for (i = 0; i < 40; i++) ++ 1a59: 83 c6 01 add $0x1,%esi ++ wait(0); ++ 1a5c: e8 09 25 00 00 call 3f6a ++ for (i = 0; i < 40; i++) ++ 1a61: 83 fe 28 cmp $0x28,%esi ++ 1a64: 74 6a je 1ad0 ++ 1a66: 8d 46 30 lea 0x30(%esi),%eax + unlink(file); +- 1a02: 89 1c 24 mov %ebx,(%esp) +- 1a05: 88 45 ae mov %al,-0x52(%ebp) +- 1a08: e8 d5 24 00 00 call 3ee2 ++ 1a69: 89 1c 24 mov %ebx,(%esp) ++ 1a6c: 88 45 ae mov %al,-0x52(%ebp) ++ 1a6f: e8 3e 25 00 00 call 3fb2 + pid = fork(); +- 1a0d: e8 78 24 00 00 call 3e8a +- if(pid && (i % 3) == 1){ +- 1a12: 85 c0 test %eax,%eax ++ 1a74: e8 e1 24 00 00 call 3f5a ++ if (pid && (i % 3) == 1) ++ 1a79: 85 c0 test %eax,%eax + pid = fork(); +- 1a14: 89 c7 mov %eax,%edi +- if(pid && (i % 3) == 1){ +- 1a16: 75 98 jne 19b0 +- } else if(pid == 0 && (i % 5) == 1){ +- 1a18: b8 67 66 66 66 mov $0x66666667,%eax +- 1a1d: 89 f1 mov %esi,%ecx +- 1a1f: f7 ee imul %esi +- 1a21: 89 f0 mov %esi,%eax +- 1a23: c1 f8 1f sar $0x1f,%eax +- 1a26: d1 fa sar %edx +- 1a28: 29 c2 sub %eax,%edx +- 1a2a: 8d 04 92 lea (%edx,%edx,4),%eax +- 1a2d: 29 c1 sub %eax,%ecx +- 1a2f: 83 f9 01 cmp $0x1,%ecx +- 1a32: 75 9a jne 19ce ++ 1a7b: 89 c7 mov %eax,%edi ++ if (pid && (i % 3) == 1) ++ 1a7d: 75 91 jne 1a10 ++ else if (pid == 0 && (i % 5) == 1) ++ 1a7f: b8 67 66 66 66 mov $0x66666667,%eax ++ 1a84: 89 f1 mov %esi,%ecx ++ 1a86: f7 ee imul %esi ++ 1a88: 89 f0 mov %esi,%eax ++ 1a8a: c1 f8 1f sar $0x1f,%eax ++ 1a8d: d1 fa sar %edx ++ 1a8f: 29 c2 sub %eax,%edx ++ 1a91: 8d 04 92 lea (%edx,%edx,4),%eax ++ 1a94: 29 c1 sub %eax,%ecx ++ 1a96: 83 f9 01 cmp $0x1,%ecx ++ 1a99: 75 93 jne 1a2e + link("C0", file); +- 1a34: 89 5c 24 04 mov %ebx,0x4(%esp) +- 1a38: c7 04 24 b1 49 00 00 movl $0x49b1,(%esp) +- 1a3f: e8 ae 24 00 00 call 3ef2 ++ 1a9b: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 1a9f: c7 04 24 81 4a 00 00 movl $0x4a81,(%esp) ++ 1aa6: e8 17 25 00 00 call 3fc2 + exit(0); +- 1a44: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1a4b: e8 42 24 00 00 call 3e92 +- link("C0", file); +- 1a50: 89 5c 24 04 mov %ebx,0x4(%esp) +- for(i = 0; i < 40; i++){ +- 1a54: 83 c6 01 add $0x1,%esi ++ 1aab: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1ab2: e8 ab 24 00 00 call 3f62 ++ 1ab7: 90 nop + link("C0", file); +- 1a57: c7 04 24 b1 49 00 00 movl $0x49b1,(%esp) +- 1a5e: e8 8f 24 00 00 call 3ef2 +- wait(); +- 1a63: e8 32 24 00 00 call 3e9a +- for(i = 0; i < 40; i++){ +- 1a68: 83 fe 28 cmp $0x28,%esi +- 1a6b: 75 92 jne 19ff +- 1a6d: 8d 76 00 lea 0x0(%esi),%esi ++ 1ab8: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 1abc: c7 04 24 81 4a 00 00 movl $0x4a81,(%esp) ++ 1ac3: e8 fa 24 00 00 call 3fc2 ++ 1ac8: eb 88 jmp 1a52 ++ 1aca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + memset(fa, 0, sizeof(fa)); +- 1a70: 8d 45 c0 lea -0x40(%ebp),%eax +- 1a73: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp) +- 1a7a: 00 +- 1a7b: 8d 7d b0 lea -0x50(%ebp),%edi +- 1a7e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1a85: 00 +- 1a86: 89 04 24 mov %eax,(%esp) +- 1a89: e8 92 22 00 00 call 3d20 ++ 1ad0: 8d 45 c0 lea -0x40(%ebp),%eax ++ 1ad3: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp) ++ 1ada: 00 ++ 1adb: 8d 7d b0 lea -0x50(%ebp),%edi ++ 1ade: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1ae5: 00 ++ 1ae6: 89 04 24 mov %eax,(%esp) ++ 1ae9: e8 02 23 00 00 call 3df0 + fd = open(".", 0); +- 1a8e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1a95: 00 +- 1a96: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) +- 1a9d: e8 30 24 00 00 call 3ed2 ++ 1aee: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1af5: 00 ++ 1af6: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) ++ 1afd: e8 a0 24 00 00 call 3fa2 + n = 0; +- 1aa2: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp) ++ 1b02: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp) + fd = open(".", 0); +- 1aa9: 89 c6 mov %eax,%esi +- 1aab: 90 nop +- 1aac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- while(read(fd, &de, sizeof(de)) > 0){ +- 1ab0: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) +- 1ab7: 00 +- 1ab8: 89 7c 24 04 mov %edi,0x4(%esp) +- 1abc: 89 34 24 mov %esi,(%esp) +- 1abf: e8 e6 23 00 00 call 3eaa +- 1ac4: 85 c0 test %eax,%eax +- 1ac6: 7e 40 jle 1b08 +- if(de.inum == 0) +- 1ac8: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp) +- 1acd: 74 e1 je 1ab0 +- if(de.name[0] == 'C' && de.name[2] == '\0'){ +- 1acf: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp) +- 1ad3: 75 db jne 1ab0 +- 1ad5: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp) +- 1ad9: 75 d5 jne 1ab0 ++ 1b09: 89 c6 mov %eax,%esi ++ 1b0b: 90 nop ++ 1b0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ while (read(fd, &de, sizeof(de)) > 0) ++ 1b10: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) ++ 1b17: 00 ++ 1b18: 89 7c 24 04 mov %edi,0x4(%esp) ++ 1b1c: 89 34 24 mov %esi,(%esp) ++ 1b1f: e8 56 24 00 00 call 3f7a ++ 1b24: 85 c0 test %eax,%eax ++ 1b26: 7e 40 jle 1b68 ++ if (de.inum == 0) ++ 1b28: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp) ++ 1b2d: 74 e1 je 1b10 ++ if (de.name[0] == 'C' && de.name[2] == '\0') ++ 1b2f: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp) ++ 1b33: 75 db jne 1b10 ++ 1b35: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp) ++ 1b39: 75 d5 jne 1b10 + i = de.name[1] - '0'; +- 1adb: 0f be 45 b3 movsbl -0x4d(%ebp),%eax +- 1adf: 83 e8 30 sub $0x30,%eax +- if(i < 0 || i >= sizeof(fa)){ +- 1ae2: 83 f8 27 cmp $0x27,%eax +- 1ae5: 0f 87 6d 01 00 00 ja 1c58 +- if(fa[i]){ +- 1aeb: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1) +- 1af0: 0f 85 a2 01 00 00 jne 1c98 ++ 1b3b: 0f be 45 b3 movsbl -0x4d(%ebp),%eax ++ 1b3f: 83 e8 30 sub $0x30,%eax ++ if (i < 0 || i >= sizeof(fa)) ++ 1b42: 83 f8 27 cmp $0x27,%eax ++ 1b45: 0f 87 7d 01 00 00 ja 1cc8 ++ if (fa[i]) ++ 1b4b: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1) ++ 1b50: 0f 85 b2 01 00 00 jne 1d08 + fa[i] = 1; +- 1af6: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1) ++ 1b56: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1) + n++; +- 1afb: 83 45 a4 01 addl $0x1,-0x5c(%ebp) +- 1aff: eb af jmp 1ab0 +- 1b01: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 1b5b: 83 45 a4 01 addl $0x1,-0x5c(%ebp) ++ 1b5f: eb af jmp 1b10 ++ 1b61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + close(fd); +- 1b08: 89 34 24 mov %esi,(%esp) +- 1b0b: e8 aa 23 00 00 call 3eba +- if(n != 40){ +- 1b10: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp) +- 1b14: 0f 85 5e 01 00 00 jne 1c78 +- 1b1a: 31 f6 xor %esi,%esi +- 1b1c: eb 7f jmp 1b9d +- 1b1e: 66 90 xchg %ax,%ax +- ((i % 3) == 1 && pid != 0)){ +- 1b20: 85 ff test %edi,%edi +- 1b22: 0f 84 ae 00 00 00 je 1bd6 ++ 1b68: 89 34 24 mov %esi,(%esp) ++ 1b6b: e8 1a 24 00 00 call 3f8a ++ if (n != 40) ++ 1b70: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp) ++ 1b74: 0f 85 6e 01 00 00 jne 1ce8 ++ 1b7a: 31 f6 xor %esi,%esi ++ 1b7c: e9 8b 00 00 00 jmp 1c0c ++ 1b81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ ((i % 3) == 1 && pid != 0)) ++ 1b88: 85 ff test %edi,%edi ++ 1b8a: 0f 84 b5 00 00 00 je 1c45 + close(open(file, 0)); +- 1b28: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1b2f: 00 +- 1b30: 89 1c 24 mov %ebx,(%esp) +- 1b33: e8 9a 23 00 00 call 3ed2 +- 1b38: 89 04 24 mov %eax,(%esp) +- 1b3b: e8 7a 23 00 00 call 3eba ++ 1b90: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1b97: 00 ++ 1b98: 89 1c 24 mov %ebx,(%esp) ++ 1b9b: e8 02 24 00 00 call 3fa2 ++ 1ba0: 89 04 24 mov %eax,(%esp) ++ 1ba3: e8 e2 23 00 00 call 3f8a + close(open(file, 0)); +- 1b40: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1b47: 00 +- 1b48: 89 1c 24 mov %ebx,(%esp) +- 1b4b: e8 82 23 00 00 call 3ed2 +- 1b50: 89 04 24 mov %eax,(%esp) +- 1b53: e8 62 23 00 00 call 3eba ++ 1ba8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1baf: 00 ++ 1bb0: 89 1c 24 mov %ebx,(%esp) ++ 1bb3: e8 ea 23 00 00 call 3fa2 ++ 1bb8: 89 04 24 mov %eax,(%esp) ++ 1bbb: e8 ca 23 00 00 call 3f8a + close(open(file, 0)); +- 1b58: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1b5f: 00 +- 1b60: 89 1c 24 mov %ebx,(%esp) +- 1b63: e8 6a 23 00 00 call 3ed2 +- 1b68: 89 04 24 mov %eax,(%esp) +- 1b6b: e8 4a 23 00 00 call 3eba ++ 1bc0: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1bc7: 00 ++ 1bc8: 89 1c 24 mov %ebx,(%esp) ++ 1bcb: e8 d2 23 00 00 call 3fa2 ++ 1bd0: 89 04 24 mov %eax,(%esp) ++ 1bd3: e8 b2 23 00 00 call 3f8a + close(open(file, 0)); +- 1b70: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 1b77: 00 +- 1b78: 89 1c 24 mov %ebx,(%esp) +- 1b7b: e8 52 23 00 00 call 3ed2 +- 1b80: 89 04 24 mov %eax,(%esp) +- 1b83: e8 32 23 00 00 call 3eba +- if(pid == 0) +- 1b88: 85 ff test %edi,%edi +- 1b8a: 0f 84 b4 fe ff ff je 1a44 +- for(i = 0; i < 40; i++){ +- 1b90: 83 c6 01 add $0x1,%esi +- wait(); +- 1b93: e8 02 23 00 00 call 3e9a +- for(i = 0; i < 40; i++){ +- 1b98: 83 fe 28 cmp $0x28,%esi +- 1b9b: 74 5b je 1bf8 +- 1b9d: 8d 46 30 lea 0x30(%esi),%eax +- 1ba0: 88 45 ae mov %al,-0x52(%ebp) ++ 1bd8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 1bdf: 00 ++ 1be0: 89 1c 24 mov %ebx,(%esp) ++ 1be3: e8 ba 23 00 00 call 3fa2 ++ 1be8: 89 04 24 mov %eax,(%esp) ++ 1beb: e8 9a 23 00 00 call 3f8a ++ if (pid == 0) ++ 1bf0: 85 ff test %edi,%edi ++ 1bf2: 0f 84 b3 fe ff ff je 1aab ++ wait(0); ++ 1bf8: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ for (i = 0; i < 40; i++) ++ 1bff: 83 c6 01 add $0x1,%esi ++ wait(0); ++ 1c02: e8 63 23 00 00 call 3f6a ++ for (i = 0; i < 40; i++) ++ 1c07: 83 fe 28 cmp $0x28,%esi ++ 1c0a: 74 5c je 1c68 ++ 1c0c: 8d 46 30 lea 0x30(%esi),%eax ++ 1c0f: 88 45 ae mov %al,-0x52(%ebp) + pid = fork(); +- 1ba3: e8 e2 22 00 00 call 3e8a +- if(pid < 0){ +- 1ba8: 85 c0 test %eax,%eax ++ 1c12: e8 43 23 00 00 call 3f5a ++ if (pid < 0) ++ 1c17: 85 c0 test %eax,%eax + pid = fork(); +- 1baa: 89 c7 mov %eax,%edi +- if(pid < 0){ +- 1bac: 78 66 js 1c14 +- if(((i % 3) == 0 && pid == 0) || +- 1bae: b8 56 55 55 55 mov $0x55555556,%eax +- 1bb3: f7 ee imul %esi +- 1bb5: 89 f0 mov %esi,%eax +- 1bb7: c1 f8 1f sar $0x1f,%eax +- 1bba: 29 c2 sub %eax,%edx +- 1bbc: 8d 04 52 lea (%edx,%edx,2),%eax +- 1bbf: 89 f2 mov %esi,%edx +- 1bc1: 29 c2 sub %eax,%edx +- 1bc3: 89 d0 mov %edx,%eax +- 1bc5: 09 f8 or %edi,%eax +- 1bc7: 0f 84 5b ff ff ff je 1b28 +- 1bcd: 83 fa 01 cmp $0x1,%edx +- 1bd0: 0f 84 4a ff ff ff je 1b20 ++ 1c19: 89 c7 mov %eax,%edi ++ if (pid < 0) ++ 1c1b: 78 67 js 1c84 ++ if (((i % 3) == 0 && pid == 0) || ++ 1c1d: b8 56 55 55 55 mov $0x55555556,%eax ++ 1c22: f7 ee imul %esi ++ 1c24: 89 f0 mov %esi,%eax ++ 1c26: c1 f8 1f sar $0x1f,%eax ++ 1c29: 29 c2 sub %eax,%edx ++ 1c2b: 8d 04 52 lea (%edx,%edx,2),%eax ++ 1c2e: 89 f2 mov %esi,%edx ++ 1c30: 29 c2 sub %eax,%edx ++ 1c32: 89 d0 mov %edx,%eax ++ 1c34: 09 f8 or %edi,%eax ++ 1c36: 0f 84 54 ff ff ff je 1b90 ++ 1c3c: 83 fa 01 cmp $0x1,%edx ++ 1c3f: 0f 84 43 ff ff ff je 1b88 + unlink(file); +- 1bd6: 89 1c 24 mov %ebx,(%esp) +- 1bd9: e8 04 23 00 00 call 3ee2 ++ 1c45: 89 1c 24 mov %ebx,(%esp) ++ 1c48: e8 65 23 00 00 call 3fb2 + unlink(file); +- 1bde: 89 1c 24 mov %ebx,(%esp) +- 1be1: e8 fc 22 00 00 call 3ee2 ++ 1c4d: 89 1c 24 mov %ebx,(%esp) ++ 1c50: e8 5d 23 00 00 call 3fb2 + unlink(file); +- 1be6: 89 1c 24 mov %ebx,(%esp) +- 1be9: e8 f4 22 00 00 call 3ee2 ++ 1c55: 89 1c 24 mov %ebx,(%esp) ++ 1c58: e8 55 23 00 00 call 3fb2 + unlink(file); +- 1bee: 89 1c 24 mov %ebx,(%esp) +- 1bf1: e8 ec 22 00 00 call 3ee2 +- 1bf6: eb 90 jmp 1b88 ++ 1c5d: 89 1c 24 mov %ebx,(%esp) ++ 1c60: e8 4d 23 00 00 call 3fb2 ++ 1c65: eb 89 jmp 1bf0 ++ 1c67: 90 nop + printf(1, "concreate ok\n"); +- 1bf8: c7 44 24 04 06 4a 00 movl $0x4a06,0x4(%esp) +- 1bff: 00 +- 1c00: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1c07: e8 d4 23 00 00 call 3fe0 ++ 1c68: c7 44 24 04 d6 4a 00 movl $0x4ad6,0x4(%esp) ++ 1c6f: 00 ++ 1c70: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1c77: e8 34 24 00 00 call 40b0 + } +- 1c0c: 83 c4 5c add $0x5c,%esp +- 1c0f: 5b pop %ebx +- 1c10: 5e pop %esi +- 1c11: 5f pop %edi +- 1c12: 5d pop %ebp +- 1c13: c3 ret ++ 1c7c: 83 c4 5c add $0x5c,%esp ++ 1c7f: 5b pop %ebx ++ 1c80: 5e pop %esi ++ 1c81: 5f pop %edi ++ 1c82: 5d pop %ebp ++ 1c83: c3 ret + printf(1, "fork failed\n"); +- 1c14: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 1c1b: 00 +- 1c1c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1c23: e8 b8 23 00 00 call 3fe0 ++ 1c84: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 1c8b: 00 ++ 1c8c: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1c93: e8 18 24 00 00 call 40b0 + exit(0); +- 1c28: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1c2f: e8 5e 22 00 00 call 3e92 ++ 1c98: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1c9f: e8 be 22 00 00 call 3f62 + printf(1, "concreate create %s failed\n", file); +- 1c34: 89 5c 24 08 mov %ebx,0x8(%esp) +- 1c38: c7 44 24 04 b4 49 00 movl $0x49b4,0x4(%esp) +- 1c3f: 00 +- 1c40: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1c47: e8 94 23 00 00 call 3fe0 ++ 1ca4: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 1ca8: c7 44 24 04 84 4a 00 movl $0x4a84,0x4(%esp) ++ 1caf: 00 ++ 1cb0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1cb7: e8 f4 23 00 00 call 40b0 + exit(0); +- 1c4c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1c53: e8 3a 22 00 00 call 3e92 ++ 1cbc: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1cc3: e8 9a 22 00 00 call 3f62 + printf(1, "concreate weird file %s\n", de.name); +- 1c58: 8d 45 b2 lea -0x4e(%ebp),%eax +- 1c5b: 89 44 24 08 mov %eax,0x8(%esp) +- 1c5f: c7 44 24 04 d0 49 00 movl $0x49d0,0x4(%esp) +- 1c66: 00 +- 1c67: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1c6e: e8 6d 23 00 00 call 3fe0 +- 1c73: e9 cc fd ff ff jmp 1a44 ++ 1cc8: 8d 45 b2 lea -0x4e(%ebp),%eax ++ 1ccb: 89 44 24 08 mov %eax,0x8(%esp) ++ 1ccf: c7 44 24 04 a0 4a 00 movl $0x4aa0,0x4(%esp) ++ 1cd6: 00 ++ 1cd7: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1cde: e8 cd 23 00 00 call 40b0 ++ 1ce3: e9 c3 fd ff ff jmp 1aab + printf(1, "concreate not enough files in directory listing\n"); +- 1c78: c7 44 24 04 50 55 00 movl $0x5550,0x4(%esp) +- 1c7f: 00 +- 1c80: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1c87: e8 54 23 00 00 call 3fe0 ++ 1ce8: c7 44 24 04 20 56 00 movl $0x5620,0x4(%esp) ++ 1cef: 00 ++ 1cf0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1cf7: e8 b4 23 00 00 call 40b0 + exit(0); +- 1c8c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1c93: e8 fa 21 00 00 call 3e92 ++ 1cfc: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1d03: e8 5a 22 00 00 call 3f62 + printf(1, "concreate duplicate file %s\n", de.name); +- 1c98: 8d 45 b2 lea -0x4e(%ebp),%eax +- 1c9b: 89 44 24 08 mov %eax,0x8(%esp) +- 1c9f: c7 44 24 04 e9 49 00 movl $0x49e9,0x4(%esp) +- 1ca6: 00 +- 1ca7: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1cae: e8 2d 23 00 00 call 3fe0 ++ 1d08: 8d 45 b2 lea -0x4e(%ebp),%eax ++ 1d0b: 89 44 24 08 mov %eax,0x8(%esp) ++ 1d0f: c7 44 24 04 b9 4a 00 movl $0x4ab9,0x4(%esp) ++ 1d16: 00 ++ 1d17: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1d1e: e8 8d 23 00 00 call 40b0 + exit(0); +- 1cb3: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1cba: e8 d3 21 00 00 call 3e92 +- 1cbf: 90 nop ++ 1d23: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1d2a: e8 33 22 00 00 call 3f62 ++ 1d2f: 90 nop + +-00001cc0 : ++00001d30 : + { +- 1cc0: 55 push %ebp +- 1cc1: 89 e5 mov %esp,%ebp +- 1cc3: 57 push %edi +- 1cc4: 56 push %esi +- 1cc5: 53 push %ebx +- 1cc6: 83 ec 1c sub $0x1c,%esp ++ 1d30: 55 push %ebp ++ 1d31: 89 e5 mov %esp,%ebp ++ 1d33: 57 push %edi ++ 1d34: 56 push %esi ++ 1d35: 53 push %ebx ++ 1d36: 83 ec 1c sub $0x1c,%esp + printf(1, "linkunlink test\n"); +- 1cc9: c7 44 24 04 14 4a 00 movl $0x4a14,0x4(%esp) +- 1cd0: 00 +- 1cd1: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1cd8: e8 03 23 00 00 call 3fe0 ++ 1d39: c7 44 24 04 e4 4a 00 movl $0x4ae4,0x4(%esp) ++ 1d40: 00 ++ 1d41: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1d48: e8 63 23 00 00 call 40b0 + unlink("x"); +- 1cdd: c7 04 24 a1 4c 00 00 movl $0x4ca1,(%esp) +- 1ce4: e8 f9 21 00 00 call 3ee2 ++ 1d4d: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp) ++ 1d54: e8 59 22 00 00 call 3fb2 + pid = fork(); +- 1ce9: e8 9c 21 00 00 call 3e8a +- if(pid < 0){ +- 1cee: 85 c0 test %eax,%eax ++ 1d59: e8 fc 21 00 00 call 3f5a ++ if (pid < 0) ++ 1d5e: 85 c0 test %eax,%eax + pid = fork(); +- 1cf0: 89 45 e4 mov %eax,-0x1c(%ebp) +- if(pid < 0){ +- 1cf3: 0f 88 b8 00 00 00 js 1db1 ++ 1d60: 89 45 e4 mov %eax,-0x1c(%ebp) ++ if (pid < 0) ++ 1d63: 0f 88 c0 00 00 00 js 1e29 + unsigned int x = (pid ? 1 : 97); +- 1cf9: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp) +- 1cfd: bb 64 00 00 00 mov $0x64,%ebx +- if((x % 3) == 0){ +- 1d02: be ab aa aa aa mov $0xaaaaaaab,%esi ++ 1d69: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp) ++ 1d6d: bb 64 00 00 00 mov $0x64,%ebx ++ if ((x % 3) == 0) ++ 1d72: be ab aa aa aa mov $0xaaaaaaab,%esi + unsigned int x = (pid ? 1 : 97); +- 1d07: 19 ff sbb %edi,%edi +- 1d09: 83 e7 60 and $0x60,%edi +- 1d0c: 83 c7 01 add $0x1,%edi +- 1d0f: eb 1d jmp 1d2e +- 1d11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- } else if((x % 3) == 1){ +- 1d18: 83 fa 01 cmp $0x1,%edx +- 1d1b: 74 7b je 1d98 ++ 1d77: 19 ff sbb %edi,%edi ++ 1d79: 83 e7 60 and $0x60,%edi ++ 1d7c: 83 c7 01 add $0x1,%edi ++ 1d7f: eb 21 jmp 1da2 ++ 1d81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ else if ((x % 3) == 1) ++ 1d88: 83 fa 01 cmp $0x1,%edx ++ 1d8b: 0f 84 7f 00 00 00 je 1e10 + unlink("x"); +- 1d1d: c7 04 24 a1 4c 00 00 movl $0x4ca1,(%esp) +- 1d24: e8 b9 21 00 00 call 3ee2 +- for(i = 0; i < 100; i++){ +- 1d29: 83 eb 01 sub $0x1,%ebx +- 1d2c: 74 3c je 1d6a ++ 1d91: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp) ++ 1d98: e8 15 22 00 00 call 3fb2 ++ for (i = 0; i < 100; i++) ++ 1d9d: 83 eb 01 sub $0x1,%ebx ++ 1da0: 74 3c je 1dde + x = x * 1103515245 + 12345; +- 1d2e: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx +- 1d34: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi +- if((x % 3) == 0){ +- 1d3a: 89 f8 mov %edi,%eax +- 1d3c: f7 e6 mul %esi +- 1d3e: d1 ea shr %edx +- 1d40: 8d 04 52 lea (%edx,%edx,2),%eax +- 1d43: 89 fa mov %edi,%edx +- 1d45: 29 c2 sub %eax,%edx +- 1d47: 75 cf jne 1d18 ++ 1da2: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx ++ 1da8: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi ++ if ((x % 3) == 0) ++ 1dae: 89 f8 mov %edi,%eax ++ 1db0: f7 e6 mul %esi ++ 1db2: d1 ea shr %edx ++ 1db4: 8d 04 52 lea (%edx,%edx,2),%eax ++ 1db7: 89 fa mov %edi,%edx ++ 1db9: 29 c2 sub %eax,%edx ++ 1dbb: 75 cb jne 1d88 + close(open("x", O_RDWR | O_CREATE)); +- 1d49: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 1d50: 00 +- 1d51: c7 04 24 a1 4c 00 00 movl $0x4ca1,(%esp) +- 1d58: e8 75 21 00 00 call 3ed2 +- 1d5d: 89 04 24 mov %eax,(%esp) +- 1d60: e8 55 21 00 00 call 3eba +- for(i = 0; i < 100; i++){ +- 1d65: 83 eb 01 sub $0x1,%ebx +- 1d68: 75 c4 jne 1d2e +- if(pid) +- 1d6a: 8b 45 e4 mov -0x1c(%ebp),%eax +- 1d6d: 85 c0 test %eax,%eax +- 1d6f: 74 60 je 1dd1 +- wait(); +- 1d71: e8 24 21 00 00 call 3e9a ++ 1dbd: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 1dc4: 00 ++ 1dc5: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp) ++ 1dcc: e8 d1 21 00 00 call 3fa2 ++ 1dd1: 89 04 24 mov %eax,(%esp) ++ 1dd4: e8 b1 21 00 00 call 3f8a ++ for (i = 0; i < 100; i++) ++ 1dd9: 83 eb 01 sub $0x1,%ebx ++ 1ddc: 75 c4 jne 1da2 ++ if (pid) ++ 1dde: 8b 45 e4 mov -0x1c(%ebp),%eax ++ wait(0); ++ 1de1: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ if (pid) ++ 1de8: 85 c0 test %eax,%eax ++ 1dea: 74 5d je 1e49 ++ wait(0); ++ 1dec: e8 79 21 00 00 call 3f6a + printf(1, "linkunlink ok\n"); +- 1d76: c7 44 24 04 29 4a 00 movl $0x4a29,0x4(%esp) +- 1d7d: 00 +- 1d7e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1d85: e8 56 22 00 00 call 3fe0 ++ 1df1: c7 44 24 04 f9 4a 00 movl $0x4af9,0x4(%esp) ++ 1df8: 00 ++ 1df9: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1e00: e8 ab 22 00 00 call 40b0 + } +- 1d8a: 83 c4 1c add $0x1c,%esp +- 1d8d: 5b pop %ebx +- 1d8e: 5e pop %esi +- 1d8f: 5f pop %edi +- 1d90: 5d pop %ebp +- 1d91: c3 ret +- 1d92: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 1e05: 83 c4 1c add $0x1c,%esp ++ 1e08: 5b pop %ebx ++ 1e09: 5e pop %esi ++ 1e0a: 5f pop %edi ++ 1e0b: 5d pop %ebp ++ 1e0c: c3 ret ++ 1e0d: 8d 76 00 lea 0x0(%esi),%esi + link("cat", "x"); +- 1d98: c7 44 24 04 a1 4c 00 movl $0x4ca1,0x4(%esp) +- 1d9f: 00 +- 1da0: c7 04 24 25 4a 00 00 movl $0x4a25,(%esp) +- 1da7: e8 46 21 00 00 call 3ef2 +- 1dac: e9 78 ff ff ff jmp 1d29 ++ 1e10: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) ++ 1e17: 00 ++ 1e18: c7 04 24 f5 4a 00 00 movl $0x4af5,(%esp) ++ 1e1f: e8 9e 21 00 00 call 3fc2 ++ 1e24: e9 74 ff ff ff jmp 1d9d + printf(1, "fork failed\n"); +- 1db1: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 1db8: 00 +- 1db9: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1dc0: e8 1b 22 00 00 call 3fe0 ++ 1e29: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 1e30: 00 ++ 1e31: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1e38: e8 73 22 00 00 call 40b0 + exit(0); +- 1dc5: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1dcc: e8 c1 20 00 00 call 3e92 ++ 1e3d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1e44: e8 19 21 00 00 call 3f62 + exit(0); +- 1dd1: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1dd8: e8 b5 20 00 00 call 3e92 +- 1ddd: 8d 76 00 lea 0x0(%esi),%esi ++ 1e49: e8 14 21 00 00 call 3f62 ++ 1e4e: 66 90 xchg %ax,%ax + +-00001de0 : ++00001e50 : + { +- 1de0: 55 push %ebp +- 1de1: 89 e5 mov %esp,%ebp +- 1de3: 56 push %esi +- 1de4: 53 push %ebx +- 1de5: 83 ec 20 sub $0x20,%esp ++ 1e50: 55 push %ebp ++ 1e51: 89 e5 mov %esp,%ebp ++ 1e53: 56 push %esi ++ 1e54: 53 push %ebx ++ 1e55: 83 ec 20 sub $0x20,%esp + printf(1, "bigdir test\n"); +- 1de8: c7 44 24 04 38 4a 00 movl $0x4a38,0x4(%esp) +- 1def: 00 +- 1df0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1df7: e8 e4 21 00 00 call 3fe0 ++ 1e58: c7 44 24 04 08 4b 00 movl $0x4b08,0x4(%esp) ++ 1e5f: 00 ++ 1e60: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1e67: e8 44 22 00 00 call 40b0 + unlink("bd"); +- 1dfc: c7 04 24 45 4a 00 00 movl $0x4a45,(%esp) +- 1e03: e8 da 20 00 00 call 3ee2 ++ 1e6c: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) ++ 1e73: e8 3a 21 00 00 call 3fb2 + fd = open("bd", O_CREATE); +- 1e08: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 1e0f: 00 +- 1e10: c7 04 24 45 4a 00 00 movl $0x4a45,(%esp) +- 1e17: e8 b6 20 00 00 call 3ed2 +- if(fd < 0){ +- 1e1c: 85 c0 test %eax,%eax +- 1e1e: 0f 88 f4 00 00 00 js 1f18 ++ 1e78: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 1e7f: 00 ++ 1e80: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) ++ 1e87: e8 16 21 00 00 call 3fa2 ++ if (fd < 0) ++ 1e8c: 85 c0 test %eax,%eax ++ 1e8e: 0f 88 f4 00 00 00 js 1f88 + close(fd); +- 1e24: 89 04 24 mov %eax,(%esp) +- for(i = 0; i < 500; i++){ +- 1e27: 31 db xor %ebx,%ebx ++ 1e94: 89 04 24 mov %eax,(%esp) ++ for (i = 0; i < 500; i++) ++ 1e97: 31 db xor %ebx,%ebx + close(fd); +- 1e29: e8 8c 20 00 00 call 3eba +- 1e2e: 8d 75 ee lea -0x12(%ebp),%esi +- 1e31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 1e99: e8 ec 20 00 00 call 3f8a ++ 1e9e: 8d 75 ee lea -0x12(%ebp),%esi ++ 1ea1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + name[1] = '0' + (i / 64); +- 1e38: 89 d8 mov %ebx,%eax +- 1e3a: c1 f8 06 sar $0x6,%eax +- 1e3d: 83 c0 30 add $0x30,%eax +- 1e40: 88 45 ef mov %al,-0x11(%ebp) ++ 1ea8: 89 d8 mov %ebx,%eax ++ 1eaa: c1 f8 06 sar $0x6,%eax ++ 1ead: 83 c0 30 add $0x30,%eax ++ 1eb0: 88 45 ef mov %al,-0x11(%ebp) + name[2] = '0' + (i % 64); +- 1e43: 89 d8 mov %ebx,%eax +- 1e45: 83 e0 3f and $0x3f,%eax +- 1e48: 83 c0 30 add $0x30,%eax +- if(link("bd", name) != 0){ +- 1e4b: 89 74 24 04 mov %esi,0x4(%esp) +- 1e4f: c7 04 24 45 4a 00 00 movl $0x4a45,(%esp) ++ 1eb3: 89 d8 mov %ebx,%eax ++ 1eb5: 83 e0 3f and $0x3f,%eax ++ 1eb8: 83 c0 30 add $0x30,%eax ++ if (link("bd", name) != 0) ++ 1ebb: 89 74 24 04 mov %esi,0x4(%esp) ++ 1ebf: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) + name[0] = 'x'; +- 1e56: c6 45 ee 78 movb $0x78,-0x12(%ebp) ++ 1ec6: c6 45 ee 78 movb $0x78,-0x12(%ebp) + name[2] = '0' + (i % 64); +- 1e5a: 88 45 f0 mov %al,-0x10(%ebp) ++ 1eca: 88 45 f0 mov %al,-0x10(%ebp) + name[3] = '\0'; +- 1e5d: c6 45 f1 00 movb $0x0,-0xf(%ebp) +- if(link("bd", name) != 0){ +- 1e61: e8 8c 20 00 00 call 3ef2 +- 1e66: 85 c0 test %eax,%eax +- 1e68: 75 6e jne 1ed8 +- for(i = 0; i < 500; i++){ +- 1e6a: 83 c3 01 add $0x1,%ebx +- 1e6d: 81 fb f4 01 00 00 cmp $0x1f4,%ebx +- 1e73: 75 c3 jne 1e38 ++ 1ecd: c6 45 f1 00 movb $0x0,-0xf(%ebp) ++ if (link("bd", name) != 0) ++ 1ed1: e8 ec 20 00 00 call 3fc2 ++ 1ed6: 85 c0 test %eax,%eax ++ 1ed8: 75 6e jne 1f48 ++ for (i = 0; i < 500; i++) ++ 1eda: 83 c3 01 add $0x1,%ebx ++ 1edd: 81 fb f4 01 00 00 cmp $0x1f4,%ebx ++ 1ee3: 75 c3 jne 1ea8 + unlink("bd"); +- 1e75: c7 04 24 45 4a 00 00 movl $0x4a45,(%esp) +- for(i = 0; i < 500; i++){ +- 1e7c: 66 31 db xor %bx,%bx ++ 1ee5: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) ++ for (i = 0; i < 500; i++) ++ 1eec: 66 31 db xor %bx,%bx + unlink("bd"); +- 1e7f: e8 5e 20 00 00 call 3ee2 +- 1e84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 1eef: e8 be 20 00 00 call 3fb2 ++ 1ef4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + name[1] = '0' + (i / 64); +- 1e88: 89 d8 mov %ebx,%eax +- 1e8a: c1 f8 06 sar $0x6,%eax +- 1e8d: 83 c0 30 add $0x30,%eax +- 1e90: 88 45 ef mov %al,-0x11(%ebp) ++ 1ef8: 89 d8 mov %ebx,%eax ++ 1efa: c1 f8 06 sar $0x6,%eax ++ 1efd: 83 c0 30 add $0x30,%eax ++ 1f00: 88 45 ef mov %al,-0x11(%ebp) + name[2] = '0' + (i % 64); +- 1e93: 89 d8 mov %ebx,%eax +- 1e95: 83 e0 3f and $0x3f,%eax +- 1e98: 83 c0 30 add $0x30,%eax +- if(unlink(name) != 0){ +- 1e9b: 89 34 24 mov %esi,(%esp) ++ 1f03: 89 d8 mov %ebx,%eax ++ 1f05: 83 e0 3f and $0x3f,%eax ++ 1f08: 83 c0 30 add $0x30,%eax ++ if (unlink(name) != 0) ++ 1f0b: 89 34 24 mov %esi,(%esp) + name[0] = 'x'; +- 1e9e: c6 45 ee 78 movb $0x78,-0x12(%ebp) ++ 1f0e: c6 45 ee 78 movb $0x78,-0x12(%ebp) + name[2] = '0' + (i % 64); +- 1ea2: 88 45 f0 mov %al,-0x10(%ebp) ++ 1f12: 88 45 f0 mov %al,-0x10(%ebp) + name[3] = '\0'; +- 1ea5: c6 45 f1 00 movb $0x0,-0xf(%ebp) +- if(unlink(name) != 0){ +- 1ea9: e8 34 20 00 00 call 3ee2 +- 1eae: 85 c0 test %eax,%eax +- 1eb0: 75 46 jne 1ef8 +- for(i = 0; i < 500; i++){ +- 1eb2: 83 c3 01 add $0x1,%ebx +- 1eb5: 81 fb f4 01 00 00 cmp $0x1f4,%ebx +- 1ebb: 75 cb jne 1e88 ++ 1f15: c6 45 f1 00 movb $0x0,-0xf(%ebp) ++ if (unlink(name) != 0) ++ 1f19: e8 94 20 00 00 call 3fb2 ++ 1f1e: 85 c0 test %eax,%eax ++ 1f20: 75 46 jne 1f68 ++ for (i = 0; i < 500; i++) ++ 1f22: 83 c3 01 add $0x1,%ebx ++ 1f25: 81 fb f4 01 00 00 cmp $0x1f4,%ebx ++ 1f2b: 75 cb jne 1ef8 + printf(1, "bigdir ok\n"); +- 1ebd: c7 44 24 04 87 4a 00 movl $0x4a87,0x4(%esp) +- 1ec4: 00 +- 1ec5: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1ecc: e8 0f 21 00 00 call 3fe0 ++ 1f2d: c7 44 24 04 57 4b 00 movl $0x4b57,0x4(%esp) ++ 1f34: 00 ++ 1f35: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1f3c: e8 6f 21 00 00 call 40b0 + } +- 1ed1: 83 c4 20 add $0x20,%esp +- 1ed4: 5b pop %ebx +- 1ed5: 5e pop %esi +- 1ed6: 5d pop %ebp +- 1ed7: c3 ret ++ 1f41: 83 c4 20 add $0x20,%esp ++ 1f44: 5b pop %ebx ++ 1f45: 5e pop %esi ++ 1f46: 5d pop %ebp ++ 1f47: c3 ret + printf(1, "bigdir link failed\n"); +- 1ed8: c7 44 24 04 5e 4a 00 movl $0x4a5e,0x4(%esp) +- 1edf: 00 +- 1ee0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1ee7: e8 f4 20 00 00 call 3fe0 ++ 1f48: c7 44 24 04 2e 4b 00 movl $0x4b2e,0x4(%esp) ++ 1f4f: 00 ++ 1f50: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1f57: e8 54 21 00 00 call 40b0 + exit(0); +- 1eec: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1ef3: e8 9a 1f 00 00 call 3e92 ++ 1f5c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1f63: e8 fa 1f 00 00 call 3f62 + printf(1, "bigdir unlink failed"); +- 1ef8: c7 44 24 04 72 4a 00 movl $0x4a72,0x4(%esp) +- 1eff: 00 +- 1f00: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1f07: e8 d4 20 00 00 call 3fe0 ++ 1f68: c7 44 24 04 42 4b 00 movl $0x4b42,0x4(%esp) ++ 1f6f: 00 ++ 1f70: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1f77: e8 34 21 00 00 call 40b0 + exit(0); +- 1f0c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1f13: e8 7a 1f 00 00 call 3e92 ++ 1f7c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1f83: e8 da 1f 00 00 call 3f62 + printf(1, "bigdir create failed\n"); +- 1f18: c7 44 24 04 48 4a 00 movl $0x4a48,0x4(%esp) +- 1f1f: 00 +- 1f20: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1f27: e8 b4 20 00 00 call 3fe0 ++ 1f88: c7 44 24 04 18 4b 00 movl $0x4b18,0x4(%esp) ++ 1f8f: 00 ++ 1f90: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1f97: e8 14 21 00 00 call 40b0 + exit(0); +- 1f2c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 1f33: e8 5a 1f 00 00 call 3e92 +- 1f38: 90 nop +- 1f39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 1f9c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 1fa3: e8 ba 1f 00 00 call 3f62 ++ 1fa8: 90 nop ++ 1fa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00001f40 : ++00001fb0 : + { +- 1f40: 55 push %ebp +- 1f41: 89 e5 mov %esp,%ebp +- 1f43: 53 push %ebx +- 1f44: 83 ec 14 sub $0x14,%esp ++ 1fb0: 55 push %ebp ++ 1fb1: 89 e5 mov %esp,%ebp ++ 1fb3: 53 push %ebx ++ 1fb4: 83 ec 14 sub $0x14,%esp + printf(1, "subdir test\n"); +- 1f47: c7 44 24 04 92 4a 00 movl $0x4a92,0x4(%esp) +- 1f4e: 00 +- 1f4f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 1f56: e8 85 20 00 00 call 3fe0 ++ 1fb7: c7 44 24 04 62 4b 00 movl $0x4b62,0x4(%esp) ++ 1fbe: 00 ++ 1fbf: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 1fc6: e8 e5 20 00 00 call 40b0 + unlink("ff"); +- 1f5b: c7 04 24 1b 4b 00 00 movl $0x4b1b,(%esp) +- 1f62: e8 7b 1f 00 00 call 3ee2 +- if(mkdir("dd") != 0){ +- 1f67: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 1f6e: e8 87 1f 00 00 call 3efa +- 1f73: 85 c0 test %eax,%eax +- 1f75: 0f 85 a1 06 00 00 jne 261c ++ 1fcb: c7 04 24 eb 4b 00 00 movl $0x4beb,(%esp) ++ 1fd2: e8 db 1f 00 00 call 3fb2 ++ if (mkdir("dd") != 0) ++ 1fd7: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 1fde: e8 e7 1f 00 00 call 3fca ++ 1fe3: 85 c0 test %eax,%eax ++ 1fe5: 0f 85 a1 06 00 00 jne 268c + fd = open("dd/ff", O_CREATE | O_RDWR); +- 1f7b: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 1f82: 00 +- 1f83: c7 04 24 f1 4a 00 00 movl $0x4af1,(%esp) +- 1f8a: e8 43 1f 00 00 call 3ed2 +- if(fd < 0){ +- 1f8f: 85 c0 test %eax,%eax ++ 1feb: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 1ff2: 00 ++ 1ff3: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) ++ 1ffa: e8 a3 1f 00 00 call 3fa2 ++ if (fd < 0) ++ 1fff: 85 c0 test %eax,%eax + fd = open("dd/ff", O_CREATE | O_RDWR); +- 1f91: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 1f93: 0f 88 63 06 00 00 js 25fc ++ 2001: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 2003: 0f 88 63 06 00 00 js 266c + write(fd, "ff", 2); +- 1f99: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp) +- 1fa0: 00 +- 1fa1: c7 44 24 04 1b 4b 00 movl $0x4b1b,0x4(%esp) +- 1fa8: 00 +- 1fa9: 89 04 24 mov %eax,(%esp) +- 1fac: e8 01 1f 00 00 call 3eb2 ++ 2009: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp) ++ 2010: 00 ++ 2011: c7 44 24 04 eb 4b 00 movl $0x4beb,0x4(%esp) ++ 2018: 00 ++ 2019: 89 04 24 mov %eax,(%esp) ++ 201c: e8 61 1f 00 00 call 3f82 + close(fd); +- 1fb1: 89 1c 24 mov %ebx,(%esp) +- 1fb4: e8 01 1f 00 00 call 3eba +- if(unlink("dd") >= 0){ +- 1fb9: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 1fc0: e8 1d 1f 00 00 call 3ee2 +- 1fc5: 85 c0 test %eax,%eax +- 1fc7: 0f 89 0f 06 00 00 jns 25dc +- if(mkdir("/dd/dd") != 0){ +- 1fcd: c7 04 24 cc 4a 00 00 movl $0x4acc,(%esp) +- 1fd4: e8 21 1f 00 00 call 3efa +- 1fd9: 85 c0 test %eax,%eax +- 1fdb: 0f 85 db 05 00 00 jne 25bc ++ 2021: 89 1c 24 mov %ebx,(%esp) ++ 2024: e8 61 1f 00 00 call 3f8a ++ if (unlink("dd") >= 0) ++ 2029: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 2030: e8 7d 1f 00 00 call 3fb2 ++ 2035: 85 c0 test %eax,%eax ++ 2037: 0f 89 0f 06 00 00 jns 264c ++ if (mkdir("/dd/dd") != 0) ++ 203d: c7 04 24 9c 4b 00 00 movl $0x4b9c,(%esp) ++ 2044: e8 81 1f 00 00 call 3fca ++ 2049: 85 c0 test %eax,%eax ++ 204b: 0f 85 db 05 00 00 jne 262c + fd = open("dd/dd/ff", O_CREATE | O_RDWR); +- 1fe1: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 1fe8: 00 +- 1fe9: c7 04 24 ee 4a 00 00 movl $0x4aee,(%esp) +- 1ff0: e8 dd 1e 00 00 call 3ed2 +- if(fd < 0){ +- 1ff5: 85 c0 test %eax,%eax ++ 2051: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 2058: 00 ++ 2059: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) ++ 2060: e8 3d 1f 00 00 call 3fa2 ++ if (fd < 0) ++ 2065: 85 c0 test %eax,%eax + fd = open("dd/dd/ff", O_CREATE | O_RDWR); +- 1ff7: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 1ff9: 0f 88 5d 04 00 00 js 245c ++ 2067: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 2069: 0f 88 5d 04 00 00 js 24cc + write(fd, "FF", 2); +- 1fff: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp) +- 2006: 00 +- 2007: c7 44 24 04 0f 4b 00 movl $0x4b0f,0x4(%esp) +- 200e: 00 +- 200f: 89 04 24 mov %eax,(%esp) +- 2012: e8 9b 1e 00 00 call 3eb2 ++ 206f: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp) ++ 2076: 00 ++ 2077: c7 44 24 04 df 4b 00 movl $0x4bdf,0x4(%esp) ++ 207e: 00 ++ 207f: 89 04 24 mov %eax,(%esp) ++ 2082: e8 fb 1e 00 00 call 3f82 + close(fd); +- 2017: 89 1c 24 mov %ebx,(%esp) +- 201a: e8 9b 1e 00 00 call 3eba ++ 2087: 89 1c 24 mov %ebx,(%esp) ++ 208a: e8 fb 1e 00 00 call 3f8a + fd = open("dd/dd/../ff", 0); +- 201f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2026: 00 +- 2027: c7 04 24 12 4b 00 00 movl $0x4b12,(%esp) +- 202e: e8 9f 1e 00 00 call 3ed2 +- if(fd < 0){ +- 2033: 85 c0 test %eax,%eax ++ 208f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 2096: 00 ++ 2097: c7 04 24 e2 4b 00 00 movl $0x4be2,(%esp) ++ 209e: e8 ff 1e 00 00 call 3fa2 ++ if (fd < 0) ++ 20a3: 85 c0 test %eax,%eax + fd = open("dd/dd/../ff", 0); +- 2035: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 2037: 0f 88 ff 03 00 00 js 243c ++ 20a5: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 20a7: 0f 88 ff 03 00 00 js 24ac + cc = read(fd, buf, sizeof(buf)); +- 203d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) +- 2044: 00 +- 2045: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 204c: 00 +- 204d: 89 04 24 mov %eax,(%esp) +- 2050: e8 55 1e 00 00 call 3eaa +- if(cc != 2 || buf[0] != 'f'){ +- 2055: 83 f8 02 cmp $0x2,%eax +- 2058: 0f 85 fe 02 00 00 jne 235c +- 205e: 80 3d a0 8b 00 00 66 cmpb $0x66,0x8ba0 +- 2065: 0f 85 f1 02 00 00 jne 235c ++ 20ad: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) ++ 20b4: 00 ++ 20b5: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 20bc: 00 ++ 20bd: 89 04 24 mov %eax,(%esp) ++ 20c0: e8 b5 1e 00 00 call 3f7a ++ if (cc != 2 || buf[0] != 'f') ++ 20c5: 83 f8 02 cmp $0x2,%eax ++ 20c8: 0f 85 fe 02 00 00 jne 23cc ++ 20ce: 80 3d 80 8c 00 00 66 cmpb $0x66,0x8c80 ++ 20d5: 0f 85 f1 02 00 00 jne 23cc + close(fd); +- 206b: 89 1c 24 mov %ebx,(%esp) +- 206e: e8 47 1e 00 00 call 3eba +- if(link("dd/dd/ff", "dd/dd/ffff") != 0){ +- 2073: c7 44 24 04 52 4b 00 movl $0x4b52,0x4(%esp) +- 207a: 00 +- 207b: c7 04 24 ee 4a 00 00 movl $0x4aee,(%esp) +- 2082: e8 6b 1e 00 00 call 3ef2 +- 2087: 85 c0 test %eax,%eax +- 2089: 0f 85 0d 04 00 00 jne 249c +- if(unlink("dd/dd/ff") != 0){ +- 208f: c7 04 24 ee 4a 00 00 movl $0x4aee,(%esp) +- 2096: e8 47 1e 00 00 call 3ee2 +- 209b: 85 c0 test %eax,%eax +- 209d: 0f 85 f9 02 00 00 jne 239c +- if(open("dd/dd/ff", O_RDONLY) >= 0){ +- 20a3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 20aa: 00 +- 20ab: c7 04 24 ee 4a 00 00 movl $0x4aee,(%esp) +- 20b2: e8 1b 1e 00 00 call 3ed2 +- 20b7: 85 c0 test %eax,%eax +- 20b9: 0f 89 dd 04 00 00 jns 259c +- if(chdir("dd") != 0){ +- 20bf: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 20c6: e8 37 1e 00 00 call 3f02 +- 20cb: 85 c0 test %eax,%eax +- 20cd: 0f 85 a9 04 00 00 jne 257c +- if(chdir("dd/../../dd") != 0){ +- 20d3: c7 04 24 86 4b 00 00 movl $0x4b86,(%esp) +- 20da: e8 23 1e 00 00 call 3f02 +- 20df: 85 c0 test %eax,%eax +- 20e1: 0f 85 95 02 00 00 jne 237c +- if(chdir("dd/../../../dd") != 0){ +- 20e7: c7 04 24 ac 4b 00 00 movl $0x4bac,(%esp) +- 20ee: e8 0f 1e 00 00 call 3f02 +- 20f3: 85 c0 test %eax,%eax +- 20f5: 0f 85 81 02 00 00 jne 237c +- if(chdir("./..") != 0){ +- 20fb: c7 04 24 bb 4b 00 00 movl $0x4bbb,(%esp) +- 2102: e8 fb 1d 00 00 call 3f02 +- 2107: 85 c0 test %eax,%eax +- 2109: 0f 85 6d 03 00 00 jne 247c ++ 20db: 89 1c 24 mov %ebx,(%esp) ++ 20de: e8 a7 1e 00 00 call 3f8a ++ if (link("dd/dd/ff", "dd/dd/ffff") != 0) ++ 20e3: c7 44 24 04 22 4c 00 movl $0x4c22,0x4(%esp) ++ 20ea: 00 ++ 20eb: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) ++ 20f2: e8 cb 1e 00 00 call 3fc2 ++ 20f7: 85 c0 test %eax,%eax ++ 20f9: 0f 85 0d 04 00 00 jne 250c ++ if (unlink("dd/dd/ff") != 0) ++ 20ff: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) ++ 2106: e8 a7 1e 00 00 call 3fb2 ++ 210b: 85 c0 test %eax,%eax ++ 210d: 0f 85 f9 02 00 00 jne 240c ++ if (open("dd/dd/ff", O_RDONLY) >= 0) ++ 2113: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 211a: 00 ++ 211b: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) ++ 2122: e8 7b 1e 00 00 call 3fa2 ++ 2127: 85 c0 test %eax,%eax ++ 2129: 0f 89 dd 04 00 00 jns 260c ++ if (chdir("dd") != 0) ++ 212f: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 2136: e8 97 1e 00 00 call 3fd2 ++ 213b: 85 c0 test %eax,%eax ++ 213d: 0f 85 a9 04 00 00 jne 25ec ++ if (chdir("dd/../../dd") != 0) ++ 2143: c7 04 24 56 4c 00 00 movl $0x4c56,(%esp) ++ 214a: e8 83 1e 00 00 call 3fd2 ++ 214f: 85 c0 test %eax,%eax ++ 2151: 0f 85 95 02 00 00 jne 23ec ++ if (chdir("dd/../../../dd") != 0) ++ 2157: c7 04 24 7c 4c 00 00 movl $0x4c7c,(%esp) ++ 215e: e8 6f 1e 00 00 call 3fd2 ++ 2163: 85 c0 test %eax,%eax ++ 2165: 0f 85 81 02 00 00 jne 23ec ++ if (chdir("./..") != 0) ++ 216b: c7 04 24 8b 4c 00 00 movl $0x4c8b,(%esp) ++ 2172: e8 5b 1e 00 00 call 3fd2 ++ 2177: 85 c0 test %eax,%eax ++ 2179: 0f 85 6d 03 00 00 jne 24ec + fd = open("dd/dd/ffff", 0); +- 210f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2116: 00 +- 2117: c7 04 24 52 4b 00 00 movl $0x4b52,(%esp) +- 211e: e8 af 1d 00 00 call 3ed2 +- if(fd < 0){ +- 2123: 85 c0 test %eax,%eax ++ 217f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 2186: 00 ++ 2187: c7 04 24 22 4c 00 00 movl $0x4c22,(%esp) ++ 218e: e8 0f 1e 00 00 call 3fa2 ++ if (fd < 0) ++ 2193: 85 c0 test %eax,%eax + fd = open("dd/dd/ffff", 0); +- 2125: 89 c3 mov %eax,%ebx +- if(fd < 0){ +- 2127: 0f 88 6f 06 00 00 js 279c +- if(read(fd, buf, sizeof(buf)) != 2){ +- 212d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) +- 2134: 00 +- 2135: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 213c: 00 +- 213d: 89 04 24 mov %eax,(%esp) +- 2140: e8 65 1d 00 00 call 3eaa +- 2145: 83 f8 02 cmp $0x2,%eax +- 2148: 0f 85 2e 06 00 00 jne 277c ++ 2195: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 2197: 0f 88 6f 06 00 00 js 280c ++ if (read(fd, buf, sizeof(buf)) != 2) ++ 219d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) ++ 21a4: 00 ++ 21a5: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 21ac: 00 ++ 21ad: 89 04 24 mov %eax,(%esp) ++ 21b0: e8 c5 1d 00 00 call 3f7a ++ 21b5: 83 f8 02 cmp $0x2,%eax ++ 21b8: 0f 85 2e 06 00 00 jne 27ec + close(fd); +- 214e: 89 1c 24 mov %ebx,(%esp) +- 2151: e8 64 1d 00 00 call 3eba +- if(open("dd/dd/ff", O_RDONLY) >= 0){ +- 2156: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 215d: 00 +- 215e: c7 04 24 ee 4a 00 00 movl $0x4aee,(%esp) +- 2165: e8 68 1d 00 00 call 3ed2 +- 216a: 85 c0 test %eax,%eax +- 216c: 0f 89 6a 02 00 00 jns 23dc +- if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){ +- 2172: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 2179: 00 +- 217a: c7 04 24 06 4c 00 00 movl $0x4c06,(%esp) +- 2181: e8 4c 1d 00 00 call 3ed2 +- 2186: 85 c0 test %eax,%eax +- 2188: 0f 89 2e 02 00 00 jns 23bc +- if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){ +- 218e: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 2195: 00 +- 2196: c7 04 24 2b 4c 00 00 movl $0x4c2b,(%esp) +- 219d: e8 30 1d 00 00 call 3ed2 +- 21a2: 85 c0 test %eax,%eax +- 21a4: 0f 89 b2 03 00 00 jns 255c +- if(open("dd", O_CREATE) >= 0){ +- 21aa: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 21b1: 00 +- 21b2: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 21b9: e8 14 1d 00 00 call 3ed2 +- 21be: 85 c0 test %eax,%eax +- 21c0: 0f 89 76 03 00 00 jns 253c +- if(open("dd", O_RDWR) >= 0){ +- 21c6: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) ++ 21be: 89 1c 24 mov %ebx,(%esp) ++ 21c1: e8 c4 1d 00 00 call 3f8a ++ if (open("dd/dd/ff", O_RDONLY) >= 0) ++ 21c6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 21cd: 00 +- 21ce: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 21d5: e8 f8 1c 00 00 call 3ed2 ++ 21ce: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) ++ 21d5: e8 c8 1d 00 00 call 3fa2 + 21da: 85 c0 test %eax,%eax +- 21dc: 0f 89 3a 03 00 00 jns 251c +- if(open("dd", O_WRONLY) >= 0){ +- 21e2: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) ++ 21dc: 0f 89 6a 02 00 00 jns 244c ++ if (open("dd/ff/ff", O_CREATE | O_RDWR) >= 0) ++ 21e2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 21e9: 00 +- 21ea: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 21f1: e8 dc 1c 00 00 call 3ed2 ++ 21ea: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) ++ 21f1: e8 ac 1d 00 00 call 3fa2 + 21f6: 85 c0 test %eax,%eax +- 21f8: 0f 89 fe 02 00 00 jns 24fc +- if(link("dd/ff/ff", "dd/dd/xx") == 0){ +- 21fe: c7 44 24 04 9a 4c 00 movl $0x4c9a,0x4(%esp) ++ 21f8: 0f 89 2e 02 00 00 jns 242c ++ if (open("dd/xx/ff", O_CREATE | O_RDWR) >= 0) ++ 21fe: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 2205: 00 +- 2206: c7 04 24 06 4c 00 00 movl $0x4c06,(%esp) +- 220d: e8 e0 1c 00 00 call 3ef2 ++ 2206: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) ++ 220d: e8 90 1d 00 00 call 3fa2 + 2212: 85 c0 test %eax,%eax +- 2214: 0f 84 c2 02 00 00 je 24dc +- if(link("dd/xx/ff", "dd/dd/xx") == 0){ +- 221a: c7 44 24 04 9a 4c 00 movl $0x4c9a,0x4(%esp) ++ 2214: 0f 89 b2 03 00 00 jns 25cc ++ if (open("dd", O_CREATE) >= 0) ++ 221a: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 2221: 00 +- 2222: c7 04 24 2b 4c 00 00 movl $0x4c2b,(%esp) +- 2229: e8 c4 1c 00 00 call 3ef2 ++ 2222: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 2229: e8 74 1d 00 00 call 3fa2 + 222e: 85 c0 test %eax,%eax +- 2230: 0f 84 86 02 00 00 je 24bc +- if(link("dd/ff", "dd/dd/ffff") == 0){ +- 2236: c7 44 24 04 52 4b 00 movl $0x4b52,0x4(%esp) ++ 2230: 0f 89 76 03 00 00 jns 25ac ++ if (open("dd", O_RDWR) >= 0) ++ 2236: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 223d: 00 +- 223e: c7 04 24 f1 4a 00 00 movl $0x4af1,(%esp) +- 2245: e8 a8 1c 00 00 call 3ef2 ++ 223e: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 2245: e8 58 1d 00 00 call 3fa2 + 224a: 85 c0 test %eax,%eax +- 224c: 0f 84 ca 01 00 00 je 241c +- if(mkdir("dd/ff/ff") == 0){ +- 2252: c7 04 24 06 4c 00 00 movl $0x4c06,(%esp) +- 2259: e8 9c 1c 00 00 call 3efa +- 225e: 85 c0 test %eax,%eax +- 2260: 0f 84 96 01 00 00 je 23fc +- if(mkdir("dd/xx/ff") == 0){ +- 2266: c7 04 24 2b 4c 00 00 movl $0x4c2b,(%esp) +- 226d: e8 88 1c 00 00 call 3efa +- 2272: 85 c0 test %eax,%eax +- 2274: 0f 84 e2 04 00 00 je 275c +- if(mkdir("dd/dd/ffff") == 0){ +- 227a: c7 04 24 52 4b 00 00 movl $0x4b52,(%esp) +- 2281: e8 74 1c 00 00 call 3efa +- 2286: 85 c0 test %eax,%eax +- 2288: 0f 84 ae 04 00 00 je 273c +- if(unlink("dd/xx/ff") == 0){ +- 228e: c7 04 24 2b 4c 00 00 movl $0x4c2b,(%esp) +- 2295: e8 48 1c 00 00 call 3ee2 +- 229a: 85 c0 test %eax,%eax +- 229c: 0f 84 7a 04 00 00 je 271c +- if(unlink("dd/ff/ff") == 0){ +- 22a2: c7 04 24 06 4c 00 00 movl $0x4c06,(%esp) +- 22a9: e8 34 1c 00 00 call 3ee2 +- 22ae: 85 c0 test %eax,%eax +- 22b0: 0f 84 46 04 00 00 je 26fc +- if(chdir("dd/ff") == 0){ +- 22b6: c7 04 24 f1 4a 00 00 movl $0x4af1,(%esp) +- 22bd: e8 40 1c 00 00 call 3f02 +- 22c2: 85 c0 test %eax,%eax +- 22c4: 0f 84 12 04 00 00 je 26dc +- if(chdir("dd/xx") == 0){ +- 22ca: c7 04 24 9d 4c 00 00 movl $0x4c9d,(%esp) +- 22d1: e8 2c 1c 00 00 call 3f02 +- 22d6: 85 c0 test %eax,%eax +- 22d8: 0f 84 de 03 00 00 je 26bc +- if(unlink("dd/dd/ffff") != 0){ +- 22de: c7 04 24 52 4b 00 00 movl $0x4b52,(%esp) +- 22e5: e8 f8 1b 00 00 call 3ee2 +- 22ea: 85 c0 test %eax,%eax +- 22ec: 0f 85 aa 00 00 00 jne 239c +- if(unlink("dd/ff") != 0){ +- 22f2: c7 04 24 f1 4a 00 00 movl $0x4af1,(%esp) +- 22f9: e8 e4 1b 00 00 call 3ee2 +- 22fe: 85 c0 test %eax,%eax +- 2300: 0f 85 96 03 00 00 jne 269c +- if(unlink("dd") == 0){ +- 2306: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 230d: e8 d0 1b 00 00 call 3ee2 +- 2312: 85 c0 test %eax,%eax +- 2314: 0f 84 62 03 00 00 je 267c +- if(unlink("dd/dd") < 0){ +- 231a: c7 04 24 cd 4a 00 00 movl $0x4acd,(%esp) +- 2321: e8 bc 1b 00 00 call 3ee2 +- 2326: 85 c0 test %eax,%eax +- 2328: 0f 88 2e 03 00 00 js 265c +- if(unlink("dd") < 0){ +- 232e: c7 04 24 b8 4b 00 00 movl $0x4bb8,(%esp) +- 2335: e8 a8 1b 00 00 call 3ee2 +- 233a: 85 c0 test %eax,%eax +- 233c: 0f 88 fa 02 00 00 js 263c ++ 224c: 0f 89 3a 03 00 00 jns 258c ++ if (open("dd", O_WRONLY) >= 0) ++ 2252: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) ++ 2259: 00 ++ 225a: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 2261: e8 3c 1d 00 00 call 3fa2 ++ 2266: 85 c0 test %eax,%eax ++ 2268: 0f 89 fe 02 00 00 jns 256c ++ if (link("dd/ff/ff", "dd/dd/xx") == 0) ++ 226e: c7 44 24 04 6a 4d 00 movl $0x4d6a,0x4(%esp) ++ 2275: 00 ++ 2276: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) ++ 227d: e8 40 1d 00 00 call 3fc2 ++ 2282: 85 c0 test %eax,%eax ++ 2284: 0f 84 c2 02 00 00 je 254c ++ if (link("dd/xx/ff", "dd/dd/xx") == 0) ++ 228a: c7 44 24 04 6a 4d 00 movl $0x4d6a,0x4(%esp) ++ 2291: 00 ++ 2292: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) ++ 2299: e8 24 1d 00 00 call 3fc2 ++ 229e: 85 c0 test %eax,%eax ++ 22a0: 0f 84 86 02 00 00 je 252c ++ if (link("dd/ff", "dd/dd/ffff") == 0) ++ 22a6: c7 44 24 04 22 4c 00 movl $0x4c22,0x4(%esp) ++ 22ad: 00 ++ 22ae: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) ++ 22b5: e8 08 1d 00 00 call 3fc2 ++ 22ba: 85 c0 test %eax,%eax ++ 22bc: 0f 84 ca 01 00 00 je 248c ++ if (mkdir("dd/ff/ff") == 0) ++ 22c2: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) ++ 22c9: e8 fc 1c 00 00 call 3fca ++ 22ce: 85 c0 test %eax,%eax ++ 22d0: 0f 84 96 01 00 00 je 246c ++ if (mkdir("dd/xx/ff") == 0) ++ 22d6: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) ++ 22dd: e8 e8 1c 00 00 call 3fca ++ 22e2: 85 c0 test %eax,%eax ++ 22e4: 0f 84 e2 04 00 00 je 27cc ++ if (mkdir("dd/dd/ffff") == 0) ++ 22ea: c7 04 24 22 4c 00 00 movl $0x4c22,(%esp) ++ 22f1: e8 d4 1c 00 00 call 3fca ++ 22f6: 85 c0 test %eax,%eax ++ 22f8: 0f 84 ae 04 00 00 je 27ac ++ if (unlink("dd/xx/ff") == 0) ++ 22fe: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) ++ 2305: e8 a8 1c 00 00 call 3fb2 ++ 230a: 85 c0 test %eax,%eax ++ 230c: 0f 84 7a 04 00 00 je 278c ++ if (unlink("dd/ff/ff") == 0) ++ 2312: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) ++ 2319: e8 94 1c 00 00 call 3fb2 ++ 231e: 85 c0 test %eax,%eax ++ 2320: 0f 84 46 04 00 00 je 276c ++ if (chdir("dd/ff") == 0) ++ 2326: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) ++ 232d: e8 a0 1c 00 00 call 3fd2 ++ 2332: 85 c0 test %eax,%eax ++ 2334: 0f 84 12 04 00 00 je 274c ++ if (chdir("dd/xx") == 0) ++ 233a: c7 04 24 6d 4d 00 00 movl $0x4d6d,(%esp) ++ 2341: e8 8c 1c 00 00 call 3fd2 ++ 2346: 85 c0 test %eax,%eax ++ 2348: 0f 84 de 03 00 00 je 272c ++ if (unlink("dd/dd/ffff") != 0) ++ 234e: c7 04 24 22 4c 00 00 movl $0x4c22,(%esp) ++ 2355: e8 58 1c 00 00 call 3fb2 ++ 235a: 85 c0 test %eax,%eax ++ 235c: 0f 85 aa 00 00 00 jne 240c ++ if (unlink("dd/ff") != 0) ++ 2362: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) ++ 2369: e8 44 1c 00 00 call 3fb2 ++ 236e: 85 c0 test %eax,%eax ++ 2370: 0f 85 96 03 00 00 jne 270c ++ if (unlink("dd") == 0) ++ 2376: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 237d: e8 30 1c 00 00 call 3fb2 ++ 2382: 85 c0 test %eax,%eax ++ 2384: 0f 84 62 03 00 00 je 26ec ++ if (unlink("dd/dd") < 0) ++ 238a: c7 04 24 9d 4b 00 00 movl $0x4b9d,(%esp) ++ 2391: e8 1c 1c 00 00 call 3fb2 ++ 2396: 85 c0 test %eax,%eax ++ 2398: 0f 88 2e 03 00 00 js 26cc ++ if (unlink("dd") < 0) ++ 239e: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) ++ 23a5: e8 08 1c 00 00 call 3fb2 ++ 23aa: 85 c0 test %eax,%eax ++ 23ac: 0f 88 fa 02 00 00 js 26ac + printf(1, "subdir ok\n"); +- 2342: c7 44 24 04 9a 4d 00 movl $0x4d9a,0x4(%esp) +- 2349: 00 +- 234a: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2351: e8 8a 1c 00 00 call 3fe0 ++ 23b2: c7 44 24 04 6a 4e 00 movl $0x4e6a,0x4(%esp) ++ 23b9: 00 ++ 23ba: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 23c1: e8 ea 1c 00 00 call 40b0 + } +- 2356: 83 c4 14 add $0x14,%esp +- 2359: 5b pop %ebx +- 235a: 5d pop %ebp +- 235b: c3 ret ++ 23c6: 83 c4 14 add $0x14,%esp ++ 23c9: 5b pop %ebx ++ 23ca: 5d pop %ebp ++ 23cb: c3 ret + printf(1, "dd/dd/../ff wrong content\n"); +- 235c: c7 44 24 04 37 4b 00 movl $0x4b37,0x4(%esp) +- 2363: 00 +- 2364: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 236b: e8 70 1c 00 00 call 3fe0 ++ 23cc: c7 44 24 04 07 4c 00 movl $0x4c07,0x4(%esp) ++ 23d3: 00 ++ 23d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 23db: e8 d0 1c 00 00 call 40b0 + exit(0); +- 2370: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2377: e8 16 1b 00 00 call 3e92 ++ 23e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 23e7: e8 76 1b 00 00 call 3f62 + printf(1, "chdir dd/../../dd failed\n"); +- 237c: c7 44 24 04 92 4b 00 movl $0x4b92,0x4(%esp) +- 2383: 00 +- 2384: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 238b: e8 50 1c 00 00 call 3fe0 ++ 23ec: c7 44 24 04 62 4c 00 movl $0x4c62,0x4(%esp) ++ 23f3: 00 ++ 23f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 23fb: e8 b0 1c 00 00 call 40b0 + exit(0); +- 2390: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2397: e8 f6 1a 00 00 call 3e92 ++ 2400: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2407: e8 56 1b 00 00 call 3f62 + printf(1, "unlink dd/dd/ff failed\n"); +- 239c: c7 44 24 04 5d 4b 00 movl $0x4b5d,0x4(%esp) +- 23a3: 00 +- 23a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 23ab: e8 30 1c 00 00 call 3fe0 ++ 240c: c7 44 24 04 2d 4c 00 movl $0x4c2d,0x4(%esp) ++ 2413: 00 ++ 2414: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 241b: e8 90 1c 00 00 call 40b0 + exit(0); +- 23b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 23b7: e8 d6 1a 00 00 call 3e92 ++ 2420: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2427: e8 36 1b 00 00 call 3f62 + printf(1, "create dd/ff/ff succeeded!\n"); +- 23bc: c7 44 24 04 0f 4c 00 movl $0x4c0f,0x4(%esp) +- 23c3: 00 +- 23c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 23cb: e8 10 1c 00 00 call 3fe0 ++ 242c: c7 44 24 04 df 4c 00 movl $0x4cdf,0x4(%esp) ++ 2433: 00 ++ 2434: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 243b: e8 70 1c 00 00 call 40b0 + exit(0); +- 23d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 23d7: e8 b6 1a 00 00 call 3e92 ++ 2440: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2447: e8 16 1b 00 00 call 3f62 + printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); +- 23dc: c7 44 24 04 f4 55 00 movl $0x55f4,0x4(%esp) +- 23e3: 00 +- 23e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 23eb: e8 f0 1b 00 00 call 3fe0 ++ 244c: c7 44 24 04 c4 56 00 movl $0x56c4,0x4(%esp) ++ 2453: 00 ++ 2454: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 245b: e8 50 1c 00 00 call 40b0 + exit(0); +- 23f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 23f7: e8 96 1a 00 00 call 3e92 ++ 2460: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2467: e8 f6 1a 00 00 call 3f62 + printf(1, "mkdir dd/ff/ff succeeded!\n"); +- 23fc: c7 44 24 04 a3 4c 00 movl $0x4ca3,0x4(%esp) +- 2403: 00 +- 2404: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 240b: e8 d0 1b 00 00 call 3fe0 ++ 246c: c7 44 24 04 73 4d 00 movl $0x4d73,0x4(%esp) ++ 2473: 00 ++ 2474: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 247b: e8 30 1c 00 00 call 40b0 + exit(0); +- 2410: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2417: e8 76 1a 00 00 call 3e92 ++ 2480: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2487: e8 d6 1a 00 00 call 3f62 + printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); +- 241c: c7 44 24 04 64 56 00 movl $0x5664,0x4(%esp) +- 2423: 00 +- 2424: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 242b: e8 b0 1b 00 00 call 3fe0 ++ 248c: c7 44 24 04 34 57 00 movl $0x5734,0x4(%esp) ++ 2493: 00 ++ 2494: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 249b: e8 10 1c 00 00 call 40b0 + exit(0); +- 2430: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2437: e8 56 1a 00 00 call 3e92 ++ 24a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 24a7: e8 b6 1a 00 00 call 3f62 + printf(1, "open dd/dd/../ff failed\n"); +- 243c: c7 44 24 04 1e 4b 00 movl $0x4b1e,0x4(%esp) +- 2443: 00 +- 2444: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 244b: e8 90 1b 00 00 call 3fe0 ++ 24ac: c7 44 24 04 ee 4b 00 movl $0x4bee,0x4(%esp) ++ 24b3: 00 ++ 24b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 24bb: e8 f0 1b 00 00 call 40b0 + exit(0); +- 2450: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2457: e8 36 1a 00 00 call 3e92 ++ 24c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 24c7: e8 96 1a 00 00 call 3f62 + printf(1, "create dd/dd/ff failed\n"); +- 245c: c7 44 24 04 f7 4a 00 movl $0x4af7,0x4(%esp) +- 2463: 00 +- 2464: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 246b: e8 70 1b 00 00 call 3fe0 ++ 24cc: c7 44 24 04 c7 4b 00 movl $0x4bc7,0x4(%esp) ++ 24d3: 00 ++ 24d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 24db: e8 d0 1b 00 00 call 40b0 + exit(0); +- 2470: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2477: e8 16 1a 00 00 call 3e92 ++ 24e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 24e7: e8 76 1a 00 00 call 3f62 + printf(1, "chdir ./.. failed\n"); +- 247c: c7 44 24 04 c0 4b 00 movl $0x4bc0,0x4(%esp) +- 2483: 00 +- 2484: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 248b: e8 50 1b 00 00 call 3fe0 ++ 24ec: c7 44 24 04 90 4c 00 movl $0x4c90,0x4(%esp) ++ 24f3: 00 ++ 24f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 24fb: e8 b0 1b 00 00 call 40b0 + exit(0); +- 2490: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2497: e8 f6 19 00 00 call 3e92 ++ 2500: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2507: e8 56 1a 00 00 call 3f62 + printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); +- 249c: c7 44 24 04 ac 55 00 movl $0x55ac,0x4(%esp) +- 24a3: 00 +- 24a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 24ab: e8 30 1b 00 00 call 3fe0 ++ 250c: c7 44 24 04 7c 56 00 movl $0x567c,0x4(%esp) ++ 2513: 00 ++ 2514: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 251b: e8 90 1b 00 00 call 40b0 + exit(0); +- 24b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 24b7: e8 d6 19 00 00 call 3e92 ++ 2520: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2527: e8 36 1a 00 00 call 3f62 + printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); +- 24bc: c7 44 24 04 40 56 00 movl $0x5640,0x4(%esp) +- 24c3: 00 +- 24c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 24cb: e8 10 1b 00 00 call 3fe0 ++ 252c: c7 44 24 04 10 57 00 movl $0x5710,0x4(%esp) ++ 2533: 00 ++ 2534: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 253b: e8 70 1b 00 00 call 40b0 + exit(0); +- 24d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 24d7: e8 b6 19 00 00 call 3e92 ++ 2540: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2547: e8 16 1a 00 00 call 3f62 + printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); +- 24dc: c7 44 24 04 1c 56 00 movl $0x561c,0x4(%esp) +- 24e3: 00 +- 24e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 24eb: e8 f0 1a 00 00 call 3fe0 ++ 254c: c7 44 24 04 ec 56 00 movl $0x56ec,0x4(%esp) ++ 2553: 00 ++ 2554: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 255b: e8 50 1b 00 00 call 40b0 + exit(0); +- 24f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 24f7: e8 96 19 00 00 call 3e92 ++ 2560: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2567: e8 f6 19 00 00 call 3f62 + printf(1, "open dd wronly succeeded!\n"); +- 24fc: c7 44 24 04 7f 4c 00 movl $0x4c7f,0x4(%esp) +- 2503: 00 +- 2504: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 250b: e8 d0 1a 00 00 call 3fe0 ++ 256c: c7 44 24 04 4f 4d 00 movl $0x4d4f,0x4(%esp) ++ 2573: 00 ++ 2574: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 257b: e8 30 1b 00 00 call 40b0 + exit(0); +- 2510: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2517: e8 76 19 00 00 call 3e92 ++ 2580: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2587: e8 d6 19 00 00 call 3f62 + printf(1, "open dd rdwr succeeded!\n"); +- 251c: c7 44 24 04 66 4c 00 movl $0x4c66,0x4(%esp) +- 2523: 00 +- 2524: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 252b: e8 b0 1a 00 00 call 3fe0 ++ 258c: c7 44 24 04 36 4d 00 movl $0x4d36,0x4(%esp) ++ 2593: 00 ++ 2594: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 259b: e8 10 1b 00 00 call 40b0 + exit(0); +- 2530: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2537: e8 56 19 00 00 call 3e92 ++ 25a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 25a7: e8 b6 19 00 00 call 3f62 + printf(1, "create dd succeeded!\n"); +- 253c: c7 44 24 04 50 4c 00 movl $0x4c50,0x4(%esp) +- 2543: 00 +- 2544: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 254b: e8 90 1a 00 00 call 3fe0 ++ 25ac: c7 44 24 04 20 4d 00 movl $0x4d20,0x4(%esp) ++ 25b3: 00 ++ 25b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 25bb: e8 f0 1a 00 00 call 40b0 + exit(0); +- 2550: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2557: e8 36 19 00 00 call 3e92 ++ 25c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 25c7: e8 96 19 00 00 call 3f62 + printf(1, "create dd/xx/ff succeeded!\n"); +- 255c: c7 44 24 04 34 4c 00 movl $0x4c34,0x4(%esp) +- 2563: 00 +- 2564: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 256b: e8 70 1a 00 00 call 3fe0 ++ 25cc: c7 44 24 04 04 4d 00 movl $0x4d04,0x4(%esp) ++ 25d3: 00 ++ 25d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 25db: e8 d0 1a 00 00 call 40b0 + exit(0); +- 2570: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2577: e8 16 19 00 00 call 3e92 ++ 25e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 25e7: e8 76 19 00 00 call 3f62 + printf(1, "chdir dd failed\n"); +- 257c: c7 44 24 04 75 4b 00 movl $0x4b75,0x4(%esp) +- 2583: 00 +- 2584: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 258b: e8 50 1a 00 00 call 3fe0 ++ 25ec: c7 44 24 04 45 4c 00 movl $0x4c45,0x4(%esp) ++ 25f3: 00 ++ 25f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 25fb: e8 b0 1a 00 00 call 40b0 + exit(0); +- 2590: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2597: e8 f6 18 00 00 call 3e92 ++ 2600: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2607: e8 56 19 00 00 call 3f62 + printf(1, "open (unlinked) dd/dd/ff succeeded\n"); +- 259c: c7 44 24 04 d0 55 00 movl $0x55d0,0x4(%esp) +- 25a3: 00 +- 25a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 25ab: e8 30 1a 00 00 call 3fe0 ++ 260c: c7 44 24 04 a0 56 00 movl $0x56a0,0x4(%esp) ++ 2613: 00 ++ 2614: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 261b: e8 90 1a 00 00 call 40b0 + exit(0); +- 25b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 25b7: e8 d6 18 00 00 call 3e92 ++ 2620: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2627: e8 36 19 00 00 call 3f62 + printf(1, "subdir mkdir dd/dd failed\n"); +- 25bc: c7 44 24 04 d3 4a 00 movl $0x4ad3,0x4(%esp) +- 25c3: 00 +- 25c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 25cb: e8 10 1a 00 00 call 3fe0 ++ 262c: c7 44 24 04 a3 4b 00 movl $0x4ba3,0x4(%esp) ++ 2633: 00 ++ 2634: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 263b: e8 70 1a 00 00 call 40b0 + exit(0); +- 25d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 25d7: e8 b6 18 00 00 call 3e92 ++ 2640: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2647: e8 16 19 00 00 call 3f62 + printf(1, "unlink dd (non-empty dir) succeeded!\n"); +- 25dc: c7 44 24 04 84 55 00 movl $0x5584,0x4(%esp) +- 25e3: 00 +- 25e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 25eb: e8 f0 19 00 00 call 3fe0 ++ 264c: c7 44 24 04 54 56 00 movl $0x5654,0x4(%esp) ++ 2653: 00 ++ 2654: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 265b: e8 50 1a 00 00 call 40b0 + exit(0); +- 25f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 25f7: e8 96 18 00 00 call 3e92 ++ 2660: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2667: e8 f6 18 00 00 call 3f62 + printf(1, "create dd/ff failed\n"); +- 25fc: c7 44 24 04 b7 4a 00 movl $0x4ab7,0x4(%esp) +- 2603: 00 +- 2604: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 260b: e8 d0 19 00 00 call 3fe0 ++ 266c: c7 44 24 04 87 4b 00 movl $0x4b87,0x4(%esp) ++ 2673: 00 ++ 2674: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 267b: e8 30 1a 00 00 call 40b0 + exit(0); +- 2610: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2617: e8 76 18 00 00 call 3e92 ++ 2680: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2687: e8 d6 18 00 00 call 3f62 + printf(1, "subdir mkdir dd failed\n"); +- 261c: c7 44 24 04 9f 4a 00 movl $0x4a9f,0x4(%esp) +- 2623: 00 +- 2624: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 262b: e8 b0 19 00 00 call 3fe0 ++ 268c: c7 44 24 04 6f 4b 00 movl $0x4b6f,0x4(%esp) ++ 2693: 00 ++ 2694: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 269b: e8 10 1a 00 00 call 40b0 + exit(0); +- 2630: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2637: e8 56 18 00 00 call 3e92 ++ 26a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 26a7: e8 b6 18 00 00 call 3f62 + printf(1, "unlink dd failed\n"); +- 263c: c7 44 24 04 88 4d 00 movl $0x4d88,0x4(%esp) +- 2643: 00 +- 2644: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 264b: e8 90 19 00 00 call 3fe0 ++ 26ac: c7 44 24 04 58 4e 00 movl $0x4e58,0x4(%esp) ++ 26b3: 00 ++ 26b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 26bb: e8 f0 19 00 00 call 40b0 + exit(0); +- 2650: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2657: e8 36 18 00 00 call 3e92 ++ 26c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 26c7: e8 96 18 00 00 call 3f62 + printf(1, "unlink dd/dd failed\n"); +- 265c: c7 44 24 04 73 4d 00 movl $0x4d73,0x4(%esp) +- 2663: 00 +- 2664: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 266b: e8 70 19 00 00 call 3fe0 ++ 26cc: c7 44 24 04 43 4e 00 movl $0x4e43,0x4(%esp) ++ 26d3: 00 ++ 26d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 26db: e8 d0 19 00 00 call 40b0 + exit(0); +- 2670: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2677: e8 16 18 00 00 call 3e92 ++ 26e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 26e7: e8 76 18 00 00 call 3f62 + printf(1, "unlink non-empty dd succeeded!\n"); +- 267c: c7 44 24 04 88 56 00 movl $0x5688,0x4(%esp) +- 2683: 00 +- 2684: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 268b: e8 50 19 00 00 call 3fe0 ++ 26ec: c7 44 24 04 58 57 00 movl $0x5758,0x4(%esp) ++ 26f3: 00 ++ 26f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 26fb: e8 b0 19 00 00 call 40b0 + exit(0); +- 2690: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2697: e8 f6 17 00 00 call 3e92 ++ 2700: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2707: e8 56 18 00 00 call 3f62 + printf(1, "unlink dd/ff failed\n"); +- 269c: c7 44 24 04 5e 4d 00 movl $0x4d5e,0x4(%esp) +- 26a3: 00 +- 26a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 26ab: e8 30 19 00 00 call 3fe0 ++ 270c: c7 44 24 04 2e 4e 00 movl $0x4e2e,0x4(%esp) ++ 2713: 00 ++ 2714: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 271b: e8 90 19 00 00 call 40b0 + exit(0); +- 26b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 26b7: e8 d6 17 00 00 call 3e92 ++ 2720: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2727: e8 36 18 00 00 call 3f62 + printf(1, "chdir dd/xx succeeded!\n"); +- 26bc: c7 44 24 04 46 4d 00 movl $0x4d46,0x4(%esp) +- 26c3: 00 +- 26c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 26cb: e8 10 19 00 00 call 3fe0 ++ 272c: c7 44 24 04 16 4e 00 movl $0x4e16,0x4(%esp) ++ 2733: 00 ++ 2734: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 273b: e8 70 19 00 00 call 40b0 + exit(0); +- 26d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 26d7: e8 b6 17 00 00 call 3e92 ++ 2740: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2747: e8 16 18 00 00 call 3f62 + printf(1, "chdir dd/ff succeeded!\n"); +- 26dc: c7 44 24 04 2e 4d 00 movl $0x4d2e,0x4(%esp) +- 26e3: 00 +- 26e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 26eb: e8 f0 18 00 00 call 3fe0 ++ 274c: c7 44 24 04 fe 4d 00 movl $0x4dfe,0x4(%esp) ++ 2753: 00 ++ 2754: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 275b: e8 50 19 00 00 call 40b0 + exit(0); +- 26f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 26f7: e8 96 17 00 00 call 3e92 ++ 2760: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2767: e8 f6 17 00 00 call 3f62 + printf(1, "unlink dd/ff/ff succeeded!\n"); +- 26fc: c7 44 24 04 12 4d 00 movl $0x4d12,0x4(%esp) +- 2703: 00 +- 2704: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 270b: e8 d0 18 00 00 call 3fe0 ++ 276c: c7 44 24 04 e2 4d 00 movl $0x4de2,0x4(%esp) ++ 2773: 00 ++ 2774: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 277b: e8 30 19 00 00 call 40b0 + exit(0); +- 2710: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2717: e8 76 17 00 00 call 3e92 ++ 2780: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2787: e8 d6 17 00 00 call 3f62 + printf(1, "unlink dd/xx/ff succeeded!\n"); +- 271c: c7 44 24 04 f6 4c 00 movl $0x4cf6,0x4(%esp) +- 2723: 00 +- 2724: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 272b: e8 b0 18 00 00 call 3fe0 ++ 278c: c7 44 24 04 c6 4d 00 movl $0x4dc6,0x4(%esp) ++ 2793: 00 ++ 2794: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 279b: e8 10 19 00 00 call 40b0 + exit(0); +- 2730: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2737: e8 56 17 00 00 call 3e92 ++ 27a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 27a7: e8 b6 17 00 00 call 3f62 + printf(1, "mkdir dd/dd/ffff succeeded!\n"); +- 273c: c7 44 24 04 d9 4c 00 movl $0x4cd9,0x4(%esp) +- 2743: 00 +- 2744: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 274b: e8 90 18 00 00 call 3fe0 ++ 27ac: c7 44 24 04 a9 4d 00 movl $0x4da9,0x4(%esp) ++ 27b3: 00 ++ 27b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 27bb: e8 f0 18 00 00 call 40b0 + exit(0); +- 2750: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2757: e8 36 17 00 00 call 3e92 ++ 27c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 27c7: e8 96 17 00 00 call 3f62 + printf(1, "mkdir dd/xx/ff succeeded!\n"); +- 275c: c7 44 24 04 be 4c 00 movl $0x4cbe,0x4(%esp) +- 2763: 00 +- 2764: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 276b: e8 70 18 00 00 call 3fe0 ++ 27cc: c7 44 24 04 8e 4d 00 movl $0x4d8e,0x4(%esp) ++ 27d3: 00 ++ 27d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 27db: e8 d0 18 00 00 call 40b0 + exit(0); +- 2770: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2777: e8 16 17 00 00 call 3e92 ++ 27e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 27e7: e8 76 17 00 00 call 3f62 + printf(1, "read dd/dd/ffff wrong len\n"); +- 277c: c7 44 24 04 eb 4b 00 movl $0x4beb,0x4(%esp) +- 2783: 00 +- 2784: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 278b: e8 50 18 00 00 call 3fe0 ++ 27ec: c7 44 24 04 bb 4c 00 movl $0x4cbb,0x4(%esp) ++ 27f3: 00 ++ 27f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 27fb: e8 b0 18 00 00 call 40b0 + exit(0); +- 2790: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2797: e8 f6 16 00 00 call 3e92 ++ 2800: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2807: e8 56 17 00 00 call 3f62 + printf(1, "open dd/dd/ffff failed\n"); +- 279c: c7 44 24 04 d3 4b 00 movl $0x4bd3,0x4(%esp) +- 27a3: 00 +- 27a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 27ab: e8 30 18 00 00 call 3fe0 ++ 280c: c7 44 24 04 a3 4c 00 movl $0x4ca3,0x4(%esp) ++ 2813: 00 ++ 2814: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 281b: e8 90 18 00 00 call 40b0 + exit(0); +- 27b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 27b7: e8 d6 16 00 00 call 3e92 +- 27bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 2820: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2827: e8 36 17 00 00 call 3f62 ++ 282c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +-000027c0 : ++00002830 : + { +- 27c0: 55 push %ebp +- 27c1: 89 e5 mov %esp,%ebp +- 27c3: 56 push %esi +- 27c4: 53 push %ebx +- for(sz = 499; sz < 12*512; sz += 471){ +- 27c5: bb f3 01 00 00 mov $0x1f3,%ebx ++ 2830: 55 push %ebp ++ 2831: 89 e5 mov %esp,%ebp ++ 2833: 56 push %esi ++ 2834: 53 push %ebx ++ for (sz = 499; sz < 12 * 512; sz += 471) ++ 2835: bb f3 01 00 00 mov $0x1f3,%ebx + { +- 27ca: 83 ec 10 sub $0x10,%esp ++ 283a: 83 ec 10 sub $0x10,%esp + printf(1, "bigwrite test\n"); +- 27cd: c7 44 24 04 a5 4d 00 movl $0x4da5,0x4(%esp) +- 27d4: 00 +- 27d5: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 27dc: e8 ff 17 00 00 call 3fe0 ++ 283d: c7 44 24 04 75 4e 00 movl $0x4e75,0x4(%esp) ++ 2844: 00 ++ 2845: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 284c: e8 5f 18 00 00 call 40b0 + unlink("bigwrite"); +- 27e1: c7 04 24 b4 4d 00 00 movl $0x4db4,(%esp) +- 27e8: e8 f5 16 00 00 call 3ee2 +- 27ed: 8d 76 00 lea 0x0(%esi),%esi ++ 2851: c7 04 24 84 4e 00 00 movl $0x4e84,(%esp) ++ 2858: e8 55 17 00 00 call 3fb2 ++ 285d: 8d 76 00 lea 0x0(%esi),%esi + fd = open("bigwrite", O_CREATE | O_RDWR); +- 27f0: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 27f7: 00 +- 27f8: c7 04 24 b4 4d 00 00 movl $0x4db4,(%esp) +- 27ff: e8 ce 16 00 00 call 3ed2 +- if(fd < 0){ +- 2804: 85 c0 test %eax,%eax ++ 2860: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 2867: 00 ++ 2868: c7 04 24 84 4e 00 00 movl $0x4e84,(%esp) ++ 286f: e8 2e 17 00 00 call 3fa2 ++ if (fd < 0) ++ 2874: 85 c0 test %eax,%eax + fd = open("bigwrite", O_CREATE | O_RDWR); +- 2806: 89 c6 mov %eax,%esi +- if(fd < 0){ +- 2808: 0f 88 95 00 00 00 js 28a3 ++ 2876: 89 c6 mov %eax,%esi ++ if (fd < 0) ++ 2878: 0f 88 95 00 00 00 js 2913 + int cc = write(fd, buf, sz); +- 280e: 89 5c 24 08 mov %ebx,0x8(%esp) +- 2812: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 2819: 00 +- 281a: 89 04 24 mov %eax,(%esp) +- 281d: e8 90 16 00 00 call 3eb2 +- if(cc != sz){ +- 2822: 39 d8 cmp %ebx,%eax +- 2824: 75 55 jne 287b ++ 287e: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 2882: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 2889: 00 ++ 288a: 89 04 24 mov %eax,(%esp) ++ 288d: e8 f0 16 00 00 call 3f82 ++ if (cc != sz) ++ 2892: 39 d8 cmp %ebx,%eax ++ 2894: 75 55 jne 28eb + int cc = write(fd, buf, sz); +- 2826: 89 5c 24 08 mov %ebx,0x8(%esp) +- 282a: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 2831: 00 +- 2832: 89 34 24 mov %esi,(%esp) +- 2835: e8 78 16 00 00 call 3eb2 +- if(cc != sz){ +- 283a: 39 c3 cmp %eax,%ebx +- 283c: 75 3d jne 287b ++ 2896: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 289a: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 28a1: 00 ++ 28a2: 89 34 24 mov %esi,(%esp) ++ 28a5: e8 d8 16 00 00 call 3f82 ++ if (cc != sz) ++ 28aa: 39 c3 cmp %eax,%ebx ++ 28ac: 75 3d jne 28eb + close(fd); +- 283e: 89 34 24 mov %esi,(%esp) +- for(sz = 499; sz < 12*512; sz += 471){ +- 2841: 81 c3 d7 01 00 00 add $0x1d7,%ebx ++ 28ae: 89 34 24 mov %esi,(%esp) ++ for (sz = 499; sz < 12 * 512; sz += 471) ++ 28b1: 81 c3 d7 01 00 00 add $0x1d7,%ebx + close(fd); +- 2847: e8 6e 16 00 00 call 3eba ++ 28b7: e8 ce 16 00 00 call 3f8a + unlink("bigwrite"); +- 284c: c7 04 24 b4 4d 00 00 movl $0x4db4,(%esp) +- 2853: e8 8a 16 00 00 call 3ee2 +- for(sz = 499; sz < 12*512; sz += 471){ +- 2858: 81 fb 07 18 00 00 cmp $0x1807,%ebx +- 285e: 75 90 jne 27f0 ++ 28bc: c7 04 24 84 4e 00 00 movl $0x4e84,(%esp) ++ 28c3: e8 ea 16 00 00 call 3fb2 ++ for (sz = 499; sz < 12 * 512; sz += 471) ++ 28c8: 81 fb 07 18 00 00 cmp $0x1807,%ebx ++ 28ce: 75 90 jne 2860 + printf(1, "bigwrite ok\n"); +- 2860: c7 44 24 04 e7 4d 00 movl $0x4de7,0x4(%esp) +- 2867: 00 +- 2868: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 286f: e8 6c 17 00 00 call 3fe0 ++ 28d0: c7 44 24 04 b7 4e 00 movl $0x4eb7,0x4(%esp) ++ 28d7: 00 ++ 28d8: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 28df: e8 cc 17 00 00 call 40b0 + } +- 2874: 83 c4 10 add $0x10,%esp +- 2877: 5b pop %ebx +- 2878: 5e pop %esi +- 2879: 5d pop %ebp +- 287a: c3 ret ++ 28e4: 83 c4 10 add $0x10,%esp ++ 28e7: 5b pop %ebx ++ 28e8: 5e pop %esi ++ 28e9: 5d pop %ebp ++ 28ea: c3 ret + printf(1, "write(%d) ret %d\n", sz, cc); +- 287b: 89 44 24 0c mov %eax,0xc(%esp) +- 287f: 89 5c 24 08 mov %ebx,0x8(%esp) +- 2883: c7 44 24 04 d5 4d 00 movl $0x4dd5,0x4(%esp) +- 288a: 00 +- 288b: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2892: e8 49 17 00 00 call 3fe0 ++ 28eb: 89 44 24 0c mov %eax,0xc(%esp) ++ 28ef: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 28f3: c7 44 24 04 a5 4e 00 movl $0x4ea5,0x4(%esp) ++ 28fa: 00 ++ 28fb: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2902: e8 a9 17 00 00 call 40b0 + exit(0); +- 2897: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 289e: e8 ef 15 00 00 call 3e92 ++ 2907: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 290e: e8 4f 16 00 00 call 3f62 + printf(1, "cannot create bigwrite\n"); +- 28a3: c7 44 24 04 bd 4d 00 movl $0x4dbd,0x4(%esp) +- 28aa: 00 +- 28ab: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 28b2: e8 29 17 00 00 call 3fe0 ++ 2913: c7 44 24 04 8d 4e 00 movl $0x4e8d,0x4(%esp) ++ 291a: 00 ++ 291b: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2922: e8 89 17 00 00 call 40b0 + exit(0); +- 28b7: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 28be: e8 cf 15 00 00 call 3e92 +- 28c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 28c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 2927: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 292e: e8 2f 16 00 00 call 3f62 ++ 2933: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 2939: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000028d0 : ++00002940 : + { +- 28d0: 55 push %ebp +- 28d1: 89 e5 mov %esp,%ebp +- 28d3: 57 push %edi +- 28d4: 56 push %esi +- 28d5: 53 push %ebx +- 28d6: 83 ec 1c sub $0x1c,%esp ++ 2940: 55 push %ebp ++ 2941: 89 e5 mov %esp,%ebp ++ 2943: 57 push %edi ++ 2944: 56 push %esi ++ 2945: 53 push %ebx ++ 2946: 83 ec 1c sub $0x1c,%esp + printf(1, "bigfile test\n"); +- 28d9: c7 44 24 04 f4 4d 00 movl $0x4df4,0x4(%esp) +- 28e0: 00 +- 28e1: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 28e8: e8 f3 16 00 00 call 3fe0 ++ 2949: c7 44 24 04 c4 4e 00 movl $0x4ec4,0x4(%esp) ++ 2950: 00 ++ 2951: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2958: e8 53 17 00 00 call 40b0 + unlink("bigfile"); +- 28ed: c7 04 24 10 4e 00 00 movl $0x4e10,(%esp) +- 28f4: e8 e9 15 00 00 call 3ee2 ++ 295d: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) ++ 2964: e8 49 16 00 00 call 3fb2 + fd = open("bigfile", O_CREATE | O_RDWR); +- 28f9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 2900: 00 +- 2901: c7 04 24 10 4e 00 00 movl $0x4e10,(%esp) +- 2908: e8 c5 15 00 00 call 3ed2 +- if(fd < 0){ +- 290d: 85 c0 test %eax,%eax ++ 2969: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 2970: 00 ++ 2971: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) ++ 2978: e8 25 16 00 00 call 3fa2 ++ if (fd < 0) ++ 297d: 85 c0 test %eax,%eax + fd = open("bigfile", O_CREATE | O_RDWR); +- 290f: 89 c6 mov %eax,%esi +- if(fd < 0){ +- 2911: 0f 88 a2 01 00 00 js 2ab9 +- 2917: 31 db xor %ebx,%ebx +- 2919: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 297f: 89 c6 mov %eax,%esi ++ if (fd < 0) ++ 2981: 0f 88 a2 01 00 00 js 2b29 ++ 2987: 31 db xor %ebx,%ebx ++ 2989: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + memset(buf, i, 600); +- 2920: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp) +- 2927: 00 +- 2928: 89 5c 24 04 mov %ebx,0x4(%esp) +- 292c: c7 04 24 a0 8b 00 00 movl $0x8ba0,(%esp) +- 2933: e8 e8 13 00 00 call 3d20 +- if(write(fd, buf, 600) != 600){ +- 2938: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp) +- 293f: 00 +- 2940: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 2947: 00 +- 2948: 89 34 24 mov %esi,(%esp) +- 294b: e8 62 15 00 00 call 3eb2 +- 2950: 3d 58 02 00 00 cmp $0x258,%eax +- 2955: 0f 85 1e 01 00 00 jne 2a79 +- for(i = 0; i < 20; i++){ +- 295b: 83 c3 01 add $0x1,%ebx +- 295e: 83 fb 14 cmp $0x14,%ebx +- 2961: 75 bd jne 2920 ++ 2990: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp) ++ 2997: 00 ++ 2998: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 299c: c7 04 24 80 8c 00 00 movl $0x8c80,(%esp) ++ 29a3: e8 48 14 00 00 call 3df0 ++ if (write(fd, buf, 600) != 600) ++ 29a8: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp) ++ 29af: 00 ++ 29b0: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 29b7: 00 ++ 29b8: 89 34 24 mov %esi,(%esp) ++ 29bb: e8 c2 15 00 00 call 3f82 ++ 29c0: 3d 58 02 00 00 cmp $0x258,%eax ++ 29c5: 0f 85 1e 01 00 00 jne 2ae9 ++ for (i = 0; i < 20; i++) ++ 29cb: 83 c3 01 add $0x1,%ebx ++ 29ce: 83 fb 14 cmp $0x14,%ebx ++ 29d1: 75 bd jne 2990 + close(fd); +- 2963: 89 34 24 mov %esi,(%esp) +- 2966: e8 4f 15 00 00 call 3eba ++ 29d3: 89 34 24 mov %esi,(%esp) ++ 29d6: e8 af 15 00 00 call 3f8a + fd = open("bigfile", 0); +- 296b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2972: 00 +- 2973: c7 04 24 10 4e 00 00 movl $0x4e10,(%esp) +- 297a: e8 53 15 00 00 call 3ed2 +- if(fd < 0){ +- 297f: 85 c0 test %eax,%eax ++ 29db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 29e2: 00 ++ 29e3: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) ++ 29ea: e8 b3 15 00 00 call 3fa2 ++ if (fd < 0) ++ 29ef: 85 c0 test %eax,%eax + fd = open("bigfile", 0); +- 2981: 89 c6 mov %eax,%esi +- if(fd < 0){ +- 2983: 0f 88 10 01 00 00 js 2a99 +- 2989: 31 db xor %ebx,%ebx +- 298b: 31 ff xor %edi,%edi +- 298d: eb 2f jmp 29be +- 298f: 90 nop +- if(cc != 300){ +- 2990: 3d 2c 01 00 00 cmp $0x12c,%eax +- 2995: 0f 85 9e 00 00 00 jne 2a39 +- if(buf[0] != i/2 || buf[299] != i/2){ +- 299b: 0f be 05 a0 8b 00 00 movsbl 0x8ba0,%eax +- 29a2: 89 fa mov %edi,%edx +- 29a4: d1 fa sar %edx +- 29a6: 39 d0 cmp %edx,%eax +- 29a8: 75 6f jne 2a19 +- 29aa: 0f be 15 cb 8c 00 00 movsbl 0x8ccb,%edx +- 29b1: 39 d0 cmp %edx,%eax +- 29b3: 75 64 jne 2a19 ++ 29f1: 89 c6 mov %eax,%esi ++ if (fd < 0) ++ 29f3: 0f 88 10 01 00 00 js 2b09 ++ 29f9: 31 db xor %ebx,%ebx ++ 29fb: 31 ff xor %edi,%edi ++ 29fd: eb 2f jmp 2a2e ++ 29ff: 90 nop ++ if (cc != 300) ++ 2a00: 3d 2c 01 00 00 cmp $0x12c,%eax ++ 2a05: 0f 85 9e 00 00 00 jne 2aa9 ++ if (buf[0] != i / 2 || buf[299] != i / 2) ++ 2a0b: 0f be 05 80 8c 00 00 movsbl 0x8c80,%eax ++ 2a12: 89 fa mov %edi,%edx ++ 2a14: d1 fa sar %edx ++ 2a16: 39 d0 cmp %edx,%eax ++ 2a18: 75 6f jne 2a89 ++ 2a1a: 0f be 15 ab 8d 00 00 movsbl 0x8dab,%edx ++ 2a21: 39 d0 cmp %edx,%eax ++ 2a23: 75 64 jne 2a89 + total += cc; +- 29b5: 81 c3 2c 01 00 00 add $0x12c,%ebx +- for(i = 0; ; i++){ +- 29bb: 83 c7 01 add $0x1,%edi ++ 2a25: 81 c3 2c 01 00 00 add $0x12c,%ebx ++ for (i = 0;; i++) ++ 2a2b: 83 c7 01 add $0x1,%edi + cc = read(fd, buf, 300); +- 29be: c7 44 24 08 2c 01 00 movl $0x12c,0x8(%esp) +- 29c5: 00 +- 29c6: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 29cd: 00 +- 29ce: 89 34 24 mov %esi,(%esp) +- 29d1: e8 d4 14 00 00 call 3eaa +- if(cc < 0){ +- 29d6: 85 c0 test %eax,%eax +- 29d8: 78 7f js 2a59 +- if(cc == 0) +- 29da: 75 b4 jne 2990 ++ 2a2e: c7 44 24 08 2c 01 00 movl $0x12c,0x8(%esp) ++ 2a35: 00 ++ 2a36: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 2a3d: 00 ++ 2a3e: 89 34 24 mov %esi,(%esp) ++ 2a41: e8 34 15 00 00 call 3f7a ++ if (cc < 0) ++ 2a46: 85 c0 test %eax,%eax ++ 2a48: 78 7f js 2ac9 ++ if (cc == 0) ++ 2a4a: 75 b4 jne 2a00 + close(fd); +- 29dc: 89 34 24 mov %esi,(%esp) +- 29df: 90 nop +- 29e0: e8 d5 14 00 00 call 3eba +- if(total != 20*600){ +- 29e5: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx +- 29eb: 0f 85 e8 00 00 00 jne 2ad9 ++ 2a4c: 89 34 24 mov %esi,(%esp) ++ 2a4f: 90 nop ++ 2a50: e8 35 15 00 00 call 3f8a ++ if (total != 20 * 600) ++ 2a55: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx ++ 2a5b: 0f 85 e8 00 00 00 jne 2b49 + unlink("bigfile"); +- 29f1: c7 04 24 10 4e 00 00 movl $0x4e10,(%esp) +- 29f8: e8 e5 14 00 00 call 3ee2 ++ 2a61: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) ++ 2a68: e8 45 15 00 00 call 3fb2 + printf(1, "bigfile test ok\n"); +- 29fd: c7 44 24 04 9f 4e 00 movl $0x4e9f,0x4(%esp) +- 2a04: 00 +- 2a05: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2a0c: e8 cf 15 00 00 call 3fe0 ++ 2a6d: c7 44 24 04 6f 4f 00 movl $0x4f6f,0x4(%esp) ++ 2a74: 00 ++ 2a75: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2a7c: e8 2f 16 00 00 call 40b0 + } +- 2a11: 83 c4 1c add $0x1c,%esp +- 2a14: 5b pop %ebx +- 2a15: 5e pop %esi +- 2a16: 5f pop %edi +- 2a17: 5d pop %ebp +- 2a18: c3 ret ++ 2a81: 83 c4 1c add $0x1c,%esp ++ 2a84: 5b pop %ebx ++ 2a85: 5e pop %esi ++ 2a86: 5f pop %edi ++ 2a87: 5d pop %ebp ++ 2a88: c3 ret + printf(1, "read bigfile wrong data\n"); +- 2a19: c7 44 24 04 6c 4e 00 movl $0x4e6c,0x4(%esp) +- 2a20: 00 +- 2a21: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2a28: e8 b3 15 00 00 call 3fe0 ++ 2a89: c7 44 24 04 3c 4f 00 movl $0x4f3c,0x4(%esp) ++ 2a90: 00 ++ 2a91: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2a98: e8 13 16 00 00 call 40b0 + exit(0); +- 2a2d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2a34: e8 59 14 00 00 call 3e92 ++ 2a9d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2aa4: e8 b9 14 00 00 call 3f62 + printf(1, "short read bigfile\n"); +- 2a39: c7 44 24 04 58 4e 00 movl $0x4e58,0x4(%esp) +- 2a40: 00 +- 2a41: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2a48: e8 93 15 00 00 call 3fe0 ++ 2aa9: c7 44 24 04 28 4f 00 movl $0x4f28,0x4(%esp) ++ 2ab0: 00 ++ 2ab1: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2ab8: e8 f3 15 00 00 call 40b0 + exit(0); +- 2a4d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2a54: e8 39 14 00 00 call 3e92 ++ 2abd: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2ac4: e8 99 14 00 00 call 3f62 + printf(1, "read bigfile failed\n"); +- 2a59: c7 44 24 04 43 4e 00 movl $0x4e43,0x4(%esp) +- 2a60: 00 +- 2a61: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2a68: e8 73 15 00 00 call 3fe0 ++ 2ac9: c7 44 24 04 13 4f 00 movl $0x4f13,0x4(%esp) ++ 2ad0: 00 ++ 2ad1: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2ad8: e8 d3 15 00 00 call 40b0 + exit(0); +- 2a6d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2a74: e8 19 14 00 00 call 3e92 ++ 2add: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2ae4: e8 79 14 00 00 call 3f62 + printf(1, "write bigfile failed\n"); +- 2a79: c7 44 24 04 18 4e 00 movl $0x4e18,0x4(%esp) +- 2a80: 00 +- 2a81: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2a88: e8 53 15 00 00 call 3fe0 ++ 2ae9: c7 44 24 04 e8 4e 00 movl $0x4ee8,0x4(%esp) ++ 2af0: 00 ++ 2af1: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2af8: e8 b3 15 00 00 call 40b0 + exit(0); +- 2a8d: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2a94: e8 f9 13 00 00 call 3e92 ++ 2afd: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2b04: e8 59 14 00 00 call 3f62 + printf(1, "cannot open bigfile\n"); +- 2a99: c7 44 24 04 2e 4e 00 movl $0x4e2e,0x4(%esp) +- 2aa0: 00 +- 2aa1: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2aa8: e8 33 15 00 00 call 3fe0 ++ 2b09: c7 44 24 04 fe 4e 00 movl $0x4efe,0x4(%esp) ++ 2b10: 00 ++ 2b11: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2b18: e8 93 15 00 00 call 40b0 + exit(0); +- 2aad: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2ab4: e8 d9 13 00 00 call 3e92 ++ 2b1d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2b24: e8 39 14 00 00 call 3f62 + printf(1, "cannot create bigfile"); +- 2ab9: c7 44 24 04 02 4e 00 movl $0x4e02,0x4(%esp) +- 2ac0: 00 +- 2ac1: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2ac8: e8 13 15 00 00 call 3fe0 ++ 2b29: c7 44 24 04 d2 4e 00 movl $0x4ed2,0x4(%esp) ++ 2b30: 00 ++ 2b31: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2b38: e8 73 15 00 00 call 40b0 + exit(0); +- 2acd: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2ad4: e8 b9 13 00 00 call 3e92 ++ 2b3d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2b44: e8 19 14 00 00 call 3f62 + printf(1, "read bigfile wrong total\n"); +- 2ad9: c7 44 24 04 85 4e 00 movl $0x4e85,0x4(%esp) +- 2ae0: 00 +- 2ae1: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2ae8: e8 f3 14 00 00 call 3fe0 ++ 2b49: c7 44 24 04 55 4f 00 movl $0x4f55,0x4(%esp) ++ 2b50: 00 ++ 2b51: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2b58: e8 53 15 00 00 call 40b0 + exit(0); +- 2aed: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2af4: e8 99 13 00 00 call 3e92 +- 2af9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 2b5d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2b64: e8 f9 13 00 00 call 3f62 ++ 2b69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00002b00 : ++00002b70 : + { +- 2b00: 55 push %ebp +- 2b01: 89 e5 mov %esp,%ebp +- 2b03: 83 ec 18 sub $0x18,%esp ++ 2b70: 55 push %ebp ++ 2b71: 89 e5 mov %esp,%ebp ++ 2b73: 83 ec 18 sub $0x18,%esp + printf(1, "fourteen test\n"); +- 2b06: c7 44 24 04 b0 4e 00 movl $0x4eb0,0x4(%esp) +- 2b0d: 00 +- 2b0e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2b15: e8 c6 14 00 00 call 3fe0 +- if(mkdir("12345678901234") != 0){ +- 2b1a: c7 04 24 eb 4e 00 00 movl $0x4eeb,(%esp) +- 2b21: e8 d4 13 00 00 call 3efa +- 2b26: 85 c0 test %eax,%eax +- 2b28: 0f 85 92 00 00 00 jne 2bc0 +- if(mkdir("12345678901234/123456789012345") != 0){ +- 2b2e: c7 04 24 a8 56 00 00 movl $0x56a8,(%esp) +- 2b35: e8 c0 13 00 00 call 3efa +- 2b3a: 85 c0 test %eax,%eax +- 2b3c: 0f 85 1e 01 00 00 jne 2c60 ++ 2b76: c7 44 24 04 80 4f 00 movl $0x4f80,0x4(%esp) ++ 2b7d: 00 ++ 2b7e: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2b85: e8 26 15 00 00 call 40b0 ++ if (mkdir("12345678901234") != 0) ++ 2b8a: c7 04 24 bb 4f 00 00 movl $0x4fbb,(%esp) ++ 2b91: e8 34 14 00 00 call 3fca ++ 2b96: 85 c0 test %eax,%eax ++ 2b98: 0f 85 92 00 00 00 jne 2c30 ++ if (mkdir("12345678901234/123456789012345") != 0) ++ 2b9e: c7 04 24 78 57 00 00 movl $0x5778,(%esp) ++ 2ba5: e8 20 14 00 00 call 3fca ++ 2baa: 85 c0 test %eax,%eax ++ 2bac: 0f 85 1e 01 00 00 jne 2cd0 + fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); +- 2b42: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 2b49: 00 +- 2b4a: c7 04 24 f8 56 00 00 movl $0x56f8,(%esp) +- 2b51: e8 7c 13 00 00 call 3ed2 +- if(fd < 0){ +- 2b56: 85 c0 test %eax,%eax +- 2b58: 0f 88 e2 00 00 00 js 2c40 ++ 2bb2: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 2bb9: 00 ++ 2bba: c7 04 24 c8 57 00 00 movl $0x57c8,(%esp) ++ 2bc1: e8 dc 13 00 00 call 3fa2 ++ if (fd < 0) ++ 2bc6: 85 c0 test %eax,%eax ++ 2bc8: 0f 88 e2 00 00 00 js 2cb0 + close(fd); +- 2b5e: 89 04 24 mov %eax,(%esp) +- 2b61: e8 54 13 00 00 call 3eba ++ 2bce: 89 04 24 mov %eax,(%esp) ++ 2bd1: e8 b4 13 00 00 call 3f8a + fd = open("12345678901234/12345678901234/12345678901234", 0); +- 2b66: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2b6d: 00 +- 2b6e: c7 04 24 68 57 00 00 movl $0x5768,(%esp) +- 2b75: e8 58 13 00 00 call 3ed2 +- if(fd < 0){ +- 2b7a: 85 c0 test %eax,%eax +- 2b7c: 0f 88 9e 00 00 00 js 2c20 ++ 2bd6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 2bdd: 00 ++ 2bde: c7 04 24 38 58 00 00 movl $0x5838,(%esp) ++ 2be5: e8 b8 13 00 00 call 3fa2 ++ if (fd < 0) ++ 2bea: 85 c0 test %eax,%eax ++ 2bec: 0f 88 9e 00 00 00 js 2c90 + close(fd); +- 2b82: 89 04 24 mov %eax,(%esp) +- 2b85: e8 30 13 00 00 call 3eba +- if(mkdir("12345678901234/12345678901234") == 0){ +- 2b8a: c7 04 24 dc 4e 00 00 movl $0x4edc,(%esp) +- 2b91: e8 64 13 00 00 call 3efa +- 2b96: 85 c0 test %eax,%eax +- 2b98: 74 66 je 2c00 +- if(mkdir("123456789012345/12345678901234") == 0){ +- 2b9a: c7 04 24 04 58 00 00 movl $0x5804,(%esp) +- 2ba1: e8 54 13 00 00 call 3efa +- 2ba6: 85 c0 test %eax,%eax +- 2ba8: 74 36 je 2be0 ++ 2bf2: 89 04 24 mov %eax,(%esp) ++ 2bf5: e8 90 13 00 00 call 3f8a ++ if (mkdir("12345678901234/12345678901234") == 0) ++ 2bfa: c7 04 24 ac 4f 00 00 movl $0x4fac,(%esp) ++ 2c01: e8 c4 13 00 00 call 3fca ++ 2c06: 85 c0 test %eax,%eax ++ 2c08: 74 66 je 2c70 ++ if (mkdir("123456789012345/12345678901234") == 0) ++ 2c0a: c7 04 24 d4 58 00 00 movl $0x58d4,(%esp) ++ 2c11: e8 b4 13 00 00 call 3fca ++ 2c16: 85 c0 test %eax,%eax ++ 2c18: 74 36 je 2c50 + printf(1, "fourteen ok\n"); +- 2baa: c7 44 24 04 fa 4e 00 movl $0x4efa,0x4(%esp) +- 2bb1: 00 +- 2bb2: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2bb9: e8 22 14 00 00 call 3fe0 ++ 2c1a: c7 44 24 04 ca 4f 00 movl $0x4fca,0x4(%esp) ++ 2c21: 00 ++ 2c22: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2c29: e8 82 14 00 00 call 40b0 + } +- 2bbe: c9 leave +- 2bbf: c3 ret ++ 2c2e: c9 leave ++ 2c2f: c3 ret + printf(1, "mkdir 12345678901234 failed\n"); +- 2bc0: c7 44 24 04 bf 4e 00 movl $0x4ebf,0x4(%esp) +- 2bc7: 00 +- 2bc8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2bcf: e8 0c 14 00 00 call 3fe0 ++ 2c30: c7 44 24 04 8f 4f 00 movl $0x4f8f,0x4(%esp) ++ 2c37: 00 ++ 2c38: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2c3f: e8 6c 14 00 00 call 40b0 + exit(0); +- 2bd4: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2bdb: e8 b2 12 00 00 call 3e92 ++ 2c44: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2c4b: e8 12 13 00 00 call 3f62 + printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); +- 2be0: c7 44 24 04 24 58 00 movl $0x5824,0x4(%esp) +- 2be7: 00 +- 2be8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2bef: e8 ec 13 00 00 call 3fe0 ++ 2c50: c7 44 24 04 f4 58 00 movl $0x58f4,0x4(%esp) ++ 2c57: 00 ++ 2c58: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2c5f: e8 4c 14 00 00 call 40b0 + exit(0); +- 2bf4: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2bfb: e8 92 12 00 00 call 3e92 ++ 2c64: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2c6b: e8 f2 12 00 00 call 3f62 + printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); +- 2c00: c7 44 24 04 d4 57 00 movl $0x57d4,0x4(%esp) +- 2c07: 00 +- 2c08: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2c0f: e8 cc 13 00 00 call 3fe0 ++ 2c70: c7 44 24 04 a4 58 00 movl $0x58a4,0x4(%esp) ++ 2c77: 00 ++ 2c78: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2c7f: e8 2c 14 00 00 call 40b0 + exit(0); +- 2c14: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2c1b: e8 72 12 00 00 call 3e92 ++ 2c84: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2c8b: e8 d2 12 00 00 call 3f62 + printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); +- 2c20: c7 44 24 04 98 57 00 movl $0x5798,0x4(%esp) +- 2c27: 00 +- 2c28: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2c2f: e8 ac 13 00 00 call 3fe0 ++ 2c90: c7 44 24 04 68 58 00 movl $0x5868,0x4(%esp) ++ 2c97: 00 ++ 2c98: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2c9f: e8 0c 14 00 00 call 40b0 + exit(0); +- 2c34: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2c3b: e8 52 12 00 00 call 3e92 ++ 2ca4: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2cab: e8 b2 12 00 00 call 3f62 + printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); +- 2c40: c7 44 24 04 28 57 00 movl $0x5728,0x4(%esp) +- 2c47: 00 +- 2c48: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2c4f: e8 8c 13 00 00 call 3fe0 ++ 2cb0: c7 44 24 04 f8 57 00 movl $0x57f8,0x4(%esp) ++ 2cb7: 00 ++ 2cb8: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2cbf: e8 ec 13 00 00 call 40b0 + exit(0); +- 2c54: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2c5b: e8 32 12 00 00 call 3e92 ++ 2cc4: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2ccb: e8 92 12 00 00 call 3f62 + printf(1, "mkdir 12345678901234/123456789012345 failed\n"); +- 2c60: c7 44 24 04 c8 56 00 movl $0x56c8,0x4(%esp) +- 2c67: 00 +- 2c68: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2c6f: e8 6c 13 00 00 call 3fe0 ++ 2cd0: c7 44 24 04 98 57 00 movl $0x5798,0x4(%esp) ++ 2cd7: 00 ++ 2cd8: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2cdf: e8 cc 13 00 00 call 40b0 + exit(0); +- 2c74: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2c7b: e8 12 12 00 00 call 3e92 ++ 2ce4: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2ceb: e8 72 12 00 00 call 3f62 + +-00002c80 : ++00002cf0 : + { +- 2c80: 55 push %ebp +- 2c81: 89 e5 mov %esp,%ebp +- 2c83: 83 ec 18 sub $0x18,%esp ++ 2cf0: 55 push %ebp ++ 2cf1: 89 e5 mov %esp,%ebp ++ 2cf3: 83 ec 18 sub $0x18,%esp + printf(1, "rmdot test\n"); +- 2c86: c7 44 24 04 07 4f 00 movl $0x4f07,0x4(%esp) +- 2c8d: 00 +- 2c8e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2c95: e8 46 13 00 00 call 3fe0 +- if(mkdir("dots") != 0){ +- 2c9a: c7 04 24 13 4f 00 00 movl $0x4f13,(%esp) +- 2ca1: e8 54 12 00 00 call 3efa +- 2ca6: 85 c0 test %eax,%eax +- 2ca8: 0f 85 9a 00 00 00 jne 2d48 +- if(chdir("dots") != 0){ +- 2cae: c7 04 24 13 4f 00 00 movl $0x4f13,(%esp) +- 2cb5: e8 48 12 00 00 call 3f02 +- 2cba: 85 c0 test %eax,%eax +- 2cbc: 0f 85 66 01 00 00 jne 2e28 +- if(unlink(".") == 0){ +- 2cc2: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) +- 2cc9: e8 14 12 00 00 call 3ee2 +- 2cce: 85 c0 test %eax,%eax +- 2cd0: 0f 84 32 01 00 00 je 2e08 +- if(unlink("..") == 0){ +- 2cd6: c7 04 24 bd 4b 00 00 movl $0x4bbd,(%esp) +- 2cdd: e8 00 12 00 00 call 3ee2 +- 2ce2: 85 c0 test %eax,%eax +- 2ce4: 0f 84 fe 00 00 00 je 2de8 +- if(chdir("/") != 0){ +- 2cea: c7 04 24 91 43 00 00 movl $0x4391,(%esp) +- 2cf1: e8 0c 12 00 00 call 3f02 +- 2cf6: 85 c0 test %eax,%eax +- 2cf8: 0f 85 ca 00 00 00 jne 2dc8 +- if(unlink("dots/.") == 0){ +- 2cfe: c7 04 24 5b 4f 00 00 movl $0x4f5b,(%esp) +- 2d05: e8 d8 11 00 00 call 3ee2 +- 2d0a: 85 c0 test %eax,%eax +- 2d0c: 0f 84 96 00 00 00 je 2da8 +- if(unlink("dots/..") == 0){ +- 2d12: c7 04 24 79 4f 00 00 movl $0x4f79,(%esp) +- 2d19: e8 c4 11 00 00 call 3ee2 +- 2d1e: 85 c0 test %eax,%eax +- 2d20: 74 66 je 2d88 +- if(unlink("dots") != 0){ +- 2d22: c7 04 24 13 4f 00 00 movl $0x4f13,(%esp) +- 2d29: e8 b4 11 00 00 call 3ee2 +- 2d2e: 85 c0 test %eax,%eax +- 2d30: 75 36 jne 2d68 ++ 2cf6: c7 44 24 04 d7 4f 00 movl $0x4fd7,0x4(%esp) ++ 2cfd: 00 ++ 2cfe: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2d05: e8 a6 13 00 00 call 40b0 ++ if (mkdir("dots") != 0) ++ 2d0a: c7 04 24 e3 4f 00 00 movl $0x4fe3,(%esp) ++ 2d11: e8 b4 12 00 00 call 3fca ++ 2d16: 85 c0 test %eax,%eax ++ 2d18: 0f 85 9a 00 00 00 jne 2db8 ++ if (chdir("dots") != 0) ++ 2d1e: c7 04 24 e3 4f 00 00 movl $0x4fe3,(%esp) ++ 2d25: e8 a8 12 00 00 call 3fd2 ++ 2d2a: 85 c0 test %eax,%eax ++ 2d2c: 0f 85 66 01 00 00 jne 2e98 ++ if (unlink(".") == 0) ++ 2d32: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) ++ 2d39: e8 74 12 00 00 call 3fb2 ++ 2d3e: 85 c0 test %eax,%eax ++ 2d40: 0f 84 32 01 00 00 je 2e78 ++ if (unlink("..") == 0) ++ 2d46: c7 04 24 8d 4c 00 00 movl $0x4c8d,(%esp) ++ 2d4d: e8 60 12 00 00 call 3fb2 ++ 2d52: 85 c0 test %eax,%eax ++ 2d54: 0f 84 fe 00 00 00 je 2e58 ++ if (chdir("/") != 0) ++ 2d5a: c7 04 24 61 44 00 00 movl $0x4461,(%esp) ++ 2d61: e8 6c 12 00 00 call 3fd2 ++ 2d66: 85 c0 test %eax,%eax ++ 2d68: 0f 85 ca 00 00 00 jne 2e38 ++ if (unlink("dots/.") == 0) ++ 2d6e: c7 04 24 2b 50 00 00 movl $0x502b,(%esp) ++ 2d75: e8 38 12 00 00 call 3fb2 ++ 2d7a: 85 c0 test %eax,%eax ++ 2d7c: 0f 84 96 00 00 00 je 2e18 ++ if (unlink("dots/..") == 0) ++ 2d82: c7 04 24 49 50 00 00 movl $0x5049,(%esp) ++ 2d89: e8 24 12 00 00 call 3fb2 ++ 2d8e: 85 c0 test %eax,%eax ++ 2d90: 74 66 je 2df8 ++ if (unlink("dots") != 0) ++ 2d92: c7 04 24 e3 4f 00 00 movl $0x4fe3,(%esp) ++ 2d99: e8 14 12 00 00 call 3fb2 ++ 2d9e: 85 c0 test %eax,%eax ++ 2da0: 75 36 jne 2dd8 + printf(1, "rmdot ok\n"); +- 2d32: c7 44 24 04 ae 4f 00 movl $0x4fae,0x4(%esp) +- 2d39: 00 +- 2d3a: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2d41: e8 9a 12 00 00 call 3fe0 ++ 2da2: c7 44 24 04 7e 50 00 movl $0x507e,0x4(%esp) ++ 2da9: 00 ++ 2daa: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2db1: e8 fa 12 00 00 call 40b0 + } +- 2d46: c9 leave +- 2d47: c3 ret ++ 2db6: c9 leave ++ 2db7: c3 ret + printf(1, "mkdir dots failed\n"); +- 2d48: c7 44 24 04 18 4f 00 movl $0x4f18,0x4(%esp) +- 2d4f: 00 +- 2d50: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2d57: e8 84 12 00 00 call 3fe0 ++ 2db8: c7 44 24 04 e8 4f 00 movl $0x4fe8,0x4(%esp) ++ 2dbf: 00 ++ 2dc0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2dc7: e8 e4 12 00 00 call 40b0 + exit(0); +- 2d5c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2d63: e8 2a 11 00 00 call 3e92 ++ 2dcc: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2dd3: e8 8a 11 00 00 call 3f62 + printf(1, "unlink dots failed!\n"); +- 2d68: c7 44 24 04 99 4f 00 movl $0x4f99,0x4(%esp) +- 2d6f: 00 +- 2d70: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2d77: e8 64 12 00 00 call 3fe0 ++ 2dd8: c7 44 24 04 69 50 00 movl $0x5069,0x4(%esp) ++ 2ddf: 00 ++ 2de0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2de7: e8 c4 12 00 00 call 40b0 + exit(0); +- 2d7c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2d83: e8 0a 11 00 00 call 3e92 ++ 2dec: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2df3: e8 6a 11 00 00 call 3f62 + printf(1, "unlink dots/.. worked!\n"); +- 2d88: c7 44 24 04 81 4f 00 movl $0x4f81,0x4(%esp) +- 2d8f: 00 +- 2d90: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2d97: e8 44 12 00 00 call 3fe0 ++ 2df8: c7 44 24 04 51 50 00 movl $0x5051,0x4(%esp) ++ 2dff: 00 ++ 2e00: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2e07: e8 a4 12 00 00 call 40b0 + exit(0); +- 2d9c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2da3: e8 ea 10 00 00 call 3e92 ++ 2e0c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2e13: e8 4a 11 00 00 call 3f62 + printf(1, "unlink dots/. worked!\n"); +- 2da8: c7 44 24 04 62 4f 00 movl $0x4f62,0x4(%esp) +- 2daf: 00 +- 2db0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2db7: e8 24 12 00 00 call 3fe0 ++ 2e18: c7 44 24 04 32 50 00 movl $0x5032,0x4(%esp) ++ 2e1f: 00 ++ 2e20: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2e27: e8 84 12 00 00 call 40b0 + exit(0); +- 2dbc: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2dc3: e8 ca 10 00 00 call 3e92 ++ 2e2c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2e33: e8 2a 11 00 00 call 3f62 + printf(1, "chdir / failed\n"); +- 2dc8: c7 44 24 04 93 43 00 movl $0x4393,0x4(%esp) +- 2dcf: 00 +- 2dd0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2dd7: e8 04 12 00 00 call 3fe0 ++ 2e38: c7 44 24 04 63 44 00 movl $0x4463,0x4(%esp) ++ 2e3f: 00 ++ 2e40: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2e47: e8 64 12 00 00 call 40b0 + exit(0); +- 2ddc: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2de3: e8 aa 10 00 00 call 3e92 ++ 2e4c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2e53: e8 0a 11 00 00 call 3f62 + printf(1, "rm .. worked!\n"); +- 2de8: c7 44 24 04 4c 4f 00 movl $0x4f4c,0x4(%esp) +- 2def: 00 +- 2df0: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2df7: e8 e4 11 00 00 call 3fe0 ++ 2e58: c7 44 24 04 1c 50 00 movl $0x501c,0x4(%esp) ++ 2e5f: 00 ++ 2e60: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2e67: e8 44 12 00 00 call 40b0 + exit(0); +- 2dfc: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2e03: e8 8a 10 00 00 call 3e92 ++ 2e6c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2e73: e8 ea 10 00 00 call 3f62 + printf(1, "rm . worked!\n"); +- 2e08: c7 44 24 04 3e 4f 00 movl $0x4f3e,0x4(%esp) +- 2e0f: 00 +- 2e10: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2e17: e8 c4 11 00 00 call 3fe0 ++ 2e78: c7 44 24 04 0e 50 00 movl $0x500e,0x4(%esp) ++ 2e7f: 00 ++ 2e80: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2e87: e8 24 12 00 00 call 40b0 + exit(0); +- 2e1c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2e23: e8 6a 10 00 00 call 3e92 ++ 2e8c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2e93: e8 ca 10 00 00 call 3f62 + printf(1, "chdir dots failed\n"); +- 2e28: c7 44 24 04 2b 4f 00 movl $0x4f2b,0x4(%esp) +- 2e2f: 00 +- 2e30: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2e37: e8 a4 11 00 00 call 3fe0 ++ 2e98: c7 44 24 04 fb 4f 00 movl $0x4ffb,0x4(%esp) ++ 2e9f: 00 ++ 2ea0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2ea7: e8 04 12 00 00 call 40b0 + exit(0); +- 2e3c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2e43: e8 4a 10 00 00 call 3e92 +- 2e48: 90 nop +- 2e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 2eac: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 2eb3: e8 aa 10 00 00 call 3f62 ++ 2eb8: 90 nop ++ 2eb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00002e50 : ++00002ec0 : + { +- 2e50: 55 push %ebp +- 2e51: 89 e5 mov %esp,%ebp +- 2e53: 53 push %ebx +- 2e54: 83 ec 14 sub $0x14,%esp ++ 2ec0: 55 push %ebp ++ 2ec1: 89 e5 mov %esp,%ebp ++ 2ec3: 53 push %ebx ++ 2ec4: 83 ec 14 sub $0x14,%esp + printf(1, "dir vs file\n"); +- 2e57: c7 44 24 04 b8 4f 00 movl $0x4fb8,0x4(%esp) +- 2e5e: 00 +- 2e5f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2e66: e8 75 11 00 00 call 3fe0 ++ 2ec7: c7 44 24 04 88 50 00 movl $0x5088,0x4(%esp) ++ 2ece: 00 ++ 2ecf: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 2ed6: e8 d5 11 00 00 call 40b0 + fd = open("dirfile", O_CREATE); +- 2e6b: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 2e72: 00 +- 2e73: c7 04 24 c5 4f 00 00 movl $0x4fc5,(%esp) +- 2e7a: e8 53 10 00 00 call 3ed2 +- if(fd < 0){ +- 2e7f: 85 c0 test %eax,%eax +- 2e81: 0f 88 60 01 00 00 js 2fe7 ++ 2edb: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 2ee2: 00 ++ 2ee3: c7 04 24 95 50 00 00 movl $0x5095,(%esp) ++ 2eea: e8 b3 10 00 00 call 3fa2 ++ if (fd < 0) ++ 2eef: 85 c0 test %eax,%eax ++ 2ef1: 0f 88 60 01 00 00 js 3057 + close(fd); +- 2e87: 89 04 24 mov %eax,(%esp) +- 2e8a: e8 2b 10 00 00 call 3eba +- if(chdir("dirfile") == 0){ +- 2e8f: c7 04 24 c5 4f 00 00 movl $0x4fc5,(%esp) +- 2e96: e8 67 10 00 00 call 3f02 +- 2e9b: 85 c0 test %eax,%eax +- 2e9d: 0f 84 24 01 00 00 je 2fc7 ++ 2ef7: 89 04 24 mov %eax,(%esp) ++ 2efa: e8 8b 10 00 00 call 3f8a ++ if (chdir("dirfile") == 0) ++ 2eff: c7 04 24 95 50 00 00 movl $0x5095,(%esp) ++ 2f06: e8 c7 10 00 00 call 3fd2 ++ 2f0b: 85 c0 test %eax,%eax ++ 2f0d: 0f 84 24 01 00 00 je 3037 + fd = open("dirfile/xx", 0); +- 2ea3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2eaa: 00 +- 2eab: c7 04 24 fe 4f 00 00 movl $0x4ffe,(%esp) +- 2eb2: e8 1b 10 00 00 call 3ed2 +- if(fd >= 0){ +- 2eb7: 85 c0 test %eax,%eax +- 2eb9: 0f 89 e8 00 00 00 jns 2fa7 ++ 2f13: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 2f1a: 00 ++ 2f1b: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) ++ 2f22: e8 7b 10 00 00 call 3fa2 ++ if (fd >= 0) ++ 2f27: 85 c0 test %eax,%eax ++ 2f29: 0f 89 e8 00 00 00 jns 3017 + fd = open("dirfile/xx", O_CREATE); +- 2ebf: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 2ec6: 00 +- 2ec7: c7 04 24 fe 4f 00 00 movl $0x4ffe,(%esp) +- 2ece: e8 ff 0f 00 00 call 3ed2 +- if(fd >= 0){ +- 2ed3: 85 c0 test %eax,%eax +- 2ed5: 0f 89 cc 00 00 00 jns 2fa7 +- if(mkdir("dirfile/xx") == 0){ +- 2edb: c7 04 24 fe 4f 00 00 movl $0x4ffe,(%esp) +- 2ee2: e8 13 10 00 00 call 3efa +- 2ee7: 85 c0 test %eax,%eax +- 2ee9: 0f 84 b8 01 00 00 je 30a7 +- if(unlink("dirfile/xx") == 0){ +- 2eef: c7 04 24 fe 4f 00 00 movl $0x4ffe,(%esp) +- 2ef6: e8 e7 0f 00 00 call 3ee2 +- 2efb: 85 c0 test %eax,%eax +- 2efd: 0f 84 84 01 00 00 je 3087 +- if(link("README", "dirfile/xx") == 0){ +- 2f03: c7 44 24 04 fe 4f 00 movl $0x4ffe,0x4(%esp) +- 2f0a: 00 +- 2f0b: c7 04 24 62 50 00 00 movl $0x5062,(%esp) +- 2f12: e8 db 0f 00 00 call 3ef2 +- 2f17: 85 c0 test %eax,%eax +- 2f19: 0f 84 48 01 00 00 je 3067 +- if(unlink("dirfile") != 0){ +- 2f1f: c7 04 24 c5 4f 00 00 movl $0x4fc5,(%esp) +- 2f26: e8 b7 0f 00 00 call 3ee2 +- 2f2b: 85 c0 test %eax,%eax +- 2f2d: 0f 85 14 01 00 00 jne 3047 ++ 2f2f: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 2f36: 00 ++ 2f37: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) ++ 2f3e: e8 5f 10 00 00 call 3fa2 ++ if (fd >= 0) ++ 2f43: 85 c0 test %eax,%eax ++ 2f45: 0f 89 cc 00 00 00 jns 3017 ++ if (mkdir("dirfile/xx") == 0) ++ 2f4b: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) ++ 2f52: e8 73 10 00 00 call 3fca ++ 2f57: 85 c0 test %eax,%eax ++ 2f59: 0f 84 b8 01 00 00 je 3117 ++ if (unlink("dirfile/xx") == 0) ++ 2f5f: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) ++ 2f66: e8 47 10 00 00 call 3fb2 ++ 2f6b: 85 c0 test %eax,%eax ++ 2f6d: 0f 84 84 01 00 00 je 30f7 ++ if (link("README", "dirfile/xx") == 0) ++ 2f73: c7 44 24 04 ce 50 00 movl $0x50ce,0x4(%esp) ++ 2f7a: 00 ++ 2f7b: c7 04 24 32 51 00 00 movl $0x5132,(%esp) ++ 2f82: e8 3b 10 00 00 call 3fc2 ++ 2f87: 85 c0 test %eax,%eax ++ 2f89: 0f 84 48 01 00 00 je 30d7 ++ if (unlink("dirfile") != 0) ++ 2f8f: c7 04 24 95 50 00 00 movl $0x5095,(%esp) ++ 2f96: e8 17 10 00 00 call 3fb2 ++ 2f9b: 85 c0 test %eax,%eax ++ 2f9d: 0f 85 14 01 00 00 jne 30b7 + fd = open(".", O_RDWR); +- 2f33: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) +- 2f3a: 00 +- 2f3b: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) +- 2f42: e8 8b 0f 00 00 call 3ed2 +- if(fd >= 0){ +- 2f47: 85 c0 test %eax,%eax +- 2f49: 0f 89 d8 00 00 00 jns 3027 ++ 2fa3: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) ++ 2faa: 00 ++ 2fab: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) ++ 2fb2: e8 eb 0f 00 00 call 3fa2 ++ if (fd >= 0) ++ 2fb7: 85 c0 test %eax,%eax ++ 2fb9: 0f 89 d8 00 00 00 jns 3097 + fd = open(".", 0); +- 2f4f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 2f56: 00 +- 2f57: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) +- 2f5e: e8 6f 0f 00 00 call 3ed2 +- if(write(fd, "x", 1) > 0){ +- 2f63: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 2f6a: 00 +- 2f6b: c7 44 24 04 a1 4c 00 movl $0x4ca1,0x4(%esp) +- 2f72: 00 +- 2f73: 89 04 24 mov %eax,(%esp) ++ 2fbf: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 2fc6: 00 ++ 2fc7: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) ++ 2fce: e8 cf 0f 00 00 call 3fa2 ++ if (write(fd, "x", 1) > 0) ++ 2fd3: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 2fda: 00 ++ 2fdb: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) ++ 2fe2: 00 ++ 2fe3: 89 04 24 mov %eax,(%esp) + fd = open(".", 0); +- 2f76: 89 c3 mov %eax,%ebx +- if(write(fd, "x", 1) > 0){ +- 2f78: e8 35 0f 00 00 call 3eb2 +- 2f7d: 85 c0 test %eax,%eax +- 2f7f: 0f 8f 82 00 00 00 jg 3007 ++ 2fe6: 89 c3 mov %eax,%ebx ++ if (write(fd, "x", 1) > 0) ++ 2fe8: e8 95 0f 00 00 call 3f82 ++ 2fed: 85 c0 test %eax,%eax ++ 2fef: 0f 8f 82 00 00 00 jg 3077 + close(fd); +- 2f85: 89 1c 24 mov %ebx,(%esp) +- 2f88: e8 2d 0f 00 00 call 3eba ++ 2ff5: 89 1c 24 mov %ebx,(%esp) ++ 2ff8: e8 8d 0f 00 00 call 3f8a + printf(1, "dir vs file OK\n"); +- 2f8d: c7 44 24 04 95 50 00 movl $0x5095,0x4(%esp) +- 2f94: 00 +- 2f95: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2f9c: e8 3f 10 00 00 call 3fe0 ++ 2ffd: c7 44 24 04 65 51 00 movl $0x5165,0x4(%esp) ++ 3004: 00 ++ 3005: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 300c: e8 9f 10 00 00 call 40b0 + } +- 2fa1: 83 c4 14 add $0x14,%esp +- 2fa4: 5b pop %ebx +- 2fa5: 5d pop %ebp +- 2fa6: c3 ret ++ 3011: 83 c4 14 add $0x14,%esp ++ 3014: 5b pop %ebx ++ 3015: 5d pop %ebp ++ 3016: c3 ret + printf(1, "create dirfile/xx succeeded!\n"); +- 2fa7: c7 44 24 04 09 50 00 movl $0x5009,0x4(%esp) +- 2fae: 00 +- 2faf: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2fb6: e8 25 10 00 00 call 3fe0 ++ 3017: c7 44 24 04 d9 50 00 movl $0x50d9,0x4(%esp) ++ 301e: 00 ++ 301f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3026: e8 85 10 00 00 call 40b0 + exit(0); +- 2fbb: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2fc2: e8 cb 0e 00 00 call 3e92 ++ 302b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3032: e8 2b 0f 00 00 call 3f62 + printf(1, "chdir dirfile succeeded!\n"); +- 2fc7: c7 44 24 04 e4 4f 00 movl $0x4fe4,0x4(%esp) +- 2fce: 00 +- 2fcf: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2fd6: e8 05 10 00 00 call 3fe0 ++ 3037: c7 44 24 04 b4 50 00 movl $0x50b4,0x4(%esp) ++ 303e: 00 ++ 303f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3046: e8 65 10 00 00 call 40b0 + exit(0); +- 2fdb: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 2fe2: e8 ab 0e 00 00 call 3e92 ++ 304b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3052: e8 0b 0f 00 00 call 3f62 + printf(1, "create dirfile failed\n"); +- 2fe7: c7 44 24 04 cd 4f 00 movl $0x4fcd,0x4(%esp) +- 2fee: 00 +- 2fef: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 2ff6: e8 e5 0f 00 00 call 3fe0 ++ 3057: c7 44 24 04 9d 50 00 movl $0x509d,0x4(%esp) ++ 305e: 00 ++ 305f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3066: e8 45 10 00 00 call 40b0 + exit(0); +- 2ffb: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3002: e8 8b 0e 00 00 call 3e92 ++ 306b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3072: e8 eb 0e 00 00 call 3f62 + printf(1, "write . succeeded!\n"); +- 3007: c7 44 24 04 81 50 00 movl $0x5081,0x4(%esp) +- 300e: 00 +- 300f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3016: e8 c5 0f 00 00 call 3fe0 ++ 3077: c7 44 24 04 51 51 00 movl $0x5151,0x4(%esp) ++ 307e: 00 ++ 307f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3086: e8 25 10 00 00 call 40b0 + exit(0); +- 301b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3022: e8 6b 0e 00 00 call 3e92 ++ 308b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3092: e8 cb 0e 00 00 call 3f62 + printf(1, "open . for writing succeeded!\n"); +- 3027: c7 44 24 04 78 58 00 movl $0x5878,0x4(%esp) +- 302e: 00 +- 302f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3036: e8 a5 0f 00 00 call 3fe0 ++ 3097: c7 44 24 04 48 59 00 movl $0x5948,0x4(%esp) ++ 309e: 00 ++ 309f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 30a6: e8 05 10 00 00 call 40b0 + exit(0); +- 303b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3042: e8 4b 0e 00 00 call 3e92 ++ 30ab: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 30b2: e8 ab 0e 00 00 call 3f62 + printf(1, "unlink dirfile failed!\n"); +- 3047: c7 44 24 04 69 50 00 movl $0x5069,0x4(%esp) +- 304e: 00 +- 304f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3056: e8 85 0f 00 00 call 3fe0 ++ 30b7: c7 44 24 04 39 51 00 movl $0x5139,0x4(%esp) ++ 30be: 00 ++ 30bf: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 30c6: e8 e5 0f 00 00 call 40b0 + exit(0); +- 305b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3062: e8 2b 0e 00 00 call 3e92 ++ 30cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 30d2: e8 8b 0e 00 00 call 3f62 + printf(1, "link to dirfile/xx succeeded!\n"); +- 3067: c7 44 24 04 58 58 00 movl $0x5858,0x4(%esp) +- 306e: 00 +- 306f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3076: e8 65 0f 00 00 call 3fe0 ++ 30d7: c7 44 24 04 28 59 00 movl $0x5928,0x4(%esp) ++ 30de: 00 ++ 30df: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 30e6: e8 c5 0f 00 00 call 40b0 + exit(0); +- 307b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3082: e8 0b 0e 00 00 call 3e92 ++ 30eb: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 30f2: e8 6b 0e 00 00 call 3f62 + printf(1, "unlink dirfile/xx succeeded!\n"); +- 3087: c7 44 24 04 44 50 00 movl $0x5044,0x4(%esp) +- 308e: 00 +- 308f: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3096: e8 45 0f 00 00 call 3fe0 ++ 30f7: c7 44 24 04 14 51 00 movl $0x5114,0x4(%esp) ++ 30fe: 00 ++ 30ff: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3106: e8 a5 0f 00 00 call 40b0 + exit(0); +- 309b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 30a2: e8 eb 0d 00 00 call 3e92 ++ 310b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3112: e8 4b 0e 00 00 call 3f62 + printf(1, "mkdir dirfile/xx succeeded!\n"); +- 30a7: c7 44 24 04 27 50 00 movl $0x5027,0x4(%esp) +- 30ae: 00 +- 30af: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 30b6: e8 25 0f 00 00 call 3fe0 ++ 3117: c7 44 24 04 f7 50 00 movl $0x50f7,0x4(%esp) ++ 311e: 00 ++ 311f: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3126: e8 85 0f 00 00 call 40b0 + exit(0); +- 30bb: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 30c2: e8 cb 0d 00 00 call 3e92 +- 30c7: 89 f6 mov %esi,%esi +- 30c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 312b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3132: e8 2b 0e 00 00 call 3f62 ++ 3137: 89 f6 mov %esi,%esi ++ 3139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000030d0 : ++00003140 : + { +- 30d0: 55 push %ebp +- 30d1: 89 e5 mov %esp,%ebp +- 30d3: 53 push %ebx ++ 3140: 55 push %ebp ++ 3141: 89 e5 mov %esp,%ebp ++ 3143: 53 push %ebx + printf(1, "empty file name\n"); +- 30d4: bb 33 00 00 00 mov $0x33,%ebx ++ 3144: bb 33 00 00 00 mov $0x33,%ebx + { +- 30d9: 83 ec 14 sub $0x14,%esp ++ 3149: 83 ec 14 sub $0x14,%esp + printf(1, "empty file name\n"); +- 30dc: c7 44 24 04 a5 50 00 movl $0x50a5,0x4(%esp) +- 30e3: 00 +- 30e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 30eb: e8 f0 0e 00 00 call 3fe0 +- if(mkdir("irefd") != 0){ +- 30f0: c7 04 24 b6 50 00 00 movl $0x50b6,(%esp) +- 30f7: e8 fe 0d 00 00 call 3efa +- 30fc: 85 c0 test %eax,%eax +- 30fe: 0f 85 af 00 00 00 jne 31b3 +- if(chdir("irefd") != 0){ +- 3104: c7 04 24 b6 50 00 00 movl $0x50b6,(%esp) +- 310b: e8 f2 0d 00 00 call 3f02 +- 3110: 85 c0 test %eax,%eax +- 3112: 0f 85 bb 00 00 00 jne 31d3 ++ 314c: c7 44 24 04 75 51 00 movl $0x5175,0x4(%esp) ++ 3153: 00 ++ 3154: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 315b: e8 50 0f 00 00 call 40b0 ++ if (mkdir("irefd") != 0) ++ 3160: c7 04 24 86 51 00 00 movl $0x5186,(%esp) ++ 3167: e8 5e 0e 00 00 call 3fca ++ 316c: 85 c0 test %eax,%eax ++ 316e: 0f 85 af 00 00 00 jne 3223 ++ if (chdir("irefd") != 0) ++ 3174: c7 04 24 86 51 00 00 movl $0x5186,(%esp) ++ 317b: e8 52 0e 00 00 call 3fd2 ++ 3180: 85 c0 test %eax,%eax ++ 3182: 0f 85 bb 00 00 00 jne 3243 + mkdir(""); +- 3118: c7 04 24 6b 47 00 00 movl $0x476b,(%esp) +- 311f: e8 d6 0d 00 00 call 3efa ++ 3188: c7 04 24 3b 48 00 00 movl $0x483b,(%esp) ++ 318f: e8 36 0e 00 00 call 3fca + link("README", ""); +- 3124: c7 44 24 04 6b 47 00 movl $0x476b,0x4(%esp) +- 312b: 00 +- 312c: c7 04 24 62 50 00 00 movl $0x5062,(%esp) +- 3133: e8 ba 0d 00 00 call 3ef2 ++ 3194: c7 44 24 04 3b 48 00 movl $0x483b,0x4(%esp) ++ 319b: 00 ++ 319c: c7 04 24 32 51 00 00 movl $0x5132,(%esp) ++ 31a3: e8 1a 0e 00 00 call 3fc2 + fd = open("", O_CREATE); +- 3138: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 313f: 00 +- 3140: c7 04 24 6b 47 00 00 movl $0x476b,(%esp) +- 3147: e8 86 0d 00 00 call 3ed2 +- if(fd >= 0) +- 314c: 85 c0 test %eax,%eax +- 314e: 78 08 js 3158 ++ 31a8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 31af: 00 ++ 31b0: c7 04 24 3b 48 00 00 movl $0x483b,(%esp) ++ 31b7: e8 e6 0d 00 00 call 3fa2 ++ if (fd >= 0) ++ 31bc: 85 c0 test %eax,%eax ++ 31be: 78 08 js 31c8 + close(fd); +- 3150: 89 04 24 mov %eax,(%esp) +- 3153: e8 62 0d 00 00 call 3eba ++ 31c0: 89 04 24 mov %eax,(%esp) ++ 31c3: e8 c2 0d 00 00 call 3f8a + fd = open("xx", O_CREATE); +- 3158: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 315f: 00 +- 3160: c7 04 24 a0 4c 00 00 movl $0x4ca0,(%esp) +- 3167: e8 66 0d 00 00 call 3ed2 +- if(fd >= 0) +- 316c: 85 c0 test %eax,%eax +- 316e: 78 08 js 3178 ++ 31c8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 31cf: 00 ++ 31d0: c7 04 24 70 4d 00 00 movl $0x4d70,(%esp) ++ 31d7: e8 c6 0d 00 00 call 3fa2 ++ if (fd >= 0) ++ 31dc: 85 c0 test %eax,%eax ++ 31de: 78 08 js 31e8 + close(fd); +- 3170: 89 04 24 mov %eax,(%esp) +- 3173: e8 42 0d 00 00 call 3eba ++ 31e0: 89 04 24 mov %eax,(%esp) ++ 31e3: e8 a2 0d 00 00 call 3f8a + unlink("xx"); +- 3178: c7 04 24 a0 4c 00 00 movl $0x4ca0,(%esp) +- 317f: e8 5e 0d 00 00 call 3ee2 +- for(i = 0; i < 50 + 1; i++){ +- 3184: 83 eb 01 sub $0x1,%ebx +- 3187: 0f 85 63 ff ff ff jne 30f0 ++ 31e8: c7 04 24 70 4d 00 00 movl $0x4d70,(%esp) ++ 31ef: e8 be 0d 00 00 call 3fb2 ++ for (i = 0; i < 50 + 1; i++) ++ 31f4: 83 eb 01 sub $0x1,%ebx ++ 31f7: 0f 85 63 ff ff ff jne 3160 + chdir("/"); +- 318d: c7 04 24 91 43 00 00 movl $0x4391,(%esp) +- 3194: e8 69 0d 00 00 call 3f02 ++ 31fd: c7 04 24 61 44 00 00 movl $0x4461,(%esp) ++ 3204: e8 c9 0d 00 00 call 3fd2 + printf(1, "empty file name OK\n"); +- 3199: c7 44 24 04 e4 50 00 movl $0x50e4,0x4(%esp) +- 31a0: 00 +- 31a1: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 31a8: e8 33 0e 00 00 call 3fe0 ++ 3209: c7 44 24 04 b4 51 00 movl $0x51b4,0x4(%esp) ++ 3210: 00 ++ 3211: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3218: e8 93 0e 00 00 call 40b0 + } +- 31ad: 83 c4 14 add $0x14,%esp +- 31b0: 5b pop %ebx +- 31b1: 5d pop %ebp +- 31b2: c3 ret ++ 321d: 83 c4 14 add $0x14,%esp ++ 3220: 5b pop %ebx ++ 3221: 5d pop %ebp ++ 3222: c3 ret + printf(1, "mkdir irefd failed\n"); +- 31b3: c7 44 24 04 bc 50 00 movl $0x50bc,0x4(%esp) +- 31ba: 00 +- 31bb: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 31c2: e8 19 0e 00 00 call 3fe0 ++ 3223: c7 44 24 04 8c 51 00 movl $0x518c,0x4(%esp) ++ 322a: 00 ++ 322b: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3232: e8 79 0e 00 00 call 40b0 + exit(0); +- 31c7: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 31ce: e8 bf 0c 00 00 call 3e92 ++ 3237: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 323e: e8 1f 0d 00 00 call 3f62 + printf(1, "chdir irefd failed\n"); +- 31d3: c7 44 24 04 d0 50 00 movl $0x50d0,0x4(%esp) +- 31da: 00 +- 31db: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 31e2: e8 f9 0d 00 00 call 3fe0 ++ 3243: c7 44 24 04 a0 51 00 movl $0x51a0,0x4(%esp) ++ 324a: 00 ++ 324b: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3252: e8 59 0e 00 00 call 40b0 + exit(0); +- 31e7: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 31ee: e8 9f 0c 00 00 call 3e92 +- 31f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 31f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 3257: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 325e: e8 ff 0c 00 00 call 3f62 ++ 3263: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 3269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00003200 : ++00003270 : + { +- 3200: 55 push %ebp +- 3201: 89 e5 mov %esp,%ebp +- 3203: 53 push %ebx +- for(n=0; n<1000; n++){ +- 3204: 31 db xor %ebx,%ebx ++ 3270: 55 push %ebp ++ 3271: 89 e5 mov %esp,%ebp ++ 3273: 53 push %ebx ++ for (n = 0; n < 1000; n++) ++ 3274: 31 db xor %ebx,%ebx + { +- 3206: 83 ec 14 sub $0x14,%esp ++ 3276: 83 ec 14 sub $0x14,%esp + printf(1, "fork test\n"); +- 3209: c7 44 24 04 f8 50 00 movl $0x50f8,0x4(%esp) +- 3210: 00 +- 3211: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3218: e8 c3 0d 00 00 call 3fe0 +- 321d: eb 13 jmp 3232 +- 321f: 90 nop +- if(pid == 0) +- 3220: 0f 84 8e 00 00 00 je 32b4 +- for(n=0; n<1000; n++){ +- 3226: 83 c3 01 add $0x1,%ebx +- 3229: 81 fb e8 03 00 00 cmp $0x3e8,%ebx +- 322f: 90 nop +- 3230: 74 4e je 3280 ++ 3279: c7 44 24 04 c8 51 00 movl $0x51c8,0x4(%esp) ++ 3280: 00 ++ 3281: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3288: e8 23 0e 00 00 call 40b0 ++ 328d: eb 13 jmp 32a2 ++ 328f: 90 nop ++ if (pid == 0) ++ 3290: 0f 84 96 00 00 00 je 332c ++ for (n = 0; n < 1000; n++) ++ 3296: 83 c3 01 add $0x1,%ebx ++ 3299: 81 fb e8 03 00 00 cmp $0x3e8,%ebx ++ 329f: 90 nop ++ 32a0: 74 56 je 32f8 + pid = fork(); +- 3232: e8 53 0c 00 00 call 3e8a +- if(pid < 0) +- 3237: 85 c0 test %eax,%eax +- 3239: 79 e5 jns 3220 +- for(; n > 0; n--){ +- 323b: 85 db test %ebx,%ebx +- 323d: 8d 76 00 lea 0x0(%esi),%esi +- 3240: 74 15 je 3257 +- 3242: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- if(wait() < 0){ +- 3248: e8 4d 0c 00 00 call 3e9a +- 324d: 85 c0 test %eax,%eax +- 324f: 90 nop +- 3250: 78 4e js 32a0 +- for(; n > 0; n--){ +- 3252: 83 eb 01 sub $0x1,%ebx +- 3255: 75 f1 jne 3248 +- if(wait() != -1){ +- 3257: e8 3e 0c 00 00 call 3e9a +- 325c: 83 f8 ff cmp $0xffffffff,%eax +- 325f: 90 nop +- 3260: 75 5e jne 32c0 ++ 32a2: e8 b3 0c 00 00 call 3f5a ++ if (pid < 0) ++ 32a7: 85 c0 test %eax,%eax ++ 32a9: 79 e5 jns 3290 ++ for (; n > 0; n--) ++ 32ab: 85 db test %ebx,%ebx ++ 32ad: 8d 76 00 lea 0x0(%esi),%esi ++ 32b0: 74 1b je 32cd ++ 32b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ if (wait(0) < 0) ++ 32b8: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 32bf: e8 a6 0c 00 00 call 3f6a ++ 32c4: 85 c0 test %eax,%eax ++ 32c6: 78 50 js 3318 ++ for (; n > 0; n--) ++ 32c8: 83 eb 01 sub $0x1,%ebx ++ 32cb: 75 eb jne 32b8 ++ if (wait(0) != -1) ++ 32cd: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 32d4: e8 91 0c 00 00 call 3f6a ++ 32d9: 83 f8 ff cmp $0xffffffff,%eax ++ 32dc: 75 5a jne 3338 + printf(1, "fork test OK\n"); +- 3262: c7 44 24 04 2a 51 00 movl $0x512a,0x4(%esp) +- 3269: 00 +- 326a: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3271: e8 6a 0d 00 00 call 3fe0 ++ 32de: c7 44 24 04 fa 51 00 movl $0x51fa,0x4(%esp) ++ 32e5: 00 ++ 32e6: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 32ed: e8 be 0d 00 00 call 40b0 + } +- 3276: 83 c4 14 add $0x14,%esp +- 3279: 5b pop %ebx +- 327a: 5d pop %ebp +- 327b: c3 ret +- 327c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 32f2: 83 c4 14 add $0x14,%esp ++ 32f5: 5b pop %ebx ++ 32f6: 5d pop %ebp ++ 32f7: c3 ret + printf(1, "fork claimed to work 1000 times!\n"); +- 3280: c7 44 24 04 98 58 00 movl $0x5898,0x4(%esp) +- 3287: 00 +- 3288: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 328f: e8 4c 0d 00 00 call 3fe0 ++ 32f8: c7 44 24 04 68 59 00 movl $0x5968,0x4(%esp) ++ 32ff: 00 ++ 3300: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3307: e8 a4 0d 00 00 call 40b0 + exit(0); +- 3294: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 329b: e8 f2 0b 00 00 call 3e92 ++ 330c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3313: e8 4a 0c 00 00 call 3f62 + printf(1, "wait stopped early\n"); +- 32a0: c7 44 24 04 03 51 00 movl $0x5103,0x4(%esp) +- 32a7: 00 +- 32a8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 32af: e8 2c 0d 00 00 call 3fe0 ++ 3318: c7 44 24 04 d3 51 00 movl $0x51d3,0x4(%esp) ++ 331f: 00 ++ 3320: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3327: e8 84 0d 00 00 call 40b0 + exit(0); +- 32b4: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 32bb: e8 d2 0b 00 00 call 3e92 ++ 332c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3333: e8 2a 0c 00 00 call 3f62 + printf(1, "wait got too many\n"); +- 32c0: c7 44 24 04 17 51 00 movl $0x5117,0x4(%esp) +- 32c7: 00 +- 32c8: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 32cf: e8 0c 0d 00 00 call 3fe0 ++ 3338: c7 44 24 04 e7 51 00 movl $0x51e7,0x4(%esp) ++ 333f: 00 ++ 3340: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3347: e8 64 0d 00 00 call 40b0 + exit(0); +- 32d4: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 32db: e8 b2 0b 00 00 call 3e92 ++ 334c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3353: e8 0a 0c 00 00 call 3f62 ++ 3358: 90 nop ++ 3359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-000032e0 : ++00003360 : + { +- 32e0: 55 push %ebp +- 32e1: 89 e5 mov %esp,%ebp +- 32e3: 57 push %edi +- 32e4: 56 push %esi +- for(i = 0; i < 5000; i++){ +- 32e5: 31 f6 xor %esi,%esi ++ 3360: 55 push %ebp ++ 3361: 89 e5 mov %esp,%ebp ++ 3363: 57 push %edi ++ 3364: 56 push %esi ++ for (i = 0; i < 5000; i++) ++ 3365: 31 f6 xor %esi,%esi + { +- 32e7: 53 push %ebx +- 32e8: 83 ec 6c sub $0x6c,%esp ++ 3367: 53 push %ebx ++ 3368: 83 ec 6c sub $0x6c,%esp + printf(stdout, "sbrk test\n"); +- 32eb: a1 c4 63 00 00 mov 0x63c4,%eax +- 32f0: c7 44 24 04 38 51 00 movl $0x5138,0x4(%esp) +- 32f7: 00 +- 32f8: 89 04 24 mov %eax,(%esp) +- 32fb: e8 e0 0c 00 00 call 3fe0 ++ 336b: a1 94 64 00 00 mov 0x6494,%eax ++ 3370: c7 44 24 04 08 52 00 movl $0x5208,0x4(%esp) ++ 3377: 00 ++ 3378: 89 04 24 mov %eax,(%esp) ++ 337b: e8 30 0d 00 00 call 40b0 + oldbrk = sbrk(0); +- 3300: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3307: e8 0e 0c 00 00 call 3f1a ++ 3380: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3387: e8 5e 0c 00 00 call 3fea + a = sbrk(0); +- 330c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 338c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + oldbrk = sbrk(0); +- 3313: 89 45 a4 mov %eax,-0x5c(%ebp) ++ 3393: 89 45 a4 mov %eax,-0x5c(%ebp) + a = sbrk(0); +- 3316: e8 ff 0b 00 00 call 3f1a +- 331b: 89 c3 mov %eax,%ebx +- 331d: 8d 76 00 lea 0x0(%esi),%esi ++ 3396: e8 4f 0c 00 00 call 3fea ++ 339b: 89 c3 mov %eax,%ebx ++ 339d: 8d 76 00 lea 0x0(%esi),%esi + b = sbrk(1); +- 3320: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3327: e8 ee 0b 00 00 call 3f1a +- if(b != a){ +- 332c: 39 d8 cmp %ebx,%eax ++ 33a0: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 33a7: e8 3e 0c 00 00 call 3fea ++ if (b != a) ++ 33ac: 39 d8 cmp %ebx,%eax + b = sbrk(1); +- 332e: 89 c7 mov %eax,%edi +- if(b != a){ +- 3330: 0f 85 78 02 00 00 jne 35ae +- for(i = 0; i < 5000; i++){ +- 3336: 83 c6 01 add $0x1,%esi ++ 33ae: 89 c7 mov %eax,%edi ++ if (b != a) ++ 33b0: 0f 85 90 02 00 00 jne 3646 ++ for (i = 0; i < 5000; i++) ++ 33b6: 83 c6 01 add $0x1,%esi + a = b + 1; +- 3339: 83 c3 01 add $0x1,%ebx ++ 33b9: 83 c3 01 add $0x1,%ebx + *b = 1; +- 333c: c6 43 ff 01 movb $0x1,-0x1(%ebx) +- for(i = 0; i < 5000; i++){ +- 3340: 81 fe 88 13 00 00 cmp $0x1388,%esi +- 3346: 75 d8 jne 3320 ++ 33bc: c6 43 ff 01 movb $0x1,-0x1(%ebx) ++ for (i = 0; i < 5000; i++) ++ 33c0: 81 fe 88 13 00 00 cmp $0x1388,%esi ++ 33c6: 75 d8 jne 33a0 + pid = fork(); +- 3348: e8 3d 0b 00 00 call 3e8a +- if(pid < 0){ +- 334d: 85 c0 test %eax,%eax ++ 33c8: e8 8d 0b 00 00 call 3f5a ++ if (pid < 0) ++ 33cd: 85 c0 test %eax,%eax + pid = fork(); +- 334f: 89 c3 mov %eax,%ebx +- if(pid < 0){ +- 3351: 0f 88 7a 03 00 00 js 36d1 ++ 33cf: 89 c3 mov %eax,%ebx ++ if (pid < 0) ++ 33d1: 0f 88 9c 03 00 00 js 3773 + c = sbrk(1); +- 3357: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 335e: e8 b7 0b 00 00 call 3f1a ++ 33d7: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 33de: e8 07 0c 00 00 call 3fea + c = sbrk(1); +- 3363: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 336a: e8 ab 0b 00 00 call 3f1a +- if(c != a + 1){ +- 336f: 8d 57 02 lea 0x2(%edi),%edx +- 3372: 39 d0 cmp %edx,%eax +- 3374: 0f 85 4a 03 00 00 jne 36c4 +- if(pid == 0) +- 337a: 85 db test %ebx,%ebx +- 337c: 0f 84 8e 02 00 00 je 3610 +- wait(); +- 3382: e8 13 0b 00 00 call 3e9a ++ 33e3: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 33ea: e8 fb 0b 00 00 call 3fea ++ if (c != a + 1) ++ 33ef: 8d 57 02 lea 0x2(%edi),%edx ++ 33f2: 39 d0 cmp %edx,%eax ++ 33f4: 0f 85 6c 03 00 00 jne 3766 ++ if (pid == 0) ++ 33fa: 85 db test %ebx,%ebx ++ exit(0); ++ 33fc: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ if (pid == 0) ++ 3403: 0f 84 a6 02 00 00 je 36af ++ wait(0); ++ 3409: e8 5c 0b 00 00 call 3f6a + a = sbrk(0); +- 3387: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 338e: e8 87 0b 00 00 call 3f1a ++ 340e: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3415: e8 d0 0b 00 00 call 3fea + amt = (BIG) - (uint)a; +- 3393: ba 00 00 40 06 mov $0x6400000,%edx +- 3398: 29 c2 sub %eax,%edx ++ 341a: ba 00 00 40 06 mov $0x6400000,%edx ++ 341f: 29 c2 sub %eax,%edx + a = sbrk(0); +- 339a: 89 c3 mov %eax,%ebx ++ 3421: 89 c3 mov %eax,%ebx + p = sbrk(amt); +- 339c: 89 14 24 mov %edx,(%esp) +- 339f: e8 76 0b 00 00 call 3f1a +- if (p != a) { +- 33a4: 39 d8 cmp %ebx,%eax +- 33a6: 0f 85 ec 02 00 00 jne 3698 ++ 3423: 89 14 24 mov %edx,(%esp) ++ 3426: e8 bf 0b 00 00 call 3fea ++ if (p != a) ++ 342b: 39 d8 cmp %ebx,%eax ++ 342d: 0f 85 07 03 00 00 jne 373a + *lastaddr = 99; +- 33ac: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff ++ 3433: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff + a = sbrk(0); +- 33b3: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 33ba: e8 5b 0b 00 00 call 3f1a ++ 343a: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3441: e8 a4 0b 00 00 call 3fea + c = sbrk(-4096); +- 33bf: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp) ++ 3446: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp) + a = sbrk(0); +- 33c6: 89 c3 mov %eax,%ebx ++ 344d: 89 c3 mov %eax,%ebx + c = sbrk(-4096); +- 33c8: e8 4d 0b 00 00 call 3f1a +- if(c == (char*)0xffffffff){ +- 33cd: 83 f8 ff cmp $0xffffffff,%eax +- 33d0: 0f 84 e1 02 00 00 je 36b7 ++ 344f: e8 96 0b 00 00 call 3fea ++ if (c == (char *)0xffffffff) ++ 3454: 83 f8 ff cmp $0xffffffff,%eax ++ 3457: 0f 84 fc 02 00 00 je 3759 + c = sbrk(0); +- 33d6: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 33dd: e8 38 0b 00 00 call 3f1a +- if(c != a - 4096){ +- 33e2: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx +- 33e8: 39 d0 cmp %edx,%eax +- 33ea: 0f 85 b5 02 00 00 jne 36a5 ++ 345d: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3464: e8 81 0b 00 00 call 3fea ++ if (c != a - 4096) ++ 3469: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx ++ 346f: 39 d0 cmp %edx,%eax ++ 3471: 0f 85 d0 02 00 00 jne 3747 + a = sbrk(0); +- 33f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 33f7: e8 1e 0b 00 00 call 3f1a ++ 3477: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 347e: e8 67 0b 00 00 call 3fea + c = sbrk(4096); +- 33fc: c7 04 24 00 10 00 00 movl $0x1000,(%esp) ++ 3483: c7 04 24 00 10 00 00 movl $0x1000,(%esp) + a = sbrk(0); +- 3403: 89 c6 mov %eax,%esi ++ 348a: 89 c6 mov %eax,%esi + c = sbrk(4096); +- 3405: e8 10 0b 00 00 call 3f1a +- if(c != a || sbrk(0) != a + 4096){ +- 340a: 39 f0 cmp %esi,%eax ++ 348c: e8 59 0b 00 00 call 3fea ++ if (c != a || sbrk(0) != a + 4096) ++ 3491: 39 f0 cmp %esi,%eax + c = sbrk(4096); +- 340c: 89 c3 mov %eax,%ebx +- if(c != a || sbrk(0) != a + 4096){ +- 340e: 0f 85 72 02 00 00 jne 3686 +- 3414: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 341b: e8 fa 0a 00 00 call 3f1a +- 3420: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx +- 3426: 39 d0 cmp %edx,%eax +- 3428: 0f 85 58 02 00 00 jne 3686 +- if(*lastaddr == 99){ +- 342e: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff +- 3435: 0f 84 3e 02 00 00 je 3679 ++ 3493: 89 c3 mov %eax,%ebx ++ if (c != a || sbrk(0) != a + 4096) ++ 3495: 0f 85 8d 02 00 00 jne 3728 ++ 349b: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 34a2: e8 43 0b 00 00 call 3fea ++ 34a7: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx ++ 34ad: 39 d0 cmp %edx,%eax ++ 34af: 0f 85 73 02 00 00 jne 3728 ++ if (*lastaddr == 99) ++ 34b5: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff ++ 34bc: 0f 84 59 02 00 00 je 371b + a = sbrk(0); +- 343b: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3442: e8 d3 0a 00 00 call 3f1a ++ 34c2: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 34c9: e8 1c 0b 00 00 call 3fea + c = sbrk(-(sbrk(0) - oldbrk)); +- 3447: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 34ce: c7 04 24 00 00 00 00 movl $0x0,(%esp) + a = sbrk(0); +- 344e: 89 c3 mov %eax,%ebx ++ 34d5: 89 c3 mov %eax,%ebx + c = sbrk(-(sbrk(0) - oldbrk)); +- 3450: e8 c5 0a 00 00 call 3f1a +- 3455: 8b 4d a4 mov -0x5c(%ebp),%ecx +- 3458: 29 c1 sub %eax,%ecx +- 345a: 89 0c 24 mov %ecx,(%esp) +- 345d: e8 b8 0a 00 00 call 3f1a +- if(c != a){ +- 3462: 39 d8 cmp %ebx,%eax +- 3464: 0f 85 f0 01 00 00 jne 365a +- 346a: bb 00 00 00 80 mov $0x80000000,%ebx +- 346f: 90 nop ++ 34d7: e8 0e 0b 00 00 call 3fea ++ 34dc: 8b 4d a4 mov -0x5c(%ebp),%ecx ++ 34df: 29 c1 sub %eax,%ecx ++ 34e1: 89 0c 24 mov %ecx,(%esp) ++ 34e4: e8 01 0b 00 00 call 3fea ++ if (c != a) ++ 34e9: 39 d8 cmp %ebx,%eax ++ 34eb: 0f 85 01 02 00 00 jne 36f2 ++ 34f1: bb 00 00 00 80 mov $0x80000000,%ebx ++ 34f6: 66 90 xchg %ax,%ax + ppid = getpid(); +- 3470: e8 9d 0a 00 00 call 3f12 +- 3475: 89 c6 mov %eax,%esi ++ 34f8: e8 e5 0a 00 00 call 3fe2 ++ 34fd: 89 c6 mov %eax,%esi + pid = fork(); +- 3477: e8 0e 0a 00 00 call 3e8a +- if(pid < 0){ +- 347c: 85 c0 test %eax,%eax +- 347e: 0f 88 cc 01 00 00 js 3650 +- if(pid == 0){ +- 3484: 0f 84 92 01 00 00 je 361c +- for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){ +- 348a: 81 c3 50 c3 00 00 add $0xc350,%ebx +- wait(); +- 3490: e8 05 0a 00 00 call 3e9a +- for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){ +- 3495: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx +- 349b: 75 d3 jne 3470 +- if(pipe(fds) != 0){ +- 349d: 8d 45 b8 lea -0x48(%ebp),%eax +- 34a0: 89 04 24 mov %eax,(%esp) +- 34a3: e8 fa 09 00 00 call 3ea2 +- 34a8: 85 c0 test %eax,%eax +- 34aa: 0f 85 4c 01 00 00 jne 35fc +- 34b0: 8d 5d e8 lea -0x18(%ebp),%ebx +- 34b3: 8d 75 c0 lea -0x40(%ebp),%esi ++ 34ff: e8 56 0a 00 00 call 3f5a ++ if (pid < 0) ++ 3504: 85 c0 test %eax,%eax ++ 3506: 0f 88 dc 01 00 00 js 36e8 ++ 350c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ if (pid == 0) ++ 3510: 0f 84 9e 01 00 00 je 36b4 ++ wait(0); ++ 3516: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) ++ 351d: 81 c3 50 c3 00 00 add $0xc350,%ebx ++ wait(0); ++ 3523: e8 42 0a 00 00 call 3f6a ++ for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) ++ 3528: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx ++ 352e: 75 c8 jne 34f8 ++ if (pipe(fds) != 0) ++ 3530: 8d 45 b8 lea -0x48(%ebp),%eax ++ 3533: 89 04 24 mov %eax,(%esp) ++ 3536: e8 37 0a 00 00 call 3f72 ++ 353b: 85 c0 test %eax,%eax ++ 353d: 0f 85 51 01 00 00 jne 3694 ++ 3543: 8d 5d e8 lea -0x18(%ebp),%ebx ++ 3546: 8d 75 c0 lea -0x40(%ebp),%esi + read(fds[0], &scratch, 1); +- 34b6: 8d 7d b7 lea -0x49(%ebp),%edi +- if((pids[i] = fork()) == 0){ +- 34b9: e8 cc 09 00 00 call 3e8a +- 34be: 85 c0 test %eax,%eax +- 34c0: 89 06 mov %eax,(%esi) +- 34c2: 0f 84 9f 00 00 00 je 3567 +- if(pids[i] != -1) +- 34c8: 83 f8 ff cmp $0xffffffff,%eax +- 34cb: 74 17 je 34e4 ++ 3549: 8d 7d b7 lea -0x49(%ebp),%edi ++ if ((pids[i] = fork()) == 0) ++ 354c: e8 09 0a 00 00 call 3f5a ++ 3551: 85 c0 test %eax,%eax ++ 3553: 89 06 mov %eax,(%esi) ++ 3555: 0f 84 a6 00 00 00 je 3601 ++ if (pids[i] != -1) ++ 355b: 83 f8 ff cmp $0xffffffff,%eax ++ 355e: 74 17 je 3577 + read(fds[0], &scratch, 1); +- 34cd: 8b 45 b8 mov -0x48(%ebp),%eax +- 34d0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 34d7: 00 +- 34d8: 89 7c 24 04 mov %edi,0x4(%esp) +- 34dc: 89 04 24 mov %eax,(%esp) +- 34df: e8 c6 09 00 00 call 3eaa +- 34e4: 83 c6 04 add $0x4,%esi +- for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ +- 34e7: 39 de cmp %ebx,%esi +- 34e9: 75 ce jne 34b9 ++ 3560: 8b 45 b8 mov -0x48(%ebp),%eax ++ 3563: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 356a: 00 ++ 356b: 89 7c 24 04 mov %edi,0x4(%esp) ++ 356f: 89 04 24 mov %eax,(%esp) ++ 3572: e8 03 0a 00 00 call 3f7a ++ 3577: 83 c6 04 add $0x4,%esi ++ for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) ++ 357a: 39 de cmp %ebx,%esi ++ 357c: 75 ce jne 354c + c = sbrk(4096); +- 34eb: c7 04 24 00 10 00 00 movl $0x1000,(%esp) +- 34f2: 8d 75 c0 lea -0x40(%ebp),%esi +- 34f5: e8 20 0a 00 00 call 3f1a +- 34fa: 89 c7 mov %eax,%edi +- if(pids[i] == -1) +- 34fc: 8b 06 mov (%esi),%eax +- 34fe: 83 f8 ff cmp $0xffffffff,%eax +- 3501: 74 0d je 3510 ++ 357e: c7 04 24 00 10 00 00 movl $0x1000,(%esp) ++ 3585: 8d 75 c0 lea -0x40(%ebp),%esi ++ 3588: e8 5d 0a 00 00 call 3fea ++ 358d: 89 c7 mov %eax,%edi ++ if (pids[i] == -1) ++ 358f: 8b 06 mov (%esi),%eax ++ 3591: 83 f8 ff cmp $0xffffffff,%eax ++ 3594: 74 14 je 35aa + kill(pids[i]); +- 3503: 89 04 24 mov %eax,(%esp) +- 3506: e8 b7 09 00 00 call 3ec2 +- wait(); +- 350b: e8 8a 09 00 00 call 3e9a +- 3510: 83 c6 04 add $0x4,%esi +- for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ +- 3513: 39 f3 cmp %esi,%ebx +- 3515: 75 e5 jne 34fc +- if(c == (char*)0xffffffff){ +- 3517: 83 ff ff cmp $0xffffffff,%edi +- 351a: 0f 84 bb 00 00 00 je 35db +- if(sbrk(0) > oldbrk) +- 3520: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3527: e8 ee 09 00 00 call 3f1a +- 352c: 39 45 a4 cmp %eax,-0x5c(%ebp) +- 352f: 73 19 jae 354a ++ 3596: 89 04 24 mov %eax,(%esp) ++ 3599: e8 f4 09 00 00 call 3f92 ++ wait(0); ++ 359e: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 35a5: e8 c0 09 00 00 call 3f6a ++ 35aa: 83 c6 04 add $0x4,%esi ++ for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) ++ 35ad: 39 f3 cmp %esi,%ebx ++ 35af: 75 de jne 358f ++ if (c == (char *)0xffffffff) ++ 35b1: 83 ff ff cmp $0xffffffff,%edi ++ 35b4: 0f 84 b9 00 00 00 je 3673 ++ if (sbrk(0) > oldbrk) ++ 35ba: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 35c1: e8 24 0a 00 00 call 3fea ++ 35c6: 39 45 a4 cmp %eax,-0x5c(%ebp) ++ 35c9: 73 19 jae 35e4 + sbrk(-(sbrk(0) - oldbrk)); +- 3531: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3538: e8 dd 09 00 00 call 3f1a +- 353d: 8b 7d a4 mov -0x5c(%ebp),%edi +- 3540: 29 c7 sub %eax,%edi +- 3542: 89 3c 24 mov %edi,(%esp) +- 3545: e8 d0 09 00 00 call 3f1a ++ 35cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 35d2: e8 13 0a 00 00 call 3fea ++ 35d7: 8b 7d a4 mov -0x5c(%ebp),%edi ++ 35da: 29 c7 sub %eax,%edi ++ 35dc: 89 3c 24 mov %edi,(%esp) ++ 35df: e8 06 0a 00 00 call 3fea + printf(stdout, "sbrk test OK\n"); +- 354a: a1 c4 63 00 00 mov 0x63c4,%eax +- 354f: c7 44 24 04 e0 51 00 movl $0x51e0,0x4(%esp) +- 3556: 00 +- 3557: 89 04 24 mov %eax,(%esp) +- 355a: e8 81 0a 00 00 call 3fe0 ++ 35e4: a1 94 64 00 00 mov 0x6494,%eax ++ 35e9: c7 44 24 04 b0 52 00 movl $0x52b0,0x4(%esp) ++ 35f0: 00 ++ 35f1: 89 04 24 mov %eax,(%esp) ++ 35f4: e8 b7 0a 00 00 call 40b0 + } +- 355f: 83 c4 6c add $0x6c,%esp +- 3562: 5b pop %ebx +- 3563: 5e pop %esi +- 3564: 5f pop %edi +- 3565: 5d pop %ebp +- 3566: c3 ret ++ 35f9: 83 c4 6c add $0x6c,%esp ++ 35fc: 5b pop %ebx ++ 35fd: 5e pop %esi ++ 35fe: 5f pop %edi ++ 35ff: 5d pop %ebp ++ 3600: c3 ret + sbrk(BIG - (uint)sbrk(0)); +- 3567: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 356e: e8 a7 09 00 00 call 3f1a +- 3573: ba 00 00 40 06 mov $0x6400000,%edx +- 3578: 29 c2 sub %eax,%edx +- 357a: 89 14 24 mov %edx,(%esp) +- 357d: e8 98 09 00 00 call 3f1a ++ 3601: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3608: e8 dd 09 00 00 call 3fea ++ 360d: ba 00 00 40 06 mov $0x6400000,%edx ++ 3612: 29 c2 sub %eax,%edx ++ 3614: 89 14 24 mov %edx,(%esp) ++ 3617: e8 ce 09 00 00 call 3fea + write(fds[1], "x", 1); +- 3582: 8b 45 bc mov -0x44(%ebp),%eax +- 3585: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 358c: 00 +- 358d: c7 44 24 04 a1 4c 00 movl $0x4ca1,0x4(%esp) +- 3594: 00 +- 3595: 89 04 24 mov %eax,(%esp) +- 3598: e8 15 09 00 00 call 3eb2 +- 359d: 8d 76 00 lea 0x0(%esi),%esi +- for(;;) sleep(1000); +- 35a0: c7 04 24 e8 03 00 00 movl $0x3e8,(%esp) +- 35a7: e8 76 09 00 00 call 3f22 +- 35ac: eb f2 jmp 35a0 ++ 361c: 8b 45 bc mov -0x44(%ebp),%eax ++ 361f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 3626: 00 ++ 3627: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) ++ 362e: 00 ++ 362f: 89 04 24 mov %eax,(%esp) ++ 3632: e8 4b 09 00 00 call 3f82 ++ 3637: 90 nop ++ sleep(1000); ++ 3638: c7 04 24 e8 03 00 00 movl $0x3e8,(%esp) ++ 363f: e8 ae 09 00 00 call 3ff2 ++ 3644: eb f2 jmp 3638 + printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); +- 35ae: 89 44 24 10 mov %eax,0x10(%esp) +- 35b2: a1 c4 63 00 00 mov 0x63c4,%eax +- 35b7: 89 5c 24 0c mov %ebx,0xc(%esp) +- 35bb: 89 74 24 08 mov %esi,0x8(%esp) +- 35bf: c7 44 24 04 43 51 00 movl $0x5143,0x4(%esp) +- 35c6: 00 +- 35c7: 89 04 24 mov %eax,(%esp) +- 35ca: e8 11 0a 00 00 call 3fe0 ++ 3646: 89 44 24 10 mov %eax,0x10(%esp) ++ 364a: a1 94 64 00 00 mov 0x6494,%eax ++ 364f: 89 5c 24 0c mov %ebx,0xc(%esp) ++ 3653: 89 74 24 08 mov %esi,0x8(%esp) ++ 3657: c7 44 24 04 13 52 00 movl $0x5213,0x4(%esp) ++ 365e: 00 ++ 365f: 89 04 24 mov %eax,(%esp) ++ 3662: e8 49 0a 00 00 call 40b0 + exit(0); +- 35cf: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 35d6: e8 b7 08 00 00 call 3e92 ++ 3667: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 366e: e8 ef 08 00 00 call 3f62 + printf(stdout, "failed sbrk leaked memory\n"); +- 35db: c7 44 24 04 c5 51 00 movl $0x51c5,0x4(%esp) +- 35e2: 00 ++ 3673: c7 44 24 04 95 52 00 movl $0x5295,0x4(%esp) ++ 367a: 00 + printf(stdout, "sbrk test failed post-fork\n"); +- 35e3: a1 c4 63 00 00 mov 0x63c4,%eax +- 35e8: 89 04 24 mov %eax,(%esp) +- 35eb: e8 f0 09 00 00 call 3fe0 ++ 367b: a1 94 64 00 00 mov 0x6494,%eax ++ 3680: 89 04 24 mov %eax,(%esp) ++ 3683: e8 28 0a 00 00 call 40b0 + exit(0); +- 35f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 35f7: e8 96 08 00 00 call 3e92 ++ 3688: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 368f: e8 ce 08 00 00 call 3f62 + printf(1, "pipe() failed\n"); +- 35fc: c7 44 24 04 81 46 00 movl $0x4681,0x4(%esp) +- 3603: 00 +- 3604: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 360b: e8 d0 09 00 00 call 3fe0 ++ 3694: c7 44 24 04 51 47 00 movl $0x4751,0x4(%esp) ++ 369b: 00 ++ 369c: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 36a3: e8 08 0a 00 00 call 40b0 + exit(0); +- 3610: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3617: e8 76 08 00 00 call 3e92 ++ 36a8: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 36af: e8 ae 08 00 00 call 3f62 + printf(stdout, "oops could read %x = %x\n", a, *a); +- 361c: 0f be 03 movsbl (%ebx),%eax +- 361f: 89 5c 24 08 mov %ebx,0x8(%esp) +- 3623: c7 44 24 04 ac 51 00 movl $0x51ac,0x4(%esp) +- 362a: 00 +- 362b: 89 44 24 0c mov %eax,0xc(%esp) +- 362f: a1 c4 63 00 00 mov 0x63c4,%eax +- 3634: 89 04 24 mov %eax,(%esp) +- 3637: e8 a4 09 00 00 call 3fe0 ++ 36b4: 0f be 03 movsbl (%ebx),%eax ++ 36b7: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 36bb: c7 44 24 04 7c 52 00 movl $0x527c,0x4(%esp) ++ 36c2: 00 ++ 36c3: 89 44 24 0c mov %eax,0xc(%esp) ++ 36c7: a1 94 64 00 00 mov 0x6494,%eax ++ 36cc: 89 04 24 mov %eax,(%esp) ++ 36cf: e8 dc 09 00 00 call 40b0 + kill(ppid); +- 363c: 89 34 24 mov %esi,(%esp) +- 363f: e8 7e 08 00 00 call 3ec2 ++ 36d4: 89 34 24 mov %esi,(%esp) ++ 36d7: e8 b6 08 00 00 call 3f92 + exit(0); +- 3644: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 364b: e8 42 08 00 00 call 3e92 ++ 36dc: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 36e3: e8 7a 08 00 00 call 3f62 + printf(stdout, "fork failed\n"); +- 3650: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 3657: 00 +- 3658: eb 89 jmp 35e3 ++ 36e8: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 36ef: 00 ++ 36f0: eb 89 jmp 367b + printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); +- 365a: 89 44 24 0c mov %eax,0xc(%esp) +- 365e: 89 5c 24 08 mov %ebx,0x8(%esp) +- 3662: c7 44 24 04 8c 59 00 movl $0x598c,0x4(%esp) +- 3669: 00 +- 366a: a1 c4 63 00 00 mov 0x63c4,%eax +- 366f: 89 04 24 mov %eax,(%esp) +- 3672: e8 69 09 00 00 call 3fe0 +- 3677: eb 97 jmp 3610 ++ 36f2: 89 44 24 0c mov %eax,0xc(%esp) ++ 36f6: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 36fa: c7 44 24 04 5c 5a 00 movl $0x5a5c,0x4(%esp) ++ 3701: 00 ++ 3702: a1 94 64 00 00 mov 0x6494,%eax ++ 3707: 89 04 24 mov %eax,(%esp) ++ 370a: e8 a1 09 00 00 call 40b0 ++ exit(0); ++ 370f: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3716: e8 47 08 00 00 call 3f62 + printf(stdout, "sbrk de-allocation didn't really deallocate\n"); +- 3679: c7 44 24 04 5c 59 00 movl $0x595c,0x4(%esp) +- 3680: 00 +- 3681: e9 5d ff ff ff jmp 35e3 ++ 371b: c7 44 24 04 2c 5a 00 movl $0x5a2c,0x4(%esp) ++ 3722: 00 ++ 3723: e9 53 ff ff ff jmp 367b + printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); +- 3686: 89 5c 24 0c mov %ebx,0xc(%esp) +- 368a: 89 74 24 08 mov %esi,0x8(%esp) +- 368e: c7 44 24 04 34 59 00 movl $0x5934,0x4(%esp) +- 3695: 00 +- 3696: eb d2 jmp 366a ++ 3728: 89 5c 24 0c mov %ebx,0xc(%esp) ++ 372c: 89 74 24 08 mov %esi,0x8(%esp) ++ 3730: c7 44 24 04 04 5a 00 movl $0x5a04,0x4(%esp) ++ 3737: 00 ++ 3738: eb c8 jmp 3702 + printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); +- 3698: c7 44 24 04 bc 58 00 movl $0x58bc,0x4(%esp) +- 369f: 00 +- 36a0: e9 3e ff ff ff jmp 35e3 ++ 373a: c7 44 24 04 8c 59 00 movl $0x598c,0x4(%esp) ++ 3741: 00 ++ 3742: e9 34 ff ff ff jmp 367b + printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); +- 36a5: 89 44 24 0c mov %eax,0xc(%esp) +- 36a9: 89 5c 24 08 mov %ebx,0x8(%esp) +- 36ad: c7 44 24 04 fc 58 00 movl $0x58fc,0x4(%esp) +- 36b4: 00 +- 36b5: eb b3 jmp 366a ++ 3747: 89 44 24 0c mov %eax,0xc(%esp) ++ 374b: 89 5c 24 08 mov %ebx,0x8(%esp) ++ 374f: c7 44 24 04 cc 59 00 movl $0x59cc,0x4(%esp) ++ 3756: 00 ++ 3757: eb a9 jmp 3702 + printf(stdout, "sbrk could not deallocate\n"); +- 36b7: c7 44 24 04 91 51 00 movl $0x5191,0x4(%esp) +- 36be: 00 +- 36bf: e9 1f ff ff ff jmp 35e3 ++ 3759: c7 44 24 04 61 52 00 movl $0x5261,0x4(%esp) ++ 3760: 00 ++ 3761: e9 15 ff ff ff jmp 367b + printf(stdout, "sbrk test failed post-fork\n"); +- 36c4: c7 44 24 04 75 51 00 movl $0x5175,0x4(%esp) +- 36cb: 00 +- 36cc: e9 12 ff ff ff jmp 35e3 ++ 3766: c7 44 24 04 45 52 00 movl $0x5245,0x4(%esp) ++ 376d: 00 ++ 376e: e9 08 ff ff ff jmp 367b + printf(stdout, "sbrk test fork failed\n"); +- 36d1: c7 44 24 04 5e 51 00 movl $0x515e,0x4(%esp) +- 36d8: 00 +- 36d9: e9 05 ff ff ff jmp 35e3 +- 36de: 66 90 xchg %ax,%ax ++ 3773: c7 44 24 04 2e 52 00 movl $0x522e,0x4(%esp) ++ 377a: 00 ++ 377b: e9 fb fe ff ff jmp 367b + +-000036e0 : ++00003780 : + { +- 36e0: 55 push %ebp +- 36e1: 89 e5 mov %esp,%ebp ++ 3780: 55 push %ebp ++ 3781: 89 e5 mov %esp,%ebp + } +- 36e3: 5d pop %ebp +- 36e4: c3 ret +- 36e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 36e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 3783: 5d pop %ebp ++ 3784: c3 ret ++ 3785: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-000036f0 : ++00003790 : + { +- 36f0: 55 push %ebp +- 36f1: 89 e5 mov %esp,%ebp +- 36f3: 56 push %esi +- 36f4: 53 push %ebx +- for(p = 0; p <= (uint)hi; p += 4096){ +- 36f5: 31 db xor %ebx,%ebx ++ 3790: 55 push %ebp ++ 3791: 89 e5 mov %esp,%ebp ++ 3793: 56 push %esi ++ 3794: 53 push %ebx ++ for (p = 0; p <= (uint)hi; p += 4096) ++ 3795: 31 db xor %ebx,%ebx + { +- 36f7: 83 ec 10 sub $0x10,%esp ++ 3797: 83 ec 10 sub $0x10,%esp + printf(stdout, "validate test\n"); +- 36fa: a1 c4 63 00 00 mov 0x63c4,%eax +- 36ff: c7 44 24 04 ee 51 00 movl $0x51ee,0x4(%esp) +- 3706: 00 +- 3707: 89 04 24 mov %eax,(%esp) +- 370a: e8 d1 08 00 00 call 3fe0 +- 370f: 90 nop +- if((pid = fork()) == 0){ +- 3710: e8 75 07 00 00 call 3e8a ++ 379a: a1 94 64 00 00 mov 0x6494,%eax ++ 379f: c7 44 24 04 be 52 00 movl $0x52be,0x4(%esp) ++ 37a6: 00 ++ 37a7: 89 04 24 mov %eax,(%esp) ++ 37aa: e8 01 09 00 00 call 40b0 ++ 37af: 90 nop ++ if ((pid = fork()) == 0) ++ 37b0: e8 a5 07 00 00 call 3f5a + exit(0); +- 3715: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- if((pid = fork()) == 0){ +- 371c: 85 c0 test %eax,%eax +- 371e: 89 c6 mov %eax,%esi +- 3720: 74 79 je 379b ++ 37b5: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ if ((pid = fork()) == 0) ++ 37bc: 85 c0 test %eax,%eax ++ 37be: 89 c6 mov %eax,%esi ++ 37c0: 0f 84 80 00 00 00 je 3846 + sleep(0); +- 3722: e8 fb 07 00 00 call 3f22 ++ 37c6: e8 27 08 00 00 call 3ff2 + sleep(0); +- 3727: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 372e: e8 ef 07 00 00 call 3f22 ++ 37cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 37d2: e8 1b 08 00 00 call 3ff2 + kill(pid); +- 3733: 89 34 24 mov %esi,(%esp) +- 3736: e8 87 07 00 00 call 3ec2 +- wait(); +- 373b: e8 5a 07 00 00 call 3e9a +- if(link("nosuchfile", (char*)p) != -1){ +- 3740: 89 5c 24 04 mov %ebx,0x4(%esp) +- 3744: c7 04 24 fd 51 00 00 movl $0x51fd,(%esp) +- 374b: e8 a2 07 00 00 call 3ef2 +- 3750: 83 f8 ff cmp $0xffffffff,%eax +- 3753: 75 2a jne 377f +- for(p = 0; p <= (uint)hi; p += 4096){ +- 3755: 81 c3 00 10 00 00 add $0x1000,%ebx +- 375b: 81 fb 00 40 11 00 cmp $0x114000,%ebx +- 3761: 75 ad jne 3710 ++ 37d7: 89 34 24 mov %esi,(%esp) ++ 37da: e8 b3 07 00 00 call 3f92 ++ wait(0); ++ 37df: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 37e6: e8 7f 07 00 00 call 3f6a ++ if (link("nosuchfile", (char *)p) != -1) ++ 37eb: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 37ef: c7 04 24 cd 52 00 00 movl $0x52cd,(%esp) ++ 37f6: e8 c7 07 00 00 call 3fc2 ++ 37fb: 83 f8 ff cmp $0xffffffff,%eax ++ 37fe: 75 2a jne 382a ++ for (p = 0; p <= (uint)hi; p += 4096) ++ 3800: 81 c3 00 10 00 00 add $0x1000,%ebx ++ 3806: 81 fb 00 40 11 00 cmp $0x114000,%ebx ++ 380c: 75 a2 jne 37b0 + printf(stdout, "validate ok\n"); +- 3763: a1 c4 63 00 00 mov 0x63c4,%eax +- 3768: c7 44 24 04 21 52 00 movl $0x5221,0x4(%esp) +- 376f: 00 +- 3770: 89 04 24 mov %eax,(%esp) +- 3773: e8 68 08 00 00 call 3fe0 ++ 380e: a1 94 64 00 00 mov 0x6494,%eax ++ 3813: c7 44 24 04 f1 52 00 movl $0x52f1,0x4(%esp) ++ 381a: 00 ++ 381b: 89 04 24 mov %eax,(%esp) ++ 381e: e8 8d 08 00 00 call 40b0 + } +- 3778: 83 c4 10 add $0x10,%esp +- 377b: 5b pop %ebx +- 377c: 5e pop %esi +- 377d: 5d pop %ebp +- 377e: c3 ret ++ 3823: 83 c4 10 add $0x10,%esp ++ 3826: 5b pop %ebx ++ 3827: 5e pop %esi ++ 3828: 5d pop %ebp ++ 3829: c3 ret + printf(stdout, "link should not succeed\n"); +- 377f: a1 c4 63 00 00 mov 0x63c4,%eax +- 3784: c7 44 24 04 08 52 00 movl $0x5208,0x4(%esp) +- 378b: 00 +- 378c: 89 04 24 mov %eax,(%esp) +- 378f: e8 4c 08 00 00 call 3fe0 ++ 382a: a1 94 64 00 00 mov 0x6494,%eax ++ 382f: c7 44 24 04 d8 52 00 movl $0x52d8,0x4(%esp) ++ 3836: 00 ++ 3837: 89 04 24 mov %eax,(%esp) ++ 383a: e8 71 08 00 00 call 40b0 + exit(0); +- 3794: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 379b: e8 f2 06 00 00 call 3e92 ++ 383f: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3846: e8 17 07 00 00 call 3f62 ++ 384b: 90 nop ++ 384c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +-000037a0 : ++00003850 : + { +- 37a0: 55 push %ebp +- 37a1: 89 e5 mov %esp,%ebp +- 37a3: 83 ec 18 sub $0x18,%esp ++ 3850: 55 push %ebp ++ 3851: 89 e5 mov %esp,%ebp ++ 3853: 83 ec 18 sub $0x18,%esp + printf(stdout, "bss test\n"); +- 37a6: a1 c4 63 00 00 mov 0x63c4,%eax +- 37ab: c7 44 24 04 2e 52 00 movl $0x522e,0x4(%esp) +- 37b2: 00 +- 37b3: 89 04 24 mov %eax,(%esp) +- 37b6: e8 25 08 00 00 call 3fe0 +- if(uninit[i] != '\0'){ +- 37bb: 80 3d 80 64 00 00 00 cmpb $0x0,0x6480 +- 37c2: 75 36 jne 37fa +- for(i = 0; i < sizeof(uninit); i++){ +- 37c4: b8 01 00 00 00 mov $0x1,%eax +- 37c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- if(uninit[i] != '\0'){ +- 37d0: 80 b8 80 64 00 00 00 cmpb $0x0,0x6480(%eax) +- 37d7: 75 21 jne 37fa +- for(i = 0; i < sizeof(uninit); i++){ +- 37d9: 83 c0 01 add $0x1,%eax +- 37dc: 3d 10 27 00 00 cmp $0x2710,%eax +- 37e1: 75 ed jne 37d0 ++ 3856: a1 94 64 00 00 mov 0x6494,%eax ++ 385b: c7 44 24 04 fe 52 00 movl $0x52fe,0x4(%esp) ++ 3862: 00 ++ 3863: 89 04 24 mov %eax,(%esp) ++ 3866: e8 45 08 00 00 call 40b0 ++ if (uninit[i] != '\0') ++ 386b: 80 3d 60 65 00 00 00 cmpb $0x0,0x6560 ++ 3872: 75 36 jne 38aa ++ for (i = 0; i < sizeof(uninit); i++) ++ 3874: b8 01 00 00 00 mov $0x1,%eax ++ 3879: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ if (uninit[i] != '\0') ++ 3880: 80 b8 60 65 00 00 00 cmpb $0x0,0x6560(%eax) ++ 3887: 75 21 jne 38aa ++ for (i = 0; i < sizeof(uninit); i++) ++ 3889: 83 c0 01 add $0x1,%eax ++ 388c: 3d 10 27 00 00 cmp $0x2710,%eax ++ 3891: 75 ed jne 3880 + printf(stdout, "bss test ok\n"); +- 37e3: a1 c4 63 00 00 mov 0x63c4,%eax +- 37e8: c7 44 24 04 49 52 00 movl $0x5249,0x4(%esp) +- 37ef: 00 +- 37f0: 89 04 24 mov %eax,(%esp) +- 37f3: e8 e8 07 00 00 call 3fe0 ++ 3893: a1 94 64 00 00 mov 0x6494,%eax ++ 3898: c7 44 24 04 19 53 00 movl $0x5319,0x4(%esp) ++ 389f: 00 ++ 38a0: 89 04 24 mov %eax,(%esp) ++ 38a3: e8 08 08 00 00 call 40b0 + } +- 37f8: c9 leave +- 37f9: c3 ret ++ 38a8: c9 leave ++ 38a9: c3 ret + printf(stdout, "bss test failed\n"); +- 37fa: a1 c4 63 00 00 mov 0x63c4,%eax +- 37ff: c7 44 24 04 38 52 00 movl $0x5238,0x4(%esp) +- 3806: 00 +- 3807: 89 04 24 mov %eax,(%esp) +- 380a: e8 d1 07 00 00 call 3fe0 ++ 38aa: a1 94 64 00 00 mov 0x6494,%eax ++ 38af: c7 44 24 04 08 53 00 movl $0x5308,0x4(%esp) ++ 38b6: 00 ++ 38b7: 89 04 24 mov %eax,(%esp) ++ 38ba: e8 f1 07 00 00 call 40b0 + exit(0); +- 380f: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3816: e8 77 06 00 00 call 3e92 +- 381b: 90 nop +- 381c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 38bf: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 38c6: e8 97 06 00 00 call 3f62 ++ 38cb: 90 nop ++ 38cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +-00003820 : ++000038d0 : + { +- 3820: 55 push %ebp +- 3821: 89 e5 mov %esp,%ebp +- 3823: 83 ec 18 sub $0x18,%esp ++ 38d0: 55 push %ebp ++ 38d1: 89 e5 mov %esp,%ebp ++ 38d3: 83 ec 18 sub $0x18,%esp + unlink("bigarg-ok"); +- 3826: c7 04 24 56 52 00 00 movl $0x5256,(%esp) +- 382d: e8 b0 06 00 00 call 3ee2 ++ 38d6: c7 04 24 26 53 00 00 movl $0x5326,(%esp) ++ 38dd: e8 d0 06 00 00 call 3fb2 + pid = fork(); +- 3832: e8 53 06 00 00 call 3e8a +- if(pid == 0){ +- 3837: 85 c0 test %eax,%eax +- 3839: 74 45 je 3880 +- 383b: 90 nop +- 383c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- } else if(pid < 0){ +- 3840: 0f 88 de 00 00 00 js 3924 +- wait(); +- 3846: e8 4f 06 00 00 call 3e9a ++ 38e2: e8 73 06 00 00 call 3f5a ++ if (pid == 0) ++ 38e7: 85 c0 test %eax,%eax ++ 38e9: 74 4d je 3938 ++ 38eb: 90 nop ++ 38ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ else if (pid < 0) ++ 38f0: 0f 88 e6 00 00 00 js 39dc ++ wait(0); ++ 38f6: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 38fd: e8 68 06 00 00 call 3f6a + fd = open("bigarg-ok", 0); +- 384b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 3852: 00 +- 3853: c7 04 24 56 52 00 00 movl $0x5256,(%esp) +- 385a: e8 73 06 00 00 call 3ed2 +- if(fd < 0){ +- 385f: 85 c0 test %eax,%eax +- 3861: 0f 88 9c 00 00 00 js 3903 ++ 3902: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 3909: 00 ++ 390a: c7 04 24 26 53 00 00 movl $0x5326,(%esp) ++ 3911: e8 8c 06 00 00 call 3fa2 ++ if (fd < 0) ++ 3916: 85 c0 test %eax,%eax ++ 3918: 0f 88 9d 00 00 00 js 39bb + close(fd); +- 3867: 89 04 24 mov %eax,(%esp) +- 386a: e8 4b 06 00 00 call 3eba ++ 391e: 89 04 24 mov %eax,(%esp) ++ 3921: e8 64 06 00 00 call 3f8a + unlink("bigarg-ok"); +- 386f: c7 04 24 56 52 00 00 movl $0x5256,(%esp) +- 3876: e8 67 06 00 00 call 3ee2 ++ 3926: c7 04 24 26 53 00 00 movl $0x5326,(%esp) ++ 392d: e8 80 06 00 00 call 3fb2 + } +- 387b: c9 leave +- 387c: c3 ret +- 387d: 8d 76 00 lea 0x0(%esi),%esi ++ 3932: c9 leave ++ 3933: c3 ret ++ 3934: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + args[i] = "bigargs test: failed\n "; +- 3880: c7 04 85 e0 63 00 00 movl $0x59b0,0x63e0(,%eax,4) +- 3887: b0 59 00 00 +- for(i = 0; i < MAXARG-1; i++) +- 388b: 83 c0 01 add $0x1,%eax +- 388e: 83 f8 1f cmp $0x1f,%eax +- 3891: 75 ed jne 3880 ++ 3938: c7 04 85 c0 64 00 00 movl $0x5a80,0x64c0(,%eax,4) ++ 393f: 80 5a 00 00 ++ for (i = 0; i < MAXARG - 1; i++) ++ 3943: 83 c0 01 add $0x1,%eax ++ 3946: 83 f8 1f cmp $0x1f,%eax ++ 3949: 75 ed jne 3938 + printf(stdout, "bigarg test\n"); +- 3893: a1 c4 63 00 00 mov 0x63c4,%eax +- 3898: c7 44 24 04 60 52 00 movl $0x5260,0x4(%esp) +- 389f: 00 +- args[MAXARG-1] = 0; +- 38a0: c7 05 5c 64 00 00 00 movl $0x0,0x645c +- 38a7: 00 00 00 ++ 394b: a1 94 64 00 00 mov 0x6494,%eax ++ 3950: c7 44 24 04 30 53 00 movl $0x5330,0x4(%esp) ++ 3957: 00 ++ args[MAXARG - 1] = 0; ++ 3958: c7 05 3c 65 00 00 00 movl $0x0,0x653c ++ 395f: 00 00 00 + printf(stdout, "bigarg test\n"); +- 38aa: 89 04 24 mov %eax,(%esp) +- 38ad: e8 2e 07 00 00 call 3fe0 ++ 3962: 89 04 24 mov %eax,(%esp) ++ 3965: e8 46 07 00 00 call 40b0 + exec("echo", args); +- 38b2: c7 44 24 04 e0 63 00 movl $0x63e0,0x4(%esp) +- 38b9: 00 +- 38ba: c7 04 24 2d 44 00 00 movl $0x442d,(%esp) +- 38c1: e8 04 06 00 00 call 3eca ++ 396a: c7 44 24 04 c0 64 00 movl $0x64c0,0x4(%esp) ++ 3971: 00 ++ 3972: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) ++ 3979: e8 1c 06 00 00 call 3f9a + printf(stdout, "bigarg test ok\n"); +- 38c6: a1 c4 63 00 00 mov 0x63c4,%eax +- 38cb: c7 44 24 04 6d 52 00 movl $0x526d,0x4(%esp) +- 38d2: 00 +- 38d3: 89 04 24 mov %eax,(%esp) +- 38d6: e8 05 07 00 00 call 3fe0 ++ 397e: a1 94 64 00 00 mov 0x6494,%eax ++ 3983: c7 44 24 04 3d 53 00 movl $0x533d,0x4(%esp) ++ 398a: 00 ++ 398b: 89 04 24 mov %eax,(%esp) ++ 398e: e8 1d 07 00 00 call 40b0 + fd = open("bigarg-ok", O_CREATE); +- 38db: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) +- 38e2: 00 +- 38e3: c7 04 24 56 52 00 00 movl $0x5256,(%esp) +- 38ea: e8 e3 05 00 00 call 3ed2 ++ 3993: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) ++ 399a: 00 ++ 399b: c7 04 24 26 53 00 00 movl $0x5326,(%esp) ++ 39a2: e8 fb 05 00 00 call 3fa2 + close(fd); +- 38ef: 89 04 24 mov %eax,(%esp) +- 38f2: e8 c3 05 00 00 call 3eba ++ 39a7: 89 04 24 mov %eax,(%esp) ++ 39aa: e8 db 05 00 00 call 3f8a + exit(0); +- 38f7: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 38fe: e8 8f 05 00 00 call 3e92 ++ 39af: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 39b6: e8 a7 05 00 00 call 3f62 + printf(stdout, "bigarg test failed!\n"); +- 3903: c7 44 24 04 96 52 00 movl $0x5296,0x4(%esp) +- 390a: 00 +- 390b: a1 c4 63 00 00 mov 0x63c4,%eax +- 3910: 89 04 24 mov %eax,(%esp) +- 3913: e8 c8 06 00 00 call 3fe0 ++ 39bb: c7 44 24 04 66 53 00 movl $0x5366,0x4(%esp) ++ 39c2: 00 ++ 39c3: a1 94 64 00 00 mov 0x6494,%eax ++ 39c8: 89 04 24 mov %eax,(%esp) ++ 39cb: e8 e0 06 00 00 call 40b0 + exit(0); +- 3918: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 391f: e8 6e 05 00 00 call 3e92 ++ 39d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 39d7: e8 86 05 00 00 call 3f62 + printf(stdout, "bigargtest: fork failed\n"); +- 3924: c7 44 24 04 7d 52 00 movl $0x527d,0x4(%esp) +- 392b: 00 +- 392c: eb dd jmp 390b +- 392e: 66 90 xchg %ax,%ax ++ 39dc: c7 44 24 04 4d 53 00 movl $0x534d,0x4(%esp) ++ 39e3: 00 ++ 39e4: eb dd jmp 39c3 ++ 39e6: 8d 76 00 lea 0x0(%esi),%esi ++ 39e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00003930 : ++000039f0 : + { +- 3930: 55 push %ebp +- 3931: 89 e5 mov %esp,%ebp +- 3933: 57 push %edi +- 3934: 56 push %esi +- 3935: 53 push %ebx +- for(nfiles = 0; ; nfiles++){ +- 3936: 31 db xor %ebx,%ebx ++ 39f0: 55 push %ebp ++ 39f1: 89 e5 mov %esp,%ebp ++ 39f3: 57 push %edi ++ 39f4: 56 push %esi ++ 39f5: 53 push %ebx ++ for (nfiles = 0;; nfiles++) ++ 39f6: 31 db xor %ebx,%ebx + { +- 3938: 83 ec 5c sub $0x5c,%esp ++ 39f8: 83 ec 5c sub $0x5c,%esp + printf(1, "fsfull test\n"); +- 393b: c7 44 24 04 ab 52 00 movl $0x52ab,0x4(%esp) +- 3942: 00 +- 3943: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 394a: e8 91 06 00 00 call 3fe0 +- 394f: 90 nop ++ 39fb: c7 44 24 04 7b 53 00 movl $0x537b,0x4(%esp) ++ 3a02: 00 ++ 3a03: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3a0a: e8 a1 06 00 00 call 40b0 ++ 3a0f: 90 nop + name[1] = '0' + nfiles / 1000; +- 3950: b8 d3 4d 62 10 mov $0x10624dd3,%eax +- 3955: 89 d9 mov %ebx,%ecx +- 3957: f7 eb imul %ebx ++ 3a10: b8 d3 4d 62 10 mov $0x10624dd3,%eax ++ 3a15: 89 d9 mov %ebx,%ecx ++ 3a17: f7 eb imul %ebx + name[2] = '0' + (nfiles % 1000) / 100; +- 3959: 89 de mov %ebx,%esi ++ 3a19: 89 de mov %ebx,%esi + name[1] = '0' + nfiles / 1000; +- 395b: c1 f9 1f sar $0x1f,%ecx ++ 3a1b: c1 f9 1f sar $0x1f,%ecx + name[3] = '0' + (nfiles % 100) / 10; +- 395e: 89 df mov %ebx,%edi ++ 3a1e: 89 df mov %ebx,%edi + printf(1, "writing %s\n", name); +- 3960: c7 44 24 04 b8 52 00 movl $0x52b8,0x4(%esp) +- 3967: 00 +- 3968: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3a20: c7 44 24 04 88 53 00 movl $0x5388,0x4(%esp) ++ 3a27: 00 ++ 3a28: c7 04 24 01 00 00 00 movl $0x1,(%esp) + name[1] = '0' + nfiles / 1000; +- 396f: c1 fa 06 sar $0x6,%edx +- 3972: 29 ca sub %ecx,%edx +- 3974: 8d 42 30 lea 0x30(%edx),%eax ++ 3a2f: c1 fa 06 sar $0x6,%edx ++ 3a32: 29 ca sub %ecx,%edx ++ 3a34: 8d 42 30 lea 0x30(%edx),%eax + name[2] = '0' + (nfiles % 1000) / 100; +- 3977: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx ++ 3a37: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx + name[1] = '0' + nfiles / 1000; +- 397d: 88 45 a9 mov %al,-0x57(%ebp) ++ 3a3d: 88 45 a9 mov %al,-0x57(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; +- 3980: b8 1f 85 eb 51 mov $0x51eb851f,%eax ++ 3a40: b8 1f 85 eb 51 mov $0x51eb851f,%eax + name[0] = 'f'; +- 3985: c6 45 a8 66 movb $0x66,-0x58(%ebp) ++ 3a45: c6 45 a8 66 movb $0x66,-0x58(%ebp) + name[5] = '\0'; +- 3989: c6 45 ad 00 movb $0x0,-0x53(%ebp) ++ 3a49: c6 45 ad 00 movb $0x0,-0x53(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; +- 398d: 29 d6 sub %edx,%esi +- 398f: f7 ee imul %esi ++ 3a4d: 29 d6 sub %edx,%esi ++ 3a4f: f7 ee imul %esi + name[3] = '0' + (nfiles % 100) / 10; +- 3991: b8 1f 85 eb 51 mov $0x51eb851f,%eax ++ 3a51: b8 1f 85 eb 51 mov $0x51eb851f,%eax + name[2] = '0' + (nfiles % 1000) / 100; +- 3996: c1 fe 1f sar $0x1f,%esi +- 3999: c1 fa 05 sar $0x5,%edx +- 399c: 29 f2 sub %esi,%edx ++ 3a56: c1 fe 1f sar $0x1f,%esi ++ 3a59: c1 fa 05 sar $0x5,%edx ++ 3a5c: 29 f2 sub %esi,%edx + name[3] = '0' + (nfiles % 100) / 10; +- 399e: be 67 66 66 66 mov $0x66666667,%esi ++ 3a5e: be 67 66 66 66 mov $0x66666667,%esi + name[2] = '0' + (nfiles % 1000) / 100; +- 39a3: 83 c2 30 add $0x30,%edx +- 39a6: 88 55 aa mov %dl,-0x56(%ebp) ++ 3a63: 83 c2 30 add $0x30,%edx ++ 3a66: 88 55 aa mov %dl,-0x56(%ebp) + name[3] = '0' + (nfiles % 100) / 10; +- 39a9: f7 eb imul %ebx +- 39ab: c1 fa 05 sar $0x5,%edx +- 39ae: 29 ca sub %ecx,%edx +- 39b0: 6b d2 64 imul $0x64,%edx,%edx +- 39b3: 29 d7 sub %edx,%edi +- 39b5: 89 f8 mov %edi,%eax +- 39b7: f7 ee imul %esi ++ 3a69: f7 eb imul %ebx ++ 3a6b: c1 fa 05 sar $0x5,%edx ++ 3a6e: 29 ca sub %ecx,%edx ++ 3a70: 6b d2 64 imul $0x64,%edx,%edx ++ 3a73: 29 d7 sub %edx,%edi ++ 3a75: 89 f8 mov %edi,%eax ++ 3a77: f7 ee imul %esi + name[4] = '0' + (nfiles % 10); +- 39b9: 89 d8 mov %ebx,%eax ++ 3a79: 89 d8 mov %ebx,%eax + name[3] = '0' + (nfiles % 100) / 10; +- 39bb: c1 ff 1f sar $0x1f,%edi +- 39be: c1 fa 02 sar $0x2,%edx +- 39c1: 29 fa sub %edi,%edx +- 39c3: 83 c2 30 add $0x30,%edx +- 39c6: 88 55 ab mov %dl,-0x55(%ebp) ++ 3a7b: c1 ff 1f sar $0x1f,%edi ++ 3a7e: c1 fa 02 sar $0x2,%edx ++ 3a81: 29 fa sub %edi,%edx ++ 3a83: 83 c2 30 add $0x30,%edx ++ 3a86: 88 55 ab mov %dl,-0x55(%ebp) + name[4] = '0' + (nfiles % 10); +- 39c9: f7 ee imul %esi +- 39cb: c1 fa 02 sar $0x2,%edx +- 39ce: 29 ca sub %ecx,%edx +- 39d0: 89 d9 mov %ebx,%ecx +- 39d2: 8d 04 92 lea (%edx,%edx,4),%eax +- 39d5: 01 c0 add %eax,%eax +- 39d7: 29 c1 sub %eax,%ecx +- 39d9: 89 c8 mov %ecx,%eax +- 39db: 83 c0 30 add $0x30,%eax +- 39de: 88 45 ac mov %al,-0x54(%ebp) ++ 3a89: f7 ee imul %esi ++ 3a8b: c1 fa 02 sar $0x2,%edx ++ 3a8e: 29 ca sub %ecx,%edx ++ 3a90: 89 d9 mov %ebx,%ecx ++ 3a92: 8d 04 92 lea (%edx,%edx,4),%eax ++ 3a95: 01 c0 add %eax,%eax ++ 3a97: 29 c1 sub %eax,%ecx ++ 3a99: 89 c8 mov %ecx,%eax ++ 3a9b: 83 c0 30 add $0x30,%eax ++ 3a9e: 88 45 ac mov %al,-0x54(%ebp) + printf(1, "writing %s\n", name); +- 39e1: 8d 45 a8 lea -0x58(%ebp),%eax +- 39e4: 89 44 24 08 mov %eax,0x8(%esp) +- 39e8: e8 f3 05 00 00 call 3fe0 +- int fd = open(name, O_CREATE|O_RDWR); +- 39ed: 8d 45 a8 lea -0x58(%ebp),%eax +- 39f0: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) +- 39f7: 00 +- 39f8: 89 04 24 mov %eax,(%esp) +- 39fb: e8 d2 04 00 00 call 3ed2 +- if(fd < 0){ +- 3a00: 85 c0 test %eax,%eax +- int fd = open(name, O_CREATE|O_RDWR); +- 3a02: 89 c7 mov %eax,%edi +- if(fd < 0){ +- 3a04: 78 57 js 3a5d +- 3a06: 31 f6 xor %esi,%esi +- 3a08: eb 08 jmp 3a12 +- 3a0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 3aa1: 8d 45 a8 lea -0x58(%ebp),%eax ++ 3aa4: 89 44 24 08 mov %eax,0x8(%esp) ++ 3aa8: e8 03 06 00 00 call 40b0 ++ int fd = open(name, O_CREATE | O_RDWR); ++ 3aad: 8d 45 a8 lea -0x58(%ebp),%eax ++ 3ab0: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) ++ 3ab7: 00 ++ 3ab8: 89 04 24 mov %eax,(%esp) ++ 3abb: e8 e2 04 00 00 call 3fa2 ++ if (fd < 0) ++ 3ac0: 85 c0 test %eax,%eax ++ int fd = open(name, O_CREATE | O_RDWR); ++ 3ac2: 89 c7 mov %eax,%edi ++ if (fd < 0) ++ 3ac4: 78 57 js 3b1d ++ 3ac6: 31 f6 xor %esi,%esi ++ 3ac8: eb 08 jmp 3ad2 ++ 3aca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + total += cc; +- 3a10: 01 c6 add %eax,%esi ++ 3ad0: 01 c6 add %eax,%esi + int cc = write(fd, buf, 512); +- 3a12: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) +- 3a19: 00 +- 3a1a: c7 44 24 04 a0 8b 00 movl $0x8ba0,0x4(%esp) +- 3a21: 00 +- 3a22: 89 3c 24 mov %edi,(%esp) +- 3a25: e8 88 04 00 00 call 3eb2 +- if(cc < 512) +- 3a2a: 3d ff 01 00 00 cmp $0x1ff,%eax +- 3a2f: 7f df jg 3a10 ++ 3ad2: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) ++ 3ad9: 00 ++ 3ada: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) ++ 3ae1: 00 ++ 3ae2: 89 3c 24 mov %edi,(%esp) ++ 3ae5: e8 98 04 00 00 call 3f82 ++ if (cc < 512) ++ 3aea: 3d ff 01 00 00 cmp $0x1ff,%eax ++ 3aef: 7f df jg 3ad0 + printf(1, "wrote %d bytes\n", total); +- 3a31: 89 74 24 08 mov %esi,0x8(%esp) +- 3a35: c7 44 24 04 d4 52 00 movl $0x52d4,0x4(%esp) +- 3a3c: 00 +- 3a3d: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3a44: e8 97 05 00 00 call 3fe0 ++ 3af1: 89 74 24 08 mov %esi,0x8(%esp) ++ 3af5: c7 44 24 04 a4 53 00 movl $0x53a4,0x4(%esp) ++ 3afc: 00 ++ 3afd: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3b04: e8 a7 05 00 00 call 40b0 + close(fd); +- 3a49: 89 3c 24 mov %edi,(%esp) +- 3a4c: e8 69 04 00 00 call 3eba +- if(total == 0) +- 3a51: 85 f6 test %esi,%esi +- 3a53: 74 23 je 3a78 +- for(nfiles = 0; ; nfiles++){ +- 3a55: 83 c3 01 add $0x1,%ebx ++ 3b09: 89 3c 24 mov %edi,(%esp) ++ 3b0c: e8 79 04 00 00 call 3f8a ++ if (total == 0) ++ 3b11: 85 f6 test %esi,%esi ++ 3b13: 74 23 je 3b38 ++ for (nfiles = 0;; nfiles++) ++ 3b15: 83 c3 01 add $0x1,%ebx + } +- 3a58: e9 f3 fe ff ff jmp 3950 ++ 3b18: e9 f3 fe ff ff jmp 3a10 + printf(1, "open %s failed\n", name); +- 3a5d: 8d 45 a8 lea -0x58(%ebp),%eax +- 3a60: 89 44 24 08 mov %eax,0x8(%esp) +- 3a64: c7 44 24 04 c4 52 00 movl $0x52c4,0x4(%esp) +- 3a6b: 00 +- 3a6c: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3a73: e8 68 05 00 00 call 3fe0 ++ 3b1d: 8d 45 a8 lea -0x58(%ebp),%eax ++ 3b20: 89 44 24 08 mov %eax,0x8(%esp) ++ 3b24: c7 44 24 04 94 53 00 movl $0x5394,0x4(%esp) ++ 3b2b: 00 ++ 3b2c: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3b33: e8 78 05 00 00 call 40b0 + name[1] = '0' + nfiles / 1000; +- 3a78: b8 d3 4d 62 10 mov $0x10624dd3,%eax +- 3a7d: 89 d9 mov %ebx,%ecx +- 3a7f: f7 eb imul %ebx ++ 3b38: b8 d3 4d 62 10 mov $0x10624dd3,%eax ++ 3b3d: 89 d9 mov %ebx,%ecx ++ 3b3f: f7 eb imul %ebx + name[2] = '0' + (nfiles % 1000) / 100; +- 3a81: 89 de mov %ebx,%esi ++ 3b41: 89 de mov %ebx,%esi + name[1] = '0' + nfiles / 1000; +- 3a83: c1 f9 1f sar $0x1f,%ecx ++ 3b43: c1 f9 1f sar $0x1f,%ecx + name[3] = '0' + (nfiles % 100) / 10; +- 3a86: 89 df mov %ebx,%edi ++ 3b46: 89 df mov %ebx,%edi + name[0] = 'f'; +- 3a88: c6 45 a8 66 movb $0x66,-0x58(%ebp) ++ 3b48: c6 45 a8 66 movb $0x66,-0x58(%ebp) + name[5] = '\0'; +- 3a8c: c6 45 ad 00 movb $0x0,-0x53(%ebp) ++ 3b4c: c6 45 ad 00 movb $0x0,-0x53(%ebp) + name[1] = '0' + nfiles / 1000; +- 3a90: c1 fa 06 sar $0x6,%edx +- 3a93: 29 ca sub %ecx,%edx +- 3a95: 8d 42 30 lea 0x30(%edx),%eax ++ 3b50: c1 fa 06 sar $0x6,%edx ++ 3b53: 29 ca sub %ecx,%edx ++ 3b55: 8d 42 30 lea 0x30(%edx),%eax + name[2] = '0' + (nfiles % 1000) / 100; +- 3a98: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx ++ 3b58: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx + name[1] = '0' + nfiles / 1000; +- 3a9e: 88 45 a9 mov %al,-0x57(%ebp) ++ 3b5e: 88 45 a9 mov %al,-0x57(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; +- 3aa1: b8 1f 85 eb 51 mov $0x51eb851f,%eax +- 3aa6: 29 d6 sub %edx,%esi +- 3aa8: f7 ee imul %esi ++ 3b61: b8 1f 85 eb 51 mov $0x51eb851f,%eax ++ 3b66: 29 d6 sub %edx,%esi ++ 3b68: f7 ee imul %esi + name[3] = '0' + (nfiles % 100) / 10; +- 3aaa: b8 1f 85 eb 51 mov $0x51eb851f,%eax ++ 3b6a: b8 1f 85 eb 51 mov $0x51eb851f,%eax + name[2] = '0' + (nfiles % 1000) / 100; +- 3aaf: c1 fe 1f sar $0x1f,%esi +- 3ab2: c1 fa 05 sar $0x5,%edx +- 3ab5: 29 f2 sub %esi,%edx ++ 3b6f: c1 fe 1f sar $0x1f,%esi ++ 3b72: c1 fa 05 sar $0x5,%edx ++ 3b75: 29 f2 sub %esi,%edx + name[3] = '0' + (nfiles % 100) / 10; +- 3ab7: be 67 66 66 66 mov $0x66666667,%esi ++ 3b77: be 67 66 66 66 mov $0x66666667,%esi + name[2] = '0' + (nfiles % 1000) / 100; +- 3abc: 83 c2 30 add $0x30,%edx +- 3abf: 88 55 aa mov %dl,-0x56(%ebp) ++ 3b7c: 83 c2 30 add $0x30,%edx ++ 3b7f: 88 55 aa mov %dl,-0x56(%ebp) + name[3] = '0' + (nfiles % 100) / 10; +- 3ac2: f7 eb imul %ebx +- 3ac4: c1 fa 05 sar $0x5,%edx +- 3ac7: 29 ca sub %ecx,%edx +- 3ac9: 6b d2 64 imul $0x64,%edx,%edx +- 3acc: 29 d7 sub %edx,%edi +- 3ace: 89 f8 mov %edi,%eax +- 3ad0: f7 ee imul %esi ++ 3b82: f7 eb imul %ebx ++ 3b84: c1 fa 05 sar $0x5,%edx ++ 3b87: 29 ca sub %ecx,%edx ++ 3b89: 6b d2 64 imul $0x64,%edx,%edx ++ 3b8c: 29 d7 sub %edx,%edi ++ 3b8e: 89 f8 mov %edi,%eax ++ 3b90: f7 ee imul %esi + name[4] = '0' + (nfiles % 10); +- 3ad2: 89 d8 mov %ebx,%eax ++ 3b92: 89 d8 mov %ebx,%eax + name[3] = '0' + (nfiles % 100) / 10; +- 3ad4: c1 ff 1f sar $0x1f,%edi +- 3ad7: c1 fa 02 sar $0x2,%edx +- 3ada: 29 fa sub %edi,%edx +- 3adc: 83 c2 30 add $0x30,%edx +- 3adf: 88 55 ab mov %dl,-0x55(%ebp) ++ 3b94: c1 ff 1f sar $0x1f,%edi ++ 3b97: c1 fa 02 sar $0x2,%edx ++ 3b9a: 29 fa sub %edi,%edx ++ 3b9c: 83 c2 30 add $0x30,%edx ++ 3b9f: 88 55 ab mov %dl,-0x55(%ebp) + name[4] = '0' + (nfiles % 10); +- 3ae2: f7 ee imul %esi +- 3ae4: c1 fa 02 sar $0x2,%edx +- 3ae7: 29 ca sub %ecx,%edx +- 3ae9: 89 d9 mov %ebx,%ecx +- 3aeb: 8d 04 92 lea (%edx,%edx,4),%eax ++ 3ba2: f7 ee imul %esi ++ 3ba4: c1 fa 02 sar $0x2,%edx ++ 3ba7: 29 ca sub %ecx,%edx ++ 3ba9: 89 d9 mov %ebx,%ecx ++ 3bab: 8d 04 92 lea (%edx,%edx,4),%eax + nfiles--; +- 3aee: 83 eb 01 sub $0x1,%ebx ++ 3bae: 83 eb 01 sub $0x1,%ebx + name[4] = '0' + (nfiles % 10); +- 3af1: 01 c0 add %eax,%eax +- 3af3: 29 c1 sub %eax,%ecx +- 3af5: 89 c8 mov %ecx,%eax +- 3af7: 83 c0 30 add $0x30,%eax +- 3afa: 88 45 ac mov %al,-0x54(%ebp) ++ 3bb1: 01 c0 add %eax,%eax ++ 3bb3: 29 c1 sub %eax,%ecx ++ 3bb5: 89 c8 mov %ecx,%eax ++ 3bb7: 83 c0 30 add $0x30,%eax ++ 3bba: 88 45 ac mov %al,-0x54(%ebp) + unlink(name); +- 3afd: 8d 45 a8 lea -0x58(%ebp),%eax +- 3b00: 89 04 24 mov %eax,(%esp) +- 3b03: e8 da 03 00 00 call 3ee2 +- while(nfiles >= 0){ +- 3b08: 83 fb ff cmp $0xffffffff,%ebx +- 3b0b: 0f 85 67 ff ff ff jne 3a78 ++ 3bbd: 8d 45 a8 lea -0x58(%ebp),%eax ++ 3bc0: 89 04 24 mov %eax,(%esp) ++ 3bc3: e8 ea 03 00 00 call 3fb2 ++ while (nfiles >= 0) ++ 3bc8: 83 fb ff cmp $0xffffffff,%ebx ++ 3bcb: 0f 85 67 ff ff ff jne 3b38 + printf(1, "fsfull test finished\n"); +- 3b11: c7 44 24 04 e4 52 00 movl $0x52e4,0x4(%esp) +- 3b18: 00 +- 3b19: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3b20: e8 bb 04 00 00 call 3fe0 ++ 3bd1: c7 44 24 04 b4 53 00 movl $0x53b4,0x4(%esp) ++ 3bd8: 00 ++ 3bd9: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3be0: e8 cb 04 00 00 call 40b0 + } +- 3b25: 83 c4 5c add $0x5c,%esp +- 3b28: 5b pop %ebx +- 3b29: 5e pop %esi +- 3b2a: 5f pop %edi +- 3b2b: 5d pop %ebp +- 3b2c: c3 ret +- 3b2d: 8d 76 00 lea 0x0(%esi),%esi ++ 3be5: 83 c4 5c add $0x5c,%esp ++ 3be8: 5b pop %ebx ++ 3be9: 5e pop %esi ++ 3bea: 5f pop %edi ++ 3beb: 5d pop %ebp ++ 3bec: c3 ret ++ 3bed: 8d 76 00 lea 0x0(%esi),%esi + +-00003b30 : ++00003bf0 : + { +- 3b30: 55 push %ebp +- 3b31: 89 e5 mov %esp,%ebp +- 3b33: 83 ec 18 sub $0x18,%esp ++ 3bf0: 55 push %ebp ++ 3bf1: 89 e5 mov %esp,%ebp ++ 3bf3: 83 ec 18 sub $0x18,%esp + printf(1, "uio test\n"); +- 3b36: c7 44 24 04 fa 52 00 movl $0x52fa,0x4(%esp) +- 3b3d: 00 +- 3b3e: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3b45: e8 96 04 00 00 call 3fe0 ++ 3bf6: c7 44 24 04 ca 53 00 movl $0x53ca,0x4(%esp) ++ 3bfd: 00 ++ 3bfe: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3c05: e8 a6 04 00 00 call 40b0 + pid = fork(); +- 3b4a: e8 3b 03 00 00 call 3e8a +- if(pid == 0){ +- 3b4f: 85 c0 test %eax,%eax +- 3b51: 74 1d je 3b70 +- } else if(pid < 0){ +- 3b53: 78 49 js 3b9e +- wait(); +- 3b55: e8 40 03 00 00 call 3e9a ++ 3c0a: e8 4b 03 00 00 call 3f5a ++ if (pid == 0) ++ 3c0f: 85 c0 test %eax,%eax ++ 3c11: 74 24 je 3c37 ++ else if (pid < 0) ++ 3c13: 78 50 js 3c65 ++ wait(0); ++ 3c15: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3c1c: e8 49 03 00 00 call 3f6a + printf(1, "uio test done\n"); +- 3b5a: c7 44 24 04 04 53 00 movl $0x5304,0x4(%esp) +- 3b61: 00 +- 3b62: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3b69: e8 72 04 00 00 call 3fe0 ++ 3c21: c7 44 24 04 d4 53 00 movl $0x53d4,0x4(%esp) ++ 3c28: 00 ++ 3c29: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3c30: e8 7b 04 00 00 call 40b0 + } +- 3b6e: c9 leave +- 3b6f: c3 ret +- asm volatile("outb %0,%1"::"a"(val), "d" (port)); +- 3b70: ba 70 00 00 00 mov $0x70,%edx +- 3b75: b8 09 00 00 00 mov $0x9,%eax +- 3b7a: ee out %al,(%dx) +- asm volatile("inb %1,%0" : "=a" (val) : "d" (port)); +- 3b7b: b2 71 mov $0x71,%dl +- 3b7d: ec in (%dx),%al ++ 3c35: c9 leave ++ 3c36: c3 ret ++ asm volatile("outb %0,%1" ::"a"(val), "d"(port)); ++ 3c37: ba 70 00 00 00 mov $0x70,%edx ++ 3c3c: b8 09 00 00 00 mov $0x9,%eax ++ 3c41: ee out %al,(%dx) ++ asm volatile("inb %1,%0" ++ 3c42: b2 71 mov $0x71,%dl ++ 3c44: ec in (%dx),%al + printf(1, "uio: uio succeeded; test FAILED\n"); +- 3b7e: c7 44 24 04 90 5a 00 movl $0x5a90,0x4(%esp) +- 3b85: 00 +- 3b86: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3b8d: e8 4e 04 00 00 call 3fe0 ++ 3c45: c7 44 24 04 60 5b 00 movl $0x5b60,0x4(%esp) ++ 3c4c: 00 ++ 3c4d: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3c54: e8 57 04 00 00 call 40b0 + exit(0); +- 3b92: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3b99: e8 f4 02 00 00 call 3e92 +- printf (1, "fork failed\n"); +- 3b9e: c7 44 24 04 89 52 00 movl $0x5289,0x4(%esp) +- 3ba5: 00 +- 3ba6: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3bad: e8 2e 04 00 00 call 3fe0 ++ 3c59: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3c60: e8 fd 02 00 00 call 3f62 ++ printf(1, "fork failed\n"); ++ 3c65: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) ++ 3c6c: 00 ++ 3c6d: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3c74: e8 37 04 00 00 call 40b0 + exit(0); +- 3bb2: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3bb9: e8 d4 02 00 00 call 3e92 +- 3bbe: 66 90 xchg %ax,%ax ++ 3c79: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3c80: e8 dd 02 00 00 call 3f62 ++ 3c85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3c89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00003bc0 : ++00003c90 : + { +- 3bc0: 55 push %ebp +- 3bc1: 89 e5 mov %esp,%ebp +- 3bc3: 53 push %ebx +- 3bc4: 83 ec 14 sub $0x14,%esp ++ 3c90: 55 push %ebp ++ 3c91: 89 e5 mov %esp,%ebp ++ 3c93: 53 push %ebx ++ 3c94: 83 ec 14 sub $0x14,%esp + fd = open("init", O_RDONLY); +- 3bc7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 3bce: 00 +- 3bcf: c7 04 24 13 53 00 00 movl $0x5313,(%esp) +- 3bd6: e8 f7 02 00 00 call 3ed2 +- if (fd < 0) { +- 3bdb: 85 c0 test %eax,%eax ++ 3c97: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 3c9e: 00 ++ 3c9f: c7 04 24 e3 53 00 00 movl $0x53e3,(%esp) ++ 3ca6: e8 f7 02 00 00 call 3fa2 ++ if (fd < 0) ++ 3cab: 85 c0 test %eax,%eax + fd = open("init", O_RDONLY); +- 3bdd: 89 c3 mov %eax,%ebx +- if (fd < 0) { +- 3bdf: 78 45 js 3c26 ++ 3cad: 89 c3 mov %eax,%ebx ++ if (fd < 0) ++ 3caf: 78 45 js 3cf6 + read(fd, sbrk(0) - 1, -1); +- 3be1: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3be8: e8 2d 03 00 00 call 3f1a +- 3bed: 89 1c 24 mov %ebx,(%esp) +- 3bf0: c7 44 24 08 ff ff ff movl $0xffffffff,0x8(%esp) +- 3bf7: ff +- 3bf8: 83 e8 01 sub $0x1,%eax +- 3bfb: 89 44 24 04 mov %eax,0x4(%esp) +- 3bff: e8 a6 02 00 00 call 3eaa ++ 3cb1: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3cb8: e8 2d 03 00 00 call 3fea ++ 3cbd: 89 1c 24 mov %ebx,(%esp) ++ 3cc0: c7 44 24 08 ff ff ff movl $0xffffffff,0x8(%esp) ++ 3cc7: ff ++ 3cc8: 83 e8 01 sub $0x1,%eax ++ 3ccb: 89 44 24 04 mov %eax,0x4(%esp) ++ 3ccf: e8 a6 02 00 00 call 3f7a + close(fd); +- 3c04: 89 1c 24 mov %ebx,(%esp) +- 3c07: e8 ae 02 00 00 call 3eba ++ 3cd4: 89 1c 24 mov %ebx,(%esp) ++ 3cd7: e8 ae 02 00 00 call 3f8a + printf(1, "arg test passed\n"); +- 3c0c: c7 44 24 04 25 53 00 movl $0x5325,0x4(%esp) +- 3c13: 00 +- 3c14: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 3c1b: e8 c0 03 00 00 call 3fe0 ++ 3cdc: c7 44 24 04 f5 53 00 movl $0x53f5,0x4(%esp) ++ 3ce3: 00 ++ 3ce4: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 3ceb: e8 c0 03 00 00 call 40b0 + } +- 3c20: 83 c4 14 add $0x14,%esp +- 3c23: 5b pop %ebx +- 3c24: 5d pop %ebp +- 3c25: c3 ret ++ 3cf0: 83 c4 14 add $0x14,%esp ++ 3cf3: 5b pop %ebx ++ 3cf4: 5d pop %ebp ++ 3cf5: c3 ret + printf(2, "open failed\n"); +- 3c26: c7 44 24 04 18 53 00 movl $0x5318,0x4(%esp) +- 3c2d: 00 +- 3c2e: c7 04 24 02 00 00 00 movl $0x2,(%esp) +- 3c35: e8 a6 03 00 00 call 3fe0 ++ 3cf6: c7 44 24 04 e8 53 00 movl $0x53e8,0x4(%esp) ++ 3cfd: 00 ++ 3cfe: c7 04 24 02 00 00 00 movl $0x2,(%esp) ++ 3d05: e8 a6 03 00 00 call 40b0 + exit(0); +- 3c3a: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3c41: e8 4c 02 00 00 call 3e92 +- 3c46: 8d 76 00 lea 0x0(%esi),%esi +- 3c49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 3d0a: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3d11: e8 4c 02 00 00 call 3f62 ++ 3d16: 8d 76 00 lea 0x0(%esi),%esi ++ 3d19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00003c50 : ++00003d20 : + randstate = randstate * 1664525 + 1013904223; +- 3c50: 69 05 c0 63 00 00 0d imul $0x19660d,0x63c0,%eax +- 3c57: 66 19 00 ++ 3d20: 69 05 90 64 00 00 0d imul $0x19660d,0x6490,%eax ++ 3d27: 66 19 00 + { +- 3c5a: 55 push %ebp +- 3c5b: 89 e5 mov %esp,%ebp ++ 3d2a: 55 push %ebp ++ 3d2b: 89 e5 mov %esp,%ebp + } +- 3c5d: 5d pop %ebp ++ 3d2d: 5d pop %ebp + randstate = randstate * 1664525 + 1013904223; +- 3c5e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax +- 3c63: a3 c0 63 00 00 mov %eax,0x63c0 ++ 3d2e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax ++ 3d33: a3 90 64 00 00 mov %eax,0x6490 + } +- 3c68: c3 ret +- 3c69: 66 90 xchg %ax,%ax +- 3c6b: 66 90 xchg %ax,%ax +- 3c6d: 66 90 xchg %ax,%ax +- 3c6f: 90 nop ++ 3d38: c3 ret ++ 3d39: 66 90 xchg %ax,%ax ++ 3d3b: 66 90 xchg %ax,%ax ++ 3d3d: 66 90 xchg %ax,%ax ++ 3d3f: 90 nop + +-00003c70 : ++00003d40 : + #include "user.h" + #include "x86.h" + + char* + strcpy(char *s, const char *t) + { +- 3c70: 55 push %ebp +- 3c71: 89 e5 mov %esp,%ebp +- 3c73: 8b 45 08 mov 0x8(%ebp),%eax +- 3c76: 8b 4d 0c mov 0xc(%ebp),%ecx +- 3c79: 53 push %ebx ++ 3d40: 55 push %ebp ++ 3d41: 89 e5 mov %esp,%ebp ++ 3d43: 8b 45 08 mov 0x8(%ebp),%eax ++ 3d46: 8b 4d 0c mov 0xc(%ebp),%ecx ++ 3d49: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) +- 3c7a: 89 c2 mov %eax,%edx +- 3c7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi +- 3c80: 83 c1 01 add $0x1,%ecx +- 3c83: 0f b6 59 ff movzbl -0x1(%ecx),%ebx +- 3c87: 83 c2 01 add $0x1,%edx +- 3c8a: 84 db test %bl,%bl +- 3c8c: 88 5a ff mov %bl,-0x1(%edx) +- 3c8f: 75 ef jne 3c80 ++ 3d4a: 89 c2 mov %eax,%edx ++ 3d4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3d50: 83 c1 01 add $0x1,%ecx ++ 3d53: 0f b6 59 ff movzbl -0x1(%ecx),%ebx ++ 3d57: 83 c2 01 add $0x1,%edx ++ 3d5a: 84 db test %bl,%bl ++ 3d5c: 88 5a ff mov %bl,-0x1(%edx) ++ 3d5f: 75 ef jne 3d50 + ; + return os; + } +- 3c91: 5b pop %ebx +- 3c92: 5d pop %ebp +- 3c93: c3 ret +- 3c94: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 3c9a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ 3d61: 5b pop %ebx ++ 3d62: 5d pop %ebp ++ 3d63: c3 ret ++ 3d64: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 3d6a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00003ca0 : ++00003d70 : + + int + strcmp(const char *p, const char *q) + { +- 3ca0: 55 push %ebp +- 3ca1: 89 e5 mov %esp,%ebp +- 3ca3: 8b 55 08 mov 0x8(%ebp),%edx +- 3ca6: 53 push %ebx +- 3ca7: 8b 4d 0c mov 0xc(%ebp),%ecx ++ 3d70: 55 push %ebp ++ 3d71: 89 e5 mov %esp,%ebp ++ 3d73: 8b 55 08 mov 0x8(%ebp),%edx ++ 3d76: 53 push %ebx ++ 3d77: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) +- 3caa: 0f b6 02 movzbl (%edx),%eax +- 3cad: 84 c0 test %al,%al +- 3caf: 74 2d je 3cde +- 3cb1: 0f b6 19 movzbl (%ecx),%ebx +- 3cb4: 38 d8 cmp %bl,%al +- 3cb6: 74 0e je 3cc6 +- 3cb8: eb 2b jmp 3ce5 +- 3cba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 3cc0: 38 c8 cmp %cl,%al +- 3cc2: 75 15 jne 3cd9 ++ 3d7a: 0f b6 02 movzbl (%edx),%eax ++ 3d7d: 84 c0 test %al,%al ++ 3d7f: 74 2d je 3dae ++ 3d81: 0f b6 19 movzbl (%ecx),%ebx ++ 3d84: 38 d8 cmp %bl,%al ++ 3d86: 74 0e je 3d96 ++ 3d88: eb 2b jmp 3db5 ++ 3d8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 3d90: 38 c8 cmp %cl,%al ++ 3d92: 75 15 jne 3da9 + p++, q++; +- 3cc4: 89 d9 mov %ebx,%ecx +- 3cc6: 83 c2 01 add $0x1,%edx ++ 3d94: 89 d9 mov %ebx,%ecx ++ 3d96: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) +- 3cc9: 0f b6 02 movzbl (%edx),%eax ++ 3d99: 0f b6 02 movzbl (%edx),%eax + p++, q++; +- 3ccc: 8d 59 01 lea 0x1(%ecx),%ebx ++ 3d9c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) +- 3ccf: 0f b6 49 01 movzbl 0x1(%ecx),%ecx +- 3cd3: 84 c0 test %al,%al +- 3cd5: 75 e9 jne 3cc0 +- 3cd7: 31 c0 xor %eax,%eax ++ 3d9f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx ++ 3da3: 84 c0 test %al,%al ++ 3da5: 75 e9 jne 3d90 ++ 3da7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; +- 3cd9: 29 c8 sub %ecx,%eax ++ 3da9: 29 c8 sub %ecx,%eax + } +- 3cdb: 5b pop %ebx +- 3cdc: 5d pop %ebp +- 3cdd: c3 ret +- 3cde: 0f b6 09 movzbl (%ecx),%ecx ++ 3dab: 5b pop %ebx ++ 3dac: 5d pop %ebp ++ 3dad: c3 ret ++ 3dae: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) +- 3ce1: 31 c0 xor %eax,%eax +- 3ce3: eb f4 jmp 3cd9 +- 3ce5: 0f b6 cb movzbl %bl,%ecx +- 3ce8: eb ef jmp 3cd9 +- 3cea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 3db1: 31 c0 xor %eax,%eax ++ 3db3: eb f4 jmp 3da9 ++ 3db5: 0f b6 cb movzbl %bl,%ecx ++ 3db8: eb ef jmp 3da9 ++ 3dba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +-00003cf0 : ++00003dc0 : + + uint + strlen(const char *s) + { +- 3cf0: 55 push %ebp +- 3cf1: 89 e5 mov %esp,%ebp +- 3cf3: 8b 4d 08 mov 0x8(%ebp),%ecx ++ 3dc0: 55 push %ebp ++ 3dc1: 89 e5 mov %esp,%ebp ++ 3dc3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) +- 3cf6: 80 39 00 cmpb $0x0,(%ecx) +- 3cf9: 74 12 je 3d0d +- 3cfb: 31 d2 xor %edx,%edx +- 3cfd: 8d 76 00 lea 0x0(%esi),%esi +- 3d00: 83 c2 01 add $0x1,%edx +- 3d03: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) +- 3d07: 89 d0 mov %edx,%eax +- 3d09: 75 f5 jne 3d00 ++ 3dc6: 80 39 00 cmpb $0x0,(%ecx) ++ 3dc9: 74 12 je 3ddd ++ 3dcb: 31 d2 xor %edx,%edx ++ 3dcd: 8d 76 00 lea 0x0(%esi),%esi ++ 3dd0: 83 c2 01 add $0x1,%edx ++ 3dd3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) ++ 3dd7: 89 d0 mov %edx,%eax ++ 3dd9: 75 f5 jne 3dd0 + ; + return n; + } +- 3d0b: 5d pop %ebp +- 3d0c: c3 ret ++ 3ddb: 5d pop %ebp ++ 3ddc: c3 ret + for(n = 0; s[n]; n++) +- 3d0d: 31 c0 xor %eax,%eax ++ 3ddd: 31 c0 xor %eax,%eax + } +- 3d0f: 5d pop %ebp +- 3d10: c3 ret +- 3d11: eb 0d jmp 3d20 +- 3d13: 90 nop +- 3d14: 90 nop +- 3d15: 90 nop +- 3d16: 90 nop +- 3d17: 90 nop +- 3d18: 90 nop +- 3d19: 90 nop +- 3d1a: 90 nop +- 3d1b: 90 nop +- 3d1c: 90 nop +- 3d1d: 90 nop +- 3d1e: 90 nop +- 3d1f: 90 nop ++ 3ddf: 5d pop %ebp ++ 3de0: c3 ret ++ 3de1: eb 0d jmp 3df0 ++ 3de3: 90 nop ++ 3de4: 90 nop ++ 3de5: 90 nop ++ 3de6: 90 nop ++ 3de7: 90 nop ++ 3de8: 90 nop ++ 3de9: 90 nop ++ 3dea: 90 nop ++ 3deb: 90 nop ++ 3dec: 90 nop ++ 3ded: 90 nop ++ 3dee: 90 nop ++ 3def: 90 nop + +-00003d20 : ++00003df0 : + + void* + memset(void *dst, int c, uint n) + { +- 3d20: 55 push %ebp +- 3d21: 89 e5 mov %esp,%ebp +- 3d23: 8b 55 08 mov 0x8(%ebp),%edx +- 3d26: 57 push %edi ++ 3df0: 55 push %ebp ++ 3df1: 89 e5 mov %esp,%ebp ++ 3df3: 8b 55 08 mov 0x8(%ebp),%edx ++ 3df6: 57 push %edi + } + + static inline void + stosb(void *addr, int data, int cnt) + { + asm volatile("cld; rep stosb" : +- 3d27: 8b 4d 10 mov 0x10(%ebp),%ecx +- 3d2a: 8b 45 0c mov 0xc(%ebp),%eax +- 3d2d: 89 d7 mov %edx,%edi +- 3d2f: fc cld +- 3d30: f3 aa rep stos %al,%es:(%edi) ++ 3df7: 8b 4d 10 mov 0x10(%ebp),%ecx ++ 3dfa: 8b 45 0c mov 0xc(%ebp),%eax ++ 3dfd: 89 d7 mov %edx,%edi ++ 3dff: fc cld ++ 3e00: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; + } +- 3d32: 89 d0 mov %edx,%eax +- 3d34: 5f pop %edi +- 3d35: 5d pop %ebp +- 3d36: c3 ret +- 3d37: 89 f6 mov %esi,%esi +- 3d39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 3e02: 89 d0 mov %edx,%eax ++ 3e04: 5f pop %edi ++ 3e05: 5d pop %ebp ++ 3e06: c3 ret ++ 3e07: 89 f6 mov %esi,%esi ++ 3e09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00003d40 : ++00003e10 : + + char* + strchr(const char *s, char c) + { +- 3d40: 55 push %ebp +- 3d41: 89 e5 mov %esp,%ebp +- 3d43: 8b 45 08 mov 0x8(%ebp),%eax +- 3d46: 53 push %ebx +- 3d47: 8b 55 0c mov 0xc(%ebp),%edx ++ 3e10: 55 push %ebp ++ 3e11: 89 e5 mov %esp,%ebp ++ 3e13: 8b 45 08 mov 0x8(%ebp),%eax ++ 3e16: 53 push %ebx ++ 3e17: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) +- 3d4a: 0f b6 18 movzbl (%eax),%ebx +- 3d4d: 84 db test %bl,%bl +- 3d4f: 74 1d je 3d6e ++ 3e1a: 0f b6 18 movzbl (%eax),%ebx ++ 3e1d: 84 db test %bl,%bl ++ 3e1f: 74 1d je 3e3e + if(*s == c) +- 3d51: 38 d3 cmp %dl,%bl +- 3d53: 89 d1 mov %edx,%ecx +- 3d55: 75 0d jne 3d64 +- 3d57: eb 17 jmp 3d70 +- 3d59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi +- 3d60: 38 ca cmp %cl,%dl +- 3d62: 74 0c je 3d70 ++ 3e21: 38 d3 cmp %dl,%bl ++ 3e23: 89 d1 mov %edx,%ecx ++ 3e25: 75 0d jne 3e34 ++ 3e27: eb 17 jmp 3e40 ++ 3e29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 3e30: 38 ca cmp %cl,%dl ++ 3e32: 74 0c je 3e40 + for(; *s; s++) +- 3d64: 83 c0 01 add $0x1,%eax +- 3d67: 0f b6 10 movzbl (%eax),%edx +- 3d6a: 84 d2 test %dl,%dl +- 3d6c: 75 f2 jne 3d60 ++ 3e34: 83 c0 01 add $0x1,%eax ++ 3e37: 0f b6 10 movzbl (%eax),%edx ++ 3e3a: 84 d2 test %dl,%dl ++ 3e3c: 75 f2 jne 3e30 + return (char*)s; + return 0; +- 3d6e: 31 c0 xor %eax,%eax ++ 3e3e: 31 c0 xor %eax,%eax + } +- 3d70: 5b pop %ebx +- 3d71: 5d pop %ebp +- 3d72: c3 ret +- 3d73: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 3d79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ++ 3e40: 5b pop %ebx ++ 3e41: 5d pop %ebp ++ 3e42: c3 ret ++ 3e43: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 3e49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +-00003d80 : ++00003e50 : + + char* + gets(char *buf, int max) + { +- 3d80: 55 push %ebp +- 3d81: 89 e5 mov %esp,%ebp +- 3d83: 57 push %edi +- 3d84: 56 push %esi ++ 3e50: 55 push %ebp ++ 3e51: 89 e5 mov %esp,%ebp ++ 3e53: 57 push %edi ++ 3e54: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ +- 3d85: 31 f6 xor %esi,%esi ++ 3e55: 31 f6 xor %esi,%esi + { +- 3d87: 53 push %ebx +- 3d88: 83 ec 2c sub $0x2c,%esp ++ 3e57: 53 push %ebx ++ 3e58: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); +- 3d8b: 8d 7d e7 lea -0x19(%ebp),%edi ++ 3e5b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ +- 3d8e: eb 31 jmp 3dc1 ++ 3e5e: eb 31 jmp 3e91 + cc = read(0, &c, 1); +- 3d90: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 3d97: 00 +- 3d98: 89 7c 24 04 mov %edi,0x4(%esp) +- 3d9c: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 3da3: e8 02 01 00 00 call 3eaa ++ 3e60: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 3e67: 00 ++ 3e68: 89 7c 24 04 mov %edi,0x4(%esp) ++ 3e6c: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 3e73: e8 02 01 00 00 call 3f7a + if(cc < 1) +- 3da8: 85 c0 test %eax,%eax +- 3daa: 7e 1d jle 3dc9 ++ 3e78: 85 c0 test %eax,%eax ++ 3e7a: 7e 1d jle 3e99 + break; + buf[i++] = c; +- 3dac: 0f b6 45 e7 movzbl -0x19(%ebp),%eax ++ 3e7c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ +- 3db0: 89 de mov %ebx,%esi ++ 3e80: 89 de mov %ebx,%esi + buf[i++] = c; +- 3db2: 8b 55 08 mov 0x8(%ebp),%edx ++ 3e82: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') +- 3db5: 3c 0d cmp $0xd,%al ++ 3e85: 3c 0d cmp $0xd,%al + buf[i++] = c; +- 3db7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) ++ 3e87: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') +- 3dbb: 74 0c je 3dc9 +- 3dbd: 3c 0a cmp $0xa,%al +- 3dbf: 74 08 je 3dc9 ++ 3e8b: 74 0c je 3e99 ++ 3e8d: 3c 0a cmp $0xa,%al ++ 3e8f: 74 08 je 3e99 + for(i=0; i+1 < max; ){ +- 3dc1: 8d 5e 01 lea 0x1(%esi),%ebx +- 3dc4: 3b 5d 0c cmp 0xc(%ebp),%ebx +- 3dc7: 7c c7 jl 3d90 ++ 3e91: 8d 5e 01 lea 0x1(%esi),%ebx ++ 3e94: 3b 5d 0c cmp 0xc(%ebp),%ebx ++ 3e97: 7c c7 jl 3e60 + break; + } + buf[i] = '\0'; +- 3dc9: 8b 45 08 mov 0x8(%ebp),%eax +- 3dcc: c6 04 30 00 movb $0x0,(%eax,%esi,1) ++ 3e99: 8b 45 08 mov 0x8(%ebp),%eax ++ 3e9c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; + } +- 3dd0: 83 c4 2c add $0x2c,%esp +- 3dd3: 5b pop %ebx +- 3dd4: 5e pop %esi +- 3dd5: 5f pop %edi +- 3dd6: 5d pop %ebp +- 3dd7: c3 ret +- 3dd8: 90 nop +- 3dd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ++ 3ea0: 83 c4 2c add $0x2c,%esp ++ 3ea3: 5b pop %ebx ++ 3ea4: 5e pop %esi ++ 3ea5: 5f pop %edi ++ 3ea6: 5d pop %ebp ++ 3ea7: c3 ret ++ 3ea8: 90 nop ++ 3ea9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +-00003de0 : ++00003eb0 : + + int + stat(const char *n, struct stat *st) + { +- 3de0: 55 push %ebp +- 3de1: 89 e5 mov %esp,%ebp +- 3de3: 56 push %esi +- 3de4: 53 push %ebx +- 3de5: 83 ec 10 sub $0x10,%esp ++ 3eb0: 55 push %ebp ++ 3eb1: 89 e5 mov %esp,%ebp ++ 3eb3: 56 push %esi ++ 3eb4: 53 push %ebx ++ 3eb5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); +- 3de8: 8b 45 08 mov 0x8(%ebp),%eax +- 3deb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) +- 3df2: 00 +- 3df3: 89 04 24 mov %eax,(%esp) +- 3df6: e8 d7 00 00 00 call 3ed2 ++ 3eb8: 8b 45 08 mov 0x8(%ebp),%eax ++ 3ebb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ++ 3ec2: 00 ++ 3ec3: 89 04 24 mov %eax,(%esp) ++ 3ec6: e8 d7 00 00 00 call 3fa2 + if(fd < 0) +- 3dfb: 85 c0 test %eax,%eax ++ 3ecb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); +- 3dfd: 89 c3 mov %eax,%ebx ++ 3ecd: 89 c3 mov %eax,%ebx + if(fd < 0) +- 3dff: 78 27 js 3e28 ++ 3ecf: 78 27 js 3ef8 + return -1; + r = fstat(fd, st); +- 3e01: 8b 45 0c mov 0xc(%ebp),%eax +- 3e04: 89 1c 24 mov %ebx,(%esp) +- 3e07: 89 44 24 04 mov %eax,0x4(%esp) +- 3e0b: e8 da 00 00 00 call 3eea ++ 3ed1: 8b 45 0c mov 0xc(%ebp),%eax ++ 3ed4: 89 1c 24 mov %ebx,(%esp) ++ 3ed7: 89 44 24 04 mov %eax,0x4(%esp) ++ 3edb: e8 da 00 00 00 call 3fba + close(fd); +- 3e10: 89 1c 24 mov %ebx,(%esp) ++ 3ee0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); +- 3e13: 89 c6 mov %eax,%esi ++ 3ee3: 89 c6 mov %eax,%esi + close(fd); +- 3e15: e8 a0 00 00 00 call 3eba ++ 3ee5: e8 a0 00 00 00 call 3f8a + return r; +- 3e1a: 89 f0 mov %esi,%eax ++ 3eea: 89 f0 mov %esi,%eax + } +- 3e1c: 83 c4 10 add $0x10,%esp +- 3e1f: 5b pop %ebx +- 3e20: 5e pop %esi +- 3e21: 5d pop %ebp +- 3e22: c3 ret +- 3e23: 90 nop +- 3e24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3eec: 83 c4 10 add $0x10,%esp ++ 3eef: 5b pop %ebx ++ 3ef0: 5e pop %esi ++ 3ef1: 5d pop %ebp ++ 3ef2: c3 ret ++ 3ef3: 90 nop ++ 3ef4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; +- 3e28: b8 ff ff ff ff mov $0xffffffff,%eax +- 3e2d: eb ed jmp 3e1c +- 3e2f: 90 nop ++ 3ef8: b8 ff ff ff ff mov $0xffffffff,%eax ++ 3efd: eb ed jmp 3eec ++ 3eff: 90 nop + +-00003e30 : ++00003f00 : + + int + atoi(const char *s) + { +- 3e30: 55 push %ebp +- 3e31: 89 e5 mov %esp,%ebp +- 3e33: 8b 4d 08 mov 0x8(%ebp),%ecx +- 3e36: 53 push %ebx ++ 3f00: 55 push %ebp ++ 3f01: 89 e5 mov %esp,%ebp ++ 3f03: 8b 4d 08 mov 0x8(%ebp),%ecx ++ 3f06: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') +- 3e37: 0f be 11 movsbl (%ecx),%edx +- 3e3a: 8d 42 d0 lea -0x30(%edx),%eax +- 3e3d: 3c 09 cmp $0x9,%al ++ 3f07: 0f be 11 movsbl (%ecx),%edx ++ 3f0a: 8d 42 d0 lea -0x30(%edx),%eax ++ 3f0d: 3c 09 cmp $0x9,%al + n = 0; +- 3e3f: b8 00 00 00 00 mov $0x0,%eax ++ 3f0f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') +- 3e44: 77 17 ja 3e5d +- 3e46: 66 90 xchg %ax,%ax ++ 3f14: 77 17 ja 3f2d ++ 3f16: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; +- 3e48: 83 c1 01 add $0x1,%ecx +- 3e4b: 8d 04 80 lea (%eax,%eax,4),%eax +- 3e4e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ++ 3f18: 83 c1 01 add $0x1,%ecx ++ 3f1b: 8d 04 80 lea (%eax,%eax,4),%eax ++ 3f1e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') +- 3e52: 0f be 11 movsbl (%ecx),%edx +- 3e55: 8d 5a d0 lea -0x30(%edx),%ebx +- 3e58: 80 fb 09 cmp $0x9,%bl +- 3e5b: 76 eb jbe 3e48 ++ 3f22: 0f be 11 movsbl (%ecx),%edx ++ 3f25: 8d 5a d0 lea -0x30(%edx),%ebx ++ 3f28: 80 fb 09 cmp $0x9,%bl ++ 3f2b: 76 eb jbe 3f18 + return n; + } +- 3e5d: 5b pop %ebx +- 3e5e: 5d pop %ebp +- 3e5f: c3 ret ++ 3f2d: 5b pop %ebx ++ 3f2e: 5d pop %ebp ++ 3f2f: c3 ret + +-00003e60 : ++00003f30 : + + void* + memmove(void *vdst, const void *vsrc, int n) + { +- 3e60: 55 push %ebp ++ 3f30: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) +- 3e61: 31 d2 xor %edx,%edx ++ 3f31: 31 d2 xor %edx,%edx + { +- 3e63: 89 e5 mov %esp,%ebp +- 3e65: 56 push %esi +- 3e66: 8b 45 08 mov 0x8(%ebp),%eax +- 3e69: 53 push %ebx +- 3e6a: 8b 5d 10 mov 0x10(%ebp),%ebx +- 3e6d: 8b 75 0c mov 0xc(%ebp),%esi ++ 3f33: 89 e5 mov %esp,%ebp ++ 3f35: 56 push %esi ++ 3f36: 8b 45 08 mov 0x8(%ebp),%eax ++ 3f39: 53 push %ebx ++ 3f3a: 8b 5d 10 mov 0x10(%ebp),%ebx ++ 3f3d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) +- 3e70: 85 db test %ebx,%ebx +- 3e72: 7e 12 jle 3e86 +- 3e74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 3f40: 85 db test %ebx,%ebx ++ 3f42: 7e 12 jle 3f56 ++ 3f44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; +- 3e78: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx +- 3e7c: 88 0c 10 mov %cl,(%eax,%edx,1) +- 3e7f: 83 c2 01 add $0x1,%edx ++ 3f48: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx ++ 3f4c: 88 0c 10 mov %cl,(%eax,%edx,1) ++ 3f4f: 83 c2 01 add $0x1,%edx + while(n-- > 0) +- 3e82: 39 da cmp %ebx,%edx +- 3e84: 75 f2 jne 3e78 ++ 3f52: 39 da cmp %ebx,%edx ++ 3f54: 75 f2 jne 3f48 + return vdst; + } +- 3e86: 5b pop %ebx +- 3e87: 5e pop %esi +- 3e88: 5d pop %ebp +- 3e89: c3 ret +- +-00003e8a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret ++ 3f56: 5b pop %ebx ++ 3f57: 5e pop %esi ++ 3f58: 5d pop %ebp ++ 3f59: c3 ret + +-SYSCALL(fork) +- 3e8a: b8 01 00 00 00 mov $0x1,%eax +- 3e8f: cd 40 int $0x40 +- 3e91: c3 ret ++00003f5a : ++ 3f5a: b8 01 00 00 00 mov $0x1,%eax ++ 3f5f: cd 40 int $0x40 ++ 3f61: c3 ret + +-00003e92 : +-SYSCALL(exit) +- 3e92: b8 02 00 00 00 mov $0x2,%eax +- 3e97: cd 40 int $0x40 +- 3e99: c3 ret ++00003f62 : ++ 3f62: b8 02 00 00 00 mov $0x2,%eax ++ 3f67: cd 40 int $0x40 ++ 3f69: c3 ret + +-00003e9a : +-SYSCALL(wait) +- 3e9a: b8 03 00 00 00 mov $0x3,%eax +- 3e9f: cd 40 int $0x40 +- 3ea1: c3 ret ++00003f6a : ++ 3f6a: b8 03 00 00 00 mov $0x3,%eax ++ 3f6f: cd 40 int $0x40 ++ 3f71: c3 ret + +-00003ea2 : +-SYSCALL(pipe) +- 3ea2: b8 04 00 00 00 mov $0x4,%eax +- 3ea7: cd 40 int $0x40 +- 3ea9: c3 ret ++00003f72 : ++ 3f72: b8 04 00 00 00 mov $0x4,%eax ++ 3f77: cd 40 int $0x40 ++ 3f79: c3 ret + +-00003eaa : +-SYSCALL(read) +- 3eaa: b8 05 00 00 00 mov $0x5,%eax +- 3eaf: cd 40 int $0x40 +- 3eb1: c3 ret ++00003f7a : ++ 3f7a: b8 05 00 00 00 mov $0x5,%eax ++ 3f7f: cd 40 int $0x40 ++ 3f81: c3 ret + +-00003eb2 : +-SYSCALL(write) +- 3eb2: b8 10 00 00 00 mov $0x10,%eax +- 3eb7: cd 40 int $0x40 +- 3eb9: c3 ret ++00003f82 : ++ 3f82: b8 10 00 00 00 mov $0x10,%eax ++ 3f87: cd 40 int $0x40 ++ 3f89: c3 ret + +-00003eba : +-SYSCALL(close) +- 3eba: b8 15 00 00 00 mov $0x15,%eax +- 3ebf: cd 40 int $0x40 +- 3ec1: c3 ret ++00003f8a : ++ 3f8a: b8 15 00 00 00 mov $0x15,%eax ++ 3f8f: cd 40 int $0x40 ++ 3f91: c3 ret + +-00003ec2 : +-SYSCALL(kill) +- 3ec2: b8 06 00 00 00 mov $0x6,%eax +- 3ec7: cd 40 int $0x40 +- 3ec9: c3 ret ++00003f92 : ++ 3f92: b8 06 00 00 00 mov $0x6,%eax ++ 3f97: cd 40 int $0x40 ++ 3f99: c3 ret + +-00003eca : +-SYSCALL(exec) +- 3eca: b8 07 00 00 00 mov $0x7,%eax +- 3ecf: cd 40 int $0x40 +- 3ed1: c3 ret ++00003f9a : ++ 3f9a: b8 07 00 00 00 mov $0x7,%eax ++ 3f9f: cd 40 int $0x40 ++ 3fa1: c3 ret + +-00003ed2 : +-SYSCALL(open) +- 3ed2: b8 0f 00 00 00 mov $0xf,%eax +- 3ed7: cd 40 int $0x40 +- 3ed9: c3 ret ++00003fa2 : ++ 3fa2: b8 0f 00 00 00 mov $0xf,%eax ++ 3fa7: cd 40 int $0x40 ++ 3fa9: c3 ret + +-00003eda : +-SYSCALL(mknod) +- 3eda: b8 11 00 00 00 mov $0x11,%eax +- 3edf: cd 40 int $0x40 +- 3ee1: c3 ret ++00003faa : ++ 3faa: b8 11 00 00 00 mov $0x11,%eax ++ 3faf: cd 40 int $0x40 ++ 3fb1: c3 ret + +-00003ee2 : +-SYSCALL(unlink) +- 3ee2: b8 12 00 00 00 mov $0x12,%eax +- 3ee7: cd 40 int $0x40 +- 3ee9: c3 ret ++00003fb2 : ++ 3fb2: b8 12 00 00 00 mov $0x12,%eax ++ 3fb7: cd 40 int $0x40 ++ 3fb9: c3 ret + +-00003eea : +-SYSCALL(fstat) +- 3eea: b8 08 00 00 00 mov $0x8,%eax +- 3eef: cd 40 int $0x40 +- 3ef1: c3 ret ++00003fba : ++ 3fba: b8 08 00 00 00 mov $0x8,%eax ++ 3fbf: cd 40 int $0x40 ++ 3fc1: c3 ret + +-00003ef2 : +-SYSCALL(link) +- 3ef2: b8 13 00 00 00 mov $0x13,%eax +- 3ef7: cd 40 int $0x40 +- 3ef9: c3 ret ++00003fc2 : ++ 3fc2: b8 13 00 00 00 mov $0x13,%eax ++ 3fc7: cd 40 int $0x40 ++ 3fc9: c3 ret + +-00003efa : +-SYSCALL(mkdir) +- 3efa: b8 14 00 00 00 mov $0x14,%eax +- 3eff: cd 40 int $0x40 +- 3f01: c3 ret ++00003fca : ++ 3fca: b8 14 00 00 00 mov $0x14,%eax ++ 3fcf: cd 40 int $0x40 ++ 3fd1: c3 ret + +-00003f02 : +-SYSCALL(chdir) +- 3f02: b8 09 00 00 00 mov $0x9,%eax +- 3f07: cd 40 int $0x40 +- 3f09: c3 ret ++00003fd2 : ++ 3fd2: b8 09 00 00 00 mov $0x9,%eax ++ 3fd7: cd 40 int $0x40 ++ 3fd9: c3 ret + +-00003f0a : +-SYSCALL(dup) +- 3f0a: b8 0a 00 00 00 mov $0xa,%eax +- 3f0f: cd 40 int $0x40 +- 3f11: c3 ret ++00003fda : ++ 3fda: b8 0a 00 00 00 mov $0xa,%eax ++ 3fdf: cd 40 int $0x40 ++ 3fe1: c3 ret + +-00003f12 : +-SYSCALL(getpid) +- 3f12: b8 0b 00 00 00 mov $0xb,%eax +- 3f17: cd 40 int $0x40 +- 3f19: c3 ret ++00003fe2 : ++ 3fe2: b8 0b 00 00 00 mov $0xb,%eax ++ 3fe7: cd 40 int $0x40 ++ 3fe9: c3 ret + +-00003f1a : +-SYSCALL(sbrk) +- 3f1a: b8 0c 00 00 00 mov $0xc,%eax +- 3f1f: cd 40 int $0x40 +- 3f21: c3 ret ++00003fea : ++ 3fea: b8 0c 00 00 00 mov $0xc,%eax ++ 3fef: cd 40 int $0x40 ++ 3ff1: c3 ret + +-00003f22 : +-SYSCALL(sleep) +- 3f22: b8 0d 00 00 00 mov $0xd,%eax +- 3f27: cd 40 int $0x40 +- 3f29: c3 ret ++00003ff2 : ++ 3ff2: b8 0d 00 00 00 mov $0xd,%eax ++ 3ff7: cd 40 int $0x40 ++ 3ff9: c3 ret + +-00003f2a : +-SYSCALL(uptime) +- 3f2a: b8 0e 00 00 00 mov $0xe,%eax +- 3f2f: cd 40 int $0x40 +- 3f31: c3 ret +- 3f32: 66 90 xchg %ax,%ax +- 3f34: 66 90 xchg %ax,%ax +- 3f36: 66 90 xchg %ax,%ax +- 3f38: 66 90 xchg %ax,%ax +- 3f3a: 66 90 xchg %ax,%ax +- 3f3c: 66 90 xchg %ax,%ax +- 3f3e: 66 90 xchg %ax,%ax ++00003ffa : ++ 3ffa: b8 0e 00 00 00 mov $0xe,%eax ++ 3fff: cd 40 int $0x40 ++ 4001: c3 ret ++ 4002: 66 90 xchg %ax,%ax ++ 4004: 66 90 xchg %ax,%ax ++ 4006: 66 90 xchg %ax,%ax ++ 4008: 66 90 xchg %ax,%ax ++ 400a: 66 90 xchg %ax,%ax ++ 400c: 66 90 xchg %ax,%ax ++ 400e: 66 90 xchg %ax,%ax + +-00003f40 : ++00004010 : + write(fd, &c, 1); + } + + static void + printint(int fd, int xx, int base, int sgn) + { +- 3f40: 55 push %ebp +- 3f41: 89 e5 mov %esp,%ebp +- 3f43: 57 push %edi +- 3f44: 56 push %esi +- 3f45: 89 c6 mov %eax,%esi +- 3f47: 53 push %ebx +- 3f48: 83 ec 4c sub $0x4c,%esp ++ 4010: 55 push %ebp ++ 4011: 89 e5 mov %esp,%ebp ++ 4013: 57 push %edi ++ 4014: 56 push %esi ++ 4015: 89 c6 mov %eax,%esi ++ 4017: 53 push %ebx ++ 4018: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ +- 3f4b: 8b 5d 08 mov 0x8(%ebp),%ebx +- 3f4e: 85 db test %ebx,%ebx +- 3f50: 74 09 je 3f5b +- 3f52: 89 d0 mov %edx,%eax +- 3f54: c1 e8 1f shr $0x1f,%eax +- 3f57: 84 c0 test %al,%al +- 3f59: 75 75 jne 3fd0 ++ 401b: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 401e: 85 db test %ebx,%ebx ++ 4020: 74 09 je 402b ++ 4022: 89 d0 mov %edx,%eax ++ 4024: c1 e8 1f shr $0x1f,%eax ++ 4027: 84 c0 test %al,%al ++ 4029: 75 75 jne 40a0 + neg = 1; + x = -xx; + } else { + x = xx; +- 3f5b: 89 d0 mov %edx,%eax ++ 402b: 89 d0 mov %edx,%eax + neg = 0; +- 3f5d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) +- 3f64: 89 75 c0 mov %esi,-0x40(%ebp) ++ 402d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) ++ 4034: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; +- 3f67: 31 ff xor %edi,%edi +- 3f69: 89 ce mov %ecx,%esi +- 3f6b: 8d 5d d7 lea -0x29(%ebp),%ebx +- 3f6e: eb 02 jmp 3f72 ++ 4037: 31 ff xor %edi,%edi ++ 4039: 89 ce mov %ecx,%esi ++ 403b: 8d 5d d7 lea -0x29(%ebp),%ebx ++ 403e: eb 02 jmp 4042 + do{ + buf[i++] = digits[x % base]; +- 3f70: 89 cf mov %ecx,%edi +- 3f72: 31 d2 xor %edx,%edx +- 3f74: f7 f6 div %esi +- 3f76: 8d 4f 01 lea 0x1(%edi),%ecx +- 3f79: 0f b6 92 e7 5a 00 00 movzbl 0x5ae7(%edx),%edx ++ 4040: 89 cf mov %ecx,%edi ++ 4042: 31 d2 xor %edx,%edx ++ 4044: f7 f6 div %esi ++ 4046: 8d 4f 01 lea 0x1(%edi),%ecx ++ 4049: 0f b6 92 b7 5b 00 00 movzbl 0x5bb7(%edx),%edx + }while((x /= base) != 0); +- 3f80: 85 c0 test %eax,%eax ++ 4050: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; +- 3f82: 88 14 0b mov %dl,(%ebx,%ecx,1) ++ 4052: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); +- 3f85: 75 e9 jne 3f70 ++ 4055: 75 e9 jne 4040 + if(neg) +- 3f87: 8b 55 c4 mov -0x3c(%ebp),%edx ++ 4057: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; +- 3f8a: 89 c8 mov %ecx,%eax +- 3f8c: 8b 75 c0 mov -0x40(%ebp),%esi ++ 405a: 89 c8 mov %ecx,%eax ++ 405c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) +- 3f8f: 85 d2 test %edx,%edx +- 3f91: 74 08 je 3f9b ++ 405f: 85 d2 test %edx,%edx ++ 4061: 74 08 je 406b + buf[i++] = '-'; +- 3f93: 8d 4f 02 lea 0x2(%edi),%ecx +- 3f96: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) ++ 4063: 8d 4f 02 lea 0x2(%edi),%ecx ++ 4066: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) +- 3f9b: 8d 79 ff lea -0x1(%ecx),%edi +- 3f9e: 66 90 xchg %ax,%ax +- 3fa0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax +- 3fa5: 83 ef 01 sub $0x1,%edi ++ 406b: 8d 79 ff lea -0x1(%ecx),%edi ++ 406e: 66 90 xchg %ax,%ax ++ 4070: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax ++ 4075: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); +- 3fa8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 3faf: 00 +- 3fb0: 89 5c 24 04 mov %ebx,0x4(%esp) +- 3fb4: 89 34 24 mov %esi,(%esp) +- 3fb7: 88 45 d7 mov %al,-0x29(%ebp) +- 3fba: e8 f3 fe ff ff call 3eb2 ++ 4078: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 407f: 00 ++ 4080: 89 5c 24 04 mov %ebx,0x4(%esp) ++ 4084: 89 34 24 mov %esi,(%esp) ++ 4087: 88 45 d7 mov %al,-0x29(%ebp) ++ 408a: e8 f3 fe ff ff call 3f82 + while(--i >= 0) +- 3fbf: 83 ff ff cmp $0xffffffff,%edi +- 3fc2: 75 dc jne 3fa0 ++ 408f: 83 ff ff cmp $0xffffffff,%edi ++ 4092: 75 dc jne 4070 + putc(fd, buf[i]); + } +- 3fc4: 83 c4 4c add $0x4c,%esp +- 3fc7: 5b pop %ebx +- 3fc8: 5e pop %esi +- 3fc9: 5f pop %edi +- 3fca: 5d pop %ebp +- 3fcb: c3 ret +- 3fcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 4094: 83 c4 4c add $0x4c,%esp ++ 4097: 5b pop %ebx ++ 4098: 5e pop %esi ++ 4099: 5f pop %edi ++ 409a: 5d pop %ebp ++ 409b: c3 ret ++ 409c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; +- 3fd0: 89 d0 mov %edx,%eax +- 3fd2: f7 d8 neg %eax ++ 40a0: 89 d0 mov %edx,%eax ++ 40a2: f7 d8 neg %eax + neg = 1; +- 3fd4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) +- 3fdb: eb 87 jmp 3f64 +- 3fdd: 8d 76 00 lea 0x0(%esi),%esi ++ 40a4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) ++ 40ab: eb 87 jmp 4034 ++ 40ad: 8d 76 00 lea 0x0(%esi),%esi + +-00003fe0 : ++000040b0 : + + // Print to the given fd. Only understands %d, %x, %p, %s. + void + printf(int fd, const char *fmt, ...) + { +- 3fe0: 55 push %ebp +- 3fe1: 89 e5 mov %esp,%ebp +- 3fe3: 57 push %edi ++ 40b0: 55 push %ebp ++ 40b1: 89 e5 mov %esp,%ebp ++ 40b3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; +- 3fe4: 31 ff xor %edi,%edi ++ 40b4: 31 ff xor %edi,%edi + { +- 3fe6: 56 push %esi +- 3fe7: 53 push %ebx +- 3fe8: 83 ec 3c sub $0x3c,%esp ++ 40b6: 56 push %esi ++ 40b7: 53 push %ebx ++ 40b8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ +- 3feb: 8b 5d 0c mov 0xc(%ebp),%ebx ++ 40bb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; +- 3fee: 8d 45 10 lea 0x10(%ebp),%eax ++ 40be: 8d 45 10 lea 0x10(%ebp),%eax + { +- 3ff1: 8b 75 08 mov 0x8(%ebp),%esi ++ 40c1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; +- 3ff4: 89 45 d4 mov %eax,-0x2c(%ebp) ++ 40c4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ +- 3ff7: 0f b6 13 movzbl (%ebx),%edx +- 3ffa: 83 c3 01 add $0x1,%ebx +- 3ffd: 84 d2 test %dl,%dl +- 3fff: 75 39 jne 403a +- 4001: e9 c2 00 00 00 jmp 40c8 +- 4006: 66 90 xchg %ax,%ax ++ 40c7: 0f b6 13 movzbl (%ebx),%edx ++ 40ca: 83 c3 01 add $0x1,%ebx ++ 40cd: 84 d2 test %dl,%dl ++ 40cf: 75 39 jne 410a ++ 40d1: e9 c2 00 00 00 jmp 4198 ++ 40d6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ +- 4008: 83 fa 25 cmp $0x25,%edx +- 400b: 0f 84 bf 00 00 00 je 40d0 ++ 40d8: 83 fa 25 cmp $0x25,%edx ++ 40db: 0f 84 bf 00 00 00 je 41a0 + write(fd, &c, 1); +- 4011: 8d 45 e2 lea -0x1e(%ebp),%eax +- 4014: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 401b: 00 +- 401c: 89 44 24 04 mov %eax,0x4(%esp) +- 4020: 89 34 24 mov %esi,(%esp) ++ 40e1: 8d 45 e2 lea -0x1e(%ebp),%eax ++ 40e4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 40eb: 00 ++ 40ec: 89 44 24 04 mov %eax,0x4(%esp) ++ 40f0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); +- 4023: 88 55 e2 mov %dl,-0x1e(%ebp) ++ 40f3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); +- 4026: e8 87 fe ff ff call 3eb2 +- 402b: 83 c3 01 add $0x1,%ebx ++ 40f6: e8 87 fe ff ff call 3f82 ++ 40fb: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ +- 402e: 0f b6 53 ff movzbl -0x1(%ebx),%edx +- 4032: 84 d2 test %dl,%dl +- 4034: 0f 84 8e 00 00 00 je 40c8 ++ 40fe: 0f b6 53 ff movzbl -0x1(%ebx),%edx ++ 4102: 84 d2 test %dl,%dl ++ 4104: 0f 84 8e 00 00 00 je 4198 + if(state == 0){ +- 403a: 85 ff test %edi,%edi ++ 410a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; +- 403c: 0f be c2 movsbl %dl,%eax ++ 410c: 0f be c2 movsbl %dl,%eax + if(state == 0){ +- 403f: 74 c7 je 4008 ++ 410f: 74 c7 je 40d8 + } + } else if(state == '%'){ +- 4041: 83 ff 25 cmp $0x25,%edi +- 4044: 75 e5 jne 402b ++ 4111: 83 ff 25 cmp $0x25,%edi ++ 4114: 75 e5 jne 40fb + if(c == 'd'){ +- 4046: 83 fa 64 cmp $0x64,%edx +- 4049: 0f 84 31 01 00 00 je 4180 ++ 4116: 83 fa 64 cmp $0x64,%edx ++ 4119: 0f 84 31 01 00 00 je 4250 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ +- 404f: 25 f7 00 00 00 and $0xf7,%eax +- 4054: 83 f8 70 cmp $0x70,%eax +- 4057: 0f 84 83 00 00 00 je 40e0 ++ 411f: 25 f7 00 00 00 and $0xf7,%eax ++ 4124: 83 f8 70 cmp $0x70,%eax ++ 4127: 0f 84 83 00 00 00 je 41b0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ +- 405d: 83 fa 73 cmp $0x73,%edx +- 4060: 0f 84 a2 00 00 00 je 4108 ++ 412d: 83 fa 73 cmp $0x73,%edx ++ 4130: 0f 84 a2 00 00 00 je 41d8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ +- 4066: 83 fa 63 cmp $0x63,%edx +- 4069: 0f 84 35 01 00 00 je 41a4 ++ 4136: 83 fa 63 cmp $0x63,%edx ++ 4139: 0f 84 35 01 00 00 je 4274 + putc(fd, *ap); + ap++; + } else if(c == '%'){ +- 406f: 83 fa 25 cmp $0x25,%edx +- 4072: 0f 84 e0 00 00 00 je 4158 ++ 413f: 83 fa 25 cmp $0x25,%edx ++ 4142: 0f 84 e0 00 00 00 je 4228 + write(fd, &c, 1); +- 4078: 8d 45 e6 lea -0x1a(%ebp),%eax +- 407b: 83 c3 01 add $0x1,%ebx +- 407e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 4085: 00 ++ 4148: 8d 45 e6 lea -0x1a(%ebp),%eax ++ 414b: 83 c3 01 add $0x1,%ebx ++ 414e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 4155: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; +- 4086: 31 ff xor %edi,%edi ++ 4156: 31 ff xor %edi,%edi + write(fd, &c, 1); +- 4088: 89 44 24 04 mov %eax,0x4(%esp) +- 408c: 89 34 24 mov %esi,(%esp) +- 408f: 89 55 d0 mov %edx,-0x30(%ebp) +- 4092: c6 45 e6 25 movb $0x25,-0x1a(%ebp) +- 4096: e8 17 fe ff ff call 3eb2 ++ 4158: 89 44 24 04 mov %eax,0x4(%esp) ++ 415c: 89 34 24 mov %esi,(%esp) ++ 415f: 89 55 d0 mov %edx,-0x30(%ebp) ++ 4162: c6 45 e6 25 movb $0x25,-0x1a(%ebp) ++ 4166: e8 17 fe ff ff call 3f82 + putc(fd, c); +- 409b: 8b 55 d0 mov -0x30(%ebp),%edx ++ 416b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); +- 409e: 8d 45 e7 lea -0x19(%ebp),%eax +- 40a1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 40a8: 00 +- 40a9: 89 44 24 04 mov %eax,0x4(%esp) +- 40ad: 89 34 24 mov %esi,(%esp) ++ 416e: 8d 45 e7 lea -0x19(%ebp),%eax ++ 4171: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 4178: 00 ++ 4179: 89 44 24 04 mov %eax,0x4(%esp) ++ 417d: 89 34 24 mov %esi,(%esp) + putc(fd, c); +- 40b0: 88 55 e7 mov %dl,-0x19(%ebp) ++ 4180: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); +- 40b3: e8 fa fd ff ff call 3eb2 ++ 4183: e8 fa fd ff ff call 3f82 + for(i = 0; fmt[i]; i++){ +- 40b8: 0f b6 53 ff movzbl -0x1(%ebx),%edx +- 40bc: 84 d2 test %dl,%dl +- 40be: 0f 85 76 ff ff ff jne 403a +- 40c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 4188: 0f b6 53 ff movzbl -0x1(%ebx),%edx ++ 418c: 84 d2 test %dl,%dl ++ 418e: 0f 85 76 ff ff ff jne 410a ++ 4194: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } + } +- 40c8: 83 c4 3c add $0x3c,%esp +- 40cb: 5b pop %ebx +- 40cc: 5e pop %esi +- 40cd: 5f pop %edi +- 40ce: 5d pop %ebp +- 40cf: c3 ret ++ 4198: 83 c4 3c add $0x3c,%esp ++ 419b: 5b pop %ebx ++ 419c: 5e pop %esi ++ 419d: 5f pop %edi ++ 419e: 5d pop %ebp ++ 419f: c3 ret + state = '%'; +- 40d0: bf 25 00 00 00 mov $0x25,%edi +- 40d5: e9 51 ff ff ff jmp 402b +- 40da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 41a0: bf 25 00 00 00 mov $0x25,%edi ++ 41a5: e9 51 ff ff ff jmp 40fb ++ 41aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); +- 40e0: 8b 45 d4 mov -0x2c(%ebp),%eax +- 40e3: b9 10 00 00 00 mov $0x10,%ecx ++ 41b0: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 41b3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; +- 40e8: 31 ff xor %edi,%edi ++ 41b8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); +- 40ea: c7 04 24 00 00 00 00 movl $0x0,(%esp) +- 40f1: 8b 10 mov (%eax),%edx +- 40f3: 89 f0 mov %esi,%eax +- 40f5: e8 46 fe ff ff call 3f40 ++ 41ba: c7 04 24 00 00 00 00 movl $0x0,(%esp) ++ 41c1: 8b 10 mov (%eax),%edx ++ 41c3: 89 f0 mov %esi,%eax ++ 41c5: e8 46 fe ff ff call 4010 + ap++; +- 40fa: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 40fe: e9 28 ff ff ff jmp 402b +- 4103: 90 nop +- 4104: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 41ca: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 41ce: e9 28 ff ff ff jmp 40fb ++ 41d3: 90 nop ++ 41d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; +- 4108: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 41d8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; +- 410b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 41db: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; +- 410f: 8b 38 mov (%eax),%edi ++ 41df: 8b 38 mov (%eax),%edi + s = "(null)"; +- 4111: b8 e0 5a 00 00 mov $0x5ae0,%eax +- 4116: 85 ff test %edi,%edi +- 4118: 0f 44 f8 cmove %eax,%edi ++ 41e1: b8 b0 5b 00 00 mov $0x5bb0,%eax ++ 41e6: 85 ff test %edi,%edi ++ 41e8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ +- 411b: 0f b6 07 movzbl (%edi),%eax +- 411e: 84 c0 test %al,%al +- 4120: 74 2a je 414c +- 4122: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 4128: 88 45 e3 mov %al,-0x1d(%ebp) ++ 41eb: 0f b6 07 movzbl (%edi),%eax ++ 41ee: 84 c0 test %al,%al ++ 41f0: 74 2a je 421c ++ 41f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 41f8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); +- 412b: 8d 45 e3 lea -0x1d(%ebp),%eax ++ 41fb: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; +- 412e: 83 c7 01 add $0x1,%edi ++ 41fe: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); +- 4131: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 4138: 00 +- 4139: 89 44 24 04 mov %eax,0x4(%esp) +- 413d: 89 34 24 mov %esi,(%esp) +- 4140: e8 6d fd ff ff call 3eb2 ++ 4201: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 4208: 00 ++ 4209: 89 44 24 04 mov %eax,0x4(%esp) ++ 420d: 89 34 24 mov %esi,(%esp) ++ 4210: e8 6d fd ff ff call 3f82 + while(*s != 0){ +- 4145: 0f b6 07 movzbl (%edi),%eax +- 4148: 84 c0 test %al,%al +- 414a: 75 dc jne 4128 ++ 4215: 0f b6 07 movzbl (%edi),%eax ++ 4218: 84 c0 test %al,%al ++ 421a: 75 dc jne 41f8 + state = 0; +- 414c: 31 ff xor %edi,%edi +- 414e: e9 d8 fe ff ff jmp 402b +- 4153: 90 nop +- 4154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 421c: 31 ff xor %edi,%edi ++ 421e: e9 d8 fe ff ff jmp 40fb ++ 4223: 90 nop ++ 4224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); +- 4158: 8d 45 e5 lea -0x1b(%ebp),%eax ++ 4228: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; +- 415b: 31 ff xor %edi,%edi ++ 422b: 31 ff xor %edi,%edi + write(fd, &c, 1); +- 415d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 4164: 00 +- 4165: 89 44 24 04 mov %eax,0x4(%esp) +- 4169: 89 34 24 mov %esi,(%esp) +- 416c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) +- 4170: e8 3d fd ff ff call 3eb2 +- 4175: e9 b1 fe ff ff jmp 402b +- 417a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 422d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 4234: 00 ++ 4235: 89 44 24 04 mov %eax,0x4(%esp) ++ 4239: 89 34 24 mov %esi,(%esp) ++ 423c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) ++ 4240: e8 3d fd ff ff call 3f82 ++ 4245: e9 b1 fe ff ff jmp 40fb ++ 424a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); +- 4180: 8b 45 d4 mov -0x2c(%ebp),%eax +- 4183: b9 0a 00 00 00 mov $0xa,%ecx ++ 4250: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 4253: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; +- 4188: 66 31 ff xor %di,%di ++ 4258: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); +- 418b: c7 04 24 01 00 00 00 movl $0x1,(%esp) +- 4192: 8b 10 mov (%eax),%edx +- 4194: 89 f0 mov %esi,%eax +- 4196: e8 a5 fd ff ff call 3f40 ++ 425b: c7 04 24 01 00 00 00 movl $0x1,(%esp) ++ 4262: 8b 10 mov (%eax),%edx ++ 4264: 89 f0 mov %esi,%eax ++ 4266: e8 a5 fd ff ff call 4010 + ap++; +- 419b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 419f: e9 87 fe ff ff jmp 402b ++ 426b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 426f: e9 87 fe ff ff jmp 40fb + putc(fd, *ap); +- 41a4: 8b 45 d4 mov -0x2c(%ebp),%eax ++ 4274: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; +- 41a7: 31 ff xor %edi,%edi ++ 4277: 31 ff xor %edi,%edi + putc(fd, *ap); +- 41a9: 8b 00 mov (%eax),%eax ++ 4279: 8b 00 mov (%eax),%eax + write(fd, &c, 1); +- 41ab: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) +- 41b2: 00 +- 41b3: 89 34 24 mov %esi,(%esp) ++ 427b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) ++ 4282: 00 ++ 4283: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); +- 41b6: 88 45 e4 mov %al,-0x1c(%ebp) ++ 4286: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); +- 41b9: 8d 45 e4 lea -0x1c(%ebp),%eax +- 41bc: 89 44 24 04 mov %eax,0x4(%esp) +- 41c0: e8 ed fc ff ff call 3eb2 ++ 4289: 8d 45 e4 lea -0x1c(%ebp),%eax ++ 428c: 89 44 24 04 mov %eax,0x4(%esp) ++ 4290: e8 ed fc ff ff call 3f82 + ap++; +- 41c5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +- 41c9: e9 5d fe ff ff jmp 402b +- 41ce: 66 90 xchg %ax,%ax ++ 4295: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ++ 4299: e9 5d fe ff ff jmp 40fb ++ 429e: 66 90 xchg %ax,%ax + +-000041d0 : ++000042a0 : + static Header base; + static Header *freep; + + void + free(void *ap) + { +- 41d0: 55 push %ebp ++ 42a0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 41d1: a1 60 64 00 00 mov 0x6460,%eax ++ 42a1: a1 40 65 00 00 mov 0x6540,%eax + { +- 41d6: 89 e5 mov %esp,%ebp +- 41d8: 57 push %edi +- 41d9: 56 push %esi +- 41da: 53 push %ebx +- 41db: 8b 5d 08 mov 0x8(%ebp),%ebx ++ 42a6: 89 e5 mov %esp,%ebp ++ 42a8: 57 push %edi ++ 42a9: 56 push %esi ++ 42aa: 53 push %ebx ++ 42ab: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 41de: 8b 08 mov (%eax),%ecx ++ 42ae: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; +- 41e0: 8d 53 f8 lea -0x8(%ebx),%edx ++ 42b0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 41e3: 39 d0 cmp %edx,%eax +- 41e5: 72 11 jb 41f8 +- 41e7: 90 nop ++ 42b3: 39 d0 cmp %edx,%eax ++ 42b5: 72 11 jb 42c8 ++ 42b7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 41e8: 39 c8 cmp %ecx,%eax +- 41ea: 72 04 jb 41f0 +- 41ec: 39 ca cmp %ecx,%edx +- 41ee: 72 10 jb 4200 +- 41f0: 89 c8 mov %ecx,%eax ++ 42b8: 39 c8 cmp %ecx,%eax ++ 42ba: 72 04 jb 42c0 ++ 42bc: 39 ca cmp %ecx,%edx ++ 42be: 72 10 jb 42d0 ++ 42c0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 41f2: 39 d0 cmp %edx,%eax ++ 42c2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 41f4: 8b 08 mov (%eax),%ecx ++ 42c4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +- 41f6: 73 f0 jae 41e8 +- 41f8: 39 ca cmp %ecx,%edx +- 41fa: 72 04 jb 4200 ++ 42c6: 73 f0 jae 42b8 ++ 42c8: 39 ca cmp %ecx,%edx ++ 42ca: 72 04 jb 42d0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) +- 41fc: 39 c8 cmp %ecx,%eax +- 41fe: 72 f0 jb 41f0 ++ 42cc: 39 c8 cmp %ecx,%eax ++ 42ce: 72 f0 jb 42c0 + break; + if(bp + bp->s.size == p->s.ptr){ +- 4200: 8b 73 fc mov -0x4(%ebx),%esi +- 4203: 8d 3c f2 lea (%edx,%esi,8),%edi +- 4206: 39 cf cmp %ecx,%edi +- 4208: 74 1e je 4228 ++ 42d0: 8b 73 fc mov -0x4(%ebx),%esi ++ 42d3: 8d 3c f2 lea (%edx,%esi,8),%edi ++ 42d6: 39 cf cmp %ecx,%edi ++ 42d8: 74 1e je 42f8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; +- 420a: 89 4b f8 mov %ecx,-0x8(%ebx) ++ 42da: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ +- 420d: 8b 48 04 mov 0x4(%eax),%ecx +- 4210: 8d 34 c8 lea (%eax,%ecx,8),%esi +- 4213: 39 f2 cmp %esi,%edx +- 4215: 74 28 je 423f ++ 42dd: 8b 48 04 mov 0x4(%eax),%ecx ++ 42e0: 8d 34 c8 lea (%eax,%ecx,8),%esi ++ 42e3: 39 f2 cmp %esi,%edx ++ 42e5: 74 28 je 430f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; +- 4217: 89 10 mov %edx,(%eax) ++ 42e7: 89 10 mov %edx,(%eax) + freep = p; +- 4219: a3 60 64 00 00 mov %eax,0x6460 ++ 42e9: a3 40 65 00 00 mov %eax,0x6540 + } +- 421e: 5b pop %ebx +- 421f: 5e pop %esi +- 4220: 5f pop %edi +- 4221: 5d pop %ebp +- 4222: c3 ret +- 4223: 90 nop +- 4224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 42ee: 5b pop %ebx ++ 42ef: 5e pop %esi ++ 42f0: 5f pop %edi ++ 42f1: 5d pop %ebp ++ 42f2: c3 ret ++ 42f3: 90 nop ++ 42f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; +- 4228: 03 71 04 add 0x4(%ecx),%esi +- 422b: 89 73 fc mov %esi,-0x4(%ebx) ++ 42f8: 03 71 04 add 0x4(%ecx),%esi ++ 42fb: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; +- 422e: 8b 08 mov (%eax),%ecx +- 4230: 8b 09 mov (%ecx),%ecx +- 4232: 89 4b f8 mov %ecx,-0x8(%ebx) ++ 42fe: 8b 08 mov (%eax),%ecx ++ 4300: 8b 09 mov (%ecx),%ecx ++ 4302: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ +- 4235: 8b 48 04 mov 0x4(%eax),%ecx +- 4238: 8d 34 c8 lea (%eax,%ecx,8),%esi +- 423b: 39 f2 cmp %esi,%edx +- 423d: 75 d8 jne 4217 ++ 4305: 8b 48 04 mov 0x4(%eax),%ecx ++ 4308: 8d 34 c8 lea (%eax,%ecx,8),%esi ++ 430b: 39 f2 cmp %esi,%edx ++ 430d: 75 d8 jne 42e7 + p->s.size += bp->s.size; +- 423f: 03 4b fc add -0x4(%ebx),%ecx ++ 430f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; +- 4242: a3 60 64 00 00 mov %eax,0x6460 ++ 4312: a3 40 65 00 00 mov %eax,0x6540 + p->s.size += bp->s.size; +- 4247: 89 48 04 mov %ecx,0x4(%eax) ++ 4317: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; +- 424a: 8b 53 f8 mov -0x8(%ebx),%edx +- 424d: 89 10 mov %edx,(%eax) ++ 431a: 8b 53 f8 mov -0x8(%ebx),%edx ++ 431d: 89 10 mov %edx,(%eax) + } +- 424f: 5b pop %ebx +- 4250: 5e pop %esi +- 4251: 5f pop %edi +- 4252: 5d pop %ebp +- 4253: c3 ret +- 4254: 8d b6 00 00 00 00 lea 0x0(%esi),%esi +- 425a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi ++ 431f: 5b pop %ebx ++ 4320: 5e pop %esi ++ 4321: 5f pop %edi ++ 4322: 5d pop %ebp ++ 4323: c3 ret ++ 4324: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ++ 432a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +-00004260 : ++00004330 : + return freep; + } + + void* + malloc(uint nbytes) + { +- 4260: 55 push %ebp +- 4261: 89 e5 mov %esp,%ebp +- 4263: 57 push %edi +- 4264: 56 push %esi +- 4265: 53 push %ebx +- 4266: 83 ec 1c sub $0x1c,%esp ++ 4330: 55 push %ebp ++ 4331: 89 e5 mov %esp,%ebp ++ 4333: 57 push %edi ++ 4334: 56 push %esi ++ 4335: 53 push %ebx ++ 4336: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 4269: 8b 45 08 mov 0x8(%ebp),%eax ++ 4339: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ +- 426c: 8b 1d 60 64 00 00 mov 0x6460,%ebx ++ 433c: 8b 1d 40 65 00 00 mov 0x6540,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 4272: 8d 48 07 lea 0x7(%eax),%ecx +- 4275: c1 e9 03 shr $0x3,%ecx ++ 4342: 8d 48 07 lea 0x7(%eax),%ecx ++ 4345: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ +- 4278: 85 db test %ebx,%ebx ++ 4348: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; +- 427a: 8d 71 01 lea 0x1(%ecx),%esi ++ 434a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ +- 427d: 0f 84 9b 00 00 00 je 431e +- 4283: 8b 13 mov (%ebx),%edx +- 4285: 8b 7a 04 mov 0x4(%edx),%edi ++ 434d: 0f 84 9b 00 00 00 je 43ee ++ 4353: 8b 13 mov (%ebx),%edx ++ 4355: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ +- 4288: 39 fe cmp %edi,%esi +- 428a: 76 64 jbe 42f0 +- 428c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax ++ 4358: 39 fe cmp %edi,%esi ++ 435a: 76 64 jbe 43c0 ++ 435c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) +- 4293: bb 00 80 00 00 mov $0x8000,%ebx +- 4298: 89 45 e4 mov %eax,-0x1c(%ebp) +- 429b: eb 0e jmp 42ab +- 429d: 8d 76 00 lea 0x0(%esi),%esi ++ 4363: bb 00 80 00 00 mov $0x8000,%ebx ++ 4368: 89 45 e4 mov %eax,-0x1c(%ebp) ++ 436b: eb 0e jmp 437b ++ 436d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ +- 42a0: 8b 02 mov (%edx),%eax ++ 4370: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ +- 42a2: 8b 78 04 mov 0x4(%eax),%edi +- 42a5: 39 fe cmp %edi,%esi +- 42a7: 76 4f jbe 42f8 +- 42a9: 89 c2 mov %eax,%edx ++ 4372: 8b 78 04 mov 0x4(%eax),%edi ++ 4375: 39 fe cmp %edi,%esi ++ 4377: 76 4f jbe 43c8 ++ 4379: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) +- 42ab: 3b 15 60 64 00 00 cmp 0x6460,%edx +- 42b1: 75 ed jne 42a0 ++ 437b: 3b 15 40 65 00 00 cmp 0x6540,%edx ++ 4381: 75 ed jne 4370 + if(nu < 4096) +- 42b3: 8b 45 e4 mov -0x1c(%ebp),%eax +- 42b6: 81 fe 00 10 00 00 cmp $0x1000,%esi +- 42bc: bf 00 10 00 00 mov $0x1000,%edi +- 42c1: 0f 43 fe cmovae %esi,%edi +- 42c4: 0f 42 c3 cmovb %ebx,%eax ++ 4383: 8b 45 e4 mov -0x1c(%ebp),%eax ++ 4386: 81 fe 00 10 00 00 cmp $0x1000,%esi ++ 438c: bf 00 10 00 00 mov $0x1000,%edi ++ 4391: 0f 43 fe cmovae %esi,%edi ++ 4394: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); +- 42c7: 89 04 24 mov %eax,(%esp) +- 42ca: e8 4b fc ff ff call 3f1a ++ 4397: 89 04 24 mov %eax,(%esp) ++ 439a: e8 4b fc ff ff call 3fea + if(p == (char*)-1) +- 42cf: 83 f8 ff cmp $0xffffffff,%eax +- 42d2: 74 18 je 42ec ++ 439f: 83 f8 ff cmp $0xffffffff,%eax ++ 43a2: 74 18 je 43bc + hp->s.size = nu; +- 42d4: 89 78 04 mov %edi,0x4(%eax) ++ 43a4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); +- 42d7: 83 c0 08 add $0x8,%eax +- 42da: 89 04 24 mov %eax,(%esp) +- 42dd: e8 ee fe ff ff call 41d0 ++ 43a7: 83 c0 08 add $0x8,%eax ++ 43aa: 89 04 24 mov %eax,(%esp) ++ 43ad: e8 ee fe ff ff call 42a0 + return freep; +- 42e2: 8b 15 60 64 00 00 mov 0x6460,%edx ++ 43b2: 8b 15 40 65 00 00 mov 0x6540,%edx + if((p = morecore(nunits)) == 0) +- 42e8: 85 d2 test %edx,%edx +- 42ea: 75 b4 jne 42a0 ++ 43b8: 85 d2 test %edx,%edx ++ 43ba: 75 b4 jne 4370 + return 0; +- 42ec: 31 c0 xor %eax,%eax +- 42ee: eb 20 jmp 4310 ++ 43bc: 31 c0 xor %eax,%eax ++ 43be: eb 20 jmp 43e0 + if(p->s.size >= nunits){ +- 42f0: 89 d0 mov %edx,%eax +- 42f2: 89 da mov %ebx,%edx +- 42f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ++ 43c0: 89 d0 mov %edx,%eax ++ 43c2: 89 da mov %ebx,%edx ++ 43c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) +- 42f8: 39 fe cmp %edi,%esi +- 42fa: 74 1c je 4318 ++ 43c8: 39 fe cmp %edi,%esi ++ 43ca: 74 1c je 43e8 + p->s.size -= nunits; +- 42fc: 29 f7 sub %esi,%edi +- 42fe: 89 78 04 mov %edi,0x4(%eax) ++ 43cc: 29 f7 sub %esi,%edi ++ 43ce: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; +- 4301: 8d 04 f8 lea (%eax,%edi,8),%eax ++ 43d1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; +- 4304: 89 70 04 mov %esi,0x4(%eax) ++ 43d4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; +- 4307: 89 15 60 64 00 00 mov %edx,0x6460 ++ 43d7: 89 15 40 65 00 00 mov %edx,0x6540 + return (void*)(p + 1); +- 430d: 83 c0 08 add $0x8,%eax ++ 43dd: 83 c0 08 add $0x8,%eax + } + } +- 4310: 83 c4 1c add $0x1c,%esp +- 4313: 5b pop %ebx +- 4314: 5e pop %esi +- 4315: 5f pop %edi +- 4316: 5d pop %ebp +- 4317: c3 ret ++ 43e0: 83 c4 1c add $0x1c,%esp ++ 43e3: 5b pop %ebx ++ 43e4: 5e pop %esi ++ 43e5: 5f pop %edi ++ 43e6: 5d pop %ebp ++ 43e7: c3 ret + prevp->s.ptr = p->s.ptr; +- 4318: 8b 08 mov (%eax),%ecx +- 431a: 89 0a mov %ecx,(%edx) +- 431c: eb e9 jmp 4307 ++ 43e8: 8b 08 mov (%eax),%ecx ++ 43ea: 89 0a mov %ecx,(%edx) ++ 43ec: eb e9 jmp 43d7 + base.s.ptr = freep = prevp = &base; +- 431e: c7 05 60 64 00 00 64 movl $0x6464,0x6460 +- 4325: 64 00 00 ++ 43ee: c7 05 40 65 00 00 44 movl $0x6544,0x6540 ++ 43f5: 65 00 00 + base.s.size = 0; +- 4328: ba 64 64 00 00 mov $0x6464,%edx ++ 43f8: ba 44 65 00 00 mov $0x6544,%edx + base.s.ptr = freep = prevp = &base; +- 432d: c7 05 64 64 00 00 64 movl $0x6464,0x6464 +- 4334: 64 00 00 ++ 43fd: c7 05 44 65 00 00 44 movl $0x6544,0x6544 ++ 4404: 65 00 00 + base.s.size = 0; +- 4337: c7 05 68 64 00 00 00 movl $0x0,0x6468 +- 433e: 00 00 00 +- 4341: e9 46 ff ff ff jmp 428c ++ 4407: c7 05 48 65 00 00 00 movl $0x0,0x6548 ++ 440e: 00 00 00 ++ 4411: e9 46 ff ff ff jmp 435c +diff --git a/usertests.c b/usertests.c +index d25d9ef..d1662c5 100644 +--- a/usertests.c ++++ b/usertests.c +@@ -10,28 +10,31 @@ + + char buf[8192]; + char name[3]; +-char *echoargv[] = { "echo", "ALL", "TESTS", "PASSED", 0 }; ++char *echoargv[] = {"echo", "ALL", "TESTS", "PASSED", 0}; + int stdout = 1; + + // does chdir() call iput(p->cwd) in a transaction? +-void +-iputtest(void) ++void iputtest(void) + { + printf(stdout, "iput test\n"); + +- if(mkdir("iputdir") < 0){ ++ if (mkdir("iputdir") < 0) ++ { + printf(stdout, "mkdir failed\n"); + exit(0); + } +- if(chdir("iputdir") < 0){ ++ if (chdir("iputdir") < 0) ++ { + printf(stdout, "chdir iputdir failed\n"); + exit(0); + } +- if(unlink("../iputdir") < 0){ ++ if (unlink("../iputdir") < 0) ++ { + printf(stdout, "unlink ../iputdir failed\n"); + exit(0); + } +- if(chdir("/") < 0){ ++ if (chdir("/") < 0) ++ { + printf(stdout, "chdir / failed\n"); + exit(0); + } +@@ -39,34 +42,39 @@ iputtest(void) + } + + // does exit(0) call iput(p->cwd) in a transaction? +-void +-exitiputtest(void) ++void exitiputtest(void) + { + int pid; + + printf(stdout, "exitiput test\n"); + + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(stdout, "fork failed\n"); + exit(0); + } +- if(pid == 0){ +- if(mkdir("iputdir") < 0){ ++ if (pid == 0) ++ { ++ if (mkdir("iputdir") < 0) ++ { + printf(stdout, "mkdir failed\n"); + exit(0); + } +- if(chdir("iputdir") < 0){ ++ if (chdir("iputdir") < 0) ++ { + printf(stdout, "child chdir failed\n"); + exit(0); + } +- if(unlink("../iputdir") < 0){ ++ if (unlink("../iputdir") < 0) ++ { + printf(stdout, "unlink ../iputdir failed\n"); + exit(0); + } + exit(0); + } +- wait(); ++ wait(0); ++ ; + printf(stdout, "exitiput test ok\n"); + } + +@@ -81,80 +89,91 @@ exitiputtest(void) + // for(i = 0; i < 10000; i++) + // yield(); + // } +-void +-openiputtest(void) ++void openiputtest(void) + { + int pid; + + printf(stdout, "openiput test\n"); +- if(mkdir("oidir") < 0){ ++ if (mkdir("oidir") < 0) ++ { + printf(stdout, "mkdir oidir failed\n"); + exit(0); + } + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(stdout, "fork failed\n"); + exit(0); + } +- if(pid == 0){ ++ if (pid == 0) ++ { + int fd = open("oidir", O_RDWR); +- if(fd >= 0){ ++ if (fd >= 0) ++ { + printf(stdout, "open directory for write succeeded\n"); + exit(0); + } + exit(0); + } + sleep(1); +- if(unlink("oidir") != 0){ ++ if (unlink("oidir") != 0) ++ { + printf(stdout, "unlink failed\n"); + exit(0); + } +- wait(); ++ wait(0); ++ ; + printf(stdout, "openiput test ok\n"); + } + + // simple file system tests + +-void +-opentest(void) ++void opentest(void) + { + int fd; + + printf(stdout, "open test\n"); + fd = open("echo", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(stdout, "open echo failed!\n"); + exit(0); + } + close(fd); + fd = open("doesnotexist", 0); +- if(fd >= 0){ ++ if (fd >= 0) ++ { + printf(stdout, "open doesnotexist succeeded!\n"); + exit(0); + } + printf(stdout, "open test ok\n"); + } + +-void +-writetest(void) ++void writetest(void) + { + int fd; + int i; + + printf(stdout, "small file test\n"); +- fd = open("small", O_CREATE|O_RDWR); +- if(fd >= 0){ ++ fd = open("small", O_CREATE | O_RDWR); ++ if (fd >= 0) ++ { + printf(stdout, "creat small succeeded; ok\n"); +- } else { ++ } ++ else ++ { + printf(stdout, "error: creat small failed!\n"); + exit(0); + } +- for(i = 0; i < 100; i++){ +- if(write(fd, "aaaaaaaaaa", 10) != 10){ ++ for (i = 0; i < 100; i++) ++ { ++ if (write(fd, "aaaaaaaaaa", 10) != 10) ++ { + printf(stdout, "error: write aa %d new file failed\n", i); + exit(0); + } +- if(write(fd, "bbbbbbbbbb", 10) != 10){ ++ if (write(fd, "bbbbbbbbbb", 10) != 10) ++ { + printf(stdout, "error: write bb %d new file failed\n", i); + exit(0); + } +@@ -162,44 +181,53 @@ writetest(void) + printf(stdout, "writes ok\n"); + close(fd); + fd = open("small", O_RDONLY); +- if(fd >= 0){ ++ if (fd >= 0) ++ { + printf(stdout, "open small succeeded ok\n"); +- } else { ++ } ++ else ++ { + printf(stdout, "error: open small failed!\n"); + exit(0); + } + i = read(fd, buf, 2000); +- if(i == 2000){ ++ if (i == 2000) ++ { + printf(stdout, "read succeeded ok\n"); +- } else { ++ } ++ else ++ { + printf(stdout, "read failed\n"); + exit(0); + } + close(fd); + +- if(unlink("small") < 0){ ++ if (unlink("small") < 0) ++ { + printf(stdout, "unlink small failed\n"); + exit(0); + } + printf(stdout, "small file test ok\n"); + } + +-void +-writetest1(void) ++void writetest1(void) + { + int i, fd, n; + + printf(stdout, "big files test\n"); + +- fd = open("big", O_CREATE|O_RDWR); +- if(fd < 0){ ++ fd = open("big", O_CREATE | O_RDWR); ++ if (fd < 0) ++ { + printf(stdout, "error: creat big failed!\n"); + exit(0); + } + +- for(i = 0; i < MAXFILE; i++){ +- ((int*)buf)[0] = i; +- if(write(fd, buf, 512) != 512){ ++ for (i = 0; i < MAXFILE; i++) ++ { ++ ((int *)buf)[0] = i; ++ if (write(fd, buf, 512) != 512) ++ { + printf(stdout, "error: write big file failed\n", i); + exit(0); + } +@@ -208,41 +236,48 @@ writetest1(void) + close(fd); + + fd = open("big", O_RDONLY); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(stdout, "error: open big failed!\n"); + exit(0); + } + + n = 0; +- for(;;){ ++ for (;;) ++ { + i = read(fd, buf, 512); +- if(i == 0){ +- if(n == MAXFILE - 1){ ++ if (i == 0) ++ { ++ if (n == MAXFILE - 1) ++ { + printf(stdout, "read only %d blocks from big", n); + exit(0); + } + break; +- } else if(i != 512){ ++ } ++ else if (i != 512) ++ { + printf(stdout, "read failed %d\n", i); + exit(0); + } +- if(((int*)buf)[0] != n){ ++ if (((int *)buf)[0] != n) ++ { + printf(stdout, "read content of block %d is %d\n", +- n, ((int*)buf)[0]); ++ n, ((int *)buf)[0]); + exit(0); + } + n++; + } + close(fd); +- if(unlink("big") < 0){ ++ if (unlink("big") < 0) ++ { + printf(stdout, "unlink big failed\n"); + exit(0); + } + printf(stdout, "big files ok\n"); + } + +-void +-createtest(void) ++void createtest(void) + { + int i, fd; + +@@ -250,14 +285,16 @@ createtest(void) + + name[0] = 'a'; + name[2] = '\0'; +- for(i = 0; i < 52; i++){ ++ for (i = 0; i < 52; i++) ++ { + name[1] = '0' + i; +- fd = open(name, O_CREATE|O_RDWR); ++ fd = open(name, O_CREATE | O_RDWR); + close(fd); + } + name[0] = 'a'; + name[2] = '\0'; +- for(i = 0; i < 52; i++){ ++ for (i = 0; i < 52; i++) ++ { + name[1] = '0' + i; + unlink(name); + } +@@ -268,33 +305,37 @@ void dirtest(void) + { + printf(stdout, "mkdir test\n"); + +- if(mkdir("dir0") < 0){ ++ if (mkdir("dir0") < 0) ++ { + printf(stdout, "mkdir failed\n"); + exit(0); + } + +- if(chdir("dir0") < 0){ ++ if (chdir("dir0") < 0) ++ { + printf(stdout, "chdir dir0 failed\n"); + exit(0); + } + +- if(chdir("..") < 0){ ++ if (chdir("..") < 0) ++ { + printf(stdout, "chdir .. failed\n"); + exit(0); + } + +- if(unlink("dir0") < 0){ ++ if (unlink("dir0") < 0) ++ { + printf(stdout, "unlink dir0 failed\n"); + exit(0); + } + printf(stdout, "mkdir test ok\n"); + } + +-void +-exectest(void) ++void exectest(void) + { + printf(stdout, "exec test\n"); +- if(exec("echo", echoargv) < 0){ ++ if (exec("echo", echoargv) < 0) ++ { + printf(stdout, "exec echo failed\n"); + exit(0); + } +@@ -302,52 +343,64 @@ exectest(void) + + // simple fork and pipe read/write + +-void +-pipe1(void) ++void pipe1(void) + { + int fds[2], pid; + int seq, i, n, cc, total; + +- if(pipe(fds) != 0){ ++ if (pipe(fds) != 0) ++ { + printf(1, "pipe() failed\n"); + exit(0); + } + pid = fork(); + seq = 0; +- if(pid == 0){ ++ if (pid == 0) ++ { + close(fds[0]); +- for(n = 0; n < 5; n++){ +- for(i = 0; i < 1033; i++) ++ for (n = 0; n < 5; n++) ++ { ++ for (i = 0; i < 1033; i++) + buf[i] = seq++; +- if(write(fds[1], buf, 1033) != 1033){ ++ if (write(fds[1], buf, 1033) != 1033) ++ { + printf(1, "pipe1 oops 1\n"); + exit(0); + } + } + exit(0); +- } else if(pid > 0){ ++ } ++ else if (pid > 0) ++ { + close(fds[1]); + total = 0; + cc = 1; +- while((n = read(fds[0], buf, cc)) > 0){ +- for(i = 0; i < n; i++){ +- if((buf[i] & 0xff) != (seq++ & 0xff)){ ++ while ((n = read(fds[0], buf, cc)) > 0) ++ { ++ for (i = 0; i < n; i++) ++ { ++ if ((buf[i] & 0xff) != (seq++ & 0xff)) ++ { + printf(1, "pipe1 oops 2\n"); + return; + } + } + total += n; + cc = cc * 2; +- if(cc > sizeof(buf)) ++ if (cc > sizeof(buf)) + cc = sizeof(buf); + } +- if(total != 5 * 1033){ ++ if (total != 5 * 1033) ++ { + printf(1, "pipe1 oops 3 total %d\n", total); + exit(0); + } + close(fds[0]); +- wait(); +- } else { ++ wait(0); ++ ; ++ } ++ else ++ { + printf(1, "fork() failed\n"); + exit(0); + } +@@ -355,36 +408,37 @@ pipe1(void) + } + + // meant to be run w/ at most two CPUs +-void +-preempt(void) ++void preempt(void) + { + int pid1, pid2, pid3; + int pfds[2]; + + printf(1, "preempt: "); + pid1 = fork(); +- if(pid1 == 0) +- for(;;) ++ if (pid1 == 0) ++ for (;;) + ; + + pid2 = fork(); +- if(pid2 == 0) +- for(;;) ++ if (pid2 == 0) ++ for (;;) + ; + + pipe(pfds); + pid3 = fork(); +- if(pid3 == 0){ ++ if (pid3 == 0) ++ { + close(pfds[0]); +- if(write(pfds[1], "x", 1) != 1) ++ if (write(pfds[1], "x", 1) != 1) + printf(1, "preempt write error"); + close(pfds[1]); +- for(;;) ++ for (;;) + ; + } + + close(pfds[1]); +- if(read(pfds[0], buf, sizeof(buf)) != 1){ ++ if (read(pfds[0], buf, sizeof(buf)) != 1) ++ { + printf(1, "preempt read error"); + return; + } +@@ -394,57 +448,68 @@ preempt(void) + kill(pid2); + kill(pid3); + printf(1, "wait... "); +- wait(); +- wait(); +- wait(); ++ wait(0); ++ ; ++ wait(0); ++ ; ++ wait(0); ++ ; + printf(1, "preempt ok\n"); + } + + // try to find any races between exit and wait +-void +-exitwait(void) ++void exitwait(void) + { + int i, pid; + +- for(i = 0; i < 100; i++){ ++ for (i = 0; i < 100; i++) ++ { + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(1, "fork failed\n"); + return; + } +- if(pid){ +- if(wait() != pid){ ++ if (pid) ++ { ++ if (wait(0) != pid) ++ { + printf(1, "wait wrong pid\n"); + return; + } +- } else { ++ } ++ else ++ { + exit(0); + } + } + printf(1, "exitwait ok\n"); + } + +-void +-mem(void) ++void mem(void) + { + void *m1, *m2; + int pid, ppid; + + printf(1, "mem test\n"); + ppid = getpid(); +- if((pid = fork()) == 0){ ++ if ((pid = fork()) == 0) ++ { + m1 = 0; +- while((m2 = malloc(10001)) != 0){ +- *(char**)m2 = m1; ++ while ((m2 = malloc(10001)) != 0) ++ { ++ *(char **)m2 = m1; + m1 = m2; + } +- while(m1){ +- m2 = *(char**)m1; ++ while (m1) ++ { ++ m2 = *(char **)m1; + free(m1); + m1 = m2; + } +- m1 = malloc(1024*20); +- if(m1 == 0){ ++ m1 = malloc(1024 * 20); ++ if (m1 == 0) ++ { + printf(1, "couldn't allocate mem?!!\n"); + kill(ppid); + exit(0); +@@ -452,8 +517,11 @@ mem(void) + free(m1); + printf(1, "mem ok\n"); + exit(0); +- } else { +- wait(); ++ } ++ else ++ { ++ wait(0); ++ ; + } + } + +@@ -461,8 +529,7 @@ mem(void) + + // two processes write to the same file descriptor + // is the offset shared? does inode locking work? +-void +-sharedfd(void) ++void sharedfd(void) + { + int fd, pid, i, n, nc, np; + char buf[10]; +@@ -470,43 +537,53 @@ sharedfd(void) + printf(1, "sharedfd test\n"); + + unlink("sharedfd"); +- fd = open("sharedfd", O_CREATE|O_RDWR); +- if(fd < 0){ ++ fd = open("sharedfd", O_CREATE | O_RDWR); ++ if (fd < 0) ++ { + printf(1, "fstests: cannot open sharedfd for writing"); + return; + } + pid = fork(); +- memset(buf, pid==0?'c':'p', sizeof(buf)); +- for(i = 0; i < 1000; i++){ +- if(write(fd, buf, sizeof(buf)) != sizeof(buf)){ ++ memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); ++ for (i = 0; i < 1000; i++) ++ { ++ if (write(fd, buf, sizeof(buf)) != sizeof(buf)) ++ { + printf(1, "fstests: write sharedfd failed\n"); + break; + } + } +- if(pid == 0) ++ if (pid == 0) + exit(0); + else +- wait(); ++ wait(0); ++ ; + close(fd); + fd = open("sharedfd", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "fstests: cannot open sharedfd for reading\n"); + return; + } + nc = np = 0; +- while((n = read(fd, buf, sizeof(buf))) > 0){ +- for(i = 0; i < sizeof(buf); i++){ +- if(buf[i] == 'c') ++ while ((n = read(fd, buf, sizeof(buf))) > 0) ++ { ++ for (i = 0; i < sizeof(buf); i++) ++ { ++ if (buf[i] == 'c') + nc++; +- if(buf[i] == 'p') ++ if (buf[i] == 'p') + np++; + } + } + close(fd); + unlink("sharedfd"); +- if(nc == 10000 && np == 10000){ ++ if (nc == 10000 && np == 10000) ++ { + printf(1, "sharedfd ok\n"); +- } else { ++ } ++ else ++ { + printf(1, "sharedfd oops %d %d\n", nc, np); + exit(0); + } +@@ -514,35 +591,40 @@ sharedfd(void) + + // four processes write different files at the same + // time, to test block allocation. +-void +-fourfiles(void) ++void fourfiles(void) + { + int fd, pid, i, j, n, total, pi; +- char *names[] = { "f0", "f1", "f2", "f3" }; ++ char *names[] = {"f0", "f1", "f2", "f3"}; + char *fname; + + printf(1, "fourfiles test\n"); + +- for(pi = 0; pi < 4; pi++){ ++ for (pi = 0; pi < 4; pi++) ++ { + fname = names[pi]; + unlink(fname); + + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(1, "fork failed\n"); + exit(0); + } + +- if(pid == 0){ ++ if (pid == 0) ++ { + fd = open(fname, O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create failed\n"); + exit(0); + } + +- memset(buf, '0'+pi, 512); +- for(i = 0; i < 12; i++){ +- if((n = write(fd, buf, 500)) != 500){ ++ memset(buf, '0' + pi, 512); ++ for (i = 0; i < 12; i++) ++ { ++ if ((n = write(fd, buf, 500)) != 500) ++ { + printf(1, "write failed %d\n", n); + exit(0); + } +@@ -551,17 +633,23 @@ fourfiles(void) + } + } + +- for(pi = 0; pi < 4; pi++){ +- wait(); ++ for (pi = 0; pi < 4; pi++) ++ { ++ wait(0); ++ ; + } + +- for(i = 0; i < 2; i++){ ++ for (i = 0; i < 2; i++) ++ { + fname = names[i]; + fd = open(fname, 0); + total = 0; +- while((n = read(fd, buf, sizeof(buf))) > 0){ +- for(j = 0; j < n; j++){ +- if(buf[j] != '0'+i){ ++ while ((n = read(fd, buf, sizeof(buf))) > 0) ++ { ++ for (j = 0; j < n; j++) ++ { ++ if (buf[j] != '0' + i) ++ { + printf(1, "wrong char\n"); + exit(0); + } +@@ -569,7 +657,8 @@ fourfiles(void) + total += n; + } + close(fd); +- if(total != 12*500){ ++ if (total != 12 * 500) ++ { + printf(1, "wrong length %d\n", total); + exit(0); + } +@@ -580,36 +669,45 @@ fourfiles(void) + } + + // four processes create and delete different files in same directory +-void +-createdelete(void) ++void createdelete(void) + { +- enum { N = 20 }; ++ enum ++ { ++ N = 20 ++ }; + int pid, i, fd, pi; + char name[32]; + + printf(1, "createdelete test\n"); + +- for(pi = 0; pi < 4; pi++){ ++ for (pi = 0; pi < 4; pi++) ++ { + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(1, "fork failed\n"); + exit(0); + } + +- if(pid == 0){ ++ if (pid == 0) ++ { + name[0] = 'p' + pi; + name[2] = '\0'; +- for(i = 0; i < N; i++){ ++ for (i = 0; i < N; i++) ++ { + name[1] = '0' + i; + fd = open(name, O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create failed\n"); + exit(0); + } + close(fd); +- if(i > 0 && (i % 2 ) == 0){ ++ if (i > 0 && (i % 2) == 0) ++ { + name[1] = '0' + (i / 2); +- if(unlink(name) < 0){ ++ if (unlink(name) < 0) ++ { + printf(1, "unlink failed\n"); + exit(0); + } +@@ -619,30 +717,39 @@ createdelete(void) + } + } + +- for(pi = 0; pi < 4; pi++){ +- wait(); ++ for (pi = 0; pi < 4; pi++) ++ { ++ wait(0); ++ ; + } + + name[0] = name[1] = name[2] = 0; +- for(i = 0; i < N; i++){ +- for(pi = 0; pi < 4; pi++){ ++ for (i = 0; i < N; i++) ++ { ++ for (pi = 0; pi < 4; pi++) ++ { + name[0] = 'p' + pi; + name[1] = '0' + i; + fd = open(name, 0); +- if((i == 0 || i >= N/2) && fd < 0){ ++ if ((i == 0 || i >= N / 2) && fd < 0) ++ { + printf(1, "oops createdelete %s didn't exist\n", name); + exit(0); +- } else if((i >= 1 && i < N/2) && fd >= 0){ ++ } ++ else if ((i >= 1 && i < N / 2) && fd >= 0) ++ { + printf(1, "oops createdelete %s did exist\n", name); + exit(0); + } +- if(fd >= 0) ++ if (fd >= 0) + close(fd); + } + } + +- for(i = 0; i < N; i++){ +- for(pi = 0; pi < 4; pi++){ ++ for (i = 0; i < N; i++) ++ { ++ for (pi = 0; pi < 4; pi++) ++ { + name[0] = 'p' + i; + name[1] = '0' + i; + unlink(name); +@@ -653,14 +760,14 @@ createdelete(void) + } + + // can I unlink a file and still read it? +-void +-unlinkread(void) ++void unlinkread(void) + { + int fd, fd1; + + printf(1, "unlinkread test\n"); + fd = open("unlinkread", O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create unlinkread failed\n"); + exit(0); + } +@@ -668,11 +775,13 @@ unlinkread(void) + close(fd); + + fd = open("unlinkread", O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "open unlinkread failed\n"); + exit(0); + } +- if(unlink("unlinkread") != 0){ ++ if (unlink("unlinkread") != 0) ++ { + printf(1, "unlink unlinkread failed\n"); + exit(0); + } +@@ -681,15 +790,18 @@ unlinkread(void) + write(fd1, "yyy", 3); + close(fd1); + +- if(read(fd, buf, sizeof(buf)) != 5){ ++ if (read(fd, buf, sizeof(buf)) != 5) ++ { + printf(1, "unlinkread read failed"); + exit(0); + } +- if(buf[0] != 'h'){ ++ if (buf[0] != 'h') ++ { + printf(1, "unlinkread wrong data\n"); + exit(0); + } +- if(write(fd, buf, 10) != 10){ ++ if (write(fd, buf, 10) != 10) ++ { + printf(1, "unlinkread write failed\n"); + exit(0); + } +@@ -698,8 +810,7 @@ unlinkread(void) + printf(1, "unlinkread ok\n"); + } + +-void +-linktest(void) ++void linktest(void) + { + int fd; + +@@ -708,51 +819,60 @@ linktest(void) + unlink("lf1"); + unlink("lf2"); + +- fd = open("lf1", O_CREATE|O_RDWR); +- if(fd < 0){ ++ fd = open("lf1", O_CREATE | O_RDWR); ++ if (fd < 0) ++ { + printf(1, "create lf1 failed\n"); + exit(0); + } +- if(write(fd, "hello", 5) != 5){ ++ if (write(fd, "hello", 5) != 5) ++ { + printf(1, "write lf1 failed\n"); + exit(0); + } + close(fd); + +- if(link("lf1", "lf2") < 0){ ++ if (link("lf1", "lf2") < 0) ++ { + printf(1, "link lf1 lf2 failed\n"); + exit(0); + } + unlink("lf1"); + +- if(open("lf1", 0) >= 0){ ++ if (open("lf1", 0) >= 0) ++ { + printf(1, "unlinked lf1 but it is still there!\n"); + exit(0); + } + + fd = open("lf2", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "open lf2 failed\n"); + exit(0); + } +- if(read(fd, buf, sizeof(buf)) != 5){ ++ if (read(fd, buf, sizeof(buf)) != 5) ++ { + printf(1, "read lf2 failed\n"); + exit(0); + } + close(fd); + +- if(link("lf2", "lf2") >= 0){ ++ if (link("lf2", "lf2") >= 0) ++ { + printf(1, "link lf2 lf2 succeeded! oops\n"); + exit(0); + } + + unlink("lf2"); +- if(link("lf2", "lf1") >= 0){ ++ if (link("lf2", "lf1") >= 0) ++ { + printf(1, "link non-existant succeeded! oops\n"); + exit(0); + } + +- if(link(".", "lf1") >= 0){ ++ if (link(".", "lf1") >= 0) ++ { + printf(1, "link . lf1 succeeded! oops\n"); + exit(0); + } +@@ -761,13 +881,13 @@ linktest(void) + } + + // test concurrent create/link/unlink of the same file +-void +-concreate(void) ++void concreate(void) + { + char file[3]; + int i, pid, n, fd; + char fa[40]; +- struct { ++ struct ++ { + ushort inum; + char name[14]; + } de; +@@ -775,41 +895,53 @@ concreate(void) + printf(1, "concreate test\n"); + file[0] = 'C'; + file[2] = '\0'; +- for(i = 0; i < 40; i++){ ++ for (i = 0; i < 40; i++) ++ { + file[1] = '0' + i; + unlink(file); + pid = fork(); +- if(pid && (i % 3) == 1){ ++ if (pid && (i % 3) == 1) ++ { + link("C0", file); +- } else if(pid == 0 && (i % 5) == 1){ ++ } ++ else if (pid == 0 && (i % 5) == 1) ++ { + link("C0", file); +- } else { ++ } ++ else ++ { + fd = open(file, O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "concreate create %s failed\n", file); + exit(0); + } + close(fd); + } +- if(pid == 0) ++ if (pid == 0) + exit(0); + else +- wait(); ++ wait(0); ++ ; + } + + memset(fa, 0, sizeof(fa)); + fd = open(".", 0); + n = 0; +- while(read(fd, &de, sizeof(de)) > 0){ +- if(de.inum == 0) ++ while (read(fd, &de, sizeof(de)) > 0) ++ { ++ if (de.inum == 0) + continue; +- if(de.name[0] == 'C' && de.name[2] == '\0'){ ++ if (de.name[0] == 'C' && de.name[2] == '\0') ++ { + i = de.name[1] - '0'; +- if(i < 0 || i >= sizeof(fa)){ ++ if (i < 0 || i >= sizeof(fa)) ++ { + printf(1, "concreate weird file %s\n", de.name); + exit(0); + } +- if(fa[i]){ ++ if (fa[i]) ++ { + printf(1, "concreate duplicate file %s\n", de.name); + exit(0); + } +@@ -819,34 +951,41 @@ concreate(void) + } + close(fd); + +- if(n != 40){ ++ if (n != 40) ++ { + printf(1, "concreate not enough files in directory listing\n"); + exit(0); + } + +- for(i = 0; i < 40; i++){ ++ for (i = 0; i < 40; i++) ++ { + file[1] = '0' + i; + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(1, "fork failed\n"); + exit(0); + } +- if(((i % 3) == 0 && pid == 0) || +- ((i % 3) == 1 && pid != 0)){ ++ if (((i % 3) == 0 && pid == 0) || ++ ((i % 3) == 1 && pid != 0)) ++ { + close(open(file, 0)); + close(open(file, 0)); + close(open(file, 0)); + close(open(file, 0)); +- } else { ++ } ++ else ++ { + unlink(file); + unlink(file); + unlink(file); + unlink(file); + } +- if(pid == 0) ++ if (pid == 0) + exit(0); + else +- wait(); ++ wait(0); ++ ; + } + + printf(1, "concreate ok\n"); +@@ -854,8 +993,7 @@ concreate(void) + + // another concurrent link/unlink/create test, + // to look for deadlocks. +-void +-linkunlink() ++void linkunlink() + { + int pid, i; + +@@ -863,25 +1001,33 @@ linkunlink() + + unlink("x"); + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(1, "fork failed\n"); + exit(0); + } + + unsigned int x = (pid ? 1 : 97); +- for(i = 0; i < 100; i++){ ++ for (i = 0; i < 100; i++) ++ { + x = x * 1103515245 + 12345; +- if((x % 3) == 0){ ++ if ((x % 3) == 0) ++ { + close(open("x", O_RDWR | O_CREATE)); +- } else if((x % 3) == 1){ ++ } ++ else if ((x % 3) == 1) ++ { + link("cat", "x"); +- } else { ++ } ++ else ++ { + unlink("x"); + } + } + +- if(pid) +- wait(); ++ if (pid) ++ wait(0); ++ + else + exit(0); + +@@ -889,8 +1035,7 @@ linkunlink() + } + + // directory that uses indirect blocks +-void +-bigdir(void) ++void bigdir(void) + { + int i, fd; + char name[10]; +@@ -899,30 +1044,35 @@ bigdir(void) + unlink("bd"); + + fd = open("bd", O_CREATE); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "bigdir create failed\n"); + exit(0); + } + close(fd); + +- for(i = 0; i < 500; i++){ ++ for (i = 0; i < 500; i++) ++ { + name[0] = 'x'; + name[1] = '0' + (i / 64); + name[2] = '0' + (i % 64); + name[3] = '\0'; +- if(link("bd", name) != 0){ ++ if (link("bd", name) != 0) ++ { + printf(1, "bigdir link failed\n"); + exit(0); + } + } + + unlink("bd"); +- for(i = 0; i < 500; i++){ ++ for (i = 0; i < 500; i++) ++ { + name[0] = 'x'; + name[1] = '0' + (i / 64); + name[2] = '0' + (i % 64); + name[3] = '\0'; +- if(unlink(name) != 0){ ++ if (unlink(name) != 0) ++ { + printf(1, "bigdir unlink failed"); + exit(0); + } +@@ -931,39 +1081,43 @@ bigdir(void) + printf(1, "bigdir ok\n"); + } + +-void +-subdir(void) ++void subdir(void) + { + int fd, cc; + + printf(1, "subdir test\n"); + + unlink("ff"); +- if(mkdir("dd") != 0){ ++ if (mkdir("dd") != 0) ++ { + printf(1, "subdir mkdir dd failed\n"); + exit(0); + } + + fd = open("dd/ff", O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create dd/ff failed\n"); + exit(0); + } + write(fd, "ff", 2); + close(fd); + +- if(unlink("dd") >= 0){ ++ if (unlink("dd") >= 0) ++ { + printf(1, "unlink dd (non-empty dir) succeeded!\n"); + exit(0); + } + +- if(mkdir("/dd/dd") != 0){ ++ if (mkdir("/dd/dd") != 0) ++ { + printf(1, "subdir mkdir dd/dd failed\n"); + exit(0); + } + + fd = open("dd/dd/ff", O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create dd/dd/ff failed\n"); + exit(0); + } +@@ -971,142 +1125,174 @@ subdir(void) + close(fd); + + fd = open("dd/dd/../ff", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "open dd/dd/../ff failed\n"); + exit(0); + } + cc = read(fd, buf, sizeof(buf)); +- if(cc != 2 || buf[0] != 'f'){ ++ if (cc != 2 || buf[0] != 'f') ++ { + printf(1, "dd/dd/../ff wrong content\n"); + exit(0); + } + close(fd); + +- if(link("dd/dd/ff", "dd/dd/ffff") != 0){ ++ if (link("dd/dd/ff", "dd/dd/ffff") != 0) ++ { + printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); + exit(0); + } + +- if(unlink("dd/dd/ff") != 0){ ++ if (unlink("dd/dd/ff") != 0) ++ { + printf(1, "unlink dd/dd/ff failed\n"); + exit(0); + } +- if(open("dd/dd/ff", O_RDONLY) >= 0){ ++ if (open("dd/dd/ff", O_RDONLY) >= 0) ++ { + printf(1, "open (unlinked) dd/dd/ff succeeded\n"); + exit(0); + } + +- if(chdir("dd") != 0){ ++ if (chdir("dd") != 0) ++ { + printf(1, "chdir dd failed\n"); + exit(0); + } +- if(chdir("dd/../../dd") != 0){ ++ if (chdir("dd/../../dd") != 0) ++ { + printf(1, "chdir dd/../../dd failed\n"); + exit(0); + } +- if(chdir("dd/../../../dd") != 0){ ++ if (chdir("dd/../../../dd") != 0) ++ { + printf(1, "chdir dd/../../dd failed\n"); + exit(0); + } +- if(chdir("./..") != 0){ ++ if (chdir("./..") != 0) ++ { + printf(1, "chdir ./.. failed\n"); + exit(0); + } + + fd = open("dd/dd/ffff", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "open dd/dd/ffff failed\n"); + exit(0); + } +- if(read(fd, buf, sizeof(buf)) != 2){ ++ if (read(fd, buf, sizeof(buf)) != 2) ++ { + printf(1, "read dd/dd/ffff wrong len\n"); + exit(0); + } + close(fd); + +- if(open("dd/dd/ff", O_RDONLY) >= 0){ ++ if (open("dd/dd/ff", O_RDONLY) >= 0) ++ { + printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); + exit(0); + } + +- if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){ ++ if (open("dd/ff/ff", O_CREATE | O_RDWR) >= 0) ++ { + printf(1, "create dd/ff/ff succeeded!\n"); + exit(0); + } +- if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){ ++ if (open("dd/xx/ff", O_CREATE | O_RDWR) >= 0) ++ { + printf(1, "create dd/xx/ff succeeded!\n"); + exit(0); + } +- if(open("dd", O_CREATE) >= 0){ ++ if (open("dd", O_CREATE) >= 0) ++ { + printf(1, "create dd succeeded!\n"); + exit(0); + } +- if(open("dd", O_RDWR) >= 0){ ++ if (open("dd", O_RDWR) >= 0) ++ { + printf(1, "open dd rdwr succeeded!\n"); + exit(0); + } +- if(open("dd", O_WRONLY) >= 0){ ++ if (open("dd", O_WRONLY) >= 0) ++ { + printf(1, "open dd wronly succeeded!\n"); + exit(0); + } +- if(link("dd/ff/ff", "dd/dd/xx") == 0){ ++ if (link("dd/ff/ff", "dd/dd/xx") == 0) ++ { + printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); + exit(0); + } +- if(link("dd/xx/ff", "dd/dd/xx") == 0){ ++ if (link("dd/xx/ff", "dd/dd/xx") == 0) ++ { + printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); + exit(0); + } +- if(link("dd/ff", "dd/dd/ffff") == 0){ ++ if (link("dd/ff", "dd/dd/ffff") == 0) ++ { + printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); + exit(0); + } +- if(mkdir("dd/ff/ff") == 0){ ++ if (mkdir("dd/ff/ff") == 0) ++ { + printf(1, "mkdir dd/ff/ff succeeded!\n"); + exit(0); + } +- if(mkdir("dd/xx/ff") == 0){ ++ if (mkdir("dd/xx/ff") == 0) ++ { + printf(1, "mkdir dd/xx/ff succeeded!\n"); + exit(0); + } +- if(mkdir("dd/dd/ffff") == 0){ ++ if (mkdir("dd/dd/ffff") == 0) ++ { + printf(1, "mkdir dd/dd/ffff succeeded!\n"); + exit(0); + } +- if(unlink("dd/xx/ff") == 0){ ++ if (unlink("dd/xx/ff") == 0) ++ { + printf(1, "unlink dd/xx/ff succeeded!\n"); + exit(0); + } +- if(unlink("dd/ff/ff") == 0){ ++ if (unlink("dd/ff/ff") == 0) ++ { + printf(1, "unlink dd/ff/ff succeeded!\n"); + exit(0); + } +- if(chdir("dd/ff") == 0){ ++ if (chdir("dd/ff") == 0) ++ { + printf(1, "chdir dd/ff succeeded!\n"); + exit(0); + } +- if(chdir("dd/xx") == 0){ ++ if (chdir("dd/xx") == 0) ++ { + printf(1, "chdir dd/xx succeeded!\n"); + exit(0); + } + +- if(unlink("dd/dd/ffff") != 0){ ++ if (unlink("dd/dd/ffff") != 0) ++ { + printf(1, "unlink dd/dd/ff failed\n"); + exit(0); + } +- if(unlink("dd/ff") != 0){ ++ if (unlink("dd/ff") != 0) ++ { + printf(1, "unlink dd/ff failed\n"); + exit(0); + } +- if(unlink("dd") == 0){ ++ if (unlink("dd") == 0) ++ { + printf(1, "unlink non-empty dd succeeded!\n"); + exit(0); + } +- if(unlink("dd/dd") < 0){ ++ if (unlink("dd/dd") < 0) ++ { + printf(1, "unlink dd/dd failed\n"); + exit(0); + } +- if(unlink("dd") < 0){ ++ if (unlink("dd") < 0) ++ { + printf(1, "unlink dd failed\n"); + exit(0); + } +@@ -1115,24 +1301,27 @@ subdir(void) + } + + // test writes that are larger than the log. +-void +-bigwrite(void) ++void bigwrite(void) + { + int fd, sz; + + printf(1, "bigwrite test\n"); + + unlink("bigwrite"); +- for(sz = 499; sz < 12*512; sz += 471){ ++ for (sz = 499; sz < 12 * 512; sz += 471) ++ { + fd = open("bigwrite", O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "cannot create bigwrite\n"); + exit(0); + } + int i; +- for(i = 0; i < 2; i++){ ++ for (i = 0; i < 2; i++) ++ { + int cc = write(fd, buf, sz); +- if(cc != sz){ ++ if (cc != sz) ++ { + printf(1, "write(%d) ret %d\n", sz, cc); + exit(0); + } +@@ -1144,8 +1333,7 @@ bigwrite(void) + printf(1, "bigwrite ok\n"); + } + +-void +-bigfile(void) ++void bigfile(void) + { + int fd, i, total, cc; + +@@ -1153,13 +1341,16 @@ bigfile(void) + + unlink("bigfile"); + fd = open("bigfile", O_CREATE | O_RDWR); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "cannot create bigfile"); + exit(0); + } +- for(i = 0; i < 20; i++){ ++ for (i = 0; i < 20; i++) ++ { + memset(buf, i, 600); +- if(write(fd, buf, 600) != 600){ ++ if (write(fd, buf, 600) != 600) ++ { + printf(1, "write bigfile failed\n"); + exit(0); + } +@@ -1167,31 +1358,37 @@ bigfile(void) + close(fd); + + fd = open("bigfile", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "cannot open bigfile\n"); + exit(0); + } + total = 0; +- for(i = 0; ; i++){ ++ for (i = 0;; i++) ++ { + cc = read(fd, buf, 300); +- if(cc < 0){ ++ if (cc < 0) ++ { + printf(1, "read bigfile failed\n"); + exit(0); + } +- if(cc == 0) ++ if (cc == 0) + break; +- if(cc != 300){ ++ if (cc != 300) ++ { + printf(1, "short read bigfile\n"); + exit(0); + } +- if(buf[0] != i/2 || buf[299] != i/2){ ++ if (buf[0] != i / 2 || buf[299] != i / 2) ++ { + printf(1, "read bigfile wrong data\n"); + exit(0); + } + total += cc; + } + close(fd); +- if(total != 20*600){ ++ if (total != 20 * 600) ++ { + printf(1, "read bigfile wrong total\n"); + exit(0); + } +@@ -1200,40 +1397,45 @@ bigfile(void) + printf(1, "bigfile test ok\n"); + } + +-void +-fourteen(void) ++void fourteen(void) + { + int fd; + + // DIRSIZ is 14. + printf(1, "fourteen test\n"); + +- if(mkdir("12345678901234") != 0){ ++ if (mkdir("12345678901234") != 0) ++ { + printf(1, "mkdir 12345678901234 failed\n"); + exit(0); + } +- if(mkdir("12345678901234/123456789012345") != 0){ ++ if (mkdir("12345678901234/123456789012345") != 0) ++ { + printf(1, "mkdir 12345678901234/123456789012345 failed\n"); + exit(0); + } + fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); + exit(0); + } + close(fd); + fd = open("12345678901234/12345678901234/12345678901234", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); + exit(0); + } + close(fd); + +- if(mkdir("12345678901234/12345678901234") == 0){ ++ if (mkdir("12345678901234/12345678901234") == 0) ++ { + printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); + exit(0); + } +- if(mkdir("123456789012345/12345678901234") == 0){ ++ if (mkdir("123456789012345/12345678901234") == 0) ++ { + printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); + exit(0); + } +@@ -1241,96 +1443,112 @@ fourteen(void) + printf(1, "fourteen ok\n"); + } + +-void +-rmdot(void) ++void rmdot(void) + { + printf(1, "rmdot test\n"); +- if(mkdir("dots") != 0){ ++ if (mkdir("dots") != 0) ++ { + printf(1, "mkdir dots failed\n"); + exit(0); + } +- if(chdir("dots") != 0){ ++ if (chdir("dots") != 0) ++ { + printf(1, "chdir dots failed\n"); + exit(0); + } +- if(unlink(".") == 0){ ++ if (unlink(".") == 0) ++ { + printf(1, "rm . worked!\n"); + exit(0); + } +- if(unlink("..") == 0){ ++ if (unlink("..") == 0) ++ { + printf(1, "rm .. worked!\n"); + exit(0); + } +- if(chdir("/") != 0){ ++ if (chdir("/") != 0) ++ { + printf(1, "chdir / failed\n"); + exit(0); + } +- if(unlink("dots/.") == 0){ ++ if (unlink("dots/.") == 0) ++ { + printf(1, "unlink dots/. worked!\n"); + exit(0); + } +- if(unlink("dots/..") == 0){ ++ if (unlink("dots/..") == 0) ++ { + printf(1, "unlink dots/.. worked!\n"); + exit(0); + } +- if(unlink("dots") != 0){ ++ if (unlink("dots") != 0) ++ { + printf(1, "unlink dots failed!\n"); + exit(0); + } + printf(1, "rmdot ok\n"); + } + +-void +-dirfile(void) ++void dirfile(void) + { + int fd; + + printf(1, "dir vs file\n"); + + fd = open("dirfile", O_CREATE); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(1, "create dirfile failed\n"); + exit(0); + } + close(fd); +- if(chdir("dirfile") == 0){ ++ if (chdir("dirfile") == 0) ++ { + printf(1, "chdir dirfile succeeded!\n"); + exit(0); + } + fd = open("dirfile/xx", 0); +- if(fd >= 0){ ++ if (fd >= 0) ++ { + printf(1, "create dirfile/xx succeeded!\n"); + exit(0); + } + fd = open("dirfile/xx", O_CREATE); +- if(fd >= 0){ ++ if (fd >= 0) ++ { + printf(1, "create dirfile/xx succeeded!\n"); + exit(0); + } +- if(mkdir("dirfile/xx") == 0){ ++ if (mkdir("dirfile/xx") == 0) ++ { + printf(1, "mkdir dirfile/xx succeeded!\n"); + exit(0); + } +- if(unlink("dirfile/xx") == 0){ ++ if (unlink("dirfile/xx") == 0) ++ { + printf(1, "unlink dirfile/xx succeeded!\n"); + exit(0); + } +- if(link("README", "dirfile/xx") == 0){ ++ if (link("README", "dirfile/xx") == 0) ++ { + printf(1, "link to dirfile/xx succeeded!\n"); + exit(0); + } +- if(unlink("dirfile") != 0){ ++ if (unlink("dirfile") != 0) ++ { + printf(1, "unlink dirfile failed!\n"); + exit(0); + } + + fd = open(".", O_RDWR); +- if(fd >= 0){ ++ if (fd >= 0) ++ { + printf(1, "open . for writing succeeded!\n"); + exit(0); + } + fd = open(".", 0); +- if(write(fd, "x", 1) > 0){ ++ if (write(fd, "x", 1) > 0) ++ { + printf(1, "write . succeeded!\n"); + exit(0); + } +@@ -1340,20 +1558,22 @@ dirfile(void) + } + + // test that iput() is called at the end of _namei() +-void +-iref(void) ++void iref(void) + { + int i, fd; + + printf(1, "empty file name\n"); + + // the 50 is NINODE +- for(i = 0; i < 50 + 1; i++){ +- if(mkdir("irefd") != 0){ ++ for (i = 0; i < 50 + 1; i++) ++ { ++ if (mkdir("irefd") != 0) ++ { + printf(1, "mkdir irefd failed\n"); + exit(0); + } +- if(chdir("irefd") != 0){ ++ if (chdir("irefd") != 0) ++ { + printf(1, "chdir irefd failed\n"); + exit(0); + } +@@ -1361,10 +1581,10 @@ iref(void) + mkdir(""); + link("README", ""); + fd = open("", O_CREATE); +- if(fd >= 0) ++ if (fd >= 0) + close(fd); + fd = open("xx", O_CREATE); +- if(fd >= 0) ++ if (fd >= 0) + close(fd); + unlink("xx"); + } +@@ -1376,34 +1596,38 @@ iref(void) + // test that fork fails gracefully + // the forktest binary also does this, but it runs out of proc entries first. + // inside the bigger usertests binary, we run out of memory first. +-void +-forktest(void) ++void forktest(void) + { + int n, pid; + + printf(1, "fork test\n"); + +- for(n=0; n<1000; n++){ ++ for (n = 0; n < 1000; n++) ++ { + pid = fork(); +- if(pid < 0) ++ if (pid < 0) + break; +- if(pid == 0) ++ if (pid == 0) + exit(0); + } + +- if(n == 1000){ ++ if (n == 1000) ++ { + printf(1, "fork claimed to work 1000 times!\n"); + exit(0); + } + +- for(; n > 0; n--){ +- if(wait() < 0){ ++ for (; n > 0; n--) ++ { ++ if (wait(0) < 0) ++ { + printf(1, "wait stopped early\n"); + exit(0); + } + } + +- if(wait() != -1){ ++ if (wait(0) != -1) ++ { + printf(1, "wait got too many\n"); + exit(0); + } +@@ -1411,8 +1635,7 @@ forktest(void) + printf(1, "fork test OK\n"); + } + +-void +-sbrktest(void) ++void sbrktest(void) + { + int fds[2], pid, pids[10], ppid; + char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; +@@ -1424,9 +1647,11 @@ sbrktest(void) + // can one sbrk() less than a page? + a = sbrk(0); + int i; +- for(i = 0; i < 5000; i++){ ++ for (i = 0; i < 5000; i++) ++ { + b = sbrk(1); +- if(b != a){ ++ if (b != a) ++ { + printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); + exit(0); + } +@@ -1434,41 +1659,47 @@ sbrktest(void) + a = b + 1; + } + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(stdout, "sbrk test fork failed\n"); + exit(0); + } + c = sbrk(1); + c = sbrk(1); +- if(c != a + 1){ ++ if (c != a + 1) ++ { + printf(stdout, "sbrk test failed post-fork\n"); + exit(0); + } +- if(pid == 0) ++ if (pid == 0) + exit(0); +- wait(); ++ wait(0); ++ ; + + // can one grow address space to something big? +-#define BIG (100*1024*1024) ++#define BIG (100 * 1024 * 1024) + a = sbrk(0); + amt = (BIG) - (uint)a; + p = sbrk(amt); +- if (p != a) { ++ if (p != a) ++ { + printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); + exit(0); + } +- lastaddr = (char*) (BIG-1); ++ lastaddr = (char *)(BIG - 1); + *lastaddr = 99; + + // can one de-allocate? + a = sbrk(0); + c = sbrk(-4096); +- if(c == (char*)0xffffffff){ ++ if (c == (char *)0xffffffff) ++ { + printf(stdout, "sbrk could not deallocate\n"); + exit(0); + } + c = sbrk(0); +- if(c != a - 4096){ ++ if (c != a - 4096) ++ { + printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); + exit(0); + } +@@ -1476,11 +1707,13 @@ sbrktest(void) + // can one re-allocate that page? + a = sbrk(0); + c = sbrk(4096); +- if(c != a || sbrk(0) != a + 4096){ ++ if (c != a || sbrk(0) != a + 4096) ++ { + printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); + exit(0); + } +- if(*lastaddr == 99){ ++ if (*lastaddr == 99) ++ { + // should be zero + printf(stdout, "sbrk de-allocation didn't really deallocate\n"); + exit(0); +@@ -1488,99 +1721,113 @@ sbrktest(void) + + a = sbrk(0); + c = sbrk(-(sbrk(0) - oldbrk)); +- if(c != a){ ++ if (c != a) ++ { + printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); + exit(0); + } + + // can we read the kernel's memory? +- for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){ ++ for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) ++ { + ppid = getpid(); + pid = fork(); +- if(pid < 0){ ++ if (pid < 0) ++ { + printf(stdout, "fork failed\n"); + exit(0); + } +- if(pid == 0){ ++ if (pid == 0) ++ { + printf(stdout, "oops could read %x = %x\n", a, *a); + kill(ppid); + exit(0); + } +- wait(); ++ wait(0); ++ ; + } + + // if we run the system out of memory, does it clean up the last + // failed allocation? +- if(pipe(fds) != 0){ ++ if (pipe(fds) != 0) ++ { + printf(1, "pipe() failed\n"); + exit(0); + } +- for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ +- if((pids[i] = fork()) == 0){ ++ for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) ++ { ++ if ((pids[i] = fork()) == 0) ++ { + // allocate a lot of memory + sbrk(BIG - (uint)sbrk(0)); + write(fds[1], "x", 1); + // sit around until killed +- for(;;) sleep(1000); ++ for (;;) ++ sleep(1000); + } +- if(pids[i] != -1) ++ if (pids[i] != -1) + read(fds[0], &scratch, 1); + } + // if those failed allocations freed up the pages they did allocate, + // we'll be able to allocate here + c = sbrk(4096); +- for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ +- if(pids[i] == -1) ++ for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) ++ { ++ if (pids[i] == -1) + continue; + kill(pids[i]); +- wait(); ++ wait(0); ++ ; + } +- if(c == (char*)0xffffffff){ ++ if (c == (char *)0xffffffff) ++ { + printf(stdout, "failed sbrk leaked memory\n"); + exit(0); + } + +- if(sbrk(0) > oldbrk) ++ if (sbrk(0) > oldbrk) + sbrk(-(sbrk(0) - oldbrk)); + + printf(stdout, "sbrk test OK\n"); + } + +-void +-validateint(int *p) ++void validateint(int *p) + { + int res; + asm("mov %%esp, %%ebx\n\t" + "mov %3, %%esp\n\t" + "int %2\n\t" +- "mov %%ebx, %%esp" : +- "=a" (res) : +- "a" (SYS_sleep), "n" (T_SYSCALL), "c" (p) : +- "ebx"); ++ "mov %%ebx, %%esp" ++ : "=a"(res) ++ : "a"(SYS_sleep), "n"(T_SYSCALL), "c"(p) ++ : "ebx"); + } + +-void +-validatetest(void) ++void validatetest(void) + { + int hi, pid; + uint p; + + printf(stdout, "validate test\n"); +- hi = 1100*1024; ++ hi = 1100 * 1024; + +- for(p = 0; p <= (uint)hi; p += 4096){ +- if((pid = fork()) == 0){ ++ for (p = 0; p <= (uint)hi; p += 4096) ++ { ++ if ((pid = fork()) == 0) ++ { + // try to crash the kernel by passing in a badly placed integer +- validateint((int*)p); ++ validateint((int *)p); + exit(0); + } + sleep(0); + sleep(0); + kill(pid); +- wait(); ++ wait(0); ++ ; + + // try to crash the kernel by passing in a bad string pointer +- if(link("nosuchfile", (char*)p) != -1){ ++ if (link("nosuchfile", (char *)p) != -1) ++ { + printf(stdout, "link should not succeed\n"); + exit(0); + } +@@ -1591,14 +1838,15 @@ validatetest(void) + + // does unintialized data start out zero? + char uninit[10000]; +-void +-bsstest(void) ++void bsstest(void) + { + int i; + + printf(stdout, "bss test\n"); +- for(i = 0; i < sizeof(uninit); i++){ +- if(uninit[i] != '\0'){ ++ for (i = 0; i < sizeof(uninit); i++) ++ { ++ if (uninit[i] != '\0') ++ { + printf(stdout, "bss test failed\n"); + exit(0); + } +@@ -1609,32 +1857,36 @@ bsstest(void) + // does exec return an error if the arguments + // are larger than a page? or does it write + // below the stack and wreck the instructions/data? +-void +-bigargtest(void) ++void bigargtest(void) + { + int pid, fd; + + unlink("bigarg-ok"); + pid = fork(); +- if(pid == 0){ ++ if (pid == 0) ++ { + static char *args[MAXARG]; + int i; +- for(i = 0; i < MAXARG-1; i++) ++ for (i = 0; i < MAXARG - 1; i++) + args[i] = "bigargs test: failed\n "; +- args[MAXARG-1] = 0; ++ args[MAXARG - 1] = 0; + printf(stdout, "bigarg test\n"); + exec("echo", args); + printf(stdout, "bigarg test ok\n"); + fd = open("bigarg-ok", O_CREATE); + close(fd); + exit(0); +- } else if(pid < 0){ ++ } ++ else if (pid < 0) ++ { + printf(stdout, "bigargtest: fork failed\n"); + exit(0); + } +- wait(); ++ wait(0); ++ ; + fd = open("bigarg-ok", 0); +- if(fd < 0){ ++ if (fd < 0) ++ { + printf(stdout, "bigarg test failed!\n"); + exit(0); + } +@@ -1644,15 +1896,15 @@ bigargtest(void) + + // what happens when the file system runs out of blocks? + // answer: balloc panics, so this test is not useful. +-void +-fsfull() ++void fsfull() + { + int nfiles; + int fsblocks = 0; + + printf(1, "fsfull test\n"); + +- for(nfiles = 0; ; nfiles++){ ++ for (nfiles = 0;; nfiles++) ++ { + char name[64]; + name[0] = 'f'; + name[1] = '0' + nfiles / 1000; +@@ -1661,26 +1913,29 @@ fsfull() + name[4] = '0' + (nfiles % 10); + name[5] = '\0'; + printf(1, "writing %s\n", name); +- int fd = open(name, O_CREATE|O_RDWR); +- if(fd < 0){ ++ int fd = open(name, O_CREATE | O_RDWR); ++ if (fd < 0) ++ { + printf(1, "open %s failed\n", name); + break; + } + int total = 0; +- while(1){ ++ while (1) ++ { + int cc = write(fd, buf, 512); +- if(cc < 512) ++ if (cc < 512) + break; + total += cc; + fsblocks++; + } + printf(1, "wrote %d bytes\n", total); + close(fd); +- if(total == 0) ++ if (total == 0) + break; + } + +- while(nfiles >= 0){ ++ while (nfiles >= 0) ++ { + char name[64]; + name[0] = 'f'; + name[1] = '0' + nfiles / 1000; +@@ -1695,11 +1950,10 @@ fsfull() + printf(1, "fsfull test finished\n"); + } + +-void +-uio() ++void uio() + { +- #define RTC_ADDR 0x70 +- #define RTC_DATA 0x71 ++#define RTC_ADDR 0x70 ++#define RTC_DATA 0x71 + + ushort port = 0; + uchar val = 0; +@@ -1707,20 +1961,26 @@ uio() + + printf(1, "uio test\n"); + pid = fork(); +- if(pid == 0){ ++ if (pid == 0) ++ { + port = RTC_ADDR; +- val = 0x09; /* year */ ++ val = 0x09; /* year */ + /* http://wiki.osdev.org/Inline_Assembly/Examples */ +- asm volatile("outb %0,%1"::"a"(val), "d" (port)); ++ asm volatile("outb %0,%1" ::"a"(val), "d"(port)); + port = RTC_DATA; +- asm volatile("inb %1,%0" : "=a" (val) : "d" (port)); ++ asm volatile("inb %1,%0" ++ : "=a"(val) ++ : "d"(port)); + printf(1, "uio: uio succeeded; test FAILED\n"); + exit(0); +- } else if(pid < 0){ +- printf (1, "fork failed\n"); ++ } ++ else if (pid < 0) ++ { ++ printf(1, "fork failed\n"); + exit(0); + } +- wait(); ++ wait(0); ++ ; + printf(1, "uio test done\n"); + } + +@@ -1728,7 +1988,8 @@ void argptest() + { + int fd; + fd = open("init", O_RDONLY); +- if (fd < 0) { ++ if (fd < 0) ++ { + printf(2, "open failed\n"); + exit(0); + } +@@ -1745,12 +2006,12 @@ rand() + return randstate; + } + +-int +-main(int argc, char *argv[]) ++int main(int argc, char *argv[]) + { + printf(1, "usertests starting\n"); + +- if(open("usertests.ran", 0) >= 0){ ++ if (open("usertests.ran", 0) >= 0) ++ { + printf(1, "already ran user tests -- rebuild fs.img\n"); + exit(0); + } +@@ -1783,6 +2044,7 @@ main(int argc, char *argv[]) + pipe1(); + preempt(); + exitwait(); ++ ; + + rmdot(); + fourteen(); +diff --git a/usertests.o b/usertests.o +index d243241..be0b0c9 100644 +Binary files a/usertests.o and b/usertests.o differ +diff --git a/usertests.sym b/usertests.sym +index b2ac84e..5ba9e9e 100644 +--- a/usertests.sym ++++ b/usertests.sym +@@ -1,8 +1,8 @@ + 00000000 .text +-00004348 .rodata +-00005af8 .eh_frame +-000063c0 .data +-000063e0 .bss ++00004418 .rodata ++00005bc8 .eh_frame ++00006490 .data ++000064c0 .bss + 00000000 .comment + 00000000 .debug_aranges + 00000000 .debug_info +@@ -12,92 +12,92 @@ + 00000000 .debug_loc + 00000000 .debug_ranges + 00000000 usertests.c +-000063e0 args.1718 ++000064c0 args.1718 + 00000000 ulib.c + 00000000 printf.c +-00003f40 printint +-00005ae7 digits.1354 ++00004010 printint ++00005bb7 digits.1354 + 00000000 umalloc.c +-00006460 freep +-00006464 base +-00003c70 strcpy +-00000ce0 exitwait +-00003fe0 printf +-000063c4 stdout +-00003820 bigargtest +-00003e60 memmove +-000002d0 openiputtest +-00003eda mknod +-00003d80 gets +-00003f12 getpid +-000009a0 pipe1 +-000030d0 iref +-00004260 malloc +-00003f22 sleep ++00006540 freep ++00006544 base ++00003d40 strcpy ++00000d10 exitwait ++000040b0 printf ++00006494 stdout ++000038d0 bigargtest ++00003f30 memmove ++000002e0 openiputtest ++00003faa mknod ++00003e50 gets ++00003fe2 getpid ++000009c0 pipe1 ++00003140 iref ++00004330 malloc ++00003ff2 sleep + 00000200 exitiputtest +-00003930 fsfull +-00001de0 bigdir +-00003200 forktest +-00000610 writetest1 +-000027c0 bigwrite +-00000e50 sharedfd +-000063c0 randstate +-00003ea2 pipe +-00006480 uninit +-00002e50 dirfile +-00003eb2 write +-000037a0 bsstest +-000063c8 echoargv +-00003eea fstat +-00003ec2 kill +-000036f0 validatetest +-00002c80 rmdot +-00003f02 chdir +-00000940 exectest +-00003eca exec +-00003e9a wait +-00003c50 rand +-00003eaa read +-00000b80 preempt +-00003ee2 unlink +-00003bc0 argptest +-00000d70 mem +-00003e8a fork +-00003f1a sbrk +-00003f2a uptime +-000063dc __bss_start +-00003d20 memset +-000007d0 createtest ++000039f0 fsfull ++00001e50 bigdir ++00003270 forktest ++00000630 writetest1 ++00002830 bigwrite ++00000e80 sharedfd ++00006490 randstate ++00003f72 pipe ++00006560 uninit ++00002ec0 dirfile ++00003f82 write ++00003850 bsstest ++00006498 echoargv ++00003fba fstat ++00003f92 kill ++00003790 validatetest ++00002cf0 rmdot ++00003fd2 chdir ++00000960 exectest ++00003f9a exec ++00003f6a wait ++00003d20 rand ++00003f7a read ++00000ba0 preempt ++00003fb2 unlink ++00003c90 argptest ++00000da0 mem ++00003f5a fork ++00003fea sbrk ++00003ffa uptime ++000064ac __bss_start ++00003df0 memset ++000007f0 createtest + 00000000 main +-00001280 createdelete +-00003ca0 strcmp +-00000440 writetest +-00003f0a dup +-000032e0 sbrktest +-000003a0 opentest +-00001f40 subdir +-00003b30 uio +-000016e0 linktest +-00008ba0 buf +-00000880 dirtest ++000012d0 createdelete ++00003d70 strcmp ++00000460 writetest ++00003fda dup ++00003360 sbrktest ++000003c0 opentest ++00001fb0 subdir ++00003bf0 uio ++00001740 linktest ++00008c80 buf ++000008a0 dirtest + 00000140 iputtest +-00003de0 stat +-000028d0 bigfile +-000063dc _edata +-0000aba4 _end +-000014e0 unlinkread +-00003ef2 link +-00003e92 exit +-00003e30 atoi +-00001cc0 linkunlink +-0000aba0 name +-00003cf0 strlen +-00003ed2 open +-00003d40 strchr +-00001980 concreate +-00002b00 fourteen +-000036e0 validateint +-00001040 fourfiles +-00003efa mkdir +-00003eba close +-000041d0 free ++00003eb0 stat ++00002940 bigfile ++000064ac _edata ++0000ac84 _end ++00001540 unlinkread ++00003fc2 link ++00003f62 exit ++00003f00 atoi ++00001d30 linkunlink ++0000ac80 name ++00003dc0 strlen ++00003fa2 open ++00003e10 strchr ++000019e0 concreate ++00002b70 fourteen ++00003780 validateint ++00001070 fourfiles ++00003fca mkdir ++00003f8a close ++000042a0 free +diff --git a/vm.o b/vm.o +index 4286cd7..be3ea13 100644 +Binary files a/vm.o and b/vm.o differ +diff --git a/wc.asm b/wc.asm +index 21713ba..aeeec8a 100644 +--- a/wc.asm ++++ b/wc.asm +@@ -574,132 +574,106 @@ memmove(void *vdst, const void *vsrc, int n) + 3b9: c3 ret + + 000003ba : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 3ba: b8 01 00 00 00 mov $0x1,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + + 000003c2 : +-SYSCALL(exit) + 3c2: b8 02 00 00 00 mov $0x2,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + + 000003ca : +-SYSCALL(wait) + 3ca: b8 03 00 00 00 mov $0x3,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + + 000003d2 : +-SYSCALL(pipe) + 3d2: b8 04 00 00 00 mov $0x4,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + + 000003da : +-SYSCALL(read) + 3da: b8 05 00 00 00 mov $0x5,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + + 000003e2 : +-SYSCALL(write) + 3e2: b8 10 00 00 00 mov $0x10,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + + 000003ea : +-SYSCALL(close) + 3ea: b8 15 00 00 00 mov $0x15,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + + 000003f2 : +-SYSCALL(kill) + 3f2: b8 06 00 00 00 mov $0x6,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + + 000003fa : +-SYSCALL(exec) + 3fa: b8 07 00 00 00 mov $0x7,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret + + 00000402 : +-SYSCALL(open) + 402: b8 0f 00 00 00 mov $0xf,%eax + 407: cd 40 int $0x40 + 409: c3 ret + + 0000040a : +-SYSCALL(mknod) + 40a: b8 11 00 00 00 mov $0x11,%eax + 40f: cd 40 int $0x40 + 411: c3 ret + + 00000412 : +-SYSCALL(unlink) + 412: b8 12 00 00 00 mov $0x12,%eax + 417: cd 40 int $0x40 + 419: c3 ret + + 0000041a : +-SYSCALL(fstat) + 41a: b8 08 00 00 00 mov $0x8,%eax + 41f: cd 40 int $0x40 + 421: c3 ret + + 00000422 : +-SYSCALL(link) + 422: b8 13 00 00 00 mov $0x13,%eax + 427: cd 40 int $0x40 + 429: c3 ret + + 0000042a : +-SYSCALL(mkdir) + 42a: b8 14 00 00 00 mov $0x14,%eax + 42f: cd 40 int $0x40 + 431: c3 ret + + 00000432 : +-SYSCALL(chdir) + 432: b8 09 00 00 00 mov $0x9,%eax + 437: cd 40 int $0x40 + 439: c3 ret + + 0000043a : +-SYSCALL(dup) + 43a: b8 0a 00 00 00 mov $0xa,%eax + 43f: cd 40 int $0x40 + 441: c3 ret + + 00000442 : +-SYSCALL(getpid) + 442: b8 0b 00 00 00 mov $0xb,%eax + 447: cd 40 int $0x40 + 449: c3 ret + + 0000044a : +-SYSCALL(sbrk) + 44a: b8 0c 00 00 00 mov $0xc,%eax + 44f: cd 40 int $0x40 + 451: c3 ret + + 00000452 : +-SYSCALL(sleep) + 452: b8 0d 00 00 00 mov $0xd,%eax + 457: cd 40 int $0x40 + 459: c3 ret + + 0000045a : +-SYSCALL(uptime) + 45a: b8 0e 00 00 00 mov $0xe,%eax + 45f: cd 40 int $0x40 + 461: c3 ret +diff --git a/wc.o b/wc.o +index 0a37ea2..5429937 100644 +Binary files a/wc.o and b/wc.o differ +diff --git a/xv6.img b/xv6.img +index dab6b43..e321d5d 100644 +Binary files a/xv6.img and b/xv6.img differ +diff --git a/zombie.asm b/zombie.asm +index ba5af38..dc1a36f 100644 +--- a/zombie.asm ++++ b/zombie.asm +@@ -412,132 +412,106 @@ memmove(void *vdst, const void *vsrc, int n) + 249: c3 ret + + 0000024a : +- name: \ +- movl $SYS_ ## name, %eax; \ +- int $T_SYSCALL; \ +- ret +- +-SYSCALL(fork) + 24a: b8 01 00 00 00 mov $0x1,%eax + 24f: cd 40 int $0x40 + 251: c3 ret + + 00000252 : +-SYSCALL(exit) + 252: b8 02 00 00 00 mov $0x2,%eax + 257: cd 40 int $0x40 + 259: c3 ret + + 0000025a : +-SYSCALL(wait) + 25a: b8 03 00 00 00 mov $0x3,%eax + 25f: cd 40 int $0x40 + 261: c3 ret + + 00000262 : +-SYSCALL(pipe) + 262: b8 04 00 00 00 mov $0x4,%eax + 267: cd 40 int $0x40 + 269: c3 ret + + 0000026a : +-SYSCALL(read) + 26a: b8 05 00 00 00 mov $0x5,%eax + 26f: cd 40 int $0x40 + 271: c3 ret + + 00000272 : +-SYSCALL(write) + 272: b8 10 00 00 00 mov $0x10,%eax + 277: cd 40 int $0x40 + 279: c3 ret + + 0000027a : +-SYSCALL(close) + 27a: b8 15 00 00 00 mov $0x15,%eax + 27f: cd 40 int $0x40 + 281: c3 ret + + 00000282 : +-SYSCALL(kill) + 282: b8 06 00 00 00 mov $0x6,%eax + 287: cd 40 int $0x40 + 289: c3 ret + + 0000028a : +-SYSCALL(exec) + 28a: b8 07 00 00 00 mov $0x7,%eax + 28f: cd 40 int $0x40 + 291: c3 ret + + 00000292 : +-SYSCALL(open) + 292: b8 0f 00 00 00 mov $0xf,%eax + 297: cd 40 int $0x40 + 299: c3 ret + + 0000029a : +-SYSCALL(mknod) + 29a: b8 11 00 00 00 mov $0x11,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + + 000002a2 : +-SYSCALL(unlink) + 2a2: b8 12 00 00 00 mov $0x12,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + + 000002aa : +-SYSCALL(fstat) + 2aa: b8 08 00 00 00 mov $0x8,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + + 000002b2 : +-SYSCALL(link) + 2b2: b8 13 00 00 00 mov $0x13,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + + 000002ba : +-SYSCALL(mkdir) + 2ba: b8 14 00 00 00 mov $0x14,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + + 000002c2 : +-SYSCALL(chdir) + 2c2: b8 09 00 00 00 mov $0x9,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + + 000002ca : +-SYSCALL(dup) + 2ca: b8 0a 00 00 00 mov $0xa,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + + 000002d2 : +-SYSCALL(getpid) + 2d2: b8 0b 00 00 00 mov $0xb,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + + 000002da : +-SYSCALL(sbrk) + 2da: b8 0c 00 00 00 mov $0xc,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + + 000002e2 : +-SYSCALL(sleep) + 2e2: b8 0d 00 00 00 mov $0xd,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + + 000002ea : +-SYSCALL(uptime) + 2ea: b8 0e 00 00 00 mov $0xe,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret +diff --git a/zombie.o b/zombie.o +index 3e6ce70..754ee1a 100644 +Binary files a/zombie.o and b/zombie.o differ diff --git a/picirq.d b/picirq.d new file mode 100644 index 0000000000..5233e7ed73 --- /dev/null +++ b/picirq.d @@ -0,0 +1 @@ +picirq.o: picirq.c /usr/include/stdc-predef.h types.h x86.h traps.h diff --git a/picirq.o b/picirq.o new file mode 100644 index 0000000000..e4ba78a161 Binary files /dev/null and b/picirq.o differ diff --git a/pipe.d b/pipe.d new file mode 100644 index 0000000000..3d0eac9ac3 --- /dev/null +++ b/pipe.d @@ -0,0 +1,2 @@ +pipe.o: pipe.c /usr/include/stdc-predef.h types.h defs.h param.h mmu.h \ + proc.h fs.h spinlock.h sleeplock.h file.h diff --git a/pipe.o b/pipe.o new file mode 100644 index 0000000000..9ae157c959 Binary files /dev/null and b/pipe.o differ diff --git a/printf.d b/printf.d new file mode 100644 index 0000000000..ddd3a8d9da --- /dev/null +++ b/printf.d @@ -0,0 +1 @@ +printf.o: printf.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/printf.o b/printf.o new file mode 100644 index 0000000000..e429caa750 Binary files /dev/null and b/printf.o differ diff --git a/proc.c b/proc.c index 806b1b184b..7933a38792 100644 --- a/proc.c +++ b/proc.c @@ -7,7 +7,8 @@ #include "proc.h" #include "spinlock.h" -struct { +struct +{ struct spinlock lock; struct proc proc[NPROC]; } ptable; @@ -20,32 +21,32 @@ extern void trapret(void); static void wakeup1(void *chan); -void -pinit(void) +void pinit(void) { initlock(&ptable.lock, "ptable"); } // Must be called with interrupts disabled -int -cpuid() { - return mycpu()-cpus; +int cpuid() +{ + return mycpu() - cpus; } // Must be called with interrupts disabled to avoid the caller being // rescheduled between reading lapicid and running through the loop. -struct cpu* +struct cpu * mycpu(void) { int apicid, i; - - if(readeflags()&FL_IF) + + if (readeflags() & FL_IF) panic("mycpu called with interrupts enabled\n"); - + apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. - for (i = 0; i < ncpu; ++i) { + for (i = 0; i < ncpu; ++i) + { if (cpus[i].apicid == apicid) return &cpus[i]; } @@ -54,8 +55,9 @@ mycpu(void) // Disable interrupts so that we are not rescheduled // while reading proc from the cpu structure -struct proc* -myproc(void) { +struct proc * +myproc(void) +{ struct cpu *c; struct proc *p; pushcli(); @@ -65,12 +67,12 @@ myproc(void) { return p; } -//PAGEBREAK: 32 -// Look in the process table for an UNUSED proc. -// If found, change state to EMBRYO and initialize -// state required to run in the kernel. -// Otherwise return 0. -static struct proc* +// PAGEBREAK: 32 +// Look in the process table for an UNUSED proc. +// If found, change state to EMBRYO and initialize +// state required to run in the kernel. +// Otherwise return 0. +static struct proc * allocproc(void) { struct proc *p; @@ -78,8 +80,8 @@ allocproc(void) acquire(&ptable.lock); - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) - if(p->state == UNUSED) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + if (p->state == UNUSED) goto found; release(&ptable.lock); @@ -92,7 +94,8 @@ allocproc(void) release(&ptable.lock); // Allocate kernel stack. - if((p->kstack = kalloc()) == 0){ + if ((p->kstack = kalloc()) == 0) + { p->state = UNUSED; return 0; } @@ -100,33 +103,32 @@ allocproc(void) // Leave room for trap frame. sp -= sizeof *p->tf; - p->tf = (struct trapframe*)sp; + p->tf = (struct trapframe *)sp; // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; - *(uint*)sp = (uint)trapret; + *(uint *)sp = (uint)trapret; sp -= sizeof *p->context; - p->context = (struct context*)sp; + p->context = (struct context *)sp; memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; return p; } -//PAGEBREAK: 32 -// Set up first user process. -void -userinit(void) +// PAGEBREAK: 32 +// Set up first user process. +void userinit(void) { struct proc *p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); - + initproc = p; - if((p->pgdir = setupkvm()) == 0) + if ((p->pgdir = setupkvm()) == 0) panic("userinit: out of memory?"); inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); p->sz = PGSIZE; @@ -137,7 +139,7 @@ userinit(void) p->tf->ss = p->tf->ds; p->tf->eflags = FL_IF; p->tf->esp = PGSIZE; - p->tf->eip = 0; // beginning of initcode.S + p->tf->eip = 0; // beginning of initcode.S safestrcpy(p->name, "initcode", sizeof(p->name)); p->cwd = namei("/"); @@ -155,18 +157,20 @@ userinit(void) // Grow current process's memory by n bytes. // Return 0 on success, -1 on failure. -int -growproc(int n) +int growproc(int n) { uint sz; struct proc *curproc = myproc(); sz = curproc->sz; - if(n > 0){ - if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) + if (n > 0) + { + if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; - } else if(n < 0){ - if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) + } + else if (n < 0) + { + if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } curproc->sz = sz; @@ -177,20 +181,21 @@ growproc(int n) // 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) +int fork(void) { int i, pid; struct proc *np; struct proc *curproc = myproc(); // Allocate process. - if((np = allocproc()) == 0){ + if ((np = allocproc()) == 0) + { return -1; } // Copy process state from proc. - if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ + if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) + { kfree(np->kstack); np->kstack = 0; np->state = UNUSED; @@ -203,8 +208,8 @@ fork(void) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; - for(i = 0; i < NOFILE; i++) - if(curproc->ofile[i]) + for (i = 0; i < NOFILE; i++) + if (curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]); np->cwd = idup(curproc->cwd); @@ -223,20 +228,21 @@ fork(void) // 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) +// until its parent calls wait(0) to find out it exited. +void exit(int status) { struct proc *curproc = myproc(); struct proc *p; int fd; - if(curproc == initproc) + if (curproc == initproc) panic("init exiting"); // Close all open files. - for(fd = 0; fd < NOFILE; fd++){ - if(curproc->ofile[fd]){ + for (fd = 0; fd < NOFILE; fd++) + { + if (curproc->ofile[fd]) + { fileclose(curproc->ofile[fd]); curproc->ofile[fd] = 0; } @@ -249,14 +255,16 @@ exit(void) acquire(&ptable.lock); - // Parent might be sleeping in wait(). + // Parent might be sleeping in wait(0);. wakeup1(curproc->parent); // Pass abandoned children to init. - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ - if(p->parent == curproc){ + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + { + if (p->parent == curproc) + { p->parent = initproc; - if(p->state == ZOMBIE) + if (p->state == ZOMBIE) wakeup1(initproc); } } @@ -269,22 +277,24 @@ exit(void) // Wait for a child process to exit and return its pid. // Return -1 if this process has no children. -int -wait(void) +int wait(int *status) { struct proc *p; int havekids, pid; struct proc *curproc = myproc(); - + acquire(&ptable.lock); - for(;;){ + for (;;) + { // Scan through table looking for exited children. havekids = 0; - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ - if(p->parent != curproc) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + { + if (p->parent != curproc) continue; havekids = 1; - if(p->state == ZOMBIE){ + if (p->state == ZOMBIE) + { // Found one. pid = p->pid; kfree(p->kstack); @@ -301,39 +311,41 @@ wait(void) } // No point waiting if we don't have any children. - if(!havekids || curproc->killed){ + if (!havekids || curproc->killed) + { release(&ptable.lock); return -1; } // Wait for children to exit. (See wakeup1 call in proc_exit.) - sleep(curproc, &ptable.lock); //DOC: wait-sleep + sleep(curproc, &ptable.lock); // DOC: wait-sleep } } -//PAGEBREAK: 42 -// Per-CPU process scheduler. -// Each CPU calls scheduler() after setting itself up. -// Scheduler never returns. It loops, doing: -// - choose a process to run -// - swtch to start running that process -// - eventually that process transfers control -// via swtch back to the scheduler. -void -scheduler(void) +// PAGEBREAK: 42 +// Per-CPU process scheduler. +// Each CPU calls scheduler() after setting itself up. +// Scheduler never returns. It loops, doing: +// - choose a process to run +// - swtch to start running that process +// - eventually that process transfers control +// via swtch back to the scheduler. +void scheduler(void) { struct proc *p; struct cpu *c = mycpu(); c->proc = 0; - - for(;;){ + + for (;;) + { // 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++){ - if(p->state != RUNNABLE) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + { + if (p->state != RUNNABLE) continue; // Switch to chosen process. It is the process's job @@ -351,7 +363,6 @@ scheduler(void) c->proc = 0; } release(&ptable.lock); - } } @@ -362,19 +373,18 @@ scheduler(void) // be proc->intena and proc->ncli, but that would // break in the few places where a lock is held but // there's no process. -void -sched(void) +void sched(void) { int intena; struct proc *p = myproc(); - if(!holding(&ptable.lock)) + if (!holding(&ptable.lock)) panic("sched ptable.lock"); - if(mycpu()->ncli != 1) + if (mycpu()->ncli != 1) panic("sched locks"); - if(p->state == RUNNING) + if (p->state == RUNNING) panic("sched running"); - if(readeflags()&FL_IF) + if (readeflags() & FL_IF) panic("sched interruptible"); intena = mycpu()->intena; swtch(&p->context, mycpu()->scheduler); @@ -382,10 +392,9 @@ sched(void) } // Give up the CPU for one scheduling round. -void -yield(void) +void yield(void) { - acquire(&ptable.lock); //DOC: yieldlock + acquire(&ptable.lock); // DOC: yieldlock myproc()->state = RUNNABLE; sched(); release(&ptable.lock); @@ -393,14 +402,14 @@ yield(void) // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. -void -forkret(void) +void forkret(void) { static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); - if (first) { + if (first) + { // 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(). @@ -414,15 +423,14 @@ forkret(void) // Atomically release lock and sleep on chan. // Reacquires lock when awakened. -void -sleep(void *chan, struct spinlock *lk) +void sleep(void *chan, struct spinlock *lk) { struct proc *p = myproc(); - - if(p == 0) + + if (p == 0) panic("sleep"); - if(lk == 0) + if (lk == 0) panic("sleep without lk"); // Must acquire ptable.lock in order to @@ -431,8 +439,9 @@ sleep(void *chan, struct spinlock *lk) // 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 - acquire(&ptable.lock); //DOC: sleeplock1 + if (lk != &ptable.lock) + { // DOC: sleeplock0 + acquire(&ptable.lock); // DOC: sleeplock1 release(lk); } // Go to sleep. @@ -445,28 +454,28 @@ sleep(void *chan, struct spinlock *lk) p->chan = 0; // Reacquire original lock. - if(lk != &ptable.lock){ //DOC: sleeplock2 + if (lk != &ptable.lock) + { // DOC: sleeplock2 release(&ptable.lock); acquire(lk); } } -//PAGEBREAK! -// Wake up all processes sleeping on chan. -// The ptable lock must be held. +// PAGEBREAK! +// Wake up all processes sleeping on chan. +// The ptable lock must be held. static void wakeup1(void *chan) { struct proc *p; - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) - if(p->state == SLEEPING && p->chan == chan) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + if (p->state == SLEEPING && p->chan == chan) p->state = RUNNABLE; } // Wake up all processes sleeping on chan. -void -wakeup(void *chan) +void wakeup(void *chan) { acquire(&ptable.lock); wakeup1(chan); @@ -476,17 +485,18 @@ wakeup(void *chan) // 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) +int kill(int pid) { struct proc *p; acquire(&ptable.lock); - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ - if(p->pid == pid){ + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + { + if (p->pid == pid) + { p->killed = 1; // Wake process from sleep if necessary. - if(p->state == SLEEPING) + if (p->state == SLEEPING) p->state = RUNNABLE; release(&ptable.lock); return 0; @@ -496,37 +506,37 @@ kill(int pid) return -1; } -//PAGEBREAK: 36 -// 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) +// PAGEBREAK: 36 +// 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) { static char *states[] = { - [UNUSED] "unused", - [EMBRYO] "embryo", - [SLEEPING] "sleep ", - [RUNNABLE] "runble", - [RUNNING] "run ", - [ZOMBIE] "zombie" - }; + [UNUSED] "unused", + [EMBRYO] "embryo", + [SLEEPING] "sleep ", + [RUNNABLE] "runble", + [RUNNING] "run ", + [ZOMBIE] "zombie"}; int i; struct proc *p; char *state; uint pc[10]; - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ - if(p->state == UNUSED) + for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) + { + if (p->state == UNUSED) continue; - if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) + if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) state = states[p->state]; 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++) + if (p->state == SLEEPING) + { + getcallerpcs((uint *)p->context->ebp + 2, pc); + for (i = 0; i < 10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); diff --git a/proc.d b/proc.d new file mode 100644 index 0000000000..9396fefc50 --- /dev/null +++ b/proc.d @@ -0,0 +1,2 @@ +proc.o: proc.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h x86.h proc.h spinlock.h diff --git a/proc.h b/proc.h index 1647114179..6947d4a474 100644 --- a/proc.h +++ b/proc.h @@ -49,6 +49,7 @@ struct proc { struct file *ofile[NOFILE]; // Open files struct inode *cwd; // Current directory char name[16]; // Process name (debugging) + int status; // exit status }; // Process memory is laid out contiguously, low addresses first: diff --git a/proc.o b/proc.o new file mode 100644 index 0000000000..7c27fc39ef Binary files /dev/null and b/proc.o differ diff --git a/rm.asm b/rm.asm new file mode 100644 index 0000000000..ec5bd3d408 --- /dev/null +++ b/rm.asm @@ -0,0 +1,1138 @@ + +_rm: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "stat.h" +#include "user.h" + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + int i; + + if(argc < 2){ + 5: be 01 00 00 00 mov $0x1,%esi +{ + a: 53 push %ebx + b: 83 e4 f0 and $0xfffffff0,%esp + e: 83 ec 10 sub $0x10,%esp + 11: 8b 7d 08 mov 0x8(%ebp),%edi + 14: 8b 45 0c mov 0xc(%ebp),%eax + if(argc < 2){ + 17: 83 ff 01 cmp $0x1,%edi + 1a: 8d 58 04 lea 0x4(%eax),%ebx + 1d: 7e 41 jle 60 + 1f: 90 nop + printf(2, "Usage: rm files...\n"); + exit(0); + } + + for(i = 1; i < argc; i++){ + if(unlink(argv[i]) < 0){ + 20: 8b 03 mov (%ebx),%eax + 22: 89 04 24 mov %eax,(%esp) + 25: e8 c8 02 00 00 call 2f2 + 2a: 85 c0 test %eax,%eax + 2c: 78 16 js 44 + for(i = 1; i < argc; i++){ + 2e: 83 c6 01 add $0x1,%esi + 31: 83 c3 04 add $0x4,%ebx + 34: 39 fe cmp %edi,%esi + 36: 75 e8 jne 20 + printf(2, "rm: %s failed to delete\n", argv[i]); + break; + } + } + + exit(0); + 38: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3f: e8 5e 02 00 00 call 2a2 + printf(2, "rm: %s failed to delete\n", argv[i]); + 44: 8b 03 mov (%ebx),%eax + 46: c7 44 24 04 6a 07 00 movl $0x76a,0x4(%esp) + 4d: 00 + 4e: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 55: 89 44 24 08 mov %eax,0x8(%esp) + 59: e8 92 03 00 00 call 3f0 + break; + 5e: eb d8 jmp 38 + printf(2, "Usage: rm files...\n"); + 60: c7 44 24 04 56 07 00 movl $0x756,0x4(%esp) + 67: 00 + 68: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 6f: e8 7c 03 00 00 call 3f0 + exit(0); + 74: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 7b: e8 22 02 00 00 call 2a2 + +00000080 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 80: 55 push %ebp + 81: 89 e5 mov %esp,%ebp + 83: 8b 45 08 mov 0x8(%ebp),%eax + 86: 8b 4d 0c mov 0xc(%ebp),%ecx + 89: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 8a: 89 c2 mov %eax,%edx + 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 90: 83 c1 01 add $0x1,%ecx + 93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 97: 83 c2 01 add $0x1,%edx + 9a: 84 db test %bl,%bl + 9c: 88 5a ff mov %bl,-0x1(%edx) + 9f: 75 ef jne 90 + ; + return os; +} + a1: 5b pop %ebx + a2: 5d pop %ebp + a3: c3 ret + a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000000b0 : + +int +strcmp(const char *p, const char *q) +{ + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 8b 55 08 mov 0x8(%ebp),%edx + b6: 53 push %ebx + b7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + ba: 0f b6 02 movzbl (%edx),%eax + bd: 84 c0 test %al,%al + bf: 74 2d je ee + c1: 0f b6 19 movzbl (%ecx),%ebx + c4: 38 d8 cmp %bl,%al + c6: 74 0e je d6 + c8: eb 2b jmp f5 + ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + d0: 38 c8 cmp %cl,%al + d2: 75 15 jne e9 + p++, q++; + d4: 89 d9 mov %ebx,%ecx + d6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + d9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + dc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + df: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + e3: 84 c0 test %al,%al + e5: 75 e9 jne d0 + e7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + e9: 29 c8 sub %ecx,%eax +} + eb: 5b pop %ebx + ec: 5d pop %ebp + ed: c3 ret + ee: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + f1: 31 c0 xor %eax,%eax + f3: eb f4 jmp e9 + f5: 0f b6 cb movzbl %bl,%ecx + f8: eb ef jmp e9 + fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000100 : + +uint +strlen(const char *s) +{ + 100: 55 push %ebp + 101: 89 e5 mov %esp,%ebp + 103: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 106: 80 39 00 cmpb $0x0,(%ecx) + 109: 74 12 je 11d + 10b: 31 d2 xor %edx,%edx + 10d: 8d 76 00 lea 0x0(%esi),%esi + 110: 83 c2 01 add $0x1,%edx + 113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 117: 89 d0 mov %edx,%eax + 119: 75 f5 jne 110 + ; + return n; +} + 11b: 5d pop %ebp + 11c: c3 ret + for(n = 0; s[n]; n++) + 11d: 31 c0 xor %eax,%eax +} + 11f: 5d pop %ebp + 120: c3 ret + 121: eb 0d jmp 130 + 123: 90 nop + 124: 90 nop + 125: 90 nop + 126: 90 nop + 127: 90 nop + 128: 90 nop + 129: 90 nop + 12a: 90 nop + 12b: 90 nop + 12c: 90 nop + 12d: 90 nop + 12e: 90 nop + 12f: 90 nop + +00000130 : + +void* +memset(void *dst, int c, uint n) +{ + 130: 55 push %ebp + 131: 89 e5 mov %esp,%ebp + 133: 8b 55 08 mov 0x8(%ebp),%edx + 136: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 137: 8b 4d 10 mov 0x10(%ebp),%ecx + 13a: 8b 45 0c mov 0xc(%ebp),%eax + 13d: 89 d7 mov %edx,%edi + 13f: fc cld + 140: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 142: 89 d0 mov %edx,%eax + 144: 5f pop %edi + 145: 5d pop %ebp + 146: c3 ret + 147: 89 f6 mov %esi,%esi + 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000150 : + +char* +strchr(const char *s, char c) +{ + 150: 55 push %ebp + 151: 89 e5 mov %esp,%ebp + 153: 8b 45 08 mov 0x8(%ebp),%eax + 156: 53 push %ebx + 157: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 15a: 0f b6 18 movzbl (%eax),%ebx + 15d: 84 db test %bl,%bl + 15f: 74 1d je 17e + if(*s == c) + 161: 38 d3 cmp %dl,%bl + 163: 89 d1 mov %edx,%ecx + 165: 75 0d jne 174 + 167: eb 17 jmp 180 + 169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 170: 38 ca cmp %cl,%dl + 172: 74 0c je 180 + for(; *s; s++) + 174: 83 c0 01 add $0x1,%eax + 177: 0f b6 10 movzbl (%eax),%edx + 17a: 84 d2 test %dl,%dl + 17c: 75 f2 jne 170 + return (char*)s; + return 0; + 17e: 31 c0 xor %eax,%eax +} + 180: 5b pop %ebx + 181: 5d pop %ebp + 182: c3 ret + 183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000190 : + +char* +gets(char *buf, int max) +{ + 190: 55 push %ebp + 191: 89 e5 mov %esp,%ebp + 193: 57 push %edi + 194: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 195: 31 f6 xor %esi,%esi +{ + 197: 53 push %ebx + 198: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 19b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 19e: eb 31 jmp 1d1 + cc = read(0, &c, 1); + 1a0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 1a7: 00 + 1a8: 89 7c 24 04 mov %edi,0x4(%esp) + 1ac: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1b3: e8 02 01 00 00 call 2ba + if(cc < 1) + 1b8: 85 c0 test %eax,%eax + 1ba: 7e 1d jle 1d9 + break; + buf[i++] = c; + 1bc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 1c0: 89 de mov %ebx,%esi + buf[i++] = c; + 1c2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 1c5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 1c7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 1cb: 74 0c je 1d9 + 1cd: 3c 0a cmp $0xa,%al + 1cf: 74 08 je 1d9 + for(i=0; i+1 < max; ){ + 1d1: 8d 5e 01 lea 0x1(%esi),%ebx + 1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1d7: 7c c7 jl 1a0 + break; + } + buf[i] = '\0'; + 1d9: 8b 45 08 mov 0x8(%ebp),%eax + 1dc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 1e0: 83 c4 2c add $0x2c,%esp + 1e3: 5b pop %ebx + 1e4: 5e pop %esi + 1e5: 5f pop %edi + 1e6: 5d pop %ebp + 1e7: c3 ret + 1e8: 90 nop + 1e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001f0 : + +int +stat(const char *n, struct stat *st) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 56 push %esi + 1f4: 53 push %ebx + 1f5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1f8: 8b 45 08 mov 0x8(%ebp),%eax + 1fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 202: 00 + 203: 89 04 24 mov %eax,(%esp) + 206: e8 d7 00 00 00 call 2e2 + if(fd < 0) + 20b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 20d: 89 c3 mov %eax,%ebx + if(fd < 0) + 20f: 78 27 js 238 + return -1; + r = fstat(fd, st); + 211: 8b 45 0c mov 0xc(%ebp),%eax + 214: 89 1c 24 mov %ebx,(%esp) + 217: 89 44 24 04 mov %eax,0x4(%esp) + 21b: e8 da 00 00 00 call 2fa + close(fd); + 220: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 223: 89 c6 mov %eax,%esi + close(fd); + 225: e8 a0 00 00 00 call 2ca + return r; + 22a: 89 f0 mov %esi,%eax +} + 22c: 83 c4 10 add $0x10,%esp + 22f: 5b pop %ebx + 230: 5e pop %esi + 231: 5d pop %ebp + 232: c3 ret + 233: 90 nop + 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 238: b8 ff ff ff ff mov $0xffffffff,%eax + 23d: eb ed jmp 22c + 23f: 90 nop + +00000240 : + +int +atoi(const char *s) +{ + 240: 55 push %ebp + 241: 89 e5 mov %esp,%ebp + 243: 8b 4d 08 mov 0x8(%ebp),%ecx + 246: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 247: 0f be 11 movsbl (%ecx),%edx + 24a: 8d 42 d0 lea -0x30(%edx),%eax + 24d: 3c 09 cmp $0x9,%al + n = 0; + 24f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 254: 77 17 ja 26d + 256: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 258: 83 c1 01 add $0x1,%ecx + 25b: 8d 04 80 lea (%eax,%eax,4),%eax + 25e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 262: 0f be 11 movsbl (%ecx),%edx + 265: 8d 5a d0 lea -0x30(%edx),%ebx + 268: 80 fb 09 cmp $0x9,%bl + 26b: 76 eb jbe 258 + return n; +} + 26d: 5b pop %ebx + 26e: 5d pop %ebp + 26f: c3 ret + +00000270 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 270: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 271: 31 d2 xor %edx,%edx +{ + 273: 89 e5 mov %esp,%ebp + 275: 56 push %esi + 276: 8b 45 08 mov 0x8(%ebp),%eax + 279: 53 push %ebx + 27a: 8b 5d 10 mov 0x10(%ebp),%ebx + 27d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 280: 85 db test %ebx,%ebx + 282: 7e 12 jle 296 + 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 28c: 88 0c 10 mov %cl,(%eax,%edx,1) + 28f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 292: 39 da cmp %ebx,%edx + 294: 75 f2 jne 288 + return vdst; +} + 296: 5b pop %ebx + 297: 5e pop %esi + 298: 5d pop %ebp + 299: c3 ret + +0000029a : + 29a: b8 01 00 00 00 mov $0x1,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 02 00 00 00 mov $0x2,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 03 00 00 00 mov $0x3,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 04 00 00 00 mov $0x4,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 05 00 00 00 mov $0x5,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 10 00 00 00 mov $0x10,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 15 00 00 00 mov $0x15,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 06 00 00 00 mov $0x6,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 07 00 00 00 mov $0x7,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 0f 00 00 00 mov $0xf,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 11 00 00 00 mov $0x11,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + +000002f2 : + 2f2: b8 12 00 00 00 mov $0x12,%eax + 2f7: cd 40 int $0x40 + 2f9: c3 ret + +000002fa : + 2fa: b8 08 00 00 00 mov $0x8,%eax + 2ff: cd 40 int $0x40 + 301: c3 ret + +00000302 : + 302: b8 13 00 00 00 mov $0x13,%eax + 307: cd 40 int $0x40 + 309: c3 ret + +0000030a : + 30a: b8 14 00 00 00 mov $0x14,%eax + 30f: cd 40 int $0x40 + 311: c3 ret + +00000312 : + 312: b8 09 00 00 00 mov $0x9,%eax + 317: cd 40 int $0x40 + 319: c3 ret + +0000031a : + 31a: b8 0a 00 00 00 mov $0xa,%eax + 31f: cd 40 int $0x40 + 321: c3 ret + +00000322 : + 322: b8 0b 00 00 00 mov $0xb,%eax + 327: cd 40 int $0x40 + 329: c3 ret + +0000032a : + 32a: b8 0c 00 00 00 mov $0xc,%eax + 32f: cd 40 int $0x40 + 331: c3 ret + +00000332 : + 332: b8 0d 00 00 00 mov $0xd,%eax + 337: cd 40 int $0x40 + 339: c3 ret + +0000033a : + 33a: b8 0e 00 00 00 mov $0xe,%eax + 33f: cd 40 int $0x40 + 341: c3 ret + 342: 66 90 xchg %ax,%ax + 344: 66 90 xchg %ax,%ax + 346: 66 90 xchg %ax,%ax + 348: 66 90 xchg %ax,%ax + 34a: 66 90 xchg %ax,%ax + 34c: 66 90 xchg %ax,%ax + 34e: 66 90 xchg %ax,%ax + +00000350 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 350: 55 push %ebp + 351: 89 e5 mov %esp,%ebp + 353: 57 push %edi + 354: 56 push %esi + 355: 89 c6 mov %eax,%esi + 357: 53 push %ebx + 358: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 35b: 8b 5d 08 mov 0x8(%ebp),%ebx + 35e: 85 db test %ebx,%ebx + 360: 74 09 je 36b + 362: 89 d0 mov %edx,%eax + 364: c1 e8 1f shr $0x1f,%eax + 367: 84 c0 test %al,%al + 369: 75 75 jne 3e0 + neg = 1; + x = -xx; + } else { + x = xx; + 36b: 89 d0 mov %edx,%eax + neg = 0; + 36d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 374: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 377: 31 ff xor %edi,%edi + 379: 89 ce mov %ecx,%esi + 37b: 8d 5d d7 lea -0x29(%ebp),%ebx + 37e: eb 02 jmp 382 + do{ + buf[i++] = digits[x % base]; + 380: 89 cf mov %ecx,%edi + 382: 31 d2 xor %edx,%edx + 384: f7 f6 div %esi + 386: 8d 4f 01 lea 0x1(%edi),%ecx + 389: 0f b6 92 8a 07 00 00 movzbl 0x78a(%edx),%edx + }while((x /= base) != 0); + 390: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 392: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 395: 75 e9 jne 380 + if(neg) + 397: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 39a: 89 c8 mov %ecx,%eax + 39c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 39f: 85 d2 test %edx,%edx + 3a1: 74 08 je 3ab + buf[i++] = '-'; + 3a3: 8d 4f 02 lea 0x2(%edi),%ecx + 3a6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 3ab: 8d 79 ff lea -0x1(%ecx),%edi + 3ae: 66 90 xchg %ax,%ax + 3b0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 3b5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 3b8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3bf: 00 + 3c0: 89 5c 24 04 mov %ebx,0x4(%esp) + 3c4: 89 34 24 mov %esi,(%esp) + 3c7: 88 45 d7 mov %al,-0x29(%ebp) + 3ca: e8 f3 fe ff ff call 2c2 + while(--i >= 0) + 3cf: 83 ff ff cmp $0xffffffff,%edi + 3d2: 75 dc jne 3b0 + putc(fd, buf[i]); +} + 3d4: 83 c4 4c add $0x4c,%esp + 3d7: 5b pop %ebx + 3d8: 5e pop %esi + 3d9: 5f pop %edi + 3da: 5d pop %ebp + 3db: c3 ret + 3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 3e0: 89 d0 mov %edx,%eax + 3e2: f7 d8 neg %eax + neg = 1; + 3e4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 3eb: eb 87 jmp 374 + 3ed: 8d 76 00 lea 0x0(%esi),%esi + +000003f0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3f0: 55 push %ebp + 3f1: 89 e5 mov %esp,%ebp + 3f3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3f4: 31 ff xor %edi,%edi +{ + 3f6: 56 push %esi + 3f7: 53 push %ebx + 3f8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3fb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3fe: 8d 45 10 lea 0x10(%ebp),%eax +{ + 401: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 404: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 407: 0f b6 13 movzbl (%ebx),%edx + 40a: 83 c3 01 add $0x1,%ebx + 40d: 84 d2 test %dl,%dl + 40f: 75 39 jne 44a + 411: e9 c2 00 00 00 jmp 4d8 + 416: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 418: 83 fa 25 cmp $0x25,%edx + 41b: 0f 84 bf 00 00 00 je 4e0 + write(fd, &c, 1); + 421: 8d 45 e2 lea -0x1e(%ebp),%eax + 424: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 42b: 00 + 42c: 89 44 24 04 mov %eax,0x4(%esp) + 430: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 433: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 436: e8 87 fe ff ff call 2c2 + 43b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 43e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 442: 84 d2 test %dl,%dl + 444: 0f 84 8e 00 00 00 je 4d8 + if(state == 0){ + 44a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 44c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 44f: 74 c7 je 418 + } + } else if(state == '%'){ + 451: 83 ff 25 cmp $0x25,%edi + 454: 75 e5 jne 43b + if(c == 'd'){ + 456: 83 fa 64 cmp $0x64,%edx + 459: 0f 84 31 01 00 00 je 590 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 45f: 25 f7 00 00 00 and $0xf7,%eax + 464: 83 f8 70 cmp $0x70,%eax + 467: 0f 84 83 00 00 00 je 4f0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 46d: 83 fa 73 cmp $0x73,%edx + 470: 0f 84 a2 00 00 00 je 518 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 476: 83 fa 63 cmp $0x63,%edx + 479: 0f 84 35 01 00 00 je 5b4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 47f: 83 fa 25 cmp $0x25,%edx + 482: 0f 84 e0 00 00 00 je 568 + write(fd, &c, 1); + 488: 8d 45 e6 lea -0x1a(%ebp),%eax + 48b: 83 c3 01 add $0x1,%ebx + 48e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 495: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 496: 31 ff xor %edi,%edi + write(fd, &c, 1); + 498: 89 44 24 04 mov %eax,0x4(%esp) + 49c: 89 34 24 mov %esi,(%esp) + 49f: 89 55 d0 mov %edx,-0x30(%ebp) + 4a2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 4a6: e8 17 fe ff ff call 2c2 + putc(fd, c); + 4ab: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 4ae: 8d 45 e7 lea -0x19(%ebp),%eax + 4b1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4b8: 00 + 4b9: 89 44 24 04 mov %eax,0x4(%esp) + 4bd: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4c0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4c3: e8 fa fd ff ff call 2c2 + for(i = 0; fmt[i]; i++){ + 4c8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4cc: 84 d2 test %dl,%dl + 4ce: 0f 85 76 ff ff ff jne 44a + 4d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4d8: 83 c4 3c add $0x3c,%esp + 4db: 5b pop %ebx + 4dc: 5e pop %esi + 4dd: 5f pop %edi + 4de: 5d pop %ebp + 4df: c3 ret + state = '%'; + 4e0: bf 25 00 00 00 mov $0x25,%edi + 4e5: e9 51 ff ff ff jmp 43b + 4ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4f0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4f3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4f8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4fa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 501: 8b 10 mov (%eax),%edx + 503: 89 f0 mov %esi,%eax + 505: e8 46 fe ff ff call 350 + ap++; + 50a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 50e: e9 28 ff ff ff jmp 43b + 513: 90 nop + 514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 518: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 51b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 51f: 8b 38 mov (%eax),%edi + s = "(null)"; + 521: b8 83 07 00 00 mov $0x783,%eax + 526: 85 ff test %edi,%edi + 528: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 52b: 0f b6 07 movzbl (%edi),%eax + 52e: 84 c0 test %al,%al + 530: 74 2a je 55c + 532: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 538: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 53b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 53e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 541: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 548: 00 + 549: 89 44 24 04 mov %eax,0x4(%esp) + 54d: 89 34 24 mov %esi,(%esp) + 550: e8 6d fd ff ff call 2c2 + while(*s != 0){ + 555: 0f b6 07 movzbl (%edi),%eax + 558: 84 c0 test %al,%al + 55a: 75 dc jne 538 + state = 0; + 55c: 31 ff xor %edi,%edi + 55e: e9 d8 fe ff ff jmp 43b + 563: 90 nop + 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 568: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 56b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 56d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 574: 00 + 575: 89 44 24 04 mov %eax,0x4(%esp) + 579: 89 34 24 mov %esi,(%esp) + 57c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 580: e8 3d fd ff ff call 2c2 + 585: e9 b1 fe ff ff jmp 43b + 58a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 590: 8b 45 d4 mov -0x2c(%ebp),%eax + 593: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 598: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 59b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 5a2: 8b 10 mov (%eax),%edx + 5a4: 89 f0 mov %esi,%eax + 5a6: e8 a5 fd ff ff call 350 + ap++; + 5ab: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5af: e9 87 fe ff ff jmp 43b + putc(fd, *ap); + 5b4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 5b7: 31 ff xor %edi,%edi + putc(fd, *ap); + 5b9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 5bb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5c2: 00 + 5c3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 5c6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 5c9: 8d 45 e4 lea -0x1c(%ebp),%eax + 5cc: 89 44 24 04 mov %eax,0x4(%esp) + 5d0: e8 ed fc ff ff call 2c2 + ap++; + 5d5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5d9: e9 5d fe ff ff jmp 43b + 5de: 66 90 xchg %ax,%ax + +000005e0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 5e0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5e1: a1 08 0a 00 00 mov 0xa08,%eax +{ + 5e6: 89 e5 mov %esp,%ebp + 5e8: 57 push %edi + 5e9: 56 push %esi + 5ea: 53 push %ebx + 5eb: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5ee: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5f0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5f3: 39 d0 cmp %edx,%eax + 5f5: 72 11 jb 608 + 5f7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5f8: 39 c8 cmp %ecx,%eax + 5fa: 72 04 jb 600 + 5fc: 39 ca cmp %ecx,%edx + 5fe: 72 10 jb 610 + 600: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 602: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 604: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 606: 73 f0 jae 5f8 + 608: 39 ca cmp %ecx,%edx + 60a: 72 04 jb 610 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 60c: 39 c8 cmp %ecx,%eax + 60e: 72 f0 jb 600 + break; + if(bp + bp->s.size == p->s.ptr){ + 610: 8b 73 fc mov -0x4(%ebx),%esi + 613: 8d 3c f2 lea (%edx,%esi,8),%edi + 616: 39 cf cmp %ecx,%edi + 618: 74 1e je 638 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 61a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 61d: 8b 48 04 mov 0x4(%eax),%ecx + 620: 8d 34 c8 lea (%eax,%ecx,8),%esi + 623: 39 f2 cmp %esi,%edx + 625: 74 28 je 64f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 627: 89 10 mov %edx,(%eax) + freep = p; + 629: a3 08 0a 00 00 mov %eax,0xa08 +} + 62e: 5b pop %ebx + 62f: 5e pop %esi + 630: 5f pop %edi + 631: 5d pop %ebp + 632: c3 ret + 633: 90 nop + 634: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 638: 03 71 04 add 0x4(%ecx),%esi + 63b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 63e: 8b 08 mov (%eax),%ecx + 640: 8b 09 mov (%ecx),%ecx + 642: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 645: 8b 48 04 mov 0x4(%eax),%ecx + 648: 8d 34 c8 lea (%eax,%ecx,8),%esi + 64b: 39 f2 cmp %esi,%edx + 64d: 75 d8 jne 627 + p->s.size += bp->s.size; + 64f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 652: a3 08 0a 00 00 mov %eax,0xa08 + p->s.size += bp->s.size; + 657: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 65a: 8b 53 f8 mov -0x8(%ebx),%edx + 65d: 89 10 mov %edx,(%eax) +} + 65f: 5b pop %ebx + 660: 5e pop %esi + 661: 5f pop %edi + 662: 5d pop %ebp + 663: c3 ret + 664: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 66a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000670 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 670: 55 push %ebp + 671: 89 e5 mov %esp,%ebp + 673: 57 push %edi + 674: 56 push %esi + 675: 53 push %ebx + 676: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 679: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 67c: 8b 1d 08 0a 00 00 mov 0xa08,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 682: 8d 48 07 lea 0x7(%eax),%ecx + 685: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 688: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 68a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 68d: 0f 84 9b 00 00 00 je 72e + 693: 8b 13 mov (%ebx),%edx + 695: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 698: 39 fe cmp %edi,%esi + 69a: 76 64 jbe 700 + 69c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 6a3: bb 00 80 00 00 mov $0x8000,%ebx + 6a8: 89 45 e4 mov %eax,-0x1c(%ebp) + 6ab: eb 0e jmp 6bb + 6ad: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 6b0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 6b2: 8b 78 04 mov 0x4(%eax),%edi + 6b5: 39 fe cmp %edi,%esi + 6b7: 76 4f jbe 708 + 6b9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 6bb: 3b 15 08 0a 00 00 cmp 0xa08,%edx + 6c1: 75 ed jne 6b0 + if(nu < 4096) + 6c3: 8b 45 e4 mov -0x1c(%ebp),%eax + 6c6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 6cc: bf 00 10 00 00 mov $0x1000,%edi + 6d1: 0f 43 fe cmovae %esi,%edi + 6d4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 6d7: 89 04 24 mov %eax,(%esp) + 6da: e8 4b fc ff ff call 32a + if(p == (char*)-1) + 6df: 83 f8 ff cmp $0xffffffff,%eax + 6e2: 74 18 je 6fc + hp->s.size = nu; + 6e4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 6e7: 83 c0 08 add $0x8,%eax + 6ea: 89 04 24 mov %eax,(%esp) + 6ed: e8 ee fe ff ff call 5e0 + return freep; + 6f2: 8b 15 08 0a 00 00 mov 0xa08,%edx + if((p = morecore(nunits)) == 0) + 6f8: 85 d2 test %edx,%edx + 6fa: 75 b4 jne 6b0 + return 0; + 6fc: 31 c0 xor %eax,%eax + 6fe: eb 20 jmp 720 + if(p->s.size >= nunits){ + 700: 89 d0 mov %edx,%eax + 702: 89 da mov %ebx,%edx + 704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 708: 39 fe cmp %edi,%esi + 70a: 74 1c je 728 + p->s.size -= nunits; + 70c: 29 f7 sub %esi,%edi + 70e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 711: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 714: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 717: 89 15 08 0a 00 00 mov %edx,0xa08 + return (void*)(p + 1); + 71d: 83 c0 08 add $0x8,%eax + } +} + 720: 83 c4 1c add $0x1c,%esp + 723: 5b pop %ebx + 724: 5e pop %esi + 725: 5f pop %edi + 726: 5d pop %ebp + 727: c3 ret + prevp->s.ptr = p->s.ptr; + 728: 8b 08 mov (%eax),%ecx + 72a: 89 0a mov %ecx,(%edx) + 72c: eb e9 jmp 717 + base.s.ptr = freep = prevp = &base; + 72e: c7 05 08 0a 00 00 0c movl $0xa0c,0xa08 + 735: 0a 00 00 + base.s.size = 0; + 738: ba 0c 0a 00 00 mov $0xa0c,%edx + base.s.ptr = freep = prevp = &base; + 73d: c7 05 0c 0a 00 00 0c movl $0xa0c,0xa0c + 744: 0a 00 00 + base.s.size = 0; + 747: c7 05 10 0a 00 00 00 movl $0x0,0xa10 + 74e: 00 00 00 + 751: e9 46 ff ff ff jmp 69c diff --git a/rm.c b/rm.c index 4fd33c85a1..83c5f36853 100644 --- a/rm.c +++ b/rm.c @@ -9,7 +9,7 @@ main(int argc, char *argv[]) if(argc < 2){ printf(2, "Usage: rm files...\n"); - exit(); + exit(0); } for(i = 1; i < argc; i++){ @@ -19,5 +19,5 @@ main(int argc, char *argv[]) } } - exit(); + exit(0); } diff --git a/rm.d b/rm.d new file mode 100644 index 0000000000..ba50b6b4af --- /dev/null +++ b/rm.d @@ -0,0 +1 @@ +rm.o: rm.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/rm.o b/rm.o new file mode 100644 index 0000000000..ac9b71421a Binary files /dev/null and b/rm.o differ diff --git a/rm.sym b/rm.sym new file mode 100644 index 0000000000..88291891d5 --- /dev/null +++ b/rm.sym @@ -0,0 +1,57 @@ +00000000 .text +00000756 .rodata +0000079c .eh_frame +00000a08 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 rm.c +00000000 ulib.c +00000000 printf.c +00000350 printint +0000078a digits.1354 +00000000 umalloc.c +00000a08 freep +00000a0c base +00000080 strcpy +000003f0 printf +00000270 memmove +000002ea mknod +00000190 gets +00000322 getpid +00000670 malloc +00000332 sleep +000002b2 pipe +000002c2 write +000002fa fstat +000002d2 kill +00000312 chdir +000002da exec +000002aa wait +000002ba read +000002f2 unlink +0000029a fork +0000032a sbrk +0000033a uptime +00000a08 __bss_start +00000130 memset +00000000 main +000000b0 strcmp +0000031a dup +000001f0 stat +00000a08 _edata +00000a14 _end +00000302 link +000002a2 exit +00000240 atoi +00000100 strlen +000002e2 open +00000150 strchr +0000030a mkdir +000002ca close +000005e0 free diff --git a/sh.asm b/sh.asm new file mode 100644 index 0000000000..ccb7431e30 --- /dev/null +++ b/sh.asm @@ -0,0 +1,2476 @@ + +_sh: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + return -1; + return 0; +} + +int main(void) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp + 6: 83 ec 10 sub $0x10,%esp + static char buf[100]; + int fd; + + // Ensure that three file descriptors are open. + while ((fd = open("console", O_RDWR)) >= 0) + 9: eb 0e jmp 19 + b: 90 nop + c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + { + if (fd >= 3) + 10: 83 f8 02 cmp $0x2,%eax + 13: 0f 8f db 00 00 00 jg f4 + while ((fd = open("console", O_RDWR)) >= 0) + 19: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 20: 00 + 21: c7 04 24 59 13 00 00 movl $0x1359,(%esp) + 28: e8 15 0e 00 00 call e42 + 2d: 85 c0 test %eax,%eax + 2f: 79 df jns 10 + 31: eb 2a jmp 5d + 33: 90 nop + 34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + + // Read and run input commands. + while (getcmd(buf, sizeof(buf)) >= 0) + { + if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') + 38: 80 3d 62 19 00 00 20 cmpb $0x20,0x1962 + 3f: 90 nop + 40: 74 6e je b0 + 42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + buf[strlen(buf) - 1] = 0; // chop \n + if (chdir(buf + 3) < 0) + printf(2, "cannot cd %s\n", buf + 3); + continue; + } + if (fork1() == 0) + 48: e8 53 01 00 00 call 1a0 + 4d: 85 c0 test %eax,%eax + 4f: 74 3f je 90 + runcmd(parsecmd(buf)); + wait(0); + 51: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 58: e8 ad 0d 00 00 call e0a + while (getcmd(buf, sizeof(buf)) >= 0) + 5d: c7 44 24 04 64 00 00 movl $0x64,0x4(%esp) + 64: 00 + 65: c7 04 24 60 19 00 00 movl $0x1960,(%esp) + 6c: e8 9f 00 00 00 call 110 + 71: 85 c0 test %eax,%eax + 73: 78 2f js a4 + if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') + 75: 80 3d 60 19 00 00 63 cmpb $0x63,0x1960 + 7c: 75 ca jne 48 + 7e: 80 3d 61 19 00 00 64 cmpb $0x64,0x1961 + 85: 74 b1 je 38 + if (fork1() == 0) + 87: e8 14 01 00 00 call 1a0 + 8c: 85 c0 test %eax,%eax + 8e: 75 c1 jne 51 + runcmd(parsecmd(buf)); + 90: c7 04 24 60 19 00 00 movl $0x1960,(%esp) + 97: e8 c4 0a 00 00 call b60 + 9c: 89 04 24 mov %eax,(%esp) + 9f: e8 1c 01 00 00 call 1c0 + ; + } + exit(0); + a4: c7 04 24 00 00 00 00 movl $0x0,(%esp) + ab: e8 52 0d 00 00 call e02 + buf[strlen(buf) - 1] = 0; // chop \n + b0: c7 04 24 60 19 00 00 movl $0x1960,(%esp) + b7: e8 a4 0b 00 00 call c60 + if (chdir(buf + 3) < 0) + bc: c7 04 24 63 19 00 00 movl $0x1963,(%esp) + buf[strlen(buf) - 1] = 0; // chop \n + c3: c6 80 5f 19 00 00 00 movb $0x0,0x195f(%eax) + if (chdir(buf + 3) < 0) + ca: e8 a3 0d 00 00 call e72 + cf: 85 c0 test %eax,%eax + d1: 79 8a jns 5d + printf(2, "cannot cd %s\n", buf + 3); + d3: c7 44 24 08 63 19 00 movl $0x1963,0x8(%esp) + da: 00 + db: c7 44 24 04 61 13 00 movl $0x1361,0x4(%esp) + e2: 00 + e3: c7 04 24 02 00 00 00 movl $0x2,(%esp) + ea: e8 61 0e 00 00 call f50 + ef: e9 69 ff ff ff jmp 5d + close(fd); + f4: 89 04 24 mov %eax,(%esp) + f7: e8 2e 0d 00 00 call e2a + fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + break; + 100: e9 58 ff ff ff jmp 5d + 105: 66 90 xchg %ax,%ax + 107: 66 90 xchg %ax,%ax + 109: 66 90 xchg %ax,%ax + 10b: 66 90 xchg %ax,%ax + 10d: 66 90 xchg %ax,%ax + 10f: 90 nop + +00000110 : +{ + 110: 55 push %ebp + 111: 89 e5 mov %esp,%ebp + 113: 56 push %esi + 114: 53 push %ebx + 115: 83 ec 10 sub $0x10,%esp + 118: 8b 5d 08 mov 0x8(%ebp),%ebx + 11b: 8b 75 0c mov 0xc(%ebp),%esi + printf(2, "$ "); + 11e: c7 44 24 04 b8 12 00 movl $0x12b8,0x4(%esp) + 125: 00 + 126: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 12d: e8 1e 0e 00 00 call f50 + memset(buf, 0, nbuf); + 132: 89 74 24 08 mov %esi,0x8(%esp) + 136: 89 1c 24 mov %ebx,(%esp) + 139: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 140: 00 + 141: e8 4a 0b 00 00 call c90 + gets(buf, nbuf); + 146: 89 74 24 04 mov %esi,0x4(%esp) + 14a: 89 1c 24 mov %ebx,(%esp) + 14d: e8 9e 0b 00 00 call cf0 + if (buf[0] == 0) // EOF + 152: 31 c0 xor %eax,%eax + 154: 80 3b 00 cmpb $0x0,(%ebx) + 157: 0f 94 c0 sete %al +} + 15a: 83 c4 10 add $0x10,%esp + 15d: 5b pop %ebx + if (buf[0] == 0) // EOF + 15e: f7 d8 neg %eax +} + 160: 5e pop %esi + 161: 5d pop %ebp + 162: c3 ret + 163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000170 : +} + +void panic(char *s) +{ + 170: 55 push %ebp + 171: 89 e5 mov %esp,%ebp + 173: 83 ec 18 sub $0x18,%esp + printf(2, "%s\n", s); + 176: 8b 45 08 mov 0x8(%ebp),%eax + 179: c7 44 24 04 55 13 00 movl $0x1355,0x4(%esp) + 180: 00 + 181: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 188: 89 44 24 08 mov %eax,0x8(%esp) + 18c: e8 bf 0d 00 00 call f50 + exit(0); + 191: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 198: e8 65 0c 00 00 call e02 + 19d: 8d 76 00 lea 0x0(%esi),%esi + +000001a0 : +} + +int fork1(void) +{ + 1a0: 55 push %ebp + 1a1: 89 e5 mov %esp,%ebp + 1a3: 83 ec 18 sub $0x18,%esp + int pid; + + pid = fork(); + 1a6: e8 4f 0c 00 00 call dfa + if (pid == -1) + 1ab: 83 f8 ff cmp $0xffffffff,%eax + 1ae: 74 02 je 1b2 + panic("fork"); + return pid; +} + 1b0: c9 leave + 1b1: c3 ret + panic("fork"); + 1b2: c7 04 24 bb 12 00 00 movl $0x12bb,(%esp) + 1b9: e8 b2 ff ff ff call 170 + 1be: 66 90 xchg %ax,%ax + +000001c0 : +{ + 1c0: 55 push %ebp + 1c1: 89 e5 mov %esp,%ebp + 1c3: 53 push %ebx + 1c4: 83 ec 24 sub $0x24,%esp + 1c7: 8b 5d 08 mov 0x8(%ebp),%ebx + if (cmd == 0) + 1ca: 85 db test %ebx,%ebx + 1cc: 74 6d je 23b + switch (cmd->type) + 1ce: 83 3b 05 cmpl $0x5,(%ebx) + 1d1: 0f 87 fe 00 00 00 ja 2d5 + 1d7: 8b 03 mov (%ebx),%eax + 1d9: ff 24 85 70 13 00 00 jmp *0x1370(,%eax,4) + if (pipe(p) < 0) + 1e0: 8d 45 f0 lea -0x10(%ebp),%eax + 1e3: 89 04 24 mov %eax,(%esp) + 1e6: e8 27 0c 00 00 call e12 + 1eb: 85 c0 test %eax,%eax + 1ed: 0f 88 ee 00 00 00 js 2e1 + if (fork1() == 0) + 1f3: e8 a8 ff ff ff call 1a0 + 1f8: 85 c0 test %eax,%eax + 1fa: 0f 84 45 01 00 00 je 345 + if (fork1() == 0) + 200: e8 9b ff ff ff call 1a0 + 205: 85 c0 test %eax,%eax + 207: 0f 84 00 01 00 00 je 30d + close(p[0]); + 20d: 8b 45 f0 mov -0x10(%ebp),%eax + 210: 89 04 24 mov %eax,(%esp) + 213: e8 12 0c 00 00 call e2a + close(p[1]); + 218: 8b 45 f4 mov -0xc(%ebp),%eax + 21b: 89 04 24 mov %eax,(%esp) + 21e: e8 07 0c 00 00 call e2a + wait(0); + 223: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 22a: e8 db 0b 00 00 call e0a + wait(0); + 22f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 236: e8 cf 0b 00 00 call e0a + exit(0); + 23b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 242: e8 bb 0b 00 00 call e02 + if (fork1() == 0) + 247: e8 54 ff ff ff call 1a0 + 24c: 85 c0 test %eax,%eax + 24e: 75 eb jne 23b + 250: eb 78 jmp 2ca + if (ecmd->argv[0] == 0) + 252: 8b 43 04 mov 0x4(%ebx),%eax + 255: 85 c0 test %eax,%eax + 257: 74 e2 je 23b + exec(ecmd->argv[0], ecmd->argv); + 259: 8d 53 04 lea 0x4(%ebx),%edx + 25c: 89 54 24 04 mov %edx,0x4(%esp) + 260: 89 04 24 mov %eax,(%esp) + 263: e8 d2 0b 00 00 call e3a + printf(2, "exec %s failed\n", ecmd->argv[0]); + 268: 8b 43 04 mov 0x4(%ebx),%eax + 26b: c7 44 24 04 c7 12 00 movl $0x12c7,0x4(%esp) + 272: 00 + 273: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 27a: 89 44 24 08 mov %eax,0x8(%esp) + 27e: e8 cd 0c 00 00 call f50 + break; + 283: eb b6 jmp 23b + if (fork1() == 0) + 285: e8 16 ff ff ff call 1a0 + 28a: 85 c0 test %eax,%eax + 28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 290: 74 38 je 2ca + wait(0); + 292: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 299: e8 6c 0b 00 00 call e0a + runcmd(lcmd->right); + 29e: 8b 43 08 mov 0x8(%ebx),%eax + 2a1: 89 04 24 mov %eax,(%esp) + 2a4: e8 17 ff ff ff call 1c0 + close(rcmd->fd); + 2a9: 8b 43 14 mov 0x14(%ebx),%eax + 2ac: 89 04 24 mov %eax,(%esp) + 2af: e8 76 0b 00 00 call e2a + if (open(rcmd->file, rcmd->mode) < 0) + 2b4: 8b 43 10 mov 0x10(%ebx),%eax + 2b7: 89 44 24 04 mov %eax,0x4(%esp) + 2bb: 8b 43 08 mov 0x8(%ebx),%eax + 2be: 89 04 24 mov %eax,(%esp) + 2c1: e8 7c 0b 00 00 call e42 + 2c6: 85 c0 test %eax,%eax + 2c8: 78 23 js 2ed + runcmd(bcmd->cmd); + 2ca: 8b 43 04 mov 0x4(%ebx),%eax + 2cd: 89 04 24 mov %eax,(%esp) + 2d0: e8 eb fe ff ff call 1c0 + panic("runcmd"); + 2d5: c7 04 24 c0 12 00 00 movl $0x12c0,(%esp) + 2dc: e8 8f fe ff ff call 170 + panic("pipe"); + 2e1: c7 04 24 e7 12 00 00 movl $0x12e7,(%esp) + 2e8: e8 83 fe ff ff call 170 + printf(2, "open %s failed\n", rcmd->file); + 2ed: 8b 43 08 mov 0x8(%ebx),%eax + 2f0: c7 44 24 04 d7 12 00 movl $0x12d7,0x4(%esp) + 2f7: 00 + 2f8: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 2ff: 89 44 24 08 mov %eax,0x8(%esp) + 303: e8 48 0c 00 00 call f50 + 308: e9 2e ff ff ff jmp 23b + close(0); + 30d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 314: e8 11 0b 00 00 call e2a + dup(p[0]); + 319: 8b 45 f0 mov -0x10(%ebp),%eax + 31c: 89 04 24 mov %eax,(%esp) + 31f: e8 56 0b 00 00 call e7a + close(p[0]); + 324: 8b 45 f0 mov -0x10(%ebp),%eax + 327: 89 04 24 mov %eax,(%esp) + 32a: e8 fb 0a 00 00 call e2a + close(p[1]); + 32f: 8b 45 f4 mov -0xc(%ebp),%eax + 332: 89 04 24 mov %eax,(%esp) + 335: e8 f0 0a 00 00 call e2a + runcmd(pcmd->right); + 33a: 8b 43 08 mov 0x8(%ebx),%eax + 33d: 89 04 24 mov %eax,(%esp) + 340: e8 7b fe ff ff call 1c0 + close(1); + 345: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 34c: e8 d9 0a 00 00 call e2a + dup(p[1]); + 351: 8b 45 f4 mov -0xc(%ebp),%eax + 354: 89 04 24 mov %eax,(%esp) + 357: e8 1e 0b 00 00 call e7a + close(p[0]); + 35c: 8b 45 f0 mov -0x10(%ebp),%eax + 35f: 89 04 24 mov %eax,(%esp) + 362: e8 c3 0a 00 00 call e2a + close(p[1]); + 367: 8b 45 f4 mov -0xc(%ebp),%eax + 36a: 89 04 24 mov %eax,(%esp) + 36d: e8 b8 0a 00 00 call e2a + runcmd(pcmd->left); + 372: 8b 43 04 mov 0x4(%ebx),%eax + 375: 89 04 24 mov %eax,(%esp) + 378: e8 43 fe ff ff call 1c0 + 37d: 8d 76 00 lea 0x0(%esi),%esi + +00000380 : +// PAGEBREAK! +// Constructors + +struct cmd * +execcmd(void) +{ + 380: 55 push %ebp + 381: 89 e5 mov %esp,%ebp + 383: 53 push %ebx + 384: 83 ec 14 sub $0x14,%esp + struct execcmd *cmd; + + cmd = malloc(sizeof(*cmd)); + 387: c7 04 24 54 00 00 00 movl $0x54,(%esp) + 38e: e8 3d 0e 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); + 393: c7 44 24 08 54 00 00 movl $0x54,0x8(%esp) + 39a: 00 + 39b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3a2: 00 + cmd = malloc(sizeof(*cmd)); + 3a3: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); + 3a5: 89 04 24 mov %eax,(%esp) + 3a8: e8 e3 08 00 00 call c90 + cmd->type = EXEC; + return (struct cmd *)cmd; +} + 3ad: 89 d8 mov %ebx,%eax + cmd->type = EXEC; + 3af: c7 03 01 00 00 00 movl $0x1,(%ebx) +} + 3b5: 83 c4 14 add $0x14,%esp + 3b8: 5b pop %ebx + 3b9: 5d pop %ebp + 3ba: c3 ret + 3bb: 90 nop + 3bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +000003c0 : + +struct cmd * +redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) +{ + 3c0: 55 push %ebp + 3c1: 89 e5 mov %esp,%ebp + 3c3: 53 push %ebx + 3c4: 83 ec 14 sub $0x14,%esp + struct redircmd *cmd; + + cmd = malloc(sizeof(*cmd)); + 3c7: c7 04 24 18 00 00 00 movl $0x18,(%esp) + 3ce: e8 fd 0d 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); + 3d3: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) + 3da: 00 + 3db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3e2: 00 + 3e3: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); + 3e6: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); + 3e8: e8 a3 08 00 00 call c90 + cmd->type = REDIR; + cmd->cmd = subcmd; + 3ed: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = REDIR; + 3f0: c7 03 02 00 00 00 movl $0x2,(%ebx) + cmd->cmd = subcmd; + 3f6: 89 43 04 mov %eax,0x4(%ebx) + cmd->file = file; + 3f9: 8b 45 0c mov 0xc(%ebp),%eax + 3fc: 89 43 08 mov %eax,0x8(%ebx) + cmd->efile = efile; + 3ff: 8b 45 10 mov 0x10(%ebp),%eax + 402: 89 43 0c mov %eax,0xc(%ebx) + cmd->mode = mode; + 405: 8b 45 14 mov 0x14(%ebp),%eax + 408: 89 43 10 mov %eax,0x10(%ebx) + cmd->fd = fd; + 40b: 8b 45 18 mov 0x18(%ebp),%eax + 40e: 89 43 14 mov %eax,0x14(%ebx) + return (struct cmd *)cmd; +} + 411: 83 c4 14 add $0x14,%esp + 414: 89 d8 mov %ebx,%eax + 416: 5b pop %ebx + 417: 5d pop %ebp + 418: c3 ret + 419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000420 : + +struct cmd * +pipecmd(struct cmd *left, struct cmd *right) +{ + 420: 55 push %ebp + 421: 89 e5 mov %esp,%ebp + 423: 53 push %ebx + 424: 83 ec 14 sub $0x14,%esp + struct pipecmd *cmd; + + cmd = malloc(sizeof(*cmd)); + 427: c7 04 24 0c 00 00 00 movl $0xc,(%esp) + 42e: e8 9d 0d 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); + 433: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) + 43a: 00 + 43b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 442: 00 + 443: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); + 446: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); + 448: e8 43 08 00 00 call c90 + cmd->type = PIPE; + cmd->left = left; + 44d: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = PIPE; + 450: c7 03 03 00 00 00 movl $0x3,(%ebx) + cmd->left = left; + 456: 89 43 04 mov %eax,0x4(%ebx) + cmd->right = right; + 459: 8b 45 0c mov 0xc(%ebp),%eax + 45c: 89 43 08 mov %eax,0x8(%ebx) + return (struct cmd *)cmd; +} + 45f: 83 c4 14 add $0x14,%esp + 462: 89 d8 mov %ebx,%eax + 464: 5b pop %ebx + 465: 5d pop %ebp + 466: c3 ret + 467: 89 f6 mov %esi,%esi + 469: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000470 : + +struct cmd * +listcmd(struct cmd *left, struct cmd *right) +{ + 470: 55 push %ebp + 471: 89 e5 mov %esp,%ebp + 473: 53 push %ebx + 474: 83 ec 14 sub $0x14,%esp + struct listcmd *cmd; + + cmd = malloc(sizeof(*cmd)); + 477: c7 04 24 0c 00 00 00 movl $0xc,(%esp) + 47e: e8 4d 0d 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); + 483: c7 44 24 08 0c 00 00 movl $0xc,0x8(%esp) + 48a: 00 + 48b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 492: 00 + 493: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); + 496: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); + 498: e8 f3 07 00 00 call c90 + cmd->type = LIST; + cmd->left = left; + 49d: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = LIST; + 4a0: c7 03 04 00 00 00 movl $0x4,(%ebx) + cmd->left = left; + 4a6: 89 43 04 mov %eax,0x4(%ebx) + cmd->right = right; + 4a9: 8b 45 0c mov 0xc(%ebp),%eax + 4ac: 89 43 08 mov %eax,0x8(%ebx) + return (struct cmd *)cmd; +} + 4af: 83 c4 14 add $0x14,%esp + 4b2: 89 d8 mov %ebx,%eax + 4b4: 5b pop %ebx + 4b5: 5d pop %ebp + 4b6: c3 ret + 4b7: 89 f6 mov %esi,%esi + 4b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000004c0 : + +struct cmd * +backcmd(struct cmd *subcmd) +{ + 4c0: 55 push %ebp + 4c1: 89 e5 mov %esp,%ebp + 4c3: 53 push %ebx + 4c4: 83 ec 14 sub $0x14,%esp + struct backcmd *cmd; + + cmd = malloc(sizeof(*cmd)); + 4c7: c7 04 24 08 00 00 00 movl $0x8,(%esp) + 4ce: e8 fd 0c 00 00 call 11d0 + memset(cmd, 0, sizeof(*cmd)); + 4d3: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) + 4da: 00 + 4db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 4e2: 00 + 4e3: 89 04 24 mov %eax,(%esp) + cmd = malloc(sizeof(*cmd)); + 4e6: 89 c3 mov %eax,%ebx + memset(cmd, 0, sizeof(*cmd)); + 4e8: e8 a3 07 00 00 call c90 + cmd->type = BACK; + cmd->cmd = subcmd; + 4ed: 8b 45 08 mov 0x8(%ebp),%eax + cmd->type = BACK; + 4f0: c7 03 05 00 00 00 movl $0x5,(%ebx) + cmd->cmd = subcmd; + 4f6: 89 43 04 mov %eax,0x4(%ebx) + return (struct cmd *)cmd; +} + 4f9: 83 c4 14 add $0x14,%esp + 4fc: 89 d8 mov %ebx,%eax + 4fe: 5b pop %ebx + 4ff: 5d pop %ebp + 500: c3 ret + 501: eb 0d jmp 510 + 503: 90 nop + 504: 90 nop + 505: 90 nop + 506: 90 nop + 507: 90 nop + 508: 90 nop + 509: 90 nop + 50a: 90 nop + 50b: 90 nop + 50c: 90 nop + 50d: 90 nop + 50e: 90 nop + 50f: 90 nop + +00000510 : + +char whitespace[] = " \t\r\n\v"; +char symbols[] = "<|>&;()"; + +int gettoken(char **ps, char *es, char **q, char **eq) +{ + 510: 55 push %ebp + 511: 89 e5 mov %esp,%ebp + 513: 57 push %edi + 514: 56 push %esi + 515: 53 push %ebx + 516: 83 ec 1c sub $0x1c,%esp + char *s; + int ret; + + s = *ps; + 519: 8b 45 08 mov 0x8(%ebp),%eax +{ + 51c: 8b 5d 0c mov 0xc(%ebp),%ebx + 51f: 8b 75 10 mov 0x10(%ebp),%esi + s = *ps; + 522: 8b 38 mov (%eax),%edi + while (s < es && strchr(whitespace, *s)) + 524: 39 df cmp %ebx,%edi + 526: 72 0f jb 537 + 528: eb 24 jmp 54e + 52a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + s++; + 530: 83 c7 01 add $0x1,%edi + while (s < es && strchr(whitespace, *s)) + 533: 39 df cmp %ebx,%edi + 535: 74 17 je 54e + 537: 0f be 07 movsbl (%edi),%eax + 53a: c7 04 24 40 19 00 00 movl $0x1940,(%esp) + 541: 89 44 24 04 mov %eax,0x4(%esp) + 545: e8 66 07 00 00 call cb0 + 54a: 85 c0 test %eax,%eax + 54c: 75 e2 jne 530 + if (q) + 54e: 85 f6 test %esi,%esi + 550: 74 02 je 554 + *q = s; + 552: 89 3e mov %edi,(%esi) + ret = *s; + 554: 0f b6 0f movzbl (%edi),%ecx + 557: 0f be f1 movsbl %cl,%esi + switch (*s) + 55a: 80 f9 29 cmp $0x29,%cl + ret = *s; + 55d: 89 f0 mov %esi,%eax + switch (*s) + 55f: 7f 4f jg 5b0 + 561: 80 f9 28 cmp $0x28,%cl + 564: 7d 55 jge 5bb + 566: 84 c9 test %cl,%cl + 568: 0f 85 ca 00 00 00 jne 638 + ret = 'a'; + while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) + s++; + break; + } + if (eq) + 56e: 8b 45 14 mov 0x14(%ebp),%eax + 571: 85 c0 test %eax,%eax + 573: 74 05 je 57a + *eq = s; + 575: 8b 45 14 mov 0x14(%ebp),%eax + 578: 89 38 mov %edi,(%eax) + + while (s < es && strchr(whitespace, *s)) + 57a: 39 df cmp %ebx,%edi + 57c: 72 09 jb 587 + 57e: eb 1e jmp 59e + s++; + 580: 83 c7 01 add $0x1,%edi + while (s < es && strchr(whitespace, *s)) + 583: 39 df cmp %ebx,%edi + 585: 74 17 je 59e + 587: 0f be 07 movsbl (%edi),%eax + 58a: c7 04 24 40 19 00 00 movl $0x1940,(%esp) + 591: 89 44 24 04 mov %eax,0x4(%esp) + 595: e8 16 07 00 00 call cb0 + 59a: 85 c0 test %eax,%eax + 59c: 75 e2 jne 580 + *ps = s; + 59e: 8b 45 08 mov 0x8(%ebp),%eax + 5a1: 89 38 mov %edi,(%eax) + return ret; +} + 5a3: 83 c4 1c add $0x1c,%esp + 5a6: 89 f0 mov %esi,%eax + 5a8: 5b pop %ebx + 5a9: 5e pop %esi + 5aa: 5f pop %edi + 5ab: 5d pop %ebp + 5ac: c3 ret + 5ad: 8d 76 00 lea 0x0(%esi),%esi + switch (*s) + 5b0: 80 f9 3e cmp $0x3e,%cl + 5b3: 75 0b jne 5c0 + if (*s == '>') + 5b5: 80 7f 01 3e cmpb $0x3e,0x1(%edi) + 5b9: 74 6d je 628 + s++; + 5bb: 83 c7 01 add $0x1,%edi + 5be: eb ae jmp 56e + switch (*s) + 5c0: 7f 56 jg 618 + 5c2: 83 e9 3b sub $0x3b,%ecx + 5c5: 80 f9 01 cmp $0x1,%cl + 5c8: 76 f1 jbe 5bb + while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) + 5ca: 39 fb cmp %edi,%ebx + 5cc: 77 2b ja 5f9 + 5ce: 66 90 xchg %ax,%ax + 5d0: eb 3b jmp 60d + 5d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 5d8: 0f be 07 movsbl (%edi),%eax + 5db: c7 04 24 38 19 00 00 movl $0x1938,(%esp) + 5e2: 89 44 24 04 mov %eax,0x4(%esp) + 5e6: e8 c5 06 00 00 call cb0 + 5eb: 85 c0 test %eax,%eax + 5ed: 75 1e jne 60d + s++; + 5ef: 83 c7 01 add $0x1,%edi + while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) + 5f2: 39 df cmp %ebx,%edi + 5f4: 74 17 je 60d + 5f6: 0f be 07 movsbl (%edi),%eax + 5f9: 89 44 24 04 mov %eax,0x4(%esp) + 5fd: c7 04 24 40 19 00 00 movl $0x1940,(%esp) + 604: e8 a7 06 00 00 call cb0 + 609: 85 c0 test %eax,%eax + 60b: 74 cb je 5d8 + ret = 'a'; + 60d: be 61 00 00 00 mov $0x61,%esi + 612: e9 57 ff ff ff jmp 56e + 617: 90 nop + switch (*s) + 618: 80 f9 7c cmp $0x7c,%cl + 61b: 74 9e je 5bb + 61d: 8d 76 00 lea 0x0(%esi),%esi + 620: eb a8 jmp 5ca + 622: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + s++; + 628: 83 c7 02 add $0x2,%edi + ret = '+'; + 62b: be 2b 00 00 00 mov $0x2b,%esi + 630: e9 39 ff ff ff jmp 56e + 635: 8d 76 00 lea 0x0(%esi),%esi + switch (*s) + 638: 80 f9 26 cmp $0x26,%cl + 63b: 75 8d jne 5ca + 63d: e9 79 ff ff ff jmp 5bb + 642: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000650 : + +int peek(char **ps, char *es, char *toks) +{ + 650: 55 push %ebp + 651: 89 e5 mov %esp,%ebp + 653: 57 push %edi + 654: 56 push %esi + 655: 53 push %ebx + 656: 83 ec 1c sub $0x1c,%esp + 659: 8b 7d 08 mov 0x8(%ebp),%edi + 65c: 8b 75 0c mov 0xc(%ebp),%esi + char *s; + + s = *ps; + 65f: 8b 1f mov (%edi),%ebx + while (s < es && strchr(whitespace, *s)) + 661: 39 f3 cmp %esi,%ebx + 663: 72 0a jb 66f + 665: eb 1f jmp 686 + 667: 90 nop + s++; + 668: 83 c3 01 add $0x1,%ebx + while (s < es && strchr(whitespace, *s)) + 66b: 39 f3 cmp %esi,%ebx + 66d: 74 17 je 686 + 66f: 0f be 03 movsbl (%ebx),%eax + 672: c7 04 24 40 19 00 00 movl $0x1940,(%esp) + 679: 89 44 24 04 mov %eax,0x4(%esp) + 67d: e8 2e 06 00 00 call cb0 + 682: 85 c0 test %eax,%eax + 684: 75 e2 jne 668 + *ps = s; + 686: 89 1f mov %ebx,(%edi) + return *s && strchr(toks, *s); + 688: 0f be 13 movsbl (%ebx),%edx + 68b: 31 c0 xor %eax,%eax + 68d: 84 d2 test %dl,%dl + 68f: 74 17 je 6a8 + 691: 8b 45 10 mov 0x10(%ebp),%eax + 694: 89 54 24 04 mov %edx,0x4(%esp) + 698: 89 04 24 mov %eax,(%esp) + 69b: e8 10 06 00 00 call cb0 + 6a0: 85 c0 test %eax,%eax + 6a2: 0f 95 c0 setne %al + 6a5: 0f b6 c0 movzbl %al,%eax +} + 6a8: 83 c4 1c add $0x1c,%esp + 6ab: 5b pop %ebx + 6ac: 5e pop %esi + 6ad: 5f pop %edi + 6ae: 5d pop %ebp + 6af: c3 ret + +000006b0 : + return cmd; +} + +struct cmd * +parseredirs(struct cmd *cmd, char **ps, char *es) +{ + 6b0: 55 push %ebp + 6b1: 89 e5 mov %esp,%ebp + 6b3: 57 push %edi + 6b4: 56 push %esi + 6b5: 53 push %ebx + 6b6: 83 ec 3c sub $0x3c,%esp + 6b9: 8b 75 0c mov 0xc(%ebp),%esi + 6bc: 8b 5d 10 mov 0x10(%ebp),%ebx + 6bf: 90 nop + int tok; + char *q, *eq; + + while (peek(ps, es, "<>")) + 6c0: c7 44 24 08 09 13 00 movl $0x1309,0x8(%esp) + 6c7: 00 + 6c8: 89 5c 24 04 mov %ebx,0x4(%esp) + 6cc: 89 34 24 mov %esi,(%esp) + 6cf: e8 7c ff ff ff call 650 + 6d4: 85 c0 test %eax,%eax + 6d6: 0f 84 9c 00 00 00 je 778 + { + tok = gettoken(ps, es, 0, 0); + 6dc: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + 6e3: 00 + 6e4: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + 6eb: 00 + 6ec: 89 5c 24 04 mov %ebx,0x4(%esp) + 6f0: 89 34 24 mov %esi,(%esp) + 6f3: e8 18 fe ff ff call 510 + if (gettoken(ps, es, &q, &eq) != 'a') + 6f8: 89 5c 24 04 mov %ebx,0x4(%esp) + 6fc: 89 34 24 mov %esi,(%esp) + tok = gettoken(ps, es, 0, 0); + 6ff: 89 c7 mov %eax,%edi + if (gettoken(ps, es, &q, &eq) != 'a') + 701: 8d 45 e4 lea -0x1c(%ebp),%eax + 704: 89 44 24 0c mov %eax,0xc(%esp) + 708: 8d 45 e0 lea -0x20(%ebp),%eax + 70b: 89 44 24 08 mov %eax,0x8(%esp) + 70f: e8 fc fd ff ff call 510 + 714: 83 f8 61 cmp $0x61,%eax + 717: 75 6a jne 783 + panic("missing file for redirection"); + switch (tok) + 719: 83 ff 3c cmp $0x3c,%edi + 71c: 74 42 je 760 + 71e: 83 ff 3e cmp $0x3e,%edi + 721: 74 05 je 728 + 723: 83 ff 2b cmp $0x2b,%edi + 726: 75 98 jne 6c0 + break; + case '>': + cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); + break; + case '+': // >> + cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); + 728: c7 44 24 10 01 00 00 movl $0x1,0x10(%esp) + 72f: 00 + 730: c7 44 24 0c 01 02 00 movl $0x201,0xc(%esp) + 737: 00 + 738: 8b 45 e4 mov -0x1c(%ebp),%eax + 73b: 89 44 24 08 mov %eax,0x8(%esp) + 73f: 8b 45 e0 mov -0x20(%ebp),%eax + 742: 89 44 24 04 mov %eax,0x4(%esp) + 746: 8b 45 08 mov 0x8(%ebp),%eax + 749: 89 04 24 mov %eax,(%esp) + 74c: e8 6f fc ff ff call 3c0 + 751: 89 45 08 mov %eax,0x8(%ebp) + break; + 754: e9 67 ff ff ff jmp 6c0 + 759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + cmd = redircmd(cmd, q, eq, O_RDONLY, 0); + 760: c7 44 24 10 00 00 00 movl $0x0,0x10(%esp) + 767: 00 + 768: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + 76f: 00 + 770: eb c6 jmp 738 + 772: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + } + } + return cmd; +} + 778: 8b 45 08 mov 0x8(%ebp),%eax + 77b: 83 c4 3c add $0x3c,%esp + 77e: 5b pop %ebx + 77f: 5e pop %esi + 780: 5f pop %edi + 781: 5d pop %ebp + 782: c3 ret + panic("missing file for redirection"); + 783: c7 04 24 ec 12 00 00 movl $0x12ec,(%esp) + 78a: e8 e1 f9 ff ff call 170 + 78f: 90 nop + +00000790 : + return cmd; +} + +struct cmd * +parseexec(char **ps, char *es) +{ + 790: 55 push %ebp + 791: 89 e5 mov %esp,%ebp + 793: 57 push %edi + 794: 56 push %esi + 795: 53 push %ebx + 796: 83 ec 3c sub $0x3c,%esp + 799: 8b 75 08 mov 0x8(%ebp),%esi + 79c: 8b 7d 0c mov 0xc(%ebp),%edi + char *q, *eq; + int tok, argc; + struct execcmd *cmd; + struct cmd *ret; + + if (peek(ps, es, "(")) + 79f: c7 44 24 08 0c 13 00 movl $0x130c,0x8(%esp) + 7a6: 00 + 7a7: 89 34 24 mov %esi,(%esp) + 7aa: 89 7c 24 04 mov %edi,0x4(%esp) + 7ae: e8 9d fe ff ff call 650 + 7b3: 85 c0 test %eax,%eax + 7b5: 0f 85 a5 00 00 00 jne 860 + return parseblock(ps, es); + + ret = execcmd(); + 7bb: e8 c0 fb ff ff call 380 + cmd = (struct execcmd *)ret; + + argc = 0; + ret = parseredirs(ret, ps, es); + 7c0: 89 7c 24 08 mov %edi,0x8(%esp) + 7c4: 89 74 24 04 mov %esi,0x4(%esp) + 7c8: 89 04 24 mov %eax,(%esp) + ret = execcmd(); + 7cb: 89 c3 mov %eax,%ebx + 7cd: 89 45 cc mov %eax,-0x34(%ebp) + ret = parseredirs(ret, ps, es); + 7d0: e8 db fe ff ff call 6b0 + argc = 0; + 7d5: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) + ret = parseredirs(ret, ps, es); + 7dc: 89 45 d0 mov %eax,-0x30(%ebp) + while (!peek(ps, es, "|)&;")) + 7df: eb 1d jmp 7fe + 7e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + cmd->argv[argc] = q; + cmd->eargv[argc] = eq; + argc++; + if (argc >= MAXARGS) + panic("too many args"); + ret = parseredirs(ret, ps, es); + 7e8: 8b 45 d0 mov -0x30(%ebp),%eax + 7eb: 89 7c 24 08 mov %edi,0x8(%esp) + 7ef: 89 74 24 04 mov %esi,0x4(%esp) + 7f3: 89 04 24 mov %eax,(%esp) + 7f6: e8 b5 fe ff ff call 6b0 + 7fb: 89 45 d0 mov %eax,-0x30(%ebp) + while (!peek(ps, es, "|)&;")) + 7fe: c7 44 24 08 23 13 00 movl $0x1323,0x8(%esp) + 805: 00 + 806: 89 7c 24 04 mov %edi,0x4(%esp) + 80a: 89 34 24 mov %esi,(%esp) + 80d: e8 3e fe ff ff call 650 + 812: 85 c0 test %eax,%eax + 814: 75 62 jne 878 + if ((tok = gettoken(ps, es, &q, &eq)) == 0) + 816: 8d 45 e4 lea -0x1c(%ebp),%eax + 819: 89 44 24 0c mov %eax,0xc(%esp) + 81d: 8d 45 e0 lea -0x20(%ebp),%eax + 820: 89 44 24 08 mov %eax,0x8(%esp) + 824: 89 7c 24 04 mov %edi,0x4(%esp) + 828: 89 34 24 mov %esi,(%esp) + 82b: e8 e0 fc ff ff call 510 + 830: 85 c0 test %eax,%eax + 832: 74 44 je 878 + if (tok != 'a') + 834: 83 f8 61 cmp $0x61,%eax + 837: 75 61 jne 89a + cmd->argv[argc] = q; + 839: 8b 45 e0 mov -0x20(%ebp),%eax + 83c: 83 c3 04 add $0x4,%ebx + argc++; + 83f: 83 45 d4 01 addl $0x1,-0x2c(%ebp) + cmd->argv[argc] = q; + 843: 89 03 mov %eax,(%ebx) + cmd->eargv[argc] = eq; + 845: 8b 45 e4 mov -0x1c(%ebp),%eax + 848: 89 43 28 mov %eax,0x28(%ebx) + if (argc >= MAXARGS) + 84b: 83 7d d4 0a cmpl $0xa,-0x2c(%ebp) + 84f: 75 97 jne 7e8 + panic("too many args"); + 851: c7 04 24 15 13 00 00 movl $0x1315,(%esp) + 858: e8 13 f9 ff ff call 170 + 85d: 8d 76 00 lea 0x0(%esi),%esi + return parseblock(ps, es); + 860: 89 7c 24 04 mov %edi,0x4(%esp) + 864: 89 34 24 mov %esi,(%esp) + 867: e8 84 01 00 00 call 9f0 + } + cmd->argv[argc] = 0; + cmd->eargv[argc] = 0; + return ret; +} + 86c: 83 c4 3c add $0x3c,%esp + 86f: 5b pop %ebx + 870: 5e pop %esi + 871: 5f pop %edi + 872: 5d pop %ebp + 873: c3 ret + 874: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 878: 8b 45 cc mov -0x34(%ebp),%eax + 87b: 8b 55 d4 mov -0x2c(%ebp),%edx + 87e: 8d 04 90 lea (%eax,%edx,4),%eax + cmd->argv[argc] = 0; + 881: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) + cmd->eargv[argc] = 0; + 888: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax) + return ret; + 88f: 8b 45 d0 mov -0x30(%ebp),%eax +} + 892: 83 c4 3c add $0x3c,%esp + 895: 5b pop %ebx + 896: 5e pop %esi + 897: 5f pop %edi + 898: 5d pop %ebp + 899: c3 ret + panic("syntax"); + 89a: c7 04 24 0e 13 00 00 movl $0x130e,(%esp) + 8a1: e8 ca f8 ff ff call 170 + 8a6: 8d 76 00 lea 0x0(%esi),%esi + 8a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000008b0 : +{ + 8b0: 55 push %ebp + 8b1: 89 e5 mov %esp,%ebp + 8b3: 57 push %edi + 8b4: 56 push %esi + 8b5: 53 push %ebx + 8b6: 83 ec 1c sub $0x1c,%esp + 8b9: 8b 5d 08 mov 0x8(%ebp),%ebx + 8bc: 8b 75 0c mov 0xc(%ebp),%esi + cmd = parseexec(ps, es); + 8bf: 89 1c 24 mov %ebx,(%esp) + 8c2: 89 74 24 04 mov %esi,0x4(%esp) + 8c6: e8 c5 fe ff ff call 790 + if (peek(ps, es, "|")) + 8cb: c7 44 24 08 28 13 00 movl $0x1328,0x8(%esp) + 8d2: 00 + 8d3: 89 74 24 04 mov %esi,0x4(%esp) + 8d7: 89 1c 24 mov %ebx,(%esp) + cmd = parseexec(ps, es); + 8da: 89 c7 mov %eax,%edi + if (peek(ps, es, "|")) + 8dc: e8 6f fd ff ff call 650 + 8e1: 85 c0 test %eax,%eax + 8e3: 75 0b jne 8f0 +} + 8e5: 83 c4 1c add $0x1c,%esp + 8e8: 89 f8 mov %edi,%eax + 8ea: 5b pop %ebx + 8eb: 5e pop %esi + 8ec: 5f pop %edi + 8ed: 5d pop %ebp + 8ee: c3 ret + 8ef: 90 nop + gettoken(ps, es, 0, 0); + 8f0: 89 74 24 04 mov %esi,0x4(%esp) + 8f4: 89 1c 24 mov %ebx,(%esp) + 8f7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + 8fe: 00 + 8ff: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + 906: 00 + 907: e8 04 fc ff ff call 510 + cmd = pipecmd(cmd, parsepipe(ps, es)); + 90c: 89 74 24 04 mov %esi,0x4(%esp) + 910: 89 1c 24 mov %ebx,(%esp) + 913: e8 98 ff ff ff call 8b0 + 918: 89 7d 08 mov %edi,0x8(%ebp) + 91b: 89 45 0c mov %eax,0xc(%ebp) +} + 91e: 83 c4 1c add $0x1c,%esp + 921: 5b pop %ebx + 922: 5e pop %esi + 923: 5f pop %edi + 924: 5d pop %ebp + cmd = pipecmd(cmd, parsepipe(ps, es)); + 925: e9 f6 fa ff ff jmp 420 + 92a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000930 : +{ + 930: 55 push %ebp + 931: 89 e5 mov %esp,%ebp + 933: 57 push %edi + 934: 56 push %esi + 935: 53 push %ebx + 936: 83 ec 1c sub $0x1c,%esp + 939: 8b 5d 08 mov 0x8(%ebp),%ebx + 93c: 8b 75 0c mov 0xc(%ebp),%esi + cmd = parsepipe(ps, es); + 93f: 89 1c 24 mov %ebx,(%esp) + 942: 89 74 24 04 mov %esi,0x4(%esp) + 946: e8 65 ff ff ff call 8b0 + 94b: 89 c7 mov %eax,%edi + while (peek(ps, es, "&")) + 94d: eb 27 jmp 976 + 94f: 90 nop + gettoken(ps, es, 0, 0); + 950: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + 957: 00 + 958: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + 95f: 00 + 960: 89 74 24 04 mov %esi,0x4(%esp) + 964: 89 1c 24 mov %ebx,(%esp) + 967: e8 a4 fb ff ff call 510 + cmd = backcmd(cmd); + 96c: 89 3c 24 mov %edi,(%esp) + 96f: e8 4c fb ff ff call 4c0 + 974: 89 c7 mov %eax,%edi + while (peek(ps, es, "&")) + 976: c7 44 24 08 2a 13 00 movl $0x132a,0x8(%esp) + 97d: 00 + 97e: 89 74 24 04 mov %esi,0x4(%esp) + 982: 89 1c 24 mov %ebx,(%esp) + 985: e8 c6 fc ff ff call 650 + 98a: 85 c0 test %eax,%eax + 98c: 75 c2 jne 950 + if (peek(ps, es, ";")) + 98e: c7 44 24 08 26 13 00 movl $0x1326,0x8(%esp) + 995: 00 + 996: 89 74 24 04 mov %esi,0x4(%esp) + 99a: 89 1c 24 mov %ebx,(%esp) + 99d: e8 ae fc ff ff call 650 + 9a2: 85 c0 test %eax,%eax + 9a4: 75 0a jne 9b0 +} + 9a6: 83 c4 1c add $0x1c,%esp + 9a9: 89 f8 mov %edi,%eax + 9ab: 5b pop %ebx + 9ac: 5e pop %esi + 9ad: 5f pop %edi + 9ae: 5d pop %ebp + 9af: c3 ret + gettoken(ps, es, 0, 0); + 9b0: 89 74 24 04 mov %esi,0x4(%esp) + 9b4: 89 1c 24 mov %ebx,(%esp) + 9b7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + 9be: 00 + 9bf: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + 9c6: 00 + 9c7: e8 44 fb ff ff call 510 + cmd = listcmd(cmd, parseline(ps, es)); + 9cc: 89 74 24 04 mov %esi,0x4(%esp) + 9d0: 89 1c 24 mov %ebx,(%esp) + 9d3: e8 58 ff ff ff call 930 + 9d8: 89 7d 08 mov %edi,0x8(%ebp) + 9db: 89 45 0c mov %eax,0xc(%ebp) +} + 9de: 83 c4 1c add $0x1c,%esp + 9e1: 5b pop %ebx + 9e2: 5e pop %esi + 9e3: 5f pop %edi + 9e4: 5d pop %ebp + cmd = listcmd(cmd, parseline(ps, es)); + 9e5: e9 86 fa ff ff jmp 470 + 9ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000009f0 : +{ + 9f0: 55 push %ebp + 9f1: 89 e5 mov %esp,%ebp + 9f3: 57 push %edi + 9f4: 56 push %esi + 9f5: 53 push %ebx + 9f6: 83 ec 1c sub $0x1c,%esp + 9f9: 8b 5d 08 mov 0x8(%ebp),%ebx + 9fc: 8b 75 0c mov 0xc(%ebp),%esi + if (!peek(ps, es, "(")) + 9ff: c7 44 24 08 0c 13 00 movl $0x130c,0x8(%esp) + a06: 00 + a07: 89 1c 24 mov %ebx,(%esp) + a0a: 89 74 24 04 mov %esi,0x4(%esp) + a0e: e8 3d fc ff ff call 650 + a13: 85 c0 test %eax,%eax + a15: 74 76 je a8d + gettoken(ps, es, 0, 0); + a17: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + a1e: 00 + a1f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + a26: 00 + a27: 89 74 24 04 mov %esi,0x4(%esp) + a2b: 89 1c 24 mov %ebx,(%esp) + a2e: e8 dd fa ff ff call 510 + cmd = parseline(ps, es); + a33: 89 74 24 04 mov %esi,0x4(%esp) + a37: 89 1c 24 mov %ebx,(%esp) + a3a: e8 f1 fe ff ff call 930 + if (!peek(ps, es, ")")) + a3f: c7 44 24 08 48 13 00 movl $0x1348,0x8(%esp) + a46: 00 + a47: 89 74 24 04 mov %esi,0x4(%esp) + a4b: 89 1c 24 mov %ebx,(%esp) + cmd = parseline(ps, es); + a4e: 89 c7 mov %eax,%edi + if (!peek(ps, es, ")")) + a50: e8 fb fb ff ff call 650 + a55: 85 c0 test %eax,%eax + a57: 74 40 je a99 + gettoken(ps, es, 0, 0); + a59: 89 74 24 04 mov %esi,0x4(%esp) + a5d: 89 1c 24 mov %ebx,(%esp) + a60: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) + a67: 00 + a68: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) + a6f: 00 + a70: e8 9b fa ff ff call 510 + cmd = parseredirs(cmd, ps, es); + a75: 89 74 24 08 mov %esi,0x8(%esp) + a79: 89 5c 24 04 mov %ebx,0x4(%esp) + a7d: 89 3c 24 mov %edi,(%esp) + a80: e8 2b fc ff ff call 6b0 +} + a85: 83 c4 1c add $0x1c,%esp + a88: 5b pop %ebx + a89: 5e pop %esi + a8a: 5f pop %edi + a8b: 5d pop %ebp + a8c: c3 ret + panic("parseblock"); + a8d: c7 04 24 2c 13 00 00 movl $0x132c,(%esp) + a94: e8 d7 f6 ff ff call 170 + panic("syntax - missing )"); + a99: c7 04 24 37 13 00 00 movl $0x1337,(%esp) + aa0: e8 cb f6 ff ff call 170 + aa5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + aa9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000ab0 : + +// NUL-terminate all the counted strings. +struct cmd * +nulterminate(struct cmd *cmd) +{ + ab0: 55 push %ebp + ab1: 89 e5 mov %esp,%ebp + ab3: 53 push %ebx + ab4: 83 ec 14 sub $0x14,%esp + ab7: 8b 5d 08 mov 0x8(%ebp),%ebx + struct execcmd *ecmd; + struct listcmd *lcmd; + struct pipecmd *pcmd; + struct redircmd *rcmd; + + if (cmd == 0) + aba: 85 db test %ebx,%ebx + abc: 0f 84 8e 00 00 00 je b50 + return 0; + + switch (cmd->type) + ac2: 83 3b 05 cmpl $0x5,(%ebx) + ac5: 77 49 ja b10 + ac7: 8b 03 mov (%ebx),%eax + ac9: ff 24 85 88 13 00 00 jmp *0x1388(,%eax,4) + nulterminate(pcmd->right); + break; + + case LIST: + lcmd = (struct listcmd *)cmd; + nulterminate(lcmd->left); + ad0: 8b 43 04 mov 0x4(%ebx),%eax + ad3: 89 04 24 mov %eax,(%esp) + ad6: e8 d5 ff ff ff call ab0 + nulterminate(lcmd->right); + adb: 8b 43 08 mov 0x8(%ebx),%eax + ade: 89 04 24 mov %eax,(%esp) + ae1: e8 ca ff ff ff call ab0 + break; + ae6: 89 d8 mov %ebx,%eax + bcmd = (struct backcmd *)cmd; + nulterminate(bcmd->cmd); + break; + } + return cmd; +} + ae8: 83 c4 14 add $0x14,%esp + aeb: 5b pop %ebx + aec: 5d pop %ebp + aed: c3 ret + aee: 66 90 xchg %ax,%ax + for (i = 0; ecmd->argv[i]; i++) + af0: 8b 4b 04 mov 0x4(%ebx),%ecx + af3: 89 d8 mov %ebx,%eax + af5: 85 c9 test %ecx,%ecx + af7: 74 17 je b10 + af9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + *ecmd->eargv[i] = 0; + b00: 8b 50 2c mov 0x2c(%eax),%edx + b03: 83 c0 04 add $0x4,%eax + b06: c6 02 00 movb $0x0,(%edx) + for (i = 0; ecmd->argv[i]; i++) + b09: 8b 50 04 mov 0x4(%eax),%edx + b0c: 85 d2 test %edx,%edx + b0e: 75 f0 jne b00 +} + b10: 83 c4 14 add $0x14,%esp + switch (cmd->type) + b13: 89 d8 mov %ebx,%eax +} + b15: 5b pop %ebx + b16: 5d pop %ebp + b17: c3 ret + nulterminate(bcmd->cmd); + b18: 8b 43 04 mov 0x4(%ebx),%eax + b1b: 89 04 24 mov %eax,(%esp) + b1e: e8 8d ff ff ff call ab0 +} + b23: 83 c4 14 add $0x14,%esp + break; + b26: 89 d8 mov %ebx,%eax +} + b28: 5b pop %ebx + b29: 5d pop %ebp + b2a: c3 ret + b2b: 90 nop + b2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + nulterminate(rcmd->cmd); + b30: 8b 43 04 mov 0x4(%ebx),%eax + b33: 89 04 24 mov %eax,(%esp) + b36: e8 75 ff ff ff call ab0 + *rcmd->efile = 0; + b3b: 8b 43 0c mov 0xc(%ebx),%eax + b3e: c6 00 00 movb $0x0,(%eax) +} + b41: 83 c4 14 add $0x14,%esp + break; + b44: 89 d8 mov %ebx,%eax +} + b46: 5b pop %ebx + b47: 5d pop %ebp + b48: c3 ret + b49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + return 0; + b50: 31 c0 xor %eax,%eax + b52: eb 94 jmp ae8 + b54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + b5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000b60 : +{ + b60: 55 push %ebp + b61: 89 e5 mov %esp,%ebp + b63: 56 push %esi + b64: 53 push %ebx + b65: 83 ec 10 sub $0x10,%esp + es = s + strlen(s); + b68: 8b 5d 08 mov 0x8(%ebp),%ebx + b6b: 89 1c 24 mov %ebx,(%esp) + b6e: e8 ed 00 00 00 call c60 + b73: 01 c3 add %eax,%ebx + cmd = parseline(&s, es); + b75: 8d 45 08 lea 0x8(%ebp),%eax + b78: 89 5c 24 04 mov %ebx,0x4(%esp) + b7c: 89 04 24 mov %eax,(%esp) + b7f: e8 ac fd ff ff call 930 + peek(&s, es, ""); + b84: c7 44 24 08 d6 12 00 movl $0x12d6,0x8(%esp) + b8b: 00 + b8c: 89 5c 24 04 mov %ebx,0x4(%esp) + cmd = parseline(&s, es); + b90: 89 c6 mov %eax,%esi + peek(&s, es, ""); + b92: 8d 45 08 lea 0x8(%ebp),%eax + b95: 89 04 24 mov %eax,(%esp) + b98: e8 b3 fa ff ff call 650 + if (s != es) + b9d: 8b 45 08 mov 0x8(%ebp),%eax + ba0: 39 d8 cmp %ebx,%eax + ba2: 75 11 jne bb5 + nulterminate(cmd); + ba4: 89 34 24 mov %esi,(%esp) + ba7: e8 04 ff ff ff call ab0 +} + bac: 83 c4 10 add $0x10,%esp + baf: 89 f0 mov %esi,%eax + bb1: 5b pop %ebx + bb2: 5e pop %esi + bb3: 5d pop %ebp + bb4: c3 ret + printf(2, "leftovers: %s\n", s); + bb5: 89 44 24 08 mov %eax,0x8(%esp) + bb9: c7 44 24 04 4a 13 00 movl $0x134a,0x4(%esp) + bc0: 00 + bc1: c7 04 24 02 00 00 00 movl $0x2,(%esp) + bc8: e8 83 03 00 00 call f50 + panic("syntax"); + bcd: c7 04 24 0e 13 00 00 movl $0x130e,(%esp) + bd4: e8 97 f5 ff ff call 170 + bd9: 66 90 xchg %ax,%ax + bdb: 66 90 xchg %ax,%ax + bdd: 66 90 xchg %ax,%ax + bdf: 90 nop + +00000be0 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + be0: 55 push %ebp + be1: 89 e5 mov %esp,%ebp + be3: 8b 45 08 mov 0x8(%ebp),%eax + be6: 8b 4d 0c mov 0xc(%ebp),%ecx + be9: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + bea: 89 c2 mov %eax,%edx + bec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bf0: 83 c1 01 add $0x1,%ecx + bf3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + bf7: 83 c2 01 add $0x1,%edx + bfa: 84 db test %bl,%bl + bfc: 88 5a ff mov %bl,-0x1(%edx) + bff: 75 ef jne bf0 + ; + return os; +} + c01: 5b pop %ebx + c02: 5d pop %ebp + c03: c3 ret + c04: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + c0a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000c10 : + +int +strcmp(const char *p, const char *q) +{ + c10: 55 push %ebp + c11: 89 e5 mov %esp,%ebp + c13: 8b 55 08 mov 0x8(%ebp),%edx + c16: 53 push %ebx + c17: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + c1a: 0f b6 02 movzbl (%edx),%eax + c1d: 84 c0 test %al,%al + c1f: 74 2d je c4e + c21: 0f b6 19 movzbl (%ecx),%ebx + c24: 38 d8 cmp %bl,%al + c26: 74 0e je c36 + c28: eb 2b jmp c55 + c2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + c30: 38 c8 cmp %cl,%al + c32: 75 15 jne c49 + p++, q++; + c34: 89 d9 mov %ebx,%ecx + c36: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + c39: 0f b6 02 movzbl (%edx),%eax + p++, q++; + c3c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + c3f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + c43: 84 c0 test %al,%al + c45: 75 e9 jne c30 + c47: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + c49: 29 c8 sub %ecx,%eax +} + c4b: 5b pop %ebx + c4c: 5d pop %ebp + c4d: c3 ret + c4e: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + c51: 31 c0 xor %eax,%eax + c53: eb f4 jmp c49 + c55: 0f b6 cb movzbl %bl,%ecx + c58: eb ef jmp c49 + c5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000c60 : + +uint +strlen(const char *s) +{ + c60: 55 push %ebp + c61: 89 e5 mov %esp,%ebp + c63: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + c66: 80 39 00 cmpb $0x0,(%ecx) + c69: 74 12 je c7d + c6b: 31 d2 xor %edx,%edx + c6d: 8d 76 00 lea 0x0(%esi),%esi + c70: 83 c2 01 add $0x1,%edx + c73: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + c77: 89 d0 mov %edx,%eax + c79: 75 f5 jne c70 + ; + return n; +} + c7b: 5d pop %ebp + c7c: c3 ret + for(n = 0; s[n]; n++) + c7d: 31 c0 xor %eax,%eax +} + c7f: 5d pop %ebp + c80: c3 ret + c81: eb 0d jmp c90 + c83: 90 nop + c84: 90 nop + c85: 90 nop + c86: 90 nop + c87: 90 nop + c88: 90 nop + c89: 90 nop + c8a: 90 nop + c8b: 90 nop + c8c: 90 nop + c8d: 90 nop + c8e: 90 nop + c8f: 90 nop + +00000c90 : + +void* +memset(void *dst, int c, uint n) +{ + c90: 55 push %ebp + c91: 89 e5 mov %esp,%ebp + c93: 8b 55 08 mov 0x8(%ebp),%edx + c96: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + c97: 8b 4d 10 mov 0x10(%ebp),%ecx + c9a: 8b 45 0c mov 0xc(%ebp),%eax + c9d: 89 d7 mov %edx,%edi + c9f: fc cld + ca0: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + ca2: 89 d0 mov %edx,%eax + ca4: 5f pop %edi + ca5: 5d pop %ebp + ca6: c3 ret + ca7: 89 f6 mov %esi,%esi + ca9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000cb0 : + +char* +strchr(const char *s, char c) +{ + cb0: 55 push %ebp + cb1: 89 e5 mov %esp,%ebp + cb3: 8b 45 08 mov 0x8(%ebp),%eax + cb6: 53 push %ebx + cb7: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + cba: 0f b6 18 movzbl (%eax),%ebx + cbd: 84 db test %bl,%bl + cbf: 74 1d je cde + if(*s == c) + cc1: 38 d3 cmp %dl,%bl + cc3: 89 d1 mov %edx,%ecx + cc5: 75 0d jne cd4 + cc7: eb 17 jmp ce0 + cc9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + cd0: 38 ca cmp %cl,%dl + cd2: 74 0c je ce0 + for(; *s; s++) + cd4: 83 c0 01 add $0x1,%eax + cd7: 0f b6 10 movzbl (%eax),%edx + cda: 84 d2 test %dl,%dl + cdc: 75 f2 jne cd0 + return (char*)s; + return 0; + cde: 31 c0 xor %eax,%eax +} + ce0: 5b pop %ebx + ce1: 5d pop %ebp + ce2: c3 ret + ce3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000cf0 : + +char* +gets(char *buf, int max) +{ + cf0: 55 push %ebp + cf1: 89 e5 mov %esp,%ebp + cf3: 57 push %edi + cf4: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + cf5: 31 f6 xor %esi,%esi +{ + cf7: 53 push %ebx + cf8: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + cfb: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + cfe: eb 31 jmp d31 + cc = read(0, &c, 1); + d00: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + d07: 00 + d08: 89 7c 24 04 mov %edi,0x4(%esp) + d0c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + d13: e8 02 01 00 00 call e1a + if(cc < 1) + d18: 85 c0 test %eax,%eax + d1a: 7e 1d jle d39 + break; + buf[i++] = c; + d1c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + d20: 89 de mov %ebx,%esi + buf[i++] = c; + d22: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + d25: 3c 0d cmp $0xd,%al + buf[i++] = c; + d27: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + d2b: 74 0c je d39 + d2d: 3c 0a cmp $0xa,%al + d2f: 74 08 je d39 + for(i=0; i+1 < max; ){ + d31: 8d 5e 01 lea 0x1(%esi),%ebx + d34: 3b 5d 0c cmp 0xc(%ebp),%ebx + d37: 7c c7 jl d00 + break; + } + buf[i] = '\0'; + d39: 8b 45 08 mov 0x8(%ebp),%eax + d3c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + d40: 83 c4 2c add $0x2c,%esp + d43: 5b pop %ebx + d44: 5e pop %esi + d45: 5f pop %edi + d46: 5d pop %ebp + d47: c3 ret + d48: 90 nop + d49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000d50 : + +int +stat(const char *n, struct stat *st) +{ + d50: 55 push %ebp + d51: 89 e5 mov %esp,%ebp + d53: 56 push %esi + d54: 53 push %ebx + d55: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + d58: 8b 45 08 mov 0x8(%ebp),%eax + d5b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + d62: 00 + d63: 89 04 24 mov %eax,(%esp) + d66: e8 d7 00 00 00 call e42 + if(fd < 0) + d6b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + d6d: 89 c3 mov %eax,%ebx + if(fd < 0) + d6f: 78 27 js d98 + return -1; + r = fstat(fd, st); + d71: 8b 45 0c mov 0xc(%ebp),%eax + d74: 89 1c 24 mov %ebx,(%esp) + d77: 89 44 24 04 mov %eax,0x4(%esp) + d7b: e8 da 00 00 00 call e5a + close(fd); + d80: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + d83: 89 c6 mov %eax,%esi + close(fd); + d85: e8 a0 00 00 00 call e2a + return r; + d8a: 89 f0 mov %esi,%eax +} + d8c: 83 c4 10 add $0x10,%esp + d8f: 5b pop %ebx + d90: 5e pop %esi + d91: 5d pop %ebp + d92: c3 ret + d93: 90 nop + d94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + d98: b8 ff ff ff ff mov $0xffffffff,%eax + d9d: eb ed jmp d8c + d9f: 90 nop + +00000da0 : + +int +atoi(const char *s) +{ + da0: 55 push %ebp + da1: 89 e5 mov %esp,%ebp + da3: 8b 4d 08 mov 0x8(%ebp),%ecx + da6: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + da7: 0f be 11 movsbl (%ecx),%edx + daa: 8d 42 d0 lea -0x30(%edx),%eax + dad: 3c 09 cmp $0x9,%al + n = 0; + daf: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + db4: 77 17 ja dcd + db6: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + db8: 83 c1 01 add $0x1,%ecx + dbb: 8d 04 80 lea (%eax,%eax,4),%eax + dbe: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + dc2: 0f be 11 movsbl (%ecx),%edx + dc5: 8d 5a d0 lea -0x30(%edx),%ebx + dc8: 80 fb 09 cmp $0x9,%bl + dcb: 76 eb jbe db8 + return n; +} + dcd: 5b pop %ebx + dce: 5d pop %ebp + dcf: c3 ret + +00000dd0 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + dd0: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + dd1: 31 d2 xor %edx,%edx +{ + dd3: 89 e5 mov %esp,%ebp + dd5: 56 push %esi + dd6: 8b 45 08 mov 0x8(%ebp),%eax + dd9: 53 push %ebx + dda: 8b 5d 10 mov 0x10(%ebp),%ebx + ddd: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + de0: 85 db test %ebx,%ebx + de2: 7e 12 jle df6 + de4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + de8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + dec: 88 0c 10 mov %cl,(%eax,%edx,1) + def: 83 c2 01 add $0x1,%edx + while(n-- > 0) + df2: 39 da cmp %ebx,%edx + df4: 75 f2 jne de8 + return vdst; +} + df6: 5b pop %ebx + df7: 5e pop %esi + df8: 5d pop %ebp + df9: c3 ret + +00000dfa : + dfa: b8 01 00 00 00 mov $0x1,%eax + dff: cd 40 int $0x40 + e01: c3 ret + +00000e02 : + e02: b8 02 00 00 00 mov $0x2,%eax + e07: cd 40 int $0x40 + e09: c3 ret + +00000e0a : + e0a: b8 03 00 00 00 mov $0x3,%eax + e0f: cd 40 int $0x40 + e11: c3 ret + +00000e12 : + e12: b8 04 00 00 00 mov $0x4,%eax + e17: cd 40 int $0x40 + e19: c3 ret + +00000e1a : + e1a: b8 05 00 00 00 mov $0x5,%eax + e1f: cd 40 int $0x40 + e21: c3 ret + +00000e22 : + e22: b8 10 00 00 00 mov $0x10,%eax + e27: cd 40 int $0x40 + e29: c3 ret + +00000e2a : + e2a: b8 15 00 00 00 mov $0x15,%eax + e2f: cd 40 int $0x40 + e31: c3 ret + +00000e32 : + e32: b8 06 00 00 00 mov $0x6,%eax + e37: cd 40 int $0x40 + e39: c3 ret + +00000e3a : + e3a: b8 07 00 00 00 mov $0x7,%eax + e3f: cd 40 int $0x40 + e41: c3 ret + +00000e42 : + e42: b8 0f 00 00 00 mov $0xf,%eax + e47: cd 40 int $0x40 + e49: c3 ret + +00000e4a : + e4a: b8 11 00 00 00 mov $0x11,%eax + e4f: cd 40 int $0x40 + e51: c3 ret + +00000e52 : + e52: b8 12 00 00 00 mov $0x12,%eax + e57: cd 40 int $0x40 + e59: c3 ret + +00000e5a : + e5a: b8 08 00 00 00 mov $0x8,%eax + e5f: cd 40 int $0x40 + e61: c3 ret + +00000e62 : + e62: b8 13 00 00 00 mov $0x13,%eax + e67: cd 40 int $0x40 + e69: c3 ret + +00000e6a : + e6a: b8 14 00 00 00 mov $0x14,%eax + e6f: cd 40 int $0x40 + e71: c3 ret + +00000e72 : + e72: b8 09 00 00 00 mov $0x9,%eax + e77: cd 40 int $0x40 + e79: c3 ret + +00000e7a : + e7a: b8 0a 00 00 00 mov $0xa,%eax + e7f: cd 40 int $0x40 + e81: c3 ret + +00000e82 : + e82: b8 0b 00 00 00 mov $0xb,%eax + e87: cd 40 int $0x40 + e89: c3 ret + +00000e8a : + e8a: b8 0c 00 00 00 mov $0xc,%eax + e8f: cd 40 int $0x40 + e91: c3 ret + +00000e92 : + e92: b8 0d 00 00 00 mov $0xd,%eax + e97: cd 40 int $0x40 + e99: c3 ret + +00000e9a : + e9a: b8 0e 00 00 00 mov $0xe,%eax + e9f: cd 40 int $0x40 + ea1: c3 ret + ea2: 66 90 xchg %ax,%ax + ea4: 66 90 xchg %ax,%ax + ea6: 66 90 xchg %ax,%ax + ea8: 66 90 xchg %ax,%ax + eaa: 66 90 xchg %ax,%ax + eac: 66 90 xchg %ax,%ax + eae: 66 90 xchg %ax,%ax + +00000eb0 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + eb0: 55 push %ebp + eb1: 89 e5 mov %esp,%ebp + eb3: 57 push %edi + eb4: 56 push %esi + eb5: 89 c6 mov %eax,%esi + eb7: 53 push %ebx + eb8: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + ebb: 8b 5d 08 mov 0x8(%ebp),%ebx + ebe: 85 db test %ebx,%ebx + ec0: 74 09 je ecb + ec2: 89 d0 mov %edx,%eax + ec4: c1 e8 1f shr $0x1f,%eax + ec7: 84 c0 test %al,%al + ec9: 75 75 jne f40 + neg = 1; + x = -xx; + } else { + x = xx; + ecb: 89 d0 mov %edx,%eax + neg = 0; + ecd: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + ed4: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + ed7: 31 ff xor %edi,%edi + ed9: 89 ce mov %ecx,%esi + edb: 8d 5d d7 lea -0x29(%ebp),%ebx + ede: eb 02 jmp ee2 + do{ + buf[i++] = digits[x % base]; + ee0: 89 cf mov %ecx,%edi + ee2: 31 d2 xor %edx,%edx + ee4: f7 f6 div %esi + ee6: 8d 4f 01 lea 0x1(%edi),%ecx + ee9: 0f b6 92 a7 13 00 00 movzbl 0x13a7(%edx),%edx + }while((x /= base) != 0); + ef0: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + ef2: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + ef5: 75 e9 jne ee0 + if(neg) + ef7: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + efa: 89 c8 mov %ecx,%eax + efc: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + eff: 85 d2 test %edx,%edx + f01: 74 08 je f0b + buf[i++] = '-'; + f03: 8d 4f 02 lea 0x2(%edi),%ecx + f06: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + f0b: 8d 79 ff lea -0x1(%ecx),%edi + f0e: 66 90 xchg %ax,%ax + f10: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + f15: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + f18: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + f1f: 00 + f20: 89 5c 24 04 mov %ebx,0x4(%esp) + f24: 89 34 24 mov %esi,(%esp) + f27: 88 45 d7 mov %al,-0x29(%ebp) + f2a: e8 f3 fe ff ff call e22 + while(--i >= 0) + f2f: 83 ff ff cmp $0xffffffff,%edi + f32: 75 dc jne f10 + putc(fd, buf[i]); +} + f34: 83 c4 4c add $0x4c,%esp + f37: 5b pop %ebx + f38: 5e pop %esi + f39: 5f pop %edi + f3a: 5d pop %ebp + f3b: c3 ret + f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + f40: 89 d0 mov %edx,%eax + f42: f7 d8 neg %eax + neg = 1; + f44: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + f4b: eb 87 jmp ed4 + f4d: 8d 76 00 lea 0x0(%esi),%esi + +00000f50 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + f50: 55 push %ebp + f51: 89 e5 mov %esp,%ebp + f53: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + f54: 31 ff xor %edi,%edi +{ + f56: 56 push %esi + f57: 53 push %ebx + f58: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + f5b: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + f5e: 8d 45 10 lea 0x10(%ebp),%eax +{ + f61: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + f64: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + f67: 0f b6 13 movzbl (%ebx),%edx + f6a: 83 c3 01 add $0x1,%ebx + f6d: 84 d2 test %dl,%dl + f6f: 75 39 jne faa + f71: e9 c2 00 00 00 jmp 1038 + f76: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + f78: 83 fa 25 cmp $0x25,%edx + f7b: 0f 84 bf 00 00 00 je 1040 + write(fd, &c, 1); + f81: 8d 45 e2 lea -0x1e(%ebp),%eax + f84: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + f8b: 00 + f8c: 89 44 24 04 mov %eax,0x4(%esp) + f90: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + f93: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + f96: e8 87 fe ff ff call e22 + f9b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + f9e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + fa2: 84 d2 test %dl,%dl + fa4: 0f 84 8e 00 00 00 je 1038 + if(state == 0){ + faa: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + fac: 0f be c2 movsbl %dl,%eax + if(state == 0){ + faf: 74 c7 je f78 + } + } else if(state == '%'){ + fb1: 83 ff 25 cmp $0x25,%edi + fb4: 75 e5 jne f9b + if(c == 'd'){ + fb6: 83 fa 64 cmp $0x64,%edx + fb9: 0f 84 31 01 00 00 je 10f0 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + fbf: 25 f7 00 00 00 and $0xf7,%eax + fc4: 83 f8 70 cmp $0x70,%eax + fc7: 0f 84 83 00 00 00 je 1050 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + fcd: 83 fa 73 cmp $0x73,%edx + fd0: 0f 84 a2 00 00 00 je 1078 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + fd6: 83 fa 63 cmp $0x63,%edx + fd9: 0f 84 35 01 00 00 je 1114 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + fdf: 83 fa 25 cmp $0x25,%edx + fe2: 0f 84 e0 00 00 00 je 10c8 + write(fd, &c, 1); + fe8: 8d 45 e6 lea -0x1a(%ebp),%eax + feb: 83 c3 01 add $0x1,%ebx + fee: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + ff5: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + ff6: 31 ff xor %edi,%edi + write(fd, &c, 1); + ff8: 89 44 24 04 mov %eax,0x4(%esp) + ffc: 89 34 24 mov %esi,(%esp) + fff: 89 55 d0 mov %edx,-0x30(%ebp) + 1002: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 1006: e8 17 fe ff ff call e22 + putc(fd, c); + 100b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 100e: 8d 45 e7 lea -0x19(%ebp),%eax + 1011: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 1018: 00 + 1019: 89 44 24 04 mov %eax,0x4(%esp) + 101d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 1020: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 1023: e8 fa fd ff ff call e22 + for(i = 0; fmt[i]; i++){ + 1028: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 102c: 84 d2 test %dl,%dl + 102e: 0f 85 76 ff ff ff jne faa + 1034: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 1038: 83 c4 3c add $0x3c,%esp + 103b: 5b pop %ebx + 103c: 5e pop %esi + 103d: 5f pop %edi + 103e: 5d pop %ebp + 103f: c3 ret + state = '%'; + 1040: bf 25 00 00 00 mov $0x25,%edi + 1045: e9 51 ff ff ff jmp f9b + 104a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 1050: 8b 45 d4 mov -0x2c(%ebp),%eax + 1053: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 1058: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 105a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1061: 8b 10 mov (%eax),%edx + 1063: 89 f0 mov %esi,%eax + 1065: e8 46 fe ff ff call eb0 + ap++; + 106a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 106e: e9 28 ff ff ff jmp f9b + 1073: 90 nop + 1074: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 1078: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 107b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 107f: 8b 38 mov (%eax),%edi + s = "(null)"; + 1081: b8 a0 13 00 00 mov $0x13a0,%eax + 1086: 85 ff test %edi,%edi + 1088: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 108b: 0f b6 07 movzbl (%edi),%eax + 108e: 84 c0 test %al,%al + 1090: 74 2a je 10bc + 1092: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 1098: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 109b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 109e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 10a1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 10a8: 00 + 10a9: 89 44 24 04 mov %eax,0x4(%esp) + 10ad: 89 34 24 mov %esi,(%esp) + 10b0: e8 6d fd ff ff call e22 + while(*s != 0){ + 10b5: 0f b6 07 movzbl (%edi),%eax + 10b8: 84 c0 test %al,%al + 10ba: 75 dc jne 1098 + state = 0; + 10bc: 31 ff xor %edi,%edi + 10be: e9 d8 fe ff ff jmp f9b + 10c3: 90 nop + 10c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 10c8: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 10cb: 31 ff xor %edi,%edi + write(fd, &c, 1); + 10cd: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 10d4: 00 + 10d5: 89 44 24 04 mov %eax,0x4(%esp) + 10d9: 89 34 24 mov %esi,(%esp) + 10dc: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 10e0: e8 3d fd ff ff call e22 + 10e5: e9 b1 fe ff ff jmp f9b + 10ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 10f0: 8b 45 d4 mov -0x2c(%ebp),%eax + 10f3: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 10f8: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 10fb: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1102: 8b 10 mov (%eax),%edx + 1104: 89 f0 mov %esi,%eax + 1106: e8 a5 fd ff ff call eb0 + ap++; + 110b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 110f: e9 87 fe ff ff jmp f9b + putc(fd, *ap); + 1114: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 1117: 31 ff xor %edi,%edi + putc(fd, *ap); + 1119: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 111b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 1122: 00 + 1123: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 1126: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 1129: 8d 45 e4 lea -0x1c(%ebp),%eax + 112c: 89 44 24 04 mov %eax,0x4(%esp) + 1130: e8 ed fc ff ff call e22 + ap++; + 1135: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 1139: e9 5d fe ff ff jmp f9b + 113e: 66 90 xchg %ax,%ax + +00001140 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 1140: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 1141: a1 c4 19 00 00 mov 0x19c4,%eax +{ + 1146: 89 e5 mov %esp,%ebp + 1148: 57 push %edi + 1149: 56 push %esi + 114a: 53 push %ebx + 114b: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 114e: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 1150: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 1153: 39 d0 cmp %edx,%eax + 1155: 72 11 jb 1168 + 1157: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 1158: 39 c8 cmp %ecx,%eax + 115a: 72 04 jb 1160 + 115c: 39 ca cmp %ecx,%edx + 115e: 72 10 jb 1170 + 1160: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 1162: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 1164: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 1166: 73 f0 jae 1158 + 1168: 39 ca cmp %ecx,%edx + 116a: 72 04 jb 1170 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 116c: 39 c8 cmp %ecx,%eax + 116e: 72 f0 jb 1160 + break; + if(bp + bp->s.size == p->s.ptr){ + 1170: 8b 73 fc mov -0x4(%ebx),%esi + 1173: 8d 3c f2 lea (%edx,%esi,8),%edi + 1176: 39 cf cmp %ecx,%edi + 1178: 74 1e je 1198 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 117a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 117d: 8b 48 04 mov 0x4(%eax),%ecx + 1180: 8d 34 c8 lea (%eax,%ecx,8),%esi + 1183: 39 f2 cmp %esi,%edx + 1185: 74 28 je 11af + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 1187: 89 10 mov %edx,(%eax) + freep = p; + 1189: a3 c4 19 00 00 mov %eax,0x19c4 +} + 118e: 5b pop %ebx + 118f: 5e pop %esi + 1190: 5f pop %edi + 1191: 5d pop %ebp + 1192: c3 ret + 1193: 90 nop + 1194: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 1198: 03 71 04 add 0x4(%ecx),%esi + 119b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 119e: 8b 08 mov (%eax),%ecx + 11a0: 8b 09 mov (%ecx),%ecx + 11a2: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 11a5: 8b 48 04 mov 0x4(%eax),%ecx + 11a8: 8d 34 c8 lea (%eax,%ecx,8),%esi + 11ab: 39 f2 cmp %esi,%edx + 11ad: 75 d8 jne 1187 + p->s.size += bp->s.size; + 11af: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 11b2: a3 c4 19 00 00 mov %eax,0x19c4 + p->s.size += bp->s.size; + 11b7: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 11ba: 8b 53 f8 mov -0x8(%ebx),%edx + 11bd: 89 10 mov %edx,(%eax) +} + 11bf: 5b pop %ebx + 11c0: 5e pop %esi + 11c1: 5f pop %edi + 11c2: 5d pop %ebp + 11c3: c3 ret + 11c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 11ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000011d0 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 11d0: 55 push %ebp + 11d1: 89 e5 mov %esp,%ebp + 11d3: 57 push %edi + 11d4: 56 push %esi + 11d5: 53 push %ebx + 11d6: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 11d9: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 11dc: 8b 1d c4 19 00 00 mov 0x19c4,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 11e2: 8d 48 07 lea 0x7(%eax),%ecx + 11e5: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 11e8: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 11ea: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 11ed: 0f 84 9b 00 00 00 je 128e + 11f3: 8b 13 mov (%ebx),%edx + 11f5: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 11f8: 39 fe cmp %edi,%esi + 11fa: 76 64 jbe 1260 + 11fc: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 1203: bb 00 80 00 00 mov $0x8000,%ebx + 1208: 89 45 e4 mov %eax,-0x1c(%ebp) + 120b: eb 0e jmp 121b + 120d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 1210: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 1212: 8b 78 04 mov 0x4(%eax),%edi + 1215: 39 fe cmp %edi,%esi + 1217: 76 4f jbe 1268 + 1219: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 121b: 3b 15 c4 19 00 00 cmp 0x19c4,%edx + 1221: 75 ed jne 1210 + if(nu < 4096) + 1223: 8b 45 e4 mov -0x1c(%ebp),%eax + 1226: 81 fe 00 10 00 00 cmp $0x1000,%esi + 122c: bf 00 10 00 00 mov $0x1000,%edi + 1231: 0f 43 fe cmovae %esi,%edi + 1234: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 1237: 89 04 24 mov %eax,(%esp) + 123a: e8 4b fc ff ff call e8a + if(p == (char*)-1) + 123f: 83 f8 ff cmp $0xffffffff,%eax + 1242: 74 18 je 125c + hp->s.size = nu; + 1244: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 1247: 83 c0 08 add $0x8,%eax + 124a: 89 04 24 mov %eax,(%esp) + 124d: e8 ee fe ff ff call 1140 + return freep; + 1252: 8b 15 c4 19 00 00 mov 0x19c4,%edx + if((p = morecore(nunits)) == 0) + 1258: 85 d2 test %edx,%edx + 125a: 75 b4 jne 1210 + return 0; + 125c: 31 c0 xor %eax,%eax + 125e: eb 20 jmp 1280 + if(p->s.size >= nunits){ + 1260: 89 d0 mov %edx,%eax + 1262: 89 da mov %ebx,%edx + 1264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 1268: 39 fe cmp %edi,%esi + 126a: 74 1c je 1288 + p->s.size -= nunits; + 126c: 29 f7 sub %esi,%edi + 126e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 1271: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 1274: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 1277: 89 15 c4 19 00 00 mov %edx,0x19c4 + return (void*)(p + 1); + 127d: 83 c0 08 add $0x8,%eax + } +} + 1280: 83 c4 1c add $0x1c,%esp + 1283: 5b pop %ebx + 1284: 5e pop %esi + 1285: 5f pop %edi + 1286: 5d pop %ebp + 1287: c3 ret + prevp->s.ptr = p->s.ptr; + 1288: 8b 08 mov (%eax),%ecx + 128a: 89 0a mov %ecx,(%edx) + 128c: eb e9 jmp 1277 + base.s.ptr = freep = prevp = &base; + 128e: c7 05 c4 19 00 00 c8 movl $0x19c8,0x19c4 + 1295: 19 00 00 + base.s.size = 0; + 1298: ba c8 19 00 00 mov $0x19c8,%edx + base.s.ptr = freep = prevp = &base; + 129d: c7 05 c8 19 00 00 c8 movl $0x19c8,0x19c8 + 12a4: 19 00 00 + base.s.size = 0; + 12a7: c7 05 cc 19 00 00 00 movl $0x0,0x19cc + 12ae: 00 00 00 + 12b1: e9 46 ff ff ff jmp 11fc diff --git a/sh.c b/sh.c index 054bab92b3..6adf66a642 100644 --- a/sh.c +++ b/sh.c @@ -5,25 +5,28 @@ #include "fcntl.h" // Parsed command representation -#define EXEC 1 +#define EXEC 1 #define REDIR 2 -#define PIPE 3 -#define LIST 4 -#define BACK 5 +#define PIPE 3 +#define LIST 4 +#define BACK 5 #define MAXARGS 10 -struct cmd { +struct cmd +{ int type; }; -struct execcmd { +struct execcmd +{ int type; char *argv[MAXARGS]; char *eargv[MAXARGS]; }; -struct redircmd { +struct redircmd +{ int type; struct cmd *cmd; char *file; @@ -32,30 +35,32 @@ struct redircmd { int fd; }; -struct pipecmd { +struct pipecmd +{ int type; struct cmd *left; struct cmd *right; }; -struct listcmd { +struct listcmd +{ int type; struct cmd *left; struct cmd *right; }; -struct backcmd { +struct backcmd +{ int type; struct cmd *cmd; }; -int fork1(void); // Fork but panics on failure. -void panic(char*); -struct cmd *parsecmd(char*); +int fork1(void); // Fork but panics on failure. +void panic(char *); +struct cmd *parsecmd(char *); // Execute cmd. Never returns. -void -runcmd(struct cmd *cmd) +void runcmd(struct cmd *cmd) { int p[2]; struct backcmd *bcmd; @@ -64,51 +69,56 @@ runcmd(struct cmd *cmd) struct pipecmd *pcmd; struct redircmd *rcmd; - if(cmd == 0) - exit(); + if (cmd == 0) + exit(0); - switch(cmd->type){ + switch (cmd->type) + { default: panic("runcmd"); case EXEC: - ecmd = (struct execcmd*)cmd; - if(ecmd->argv[0] == 0) - exit(); + ecmd = (struct execcmd *)cmd; + if (ecmd->argv[0] == 0) + exit(0); exec(ecmd->argv[0], ecmd->argv); printf(2, "exec %s failed\n", ecmd->argv[0]); break; case REDIR: - rcmd = (struct redircmd*)cmd; + rcmd = (struct redircmd *)cmd; close(rcmd->fd); - if(open(rcmd->file, rcmd->mode) < 0){ + if (open(rcmd->file, rcmd->mode) < 0) + { printf(2, "open %s failed\n", rcmd->file); - exit(); + exit(0); } runcmd(rcmd->cmd); break; case LIST: - lcmd = (struct listcmd*)cmd; - if(fork1() == 0) + lcmd = (struct listcmd *)cmd; + if (fork1() == 0) runcmd(lcmd->left); - wait(); + wait(0); + ; runcmd(lcmd->right); break; case PIPE: - pcmd = (struct pipecmd*)cmd; - if(pipe(p) < 0) + pcmd = (struct pipecmd *)cmd; + if (pipe(p) < 0) panic("pipe"); - if(fork1() == 0){ + if (fork1() == 0) + { close(1); dup(p[1]); close(p[0]); close(p[1]); runcmd(pcmd->left); } - if(fork1() == 0){ + if (fork1() == 0) + { close(0); dup(p[0]); close(p[0]); @@ -117,82 +127,85 @@ runcmd(struct cmd *cmd) } close(p[0]); close(p[1]); - wait(); - wait(); + wait(0); + ; + wait(0); + ; break; case BACK: - bcmd = (struct backcmd*)cmd; - if(fork1() == 0) + bcmd = (struct backcmd *)cmd; + if (fork1() == 0) runcmd(bcmd->cmd); break; } - exit(); + exit(0); } -int -getcmd(char *buf, int nbuf) +int getcmd(char *buf, int nbuf) { printf(2, "$ "); memset(buf, 0, nbuf); gets(buf, nbuf); - if(buf[0] == 0) // EOF + if (buf[0] == 0) // EOF return -1; return 0; } -int -main(void) +int main(void) { static char buf[100]; int fd; // Ensure that three file descriptors are open. - while((fd = open("console", O_RDWR)) >= 0){ - if(fd >= 3){ + while ((fd = open("console", O_RDWR)) >= 0) + { + if (fd >= 3) + { close(fd); break; } } // Read and run input commands. - while(getcmd(buf, sizeof(buf)) >= 0){ - if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ + while (getcmd(buf, sizeof(buf)) >= 0) + { + if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') + { // Chdir must be called by the parent, not the child. - buf[strlen(buf)-1] = 0; // chop \n - if(chdir(buf+3) < 0) - printf(2, "cannot cd %s\n", buf+3); + buf[strlen(buf) - 1] = 0; // chop \n + if (chdir(buf + 3) < 0) + printf(2, "cannot cd %s\n", buf + 3); continue; } - if(fork1() == 0) + if (fork1() == 0) runcmd(parsecmd(buf)); - wait(); + wait(0); + ; } - exit(); + exit(0); } -void -panic(char *s) +void panic(char *s) { printf(2, "%s\n", s); - exit(); + exit(0); } -int -fork1(void) +int fork1(void) { int pid; pid = fork(); - if(pid == -1) + if (pid == -1) panic("fork"); return pid; } -//PAGEBREAK! -// Constructors +// PAGEBREAK! +// Constructors -struct cmd* +struct cmd * execcmd(void) { struct execcmd *cmd; @@ -200,10 +213,10 @@ execcmd(void) cmd = malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); cmd->type = EXEC; - return (struct cmd*)cmd; + return (struct cmd *)cmd; } -struct cmd* +struct cmd * redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { struct redircmd *cmd; @@ -216,10 +229,10 @@ redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) cmd->efile = efile; cmd->mode = mode; cmd->fd = fd; - return (struct cmd*)cmd; + return (struct cmd *)cmd; } -struct cmd* +struct cmd * pipecmd(struct cmd *left, struct cmd *right) { struct pipecmd *cmd; @@ -229,10 +242,10 @@ pipecmd(struct cmd *left, struct cmd *right) cmd->type = PIPE; cmd->left = left; cmd->right = right; - return (struct cmd*)cmd; + return (struct cmd *)cmd; } -struct cmd* +struct cmd * listcmd(struct cmd *left, struct cmd *right) { struct listcmd *cmd; @@ -242,10 +255,10 @@ listcmd(struct cmd *left, struct cmd *right) cmd->type = LIST; cmd->left = left; cmd->right = right; - return (struct cmd*)cmd; + return (struct cmd *)cmd; } -struct cmd* +struct cmd * backcmd(struct cmd *subcmd) { struct backcmd *cmd; @@ -254,27 +267,27 @@ backcmd(struct cmd *subcmd) memset(cmd, 0, sizeof(*cmd)); cmd->type = BACK; cmd->cmd = subcmd; - return (struct cmd*)cmd; + return (struct cmd *)cmd; } -//PAGEBREAK! -// Parsing +// PAGEBREAK! +// Parsing char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; -int -gettoken(char **ps, char *es, char **q, char **eq) +int gettoken(char **ps, char *es, char **q, char **eq) { char *s; int ret; s = *ps; - while(s < es && strchr(whitespace, *s)) + while (s < es && strchr(whitespace, *s)) s++; - if(q) + if (q) *q = s; ret = *s; - switch(*s){ + switch (*s) + { case 0: break; case '|': @@ -287,44 +300,44 @@ gettoken(char **ps, char *es, char **q, char **eq) break; case '>': s++; - if(*s == '>'){ + if (*s == '>') + { ret = '+'; s++; } break; default: ret = 'a'; - while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) + while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } - if(eq) + if (eq) *eq = s; - while(s < es && strchr(whitespace, *s)) + while (s < es && strchr(whitespace, *s)) s++; *ps = s; return ret; } -int -peek(char **ps, char *es, char *toks) +int peek(char **ps, char *es, char *toks) { char *s; s = *ps; - while(s < es && strchr(whitespace, *s)) + while (s < es && strchr(whitespace, *s)) s++; *ps = s; return *s && strchr(toks, *s); } -struct cmd *parseline(char**, char*); -struct cmd *parsepipe(char**, char*); -struct cmd *parseexec(char**, char*); -struct cmd *nulterminate(struct cmd*); +struct cmd *parseline(char **, char *); +struct cmd *parsepipe(char **, char *); +struct cmd *parseexec(char **, char *); +struct cmd *nulterminate(struct cmd *); -struct cmd* +struct cmd * parsecmd(char *s) { char *es; @@ -333,7 +346,8 @@ parsecmd(char *s) es = s + strlen(s); cmd = parseline(&s, es); peek(&s, es, ""); - if(s != es){ + if (s != es) + { printf(2, "leftovers: %s\n", s); panic("syntax"); } @@ -341,78 +355,83 @@ parsecmd(char *s) return cmd; } -struct cmd* +struct cmd * parseline(char **ps, char *es) { struct cmd *cmd; cmd = parsepipe(ps, es); - while(peek(ps, es, "&")){ + while (peek(ps, es, "&")) + { gettoken(ps, es, 0, 0); cmd = backcmd(cmd); } - if(peek(ps, es, ";")){ + if (peek(ps, es, ";")) + { gettoken(ps, es, 0, 0); cmd = listcmd(cmd, parseline(ps, es)); } return cmd; } -struct cmd* +struct cmd * parsepipe(char **ps, char *es) { struct cmd *cmd; cmd = parseexec(ps, es); - if(peek(ps, es, "|")){ + if (peek(ps, es, "|")) + { gettoken(ps, es, 0, 0); cmd = pipecmd(cmd, parsepipe(ps, es)); } return cmd; } -struct cmd* +struct cmd * parseredirs(struct cmd *cmd, char **ps, char *es) { int tok; char *q, *eq; - while(peek(ps, es, "<>")){ + while (peek(ps, es, "<>")) + { tok = gettoken(ps, es, 0, 0); - if(gettoken(ps, es, &q, &eq) != 'a') + if (gettoken(ps, es, &q, &eq) != 'a') panic("missing file for redirection"); - switch(tok){ + switch (tok) + { case '<': cmd = redircmd(cmd, q, eq, O_RDONLY, 0); break; case '>': - cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); + cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); break; - case '+': // >> - cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); + case '+': // >> + cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); break; } } return cmd; } -struct cmd* +struct cmd * parseblock(char **ps, char *es) { struct cmd *cmd; - if(!peek(ps, es, "(")) + if (!peek(ps, es, "(")) panic("parseblock"); gettoken(ps, es, 0, 0); cmd = parseline(ps, es); - if(!peek(ps, es, ")")) + if (!peek(ps, es, ")")) panic("syntax - missing )"); gettoken(ps, es, 0, 0); cmd = parseredirs(cmd, ps, es); return cmd; } -struct cmd* +struct cmd * parseexec(char **ps, char *es) { char *q, *eq; @@ -420,23 +439,24 @@ parseexec(char **ps, char *es) struct execcmd *cmd; struct cmd *ret; - if(peek(ps, es, "(")) + if (peek(ps, es, "(")) return parseblock(ps, es); ret = execcmd(); - cmd = (struct execcmd*)ret; + cmd = (struct execcmd *)ret; argc = 0; ret = parseredirs(ret, ps, es); - while(!peek(ps, es, "|)&;")){ - if((tok=gettoken(ps, es, &q, &eq)) == 0) + while (!peek(ps, es, "|)&;")) + { + if ((tok = gettoken(ps, es, &q, &eq)) == 0) break; - if(tok != 'a') + if (tok != 'a') panic("syntax"); cmd->argv[argc] = q; cmd->eargv[argc] = eq; argc++; - if(argc >= MAXARGS) + if (argc >= MAXARGS) panic("too many args"); ret = parseredirs(ret, ps, es); } @@ -446,7 +466,7 @@ parseexec(char **ps, char *es) } // NUL-terminate all the counted strings. -struct cmd* +struct cmd * nulterminate(struct cmd *cmd) { int i; @@ -456,36 +476,37 @@ nulterminate(struct cmd *cmd) struct pipecmd *pcmd; struct redircmd *rcmd; - if(cmd == 0) + if (cmd == 0) return 0; - switch(cmd->type){ + switch (cmd->type) + { case EXEC: - ecmd = (struct execcmd*)cmd; - for(i=0; ecmd->argv[i]; i++) + ecmd = (struct execcmd *)cmd; + for (i = 0; ecmd->argv[i]; i++) *ecmd->eargv[i] = 0; break; case REDIR: - rcmd = (struct redircmd*)cmd; + rcmd = (struct redircmd *)cmd; nulterminate(rcmd->cmd); *rcmd->efile = 0; break; case PIPE: - pcmd = (struct pipecmd*)cmd; + pcmd = (struct pipecmd *)cmd; nulterminate(pcmd->left); nulterminate(pcmd->right); break; case LIST: - lcmd = (struct listcmd*)cmd; + lcmd = (struct listcmd *)cmd; nulterminate(lcmd->left); nulterminate(lcmd->right); break; case BACK: - bcmd = (struct backcmd*)cmd; + bcmd = (struct backcmd *)cmd; nulterminate(bcmd->cmd); break; } diff --git a/sh.d b/sh.d new file mode 100644 index 0000000000..51ddf2d90e --- /dev/null +++ b/sh.d @@ -0,0 +1 @@ +sh.o: sh.c /usr/include/stdc-predef.h types.h user.h fcntl.h diff --git a/sh.o b/sh.o new file mode 100644 index 0000000000..c5ff1f034e Binary files /dev/null and b/sh.o differ diff --git a/sh.sym b/sh.sym new file mode 100644 index 0000000000..ed3bbb3d83 --- /dev/null +++ b/sh.sym @@ -0,0 +1,79 @@ +00000000 .text +000012b8 .rodata +000013b8 .eh_frame +00001938 .data +00001960 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 sh.c +00001960 buf.1392 +00000000 ulib.c +00000000 printf.c +00000eb0 printint +000013a7 digits.1354 +00000000 umalloc.c +000019c4 freep +000019c8 base +00000be0 strcpy +00000f50 printf +00000dd0 memmove +00000e4a mknod +00000380 execcmd +00000cf0 gets +00000e82 getpid +000008b0 parsepipe +00000b60 parsecmd +000004c0 backcmd +00000650 peek +000006b0 parseredirs +00000510 gettoken +000011d0 malloc +00000e92 sleep +00001940 whitespace +000001a0 fork1 +00000ab0 nulterminate +00000e12 pipe +00000110 getcmd +00000e22 write +00000e5a fstat +00000e32 kill +00000e72 chdir +00000930 parseline +000001c0 runcmd +000009f0 parseblock +00000e3a exec +00000e0a wait +00001938 symbols +00000e1a read +00000790 parseexec +00000e52 unlink +00000170 panic +00000dfa fork +00000e8a sbrk +00000e9a uptime +00001946 __bss_start +00000c90 memset +00000000 main +00000c10 strcmp +00000e7a dup +00000420 pipecmd +000003c0 redircmd +00000d50 stat +00001946 _edata +000019d0 _end +00000e62 link +00000e02 exit +00000da0 atoi +00000c60 strlen +00000e42 open +00000cb0 strchr +00000e6a mkdir +00000e2a close +00000470 listcmd +00001140 free diff --git a/sleeplock.d b/sleeplock.d new file mode 100644 index 0000000000..e50551aeb6 --- /dev/null +++ b/sleeplock.d @@ -0,0 +1,2 @@ +sleeplock.o: sleeplock.c /usr/include/stdc-predef.h types.h defs.h \ + param.h x86.h memlayout.h mmu.h proc.h spinlock.h sleeplock.h diff --git a/sleeplock.o b/sleeplock.o new file mode 100644 index 0000000000..6c3c28ca98 Binary files /dev/null and b/sleeplock.o differ diff --git a/spinlock.d b/spinlock.d new file mode 100644 index 0000000000..9f70952627 --- /dev/null +++ b/spinlock.d @@ -0,0 +1,2 @@ +spinlock.o: spinlock.c /usr/include/stdc-predef.h types.h defs.h param.h \ + x86.h memlayout.h mmu.h proc.h spinlock.h diff --git a/spinlock.o b/spinlock.o new file mode 100644 index 0000000000..2a504a051e Binary files /dev/null and b/spinlock.o differ diff --git a/stressfs.asm b/stressfs.asm new file mode 100644 index 0000000000..fe50684e6a --- /dev/null +++ b/stressfs.asm @@ -0,0 +1,1208 @@ + +_stressfs: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "user.h" +#include "fs.h" +#include "fcntl.h" + +int main(int argc, char *argv[]) +{ + 0: 55 push %ebp + int fd, i; + char path[] = "stressfs0"; + 1: b8 30 00 00 00 mov $0x30,%eax +{ + 6: 89 e5 mov %esp,%ebp + 8: 57 push %edi + 9: 56 push %esi + a: 53 push %ebx + char data[512]; + + printf(1, "stressfs starting\n"); + memset(data, 'a', sizeof(data)); + + for (i = 0; i < 4; i++) + b: 31 db xor %ebx,%ebx +{ + d: 83 e4 f0 and $0xfffffff0,%esp + 10: 81 ec 20 02 00 00 sub $0x220,%esp + printf(1, "stressfs starting\n"); + 16: c7 44 24 04 16 08 00 movl $0x816,0x4(%esp) + 1d: 00 + memset(data, 'a', sizeof(data)); + 1e: 8d 74 24 20 lea 0x20(%esp),%esi + printf(1, "stressfs starting\n"); + 22: c7 04 24 01 00 00 00 movl $0x1,(%esp) + char path[] = "stressfs0"; + 29: 66 89 44 24 1e mov %ax,0x1e(%esp) + 2e: c7 44 24 16 73 74 72 movl $0x65727473,0x16(%esp) + 35: 65 + 36: c7 44 24 1a 73 73 66 movl $0x73667373,0x1a(%esp) + 3d: 73 + printf(1, "stressfs starting\n"); + 3e: e8 6d 04 00 00 call 4b0 + memset(data, 'a', sizeof(data)); + 43: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + 4a: 00 + 4b: c7 44 24 04 61 00 00 movl $0x61,0x4(%esp) + 52: 00 + 53: 89 34 24 mov %esi,(%esp) + 56: e8 95 01 00 00 call 1f0 + if (fork() > 0) + 5b: e8 fa 02 00 00 call 35a + 60: 85 c0 test %eax,%eax + 62: 0f 8f d1 00 00 00 jg 139 + for (i = 0; i < 4; i++) + 68: 83 c3 01 add $0x1,%ebx + 6b: 83 fb 04 cmp $0x4,%ebx + 6e: 75 eb jne 5b + 70: bf 04 00 00 00 mov $0x4,%edi + break; + + printf(1, "write %d\n", i); + 75: 89 5c 24 08 mov %ebx,0x8(%esp) + + path[8] += i; + fd = open(path, O_CREATE | O_RDWR); + 79: bb 14 00 00 00 mov $0x14,%ebx + printf(1, "write %d\n", i); + 7e: c7 44 24 04 29 08 00 movl $0x829,0x4(%esp) + 85: 00 + 86: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 8d: e8 1e 04 00 00 call 4b0 + path[8] += i; + 92: 89 f8 mov %edi,%eax + 94: 00 44 24 1e add %al,0x1e(%esp) + fd = open(path, O_CREATE | O_RDWR); + 98: 8d 44 24 16 lea 0x16(%esp),%eax + 9c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + a3: 00 + a4: 89 04 24 mov %eax,(%esp) + a7: e8 f6 02 00 00 call 3a2 + ac: 89 c7 mov %eax,%edi + ae: 66 90 xchg %ax,%ax + for (i = 0; i < 20; i++) + // printf(fd, "%d\n", i); + write(fd, data, sizeof(data)); + b0: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + b7: 00 + b8: 89 74 24 04 mov %esi,0x4(%esp) + bc: 89 3c 24 mov %edi,(%esp) + bf: e8 be 02 00 00 call 382 + for (i = 0; i < 20; i++) + c4: 83 eb 01 sub $0x1,%ebx + c7: 75 e7 jne b0 + close(fd); + c9: 89 3c 24 mov %edi,(%esp) + + printf(1, "read\n"); + + fd = open(path, O_RDONLY); + cc: bb 14 00 00 00 mov $0x14,%ebx + close(fd); + d1: e8 b4 02 00 00 call 38a + printf(1, "read\n"); + d6: c7 44 24 04 33 08 00 movl $0x833,0x4(%esp) + dd: 00 + de: c7 04 24 01 00 00 00 movl $0x1,(%esp) + e5: e8 c6 03 00 00 call 4b0 + fd = open(path, O_RDONLY); + ea: 8d 44 24 16 lea 0x16(%esp),%eax + ee: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + f5: 00 + f6: 89 04 24 mov %eax,(%esp) + f9: e8 a4 02 00 00 call 3a2 + fe: 89 c7 mov %eax,%edi + for (i = 0; i < 20; i++) + read(fd, data, sizeof(data)); + 100: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + 107: 00 + 108: 89 74 24 04 mov %esi,0x4(%esp) + 10c: 89 3c 24 mov %edi,(%esp) + 10f: e8 66 02 00 00 call 37a + for (i = 0; i < 20; i++) + 114: 83 eb 01 sub $0x1,%ebx + 117: 75 e7 jne 100 + close(fd); + 119: 89 3c 24 mov %edi,(%esp) + 11c: e8 69 02 00 00 call 38a + + wait(0); + 121: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 128: e8 3d 02 00 00 call 36a + ; + + exit(0); + 12d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 134: e8 29 02 00 00 call 362 + 139: 89 df mov %ebx,%edi + 13b: e9 35 ff ff ff jmp 75 + +00000140 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 8b 45 08 mov 0x8(%ebp),%eax + 146: 8b 4d 0c mov 0xc(%ebp),%ecx + 149: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 14a: 89 c2 mov %eax,%edx + 14c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 150: 83 c1 01 add $0x1,%ecx + 153: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 157: 83 c2 01 add $0x1,%edx + 15a: 84 db test %bl,%bl + 15c: 88 5a ff mov %bl,-0x1(%edx) + 15f: 75 ef jne 150 + ; + return os; +} + 161: 5b pop %ebx + 162: 5d pop %ebp + 163: c3 ret + 164: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 16a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000170 : + +int +strcmp(const char *p, const char *q) +{ + 170: 55 push %ebp + 171: 89 e5 mov %esp,%ebp + 173: 8b 55 08 mov 0x8(%ebp),%edx + 176: 53 push %ebx + 177: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 17a: 0f b6 02 movzbl (%edx),%eax + 17d: 84 c0 test %al,%al + 17f: 74 2d je 1ae + 181: 0f b6 19 movzbl (%ecx),%ebx + 184: 38 d8 cmp %bl,%al + 186: 74 0e je 196 + 188: eb 2b jmp 1b5 + 18a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 190: 38 c8 cmp %cl,%al + 192: 75 15 jne 1a9 + p++, q++; + 194: 89 d9 mov %ebx,%ecx + 196: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 199: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 19c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 19f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 1a3: 84 c0 test %al,%al + 1a5: 75 e9 jne 190 + 1a7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 1a9: 29 c8 sub %ecx,%eax +} + 1ab: 5b pop %ebx + 1ac: 5d pop %ebp + 1ad: c3 ret + 1ae: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 1b1: 31 c0 xor %eax,%eax + 1b3: eb f4 jmp 1a9 + 1b5: 0f b6 cb movzbl %bl,%ecx + 1b8: eb ef jmp 1a9 + 1ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000001c0 : + +uint +strlen(const char *s) +{ + 1c0: 55 push %ebp + 1c1: 89 e5 mov %esp,%ebp + 1c3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 1c6: 80 39 00 cmpb $0x0,(%ecx) + 1c9: 74 12 je 1dd + 1cb: 31 d2 xor %edx,%edx + 1cd: 8d 76 00 lea 0x0(%esi),%esi + 1d0: 83 c2 01 add $0x1,%edx + 1d3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 1d7: 89 d0 mov %edx,%eax + 1d9: 75 f5 jne 1d0 + ; + return n; +} + 1db: 5d pop %ebp + 1dc: c3 ret + for(n = 0; s[n]; n++) + 1dd: 31 c0 xor %eax,%eax +} + 1df: 5d pop %ebp + 1e0: c3 ret + 1e1: eb 0d jmp 1f0 + 1e3: 90 nop + 1e4: 90 nop + 1e5: 90 nop + 1e6: 90 nop + 1e7: 90 nop + 1e8: 90 nop + 1e9: 90 nop + 1ea: 90 nop + 1eb: 90 nop + 1ec: 90 nop + 1ed: 90 nop + 1ee: 90 nop + 1ef: 90 nop + +000001f0 : + +void* +memset(void *dst, int c, uint n) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 8b 55 08 mov 0x8(%ebp),%edx + 1f6: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 1f7: 8b 4d 10 mov 0x10(%ebp),%ecx + 1fa: 8b 45 0c mov 0xc(%ebp),%eax + 1fd: 89 d7 mov %edx,%edi + 1ff: fc cld + 200: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 202: 89 d0 mov %edx,%eax + 204: 5f pop %edi + 205: 5d pop %ebp + 206: c3 ret + 207: 89 f6 mov %esi,%esi + 209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000210 : + +char* +strchr(const char *s, char c) +{ + 210: 55 push %ebp + 211: 89 e5 mov %esp,%ebp + 213: 8b 45 08 mov 0x8(%ebp),%eax + 216: 53 push %ebx + 217: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 21a: 0f b6 18 movzbl (%eax),%ebx + 21d: 84 db test %bl,%bl + 21f: 74 1d je 23e + if(*s == c) + 221: 38 d3 cmp %dl,%bl + 223: 89 d1 mov %edx,%ecx + 225: 75 0d jne 234 + 227: eb 17 jmp 240 + 229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 230: 38 ca cmp %cl,%dl + 232: 74 0c je 240 + for(; *s; s++) + 234: 83 c0 01 add $0x1,%eax + 237: 0f b6 10 movzbl (%eax),%edx + 23a: 84 d2 test %dl,%dl + 23c: 75 f2 jne 230 + return (char*)s; + return 0; + 23e: 31 c0 xor %eax,%eax +} + 240: 5b pop %ebx + 241: 5d pop %ebp + 242: c3 ret + 243: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000250 : + +char* +gets(char *buf, int max) +{ + 250: 55 push %ebp + 251: 89 e5 mov %esp,%ebp + 253: 57 push %edi + 254: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 255: 31 f6 xor %esi,%esi +{ + 257: 53 push %ebx + 258: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 25b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 25e: eb 31 jmp 291 + cc = read(0, &c, 1); + 260: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 267: 00 + 268: 89 7c 24 04 mov %edi,0x4(%esp) + 26c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 273: e8 02 01 00 00 call 37a + if(cc < 1) + 278: 85 c0 test %eax,%eax + 27a: 7e 1d jle 299 + break; + buf[i++] = c; + 27c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 280: 89 de mov %ebx,%esi + buf[i++] = c; + 282: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 285: 3c 0d cmp $0xd,%al + buf[i++] = c; + 287: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 28b: 74 0c je 299 + 28d: 3c 0a cmp $0xa,%al + 28f: 74 08 je 299 + for(i=0; i+1 < max; ){ + 291: 8d 5e 01 lea 0x1(%esi),%ebx + 294: 3b 5d 0c cmp 0xc(%ebp),%ebx + 297: 7c c7 jl 260 + break; + } + buf[i] = '\0'; + 299: 8b 45 08 mov 0x8(%ebp),%eax + 29c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 2a0: 83 c4 2c add $0x2c,%esp + 2a3: 5b pop %ebx + 2a4: 5e pop %esi + 2a5: 5f pop %edi + 2a6: 5d pop %ebp + 2a7: c3 ret + 2a8: 90 nop + 2a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000002b0 : + +int +stat(const char *n, struct stat *st) +{ + 2b0: 55 push %ebp + 2b1: 89 e5 mov %esp,%ebp + 2b3: 56 push %esi + 2b4: 53 push %ebx + 2b5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 2b8: 8b 45 08 mov 0x8(%ebp),%eax + 2bb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2c2: 00 + 2c3: 89 04 24 mov %eax,(%esp) + 2c6: e8 d7 00 00 00 call 3a2 + if(fd < 0) + 2cb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 2cd: 89 c3 mov %eax,%ebx + if(fd < 0) + 2cf: 78 27 js 2f8 + return -1; + r = fstat(fd, st); + 2d1: 8b 45 0c mov 0xc(%ebp),%eax + 2d4: 89 1c 24 mov %ebx,(%esp) + 2d7: 89 44 24 04 mov %eax,0x4(%esp) + 2db: e8 da 00 00 00 call 3ba + close(fd); + 2e0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 2e3: 89 c6 mov %eax,%esi + close(fd); + 2e5: e8 a0 00 00 00 call 38a + return r; + 2ea: 89 f0 mov %esi,%eax +} + 2ec: 83 c4 10 add $0x10,%esp + 2ef: 5b pop %ebx + 2f0: 5e pop %esi + 2f1: 5d pop %ebp + 2f2: c3 ret + 2f3: 90 nop + 2f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 2f8: b8 ff ff ff ff mov $0xffffffff,%eax + 2fd: eb ed jmp 2ec + 2ff: 90 nop + +00000300 : + +int +atoi(const char *s) +{ + 300: 55 push %ebp + 301: 89 e5 mov %esp,%ebp + 303: 8b 4d 08 mov 0x8(%ebp),%ecx + 306: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 307: 0f be 11 movsbl (%ecx),%edx + 30a: 8d 42 d0 lea -0x30(%edx),%eax + 30d: 3c 09 cmp $0x9,%al + n = 0; + 30f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 314: 77 17 ja 32d + 316: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 318: 83 c1 01 add $0x1,%ecx + 31b: 8d 04 80 lea (%eax,%eax,4),%eax + 31e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 322: 0f be 11 movsbl (%ecx),%edx + 325: 8d 5a d0 lea -0x30(%edx),%ebx + 328: 80 fb 09 cmp $0x9,%bl + 32b: 76 eb jbe 318 + return n; +} + 32d: 5b pop %ebx + 32e: 5d pop %ebp + 32f: c3 ret + +00000330 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 330: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 331: 31 d2 xor %edx,%edx +{ + 333: 89 e5 mov %esp,%ebp + 335: 56 push %esi + 336: 8b 45 08 mov 0x8(%ebp),%eax + 339: 53 push %ebx + 33a: 8b 5d 10 mov 0x10(%ebp),%ebx + 33d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 340: 85 db test %ebx,%ebx + 342: 7e 12 jle 356 + 344: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 348: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 34c: 88 0c 10 mov %cl,(%eax,%edx,1) + 34f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 352: 39 da cmp %ebx,%edx + 354: 75 f2 jne 348 + return vdst; +} + 356: 5b pop %ebx + 357: 5e pop %esi + 358: 5d pop %ebp + 359: c3 ret + +0000035a : + 35a: b8 01 00 00 00 mov $0x1,%eax + 35f: cd 40 int $0x40 + 361: c3 ret + +00000362 : + 362: b8 02 00 00 00 mov $0x2,%eax + 367: cd 40 int $0x40 + 369: c3 ret + +0000036a : + 36a: b8 03 00 00 00 mov $0x3,%eax + 36f: cd 40 int $0x40 + 371: c3 ret + +00000372 : + 372: b8 04 00 00 00 mov $0x4,%eax + 377: cd 40 int $0x40 + 379: c3 ret + +0000037a : + 37a: b8 05 00 00 00 mov $0x5,%eax + 37f: cd 40 int $0x40 + 381: c3 ret + +00000382 : + 382: b8 10 00 00 00 mov $0x10,%eax + 387: cd 40 int $0x40 + 389: c3 ret + +0000038a : + 38a: b8 15 00 00 00 mov $0x15,%eax + 38f: cd 40 int $0x40 + 391: c3 ret + +00000392 : + 392: b8 06 00 00 00 mov $0x6,%eax + 397: cd 40 int $0x40 + 399: c3 ret + +0000039a : + 39a: b8 07 00 00 00 mov $0x7,%eax + 39f: cd 40 int $0x40 + 3a1: c3 ret + +000003a2 : + 3a2: b8 0f 00 00 00 mov $0xf,%eax + 3a7: cd 40 int $0x40 + 3a9: c3 ret + +000003aa : + 3aa: b8 11 00 00 00 mov $0x11,%eax + 3af: cd 40 int $0x40 + 3b1: c3 ret + +000003b2 : + 3b2: b8 12 00 00 00 mov $0x12,%eax + 3b7: cd 40 int $0x40 + 3b9: c3 ret + +000003ba : + 3ba: b8 08 00 00 00 mov $0x8,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + +000003c2 : + 3c2: b8 13 00 00 00 mov $0x13,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + +000003ca : + 3ca: b8 14 00 00 00 mov $0x14,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + +000003d2 : + 3d2: b8 09 00 00 00 mov $0x9,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + +000003da : + 3da: b8 0a 00 00 00 mov $0xa,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + +000003e2 : + 3e2: b8 0b 00 00 00 mov $0xb,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + +000003ea : + 3ea: b8 0c 00 00 00 mov $0xc,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + +000003f2 : + 3f2: b8 0d 00 00 00 mov $0xd,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + +000003fa : + 3fa: b8 0e 00 00 00 mov $0xe,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret + 402: 66 90 xchg %ax,%ax + 404: 66 90 xchg %ax,%ax + 406: 66 90 xchg %ax,%ax + 408: 66 90 xchg %ax,%ax + 40a: 66 90 xchg %ax,%ax + 40c: 66 90 xchg %ax,%ax + 40e: 66 90 xchg %ax,%ax + +00000410 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 410: 55 push %ebp + 411: 89 e5 mov %esp,%ebp + 413: 57 push %edi + 414: 56 push %esi + 415: 89 c6 mov %eax,%esi + 417: 53 push %ebx + 418: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 41b: 8b 5d 08 mov 0x8(%ebp),%ebx + 41e: 85 db test %ebx,%ebx + 420: 74 09 je 42b + 422: 89 d0 mov %edx,%eax + 424: c1 e8 1f shr $0x1f,%eax + 427: 84 c0 test %al,%al + 429: 75 75 jne 4a0 + neg = 1; + x = -xx; + } else { + x = xx; + 42b: 89 d0 mov %edx,%eax + neg = 0; + 42d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 434: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 437: 31 ff xor %edi,%edi + 439: 89 ce mov %ecx,%esi + 43b: 8d 5d d7 lea -0x29(%ebp),%ebx + 43e: eb 02 jmp 442 + do{ + buf[i++] = digits[x % base]; + 440: 89 cf mov %ecx,%edi + 442: 31 d2 xor %edx,%edx + 444: f7 f6 div %esi + 446: 8d 4f 01 lea 0x1(%edi),%ecx + 449: 0f b6 92 40 08 00 00 movzbl 0x840(%edx),%edx + }while((x /= base) != 0); + 450: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 452: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 455: 75 e9 jne 440 + if(neg) + 457: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 45a: 89 c8 mov %ecx,%eax + 45c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 45f: 85 d2 test %edx,%edx + 461: 74 08 je 46b + buf[i++] = '-'; + 463: 8d 4f 02 lea 0x2(%edi),%ecx + 466: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 46b: 8d 79 ff lea -0x1(%ecx),%edi + 46e: 66 90 xchg %ax,%ax + 470: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 475: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 478: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 47f: 00 + 480: 89 5c 24 04 mov %ebx,0x4(%esp) + 484: 89 34 24 mov %esi,(%esp) + 487: 88 45 d7 mov %al,-0x29(%ebp) + 48a: e8 f3 fe ff ff call 382 + while(--i >= 0) + 48f: 83 ff ff cmp $0xffffffff,%edi + 492: 75 dc jne 470 + putc(fd, buf[i]); +} + 494: 83 c4 4c add $0x4c,%esp + 497: 5b pop %ebx + 498: 5e pop %esi + 499: 5f pop %edi + 49a: 5d pop %ebp + 49b: c3 ret + 49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 4a0: 89 d0 mov %edx,%eax + 4a2: f7 d8 neg %eax + neg = 1; + 4a4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 4ab: eb 87 jmp 434 + 4ad: 8d 76 00 lea 0x0(%esi),%esi + +000004b0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 4b0: 55 push %ebp + 4b1: 89 e5 mov %esp,%ebp + 4b3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 4b4: 31 ff xor %edi,%edi +{ + 4b6: 56 push %esi + 4b7: 53 push %ebx + 4b8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 4bb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 4be: 8d 45 10 lea 0x10(%ebp),%eax +{ + 4c1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 4c4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 4c7: 0f b6 13 movzbl (%ebx),%edx + 4ca: 83 c3 01 add $0x1,%ebx + 4cd: 84 d2 test %dl,%dl + 4cf: 75 39 jne 50a + 4d1: e9 c2 00 00 00 jmp 598 + 4d6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 4d8: 83 fa 25 cmp $0x25,%edx + 4db: 0f 84 bf 00 00 00 je 5a0 + write(fd, &c, 1); + 4e1: 8d 45 e2 lea -0x1e(%ebp),%eax + 4e4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4eb: 00 + 4ec: 89 44 24 04 mov %eax,0x4(%esp) + 4f0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 4f3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 4f6: e8 87 fe ff ff call 382 + 4fb: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 4fe: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 502: 84 d2 test %dl,%dl + 504: 0f 84 8e 00 00 00 je 598 + if(state == 0){ + 50a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 50c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 50f: 74 c7 je 4d8 + } + } else if(state == '%'){ + 511: 83 ff 25 cmp $0x25,%edi + 514: 75 e5 jne 4fb + if(c == 'd'){ + 516: 83 fa 64 cmp $0x64,%edx + 519: 0f 84 31 01 00 00 je 650 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 51f: 25 f7 00 00 00 and $0xf7,%eax + 524: 83 f8 70 cmp $0x70,%eax + 527: 0f 84 83 00 00 00 je 5b0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 52d: 83 fa 73 cmp $0x73,%edx + 530: 0f 84 a2 00 00 00 je 5d8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 536: 83 fa 63 cmp $0x63,%edx + 539: 0f 84 35 01 00 00 je 674 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 53f: 83 fa 25 cmp $0x25,%edx + 542: 0f 84 e0 00 00 00 je 628 + write(fd, &c, 1); + 548: 8d 45 e6 lea -0x1a(%ebp),%eax + 54b: 83 c3 01 add $0x1,%ebx + 54e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 555: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 556: 31 ff xor %edi,%edi + write(fd, &c, 1); + 558: 89 44 24 04 mov %eax,0x4(%esp) + 55c: 89 34 24 mov %esi,(%esp) + 55f: 89 55 d0 mov %edx,-0x30(%ebp) + 562: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 566: e8 17 fe ff ff call 382 + putc(fd, c); + 56b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 56e: 8d 45 e7 lea -0x19(%ebp),%eax + 571: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 578: 00 + 579: 89 44 24 04 mov %eax,0x4(%esp) + 57d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 580: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 583: e8 fa fd ff ff call 382 + for(i = 0; fmt[i]; i++){ + 588: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 58c: 84 d2 test %dl,%dl + 58e: 0f 85 76 ff ff ff jne 50a + 594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 598: 83 c4 3c add $0x3c,%esp + 59b: 5b pop %ebx + 59c: 5e pop %esi + 59d: 5f pop %edi + 59e: 5d pop %ebp + 59f: c3 ret + state = '%'; + 5a0: bf 25 00 00 00 mov $0x25,%edi + 5a5: e9 51 ff ff ff jmp 4fb + 5aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 5b0: 8b 45 d4 mov -0x2c(%ebp),%eax + 5b3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 5b8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 5ba: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 5c1: 8b 10 mov (%eax),%edx + 5c3: 89 f0 mov %esi,%eax + 5c5: e8 46 fe ff ff call 410 + ap++; + 5ca: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 5ce: e9 28 ff ff ff jmp 4fb + 5d3: 90 nop + 5d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 5d8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 5db: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 5df: 8b 38 mov (%eax),%edi + s = "(null)"; + 5e1: b8 39 08 00 00 mov $0x839,%eax + 5e6: 85 ff test %edi,%edi + 5e8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 5eb: 0f b6 07 movzbl (%edi),%eax + 5ee: 84 c0 test %al,%al + 5f0: 74 2a je 61c + 5f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 5f8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 5fb: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 5fe: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 601: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 608: 00 + 609: 89 44 24 04 mov %eax,0x4(%esp) + 60d: 89 34 24 mov %esi,(%esp) + 610: e8 6d fd ff ff call 382 + while(*s != 0){ + 615: 0f b6 07 movzbl (%edi),%eax + 618: 84 c0 test %al,%al + 61a: 75 dc jne 5f8 + state = 0; + 61c: 31 ff xor %edi,%edi + 61e: e9 d8 fe ff ff jmp 4fb + 623: 90 nop + 624: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 628: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 62b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 62d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 634: 00 + 635: 89 44 24 04 mov %eax,0x4(%esp) + 639: 89 34 24 mov %esi,(%esp) + 63c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 640: e8 3d fd ff ff call 382 + 645: e9 b1 fe ff ff jmp 4fb + 64a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 650: 8b 45 d4 mov -0x2c(%ebp),%eax + 653: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 658: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 65b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 662: 8b 10 mov (%eax),%edx + 664: 89 f0 mov %esi,%eax + 666: e8 a5 fd ff ff call 410 + ap++; + 66b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 66f: e9 87 fe ff ff jmp 4fb + putc(fd, *ap); + 674: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 677: 31 ff xor %edi,%edi + putc(fd, *ap); + 679: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 67b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 682: 00 + 683: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 686: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 689: 8d 45 e4 lea -0x1c(%ebp),%eax + 68c: 89 44 24 04 mov %eax,0x4(%esp) + 690: e8 ed fc ff ff call 382 + ap++; + 695: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 699: e9 5d fe ff ff jmp 4fb + 69e: 66 90 xchg %ax,%ax + +000006a0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 6a0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6a1: a1 bc 0a 00 00 mov 0xabc,%eax +{ + 6a6: 89 e5 mov %esp,%ebp + 6a8: 57 push %edi + 6a9: 56 push %esi + 6aa: 53 push %ebx + 6ab: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6ae: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 6b0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6b3: 39 d0 cmp %edx,%eax + 6b5: 72 11 jb 6c8 + 6b7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6b8: 39 c8 cmp %ecx,%eax + 6ba: 72 04 jb 6c0 + 6bc: 39 ca cmp %ecx,%edx + 6be: 72 10 jb 6d0 + 6c0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6c2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6c4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 6c6: 73 f0 jae 6b8 + 6c8: 39 ca cmp %ecx,%edx + 6ca: 72 04 jb 6d0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 6cc: 39 c8 cmp %ecx,%eax + 6ce: 72 f0 jb 6c0 + break; + if(bp + bp->s.size == p->s.ptr){ + 6d0: 8b 73 fc mov -0x4(%ebx),%esi + 6d3: 8d 3c f2 lea (%edx,%esi,8),%edi + 6d6: 39 cf cmp %ecx,%edi + 6d8: 74 1e je 6f8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 6da: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 6dd: 8b 48 04 mov 0x4(%eax),%ecx + 6e0: 8d 34 c8 lea (%eax,%ecx,8),%esi + 6e3: 39 f2 cmp %esi,%edx + 6e5: 74 28 je 70f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 6e7: 89 10 mov %edx,(%eax) + freep = p; + 6e9: a3 bc 0a 00 00 mov %eax,0xabc +} + 6ee: 5b pop %ebx + 6ef: 5e pop %esi + 6f0: 5f pop %edi + 6f1: 5d pop %ebp + 6f2: c3 ret + 6f3: 90 nop + 6f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 6f8: 03 71 04 add 0x4(%ecx),%esi + 6fb: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 6fe: 8b 08 mov (%eax),%ecx + 700: 8b 09 mov (%ecx),%ecx + 702: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 705: 8b 48 04 mov 0x4(%eax),%ecx + 708: 8d 34 c8 lea (%eax,%ecx,8),%esi + 70b: 39 f2 cmp %esi,%edx + 70d: 75 d8 jne 6e7 + p->s.size += bp->s.size; + 70f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 712: a3 bc 0a 00 00 mov %eax,0xabc + p->s.size += bp->s.size; + 717: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 71a: 8b 53 f8 mov -0x8(%ebx),%edx + 71d: 89 10 mov %edx,(%eax) +} + 71f: 5b pop %ebx + 720: 5e pop %esi + 721: 5f pop %edi + 722: 5d pop %ebp + 723: c3 ret + 724: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 72a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000730 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 730: 55 push %ebp + 731: 89 e5 mov %esp,%ebp + 733: 57 push %edi + 734: 56 push %esi + 735: 53 push %ebx + 736: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 739: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 73c: 8b 1d bc 0a 00 00 mov 0xabc,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 742: 8d 48 07 lea 0x7(%eax),%ecx + 745: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 748: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 74a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 74d: 0f 84 9b 00 00 00 je 7ee + 753: 8b 13 mov (%ebx),%edx + 755: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 758: 39 fe cmp %edi,%esi + 75a: 76 64 jbe 7c0 + 75c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 763: bb 00 80 00 00 mov $0x8000,%ebx + 768: 89 45 e4 mov %eax,-0x1c(%ebp) + 76b: eb 0e jmp 77b + 76d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 770: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 772: 8b 78 04 mov 0x4(%eax),%edi + 775: 39 fe cmp %edi,%esi + 777: 76 4f jbe 7c8 + 779: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 77b: 3b 15 bc 0a 00 00 cmp 0xabc,%edx + 781: 75 ed jne 770 + if(nu < 4096) + 783: 8b 45 e4 mov -0x1c(%ebp),%eax + 786: 81 fe 00 10 00 00 cmp $0x1000,%esi + 78c: bf 00 10 00 00 mov $0x1000,%edi + 791: 0f 43 fe cmovae %esi,%edi + 794: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 797: 89 04 24 mov %eax,(%esp) + 79a: e8 4b fc ff ff call 3ea + if(p == (char*)-1) + 79f: 83 f8 ff cmp $0xffffffff,%eax + 7a2: 74 18 je 7bc + hp->s.size = nu; + 7a4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 7a7: 83 c0 08 add $0x8,%eax + 7aa: 89 04 24 mov %eax,(%esp) + 7ad: e8 ee fe ff ff call 6a0 + return freep; + 7b2: 8b 15 bc 0a 00 00 mov 0xabc,%edx + if((p = morecore(nunits)) == 0) + 7b8: 85 d2 test %edx,%edx + 7ba: 75 b4 jne 770 + return 0; + 7bc: 31 c0 xor %eax,%eax + 7be: eb 20 jmp 7e0 + if(p->s.size >= nunits){ + 7c0: 89 d0 mov %edx,%eax + 7c2: 89 da mov %ebx,%edx + 7c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 7c8: 39 fe cmp %edi,%esi + 7ca: 74 1c je 7e8 + p->s.size -= nunits; + 7cc: 29 f7 sub %esi,%edi + 7ce: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 7d1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 7d4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 7d7: 89 15 bc 0a 00 00 mov %edx,0xabc + return (void*)(p + 1); + 7dd: 83 c0 08 add $0x8,%eax + } +} + 7e0: 83 c4 1c add $0x1c,%esp + 7e3: 5b pop %ebx + 7e4: 5e pop %esi + 7e5: 5f pop %edi + 7e6: 5d pop %ebp + 7e7: c3 ret + prevp->s.ptr = p->s.ptr; + 7e8: 8b 08 mov (%eax),%ecx + 7ea: 89 0a mov %ecx,(%edx) + 7ec: eb e9 jmp 7d7 + base.s.ptr = freep = prevp = &base; + 7ee: c7 05 bc 0a 00 00 c0 movl $0xac0,0xabc + 7f5: 0a 00 00 + base.s.size = 0; + 7f8: ba c0 0a 00 00 mov $0xac0,%edx + base.s.ptr = freep = prevp = &base; + 7fd: c7 05 c0 0a 00 00 c0 movl $0xac0,0xac0 + 804: 0a 00 00 + base.s.size = 0; + 807: c7 05 c4 0a 00 00 00 movl $0x0,0xac4 + 80e: 00 00 00 + 811: e9 46 ff ff ff jmp 75c diff --git a/stressfs.c b/stressfs.c index c0a474375a..1e78e1822d 100644 --- a/stressfs.c +++ b/stressfs.c @@ -13,8 +13,7 @@ #include "fs.h" #include "fcntl.h" -int -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int fd, i; char path[] = "stressfs0"; @@ -23,16 +22,16 @@ main(int argc, char *argv[]) printf(1, "stressfs starting\n"); memset(data, 'a', sizeof(data)); - for(i = 0; i < 4; i++) - if(fork() > 0) + for (i = 0; i < 4; i++) + if (fork() > 0) break; printf(1, "write %d\n", i); path[8] += i; fd = open(path, O_CREATE | O_RDWR); - for(i = 0; i < 20; i++) -// printf(fd, "%d\n", i); + for (i = 0; i < 20; i++) + // printf(fd, "%d\n", i); write(fd, data, sizeof(data)); close(fd); @@ -43,7 +42,8 @@ main(int argc, char *argv[]) read(fd, data, sizeof(data)); close(fd); - wait(); + wait(0); + ; - exit(); + exit(0); } diff --git a/stressfs.d b/stressfs.d new file mode 100644 index 0000000000..7d5de54bb3 --- /dev/null +++ b/stressfs.d @@ -0,0 +1,2 @@ +stressfs.o: stressfs.c /usr/include/stdc-predef.h types.h stat.h user.h \ + fs.h fcntl.h diff --git a/stressfs.o b/stressfs.o new file mode 100644 index 0000000000..900a131346 Binary files /dev/null and b/stressfs.o differ diff --git a/stressfs.sym b/stressfs.sym new file mode 100644 index 0000000000..71e8202d5f --- /dev/null +++ b/stressfs.sym @@ -0,0 +1,57 @@ +00000000 .text +00000816 .rodata +00000854 .eh_frame +00000abc .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 stressfs.c +00000000 ulib.c +00000000 printf.c +00000410 printint +00000840 digits.1354 +00000000 umalloc.c +00000abc freep +00000ac0 base +00000140 strcpy +000004b0 printf +00000330 memmove +000003aa mknod +00000250 gets +000003e2 getpid +00000730 malloc +000003f2 sleep +00000372 pipe +00000382 write +000003ba fstat +00000392 kill +000003d2 chdir +0000039a exec +0000036a wait +0000037a read +000003b2 unlink +0000035a fork +000003ea sbrk +000003fa uptime +00000abc __bss_start +000001f0 memset +00000000 main +00000170 strcmp +000003da dup +000002b0 stat +00000abc _edata +00000ac8 _end +000003c2 link +00000362 exit +00000300 atoi +000001c0 strlen +000003a2 open +00000210 strchr +000003ca mkdir +0000038a close +000006a0 free diff --git a/string.d b/string.d new file mode 100644 index 0000000000..68931ed49f --- /dev/null +++ b/string.d @@ -0,0 +1 @@ +string.o: string.c /usr/include/stdc-predef.h types.h x86.h diff --git a/string.o b/string.o new file mode 100644 index 0000000000..19e2652d6d Binary files /dev/null and b/string.o differ diff --git a/swtch.o b/swtch.o new file mode 100644 index 0000000000..aa6f59282e Binary files /dev/null and b/swtch.o differ diff --git a/syscall.d b/syscall.d new file mode 100644 index 0000000000..4649283dc6 --- /dev/null +++ b/syscall.d @@ -0,0 +1,2 @@ +syscall.o: syscall.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h proc.h x86.h syscall.h diff --git a/syscall.o b/syscall.o new file mode 100644 index 0000000000..d15993336a Binary files /dev/null and b/syscall.o differ diff --git a/sysfile.d b/sysfile.d new file mode 100644 index 0000000000..74f1a20723 --- /dev/null +++ b/sysfile.d @@ -0,0 +1,2 @@ +sysfile.o: sysfile.c /usr/include/stdc-predef.h types.h defs.h param.h \ + stat.h mmu.h proc.h fs.h spinlock.h sleeplock.h file.h fcntl.h diff --git a/sysfile.o b/sysfile.o new file mode 100644 index 0000000000..426943d629 Binary files /dev/null and b/sysfile.o differ diff --git a/sysproc.c b/sysproc.c index 0686d295b6..4d73f05d83 100644 --- a/sysproc.c +++ b/sysproc.c @@ -7,67 +7,70 @@ #include "mmu.h" #include "proc.h" -int -sys_fork(void) +int sys_fork(void) { return fork(); } -int -sys_exit(void) +int sys_exit(void) { - exit(); - return 0; // not reached + int status; + argint(0, &status); + exit(status); + return 0; // not reached } -int -sys_wait(void) +int sys_wait(void) { - return wait(); + int *status; + if (argptr(0, (void *)&status, sizeof(status)) < 0) + { + return -1; + } + + return wait(status); } -int -sys_kill(void) +int sys_kill(void) { int pid; - if(argint(0, &pid) < 0) + if (argint(0, &pid) < 0) return -1; return kill(pid); } -int -sys_getpid(void) +int sys_getpid(void) { return myproc()->pid; } -int -sys_sbrk(void) +int sys_sbrk(void) { int addr; int n; - if(argint(0, &n) < 0) + if (argint(0, &n) < 0) return -1; addr = myproc()->sz; - if(growproc(n) < 0) + if (growproc(n) < 0) return -1; return addr; } -int -sys_sleep(void) +int sys_sleep(void) { int n; uint ticks0; - if(argint(0, &n) < 0) + if (argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; - while(ticks - ticks0 < n){ - if(myproc()->killed){ + while (ticks - ticks0 < n) + { + if (myproc()->killed) + { release(&tickslock); return -1; } @@ -79,8 +82,7 @@ sys_sleep(void) // return how many clock tick interrupts have occurred // since start. -int -sys_uptime(void) +int sys_uptime(void) { uint xticks; diff --git a/sysproc.d b/sysproc.d new file mode 100644 index 0000000000..2f26f0c38f --- /dev/null +++ b/sysproc.d @@ -0,0 +1,2 @@ +sysproc.o: sysproc.c /usr/include/stdc-predef.h types.h x86.h defs.h \ + date.h param.h memlayout.h mmu.h proc.h diff --git a/sysproc.o b/sysproc.o new file mode 100644 index 0000000000..0509812431 Binary files /dev/null and b/sysproc.o differ diff --git a/test.c b/test.c new file mode 100644 index 0000000000..702f1876f0 --- /dev/null +++ b/test.c @@ -0,0 +1,8 @@ +#include "types.h" +#include "user.h" + +int main( int argc, char **argv) { + + printf(1, "Hello World!\n"); + exit(0); +} diff --git a/trap.c b/trap.c index 41c66ebf9a..dbc9f6f6d1 100644 --- a/trap.c +++ b/trap.c @@ -38,11 +38,11 @@ trap(struct trapframe *tf) { if(tf->trapno == T_SYSCALL){ if(myproc()->killed) - exit(); + exit(0); myproc()->tf = tf; syscall(); if(myproc()->killed) - exit(); + exit(0); return; } @@ -98,7 +98,7 @@ trap(struct trapframe *tf) // (If it is still executing in the kernel, let it keep running // until it gets to the regular system call return.) if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) - exit(); + exit(0); // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. @@ -108,5 +108,5 @@ trap(struct trapframe *tf) // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) - exit(); + exit(0); } diff --git a/trap.d b/trap.d new file mode 100644 index 0000000000..c48ab899ee --- /dev/null +++ b/trap.d @@ -0,0 +1,2 @@ +trap.o: trap.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h proc.h x86.h traps.h spinlock.h diff --git a/trap.o b/trap.o new file mode 100644 index 0000000000..86a1276fe1 Binary files /dev/null and b/trap.o differ diff --git a/trapasm.o b/trapasm.o new file mode 100644 index 0000000000..124fe2eb68 Binary files /dev/null and b/trapasm.o differ diff --git a/uart.c b/uart.c index b8946da2e4..7de20157d1 100644 --- a/uart.c +++ b/uart.c @@ -12,66 +12,63 @@ #include "proc.h" #include "x86.h" -#define COM1 0x3f8 +#define COM1 0x3f8 -static int uart; // is there a uart? +static int uart; // is there a uart? -void -uartinit(void) +void uartinit(void) { char *p; // Turn off the FIFO - outb(COM1+2, 0); + outb(COM1 + 2, 0); // 9600 baud, 8 data bits, 1 stop bit, parity off. - outb(COM1+3, 0x80); // Unlock divisor - outb(COM1+0, 115200/9600); - outb(COM1+1, 0); - outb(COM1+3, 0x03); // Lock divisor, 8 data bits. - outb(COM1+4, 0); - outb(COM1+1, 0x01); // Enable receive interrupts. + outb(COM1 + 3, 0x80); // Unlock divisor + outb(COM1 + 0, 115200 / 9600); + outb(COM1 + 1, 0); + outb(COM1 + 3, 0x03); // Lock divisor, 8 data bits. + outb(COM1 + 4, 0); + outb(COM1 + 1, 0x01); // Enable receive interrupts. // If status is 0xFF, no serial port. - if(inb(COM1+5) == 0xFF) + if (inb(COM1 + 5) == 0xFF) return; uart = 1; // Acknowledge pre-existing interrupt conditions; // enable interrupts. - inb(COM1+2); - inb(COM1+0); + inb(COM1 + 2); + inb(COM1 + 0); ioapicenable(IRQ_COM1, 0); // Announce that we're here. - for(p="xv6...\n"; *p; p++) + for (p = "xv6...\n"; *p; p++) uartputc(*p); } -void -uartputc(int c) +void uartputc(int c) { int i; - if(!uart) + if (!uart) return; - for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) + for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) microdelay(10); - outb(COM1+0, c); + outb(COM1 + 0, c); } static int uartgetc(void) { - if(!uart) + if (!uart) return -1; - if(!(inb(COM1+5) & 0x01)) + if (!(inb(COM1 + 5) & 0x01)) return -1; - return inb(COM1+0); + return inb(COM1 + 0); } -void -uartintr(void) +void uartintr(void) { consoleintr(uartgetc); } diff --git a/uart.d b/uart.d new file mode 100644 index 0000000000..d156629d51 --- /dev/null +++ b/uart.d @@ -0,0 +1,2 @@ +uart.o: uart.c /usr/include/stdc-predef.h types.h defs.h param.h traps.h \ + spinlock.h sleeplock.h fs.h file.h mmu.h proc.h x86.h diff --git a/uart.o b/uart.o new file mode 100644 index 0000000000..098d4fcee7 Binary files /dev/null and b/uart.o differ diff --git a/ulib.d b/ulib.d new file mode 100644 index 0000000000..61f575ef9e --- /dev/null +++ b/ulib.d @@ -0,0 +1,2 @@ +ulib.o: ulib.c /usr/include/stdc-predef.h types.h stat.h fcntl.h user.h \ + x86.h diff --git a/ulib.o b/ulib.o new file mode 100644 index 0000000000..f1995da4a0 Binary files /dev/null and b/ulib.o differ diff --git a/umalloc.d b/umalloc.d new file mode 100644 index 0000000000..cc1d152496 --- /dev/null +++ b/umalloc.d @@ -0,0 +1,2 @@ +umalloc.o: umalloc.c /usr/include/stdc-predef.h types.h stat.h user.h \ + param.h diff --git a/umalloc.o b/umalloc.o new file mode 100644 index 0000000000..56165e8167 Binary files /dev/null and b/umalloc.o differ diff --git a/user.h b/user.h index 4f99c52ba6..d4d3040e89 100644 --- a/user.h +++ b/user.h @@ -3,37 +3,37 @@ struct rtcdate; // system calls int fork(void); -int exit(void) __attribute__((noreturn)); -int wait(void); -int pipe(int*); -int write(int, const void*, int); -int read(int, void*, int); +int exit(int) __attribute__((noreturn)); +int wait(int *); +int pipe(int *); +int write(int, const void *, int); +int read(int, void *, int); int close(int); int kill(int); -int exec(char*, char**); -int open(const char*, int); -int mknod(const char*, short, short); -int unlink(const char*); -int fstat(int fd, struct stat*); -int link(const char*, const char*); -int mkdir(const char*); -int chdir(const char*); +int exec(char *, char **); +int open(const char *, int); +int mknod(const char *, short, short); +int unlink(const char *); +int fstat(int fd, struct stat *); +int link(const char *, const char *); +int mkdir(const char *); +int chdir(const char *); int dup(int); int getpid(void); -char* sbrk(int); +char *sbrk(int); int sleep(int); int uptime(void); // ulib.c -int stat(const char*, struct stat*); -char* strcpy(char*, const char*); -void *memmove(void*, const void*, int); -char* strchr(const char*, char c); -int strcmp(const char*, const char*); -void printf(int, const char*, ...); -char* gets(char*, int max); -uint strlen(const char*); -void* memset(void*, int, uint); -void* malloc(uint); -void free(void*); -int atoi(const char*); +int stat(const char *, struct stat *); +char *strcpy(char *, const char *); +void *memmove(void *, const void *, int); +char *strchr(const char *, char c); +int strcmp(const char *, const char *); +void printf(int, const char *, ...); +char *gets(char *, int max); +uint strlen(const char *); +void *memset(void *, int, uint); +void *malloc(uint); +void free(void *); +int atoi(const char *); diff --git a/usertests.asm b/usertests.asm new file mode 100644 index 0000000000..f29872bf22 --- /dev/null +++ b/usertests.asm @@ -0,0 +1,6257 @@ + +_usertests: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + randstate = randstate * 1664525 + 1013904223; + return randstate; +} + +int main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp + 6: 83 ec 10 sub $0x10,%esp + printf(1, "usertests starting\n"); + 9: c7 44 24 04 06 54 00 movl $0x5406,0x4(%esp) + 10: 00 + 11: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 18: e8 93 40 00 00 call 40b0 + + if (open("usertests.ran", 0) >= 0) + 1d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 24: 00 + 25: c7 04 24 1a 54 00 00 movl $0x541a,(%esp) + 2c: e8 71 3f 00 00 call 3fa2 + 31: 85 c0 test %eax,%eax + 33: 78 20 js 55 + { + printf(1, "already ran user tests -- rebuild fs.img\n"); + 35: c7 44 24 04 84 5b 00 movl $0x5b84,0x4(%esp) + 3c: 00 + 3d: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 44: e8 67 40 00 00 call 40b0 + exit(0); + 49: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 50: e8 0d 3f 00 00 call 3f62 + } + close(open("usertests.ran", O_CREATE)); + 55: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 5c: 00 + 5d: c7 04 24 1a 54 00 00 movl $0x541a,(%esp) + 64: e8 39 3f 00 00 call 3fa2 + 69: 89 04 24 mov %eax,(%esp) + 6c: e8 19 3f 00 00 call 3f8a + + argptest(); + 71: e8 1a 3c 00 00 call 3c90 + createdelete(); + 76: e8 55 12 00 00 call 12d0 + 7b: 90 nop + 7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + linkunlink(); + 80: e8 ab 1c 00 00 call 1d30 + concreate(); + 85: e8 56 19 00 00 call 19e0 + fourfiles(); + 8a: e8 e1 0f 00 00 call 1070 + 8f: 90 nop + sharedfd(); + 90: e8 eb 0d 00 00 call e80 + + bigargtest(); + 95: e8 36 38 00 00 call 38d0 + bigwrite(); + 9a: e8 91 27 00 00 call 2830 + 9f: 90 nop + bigargtest(); + a0: e8 2b 38 00 00 call 38d0 + bsstest(); + a5: e8 a6 37 00 00 call 3850 + sbrktest(); + aa: e8 b1 32 00 00 call 3360 + af: 90 nop + validatetest(); + b0: e8 db 36 00 00 call 3790 + + opentest(); + b5: e8 06 03 00 00 call 3c0 + writetest(); + ba: e8 a1 03 00 00 call 460 + bf: 90 nop + writetest1(); + c0: e8 6b 05 00 00 call 630 + createtest(); + c5: e8 26 07 00 00 call 7f0 + + openiputtest(); + ca: e8 11 02 00 00 call 2e0 + cf: 90 nop + exitiputtest(); + d0: e8 2b 01 00 00 call 200 + iputtest(); + d5: e8 66 00 00 00 call 140 + + mem(); + da: e8 c1 0c 00 00 call da0 + df: 90 nop + pipe1(); + e0: e8 db 08 00 00 call 9c0 + preempt(); + e5: e8 b6 0a 00 00 call ba0 + exitwait(); + ea: e8 21 0c 00 00 call d10 + ef: 90 nop + ; + + rmdot(); + f0: e8 fb 2b 00 00 call 2cf0 + fourteen(); + f5: e8 76 2a 00 00 call 2b70 + bigfile(); + fa: e8 41 28 00 00 call 2940 + ff: 90 nop + subdir(); + 100: e8 ab 1e 00 00 call 1fb0 + linktest(); + 105: e8 36 16 00 00 call 1740 + unlinkread(); + 10a: e8 31 14 00 00 call 1540 + 10f: 90 nop + dirfile(); + 110: e8 ab 2d 00 00 call 2ec0 + iref(); + 115: e8 26 30 00 00 call 3140 + forktest(); + 11a: e8 51 31 00 00 call 3270 + 11f: 90 nop + bigdir(); // slow + 120: e8 2b 1d 00 00 call 1e50 + + uio(); + 125: e8 c6 3a 00 00 call 3bf0 + + exectest(); + 12a: e8 31 08 00 00 call 960 + + exit(0); + 12f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 136: e8 27 3e 00 00 call 3f62 + 13b: 66 90 xchg %ax,%ax + 13d: 66 90 xchg %ax,%ax + 13f: 90 nop + +00000140 : +{ + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 83 ec 18 sub $0x18,%esp + printf(stdout, "iput test\n"); + 146: a1 94 64 00 00 mov 0x6494,%eax + 14b: c7 44 24 04 ac 44 00 movl $0x44ac,0x4(%esp) + 152: 00 + 153: 89 04 24 mov %eax,(%esp) + 156: e8 55 3f 00 00 call 40b0 + if (mkdir("iputdir") < 0) + 15b: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) + 162: e8 63 3e 00 00 call 3fca + 167: 85 c0 test %eax,%eax + 169: 78 47 js 1b2 + if (chdir("iputdir") < 0) + 16b: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) + 172: e8 5b 3e 00 00 call 3fd2 + 177: 85 c0 test %eax,%eax + 179: 78 6c js 1e7 + if (unlink("../iputdir") < 0) + 17b: c7 04 24 3c 44 00 00 movl $0x443c,(%esp) + 182: e8 2b 3e 00 00 call 3fb2 + 187: 85 c0 test %eax,%eax + 189: 78 52 js 1dd + if (chdir("/") < 0) + 18b: c7 04 24 61 44 00 00 movl $0x4461,(%esp) + 192: e8 3b 3e 00 00 call 3fd2 + 197: 85 c0 test %eax,%eax + 199: 78 38 js 1d3 + printf(stdout, "iput test ok\n"); + 19b: a1 94 64 00 00 mov 0x6494,%eax + 1a0: c7 44 24 04 e4 44 00 movl $0x44e4,0x4(%esp) + 1a7: 00 + 1a8: 89 04 24 mov %eax,(%esp) + 1ab: e8 00 3f 00 00 call 40b0 +} + 1b0: c9 leave + 1b1: c3 ret + printf(stdout, "mkdir failed\n"); + 1b2: c7 44 24 04 18 44 00 movl $0x4418,0x4(%esp) + 1b9: 00 + printf(stdout, "chdir iputdir failed\n"); + 1ba: a1 94 64 00 00 mov 0x6494,%eax + 1bf: 89 04 24 mov %eax,(%esp) + 1c2: e8 e9 3e 00 00 call 40b0 + exit(0); + 1c7: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1ce: e8 8f 3d 00 00 call 3f62 + printf(stdout, "chdir / failed\n"); + 1d3: c7 44 24 04 63 44 00 movl $0x4463,0x4(%esp) + 1da: 00 + 1db: eb dd jmp 1ba + printf(stdout, "unlink ../iputdir failed\n"); + 1dd: c7 44 24 04 47 44 00 movl $0x4447,0x4(%esp) + 1e4: 00 + 1e5: eb d3 jmp 1ba + printf(stdout, "chdir iputdir failed\n"); + 1e7: c7 44 24 04 26 44 00 movl $0x4426,0x4(%esp) + 1ee: 00 + 1ef: eb c9 jmp 1ba + 1f1: eb 0d jmp 200 + 1f3: 90 nop + 1f4: 90 nop + 1f5: 90 nop + 1f6: 90 nop + 1f7: 90 nop + 1f8: 90 nop + 1f9: 90 nop + 1fa: 90 nop + 1fb: 90 nop + 1fc: 90 nop + 1fd: 90 nop + 1fe: 90 nop + 1ff: 90 nop + +00000200 : +{ + 200: 55 push %ebp + 201: 89 e5 mov %esp,%ebp + 203: 83 ec 18 sub $0x18,%esp + printf(stdout, "exitiput test\n"); + 206: a1 94 64 00 00 mov 0x6494,%eax + 20b: c7 44 24 04 73 44 00 movl $0x4473,0x4(%esp) + 212: 00 + 213: 89 04 24 mov %eax,(%esp) + 216: e8 95 3e 00 00 call 40b0 + pid = fork(); + 21b: e8 3a 3d 00 00 call 3f5a + if (pid < 0) + 220: 85 c0 test %eax,%eax + 222: 0f 88 91 00 00 00 js 2b9 + if (pid == 0) + 228: 75 46 jne 270 + if (mkdir("iputdir") < 0) + 22a: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) + 231: e8 94 3d 00 00 call 3fca + 236: 85 c0 test %eax,%eax + 238: 0f 88 8f 00 00 00 js 2cd + if (chdir("iputdir") < 0) + 23e: c7 04 24 3f 44 00 00 movl $0x443f,(%esp) + 245: e8 88 3d 00 00 call 3fd2 + 24a: 85 c0 test %eax,%eax + 24c: 78 75 js 2c3 + if (unlink("../iputdir") < 0) + 24e: c7 04 24 3c 44 00 00 movl $0x443c,(%esp) + 255: e8 58 3d 00 00 call 3fb2 + 25a: 85 c0 test %eax,%eax + 25c: 78 3a js 298 + exit(0); + 25e: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 265: e8 f8 3c 00 00 call 3f62 + 26a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + wait(0); + 270: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 277: e8 ee 3c 00 00 call 3f6a + printf(stdout, "exitiput test ok\n"); + 27c: a1 94 64 00 00 mov 0x6494,%eax + 281: c7 44 24 04 96 44 00 movl $0x4496,0x4(%esp) + 288: 00 + 289: 89 04 24 mov %eax,(%esp) + 28c: e8 1f 3e 00 00 call 40b0 +} + 291: c9 leave + 292: c3 ret + 293: 90 nop + 294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(stdout, "unlink ../iputdir failed\n"); + 298: c7 44 24 04 47 44 00 movl $0x4447,0x4(%esp) + 29f: 00 + printf(stdout, "mkdir failed\n"); + 2a0: a1 94 64 00 00 mov 0x6494,%eax + 2a5: 89 04 24 mov %eax,(%esp) + 2a8: e8 03 3e 00 00 call 40b0 + exit(0); + 2ad: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2b4: e8 a9 3c 00 00 call 3f62 + printf(stdout, "fork failed\n"); + 2b9: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 2c0: 00 + 2c1: eb dd jmp 2a0 + printf(stdout, "child chdir failed\n"); + 2c3: c7 44 24 04 82 44 00 movl $0x4482,0x4(%esp) + 2ca: 00 + 2cb: eb d3 jmp 2a0 + printf(stdout, "mkdir failed\n"); + 2cd: c7 44 24 04 18 44 00 movl $0x4418,0x4(%esp) + 2d4: 00 + 2d5: eb c9 jmp 2a0 + 2d7: 89 f6 mov %esi,%esi + 2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000002e0 : +{ + 2e0: 55 push %ebp + 2e1: 89 e5 mov %esp,%ebp + 2e3: 83 ec 18 sub $0x18,%esp + printf(stdout, "openiput test\n"); + 2e6: a1 94 64 00 00 mov 0x6494,%eax + 2eb: c7 44 24 04 a8 44 00 movl $0x44a8,0x4(%esp) + 2f2: 00 + 2f3: 89 04 24 mov %eax,(%esp) + 2f6: e8 b5 3d 00 00 call 40b0 + if (mkdir("oidir") < 0) + 2fb: c7 04 24 b7 44 00 00 movl $0x44b7,(%esp) + 302: e8 c3 3c 00 00 call 3fca + 307: 85 c0 test %eax,%eax + 309: 0f 88 92 00 00 00 js 3a1 + pid = fork(); + 30f: e8 46 3c 00 00 call 3f5a + if (pid < 0) + 314: 85 c0 test %eax,%eax + 316: 78 7f js 397 + if (pid == 0) + 318: 75 3e jne 358 + int fd = open("oidir", O_RDWR); + 31a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 321: 00 + 322: c7 04 24 b7 44 00 00 movl $0x44b7,(%esp) + 329: e8 74 3c 00 00 call 3fa2 + if (fd >= 0) + 32e: 85 c0 test %eax,%eax + 330: 78 15 js 347 + printf(stdout, "open directory for write succeeded\n"); + 332: c7 44 24 04 3c 54 00 movl $0x543c,0x4(%esp) + 339: 00 + printf(stdout, "fork failed\n"); + 33a: a1 94 64 00 00 mov 0x6494,%eax + 33f: 89 04 24 mov %eax,(%esp) + 342: e8 69 3d 00 00 call 40b0 + exit(0); + 347: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 34e: e8 0f 3c 00 00 call 3f62 + 353: 90 nop + 354: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + sleep(1); + 358: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 35f: e8 8e 3c 00 00 call 3ff2 + if (unlink("oidir") != 0) + 364: c7 04 24 b7 44 00 00 movl $0x44b7,(%esp) + 36b: e8 42 3c 00 00 call 3fb2 + 370: 85 c0 test %eax,%eax + 372: 75 37 jne 3ab + wait(0); + 374: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 37b: e8 ea 3b 00 00 call 3f6a + printf(stdout, "openiput test ok\n"); + 380: a1 94 64 00 00 mov 0x6494,%eax + 385: c7 44 24 04 e0 44 00 movl $0x44e0,0x4(%esp) + 38c: 00 + 38d: 89 04 24 mov %eax,(%esp) + 390: e8 1b 3d 00 00 call 40b0 +} + 395: c9 leave + 396: c3 ret + printf(stdout, "fork failed\n"); + 397: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 39e: 00 + 39f: eb 99 jmp 33a + printf(stdout, "mkdir oidir failed\n"); + 3a1: c7 44 24 04 bd 44 00 movl $0x44bd,0x4(%esp) + 3a8: 00 + 3a9: eb 8f jmp 33a + printf(stdout, "unlink failed\n"); + 3ab: c7 44 24 04 d1 44 00 movl $0x44d1,0x4(%esp) + 3b2: 00 + 3b3: eb 85 jmp 33a + 3b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 3b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000003c0 : +{ + 3c0: 55 push %ebp + 3c1: 89 e5 mov %esp,%ebp + 3c3: 83 ec 18 sub $0x18,%esp + printf(stdout, "open test\n"); + 3c6: a1 94 64 00 00 mov 0x6494,%eax + 3cb: c7 44 24 04 f2 44 00 movl $0x44f2,0x4(%esp) + 3d2: 00 + 3d3: 89 04 24 mov %eax,(%esp) + 3d6: e8 d5 3c 00 00 call 40b0 + fd = open("echo", 0); + 3db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3e2: 00 + 3e3: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) + 3ea: e8 b3 3b 00 00 call 3fa2 + if (fd < 0) + 3ef: 85 c0 test %eax,%eax + 3f1: 78 37 js 42a + close(fd); + 3f3: 89 04 24 mov %eax,(%esp) + 3f6: e8 8f 3b 00 00 call 3f8a + fd = open("doesnotexist", 0); + 3fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 402: 00 + 403: c7 04 24 15 45 00 00 movl $0x4515,(%esp) + 40a: e8 93 3b 00 00 call 3fa2 + if (fd >= 0) + 40f: 85 c0 test %eax,%eax + 411: 79 38 jns 44b + printf(stdout, "open test ok\n"); + 413: a1 94 64 00 00 mov 0x6494,%eax + 418: c7 44 24 04 40 45 00 movl $0x4540,0x4(%esp) + 41f: 00 + 420: 89 04 24 mov %eax,(%esp) + 423: e8 88 3c 00 00 call 40b0 +} + 428: c9 leave + 429: c3 ret + printf(stdout, "open echo failed!\n"); + 42a: c7 44 24 04 02 45 00 movl $0x4502,0x4(%esp) + 431: 00 + printf(stdout, "open doesnotexist succeeded!\n"); + 432: a1 94 64 00 00 mov 0x6494,%eax + 437: 89 04 24 mov %eax,(%esp) + 43a: e8 71 3c 00 00 call 40b0 + exit(0); + 43f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 446: e8 17 3b 00 00 call 3f62 + printf(stdout, "open doesnotexist succeeded!\n"); + 44b: c7 44 24 04 22 45 00 movl $0x4522,0x4(%esp) + 452: 00 + 453: eb dd jmp 432 + 455: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 459: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000460 : +{ + 460: 55 push %ebp + 461: 89 e5 mov %esp,%ebp + 463: 56 push %esi + 464: 53 push %ebx + 465: 83 ec 10 sub $0x10,%esp + printf(stdout, "small file test\n"); + 468: a1 94 64 00 00 mov 0x6494,%eax + 46d: c7 44 24 04 4e 45 00 movl $0x454e,0x4(%esp) + 474: 00 + 475: 89 04 24 mov %eax,(%esp) + 478: e8 33 3c 00 00 call 40b0 + fd = open("small", O_CREATE | O_RDWR); + 47d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 484: 00 + 485: c7 04 24 5f 45 00 00 movl $0x455f,(%esp) + 48c: e8 11 3b 00 00 call 3fa2 + if (fd >= 0) + 491: 85 c0 test %eax,%eax + fd = open("small", O_CREATE | O_RDWR); + 493: 89 c6 mov %eax,%esi + if (fd >= 0) + 495: 0f 88 8b 01 00 00 js 626 + printf(stdout, "creat small succeeded; ok\n"); + 49b: a1 94 64 00 00 mov 0x6494,%eax + for (i = 0; i < 100; i++) + 4a0: 31 db xor %ebx,%ebx + printf(stdout, "creat small succeeded; ok\n"); + 4a2: c7 44 24 04 65 45 00 movl $0x4565,0x4(%esp) + 4a9: 00 + 4aa: 89 04 24 mov %eax,(%esp) + 4ad: e8 fe 3b 00 00 call 40b0 + 4b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if (write(fd, "aaaaaaaaaa", 10) != 10) + 4b8: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) + 4bf: 00 + 4c0: c7 44 24 04 9c 45 00 movl $0x459c,0x4(%esp) + 4c7: 00 + 4c8: 89 34 24 mov %esi,(%esp) + 4cb: e8 b2 3a 00 00 call 3f82 + 4d0: 83 f8 0a cmp $0xa,%eax + 4d3: 0f 85 e5 00 00 00 jne 5be + if (write(fd, "bbbbbbbbbb", 10) != 10) + 4d9: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) + 4e0: 00 + 4e1: c7 44 24 04 a7 45 00 movl $0x45a7,0x4(%esp) + 4e8: 00 + 4e9: 89 34 24 mov %esi,(%esp) + 4ec: e8 91 3a 00 00 call 3f82 + 4f1: 83 f8 0a cmp $0xa,%eax + 4f4: 0f 85 e9 00 00 00 jne 5e3 + for (i = 0; i < 100; i++) + 4fa: 83 c3 01 add $0x1,%ebx + 4fd: 83 fb 64 cmp $0x64,%ebx + 500: 75 b6 jne 4b8 + printf(stdout, "writes ok\n"); + 502: a1 94 64 00 00 mov 0x6494,%eax + 507: c7 44 24 04 b2 45 00 movl $0x45b2,0x4(%esp) + 50e: 00 + 50f: 89 04 24 mov %eax,(%esp) + 512: e8 99 3b 00 00 call 40b0 + close(fd); + 517: 89 34 24 mov %esi,(%esp) + 51a: e8 6b 3a 00 00 call 3f8a + fd = open("small", O_RDONLY); + 51f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 526: 00 + 527: c7 04 24 5f 45 00 00 movl $0x455f,(%esp) + 52e: e8 6f 3a 00 00 call 3fa2 + if (fd >= 0) + 533: 85 c0 test %eax,%eax + fd = open("small", O_RDONLY); + 535: 89 c3 mov %eax,%ebx + if (fd >= 0) + 537: 0f 88 b4 00 00 00 js 5f1 + printf(stdout, "open small succeeded ok\n"); + 53d: a1 94 64 00 00 mov 0x6494,%eax + 542: c7 44 24 04 bd 45 00 movl $0x45bd,0x4(%esp) + 549: 00 + 54a: 89 04 24 mov %eax,(%esp) + 54d: e8 5e 3b 00 00 call 40b0 + i = read(fd, buf, 2000); + 552: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp) + 559: 00 + 55a: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 561: 00 + 562: 89 1c 24 mov %ebx,(%esp) + 565: e8 10 3a 00 00 call 3f7a + if (i == 2000) + 56a: 3d d0 07 00 00 cmp $0x7d0,%eax + 56f: 0f 85 9d 00 00 00 jne 612 + printf(stdout, "read succeeded ok\n"); + 575: a1 94 64 00 00 mov 0x6494,%eax + 57a: c7 44 24 04 f1 45 00 movl $0x45f1,0x4(%esp) + 581: 00 + 582: 89 04 24 mov %eax,(%esp) + 585: e8 26 3b 00 00 call 40b0 + close(fd); + 58a: 89 1c 24 mov %ebx,(%esp) + 58d: e8 f8 39 00 00 call 3f8a + if (unlink("small") < 0) + 592: c7 04 24 5f 45 00 00 movl $0x455f,(%esp) + 599: e8 14 3a 00 00 call 3fb2 + 59e: 85 c0 test %eax,%eax + 5a0: 78 7a js 61c + printf(stdout, "small file test ok\n"); + 5a2: a1 94 64 00 00 mov 0x6494,%eax + 5a7: c7 44 24 04 19 46 00 movl $0x4619,0x4(%esp) + 5ae: 00 + 5af: 89 04 24 mov %eax,(%esp) + 5b2: e8 f9 3a 00 00 call 40b0 +} + 5b7: 83 c4 10 add $0x10,%esp + 5ba: 5b pop %ebx + 5bb: 5e pop %esi + 5bc: 5d pop %ebp + 5bd: c3 ret + printf(stdout, "error: write aa %d new file failed\n", i); + 5be: 89 5c 24 08 mov %ebx,0x8(%esp) + 5c2: c7 44 24 04 60 54 00 movl $0x5460,0x4(%esp) + 5c9: 00 + printf(stdout, "error: write bb %d new file failed\n", i); + 5ca: a1 94 64 00 00 mov 0x6494,%eax + 5cf: 89 04 24 mov %eax,(%esp) + 5d2: e8 d9 3a 00 00 call 40b0 + exit(0); + 5d7: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 5de: e8 7f 39 00 00 call 3f62 + printf(stdout, "error: write bb %d new file failed\n", i); + 5e3: 89 5c 24 08 mov %ebx,0x8(%esp) + 5e7: c7 44 24 04 84 54 00 movl $0x5484,0x4(%esp) + 5ee: 00 + 5ef: eb d9 jmp 5ca + printf(stdout, "error: open small failed!\n"); + 5f1: c7 44 24 04 d6 45 00 movl $0x45d6,0x4(%esp) + 5f8: 00 + 5f9: a1 94 64 00 00 mov 0x6494,%eax + 5fe: 89 04 24 mov %eax,(%esp) + 601: e8 aa 3a 00 00 call 40b0 + exit(0); + 606: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 60d: e8 50 39 00 00 call 3f62 + printf(stdout, "read failed\n"); + 612: c7 44 24 04 1d 49 00 movl $0x491d,0x4(%esp) + 619: 00 + 61a: eb dd jmp 5f9 + printf(stdout, "unlink small failed\n"); + 61c: c7 44 24 04 04 46 00 movl $0x4604,0x4(%esp) + 623: 00 + 624: eb d3 jmp 5f9 + printf(stdout, "error: creat small failed!\n"); + 626: c7 44 24 04 80 45 00 movl $0x4580,0x4(%esp) + 62d: 00 + 62e: eb c9 jmp 5f9 + +00000630 : +{ + 630: 55 push %ebp + 631: 89 e5 mov %esp,%ebp + 633: 56 push %esi + 634: 53 push %ebx + 635: 83 ec 10 sub $0x10,%esp + printf(stdout, "big files test\n"); + 638: a1 94 64 00 00 mov 0x6494,%eax + 63d: c7 44 24 04 2d 46 00 movl $0x462d,0x4(%esp) + 644: 00 + 645: 89 04 24 mov %eax,(%esp) + 648: e8 63 3a 00 00 call 40b0 + fd = open("big", O_CREATE | O_RDWR); + 64d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 654: 00 + 655: c7 04 24 a7 46 00 00 movl $0x46a7,(%esp) + 65c: e8 41 39 00 00 call 3fa2 + if (fd < 0) + 661: 85 c0 test %eax,%eax + fd = open("big", O_CREATE | O_RDWR); + 663: 89 c6 mov %eax,%esi + if (fd < 0) + 665: 0f 88 6f 01 00 00 js 7da + 66b: 31 db xor %ebx,%ebx + 66d: 8d 76 00 lea 0x0(%esi),%esi + if (write(fd, buf, 512) != 512) + 670: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + 677: 00 + 678: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 67f: 00 + 680: 89 34 24 mov %esi,(%esp) + ((int *)buf)[0] = i; + 683: 89 1d 80 8c 00 00 mov %ebx,0x8c80 + if (write(fd, buf, 512) != 512) + 689: e8 f4 38 00 00 call 3f82 + 68e: 3d 00 02 00 00 cmp $0x200,%eax + 693: 0f 85 b2 00 00 00 jne 74b + for (i = 0; i < MAXFILE; i++) + 699: 83 c3 01 add $0x1,%ebx + 69c: 81 fb 8c 00 00 00 cmp $0x8c,%ebx + 6a2: 75 cc jne 670 + close(fd); + 6a4: 89 34 24 mov %esi,(%esp) + 6a7: e8 de 38 00 00 call 3f8a + fd = open("big", O_RDONLY); + 6ac: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 6b3: 00 + 6b4: c7 04 24 a7 46 00 00 movl $0x46a7,(%esp) + 6bb: e8 e2 38 00 00 call 3fa2 + if (fd < 0) + 6c0: 85 c0 test %eax,%eax + fd = open("big", O_RDONLY); + 6c2: 89 c6 mov %eax,%esi + if (fd < 0) + 6c4: 0f 88 ef 00 00 00 js 7b9 + 6ca: 31 db xor %ebx,%ebx + 6cc: eb 1d jmp 6eb + 6ce: 66 90 xchg %ax,%ax + else if (i != 512) + 6d0: 3d 00 02 00 00 cmp $0x200,%eax + 6d5: 0f 85 be 00 00 00 jne 799 + if (((int *)buf)[0] != n) + 6db: a1 80 8c 00 00 mov 0x8c80,%eax + 6e0: 39 d8 cmp %ebx,%eax + 6e2: 0f 85 88 00 00 00 jne 770 + n++; + 6e8: 83 c3 01 add $0x1,%ebx + i = read(fd, buf, 512); + 6eb: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + 6f2: 00 + 6f3: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 6fa: 00 + 6fb: 89 34 24 mov %esi,(%esp) + 6fe: e8 77 38 00 00 call 3f7a + if (i == 0) + 703: 85 c0 test %eax,%eax + 705: 75 c9 jne 6d0 + if (n == MAXFILE - 1) + 707: 81 fb 8b 00 00 00 cmp $0x8b,%ebx + 70d: 0f 84 94 00 00 00 je 7a7 + close(fd); + 713: 89 34 24 mov %esi,(%esp) + 716: e8 6f 38 00 00 call 3f8a + if (unlink("big") < 0) + 71b: c7 04 24 a7 46 00 00 movl $0x46a7,(%esp) + 722: e8 8b 38 00 00 call 3fb2 + 727: 85 c0 test %eax,%eax + 729: 0f 88 b5 00 00 00 js 7e4 + printf(stdout, "big files ok\n"); + 72f: a1 94 64 00 00 mov 0x6494,%eax + 734: c7 44 24 04 ce 46 00 movl $0x46ce,0x4(%esp) + 73b: 00 + 73c: 89 04 24 mov %eax,(%esp) + 73f: e8 6c 39 00 00 call 40b0 +} + 744: 83 c4 10 add $0x10,%esp + 747: 5b pop %ebx + 748: 5e pop %esi + 749: 5d pop %ebp + 74a: c3 ret + printf(stdout, "error: write big file failed\n", i); + 74b: 89 5c 24 08 mov %ebx,0x8(%esp) + 74f: c7 44 24 04 57 46 00 movl $0x4657,0x4(%esp) + 756: 00 + printf(stdout, "read only %d blocks from big", n); + 757: a1 94 64 00 00 mov 0x6494,%eax + 75c: 89 04 24 mov %eax,(%esp) + 75f: e8 4c 39 00 00 call 40b0 + exit(0); + 764: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 76b: e8 f2 37 00 00 call 3f62 + printf(stdout, "read content of block %d is %d\n", + 770: 89 44 24 0c mov %eax,0xc(%esp) + 774: a1 94 64 00 00 mov 0x6494,%eax + 779: 89 5c 24 08 mov %ebx,0x8(%esp) + 77d: c7 44 24 04 a8 54 00 movl $0x54a8,0x4(%esp) + 784: 00 + 785: 89 04 24 mov %eax,(%esp) + 788: e8 23 39 00 00 call 40b0 + exit(0); + 78d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 794: e8 c9 37 00 00 call 3f62 + printf(stdout, "read failed %d\n", i); + 799: 89 44 24 08 mov %eax,0x8(%esp) + 79d: c7 44 24 04 ab 46 00 movl $0x46ab,0x4(%esp) + 7a4: 00 + 7a5: eb b0 jmp 757 + printf(stdout, "read only %d blocks from big", n); + 7a7: c7 44 24 08 8b 00 00 movl $0x8b,0x8(%esp) + 7ae: 00 + 7af: c7 44 24 04 8e 46 00 movl $0x468e,0x4(%esp) + 7b6: 00 + 7b7: eb 9e jmp 757 + printf(stdout, "error: open big failed!\n"); + 7b9: c7 44 24 04 75 46 00 movl $0x4675,0x4(%esp) + 7c0: 00 + 7c1: a1 94 64 00 00 mov 0x6494,%eax + 7c6: 89 04 24 mov %eax,(%esp) + 7c9: e8 e2 38 00 00 call 40b0 + exit(0); + 7ce: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 7d5: e8 88 37 00 00 call 3f62 + printf(stdout, "error: creat big failed!\n"); + 7da: c7 44 24 04 3d 46 00 movl $0x463d,0x4(%esp) + 7e1: 00 + 7e2: eb dd jmp 7c1 + printf(stdout, "unlink big failed\n"); + 7e4: c7 44 24 04 bb 46 00 movl $0x46bb,0x4(%esp) + 7eb: 00 + 7ec: eb d3 jmp 7c1 + 7ee: 66 90 xchg %ax,%ax + +000007f0 : +{ + 7f0: 55 push %ebp + 7f1: 89 e5 mov %esp,%ebp + 7f3: 53 push %ebx + name[2] = '\0'; + 7f4: bb 30 00 00 00 mov $0x30,%ebx +{ + 7f9: 83 ec 14 sub $0x14,%esp + printf(stdout, "many creates, followed by unlink test\n"); + 7fc: a1 94 64 00 00 mov 0x6494,%eax + 801: c7 44 24 04 c8 54 00 movl $0x54c8,0x4(%esp) + 808: 00 + 809: 89 04 24 mov %eax,(%esp) + 80c: e8 9f 38 00 00 call 40b0 + name[0] = 'a'; + 811: c6 05 80 ac 00 00 61 movb $0x61,0xac80 + name[2] = '\0'; + 818: c6 05 82 ac 00 00 00 movb $0x0,0xac82 + 81f: 90 nop + fd = open(name, O_CREATE | O_RDWR); + 820: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 827: 00 + 828: c7 04 24 80 ac 00 00 movl $0xac80,(%esp) + name[1] = '0' + i; + 82f: 88 1d 81 ac 00 00 mov %bl,0xac81 + 835: 83 c3 01 add $0x1,%ebx + fd = open(name, O_CREATE | O_RDWR); + 838: e8 65 37 00 00 call 3fa2 + close(fd); + 83d: 89 04 24 mov %eax,(%esp) + 840: e8 45 37 00 00 call 3f8a + for (i = 0; i < 52; i++) + 845: 80 fb 64 cmp $0x64,%bl + 848: 75 d6 jne 820 + name[0] = 'a'; + 84a: c6 05 80 ac 00 00 61 movb $0x61,0xac80 + name[2] = '\0'; + 851: bb 30 00 00 00 mov $0x30,%ebx + 856: c6 05 82 ac 00 00 00 movb $0x0,0xac82 + 85d: 8d 76 00 lea 0x0(%esi),%esi + name[1] = '0' + i; + 860: 88 1d 81 ac 00 00 mov %bl,0xac81 + 866: 83 c3 01 add $0x1,%ebx + unlink(name); + 869: c7 04 24 80 ac 00 00 movl $0xac80,(%esp) + 870: e8 3d 37 00 00 call 3fb2 + for (i = 0; i < 52; i++) + 875: 80 fb 64 cmp $0x64,%bl + 878: 75 e6 jne 860 + printf(stdout, "many creates, followed by unlink; ok\n"); + 87a: a1 94 64 00 00 mov 0x6494,%eax + 87f: c7 44 24 04 f0 54 00 movl $0x54f0,0x4(%esp) + 886: 00 + 887: 89 04 24 mov %eax,(%esp) + 88a: e8 21 38 00 00 call 40b0 +} + 88f: 83 c4 14 add $0x14,%esp + 892: 5b pop %ebx + 893: 5d pop %ebp + 894: c3 ret + 895: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 899: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000008a0 : +{ + 8a0: 55 push %ebp + 8a1: 89 e5 mov %esp,%ebp + 8a3: 83 ec 18 sub $0x18,%esp + printf(stdout, "mkdir test\n"); + 8a6: a1 94 64 00 00 mov 0x6494,%eax + 8ab: c7 44 24 04 dc 46 00 movl $0x46dc,0x4(%esp) + 8b2: 00 + 8b3: 89 04 24 mov %eax,(%esp) + 8b6: e8 f5 37 00 00 call 40b0 + if (mkdir("dir0") < 0) + 8bb: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) + 8c2: e8 03 37 00 00 call 3fca + 8c7: 85 c0 test %eax,%eax + 8c9: 78 47 js 912 + if (chdir("dir0") < 0) + 8cb: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) + 8d2: e8 fb 36 00 00 call 3fd2 + 8d7: 85 c0 test %eax,%eax + 8d9: 78 6c js 947 + if (chdir("..") < 0) + 8db: c7 04 24 8d 4c 00 00 movl $0x4c8d,(%esp) + 8e2: e8 eb 36 00 00 call 3fd2 + 8e7: 85 c0 test %eax,%eax + 8e9: 78 52 js 93d + if (unlink("dir0") < 0) + 8eb: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) + 8f2: e8 bb 36 00 00 call 3fb2 + 8f7: 85 c0 test %eax,%eax + 8f9: 78 38 js 933 + printf(stdout, "mkdir test ok\n"); + 8fb: a1 94 64 00 00 mov 0x6494,%eax + 900: c7 44 24 04 25 47 00 movl $0x4725,0x4(%esp) + 907: 00 + 908: 89 04 24 mov %eax,(%esp) + 90b: e8 a0 37 00 00 call 40b0 +} + 910: c9 leave + 911: c3 ret + printf(stdout, "mkdir failed\n"); + 912: c7 44 24 04 18 44 00 movl $0x4418,0x4(%esp) + 919: 00 + printf(stdout, "chdir dir0 failed\n"); + 91a: a1 94 64 00 00 mov 0x6494,%eax + 91f: 89 04 24 mov %eax,(%esp) + 922: e8 89 37 00 00 call 40b0 + exit(0); + 927: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 92e: e8 2f 36 00 00 call 3f62 + printf(stdout, "unlink dir0 failed\n"); + 933: c7 44 24 04 11 47 00 movl $0x4711,0x4(%esp) + 93a: 00 + 93b: eb dd jmp 91a + printf(stdout, "chdir .. failed\n"); + 93d: c7 44 24 04 00 47 00 movl $0x4700,0x4(%esp) + 944: 00 + 945: eb d3 jmp 91a + printf(stdout, "chdir dir0 failed\n"); + 947: c7 44 24 04 ed 46 00 movl $0x46ed,0x4(%esp) + 94e: 00 + 94f: eb c9 jmp 91a + 951: eb 0d jmp 960 + 953: 90 nop + 954: 90 nop + 955: 90 nop + 956: 90 nop + 957: 90 nop + 958: 90 nop + 959: 90 nop + 95a: 90 nop + 95b: 90 nop + 95c: 90 nop + 95d: 90 nop + 95e: 90 nop + 95f: 90 nop + +00000960 : +{ + 960: 55 push %ebp + 961: 89 e5 mov %esp,%ebp + 963: 83 ec 18 sub $0x18,%esp + printf(stdout, "exec test\n"); + 966: a1 94 64 00 00 mov 0x6494,%eax + 96b: c7 44 24 04 34 47 00 movl $0x4734,0x4(%esp) + 972: 00 + 973: 89 04 24 mov %eax,(%esp) + 976: e8 35 37 00 00 call 40b0 + if (exec("echo", echoargv) < 0) + 97b: c7 44 24 04 98 64 00 movl $0x6498,0x4(%esp) + 982: 00 + 983: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) + 98a: e8 0b 36 00 00 call 3f9a + 98f: 85 c0 test %eax,%eax + 991: 78 02 js 995 +} + 993: c9 leave + 994: c3 ret + printf(stdout, "exec echo failed\n"); + 995: a1 94 64 00 00 mov 0x6494,%eax + 99a: c7 44 24 04 3f 47 00 movl $0x473f,0x4(%esp) + 9a1: 00 + 9a2: 89 04 24 mov %eax,(%esp) + 9a5: e8 06 37 00 00 call 40b0 + exit(0); + 9aa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 9b1: e8 ac 35 00 00 call 3f62 + 9b6: 8d 76 00 lea 0x0(%esi),%esi + 9b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000009c0 : +{ + 9c0: 55 push %ebp + 9c1: 89 e5 mov %esp,%ebp + 9c3: 57 push %edi + 9c4: 56 push %esi + 9c5: 53 push %ebx + 9c6: 83 ec 2c sub $0x2c,%esp + if (pipe(fds) != 0) + 9c9: 8d 45 e0 lea -0x20(%ebp),%eax + 9cc: 89 04 24 mov %eax,(%esp) + 9cf: e8 9e 35 00 00 call 3f72 + 9d4: 85 c0 test %eax,%eax + 9d6: 0f 85 5c 01 00 00 jne b38 + pid = fork(); + 9dc: e8 79 35 00 00 call 3f5a + if (pid == 0) + 9e1: 83 f8 00 cmp $0x0,%eax + 9e4: 0f 84 93 00 00 00 je a7d + else if (pid > 0) + 9ea: 0f 8e 68 01 00 00 jle b58 + close(fds[1]); + 9f0: 8b 45 e4 mov -0x1c(%ebp),%eax + cc = 1; + 9f3: bf 01 00 00 00 mov $0x1,%edi + seq = 0; + 9f8: 31 db xor %ebx,%ebx + close(fds[1]); + 9fa: 89 04 24 mov %eax,(%esp) + 9fd: e8 88 35 00 00 call 3f8a + total = 0; + a02: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) + while ((n = read(fds[0], buf, cc)) > 0) + a09: 8b 45 e0 mov -0x20(%ebp),%eax + a0c: 89 7c 24 08 mov %edi,0x8(%esp) + a10: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + a17: 00 + a18: 89 04 24 mov %eax,(%esp) + a1b: e8 5a 35 00 00 call 3f7a + a20: 85 c0 test %eax,%eax + a22: 0f 8e ba 00 00 00 jle ae2 + a28: 89 d9 mov %ebx,%ecx + a2a: 8d 34 03 lea (%ebx,%eax,1),%esi + a2d: f7 d9 neg %ecx + a2f: eb 09 jmp a3a + a31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if ((buf[i] & 0xff) != (seq++ & 0xff)) + a38: 89 d3 mov %edx,%ebx + a3a: 38 9c 0b 80 8c 00 00 cmp %bl,0x8c80(%ebx,%ecx,1) + a41: 8d 53 01 lea 0x1(%ebx),%edx + a44: 75 1b jne a61 + for (i = 0; i < n; i++) + a46: 39 f2 cmp %esi,%edx + a48: 75 ee jne a38 + cc = cc * 2; + a4a: 01 ff add %edi,%edi + if ((buf[i] & 0xff) != (seq++ & 0xff)) + a4c: 89 f3 mov %esi,%ebx + total += n; + a4e: 01 45 d4 add %eax,-0x2c(%ebp) + cc = sizeof(buf); + a51: 81 ff 01 20 00 00 cmp $0x2001,%edi + a57: b8 00 20 00 00 mov $0x2000,%eax + a5c: 0f 43 f8 cmovae %eax,%edi + a5f: eb a8 jmp a09 + printf(1, "pipe1 oops 2\n"); + a61: c7 44 24 04 6e 47 00 movl $0x476e,0x4(%esp) + a68: 00 + a69: c7 04 24 01 00 00 00 movl $0x1,(%esp) + a70: e8 3b 36 00 00 call 40b0 +} + a75: 83 c4 2c add $0x2c,%esp + a78: 5b pop %ebx + a79: 5e pop %esi + a7a: 5f pop %edi + a7b: 5d pop %ebp + a7c: c3 ret + close(fds[0]); + a7d: 8b 45 e0 mov -0x20(%ebp),%eax + seq = 0; + a80: 31 f6 xor %esi,%esi + close(fds[0]); + a82: 89 04 24 mov %eax,(%esp) + a85: e8 00 35 00 00 call 3f8a + a8a: 89 f0 mov %esi,%eax +{ + a8c: 89 f3 mov %esi,%ebx + a8e: 8d 96 09 04 00 00 lea 0x409(%esi),%edx + a94: f7 d8 neg %eax + a96: 66 90 xchg %ax,%ax + buf[i] = seq++; + a98: 88 9c 18 80 8c 00 00 mov %bl,0x8c80(%eax,%ebx,1) + a9f: 83 c3 01 add $0x1,%ebx + for (i = 0; i < 1033; i++) + aa2: 39 d3 cmp %edx,%ebx + aa4: 75 f2 jne a98 + if (write(fds[1], buf, 1033) != 1033) + aa6: 8b 45 e4 mov -0x1c(%ebp),%eax + aa9: 89 de mov %ebx,%esi + aab: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp) + ab2: 00 + ab3: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + aba: 00 + abb: 89 04 24 mov %eax,(%esp) + abe: e8 bf 34 00 00 call 3f82 + ac3: 3d 09 04 00 00 cmp $0x409,%eax + ac8: 0f 85 aa 00 00 00 jne b78 + for (n = 0; n < 5; n++) + ace: 81 fb 2d 14 00 00 cmp $0x142d,%ebx + ad4: 75 b4 jne a8a + exit(0); + ad6: c7 04 24 00 00 00 00 movl $0x0,(%esp) + add: e8 80 34 00 00 call 3f62 + if (total != 5 * 1033) + ae2: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp) + ae9: 75 30 jne b1b + close(fds[0]); + aeb: 8b 45 e0 mov -0x20(%ebp),%eax + aee: 89 04 24 mov %eax,(%esp) + af1: e8 94 34 00 00 call 3f8a + wait(0); + af6: c7 04 24 00 00 00 00 movl $0x0,(%esp) + afd: e8 68 34 00 00 call 3f6a + printf(1, "pipe1 ok\n"); + b02: c7 44 24 04 93 47 00 movl $0x4793,0x4(%esp) + b09: 00 + b0a: c7 04 24 01 00 00 00 movl $0x1,(%esp) + b11: e8 9a 35 00 00 call 40b0 + b16: e9 5a ff ff ff jmp a75 + printf(1, "pipe1 oops 3 total %d\n", total); + b1b: 8b 45 d4 mov -0x2c(%ebp),%eax + b1e: c7 44 24 04 7c 47 00 movl $0x477c,0x4(%esp) + b25: 00 + b26: c7 04 24 01 00 00 00 movl $0x1,(%esp) + b2d: 89 44 24 08 mov %eax,0x8(%esp) + b31: e8 7a 35 00 00 call 40b0 + b36: eb 9e jmp ad6 + printf(1, "pipe() failed\n"); + b38: c7 44 24 04 51 47 00 movl $0x4751,0x4(%esp) + b3f: 00 + b40: c7 04 24 01 00 00 00 movl $0x1,(%esp) + b47: e8 64 35 00 00 call 40b0 + exit(0); + b4c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + b53: e8 0a 34 00 00 call 3f62 + printf(1, "fork() failed\n"); + b58: c7 44 24 04 9d 47 00 movl $0x479d,0x4(%esp) + b5f: 00 + b60: c7 04 24 01 00 00 00 movl $0x1,(%esp) + b67: e8 44 35 00 00 call 40b0 + exit(0); + b6c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + b73: e8 ea 33 00 00 call 3f62 + printf(1, "pipe1 oops 1\n"); + b78: c7 44 24 04 60 47 00 movl $0x4760,0x4(%esp) + b7f: 00 + b80: c7 04 24 01 00 00 00 movl $0x1,(%esp) + b87: e8 24 35 00 00 call 40b0 + exit(0); + b8c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + b93: e8 ca 33 00 00 call 3f62 + b98: 90 nop + b99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000ba0 : +{ + ba0: 55 push %ebp + ba1: 89 e5 mov %esp,%ebp + ba3: 57 push %edi + ba4: 56 push %esi + ba5: 53 push %ebx + ba6: 83 ec 2c sub $0x2c,%esp + printf(1, "preempt: "); + ba9: c7 44 24 04 ac 47 00 movl $0x47ac,0x4(%esp) + bb0: 00 + bb1: c7 04 24 01 00 00 00 movl $0x1,(%esp) + bb8: e8 f3 34 00 00 call 40b0 + pid1 = fork(); + bbd: e8 98 33 00 00 call 3f5a + if (pid1 == 0) + bc2: 85 c0 test %eax,%eax + pid1 = fork(); + bc4: 89 c7 mov %eax,%edi + if (pid1 == 0) + bc6: 75 02 jne bca + bc8: eb fe jmp bc8 + bca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + pid2 = fork(); + bd0: e8 85 33 00 00 call 3f5a + if (pid2 == 0) + bd5: 85 c0 test %eax,%eax + pid2 = fork(); + bd7: 89 c6 mov %eax,%esi + if (pid2 == 0) + bd9: 75 02 jne bdd + bdb: eb fe jmp bdb + pipe(pfds); + bdd: 8d 45 e0 lea -0x20(%ebp),%eax + be0: 89 04 24 mov %eax,(%esp) + be3: e8 8a 33 00 00 call 3f72 + pid3 = fork(); + be8: e8 6d 33 00 00 call 3f5a + if (pid3 == 0) + bed: 85 c0 test %eax,%eax + pid3 = fork(); + bef: 89 c3 mov %eax,%ebx + if (pid3 == 0) + bf1: 75 4c jne c3f + close(pfds[0]); + bf3: 8b 45 e0 mov -0x20(%ebp),%eax + bf6: 89 04 24 mov %eax,(%esp) + bf9: e8 8c 33 00 00 call 3f8a + if (write(pfds[1], "x", 1) != 1) + bfe: 8b 45 e4 mov -0x1c(%ebp),%eax + c01: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + c08: 00 + c09: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) + c10: 00 + c11: 89 04 24 mov %eax,(%esp) + c14: e8 69 33 00 00 call 3f82 + c19: 83 f8 01 cmp $0x1,%eax + c1c: 74 14 je c32 + printf(1, "preempt write error"); + c1e: c7 44 24 04 b6 47 00 movl $0x47b6,0x4(%esp) + c25: 00 + c26: c7 04 24 01 00 00 00 movl $0x1,(%esp) + c2d: e8 7e 34 00 00 call 40b0 + close(pfds[1]); + c32: 8b 45 e4 mov -0x1c(%ebp),%eax + c35: 89 04 24 mov %eax,(%esp) + c38: e8 4d 33 00 00 call 3f8a + c3d: eb fe jmp c3d + close(pfds[1]); + c3f: 8b 45 e4 mov -0x1c(%ebp),%eax + c42: 89 04 24 mov %eax,(%esp) + c45: e8 40 33 00 00 call 3f8a + if (read(pfds[0], buf, sizeof(buf)) != 1) + c4a: 8b 45 e0 mov -0x20(%ebp),%eax + c4d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) + c54: 00 + c55: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + c5c: 00 + c5d: 89 04 24 mov %eax,(%esp) + c60: e8 15 33 00 00 call 3f7a + c65: 83 f8 01 cmp $0x1,%eax + c68: 74 1c je c86 + printf(1, "preempt read error"); + c6a: c7 44 24 04 ca 47 00 movl $0x47ca,0x4(%esp) + c71: 00 + c72: c7 04 24 01 00 00 00 movl $0x1,(%esp) + c79: e8 32 34 00 00 call 40b0 +} + c7e: 83 c4 2c add $0x2c,%esp + c81: 5b pop %ebx + c82: 5e pop %esi + c83: 5f pop %edi + c84: 5d pop %ebp + c85: c3 ret + close(pfds[0]); + c86: 8b 45 e0 mov -0x20(%ebp),%eax + c89: 89 04 24 mov %eax,(%esp) + c8c: e8 f9 32 00 00 call 3f8a + printf(1, "kill... "); + c91: c7 44 24 04 dd 47 00 movl $0x47dd,0x4(%esp) + c98: 00 + c99: c7 04 24 01 00 00 00 movl $0x1,(%esp) + ca0: e8 0b 34 00 00 call 40b0 + kill(pid1); + ca5: 89 3c 24 mov %edi,(%esp) + ca8: e8 e5 32 00 00 call 3f92 + kill(pid2); + cad: 89 34 24 mov %esi,(%esp) + cb0: e8 dd 32 00 00 call 3f92 + kill(pid3); + cb5: 89 1c 24 mov %ebx,(%esp) + cb8: e8 d5 32 00 00 call 3f92 + printf(1, "wait... "); + cbd: c7 44 24 04 e6 47 00 movl $0x47e6,0x4(%esp) + cc4: 00 + cc5: c7 04 24 01 00 00 00 movl $0x1,(%esp) + ccc: e8 df 33 00 00 call 40b0 + wait(0); + cd1: c7 04 24 00 00 00 00 movl $0x0,(%esp) + cd8: e8 8d 32 00 00 call 3f6a + wait(0); + cdd: c7 04 24 00 00 00 00 movl $0x0,(%esp) + ce4: e8 81 32 00 00 call 3f6a + wait(0); + ce9: c7 04 24 00 00 00 00 movl $0x0,(%esp) + cf0: e8 75 32 00 00 call 3f6a + printf(1, "preempt ok\n"); + cf5: c7 44 24 04 ef 47 00 movl $0x47ef,0x4(%esp) + cfc: 00 + cfd: c7 04 24 01 00 00 00 movl $0x1,(%esp) + d04: e8 a7 33 00 00 call 40b0 + d09: e9 70 ff ff ff jmp c7e + d0e: 66 90 xchg %ax,%ax + +00000d10 : +{ + d10: 55 push %ebp + d11: 89 e5 mov %esp,%ebp + d13: 56 push %esi + d14: be 64 00 00 00 mov $0x64,%esi + d19: 53 push %ebx + d1a: 83 ec 10 sub $0x10,%esp + d1d: eb 18 jmp d37 + d1f: 90 nop + if (wait(0) != pid) + d20: c7 04 24 00 00 00 00 movl $0x0,(%esp) + if (pid) + d27: 74 72 je d9b + if (wait(0) != pid) + d29: e8 3c 32 00 00 call 3f6a + d2e: 39 d8 cmp %ebx,%eax + d30: 75 2e jne d60 + for (i = 0; i < 100; i++) + d32: 83 ee 01 sub $0x1,%esi + d35: 74 49 je d80 + pid = fork(); + d37: e8 1e 32 00 00 call 3f5a + if (pid < 0) + d3c: 85 c0 test %eax,%eax + pid = fork(); + d3e: 89 c3 mov %eax,%ebx + if (pid < 0) + d40: 79 de jns d20 + printf(1, "fork failed\n"); + d42: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + d49: 00 + d4a: c7 04 24 01 00 00 00 movl $0x1,(%esp) + d51: e8 5a 33 00 00 call 40b0 +} + d56: 83 c4 10 add $0x10,%esp + d59: 5b pop %ebx + d5a: 5e pop %esi + d5b: 5d pop %ebp + d5c: c3 ret + d5d: 8d 76 00 lea 0x0(%esi),%esi + printf(1, "wait wrong pid\n"); + d60: c7 44 24 04 fb 47 00 movl $0x47fb,0x4(%esp) + d67: 00 + d68: c7 04 24 01 00 00 00 movl $0x1,(%esp) + d6f: e8 3c 33 00 00 call 40b0 +} + d74: 83 c4 10 add $0x10,%esp + d77: 5b pop %ebx + d78: 5e pop %esi + d79: 5d pop %ebp + d7a: c3 ret + d7b: 90 nop + d7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(1, "exitwait ok\n"); + d80: c7 44 24 04 0b 48 00 movl $0x480b,0x4(%esp) + d87: 00 + d88: c7 04 24 01 00 00 00 movl $0x1,(%esp) + d8f: e8 1c 33 00 00 call 40b0 +} + d94: 83 c4 10 add $0x10,%esp + d97: 5b pop %ebx + d98: 5e pop %esi + d99: 5d pop %ebp + d9a: c3 ret + exit(0); + d9b: e8 c2 31 00 00 call 3f62 + +00000da0 : +{ + da0: 55 push %ebp + da1: 89 e5 mov %esp,%ebp + da3: 57 push %edi + da4: 56 push %esi + da5: 53 push %ebx + da6: 83 ec 1c sub $0x1c,%esp + printf(1, "mem test\n"); + da9: c7 44 24 04 18 48 00 movl $0x4818,0x4(%esp) + db0: 00 + db1: c7 04 24 01 00 00 00 movl $0x1,(%esp) + db8: e8 f3 32 00 00 call 40b0 + ppid = getpid(); + dbd: e8 20 32 00 00 call 3fe2 + dc2: 89 c6 mov %eax,%esi + if ((pid = fork()) == 0) + dc4: e8 91 31 00 00 call 3f5a + dc9: 85 c0 test %eax,%eax + dcb: 75 73 jne e40 + dcd: 31 db xor %ebx,%ebx + dcf: 90 nop + dd0: eb 0a jmp ddc + dd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + *(char **)m2 = m1; + dd8: 89 18 mov %ebx,(%eax) + dda: 89 c3 mov %eax,%ebx + while ((m2 = malloc(10001)) != 0) + ddc: c7 04 24 11 27 00 00 movl $0x2711,(%esp) + de3: e8 48 35 00 00 call 4330 + de8: 85 c0 test %eax,%eax + dea: 75 ec jne dd8 + while (m1) + dec: 85 db test %ebx,%ebx + dee: 75 0a jne dfa + df0: eb 16 jmp e08 + df2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + m1 = m2; + df8: 89 fb mov %edi,%ebx + m2 = *(char **)m1; + dfa: 8b 3b mov (%ebx),%edi + free(m1); + dfc: 89 1c 24 mov %ebx,(%esp) + dff: e8 9c 34 00 00 call 42a0 + while (m1) + e04: 85 ff test %edi,%edi + e06: 75 f0 jne df8 + m1 = malloc(1024 * 20); + e08: c7 04 24 00 50 00 00 movl $0x5000,(%esp) + e0f: e8 1c 35 00 00 call 4330 + if (m1 == 0) + e14: 85 c0 test %eax,%eax + e16: 74 40 je e58 + free(m1); + e18: 89 04 24 mov %eax,(%esp) + e1b: e8 80 34 00 00 call 42a0 + printf(1, "mem ok\n"); + e20: c7 44 24 04 3c 48 00 movl $0x483c,0x4(%esp) + e27: 00 + e28: c7 04 24 01 00 00 00 movl $0x1,(%esp) + e2f: e8 7c 32 00 00 call 40b0 + exit(0); + e34: c7 04 24 00 00 00 00 movl $0x0,(%esp) + e3b: e8 22 31 00 00 call 3f62 + wait(0); + e40: c7 04 24 00 00 00 00 movl $0x0,(%esp) + e47: e8 1e 31 00 00 call 3f6a +} + e4c: 83 c4 1c add $0x1c,%esp + e4f: 5b pop %ebx + e50: 5e pop %esi + e51: 5f pop %edi + e52: 5d pop %ebp + e53: c3 ret + e54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + printf(1, "couldn't allocate mem?!!\n"); + e58: c7 44 24 04 22 48 00 movl $0x4822,0x4(%esp) + e5f: 00 + e60: c7 04 24 01 00 00 00 movl $0x1,(%esp) + e67: e8 44 32 00 00 call 40b0 + kill(ppid); + e6c: 89 34 24 mov %esi,(%esp) + e6f: e8 1e 31 00 00 call 3f92 + exit(0); + e74: c7 04 24 00 00 00 00 movl $0x0,(%esp) + e7b: e8 e2 30 00 00 call 3f62 + +00000e80 : +{ + e80: 55 push %ebp + e81: 89 e5 mov %esp,%ebp + e83: 57 push %edi + e84: 56 push %esi + e85: 53 push %ebx + e86: 83 ec 3c sub $0x3c,%esp + printf(1, "sharedfd test\n"); + e89: c7 44 24 04 44 48 00 movl $0x4844,0x4(%esp) + e90: 00 + e91: c7 04 24 01 00 00 00 movl $0x1,(%esp) + e98: e8 13 32 00 00 call 40b0 + unlink("sharedfd"); + e9d: c7 04 24 53 48 00 00 movl $0x4853,(%esp) + ea4: e8 09 31 00 00 call 3fb2 + fd = open("sharedfd", O_CREATE | O_RDWR); + ea9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + eb0: 00 + eb1: c7 04 24 53 48 00 00 movl $0x4853,(%esp) + eb8: e8 e5 30 00 00 call 3fa2 + if (fd < 0) + ebd: 85 c0 test %eax,%eax + fd = open("sharedfd", O_CREATE | O_RDWR); + ebf: 89 c7 mov %eax,%edi + if (fd < 0) + ec1: 0f 88 48 01 00 00 js 100f + pid = fork(); + ec7: e8 8e 30 00 00 call 3f5a + memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); + ecc: 8d 75 de lea -0x22(%ebp),%esi + ecf: bb e8 03 00 00 mov $0x3e8,%ebx + ed4: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) + edb: 00 + edc: 89 34 24 mov %esi,(%esp) + edf: 83 f8 01 cmp $0x1,%eax + pid = fork(); + ee2: 89 45 d4 mov %eax,-0x2c(%ebp) + memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); + ee5: 19 c0 sbb %eax,%eax + ee7: 83 e0 f3 and $0xfffffff3,%eax + eea: 83 c0 70 add $0x70,%eax + eed: 89 44 24 04 mov %eax,0x4(%esp) + ef1: e8 fa 2e 00 00 call 3df0 + ef6: eb 05 jmp efd + for (i = 0; i < 1000; i++) + ef8: 83 eb 01 sub $0x1,%ebx + efb: 74 2d je f2a + if (write(fd, buf, sizeof(buf)) != sizeof(buf)) + efd: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) + f04: 00 + f05: 89 74 24 04 mov %esi,0x4(%esp) + f09: 89 3c 24 mov %edi,(%esp) + f0c: e8 71 30 00 00 call 3f82 + f11: 83 f8 0a cmp $0xa,%eax + f14: 74 e2 je ef8 + printf(1, "fstests: write sharedfd failed\n"); + f16: c7 44 24 04 44 55 00 movl $0x5544,0x4(%esp) + f1d: 00 + f1e: c7 04 24 01 00 00 00 movl $0x1,(%esp) + f25: e8 86 31 00 00 call 40b0 + if (pid == 0) + f2a: 8b 45 d4 mov -0x2c(%ebp),%eax + exit(0); + f2d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + if (pid == 0) + f34: 85 c0 test %eax,%eax + f36: 0f 84 2e 01 00 00 je 106a + wait(0); + f3c: e8 29 30 00 00 call 3f6a + close(fd); + f41: 89 3c 24 mov %edi,(%esp) + f44: e8 41 30 00 00 call 3f8a + fd = open("sharedfd", 0); + f49: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + f50: 00 + f51: c7 04 24 53 48 00 00 movl $0x4853,(%esp) + f58: e8 45 30 00 00 call 3fa2 + if (fd < 0) + f5d: 85 c0 test %eax,%eax + fd = open("sharedfd", 0); + f5f: 89 45 d0 mov %eax,-0x30(%ebp) + if (fd < 0) + f62: 0f 88 c3 00 00 00 js 102b + f68: 31 d2 xor %edx,%edx + f6a: 31 db xor %ebx,%ebx + f6c: 8d 7d e8 lea -0x18(%ebp),%edi + f6f: 89 55 d4 mov %edx,-0x2c(%ebp) + f72: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + while ((n = read(fd, buf, sizeof(buf))) > 0) + f78: 8b 45 d0 mov -0x30(%ebp),%eax + f7b: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) + f82: 00 + f83: 89 74 24 04 mov %esi,0x4(%esp) + f87: 89 04 24 mov %eax,(%esp) + f8a: e8 eb 2f 00 00 call 3f7a + f8f: 85 c0 test %eax,%eax + f91: 7e 36 jle fc9 + f93: 89 f0 mov %esi,%eax + f95: 8b 55 d4 mov -0x2c(%ebp),%edx + f98: eb 18 jmp fb2 + f9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + np++; + fa0: 80 f9 70 cmp $0x70,%cl + fa3: 0f 94 c1 sete %cl + fa6: 83 c0 01 add $0x1,%eax + fa9: 0f b6 c9 movzbl %cl,%ecx + fac: 01 cb add %ecx,%ebx + for (i = 0; i < sizeof(buf); i++) + fae: 39 f8 cmp %edi,%eax + fb0: 74 12 je fc4 + if (buf[i] == 'c') + fb2: 0f b6 08 movzbl (%eax),%ecx + fb5: 80 f9 63 cmp $0x63,%cl + fb8: 75 e6 jne fa0 + fba: 83 c0 01 add $0x1,%eax + nc++; + fbd: 83 c2 01 add $0x1,%edx + for (i = 0; i < sizeof(buf); i++) + fc0: 39 f8 cmp %edi,%eax + fc2: 75 ee jne fb2 + fc4: 89 55 d4 mov %edx,-0x2c(%ebp) + fc7: eb af jmp f78 + close(fd); + fc9: 8b 45 d0 mov -0x30(%ebp),%eax + fcc: 89 04 24 mov %eax,(%esp) + fcf: e8 b6 2f 00 00 call 3f8a + unlink("sharedfd"); + fd4: c7 04 24 53 48 00 00 movl $0x4853,(%esp) + fdb: e8 d2 2f 00 00 call 3fb2 + if (nc == 10000 && np == 10000) + fe0: 81 fb 10 27 00 00 cmp $0x2710,%ebx + fe6: 8b 55 d4 mov -0x2c(%ebp),%edx + fe9: 75 5c jne 1047 + feb: 81 fa 10 27 00 00 cmp $0x2710,%edx + ff1: 75 54 jne 1047 + printf(1, "sharedfd ok\n"); + ff3: c7 44 24 04 5c 48 00 movl $0x485c,0x4(%esp) + ffa: 00 + ffb: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1002: e8 a9 30 00 00 call 40b0 +} + 1007: 83 c4 3c add $0x3c,%esp + 100a: 5b pop %ebx + 100b: 5e pop %esi + 100c: 5f pop %edi + 100d: 5d pop %ebp + 100e: c3 ret + printf(1, "fstests: cannot open sharedfd for writing"); + 100f: c7 44 24 04 18 55 00 movl $0x5518,0x4(%esp) + 1016: 00 + 1017: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 101e: e8 8d 30 00 00 call 40b0 +} + 1023: 83 c4 3c add $0x3c,%esp + 1026: 5b pop %ebx + 1027: 5e pop %esi + 1028: 5f pop %edi + 1029: 5d pop %ebp + 102a: c3 ret + printf(1, "fstests: cannot open sharedfd for reading\n"); + 102b: c7 44 24 04 64 55 00 movl $0x5564,0x4(%esp) + 1032: 00 + 1033: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 103a: e8 71 30 00 00 call 40b0 +} + 103f: 83 c4 3c add $0x3c,%esp + 1042: 5b pop %ebx + 1043: 5e pop %esi + 1044: 5f pop %edi + 1045: 5d pop %ebp + 1046: c3 ret + printf(1, "sharedfd oops %d %d\n", nc, np); + 1047: 89 5c 24 0c mov %ebx,0xc(%esp) + 104b: 89 54 24 08 mov %edx,0x8(%esp) + 104f: c7 44 24 04 69 48 00 movl $0x4869,0x4(%esp) + 1056: 00 + 1057: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 105e: e8 4d 30 00 00 call 40b0 + exit(0); + 1063: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 106a: e8 f3 2e 00 00 call 3f62 + 106f: 90 nop + +00001070 : +{ + 1070: 55 push %ebp + 1071: 89 e5 mov %esp,%ebp + 1073: 57 push %edi + 1074: 56 push %esi + printf(1, "fourfiles test\n"); + 1075: be 7e 48 00 00 mov $0x487e,%esi +{ + 107a: 53 push %ebx + for (pi = 0; pi < 4; pi++) + 107b: 31 db xor %ebx,%ebx +{ + 107d: 83 ec 2c sub $0x2c,%esp + printf(1, "fourfiles test\n"); + 1080: c7 44 24 04 84 48 00 movl $0x4884,0x4(%esp) + 1087: 00 + 1088: c7 04 24 01 00 00 00 movl $0x1,(%esp) + char *names[] = {"f0", "f1", "f2", "f3"}; + 108f: c7 45 d8 7e 48 00 00 movl $0x487e,-0x28(%ebp) + 1096: c7 45 dc c7 49 00 00 movl $0x49c7,-0x24(%ebp) + 109d: c7 45 e0 cb 49 00 00 movl $0x49cb,-0x20(%ebp) + 10a4: c7 45 e4 81 48 00 00 movl $0x4881,-0x1c(%ebp) + printf(1, "fourfiles test\n"); + 10ab: e8 00 30 00 00 call 40b0 + unlink(fname); + 10b0: 89 34 24 mov %esi,(%esp) + 10b3: e8 fa 2e 00 00 call 3fb2 + pid = fork(); + 10b8: e8 9d 2e 00 00 call 3f5a + if (pid < 0) + 10bd: 85 c0 test %eax,%eax + 10bf: 0f 88 9b 01 00 00 js 1260 + if (pid == 0) + 10c5: 0f 84 0b 01 00 00 je 11d6 + for (pi = 0; pi < 4; pi++) + 10cb: 83 c3 01 add $0x1,%ebx + 10ce: 83 fb 04 cmp $0x4,%ebx + 10d1: 74 06 je 10d9 + 10d3: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi + 10d7: eb d7 jmp 10b0 + wait(0); + 10d9: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 10e0: bf 30 00 00 00 mov $0x30,%edi + 10e5: e8 80 2e 00 00 call 3f6a + 10ea: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 10f1: e8 74 2e 00 00 call 3f6a + 10f6: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 10fd: e8 68 2e 00 00 call 3f6a + 1102: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1109: e8 5c 2e 00 00 call 3f6a + 110e: c7 45 d4 7e 48 00 00 movl $0x487e,-0x2c(%ebp) + fd = open(fname, 0); + 1115: 8b 45 d4 mov -0x2c(%ebp),%eax + total = 0; + 1118: 31 db xor %ebx,%ebx + fd = open(fname, 0); + 111a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1121: 00 + 1122: 89 04 24 mov %eax,(%esp) + 1125: e8 78 2e 00 00 call 3fa2 + 112a: 89 c6 mov %eax,%esi + 112c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while ((n = read(fd, buf, sizeof(buf))) > 0) + 1130: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) + 1137: 00 + 1138: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 113f: 00 + 1140: 89 34 24 mov %esi,(%esp) + 1143: e8 32 2e 00 00 call 3f7a + 1148: 85 c0 test %eax,%eax + 114a: 7e 1a jle 1166 + 114c: 31 d2 xor %edx,%edx + 114e: 66 90 xchg %ax,%ax + if (buf[j] != '0' + i) + 1150: 0f be 8a 80 8c 00 00 movsbl 0x8c80(%edx),%ecx + 1157: 39 f9 cmp %edi,%ecx + 1159: 75 5b jne 11b6 + for (j = 0; j < n; j++) + 115b: 83 c2 01 add $0x1,%edx + 115e: 39 c2 cmp %eax,%edx + 1160: 75 ee jne 1150 + total += n; + 1162: 01 d3 add %edx,%ebx + 1164: eb ca jmp 1130 + close(fd); + 1166: 89 34 24 mov %esi,(%esp) + 1169: e8 1c 2e 00 00 call 3f8a + if (total != 12 * 500) + 116e: 81 fb 70 17 00 00 cmp $0x1770,%ebx + 1174: 0f 85 06 01 00 00 jne 1280 + unlink(fname); + 117a: 8b 45 d4 mov -0x2c(%ebp),%eax + 117d: 89 04 24 mov %eax,(%esp) + 1180: e8 2d 2e 00 00 call 3fb2 + for (i = 0; i < 2; i++) + 1185: 83 ff 31 cmp $0x31,%edi + 1188: 75 1c jne 11a6 + printf(1, "fourfiles ok\n"); + 118a: c7 44 24 04 c2 48 00 movl $0x48c2,0x4(%esp) + 1191: 00 + 1192: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1199: e8 12 2f 00 00 call 40b0 +} + 119e: 83 c4 2c add $0x2c,%esp + 11a1: 5b pop %ebx + 11a2: 5e pop %esi + 11a3: 5f pop %edi + 11a4: 5d pop %ebp + 11a5: c3 ret + 11a6: 8b 45 dc mov -0x24(%ebp),%eax + 11a9: bf 31 00 00 00 mov $0x31,%edi + 11ae: 89 45 d4 mov %eax,-0x2c(%ebp) + 11b1: e9 5f ff ff ff jmp 1115 + printf(1, "wrong char\n"); + 11b6: c7 44 24 04 a5 48 00 movl $0x48a5,0x4(%esp) + 11bd: 00 + 11be: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 11c5: e8 e6 2e 00 00 call 40b0 + exit(0); + 11ca: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 11d1: e8 8c 2d 00 00 call 3f62 + fd = open(fname, O_CREATE | O_RDWR); + 11d6: 89 34 24 mov %esi,(%esp) + 11d9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 11e0: 00 + 11e1: e8 bc 2d 00 00 call 3fa2 + if (fd < 0) + 11e6: 85 c0 test %eax,%eax + fd = open(fname, O_CREATE | O_RDWR); + 11e8: 89 c6 mov %eax,%esi + if (fd < 0) + 11ea: 0f 88 b4 00 00 00 js 12a4 + memset(buf, '0' + pi, 512); + 11f0: 83 c3 30 add $0x30,%ebx + 11f3: 89 5c 24 04 mov %ebx,0x4(%esp) + 11f7: bb 0c 00 00 00 mov $0xc,%ebx + 11fc: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + 1203: 00 + 1204: c7 04 24 80 8c 00 00 movl $0x8c80,(%esp) + 120b: e8 e0 2b 00 00 call 3df0 + 1210: eb 0b jmp 121d + 1212: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + for (i = 0; i < 12; i++) + 1218: 83 eb 01 sub $0x1,%ebx + 121b: 74 ad je 11ca + if ((n = write(fd, buf, 500)) != 500) + 121d: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp) + 1224: 00 + 1225: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 122c: 00 + 122d: 89 34 24 mov %esi,(%esp) + 1230: e8 4d 2d 00 00 call 3f82 + 1235: 3d f4 01 00 00 cmp $0x1f4,%eax + 123a: 74 dc je 1218 + printf(1, "write failed %d\n", n); + 123c: 89 44 24 08 mov %eax,0x8(%esp) + 1240: c7 44 24 04 94 48 00 movl $0x4894,0x4(%esp) + 1247: 00 + 1248: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 124f: e8 5c 2e 00 00 call 40b0 + exit(0); + 1254: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 125b: e8 02 2d 00 00 call 3f62 + printf(1, "fork failed\n"); + 1260: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 1267: 00 + 1268: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 126f: e8 3c 2e 00 00 call 40b0 + exit(0); + 1274: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 127b: e8 e2 2c 00 00 call 3f62 + printf(1, "wrong length %d\n", total); + 1280: 89 5c 24 08 mov %ebx,0x8(%esp) + 1284: c7 44 24 04 b1 48 00 movl $0x48b1,0x4(%esp) + 128b: 00 + 128c: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1293: e8 18 2e 00 00 call 40b0 + exit(0); + 1298: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 129f: e8 be 2c 00 00 call 3f62 + printf(1, "create failed\n"); + 12a4: c7 44 24 04 1f 4b 00 movl $0x4b1f,0x4(%esp) + 12ab: 00 + 12ac: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 12b3: e8 f8 2d 00 00 call 40b0 + exit(0); + 12b8: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 12bf: e8 9e 2c 00 00 call 3f62 + 12c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 12ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000012d0 : +{ + 12d0: 55 push %ebp + 12d1: 89 e5 mov %esp,%ebp + 12d3: 57 push %edi + 12d4: 56 push %esi + 12d5: 53 push %ebx + for (pi = 0; pi < 4; pi++) + 12d6: 31 db xor %ebx,%ebx +{ + 12d8: 83 ec 4c sub $0x4c,%esp + printf(1, "createdelete test\n"); + 12db: c7 44 24 04 d0 48 00 movl $0x48d0,0x4(%esp) + 12e2: 00 + 12e3: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 12ea: e8 c1 2d 00 00 call 40b0 + pid = fork(); + 12ef: e8 66 2c 00 00 call 3f5a + if (pid < 0) + 12f4: 85 c0 test %eax,%eax + 12f6: 0f 88 00 02 00 00 js 14fc + 12fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if (pid == 0) + 1300: 0f 84 2c 01 00 00 je 1432 + for (pi = 0; pi < 4; pi++) + 1306: 83 c3 01 add $0x1,%ebx + 1309: 83 fb 04 cmp $0x4,%ebx + 130c: 75 e1 jne 12ef + wait(0); + 130e: c7 04 24 00 00 00 00 movl $0x0,(%esp) + for (i = 0; i < N; i++) + 1315: 31 f6 xor %esi,%esi + wait(0); + 1317: e8 4e 2c 00 00 call 3f6a + 131c: 8d 7d c8 lea -0x38(%ebp),%edi + 131f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1326: e8 3f 2c 00 00 call 3f6a + 132b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1332: e8 33 2c 00 00 call 3f6a + 1337: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 133e: e8 27 2c 00 00 call 3f6a + name[0] = name[1] = name[2] = 0; + 1343: c6 45 ca 00 movb $0x0,-0x36(%ebp) + 1347: 90 nop + 1348: 83 fe 09 cmp $0x9,%esi + name[2] = '\0'; + 134b: bb 70 00 00 00 mov $0x70,%ebx + 1350: 8d 46 30 lea 0x30(%esi),%eax + 1353: 0f 9f 45 c7 setg -0x39(%ebp) + 1357: 85 f6 test %esi,%esi + 1359: 88 45 c6 mov %al,-0x3a(%ebp) + 135c: 0f 94 c0 sete %al + 135f: 08 45 c7 or %al,-0x39(%ebp) + 1362: 8d 46 ff lea -0x1(%esi),%eax + 1365: 89 45 c0 mov %eax,-0x40(%ebp) + name[1] = '0' + i; + 1368: 0f b6 45 c6 movzbl -0x3a(%ebp),%eax + fd = open(name, 0); + 136c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1373: 00 + 1374: 89 3c 24 mov %edi,(%esp) + name[0] = 'p' + pi; + 1377: 88 5d c8 mov %bl,-0x38(%ebp) + name[1] = '0' + i; + 137a: 88 45 c9 mov %al,-0x37(%ebp) + fd = open(name, 0); + 137d: e8 20 2c 00 00 call 3fa2 + if ((i == 0 || i >= N / 2) && fd < 0) + 1382: 80 7d c7 00 cmpb $0x0,-0x39(%ebp) + 1386: 0f 84 84 00 00 00 je 1410 + 138c: 85 c0 test %eax,%eax + 138e: 0f 88 24 01 00 00 js 14b8 + else if ((i >= 1 && i < N / 2) && fd >= 0) + 1394: 83 7d c0 08 cmpl $0x8,-0x40(%ebp) + 1398: 0f 86 7e 01 00 00 jbe 151c + close(fd); + 139e: 89 04 24 mov %eax,(%esp) + 13a1: 83 c3 01 add $0x1,%ebx + 13a4: e8 e1 2b 00 00 call 3f8a + for (pi = 0; pi < 4; pi++) + 13a9: 80 fb 74 cmp $0x74,%bl + 13ac: 75 ba jne 1368 + for (i = 0; i < N; i++) + 13ae: 83 c6 01 add $0x1,%esi + 13b1: 83 fe 14 cmp $0x14,%esi + 13b4: 75 92 jne 1348 + 13b6: be 70 00 00 00 mov $0x70,%esi + 13bb: 90 nop + 13bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 13c0: 8d 46 c0 lea -0x40(%esi),%eax + 13c3: bb 04 00 00 00 mov $0x4,%ebx + 13c8: 88 45 c7 mov %al,-0x39(%ebp) + name[0] = 'p' + i; + 13cb: 89 f0 mov %esi,%eax + 13cd: 88 45 c8 mov %al,-0x38(%ebp) + name[1] = '0' + i; + 13d0: 0f b6 45 c7 movzbl -0x39(%ebp),%eax + unlink(name); + 13d4: 89 3c 24 mov %edi,(%esp) + name[1] = '0' + i; + 13d7: 88 45 c9 mov %al,-0x37(%ebp) + unlink(name); + 13da: e8 d3 2b 00 00 call 3fb2 + for (pi = 0; pi < 4; pi++) + 13df: 83 eb 01 sub $0x1,%ebx + 13e2: 75 e7 jne 13cb + 13e4: 83 c6 01 add $0x1,%esi + for (i = 0; i < N; i++) + 13e7: 89 f0 mov %esi,%eax + 13e9: 3c 84 cmp $0x84,%al + 13eb: 75 d3 jne 13c0 + printf(1, "createdelete ok\n"); + 13ed: c7 44 24 04 e3 48 00 movl $0x48e3,0x4(%esp) + 13f4: 00 + 13f5: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 13fc: e8 af 2c 00 00 call 40b0 +} + 1401: 83 c4 4c add $0x4c,%esp + 1404: 5b pop %ebx + 1405: 5e pop %esi + 1406: 5f pop %edi + 1407: 5d pop %ebp + 1408: c3 ret + 1409: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + else if ((i >= 1 && i < N / 2) && fd >= 0) + 1410: 85 c0 test %eax,%eax + 1412: 0f 89 04 01 00 00 jns 151c + 1418: 83 c3 01 add $0x1,%ebx + for (pi = 0; pi < 4; pi++) + 141b: 80 fb 74 cmp $0x74,%bl + 141e: 0f 85 44 ff ff ff jne 1368 + for (i = 0; i < N; i++) + 1424: 83 c6 01 add $0x1,%esi + 1427: 83 fe 14 cmp $0x14,%esi + 142a: 0f 85 18 ff ff ff jne 1348 + 1430: eb 84 jmp 13b6 + name[0] = 'p' + pi; + 1432: 83 c3 70 add $0x70,%ebx + name[2] = '\0'; + 1435: be 01 00 00 00 mov $0x1,%esi + name[0] = 'p' + pi; + 143a: 88 5d c8 mov %bl,-0x38(%ebp) + 143d: 8d 7d c8 lea -0x38(%ebp),%edi + name[2] = '\0'; + 1440: 31 db xor %ebx,%ebx + 1442: c6 45 ca 00 movb $0x0,-0x36(%ebp) + 1446: eb 0f jmp 1457 + for (i = 0; i < N; i++) + 1448: 83 fe 14 cmp $0x14,%esi + 144b: 0f 84 7f 00 00 00 je 14d0 + 1451: 83 c3 01 add $0x1,%ebx + 1454: 83 c6 01 add $0x1,%esi + 1457: 8d 43 30 lea 0x30(%ebx),%eax + fd = open(name, O_CREATE | O_RDWR); + 145a: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 1461: 00 + 1462: 89 3c 24 mov %edi,(%esp) + 1465: 88 45 c9 mov %al,-0x37(%ebp) + 1468: e8 35 2b 00 00 call 3fa2 + if (fd < 0) + 146d: 85 c0 test %eax,%eax + 146f: 78 6b js 14dc + close(fd); + 1471: 89 04 24 mov %eax,(%esp) + 1474: e8 11 2b 00 00 call 3f8a + if (i > 0 && (i % 2) == 0) + 1479: 85 db test %ebx,%ebx + 147b: 74 d4 je 1451 + 147d: f6 c3 01 test $0x1,%bl + 1480: 75 c6 jne 1448 + name[1] = '0' + (i / 2); + 1482: 89 d8 mov %ebx,%eax + 1484: d1 f8 sar %eax + 1486: 83 c0 30 add $0x30,%eax + if (unlink(name) < 0) + 1489: 89 3c 24 mov %edi,(%esp) + name[1] = '0' + (i / 2); + 148c: 88 45 c9 mov %al,-0x37(%ebp) + if (unlink(name) < 0) + 148f: e8 1e 2b 00 00 call 3fb2 + 1494: 85 c0 test %eax,%eax + 1496: 79 b0 jns 1448 + printf(1, "unlink failed\n"); + 1498: c7 44 24 04 d1 44 00 movl $0x44d1,0x4(%esp) + 149f: 00 + 14a0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 14a7: e8 04 2c 00 00 call 40b0 + exit(0); + 14ac: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 14b3: e8 aa 2a 00 00 call 3f62 + printf(1, "oops createdelete %s didn't exist\n", name); + 14b8: 89 7c 24 08 mov %edi,0x8(%esp) + 14bc: c7 44 24 04 90 55 00 movl $0x5590,0x4(%esp) + 14c3: 00 + 14c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 14cb: e8 e0 2b 00 00 call 40b0 + exit(0); + 14d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 14d7: e8 86 2a 00 00 call 3f62 + printf(1, "create failed\n"); + 14dc: c7 44 24 04 1f 4b 00 movl $0x4b1f,0x4(%esp) + 14e3: 00 + 14e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 14eb: e8 c0 2b 00 00 call 40b0 + exit(0); + 14f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 14f7: e8 66 2a 00 00 call 3f62 + printf(1, "fork failed\n"); + 14fc: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 1503: 00 + 1504: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 150b: e8 a0 2b 00 00 call 40b0 + exit(0); + 1510: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1517: e8 46 2a 00 00 call 3f62 + printf(1, "oops createdelete %s did exist\n", name); + 151c: 89 7c 24 08 mov %edi,0x8(%esp) + 1520: c7 44 24 04 b4 55 00 movl $0x55b4,0x4(%esp) + 1527: 00 + 1528: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 152f: e8 7c 2b 00 00 call 40b0 + exit(0); + 1534: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 153b: e8 22 2a 00 00 call 3f62 + +00001540 : +{ + 1540: 55 push %ebp + 1541: 89 e5 mov %esp,%ebp + 1543: 56 push %esi + 1544: 53 push %ebx + 1545: 83 ec 10 sub $0x10,%esp + printf(1, "unlinkread test\n"); + 1548: c7 44 24 04 f4 48 00 movl $0x48f4,0x4(%esp) + 154f: 00 + 1550: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1557: e8 54 2b 00 00 call 40b0 + fd = open("unlinkread", O_CREATE | O_RDWR); + 155c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 1563: 00 + 1564: c7 04 24 05 49 00 00 movl $0x4905,(%esp) + 156b: e8 32 2a 00 00 call 3fa2 + if (fd < 0) + 1570: 85 c0 test %eax,%eax + fd = open("unlinkread", O_CREATE | O_RDWR); + 1572: 89 c3 mov %eax,%ebx + if (fd < 0) + 1574: 0f 88 02 01 00 00 js 167c + write(fd, "hello", 5); + 157a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp) + 1581: 00 + 1582: c7 44 24 04 2a 49 00 movl $0x492a,0x4(%esp) + 1589: 00 + 158a: 89 04 24 mov %eax,(%esp) + 158d: e8 f0 29 00 00 call 3f82 + close(fd); + 1592: 89 1c 24 mov %ebx,(%esp) + 1595: e8 f0 29 00 00 call 3f8a + fd = open("unlinkread", O_RDWR); + 159a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 15a1: 00 + 15a2: c7 04 24 05 49 00 00 movl $0x4905,(%esp) + 15a9: e8 f4 29 00 00 call 3fa2 + if (fd < 0) + 15ae: 85 c0 test %eax,%eax + fd = open("unlinkread", O_RDWR); + 15b0: 89 c3 mov %eax,%ebx + if (fd < 0) + 15b2: 0f 88 64 01 00 00 js 171c + if (unlink("unlinkread") != 0) + 15b8: c7 04 24 05 49 00 00 movl $0x4905,(%esp) + 15bf: e8 ee 29 00 00 call 3fb2 + 15c4: 85 c0 test %eax,%eax + 15c6: 0f 85 30 01 00 00 jne 16fc + fd1 = open("unlinkread", O_CREATE | O_RDWR); + 15cc: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 15d3: 00 + 15d4: c7 04 24 05 49 00 00 movl $0x4905,(%esp) + 15db: e8 c2 29 00 00 call 3fa2 + write(fd1, "yyy", 3); + 15e0: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp) + 15e7: 00 + 15e8: c7 44 24 04 62 49 00 movl $0x4962,0x4(%esp) + 15ef: 00 + fd1 = open("unlinkread", O_CREATE | O_RDWR); + 15f0: 89 c6 mov %eax,%esi + write(fd1, "yyy", 3); + 15f2: 89 04 24 mov %eax,(%esp) + 15f5: e8 88 29 00 00 call 3f82 + close(fd1); + 15fa: 89 34 24 mov %esi,(%esp) + 15fd: e8 88 29 00 00 call 3f8a + if (read(fd, buf, sizeof(buf)) != 5) + 1602: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) + 1609: 00 + 160a: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 1611: 00 + 1612: 89 1c 24 mov %ebx,(%esp) + 1615: e8 60 29 00 00 call 3f7a + 161a: 83 f8 05 cmp $0x5,%eax + 161d: 0f 85 b9 00 00 00 jne 16dc + if (buf[0] != 'h') + 1623: 80 3d 80 8c 00 00 68 cmpb $0x68,0x8c80 + 162a: 0f 85 8c 00 00 00 jne 16bc + if (write(fd, buf, 10) != 10) + 1630: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) + 1637: 00 + 1638: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 163f: 00 + 1640: 89 1c 24 mov %ebx,(%esp) + 1643: e8 3a 29 00 00 call 3f82 + 1648: 83 f8 0a cmp $0xa,%eax + 164b: 75 4f jne 169c + close(fd); + 164d: 89 1c 24 mov %ebx,(%esp) + 1650: e8 35 29 00 00 call 3f8a + unlink("unlinkread"); + 1655: c7 04 24 05 49 00 00 movl $0x4905,(%esp) + 165c: e8 51 29 00 00 call 3fb2 + printf(1, "unlinkread ok\n"); + 1661: c7 44 24 04 ad 49 00 movl $0x49ad,0x4(%esp) + 1668: 00 + 1669: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1670: e8 3b 2a 00 00 call 40b0 +} + 1675: 83 c4 10 add $0x10,%esp + 1678: 5b pop %ebx + 1679: 5e pop %esi + 167a: 5d pop %ebp + 167b: c3 ret + printf(1, "create unlinkread failed\n"); + 167c: c7 44 24 04 10 49 00 movl $0x4910,0x4(%esp) + 1683: 00 + 1684: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 168b: e8 20 2a 00 00 call 40b0 + exit(0); + 1690: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1697: e8 c6 28 00 00 call 3f62 + printf(1, "unlinkread write failed\n"); + 169c: c7 44 24 04 94 49 00 movl $0x4994,0x4(%esp) + 16a3: 00 + 16a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 16ab: e8 00 2a 00 00 call 40b0 + exit(0); + 16b0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 16b7: e8 a6 28 00 00 call 3f62 + printf(1, "unlinkread wrong data\n"); + 16bc: c7 44 24 04 7d 49 00 movl $0x497d,0x4(%esp) + 16c3: 00 + 16c4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 16cb: e8 e0 29 00 00 call 40b0 + exit(0); + 16d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 16d7: e8 86 28 00 00 call 3f62 + printf(1, "unlinkread read failed"); + 16dc: c7 44 24 04 66 49 00 movl $0x4966,0x4(%esp) + 16e3: 00 + 16e4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 16eb: e8 c0 29 00 00 call 40b0 + exit(0); + 16f0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 16f7: e8 66 28 00 00 call 3f62 + printf(1, "unlink unlinkread failed\n"); + 16fc: c7 44 24 04 48 49 00 movl $0x4948,0x4(%esp) + 1703: 00 + 1704: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 170b: e8 a0 29 00 00 call 40b0 + exit(0); + 1710: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1717: e8 46 28 00 00 call 3f62 + printf(1, "open unlinkread failed\n"); + 171c: c7 44 24 04 30 49 00 movl $0x4930,0x4(%esp) + 1723: 00 + 1724: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 172b: e8 80 29 00 00 call 40b0 + exit(0); + 1730: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1737: e8 26 28 00 00 call 3f62 + 173c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +00001740 : +{ + 1740: 55 push %ebp + 1741: 89 e5 mov %esp,%ebp + 1743: 53 push %ebx + 1744: 83 ec 14 sub $0x14,%esp + printf(1, "linktest\n"); + 1747: c7 44 24 04 bc 49 00 movl $0x49bc,0x4(%esp) + 174e: 00 + 174f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1756: e8 55 29 00 00 call 40b0 + unlink("lf1"); + 175b: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) + 1762: e8 4b 28 00 00 call 3fb2 + unlink("lf2"); + 1767: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) + 176e: e8 3f 28 00 00 call 3fb2 + fd = open("lf1", O_CREATE | O_RDWR); + 1773: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 177a: 00 + 177b: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) + 1782: e8 1b 28 00 00 call 3fa2 + if (fd < 0) + 1787: 85 c0 test %eax,%eax + fd = open("lf1", O_CREATE | O_RDWR); + 1789: 89 c3 mov %eax,%ebx + if (fd < 0) + 178b: 0f 88 26 01 00 00 js 18b7 + if (write(fd, "hello", 5) != 5) + 1791: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp) + 1798: 00 + 1799: c7 44 24 04 2a 49 00 movl $0x492a,0x4(%esp) + 17a0: 00 + 17a1: 89 04 24 mov %eax,(%esp) + 17a4: e8 d9 27 00 00 call 3f82 + 17a9: 83 f8 05 cmp $0x5,%eax + 17ac: 0f 85 05 02 00 00 jne 19b7 + close(fd); + 17b2: 89 1c 24 mov %ebx,(%esp) + 17b5: e8 d0 27 00 00 call 3f8a + if (link("lf1", "lf2") < 0) + 17ba: c7 44 24 04 ca 49 00 movl $0x49ca,0x4(%esp) + 17c1: 00 + 17c2: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) + 17c9: e8 f4 27 00 00 call 3fc2 + 17ce: 85 c0 test %eax,%eax + 17d0: 0f 88 c1 01 00 00 js 1997 + unlink("lf1"); + 17d6: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) + 17dd: e8 d0 27 00 00 call 3fb2 + if (open("lf1", 0) >= 0) + 17e2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 17e9: 00 + 17ea: c7 04 24 c6 49 00 00 movl $0x49c6,(%esp) + 17f1: e8 ac 27 00 00 call 3fa2 + 17f6: 85 c0 test %eax,%eax + 17f8: 0f 89 79 01 00 00 jns 1977 + fd = open("lf2", 0); + 17fe: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1805: 00 + 1806: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) + 180d: e8 90 27 00 00 call 3fa2 + if (fd < 0) + 1812: 85 c0 test %eax,%eax + fd = open("lf2", 0); + 1814: 89 c3 mov %eax,%ebx + if (fd < 0) + 1816: 0f 88 3b 01 00 00 js 1957 + if (read(fd, buf, sizeof(buf)) != 5) + 181c: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) + 1823: 00 + 1824: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 182b: 00 + 182c: 89 04 24 mov %eax,(%esp) + 182f: e8 46 27 00 00 call 3f7a + 1834: 83 f8 05 cmp $0x5,%eax + 1837: 0f 85 fa 00 00 00 jne 1937 + close(fd); + 183d: 89 1c 24 mov %ebx,(%esp) + 1840: e8 45 27 00 00 call 3f8a + if (link("lf2", "lf2") >= 0) + 1845: c7 44 24 04 ca 49 00 movl $0x49ca,0x4(%esp) + 184c: 00 + 184d: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) + 1854: e8 69 27 00 00 call 3fc2 + 1859: 85 c0 test %eax,%eax + 185b: 0f 89 b6 00 00 00 jns 1917 + unlink("lf2"); + 1861: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) + 1868: e8 45 27 00 00 call 3fb2 + if (link("lf2", "lf1") >= 0) + 186d: c7 44 24 04 c6 49 00 movl $0x49c6,0x4(%esp) + 1874: 00 + 1875: c7 04 24 ca 49 00 00 movl $0x49ca,(%esp) + 187c: e8 41 27 00 00 call 3fc2 + 1881: 85 c0 test %eax,%eax + 1883: 79 72 jns 18f7 + if (link(".", "lf1") >= 0) + 1885: c7 44 24 04 c6 49 00 movl $0x49c6,0x4(%esp) + 188c: 00 + 188d: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) + 1894: e8 29 27 00 00 call 3fc2 + 1899: 85 c0 test %eax,%eax + 189b: 79 3a jns 18d7 + printf(1, "linktest ok\n"); + 189d: c7 44 24 04 64 4a 00 movl $0x4a64,0x4(%esp) + 18a4: 00 + 18a5: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 18ac: e8 ff 27 00 00 call 40b0 +} + 18b1: 83 c4 14 add $0x14,%esp + 18b4: 5b pop %ebx + 18b5: 5d pop %ebp + 18b6: c3 ret + printf(1, "create lf1 failed\n"); + 18b7: c7 44 24 04 ce 49 00 movl $0x49ce,0x4(%esp) + 18be: 00 + 18bf: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 18c6: e8 e5 27 00 00 call 40b0 + exit(0); + 18cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 18d2: e8 8b 26 00 00 call 3f62 + printf(1, "link . lf1 succeeded! oops\n"); + 18d7: c7 44 24 04 48 4a 00 movl $0x4a48,0x4(%esp) + 18de: 00 + 18df: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 18e6: e8 c5 27 00 00 call 40b0 + exit(0); + 18eb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 18f2: e8 6b 26 00 00 call 3f62 + printf(1, "link non-existant succeeded! oops\n"); + 18f7: c7 44 24 04 fc 55 00 movl $0x55fc,0x4(%esp) + 18fe: 00 + 18ff: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1906: e8 a5 27 00 00 call 40b0 + exit(0); + 190b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1912: e8 4b 26 00 00 call 3f62 + printf(1, "link lf2 lf2 succeeded! oops\n"); + 1917: c7 44 24 04 2a 4a 00 movl $0x4a2a,0x4(%esp) + 191e: 00 + 191f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1926: e8 85 27 00 00 call 40b0 + exit(0); + 192b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1932: e8 2b 26 00 00 call 3f62 + printf(1, "read lf2 failed\n"); + 1937: c7 44 24 04 19 4a 00 movl $0x4a19,0x4(%esp) + 193e: 00 + 193f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1946: e8 65 27 00 00 call 40b0 + exit(0); + 194b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1952: e8 0b 26 00 00 call 3f62 + printf(1, "open lf2 failed\n"); + 1957: c7 44 24 04 08 4a 00 movl $0x4a08,0x4(%esp) + 195e: 00 + 195f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1966: e8 45 27 00 00 call 40b0 + exit(0); + 196b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1972: e8 eb 25 00 00 call 3f62 + printf(1, "unlinked lf1 but it is still there!\n"); + 1977: c7 44 24 04 d4 55 00 movl $0x55d4,0x4(%esp) + 197e: 00 + 197f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1986: e8 25 27 00 00 call 40b0 + exit(0); + 198b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1992: e8 cb 25 00 00 call 3f62 + printf(1, "link lf1 lf2 failed\n"); + 1997: c7 44 24 04 f3 49 00 movl $0x49f3,0x4(%esp) + 199e: 00 + 199f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 19a6: e8 05 27 00 00 call 40b0 + exit(0); + 19ab: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 19b2: e8 ab 25 00 00 call 3f62 + printf(1, "write lf1 failed\n"); + 19b7: c7 44 24 04 e1 49 00 movl $0x49e1,0x4(%esp) + 19be: 00 + 19bf: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 19c6: e8 e5 26 00 00 call 40b0 + exit(0); + 19cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 19d2: e8 8b 25 00 00 call 3f62 + 19d7: 89 f6 mov %esi,%esi + 19d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000019e0 : +{ + 19e0: 55 push %ebp + 19e1: 89 e5 mov %esp,%ebp + 19e3: 57 push %edi + 19e4: 56 push %esi + for (i = 0; i < 40; i++) + 19e5: 31 f6 xor %esi,%esi +{ + 19e7: 53 push %ebx + 19e8: 83 ec 5c sub $0x5c,%esp + printf(1, "concreate test\n"); + 19eb: c7 44 24 04 71 4a 00 movl $0x4a71,0x4(%esp) + 19f2: 00 + 19f3: 8d 5d ad lea -0x53(%ebp),%ebx + 19f6: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 19fd: e8 ae 26 00 00 call 40b0 + file[0] = 'C'; + 1a02: c6 45 ad 43 movb $0x43,-0x53(%ebp) + file[2] = '\0'; + 1a06: c6 45 af 00 movb $0x0,-0x51(%ebp) + 1a0a: eb 5a jmp 1a66 + 1a0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if (pid && (i % 3) == 1) + 1a10: b8 56 55 55 55 mov $0x55555556,%eax + 1a15: 89 f1 mov %esi,%ecx + 1a17: f7 ee imul %esi + 1a19: 89 f0 mov %esi,%eax + 1a1b: c1 f8 1f sar $0x1f,%eax + 1a1e: 29 c2 sub %eax,%edx + 1a20: 8d 04 52 lea (%edx,%edx,2),%eax + 1a23: 29 c1 sub %eax,%ecx + 1a25: 83 f9 01 cmp $0x1,%ecx + 1a28: 0f 84 8a 00 00 00 je 1ab8 + fd = open(file, O_CREATE | O_RDWR); + 1a2e: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 1a35: 00 + 1a36: 89 1c 24 mov %ebx,(%esp) + 1a39: e8 64 25 00 00 call 3fa2 + if (fd < 0) + 1a3e: 85 c0 test %eax,%eax + 1a40: 0f 88 5e 02 00 00 js 1ca4 + close(fd); + 1a46: 89 04 24 mov %eax,(%esp) + 1a49: e8 3c 25 00 00 call 3f8a + if (pid == 0) + 1a4e: 85 ff test %edi,%edi + 1a50: 74 59 je 1aab + wait(0); + 1a52: c7 04 24 00 00 00 00 movl $0x0,(%esp) + for (i = 0; i < 40; i++) + 1a59: 83 c6 01 add $0x1,%esi + wait(0); + 1a5c: e8 09 25 00 00 call 3f6a + for (i = 0; i < 40; i++) + 1a61: 83 fe 28 cmp $0x28,%esi + 1a64: 74 6a je 1ad0 + 1a66: 8d 46 30 lea 0x30(%esi),%eax + unlink(file); + 1a69: 89 1c 24 mov %ebx,(%esp) + 1a6c: 88 45 ae mov %al,-0x52(%ebp) + 1a6f: e8 3e 25 00 00 call 3fb2 + pid = fork(); + 1a74: e8 e1 24 00 00 call 3f5a + if (pid && (i % 3) == 1) + 1a79: 85 c0 test %eax,%eax + pid = fork(); + 1a7b: 89 c7 mov %eax,%edi + if (pid && (i % 3) == 1) + 1a7d: 75 91 jne 1a10 + else if (pid == 0 && (i % 5) == 1) + 1a7f: b8 67 66 66 66 mov $0x66666667,%eax + 1a84: 89 f1 mov %esi,%ecx + 1a86: f7 ee imul %esi + 1a88: 89 f0 mov %esi,%eax + 1a8a: c1 f8 1f sar $0x1f,%eax + 1a8d: d1 fa sar %edx + 1a8f: 29 c2 sub %eax,%edx + 1a91: 8d 04 92 lea (%edx,%edx,4),%eax + 1a94: 29 c1 sub %eax,%ecx + 1a96: 83 f9 01 cmp $0x1,%ecx + 1a99: 75 93 jne 1a2e + link("C0", file); + 1a9b: 89 5c 24 04 mov %ebx,0x4(%esp) + 1a9f: c7 04 24 81 4a 00 00 movl $0x4a81,(%esp) + 1aa6: e8 17 25 00 00 call 3fc2 + exit(0); + 1aab: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1ab2: e8 ab 24 00 00 call 3f62 + 1ab7: 90 nop + link("C0", file); + 1ab8: 89 5c 24 04 mov %ebx,0x4(%esp) + 1abc: c7 04 24 81 4a 00 00 movl $0x4a81,(%esp) + 1ac3: e8 fa 24 00 00 call 3fc2 + 1ac8: eb 88 jmp 1a52 + 1aca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + memset(fa, 0, sizeof(fa)); + 1ad0: 8d 45 c0 lea -0x40(%ebp),%eax + 1ad3: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp) + 1ada: 00 + 1adb: 8d 7d b0 lea -0x50(%ebp),%edi + 1ade: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1ae5: 00 + 1ae6: 89 04 24 mov %eax,(%esp) + 1ae9: e8 02 23 00 00 call 3df0 + fd = open(".", 0); + 1aee: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1af5: 00 + 1af6: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) + 1afd: e8 a0 24 00 00 call 3fa2 + n = 0; + 1b02: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp) + fd = open(".", 0); + 1b09: 89 c6 mov %eax,%esi + 1b0b: 90 nop + 1b0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while (read(fd, &de, sizeof(de)) > 0) + 1b10: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) + 1b17: 00 + 1b18: 89 7c 24 04 mov %edi,0x4(%esp) + 1b1c: 89 34 24 mov %esi,(%esp) + 1b1f: e8 56 24 00 00 call 3f7a + 1b24: 85 c0 test %eax,%eax + 1b26: 7e 40 jle 1b68 + if (de.inum == 0) + 1b28: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp) + 1b2d: 74 e1 je 1b10 + if (de.name[0] == 'C' && de.name[2] == '\0') + 1b2f: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp) + 1b33: 75 db jne 1b10 + 1b35: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp) + 1b39: 75 d5 jne 1b10 + i = de.name[1] - '0'; + 1b3b: 0f be 45 b3 movsbl -0x4d(%ebp),%eax + 1b3f: 83 e8 30 sub $0x30,%eax + if (i < 0 || i >= sizeof(fa)) + 1b42: 83 f8 27 cmp $0x27,%eax + 1b45: 0f 87 7d 01 00 00 ja 1cc8 + if (fa[i]) + 1b4b: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1) + 1b50: 0f 85 b2 01 00 00 jne 1d08 + fa[i] = 1; + 1b56: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1) + n++; + 1b5b: 83 45 a4 01 addl $0x1,-0x5c(%ebp) + 1b5f: eb af jmp 1b10 + 1b61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + close(fd); + 1b68: 89 34 24 mov %esi,(%esp) + 1b6b: e8 1a 24 00 00 call 3f8a + if (n != 40) + 1b70: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp) + 1b74: 0f 85 6e 01 00 00 jne 1ce8 + 1b7a: 31 f6 xor %esi,%esi + 1b7c: e9 8b 00 00 00 jmp 1c0c + 1b81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + ((i % 3) == 1 && pid != 0)) + 1b88: 85 ff test %edi,%edi + 1b8a: 0f 84 b5 00 00 00 je 1c45 + close(open(file, 0)); + 1b90: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1b97: 00 + 1b98: 89 1c 24 mov %ebx,(%esp) + 1b9b: e8 02 24 00 00 call 3fa2 + 1ba0: 89 04 24 mov %eax,(%esp) + 1ba3: e8 e2 23 00 00 call 3f8a + close(open(file, 0)); + 1ba8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1baf: 00 + 1bb0: 89 1c 24 mov %ebx,(%esp) + 1bb3: e8 ea 23 00 00 call 3fa2 + 1bb8: 89 04 24 mov %eax,(%esp) + 1bbb: e8 ca 23 00 00 call 3f8a + close(open(file, 0)); + 1bc0: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1bc7: 00 + 1bc8: 89 1c 24 mov %ebx,(%esp) + 1bcb: e8 d2 23 00 00 call 3fa2 + 1bd0: 89 04 24 mov %eax,(%esp) + 1bd3: e8 b2 23 00 00 call 3f8a + close(open(file, 0)); + 1bd8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1bdf: 00 + 1be0: 89 1c 24 mov %ebx,(%esp) + 1be3: e8 ba 23 00 00 call 3fa2 + 1be8: 89 04 24 mov %eax,(%esp) + 1beb: e8 9a 23 00 00 call 3f8a + if (pid == 0) + 1bf0: 85 ff test %edi,%edi + 1bf2: 0f 84 b3 fe ff ff je 1aab + wait(0); + 1bf8: c7 04 24 00 00 00 00 movl $0x0,(%esp) + for (i = 0; i < 40; i++) + 1bff: 83 c6 01 add $0x1,%esi + wait(0); + 1c02: e8 63 23 00 00 call 3f6a + for (i = 0; i < 40; i++) + 1c07: 83 fe 28 cmp $0x28,%esi + 1c0a: 74 5c je 1c68 + 1c0c: 8d 46 30 lea 0x30(%esi),%eax + 1c0f: 88 45 ae mov %al,-0x52(%ebp) + pid = fork(); + 1c12: e8 43 23 00 00 call 3f5a + if (pid < 0) + 1c17: 85 c0 test %eax,%eax + pid = fork(); + 1c19: 89 c7 mov %eax,%edi + if (pid < 0) + 1c1b: 78 67 js 1c84 + if (((i % 3) == 0 && pid == 0) || + 1c1d: b8 56 55 55 55 mov $0x55555556,%eax + 1c22: f7 ee imul %esi + 1c24: 89 f0 mov %esi,%eax + 1c26: c1 f8 1f sar $0x1f,%eax + 1c29: 29 c2 sub %eax,%edx + 1c2b: 8d 04 52 lea (%edx,%edx,2),%eax + 1c2e: 89 f2 mov %esi,%edx + 1c30: 29 c2 sub %eax,%edx + 1c32: 89 d0 mov %edx,%eax + 1c34: 09 f8 or %edi,%eax + 1c36: 0f 84 54 ff ff ff je 1b90 + 1c3c: 83 fa 01 cmp $0x1,%edx + 1c3f: 0f 84 43 ff ff ff je 1b88 + unlink(file); + 1c45: 89 1c 24 mov %ebx,(%esp) + 1c48: e8 65 23 00 00 call 3fb2 + unlink(file); + 1c4d: 89 1c 24 mov %ebx,(%esp) + 1c50: e8 5d 23 00 00 call 3fb2 + unlink(file); + 1c55: 89 1c 24 mov %ebx,(%esp) + 1c58: e8 55 23 00 00 call 3fb2 + unlink(file); + 1c5d: 89 1c 24 mov %ebx,(%esp) + 1c60: e8 4d 23 00 00 call 3fb2 + 1c65: eb 89 jmp 1bf0 + 1c67: 90 nop + printf(1, "concreate ok\n"); + 1c68: c7 44 24 04 d6 4a 00 movl $0x4ad6,0x4(%esp) + 1c6f: 00 + 1c70: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1c77: e8 34 24 00 00 call 40b0 +} + 1c7c: 83 c4 5c add $0x5c,%esp + 1c7f: 5b pop %ebx + 1c80: 5e pop %esi + 1c81: 5f pop %edi + 1c82: 5d pop %ebp + 1c83: c3 ret + printf(1, "fork failed\n"); + 1c84: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 1c8b: 00 + 1c8c: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1c93: e8 18 24 00 00 call 40b0 + exit(0); + 1c98: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1c9f: e8 be 22 00 00 call 3f62 + printf(1, "concreate create %s failed\n", file); + 1ca4: 89 5c 24 08 mov %ebx,0x8(%esp) + 1ca8: c7 44 24 04 84 4a 00 movl $0x4a84,0x4(%esp) + 1caf: 00 + 1cb0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1cb7: e8 f4 23 00 00 call 40b0 + exit(0); + 1cbc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1cc3: e8 9a 22 00 00 call 3f62 + printf(1, "concreate weird file %s\n", de.name); + 1cc8: 8d 45 b2 lea -0x4e(%ebp),%eax + 1ccb: 89 44 24 08 mov %eax,0x8(%esp) + 1ccf: c7 44 24 04 a0 4a 00 movl $0x4aa0,0x4(%esp) + 1cd6: 00 + 1cd7: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1cde: e8 cd 23 00 00 call 40b0 + 1ce3: e9 c3 fd ff ff jmp 1aab + printf(1, "concreate not enough files in directory listing\n"); + 1ce8: c7 44 24 04 20 56 00 movl $0x5620,0x4(%esp) + 1cef: 00 + 1cf0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1cf7: e8 b4 23 00 00 call 40b0 + exit(0); + 1cfc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1d03: e8 5a 22 00 00 call 3f62 + printf(1, "concreate duplicate file %s\n", de.name); + 1d08: 8d 45 b2 lea -0x4e(%ebp),%eax + 1d0b: 89 44 24 08 mov %eax,0x8(%esp) + 1d0f: c7 44 24 04 b9 4a 00 movl $0x4ab9,0x4(%esp) + 1d16: 00 + 1d17: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1d1e: e8 8d 23 00 00 call 40b0 + exit(0); + 1d23: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1d2a: e8 33 22 00 00 call 3f62 + 1d2f: 90 nop + +00001d30 : +{ + 1d30: 55 push %ebp + 1d31: 89 e5 mov %esp,%ebp + 1d33: 57 push %edi + 1d34: 56 push %esi + 1d35: 53 push %ebx + 1d36: 83 ec 1c sub $0x1c,%esp + printf(1, "linkunlink test\n"); + 1d39: c7 44 24 04 e4 4a 00 movl $0x4ae4,0x4(%esp) + 1d40: 00 + 1d41: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1d48: e8 63 23 00 00 call 40b0 + unlink("x"); + 1d4d: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp) + 1d54: e8 59 22 00 00 call 3fb2 + pid = fork(); + 1d59: e8 fc 21 00 00 call 3f5a + if (pid < 0) + 1d5e: 85 c0 test %eax,%eax + pid = fork(); + 1d60: 89 45 e4 mov %eax,-0x1c(%ebp) + if (pid < 0) + 1d63: 0f 88 c0 00 00 00 js 1e29 + unsigned int x = (pid ? 1 : 97); + 1d69: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp) + 1d6d: bb 64 00 00 00 mov $0x64,%ebx + if ((x % 3) == 0) + 1d72: be ab aa aa aa mov $0xaaaaaaab,%esi + unsigned int x = (pid ? 1 : 97); + 1d77: 19 ff sbb %edi,%edi + 1d79: 83 e7 60 and $0x60,%edi + 1d7c: 83 c7 01 add $0x1,%edi + 1d7f: eb 21 jmp 1da2 + 1d81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + else if ((x % 3) == 1) + 1d88: 83 fa 01 cmp $0x1,%edx + 1d8b: 0f 84 7f 00 00 00 je 1e10 + unlink("x"); + 1d91: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp) + 1d98: e8 15 22 00 00 call 3fb2 + for (i = 0; i < 100; i++) + 1d9d: 83 eb 01 sub $0x1,%ebx + 1da0: 74 3c je 1dde + x = x * 1103515245 + 12345; + 1da2: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx + 1da8: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi + if ((x % 3) == 0) + 1dae: 89 f8 mov %edi,%eax + 1db0: f7 e6 mul %esi + 1db2: d1 ea shr %edx + 1db4: 8d 04 52 lea (%edx,%edx,2),%eax + 1db7: 89 fa mov %edi,%edx + 1db9: 29 c2 sub %eax,%edx + 1dbb: 75 cb jne 1d88 + close(open("x", O_RDWR | O_CREATE)); + 1dbd: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 1dc4: 00 + 1dc5: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp) + 1dcc: e8 d1 21 00 00 call 3fa2 + 1dd1: 89 04 24 mov %eax,(%esp) + 1dd4: e8 b1 21 00 00 call 3f8a + for (i = 0; i < 100; i++) + 1dd9: 83 eb 01 sub $0x1,%ebx + 1ddc: 75 c4 jne 1da2 + if (pid) + 1dde: 8b 45 e4 mov -0x1c(%ebp),%eax + wait(0); + 1de1: c7 04 24 00 00 00 00 movl $0x0,(%esp) + if (pid) + 1de8: 85 c0 test %eax,%eax + 1dea: 74 5d je 1e49 + wait(0); + 1dec: e8 79 21 00 00 call 3f6a + printf(1, "linkunlink ok\n"); + 1df1: c7 44 24 04 f9 4a 00 movl $0x4af9,0x4(%esp) + 1df8: 00 + 1df9: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1e00: e8 ab 22 00 00 call 40b0 +} + 1e05: 83 c4 1c add $0x1c,%esp + 1e08: 5b pop %ebx + 1e09: 5e pop %esi + 1e0a: 5f pop %edi + 1e0b: 5d pop %ebp + 1e0c: c3 ret + 1e0d: 8d 76 00 lea 0x0(%esi),%esi + link("cat", "x"); + 1e10: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) + 1e17: 00 + 1e18: c7 04 24 f5 4a 00 00 movl $0x4af5,(%esp) + 1e1f: e8 9e 21 00 00 call 3fc2 + 1e24: e9 74 ff ff ff jmp 1d9d + printf(1, "fork failed\n"); + 1e29: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 1e30: 00 + 1e31: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1e38: e8 73 22 00 00 call 40b0 + exit(0); + 1e3d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1e44: e8 19 21 00 00 call 3f62 + exit(0); + 1e49: e8 14 21 00 00 call 3f62 + 1e4e: 66 90 xchg %ax,%ax + +00001e50 : +{ + 1e50: 55 push %ebp + 1e51: 89 e5 mov %esp,%ebp + 1e53: 56 push %esi + 1e54: 53 push %ebx + 1e55: 83 ec 20 sub $0x20,%esp + printf(1, "bigdir test\n"); + 1e58: c7 44 24 04 08 4b 00 movl $0x4b08,0x4(%esp) + 1e5f: 00 + 1e60: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1e67: e8 44 22 00 00 call 40b0 + unlink("bd"); + 1e6c: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) + 1e73: e8 3a 21 00 00 call 3fb2 + fd = open("bd", O_CREATE); + 1e78: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 1e7f: 00 + 1e80: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) + 1e87: e8 16 21 00 00 call 3fa2 + if (fd < 0) + 1e8c: 85 c0 test %eax,%eax + 1e8e: 0f 88 f4 00 00 00 js 1f88 + close(fd); + 1e94: 89 04 24 mov %eax,(%esp) + for (i = 0; i < 500; i++) + 1e97: 31 db xor %ebx,%ebx + close(fd); + 1e99: e8 ec 20 00 00 call 3f8a + 1e9e: 8d 75 ee lea -0x12(%ebp),%esi + 1ea1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + name[1] = '0' + (i / 64); + 1ea8: 89 d8 mov %ebx,%eax + 1eaa: c1 f8 06 sar $0x6,%eax + 1ead: 83 c0 30 add $0x30,%eax + 1eb0: 88 45 ef mov %al,-0x11(%ebp) + name[2] = '0' + (i % 64); + 1eb3: 89 d8 mov %ebx,%eax + 1eb5: 83 e0 3f and $0x3f,%eax + 1eb8: 83 c0 30 add $0x30,%eax + if (link("bd", name) != 0) + 1ebb: 89 74 24 04 mov %esi,0x4(%esp) + 1ebf: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) + name[0] = 'x'; + 1ec6: c6 45 ee 78 movb $0x78,-0x12(%ebp) + name[2] = '0' + (i % 64); + 1eca: 88 45 f0 mov %al,-0x10(%ebp) + name[3] = '\0'; + 1ecd: c6 45 f1 00 movb $0x0,-0xf(%ebp) + if (link("bd", name) != 0) + 1ed1: e8 ec 20 00 00 call 3fc2 + 1ed6: 85 c0 test %eax,%eax + 1ed8: 75 6e jne 1f48 + for (i = 0; i < 500; i++) + 1eda: 83 c3 01 add $0x1,%ebx + 1edd: 81 fb f4 01 00 00 cmp $0x1f4,%ebx + 1ee3: 75 c3 jne 1ea8 + unlink("bd"); + 1ee5: c7 04 24 15 4b 00 00 movl $0x4b15,(%esp) + for (i = 0; i < 500; i++) + 1eec: 66 31 db xor %bx,%bx + unlink("bd"); + 1eef: e8 be 20 00 00 call 3fb2 + 1ef4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + name[1] = '0' + (i / 64); + 1ef8: 89 d8 mov %ebx,%eax + 1efa: c1 f8 06 sar $0x6,%eax + 1efd: 83 c0 30 add $0x30,%eax + 1f00: 88 45 ef mov %al,-0x11(%ebp) + name[2] = '0' + (i % 64); + 1f03: 89 d8 mov %ebx,%eax + 1f05: 83 e0 3f and $0x3f,%eax + 1f08: 83 c0 30 add $0x30,%eax + if (unlink(name) != 0) + 1f0b: 89 34 24 mov %esi,(%esp) + name[0] = 'x'; + 1f0e: c6 45 ee 78 movb $0x78,-0x12(%ebp) + name[2] = '0' + (i % 64); + 1f12: 88 45 f0 mov %al,-0x10(%ebp) + name[3] = '\0'; + 1f15: c6 45 f1 00 movb $0x0,-0xf(%ebp) + if (unlink(name) != 0) + 1f19: e8 94 20 00 00 call 3fb2 + 1f1e: 85 c0 test %eax,%eax + 1f20: 75 46 jne 1f68 + for (i = 0; i < 500; i++) + 1f22: 83 c3 01 add $0x1,%ebx + 1f25: 81 fb f4 01 00 00 cmp $0x1f4,%ebx + 1f2b: 75 cb jne 1ef8 + printf(1, "bigdir ok\n"); + 1f2d: c7 44 24 04 57 4b 00 movl $0x4b57,0x4(%esp) + 1f34: 00 + 1f35: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1f3c: e8 6f 21 00 00 call 40b0 +} + 1f41: 83 c4 20 add $0x20,%esp + 1f44: 5b pop %ebx + 1f45: 5e pop %esi + 1f46: 5d pop %ebp + 1f47: c3 ret + printf(1, "bigdir link failed\n"); + 1f48: c7 44 24 04 2e 4b 00 movl $0x4b2e,0x4(%esp) + 1f4f: 00 + 1f50: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1f57: e8 54 21 00 00 call 40b0 + exit(0); + 1f5c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1f63: e8 fa 1f 00 00 call 3f62 + printf(1, "bigdir unlink failed"); + 1f68: c7 44 24 04 42 4b 00 movl $0x4b42,0x4(%esp) + 1f6f: 00 + 1f70: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1f77: e8 34 21 00 00 call 40b0 + exit(0); + 1f7c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1f83: e8 da 1f 00 00 call 3f62 + printf(1, "bigdir create failed\n"); + 1f88: c7 44 24 04 18 4b 00 movl $0x4b18,0x4(%esp) + 1f8f: 00 + 1f90: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1f97: e8 14 21 00 00 call 40b0 + exit(0); + 1f9c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 1fa3: e8 ba 1f 00 00 call 3f62 + 1fa8: 90 nop + 1fa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00001fb0 : +{ + 1fb0: 55 push %ebp + 1fb1: 89 e5 mov %esp,%ebp + 1fb3: 53 push %ebx + 1fb4: 83 ec 14 sub $0x14,%esp + printf(1, "subdir test\n"); + 1fb7: c7 44 24 04 62 4b 00 movl $0x4b62,0x4(%esp) + 1fbe: 00 + 1fbf: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 1fc6: e8 e5 20 00 00 call 40b0 + unlink("ff"); + 1fcb: c7 04 24 eb 4b 00 00 movl $0x4beb,(%esp) + 1fd2: e8 db 1f 00 00 call 3fb2 + if (mkdir("dd") != 0) + 1fd7: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 1fde: e8 e7 1f 00 00 call 3fca + 1fe3: 85 c0 test %eax,%eax + 1fe5: 0f 85 a1 06 00 00 jne 268c + fd = open("dd/ff", O_CREATE | O_RDWR); + 1feb: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 1ff2: 00 + 1ff3: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) + 1ffa: e8 a3 1f 00 00 call 3fa2 + if (fd < 0) + 1fff: 85 c0 test %eax,%eax + fd = open("dd/ff", O_CREATE | O_RDWR); + 2001: 89 c3 mov %eax,%ebx + if (fd < 0) + 2003: 0f 88 63 06 00 00 js 266c + write(fd, "ff", 2); + 2009: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp) + 2010: 00 + 2011: c7 44 24 04 eb 4b 00 movl $0x4beb,0x4(%esp) + 2018: 00 + 2019: 89 04 24 mov %eax,(%esp) + 201c: e8 61 1f 00 00 call 3f82 + close(fd); + 2021: 89 1c 24 mov %ebx,(%esp) + 2024: e8 61 1f 00 00 call 3f8a + if (unlink("dd") >= 0) + 2029: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 2030: e8 7d 1f 00 00 call 3fb2 + 2035: 85 c0 test %eax,%eax + 2037: 0f 89 0f 06 00 00 jns 264c + if (mkdir("/dd/dd") != 0) + 203d: c7 04 24 9c 4b 00 00 movl $0x4b9c,(%esp) + 2044: e8 81 1f 00 00 call 3fca + 2049: 85 c0 test %eax,%eax + 204b: 0f 85 db 05 00 00 jne 262c + fd = open("dd/dd/ff", O_CREATE | O_RDWR); + 2051: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 2058: 00 + 2059: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) + 2060: e8 3d 1f 00 00 call 3fa2 + if (fd < 0) + 2065: 85 c0 test %eax,%eax + fd = open("dd/dd/ff", O_CREATE | O_RDWR); + 2067: 89 c3 mov %eax,%ebx + if (fd < 0) + 2069: 0f 88 5d 04 00 00 js 24cc + write(fd, "FF", 2); + 206f: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp) + 2076: 00 + 2077: c7 44 24 04 df 4b 00 movl $0x4bdf,0x4(%esp) + 207e: 00 + 207f: 89 04 24 mov %eax,(%esp) + 2082: e8 fb 1e 00 00 call 3f82 + close(fd); + 2087: 89 1c 24 mov %ebx,(%esp) + 208a: e8 fb 1e 00 00 call 3f8a + fd = open("dd/dd/../ff", 0); + 208f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2096: 00 + 2097: c7 04 24 e2 4b 00 00 movl $0x4be2,(%esp) + 209e: e8 ff 1e 00 00 call 3fa2 + if (fd < 0) + 20a3: 85 c0 test %eax,%eax + fd = open("dd/dd/../ff", 0); + 20a5: 89 c3 mov %eax,%ebx + if (fd < 0) + 20a7: 0f 88 ff 03 00 00 js 24ac + cc = read(fd, buf, sizeof(buf)); + 20ad: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) + 20b4: 00 + 20b5: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 20bc: 00 + 20bd: 89 04 24 mov %eax,(%esp) + 20c0: e8 b5 1e 00 00 call 3f7a + if (cc != 2 || buf[0] != 'f') + 20c5: 83 f8 02 cmp $0x2,%eax + 20c8: 0f 85 fe 02 00 00 jne 23cc + 20ce: 80 3d 80 8c 00 00 66 cmpb $0x66,0x8c80 + 20d5: 0f 85 f1 02 00 00 jne 23cc + close(fd); + 20db: 89 1c 24 mov %ebx,(%esp) + 20de: e8 a7 1e 00 00 call 3f8a + if (link("dd/dd/ff", "dd/dd/ffff") != 0) + 20e3: c7 44 24 04 22 4c 00 movl $0x4c22,0x4(%esp) + 20ea: 00 + 20eb: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) + 20f2: e8 cb 1e 00 00 call 3fc2 + 20f7: 85 c0 test %eax,%eax + 20f9: 0f 85 0d 04 00 00 jne 250c + if (unlink("dd/dd/ff") != 0) + 20ff: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) + 2106: e8 a7 1e 00 00 call 3fb2 + 210b: 85 c0 test %eax,%eax + 210d: 0f 85 f9 02 00 00 jne 240c + if (open("dd/dd/ff", O_RDONLY) >= 0) + 2113: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 211a: 00 + 211b: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) + 2122: e8 7b 1e 00 00 call 3fa2 + 2127: 85 c0 test %eax,%eax + 2129: 0f 89 dd 04 00 00 jns 260c + if (chdir("dd") != 0) + 212f: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 2136: e8 97 1e 00 00 call 3fd2 + 213b: 85 c0 test %eax,%eax + 213d: 0f 85 a9 04 00 00 jne 25ec + if (chdir("dd/../../dd") != 0) + 2143: c7 04 24 56 4c 00 00 movl $0x4c56,(%esp) + 214a: e8 83 1e 00 00 call 3fd2 + 214f: 85 c0 test %eax,%eax + 2151: 0f 85 95 02 00 00 jne 23ec + if (chdir("dd/../../../dd") != 0) + 2157: c7 04 24 7c 4c 00 00 movl $0x4c7c,(%esp) + 215e: e8 6f 1e 00 00 call 3fd2 + 2163: 85 c0 test %eax,%eax + 2165: 0f 85 81 02 00 00 jne 23ec + if (chdir("./..") != 0) + 216b: c7 04 24 8b 4c 00 00 movl $0x4c8b,(%esp) + 2172: e8 5b 1e 00 00 call 3fd2 + 2177: 85 c0 test %eax,%eax + 2179: 0f 85 6d 03 00 00 jne 24ec + fd = open("dd/dd/ffff", 0); + 217f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2186: 00 + 2187: c7 04 24 22 4c 00 00 movl $0x4c22,(%esp) + 218e: e8 0f 1e 00 00 call 3fa2 + if (fd < 0) + 2193: 85 c0 test %eax,%eax + fd = open("dd/dd/ffff", 0); + 2195: 89 c3 mov %eax,%ebx + if (fd < 0) + 2197: 0f 88 6f 06 00 00 js 280c + if (read(fd, buf, sizeof(buf)) != 2) + 219d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp) + 21a4: 00 + 21a5: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 21ac: 00 + 21ad: 89 04 24 mov %eax,(%esp) + 21b0: e8 c5 1d 00 00 call 3f7a + 21b5: 83 f8 02 cmp $0x2,%eax + 21b8: 0f 85 2e 06 00 00 jne 27ec + close(fd); + 21be: 89 1c 24 mov %ebx,(%esp) + 21c1: e8 c4 1d 00 00 call 3f8a + if (open("dd/dd/ff", O_RDONLY) >= 0) + 21c6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 21cd: 00 + 21ce: c7 04 24 be 4b 00 00 movl $0x4bbe,(%esp) + 21d5: e8 c8 1d 00 00 call 3fa2 + 21da: 85 c0 test %eax,%eax + 21dc: 0f 89 6a 02 00 00 jns 244c + if (open("dd/ff/ff", O_CREATE | O_RDWR) >= 0) + 21e2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 21e9: 00 + 21ea: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) + 21f1: e8 ac 1d 00 00 call 3fa2 + 21f6: 85 c0 test %eax,%eax + 21f8: 0f 89 2e 02 00 00 jns 242c + if (open("dd/xx/ff", O_CREATE | O_RDWR) >= 0) + 21fe: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 2205: 00 + 2206: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) + 220d: e8 90 1d 00 00 call 3fa2 + 2212: 85 c0 test %eax,%eax + 2214: 0f 89 b2 03 00 00 jns 25cc + if (open("dd", O_CREATE) >= 0) + 221a: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 2221: 00 + 2222: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 2229: e8 74 1d 00 00 call 3fa2 + 222e: 85 c0 test %eax,%eax + 2230: 0f 89 76 03 00 00 jns 25ac + if (open("dd", O_RDWR) >= 0) + 2236: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 223d: 00 + 223e: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 2245: e8 58 1d 00 00 call 3fa2 + 224a: 85 c0 test %eax,%eax + 224c: 0f 89 3a 03 00 00 jns 258c + if (open("dd", O_WRONLY) >= 0) + 2252: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) + 2259: 00 + 225a: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 2261: e8 3c 1d 00 00 call 3fa2 + 2266: 85 c0 test %eax,%eax + 2268: 0f 89 fe 02 00 00 jns 256c + if (link("dd/ff/ff", "dd/dd/xx") == 0) + 226e: c7 44 24 04 6a 4d 00 movl $0x4d6a,0x4(%esp) + 2275: 00 + 2276: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) + 227d: e8 40 1d 00 00 call 3fc2 + 2282: 85 c0 test %eax,%eax + 2284: 0f 84 c2 02 00 00 je 254c + if (link("dd/xx/ff", "dd/dd/xx") == 0) + 228a: c7 44 24 04 6a 4d 00 movl $0x4d6a,0x4(%esp) + 2291: 00 + 2292: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) + 2299: e8 24 1d 00 00 call 3fc2 + 229e: 85 c0 test %eax,%eax + 22a0: 0f 84 86 02 00 00 je 252c + if (link("dd/ff", "dd/dd/ffff") == 0) + 22a6: c7 44 24 04 22 4c 00 movl $0x4c22,0x4(%esp) + 22ad: 00 + 22ae: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) + 22b5: e8 08 1d 00 00 call 3fc2 + 22ba: 85 c0 test %eax,%eax + 22bc: 0f 84 ca 01 00 00 je 248c + if (mkdir("dd/ff/ff") == 0) + 22c2: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) + 22c9: e8 fc 1c 00 00 call 3fca + 22ce: 85 c0 test %eax,%eax + 22d0: 0f 84 96 01 00 00 je 246c + if (mkdir("dd/xx/ff") == 0) + 22d6: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) + 22dd: e8 e8 1c 00 00 call 3fca + 22e2: 85 c0 test %eax,%eax + 22e4: 0f 84 e2 04 00 00 je 27cc + if (mkdir("dd/dd/ffff") == 0) + 22ea: c7 04 24 22 4c 00 00 movl $0x4c22,(%esp) + 22f1: e8 d4 1c 00 00 call 3fca + 22f6: 85 c0 test %eax,%eax + 22f8: 0f 84 ae 04 00 00 je 27ac + if (unlink("dd/xx/ff") == 0) + 22fe: c7 04 24 fb 4c 00 00 movl $0x4cfb,(%esp) + 2305: e8 a8 1c 00 00 call 3fb2 + 230a: 85 c0 test %eax,%eax + 230c: 0f 84 7a 04 00 00 je 278c + if (unlink("dd/ff/ff") == 0) + 2312: c7 04 24 d6 4c 00 00 movl $0x4cd6,(%esp) + 2319: e8 94 1c 00 00 call 3fb2 + 231e: 85 c0 test %eax,%eax + 2320: 0f 84 46 04 00 00 je 276c + if (chdir("dd/ff") == 0) + 2326: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) + 232d: e8 a0 1c 00 00 call 3fd2 + 2332: 85 c0 test %eax,%eax + 2334: 0f 84 12 04 00 00 je 274c + if (chdir("dd/xx") == 0) + 233a: c7 04 24 6d 4d 00 00 movl $0x4d6d,(%esp) + 2341: e8 8c 1c 00 00 call 3fd2 + 2346: 85 c0 test %eax,%eax + 2348: 0f 84 de 03 00 00 je 272c + if (unlink("dd/dd/ffff") != 0) + 234e: c7 04 24 22 4c 00 00 movl $0x4c22,(%esp) + 2355: e8 58 1c 00 00 call 3fb2 + 235a: 85 c0 test %eax,%eax + 235c: 0f 85 aa 00 00 00 jne 240c + if (unlink("dd/ff") != 0) + 2362: c7 04 24 c1 4b 00 00 movl $0x4bc1,(%esp) + 2369: e8 44 1c 00 00 call 3fb2 + 236e: 85 c0 test %eax,%eax + 2370: 0f 85 96 03 00 00 jne 270c + if (unlink("dd") == 0) + 2376: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 237d: e8 30 1c 00 00 call 3fb2 + 2382: 85 c0 test %eax,%eax + 2384: 0f 84 62 03 00 00 je 26ec + if (unlink("dd/dd") < 0) + 238a: c7 04 24 9d 4b 00 00 movl $0x4b9d,(%esp) + 2391: e8 1c 1c 00 00 call 3fb2 + 2396: 85 c0 test %eax,%eax + 2398: 0f 88 2e 03 00 00 js 26cc + if (unlink("dd") < 0) + 239e: c7 04 24 88 4c 00 00 movl $0x4c88,(%esp) + 23a5: e8 08 1c 00 00 call 3fb2 + 23aa: 85 c0 test %eax,%eax + 23ac: 0f 88 fa 02 00 00 js 26ac + printf(1, "subdir ok\n"); + 23b2: c7 44 24 04 6a 4e 00 movl $0x4e6a,0x4(%esp) + 23b9: 00 + 23ba: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 23c1: e8 ea 1c 00 00 call 40b0 +} + 23c6: 83 c4 14 add $0x14,%esp + 23c9: 5b pop %ebx + 23ca: 5d pop %ebp + 23cb: c3 ret + printf(1, "dd/dd/../ff wrong content\n"); + 23cc: c7 44 24 04 07 4c 00 movl $0x4c07,0x4(%esp) + 23d3: 00 + 23d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 23db: e8 d0 1c 00 00 call 40b0 + exit(0); + 23e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 23e7: e8 76 1b 00 00 call 3f62 + printf(1, "chdir dd/../../dd failed\n"); + 23ec: c7 44 24 04 62 4c 00 movl $0x4c62,0x4(%esp) + 23f3: 00 + 23f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 23fb: e8 b0 1c 00 00 call 40b0 + exit(0); + 2400: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2407: e8 56 1b 00 00 call 3f62 + printf(1, "unlink dd/dd/ff failed\n"); + 240c: c7 44 24 04 2d 4c 00 movl $0x4c2d,0x4(%esp) + 2413: 00 + 2414: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 241b: e8 90 1c 00 00 call 40b0 + exit(0); + 2420: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2427: e8 36 1b 00 00 call 3f62 + printf(1, "create dd/ff/ff succeeded!\n"); + 242c: c7 44 24 04 df 4c 00 movl $0x4cdf,0x4(%esp) + 2433: 00 + 2434: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 243b: e8 70 1c 00 00 call 40b0 + exit(0); + 2440: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2447: e8 16 1b 00 00 call 3f62 + printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); + 244c: c7 44 24 04 c4 56 00 movl $0x56c4,0x4(%esp) + 2453: 00 + 2454: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 245b: e8 50 1c 00 00 call 40b0 + exit(0); + 2460: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2467: e8 f6 1a 00 00 call 3f62 + printf(1, "mkdir dd/ff/ff succeeded!\n"); + 246c: c7 44 24 04 73 4d 00 movl $0x4d73,0x4(%esp) + 2473: 00 + 2474: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 247b: e8 30 1c 00 00 call 40b0 + exit(0); + 2480: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2487: e8 d6 1a 00 00 call 3f62 + printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); + 248c: c7 44 24 04 34 57 00 movl $0x5734,0x4(%esp) + 2493: 00 + 2494: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 249b: e8 10 1c 00 00 call 40b0 + exit(0); + 24a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 24a7: e8 b6 1a 00 00 call 3f62 + printf(1, "open dd/dd/../ff failed\n"); + 24ac: c7 44 24 04 ee 4b 00 movl $0x4bee,0x4(%esp) + 24b3: 00 + 24b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 24bb: e8 f0 1b 00 00 call 40b0 + exit(0); + 24c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 24c7: e8 96 1a 00 00 call 3f62 + printf(1, "create dd/dd/ff failed\n"); + 24cc: c7 44 24 04 c7 4b 00 movl $0x4bc7,0x4(%esp) + 24d3: 00 + 24d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 24db: e8 d0 1b 00 00 call 40b0 + exit(0); + 24e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 24e7: e8 76 1a 00 00 call 3f62 + printf(1, "chdir ./.. failed\n"); + 24ec: c7 44 24 04 90 4c 00 movl $0x4c90,0x4(%esp) + 24f3: 00 + 24f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 24fb: e8 b0 1b 00 00 call 40b0 + exit(0); + 2500: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2507: e8 56 1a 00 00 call 3f62 + printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); + 250c: c7 44 24 04 7c 56 00 movl $0x567c,0x4(%esp) + 2513: 00 + 2514: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 251b: e8 90 1b 00 00 call 40b0 + exit(0); + 2520: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2527: e8 36 1a 00 00 call 3f62 + printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); + 252c: c7 44 24 04 10 57 00 movl $0x5710,0x4(%esp) + 2533: 00 + 2534: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 253b: e8 70 1b 00 00 call 40b0 + exit(0); + 2540: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2547: e8 16 1a 00 00 call 3f62 + printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); + 254c: c7 44 24 04 ec 56 00 movl $0x56ec,0x4(%esp) + 2553: 00 + 2554: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 255b: e8 50 1b 00 00 call 40b0 + exit(0); + 2560: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2567: e8 f6 19 00 00 call 3f62 + printf(1, "open dd wronly succeeded!\n"); + 256c: c7 44 24 04 4f 4d 00 movl $0x4d4f,0x4(%esp) + 2573: 00 + 2574: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 257b: e8 30 1b 00 00 call 40b0 + exit(0); + 2580: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2587: e8 d6 19 00 00 call 3f62 + printf(1, "open dd rdwr succeeded!\n"); + 258c: c7 44 24 04 36 4d 00 movl $0x4d36,0x4(%esp) + 2593: 00 + 2594: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 259b: e8 10 1b 00 00 call 40b0 + exit(0); + 25a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 25a7: e8 b6 19 00 00 call 3f62 + printf(1, "create dd succeeded!\n"); + 25ac: c7 44 24 04 20 4d 00 movl $0x4d20,0x4(%esp) + 25b3: 00 + 25b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 25bb: e8 f0 1a 00 00 call 40b0 + exit(0); + 25c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 25c7: e8 96 19 00 00 call 3f62 + printf(1, "create dd/xx/ff succeeded!\n"); + 25cc: c7 44 24 04 04 4d 00 movl $0x4d04,0x4(%esp) + 25d3: 00 + 25d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 25db: e8 d0 1a 00 00 call 40b0 + exit(0); + 25e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 25e7: e8 76 19 00 00 call 3f62 + printf(1, "chdir dd failed\n"); + 25ec: c7 44 24 04 45 4c 00 movl $0x4c45,0x4(%esp) + 25f3: 00 + 25f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 25fb: e8 b0 1a 00 00 call 40b0 + exit(0); + 2600: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2607: e8 56 19 00 00 call 3f62 + printf(1, "open (unlinked) dd/dd/ff succeeded\n"); + 260c: c7 44 24 04 a0 56 00 movl $0x56a0,0x4(%esp) + 2613: 00 + 2614: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 261b: e8 90 1a 00 00 call 40b0 + exit(0); + 2620: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2627: e8 36 19 00 00 call 3f62 + printf(1, "subdir mkdir dd/dd failed\n"); + 262c: c7 44 24 04 a3 4b 00 movl $0x4ba3,0x4(%esp) + 2633: 00 + 2634: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 263b: e8 70 1a 00 00 call 40b0 + exit(0); + 2640: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2647: e8 16 19 00 00 call 3f62 + printf(1, "unlink dd (non-empty dir) succeeded!\n"); + 264c: c7 44 24 04 54 56 00 movl $0x5654,0x4(%esp) + 2653: 00 + 2654: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 265b: e8 50 1a 00 00 call 40b0 + exit(0); + 2660: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2667: e8 f6 18 00 00 call 3f62 + printf(1, "create dd/ff failed\n"); + 266c: c7 44 24 04 87 4b 00 movl $0x4b87,0x4(%esp) + 2673: 00 + 2674: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 267b: e8 30 1a 00 00 call 40b0 + exit(0); + 2680: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2687: e8 d6 18 00 00 call 3f62 + printf(1, "subdir mkdir dd failed\n"); + 268c: c7 44 24 04 6f 4b 00 movl $0x4b6f,0x4(%esp) + 2693: 00 + 2694: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 269b: e8 10 1a 00 00 call 40b0 + exit(0); + 26a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 26a7: e8 b6 18 00 00 call 3f62 + printf(1, "unlink dd failed\n"); + 26ac: c7 44 24 04 58 4e 00 movl $0x4e58,0x4(%esp) + 26b3: 00 + 26b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 26bb: e8 f0 19 00 00 call 40b0 + exit(0); + 26c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 26c7: e8 96 18 00 00 call 3f62 + printf(1, "unlink dd/dd failed\n"); + 26cc: c7 44 24 04 43 4e 00 movl $0x4e43,0x4(%esp) + 26d3: 00 + 26d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 26db: e8 d0 19 00 00 call 40b0 + exit(0); + 26e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 26e7: e8 76 18 00 00 call 3f62 + printf(1, "unlink non-empty dd succeeded!\n"); + 26ec: c7 44 24 04 58 57 00 movl $0x5758,0x4(%esp) + 26f3: 00 + 26f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 26fb: e8 b0 19 00 00 call 40b0 + exit(0); + 2700: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2707: e8 56 18 00 00 call 3f62 + printf(1, "unlink dd/ff failed\n"); + 270c: c7 44 24 04 2e 4e 00 movl $0x4e2e,0x4(%esp) + 2713: 00 + 2714: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 271b: e8 90 19 00 00 call 40b0 + exit(0); + 2720: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2727: e8 36 18 00 00 call 3f62 + printf(1, "chdir dd/xx succeeded!\n"); + 272c: c7 44 24 04 16 4e 00 movl $0x4e16,0x4(%esp) + 2733: 00 + 2734: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 273b: e8 70 19 00 00 call 40b0 + exit(0); + 2740: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2747: e8 16 18 00 00 call 3f62 + printf(1, "chdir dd/ff succeeded!\n"); + 274c: c7 44 24 04 fe 4d 00 movl $0x4dfe,0x4(%esp) + 2753: 00 + 2754: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 275b: e8 50 19 00 00 call 40b0 + exit(0); + 2760: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2767: e8 f6 17 00 00 call 3f62 + printf(1, "unlink dd/ff/ff succeeded!\n"); + 276c: c7 44 24 04 e2 4d 00 movl $0x4de2,0x4(%esp) + 2773: 00 + 2774: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 277b: e8 30 19 00 00 call 40b0 + exit(0); + 2780: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2787: e8 d6 17 00 00 call 3f62 + printf(1, "unlink dd/xx/ff succeeded!\n"); + 278c: c7 44 24 04 c6 4d 00 movl $0x4dc6,0x4(%esp) + 2793: 00 + 2794: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 279b: e8 10 19 00 00 call 40b0 + exit(0); + 27a0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 27a7: e8 b6 17 00 00 call 3f62 + printf(1, "mkdir dd/dd/ffff succeeded!\n"); + 27ac: c7 44 24 04 a9 4d 00 movl $0x4da9,0x4(%esp) + 27b3: 00 + 27b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 27bb: e8 f0 18 00 00 call 40b0 + exit(0); + 27c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 27c7: e8 96 17 00 00 call 3f62 + printf(1, "mkdir dd/xx/ff succeeded!\n"); + 27cc: c7 44 24 04 8e 4d 00 movl $0x4d8e,0x4(%esp) + 27d3: 00 + 27d4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 27db: e8 d0 18 00 00 call 40b0 + exit(0); + 27e0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 27e7: e8 76 17 00 00 call 3f62 + printf(1, "read dd/dd/ffff wrong len\n"); + 27ec: c7 44 24 04 bb 4c 00 movl $0x4cbb,0x4(%esp) + 27f3: 00 + 27f4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 27fb: e8 b0 18 00 00 call 40b0 + exit(0); + 2800: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2807: e8 56 17 00 00 call 3f62 + printf(1, "open dd/dd/ffff failed\n"); + 280c: c7 44 24 04 a3 4c 00 movl $0x4ca3,0x4(%esp) + 2813: 00 + 2814: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 281b: e8 90 18 00 00 call 40b0 + exit(0); + 2820: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2827: e8 36 17 00 00 call 3f62 + 282c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +00002830 : +{ + 2830: 55 push %ebp + 2831: 89 e5 mov %esp,%ebp + 2833: 56 push %esi + 2834: 53 push %ebx + for (sz = 499; sz < 12 * 512; sz += 471) + 2835: bb f3 01 00 00 mov $0x1f3,%ebx +{ + 283a: 83 ec 10 sub $0x10,%esp + printf(1, "bigwrite test\n"); + 283d: c7 44 24 04 75 4e 00 movl $0x4e75,0x4(%esp) + 2844: 00 + 2845: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 284c: e8 5f 18 00 00 call 40b0 + unlink("bigwrite"); + 2851: c7 04 24 84 4e 00 00 movl $0x4e84,(%esp) + 2858: e8 55 17 00 00 call 3fb2 + 285d: 8d 76 00 lea 0x0(%esi),%esi + fd = open("bigwrite", O_CREATE | O_RDWR); + 2860: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 2867: 00 + 2868: c7 04 24 84 4e 00 00 movl $0x4e84,(%esp) + 286f: e8 2e 17 00 00 call 3fa2 + if (fd < 0) + 2874: 85 c0 test %eax,%eax + fd = open("bigwrite", O_CREATE | O_RDWR); + 2876: 89 c6 mov %eax,%esi + if (fd < 0) + 2878: 0f 88 95 00 00 00 js 2913 + int cc = write(fd, buf, sz); + 287e: 89 5c 24 08 mov %ebx,0x8(%esp) + 2882: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 2889: 00 + 288a: 89 04 24 mov %eax,(%esp) + 288d: e8 f0 16 00 00 call 3f82 + if (cc != sz) + 2892: 39 d8 cmp %ebx,%eax + 2894: 75 55 jne 28eb + int cc = write(fd, buf, sz); + 2896: 89 5c 24 08 mov %ebx,0x8(%esp) + 289a: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 28a1: 00 + 28a2: 89 34 24 mov %esi,(%esp) + 28a5: e8 d8 16 00 00 call 3f82 + if (cc != sz) + 28aa: 39 c3 cmp %eax,%ebx + 28ac: 75 3d jne 28eb + close(fd); + 28ae: 89 34 24 mov %esi,(%esp) + for (sz = 499; sz < 12 * 512; sz += 471) + 28b1: 81 c3 d7 01 00 00 add $0x1d7,%ebx + close(fd); + 28b7: e8 ce 16 00 00 call 3f8a + unlink("bigwrite"); + 28bc: c7 04 24 84 4e 00 00 movl $0x4e84,(%esp) + 28c3: e8 ea 16 00 00 call 3fb2 + for (sz = 499; sz < 12 * 512; sz += 471) + 28c8: 81 fb 07 18 00 00 cmp $0x1807,%ebx + 28ce: 75 90 jne 2860 + printf(1, "bigwrite ok\n"); + 28d0: c7 44 24 04 b7 4e 00 movl $0x4eb7,0x4(%esp) + 28d7: 00 + 28d8: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 28df: e8 cc 17 00 00 call 40b0 +} + 28e4: 83 c4 10 add $0x10,%esp + 28e7: 5b pop %ebx + 28e8: 5e pop %esi + 28e9: 5d pop %ebp + 28ea: c3 ret + printf(1, "write(%d) ret %d\n", sz, cc); + 28eb: 89 44 24 0c mov %eax,0xc(%esp) + 28ef: 89 5c 24 08 mov %ebx,0x8(%esp) + 28f3: c7 44 24 04 a5 4e 00 movl $0x4ea5,0x4(%esp) + 28fa: 00 + 28fb: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2902: e8 a9 17 00 00 call 40b0 + exit(0); + 2907: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 290e: e8 4f 16 00 00 call 3f62 + printf(1, "cannot create bigwrite\n"); + 2913: c7 44 24 04 8d 4e 00 movl $0x4e8d,0x4(%esp) + 291a: 00 + 291b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2922: e8 89 17 00 00 call 40b0 + exit(0); + 2927: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 292e: e8 2f 16 00 00 call 3f62 + 2933: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 2939: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00002940 : +{ + 2940: 55 push %ebp + 2941: 89 e5 mov %esp,%ebp + 2943: 57 push %edi + 2944: 56 push %esi + 2945: 53 push %ebx + 2946: 83 ec 1c sub $0x1c,%esp + printf(1, "bigfile test\n"); + 2949: c7 44 24 04 c4 4e 00 movl $0x4ec4,0x4(%esp) + 2950: 00 + 2951: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2958: e8 53 17 00 00 call 40b0 + unlink("bigfile"); + 295d: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) + 2964: e8 49 16 00 00 call 3fb2 + fd = open("bigfile", O_CREATE | O_RDWR); + 2969: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 2970: 00 + 2971: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) + 2978: e8 25 16 00 00 call 3fa2 + if (fd < 0) + 297d: 85 c0 test %eax,%eax + fd = open("bigfile", O_CREATE | O_RDWR); + 297f: 89 c6 mov %eax,%esi + if (fd < 0) + 2981: 0f 88 a2 01 00 00 js 2b29 + 2987: 31 db xor %ebx,%ebx + 2989: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + memset(buf, i, 600); + 2990: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp) + 2997: 00 + 2998: 89 5c 24 04 mov %ebx,0x4(%esp) + 299c: c7 04 24 80 8c 00 00 movl $0x8c80,(%esp) + 29a3: e8 48 14 00 00 call 3df0 + if (write(fd, buf, 600) != 600) + 29a8: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp) + 29af: 00 + 29b0: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 29b7: 00 + 29b8: 89 34 24 mov %esi,(%esp) + 29bb: e8 c2 15 00 00 call 3f82 + 29c0: 3d 58 02 00 00 cmp $0x258,%eax + 29c5: 0f 85 1e 01 00 00 jne 2ae9 + for (i = 0; i < 20; i++) + 29cb: 83 c3 01 add $0x1,%ebx + 29ce: 83 fb 14 cmp $0x14,%ebx + 29d1: 75 bd jne 2990 + close(fd); + 29d3: 89 34 24 mov %esi,(%esp) + 29d6: e8 af 15 00 00 call 3f8a + fd = open("bigfile", 0); + 29db: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 29e2: 00 + 29e3: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) + 29ea: e8 b3 15 00 00 call 3fa2 + if (fd < 0) + 29ef: 85 c0 test %eax,%eax + fd = open("bigfile", 0); + 29f1: 89 c6 mov %eax,%esi + if (fd < 0) + 29f3: 0f 88 10 01 00 00 js 2b09 + 29f9: 31 db xor %ebx,%ebx + 29fb: 31 ff xor %edi,%edi + 29fd: eb 2f jmp 2a2e + 29ff: 90 nop + if (cc != 300) + 2a00: 3d 2c 01 00 00 cmp $0x12c,%eax + 2a05: 0f 85 9e 00 00 00 jne 2aa9 + if (buf[0] != i / 2 || buf[299] != i / 2) + 2a0b: 0f be 05 80 8c 00 00 movsbl 0x8c80,%eax + 2a12: 89 fa mov %edi,%edx + 2a14: d1 fa sar %edx + 2a16: 39 d0 cmp %edx,%eax + 2a18: 75 6f jne 2a89 + 2a1a: 0f be 15 ab 8d 00 00 movsbl 0x8dab,%edx + 2a21: 39 d0 cmp %edx,%eax + 2a23: 75 64 jne 2a89 + total += cc; + 2a25: 81 c3 2c 01 00 00 add $0x12c,%ebx + for (i = 0;; i++) + 2a2b: 83 c7 01 add $0x1,%edi + cc = read(fd, buf, 300); + 2a2e: c7 44 24 08 2c 01 00 movl $0x12c,0x8(%esp) + 2a35: 00 + 2a36: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 2a3d: 00 + 2a3e: 89 34 24 mov %esi,(%esp) + 2a41: e8 34 15 00 00 call 3f7a + if (cc < 0) + 2a46: 85 c0 test %eax,%eax + 2a48: 78 7f js 2ac9 + if (cc == 0) + 2a4a: 75 b4 jne 2a00 + close(fd); + 2a4c: 89 34 24 mov %esi,(%esp) + 2a4f: 90 nop + 2a50: e8 35 15 00 00 call 3f8a + if (total != 20 * 600) + 2a55: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx + 2a5b: 0f 85 e8 00 00 00 jne 2b49 + unlink("bigfile"); + 2a61: c7 04 24 e0 4e 00 00 movl $0x4ee0,(%esp) + 2a68: e8 45 15 00 00 call 3fb2 + printf(1, "bigfile test ok\n"); + 2a6d: c7 44 24 04 6f 4f 00 movl $0x4f6f,0x4(%esp) + 2a74: 00 + 2a75: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2a7c: e8 2f 16 00 00 call 40b0 +} + 2a81: 83 c4 1c add $0x1c,%esp + 2a84: 5b pop %ebx + 2a85: 5e pop %esi + 2a86: 5f pop %edi + 2a87: 5d pop %ebp + 2a88: c3 ret + printf(1, "read bigfile wrong data\n"); + 2a89: c7 44 24 04 3c 4f 00 movl $0x4f3c,0x4(%esp) + 2a90: 00 + 2a91: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2a98: e8 13 16 00 00 call 40b0 + exit(0); + 2a9d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2aa4: e8 b9 14 00 00 call 3f62 + printf(1, "short read bigfile\n"); + 2aa9: c7 44 24 04 28 4f 00 movl $0x4f28,0x4(%esp) + 2ab0: 00 + 2ab1: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2ab8: e8 f3 15 00 00 call 40b0 + exit(0); + 2abd: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2ac4: e8 99 14 00 00 call 3f62 + printf(1, "read bigfile failed\n"); + 2ac9: c7 44 24 04 13 4f 00 movl $0x4f13,0x4(%esp) + 2ad0: 00 + 2ad1: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2ad8: e8 d3 15 00 00 call 40b0 + exit(0); + 2add: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2ae4: e8 79 14 00 00 call 3f62 + printf(1, "write bigfile failed\n"); + 2ae9: c7 44 24 04 e8 4e 00 movl $0x4ee8,0x4(%esp) + 2af0: 00 + 2af1: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2af8: e8 b3 15 00 00 call 40b0 + exit(0); + 2afd: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2b04: e8 59 14 00 00 call 3f62 + printf(1, "cannot open bigfile\n"); + 2b09: c7 44 24 04 fe 4e 00 movl $0x4efe,0x4(%esp) + 2b10: 00 + 2b11: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2b18: e8 93 15 00 00 call 40b0 + exit(0); + 2b1d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2b24: e8 39 14 00 00 call 3f62 + printf(1, "cannot create bigfile"); + 2b29: c7 44 24 04 d2 4e 00 movl $0x4ed2,0x4(%esp) + 2b30: 00 + 2b31: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2b38: e8 73 15 00 00 call 40b0 + exit(0); + 2b3d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2b44: e8 19 14 00 00 call 3f62 + printf(1, "read bigfile wrong total\n"); + 2b49: c7 44 24 04 55 4f 00 movl $0x4f55,0x4(%esp) + 2b50: 00 + 2b51: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2b58: e8 53 15 00 00 call 40b0 + exit(0); + 2b5d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2b64: e8 f9 13 00 00 call 3f62 + 2b69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00002b70 : +{ + 2b70: 55 push %ebp + 2b71: 89 e5 mov %esp,%ebp + 2b73: 83 ec 18 sub $0x18,%esp + printf(1, "fourteen test\n"); + 2b76: c7 44 24 04 80 4f 00 movl $0x4f80,0x4(%esp) + 2b7d: 00 + 2b7e: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2b85: e8 26 15 00 00 call 40b0 + if (mkdir("12345678901234") != 0) + 2b8a: c7 04 24 bb 4f 00 00 movl $0x4fbb,(%esp) + 2b91: e8 34 14 00 00 call 3fca + 2b96: 85 c0 test %eax,%eax + 2b98: 0f 85 92 00 00 00 jne 2c30 + if (mkdir("12345678901234/123456789012345") != 0) + 2b9e: c7 04 24 78 57 00 00 movl $0x5778,(%esp) + 2ba5: e8 20 14 00 00 call 3fca + 2baa: 85 c0 test %eax,%eax + 2bac: 0f 85 1e 01 00 00 jne 2cd0 + fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); + 2bb2: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 2bb9: 00 + 2bba: c7 04 24 c8 57 00 00 movl $0x57c8,(%esp) + 2bc1: e8 dc 13 00 00 call 3fa2 + if (fd < 0) + 2bc6: 85 c0 test %eax,%eax + 2bc8: 0f 88 e2 00 00 00 js 2cb0 + close(fd); + 2bce: 89 04 24 mov %eax,(%esp) + 2bd1: e8 b4 13 00 00 call 3f8a + fd = open("12345678901234/12345678901234/12345678901234", 0); + 2bd6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2bdd: 00 + 2bde: c7 04 24 38 58 00 00 movl $0x5838,(%esp) + 2be5: e8 b8 13 00 00 call 3fa2 + if (fd < 0) + 2bea: 85 c0 test %eax,%eax + 2bec: 0f 88 9e 00 00 00 js 2c90 + close(fd); + 2bf2: 89 04 24 mov %eax,(%esp) + 2bf5: e8 90 13 00 00 call 3f8a + if (mkdir("12345678901234/12345678901234") == 0) + 2bfa: c7 04 24 ac 4f 00 00 movl $0x4fac,(%esp) + 2c01: e8 c4 13 00 00 call 3fca + 2c06: 85 c0 test %eax,%eax + 2c08: 74 66 je 2c70 + if (mkdir("123456789012345/12345678901234") == 0) + 2c0a: c7 04 24 d4 58 00 00 movl $0x58d4,(%esp) + 2c11: e8 b4 13 00 00 call 3fca + 2c16: 85 c0 test %eax,%eax + 2c18: 74 36 je 2c50 + printf(1, "fourteen ok\n"); + 2c1a: c7 44 24 04 ca 4f 00 movl $0x4fca,0x4(%esp) + 2c21: 00 + 2c22: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c29: e8 82 14 00 00 call 40b0 +} + 2c2e: c9 leave + 2c2f: c3 ret + printf(1, "mkdir 12345678901234 failed\n"); + 2c30: c7 44 24 04 8f 4f 00 movl $0x4f8f,0x4(%esp) + 2c37: 00 + 2c38: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c3f: e8 6c 14 00 00 call 40b0 + exit(0); + 2c44: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2c4b: e8 12 13 00 00 call 3f62 + printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); + 2c50: c7 44 24 04 f4 58 00 movl $0x58f4,0x4(%esp) + 2c57: 00 + 2c58: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c5f: e8 4c 14 00 00 call 40b0 + exit(0); + 2c64: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2c6b: e8 f2 12 00 00 call 3f62 + printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); + 2c70: c7 44 24 04 a4 58 00 movl $0x58a4,0x4(%esp) + 2c77: 00 + 2c78: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c7f: e8 2c 14 00 00 call 40b0 + exit(0); + 2c84: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2c8b: e8 d2 12 00 00 call 3f62 + printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); + 2c90: c7 44 24 04 68 58 00 movl $0x5868,0x4(%esp) + 2c97: 00 + 2c98: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2c9f: e8 0c 14 00 00 call 40b0 + exit(0); + 2ca4: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2cab: e8 b2 12 00 00 call 3f62 + printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); + 2cb0: c7 44 24 04 f8 57 00 movl $0x57f8,0x4(%esp) + 2cb7: 00 + 2cb8: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2cbf: e8 ec 13 00 00 call 40b0 + exit(0); + 2cc4: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2ccb: e8 92 12 00 00 call 3f62 + printf(1, "mkdir 12345678901234/123456789012345 failed\n"); + 2cd0: c7 44 24 04 98 57 00 movl $0x5798,0x4(%esp) + 2cd7: 00 + 2cd8: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2cdf: e8 cc 13 00 00 call 40b0 + exit(0); + 2ce4: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2ceb: e8 72 12 00 00 call 3f62 + +00002cf0 : +{ + 2cf0: 55 push %ebp + 2cf1: 89 e5 mov %esp,%ebp + 2cf3: 83 ec 18 sub $0x18,%esp + printf(1, "rmdot test\n"); + 2cf6: c7 44 24 04 d7 4f 00 movl $0x4fd7,0x4(%esp) + 2cfd: 00 + 2cfe: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2d05: e8 a6 13 00 00 call 40b0 + if (mkdir("dots") != 0) + 2d0a: c7 04 24 e3 4f 00 00 movl $0x4fe3,(%esp) + 2d11: e8 b4 12 00 00 call 3fca + 2d16: 85 c0 test %eax,%eax + 2d18: 0f 85 9a 00 00 00 jne 2db8 + if (chdir("dots") != 0) + 2d1e: c7 04 24 e3 4f 00 00 movl $0x4fe3,(%esp) + 2d25: e8 a8 12 00 00 call 3fd2 + 2d2a: 85 c0 test %eax,%eax + 2d2c: 0f 85 66 01 00 00 jne 2e98 + if (unlink(".") == 0) + 2d32: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) + 2d39: e8 74 12 00 00 call 3fb2 + 2d3e: 85 c0 test %eax,%eax + 2d40: 0f 84 32 01 00 00 je 2e78 + if (unlink("..") == 0) + 2d46: c7 04 24 8d 4c 00 00 movl $0x4c8d,(%esp) + 2d4d: e8 60 12 00 00 call 3fb2 + 2d52: 85 c0 test %eax,%eax + 2d54: 0f 84 fe 00 00 00 je 2e58 + if (chdir("/") != 0) + 2d5a: c7 04 24 61 44 00 00 movl $0x4461,(%esp) + 2d61: e8 6c 12 00 00 call 3fd2 + 2d66: 85 c0 test %eax,%eax + 2d68: 0f 85 ca 00 00 00 jne 2e38 + if (unlink("dots/.") == 0) + 2d6e: c7 04 24 2b 50 00 00 movl $0x502b,(%esp) + 2d75: e8 38 12 00 00 call 3fb2 + 2d7a: 85 c0 test %eax,%eax + 2d7c: 0f 84 96 00 00 00 je 2e18 + if (unlink("dots/..") == 0) + 2d82: c7 04 24 49 50 00 00 movl $0x5049,(%esp) + 2d89: e8 24 12 00 00 call 3fb2 + 2d8e: 85 c0 test %eax,%eax + 2d90: 74 66 je 2df8 + if (unlink("dots") != 0) + 2d92: c7 04 24 e3 4f 00 00 movl $0x4fe3,(%esp) + 2d99: e8 14 12 00 00 call 3fb2 + 2d9e: 85 c0 test %eax,%eax + 2da0: 75 36 jne 2dd8 + printf(1, "rmdot ok\n"); + 2da2: c7 44 24 04 7e 50 00 movl $0x507e,0x4(%esp) + 2da9: 00 + 2daa: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2db1: e8 fa 12 00 00 call 40b0 +} + 2db6: c9 leave + 2db7: c3 ret + printf(1, "mkdir dots failed\n"); + 2db8: c7 44 24 04 e8 4f 00 movl $0x4fe8,0x4(%esp) + 2dbf: 00 + 2dc0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2dc7: e8 e4 12 00 00 call 40b0 + exit(0); + 2dcc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2dd3: e8 8a 11 00 00 call 3f62 + printf(1, "unlink dots failed!\n"); + 2dd8: c7 44 24 04 69 50 00 movl $0x5069,0x4(%esp) + 2ddf: 00 + 2de0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2de7: e8 c4 12 00 00 call 40b0 + exit(0); + 2dec: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2df3: e8 6a 11 00 00 call 3f62 + printf(1, "unlink dots/.. worked!\n"); + 2df8: c7 44 24 04 51 50 00 movl $0x5051,0x4(%esp) + 2dff: 00 + 2e00: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2e07: e8 a4 12 00 00 call 40b0 + exit(0); + 2e0c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2e13: e8 4a 11 00 00 call 3f62 + printf(1, "unlink dots/. worked!\n"); + 2e18: c7 44 24 04 32 50 00 movl $0x5032,0x4(%esp) + 2e1f: 00 + 2e20: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2e27: e8 84 12 00 00 call 40b0 + exit(0); + 2e2c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2e33: e8 2a 11 00 00 call 3f62 + printf(1, "chdir / failed\n"); + 2e38: c7 44 24 04 63 44 00 movl $0x4463,0x4(%esp) + 2e3f: 00 + 2e40: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2e47: e8 64 12 00 00 call 40b0 + exit(0); + 2e4c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2e53: e8 0a 11 00 00 call 3f62 + printf(1, "rm .. worked!\n"); + 2e58: c7 44 24 04 1c 50 00 movl $0x501c,0x4(%esp) + 2e5f: 00 + 2e60: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2e67: e8 44 12 00 00 call 40b0 + exit(0); + 2e6c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2e73: e8 ea 10 00 00 call 3f62 + printf(1, "rm . worked!\n"); + 2e78: c7 44 24 04 0e 50 00 movl $0x500e,0x4(%esp) + 2e7f: 00 + 2e80: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2e87: e8 24 12 00 00 call 40b0 + exit(0); + 2e8c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2e93: e8 ca 10 00 00 call 3f62 + printf(1, "chdir dots failed\n"); + 2e98: c7 44 24 04 fb 4f 00 movl $0x4ffb,0x4(%esp) + 2e9f: 00 + 2ea0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2ea7: e8 04 12 00 00 call 40b0 + exit(0); + 2eac: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2eb3: e8 aa 10 00 00 call 3f62 + 2eb8: 90 nop + 2eb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00002ec0 : +{ + 2ec0: 55 push %ebp + 2ec1: 89 e5 mov %esp,%ebp + 2ec3: 53 push %ebx + 2ec4: 83 ec 14 sub $0x14,%esp + printf(1, "dir vs file\n"); + 2ec7: c7 44 24 04 88 50 00 movl $0x5088,0x4(%esp) + 2ece: 00 + 2ecf: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2ed6: e8 d5 11 00 00 call 40b0 + fd = open("dirfile", O_CREATE); + 2edb: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 2ee2: 00 + 2ee3: c7 04 24 95 50 00 00 movl $0x5095,(%esp) + 2eea: e8 b3 10 00 00 call 3fa2 + if (fd < 0) + 2eef: 85 c0 test %eax,%eax + 2ef1: 0f 88 60 01 00 00 js 3057 + close(fd); + 2ef7: 89 04 24 mov %eax,(%esp) + 2efa: e8 8b 10 00 00 call 3f8a + if (chdir("dirfile") == 0) + 2eff: c7 04 24 95 50 00 00 movl $0x5095,(%esp) + 2f06: e8 c7 10 00 00 call 3fd2 + 2f0b: 85 c0 test %eax,%eax + 2f0d: 0f 84 24 01 00 00 je 3037 + fd = open("dirfile/xx", 0); + 2f13: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2f1a: 00 + 2f1b: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) + 2f22: e8 7b 10 00 00 call 3fa2 + if (fd >= 0) + 2f27: 85 c0 test %eax,%eax + 2f29: 0f 89 e8 00 00 00 jns 3017 + fd = open("dirfile/xx", O_CREATE); + 2f2f: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 2f36: 00 + 2f37: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) + 2f3e: e8 5f 10 00 00 call 3fa2 + if (fd >= 0) + 2f43: 85 c0 test %eax,%eax + 2f45: 0f 89 cc 00 00 00 jns 3017 + if (mkdir("dirfile/xx") == 0) + 2f4b: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) + 2f52: e8 73 10 00 00 call 3fca + 2f57: 85 c0 test %eax,%eax + 2f59: 0f 84 b8 01 00 00 je 3117 + if (unlink("dirfile/xx") == 0) + 2f5f: c7 04 24 ce 50 00 00 movl $0x50ce,(%esp) + 2f66: e8 47 10 00 00 call 3fb2 + 2f6b: 85 c0 test %eax,%eax + 2f6d: 0f 84 84 01 00 00 je 30f7 + if (link("README", "dirfile/xx") == 0) + 2f73: c7 44 24 04 ce 50 00 movl $0x50ce,0x4(%esp) + 2f7a: 00 + 2f7b: c7 04 24 32 51 00 00 movl $0x5132,(%esp) + 2f82: e8 3b 10 00 00 call 3fc2 + 2f87: 85 c0 test %eax,%eax + 2f89: 0f 84 48 01 00 00 je 30d7 + if (unlink("dirfile") != 0) + 2f8f: c7 04 24 95 50 00 00 movl $0x5095,(%esp) + 2f96: e8 17 10 00 00 call 3fb2 + 2f9b: 85 c0 test %eax,%eax + 2f9d: 0f 85 14 01 00 00 jne 30b7 + fd = open(".", O_RDWR); + 2fa3: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) + 2faa: 00 + 2fab: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) + 2fb2: e8 eb 0f 00 00 call 3fa2 + if (fd >= 0) + 2fb7: 85 c0 test %eax,%eax + 2fb9: 0f 89 d8 00 00 00 jns 3097 + fd = open(".", 0); + 2fbf: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 2fc6: 00 + 2fc7: c7 04 24 8e 4c 00 00 movl $0x4c8e,(%esp) + 2fce: e8 cf 0f 00 00 call 3fa2 + if (write(fd, "x", 1) > 0) + 2fd3: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 2fda: 00 + 2fdb: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) + 2fe2: 00 + 2fe3: 89 04 24 mov %eax,(%esp) + fd = open(".", 0); + 2fe6: 89 c3 mov %eax,%ebx + if (write(fd, "x", 1) > 0) + 2fe8: e8 95 0f 00 00 call 3f82 + 2fed: 85 c0 test %eax,%eax + 2fef: 0f 8f 82 00 00 00 jg 3077 + close(fd); + 2ff5: 89 1c 24 mov %ebx,(%esp) + 2ff8: e8 8d 0f 00 00 call 3f8a + printf(1, "dir vs file OK\n"); + 2ffd: c7 44 24 04 65 51 00 movl $0x5165,0x4(%esp) + 3004: 00 + 3005: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 300c: e8 9f 10 00 00 call 40b0 +} + 3011: 83 c4 14 add $0x14,%esp + 3014: 5b pop %ebx + 3015: 5d pop %ebp + 3016: c3 ret + printf(1, "create dirfile/xx succeeded!\n"); + 3017: c7 44 24 04 d9 50 00 movl $0x50d9,0x4(%esp) + 301e: 00 + 301f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3026: e8 85 10 00 00 call 40b0 + exit(0); + 302b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3032: e8 2b 0f 00 00 call 3f62 + printf(1, "chdir dirfile succeeded!\n"); + 3037: c7 44 24 04 b4 50 00 movl $0x50b4,0x4(%esp) + 303e: 00 + 303f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3046: e8 65 10 00 00 call 40b0 + exit(0); + 304b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3052: e8 0b 0f 00 00 call 3f62 + printf(1, "create dirfile failed\n"); + 3057: c7 44 24 04 9d 50 00 movl $0x509d,0x4(%esp) + 305e: 00 + 305f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3066: e8 45 10 00 00 call 40b0 + exit(0); + 306b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3072: e8 eb 0e 00 00 call 3f62 + printf(1, "write . succeeded!\n"); + 3077: c7 44 24 04 51 51 00 movl $0x5151,0x4(%esp) + 307e: 00 + 307f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3086: e8 25 10 00 00 call 40b0 + exit(0); + 308b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3092: e8 cb 0e 00 00 call 3f62 + printf(1, "open . for writing succeeded!\n"); + 3097: c7 44 24 04 48 59 00 movl $0x5948,0x4(%esp) + 309e: 00 + 309f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 30a6: e8 05 10 00 00 call 40b0 + exit(0); + 30ab: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 30b2: e8 ab 0e 00 00 call 3f62 + printf(1, "unlink dirfile failed!\n"); + 30b7: c7 44 24 04 39 51 00 movl $0x5139,0x4(%esp) + 30be: 00 + 30bf: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 30c6: e8 e5 0f 00 00 call 40b0 + exit(0); + 30cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 30d2: e8 8b 0e 00 00 call 3f62 + printf(1, "link to dirfile/xx succeeded!\n"); + 30d7: c7 44 24 04 28 59 00 movl $0x5928,0x4(%esp) + 30de: 00 + 30df: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 30e6: e8 c5 0f 00 00 call 40b0 + exit(0); + 30eb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 30f2: e8 6b 0e 00 00 call 3f62 + printf(1, "unlink dirfile/xx succeeded!\n"); + 30f7: c7 44 24 04 14 51 00 movl $0x5114,0x4(%esp) + 30fe: 00 + 30ff: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3106: e8 a5 0f 00 00 call 40b0 + exit(0); + 310b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3112: e8 4b 0e 00 00 call 3f62 + printf(1, "mkdir dirfile/xx succeeded!\n"); + 3117: c7 44 24 04 f7 50 00 movl $0x50f7,0x4(%esp) + 311e: 00 + 311f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3126: e8 85 0f 00 00 call 40b0 + exit(0); + 312b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3132: e8 2b 0e 00 00 call 3f62 + 3137: 89 f6 mov %esi,%esi + 3139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003140 : +{ + 3140: 55 push %ebp + 3141: 89 e5 mov %esp,%ebp + 3143: 53 push %ebx + printf(1, "empty file name\n"); + 3144: bb 33 00 00 00 mov $0x33,%ebx +{ + 3149: 83 ec 14 sub $0x14,%esp + printf(1, "empty file name\n"); + 314c: c7 44 24 04 75 51 00 movl $0x5175,0x4(%esp) + 3153: 00 + 3154: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 315b: e8 50 0f 00 00 call 40b0 + if (mkdir("irefd") != 0) + 3160: c7 04 24 86 51 00 00 movl $0x5186,(%esp) + 3167: e8 5e 0e 00 00 call 3fca + 316c: 85 c0 test %eax,%eax + 316e: 0f 85 af 00 00 00 jne 3223 + if (chdir("irefd") != 0) + 3174: c7 04 24 86 51 00 00 movl $0x5186,(%esp) + 317b: e8 52 0e 00 00 call 3fd2 + 3180: 85 c0 test %eax,%eax + 3182: 0f 85 bb 00 00 00 jne 3243 + mkdir(""); + 3188: c7 04 24 3b 48 00 00 movl $0x483b,(%esp) + 318f: e8 36 0e 00 00 call 3fca + link("README", ""); + 3194: c7 44 24 04 3b 48 00 movl $0x483b,0x4(%esp) + 319b: 00 + 319c: c7 04 24 32 51 00 00 movl $0x5132,(%esp) + 31a3: e8 1a 0e 00 00 call 3fc2 + fd = open("", O_CREATE); + 31a8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 31af: 00 + 31b0: c7 04 24 3b 48 00 00 movl $0x483b,(%esp) + 31b7: e8 e6 0d 00 00 call 3fa2 + if (fd >= 0) + 31bc: 85 c0 test %eax,%eax + 31be: 78 08 js 31c8 + close(fd); + 31c0: 89 04 24 mov %eax,(%esp) + 31c3: e8 c2 0d 00 00 call 3f8a + fd = open("xx", O_CREATE); + 31c8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 31cf: 00 + 31d0: c7 04 24 70 4d 00 00 movl $0x4d70,(%esp) + 31d7: e8 c6 0d 00 00 call 3fa2 + if (fd >= 0) + 31dc: 85 c0 test %eax,%eax + 31de: 78 08 js 31e8 + close(fd); + 31e0: 89 04 24 mov %eax,(%esp) + 31e3: e8 a2 0d 00 00 call 3f8a + unlink("xx"); + 31e8: c7 04 24 70 4d 00 00 movl $0x4d70,(%esp) + 31ef: e8 be 0d 00 00 call 3fb2 + for (i = 0; i < 50 + 1; i++) + 31f4: 83 eb 01 sub $0x1,%ebx + 31f7: 0f 85 63 ff ff ff jne 3160 + chdir("/"); + 31fd: c7 04 24 61 44 00 00 movl $0x4461,(%esp) + 3204: e8 c9 0d 00 00 call 3fd2 + printf(1, "empty file name OK\n"); + 3209: c7 44 24 04 b4 51 00 movl $0x51b4,0x4(%esp) + 3210: 00 + 3211: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3218: e8 93 0e 00 00 call 40b0 +} + 321d: 83 c4 14 add $0x14,%esp + 3220: 5b pop %ebx + 3221: 5d pop %ebp + 3222: c3 ret + printf(1, "mkdir irefd failed\n"); + 3223: c7 44 24 04 8c 51 00 movl $0x518c,0x4(%esp) + 322a: 00 + 322b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3232: e8 79 0e 00 00 call 40b0 + exit(0); + 3237: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 323e: e8 1f 0d 00 00 call 3f62 + printf(1, "chdir irefd failed\n"); + 3243: c7 44 24 04 a0 51 00 movl $0x51a0,0x4(%esp) + 324a: 00 + 324b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3252: e8 59 0e 00 00 call 40b0 + exit(0); + 3257: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 325e: e8 ff 0c 00 00 call 3f62 + 3263: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 3269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003270 : +{ + 3270: 55 push %ebp + 3271: 89 e5 mov %esp,%ebp + 3273: 53 push %ebx + for (n = 0; n < 1000; n++) + 3274: 31 db xor %ebx,%ebx +{ + 3276: 83 ec 14 sub $0x14,%esp + printf(1, "fork test\n"); + 3279: c7 44 24 04 c8 51 00 movl $0x51c8,0x4(%esp) + 3280: 00 + 3281: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3288: e8 23 0e 00 00 call 40b0 + 328d: eb 13 jmp 32a2 + 328f: 90 nop + if (pid == 0) + 3290: 0f 84 96 00 00 00 je 332c + for (n = 0; n < 1000; n++) + 3296: 83 c3 01 add $0x1,%ebx + 3299: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 329f: 90 nop + 32a0: 74 56 je 32f8 + pid = fork(); + 32a2: e8 b3 0c 00 00 call 3f5a + if (pid < 0) + 32a7: 85 c0 test %eax,%eax + 32a9: 79 e5 jns 3290 + for (; n > 0; n--) + 32ab: 85 db test %ebx,%ebx + 32ad: 8d 76 00 lea 0x0(%esi),%esi + 32b0: 74 1b je 32cd + 32b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + if (wait(0) < 0) + 32b8: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 32bf: e8 a6 0c 00 00 call 3f6a + 32c4: 85 c0 test %eax,%eax + 32c6: 78 50 js 3318 + for (; n > 0; n--) + 32c8: 83 eb 01 sub $0x1,%ebx + 32cb: 75 eb jne 32b8 + if (wait(0) != -1) + 32cd: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 32d4: e8 91 0c 00 00 call 3f6a + 32d9: 83 f8 ff cmp $0xffffffff,%eax + 32dc: 75 5a jne 3338 + printf(1, "fork test OK\n"); + 32de: c7 44 24 04 fa 51 00 movl $0x51fa,0x4(%esp) + 32e5: 00 + 32e6: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 32ed: e8 be 0d 00 00 call 40b0 +} + 32f2: 83 c4 14 add $0x14,%esp + 32f5: 5b pop %ebx + 32f6: 5d pop %ebp + 32f7: c3 ret + printf(1, "fork claimed to work 1000 times!\n"); + 32f8: c7 44 24 04 68 59 00 movl $0x5968,0x4(%esp) + 32ff: 00 + 3300: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3307: e8 a4 0d 00 00 call 40b0 + exit(0); + 330c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3313: e8 4a 0c 00 00 call 3f62 + printf(1, "wait stopped early\n"); + 3318: c7 44 24 04 d3 51 00 movl $0x51d3,0x4(%esp) + 331f: 00 + 3320: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3327: e8 84 0d 00 00 call 40b0 + exit(0); + 332c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3333: e8 2a 0c 00 00 call 3f62 + printf(1, "wait got too many\n"); + 3338: c7 44 24 04 e7 51 00 movl $0x51e7,0x4(%esp) + 333f: 00 + 3340: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3347: e8 64 0d 00 00 call 40b0 + exit(0); + 334c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3353: e8 0a 0c 00 00 call 3f62 + 3358: 90 nop + 3359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00003360 : +{ + 3360: 55 push %ebp + 3361: 89 e5 mov %esp,%ebp + 3363: 57 push %edi + 3364: 56 push %esi + for (i = 0; i < 5000; i++) + 3365: 31 f6 xor %esi,%esi +{ + 3367: 53 push %ebx + 3368: 83 ec 6c sub $0x6c,%esp + printf(stdout, "sbrk test\n"); + 336b: a1 94 64 00 00 mov 0x6494,%eax + 3370: c7 44 24 04 08 52 00 movl $0x5208,0x4(%esp) + 3377: 00 + 3378: 89 04 24 mov %eax,(%esp) + 337b: e8 30 0d 00 00 call 40b0 + oldbrk = sbrk(0); + 3380: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3387: e8 5e 0c 00 00 call 3fea + a = sbrk(0); + 338c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + oldbrk = sbrk(0); + 3393: 89 45 a4 mov %eax,-0x5c(%ebp) + a = sbrk(0); + 3396: e8 4f 0c 00 00 call 3fea + 339b: 89 c3 mov %eax,%ebx + 339d: 8d 76 00 lea 0x0(%esi),%esi + b = sbrk(1); + 33a0: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 33a7: e8 3e 0c 00 00 call 3fea + if (b != a) + 33ac: 39 d8 cmp %ebx,%eax + b = sbrk(1); + 33ae: 89 c7 mov %eax,%edi + if (b != a) + 33b0: 0f 85 90 02 00 00 jne 3646 + for (i = 0; i < 5000; i++) + 33b6: 83 c6 01 add $0x1,%esi + a = b + 1; + 33b9: 83 c3 01 add $0x1,%ebx + *b = 1; + 33bc: c6 43 ff 01 movb $0x1,-0x1(%ebx) + for (i = 0; i < 5000; i++) + 33c0: 81 fe 88 13 00 00 cmp $0x1388,%esi + 33c6: 75 d8 jne 33a0 + pid = fork(); + 33c8: e8 8d 0b 00 00 call 3f5a + if (pid < 0) + 33cd: 85 c0 test %eax,%eax + pid = fork(); + 33cf: 89 c3 mov %eax,%ebx + if (pid < 0) + 33d1: 0f 88 9c 03 00 00 js 3773 + c = sbrk(1); + 33d7: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 33de: e8 07 0c 00 00 call 3fea + c = sbrk(1); + 33e3: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 33ea: e8 fb 0b 00 00 call 3fea + if (c != a + 1) + 33ef: 8d 57 02 lea 0x2(%edi),%edx + 33f2: 39 d0 cmp %edx,%eax + 33f4: 0f 85 6c 03 00 00 jne 3766 + if (pid == 0) + 33fa: 85 db test %ebx,%ebx + exit(0); + 33fc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + if (pid == 0) + 3403: 0f 84 a6 02 00 00 je 36af + wait(0); + 3409: e8 5c 0b 00 00 call 3f6a + a = sbrk(0); + 340e: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3415: e8 d0 0b 00 00 call 3fea + amt = (BIG) - (uint)a; + 341a: ba 00 00 40 06 mov $0x6400000,%edx + 341f: 29 c2 sub %eax,%edx + a = sbrk(0); + 3421: 89 c3 mov %eax,%ebx + p = sbrk(amt); + 3423: 89 14 24 mov %edx,(%esp) + 3426: e8 bf 0b 00 00 call 3fea + if (p != a) + 342b: 39 d8 cmp %ebx,%eax + 342d: 0f 85 07 03 00 00 jne 373a + *lastaddr = 99; + 3433: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff + a = sbrk(0); + 343a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3441: e8 a4 0b 00 00 call 3fea + c = sbrk(-4096); + 3446: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp) + a = sbrk(0); + 344d: 89 c3 mov %eax,%ebx + c = sbrk(-4096); + 344f: e8 96 0b 00 00 call 3fea + if (c == (char *)0xffffffff) + 3454: 83 f8 ff cmp $0xffffffff,%eax + 3457: 0f 84 fc 02 00 00 je 3759 + c = sbrk(0); + 345d: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3464: e8 81 0b 00 00 call 3fea + if (c != a - 4096) + 3469: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx + 346f: 39 d0 cmp %edx,%eax + 3471: 0f 85 d0 02 00 00 jne 3747 + a = sbrk(0); + 3477: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 347e: e8 67 0b 00 00 call 3fea + c = sbrk(4096); + 3483: c7 04 24 00 10 00 00 movl $0x1000,(%esp) + a = sbrk(0); + 348a: 89 c6 mov %eax,%esi + c = sbrk(4096); + 348c: e8 59 0b 00 00 call 3fea + if (c != a || sbrk(0) != a + 4096) + 3491: 39 f0 cmp %esi,%eax + c = sbrk(4096); + 3493: 89 c3 mov %eax,%ebx + if (c != a || sbrk(0) != a + 4096) + 3495: 0f 85 8d 02 00 00 jne 3728 + 349b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 34a2: e8 43 0b 00 00 call 3fea + 34a7: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx + 34ad: 39 d0 cmp %edx,%eax + 34af: 0f 85 73 02 00 00 jne 3728 + if (*lastaddr == 99) + 34b5: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff + 34bc: 0f 84 59 02 00 00 je 371b + a = sbrk(0); + 34c2: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 34c9: e8 1c 0b 00 00 call 3fea + c = sbrk(-(sbrk(0) - oldbrk)); + 34ce: c7 04 24 00 00 00 00 movl $0x0,(%esp) + a = sbrk(0); + 34d5: 89 c3 mov %eax,%ebx + c = sbrk(-(sbrk(0) - oldbrk)); + 34d7: e8 0e 0b 00 00 call 3fea + 34dc: 8b 4d a4 mov -0x5c(%ebp),%ecx + 34df: 29 c1 sub %eax,%ecx + 34e1: 89 0c 24 mov %ecx,(%esp) + 34e4: e8 01 0b 00 00 call 3fea + if (c != a) + 34e9: 39 d8 cmp %ebx,%eax + 34eb: 0f 85 01 02 00 00 jne 36f2 + 34f1: bb 00 00 00 80 mov $0x80000000,%ebx + 34f6: 66 90 xchg %ax,%ax + ppid = getpid(); + 34f8: e8 e5 0a 00 00 call 3fe2 + 34fd: 89 c6 mov %eax,%esi + pid = fork(); + 34ff: e8 56 0a 00 00 call 3f5a + if (pid < 0) + 3504: 85 c0 test %eax,%eax + 3506: 0f 88 dc 01 00 00 js 36e8 + 350c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if (pid == 0) + 3510: 0f 84 9e 01 00 00 je 36b4 + wait(0); + 3516: c7 04 24 00 00 00 00 movl $0x0,(%esp) + for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) + 351d: 81 c3 50 c3 00 00 add $0xc350,%ebx + wait(0); + 3523: e8 42 0a 00 00 call 3f6a + for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) + 3528: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx + 352e: 75 c8 jne 34f8 + if (pipe(fds) != 0) + 3530: 8d 45 b8 lea -0x48(%ebp),%eax + 3533: 89 04 24 mov %eax,(%esp) + 3536: e8 37 0a 00 00 call 3f72 + 353b: 85 c0 test %eax,%eax + 353d: 0f 85 51 01 00 00 jne 3694 + 3543: 8d 5d e8 lea -0x18(%ebp),%ebx + 3546: 8d 75 c0 lea -0x40(%ebp),%esi + read(fds[0], &scratch, 1); + 3549: 8d 7d b7 lea -0x49(%ebp),%edi + if ((pids[i] = fork()) == 0) + 354c: e8 09 0a 00 00 call 3f5a + 3551: 85 c0 test %eax,%eax + 3553: 89 06 mov %eax,(%esi) + 3555: 0f 84 a6 00 00 00 je 3601 + if (pids[i] != -1) + 355b: 83 f8 ff cmp $0xffffffff,%eax + 355e: 74 17 je 3577 + read(fds[0], &scratch, 1); + 3560: 8b 45 b8 mov -0x48(%ebp),%eax + 3563: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 356a: 00 + 356b: 89 7c 24 04 mov %edi,0x4(%esp) + 356f: 89 04 24 mov %eax,(%esp) + 3572: e8 03 0a 00 00 call 3f7a + 3577: 83 c6 04 add $0x4,%esi + for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) + 357a: 39 de cmp %ebx,%esi + 357c: 75 ce jne 354c + c = sbrk(4096); + 357e: c7 04 24 00 10 00 00 movl $0x1000,(%esp) + 3585: 8d 75 c0 lea -0x40(%ebp),%esi + 3588: e8 5d 0a 00 00 call 3fea + 358d: 89 c7 mov %eax,%edi + if (pids[i] == -1) + 358f: 8b 06 mov (%esi),%eax + 3591: 83 f8 ff cmp $0xffffffff,%eax + 3594: 74 14 je 35aa + kill(pids[i]); + 3596: 89 04 24 mov %eax,(%esp) + 3599: e8 f4 09 00 00 call 3f92 + wait(0); + 359e: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 35a5: e8 c0 09 00 00 call 3f6a + 35aa: 83 c6 04 add $0x4,%esi + for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) + 35ad: 39 f3 cmp %esi,%ebx + 35af: 75 de jne 358f + if (c == (char *)0xffffffff) + 35b1: 83 ff ff cmp $0xffffffff,%edi + 35b4: 0f 84 b9 00 00 00 je 3673 + if (sbrk(0) > oldbrk) + 35ba: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 35c1: e8 24 0a 00 00 call 3fea + 35c6: 39 45 a4 cmp %eax,-0x5c(%ebp) + 35c9: 73 19 jae 35e4 + sbrk(-(sbrk(0) - oldbrk)); + 35cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 35d2: e8 13 0a 00 00 call 3fea + 35d7: 8b 7d a4 mov -0x5c(%ebp),%edi + 35da: 29 c7 sub %eax,%edi + 35dc: 89 3c 24 mov %edi,(%esp) + 35df: e8 06 0a 00 00 call 3fea + printf(stdout, "sbrk test OK\n"); + 35e4: a1 94 64 00 00 mov 0x6494,%eax + 35e9: c7 44 24 04 b0 52 00 movl $0x52b0,0x4(%esp) + 35f0: 00 + 35f1: 89 04 24 mov %eax,(%esp) + 35f4: e8 b7 0a 00 00 call 40b0 +} + 35f9: 83 c4 6c add $0x6c,%esp + 35fc: 5b pop %ebx + 35fd: 5e pop %esi + 35fe: 5f pop %edi + 35ff: 5d pop %ebp + 3600: c3 ret + sbrk(BIG - (uint)sbrk(0)); + 3601: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3608: e8 dd 09 00 00 call 3fea + 360d: ba 00 00 40 06 mov $0x6400000,%edx + 3612: 29 c2 sub %eax,%edx + 3614: 89 14 24 mov %edx,(%esp) + 3617: e8 ce 09 00 00 call 3fea + write(fds[1], "x", 1); + 361c: 8b 45 bc mov -0x44(%ebp),%eax + 361f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3626: 00 + 3627: c7 44 24 04 71 4d 00 movl $0x4d71,0x4(%esp) + 362e: 00 + 362f: 89 04 24 mov %eax,(%esp) + 3632: e8 4b 09 00 00 call 3f82 + 3637: 90 nop + sleep(1000); + 3638: c7 04 24 e8 03 00 00 movl $0x3e8,(%esp) + 363f: e8 ae 09 00 00 call 3ff2 + 3644: eb f2 jmp 3638 + printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); + 3646: 89 44 24 10 mov %eax,0x10(%esp) + 364a: a1 94 64 00 00 mov 0x6494,%eax + 364f: 89 5c 24 0c mov %ebx,0xc(%esp) + 3653: 89 74 24 08 mov %esi,0x8(%esp) + 3657: c7 44 24 04 13 52 00 movl $0x5213,0x4(%esp) + 365e: 00 + 365f: 89 04 24 mov %eax,(%esp) + 3662: e8 49 0a 00 00 call 40b0 + exit(0); + 3667: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 366e: e8 ef 08 00 00 call 3f62 + printf(stdout, "failed sbrk leaked memory\n"); + 3673: c7 44 24 04 95 52 00 movl $0x5295,0x4(%esp) + 367a: 00 + printf(stdout, "sbrk test failed post-fork\n"); + 367b: a1 94 64 00 00 mov 0x6494,%eax + 3680: 89 04 24 mov %eax,(%esp) + 3683: e8 28 0a 00 00 call 40b0 + exit(0); + 3688: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 368f: e8 ce 08 00 00 call 3f62 + printf(1, "pipe() failed\n"); + 3694: c7 44 24 04 51 47 00 movl $0x4751,0x4(%esp) + 369b: 00 + 369c: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 36a3: e8 08 0a 00 00 call 40b0 + exit(0); + 36a8: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 36af: e8 ae 08 00 00 call 3f62 + printf(stdout, "oops could read %x = %x\n", a, *a); + 36b4: 0f be 03 movsbl (%ebx),%eax + 36b7: 89 5c 24 08 mov %ebx,0x8(%esp) + 36bb: c7 44 24 04 7c 52 00 movl $0x527c,0x4(%esp) + 36c2: 00 + 36c3: 89 44 24 0c mov %eax,0xc(%esp) + 36c7: a1 94 64 00 00 mov 0x6494,%eax + 36cc: 89 04 24 mov %eax,(%esp) + 36cf: e8 dc 09 00 00 call 40b0 + kill(ppid); + 36d4: 89 34 24 mov %esi,(%esp) + 36d7: e8 b6 08 00 00 call 3f92 + exit(0); + 36dc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 36e3: e8 7a 08 00 00 call 3f62 + printf(stdout, "fork failed\n"); + 36e8: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 36ef: 00 + 36f0: eb 89 jmp 367b + printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); + 36f2: 89 44 24 0c mov %eax,0xc(%esp) + 36f6: 89 5c 24 08 mov %ebx,0x8(%esp) + 36fa: c7 44 24 04 5c 5a 00 movl $0x5a5c,0x4(%esp) + 3701: 00 + 3702: a1 94 64 00 00 mov 0x6494,%eax + 3707: 89 04 24 mov %eax,(%esp) + 370a: e8 a1 09 00 00 call 40b0 + exit(0); + 370f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3716: e8 47 08 00 00 call 3f62 + printf(stdout, "sbrk de-allocation didn't really deallocate\n"); + 371b: c7 44 24 04 2c 5a 00 movl $0x5a2c,0x4(%esp) + 3722: 00 + 3723: e9 53 ff ff ff jmp 367b + printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); + 3728: 89 5c 24 0c mov %ebx,0xc(%esp) + 372c: 89 74 24 08 mov %esi,0x8(%esp) + 3730: c7 44 24 04 04 5a 00 movl $0x5a04,0x4(%esp) + 3737: 00 + 3738: eb c8 jmp 3702 + printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); + 373a: c7 44 24 04 8c 59 00 movl $0x598c,0x4(%esp) + 3741: 00 + 3742: e9 34 ff ff ff jmp 367b + printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); + 3747: 89 44 24 0c mov %eax,0xc(%esp) + 374b: 89 5c 24 08 mov %ebx,0x8(%esp) + 374f: c7 44 24 04 cc 59 00 movl $0x59cc,0x4(%esp) + 3756: 00 + 3757: eb a9 jmp 3702 + printf(stdout, "sbrk could not deallocate\n"); + 3759: c7 44 24 04 61 52 00 movl $0x5261,0x4(%esp) + 3760: 00 + 3761: e9 15 ff ff ff jmp 367b + printf(stdout, "sbrk test failed post-fork\n"); + 3766: c7 44 24 04 45 52 00 movl $0x5245,0x4(%esp) + 376d: 00 + 376e: e9 08 ff ff ff jmp 367b + printf(stdout, "sbrk test fork failed\n"); + 3773: c7 44 24 04 2e 52 00 movl $0x522e,0x4(%esp) + 377a: 00 + 377b: e9 fb fe ff ff jmp 367b + +00003780 : +{ + 3780: 55 push %ebp + 3781: 89 e5 mov %esp,%ebp +} + 3783: 5d pop %ebp + 3784: c3 ret + 3785: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 3789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003790 : +{ + 3790: 55 push %ebp + 3791: 89 e5 mov %esp,%ebp + 3793: 56 push %esi + 3794: 53 push %ebx + for (p = 0; p <= (uint)hi; p += 4096) + 3795: 31 db xor %ebx,%ebx +{ + 3797: 83 ec 10 sub $0x10,%esp + printf(stdout, "validate test\n"); + 379a: a1 94 64 00 00 mov 0x6494,%eax + 379f: c7 44 24 04 be 52 00 movl $0x52be,0x4(%esp) + 37a6: 00 + 37a7: 89 04 24 mov %eax,(%esp) + 37aa: e8 01 09 00 00 call 40b0 + 37af: 90 nop + if ((pid = fork()) == 0) + 37b0: e8 a5 07 00 00 call 3f5a + exit(0); + 37b5: c7 04 24 00 00 00 00 movl $0x0,(%esp) + if ((pid = fork()) == 0) + 37bc: 85 c0 test %eax,%eax + 37be: 89 c6 mov %eax,%esi + 37c0: 0f 84 80 00 00 00 je 3846 + sleep(0); + 37c6: e8 27 08 00 00 call 3ff2 + sleep(0); + 37cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 37d2: e8 1b 08 00 00 call 3ff2 + kill(pid); + 37d7: 89 34 24 mov %esi,(%esp) + 37da: e8 b3 07 00 00 call 3f92 + wait(0); + 37df: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 37e6: e8 7f 07 00 00 call 3f6a + if (link("nosuchfile", (char *)p) != -1) + 37eb: 89 5c 24 04 mov %ebx,0x4(%esp) + 37ef: c7 04 24 cd 52 00 00 movl $0x52cd,(%esp) + 37f6: e8 c7 07 00 00 call 3fc2 + 37fb: 83 f8 ff cmp $0xffffffff,%eax + 37fe: 75 2a jne 382a + for (p = 0; p <= (uint)hi; p += 4096) + 3800: 81 c3 00 10 00 00 add $0x1000,%ebx + 3806: 81 fb 00 40 11 00 cmp $0x114000,%ebx + 380c: 75 a2 jne 37b0 + printf(stdout, "validate ok\n"); + 380e: a1 94 64 00 00 mov 0x6494,%eax + 3813: c7 44 24 04 f1 52 00 movl $0x52f1,0x4(%esp) + 381a: 00 + 381b: 89 04 24 mov %eax,(%esp) + 381e: e8 8d 08 00 00 call 40b0 +} + 3823: 83 c4 10 add $0x10,%esp + 3826: 5b pop %ebx + 3827: 5e pop %esi + 3828: 5d pop %ebp + 3829: c3 ret + printf(stdout, "link should not succeed\n"); + 382a: a1 94 64 00 00 mov 0x6494,%eax + 382f: c7 44 24 04 d8 52 00 movl $0x52d8,0x4(%esp) + 3836: 00 + 3837: 89 04 24 mov %eax,(%esp) + 383a: e8 71 08 00 00 call 40b0 + exit(0); + 383f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3846: e8 17 07 00 00 call 3f62 + 384b: 90 nop + 384c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +00003850 : +{ + 3850: 55 push %ebp + 3851: 89 e5 mov %esp,%ebp + 3853: 83 ec 18 sub $0x18,%esp + printf(stdout, "bss test\n"); + 3856: a1 94 64 00 00 mov 0x6494,%eax + 385b: c7 44 24 04 fe 52 00 movl $0x52fe,0x4(%esp) + 3862: 00 + 3863: 89 04 24 mov %eax,(%esp) + 3866: e8 45 08 00 00 call 40b0 + if (uninit[i] != '\0') + 386b: 80 3d 60 65 00 00 00 cmpb $0x0,0x6560 + 3872: 75 36 jne 38aa + for (i = 0; i < sizeof(uninit); i++) + 3874: b8 01 00 00 00 mov $0x1,%eax + 3879: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + if (uninit[i] != '\0') + 3880: 80 b8 60 65 00 00 00 cmpb $0x0,0x6560(%eax) + 3887: 75 21 jne 38aa + for (i = 0; i < sizeof(uninit); i++) + 3889: 83 c0 01 add $0x1,%eax + 388c: 3d 10 27 00 00 cmp $0x2710,%eax + 3891: 75 ed jne 3880 + printf(stdout, "bss test ok\n"); + 3893: a1 94 64 00 00 mov 0x6494,%eax + 3898: c7 44 24 04 19 53 00 movl $0x5319,0x4(%esp) + 389f: 00 + 38a0: 89 04 24 mov %eax,(%esp) + 38a3: e8 08 08 00 00 call 40b0 +} + 38a8: c9 leave + 38a9: c3 ret + printf(stdout, "bss test failed\n"); + 38aa: a1 94 64 00 00 mov 0x6494,%eax + 38af: c7 44 24 04 08 53 00 movl $0x5308,0x4(%esp) + 38b6: 00 + 38b7: 89 04 24 mov %eax,(%esp) + 38ba: e8 f1 07 00 00 call 40b0 + exit(0); + 38bf: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 38c6: e8 97 06 00 00 call 3f62 + 38cb: 90 nop + 38cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + +000038d0 : +{ + 38d0: 55 push %ebp + 38d1: 89 e5 mov %esp,%ebp + 38d3: 83 ec 18 sub $0x18,%esp + unlink("bigarg-ok"); + 38d6: c7 04 24 26 53 00 00 movl $0x5326,(%esp) + 38dd: e8 d0 06 00 00 call 3fb2 + pid = fork(); + 38e2: e8 73 06 00 00 call 3f5a + if (pid == 0) + 38e7: 85 c0 test %eax,%eax + 38e9: 74 4d je 3938 + 38eb: 90 nop + 38ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + else if (pid < 0) + 38f0: 0f 88 e6 00 00 00 js 39dc + wait(0); + 38f6: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 38fd: e8 68 06 00 00 call 3f6a + fd = open("bigarg-ok", 0); + 3902: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3909: 00 + 390a: c7 04 24 26 53 00 00 movl $0x5326,(%esp) + 3911: e8 8c 06 00 00 call 3fa2 + if (fd < 0) + 3916: 85 c0 test %eax,%eax + 3918: 0f 88 9d 00 00 00 js 39bb + close(fd); + 391e: 89 04 24 mov %eax,(%esp) + 3921: e8 64 06 00 00 call 3f8a + unlink("bigarg-ok"); + 3926: c7 04 24 26 53 00 00 movl $0x5326,(%esp) + 392d: e8 80 06 00 00 call 3fb2 +} + 3932: c9 leave + 3933: c3 ret + 3934: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + args[i] = "bigargs test: failed\n "; + 3938: c7 04 85 c0 64 00 00 movl $0x5a80,0x64c0(,%eax,4) + 393f: 80 5a 00 00 + for (i = 0; i < MAXARG - 1; i++) + 3943: 83 c0 01 add $0x1,%eax + 3946: 83 f8 1f cmp $0x1f,%eax + 3949: 75 ed jne 3938 + printf(stdout, "bigarg test\n"); + 394b: a1 94 64 00 00 mov 0x6494,%eax + 3950: c7 44 24 04 30 53 00 movl $0x5330,0x4(%esp) + 3957: 00 + args[MAXARG - 1] = 0; + 3958: c7 05 3c 65 00 00 00 movl $0x0,0x653c + 395f: 00 00 00 + printf(stdout, "bigarg test\n"); + 3962: 89 04 24 mov %eax,(%esp) + 3965: e8 46 07 00 00 call 40b0 + exec("echo", args); + 396a: c7 44 24 04 c0 64 00 movl $0x64c0,0x4(%esp) + 3971: 00 + 3972: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) + 3979: e8 1c 06 00 00 call 3f9a + printf(stdout, "bigarg test ok\n"); + 397e: a1 94 64 00 00 mov 0x6494,%eax + 3983: c7 44 24 04 3d 53 00 movl $0x533d,0x4(%esp) + 398a: 00 + 398b: 89 04 24 mov %eax,(%esp) + 398e: e8 1d 07 00 00 call 40b0 + fd = open("bigarg-ok", O_CREATE); + 3993: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp) + 399a: 00 + 399b: c7 04 24 26 53 00 00 movl $0x5326,(%esp) + 39a2: e8 fb 05 00 00 call 3fa2 + close(fd); + 39a7: 89 04 24 mov %eax,(%esp) + 39aa: e8 db 05 00 00 call 3f8a + exit(0); + 39af: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 39b6: e8 a7 05 00 00 call 3f62 + printf(stdout, "bigarg test failed!\n"); + 39bb: c7 44 24 04 66 53 00 movl $0x5366,0x4(%esp) + 39c2: 00 + 39c3: a1 94 64 00 00 mov 0x6494,%eax + 39c8: 89 04 24 mov %eax,(%esp) + 39cb: e8 e0 06 00 00 call 40b0 + exit(0); + 39d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 39d7: e8 86 05 00 00 call 3f62 + printf(stdout, "bigargtest: fork failed\n"); + 39dc: c7 44 24 04 4d 53 00 movl $0x534d,0x4(%esp) + 39e3: 00 + 39e4: eb dd jmp 39c3 + 39e6: 8d 76 00 lea 0x0(%esi),%esi + 39e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000039f0 : +{ + 39f0: 55 push %ebp + 39f1: 89 e5 mov %esp,%ebp + 39f3: 57 push %edi + 39f4: 56 push %esi + 39f5: 53 push %ebx + for (nfiles = 0;; nfiles++) + 39f6: 31 db xor %ebx,%ebx +{ + 39f8: 83 ec 5c sub $0x5c,%esp + printf(1, "fsfull test\n"); + 39fb: c7 44 24 04 7b 53 00 movl $0x537b,0x4(%esp) + 3a02: 00 + 3a03: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3a0a: e8 a1 06 00 00 call 40b0 + 3a0f: 90 nop + name[1] = '0' + nfiles / 1000; + 3a10: b8 d3 4d 62 10 mov $0x10624dd3,%eax + 3a15: 89 d9 mov %ebx,%ecx + 3a17: f7 eb imul %ebx + name[2] = '0' + (nfiles % 1000) / 100; + 3a19: 89 de mov %ebx,%esi + name[1] = '0' + nfiles / 1000; + 3a1b: c1 f9 1f sar $0x1f,%ecx + name[3] = '0' + (nfiles % 100) / 10; + 3a1e: 89 df mov %ebx,%edi + printf(1, "writing %s\n", name); + 3a20: c7 44 24 04 88 53 00 movl $0x5388,0x4(%esp) + 3a27: 00 + 3a28: c7 04 24 01 00 00 00 movl $0x1,(%esp) + name[1] = '0' + nfiles / 1000; + 3a2f: c1 fa 06 sar $0x6,%edx + 3a32: 29 ca sub %ecx,%edx + 3a34: 8d 42 30 lea 0x30(%edx),%eax + name[2] = '0' + (nfiles % 1000) / 100; + 3a37: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx + name[1] = '0' + nfiles / 1000; + 3a3d: 88 45 a9 mov %al,-0x57(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; + 3a40: b8 1f 85 eb 51 mov $0x51eb851f,%eax + name[0] = 'f'; + 3a45: c6 45 a8 66 movb $0x66,-0x58(%ebp) + name[5] = '\0'; + 3a49: c6 45 ad 00 movb $0x0,-0x53(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; + 3a4d: 29 d6 sub %edx,%esi + 3a4f: f7 ee imul %esi + name[3] = '0' + (nfiles % 100) / 10; + 3a51: b8 1f 85 eb 51 mov $0x51eb851f,%eax + name[2] = '0' + (nfiles % 1000) / 100; + 3a56: c1 fe 1f sar $0x1f,%esi + 3a59: c1 fa 05 sar $0x5,%edx + 3a5c: 29 f2 sub %esi,%edx + name[3] = '0' + (nfiles % 100) / 10; + 3a5e: be 67 66 66 66 mov $0x66666667,%esi + name[2] = '0' + (nfiles % 1000) / 100; + 3a63: 83 c2 30 add $0x30,%edx + 3a66: 88 55 aa mov %dl,-0x56(%ebp) + name[3] = '0' + (nfiles % 100) / 10; + 3a69: f7 eb imul %ebx + 3a6b: c1 fa 05 sar $0x5,%edx + 3a6e: 29 ca sub %ecx,%edx + 3a70: 6b d2 64 imul $0x64,%edx,%edx + 3a73: 29 d7 sub %edx,%edi + 3a75: 89 f8 mov %edi,%eax + 3a77: f7 ee imul %esi + name[4] = '0' + (nfiles % 10); + 3a79: 89 d8 mov %ebx,%eax + name[3] = '0' + (nfiles % 100) / 10; + 3a7b: c1 ff 1f sar $0x1f,%edi + 3a7e: c1 fa 02 sar $0x2,%edx + 3a81: 29 fa sub %edi,%edx + 3a83: 83 c2 30 add $0x30,%edx + 3a86: 88 55 ab mov %dl,-0x55(%ebp) + name[4] = '0' + (nfiles % 10); + 3a89: f7 ee imul %esi + 3a8b: c1 fa 02 sar $0x2,%edx + 3a8e: 29 ca sub %ecx,%edx + 3a90: 89 d9 mov %ebx,%ecx + 3a92: 8d 04 92 lea (%edx,%edx,4),%eax + 3a95: 01 c0 add %eax,%eax + 3a97: 29 c1 sub %eax,%ecx + 3a99: 89 c8 mov %ecx,%eax + 3a9b: 83 c0 30 add $0x30,%eax + 3a9e: 88 45 ac mov %al,-0x54(%ebp) + printf(1, "writing %s\n", name); + 3aa1: 8d 45 a8 lea -0x58(%ebp),%eax + 3aa4: 89 44 24 08 mov %eax,0x8(%esp) + 3aa8: e8 03 06 00 00 call 40b0 + int fd = open(name, O_CREATE | O_RDWR); + 3aad: 8d 45 a8 lea -0x58(%ebp),%eax + 3ab0: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp) + 3ab7: 00 + 3ab8: 89 04 24 mov %eax,(%esp) + 3abb: e8 e2 04 00 00 call 3fa2 + if (fd < 0) + 3ac0: 85 c0 test %eax,%eax + int fd = open(name, O_CREATE | O_RDWR); + 3ac2: 89 c7 mov %eax,%edi + if (fd < 0) + 3ac4: 78 57 js 3b1d + 3ac6: 31 f6 xor %esi,%esi + 3ac8: eb 08 jmp 3ad2 + 3aca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + total += cc; + 3ad0: 01 c6 add %eax,%esi + int cc = write(fd, buf, 512); + 3ad2: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + 3ad9: 00 + 3ada: c7 44 24 04 80 8c 00 movl $0x8c80,0x4(%esp) + 3ae1: 00 + 3ae2: 89 3c 24 mov %edi,(%esp) + 3ae5: e8 98 04 00 00 call 3f82 + if (cc < 512) + 3aea: 3d ff 01 00 00 cmp $0x1ff,%eax + 3aef: 7f df jg 3ad0 + printf(1, "wrote %d bytes\n", total); + 3af1: 89 74 24 08 mov %esi,0x8(%esp) + 3af5: c7 44 24 04 a4 53 00 movl $0x53a4,0x4(%esp) + 3afc: 00 + 3afd: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3b04: e8 a7 05 00 00 call 40b0 + close(fd); + 3b09: 89 3c 24 mov %edi,(%esp) + 3b0c: e8 79 04 00 00 call 3f8a + if (total == 0) + 3b11: 85 f6 test %esi,%esi + 3b13: 74 23 je 3b38 + for (nfiles = 0;; nfiles++) + 3b15: 83 c3 01 add $0x1,%ebx + } + 3b18: e9 f3 fe ff ff jmp 3a10 + printf(1, "open %s failed\n", name); + 3b1d: 8d 45 a8 lea -0x58(%ebp),%eax + 3b20: 89 44 24 08 mov %eax,0x8(%esp) + 3b24: c7 44 24 04 94 53 00 movl $0x5394,0x4(%esp) + 3b2b: 00 + 3b2c: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3b33: e8 78 05 00 00 call 40b0 + name[1] = '0' + nfiles / 1000; + 3b38: b8 d3 4d 62 10 mov $0x10624dd3,%eax + 3b3d: 89 d9 mov %ebx,%ecx + 3b3f: f7 eb imul %ebx + name[2] = '0' + (nfiles % 1000) / 100; + 3b41: 89 de mov %ebx,%esi + name[1] = '0' + nfiles / 1000; + 3b43: c1 f9 1f sar $0x1f,%ecx + name[3] = '0' + (nfiles % 100) / 10; + 3b46: 89 df mov %ebx,%edi + name[0] = 'f'; + 3b48: c6 45 a8 66 movb $0x66,-0x58(%ebp) + name[5] = '\0'; + 3b4c: c6 45 ad 00 movb $0x0,-0x53(%ebp) + name[1] = '0' + nfiles / 1000; + 3b50: c1 fa 06 sar $0x6,%edx + 3b53: 29 ca sub %ecx,%edx + 3b55: 8d 42 30 lea 0x30(%edx),%eax + name[2] = '0' + (nfiles % 1000) / 100; + 3b58: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx + name[1] = '0' + nfiles / 1000; + 3b5e: 88 45 a9 mov %al,-0x57(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; + 3b61: b8 1f 85 eb 51 mov $0x51eb851f,%eax + 3b66: 29 d6 sub %edx,%esi + 3b68: f7 ee imul %esi + name[3] = '0' + (nfiles % 100) / 10; + 3b6a: b8 1f 85 eb 51 mov $0x51eb851f,%eax + name[2] = '0' + (nfiles % 1000) / 100; + 3b6f: c1 fe 1f sar $0x1f,%esi + 3b72: c1 fa 05 sar $0x5,%edx + 3b75: 29 f2 sub %esi,%edx + name[3] = '0' + (nfiles % 100) / 10; + 3b77: be 67 66 66 66 mov $0x66666667,%esi + name[2] = '0' + (nfiles % 1000) / 100; + 3b7c: 83 c2 30 add $0x30,%edx + 3b7f: 88 55 aa mov %dl,-0x56(%ebp) + name[3] = '0' + (nfiles % 100) / 10; + 3b82: f7 eb imul %ebx + 3b84: c1 fa 05 sar $0x5,%edx + 3b87: 29 ca sub %ecx,%edx + 3b89: 6b d2 64 imul $0x64,%edx,%edx + 3b8c: 29 d7 sub %edx,%edi + 3b8e: 89 f8 mov %edi,%eax + 3b90: f7 ee imul %esi + name[4] = '0' + (nfiles % 10); + 3b92: 89 d8 mov %ebx,%eax + name[3] = '0' + (nfiles % 100) / 10; + 3b94: c1 ff 1f sar $0x1f,%edi + 3b97: c1 fa 02 sar $0x2,%edx + 3b9a: 29 fa sub %edi,%edx + 3b9c: 83 c2 30 add $0x30,%edx + 3b9f: 88 55 ab mov %dl,-0x55(%ebp) + name[4] = '0' + (nfiles % 10); + 3ba2: f7 ee imul %esi + 3ba4: c1 fa 02 sar $0x2,%edx + 3ba7: 29 ca sub %ecx,%edx + 3ba9: 89 d9 mov %ebx,%ecx + 3bab: 8d 04 92 lea (%edx,%edx,4),%eax + nfiles--; + 3bae: 83 eb 01 sub $0x1,%ebx + name[4] = '0' + (nfiles % 10); + 3bb1: 01 c0 add %eax,%eax + 3bb3: 29 c1 sub %eax,%ecx + 3bb5: 89 c8 mov %ecx,%eax + 3bb7: 83 c0 30 add $0x30,%eax + 3bba: 88 45 ac mov %al,-0x54(%ebp) + unlink(name); + 3bbd: 8d 45 a8 lea -0x58(%ebp),%eax + 3bc0: 89 04 24 mov %eax,(%esp) + 3bc3: e8 ea 03 00 00 call 3fb2 + while (nfiles >= 0) + 3bc8: 83 fb ff cmp $0xffffffff,%ebx + 3bcb: 0f 85 67 ff ff ff jne 3b38 + printf(1, "fsfull test finished\n"); + 3bd1: c7 44 24 04 b4 53 00 movl $0x53b4,0x4(%esp) + 3bd8: 00 + 3bd9: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3be0: e8 cb 04 00 00 call 40b0 +} + 3be5: 83 c4 5c add $0x5c,%esp + 3be8: 5b pop %ebx + 3be9: 5e pop %esi + 3bea: 5f pop %edi + 3beb: 5d pop %ebp + 3bec: c3 ret + 3bed: 8d 76 00 lea 0x0(%esi),%esi + +00003bf0 : +{ + 3bf0: 55 push %ebp + 3bf1: 89 e5 mov %esp,%ebp + 3bf3: 83 ec 18 sub $0x18,%esp + printf(1, "uio test\n"); + 3bf6: c7 44 24 04 ca 53 00 movl $0x53ca,0x4(%esp) + 3bfd: 00 + 3bfe: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3c05: e8 a6 04 00 00 call 40b0 + pid = fork(); + 3c0a: e8 4b 03 00 00 call 3f5a + if (pid == 0) + 3c0f: 85 c0 test %eax,%eax + 3c11: 74 24 je 3c37 + else if (pid < 0) + 3c13: 78 50 js 3c65 + wait(0); + 3c15: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3c1c: e8 49 03 00 00 call 3f6a + printf(1, "uio test done\n"); + 3c21: c7 44 24 04 d4 53 00 movl $0x53d4,0x4(%esp) + 3c28: 00 + 3c29: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3c30: e8 7b 04 00 00 call 40b0 +} + 3c35: c9 leave + 3c36: c3 ret + asm volatile("outb %0,%1" ::"a"(val), "d"(port)); + 3c37: ba 70 00 00 00 mov $0x70,%edx + 3c3c: b8 09 00 00 00 mov $0x9,%eax + 3c41: ee out %al,(%dx) + asm volatile("inb %1,%0" + 3c42: b2 71 mov $0x71,%dl + 3c44: ec in (%dx),%al + printf(1, "uio: uio succeeded; test FAILED\n"); + 3c45: c7 44 24 04 60 5b 00 movl $0x5b60,0x4(%esp) + 3c4c: 00 + 3c4d: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3c54: e8 57 04 00 00 call 40b0 + exit(0); + 3c59: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3c60: e8 fd 02 00 00 call 3f62 + printf(1, "fork failed\n"); + 3c65: c7 44 24 04 59 53 00 movl $0x5359,0x4(%esp) + 3c6c: 00 + 3c6d: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3c74: e8 37 04 00 00 call 40b0 + exit(0); + 3c79: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3c80: e8 dd 02 00 00 call 3f62 + 3c85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 3c89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003c90 : +{ + 3c90: 55 push %ebp + 3c91: 89 e5 mov %esp,%ebp + 3c93: 53 push %ebx + 3c94: 83 ec 14 sub $0x14,%esp + fd = open("init", O_RDONLY); + 3c97: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3c9e: 00 + 3c9f: c7 04 24 e3 53 00 00 movl $0x53e3,(%esp) + 3ca6: e8 f7 02 00 00 call 3fa2 + if (fd < 0) + 3cab: 85 c0 test %eax,%eax + fd = open("init", O_RDONLY); + 3cad: 89 c3 mov %eax,%ebx + if (fd < 0) + 3caf: 78 45 js 3cf6 + read(fd, sbrk(0) - 1, -1); + 3cb1: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3cb8: e8 2d 03 00 00 call 3fea + 3cbd: 89 1c 24 mov %ebx,(%esp) + 3cc0: c7 44 24 08 ff ff ff movl $0xffffffff,0x8(%esp) + 3cc7: ff + 3cc8: 83 e8 01 sub $0x1,%eax + 3ccb: 89 44 24 04 mov %eax,0x4(%esp) + 3ccf: e8 a6 02 00 00 call 3f7a + close(fd); + 3cd4: 89 1c 24 mov %ebx,(%esp) + 3cd7: e8 ae 02 00 00 call 3f8a + printf(1, "arg test passed\n"); + 3cdc: c7 44 24 04 f5 53 00 movl $0x53f5,0x4(%esp) + 3ce3: 00 + 3ce4: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 3ceb: e8 c0 03 00 00 call 40b0 +} + 3cf0: 83 c4 14 add $0x14,%esp + 3cf3: 5b pop %ebx + 3cf4: 5d pop %ebp + 3cf5: c3 ret + printf(2, "open failed\n"); + 3cf6: c7 44 24 04 e8 53 00 movl $0x53e8,0x4(%esp) + 3cfd: 00 + 3cfe: c7 04 24 02 00 00 00 movl $0x2,(%esp) + 3d05: e8 a6 03 00 00 call 40b0 + exit(0); + 3d0a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3d11: e8 4c 02 00 00 call 3f62 + 3d16: 8d 76 00 lea 0x0(%esi),%esi + 3d19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003d20 : + randstate = randstate * 1664525 + 1013904223; + 3d20: 69 05 90 64 00 00 0d imul $0x19660d,0x6490,%eax + 3d27: 66 19 00 +{ + 3d2a: 55 push %ebp + 3d2b: 89 e5 mov %esp,%ebp +} + 3d2d: 5d pop %ebp + randstate = randstate * 1664525 + 1013904223; + 3d2e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax + 3d33: a3 90 64 00 00 mov %eax,0x6490 +} + 3d38: c3 ret + 3d39: 66 90 xchg %ax,%ax + 3d3b: 66 90 xchg %ax,%ax + 3d3d: 66 90 xchg %ax,%ax + 3d3f: 90 nop + +00003d40 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 3d40: 55 push %ebp + 3d41: 89 e5 mov %esp,%ebp + 3d43: 8b 45 08 mov 0x8(%ebp),%eax + 3d46: 8b 4d 0c mov 0xc(%ebp),%ecx + 3d49: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 3d4a: 89 c2 mov %eax,%edx + 3d4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 3d50: 83 c1 01 add $0x1,%ecx + 3d53: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 3d57: 83 c2 01 add $0x1,%edx + 3d5a: 84 db test %bl,%bl + 3d5c: 88 5a ff mov %bl,-0x1(%edx) + 3d5f: 75 ef jne 3d50 + ; + return os; +} + 3d61: 5b pop %ebx + 3d62: 5d pop %ebp + 3d63: c3 ret + 3d64: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 3d6a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00003d70 : + +int +strcmp(const char *p, const char *q) +{ + 3d70: 55 push %ebp + 3d71: 89 e5 mov %esp,%ebp + 3d73: 8b 55 08 mov 0x8(%ebp),%edx + 3d76: 53 push %ebx + 3d77: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 3d7a: 0f b6 02 movzbl (%edx),%eax + 3d7d: 84 c0 test %al,%al + 3d7f: 74 2d je 3dae + 3d81: 0f b6 19 movzbl (%ecx),%ebx + 3d84: 38 d8 cmp %bl,%al + 3d86: 74 0e je 3d96 + 3d88: eb 2b jmp 3db5 + 3d8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 3d90: 38 c8 cmp %cl,%al + 3d92: 75 15 jne 3da9 + p++, q++; + 3d94: 89 d9 mov %ebx,%ecx + 3d96: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 3d99: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 3d9c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 3d9f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 3da3: 84 c0 test %al,%al + 3da5: 75 e9 jne 3d90 + 3da7: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 3da9: 29 c8 sub %ecx,%eax +} + 3dab: 5b pop %ebx + 3dac: 5d pop %ebp + 3dad: c3 ret + 3dae: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 3db1: 31 c0 xor %eax,%eax + 3db3: eb f4 jmp 3da9 + 3db5: 0f b6 cb movzbl %bl,%ecx + 3db8: eb ef jmp 3da9 + 3dba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00003dc0 : + +uint +strlen(const char *s) +{ + 3dc0: 55 push %ebp + 3dc1: 89 e5 mov %esp,%ebp + 3dc3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 3dc6: 80 39 00 cmpb $0x0,(%ecx) + 3dc9: 74 12 je 3ddd + 3dcb: 31 d2 xor %edx,%edx + 3dcd: 8d 76 00 lea 0x0(%esi),%esi + 3dd0: 83 c2 01 add $0x1,%edx + 3dd3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 3dd7: 89 d0 mov %edx,%eax + 3dd9: 75 f5 jne 3dd0 + ; + return n; +} + 3ddb: 5d pop %ebp + 3ddc: c3 ret + for(n = 0; s[n]; n++) + 3ddd: 31 c0 xor %eax,%eax +} + 3ddf: 5d pop %ebp + 3de0: c3 ret + 3de1: eb 0d jmp 3df0 + 3de3: 90 nop + 3de4: 90 nop + 3de5: 90 nop + 3de6: 90 nop + 3de7: 90 nop + 3de8: 90 nop + 3de9: 90 nop + 3dea: 90 nop + 3deb: 90 nop + 3dec: 90 nop + 3ded: 90 nop + 3dee: 90 nop + 3def: 90 nop + +00003df0 : + +void* +memset(void *dst, int c, uint n) +{ + 3df0: 55 push %ebp + 3df1: 89 e5 mov %esp,%ebp + 3df3: 8b 55 08 mov 0x8(%ebp),%edx + 3df6: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 3df7: 8b 4d 10 mov 0x10(%ebp),%ecx + 3dfa: 8b 45 0c mov 0xc(%ebp),%eax + 3dfd: 89 d7 mov %edx,%edi + 3dff: fc cld + 3e00: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 3e02: 89 d0 mov %edx,%eax + 3e04: 5f pop %edi + 3e05: 5d pop %ebp + 3e06: c3 ret + 3e07: 89 f6 mov %esi,%esi + 3e09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003e10 : + +char* +strchr(const char *s, char c) +{ + 3e10: 55 push %ebp + 3e11: 89 e5 mov %esp,%ebp + 3e13: 8b 45 08 mov 0x8(%ebp),%eax + 3e16: 53 push %ebx + 3e17: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 3e1a: 0f b6 18 movzbl (%eax),%ebx + 3e1d: 84 db test %bl,%bl + 3e1f: 74 1d je 3e3e + if(*s == c) + 3e21: 38 d3 cmp %dl,%bl + 3e23: 89 d1 mov %edx,%ecx + 3e25: 75 0d jne 3e34 + 3e27: eb 17 jmp 3e40 + 3e29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 3e30: 38 ca cmp %cl,%dl + 3e32: 74 0c je 3e40 + for(; *s; s++) + 3e34: 83 c0 01 add $0x1,%eax + 3e37: 0f b6 10 movzbl (%eax),%edx + 3e3a: 84 d2 test %dl,%dl + 3e3c: 75 f2 jne 3e30 + return (char*)s; + return 0; + 3e3e: 31 c0 xor %eax,%eax +} + 3e40: 5b pop %ebx + 3e41: 5d pop %ebp + 3e42: c3 ret + 3e43: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 3e49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00003e50 : + +char* +gets(char *buf, int max) +{ + 3e50: 55 push %ebp + 3e51: 89 e5 mov %esp,%ebp + 3e53: 57 push %edi + 3e54: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 3e55: 31 f6 xor %esi,%esi +{ + 3e57: 53 push %ebx + 3e58: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 3e5b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 3e5e: eb 31 jmp 3e91 + cc = read(0, &c, 1); + 3e60: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3e67: 00 + 3e68: 89 7c 24 04 mov %edi,0x4(%esp) + 3e6c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 3e73: e8 02 01 00 00 call 3f7a + if(cc < 1) + 3e78: 85 c0 test %eax,%eax + 3e7a: 7e 1d jle 3e99 + break; + buf[i++] = c; + 3e7c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 3e80: 89 de mov %ebx,%esi + buf[i++] = c; + 3e82: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 3e85: 3c 0d cmp $0xd,%al + buf[i++] = c; + 3e87: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 3e8b: 74 0c je 3e99 + 3e8d: 3c 0a cmp $0xa,%al + 3e8f: 74 08 je 3e99 + for(i=0; i+1 < max; ){ + 3e91: 8d 5e 01 lea 0x1(%esi),%ebx + 3e94: 3b 5d 0c cmp 0xc(%ebp),%ebx + 3e97: 7c c7 jl 3e60 + break; + } + buf[i] = '\0'; + 3e99: 8b 45 08 mov 0x8(%ebp),%eax + 3e9c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 3ea0: 83 c4 2c add $0x2c,%esp + 3ea3: 5b pop %ebx + 3ea4: 5e pop %esi + 3ea5: 5f pop %edi + 3ea6: 5d pop %ebp + 3ea7: c3 ret + 3ea8: 90 nop + 3ea9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00003eb0 : + +int +stat(const char *n, struct stat *st) +{ + 3eb0: 55 push %ebp + 3eb1: 89 e5 mov %esp,%ebp + 3eb3: 56 push %esi + 3eb4: 53 push %ebx + 3eb5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 3eb8: 8b 45 08 mov 0x8(%ebp),%eax + 3ebb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 3ec2: 00 + 3ec3: 89 04 24 mov %eax,(%esp) + 3ec6: e8 d7 00 00 00 call 3fa2 + if(fd < 0) + 3ecb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 3ecd: 89 c3 mov %eax,%ebx + if(fd < 0) + 3ecf: 78 27 js 3ef8 + return -1; + r = fstat(fd, st); + 3ed1: 8b 45 0c mov 0xc(%ebp),%eax + 3ed4: 89 1c 24 mov %ebx,(%esp) + 3ed7: 89 44 24 04 mov %eax,0x4(%esp) + 3edb: e8 da 00 00 00 call 3fba + close(fd); + 3ee0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 3ee3: 89 c6 mov %eax,%esi + close(fd); + 3ee5: e8 a0 00 00 00 call 3f8a + return r; + 3eea: 89 f0 mov %esi,%eax +} + 3eec: 83 c4 10 add $0x10,%esp + 3eef: 5b pop %ebx + 3ef0: 5e pop %esi + 3ef1: 5d pop %ebp + 3ef2: c3 ret + 3ef3: 90 nop + 3ef4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 3ef8: b8 ff ff ff ff mov $0xffffffff,%eax + 3efd: eb ed jmp 3eec + 3eff: 90 nop + +00003f00 : + +int +atoi(const char *s) +{ + 3f00: 55 push %ebp + 3f01: 89 e5 mov %esp,%ebp + 3f03: 8b 4d 08 mov 0x8(%ebp),%ecx + 3f06: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 3f07: 0f be 11 movsbl (%ecx),%edx + 3f0a: 8d 42 d0 lea -0x30(%edx),%eax + 3f0d: 3c 09 cmp $0x9,%al + n = 0; + 3f0f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 3f14: 77 17 ja 3f2d + 3f16: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 3f18: 83 c1 01 add $0x1,%ecx + 3f1b: 8d 04 80 lea (%eax,%eax,4),%eax + 3f1e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 3f22: 0f be 11 movsbl (%ecx),%edx + 3f25: 8d 5a d0 lea -0x30(%edx),%ebx + 3f28: 80 fb 09 cmp $0x9,%bl + 3f2b: 76 eb jbe 3f18 + return n; +} + 3f2d: 5b pop %ebx + 3f2e: 5d pop %ebp + 3f2f: c3 ret + +00003f30 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 3f30: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 3f31: 31 d2 xor %edx,%edx +{ + 3f33: 89 e5 mov %esp,%ebp + 3f35: 56 push %esi + 3f36: 8b 45 08 mov 0x8(%ebp),%eax + 3f39: 53 push %ebx + 3f3a: 8b 5d 10 mov 0x10(%ebp),%ebx + 3f3d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 3f40: 85 db test %ebx,%ebx + 3f42: 7e 12 jle 3f56 + 3f44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 3f48: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 3f4c: 88 0c 10 mov %cl,(%eax,%edx,1) + 3f4f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 3f52: 39 da cmp %ebx,%edx + 3f54: 75 f2 jne 3f48 + return vdst; +} + 3f56: 5b pop %ebx + 3f57: 5e pop %esi + 3f58: 5d pop %ebp + 3f59: c3 ret + +00003f5a : + 3f5a: b8 01 00 00 00 mov $0x1,%eax + 3f5f: cd 40 int $0x40 + 3f61: c3 ret + +00003f62 : + 3f62: b8 02 00 00 00 mov $0x2,%eax + 3f67: cd 40 int $0x40 + 3f69: c3 ret + +00003f6a : + 3f6a: b8 03 00 00 00 mov $0x3,%eax + 3f6f: cd 40 int $0x40 + 3f71: c3 ret + +00003f72 : + 3f72: b8 04 00 00 00 mov $0x4,%eax + 3f77: cd 40 int $0x40 + 3f79: c3 ret + +00003f7a : + 3f7a: b8 05 00 00 00 mov $0x5,%eax + 3f7f: cd 40 int $0x40 + 3f81: c3 ret + +00003f82 : + 3f82: b8 10 00 00 00 mov $0x10,%eax + 3f87: cd 40 int $0x40 + 3f89: c3 ret + +00003f8a : + 3f8a: b8 15 00 00 00 mov $0x15,%eax + 3f8f: cd 40 int $0x40 + 3f91: c3 ret + +00003f92 : + 3f92: b8 06 00 00 00 mov $0x6,%eax + 3f97: cd 40 int $0x40 + 3f99: c3 ret + +00003f9a : + 3f9a: b8 07 00 00 00 mov $0x7,%eax + 3f9f: cd 40 int $0x40 + 3fa1: c3 ret + +00003fa2 : + 3fa2: b8 0f 00 00 00 mov $0xf,%eax + 3fa7: cd 40 int $0x40 + 3fa9: c3 ret + +00003faa : + 3faa: b8 11 00 00 00 mov $0x11,%eax + 3faf: cd 40 int $0x40 + 3fb1: c3 ret + +00003fb2 : + 3fb2: b8 12 00 00 00 mov $0x12,%eax + 3fb7: cd 40 int $0x40 + 3fb9: c3 ret + +00003fba : + 3fba: b8 08 00 00 00 mov $0x8,%eax + 3fbf: cd 40 int $0x40 + 3fc1: c3 ret + +00003fc2 : + 3fc2: b8 13 00 00 00 mov $0x13,%eax + 3fc7: cd 40 int $0x40 + 3fc9: c3 ret + +00003fca : + 3fca: b8 14 00 00 00 mov $0x14,%eax + 3fcf: cd 40 int $0x40 + 3fd1: c3 ret + +00003fd2 : + 3fd2: b8 09 00 00 00 mov $0x9,%eax + 3fd7: cd 40 int $0x40 + 3fd9: c3 ret + +00003fda : + 3fda: b8 0a 00 00 00 mov $0xa,%eax + 3fdf: cd 40 int $0x40 + 3fe1: c3 ret + +00003fe2 : + 3fe2: b8 0b 00 00 00 mov $0xb,%eax + 3fe7: cd 40 int $0x40 + 3fe9: c3 ret + +00003fea : + 3fea: b8 0c 00 00 00 mov $0xc,%eax + 3fef: cd 40 int $0x40 + 3ff1: c3 ret + +00003ff2 : + 3ff2: b8 0d 00 00 00 mov $0xd,%eax + 3ff7: cd 40 int $0x40 + 3ff9: c3 ret + +00003ffa : + 3ffa: b8 0e 00 00 00 mov $0xe,%eax + 3fff: cd 40 int $0x40 + 4001: c3 ret + 4002: 66 90 xchg %ax,%ax + 4004: 66 90 xchg %ax,%ax + 4006: 66 90 xchg %ax,%ax + 4008: 66 90 xchg %ax,%ax + 400a: 66 90 xchg %ax,%ax + 400c: 66 90 xchg %ax,%ax + 400e: 66 90 xchg %ax,%ax + +00004010 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 4010: 55 push %ebp + 4011: 89 e5 mov %esp,%ebp + 4013: 57 push %edi + 4014: 56 push %esi + 4015: 89 c6 mov %eax,%esi + 4017: 53 push %ebx + 4018: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 401b: 8b 5d 08 mov 0x8(%ebp),%ebx + 401e: 85 db test %ebx,%ebx + 4020: 74 09 je 402b + 4022: 89 d0 mov %edx,%eax + 4024: c1 e8 1f shr $0x1f,%eax + 4027: 84 c0 test %al,%al + 4029: 75 75 jne 40a0 + neg = 1; + x = -xx; + } else { + x = xx; + 402b: 89 d0 mov %edx,%eax + neg = 0; + 402d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 4034: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 4037: 31 ff xor %edi,%edi + 4039: 89 ce mov %ecx,%esi + 403b: 8d 5d d7 lea -0x29(%ebp),%ebx + 403e: eb 02 jmp 4042 + do{ + buf[i++] = digits[x % base]; + 4040: 89 cf mov %ecx,%edi + 4042: 31 d2 xor %edx,%edx + 4044: f7 f6 div %esi + 4046: 8d 4f 01 lea 0x1(%edi),%ecx + 4049: 0f b6 92 b7 5b 00 00 movzbl 0x5bb7(%edx),%edx + }while((x /= base) != 0); + 4050: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 4052: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 4055: 75 e9 jne 4040 + if(neg) + 4057: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 405a: 89 c8 mov %ecx,%eax + 405c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 405f: 85 d2 test %edx,%edx + 4061: 74 08 je 406b + buf[i++] = '-'; + 4063: 8d 4f 02 lea 0x2(%edi),%ecx + 4066: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 406b: 8d 79 ff lea -0x1(%ecx),%edi + 406e: 66 90 xchg %ax,%ax + 4070: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 4075: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 4078: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 407f: 00 + 4080: 89 5c 24 04 mov %ebx,0x4(%esp) + 4084: 89 34 24 mov %esi,(%esp) + 4087: 88 45 d7 mov %al,-0x29(%ebp) + 408a: e8 f3 fe ff ff call 3f82 + while(--i >= 0) + 408f: 83 ff ff cmp $0xffffffff,%edi + 4092: 75 dc jne 4070 + putc(fd, buf[i]); +} + 4094: 83 c4 4c add $0x4c,%esp + 4097: 5b pop %ebx + 4098: 5e pop %esi + 4099: 5f pop %edi + 409a: 5d pop %ebp + 409b: c3 ret + 409c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 40a0: 89 d0 mov %edx,%eax + 40a2: f7 d8 neg %eax + neg = 1; + 40a4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 40ab: eb 87 jmp 4034 + 40ad: 8d 76 00 lea 0x0(%esi),%esi + +000040b0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 40b0: 55 push %ebp + 40b1: 89 e5 mov %esp,%ebp + 40b3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 40b4: 31 ff xor %edi,%edi +{ + 40b6: 56 push %esi + 40b7: 53 push %ebx + 40b8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 40bb: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 40be: 8d 45 10 lea 0x10(%ebp),%eax +{ + 40c1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 40c4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 40c7: 0f b6 13 movzbl (%ebx),%edx + 40ca: 83 c3 01 add $0x1,%ebx + 40cd: 84 d2 test %dl,%dl + 40cf: 75 39 jne 410a + 40d1: e9 c2 00 00 00 jmp 4198 + 40d6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 40d8: 83 fa 25 cmp $0x25,%edx + 40db: 0f 84 bf 00 00 00 je 41a0 + write(fd, &c, 1); + 40e1: 8d 45 e2 lea -0x1e(%ebp),%eax + 40e4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 40eb: 00 + 40ec: 89 44 24 04 mov %eax,0x4(%esp) + 40f0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 40f3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 40f6: e8 87 fe ff ff call 3f82 + 40fb: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 40fe: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 4102: 84 d2 test %dl,%dl + 4104: 0f 84 8e 00 00 00 je 4198 + if(state == 0){ + 410a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 410c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 410f: 74 c7 je 40d8 + } + } else if(state == '%'){ + 4111: 83 ff 25 cmp $0x25,%edi + 4114: 75 e5 jne 40fb + if(c == 'd'){ + 4116: 83 fa 64 cmp $0x64,%edx + 4119: 0f 84 31 01 00 00 je 4250 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 411f: 25 f7 00 00 00 and $0xf7,%eax + 4124: 83 f8 70 cmp $0x70,%eax + 4127: 0f 84 83 00 00 00 je 41b0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 412d: 83 fa 73 cmp $0x73,%edx + 4130: 0f 84 a2 00 00 00 je 41d8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 4136: 83 fa 63 cmp $0x63,%edx + 4139: 0f 84 35 01 00 00 je 4274 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 413f: 83 fa 25 cmp $0x25,%edx + 4142: 0f 84 e0 00 00 00 je 4228 + write(fd, &c, 1); + 4148: 8d 45 e6 lea -0x1a(%ebp),%eax + 414b: 83 c3 01 add $0x1,%ebx + 414e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4155: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 4156: 31 ff xor %edi,%edi + write(fd, &c, 1); + 4158: 89 44 24 04 mov %eax,0x4(%esp) + 415c: 89 34 24 mov %esi,(%esp) + 415f: 89 55 d0 mov %edx,-0x30(%ebp) + 4162: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 4166: e8 17 fe ff ff call 3f82 + putc(fd, c); + 416b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 416e: 8d 45 e7 lea -0x19(%ebp),%eax + 4171: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4178: 00 + 4179: 89 44 24 04 mov %eax,0x4(%esp) + 417d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 4180: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 4183: e8 fa fd ff ff call 3f82 + for(i = 0; fmt[i]; i++){ + 4188: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 418c: 84 d2 test %dl,%dl + 418e: 0f 85 76 ff ff ff jne 410a + 4194: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 4198: 83 c4 3c add $0x3c,%esp + 419b: 5b pop %ebx + 419c: 5e pop %esi + 419d: 5f pop %edi + 419e: 5d pop %ebp + 419f: c3 ret + state = '%'; + 41a0: bf 25 00 00 00 mov $0x25,%edi + 41a5: e9 51 ff ff ff jmp 40fb + 41aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 41b0: 8b 45 d4 mov -0x2c(%ebp),%eax + 41b3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 41b8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 41ba: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 41c1: 8b 10 mov (%eax),%edx + 41c3: 89 f0 mov %esi,%eax + 41c5: e8 46 fe ff ff call 4010 + ap++; + 41ca: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 41ce: e9 28 ff ff ff jmp 40fb + 41d3: 90 nop + 41d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 41d8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 41db: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 41df: 8b 38 mov (%eax),%edi + s = "(null)"; + 41e1: b8 b0 5b 00 00 mov $0x5bb0,%eax + 41e6: 85 ff test %edi,%edi + 41e8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 41eb: 0f b6 07 movzbl (%edi),%eax + 41ee: 84 c0 test %al,%al + 41f0: 74 2a je 421c + 41f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 41f8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 41fb: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 41fe: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 4201: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4208: 00 + 4209: 89 44 24 04 mov %eax,0x4(%esp) + 420d: 89 34 24 mov %esi,(%esp) + 4210: e8 6d fd ff ff call 3f82 + while(*s != 0){ + 4215: 0f b6 07 movzbl (%edi),%eax + 4218: 84 c0 test %al,%al + 421a: 75 dc jne 41f8 + state = 0; + 421c: 31 ff xor %edi,%edi + 421e: e9 d8 fe ff ff jmp 40fb + 4223: 90 nop + 4224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 4228: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 422b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 422d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4234: 00 + 4235: 89 44 24 04 mov %eax,0x4(%esp) + 4239: 89 34 24 mov %esi,(%esp) + 423c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 4240: e8 3d fd ff ff call 3f82 + 4245: e9 b1 fe ff ff jmp 40fb + 424a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 4250: 8b 45 d4 mov -0x2c(%ebp),%eax + 4253: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 4258: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 425b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 4262: 8b 10 mov (%eax),%edx + 4264: 89 f0 mov %esi,%eax + 4266: e8 a5 fd ff ff call 4010 + ap++; + 426b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 426f: e9 87 fe ff ff jmp 40fb + putc(fd, *ap); + 4274: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 4277: 31 ff xor %edi,%edi + putc(fd, *ap); + 4279: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 427b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4282: 00 + 4283: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 4286: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 4289: 8d 45 e4 lea -0x1c(%ebp),%eax + 428c: 89 44 24 04 mov %eax,0x4(%esp) + 4290: e8 ed fc ff ff call 3f82 + ap++; + 4295: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 4299: e9 5d fe ff ff jmp 40fb + 429e: 66 90 xchg %ax,%ax + +000042a0 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 42a0: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 42a1: a1 40 65 00 00 mov 0x6540,%eax +{ + 42a6: 89 e5 mov %esp,%ebp + 42a8: 57 push %edi + 42a9: 56 push %esi + 42aa: 53 push %ebx + 42ab: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 42ae: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 42b0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 42b3: 39 d0 cmp %edx,%eax + 42b5: 72 11 jb 42c8 + 42b7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 42b8: 39 c8 cmp %ecx,%eax + 42ba: 72 04 jb 42c0 + 42bc: 39 ca cmp %ecx,%edx + 42be: 72 10 jb 42d0 + 42c0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 42c2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 42c4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 42c6: 73 f0 jae 42b8 + 42c8: 39 ca cmp %ecx,%edx + 42ca: 72 04 jb 42d0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 42cc: 39 c8 cmp %ecx,%eax + 42ce: 72 f0 jb 42c0 + break; + if(bp + bp->s.size == p->s.ptr){ + 42d0: 8b 73 fc mov -0x4(%ebx),%esi + 42d3: 8d 3c f2 lea (%edx,%esi,8),%edi + 42d6: 39 cf cmp %ecx,%edi + 42d8: 74 1e je 42f8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 42da: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 42dd: 8b 48 04 mov 0x4(%eax),%ecx + 42e0: 8d 34 c8 lea (%eax,%ecx,8),%esi + 42e3: 39 f2 cmp %esi,%edx + 42e5: 74 28 je 430f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 42e7: 89 10 mov %edx,(%eax) + freep = p; + 42e9: a3 40 65 00 00 mov %eax,0x6540 +} + 42ee: 5b pop %ebx + 42ef: 5e pop %esi + 42f0: 5f pop %edi + 42f1: 5d pop %ebp + 42f2: c3 ret + 42f3: 90 nop + 42f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 42f8: 03 71 04 add 0x4(%ecx),%esi + 42fb: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 42fe: 8b 08 mov (%eax),%ecx + 4300: 8b 09 mov (%ecx),%ecx + 4302: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 4305: 8b 48 04 mov 0x4(%eax),%ecx + 4308: 8d 34 c8 lea (%eax,%ecx,8),%esi + 430b: 39 f2 cmp %esi,%edx + 430d: 75 d8 jne 42e7 + p->s.size += bp->s.size; + 430f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 4312: a3 40 65 00 00 mov %eax,0x6540 + p->s.size += bp->s.size; + 4317: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 431a: 8b 53 f8 mov -0x8(%ebx),%edx + 431d: 89 10 mov %edx,(%eax) +} + 431f: 5b pop %ebx + 4320: 5e pop %esi + 4321: 5f pop %edi + 4322: 5d pop %ebp + 4323: c3 ret + 4324: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 432a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00004330 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 4330: 55 push %ebp + 4331: 89 e5 mov %esp,%ebp + 4333: 57 push %edi + 4334: 56 push %esi + 4335: 53 push %ebx + 4336: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 4339: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 433c: 8b 1d 40 65 00 00 mov 0x6540,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 4342: 8d 48 07 lea 0x7(%eax),%ecx + 4345: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 4348: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 434a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 434d: 0f 84 9b 00 00 00 je 43ee + 4353: 8b 13 mov (%ebx),%edx + 4355: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 4358: 39 fe cmp %edi,%esi + 435a: 76 64 jbe 43c0 + 435c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 4363: bb 00 80 00 00 mov $0x8000,%ebx + 4368: 89 45 e4 mov %eax,-0x1c(%ebp) + 436b: eb 0e jmp 437b + 436d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 4370: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 4372: 8b 78 04 mov 0x4(%eax),%edi + 4375: 39 fe cmp %edi,%esi + 4377: 76 4f jbe 43c8 + 4379: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 437b: 3b 15 40 65 00 00 cmp 0x6540,%edx + 4381: 75 ed jne 4370 + if(nu < 4096) + 4383: 8b 45 e4 mov -0x1c(%ebp),%eax + 4386: 81 fe 00 10 00 00 cmp $0x1000,%esi + 438c: bf 00 10 00 00 mov $0x1000,%edi + 4391: 0f 43 fe cmovae %esi,%edi + 4394: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 4397: 89 04 24 mov %eax,(%esp) + 439a: e8 4b fc ff ff call 3fea + if(p == (char*)-1) + 439f: 83 f8 ff cmp $0xffffffff,%eax + 43a2: 74 18 je 43bc + hp->s.size = nu; + 43a4: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 43a7: 83 c0 08 add $0x8,%eax + 43aa: 89 04 24 mov %eax,(%esp) + 43ad: e8 ee fe ff ff call 42a0 + return freep; + 43b2: 8b 15 40 65 00 00 mov 0x6540,%edx + if((p = morecore(nunits)) == 0) + 43b8: 85 d2 test %edx,%edx + 43ba: 75 b4 jne 4370 + return 0; + 43bc: 31 c0 xor %eax,%eax + 43be: eb 20 jmp 43e0 + if(p->s.size >= nunits){ + 43c0: 89 d0 mov %edx,%eax + 43c2: 89 da mov %ebx,%edx + 43c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 43c8: 39 fe cmp %edi,%esi + 43ca: 74 1c je 43e8 + p->s.size -= nunits; + 43cc: 29 f7 sub %esi,%edi + 43ce: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 43d1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 43d4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 43d7: 89 15 40 65 00 00 mov %edx,0x6540 + return (void*)(p + 1); + 43dd: 83 c0 08 add $0x8,%eax + } +} + 43e0: 83 c4 1c add $0x1c,%esp + 43e3: 5b pop %ebx + 43e4: 5e pop %esi + 43e5: 5f pop %edi + 43e6: 5d pop %ebp + 43e7: c3 ret + prevp->s.ptr = p->s.ptr; + 43e8: 8b 08 mov (%eax),%ecx + 43ea: 89 0a mov %ecx,(%edx) + 43ec: eb e9 jmp 43d7 + base.s.ptr = freep = prevp = &base; + 43ee: c7 05 40 65 00 00 44 movl $0x6544,0x6540 + 43f5: 65 00 00 + base.s.size = 0; + 43f8: ba 44 65 00 00 mov $0x6544,%edx + base.s.ptr = freep = prevp = &base; + 43fd: c7 05 44 65 00 00 44 movl $0x6544,0x6544 + 4404: 65 00 00 + base.s.size = 0; + 4407: c7 05 48 65 00 00 00 movl $0x0,0x6548 + 440e: 00 00 00 + 4411: e9 46 ff ff ff jmp 435c diff --git a/usertests.c b/usertests.c index a1e97e72d4..d1662c55f5 100644 --- a/usertests.c +++ b/usertests.c @@ -10,63 +10,71 @@ char buf[8192]; char name[3]; -char *echoargv[] = { "echo", "ALL", "TESTS", "PASSED", 0 }; +char *echoargv[] = {"echo", "ALL", "TESTS", "PASSED", 0}; int stdout = 1; // does chdir() call iput(p->cwd) in a transaction? -void -iputtest(void) +void iputtest(void) { printf(stdout, "iput test\n"); - if(mkdir("iputdir") < 0){ + if (mkdir("iputdir") < 0) + { printf(stdout, "mkdir failed\n"); - exit(); + exit(0); } - if(chdir("iputdir") < 0){ + if (chdir("iputdir") < 0) + { printf(stdout, "chdir iputdir failed\n"); - exit(); + exit(0); } - if(unlink("../iputdir") < 0){ + if (unlink("../iputdir") < 0) + { printf(stdout, "unlink ../iputdir failed\n"); - exit(); + exit(0); } - if(chdir("/") < 0){ + if (chdir("/") < 0) + { printf(stdout, "chdir / failed\n"); - exit(); + exit(0); } printf(stdout, "iput test ok\n"); } -// does exit() call iput(p->cwd) in a transaction? -void -exitiputtest(void) +// does exit(0) call iput(p->cwd) in a transaction? +void exitiputtest(void) { int pid; printf(stdout, "exitiput test\n"); pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(stdout, "fork failed\n"); - exit(); + exit(0); } - if(pid == 0){ - if(mkdir("iputdir") < 0){ + if (pid == 0) + { + if (mkdir("iputdir") < 0) + { printf(stdout, "mkdir failed\n"); - exit(); + exit(0); } - if(chdir("iputdir") < 0){ + if (chdir("iputdir") < 0) + { printf(stdout, "child chdir failed\n"); - exit(); + exit(0); } - if(unlink("../iputdir") < 0){ + if (unlink("../iputdir") < 0) + { printf(stdout, "unlink ../iputdir failed\n"); - exit(); + exit(0); } - exit(); + exit(0); } - wait(); + wait(0); + ; printf(stdout, "exitiput test ok\n"); } @@ -81,168 +89,195 @@ exitiputtest(void) // for(i = 0; i < 10000; i++) // yield(); // } -void -openiputtest(void) +void openiputtest(void) { int pid; printf(stdout, "openiput test\n"); - if(mkdir("oidir") < 0){ + if (mkdir("oidir") < 0) + { printf(stdout, "mkdir oidir failed\n"); - exit(); + exit(0); } pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(stdout, "fork failed\n"); - exit(); + exit(0); } - if(pid == 0){ + if (pid == 0) + { int fd = open("oidir", O_RDWR); - if(fd >= 0){ + if (fd >= 0) + { printf(stdout, "open directory for write succeeded\n"); - exit(); + exit(0); } - exit(); + exit(0); } sleep(1); - if(unlink("oidir") != 0){ + if (unlink("oidir") != 0) + { printf(stdout, "unlink failed\n"); - exit(); + exit(0); } - wait(); + wait(0); + ; printf(stdout, "openiput test ok\n"); } // simple file system tests -void -opentest(void) +void opentest(void) { int fd; printf(stdout, "open test\n"); fd = open("echo", 0); - if(fd < 0){ + if (fd < 0) + { printf(stdout, "open echo failed!\n"); - exit(); + exit(0); } close(fd); fd = open("doesnotexist", 0); - if(fd >= 0){ + if (fd >= 0) + { printf(stdout, "open doesnotexist succeeded!\n"); - exit(); + exit(0); } printf(stdout, "open test ok\n"); } -void -writetest(void) +void writetest(void) { int fd; int i; printf(stdout, "small file test\n"); - fd = open("small", O_CREATE|O_RDWR); - if(fd >= 0){ + fd = open("small", O_CREATE | O_RDWR); + if (fd >= 0) + { printf(stdout, "creat small succeeded; ok\n"); - } else { + } + else + { printf(stdout, "error: creat small failed!\n"); - exit(); + exit(0); } - for(i = 0; i < 100; i++){ - if(write(fd, "aaaaaaaaaa", 10) != 10){ + for (i = 0; i < 100; i++) + { + if (write(fd, "aaaaaaaaaa", 10) != 10) + { printf(stdout, "error: write aa %d new file failed\n", i); - exit(); + exit(0); } - if(write(fd, "bbbbbbbbbb", 10) != 10){ + if (write(fd, "bbbbbbbbbb", 10) != 10) + { printf(stdout, "error: write bb %d new file failed\n", i); - exit(); + exit(0); } } printf(stdout, "writes ok\n"); close(fd); fd = open("small", O_RDONLY); - if(fd >= 0){ + if (fd >= 0) + { printf(stdout, "open small succeeded ok\n"); - } else { + } + else + { printf(stdout, "error: open small failed!\n"); - exit(); + exit(0); } i = read(fd, buf, 2000); - if(i == 2000){ + if (i == 2000) + { printf(stdout, "read succeeded ok\n"); - } else { + } + else + { printf(stdout, "read failed\n"); - exit(); + exit(0); } close(fd); - if(unlink("small") < 0){ + if (unlink("small") < 0) + { printf(stdout, "unlink small failed\n"); - exit(); + exit(0); } printf(stdout, "small file test ok\n"); } -void -writetest1(void) +void writetest1(void) { int i, fd, n; printf(stdout, "big files test\n"); - fd = open("big", O_CREATE|O_RDWR); - if(fd < 0){ + fd = open("big", O_CREATE | O_RDWR); + if (fd < 0) + { printf(stdout, "error: creat big failed!\n"); - exit(); + exit(0); } - for(i = 0; i < MAXFILE; i++){ - ((int*)buf)[0] = i; - if(write(fd, buf, 512) != 512){ + for (i = 0; i < MAXFILE; i++) + { + ((int *)buf)[0] = i; + if (write(fd, buf, 512) != 512) + { printf(stdout, "error: write big file failed\n", i); - exit(); + exit(0); } } close(fd); fd = open("big", O_RDONLY); - if(fd < 0){ + if (fd < 0) + { printf(stdout, "error: open big failed!\n"); - exit(); + exit(0); } n = 0; - for(;;){ + for (;;) + { i = read(fd, buf, 512); - if(i == 0){ - if(n == MAXFILE - 1){ + if (i == 0) + { + if (n == MAXFILE - 1) + { printf(stdout, "read only %d blocks from big", n); - exit(); + exit(0); } break; - } else if(i != 512){ + } + else if (i != 512) + { printf(stdout, "read failed %d\n", i); - exit(); + exit(0); } - if(((int*)buf)[0] != n){ + if (((int *)buf)[0] != n) + { printf(stdout, "read content of block %d is %d\n", - n, ((int*)buf)[0]); - exit(); + n, ((int *)buf)[0]); + exit(0); } n++; } close(fd); - if(unlink("big") < 0){ + if (unlink("big") < 0) + { printf(stdout, "unlink big failed\n"); - exit(); + exit(0); } printf(stdout, "big files ok\n"); } -void -createtest(void) +void createtest(void) { int i, fd; @@ -250,14 +285,16 @@ createtest(void) name[0] = 'a'; name[2] = '\0'; - for(i = 0; i < 52; i++){ + for (i = 0; i < 52; i++) + { name[1] = '0' + i; - fd = open(name, O_CREATE|O_RDWR); + fd = open(name, O_CREATE | O_RDWR); close(fd); } name[0] = 'a'; name[2] = '\0'; - for(i = 0; i < 52; i++){ + for (i = 0; i < 52; i++) + { name[1] = '0' + i; unlink(name); } @@ -268,123 +305,140 @@ void dirtest(void) { printf(stdout, "mkdir test\n"); - if(mkdir("dir0") < 0){ + if (mkdir("dir0") < 0) + { printf(stdout, "mkdir failed\n"); - exit(); + exit(0); } - if(chdir("dir0") < 0){ + if (chdir("dir0") < 0) + { printf(stdout, "chdir dir0 failed\n"); - exit(); + exit(0); } - if(chdir("..") < 0){ + if (chdir("..") < 0) + { printf(stdout, "chdir .. failed\n"); - exit(); + exit(0); } - if(unlink("dir0") < 0){ + if (unlink("dir0") < 0) + { printf(stdout, "unlink dir0 failed\n"); - exit(); + exit(0); } printf(stdout, "mkdir test ok\n"); } -void -exectest(void) +void exectest(void) { printf(stdout, "exec test\n"); - if(exec("echo", echoargv) < 0){ + if (exec("echo", echoargv) < 0) + { printf(stdout, "exec echo failed\n"); - exit(); + exit(0); } } // simple fork and pipe read/write -void -pipe1(void) +void pipe1(void) { int fds[2], pid; int seq, i, n, cc, total; - if(pipe(fds) != 0){ + if (pipe(fds) != 0) + { printf(1, "pipe() failed\n"); - exit(); + exit(0); } pid = fork(); seq = 0; - if(pid == 0){ + if (pid == 0) + { close(fds[0]); - for(n = 0; n < 5; n++){ - for(i = 0; i < 1033; i++) + for (n = 0; n < 5; n++) + { + for (i = 0; i < 1033; i++) buf[i] = seq++; - if(write(fds[1], buf, 1033) != 1033){ + if (write(fds[1], buf, 1033) != 1033) + { printf(1, "pipe1 oops 1\n"); - exit(); + exit(0); } } - exit(); - } else if(pid > 0){ + exit(0); + } + else if (pid > 0) + { close(fds[1]); total = 0; cc = 1; - while((n = read(fds[0], buf, cc)) > 0){ - for(i = 0; i < n; i++){ - if((buf[i] & 0xff) != (seq++ & 0xff)){ + while ((n = read(fds[0], buf, cc)) > 0) + { + for (i = 0; i < n; i++) + { + if ((buf[i] & 0xff) != (seq++ & 0xff)) + { printf(1, "pipe1 oops 2\n"); return; } } total += n; cc = cc * 2; - if(cc > sizeof(buf)) + if (cc > sizeof(buf)) cc = sizeof(buf); } - if(total != 5 * 1033){ + if (total != 5 * 1033) + { printf(1, "pipe1 oops 3 total %d\n", total); - exit(); + exit(0); } close(fds[0]); - wait(); - } else { + wait(0); + ; + } + else + { printf(1, "fork() failed\n"); - exit(); + exit(0); } printf(1, "pipe1 ok\n"); } // meant to be run w/ at most two CPUs -void -preempt(void) +void preempt(void) { int pid1, pid2, pid3; int pfds[2]; printf(1, "preempt: "); pid1 = fork(); - if(pid1 == 0) - for(;;) + if (pid1 == 0) + for (;;) ; pid2 = fork(); - if(pid2 == 0) - for(;;) + if (pid2 == 0) + for (;;) ; pipe(pfds); pid3 = fork(); - if(pid3 == 0){ + if (pid3 == 0) + { close(pfds[0]); - if(write(pfds[1], "x", 1) != 1) + if (write(pfds[1], "x", 1) != 1) printf(1, "preempt write error"); close(pfds[1]); - for(;;) + for (;;) ; } close(pfds[1]); - if(read(pfds[0], buf, sizeof(buf)) != 1){ + if (read(pfds[0], buf, sizeof(buf)) != 1) + { printf(1, "preempt read error"); return; } @@ -394,66 +448,80 @@ preempt(void) kill(pid2); kill(pid3); printf(1, "wait... "); - wait(); - wait(); - wait(); + wait(0); + ; + wait(0); + ; + wait(0); + ; printf(1, "preempt ok\n"); } // try to find any races between exit and wait -void -exitwait(void) +void exitwait(void) { int i, pid; - for(i = 0; i < 100; i++){ + for (i = 0; i < 100; i++) + { pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(1, "fork failed\n"); return; } - if(pid){ - if(wait() != pid){ + if (pid) + { + if (wait(0) != pid) + { printf(1, "wait wrong pid\n"); return; } - } else { - exit(); + } + else + { + exit(0); } } printf(1, "exitwait ok\n"); } -void -mem(void) +void mem(void) { void *m1, *m2; int pid, ppid; printf(1, "mem test\n"); ppid = getpid(); - if((pid = fork()) == 0){ + if ((pid = fork()) == 0) + { m1 = 0; - while((m2 = malloc(10001)) != 0){ - *(char**)m2 = m1; + while ((m2 = malloc(10001)) != 0) + { + *(char **)m2 = m1; m1 = m2; } - while(m1){ - m2 = *(char**)m1; + while (m1) + { + m2 = *(char **)m1; free(m1); m1 = m2; } - m1 = malloc(1024*20); - if(m1 == 0){ + m1 = malloc(1024 * 20); + if (m1 == 0) + { printf(1, "couldn't allocate mem?!!\n"); kill(ppid); - exit(); + exit(0); } free(m1); printf(1, "mem ok\n"); - exit(); - } else { - wait(); + exit(0); + } + else + { + wait(0); + ; } } @@ -461,8 +529,7 @@ mem(void) // two processes write to the same file descriptor // is the offset shared? does inode locking work? -void -sharedfd(void) +void sharedfd(void) { int fd, pid, i, n, nc, np; char buf[10]; @@ -470,108 +537,130 @@ sharedfd(void) printf(1, "sharedfd test\n"); unlink("sharedfd"); - fd = open("sharedfd", O_CREATE|O_RDWR); - if(fd < 0){ + fd = open("sharedfd", O_CREATE | O_RDWR); + if (fd < 0) + { printf(1, "fstests: cannot open sharedfd for writing"); return; } pid = fork(); - memset(buf, pid==0?'c':'p', sizeof(buf)); - for(i = 0; i < 1000; i++){ - if(write(fd, buf, sizeof(buf)) != sizeof(buf)){ + memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); + for (i = 0; i < 1000; i++) + { + if (write(fd, buf, sizeof(buf)) != sizeof(buf)) + { printf(1, "fstests: write sharedfd failed\n"); break; } } - if(pid == 0) - exit(); + if (pid == 0) + exit(0); else - wait(); + wait(0); + ; close(fd); fd = open("sharedfd", 0); - if(fd < 0){ + if (fd < 0) + { printf(1, "fstests: cannot open sharedfd for reading\n"); return; } nc = np = 0; - while((n = read(fd, buf, sizeof(buf))) > 0){ - for(i = 0; i < sizeof(buf); i++){ - if(buf[i] == 'c') + while ((n = read(fd, buf, sizeof(buf))) > 0) + { + for (i = 0; i < sizeof(buf); i++) + { + if (buf[i] == 'c') nc++; - if(buf[i] == 'p') + if (buf[i] == 'p') np++; } } close(fd); unlink("sharedfd"); - if(nc == 10000 && np == 10000){ + if (nc == 10000 && np == 10000) + { printf(1, "sharedfd ok\n"); - } else { + } + else + { printf(1, "sharedfd oops %d %d\n", nc, np); - exit(); + exit(0); } } // four processes write different files at the same // time, to test block allocation. -void -fourfiles(void) +void fourfiles(void) { int fd, pid, i, j, n, total, pi; - char *names[] = { "f0", "f1", "f2", "f3" }; + char *names[] = {"f0", "f1", "f2", "f3"}; char *fname; printf(1, "fourfiles test\n"); - for(pi = 0; pi < 4; pi++){ + for (pi = 0; pi < 4; pi++) + { fname = names[pi]; unlink(fname); pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(1, "fork failed\n"); - exit(); + exit(0); } - if(pid == 0){ + if (pid == 0) + { fd = open(fname, O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "create failed\n"); - exit(); + exit(0); } - memset(buf, '0'+pi, 512); - for(i = 0; i < 12; i++){ - if((n = write(fd, buf, 500)) != 500){ + memset(buf, '0' + pi, 512); + for (i = 0; i < 12; i++) + { + if ((n = write(fd, buf, 500)) != 500) + { printf(1, "write failed %d\n", n); - exit(); + exit(0); } } - exit(); + exit(0); } } - for(pi = 0; pi < 4; pi++){ - wait(); + for (pi = 0; pi < 4; pi++) + { + wait(0); + ; } - for(i = 0; i < 2; i++){ + for (i = 0; i < 2; i++) + { fname = names[i]; fd = open(fname, 0); total = 0; - while((n = read(fd, buf, sizeof(buf))) > 0){ - for(j = 0; j < n; j++){ - if(buf[j] != '0'+i){ + while ((n = read(fd, buf, sizeof(buf))) > 0) + { + for (j = 0; j < n; j++) + { + if (buf[j] != '0' + i) + { printf(1, "wrong char\n"); - exit(); + exit(0); } } total += n; } close(fd); - if(total != 12*500){ + if (total != 12 * 500) + { printf(1, "wrong length %d\n", total); - exit(); + exit(0); } unlink(fname); } @@ -580,69 +669,87 @@ fourfiles(void) } // four processes create and delete different files in same directory -void -createdelete(void) +void createdelete(void) { - enum { N = 20 }; + enum + { + N = 20 + }; int pid, i, fd, pi; char name[32]; printf(1, "createdelete test\n"); - for(pi = 0; pi < 4; pi++){ + for (pi = 0; pi < 4; pi++) + { pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(1, "fork failed\n"); - exit(); + exit(0); } - if(pid == 0){ + if (pid == 0) + { name[0] = 'p' + pi; name[2] = '\0'; - for(i = 0; i < N; i++){ + for (i = 0; i < N; i++) + { name[1] = '0' + i; fd = open(name, O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "create failed\n"); - exit(); + exit(0); } close(fd); - if(i > 0 && (i % 2 ) == 0){ + if (i > 0 && (i % 2) == 0) + { name[1] = '0' + (i / 2); - if(unlink(name) < 0){ + if (unlink(name) < 0) + { printf(1, "unlink failed\n"); - exit(); + exit(0); } } } - exit(); + exit(0); } } - for(pi = 0; pi < 4; pi++){ - wait(); + for (pi = 0; pi < 4; pi++) + { + wait(0); + ; } name[0] = name[1] = name[2] = 0; - for(i = 0; i < N; i++){ - for(pi = 0; pi < 4; pi++){ + for (i = 0; i < N; i++) + { + for (pi = 0; pi < 4; pi++) + { name[0] = 'p' + pi; name[1] = '0' + i; fd = open(name, 0); - if((i == 0 || i >= N/2) && fd < 0){ + if ((i == 0 || i >= N / 2) && fd < 0) + { printf(1, "oops createdelete %s didn't exist\n", name); - exit(); - } else if((i >= 1 && i < N/2) && fd >= 0){ + exit(0); + } + else if ((i >= 1 && i < N / 2) && fd >= 0) + { printf(1, "oops createdelete %s did exist\n", name); - exit(); + exit(0); } - if(fd >= 0) + if (fd >= 0) close(fd); } } - for(i = 0; i < N; i++){ - for(pi = 0; pi < 4; pi++){ + for (i = 0; i < N; i++) + { + for (pi = 0; pi < 4; pi++) + { name[0] = 'p' + i; name[1] = '0' + i; unlink(name); @@ -653,53 +760,57 @@ createdelete(void) } // can I unlink a file and still read it? -void -unlinkread(void) +void unlinkread(void) { int fd, fd1; printf(1, "unlinkread test\n"); fd = open("unlinkread", O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "create unlinkread failed\n"); - exit(); + exit(0); } write(fd, "hello", 5); close(fd); fd = open("unlinkread", O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "open unlinkread failed\n"); - exit(); + exit(0); } - if(unlink("unlinkread") != 0){ + if (unlink("unlinkread") != 0) + { printf(1, "unlink unlinkread failed\n"); - exit(); + exit(0); } fd1 = open("unlinkread", O_CREATE | O_RDWR); write(fd1, "yyy", 3); close(fd1); - if(read(fd, buf, sizeof(buf)) != 5){ + if (read(fd, buf, sizeof(buf)) != 5) + { printf(1, "unlinkread read failed"); - exit(); + exit(0); } - if(buf[0] != 'h'){ + if (buf[0] != 'h') + { printf(1, "unlinkread wrong data\n"); - exit(); + exit(0); } - if(write(fd, buf, 10) != 10){ + if (write(fd, buf, 10) != 10) + { printf(1, "unlinkread write failed\n"); - exit(); + exit(0); } close(fd); unlink("unlinkread"); printf(1, "unlinkread ok\n"); } -void -linktest(void) +void linktest(void) { int fd; @@ -708,66 +819,75 @@ linktest(void) unlink("lf1"); unlink("lf2"); - fd = open("lf1", O_CREATE|O_RDWR); - if(fd < 0){ + fd = open("lf1", O_CREATE | O_RDWR); + if (fd < 0) + { printf(1, "create lf1 failed\n"); - exit(); + exit(0); } - if(write(fd, "hello", 5) != 5){ + if (write(fd, "hello", 5) != 5) + { printf(1, "write lf1 failed\n"); - exit(); + exit(0); } close(fd); - if(link("lf1", "lf2") < 0){ + if (link("lf1", "lf2") < 0) + { printf(1, "link lf1 lf2 failed\n"); - exit(); + exit(0); } unlink("lf1"); - if(open("lf1", 0) >= 0){ + if (open("lf1", 0) >= 0) + { printf(1, "unlinked lf1 but it is still there!\n"); - exit(); + exit(0); } fd = open("lf2", 0); - if(fd < 0){ + if (fd < 0) + { printf(1, "open lf2 failed\n"); - exit(); + exit(0); } - if(read(fd, buf, sizeof(buf)) != 5){ + if (read(fd, buf, sizeof(buf)) != 5) + { printf(1, "read lf2 failed\n"); - exit(); + exit(0); } close(fd); - if(link("lf2", "lf2") >= 0){ + if (link("lf2", "lf2") >= 0) + { printf(1, "link lf2 lf2 succeeded! oops\n"); - exit(); + exit(0); } unlink("lf2"); - if(link("lf2", "lf1") >= 0){ + if (link("lf2", "lf1") >= 0) + { printf(1, "link non-existant succeeded! oops\n"); - exit(); + exit(0); } - if(link(".", "lf1") >= 0){ + if (link(".", "lf1") >= 0) + { printf(1, "link . lf1 succeeded! oops\n"); - exit(); + exit(0); } printf(1, "linktest ok\n"); } // test concurrent create/link/unlink of the same file -void -concreate(void) +void concreate(void) { char file[3]; int i, pid, n, fd; char fa[40]; - struct { + struct + { ushort inum; char name[14]; } de; @@ -775,43 +895,55 @@ concreate(void) printf(1, "concreate test\n"); file[0] = 'C'; file[2] = '\0'; - for(i = 0; i < 40; i++){ + for (i = 0; i < 40; i++) + { file[1] = '0' + i; unlink(file); pid = fork(); - if(pid && (i % 3) == 1){ + if (pid && (i % 3) == 1) + { link("C0", file); - } else if(pid == 0 && (i % 5) == 1){ + } + else if (pid == 0 && (i % 5) == 1) + { link("C0", file); - } else { + } + else + { fd = open(file, O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "concreate create %s failed\n", file); - exit(); + exit(0); } close(fd); } - if(pid == 0) - exit(); + if (pid == 0) + exit(0); else - wait(); + wait(0); + ; } memset(fa, 0, sizeof(fa)); fd = open(".", 0); n = 0; - while(read(fd, &de, sizeof(de)) > 0){ - if(de.inum == 0) + while (read(fd, &de, sizeof(de)) > 0) + { + if (de.inum == 0) continue; - if(de.name[0] == 'C' && de.name[2] == '\0'){ + if (de.name[0] == 'C' && de.name[2] == '\0') + { i = de.name[1] - '0'; - if(i < 0 || i >= sizeof(fa)){ + if (i < 0 || i >= sizeof(fa)) + { printf(1, "concreate weird file %s\n", de.name); - exit(); + exit(0); } - if(fa[i]){ + if (fa[i]) + { printf(1, "concreate duplicate file %s\n", de.name); - exit(); + exit(0); } fa[i] = 1; n++; @@ -819,34 +951,41 @@ concreate(void) } close(fd); - if(n != 40){ + if (n != 40) + { printf(1, "concreate not enough files in directory listing\n"); - exit(); + exit(0); } - for(i = 0; i < 40; i++){ + for (i = 0; i < 40; i++) + { file[1] = '0' + i; pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(1, "fork failed\n"); - exit(); + exit(0); } - if(((i % 3) == 0 && pid == 0) || - ((i % 3) == 1 && pid != 0)){ + if (((i % 3) == 0 && pid == 0) || + ((i % 3) == 1 && pid != 0)) + { close(open(file, 0)); close(open(file, 0)); close(open(file, 0)); close(open(file, 0)); - } else { + } + else + { unlink(file); unlink(file); unlink(file); unlink(file); } - if(pid == 0) - exit(); + if (pid == 0) + exit(0); else - wait(); + wait(0); + ; } printf(1, "concreate ok\n"); @@ -854,8 +993,7 @@ concreate(void) // another concurrent link/unlink/create test, // to look for deadlocks. -void -linkunlink() +void linkunlink() { int pid, i; @@ -863,34 +1001,41 @@ linkunlink() unlink("x"); pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(1, "fork failed\n"); - exit(); + exit(0); } unsigned int x = (pid ? 1 : 97); - for(i = 0; i < 100; i++){ + for (i = 0; i < 100; i++) + { x = x * 1103515245 + 12345; - if((x % 3) == 0){ + if ((x % 3) == 0) + { close(open("x", O_RDWR | O_CREATE)); - } else if((x % 3) == 1){ + } + else if ((x % 3) == 1) + { link("cat", "x"); - } else { + } + else + { unlink("x"); } } - if(pid) - wait(); + if (pid) + wait(0); + else - exit(); + exit(0); printf(1, "linkunlink ok\n"); } // directory that uses indirect blocks -void -bigdir(void) +void bigdir(void) { int i, fd; char name[10]; @@ -899,242 +1044,286 @@ bigdir(void) unlink("bd"); fd = open("bd", O_CREATE); - if(fd < 0){ + if (fd < 0) + { printf(1, "bigdir create failed\n"); - exit(); + exit(0); } close(fd); - for(i = 0; i < 500; i++){ + for (i = 0; i < 500; i++) + { name[0] = 'x'; name[1] = '0' + (i / 64); name[2] = '0' + (i % 64); name[3] = '\0'; - if(link("bd", name) != 0){ + if (link("bd", name) != 0) + { printf(1, "bigdir link failed\n"); - exit(); + exit(0); } } unlink("bd"); - for(i = 0; i < 500; i++){ + for (i = 0; i < 500; i++) + { name[0] = 'x'; name[1] = '0' + (i / 64); name[2] = '0' + (i % 64); name[3] = '\0'; - if(unlink(name) != 0){ + if (unlink(name) != 0) + { printf(1, "bigdir unlink failed"); - exit(); + exit(0); } } printf(1, "bigdir ok\n"); } -void -subdir(void) +void subdir(void) { int fd, cc; printf(1, "subdir test\n"); unlink("ff"); - if(mkdir("dd") != 0){ + if (mkdir("dd") != 0) + { printf(1, "subdir mkdir dd failed\n"); - exit(); + exit(0); } fd = open("dd/ff", O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "create dd/ff failed\n"); - exit(); + exit(0); } write(fd, "ff", 2); close(fd); - if(unlink("dd") >= 0){ + if (unlink("dd") >= 0) + { printf(1, "unlink dd (non-empty dir) succeeded!\n"); - exit(); + exit(0); } - if(mkdir("/dd/dd") != 0){ + if (mkdir("/dd/dd") != 0) + { printf(1, "subdir mkdir dd/dd failed\n"); - exit(); + exit(0); } fd = open("dd/dd/ff", O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "create dd/dd/ff failed\n"); - exit(); + exit(0); } write(fd, "FF", 2); close(fd); fd = open("dd/dd/../ff", 0); - if(fd < 0){ + if (fd < 0) + { printf(1, "open dd/dd/../ff failed\n"); - exit(); + exit(0); } cc = read(fd, buf, sizeof(buf)); - if(cc != 2 || buf[0] != 'f'){ + if (cc != 2 || buf[0] != 'f') + { printf(1, "dd/dd/../ff wrong content\n"); - exit(); + exit(0); } close(fd); - if(link("dd/dd/ff", "dd/dd/ffff") != 0){ + if (link("dd/dd/ff", "dd/dd/ffff") != 0) + { printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); - exit(); + exit(0); } - if(unlink("dd/dd/ff") != 0){ + if (unlink("dd/dd/ff") != 0) + { printf(1, "unlink dd/dd/ff failed\n"); - exit(); + exit(0); } - if(open("dd/dd/ff", O_RDONLY) >= 0){ + if (open("dd/dd/ff", O_RDONLY) >= 0) + { printf(1, "open (unlinked) dd/dd/ff succeeded\n"); - exit(); + exit(0); } - if(chdir("dd") != 0){ + if (chdir("dd") != 0) + { printf(1, "chdir dd failed\n"); - exit(); + exit(0); } - if(chdir("dd/../../dd") != 0){ + if (chdir("dd/../../dd") != 0) + { printf(1, "chdir dd/../../dd failed\n"); - exit(); + exit(0); } - if(chdir("dd/../../../dd") != 0){ + if (chdir("dd/../../../dd") != 0) + { printf(1, "chdir dd/../../dd failed\n"); - exit(); + exit(0); } - if(chdir("./..") != 0){ + if (chdir("./..") != 0) + { printf(1, "chdir ./.. failed\n"); - exit(); + exit(0); } fd = open("dd/dd/ffff", 0); - if(fd < 0){ + if (fd < 0) + { printf(1, "open dd/dd/ffff failed\n"); - exit(); + exit(0); } - if(read(fd, buf, sizeof(buf)) != 2){ + if (read(fd, buf, sizeof(buf)) != 2) + { printf(1, "read dd/dd/ffff wrong len\n"); - exit(); + exit(0); } close(fd); - if(open("dd/dd/ff", O_RDONLY) >= 0){ + if (open("dd/dd/ff", O_RDONLY) >= 0) + { printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); - exit(); + exit(0); } - if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){ + if (open("dd/ff/ff", O_CREATE | O_RDWR) >= 0) + { printf(1, "create dd/ff/ff succeeded!\n"); - exit(); + exit(0); } - if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){ + if (open("dd/xx/ff", O_CREATE | O_RDWR) >= 0) + { printf(1, "create dd/xx/ff succeeded!\n"); - exit(); + exit(0); } - if(open("dd", O_CREATE) >= 0){ + if (open("dd", O_CREATE) >= 0) + { printf(1, "create dd succeeded!\n"); - exit(); + exit(0); } - if(open("dd", O_RDWR) >= 0){ + if (open("dd", O_RDWR) >= 0) + { printf(1, "open dd rdwr succeeded!\n"); - exit(); + exit(0); } - if(open("dd", O_WRONLY) >= 0){ + if (open("dd", O_WRONLY) >= 0) + { printf(1, "open dd wronly succeeded!\n"); - exit(); + exit(0); } - if(link("dd/ff/ff", "dd/dd/xx") == 0){ + if (link("dd/ff/ff", "dd/dd/xx") == 0) + { printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); - exit(); + exit(0); } - if(link("dd/xx/ff", "dd/dd/xx") == 0){ + if (link("dd/xx/ff", "dd/dd/xx") == 0) + { printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); - exit(); + exit(0); } - if(link("dd/ff", "dd/dd/ffff") == 0){ + if (link("dd/ff", "dd/dd/ffff") == 0) + { printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); - exit(); + exit(0); } - if(mkdir("dd/ff/ff") == 0){ + if (mkdir("dd/ff/ff") == 0) + { printf(1, "mkdir dd/ff/ff succeeded!\n"); - exit(); + exit(0); } - if(mkdir("dd/xx/ff") == 0){ + if (mkdir("dd/xx/ff") == 0) + { printf(1, "mkdir dd/xx/ff succeeded!\n"); - exit(); + exit(0); } - if(mkdir("dd/dd/ffff") == 0){ + if (mkdir("dd/dd/ffff") == 0) + { printf(1, "mkdir dd/dd/ffff succeeded!\n"); - exit(); + exit(0); } - if(unlink("dd/xx/ff") == 0){ + if (unlink("dd/xx/ff") == 0) + { printf(1, "unlink dd/xx/ff succeeded!\n"); - exit(); + exit(0); } - if(unlink("dd/ff/ff") == 0){ + if (unlink("dd/ff/ff") == 0) + { printf(1, "unlink dd/ff/ff succeeded!\n"); - exit(); + exit(0); } - if(chdir("dd/ff") == 0){ + if (chdir("dd/ff") == 0) + { printf(1, "chdir dd/ff succeeded!\n"); - exit(); + exit(0); } - if(chdir("dd/xx") == 0){ + if (chdir("dd/xx") == 0) + { printf(1, "chdir dd/xx succeeded!\n"); - exit(); + exit(0); } - if(unlink("dd/dd/ffff") != 0){ + if (unlink("dd/dd/ffff") != 0) + { printf(1, "unlink dd/dd/ff failed\n"); - exit(); + exit(0); } - if(unlink("dd/ff") != 0){ + if (unlink("dd/ff") != 0) + { printf(1, "unlink dd/ff failed\n"); - exit(); + exit(0); } - if(unlink("dd") == 0){ + if (unlink("dd") == 0) + { printf(1, "unlink non-empty dd succeeded!\n"); - exit(); + exit(0); } - if(unlink("dd/dd") < 0){ + if (unlink("dd/dd") < 0) + { printf(1, "unlink dd/dd failed\n"); - exit(); + exit(0); } - if(unlink("dd") < 0){ + if (unlink("dd") < 0) + { printf(1, "unlink dd failed\n"); - exit(); + exit(0); } printf(1, "subdir ok\n"); } // test writes that are larger than the log. -void -bigwrite(void) +void bigwrite(void) { int fd, sz; printf(1, "bigwrite test\n"); unlink("bigwrite"); - for(sz = 499; sz < 12*512; sz += 471){ + for (sz = 499; sz < 12 * 512; sz += 471) + { fd = open("bigwrite", O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "cannot create bigwrite\n"); - exit(); + exit(0); } int i; - for(i = 0; i < 2; i++){ + for (i = 0; i < 2; i++) + { int cc = write(fd, buf, sz); - if(cc != sz){ + if (cc != sz) + { printf(1, "write(%d) ret %d\n", sz, cc); - exit(); + exit(0); } } close(fd); @@ -1144,8 +1333,7 @@ bigwrite(void) printf(1, "bigwrite ok\n"); } -void -bigfile(void) +void bigfile(void) { int fd, i, total, cc; @@ -1153,186 +1341,216 @@ bigfile(void) unlink("bigfile"); fd = open("bigfile", O_CREATE | O_RDWR); - if(fd < 0){ + if (fd < 0) + { printf(1, "cannot create bigfile"); - exit(); + exit(0); } - for(i = 0; i < 20; i++){ + for (i = 0; i < 20; i++) + { memset(buf, i, 600); - if(write(fd, buf, 600) != 600){ + if (write(fd, buf, 600) != 600) + { printf(1, "write bigfile failed\n"); - exit(); + exit(0); } } close(fd); fd = open("bigfile", 0); - if(fd < 0){ + if (fd < 0) + { printf(1, "cannot open bigfile\n"); - exit(); + exit(0); } total = 0; - for(i = 0; ; i++){ + for (i = 0;; i++) + { cc = read(fd, buf, 300); - if(cc < 0){ + if (cc < 0) + { printf(1, "read bigfile failed\n"); - exit(); + exit(0); } - if(cc == 0) + if (cc == 0) break; - if(cc != 300){ + if (cc != 300) + { printf(1, "short read bigfile\n"); - exit(); + exit(0); } - if(buf[0] != i/2 || buf[299] != i/2){ + if (buf[0] != i / 2 || buf[299] != i / 2) + { printf(1, "read bigfile wrong data\n"); - exit(); + exit(0); } total += cc; } close(fd); - if(total != 20*600){ + if (total != 20 * 600) + { printf(1, "read bigfile wrong total\n"); - exit(); + exit(0); } unlink("bigfile"); printf(1, "bigfile test ok\n"); } -void -fourteen(void) +void fourteen(void) { int fd; // DIRSIZ is 14. printf(1, "fourteen test\n"); - if(mkdir("12345678901234") != 0){ + if (mkdir("12345678901234") != 0) + { printf(1, "mkdir 12345678901234 failed\n"); - exit(); + exit(0); } - if(mkdir("12345678901234/123456789012345") != 0){ + if (mkdir("12345678901234/123456789012345") != 0) + { printf(1, "mkdir 12345678901234/123456789012345 failed\n"); - exit(); + exit(0); } fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); - if(fd < 0){ + if (fd < 0) + { printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); - exit(); + exit(0); } close(fd); fd = open("12345678901234/12345678901234/12345678901234", 0); - if(fd < 0){ + if (fd < 0) + { printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); - exit(); + exit(0); } close(fd); - if(mkdir("12345678901234/12345678901234") == 0){ + if (mkdir("12345678901234/12345678901234") == 0) + { printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); - exit(); + exit(0); } - if(mkdir("123456789012345/12345678901234") == 0){ + if (mkdir("123456789012345/12345678901234") == 0) + { printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); - exit(); + exit(0); } printf(1, "fourteen ok\n"); } -void -rmdot(void) +void rmdot(void) { printf(1, "rmdot test\n"); - if(mkdir("dots") != 0){ + if (mkdir("dots") != 0) + { printf(1, "mkdir dots failed\n"); - exit(); + exit(0); } - if(chdir("dots") != 0){ + if (chdir("dots") != 0) + { printf(1, "chdir dots failed\n"); - exit(); + exit(0); } - if(unlink(".") == 0){ + if (unlink(".") == 0) + { printf(1, "rm . worked!\n"); - exit(); + exit(0); } - if(unlink("..") == 0){ + if (unlink("..") == 0) + { printf(1, "rm .. worked!\n"); - exit(); + exit(0); } - if(chdir("/") != 0){ + if (chdir("/") != 0) + { printf(1, "chdir / failed\n"); - exit(); + exit(0); } - if(unlink("dots/.") == 0){ + if (unlink("dots/.") == 0) + { printf(1, "unlink dots/. worked!\n"); - exit(); + exit(0); } - if(unlink("dots/..") == 0){ + if (unlink("dots/..") == 0) + { printf(1, "unlink dots/.. worked!\n"); - exit(); + exit(0); } - if(unlink("dots") != 0){ + if (unlink("dots") != 0) + { printf(1, "unlink dots failed!\n"); - exit(); + exit(0); } printf(1, "rmdot ok\n"); } -void -dirfile(void) +void dirfile(void) { int fd; printf(1, "dir vs file\n"); fd = open("dirfile", O_CREATE); - if(fd < 0){ + if (fd < 0) + { printf(1, "create dirfile failed\n"); - exit(); + exit(0); } close(fd); - if(chdir("dirfile") == 0){ + if (chdir("dirfile") == 0) + { printf(1, "chdir dirfile succeeded!\n"); - exit(); + exit(0); } fd = open("dirfile/xx", 0); - if(fd >= 0){ + if (fd >= 0) + { printf(1, "create dirfile/xx succeeded!\n"); - exit(); + exit(0); } fd = open("dirfile/xx", O_CREATE); - if(fd >= 0){ + if (fd >= 0) + { printf(1, "create dirfile/xx succeeded!\n"); - exit(); + exit(0); } - if(mkdir("dirfile/xx") == 0){ + if (mkdir("dirfile/xx") == 0) + { printf(1, "mkdir dirfile/xx succeeded!\n"); - exit(); + exit(0); } - if(unlink("dirfile/xx") == 0){ + if (unlink("dirfile/xx") == 0) + { printf(1, "unlink dirfile/xx succeeded!\n"); - exit(); + exit(0); } - if(link("README", "dirfile/xx") == 0){ + if (link("README", "dirfile/xx") == 0) + { printf(1, "link to dirfile/xx succeeded!\n"); - exit(); + exit(0); } - if(unlink("dirfile") != 0){ + if (unlink("dirfile") != 0) + { printf(1, "unlink dirfile failed!\n"); - exit(); + exit(0); } fd = open(".", O_RDWR); - if(fd >= 0){ + if (fd >= 0) + { printf(1, "open . for writing succeeded!\n"); - exit(); + exit(0); } fd = open(".", 0); - if(write(fd, "x", 1) > 0){ + if (write(fd, "x", 1) > 0) + { printf(1, "write . succeeded!\n"); - exit(); + exit(0); } close(fd); @@ -1340,31 +1558,33 @@ dirfile(void) } // test that iput() is called at the end of _namei() -void -iref(void) +void iref(void) { int i, fd; printf(1, "empty file name\n"); // the 50 is NINODE - for(i = 0; i < 50 + 1; i++){ - if(mkdir("irefd") != 0){ + for (i = 0; i < 50 + 1; i++) + { + if (mkdir("irefd") != 0) + { printf(1, "mkdir irefd failed\n"); - exit(); + exit(0); } - if(chdir("irefd") != 0){ + if (chdir("irefd") != 0) + { printf(1, "chdir irefd failed\n"); - exit(); + exit(0); } mkdir(""); link("README", ""); fd = open("", O_CREATE); - if(fd >= 0) + if (fd >= 0) close(fd); fd = open("xx", O_CREATE); - if(fd >= 0) + if (fd >= 0) close(fd); unlink("xx"); } @@ -1376,43 +1596,46 @@ iref(void) // test that fork fails gracefully // the forktest binary also does this, but it runs out of proc entries first. // inside the bigger usertests binary, we run out of memory first. -void -forktest(void) +void forktest(void) { int n, pid; printf(1, "fork test\n"); - for(n=0; n<1000; n++){ + for (n = 0; n < 1000; n++) + { pid = fork(); - if(pid < 0) + if (pid < 0) break; - if(pid == 0) - exit(); + if (pid == 0) + exit(0); } - if(n == 1000){ + if (n == 1000) + { printf(1, "fork claimed to work 1000 times!\n"); - exit(); + exit(0); } - for(; n > 0; n--){ - if(wait() < 0){ + for (; n > 0; n--) + { + if (wait(0) < 0) + { printf(1, "wait stopped early\n"); - exit(); + exit(0); } } - if(wait() != -1){ + if (wait(0) != -1) + { printf(1, "wait got too many\n"); - exit(); + exit(0); } printf(1, "fork test OK\n"); } -void -sbrktest(void) +void sbrktest(void) { int fds[2], pid, pids[10], ppid; char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; @@ -1424,165 +1647,189 @@ sbrktest(void) // can one sbrk() less than a page? a = sbrk(0); int i; - for(i = 0; i < 5000; i++){ + for (i = 0; i < 5000; i++) + { b = sbrk(1); - if(b != a){ + if (b != a) + { printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); - exit(); + exit(0); } *b = 1; a = b + 1; } pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(stdout, "sbrk test fork failed\n"); - exit(); + exit(0); } c = sbrk(1); c = sbrk(1); - if(c != a + 1){ + if (c != a + 1) + { printf(stdout, "sbrk test failed post-fork\n"); - exit(); + exit(0); } - if(pid == 0) - exit(); - wait(); + if (pid == 0) + exit(0); + wait(0); + ; // can one grow address space to something big? -#define BIG (100*1024*1024) +#define BIG (100 * 1024 * 1024) a = sbrk(0); amt = (BIG) - (uint)a; p = sbrk(amt); - if (p != a) { + if (p != a) + { printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); - exit(); + exit(0); } - lastaddr = (char*) (BIG-1); + lastaddr = (char *)(BIG - 1); *lastaddr = 99; // can one de-allocate? a = sbrk(0); c = sbrk(-4096); - if(c == (char*)0xffffffff){ + if (c == (char *)0xffffffff) + { printf(stdout, "sbrk could not deallocate\n"); - exit(); + exit(0); } c = sbrk(0); - if(c != a - 4096){ + if (c != a - 4096) + { printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); - exit(); + exit(0); } // can one re-allocate that page? a = sbrk(0); c = sbrk(4096); - if(c != a || sbrk(0) != a + 4096){ + if (c != a || sbrk(0) != a + 4096) + { printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); - exit(); + exit(0); } - if(*lastaddr == 99){ + if (*lastaddr == 99) + { // should be zero printf(stdout, "sbrk de-allocation didn't really deallocate\n"); - exit(); + exit(0); } a = sbrk(0); c = sbrk(-(sbrk(0) - oldbrk)); - if(c != a){ + if (c != a) + { printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); - exit(); + exit(0); } // can we read the kernel's memory? - for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){ + for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) + { ppid = getpid(); pid = fork(); - if(pid < 0){ + if (pid < 0) + { printf(stdout, "fork failed\n"); - exit(); + exit(0); } - if(pid == 0){ + if (pid == 0) + { printf(stdout, "oops could read %x = %x\n", a, *a); kill(ppid); - exit(); + exit(0); } - wait(); + wait(0); + ; } // if we run the system out of memory, does it clean up the last // failed allocation? - if(pipe(fds) != 0){ + if (pipe(fds) != 0) + { printf(1, "pipe() failed\n"); - exit(); + exit(0); } - for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ - if((pids[i] = fork()) == 0){ + for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) + { + if ((pids[i] = fork()) == 0) + { // allocate a lot of memory sbrk(BIG - (uint)sbrk(0)); write(fds[1], "x", 1); // sit around until killed - for(;;) sleep(1000); + for (;;) + sleep(1000); } - if(pids[i] != -1) + if (pids[i] != -1) read(fds[0], &scratch, 1); } // if those failed allocations freed up the pages they did allocate, // we'll be able to allocate here c = sbrk(4096); - for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ - if(pids[i] == -1) + for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) + { + if (pids[i] == -1) continue; kill(pids[i]); - wait(); + wait(0); + ; } - if(c == (char*)0xffffffff){ + if (c == (char *)0xffffffff) + { printf(stdout, "failed sbrk leaked memory\n"); - exit(); + exit(0); } - if(sbrk(0) > oldbrk) + if (sbrk(0) > oldbrk) sbrk(-(sbrk(0) - oldbrk)); printf(stdout, "sbrk test OK\n"); } -void -validateint(int *p) +void validateint(int *p) { int res; asm("mov %%esp, %%ebx\n\t" "mov %3, %%esp\n\t" "int %2\n\t" - "mov %%ebx, %%esp" : - "=a" (res) : - "a" (SYS_sleep), "n" (T_SYSCALL), "c" (p) : - "ebx"); + "mov %%ebx, %%esp" + : "=a"(res) + : "a"(SYS_sleep), "n"(T_SYSCALL), "c"(p) + : "ebx"); } -void -validatetest(void) +void validatetest(void) { int hi, pid; uint p; printf(stdout, "validate test\n"); - hi = 1100*1024; + hi = 1100 * 1024; - for(p = 0; p <= (uint)hi; p += 4096){ - if((pid = fork()) == 0){ + for (p = 0; p <= (uint)hi; p += 4096) + { + if ((pid = fork()) == 0) + { // try to crash the kernel by passing in a badly placed integer - validateint((int*)p); - exit(); + validateint((int *)p); + exit(0); } sleep(0); sleep(0); kill(pid); - wait(); + wait(0); + ; // try to crash the kernel by passing in a bad string pointer - if(link("nosuchfile", (char*)p) != -1){ + if (link("nosuchfile", (char *)p) != -1) + { printf(stdout, "link should not succeed\n"); - exit(); + exit(0); } } @@ -1591,16 +1838,17 @@ validatetest(void) // does unintialized data start out zero? char uninit[10000]; -void -bsstest(void) +void bsstest(void) { int i; printf(stdout, "bss test\n"); - for(i = 0; i < sizeof(uninit); i++){ - if(uninit[i] != '\0'){ + for (i = 0; i < sizeof(uninit); i++) + { + if (uninit[i] != '\0') + { printf(stdout, "bss test failed\n"); - exit(); + exit(0); } } printf(stdout, "bss test ok\n"); @@ -1609,34 +1857,38 @@ bsstest(void) // does exec return an error if the arguments // are larger than a page? or does it write // below the stack and wreck the instructions/data? -void -bigargtest(void) +void bigargtest(void) { int pid, fd; unlink("bigarg-ok"); pid = fork(); - if(pid == 0){ + if (pid == 0) + { static char *args[MAXARG]; int i; - for(i = 0; i < MAXARG-1; i++) + for (i = 0; i < MAXARG - 1; i++) args[i] = "bigargs test: failed\n "; - args[MAXARG-1] = 0; + args[MAXARG - 1] = 0; printf(stdout, "bigarg test\n"); exec("echo", args); printf(stdout, "bigarg test ok\n"); fd = open("bigarg-ok", O_CREATE); close(fd); - exit(); - } else if(pid < 0){ + exit(0); + } + else if (pid < 0) + { printf(stdout, "bigargtest: fork failed\n"); - exit(); + exit(0); } - wait(); + wait(0); + ; fd = open("bigarg-ok", 0); - if(fd < 0){ + if (fd < 0) + { printf(stdout, "bigarg test failed!\n"); - exit(); + exit(0); } close(fd); unlink("bigarg-ok"); @@ -1644,15 +1896,15 @@ bigargtest(void) // what happens when the file system runs out of blocks? // answer: balloc panics, so this test is not useful. -void -fsfull() +void fsfull() { int nfiles; int fsblocks = 0; printf(1, "fsfull test\n"); - for(nfiles = 0; ; nfiles++){ + for (nfiles = 0;; nfiles++) + { char name[64]; name[0] = 'f'; name[1] = '0' + nfiles / 1000; @@ -1661,26 +1913,29 @@ fsfull() name[4] = '0' + (nfiles % 10); name[5] = '\0'; printf(1, "writing %s\n", name); - int fd = open(name, O_CREATE|O_RDWR); - if(fd < 0){ + int fd = open(name, O_CREATE | O_RDWR); + if (fd < 0) + { printf(1, "open %s failed\n", name); break; } int total = 0; - while(1){ + while (1) + { int cc = write(fd, buf, 512); - if(cc < 512) + if (cc < 512) break; total += cc; fsblocks++; } printf(1, "wrote %d bytes\n", total); close(fd); - if(total == 0) + if (total == 0) break; } - while(nfiles >= 0){ + while (nfiles >= 0) + { char name[64]; name[0] = 'f'; name[1] = '0' + nfiles / 1000; @@ -1695,11 +1950,10 @@ fsfull() printf(1, "fsfull test finished\n"); } -void -uio() +void uio() { - #define RTC_ADDR 0x70 - #define RTC_DATA 0x71 +#define RTC_ADDR 0x70 +#define RTC_DATA 0x71 ushort port = 0; uchar val = 0; @@ -1707,20 +1961,26 @@ uio() printf(1, "uio test\n"); pid = fork(); - if(pid == 0){ + if (pid == 0) + { port = RTC_ADDR; - val = 0x09; /* year */ + val = 0x09; /* year */ /* http://wiki.osdev.org/Inline_Assembly/Examples */ - asm volatile("outb %0,%1"::"a"(val), "d" (port)); + asm volatile("outb %0,%1" ::"a"(val), "d"(port)); port = RTC_DATA; - asm volatile("inb %1,%0" : "=a" (val) : "d" (port)); + asm volatile("inb %1,%0" + : "=a"(val) + : "d"(port)); printf(1, "uio: uio succeeded; test FAILED\n"); - exit(); - } else if(pid < 0){ - printf (1, "fork failed\n"); - exit(); + exit(0); + } + else if (pid < 0) + { + printf(1, "fork failed\n"); + exit(0); } - wait(); + wait(0); + ; printf(1, "uio test done\n"); } @@ -1728,9 +1988,10 @@ void argptest() { int fd; fd = open("init", O_RDONLY); - if (fd < 0) { + if (fd < 0) + { printf(2, "open failed\n"); - exit(); + exit(0); } read(fd, sbrk(0) - 1, -1); close(fd); @@ -1745,14 +2006,14 @@ rand() return randstate; } -int -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { printf(1, "usertests starting\n"); - if(open("usertests.ran", 0) >= 0){ + if (open("usertests.ran", 0) >= 0) + { printf(1, "already ran user tests -- rebuild fs.img\n"); - exit(); + exit(0); } close(open("usertests.ran", O_CREATE)); @@ -1783,6 +2044,7 @@ main(int argc, char *argv[]) pipe1(); preempt(); exitwait(); + ; rmdot(); fourteen(); @@ -1799,5 +2061,5 @@ main(int argc, char *argv[]) exectest(); - exit(); + exit(0); } diff --git a/usertests.d b/usertests.d new file mode 100644 index 0000000000..a4933d35c3 --- /dev/null +++ b/usertests.d @@ -0,0 +1,2 @@ +usertests.o: usertests.c /usr/include/stdc-predef.h param.h types.h \ + stat.h user.h fs.h fcntl.h syscall.h traps.h memlayout.h diff --git a/usertests.o b/usertests.o new file mode 100644 index 0000000000..be0b0c915c Binary files /dev/null and b/usertests.o differ diff --git a/usertests.sym b/usertests.sym new file mode 100644 index 0000000000..5ba9e9e56b --- /dev/null +++ b/usertests.sym @@ -0,0 +1,103 @@ +00000000 .text +00004418 .rodata +00005bc8 .eh_frame +00006490 .data +000064c0 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 usertests.c +000064c0 args.1718 +00000000 ulib.c +00000000 printf.c +00004010 printint +00005bb7 digits.1354 +00000000 umalloc.c +00006540 freep +00006544 base +00003d40 strcpy +00000d10 exitwait +000040b0 printf +00006494 stdout +000038d0 bigargtest +00003f30 memmove +000002e0 openiputtest +00003faa mknod +00003e50 gets +00003fe2 getpid +000009c0 pipe1 +00003140 iref +00004330 malloc +00003ff2 sleep +00000200 exitiputtest +000039f0 fsfull +00001e50 bigdir +00003270 forktest +00000630 writetest1 +00002830 bigwrite +00000e80 sharedfd +00006490 randstate +00003f72 pipe +00006560 uninit +00002ec0 dirfile +00003f82 write +00003850 bsstest +00006498 echoargv +00003fba fstat +00003f92 kill +00003790 validatetest +00002cf0 rmdot +00003fd2 chdir +00000960 exectest +00003f9a exec +00003f6a wait +00003d20 rand +00003f7a read +00000ba0 preempt +00003fb2 unlink +00003c90 argptest +00000da0 mem +00003f5a fork +00003fea sbrk +00003ffa uptime +000064ac __bss_start +00003df0 memset +000007f0 createtest +00000000 main +000012d0 createdelete +00003d70 strcmp +00000460 writetest +00003fda dup +00003360 sbrktest +000003c0 opentest +00001fb0 subdir +00003bf0 uio +00001740 linktest +00008c80 buf +000008a0 dirtest +00000140 iputtest +00003eb0 stat +00002940 bigfile +000064ac _edata +0000ac84 _end +00001540 unlinkread +00003fc2 link +00003f62 exit +00003f00 atoi +00001d30 linkunlink +0000ac80 name +00003dc0 strlen +00003fa2 open +00003e10 strchr +000019e0 concreate +00002b70 fourteen +00003780 validateint +00001070 fourfiles +00003fca mkdir +00003f8a close +000042a0 free diff --git a/usys.o b/usys.o new file mode 100644 index 0000000000..6140b2e74b Binary files /dev/null and b/usys.o differ diff --git a/vectors.S b/vectors.S new file mode 100644 index 0000000000..9e4041abba --- /dev/null +++ b/vectors.S @@ -0,0 +1,1537 @@ +# generated by vectors.pl - do not edit +# handlers +.globl alltraps +.globl vector0 +vector0: + pushl $0 + pushl $0 + jmp alltraps +.globl vector1 +vector1: + pushl $0 + pushl $1 + jmp alltraps +.globl vector2 +vector2: + pushl $0 + pushl $2 + jmp alltraps +.globl vector3 +vector3: + pushl $0 + pushl $3 + jmp alltraps +.globl vector4 +vector4: + pushl $0 + pushl $4 + jmp alltraps +.globl vector5 +vector5: + pushl $0 + pushl $5 + jmp alltraps +.globl vector6 +vector6: + pushl $0 + pushl $6 + jmp alltraps +.globl vector7 +vector7: + pushl $0 + pushl $7 + jmp alltraps +.globl vector8 +vector8: + pushl $8 + jmp alltraps +.globl vector9 +vector9: + pushl $0 + pushl $9 + jmp alltraps +.globl vector10 +vector10: + pushl $10 + jmp alltraps +.globl vector11 +vector11: + pushl $11 + jmp alltraps +.globl vector12 +vector12: + pushl $12 + jmp alltraps +.globl vector13 +vector13: + pushl $13 + jmp alltraps +.globl vector14 +vector14: + pushl $14 + jmp alltraps +.globl vector15 +vector15: + pushl $0 + pushl $15 + jmp alltraps +.globl vector16 +vector16: + pushl $0 + pushl $16 + jmp alltraps +.globl vector17 +vector17: + pushl $17 + jmp alltraps +.globl vector18 +vector18: + pushl $0 + pushl $18 + jmp alltraps +.globl vector19 +vector19: + pushl $0 + pushl $19 + jmp alltraps +.globl vector20 +vector20: + pushl $0 + pushl $20 + jmp alltraps +.globl vector21 +vector21: + pushl $0 + pushl $21 + jmp alltraps +.globl vector22 +vector22: + pushl $0 + pushl $22 + jmp alltraps +.globl vector23 +vector23: + pushl $0 + pushl $23 + jmp alltraps +.globl vector24 +vector24: + pushl $0 + pushl $24 + jmp alltraps +.globl vector25 +vector25: + pushl $0 + pushl $25 + jmp alltraps +.globl vector26 +vector26: + pushl $0 + pushl $26 + jmp alltraps +.globl vector27 +vector27: + pushl $0 + pushl $27 + jmp alltraps +.globl vector28 +vector28: + pushl $0 + pushl $28 + jmp alltraps +.globl vector29 +vector29: + pushl $0 + pushl $29 + jmp alltraps +.globl vector30 +vector30: + pushl $0 + pushl $30 + jmp alltraps +.globl vector31 +vector31: + pushl $0 + pushl $31 + jmp alltraps +.globl vector32 +vector32: + pushl $0 + pushl $32 + jmp alltraps +.globl vector33 +vector33: + pushl $0 + pushl $33 + jmp alltraps +.globl vector34 +vector34: + pushl $0 + pushl $34 + jmp alltraps +.globl vector35 +vector35: + pushl $0 + pushl $35 + jmp alltraps +.globl vector36 +vector36: + pushl $0 + pushl $36 + jmp alltraps +.globl vector37 +vector37: + pushl $0 + pushl $37 + jmp alltraps +.globl vector38 +vector38: + pushl $0 + pushl $38 + jmp alltraps +.globl vector39 +vector39: + pushl $0 + pushl $39 + jmp alltraps +.globl vector40 +vector40: + pushl $0 + pushl $40 + jmp alltraps +.globl vector41 +vector41: + pushl $0 + pushl $41 + jmp alltraps +.globl vector42 +vector42: + pushl $0 + pushl $42 + jmp alltraps +.globl vector43 +vector43: + pushl $0 + pushl $43 + jmp alltraps +.globl vector44 +vector44: + pushl $0 + pushl $44 + jmp alltraps +.globl vector45 +vector45: + pushl $0 + pushl $45 + jmp alltraps +.globl vector46 +vector46: + pushl $0 + pushl $46 + jmp alltraps +.globl vector47 +vector47: + pushl $0 + pushl $47 + jmp alltraps +.globl vector48 +vector48: + pushl $0 + pushl $48 + jmp alltraps +.globl vector49 +vector49: + pushl $0 + pushl $49 + jmp alltraps +.globl vector50 +vector50: + pushl $0 + pushl $50 + jmp alltraps +.globl vector51 +vector51: + pushl $0 + pushl $51 + jmp alltraps +.globl vector52 +vector52: + pushl $0 + pushl $52 + jmp alltraps +.globl vector53 +vector53: + pushl $0 + pushl $53 + jmp alltraps +.globl vector54 +vector54: + pushl $0 + pushl $54 + jmp alltraps +.globl vector55 +vector55: + pushl $0 + pushl $55 + jmp alltraps +.globl vector56 +vector56: + pushl $0 + pushl $56 + jmp alltraps +.globl vector57 +vector57: + pushl $0 + pushl $57 + jmp alltraps +.globl vector58 +vector58: + pushl $0 + pushl $58 + jmp alltraps +.globl vector59 +vector59: + pushl $0 + pushl $59 + jmp alltraps +.globl vector60 +vector60: + pushl $0 + pushl $60 + jmp alltraps +.globl vector61 +vector61: + pushl $0 + pushl $61 + jmp alltraps +.globl vector62 +vector62: + pushl $0 + pushl $62 + jmp alltraps +.globl vector63 +vector63: + pushl $0 + pushl $63 + jmp alltraps +.globl vector64 +vector64: + pushl $0 + pushl $64 + jmp alltraps +.globl vector65 +vector65: + pushl $0 + pushl $65 + jmp alltraps +.globl vector66 +vector66: + pushl $0 + pushl $66 + jmp alltraps +.globl vector67 +vector67: + pushl $0 + pushl $67 + jmp alltraps +.globl vector68 +vector68: + pushl $0 + pushl $68 + jmp alltraps +.globl vector69 +vector69: + pushl $0 + pushl $69 + jmp alltraps +.globl vector70 +vector70: + pushl $0 + pushl $70 + jmp alltraps +.globl vector71 +vector71: + pushl $0 + pushl $71 + jmp alltraps +.globl vector72 +vector72: + pushl $0 + pushl $72 + jmp alltraps +.globl vector73 +vector73: + pushl $0 + pushl $73 + jmp alltraps +.globl vector74 +vector74: + pushl $0 + pushl $74 + jmp alltraps +.globl vector75 +vector75: + pushl $0 + pushl $75 + jmp alltraps +.globl vector76 +vector76: + pushl $0 + pushl $76 + jmp alltraps +.globl vector77 +vector77: + pushl $0 + pushl $77 + jmp alltraps +.globl vector78 +vector78: + pushl $0 + pushl $78 + jmp alltraps +.globl vector79 +vector79: + pushl $0 + pushl $79 + jmp alltraps +.globl vector80 +vector80: + pushl $0 + pushl $80 + jmp alltraps +.globl vector81 +vector81: + pushl $0 + pushl $81 + jmp alltraps +.globl vector82 +vector82: + pushl $0 + pushl $82 + jmp alltraps +.globl vector83 +vector83: + pushl $0 + pushl $83 + jmp alltraps +.globl vector84 +vector84: + pushl $0 + pushl $84 + jmp alltraps +.globl vector85 +vector85: + pushl $0 + pushl $85 + jmp alltraps +.globl vector86 +vector86: + pushl $0 + pushl $86 + jmp alltraps +.globl vector87 +vector87: + pushl $0 + pushl $87 + jmp alltraps +.globl vector88 +vector88: + pushl $0 + pushl $88 + jmp alltraps +.globl vector89 +vector89: + pushl $0 + pushl $89 + jmp alltraps +.globl vector90 +vector90: + pushl $0 + pushl $90 + jmp alltraps +.globl vector91 +vector91: + pushl $0 + pushl $91 + jmp alltraps +.globl vector92 +vector92: + pushl $0 + pushl $92 + jmp alltraps +.globl vector93 +vector93: + pushl $0 + pushl $93 + jmp alltraps +.globl vector94 +vector94: + pushl $0 + pushl $94 + jmp alltraps +.globl vector95 +vector95: + pushl $0 + pushl $95 + jmp alltraps +.globl vector96 +vector96: + pushl $0 + pushl $96 + jmp alltraps +.globl vector97 +vector97: + pushl $0 + pushl $97 + jmp alltraps +.globl vector98 +vector98: + pushl $0 + pushl $98 + jmp alltraps +.globl vector99 +vector99: + pushl $0 + pushl $99 + jmp alltraps +.globl vector100 +vector100: + pushl $0 + pushl $100 + jmp alltraps +.globl vector101 +vector101: + pushl $0 + pushl $101 + jmp alltraps +.globl vector102 +vector102: + pushl $0 + pushl $102 + jmp alltraps +.globl vector103 +vector103: + pushl $0 + pushl $103 + jmp alltraps +.globl vector104 +vector104: + pushl $0 + pushl $104 + jmp alltraps +.globl vector105 +vector105: + pushl $0 + pushl $105 + jmp alltraps +.globl vector106 +vector106: + pushl $0 + pushl $106 + jmp alltraps +.globl vector107 +vector107: + pushl $0 + pushl $107 + jmp alltraps +.globl vector108 +vector108: + pushl $0 + pushl $108 + jmp alltraps +.globl vector109 +vector109: + pushl $0 + pushl $109 + jmp alltraps +.globl vector110 +vector110: + pushl $0 + pushl $110 + jmp alltraps +.globl vector111 +vector111: + pushl $0 + pushl $111 + jmp alltraps +.globl vector112 +vector112: + pushl $0 + pushl $112 + jmp alltraps +.globl vector113 +vector113: + pushl $0 + pushl $113 + jmp alltraps +.globl vector114 +vector114: + pushl $0 + pushl $114 + jmp alltraps +.globl vector115 +vector115: + pushl $0 + pushl $115 + jmp alltraps +.globl vector116 +vector116: + pushl $0 + pushl $116 + jmp alltraps +.globl vector117 +vector117: + pushl $0 + pushl $117 + jmp alltraps +.globl vector118 +vector118: + pushl $0 + pushl $118 + jmp alltraps +.globl vector119 +vector119: + pushl $0 + pushl $119 + jmp alltraps +.globl vector120 +vector120: + pushl $0 + pushl $120 + jmp alltraps +.globl vector121 +vector121: + pushl $0 + pushl $121 + jmp alltraps +.globl vector122 +vector122: + pushl $0 + pushl $122 + jmp alltraps +.globl vector123 +vector123: + pushl $0 + pushl $123 + jmp alltraps +.globl vector124 +vector124: + pushl $0 + pushl $124 + jmp alltraps +.globl vector125 +vector125: + pushl $0 + pushl $125 + jmp alltraps +.globl vector126 +vector126: + pushl $0 + pushl $126 + jmp alltraps +.globl vector127 +vector127: + pushl $0 + pushl $127 + jmp alltraps +.globl vector128 +vector128: + pushl $0 + pushl $128 + jmp alltraps +.globl vector129 +vector129: + pushl $0 + pushl $129 + jmp alltraps +.globl vector130 +vector130: + pushl $0 + pushl $130 + jmp alltraps +.globl vector131 +vector131: + pushl $0 + pushl $131 + jmp alltraps +.globl vector132 +vector132: + pushl $0 + pushl $132 + jmp alltraps +.globl vector133 +vector133: + pushl $0 + pushl $133 + jmp alltraps +.globl vector134 +vector134: + pushl $0 + pushl $134 + jmp alltraps +.globl vector135 +vector135: + pushl $0 + pushl $135 + jmp alltraps +.globl vector136 +vector136: + pushl $0 + pushl $136 + jmp alltraps +.globl vector137 +vector137: + pushl $0 + pushl $137 + jmp alltraps +.globl vector138 +vector138: + pushl $0 + pushl $138 + jmp alltraps +.globl vector139 +vector139: + pushl $0 + pushl $139 + jmp alltraps +.globl vector140 +vector140: + pushl $0 + pushl $140 + jmp alltraps +.globl vector141 +vector141: + pushl $0 + pushl $141 + jmp alltraps +.globl vector142 +vector142: + pushl $0 + pushl $142 + jmp alltraps +.globl vector143 +vector143: + pushl $0 + pushl $143 + jmp alltraps +.globl vector144 +vector144: + pushl $0 + pushl $144 + jmp alltraps +.globl vector145 +vector145: + pushl $0 + pushl $145 + jmp alltraps +.globl vector146 +vector146: + pushl $0 + pushl $146 + jmp alltraps +.globl vector147 +vector147: + pushl $0 + pushl $147 + jmp alltraps +.globl vector148 +vector148: + pushl $0 + pushl $148 + jmp alltraps +.globl vector149 +vector149: + pushl $0 + pushl $149 + jmp alltraps +.globl vector150 +vector150: + pushl $0 + pushl $150 + jmp alltraps +.globl vector151 +vector151: + pushl $0 + pushl $151 + jmp alltraps +.globl vector152 +vector152: + pushl $0 + pushl $152 + jmp alltraps +.globl vector153 +vector153: + pushl $0 + pushl $153 + jmp alltraps +.globl vector154 +vector154: + pushl $0 + pushl $154 + jmp alltraps +.globl vector155 +vector155: + pushl $0 + pushl $155 + jmp alltraps +.globl vector156 +vector156: + pushl $0 + pushl $156 + jmp alltraps +.globl vector157 +vector157: + pushl $0 + pushl $157 + jmp alltraps +.globl vector158 +vector158: + pushl $0 + pushl $158 + jmp alltraps +.globl vector159 +vector159: + pushl $0 + pushl $159 + jmp alltraps +.globl vector160 +vector160: + pushl $0 + pushl $160 + jmp alltraps +.globl vector161 +vector161: + pushl $0 + pushl $161 + jmp alltraps +.globl vector162 +vector162: + pushl $0 + pushl $162 + jmp alltraps +.globl vector163 +vector163: + pushl $0 + pushl $163 + jmp alltraps +.globl vector164 +vector164: + pushl $0 + pushl $164 + jmp alltraps +.globl vector165 +vector165: + pushl $0 + pushl $165 + jmp alltraps +.globl vector166 +vector166: + pushl $0 + pushl $166 + jmp alltraps +.globl vector167 +vector167: + pushl $0 + pushl $167 + jmp alltraps +.globl vector168 +vector168: + pushl $0 + pushl $168 + jmp alltraps +.globl vector169 +vector169: + pushl $0 + pushl $169 + jmp alltraps +.globl vector170 +vector170: + pushl $0 + pushl $170 + jmp alltraps +.globl vector171 +vector171: + pushl $0 + pushl $171 + jmp alltraps +.globl vector172 +vector172: + pushl $0 + pushl $172 + jmp alltraps +.globl vector173 +vector173: + pushl $0 + pushl $173 + jmp alltraps +.globl vector174 +vector174: + pushl $0 + pushl $174 + jmp alltraps +.globl vector175 +vector175: + pushl $0 + pushl $175 + jmp alltraps +.globl vector176 +vector176: + pushl $0 + pushl $176 + jmp alltraps +.globl vector177 +vector177: + pushl $0 + pushl $177 + jmp alltraps +.globl vector178 +vector178: + pushl $0 + pushl $178 + jmp alltraps +.globl vector179 +vector179: + pushl $0 + pushl $179 + jmp alltraps +.globl vector180 +vector180: + pushl $0 + pushl $180 + jmp alltraps +.globl vector181 +vector181: + pushl $0 + pushl $181 + jmp alltraps +.globl vector182 +vector182: + pushl $0 + pushl $182 + jmp alltraps +.globl vector183 +vector183: + pushl $0 + pushl $183 + jmp alltraps +.globl vector184 +vector184: + pushl $0 + pushl $184 + jmp alltraps +.globl vector185 +vector185: + pushl $0 + pushl $185 + jmp alltraps +.globl vector186 +vector186: + pushl $0 + pushl $186 + jmp alltraps +.globl vector187 +vector187: + pushl $0 + pushl $187 + jmp alltraps +.globl vector188 +vector188: + pushl $0 + pushl $188 + jmp alltraps +.globl vector189 +vector189: + pushl $0 + pushl $189 + jmp alltraps +.globl vector190 +vector190: + pushl $0 + pushl $190 + jmp alltraps +.globl vector191 +vector191: + pushl $0 + pushl $191 + jmp alltraps +.globl vector192 +vector192: + pushl $0 + pushl $192 + jmp alltraps +.globl vector193 +vector193: + pushl $0 + pushl $193 + jmp alltraps +.globl vector194 +vector194: + pushl $0 + pushl $194 + jmp alltraps +.globl vector195 +vector195: + pushl $0 + pushl $195 + jmp alltraps +.globl vector196 +vector196: + pushl $0 + pushl $196 + jmp alltraps +.globl vector197 +vector197: + pushl $0 + pushl $197 + jmp alltraps +.globl vector198 +vector198: + pushl $0 + pushl $198 + jmp alltraps +.globl vector199 +vector199: + pushl $0 + pushl $199 + jmp alltraps +.globl vector200 +vector200: + pushl $0 + pushl $200 + jmp alltraps +.globl vector201 +vector201: + pushl $0 + pushl $201 + jmp alltraps +.globl vector202 +vector202: + pushl $0 + pushl $202 + jmp alltraps +.globl vector203 +vector203: + pushl $0 + pushl $203 + jmp alltraps +.globl vector204 +vector204: + pushl $0 + pushl $204 + jmp alltraps +.globl vector205 +vector205: + pushl $0 + pushl $205 + jmp alltraps +.globl vector206 +vector206: + pushl $0 + pushl $206 + jmp alltraps +.globl vector207 +vector207: + pushl $0 + pushl $207 + jmp alltraps +.globl vector208 +vector208: + pushl $0 + pushl $208 + jmp alltraps +.globl vector209 +vector209: + pushl $0 + pushl $209 + jmp alltraps +.globl vector210 +vector210: + pushl $0 + pushl $210 + jmp alltraps +.globl vector211 +vector211: + pushl $0 + pushl $211 + jmp alltraps +.globl vector212 +vector212: + pushl $0 + pushl $212 + jmp alltraps +.globl vector213 +vector213: + pushl $0 + pushl $213 + jmp alltraps +.globl vector214 +vector214: + pushl $0 + pushl $214 + jmp alltraps +.globl vector215 +vector215: + pushl $0 + pushl $215 + jmp alltraps +.globl vector216 +vector216: + pushl $0 + pushl $216 + jmp alltraps +.globl vector217 +vector217: + pushl $0 + pushl $217 + jmp alltraps +.globl vector218 +vector218: + pushl $0 + pushl $218 + jmp alltraps +.globl vector219 +vector219: + pushl $0 + pushl $219 + jmp alltraps +.globl vector220 +vector220: + pushl $0 + pushl $220 + jmp alltraps +.globl vector221 +vector221: + pushl $0 + pushl $221 + jmp alltraps +.globl vector222 +vector222: + pushl $0 + pushl $222 + jmp alltraps +.globl vector223 +vector223: + pushl $0 + pushl $223 + jmp alltraps +.globl vector224 +vector224: + pushl $0 + pushl $224 + jmp alltraps +.globl vector225 +vector225: + pushl $0 + pushl $225 + jmp alltraps +.globl vector226 +vector226: + pushl $0 + pushl $226 + jmp alltraps +.globl vector227 +vector227: + pushl $0 + pushl $227 + jmp alltraps +.globl vector228 +vector228: + pushl $0 + pushl $228 + jmp alltraps +.globl vector229 +vector229: + pushl $0 + pushl $229 + jmp alltraps +.globl vector230 +vector230: + pushl $0 + pushl $230 + jmp alltraps +.globl vector231 +vector231: + pushl $0 + pushl $231 + jmp alltraps +.globl vector232 +vector232: + pushl $0 + pushl $232 + jmp alltraps +.globl vector233 +vector233: + pushl $0 + pushl $233 + jmp alltraps +.globl vector234 +vector234: + pushl $0 + pushl $234 + jmp alltraps +.globl vector235 +vector235: + pushl $0 + pushl $235 + jmp alltraps +.globl vector236 +vector236: + pushl $0 + pushl $236 + jmp alltraps +.globl vector237 +vector237: + pushl $0 + pushl $237 + jmp alltraps +.globl vector238 +vector238: + pushl $0 + pushl $238 + jmp alltraps +.globl vector239 +vector239: + pushl $0 + pushl $239 + jmp alltraps +.globl vector240 +vector240: + pushl $0 + pushl $240 + jmp alltraps +.globl vector241 +vector241: + pushl $0 + pushl $241 + jmp alltraps +.globl vector242 +vector242: + pushl $0 + pushl $242 + jmp alltraps +.globl vector243 +vector243: + pushl $0 + pushl $243 + jmp alltraps +.globl vector244 +vector244: + pushl $0 + pushl $244 + jmp alltraps +.globl vector245 +vector245: + pushl $0 + pushl $245 + jmp alltraps +.globl vector246 +vector246: + pushl $0 + pushl $246 + jmp alltraps +.globl vector247 +vector247: + pushl $0 + pushl $247 + jmp alltraps +.globl vector248 +vector248: + pushl $0 + pushl $248 + jmp alltraps +.globl vector249 +vector249: + pushl $0 + pushl $249 + jmp alltraps +.globl vector250 +vector250: + pushl $0 + pushl $250 + jmp alltraps +.globl vector251 +vector251: + pushl $0 + pushl $251 + jmp alltraps +.globl vector252 +vector252: + pushl $0 + pushl $252 + jmp alltraps +.globl vector253 +vector253: + pushl $0 + pushl $253 + jmp alltraps +.globl vector254 +vector254: + pushl $0 + pushl $254 + jmp alltraps +.globl vector255 +vector255: + pushl $0 + pushl $255 + jmp alltraps + +# vector table +.data +.globl vectors +vectors: + .long vector0 + .long vector1 + .long vector2 + .long vector3 + .long vector4 + .long vector5 + .long vector6 + .long vector7 + .long vector8 + .long vector9 + .long vector10 + .long vector11 + .long vector12 + .long vector13 + .long vector14 + .long vector15 + .long vector16 + .long vector17 + .long vector18 + .long vector19 + .long vector20 + .long vector21 + .long vector22 + .long vector23 + .long vector24 + .long vector25 + .long vector26 + .long vector27 + .long vector28 + .long vector29 + .long vector30 + .long vector31 + .long vector32 + .long vector33 + .long vector34 + .long vector35 + .long vector36 + .long vector37 + .long vector38 + .long vector39 + .long vector40 + .long vector41 + .long vector42 + .long vector43 + .long vector44 + .long vector45 + .long vector46 + .long vector47 + .long vector48 + .long vector49 + .long vector50 + .long vector51 + .long vector52 + .long vector53 + .long vector54 + .long vector55 + .long vector56 + .long vector57 + .long vector58 + .long vector59 + .long vector60 + .long vector61 + .long vector62 + .long vector63 + .long vector64 + .long vector65 + .long vector66 + .long vector67 + .long vector68 + .long vector69 + .long vector70 + .long vector71 + .long vector72 + .long vector73 + .long vector74 + .long vector75 + .long vector76 + .long vector77 + .long vector78 + .long vector79 + .long vector80 + .long vector81 + .long vector82 + .long vector83 + .long vector84 + .long vector85 + .long vector86 + .long vector87 + .long vector88 + .long vector89 + .long vector90 + .long vector91 + .long vector92 + .long vector93 + .long vector94 + .long vector95 + .long vector96 + .long vector97 + .long vector98 + .long vector99 + .long vector100 + .long vector101 + .long vector102 + .long vector103 + .long vector104 + .long vector105 + .long vector106 + .long vector107 + .long vector108 + .long vector109 + .long vector110 + .long vector111 + .long vector112 + .long vector113 + .long vector114 + .long vector115 + .long vector116 + .long vector117 + .long vector118 + .long vector119 + .long vector120 + .long vector121 + .long vector122 + .long vector123 + .long vector124 + .long vector125 + .long vector126 + .long vector127 + .long vector128 + .long vector129 + .long vector130 + .long vector131 + .long vector132 + .long vector133 + .long vector134 + .long vector135 + .long vector136 + .long vector137 + .long vector138 + .long vector139 + .long vector140 + .long vector141 + .long vector142 + .long vector143 + .long vector144 + .long vector145 + .long vector146 + .long vector147 + .long vector148 + .long vector149 + .long vector150 + .long vector151 + .long vector152 + .long vector153 + .long vector154 + .long vector155 + .long vector156 + .long vector157 + .long vector158 + .long vector159 + .long vector160 + .long vector161 + .long vector162 + .long vector163 + .long vector164 + .long vector165 + .long vector166 + .long vector167 + .long vector168 + .long vector169 + .long vector170 + .long vector171 + .long vector172 + .long vector173 + .long vector174 + .long vector175 + .long vector176 + .long vector177 + .long vector178 + .long vector179 + .long vector180 + .long vector181 + .long vector182 + .long vector183 + .long vector184 + .long vector185 + .long vector186 + .long vector187 + .long vector188 + .long vector189 + .long vector190 + .long vector191 + .long vector192 + .long vector193 + .long vector194 + .long vector195 + .long vector196 + .long vector197 + .long vector198 + .long vector199 + .long vector200 + .long vector201 + .long vector202 + .long vector203 + .long vector204 + .long vector205 + .long vector206 + .long vector207 + .long vector208 + .long vector209 + .long vector210 + .long vector211 + .long vector212 + .long vector213 + .long vector214 + .long vector215 + .long vector216 + .long vector217 + .long vector218 + .long vector219 + .long vector220 + .long vector221 + .long vector222 + .long vector223 + .long vector224 + .long vector225 + .long vector226 + .long vector227 + .long vector228 + .long vector229 + .long vector230 + .long vector231 + .long vector232 + .long vector233 + .long vector234 + .long vector235 + .long vector236 + .long vector237 + .long vector238 + .long vector239 + .long vector240 + .long vector241 + .long vector242 + .long vector243 + .long vector244 + .long vector245 + .long vector246 + .long vector247 + .long vector248 + .long vector249 + .long vector250 + .long vector251 + .long vector252 + .long vector253 + .long vector254 + .long vector255 diff --git a/vectors.o b/vectors.o new file mode 100644 index 0000000000..650f48726e Binary files /dev/null and b/vectors.o differ diff --git a/vm.d b/vm.d new file mode 100644 index 0000000000..51631b1950 --- /dev/null +++ b/vm.d @@ -0,0 +1,2 @@ +vm.o: vm.c /usr/include/stdc-predef.h param.h types.h defs.h x86.h \ + memlayout.h mmu.h proc.h elf.h diff --git a/vm.o b/vm.o new file mode 100644 index 0000000000..be3ea13933 Binary files /dev/null and b/vm.o differ diff --git a/wc.asm b/wc.asm new file mode 100644 index 0000000000..aeeec8ab7e --- /dev/null +++ b/wc.asm @@ -0,0 +1,1257 @@ + +_wc: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: + printf(1, "%d %d %d %s\n", l, w, c, name); +} + +int +main(int argc, char *argv[]) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + int fd, i; + + if(argc <= 1){ + 5: be 01 00 00 00 mov $0x1,%esi +{ + a: 53 push %ebx + b: 83 e4 f0 and $0xfffffff0,%esp + e: 83 ec 10 sub $0x10,%esp + 11: 8b 45 0c mov 0xc(%ebp),%eax + if(argc <= 1){ + 14: 83 7d 08 01 cmpl $0x1,0x8(%ebp) + 18: 8d 58 04 lea 0x4(%eax),%ebx + 1b: 7e 6e jle 8b + 1d: 8d 76 00 lea 0x0(%esi),%esi + wc(0, ""); + exit(0); + } + + for(i = 1; i < argc; i++){ + if((fd = open(argv[i], 0)) < 0){ + 20: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 27: 00 + 28: 8b 03 mov (%ebx),%eax + 2a: 89 04 24 mov %eax,(%esp) + 2d: e8 d0 03 00 00 call 402 + 32: 85 c0 test %eax,%eax + 34: 89 c7 mov %eax,%edi + 36: 78 2d js 65 + printf(1, "wc: cannot open %s\n", argv[i]); + exit(0); + } + wc(fd, argv[i]); + 38: 8b 13 mov (%ebx),%edx + for(i = 1; i < argc; i++){ + 3a: 83 c6 01 add $0x1,%esi + 3d: 83 c3 04 add $0x4,%ebx + wc(fd, argv[i]); + 40: 89 04 24 mov %eax,(%esp) + 43: 89 54 24 04 mov %edx,0x4(%esp) + 47: e8 64 00 00 00 call b0 + close(fd); + 4c: 89 3c 24 mov %edi,(%esp) + 4f: e8 96 03 00 00 call 3ea + for(i = 1; i < argc; i++){ + 54: 3b 75 08 cmp 0x8(%ebp),%esi + 57: 75 c7 jne 20 + } + exit(0); + 59: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 60: e8 5d 03 00 00 call 3c2 + printf(1, "wc: cannot open %s\n", argv[i]); + 65: 8b 03 mov (%ebx),%eax + 67: c7 44 24 04 99 08 00 movl $0x899,0x4(%esp) + 6e: 00 + 6f: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 76: 89 44 24 08 mov %eax,0x8(%esp) + 7a: e8 91 04 00 00 call 510 + exit(0); + 7f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 86: e8 37 03 00 00 call 3c2 + wc(0, ""); + 8b: c7 44 24 04 8b 08 00 movl $0x88b,0x4(%esp) + 92: 00 + 93: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 9a: e8 11 00 00 00 call b0 + exit(0); + 9f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + a6: e8 17 03 00 00 call 3c2 + ab: 66 90 xchg %ax,%ax + ad: 66 90 xchg %ax,%ax + af: 90 nop + +000000b0 : +{ + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 57 push %edi + b4: 56 push %esi + inword = 0; + b5: 31 f6 xor %esi,%esi +{ + b7: 53 push %ebx + l = w = c = 0; + b8: 31 db xor %ebx,%ebx +{ + ba: 83 ec 3c sub $0x3c,%esp + l = w = c = 0; + bd: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) + c4: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) + cb: 90 nop + cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + while((n = read(fd, buf, sizeof(buf))) > 0){ + d0: 8b 45 08 mov 0x8(%ebp),%eax + d3: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) + da: 00 + db: c7 44 24 04 a0 0b 00 movl $0xba0,0x4(%esp) + e2: 00 + e3: 89 04 24 mov %eax,(%esp) + e6: e8 ef 02 00 00 call 3da + eb: 83 f8 00 cmp $0x0,%eax + ee: 89 45 e4 mov %eax,-0x1c(%ebp) + f1: 7e 54 jle 147 + f3: 31 ff xor %edi,%edi + f5: eb 0b jmp 102 + f7: 90 nop + inword = 0; + f8: 31 f6 xor %esi,%esi + for(i=0; i + if(buf[i] == '\n') + 102: 0f be 87 a0 0b 00 00 movsbl 0xba0(%edi),%eax + l++; + 109: 31 c9 xor %ecx,%ecx + if(strchr(" \r\t\n\v", buf[i])) + 10b: c7 04 24 76 08 00 00 movl $0x876,(%esp) + l++; + 112: 3c 0a cmp $0xa,%al + 114: 0f 94 c1 sete %cl + if(strchr(" \r\t\n\v", buf[i])) + 117: 89 44 24 04 mov %eax,0x4(%esp) + l++; + 11b: 01 cb add %ecx,%ebx + if(strchr(" \r\t\n\v", buf[i])) + 11d: e8 4e 01 00 00 call 270 + 122: 85 c0 test %eax,%eax + 124: 75 d2 jne f8 + else if(!inword){ + 126: 85 f6 test %esi,%esi + 128: 75 16 jne 140 + w++; + 12a: 83 45 e0 01 addl $0x1,-0x20(%ebp) + for(i=0; i + 13a: 01 7d dc add %edi,-0x24(%ebp) + 13d: eb 91 jmp d0 + 13f: 90 nop + 140: be 01 00 00 00 mov $0x1,%esi + 145: eb b3 jmp fa + if(n < 0){ + 147: 75 35 jne 17e + printf(1, "%d %d %d %s\n", l, w, c, name); + 149: 8b 45 0c mov 0xc(%ebp),%eax + 14c: 89 5c 24 08 mov %ebx,0x8(%esp) + 150: c7 44 24 04 8c 08 00 movl $0x88c,0x4(%esp) + 157: 00 + 158: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 15f: 89 44 24 14 mov %eax,0x14(%esp) + 163: 8b 45 dc mov -0x24(%ebp),%eax + 166: 89 44 24 10 mov %eax,0x10(%esp) + 16a: 8b 45 e0 mov -0x20(%ebp),%eax + 16d: 89 44 24 0c mov %eax,0xc(%esp) + 171: e8 9a 03 00 00 call 510 +} + 176: 83 c4 3c add $0x3c,%esp + 179: 5b pop %ebx + 17a: 5e pop %esi + 17b: 5f pop %edi + 17c: 5d pop %ebp + 17d: c3 ret + printf(1, "wc: read error\n"); + 17e: c7 44 24 04 7c 08 00 movl $0x87c,0x4(%esp) + 185: 00 + 186: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 18d: e8 7e 03 00 00 call 510 + exit(0); + 192: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 199: e8 24 02 00 00 call 3c2 + 19e: 66 90 xchg %ax,%ax + +000001a0 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 1a0: 55 push %ebp + 1a1: 89 e5 mov %esp,%ebp + 1a3: 8b 45 08 mov 0x8(%ebp),%eax + 1a6: 8b 4d 0c mov 0xc(%ebp),%ecx + 1a9: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 1aa: 89 c2 mov %eax,%edx + 1ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 1b0: 83 c1 01 add $0x1,%ecx + 1b3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 1b7: 83 c2 01 add $0x1,%edx + 1ba: 84 db test %bl,%bl + 1bc: 88 5a ff mov %bl,-0x1(%edx) + 1bf: 75 ef jne 1b0 + ; + return os; +} + 1c1: 5b pop %ebx + 1c2: 5d pop %ebp + 1c3: c3 ret + 1c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 1ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +000001d0 : + +int +strcmp(const char *p, const char *q) +{ + 1d0: 55 push %ebp + 1d1: 89 e5 mov %esp,%ebp + 1d3: 8b 55 08 mov 0x8(%ebp),%edx + 1d6: 53 push %ebx + 1d7: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 1da: 0f b6 02 movzbl (%edx),%eax + 1dd: 84 c0 test %al,%al + 1df: 74 2d je 20e + 1e1: 0f b6 19 movzbl (%ecx),%ebx + 1e4: 38 d8 cmp %bl,%al + 1e6: 74 0e je 1f6 + 1e8: eb 2b jmp 215 + 1ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 1f0: 38 c8 cmp %cl,%al + 1f2: 75 15 jne 209 + p++, q++; + 1f4: 89 d9 mov %ebx,%ecx + 1f6: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 1f9: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 1fc: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 1ff: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 203: 84 c0 test %al,%al + 205: 75 e9 jne 1f0 + 207: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 209: 29 c8 sub %ecx,%eax +} + 20b: 5b pop %ebx + 20c: 5d pop %ebp + 20d: c3 ret + 20e: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + 211: 31 c0 xor %eax,%eax + 213: eb f4 jmp 209 + 215: 0f b6 cb movzbl %bl,%ecx + 218: eb ef jmp 209 + 21a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +00000220 : + +uint +strlen(const char *s) +{ + 220: 55 push %ebp + 221: 89 e5 mov %esp,%ebp + 223: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + 226: 80 39 00 cmpb $0x0,(%ecx) + 229: 74 12 je 23d + 22b: 31 d2 xor %edx,%edx + 22d: 8d 76 00 lea 0x0(%esi),%esi + 230: 83 c2 01 add $0x1,%edx + 233: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + 237: 89 d0 mov %edx,%eax + 239: 75 f5 jne 230 + ; + return n; +} + 23b: 5d pop %ebp + 23c: c3 ret + for(n = 0; s[n]; n++) + 23d: 31 c0 xor %eax,%eax +} + 23f: 5d pop %ebp + 240: c3 ret + 241: eb 0d jmp 250 + 243: 90 nop + 244: 90 nop + 245: 90 nop + 246: 90 nop + 247: 90 nop + 248: 90 nop + 249: 90 nop + 24a: 90 nop + 24b: 90 nop + 24c: 90 nop + 24d: 90 nop + 24e: 90 nop + 24f: 90 nop + +00000250 : + +void* +memset(void *dst, int c, uint n) +{ + 250: 55 push %ebp + 251: 89 e5 mov %esp,%ebp + 253: 8b 55 08 mov 0x8(%ebp),%edx + 256: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + 257: 8b 4d 10 mov 0x10(%ebp),%ecx + 25a: 8b 45 0c mov 0xc(%ebp),%eax + 25d: 89 d7 mov %edx,%edi + 25f: fc cld + 260: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + 262: 89 d0 mov %edx,%eax + 264: 5f pop %edi + 265: 5d pop %ebp + 266: c3 ret + 267: 89 f6 mov %esi,%esi + 269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000270 : + +char* +strchr(const char *s, char c) +{ + 270: 55 push %ebp + 271: 89 e5 mov %esp,%ebp + 273: 8b 45 08 mov 0x8(%ebp),%eax + 276: 53 push %ebx + 277: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 27a: 0f b6 18 movzbl (%eax),%ebx + 27d: 84 db test %bl,%bl + 27f: 74 1d je 29e + if(*s == c) + 281: 38 d3 cmp %dl,%bl + 283: 89 d1 mov %edx,%ecx + 285: 75 0d jne 294 + 287: eb 17 jmp 2a0 + 289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 290: 38 ca cmp %cl,%dl + 292: 74 0c je 2a0 + for(; *s; s++) + 294: 83 c0 01 add $0x1,%eax + 297: 0f b6 10 movzbl (%eax),%edx + 29a: 84 d2 test %dl,%dl + 29c: 75 f2 jne 290 + return (char*)s; + return 0; + 29e: 31 c0 xor %eax,%eax +} + 2a0: 5b pop %ebx + 2a1: 5d pop %ebp + 2a2: c3 ret + 2a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 2a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +000002b0 : + +char* +gets(char *buf, int max) +{ + 2b0: 55 push %ebp + 2b1: 89 e5 mov %esp,%ebp + 2b3: 57 push %edi + 2b4: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 2b5: 31 f6 xor %esi,%esi +{ + 2b7: 53 push %ebx + 2b8: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 2bb: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 2be: eb 31 jmp 2f1 + cc = read(0, &c, 1); + 2c0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 2c7: 00 + 2c8: 89 7c 24 04 mov %edi,0x4(%esp) + 2cc: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2d3: e8 02 01 00 00 call 3da + if(cc < 1) + 2d8: 85 c0 test %eax,%eax + 2da: 7e 1d jle 2f9 + break; + buf[i++] = c; + 2dc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 2e0: 89 de mov %ebx,%esi + buf[i++] = c; + 2e2: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 2e5: 3c 0d cmp $0xd,%al + buf[i++] = c; + 2e7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 2eb: 74 0c je 2f9 + 2ed: 3c 0a cmp $0xa,%al + 2ef: 74 08 je 2f9 + for(i=0; i+1 < max; ){ + 2f1: 8d 5e 01 lea 0x1(%esi),%ebx + 2f4: 3b 5d 0c cmp 0xc(%ebp),%ebx + 2f7: 7c c7 jl 2c0 + break; + } + buf[i] = '\0'; + 2f9: 8b 45 08 mov 0x8(%ebp),%eax + 2fc: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 300: 83 c4 2c add $0x2c,%esp + 303: 5b pop %ebx + 304: 5e pop %esi + 305: 5f pop %edi + 306: 5d pop %ebp + 307: c3 ret + 308: 90 nop + 309: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +00000310 : + +int +stat(const char *n, struct stat *st) +{ + 310: 55 push %ebp + 311: 89 e5 mov %esp,%ebp + 313: 56 push %esi + 314: 53 push %ebx + 315: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 318: 8b 45 08 mov 0x8(%ebp),%eax + 31b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 322: 00 + 323: 89 04 24 mov %eax,(%esp) + 326: e8 d7 00 00 00 call 402 + if(fd < 0) + 32b: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 32d: 89 c3 mov %eax,%ebx + if(fd < 0) + 32f: 78 27 js 358 + return -1; + r = fstat(fd, st); + 331: 8b 45 0c mov 0xc(%ebp),%eax + 334: 89 1c 24 mov %ebx,(%esp) + 337: 89 44 24 04 mov %eax,0x4(%esp) + 33b: e8 da 00 00 00 call 41a + close(fd); + 340: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 343: 89 c6 mov %eax,%esi + close(fd); + 345: e8 a0 00 00 00 call 3ea + return r; + 34a: 89 f0 mov %esi,%eax +} + 34c: 83 c4 10 add $0x10,%esp + 34f: 5b pop %ebx + 350: 5e pop %esi + 351: 5d pop %ebp + 352: c3 ret + 353: 90 nop + 354: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 358: b8 ff ff ff ff mov $0xffffffff,%eax + 35d: eb ed jmp 34c + 35f: 90 nop + +00000360 : + +int +atoi(const char *s) +{ + 360: 55 push %ebp + 361: 89 e5 mov %esp,%ebp + 363: 8b 4d 08 mov 0x8(%ebp),%ecx + 366: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 367: 0f be 11 movsbl (%ecx),%edx + 36a: 8d 42 d0 lea -0x30(%edx),%eax + 36d: 3c 09 cmp $0x9,%al + n = 0; + 36f: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 374: 77 17 ja 38d + 376: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 378: 83 c1 01 add $0x1,%ecx + 37b: 8d 04 80 lea (%eax,%eax,4),%eax + 37e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 382: 0f be 11 movsbl (%ecx),%edx + 385: 8d 5a d0 lea -0x30(%edx),%ebx + 388: 80 fb 09 cmp $0x9,%bl + 38b: 76 eb jbe 378 + return n; +} + 38d: 5b pop %ebx + 38e: 5d pop %ebp + 38f: c3 ret + +00000390 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 390: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 391: 31 d2 xor %edx,%edx +{ + 393: 89 e5 mov %esp,%ebp + 395: 56 push %esi + 396: 8b 45 08 mov 0x8(%ebp),%eax + 399: 53 push %ebx + 39a: 8b 5d 10 mov 0x10(%ebp),%ebx + 39d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 3a0: 85 db test %ebx,%ebx + 3a2: 7e 12 jle 3b6 + 3a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 3a8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 3ac: 88 0c 10 mov %cl,(%eax,%edx,1) + 3af: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 3b2: 39 da cmp %ebx,%edx + 3b4: 75 f2 jne 3a8 + return vdst; +} + 3b6: 5b pop %ebx + 3b7: 5e pop %esi + 3b8: 5d pop %ebp + 3b9: c3 ret + +000003ba : + 3ba: b8 01 00 00 00 mov $0x1,%eax + 3bf: cd 40 int $0x40 + 3c1: c3 ret + +000003c2 : + 3c2: b8 02 00 00 00 mov $0x2,%eax + 3c7: cd 40 int $0x40 + 3c9: c3 ret + +000003ca : + 3ca: b8 03 00 00 00 mov $0x3,%eax + 3cf: cd 40 int $0x40 + 3d1: c3 ret + +000003d2 : + 3d2: b8 04 00 00 00 mov $0x4,%eax + 3d7: cd 40 int $0x40 + 3d9: c3 ret + +000003da : + 3da: b8 05 00 00 00 mov $0x5,%eax + 3df: cd 40 int $0x40 + 3e1: c3 ret + +000003e2 : + 3e2: b8 10 00 00 00 mov $0x10,%eax + 3e7: cd 40 int $0x40 + 3e9: c3 ret + +000003ea : + 3ea: b8 15 00 00 00 mov $0x15,%eax + 3ef: cd 40 int $0x40 + 3f1: c3 ret + +000003f2 : + 3f2: b8 06 00 00 00 mov $0x6,%eax + 3f7: cd 40 int $0x40 + 3f9: c3 ret + +000003fa : + 3fa: b8 07 00 00 00 mov $0x7,%eax + 3ff: cd 40 int $0x40 + 401: c3 ret + +00000402 : + 402: b8 0f 00 00 00 mov $0xf,%eax + 407: cd 40 int $0x40 + 409: c3 ret + +0000040a : + 40a: b8 11 00 00 00 mov $0x11,%eax + 40f: cd 40 int $0x40 + 411: c3 ret + +00000412 : + 412: b8 12 00 00 00 mov $0x12,%eax + 417: cd 40 int $0x40 + 419: c3 ret + +0000041a : + 41a: b8 08 00 00 00 mov $0x8,%eax + 41f: cd 40 int $0x40 + 421: c3 ret + +00000422 : + 422: b8 13 00 00 00 mov $0x13,%eax + 427: cd 40 int $0x40 + 429: c3 ret + +0000042a : + 42a: b8 14 00 00 00 mov $0x14,%eax + 42f: cd 40 int $0x40 + 431: c3 ret + +00000432 : + 432: b8 09 00 00 00 mov $0x9,%eax + 437: cd 40 int $0x40 + 439: c3 ret + +0000043a : + 43a: b8 0a 00 00 00 mov $0xa,%eax + 43f: cd 40 int $0x40 + 441: c3 ret + +00000442 : + 442: b8 0b 00 00 00 mov $0xb,%eax + 447: cd 40 int $0x40 + 449: c3 ret + +0000044a : + 44a: b8 0c 00 00 00 mov $0xc,%eax + 44f: cd 40 int $0x40 + 451: c3 ret + +00000452 : + 452: b8 0d 00 00 00 mov $0xd,%eax + 457: cd 40 int $0x40 + 459: c3 ret + +0000045a : + 45a: b8 0e 00 00 00 mov $0xe,%eax + 45f: cd 40 int $0x40 + 461: c3 ret + 462: 66 90 xchg %ax,%ax + 464: 66 90 xchg %ax,%ax + 466: 66 90 xchg %ax,%ax + 468: 66 90 xchg %ax,%ax + 46a: 66 90 xchg %ax,%ax + 46c: 66 90 xchg %ax,%ax + 46e: 66 90 xchg %ax,%ax + +00000470 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 470: 55 push %ebp + 471: 89 e5 mov %esp,%ebp + 473: 57 push %edi + 474: 56 push %esi + 475: 89 c6 mov %eax,%esi + 477: 53 push %ebx + 478: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 47b: 8b 5d 08 mov 0x8(%ebp),%ebx + 47e: 85 db test %ebx,%ebx + 480: 74 09 je 48b + 482: 89 d0 mov %edx,%eax + 484: c1 e8 1f shr $0x1f,%eax + 487: 84 c0 test %al,%al + 489: 75 75 jne 500 + neg = 1; + x = -xx; + } else { + x = xx; + 48b: 89 d0 mov %edx,%eax + neg = 0; + 48d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 494: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 497: 31 ff xor %edi,%edi + 499: 89 ce mov %ecx,%esi + 49b: 8d 5d d7 lea -0x29(%ebp),%ebx + 49e: eb 02 jmp 4a2 + do{ + buf[i++] = digits[x % base]; + 4a0: 89 cf mov %ecx,%edi + 4a2: 31 d2 xor %edx,%edx + 4a4: f7 f6 div %esi + 4a6: 8d 4f 01 lea 0x1(%edi),%ecx + 4a9: 0f b6 92 b4 08 00 00 movzbl 0x8b4(%edx),%edx + }while((x /= base) != 0); + 4b0: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 4b2: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 4b5: 75 e9 jne 4a0 + if(neg) + 4b7: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 4ba: 89 c8 mov %ecx,%eax + 4bc: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 4bf: 85 d2 test %edx,%edx + 4c1: 74 08 je 4cb + buf[i++] = '-'; + 4c3: 8d 4f 02 lea 0x2(%edi),%ecx + 4c6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 4cb: 8d 79 ff lea -0x1(%ecx),%edi + 4ce: 66 90 xchg %ax,%ax + 4d0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 4d5: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 4d8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4df: 00 + 4e0: 89 5c 24 04 mov %ebx,0x4(%esp) + 4e4: 89 34 24 mov %esi,(%esp) + 4e7: 88 45 d7 mov %al,-0x29(%ebp) + 4ea: e8 f3 fe ff ff call 3e2 + while(--i >= 0) + 4ef: 83 ff ff cmp $0xffffffff,%edi + 4f2: 75 dc jne 4d0 + putc(fd, buf[i]); +} + 4f4: 83 c4 4c add $0x4c,%esp + 4f7: 5b pop %ebx + 4f8: 5e pop %esi + 4f9: 5f pop %edi + 4fa: 5d pop %ebp + 4fb: c3 ret + 4fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 500: 89 d0 mov %edx,%eax + 502: f7 d8 neg %eax + neg = 1; + 504: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 50b: eb 87 jmp 494 + 50d: 8d 76 00 lea 0x0(%esi),%esi + +00000510 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 510: 55 push %ebp + 511: 89 e5 mov %esp,%ebp + 513: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 514: 31 ff xor %edi,%edi +{ + 516: 56 push %esi + 517: 53 push %ebx + 518: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 51b: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 51e: 8d 45 10 lea 0x10(%ebp),%eax +{ + 521: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 524: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 527: 0f b6 13 movzbl (%ebx),%edx + 52a: 83 c3 01 add $0x1,%ebx + 52d: 84 d2 test %dl,%dl + 52f: 75 39 jne 56a + 531: e9 c2 00 00 00 jmp 5f8 + 536: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 538: 83 fa 25 cmp $0x25,%edx + 53b: 0f 84 bf 00 00 00 je 600 + write(fd, &c, 1); + 541: 8d 45 e2 lea -0x1e(%ebp),%eax + 544: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 54b: 00 + 54c: 89 44 24 04 mov %eax,0x4(%esp) + 550: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 553: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 556: e8 87 fe ff ff call 3e2 + 55b: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 55e: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 562: 84 d2 test %dl,%dl + 564: 0f 84 8e 00 00 00 je 5f8 + if(state == 0){ + 56a: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 56c: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 56f: 74 c7 je 538 + } + } else if(state == '%'){ + 571: 83 ff 25 cmp $0x25,%edi + 574: 75 e5 jne 55b + if(c == 'd'){ + 576: 83 fa 64 cmp $0x64,%edx + 579: 0f 84 31 01 00 00 je 6b0 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 57f: 25 f7 00 00 00 and $0xf7,%eax + 584: 83 f8 70 cmp $0x70,%eax + 587: 0f 84 83 00 00 00 je 610 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 58d: 83 fa 73 cmp $0x73,%edx + 590: 0f 84 a2 00 00 00 je 638 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 596: 83 fa 63 cmp $0x63,%edx + 599: 0f 84 35 01 00 00 je 6d4 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 59f: 83 fa 25 cmp $0x25,%edx + 5a2: 0f 84 e0 00 00 00 je 688 + write(fd, &c, 1); + 5a8: 8d 45 e6 lea -0x1a(%ebp),%eax + 5ab: 83 c3 01 add $0x1,%ebx + 5ae: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5b5: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 5b6: 31 ff xor %edi,%edi + write(fd, &c, 1); + 5b8: 89 44 24 04 mov %eax,0x4(%esp) + 5bc: 89 34 24 mov %esi,(%esp) + 5bf: 89 55 d0 mov %edx,-0x30(%ebp) + 5c2: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 5c6: e8 17 fe ff ff call 3e2 + putc(fd, c); + 5cb: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 5ce: 8d 45 e7 lea -0x19(%ebp),%eax + 5d1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 5d8: 00 + 5d9: 89 44 24 04 mov %eax,0x4(%esp) + 5dd: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 5e0: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 5e3: e8 fa fd ff ff call 3e2 + for(i = 0; fmt[i]; i++){ + 5e8: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 5ec: 84 d2 test %dl,%dl + 5ee: 0f 85 76 ff ff ff jne 56a + 5f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 5f8: 83 c4 3c add $0x3c,%esp + 5fb: 5b pop %ebx + 5fc: 5e pop %esi + 5fd: 5f pop %edi + 5fe: 5d pop %ebp + 5ff: c3 ret + state = '%'; + 600: bf 25 00 00 00 mov $0x25,%edi + 605: e9 51 ff ff ff jmp 55b + 60a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 610: 8b 45 d4 mov -0x2c(%ebp),%eax + 613: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 618: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 61a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 621: 8b 10 mov (%eax),%edx + 623: 89 f0 mov %esi,%eax + 625: e8 46 fe ff ff call 470 + ap++; + 62a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 62e: e9 28 ff ff ff jmp 55b + 633: 90 nop + 634: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 638: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 63b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 63f: 8b 38 mov (%eax),%edi + s = "(null)"; + 641: b8 ad 08 00 00 mov $0x8ad,%eax + 646: 85 ff test %edi,%edi + 648: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 64b: 0f b6 07 movzbl (%edi),%eax + 64e: 84 c0 test %al,%al + 650: 74 2a je 67c + 652: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 658: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 65b: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 65e: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 661: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 668: 00 + 669: 89 44 24 04 mov %eax,0x4(%esp) + 66d: 89 34 24 mov %esi,(%esp) + 670: e8 6d fd ff ff call 3e2 + while(*s != 0){ + 675: 0f b6 07 movzbl (%edi),%eax + 678: 84 c0 test %al,%al + 67a: 75 dc jne 658 + state = 0; + 67c: 31 ff xor %edi,%edi + 67e: e9 d8 fe ff ff jmp 55b + 683: 90 nop + 684: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 688: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 68b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 68d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 694: 00 + 695: 89 44 24 04 mov %eax,0x4(%esp) + 699: 89 34 24 mov %esi,(%esp) + 69c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 6a0: e8 3d fd ff ff call 3e2 + 6a5: e9 b1 fe ff ff jmp 55b + 6aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 6b0: 8b 45 d4 mov -0x2c(%ebp),%eax + 6b3: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 6b8: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 6bb: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 6c2: 8b 10 mov (%eax),%edx + 6c4: 89 f0 mov %esi,%eax + 6c6: e8 a5 fd ff ff call 470 + ap++; + 6cb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 6cf: e9 87 fe ff ff jmp 55b + putc(fd, *ap); + 6d4: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 6d7: 31 ff xor %edi,%edi + putc(fd, *ap); + 6d9: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 6db: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 6e2: 00 + 6e3: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 6e6: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 6e9: 8d 45 e4 lea -0x1c(%ebp),%eax + 6ec: 89 44 24 04 mov %eax,0x4(%esp) + 6f0: e8 ed fc ff ff call 3e2 + ap++; + 6f5: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 6f9: e9 5d fe ff ff jmp 55b + 6fe: 66 90 xchg %ax,%ax + +00000700 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 700: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 701: a1 80 0b 00 00 mov 0xb80,%eax +{ + 706: 89 e5 mov %esp,%ebp + 708: 57 push %edi + 709: 56 push %esi + 70a: 53 push %ebx + 70b: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 70e: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 710: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 713: 39 d0 cmp %edx,%eax + 715: 72 11 jb 728 + 717: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 718: 39 c8 cmp %ecx,%eax + 71a: 72 04 jb 720 + 71c: 39 ca cmp %ecx,%edx + 71e: 72 10 jb 730 + 720: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 722: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 724: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 726: 73 f0 jae 718 + 728: 39 ca cmp %ecx,%edx + 72a: 72 04 jb 730 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 72c: 39 c8 cmp %ecx,%eax + 72e: 72 f0 jb 720 + break; + if(bp + bp->s.size == p->s.ptr){ + 730: 8b 73 fc mov -0x4(%ebx),%esi + 733: 8d 3c f2 lea (%edx,%esi,8),%edi + 736: 39 cf cmp %ecx,%edi + 738: 74 1e je 758 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 73a: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 73d: 8b 48 04 mov 0x4(%eax),%ecx + 740: 8d 34 c8 lea (%eax,%ecx,8),%esi + 743: 39 f2 cmp %esi,%edx + 745: 74 28 je 76f + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 747: 89 10 mov %edx,(%eax) + freep = p; + 749: a3 80 0b 00 00 mov %eax,0xb80 +} + 74e: 5b pop %ebx + 74f: 5e pop %esi + 750: 5f pop %edi + 751: 5d pop %ebp + 752: c3 ret + 753: 90 nop + 754: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 758: 03 71 04 add 0x4(%ecx),%esi + 75b: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 75e: 8b 08 mov (%eax),%ecx + 760: 8b 09 mov (%ecx),%ecx + 762: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 765: 8b 48 04 mov 0x4(%eax),%ecx + 768: 8d 34 c8 lea (%eax,%ecx,8),%esi + 76b: 39 f2 cmp %esi,%edx + 76d: 75 d8 jne 747 + p->s.size += bp->s.size; + 76f: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 772: a3 80 0b 00 00 mov %eax,0xb80 + p->s.size += bp->s.size; + 777: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 77a: 8b 53 f8 mov -0x8(%ebx),%edx + 77d: 89 10 mov %edx,(%eax) +} + 77f: 5b pop %ebx + 780: 5e pop %esi + 781: 5f pop %edi + 782: 5d pop %ebp + 783: c3 ret + 784: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 78a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000790 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 790: 55 push %ebp + 791: 89 e5 mov %esp,%ebp + 793: 57 push %edi + 794: 56 push %esi + 795: 53 push %ebx + 796: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 799: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 79c: 8b 1d 80 0b 00 00 mov 0xb80,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 7a2: 8d 48 07 lea 0x7(%eax),%ecx + 7a5: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 7a8: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 7aa: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 7ad: 0f 84 9b 00 00 00 je 84e + 7b3: 8b 13 mov (%ebx),%edx + 7b5: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 7b8: 39 fe cmp %edi,%esi + 7ba: 76 64 jbe 820 + 7bc: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 7c3: bb 00 80 00 00 mov $0x8000,%ebx + 7c8: 89 45 e4 mov %eax,-0x1c(%ebp) + 7cb: eb 0e jmp 7db + 7cd: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 7d0: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 7d2: 8b 78 04 mov 0x4(%eax),%edi + 7d5: 39 fe cmp %edi,%esi + 7d7: 76 4f jbe 828 + 7d9: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 7db: 3b 15 80 0b 00 00 cmp 0xb80,%edx + 7e1: 75 ed jne 7d0 + if(nu < 4096) + 7e3: 8b 45 e4 mov -0x1c(%ebp),%eax + 7e6: 81 fe 00 10 00 00 cmp $0x1000,%esi + 7ec: bf 00 10 00 00 mov $0x1000,%edi + 7f1: 0f 43 fe cmovae %esi,%edi + 7f4: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 7f7: 89 04 24 mov %eax,(%esp) + 7fa: e8 4b fc ff ff call 44a + if(p == (char*)-1) + 7ff: 83 f8 ff cmp $0xffffffff,%eax + 802: 74 18 je 81c + hp->s.size = nu; + 804: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 807: 83 c0 08 add $0x8,%eax + 80a: 89 04 24 mov %eax,(%esp) + 80d: e8 ee fe ff ff call 700 + return freep; + 812: 8b 15 80 0b 00 00 mov 0xb80,%edx + if((p = morecore(nunits)) == 0) + 818: 85 d2 test %edx,%edx + 81a: 75 b4 jne 7d0 + return 0; + 81c: 31 c0 xor %eax,%eax + 81e: eb 20 jmp 840 + if(p->s.size >= nunits){ + 820: 89 d0 mov %edx,%eax + 822: 89 da mov %ebx,%edx + 824: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 828: 39 fe cmp %edi,%esi + 82a: 74 1c je 848 + p->s.size -= nunits; + 82c: 29 f7 sub %esi,%edi + 82e: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 831: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 834: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 837: 89 15 80 0b 00 00 mov %edx,0xb80 + return (void*)(p + 1); + 83d: 83 c0 08 add $0x8,%eax + } +} + 840: 83 c4 1c add $0x1c,%esp + 843: 5b pop %ebx + 844: 5e pop %esi + 845: 5f pop %edi + 846: 5d pop %ebp + 847: c3 ret + prevp->s.ptr = p->s.ptr; + 848: 8b 08 mov (%eax),%ecx + 84a: 89 0a mov %ecx,(%edx) + 84c: eb e9 jmp 837 + base.s.ptr = freep = prevp = &base; + 84e: c7 05 80 0b 00 00 84 movl $0xb84,0xb80 + 855: 0b 00 00 + base.s.size = 0; + 858: ba 84 0b 00 00 mov $0xb84,%edx + base.s.ptr = freep = prevp = &base; + 85d: c7 05 84 0b 00 00 84 movl $0xb84,0xb84 + 864: 0b 00 00 + base.s.size = 0; + 867: c7 05 88 0b 00 00 00 movl $0x0,0xb88 + 86e: 00 00 00 + 871: e9 46 ff ff ff jmp 7bc diff --git a/wc.c b/wc.c index d6a54df428..1d4f7088dc 100644 --- a/wc.c +++ b/wc.c @@ -27,7 +27,7 @@ wc(int fd, char *name) } if(n < 0){ printf(1, "wc: read error\n"); - exit(); + exit(0); } printf(1, "%d %d %d %s\n", l, w, c, name); } @@ -39,16 +39,16 @@ main(int argc, char *argv[]) if(argc <= 1){ wc(0, ""); - exit(); + exit(0); } for(i = 1; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ printf(1, "wc: cannot open %s\n", argv[i]); - exit(); + exit(0); } wc(fd, argv[i]); close(fd); } - exit(); + exit(0); } diff --git a/wc.d b/wc.d new file mode 100644 index 0000000000..6adc498948 --- /dev/null +++ b/wc.d @@ -0,0 +1 @@ +wc.o: wc.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/wc.o b/wc.o new file mode 100644 index 0000000000..54299377f5 Binary files /dev/null and b/wc.o differ diff --git a/wc.sym b/wc.sym new file mode 100644 index 0000000000..d20a098253 --- /dev/null +++ b/wc.sym @@ -0,0 +1,59 @@ +00000000 .text +00000876 .rodata +000008c8 .eh_frame +00000b80 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 wc.c +00000000 ulib.c +00000000 printf.c +00000470 printint +000008b4 digits.1354 +00000000 umalloc.c +00000b80 freep +00000b84 base +000001a0 strcpy +00000510 printf +00000390 memmove +0000040a mknod +000002b0 gets +00000442 getpid +00000790 malloc +00000452 sleep +000003d2 pipe +000003e2 write +0000041a fstat +000003f2 kill +00000432 chdir +000003fa exec +000003ca wait +000003da read +00000412 unlink +000000b0 wc +000003ba fork +0000044a sbrk +0000045a uptime +00000b64 __bss_start +00000250 memset +00000000 main +000001d0 strcmp +0000043a dup +00000ba0 buf +00000310 stat +00000b64 _edata +00000da0 _end +00000422 link +000003c2 exit +00000360 atoi +00000220 strlen +00000402 open +00000270 strchr +0000042a mkdir +000003ea close +00000700 free diff --git a/xv6.img b/xv6.img new file mode 100644 index 0000000000..e321d5d62c Binary files /dev/null and b/xv6.img differ diff --git a/zombie.asm b/zombie.asm new file mode 100644 index 0000000000..dc1a36fa62 --- /dev/null +++ b/zombie.asm @@ -0,0 +1,1095 @@ + +_zombie: file format elf32-i386 + + +Disassembly of section .text: + +00000000
: +#include "stat.h" +#include "user.h" + +int +main(void) +{ + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp + 6: 83 ec 10 sub $0x10,%esp + if(fork() > 0) + 9: e8 3c 02 00 00 call 24a + e: 85 c0 test %eax,%eax + 10: 7e 0c jle 1e + sleep(5); // Let child exit before parent. + 12: c7 04 24 05 00 00 00 movl $0x5,(%esp) + 19: e8 c4 02 00 00 call 2e2 + exit(0); + 1e: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 25: e8 28 02 00 00 call 252 + 2a: 66 90 xchg %ax,%ax + 2c: 66 90 xchg %ax,%ax + 2e: 66 90 xchg %ax,%ax + +00000030 : +#include "user.h" +#include "x86.h" + +char* +strcpy(char *s, const char *t) +{ + 30: 55 push %ebp + 31: 89 e5 mov %esp,%ebp + 33: 8b 45 08 mov 0x8(%ebp),%eax + 36: 8b 4d 0c mov 0xc(%ebp),%ecx + 39: 53 push %ebx + char *os; + + os = s; + while((*s++ = *t++) != 0) + 3a: 89 c2 mov %eax,%edx + 3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 40: 83 c1 01 add $0x1,%ecx + 43: 0f b6 59 ff movzbl -0x1(%ecx),%ebx + 47: 83 c2 01 add $0x1,%edx + 4a: 84 db test %bl,%bl + 4c: 88 5a ff mov %bl,-0x1(%edx) + 4f: 75 ef jne 40 + ; + return os; +} + 51: 5b pop %ebx + 52: 5d pop %ebp + 53: c3 ret + 54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000060 : + +int +strcmp(const char *p, const char *q) +{ + 60: 55 push %ebp + 61: 89 e5 mov %esp,%ebp + 63: 8b 55 08 mov 0x8(%ebp),%edx + 66: 53 push %ebx + 67: 8b 4d 0c mov 0xc(%ebp),%ecx + while(*p && *p == *q) + 6a: 0f b6 02 movzbl (%edx),%eax + 6d: 84 c0 test %al,%al + 6f: 74 2d je 9e + 71: 0f b6 19 movzbl (%ecx),%ebx + 74: 38 d8 cmp %bl,%al + 76: 74 0e je 86 + 78: eb 2b jmp a5 + 7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 80: 38 c8 cmp %cl,%al + 82: 75 15 jne 99 + p++, q++; + 84: 89 d9 mov %ebx,%ecx + 86: 83 c2 01 add $0x1,%edx + while(*p && *p == *q) + 89: 0f b6 02 movzbl (%edx),%eax + p++, q++; + 8c: 8d 59 01 lea 0x1(%ecx),%ebx + while(*p && *p == *q) + 8f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx + 93: 84 c0 test %al,%al + 95: 75 e9 jne 80 + 97: 31 c0 xor %eax,%eax + return (uchar)*p - (uchar)*q; + 99: 29 c8 sub %ecx,%eax +} + 9b: 5b pop %ebx + 9c: 5d pop %ebp + 9d: c3 ret + 9e: 0f b6 09 movzbl (%ecx),%ecx + while(*p && *p == *q) + a1: 31 c0 xor %eax,%eax + a3: eb f4 jmp 99 + a5: 0f b6 cb movzbl %bl,%ecx + a8: eb ef jmp 99 + aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + +000000b0 : + +uint +strlen(const char *s) +{ + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 8b 4d 08 mov 0x8(%ebp),%ecx + int n; + + for(n = 0; s[n]; n++) + b6: 80 39 00 cmpb $0x0,(%ecx) + b9: 74 12 je cd + bb: 31 d2 xor %edx,%edx + bd: 8d 76 00 lea 0x0(%esi),%esi + c0: 83 c2 01 add $0x1,%edx + c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) + c7: 89 d0 mov %edx,%eax + c9: 75 f5 jne c0 + ; + return n; +} + cb: 5d pop %ebp + cc: c3 ret + for(n = 0; s[n]; n++) + cd: 31 c0 xor %eax,%eax +} + cf: 5d pop %ebp + d0: c3 ret + d1: eb 0d jmp e0 + d3: 90 nop + d4: 90 nop + d5: 90 nop + d6: 90 nop + d7: 90 nop + d8: 90 nop + d9: 90 nop + da: 90 nop + db: 90 nop + dc: 90 nop + dd: 90 nop + de: 90 nop + df: 90 nop + +000000e0 : + +void* +memset(void *dst, int c, uint n) +{ + e0: 55 push %ebp + e1: 89 e5 mov %esp,%ebp + e3: 8b 55 08 mov 0x8(%ebp),%edx + e6: 57 push %edi +} + +static inline void +stosb(void *addr, int data, int cnt) +{ + asm volatile("cld; rep stosb" : + e7: 8b 4d 10 mov 0x10(%ebp),%ecx + ea: 8b 45 0c mov 0xc(%ebp),%eax + ed: 89 d7 mov %edx,%edi + ef: fc cld + f0: f3 aa rep stos %al,%es:(%edi) + stosb(dst, c, n); + return dst; +} + f2: 89 d0 mov %edx,%eax + f4: 5f pop %edi + f5: 5d pop %ebp + f6: c3 ret + f7: 89 f6 mov %esi,%esi + f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000100 : + +char* +strchr(const char *s, char c) +{ + 100: 55 push %ebp + 101: 89 e5 mov %esp,%ebp + 103: 8b 45 08 mov 0x8(%ebp),%eax + 106: 53 push %ebx + 107: 8b 55 0c mov 0xc(%ebp),%edx + for(; *s; s++) + 10a: 0f b6 18 movzbl (%eax),%ebx + 10d: 84 db test %bl,%bl + 10f: 74 1d je 12e + if(*s == c) + 111: 38 d3 cmp %dl,%bl + 113: 89 d1 mov %edx,%ecx + 115: 75 0d jne 124 + 117: eb 17 jmp 130 + 119: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + 120: 38 ca cmp %cl,%dl + 122: 74 0c je 130 + for(; *s; s++) + 124: 83 c0 01 add $0x1,%eax + 127: 0f b6 10 movzbl (%eax),%edx + 12a: 84 d2 test %dl,%dl + 12c: 75 f2 jne 120 + return (char*)s; + return 0; + 12e: 31 c0 xor %eax,%eax +} + 130: 5b pop %ebx + 131: 5d pop %ebp + 132: c3 ret + 133: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi + +00000140 : + +char* +gets(char *buf, int max) +{ + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 57 push %edi + 144: 56 push %esi + int i, cc; + char c; + + for(i=0; i+1 < max; ){ + 145: 31 f6 xor %esi,%esi +{ + 147: 53 push %ebx + 148: 83 ec 2c sub $0x2c,%esp + cc = read(0, &c, 1); + 14b: 8d 7d e7 lea -0x19(%ebp),%edi + for(i=0; i+1 < max; ){ + 14e: eb 31 jmp 181 + cc = read(0, &c, 1); + 150: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 157: 00 + 158: 89 7c 24 04 mov %edi,0x4(%esp) + 15c: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 163: e8 02 01 00 00 call 26a + if(cc < 1) + 168: 85 c0 test %eax,%eax + 16a: 7e 1d jle 189 + break; + buf[i++] = c; + 16c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + for(i=0; i+1 < max; ){ + 170: 89 de mov %ebx,%esi + buf[i++] = c; + 172: 8b 55 08 mov 0x8(%ebp),%edx + if(c == '\n' || c == '\r') + 175: 3c 0d cmp $0xd,%al + buf[i++] = c; + 177: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) + if(c == '\n' || c == '\r') + 17b: 74 0c je 189 + 17d: 3c 0a cmp $0xa,%al + 17f: 74 08 je 189 + for(i=0; i+1 < max; ){ + 181: 8d 5e 01 lea 0x1(%esi),%ebx + 184: 3b 5d 0c cmp 0xc(%ebp),%ebx + 187: 7c c7 jl 150 + break; + } + buf[i] = '\0'; + 189: 8b 45 08 mov 0x8(%ebp),%eax + 18c: c6 04 30 00 movb $0x0,(%eax,%esi,1) + return buf; +} + 190: 83 c4 2c add $0x2c,%esp + 193: 5b pop %ebx + 194: 5e pop %esi + 195: 5f pop %edi + 196: 5d pop %ebp + 197: c3 ret + 198: 90 nop + 199: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi + +000001a0 : + +int +stat(const char *n, struct stat *st) +{ + 1a0: 55 push %ebp + 1a1: 89 e5 mov %esp,%ebp + 1a3: 56 push %esi + 1a4: 53 push %ebx + 1a5: 83 ec 10 sub $0x10,%esp + int fd; + int r; + + fd = open(n, O_RDONLY); + 1a8: 8b 45 08 mov 0x8(%ebp),%eax + 1ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) + 1b2: 00 + 1b3: 89 04 24 mov %eax,(%esp) + 1b6: e8 d7 00 00 00 call 292 + if(fd < 0) + 1bb: 85 c0 test %eax,%eax + fd = open(n, O_RDONLY); + 1bd: 89 c3 mov %eax,%ebx + if(fd < 0) + 1bf: 78 27 js 1e8 + return -1; + r = fstat(fd, st); + 1c1: 8b 45 0c mov 0xc(%ebp),%eax + 1c4: 89 1c 24 mov %ebx,(%esp) + 1c7: 89 44 24 04 mov %eax,0x4(%esp) + 1cb: e8 da 00 00 00 call 2aa + close(fd); + 1d0: 89 1c 24 mov %ebx,(%esp) + r = fstat(fd, st); + 1d3: 89 c6 mov %eax,%esi + close(fd); + 1d5: e8 a0 00 00 00 call 27a + return r; + 1da: 89 f0 mov %esi,%eax +} + 1dc: 83 c4 10 add $0x10,%esp + 1df: 5b pop %ebx + 1e0: 5e pop %esi + 1e1: 5d pop %ebp + 1e2: c3 ret + 1e3: 90 nop + 1e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + return -1; + 1e8: b8 ff ff ff ff mov $0xffffffff,%eax + 1ed: eb ed jmp 1dc + 1ef: 90 nop + +000001f0 : + +int +atoi(const char *s) +{ + 1f0: 55 push %ebp + 1f1: 89 e5 mov %esp,%ebp + 1f3: 8b 4d 08 mov 0x8(%ebp),%ecx + 1f6: 53 push %ebx + int n; + + n = 0; + while('0' <= *s && *s <= '9') + 1f7: 0f be 11 movsbl (%ecx),%edx + 1fa: 8d 42 d0 lea -0x30(%edx),%eax + 1fd: 3c 09 cmp $0x9,%al + n = 0; + 1ff: b8 00 00 00 00 mov $0x0,%eax + while('0' <= *s && *s <= '9') + 204: 77 17 ja 21d + 206: 66 90 xchg %ax,%ax + n = n*10 + *s++ - '0'; + 208: 83 c1 01 add $0x1,%ecx + 20b: 8d 04 80 lea (%eax,%eax,4),%eax + 20e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax + while('0' <= *s && *s <= '9') + 212: 0f be 11 movsbl (%ecx),%edx + 215: 8d 5a d0 lea -0x30(%edx),%ebx + 218: 80 fb 09 cmp $0x9,%bl + 21b: 76 eb jbe 208 + return n; +} + 21d: 5b pop %ebx + 21e: 5d pop %ebp + 21f: c3 ret + +00000220 : + +void* +memmove(void *vdst, const void *vsrc, int n) +{ + 220: 55 push %ebp + char *dst; + const char *src; + + dst = vdst; + src = vsrc; + while(n-- > 0) + 221: 31 d2 xor %edx,%edx +{ + 223: 89 e5 mov %esp,%ebp + 225: 56 push %esi + 226: 8b 45 08 mov 0x8(%ebp),%eax + 229: 53 push %ebx + 22a: 8b 5d 10 mov 0x10(%ebp),%ebx + 22d: 8b 75 0c mov 0xc(%ebp),%esi + while(n-- > 0) + 230: 85 db test %ebx,%ebx + 232: 7e 12 jle 246 + 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + *dst++ = *src++; + 238: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx + 23c: 88 0c 10 mov %cl,(%eax,%edx,1) + 23f: 83 c2 01 add $0x1,%edx + while(n-- > 0) + 242: 39 da cmp %ebx,%edx + 244: 75 f2 jne 238 + return vdst; +} + 246: 5b pop %ebx + 247: 5e pop %esi + 248: 5d pop %ebp + 249: c3 ret + +0000024a : + 24a: b8 01 00 00 00 mov $0x1,%eax + 24f: cd 40 int $0x40 + 251: c3 ret + +00000252 : + 252: b8 02 00 00 00 mov $0x2,%eax + 257: cd 40 int $0x40 + 259: c3 ret + +0000025a : + 25a: b8 03 00 00 00 mov $0x3,%eax + 25f: cd 40 int $0x40 + 261: c3 ret + +00000262 : + 262: b8 04 00 00 00 mov $0x4,%eax + 267: cd 40 int $0x40 + 269: c3 ret + +0000026a : + 26a: b8 05 00 00 00 mov $0x5,%eax + 26f: cd 40 int $0x40 + 271: c3 ret + +00000272 : + 272: b8 10 00 00 00 mov $0x10,%eax + 277: cd 40 int $0x40 + 279: c3 ret + +0000027a : + 27a: b8 15 00 00 00 mov $0x15,%eax + 27f: cd 40 int $0x40 + 281: c3 ret + +00000282 : + 282: b8 06 00 00 00 mov $0x6,%eax + 287: cd 40 int $0x40 + 289: c3 ret + +0000028a : + 28a: b8 07 00 00 00 mov $0x7,%eax + 28f: cd 40 int $0x40 + 291: c3 ret + +00000292 : + 292: b8 0f 00 00 00 mov $0xf,%eax + 297: cd 40 int $0x40 + 299: c3 ret + +0000029a : + 29a: b8 11 00 00 00 mov $0x11,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret + +000002a2 : + 2a2: b8 12 00 00 00 mov $0x12,%eax + 2a7: cd 40 int $0x40 + 2a9: c3 ret + +000002aa : + 2aa: b8 08 00 00 00 mov $0x8,%eax + 2af: cd 40 int $0x40 + 2b1: c3 ret + +000002b2 : + 2b2: b8 13 00 00 00 mov $0x13,%eax + 2b7: cd 40 int $0x40 + 2b9: c3 ret + +000002ba : + 2ba: b8 14 00 00 00 mov $0x14,%eax + 2bf: cd 40 int $0x40 + 2c1: c3 ret + +000002c2 : + 2c2: b8 09 00 00 00 mov $0x9,%eax + 2c7: cd 40 int $0x40 + 2c9: c3 ret + +000002ca : + 2ca: b8 0a 00 00 00 mov $0xa,%eax + 2cf: cd 40 int $0x40 + 2d1: c3 ret + +000002d2 : + 2d2: b8 0b 00 00 00 mov $0xb,%eax + 2d7: cd 40 int $0x40 + 2d9: c3 ret + +000002da : + 2da: b8 0c 00 00 00 mov $0xc,%eax + 2df: cd 40 int $0x40 + 2e1: c3 ret + +000002e2 : + 2e2: b8 0d 00 00 00 mov $0xd,%eax + 2e7: cd 40 int $0x40 + 2e9: c3 ret + +000002ea : + 2ea: b8 0e 00 00 00 mov $0xe,%eax + 2ef: cd 40 int $0x40 + 2f1: c3 ret + 2f2: 66 90 xchg %ax,%ax + 2f4: 66 90 xchg %ax,%ax + 2f6: 66 90 xchg %ax,%ax + 2f8: 66 90 xchg %ax,%ax + 2fa: 66 90 xchg %ax,%ax + 2fc: 66 90 xchg %ax,%ax + 2fe: 66 90 xchg %ax,%ax + +00000300 : + write(fd, &c, 1); +} + +static void +printint(int fd, int xx, int base, int sgn) +{ + 300: 55 push %ebp + 301: 89 e5 mov %esp,%ebp + 303: 57 push %edi + 304: 56 push %esi + 305: 89 c6 mov %eax,%esi + 307: 53 push %ebx + 308: 83 ec 4c sub $0x4c,%esp + char buf[16]; + int i, neg; + uint x; + + neg = 0; + if(sgn && xx < 0){ + 30b: 8b 5d 08 mov 0x8(%ebp),%ebx + 30e: 85 db test %ebx,%ebx + 310: 74 09 je 31b + 312: 89 d0 mov %edx,%eax + 314: c1 e8 1f shr $0x1f,%eax + 317: 84 c0 test %al,%al + 319: 75 75 jne 390 + neg = 1; + x = -xx; + } else { + x = xx; + 31b: 89 d0 mov %edx,%eax + neg = 0; + 31d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) + 324: 89 75 c0 mov %esi,-0x40(%ebp) + } + + i = 0; + 327: 31 ff xor %edi,%edi + 329: 89 ce mov %ecx,%esi + 32b: 8d 5d d7 lea -0x29(%ebp),%ebx + 32e: eb 02 jmp 332 + do{ + buf[i++] = digits[x % base]; + 330: 89 cf mov %ecx,%edi + 332: 31 d2 xor %edx,%edx + 334: f7 f6 div %esi + 336: 8d 4f 01 lea 0x1(%edi),%ecx + 339: 0f b6 92 0d 07 00 00 movzbl 0x70d(%edx),%edx + }while((x /= base) != 0); + 340: 85 c0 test %eax,%eax + buf[i++] = digits[x % base]; + 342: 88 14 0b mov %dl,(%ebx,%ecx,1) + }while((x /= base) != 0); + 345: 75 e9 jne 330 + if(neg) + 347: 8b 55 c4 mov -0x3c(%ebp),%edx + buf[i++] = digits[x % base]; + 34a: 89 c8 mov %ecx,%eax + 34c: 8b 75 c0 mov -0x40(%ebp),%esi + if(neg) + 34f: 85 d2 test %edx,%edx + 351: 74 08 je 35b + buf[i++] = '-'; + 353: 8d 4f 02 lea 0x2(%edi),%ecx + 356: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) + + while(--i >= 0) + 35b: 8d 79 ff lea -0x1(%ecx),%edi + 35e: 66 90 xchg %ax,%ax + 360: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax + 365: 83 ef 01 sub $0x1,%edi + write(fd, &c, 1); + 368: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 36f: 00 + 370: 89 5c 24 04 mov %ebx,0x4(%esp) + 374: 89 34 24 mov %esi,(%esp) + 377: 88 45 d7 mov %al,-0x29(%ebp) + 37a: e8 f3 fe ff ff call 272 + while(--i >= 0) + 37f: 83 ff ff cmp $0xffffffff,%edi + 382: 75 dc jne 360 + putc(fd, buf[i]); +} + 384: 83 c4 4c add $0x4c,%esp + 387: 5b pop %ebx + 388: 5e pop %esi + 389: 5f pop %edi + 38a: 5d pop %ebp + 38b: c3 ret + 38c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + x = -xx; + 390: 89 d0 mov %edx,%eax + 392: f7 d8 neg %eax + neg = 1; + 394: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) + 39b: eb 87 jmp 324 + 39d: 8d 76 00 lea 0x0(%esi),%esi + +000003a0 : + +// Print to the given fd. Only understands %d, %x, %p, %s. +void +printf(int fd, const char *fmt, ...) +{ + 3a0: 55 push %ebp + 3a1: 89 e5 mov %esp,%ebp + 3a3: 57 push %edi + char *s; + int c, i, state; + uint *ap; + + state = 0; + 3a4: 31 ff xor %edi,%edi +{ + 3a6: 56 push %esi + 3a7: 53 push %ebx + 3a8: 83 ec 3c sub $0x3c,%esp + ap = (uint*)(void*)&fmt + 1; + for(i = 0; fmt[i]; i++){ + 3ab: 8b 5d 0c mov 0xc(%ebp),%ebx + ap = (uint*)(void*)&fmt + 1; + 3ae: 8d 45 10 lea 0x10(%ebp),%eax +{ + 3b1: 8b 75 08 mov 0x8(%ebp),%esi + ap = (uint*)(void*)&fmt + 1; + 3b4: 89 45 d4 mov %eax,-0x2c(%ebp) + for(i = 0; fmt[i]; i++){ + 3b7: 0f b6 13 movzbl (%ebx),%edx + 3ba: 83 c3 01 add $0x1,%ebx + 3bd: 84 d2 test %dl,%dl + 3bf: 75 39 jne 3fa + 3c1: e9 c2 00 00 00 jmp 488 + 3c6: 66 90 xchg %ax,%ax + c = fmt[i] & 0xff; + if(state == 0){ + if(c == '%'){ + 3c8: 83 fa 25 cmp $0x25,%edx + 3cb: 0f 84 bf 00 00 00 je 490 + write(fd, &c, 1); + 3d1: 8d 45 e2 lea -0x1e(%ebp),%eax + 3d4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 3db: 00 + 3dc: 89 44 24 04 mov %eax,0x4(%esp) + 3e0: 89 34 24 mov %esi,(%esp) + state = '%'; + } else { + putc(fd, c); + 3e3: 88 55 e2 mov %dl,-0x1e(%ebp) + write(fd, &c, 1); + 3e6: e8 87 fe ff ff call 272 + 3eb: 83 c3 01 add $0x1,%ebx + for(i = 0; fmt[i]; i++){ + 3ee: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 3f2: 84 d2 test %dl,%dl + 3f4: 0f 84 8e 00 00 00 je 488 + if(state == 0){ + 3fa: 85 ff test %edi,%edi + c = fmt[i] & 0xff; + 3fc: 0f be c2 movsbl %dl,%eax + if(state == 0){ + 3ff: 74 c7 je 3c8 + } + } else if(state == '%'){ + 401: 83 ff 25 cmp $0x25,%edi + 404: 75 e5 jne 3eb + if(c == 'd'){ + 406: 83 fa 64 cmp $0x64,%edx + 409: 0f 84 31 01 00 00 je 540 + printint(fd, *ap, 10, 1); + ap++; + } else if(c == 'x' || c == 'p'){ + 40f: 25 f7 00 00 00 and $0xf7,%eax + 414: 83 f8 70 cmp $0x70,%eax + 417: 0f 84 83 00 00 00 je 4a0 + printint(fd, *ap, 16, 0); + ap++; + } else if(c == 's'){ + 41d: 83 fa 73 cmp $0x73,%edx + 420: 0f 84 a2 00 00 00 je 4c8 + s = "(null)"; + while(*s != 0){ + putc(fd, *s); + s++; + } + } else if(c == 'c'){ + 426: 83 fa 63 cmp $0x63,%edx + 429: 0f 84 35 01 00 00 je 564 + putc(fd, *ap); + ap++; + } else if(c == '%'){ + 42f: 83 fa 25 cmp $0x25,%edx + 432: 0f 84 e0 00 00 00 je 518 + write(fd, &c, 1); + 438: 8d 45 e6 lea -0x1a(%ebp),%eax + 43b: 83 c3 01 add $0x1,%ebx + 43e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 445: 00 + } else { + // Unknown % sequence. Print it to draw attention. + putc(fd, '%'); + putc(fd, c); + } + state = 0; + 446: 31 ff xor %edi,%edi + write(fd, &c, 1); + 448: 89 44 24 04 mov %eax,0x4(%esp) + 44c: 89 34 24 mov %esi,(%esp) + 44f: 89 55 d0 mov %edx,-0x30(%ebp) + 452: c6 45 e6 25 movb $0x25,-0x1a(%ebp) + 456: e8 17 fe ff ff call 272 + putc(fd, c); + 45b: 8b 55 d0 mov -0x30(%ebp),%edx + write(fd, &c, 1); + 45e: 8d 45 e7 lea -0x19(%ebp),%eax + 461: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 468: 00 + 469: 89 44 24 04 mov %eax,0x4(%esp) + 46d: 89 34 24 mov %esi,(%esp) + putc(fd, c); + 470: 88 55 e7 mov %dl,-0x19(%ebp) + write(fd, &c, 1); + 473: e8 fa fd ff ff call 272 + for(i = 0; fmt[i]; i++){ + 478: 0f b6 53 ff movzbl -0x1(%ebx),%edx + 47c: 84 d2 test %dl,%dl + 47e: 0f 85 76 ff ff ff jne 3fa + 484: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + } + } +} + 488: 83 c4 3c add $0x3c,%esp + 48b: 5b pop %ebx + 48c: 5e pop %esi + 48d: 5f pop %edi + 48e: 5d pop %ebp + 48f: c3 ret + state = '%'; + 490: bf 25 00 00 00 mov $0x25,%edi + 495: e9 51 ff ff ff jmp 3eb + 49a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 16, 0); + 4a0: 8b 45 d4 mov -0x2c(%ebp),%eax + 4a3: b9 10 00 00 00 mov $0x10,%ecx + state = 0; + 4a8: 31 ff xor %edi,%edi + printint(fd, *ap, 16, 0); + 4aa: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 4b1: 8b 10 mov (%eax),%edx + 4b3: 89 f0 mov %esi,%eax + 4b5: e8 46 fe ff ff call 300 + ap++; + 4ba: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 4be: e9 28 ff ff ff jmp 3eb + 4c3: 90 nop + 4c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + s = (char*)*ap; + 4c8: 8b 45 d4 mov -0x2c(%ebp),%eax + ap++; + 4cb: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + s = (char*)*ap; + 4cf: 8b 38 mov (%eax),%edi + s = "(null)"; + 4d1: b8 06 07 00 00 mov $0x706,%eax + 4d6: 85 ff test %edi,%edi + 4d8: 0f 44 f8 cmove %eax,%edi + while(*s != 0){ + 4db: 0f b6 07 movzbl (%edi),%eax + 4de: 84 c0 test %al,%al + 4e0: 74 2a je 50c + 4e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 4e8: 88 45 e3 mov %al,-0x1d(%ebp) + write(fd, &c, 1); + 4eb: 8d 45 e3 lea -0x1d(%ebp),%eax + s++; + 4ee: 83 c7 01 add $0x1,%edi + write(fd, &c, 1); + 4f1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 4f8: 00 + 4f9: 89 44 24 04 mov %eax,0x4(%esp) + 4fd: 89 34 24 mov %esi,(%esp) + 500: e8 6d fd ff ff call 272 + while(*s != 0){ + 505: 0f b6 07 movzbl (%edi),%eax + 508: 84 c0 test %al,%al + 50a: 75 dc jne 4e8 + state = 0; + 50c: 31 ff xor %edi,%edi + 50e: e9 d8 fe ff ff jmp 3eb + 513: 90 nop + 514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + write(fd, &c, 1); + 518: 8d 45 e5 lea -0x1b(%ebp),%eax + state = 0; + 51b: 31 ff xor %edi,%edi + write(fd, &c, 1); + 51d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 524: 00 + 525: 89 44 24 04 mov %eax,0x4(%esp) + 529: 89 34 24 mov %esi,(%esp) + 52c: c6 45 e5 25 movb $0x25,-0x1b(%ebp) + 530: e8 3d fd ff ff call 272 + 535: e9 b1 fe ff ff jmp 3eb + 53a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + printint(fd, *ap, 10, 1); + 540: 8b 45 d4 mov -0x2c(%ebp),%eax + 543: b9 0a 00 00 00 mov $0xa,%ecx + state = 0; + 548: 66 31 ff xor %di,%di + printint(fd, *ap, 10, 1); + 54b: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 552: 8b 10 mov (%eax),%edx + 554: 89 f0 mov %esi,%eax + 556: e8 a5 fd ff ff call 300 + ap++; + 55b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 55f: e9 87 fe ff ff jmp 3eb + putc(fd, *ap); + 564: 8b 45 d4 mov -0x2c(%ebp),%eax + state = 0; + 567: 31 ff xor %edi,%edi + putc(fd, *ap); + 569: 8b 00 mov (%eax),%eax + write(fd, &c, 1); + 56b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) + 572: 00 + 573: 89 34 24 mov %esi,(%esp) + putc(fd, *ap); + 576: 88 45 e4 mov %al,-0x1c(%ebp) + write(fd, &c, 1); + 579: 8d 45 e4 lea -0x1c(%ebp),%eax + 57c: 89 44 24 04 mov %eax,0x4(%esp) + 580: e8 ed fc ff ff call 272 + ap++; + 585: 83 45 d4 04 addl $0x4,-0x2c(%ebp) + 589: e9 5d fe ff ff jmp 3eb + 58e: 66 90 xchg %ax,%ax + +00000590 : +static Header base; +static Header *freep; + +void +free(void *ap) +{ + 590: 55 push %ebp + Header *bp, *p; + + bp = (Header*)ap - 1; + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 591: a1 84 09 00 00 mov 0x984,%eax +{ + 596: 89 e5 mov %esp,%ebp + 598: 57 push %edi + 599: 56 push %esi + 59a: 53 push %ebx + 59b: 8b 5d 08 mov 0x8(%ebp),%ebx + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 59e: 8b 08 mov (%eax),%ecx + bp = (Header*)ap - 1; + 5a0: 8d 53 f8 lea -0x8(%ebx),%edx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5a3: 39 d0 cmp %edx,%eax + 5a5: 72 11 jb 5b8 + 5a7: 90 nop + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5a8: 39 c8 cmp %ecx,%eax + 5aa: 72 04 jb 5b0 + 5ac: 39 ca cmp %ecx,%edx + 5ae: 72 10 jb 5c0 + 5b0: 89 c8 mov %ecx,%eax + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5b2: 39 d0 cmp %edx,%eax + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5b4: 8b 08 mov (%eax),%ecx + for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) + 5b6: 73 f0 jae 5a8 + 5b8: 39 ca cmp %ecx,%edx + 5ba: 72 04 jb 5c0 + if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) + 5bc: 39 c8 cmp %ecx,%eax + 5be: 72 f0 jb 5b0 + break; + if(bp + bp->s.size == p->s.ptr){ + 5c0: 8b 73 fc mov -0x4(%ebx),%esi + 5c3: 8d 3c f2 lea (%edx,%esi,8),%edi + 5c6: 39 cf cmp %ecx,%edi + 5c8: 74 1e je 5e8 + bp->s.size += p->s.ptr->s.size; + bp->s.ptr = p->s.ptr->s.ptr; + } else + bp->s.ptr = p->s.ptr; + 5ca: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 5cd: 8b 48 04 mov 0x4(%eax),%ecx + 5d0: 8d 34 c8 lea (%eax,%ecx,8),%esi + 5d3: 39 f2 cmp %esi,%edx + 5d5: 74 28 je 5ff + p->s.size += bp->s.size; + p->s.ptr = bp->s.ptr; + } else + p->s.ptr = bp; + 5d7: 89 10 mov %edx,(%eax) + freep = p; + 5d9: a3 84 09 00 00 mov %eax,0x984 +} + 5de: 5b pop %ebx + 5df: 5e pop %esi + 5e0: 5f pop %edi + 5e1: 5d pop %ebp + 5e2: c3 ret + 5e3: 90 nop + 5e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + bp->s.size += p->s.ptr->s.size; + 5e8: 03 71 04 add 0x4(%ecx),%esi + 5eb: 89 73 fc mov %esi,-0x4(%ebx) + bp->s.ptr = p->s.ptr->s.ptr; + 5ee: 8b 08 mov (%eax),%ecx + 5f0: 8b 09 mov (%ecx),%ecx + 5f2: 89 4b f8 mov %ecx,-0x8(%ebx) + if(p + p->s.size == bp){ + 5f5: 8b 48 04 mov 0x4(%eax),%ecx + 5f8: 8d 34 c8 lea (%eax,%ecx,8),%esi + 5fb: 39 f2 cmp %esi,%edx + 5fd: 75 d8 jne 5d7 + p->s.size += bp->s.size; + 5ff: 03 4b fc add -0x4(%ebx),%ecx + freep = p; + 602: a3 84 09 00 00 mov %eax,0x984 + p->s.size += bp->s.size; + 607: 89 48 04 mov %ecx,0x4(%eax) + p->s.ptr = bp->s.ptr; + 60a: 8b 53 f8 mov -0x8(%ebx),%edx + 60d: 89 10 mov %edx,(%eax) +} + 60f: 5b pop %ebx + 610: 5e pop %esi + 611: 5f pop %edi + 612: 5d pop %ebp + 613: c3 ret + 614: 8d b6 00 00 00 00 lea 0x0(%esi),%esi + 61a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi + +00000620 : + return freep; +} + +void* +malloc(uint nbytes) +{ + 620: 55 push %ebp + 621: 89 e5 mov %esp,%ebp + 623: 57 push %edi + 624: 56 push %esi + 625: 53 push %ebx + 626: 83 ec 1c sub $0x1c,%esp + Header *p, *prevp; + uint nunits; + + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 629: 8b 45 08 mov 0x8(%ebp),%eax + if((prevp = freep) == 0){ + 62c: 8b 1d 84 09 00 00 mov 0x984,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 632: 8d 48 07 lea 0x7(%eax),%ecx + 635: c1 e9 03 shr $0x3,%ecx + if((prevp = freep) == 0){ + 638: 85 db test %ebx,%ebx + nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; + 63a: 8d 71 01 lea 0x1(%ecx),%esi + if((prevp = freep) == 0){ + 63d: 0f 84 9b 00 00 00 je 6de + 643: 8b 13 mov (%ebx),%edx + 645: 8b 7a 04 mov 0x4(%edx),%edi + base.s.ptr = freep = prevp = &base; + base.s.size = 0; + } + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + if(p->s.size >= nunits){ + 648: 39 fe cmp %edi,%esi + 64a: 76 64 jbe 6b0 + 64c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax + if(nu < 4096) + 653: bb 00 80 00 00 mov $0x8000,%ebx + 658: 89 45 e4 mov %eax,-0x1c(%ebp) + 65b: eb 0e jmp 66b + 65d: 8d 76 00 lea 0x0(%esi),%esi + for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ + 660: 8b 02 mov (%edx),%eax + if(p->s.size >= nunits){ + 662: 8b 78 04 mov 0x4(%eax),%edi + 665: 39 fe cmp %edi,%esi + 667: 76 4f jbe 6b8 + 669: 89 c2 mov %eax,%edx + p->s.size = nunits; + } + freep = prevp; + return (void*)(p + 1); + } + if(p == freep) + 66b: 3b 15 84 09 00 00 cmp 0x984,%edx + 671: 75 ed jne 660 + if(nu < 4096) + 673: 8b 45 e4 mov -0x1c(%ebp),%eax + 676: 81 fe 00 10 00 00 cmp $0x1000,%esi + 67c: bf 00 10 00 00 mov $0x1000,%edi + 681: 0f 43 fe cmovae %esi,%edi + 684: 0f 42 c3 cmovb %ebx,%eax + p = sbrk(nu * sizeof(Header)); + 687: 89 04 24 mov %eax,(%esp) + 68a: e8 4b fc ff ff call 2da + if(p == (char*)-1) + 68f: 83 f8 ff cmp $0xffffffff,%eax + 692: 74 18 je 6ac + hp->s.size = nu; + 694: 89 78 04 mov %edi,0x4(%eax) + free((void*)(hp + 1)); + 697: 83 c0 08 add $0x8,%eax + 69a: 89 04 24 mov %eax,(%esp) + 69d: e8 ee fe ff ff call 590 + return freep; + 6a2: 8b 15 84 09 00 00 mov 0x984,%edx + if((p = morecore(nunits)) == 0) + 6a8: 85 d2 test %edx,%edx + 6aa: 75 b4 jne 660 + return 0; + 6ac: 31 c0 xor %eax,%eax + 6ae: eb 20 jmp 6d0 + if(p->s.size >= nunits){ + 6b0: 89 d0 mov %edx,%eax + 6b2: 89 da mov %ebx,%edx + 6b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + if(p->s.size == nunits) + 6b8: 39 fe cmp %edi,%esi + 6ba: 74 1c je 6d8 + p->s.size -= nunits; + 6bc: 29 f7 sub %esi,%edi + 6be: 89 78 04 mov %edi,0x4(%eax) + p += p->s.size; + 6c1: 8d 04 f8 lea (%eax,%edi,8),%eax + p->s.size = nunits; + 6c4: 89 70 04 mov %esi,0x4(%eax) + freep = prevp; + 6c7: 89 15 84 09 00 00 mov %edx,0x984 + return (void*)(p + 1); + 6cd: 83 c0 08 add $0x8,%eax + } +} + 6d0: 83 c4 1c add $0x1c,%esp + 6d3: 5b pop %ebx + 6d4: 5e pop %esi + 6d5: 5f pop %edi + 6d6: 5d pop %ebp + 6d7: c3 ret + prevp->s.ptr = p->s.ptr; + 6d8: 8b 08 mov (%eax),%ecx + 6da: 89 0a mov %ecx,(%edx) + 6dc: eb e9 jmp 6c7 + base.s.ptr = freep = prevp = &base; + 6de: c7 05 84 09 00 00 88 movl $0x988,0x984 + 6e5: 09 00 00 + base.s.size = 0; + 6e8: ba 88 09 00 00 mov $0x988,%edx + base.s.ptr = freep = prevp = &base; + 6ed: c7 05 88 09 00 00 88 movl $0x988,0x988 + 6f4: 09 00 00 + base.s.size = 0; + 6f7: c7 05 8c 09 00 00 00 movl $0x0,0x98c + 6fe: 00 00 00 + 701: e9 46 ff ff ff jmp 64c diff --git a/zombie.c b/zombie.c index ee817da89c..c96b92d071 100644 --- a/zombie.c +++ b/zombie.c @@ -10,5 +10,5 @@ main(void) { if(fork() > 0) sleep(5); // Let child exit before parent. - exit(); + exit(0); } diff --git a/zombie.d b/zombie.d new file mode 100644 index 0000000000..c3e36f5dea --- /dev/null +++ b/zombie.d @@ -0,0 +1 @@ +zombie.o: zombie.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/zombie.o b/zombie.o new file mode 100644 index 0000000000..754ee1aafa Binary files /dev/null and b/zombie.o differ diff --git a/zombie.sym b/zombie.sym new file mode 100644 index 0000000000..5408878724 --- /dev/null +++ b/zombie.sym @@ -0,0 +1,57 @@ +00000000 .text +00000706 .rodata +00000720 .eh_frame +00000984 .bss +00000000 .comment +00000000 .debug_aranges +00000000 .debug_info +00000000 .debug_abbrev +00000000 .debug_line +00000000 .debug_str +00000000 .debug_loc +00000000 .debug_ranges +00000000 zombie.c +00000000 ulib.c +00000000 printf.c +00000300 printint +0000070d digits.1354 +00000000 umalloc.c +00000984 freep +00000988 base +00000030 strcpy +000003a0 printf +00000220 memmove +0000029a mknod +00000140 gets +000002d2 getpid +00000620 malloc +000002e2 sleep +00000262 pipe +00000272 write +000002aa fstat +00000282 kill +000002c2 chdir +0000028a exec +0000025a wait +0000026a read +000002a2 unlink +0000024a fork +000002da sbrk +000002ea uptime +00000984 __bss_start +000000e0 memset +00000000 main +00000060 strcmp +000002ca dup +000001a0 stat +00000984 _edata +00000990 _end +000002b2 link +00000252 exit +000001f0 atoi +000000b0 strlen +00000292 open +00000100 strchr +000002ba mkdir +0000027a close +00000590 free