diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..3f52cc9 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c1d206d..0000000 --- a/.gitignore +++ /dev/null @@ -1,127 +0,0 @@ -# Created by https://www.toptal.com/developers/gitignore/api/c,cmake,macos,visualstudiocode -# Edit at https://www.toptal.com/developers/gitignore?templates=c,cmake,macos,visualstudiocode - -### C ### -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -### CMake ### -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps - -### CMake Patch ### -# External projects -*-prefix/ - -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### macOS Patch ### -# iCloud generated files -*.icloud - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets - -# Local History for Visual Studio Code -.history/ - -# Built Visual Studio Code Extensions -*.vsix - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history -.ionide - -# End of https://www.toptal.com/developers/gitignore/api/c,cmake,macos,visualstudiocode \ No newline at end of file diff --git a/README b/README index 842f487..453a142 100644 --- a/README +++ b/README @@ -1,48 +1,60 @@ -xv6 is a re-implementation of Dennis Ritchie's and Ken Thompson's Unix -Version 6 (v6). xv6 loosely follows the structure and style of v6, -but is implemented for a modern x86-based multiprocessor using ANSI C. - -ACKNOWLEDGMENTS - -xv6 is inspired by John Lions's Commentary on UNIX 6th Edition (Peer -to Peer Communications; ISBN: 1-57398-013-7; 1st edition (June 14, -2000)). See also https://pdos.csail.mit.edu/6.828/, which -provides pointers to on-line resources for v6. - -xv6 borrows code from the following sources: - JOS (asm.h, elf.h, mmu.h, bootasm.S, ide.c, console.c, and others) - Plan 9 (entryother.S, mp.h, mp.c, lapic.c) - FreeBSD (ioapic.c) - NetBSD (console.c) - -The following people have made contributions: Russ Cox (context switching, -locking), Cliff Frey (MP), Xiao Yu (MP), Nickolai Zeldovich, and Austin -Clements. - -We are also grateful for the bug reports and patches contributed by Silas -Boyd-Wickizer, Anton Burtsev, Cody Cutler, Mike CAT, Tej Chajed, eyalz800, -Nelson Elhage, Saar Ettinger, Alice Ferrazzi, Nathaniel Filardo, Peter -Froehlich, Yakir Goaron,Shivam Handa, Bryan Henry, Jim Huang, Alexander -Kapshuk, Anders Kaseorg, kehao95, Wolfgang Keller, Eddie Kohler, Austin -Liew, Imbar Marinescu, Yandong Mao, Matan Shabtay, Hitoshi Mitake, Carmi -Merimovich, Mark Morrissey, mtasm, Joel Nider, Greg Price, Ayan Shafqat, -Eldar Sehayek, Yongming Shen, Cam Tenny, tyfkda, Rafael Ubal, Warren -Toomey, Stephen Tu, Pablo Ventura, Xi Wang, Keiichi Watanabe, Nicolas -Wolovick, wxdao, Grant Wu, Jindong Zhang, Icenowy Zheng, and Zou Chang Wei. - -The code in the files that constitute xv6 is -Copyright 2006-2018 Frans Kaashoek, Robert Morris, and Russ Cox. - -ERROR REPORTS - -We switched our focus to xv6 on RISC-V; see the mit-pdos/xv6-riscv.git -repository on github.com. - -BUILDING AND RUNNING XV6 - -To build xv6 on an x86 ELF machine (like Linux or FreeBSD), run -"make". On non-x86 or non-ELF machines (like OS X, even on x86), you -will need to install a cross-compiler gcc suite capable of producing -x86 ELF binaries (see https://pdos.csail.mit.edu/6.828/). -Then run "make TOOLPREFIX=i386-jos-elf-". Now install the QEMU PC -simulator and run "make qemu". \ No newline at end of file +### linux환경에서 test를 하는 법 + +1. 터미널에서 다음 명령어를 실행합니다. + + ```bash + git clone https://github.com/SSUminiOS/A3teamOS/tree/main + ``` + +2. 터미널에서 makefile이 있는 디렉토리인 src에 접근을 합니다. + + ```bash + cd src + ``` + +3. 터미널에서 명령어로 make qemu-nox를 입력합니다. + + ```bash + make qemu-nox + ``` + +4. xv6를 실행 후 slabtest를 입력하여 출력 결과를 확인합니다. + + ```bash + slabtest + ``` + + +### docker환경에서 test를 하는 법 + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/033dbc13-afd8-4ad3-a580-798af2e64184/Untitled.png) + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/7db482d9-f9f6-4378-bb77-f43acf0eaac4/Untitled.png) + +git clone 이후, vscode에서 docker-compose 파일을 실행 `docker compose up -d` + +그리고 vscode 좌하단에 ><를 클릭하여 실행 중인 컨테이너에 연결을 누르고 /xv6에 연결 + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/54dff19d-6968-492c-a8e7-94fcef91ee06/Untitled.png) + +다음 vscode 파일 열기를 통해 `/home/ubuntu/src`경로에 접속 + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/97b005c3-c8da-4135-bc8c-ee554884d1b5/Untitled.png) + +`apt-update` 명령어 실행 + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/669ed7b5-d216-4471-931b-a6c6af04b0a8/Untitled.png) + +`apt-get install -y build-essential qemu gcc-multilib qemu-system-x86` 명령어 실행 + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/146531df-a8f9-4a64-aed9-13a6e1b2bf06/Untitled.png) + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/fe1db594-1fe7-4d95-9747-b1ea6453f037/Untitled.png) + +`make qemu-nox로 build`하고 `slabtest` 실행 시 테스트 결과 확인 가능 + +### 만약 make qemu-nox에서 `make: *** No rule to make target gnu/9/include/stdbool.h', needed by 'slab.o'. Stop.` 오류가 발생한 경우 + +![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/59c44148-42ff-4519-bc90-b5b36d84abcb/ac5df945-5985-4f05-b748-a088eadbbea2/Untitled.png) + +`apt install build-essential` 명령어 실행 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..875ab15 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + xv6: + platform: linux/amd64 + image: ubuntu:22.04 + container_name: xv6 + stdin_open: true + tty: true + volumes: + - ./src:/home/ubuntu/src \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..72596ac Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/.gdbinit.tmpl b/src/.gdbinit.tmpl new file mode 100644 index 0000000..f71681a --- /dev/null +++ b/src/.gdbinit.tmpl @@ -0,0 +1,27 @@ +set $lastcs = -1 + +define hook-stop + # There doesn't seem to be a good way to detect if we're in 16- or + # 32-bit mode, but in 32-bit mode we always run with CS == 8 in the + # kernel and CS == 35 in user space + if $cs == 8 || $cs == 35 + if $lastcs != 8 && $lastcs != 35 + set architecture i386 + end + x/i $pc + else + if $lastcs == -1 || $lastcs == 8 || $lastcs == 35 + set architecture i8086 + end + # Translate the segment:offset into a physical address + printf "[%4x:%4x] ", $cs, $eip + x/i $cs*16+$eip + end + set $lastcs = $cs +end + +echo + target remote localhost:1234\n +target remote localhost:1234 + +echo + symbol-file kernel\n +symbol-file kernel diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index c1d206d..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,127 +0,0 @@ -# Created by https://www.toptal.com/developers/gitignore/api/c,cmake,macos,visualstudiocode -# Edit at https://www.toptal.com/developers/gitignore?templates=c,cmake,macos,visualstudiocode - -### C ### -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -### CMake ### -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps - -### CMake Patch ### -# External projects -*-prefix/ - -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### macOS Patch ### -# iCloud generated files -*.icloud - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets - -# Local History for Visual Studio Code -.history/ - -# Built Visual Studio Code Extensions -*.vsix - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history -.ionide - -# End of https://www.toptal.com/developers/gitignore/api/c,cmake,macos,visualstudiocode \ No newline at end of file diff --git a/src/.vscode/settings.json b/src/.vscode/settings.json new file mode 100644 index 0000000..c7775be --- /dev/null +++ b/src/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "slab.h": "c" + } +} \ No newline at end of file diff --git a/src/.vscode/tasks.json b/src/.vscode/tasks.json new file mode 100644 index 0000000..08d9005 --- /dev/null +++ b/src/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc build active file", + "command": "/usr/bin/gcc", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/src/LICENSE b/src/LICENSE new file mode 100644 index 0000000..422c0cc --- /dev/null +++ b/src/LICENSE @@ -0,0 +1,24 @@ +The xv6 software is: + +Copyright (c) 2006-2018 Frans Kaashoek, Robert Morris, Russ Cox, + Massachusetts Institute of Technology + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..afdded3 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,294 @@ +OBJS = \ + bio.o\ + console.o\ + exec.o\ + file.o\ + fs.o\ + ide.o\ + ioapic.o\ + kalloc.o\ + kbd.o\ + lapic.o\ + log.o\ + main.o\ + mp.o\ + picirq.o\ + pipe.o\ + proc.o\ + sleeplock.o\ + spinlock.o\ + string.o\ + swtch.o\ + syscall.o\ + sysfile.o\ + sysproc.o\ + trapasm.o\ + trap.o\ + uart.o\ + vectors.o\ + vm.o\ + slab.o\ + slabtest.o\ + sysslab.o\ + +# Cross-compiling (e.g., on Mac OS X) +# TOOLPREFIX = i386-jos-elf + +# Using native tools (e.g., on X86 Linux) +#TOOLPREFIX = + +# Try to infer the correct TOOLPREFIX if not set +ifndef TOOLPREFIX +TOOLPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \ + then echo 'i386-jos-elf-'; \ + elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \ + then echo ''; \ + else echo "***" 1>&2; \ + echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \ + echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \ + echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \ + echo "*** prefix other than 'i386-jos-elf-', set your TOOLPREFIX" 1>&2; \ + echo "*** environment variable to that prefix and run 'make' again." 1>&2; \ + echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \ + echo "***" 1>&2; exit 1; fi) +endif + +# If the makefile can't find QEMU, specify its path here +# QEMU = qemu-system-i386 + +# Try to infer the correct QEMU +ifndef QEMU +QEMU = $(shell if which qemu > /dev/null; \ + then echo qemu; exit; \ + elif which qemu-system-i386 > /dev/null; \ + then echo qemu-system-i386; exit; \ + elif which qemu-system-x86_64 > /dev/null; \ + then echo qemu-system-x86_64; exit; \ + else \ + qemu=/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu; \ + if test -x $$qemu; then echo $$qemu; exit; fi; fi; \ + echo "***" 1>&2; \ + echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \ + echo "*** Is the directory containing the qemu binary in your PATH" 1>&2; \ + echo "*** or have you tried setting the QEMU variable in Makefile?" 1>&2; \ + echo "***" 1>&2; exit 1) +endif + +CC = $(TOOLPREFIX)gcc +AS = $(TOOLPREFIX)gas +LD = $(TOOLPREFIX)ld +OBJCOPY = $(TOOLPREFIX)objcopy +OBJDUMP = $(TOOLPREFIX)objdump +CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O1 -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer +#CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer +CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector) +CFLAGS += -I. +ASFLAGS = -m32 -gdwarf-2 -Wa,-divide +# FreeBSD ld wants ``elf_i386_fbsd'' +LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null | head -n 1) + +# Disable PIE when possible (for Ubuntu 16.10 toolchain) +ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]no-pie'),) +CFLAGS += -fno-pie -no-pie +endif +ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]nopie'),) +CFLAGS += -fno-pie -nopie +endif + +xv6.img: bootblock kernel + dd if=/dev/zero of=xv6.img count=10000 + dd if=bootblock of=xv6.img conv=notrunc + dd if=kernel of=xv6.img seek=1 conv=notrunc + +xv6memfs.img: bootblock kernelmemfs + dd if=/dev/zero of=xv6memfs.img count=10000 + dd if=bootblock of=xv6memfs.img conv=notrunc + dd if=kernelmemfs of=xv6memfs.img seek=1 conv=notrunc + +bootblock: bootasm.S bootmain.c + $(CC) $(CFLAGS) -fno-pic -O -nostdinc -I. -c bootmain.c + $(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c bootasm.S + $(LD) $(LDFLAGS) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o + $(OBJDUMP) -S bootblock.o > bootblock.asm + $(OBJCOPY) -S -O binary -j .text bootblock.o bootblock + ./sign.pl bootblock + +entryother: entryother.S + $(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c entryother.S + $(LD) $(LDFLAGS) -N -e start -Ttext 0x7000 -o bootblockother.o entryother.o + $(OBJCOPY) -S -O binary -j .text bootblockother.o entryother + $(OBJDUMP) -S bootblockother.o > entryother.asm + +initcode: initcode.S + $(CC) $(CFLAGS) -nostdinc -I. -c initcode.S + $(LD) $(LDFLAGS) -N -e start -Ttext 0 -o initcode.out initcode.o + $(OBJCOPY) -S -O binary initcode.out initcode + $(OBJDUMP) -S initcode.o > initcode.asm + +kernel: $(OBJS) entry.o entryother initcode kernel.ld + $(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS) -b binary initcode entryother + $(OBJDUMP) -S kernel > kernel.asm + $(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym + +# kernelmemfs is a copy of kernel that maintains the +# disk image in memory instead of writing to a disk. +# This is not so useful for testing persistent storage or +# exploring disk buffering implementations, but it is +# great for testing the kernel on real hardware without +# needing a scratch disk. +MEMFSOBJS = $(filter-out ide.o,$(OBJS)) memide.o +kernelmemfs: $(MEMFSOBJS) entry.o entryother initcode kernel.ld fs.img + $(LD) $(LDFLAGS) -T kernel.ld -o kernelmemfs entry.o $(MEMFSOBJS) -b binary initcode entryother fs.img + $(OBJDUMP) -S kernelmemfs > kernelmemfs.asm + $(OBJDUMP) -t kernelmemfs | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernelmemfs.sym + +tags: $(OBJS) entryother.S _init + etags *.S *.c + +vectors.S: vectors.pl + ./vectors.pl > vectors.S + +ULIB = ulib.o usys.o printf.o umalloc.o + +_%: %.o $(ULIB) + $(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^ + $(OBJDUMP) -S $@ > $*.asm + $(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym + +_forktest: forktest.o $(ULIB) + # forktest has less library code linked in - needs to be small + # in order to be able to max out the proc table. + $(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o + $(OBJDUMP) -S _forktest > forktest.asm + +mkfs: mkfs.c fs.h + gcc -Werror -Wall -o mkfs mkfs.c + +# Prevent deletion of intermediate files, e.g. cat.o, after first build, so +# that disk image changes after first build are persistent until clean. More +# details: +# http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html +.PRECIOUS: %.o + +U=user +UPROGS=\ + $U/_cat\ + $U/_echo\ + $U/_forktest\ + $U/_grep\ + $U/_init\ + $U/_kill\ + $U/_ln\ + $U/_ls\ + $U/_mkdir\ + $U/_rm\ + $U/_sh\ + $U/_stressfs\ + $U/_usertests\ + $U/_wc\ + $U/_zombie\ + $U/_slabtest\ + $U/_ps\ + +fs.img: mkfs README $(UPROGS) + ./mkfs fs.img README $(UPROGS) + +-include *.d + +clean: + rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \ + *.o *.d *.asm *.sym vectors.S bootblock entryother \ + initcode initcode.out kernel xv6.img fs.img kernelmemfs \ + xv6memfs.img mkfs .gdbinit \ + $(UPROGS) $(U)/*.o $(U)/*.d $(U)/*.asm $(U)/*.sym + +# make a printout +FILES = $(shell grep -v '^\#' runoff.list) +PRINT = runoff.list runoff.spec README toc.hdr toc.ftr $(FILES) + +xv6.pdf: $(PRINT) + ./runoff + ls -l xv6.pdf + +print: xv6.pdf + +# run in emulators + +bochs : fs.img xv6.img + if [ ! -e .bochsrc ]; then ln -s dot-bochsrc .bochsrc; fi + bochs -q + +# try to generate a unique GDB port +GDBPORT = $(shell expr `id -u` % 5000 + 25000) +# QEMU's gdb stub command line changed in 0.11 +QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \ + then echo "-gdb tcp::$(GDBPORT)"; \ + else echo "-s -p $(GDBPORT)"; fi) +ifndef CPUS +CPUS := 1 +endif +QEMUOPTS = -drive file=fs.img,index=1,media=disk,format=raw -drive file=xv6.img,index=0,media=disk,format=raw -smp $(CPUS) -m 512 $(QEMUEXTRA) + +qemu: fs.img xv6.img + $(QEMU) -serial mon:stdio $(QEMUOPTS) + +qemu-memfs: xv6memfs.img + $(QEMU) -drive file=xv6memfs.img,index=0,media=disk,format=raw -smp $(CPUS) -m 256 + +qemu-nox: fs.img xv6.img + $(QEMU) -nographic $(QEMUOPTS) + +.gdbinit: .gdbinit.tmpl + sed "s/localhost:1234/localhost:$(GDBPORT)/" < $^ > $@ + +qemu-gdb: fs.img xv6.img .gdbinit + @echo "*** Now run 'gdb'." 1>&2 + $(QEMU) -serial mon:stdio $(QEMUOPTS) -S $(QEMUGDB) + +qemu-nox-gdb: fs.img xv6.img .gdbinit + @echo "*** Now run 'gdb'." 1>&2 + $(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB) + +# CUT HERE +# prepare dist for students +# after running make dist, probably want to +# rename it to rev0 or rev1 or so on and then +# check in that version. + +EXTRA=\ + mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\ + ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\ + printf.c umalloc.c\ + README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\ + .gdbinit.tmpl gdbutil\ + +dist: + rm -rf dist + mkdir dist + for i in $(FILES); \ + do \ + grep -v PAGEBREAK $$i >dist/$$i; \ + done + sed '/CUT HERE/,$$d' Makefile >dist/Makefile + echo >dist/runoff.spec + cp $(EXTRA) dist + +dist-test: + rm -rf dist + make dist + rm -rf dist-test + mkdir dist-test + cp dist/* dist-test + cd dist-test; $(MAKE) print + cd dist-test; $(MAKE) bochs || true + cd dist-test; $(MAKE) qemu + +# update this rule (change rev#) when it is time to +# make a new revision. +tar: + rm -rf /tmp/xv6 + mkdir -p /tmp/xv6 + cp dist/* dist/.gdbinit.tmpl /tmp/xv6 + (cd /tmp; tar cf - xv6) | gzip >xv6-rev10.tar.gz # the next one will be 10 (9/17) + +.PHONY: dist-test dist diff --git a/src/README b/src/README new file mode 100644 index 0000000..842f487 --- /dev/null +++ b/src/README @@ -0,0 +1,48 @@ +xv6 is a re-implementation of Dennis Ritchie's and Ken Thompson's Unix +Version 6 (v6). xv6 loosely follows the structure and style of v6, +but is implemented for a modern x86-based multiprocessor using ANSI C. + +ACKNOWLEDGMENTS + +xv6 is inspired by John Lions's Commentary on UNIX 6th Edition (Peer +to Peer Communications; ISBN: 1-57398-013-7; 1st edition (June 14, +2000)). See also https://pdos.csail.mit.edu/6.828/, which +provides pointers to on-line resources for v6. + +xv6 borrows code from the following sources: + JOS (asm.h, elf.h, mmu.h, bootasm.S, ide.c, console.c, and others) + Plan 9 (entryother.S, mp.h, mp.c, lapic.c) + FreeBSD (ioapic.c) + NetBSD (console.c) + +The following people have made contributions: Russ Cox (context switching, +locking), Cliff Frey (MP), Xiao Yu (MP), Nickolai Zeldovich, and Austin +Clements. + +We are also grateful for the bug reports and patches contributed by Silas +Boyd-Wickizer, Anton Burtsev, Cody Cutler, Mike CAT, Tej Chajed, eyalz800, +Nelson Elhage, Saar Ettinger, Alice Ferrazzi, Nathaniel Filardo, Peter +Froehlich, Yakir Goaron,Shivam Handa, Bryan Henry, Jim Huang, Alexander +Kapshuk, Anders Kaseorg, kehao95, Wolfgang Keller, Eddie Kohler, Austin +Liew, Imbar Marinescu, Yandong Mao, Matan Shabtay, Hitoshi Mitake, Carmi +Merimovich, Mark Morrissey, mtasm, Joel Nider, Greg Price, Ayan Shafqat, +Eldar Sehayek, Yongming Shen, Cam Tenny, tyfkda, Rafael Ubal, Warren +Toomey, Stephen Tu, Pablo Ventura, Xi Wang, Keiichi Watanabe, Nicolas +Wolovick, wxdao, Grant Wu, Jindong Zhang, Icenowy Zheng, and Zou Chang Wei. + +The code in the files that constitute xv6 is +Copyright 2006-2018 Frans Kaashoek, Robert Morris, and Russ Cox. + +ERROR REPORTS + +We switched our focus to xv6 on RISC-V; see the mit-pdos/xv6-riscv.git +repository on github.com. + +BUILDING AND RUNNING XV6 + +To build xv6 on an x86 ELF machine (like Linux or FreeBSD), run +"make". On non-x86 or non-ELF machines (like OS X, even on x86), you +will need to install a cross-compiler gcc suite capable of producing +x86 ELF binaries (see https://pdos.csail.mit.edu/6.828/). +Then run "make TOOLPREFIX=i386-jos-elf-". Now install the QEMU PC +simulator and run "make qemu". \ No newline at end of file diff --git a/src/bio.d b/src/bio.d new file mode 100644 index 0000000..b4bbd30 --- /dev/null +++ b/src/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/src/bio.o b/src/bio.o new file mode 100644 index 0000000..b38357b Binary files /dev/null and b/src/bio.o differ diff --git a/src/bootasm.d b/src/bootasm.d new file mode 100644 index 0000000..3b3dc19 --- /dev/null +++ b/src/bootasm.d @@ -0,0 +1 @@ +bootasm.o: bootasm.S asm.h memlayout.h mmu.h diff --git a/src/bootasm.o b/src/bootasm.o new file mode 100644 index 0000000..4347d69 Binary files /dev/null and b/src/bootasm.o differ diff --git a/src/bootblock b/src/bootblock index ed06193..202d24f 100755 Binary files a/src/bootblock and b/src/bootblock differ diff --git a/src/bootblock.asm b/src/bootblock.asm index 0062ca4..ee41e37 100644 --- a/src/bootblock.asm +++ b/src/bootblock.asm @@ -60,7 +60,7 @@ seta20.2: # effective memory map doesn't change during the transition. lgdt gdtdesc 7c1d: 0f 01 16 lgdtl (%esi) - 7c20: 78 7c js 7c9e + 7c20: 78 7c js 7c9e movl %cr0, %eax 7c22: 0f 20 c0 mov %cr0,%eax orl $CR0_PE, %eax @@ -100,7 +100,7 @@ start32: movl $start, %esp 7c43: bc 00 7c 00 00 mov $0x7c00,%esp call bootmain - 7c48: e8 fc 00 00 00 call 7d49 + 7c48: e8 f0 00 00 00 call 7d3d # If bootmain returns (it shouldn't), trigger a Bochs # breakpoint if running under Bochs, then loop. @@ -138,224 +138,218 @@ spin: ... 00007c7e : - entry(); -} - -void -waitdisk(void) -{ - 7c7e: f3 0f 1e fb endbr32 static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); - 7c82: ba f7 01 00 00 mov $0x1f7,%edx - 7c87: ec in (%dx),%al + 7c7e: ba f7 01 00 00 mov $0x1f7,%edx + 7c83: ec in (%dx),%al + +void +waitdisk(void) +{ // Wait for disk ready. while((inb(0x1F7) & 0xC0) != 0x40) - 7c88: 83 e0 c0 and $0xffffffc0,%eax - 7c8b: 3c 40 cmp $0x40,%al - 7c8d: 75 f8 jne 7c87 + 7c84: 83 e0 c0 and $0xffffffc0,%eax + 7c87: 3c 40 cmp $0x40,%al + 7c89: 75 f8 jne 7c83 ; } - 7c8f: c3 ret + 7c8b: c3 ret -00007c90 : +00007c8c : // Read a single sector at offset into dst. void readsect(void *dst, uint offset) { - 7c90: f3 0f 1e fb endbr32 - 7c94: 55 push %ebp - 7c95: 89 e5 mov %esp,%ebp - 7c97: 57 push %edi - 7c98: 53 push %ebx - 7c99: 8b 5d 0c mov 0xc(%ebp),%ebx + 7c8c: 55 push %ebp + 7c8d: 89 e5 mov %esp,%ebp + 7c8f: 57 push %edi + 7c90: 53 push %ebx + 7c91: 8b 5d 0c mov 0xc(%ebp),%ebx // Issue command. waitdisk(); - 7c9c: e8 dd ff ff ff call 7c7e + 7c94: e8 e5 ff ff ff call 7c7e } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); - 7ca1: b8 01 00 00 00 mov $0x1,%eax - 7ca6: ba f2 01 00 00 mov $0x1f2,%edx + 7c99: b8 01 00 00 00 mov $0x1,%eax + 7c9e: ba f2 01 00 00 mov $0x1f2,%edx + 7ca3: ee out %al,(%dx) + 7ca4: ba f3 01 00 00 mov $0x1f3,%edx + 7ca9: 89 d8 mov %ebx,%eax 7cab: ee out %al,(%dx) - 7cac: ba f3 01 00 00 mov $0x1f3,%edx - 7cb1: 89 d8 mov %ebx,%eax - 7cb3: ee out %al,(%dx) outb(0x1F2, 1); // count = 1 outb(0x1F3, offset); outb(0x1F4, offset >> 8); - 7cb4: 89 d8 mov %ebx,%eax - 7cb6: c1 e8 08 shr $0x8,%eax - 7cb9: ba f4 01 00 00 mov $0x1f4,%edx - 7cbe: ee out %al,(%dx) + 7cac: 89 d8 mov %ebx,%eax + 7cae: c1 e8 08 shr $0x8,%eax + 7cb1: ba f4 01 00 00 mov $0x1f4,%edx + 7cb6: ee out %al,(%dx) outb(0x1F5, offset >> 16); - 7cbf: 89 d8 mov %ebx,%eax - 7cc1: c1 e8 10 shr $0x10,%eax - 7cc4: ba f5 01 00 00 mov $0x1f5,%edx - 7cc9: ee out %al,(%dx) + 7cb7: 89 d8 mov %ebx,%eax + 7cb9: c1 e8 10 shr $0x10,%eax + 7cbc: ba f5 01 00 00 mov $0x1f5,%edx + 7cc1: ee out %al,(%dx) outb(0x1F6, (offset >> 24) | 0xE0); - 7cca: 89 d8 mov %ebx,%eax - 7ccc: c1 e8 18 shr $0x18,%eax - 7ccf: 83 c8 e0 or $0xffffffe0,%eax - 7cd2: ba f6 01 00 00 mov $0x1f6,%edx - 7cd7: ee out %al,(%dx) - 7cd8: b8 20 00 00 00 mov $0x20,%eax - 7cdd: ba f7 01 00 00 mov $0x1f7,%edx - 7ce2: ee out %al,(%dx) + 7cc2: 89 d8 mov %ebx,%eax + 7cc4: c1 e8 18 shr $0x18,%eax + 7cc7: 83 c8 e0 or $0xffffffe0,%eax + 7cca: ba f6 01 00 00 mov $0x1f6,%edx + 7ccf: ee out %al,(%dx) + 7cd0: b8 20 00 00 00 mov $0x20,%eax + 7cd5: ba f7 01 00 00 mov $0x1f7,%edx + 7cda: ee out %al,(%dx) outb(0x1F7, 0x20); // cmd 0x20 - read sectors // Read data. waitdisk(); - 7ce3: e8 96 ff ff ff call 7c7e + 7cdb: e8 9e ff ff ff call 7c7e asm volatile("cld; rep insl" : - 7ce8: 8b 7d 08 mov 0x8(%ebp),%edi - 7ceb: b9 80 00 00 00 mov $0x80,%ecx - 7cf0: ba f0 01 00 00 mov $0x1f0,%edx - 7cf5: fc cld - 7cf6: f3 6d rep insl (%dx),%es:(%edi) + 7ce0: 8b 7d 08 mov 0x8(%ebp),%edi + 7ce3: b9 80 00 00 00 mov $0x80,%ecx + 7ce8: ba f0 01 00 00 mov $0x1f0,%edx + 7ced: fc cld + 7cee: f3 6d rep insl (%dx),%es:(%edi) insl(0x1F0, dst, SECTSIZE/4); } - 7cf8: 5b pop %ebx - 7cf9: 5f pop %edi - 7cfa: 5d pop %ebp - 7cfb: c3 ret + 7cf0: 5b pop %ebx + 7cf1: 5f pop %edi + 7cf2: 5d pop %ebp + 7cf3: c3 ret -00007cfc : +00007cf4 : // Read 'count' bytes at 'offset' from kernel into physical address 'pa'. // Might copy more than asked. void readseg(uchar* pa, uint count, uint offset) { - 7cfc: f3 0f 1e fb endbr32 - 7d00: 55 push %ebp - 7d01: 89 e5 mov %esp,%ebp - 7d03: 57 push %edi - 7d04: 56 push %esi - 7d05: 53 push %ebx - 7d06: 83 ec 0c sub $0xc,%esp - 7d09: 8b 5d 08 mov 0x8(%ebp),%ebx - 7d0c: 8b 75 10 mov 0x10(%ebp),%esi + 7cf4: 55 push %ebp + 7cf5: 89 e5 mov %esp,%ebp + 7cf7: 57 push %edi + 7cf8: 56 push %esi + 7cf9: 53 push %ebx + 7cfa: 83 ec 0c sub $0xc,%esp + 7cfd: 8b 5d 08 mov 0x8(%ebp),%ebx + 7d00: 8b 75 10 mov 0x10(%ebp),%esi uchar* epa; epa = pa + count; - 7d0f: 89 df mov %ebx,%edi - 7d11: 03 7d 0c add 0xc(%ebp),%edi + 7d03: 89 df mov %ebx,%edi + 7d05: 03 7d 0c add 0xc(%ebp),%edi // Round down to sector boundary. pa -= offset % SECTSIZE; - 7d14: 89 f0 mov %esi,%eax - 7d16: 25 ff 01 00 00 and $0x1ff,%eax - 7d1b: 29 c3 sub %eax,%ebx + 7d08: 89 f0 mov %esi,%eax + 7d0a: 25 ff 01 00 00 and $0x1ff,%eax + 7d0f: 29 c3 sub %eax,%ebx // Translate from bytes to sectors; kernel starts at sector 1. offset = (offset / SECTSIZE) + 1; - 7d1d: c1 ee 09 shr $0x9,%esi - 7d20: 83 c6 01 add $0x1,%esi + 7d11: c1 ee 09 shr $0x9,%esi + 7d14: 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++) - 7d23: 39 df cmp %ebx,%edi - 7d25: 76 1a jbe 7d41 + 7d17: 39 df cmp %ebx,%edi + 7d19: 76 1a jbe 7d35 readsect(pa, offset); - 7d27: 83 ec 08 sub $0x8,%esp - 7d2a: 56 push %esi - 7d2b: 53 push %ebx - 7d2c: e8 5f ff ff ff call 7c90 + 7d1b: 83 ec 08 sub $0x8,%esp + 7d1e: 56 push %esi + 7d1f: 53 push %ebx + 7d20: e8 67 ff ff ff call 7c8c for(; pa < epa; pa += SECTSIZE, offset++) - 7d31: 81 c3 00 02 00 00 add $0x200,%ebx - 7d37: 83 c6 01 add $0x1,%esi - 7d3a: 83 c4 10 add $0x10,%esp - 7d3d: 39 df cmp %ebx,%edi - 7d3f: 77 e6 ja 7d27 + 7d25: 81 c3 00 02 00 00 add $0x200,%ebx + 7d2b: 83 c6 01 add $0x1,%esi + 7d2e: 83 c4 10 add $0x10,%esp + 7d31: 39 df cmp %ebx,%edi + 7d33: 77 e6 ja 7d1b } - 7d41: 8d 65 f4 lea -0xc(%ebp),%esp - 7d44: 5b pop %ebx - 7d45: 5e pop %esi - 7d46: 5f pop %edi - 7d47: 5d pop %ebp - 7d48: c3 ret - -00007d49 : + 7d35: 8d 65 f4 lea -0xc(%ebp),%esp + 7d38: 5b pop %ebx + 7d39: 5e pop %esi + 7d3a: 5f pop %edi + 7d3b: 5d pop %ebp + 7d3c: c3 ret + +00007d3d : { - 7d49: f3 0f 1e fb endbr32 - 7d4d: 55 push %ebp - 7d4e: 89 e5 mov %esp,%ebp - 7d50: 57 push %edi - 7d51: 56 push %esi - 7d52: 53 push %ebx - 7d53: 83 ec 10 sub $0x10,%esp + 7d3d: 55 push %ebp + 7d3e: 89 e5 mov %esp,%ebp + 7d40: 57 push %edi + 7d41: 56 push %esi + 7d42: 53 push %ebx + 7d43: 83 ec 10 sub $0x10,%esp readseg((uchar*)elf, 4096, 0); - 7d56: 6a 00 push $0x0 - 7d58: 68 00 10 00 00 push $0x1000 - 7d5d: 68 00 00 01 00 push $0x10000 - 7d62: e8 95 ff ff ff call 7cfc + 7d46: 6a 00 push $0x0 + 7d48: 68 00 10 00 00 push $0x1000 + 7d4d: 68 00 00 01 00 push $0x10000 + 7d52: e8 9d ff ff ff call 7cf4 if(elf->magic != ELF_MAGIC) - 7d67: 83 c4 10 add $0x10,%esp - 7d6a: 81 3d 00 00 01 00 7f cmpl $0x464c457f,0x10000 - 7d71: 45 4c 46 - 7d74: 75 21 jne 7d97 + 7d57: 83 c4 10 add $0x10,%esp + 7d5a: 81 3d 00 00 01 00 7f cmpl $0x464c457f,0x10000 + 7d61: 45 4c 46 + 7d64: 75 21 jne 7d87 ph = (struct proghdr*)((uchar*)elf + elf->phoff); - 7d76: a1 1c 00 01 00 mov 0x1001c,%eax - 7d7b: 8d 98 00 00 01 00 lea 0x10000(%eax),%ebx + 7d66: a1 1c 00 01 00 mov 0x1001c,%eax + 7d6b: 8d 98 00 00 01 00 lea 0x10000(%eax),%ebx eph = ph + elf->phnum; - 7d81: 0f b7 35 2c 00 01 00 movzwl 0x1002c,%esi - 7d88: c1 e6 05 shl $0x5,%esi - 7d8b: 01 de add %ebx,%esi + 7d71: 0f b7 35 2c 00 01 00 movzwl 0x1002c,%esi + 7d78: c1 e6 05 shl $0x5,%esi + 7d7b: 01 de add %ebx,%esi for(; ph < eph; ph++){ - 7d8d: 39 f3 cmp %esi,%ebx - 7d8f: 72 15 jb 7da6 + 7d7d: 39 f3 cmp %esi,%ebx + 7d7f: 72 15 jb 7d96 entry(); - 7d91: ff 15 18 00 01 00 call *0x10018 + 7d81: ff 15 18 00 01 00 call *0x10018 } - 7d97: 8d 65 f4 lea -0xc(%ebp),%esp - 7d9a: 5b pop %ebx - 7d9b: 5e pop %esi - 7d9c: 5f pop %edi - 7d9d: 5d pop %ebp - 7d9e: c3 ret + 7d87: 8d 65 f4 lea -0xc(%ebp),%esp + 7d8a: 5b pop %ebx + 7d8b: 5e pop %esi + 7d8c: 5f pop %edi + 7d8d: 5d pop %ebp + 7d8e: c3 ret for(; ph < eph; ph++){ - 7d9f: 83 c3 20 add $0x20,%ebx - 7da2: 39 de cmp %ebx,%esi - 7da4: 76 eb jbe 7d91 + 7d8f: 83 c3 20 add $0x20,%ebx + 7d92: 39 de cmp %ebx,%esi + 7d94: 76 eb jbe 7d81 pa = (uchar*)ph->paddr; - 7da6: 8b 7b 0c mov 0xc(%ebx),%edi + 7d96: 8b 7b 0c mov 0xc(%ebx),%edi readseg(pa, ph->filesz, ph->off); - 7da9: 83 ec 04 sub $0x4,%esp - 7dac: ff 73 04 pushl 0x4(%ebx) - 7daf: ff 73 10 pushl 0x10(%ebx) - 7db2: 57 push %edi - 7db3: e8 44 ff ff ff call 7cfc + 7d99: 83 ec 04 sub $0x4,%esp + 7d9c: ff 73 04 push 0x4(%ebx) + 7d9f: ff 73 10 push 0x10(%ebx) + 7da2: 57 push %edi + 7da3: e8 4c ff ff ff call 7cf4 if(ph->memsz > ph->filesz) - 7db8: 8b 4b 14 mov 0x14(%ebx),%ecx - 7dbb: 8b 43 10 mov 0x10(%ebx),%eax - 7dbe: 83 c4 10 add $0x10,%esp - 7dc1: 39 c1 cmp %eax,%ecx - 7dc3: 76 da jbe 7d9f + 7da8: 8b 4b 14 mov 0x14(%ebx),%ecx + 7dab: 8b 43 10 mov 0x10(%ebx),%eax + 7dae: 83 c4 10 add $0x10,%esp + 7db1: 39 c1 cmp %eax,%ecx + 7db3: 76 da jbe 7d8f stosb(pa + ph->filesz, 0, ph->memsz - ph->filesz); - 7dc5: 01 c7 add %eax,%edi - 7dc7: 29 c1 sub %eax,%ecx + 7db5: 01 c7 add %eax,%edi + 7db7: 29 c1 sub %eax,%ecx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 7dc9: b8 00 00 00 00 mov $0x0,%eax - 7dce: fc cld - 7dcf: f3 aa rep stos %al,%es:(%edi) + 7db9: b8 00 00 00 00 mov $0x0,%eax + 7dbe: fc cld + 7dbf: f3 aa rep stos %al,%es:(%edi) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } - 7dd1: eb cc jmp 7d9f + 7dc1: eb cc jmp 7d8f diff --git a/src/bootblock.o b/src/bootblock.o new file mode 100755 index 0000000..457d787 Binary files /dev/null and b/src/bootblock.o differ diff --git a/src/bootblockother.o b/src/bootblockother.o new file mode 100755 index 0000000..091fcf5 Binary files /dev/null and b/src/bootblockother.o differ diff --git a/src/bootmain.d b/src/bootmain.d new file mode 100644 index 0000000..b32eaf5 --- /dev/null +++ b/src/bootmain.d @@ -0,0 +1 @@ +bootmain.o: bootmain.c types.h elf.h x86.h memlayout.h diff --git a/src/bootmain.o b/src/bootmain.o new file mode 100644 index 0000000..29ffe4d Binary files /dev/null and b/src/bootmain.o differ diff --git a/src/console.d b/src/console.d new file mode 100644 index 0000000..7b5564c --- /dev/null +++ b/src/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/src/console.o b/src/console.o new file mode 100644 index 0000000..9b62423 Binary files /dev/null and b/src/console.o differ diff --git a/src/entry.o b/src/entry.o new file mode 100644 index 0000000..9f5f071 Binary files /dev/null and b/src/entry.o differ diff --git a/src/entryother.d b/src/entryother.d new file mode 100644 index 0000000..a140303 --- /dev/null +++ b/src/entryother.d @@ -0,0 +1 @@ +entryother.o: entryother.S asm.h memlayout.h mmu.h diff --git a/src/entryother.o b/src/entryother.o new file mode 100644 index 0000000..3acb40f Binary files /dev/null and b/src/entryother.o differ diff --git a/src/exec.d b/src/exec.d new file mode 100644 index 0000000..0400275 --- /dev/null +++ b/src/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/src/exec.o b/src/exec.o new file mode 100644 index 0000000..1ef4de4 Binary files /dev/null and b/src/exec.o differ diff --git a/src/file.d b/src/file.d new file mode 100644 index 0000000..fea73d1 --- /dev/null +++ b/src/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/src/file.o b/src/file.o new file mode 100644 index 0000000..4c7d28b Binary files /dev/null and b/src/file.o differ diff --git a/src/fs.d b/src/fs.d new file mode 100644 index 0000000..a1d05cc --- /dev/null +++ b/src/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/src/fs.img b/src/fs.img index f5c7710..0cdad6b 100644 Binary files a/src/fs.img and b/src/fs.img differ diff --git a/src/fs.o b/src/fs.o new file mode 100644 index 0000000..ad2d08f Binary files /dev/null and b/src/fs.o differ diff --git a/src/ide.d b/src/ide.d new file mode 100644 index 0000000..21155b9 --- /dev/null +++ b/src/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/src/ide.o b/src/ide.o new file mode 100644 index 0000000..5645630 Binary files /dev/null and b/src/ide.o differ diff --git a/src/initcode.d b/src/initcode.d new file mode 100644 index 0000000..ab1af4d --- /dev/null +++ b/src/initcode.d @@ -0,0 +1 @@ +initcode.o: initcode.S syscall.h traps.h diff --git a/src/initcode.o b/src/initcode.o new file mode 100644 index 0000000..5613787 Binary files /dev/null and b/src/initcode.o differ diff --git a/src/initcode.out b/src/initcode.out new file mode 100755 index 0000000..85d6141 Binary files /dev/null and b/src/initcode.out differ diff --git a/src/ioapic.d b/src/ioapic.d new file mode 100644 index 0000000..997e68a --- /dev/null +++ b/src/ioapic.d @@ -0,0 +1 @@ +ioapic.o: ioapic.c /usr/include/stdc-predef.h types.h defs.h traps.h diff --git a/src/ioapic.o b/src/ioapic.o new file mode 100644 index 0000000..f1c844f Binary files /dev/null and b/src/ioapic.o differ diff --git a/src/kalloc.d b/src/kalloc.d new file mode 100644 index 0000000..512c5db --- /dev/null +++ b/src/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/src/kalloc.o b/src/kalloc.o new file mode 100644 index 0000000..6563b48 Binary files /dev/null and b/src/kalloc.o differ diff --git a/src/kbd.d b/src/kbd.d new file mode 100644 index 0000000..92532ba --- /dev/null +++ b/src/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/src/kbd.o b/src/kbd.o new file mode 100644 index 0000000..347fe2d Binary files /dev/null and b/src/kbd.o differ diff --git a/src/kernel b/src/kernel index 1852108..0273d07 100755 Binary files a/src/kernel and b/src/kernel differ diff --git a/src/kernel.asm b/src/kernel.asm index 791755d..f5b45de 100644 --- a/src/kernel.asm +++ b/src/kernel.asm @@ -37,14 +37,14 @@ entry: # Set up the stack pointer. movl $(stack + KSTACKSIZE), %esp -80100028: bc e0 e1 10 80 mov $0x8010e1e0,%esp +80100028: bc 60 79 11 80 mov $0x80117960,%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 60 2b 10 80 mov $0x80102b60,%eax +8010002d: b8 4b 2a 10 80 mov $0x80102a4b,%eax jmp *%eax 80100032: ff e0 jmp *%eax @@ -55,16079 +55,15842 @@ entry: void binit(void) { -80100034: f3 0f 1e fb endbr32 -80100038: 55 push %ebp -80100039: 89 e5 mov %esp,%ebp -8010003b: 53 push %ebx -8010003c: 83 ec 0c sub $0xc,%esp +80100034: 55 push %ebp +80100035: 89 e5 mov %esp,%ebp +80100037: 53 push %ebx +80100038: 83 ec 0c sub $0xc,%esp struct buf *b; initlock(&bcache.lock, "bcache"); -8010003f: 68 80 78 10 80 push $0x80107880 -80100044: 68 e0 e1 10 80 push $0x8010e1e0 -80100049: e8 ef 3c 00 00 call 80103d3d +8010003b: 68 a0 75 10 80 push $0x801075a0 +80100040: 68 20 b5 10 80 push $0x8010b520 +80100045: e8 6e 3b 00 00 call 80103bb8 //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; -8010004e: c7 05 2c 29 11 80 dc movl $0x801128dc,0x8011292c -80100055: 28 11 80 +8010004a: c7 05 6c fc 10 80 1c movl $0x8010fc1c,0x8010fc6c +80100051: fc 10 80 bcache.head.next = &bcache.head; -80100058: c7 05 30 29 11 80 dc movl $0x801128dc,0x80112930 -8010005f: 28 11 80 -80100062: 83 c4 10 add $0x10,%esp +80100054: c7 05 70 fc 10 80 1c movl $0x8010fc1c,0x8010fc70 +8010005b: fc 10 80 +8010005e: 83 c4 10 add $0x10,%esp for(b = bcache.buf; b < bcache.buf+NBUF; b++){ -80100065: bb 14 e2 10 80 mov $0x8010e214,%ebx +80100061: bb 54 b5 10 80 mov $0x8010b554,%ebx b->next = bcache.head.next; -8010006a: a1 30 29 11 80 mov 0x80112930,%eax -8010006f: 89 43 54 mov %eax,0x54(%ebx) +80100066: a1 70 fc 10 80 mov 0x8010fc70,%eax +8010006b: 89 43 54 mov %eax,0x54(%ebx) b->prev = &bcache.head; -80100072: c7 43 50 dc 28 11 80 movl $0x801128dc,0x50(%ebx) +8010006e: c7 43 50 1c fc 10 80 movl $0x8010fc1c,0x50(%ebx) initsleeplock(&b->lock, "buffer"); -80100079: 83 ec 08 sub $0x8,%esp -8010007c: 68 87 78 10 80 push $0x80107887 -80100081: 8d 43 0c lea 0xc(%ebx),%eax -80100084: 50 push %eax -80100085: e8 99 3b 00 00 call 80103c23 +80100075: 83 ec 08 sub $0x8,%esp +80100078: 68 a7 75 10 80 push $0x801075a7 +8010007d: 8d 43 0c lea 0xc(%ebx),%eax +80100080: 50 push %eax +80100081: e8 28 3a 00 00 call 80103aae bcache.head.next->prev = b; -8010008a: a1 30 29 11 80 mov 0x80112930,%eax -8010008f: 89 58 50 mov %ebx,0x50(%eax) +80100086: a1 70 fc 10 80 mov 0x8010fc70,%eax +8010008b: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; -80100092: 89 1d 30 29 11 80 mov %ebx,0x80112930 +8010008e: 89 1d 70 fc 10 80 mov %ebx,0x8010fc70 for(b = bcache.buf; b < bcache.buf+NBUF; b++){ -80100098: 81 c3 5c 02 00 00 add $0x25c,%ebx -8010009e: 83 c4 10 add $0x10,%esp -801000a1: 81 fb dc 28 11 80 cmp $0x801128dc,%ebx -801000a7: 75 c1 jne 8010006a +80100094: 81 c3 5c 02 00 00 add $0x25c,%ebx +8010009a: 83 c4 10 add $0x10,%esp +8010009d: 81 fb 1c fc 10 80 cmp $0x8010fc1c,%ebx +801000a3: 75 c1 jne 80100066 } } -801000a9: 8b 5d fc mov -0x4(%ebp),%ebx -801000ac: c9 leave -801000ad: c3 ret +801000a5: 8b 5d fc mov -0x4(%ebp),%ebx +801000a8: c9 leave +801000a9: c3 ret -801000ae : +801000aa : } // Return a locked buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { -801000ae: f3 0f 1e fb endbr32 -801000b2: 55 push %ebp -801000b3: 89 e5 mov %esp,%ebp -801000b5: 57 push %edi -801000b6: 56 push %esi -801000b7: 53 push %ebx -801000b8: 83 ec 18 sub $0x18,%esp -801000bb: 8b 7d 08 mov 0x8(%ebp),%edi -801000be: 8b 75 0c mov 0xc(%ebp),%esi +801000aa: 55 push %ebp +801000ab: 89 e5 mov %esp,%ebp +801000ad: 57 push %edi +801000ae: 56 push %esi +801000af: 53 push %ebx +801000b0: 83 ec 18 sub $0x18,%esp +801000b3: 8b 75 08 mov 0x8(%ebp),%esi +801000b6: 8b 7d 0c mov 0xc(%ebp),%edi acquire(&bcache.lock); -801000c1: 68 e0 e1 10 80 push $0x8010e1e0 -801000c6: e8 ce 3d 00 00 call 80103e99 +801000b9: 68 20 b5 10 80 push $0x8010b520 +801000be: e8 3e 3c 00 00 call 80103d01 for(b = bcache.head.next; b != &bcache.head; b = b->next){ -801000cb: 8b 1d 30 29 11 80 mov 0x80112930,%ebx -801000d1: 83 c4 10 add $0x10,%esp -801000d4: 81 fb dc 28 11 80 cmp $0x801128dc,%ebx -801000da: 75 26 jne 80100102 +801000c3: 8b 1d 70 fc 10 80 mov 0x8010fc70,%ebx +801000c9: 83 c4 10 add $0x10,%esp +801000cc: 81 fb 1c fc 10 80 cmp $0x8010fc1c,%ebx +801000d2: 75 26 jne 801000fa for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ -801000dc: 8b 1d 2c 29 11 80 mov 0x8011292c,%ebx -801000e2: 81 fb dc 28 11 80 cmp $0x801128dc,%ebx -801000e8: 75 4e jne 80100138 +801000d4: 8b 1d 6c fc 10 80 mov 0x8010fc6c,%ebx +801000da: 81 fb 1c fc 10 80 cmp $0x8010fc1c,%ebx +801000e0: 75 4e jne 80100130 panic("bget: no buffers"); -801000ea: 83 ec 0c sub $0xc,%esp -801000ed: 68 8e 78 10 80 push $0x8010788e -801000f2: e8 61 02 00 00 call 80100358 +801000e2: 83 ec 0c sub $0xc,%esp +801000e5: 68 ae 75 10 80 push $0x801075ae +801000ea: e8 51 02 00 00 call 80100340 for(b = bcache.head.next; b != &bcache.head; b = b->next){ -801000f7: 8b 5b 54 mov 0x54(%ebx),%ebx -801000fa: 81 fb dc 28 11 80 cmp $0x801128dc,%ebx -80100100: 74 da je 801000dc +801000ef: 8b 5b 54 mov 0x54(%ebx),%ebx +801000f2: 81 fb 1c fc 10 80 cmp $0x8010fc1c,%ebx +801000f8: 74 da je 801000d4 if(b->dev == dev && b->blockno == blockno){ -80100102: 3b 7b 04 cmp 0x4(%ebx),%edi -80100105: 75 f0 jne 801000f7 -80100107: 3b 73 08 cmp 0x8(%ebx),%esi -8010010a: 75 eb jne 801000f7 +801000fa: 3b 73 04 cmp 0x4(%ebx),%esi +801000fd: 75 f0 jne 801000ef +801000ff: 3b 7b 08 cmp 0x8(%ebx),%edi +80100102: 75 eb jne 801000ef b->refcnt++; -8010010c: 83 43 4c 01 addl $0x1,0x4c(%ebx) +80100104: 83 43 4c 01 addl $0x1,0x4c(%ebx) release(&bcache.lock); -80100110: 83 ec 0c sub $0xc,%esp -80100113: 68 e0 e1 10 80 push $0x8010e1e0 -80100118: e8 e7 3d 00 00 call 80103f04 +80100108: 83 ec 0c sub $0xc,%esp +8010010b: 68 20 b5 10 80 push $0x8010b520 +80100110: e8 53 3c 00 00 call 80103d68 acquiresleep(&b->lock); -8010011d: 8d 43 0c lea 0xc(%ebx),%eax -80100120: 89 04 24 mov %eax,(%esp) -80100123: e8 32 3b 00 00 call 80103c5a +80100115: 8d 43 0c lea 0xc(%ebx),%eax +80100118: 89 04 24 mov %eax,(%esp) +8010011b: e8 c1 39 00 00 call 80103ae1 return b; -80100128: 83 c4 10 add $0x10,%esp -8010012b: eb 44 jmp 80100171 +80100120: 83 c4 10 add $0x10,%esp +80100123: eb 44 jmp 80100169 for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ -8010012d: 8b 5b 50 mov 0x50(%ebx),%ebx -80100130: 81 fb dc 28 11 80 cmp $0x801128dc,%ebx -80100136: 74 b2 je 801000ea +80100125: 8b 5b 50 mov 0x50(%ebx),%ebx +80100128: 81 fb 1c fc 10 80 cmp $0x8010fc1c,%ebx +8010012e: 74 b2 je 801000e2 if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { -80100138: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx) -8010013c: 75 ef jne 8010012d -8010013e: f6 03 04 testb $0x4,(%ebx) -80100141: 75 ea jne 8010012d +80100130: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx) +80100134: 75 ef jne 80100125 +80100136: f6 03 04 testb $0x4,(%ebx) +80100139: 75 ea jne 80100125 b->dev = dev; -80100143: 89 7b 04 mov %edi,0x4(%ebx) +8010013b: 89 73 04 mov %esi,0x4(%ebx) b->blockno = blockno; -80100146: 89 73 08 mov %esi,0x8(%ebx) +8010013e: 89 7b 08 mov %edi,0x8(%ebx) b->flags = 0; -80100149: c7 03 00 00 00 00 movl $0x0,(%ebx) +80100141: c7 03 00 00 00 00 movl $0x0,(%ebx) b->refcnt = 1; -8010014f: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) +80100147: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) release(&bcache.lock); -80100156: 83 ec 0c sub $0xc,%esp -80100159: 68 e0 e1 10 80 push $0x8010e1e0 -8010015e: e8 a1 3d 00 00 call 80103f04 +8010014e: 83 ec 0c sub $0xc,%esp +80100151: 68 20 b5 10 80 push $0x8010b520 +80100156: e8 0d 3c 00 00 call 80103d68 acquiresleep(&b->lock); -80100163: 8d 43 0c lea 0xc(%ebx),%eax -80100166: 89 04 24 mov %eax,(%esp) -80100169: e8 ec 3a 00 00 call 80103c5a +8010015b: 8d 43 0c lea 0xc(%ebx),%eax +8010015e: 89 04 24 mov %eax,(%esp) +80100161: e8 7b 39 00 00 call 80103ae1 return b; -8010016e: 83 c4 10 add $0x10,%esp +80100166: 83 c4 10 add $0x10,%esp struct buf *b; b = bget(dev, blockno); if((b->flags & B_VALID) == 0) { -80100171: f6 03 02 testb $0x2,(%ebx) -80100174: 74 0a je 80100180 +80100169: f6 03 02 testb $0x2,(%ebx) +8010016c: 74 0a je 80100178 iderw(b); } return b; } -80100176: 89 d8 mov %ebx,%eax -80100178: 8d 65 f4 lea -0xc(%ebp),%esp -8010017b: 5b pop %ebx -8010017c: 5e pop %esi -8010017d: 5f pop %edi -8010017e: 5d pop %ebp -8010017f: c3 ret +8010016e: 89 d8 mov %ebx,%eax +80100170: 8d 65 f4 lea -0xc(%ebp),%esp +80100173: 5b pop %ebx +80100174: 5e pop %esi +80100175: 5f pop %edi +80100176: 5d pop %ebp +80100177: c3 ret iderw(b); -80100180: 83 ec 0c sub $0xc,%esp -80100183: 53 push %ebx -80100184: e8 6e 1d 00 00 call 80101ef7 -80100189: 83 c4 10 add $0x10,%esp +80100178: 83 ec 0c sub $0xc,%esp +8010017b: 53 push %ebx +8010017c: e8 c3 1c 00 00 call 80101e44 +80100181: 83 c4 10 add $0x10,%esp return b; -8010018c: eb e8 jmp 80100176 +80100184: eb e8 jmp 8010016e -8010018e : +80100186 : // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { -8010018e: f3 0f 1e fb endbr32 -80100192: 55 push %ebp -80100193: 89 e5 mov %esp,%ebp -80100195: 53 push %ebx -80100196: 83 ec 10 sub $0x10,%esp -80100199: 8b 5d 08 mov 0x8(%ebp),%ebx +80100186: 55 push %ebp +80100187: 89 e5 mov %esp,%ebp +80100189: 53 push %ebx +8010018a: 83 ec 10 sub $0x10,%esp +8010018d: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) -8010019c: 8d 43 0c lea 0xc(%ebx),%eax -8010019f: 50 push %eax -801001a0: e8 4a 3b 00 00 call 80103cef -801001a5: 83 c4 10 add $0x10,%esp -801001a8: 85 c0 test %eax,%eax -801001aa: 74 14 je 801001c0 +80100190: 8d 43 0c lea 0xc(%ebx),%eax +80100193: 50 push %eax +80100194: e8 d5 39 00 00 call 80103b6e +80100199: 83 c4 10 add $0x10,%esp +8010019c: 85 c0 test %eax,%eax +8010019e: 74 14 je 801001b4 panic("bwrite"); b->flags |= B_DIRTY; -801001ac: 83 0b 04 orl $0x4,(%ebx) +801001a0: 83 0b 04 orl $0x4,(%ebx) iderw(b); -801001af: 83 ec 0c sub $0xc,%esp -801001b2: 53 push %ebx -801001b3: e8 3f 1d 00 00 call 80101ef7 -} -801001b8: 83 c4 10 add $0x10,%esp -801001bb: 8b 5d fc mov -0x4(%ebp),%ebx -801001be: c9 leave -801001bf: c3 ret +801001a3: 83 ec 0c sub $0xc,%esp +801001a6: 53 push %ebx +801001a7: e8 98 1c 00 00 call 80101e44 +} +801001ac: 83 c4 10 add $0x10,%esp +801001af: 8b 5d fc mov -0x4(%ebp),%ebx +801001b2: c9 leave +801001b3: c3 ret panic("bwrite"); -801001c0: 83 ec 0c sub $0xc,%esp -801001c3: 68 9f 78 10 80 push $0x8010789f -801001c8: e8 8b 01 00 00 call 80100358 +801001b4: 83 ec 0c sub $0xc,%esp +801001b7: 68 bf 75 10 80 push $0x801075bf +801001bc: e8 7f 01 00 00 call 80100340 -801001cd : +801001c1 : // Release a locked buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { -801001cd: f3 0f 1e fb endbr32 -801001d1: 55 push %ebp -801001d2: 89 e5 mov %esp,%ebp -801001d4: 56 push %esi -801001d5: 53 push %ebx -801001d6: 8b 5d 08 mov 0x8(%ebp),%ebx +801001c1: 55 push %ebp +801001c2: 89 e5 mov %esp,%ebp +801001c4: 56 push %esi +801001c5: 53 push %ebx +801001c6: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) -801001d9: 8d 73 0c lea 0xc(%ebx),%esi -801001dc: 83 ec 0c sub $0xc,%esp -801001df: 56 push %esi -801001e0: e8 0a 3b 00 00 call 80103cef -801001e5: 83 c4 10 add $0x10,%esp -801001e8: 85 c0 test %eax,%eax -801001ea: 74 6b je 80100257 +801001c9: 8d 73 0c lea 0xc(%ebx),%esi +801001cc: 83 ec 0c sub $0xc,%esp +801001cf: 56 push %esi +801001d0: e8 99 39 00 00 call 80103b6e +801001d5: 83 c4 10 add $0x10,%esp +801001d8: 85 c0 test %eax,%eax +801001da: 74 6b je 80100247 panic("brelse"); releasesleep(&b->lock); -801001ec: 83 ec 0c sub $0xc,%esp -801001ef: 56 push %esi -801001f0: e8 bb 3a 00 00 call 80103cb0 +801001dc: 83 ec 0c sub $0xc,%esp +801001df: 56 push %esi +801001e0: e8 4e 39 00 00 call 80103b33 acquire(&bcache.lock); -801001f5: c7 04 24 e0 e1 10 80 movl $0x8010e1e0,(%esp) -801001fc: e8 98 3c 00 00 call 80103e99 +801001e5: c7 04 24 20 b5 10 80 movl $0x8010b520,(%esp) +801001ec: e8 10 3b 00 00 call 80103d01 b->refcnt--; -80100201: 8b 43 4c mov 0x4c(%ebx),%eax -80100204: 83 e8 01 sub $0x1,%eax -80100207: 89 43 4c mov %eax,0x4c(%ebx) +801001f1: 8b 43 4c mov 0x4c(%ebx),%eax +801001f4: 83 e8 01 sub $0x1,%eax +801001f7: 89 43 4c mov %eax,0x4c(%ebx) if (b->refcnt == 0) { -8010020a: 83 c4 10 add $0x10,%esp -8010020d: 85 c0 test %eax,%eax -8010020f: 75 2f jne 80100240 +801001fa: 83 c4 10 add $0x10,%esp +801001fd: 85 c0 test %eax,%eax +801001ff: 75 2f jne 80100230 // no one is waiting for it. b->next->prev = b->prev; -80100211: 8b 43 54 mov 0x54(%ebx),%eax -80100214: 8b 53 50 mov 0x50(%ebx),%edx -80100217: 89 50 50 mov %edx,0x50(%eax) +80100201: 8b 43 54 mov 0x54(%ebx),%eax +80100204: 8b 53 50 mov 0x50(%ebx),%edx +80100207: 89 50 50 mov %edx,0x50(%eax) b->prev->next = b->next; -8010021a: 8b 43 50 mov 0x50(%ebx),%eax -8010021d: 8b 53 54 mov 0x54(%ebx),%edx -80100220: 89 50 54 mov %edx,0x54(%eax) +8010020a: 8b 43 50 mov 0x50(%ebx),%eax +8010020d: 8b 53 54 mov 0x54(%ebx),%edx +80100210: 89 50 54 mov %edx,0x54(%eax) b->next = bcache.head.next; -80100223: a1 30 29 11 80 mov 0x80112930,%eax -80100228: 89 43 54 mov %eax,0x54(%ebx) +80100213: a1 70 fc 10 80 mov 0x8010fc70,%eax +80100218: 89 43 54 mov %eax,0x54(%ebx) b->prev = &bcache.head; -8010022b: c7 43 50 dc 28 11 80 movl $0x801128dc,0x50(%ebx) +8010021b: c7 43 50 1c fc 10 80 movl $0x8010fc1c,0x50(%ebx) bcache.head.next->prev = b; -80100232: a1 30 29 11 80 mov 0x80112930,%eax -80100237: 89 58 50 mov %ebx,0x50(%eax) +80100222: a1 70 fc 10 80 mov 0x8010fc70,%eax +80100227: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; -8010023a: 89 1d 30 29 11 80 mov %ebx,0x80112930 +8010022a: 89 1d 70 fc 10 80 mov %ebx,0x8010fc70 } release(&bcache.lock); -80100240: 83 ec 0c sub $0xc,%esp -80100243: 68 e0 e1 10 80 push $0x8010e1e0 -80100248: e8 b7 3c 00 00 call 80103f04 -} -8010024d: 83 c4 10 add $0x10,%esp -80100250: 8d 65 f8 lea -0x8(%ebp),%esp -80100253: 5b pop %ebx -80100254: 5e pop %esi -80100255: 5d pop %ebp -80100256: c3 ret +80100230: 83 ec 0c sub $0xc,%esp +80100233: 68 20 b5 10 80 push $0x8010b520 +80100238: e8 2b 3b 00 00 call 80103d68 +} +8010023d: 83 c4 10 add $0x10,%esp +80100240: 8d 65 f8 lea -0x8(%ebp),%esp +80100243: 5b pop %ebx +80100244: 5e pop %esi +80100245: 5d pop %ebp +80100246: c3 ret panic("brelse"); -80100257: 83 ec 0c sub $0xc,%esp -8010025a: 68 a6 78 10 80 push $0x801078a6 -8010025f: e8 f4 00 00 00 call 80100358 +80100247: 83 ec 0c sub $0xc,%esp +8010024a: 68 c6 75 10 80 push $0x801075c6 +8010024f: e8 ec 00 00 00 call 80100340 -80100264 : +80100254 : } } int consoleread(struct inode *ip, char *dst, int n) { -80100264: f3 0f 1e fb endbr32 -80100268: 55 push %ebp -80100269: 89 e5 mov %esp,%ebp -8010026b: 57 push %edi -8010026c: 56 push %esi -8010026d: 53 push %ebx -8010026e: 83 ec 28 sub $0x28,%esp -80100271: 8b 75 10 mov 0x10(%ebp),%esi +80100254: 55 push %ebp +80100255: 89 e5 mov %esp,%ebp +80100257: 57 push %edi +80100258: 56 push %esi +80100259: 53 push %ebx +8010025a: 83 ec 28 sub $0x28,%esp +8010025d: 8b 7d 0c mov 0xc(%ebp),%edi +80100260: 8b 75 10 mov 0x10(%ebp),%esi uint target; int c; iunlock(ip); -80100274: ff 75 08 pushl 0x8(%ebp) -80100277: e8 76 13 00 00 call 801015f2 +80100263: ff 75 08 push 0x8(%ebp) +80100266: e8 0a 13 00 00 call 80101575 target = n; -8010027c: 89 75 e4 mov %esi,-0x1c(%ebp) +8010026b: 89 75 e4 mov %esi,-0x1c(%ebp) acquire(&cons.lock); -8010027f: c7 04 24 20 b5 10 80 movl $0x8010b520,(%esp) -80100286: e8 0e 3c 00 00 call 80103e99 +8010026e: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp) +80100275: e8 87 3a 00 00 call 80103d01 while(n > 0){ -8010028b: 83 c4 10 add $0x10,%esp +8010027a: 83 c4 10 add $0x10,%esp while(input.r == input.w){ -8010028e: bb 40 2b 11 80 mov $0x80112b40,%ebx +8010027d: bb 80 fe 10 80 mov $0x8010fe80,%ebx while(n > 0){ -80100293: 85 f6 test %esi,%esi -80100295: 7e 6a jle 80100301 +80100282: 85 f6 test %esi,%esi +80100284: 7e 64 jle 801002ea while(input.r == input.w){ -80100297: 8b 8b 80 00 00 00 mov 0x80(%ebx),%ecx -8010029d: 3b 8b 84 00 00 00 cmp 0x84(%ebx),%ecx -801002a3: 75 2e jne 801002d3 +80100286: 8b 83 80 00 00 00 mov 0x80(%ebx),%eax +8010028c: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax +80100292: 75 2e jne 801002c2 if(myproc()->killed){ -801002a5: e8 40 31 00 00 call 801033ea -801002aa: 83 78 24 00 cmpl $0x0,0x24(%eax) -801002ae: 75 73 jne 80100323 +80100294: e8 17 30 00 00 call 801032b0 +80100299: 83 78 24 00 cmpl $0x0,0x24(%eax) +8010029d: 75 6d jne 8010030c release(&cons.lock); ilock(ip); return -1; } sleep(&input.r, &cons.lock); -801002b0: 83 ec 08 sub $0x8,%esp -801002b3: 68 20 b5 10 80 push $0x8010b520 -801002b8: 68 c0 2b 11 80 push $0x80112bc0 -801002bd: e8 f2 35 00 00 call 801038b4 +8010029f: 83 ec 08 sub $0x8,%esp +801002a2: 68 20 ff 10 80 push $0x8010ff20 +801002a7: 68 00 ff 10 80 push $0x8010ff00 +801002ac: e8 a8 34 00 00 call 80103759 while(input.r == input.w){ -801002c2: 8b 8b 80 00 00 00 mov 0x80(%ebx),%ecx -801002c8: 83 c4 10 add $0x10,%esp -801002cb: 3b 8b 84 00 00 00 cmp 0x84(%ebx),%ecx -801002d1: 74 d2 je 801002a5 +801002b1: 8b 83 80 00 00 00 mov 0x80(%ebx),%eax +801002b7: 83 c4 10 add $0x10,%esp +801002ba: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax +801002c0: 74 d2 je 80100294 } c = input.buf[input.r++ % INPUT_BUF]; -801002d3: 8d 41 01 lea 0x1(%ecx),%eax -801002d6: 89 83 80 00 00 00 mov %eax,0x80(%ebx) -801002dc: 89 c8 mov %ecx,%eax -801002de: 83 e0 7f and $0x7f,%eax -801002e1: 0f b6 04 03 movzbl (%ebx,%eax,1),%eax -801002e5: 0f be d0 movsbl %al,%edx +801002c2: 8d 50 01 lea 0x1(%eax),%edx +801002c5: 89 93 80 00 00 00 mov %edx,0x80(%ebx) +801002cb: 89 c2 mov %eax,%edx +801002cd: 83 e2 7f and $0x7f,%edx +801002d0: 0f b6 14 13 movzbl (%ebx,%edx,1),%edx +801002d4: 0f be ca movsbl %dl,%ecx if(c == C('D')){ // EOF -801002e8: 3c 04 cmp $0x4,%al -801002ea: 74 5f je 8010034b +801002d7: 80 fa 04 cmp $0x4,%dl +801002da: 74 58 je 80100334 // caller gets a 0-byte result. input.r--; } break; } *dst++ = c; -801002ec: 8b 7d e4 mov -0x1c(%ebp),%edi -801002ef: 03 7d 0c add 0xc(%ebp),%edi -801002f2: 89 f1 mov %esi,%ecx -801002f4: f7 d9 neg %ecx -801002f6: 88 04 0f mov %al,(%edi,%ecx,1) +801002dc: 83 c7 01 add $0x1,%edi +801002df: 88 57 ff mov %dl,-0x1(%edi) --n; -801002f9: 83 ee 01 sub $0x1,%esi +801002e2: 83 ee 01 sub $0x1,%esi if(c == '\n') -801002fc: 83 fa 0a cmp $0xa,%edx -801002ff: 75 92 jne 80100293 +801002e5: 83 f9 0a cmp $0xa,%ecx +801002e8: 75 98 jne 80100282 break; } release(&cons.lock); -80100301: 83 ec 0c sub $0xc,%esp -80100304: 68 20 b5 10 80 push $0x8010b520 -80100309: e8 f6 3b 00 00 call 80103f04 +801002ea: 83 ec 0c sub $0xc,%esp +801002ed: 68 20 ff 10 80 push $0x8010ff20 +801002f2: e8 71 3a 00 00 call 80103d68 ilock(ip); -8010030e: 83 c4 04 add $0x4,%esp -80100311: ff 75 08 pushl 0x8(%ebp) -80100314: e8 13 12 00 00 call 8010152c +801002f7: 83 c4 04 add $0x4,%esp +801002fa: ff 75 08 push 0x8(%ebp) +801002fd: e8 b1 11 00 00 call 801014b3 return target - n; -80100319: 8b 45 e4 mov -0x1c(%ebp),%eax -8010031c: 29 f0 sub %esi,%eax -8010031e: 83 c4 10 add $0x10,%esp -80100321: eb 20 jmp 80100343 +80100302: 8b 45 e4 mov -0x1c(%ebp),%eax +80100305: 29 f0 sub %esi,%eax +80100307: 83 c4 10 add $0x10,%esp +8010030a: eb 20 jmp 8010032c release(&cons.lock); -80100323: 83 ec 0c sub $0xc,%esp -80100326: 68 20 b5 10 80 push $0x8010b520 -8010032b: e8 d4 3b 00 00 call 80103f04 +8010030c: 83 ec 0c sub $0xc,%esp +8010030f: 68 20 ff 10 80 push $0x8010ff20 +80100314: e8 4f 3a 00 00 call 80103d68 ilock(ip); -80100330: 83 c4 04 add $0x4,%esp -80100333: ff 75 08 pushl 0x8(%ebp) -80100336: e8 f1 11 00 00 call 8010152c +80100319: 83 c4 04 add $0x4,%esp +8010031c: ff 75 08 push 0x8(%ebp) +8010031f: e8 8f 11 00 00 call 801014b3 return -1; -8010033b: 83 c4 10 add $0x10,%esp -8010033e: b8 ff ff ff ff mov $0xffffffff,%eax -} -80100343: 8d 65 f4 lea -0xc(%ebp),%esp -80100346: 5b pop %ebx -80100347: 5e pop %esi -80100348: 5f pop %edi -80100349: 5d pop %ebp -8010034a: c3 ret +80100324: 83 c4 10 add $0x10,%esp +80100327: b8 ff ff ff ff mov $0xffffffff,%eax +} +8010032c: 8d 65 f4 lea -0xc(%ebp),%esp +8010032f: 5b pop %ebx +80100330: 5e pop %esi +80100331: 5f pop %edi +80100332: 5d pop %ebp +80100333: c3 ret if(n < target){ -8010034b: 3b 75 e4 cmp -0x1c(%ebp),%esi -8010034e: 73 b1 jae 80100301 +80100334: 3b 75 e4 cmp -0x1c(%ebp),%esi +80100337: 73 b1 jae 801002ea input.r--; -80100350: 89 0d c0 2b 11 80 mov %ecx,0x80112bc0 -80100356: eb a9 jmp 80100301 +80100339: a3 00 ff 10 80 mov %eax,0x8010ff00 +8010033e: eb aa jmp 801002ea -80100358 : +80100340 : { -80100358: f3 0f 1e fb endbr32 -8010035c: 55 push %ebp -8010035d: 89 e5 mov %esp,%ebp -8010035f: 56 push %esi -80100360: 53 push %ebx -80100361: 83 ec 30 sub $0x30,%esp +80100340: 55 push %ebp +80100341: 89 e5 mov %esp,%ebp +80100343: 56 push %esi +80100344: 53 push %ebx +80100345: 83 ec 30 sub $0x30,%esp } static inline void cli(void) { asm volatile("cli"); -80100364: fa cli +80100348: fa cli cons.locking = 0; -80100365: c7 05 54 b5 10 80 00 movl $0x0,0x8010b554 -8010036c: 00 00 00 +80100349: c7 05 54 ff 10 80 00 movl $0x0,0x8010ff54 +80100350: 00 00 00 cprintf("lapicid %d: panic: ", lapicid()); -8010036f: e8 90 21 00 00 call 80102504 -80100374: 83 ec 08 sub $0x8,%esp -80100377: 50 push %eax -80100378: 68 ad 78 10 80 push $0x801078ad -8010037d: e8 aa 02 00 00 call 8010062c +80100353: e8 c2 20 00 00 call 8010241a +80100358: 83 ec 08 sub $0x8,%esp +8010035b: 50 push %eax +8010035c: 68 cd 75 10 80 push $0x801075cd +80100361: e8 9b 02 00 00 call 80100601 cprintf(s); -80100382: 83 c4 04 add $0x4,%esp -80100385: ff 75 08 pushl 0x8(%ebp) -80100388: e8 9f 02 00 00 call 8010062c +80100366: 83 c4 04 add $0x4,%esp +80100369: ff 75 08 push 0x8(%ebp) +8010036c: e8 90 02 00 00 call 80100601 cprintf("\n"); -8010038d: c7 04 24 1f 82 10 80 movl $0x8010821f,(%esp) -80100394: e8 93 02 00 00 call 8010062c +80100371: c7 04 24 3f 7f 10 80 movl $0x80107f3f,(%esp) +80100378: e8 84 02 00 00 call 80100601 getcallerpcs(&s, pcs); -80100399: 83 c4 08 add $0x8,%esp -8010039c: 8d 5d d0 lea -0x30(%ebp),%ebx -8010039f: 53 push %ebx -801003a0: 8d 45 08 lea 0x8(%ebp),%eax -801003a3: 50 push %eax -801003a4: e8 b3 39 00 00 call 80103d5c +8010037d: 83 c4 08 add $0x8,%esp +80100380: 8d 5d d0 lea -0x30(%ebp),%ebx +80100383: 53 push %ebx +80100384: 8d 45 08 lea 0x8(%ebp),%eax +80100387: 50 push %eax +80100388: e8 46 38 00 00 call 80103bd3 for(i=0; i<10; i++) -801003a9: 8d 75 f8 lea -0x8(%ebp),%esi -801003ac: 83 c4 10 add $0x10,%esp +8010038d: 8d 75 f8 lea -0x8(%ebp),%esi +80100390: 83 c4 10 add $0x10,%esp cprintf(" %p", pcs[i]); -801003af: 83 ec 08 sub $0x8,%esp -801003b2: ff 33 pushl (%ebx) -801003b4: 68 77 7e 10 80 push $0x80107e77 -801003b9: e8 6e 02 00 00 call 8010062c +80100393: 83 ec 08 sub $0x8,%esp +80100396: ff 33 push (%ebx) +80100398: 68 97 7b 10 80 push $0x80107b97 +8010039d: e8 5f 02 00 00 call 80100601 for(i=0; i<10; i++) -801003be: 83 c3 04 add $0x4,%ebx -801003c1: 83 c4 10 add $0x10,%esp -801003c4: 39 f3 cmp %esi,%ebx -801003c6: 75 e7 jne 801003af +801003a2: 83 c3 04 add $0x4,%ebx +801003a5: 83 c4 10 add $0x10,%esp +801003a8: 39 f3 cmp %esi,%ebx +801003aa: 75 e7 jne 80100393 panicked = 1; // freeze other CPU -801003c8: c7 05 58 b5 10 80 01 movl $0x1,0x8010b558 -801003cf: 00 00 00 +801003ac: c7 05 58 ff 10 80 01 movl $0x1,0x8010ff58 +801003b3: 00 00 00 for(;;) -801003d2: eb fe jmp 801003d2 +801003b6: eb fe jmp 801003b6 -801003d4 : +801003b8 : if(panicked){ -801003d4: 83 3d 58 b5 10 80 00 cmpl $0x0,0x8010b558 -801003db: 74 03 je 801003e0 -801003dd: fa cli +801003b8: 83 3d 58 ff 10 80 00 cmpl $0x0,0x8010ff58 +801003bf: 74 03 je 801003c4 +801003c1: fa cli for(;;) -801003de: eb fe jmp 801003de -{ -801003e0: 55 push %ebp -801003e1: 89 e5 mov %esp,%ebp -801003e3: 57 push %edi -801003e4: 56 push %esi -801003e5: 53 push %ebx -801003e6: 83 ec 0c sub $0xc,%esp -801003e9: 89 c6 mov %eax,%esi +801003c2: eb fe jmp 801003c2 +{ +801003c4: 55 push %ebp +801003c5: 89 e5 mov %esp,%ebp +801003c7: 57 push %edi +801003c8: 56 push %esi +801003c9: 53 push %ebx +801003ca: 83 ec 0c sub $0xc,%esp +801003cd: 89 c3 mov %eax,%ebx if(c == BACKSPACE){ -801003eb: 3d 00 01 00 00 cmp $0x100,%eax -801003f0: 0f 84 b2 00 00 00 je 801004a8 +801003cf: 3d 00 01 00 00 cmp $0x100,%eax +801003d4: 0f 84 ae 00 00 00 je 80100488 uartputc(c); -801003f6: 83 ec 0c sub $0xc,%esp -801003f9: 50 push %eax -801003fa: e8 71 4f 00 00 call 80105370 -801003ff: 83 c4 10 add $0x10,%esp +801003da: 83 ec 0c sub $0xc,%esp +801003dd: 50 push %eax +801003de: e8 4a 4d 00 00 call 8010512d +801003e3: 83 c4 10 add $0x10,%esp asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80100402: bb d4 03 00 00 mov $0x3d4,%ebx -80100407: b8 0e 00 00 00 mov $0xe,%eax -8010040c: 89 da mov %ebx,%edx -8010040e: ee out %al,(%dx) +801003e6: bf d4 03 00 00 mov $0x3d4,%edi +801003eb: b8 0e 00 00 00 mov $0xe,%eax +801003f0: 89 fa mov %edi,%edx +801003f2: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -8010040f: b9 d5 03 00 00 mov $0x3d5,%ecx -80100414: 89 ca mov %ecx,%edx -80100416: ec in (%dx),%al +801003f3: be d5 03 00 00 mov $0x3d5,%esi +801003f8: 89 f2 mov %esi,%edx +801003fa: ec in (%dx),%al pos = inb(CRTPORT+1) << 8; -80100417: 0f b6 c0 movzbl %al,%eax -8010041a: c1 e0 08 shl $0x8,%eax -8010041d: 89 c7 mov %eax,%edi +801003fb: 0f b6 c8 movzbl %al,%ecx +801003fe: c1 e1 08 shl $0x8,%ecx asm volatile("out %0,%1" : : "a" (data), "d" (port)); -8010041f: b8 0f 00 00 00 mov $0xf,%eax -80100424: 89 da mov %ebx,%edx -80100426: ee out %al,(%dx) +80100401: b8 0f 00 00 00 mov $0xf,%eax +80100406: 89 fa mov %edi,%edx +80100408: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80100427: 89 ca mov %ecx,%edx -80100429: ec in (%dx),%al +80100409: 89 f2 mov %esi,%edx +8010040b: ec in (%dx),%al pos |= inb(CRTPORT+1); -8010042a: 0f b6 d8 movzbl %al,%ebx -8010042d: 09 fb or %edi,%ebx +8010040c: 0f b6 c0 movzbl %al,%eax +8010040f: 09 c8 or %ecx,%eax if(c == '\n') -8010042f: 83 fe 0a cmp $0xa,%esi -80100432: 0f 84 9a 00 00 00 je 801004d2 +80100411: 83 fb 0a cmp $0xa,%ebx +80100414: 0f 84 98 00 00 00 je 801004b2 else if(c == BACKSPACE){ -80100438: 81 fe 00 01 00 00 cmp $0x100,%esi -8010043e: 0f 84 aa 00 00 00 je 801004ee +8010041a: 81 fb 00 01 00 00 cmp $0x100,%ebx +80100420: 0f 84 a4 00 00 00 je 801004ca crt[pos++] = (c&0xff) | 0x0700; // black on white -80100444: 89 f0 mov %esi,%eax -80100446: 0f b6 c0 movzbl %al,%eax -80100449: 80 cc 07 or $0x7,%ah -8010044c: 66 89 84 1b 00 80 0b mov %ax,-0x7ff48000(%ebx,%ebx,1) -80100453: 80 -80100454: 8d 5b 01 lea 0x1(%ebx),%ebx +80100426: 8d 70 01 lea 0x1(%eax),%esi +80100429: 0f b6 db movzbl %bl,%ebx +8010042c: 80 cf 07 or $0x7,%bh +8010042f: 66 89 9c 00 00 80 0b mov %bx,-0x7ff48000(%eax,%eax,1) +80100436: 80 if(pos < 0 || pos > 25*80) -80100457: 81 fb d0 07 00 00 cmp $0x7d0,%ebx -8010045d: 0f 87 9a 00 00 00 ja 801004fd +80100437: 81 fe d0 07 00 00 cmp $0x7d0,%esi +8010043d: 0f 87 94 00 00 00 ja 801004d7 if((pos/80) >= 24){ // Scroll up. -80100463: 81 fb 7f 07 00 00 cmp $0x77f,%ebx -80100469: 0f 8f 9b 00 00 00 jg 8010050a +80100443: 81 fe 7f 07 00 00 cmp $0x77f,%esi +80100449: 0f 8f 95 00 00 00 jg 801004e4 asm volatile("out %0,%1" : : "a" (data), "d" (port)); -8010046f: be d4 03 00 00 mov $0x3d4,%esi -80100474: b8 0e 00 00 00 mov $0xe,%eax -80100479: 89 f2 mov %esi,%edx -8010047b: ee out %al,(%dx) +8010044f: bb d4 03 00 00 mov $0x3d4,%ebx +80100454: b8 0e 00 00 00 mov $0xe,%eax +80100459: 89 da mov %ebx,%edx +8010045b: ee out %al,(%dx) outb(CRTPORT+1, pos>>8); -8010047c: 89 d8 mov %ebx,%eax -8010047e: c1 f8 08 sar $0x8,%eax -80100481: b9 d5 03 00 00 mov $0x3d5,%ecx -80100486: 89 ca mov %ecx,%edx -80100488: ee out %al,(%dx) -80100489: b8 0f 00 00 00 mov $0xf,%eax -8010048e: 89 f2 mov %esi,%edx -80100490: ee out %al,(%dx) -80100491: 89 d8 mov %ebx,%eax -80100493: 89 ca mov %ecx,%edx -80100495: ee out %al,(%dx) +8010045c: 89 f0 mov %esi,%eax +8010045e: c1 f8 08 sar $0x8,%eax +80100461: b9 d5 03 00 00 mov $0x3d5,%ecx +80100466: 89 ca mov %ecx,%edx +80100468: ee out %al,(%dx) +80100469: b8 0f 00 00 00 mov $0xf,%eax +8010046e: 89 da mov %ebx,%edx +80100470: ee out %al,(%dx) +80100471: 89 f0 mov %esi,%eax +80100473: 89 ca mov %ecx,%edx +80100475: ee out %al,(%dx) crt[pos] = ' ' | 0x0700; -80100496: 66 c7 84 1b 00 80 0b movw $0x720,-0x7ff48000(%ebx,%ebx,1) -8010049d: 80 20 07 -} -801004a0: 8d 65 f4 lea -0xc(%ebp),%esp -801004a3: 5b pop %ebx -801004a4: 5e pop %esi -801004a5: 5f pop %edi -801004a6: 5d pop %ebp -801004a7: c3 ret +80100476: 66 c7 84 36 00 80 0b movw $0x720,-0x7ff48000(%esi,%esi,1) +8010047d: 80 20 07 +} +80100480: 8d 65 f4 lea -0xc(%ebp),%esp +80100483: 5b pop %ebx +80100484: 5e pop %esi +80100485: 5f pop %edi +80100486: 5d pop %ebp +80100487: c3 ret uartputc('\b'); uartputc(' '); uartputc('\b'); -801004a8: 83 ec 0c sub $0xc,%esp -801004ab: 6a 08 push $0x8 -801004ad: e8 be 4e 00 00 call 80105370 -801004b2: c7 04 24 20 00 00 00 movl $0x20,(%esp) -801004b9: e8 b2 4e 00 00 call 80105370 -801004be: c7 04 24 08 00 00 00 movl $0x8,(%esp) -801004c5: e8 a6 4e 00 00 call 80105370 -801004ca: 83 c4 10 add $0x10,%esp -801004cd: e9 30 ff ff ff jmp 80100402 +80100488: 83 ec 0c sub $0xc,%esp +8010048b: 6a 08 push $0x8 +8010048d: e8 9b 4c 00 00 call 8010512d +80100492: c7 04 24 20 00 00 00 movl $0x20,(%esp) +80100499: e8 8f 4c 00 00 call 8010512d +8010049e: c7 04 24 08 00 00 00 movl $0x8,(%esp) +801004a5: e8 83 4c 00 00 call 8010512d +801004aa: 83 c4 10 add $0x10,%esp +801004ad: e9 34 ff ff ff jmp 801003e6 pos += 80 - pos%80; -801004d2: ba 67 66 66 66 mov $0x66666667,%edx -801004d7: 89 d8 mov %ebx,%eax -801004d9: f7 ea imul %edx -801004db: 89 d0 mov %edx,%eax -801004dd: c1 f8 05 sar $0x5,%eax -801004e0: 8d 04 80 lea (%eax,%eax,4),%eax -801004e3: c1 e0 04 shl $0x4,%eax -801004e6: 8d 58 50 lea 0x50(%eax),%ebx -801004e9: e9 69 ff ff ff jmp 80100457 +801004b2: ba 67 66 66 66 mov $0x66666667,%edx +801004b7: f7 ea imul %edx +801004b9: c1 fa 05 sar $0x5,%edx +801004bc: 8d 04 92 lea (%edx,%edx,4),%eax +801004bf: c1 e0 04 shl $0x4,%eax +801004c2: 8d 70 50 lea 0x50(%eax),%esi +801004c5: e9 6d ff ff ff jmp 80100437 if(pos > 0) --pos; -801004ee: 85 db test %ebx,%ebx -801004f0: 0f 9f c0 setg %al -801004f3: 0f b6 c0 movzbl %al,%eax -801004f6: 29 c3 sub %eax,%ebx -801004f8: e9 5a ff ff ff jmp 80100457 +801004ca: 83 f8 01 cmp $0x1,%eax +801004cd: 83 d0 ff adc $0xffffffff,%eax +801004d0: 89 c6 mov %eax,%esi +801004d2: e9 60 ff ff ff jmp 80100437 panic("pos under/overflow"); -801004fd: 83 ec 0c sub $0xc,%esp -80100500: 68 c1 78 10 80 push $0x801078c1 -80100505: e8 4e fe ff ff call 80100358 +801004d7: 83 ec 0c sub $0xc,%esp +801004da: 68 e1 75 10 80 push $0x801075e1 +801004df: e8 5c fe ff ff call 80100340 memmove(crt, crt+80, sizeof(crt[0])*23*80); -8010050a: 83 ec 04 sub $0x4,%esp -8010050d: 68 60 0e 00 00 push $0xe60 -80100512: 68 a0 80 0b 80 push $0x800b80a0 -80100517: 68 00 80 0b 80 push $0x800b8000 -8010051c: e8 bb 3a 00 00 call 80103fdc +801004e4: 83 ec 04 sub $0x4,%esp +801004e7: 68 60 0e 00 00 push $0xe60 +801004ec: 68 a0 80 0b 80 push $0x800b80a0 +801004f1: 68 00 80 0b 80 push $0x800b8000 +801004f6: e8 39 39 00 00 call 80103e34 pos -= 80; -80100521: 83 eb 50 sub $0x50,%ebx +801004fb: 83 ee 50 sub $0x50,%esi memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); -80100524: 83 c4 0c add $0xc,%esp -80100527: b8 80 07 00 00 mov $0x780,%eax -8010052c: 29 d8 sub %ebx,%eax -8010052e: 01 c0 add %eax,%eax -80100530: 50 push %eax -80100531: 6a 00 push $0x0 -80100533: 8d 84 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%eax -8010053a: 50 push %eax -8010053b: e8 0f 3a 00 00 call 80103f4f -80100540: 83 c4 10 add $0x10,%esp -80100543: e9 27 ff ff ff jmp 8010046f - -80100548 : -{ -80100548: 55 push %ebp -80100549: 89 e5 mov %esp,%ebp -8010054b: 57 push %edi -8010054c: 56 push %esi -8010054d: 53 push %ebx -8010054e: 83 ec 2c sub $0x2c,%esp -80100551: 89 d6 mov %edx,%esi +801004fe: 83 c4 0c add $0xc,%esp +80100501: b8 80 07 00 00 mov $0x780,%eax +80100506: 29 f0 sub %esi,%eax +80100508: 01 c0 add %eax,%eax +8010050a: 50 push %eax +8010050b: 6a 00 push $0x0 +8010050d: 8d 84 36 00 80 0b 80 lea -0x7ff48000(%esi,%esi,1),%eax +80100514: 50 push %eax +80100515: e8 95 38 00 00 call 80103daf +8010051a: 83 c4 10 add $0x10,%esp +8010051d: e9 2d ff ff ff jmp 8010044f + +80100522 : +{ +80100522: 55 push %ebp +80100523: 89 e5 mov %esp,%ebp +80100525: 57 push %edi +80100526: 56 push %esi +80100527: 53 push %ebx +80100528: 83 ec 2c sub $0x2c,%esp +8010052b: 89 d6 mov %edx,%esi if(sign && (sign = xx < 0)) -80100553: 85 c9 test %ecx,%ecx -80100555: 74 04 je 8010055b -80100557: 85 c0 test %eax,%eax -80100559: 78 61 js 801005bc +8010052d: 85 c9 test %ecx,%ecx +8010052f: 74 04 je 80100535 +80100531: 85 c0 test %eax,%eax +80100533: 78 61 js 80100596 x = xx; -8010055b: 89 c1 mov %eax,%ecx -8010055d: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) +80100535: 89 c1 mov %eax,%ecx +80100537: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) i = 0; -80100564: bb 00 00 00 00 mov $0x0,%ebx +8010053e: bb 00 00 00 00 mov $0x0,%ebx buf[i++] = digits[x % base]; -80100569: 89 df mov %ebx,%edi -8010056b: 83 c3 01 add $0x1,%ebx -8010056e: 89 c8 mov %ecx,%eax -80100570: ba 00 00 00 00 mov $0x0,%edx -80100575: f7 f6 div %esi -80100577: 0f b6 92 ec 78 10 80 movzbl -0x7fef8714(%edx),%edx -8010057e: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) +80100543: 89 df mov %ebx,%edi +80100545: 83 c3 01 add $0x1,%ebx +80100548: 89 c8 mov %ecx,%eax +8010054a: ba 00 00 00 00 mov $0x0,%edx +8010054f: f7 f6 div %esi +80100551: 0f b6 92 0c 76 10 80 movzbl -0x7fef89f4(%edx),%edx +80100558: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); -80100582: 89 ca mov %ecx,%edx -80100584: 89 c1 mov %eax,%ecx -80100586: 39 d6 cmp %edx,%esi -80100588: 76 df jbe 80100569 +8010055c: 89 ca mov %ecx,%edx +8010055e: 89 c1 mov %eax,%ecx +80100560: 39 d6 cmp %edx,%esi +80100562: 76 df jbe 80100543 if(sign) -8010058a: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) -8010058e: 74 08 je 80100598 +80100564: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) +80100568: 74 08 je 80100572 buf[i++] = '-'; -80100590: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) -80100595: 8d 5f 02 lea 0x2(%edi),%ebx +8010056a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) +8010056f: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) -80100598: 85 db test %ebx,%ebx -8010059a: 7e 18 jle 801005b4 -8010059c: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx -801005a0: 8d 75 d8 lea -0x28(%ebp),%esi +80100572: 85 db test %ebx,%ebx +80100574: 7e 18 jle 8010058e +80100576: 8d 75 d8 lea -0x28(%ebp),%esi +80100579: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx consputc(buf[i]); -801005a3: 0f be 03 movsbl (%ebx),%eax -801005a6: e8 29 fe ff ff call 801003d4 +8010057d: 0f be 03 movsbl (%ebx),%eax +80100580: e8 33 fe ff ff call 801003b8 while(--i >= 0) -801005ab: 89 d8 mov %ebx,%eax -801005ad: 83 eb 01 sub $0x1,%ebx -801005b0: 39 f0 cmp %esi,%eax -801005b2: 75 ef jne 801005a3 -} -801005b4: 83 c4 2c add $0x2c,%esp -801005b7: 5b pop %ebx -801005b8: 5e pop %esi -801005b9: 5f pop %edi -801005ba: 5d pop %ebp -801005bb: c3 ret +80100585: 89 d8 mov %ebx,%eax +80100587: 83 eb 01 sub $0x1,%ebx +8010058a: 39 f0 cmp %esi,%eax +8010058c: 75 ef jne 8010057d +} +8010058e: 83 c4 2c add $0x2c,%esp +80100591: 5b pop %ebx +80100592: 5e pop %esi +80100593: 5f pop %edi +80100594: 5d pop %ebp +80100595: c3 ret x = -xx; -801005bc: f7 d8 neg %eax -801005be: 89 c1 mov %eax,%ecx +80100596: f7 d8 neg %eax +80100598: 89 c1 mov %eax,%ecx if(sign && (sign = xx < 0)) -801005c0: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp) +8010059a: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp) x = -xx; -801005c7: eb 9b jmp 80100564 +801005a1: eb 9b jmp 8010053e -801005c9 : +801005a3 : int consolewrite(struct inode *ip, char *buf, int n) { -801005c9: f3 0f 1e fb endbr32 -801005cd: 55 push %ebp -801005ce: 89 e5 mov %esp,%ebp -801005d0: 57 push %edi -801005d1: 56 push %esi -801005d2: 53 push %ebx -801005d3: 83 ec 18 sub $0x18,%esp -801005d6: 8b 75 0c mov 0xc(%ebp),%esi -801005d9: 8b 7d 10 mov 0x10(%ebp),%edi +801005a3: 55 push %ebp +801005a4: 89 e5 mov %esp,%ebp +801005a6: 57 push %edi +801005a7: 56 push %esi +801005a8: 53 push %ebx +801005a9: 83 ec 18 sub $0x18,%esp +801005ac: 8b 7d 08 mov 0x8(%ebp),%edi +801005af: 8b 75 0c mov 0xc(%ebp),%esi int i; iunlock(ip); -801005dc: ff 75 08 pushl 0x8(%ebp) -801005df: e8 0e 10 00 00 call 801015f2 +801005b2: 57 push %edi +801005b3: e8 bd 0f 00 00 call 80101575 acquire(&cons.lock); -801005e4: c7 04 24 20 b5 10 80 movl $0x8010b520,(%esp) -801005eb: e8 a9 38 00 00 call 80103e99 +801005b8: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp) +801005bf: e8 3d 37 00 00 call 80103d01 for(i = 0; i < n; i++) -801005f0: 83 c4 10 add $0x10,%esp -801005f3: 85 ff test %edi,%edi -801005f5: 7e 13 jle 8010060a -801005f7: 89 f3 mov %esi,%ebx -801005f9: 01 fe add %edi,%esi +801005c4: 83 c4 10 add $0x10,%esp +801005c7: 83 7d 10 00 cmpl $0x0,0x10(%ebp) +801005cb: 7e 14 jle 801005e1 +801005cd: 89 f3 mov %esi,%ebx +801005cf: 03 75 10 add 0x10(%ebp),%esi consputc(buf[i] & 0xff); -801005fb: 0f b6 03 movzbl (%ebx),%eax -801005fe: e8 d1 fd ff ff call 801003d4 +801005d2: 0f b6 03 movzbl (%ebx),%eax +801005d5: e8 de fd ff ff call 801003b8 for(i = 0; i < n; i++) -80100603: 83 c3 01 add $0x1,%ebx -80100606: 39 f3 cmp %esi,%ebx -80100608: 75 f1 jne 801005fb +801005da: 83 c3 01 add $0x1,%ebx +801005dd: 39 f3 cmp %esi,%ebx +801005df: 75 f1 jne 801005d2 release(&cons.lock); -8010060a: 83 ec 0c sub $0xc,%esp -8010060d: 68 20 b5 10 80 push $0x8010b520 -80100612: e8 ed 38 00 00 call 80103f04 +801005e1: 83 ec 0c sub $0xc,%esp +801005e4: 68 20 ff 10 80 push $0x8010ff20 +801005e9: e8 7a 37 00 00 call 80103d68 ilock(ip); -80100617: 83 c4 04 add $0x4,%esp -8010061a: ff 75 08 pushl 0x8(%ebp) -8010061d: e8 0a 0f 00 00 call 8010152c +801005ee: 89 3c 24 mov %edi,(%esp) +801005f1: e8 bd 0e 00 00 call 801014b3 return n; } -80100622: 89 f8 mov %edi,%eax -80100624: 8d 65 f4 lea -0xc(%ebp),%esp -80100627: 5b pop %ebx -80100628: 5e pop %esi -80100629: 5f pop %edi -8010062a: 5d pop %ebp -8010062b: c3 ret - -8010062c : -{ -8010062c: f3 0f 1e fb endbr32 -80100630: 55 push %ebp -80100631: 89 e5 mov %esp,%ebp -80100633: 57 push %edi -80100634: 56 push %esi -80100635: 53 push %ebx -80100636: 83 ec 1c sub $0x1c,%esp +801005f6: 8b 45 10 mov 0x10(%ebp),%eax +801005f9: 8d 65 f4 lea -0xc(%ebp),%esp +801005fc: 5b pop %ebx +801005fd: 5e pop %esi +801005fe: 5f pop %edi +801005ff: 5d pop %ebp +80100600: c3 ret + +80100601 : +{ +80100601: 55 push %ebp +80100602: 89 e5 mov %esp,%ebp +80100604: 57 push %edi +80100605: 56 push %esi +80100606: 53 push %ebx +80100607: 83 ec 1c sub $0x1c,%esp locking = cons.locking; -80100639: a1 54 b5 10 80 mov 0x8010b554,%eax -8010063e: 89 45 dc mov %eax,-0x24(%ebp) +8010060a: a1 54 ff 10 80 mov 0x8010ff54,%eax +8010060f: 89 45 dc mov %eax,-0x24(%ebp) if(locking) -80100641: 85 c0 test %eax,%eax -80100643: 75 2b jne 80100670 +80100612: 85 c0 test %eax,%eax +80100614: 75 2b jne 80100641 if (fmt == 0) -80100645: 8b 7d 08 mov 0x8(%ebp),%edi -80100648: 85 ff test %edi,%edi -8010064a: 74 36 je 80100682 +80100616: 8b 7d 08 mov 0x8(%ebp),%edi +80100619: 85 ff test %edi,%edi +8010061b: 74 36 je 80100653 for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ -8010064c: 0f b6 07 movzbl (%edi),%eax +8010061d: 0f b6 07 movzbl (%edi),%eax argp = (uint*)(void*)(&fmt + 1); -8010064f: 8d 4d 0c lea 0xc(%ebp),%ecx -80100652: 89 4d e4 mov %ecx,-0x1c(%ebp) +80100620: 8d 4d 0c lea 0xc(%ebp),%ecx +80100623: 89 4d e4 mov %ecx,-0x1c(%ebp) for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ -80100655: bb 00 00 00 00 mov $0x0,%ebx -8010065a: 85 c0 test %eax,%eax -8010065c: 75 41 jne 8010069f +80100626: bb 00 00 00 00 mov $0x0,%ebx +8010062b: 85 c0 test %eax,%eax +8010062d: 75 41 jne 80100670 if(locking) -8010065e: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) -80100662: 0f 85 0e 01 00 00 jne 80100776 -} -80100668: 8d 65 f4 lea -0xc(%ebp),%esp -8010066b: 5b pop %ebx -8010066c: 5e pop %esi -8010066d: 5f pop %edi -8010066e: 5d pop %ebp -8010066f: c3 ret +8010062f: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) +80100633: 0f 85 0e 01 00 00 jne 80100747 +} +80100639: 8d 65 f4 lea -0xc(%ebp),%esp +8010063c: 5b pop %ebx +8010063d: 5e pop %esi +8010063e: 5f pop %edi +8010063f: 5d pop %ebp +80100640: c3 ret acquire(&cons.lock); -80100670: 83 ec 0c sub $0xc,%esp -80100673: 68 20 b5 10 80 push $0x8010b520 -80100678: e8 1c 38 00 00 call 80103e99 -8010067d: 83 c4 10 add $0x10,%esp -80100680: eb c3 jmp 80100645 +80100641: 83 ec 0c sub $0xc,%esp +80100644: 68 20 ff 10 80 push $0x8010ff20 +80100649: e8 b3 36 00 00 call 80103d01 +8010064e: 83 c4 10 add $0x10,%esp +80100651: eb c3 jmp 80100616 panic("null fmt"); -80100682: 83 ec 0c sub $0xc,%esp -80100685: 68 db 78 10 80 push $0x801078db -8010068a: e8 c9 fc ff ff call 80100358 +80100653: 83 ec 0c sub $0xc,%esp +80100656: 68 fb 75 10 80 push $0x801075fb +8010065b: e8 e0 fc ff ff call 80100340 consputc(c); -8010068f: e8 40 fd ff ff call 801003d4 +80100660: e8 53 fd ff ff call 801003b8 for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ -80100694: 83 c3 01 add $0x1,%ebx -80100697: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax -8010069b: 85 c0 test %eax,%eax -8010069d: 74 bf je 8010065e +80100665: 83 c3 01 add $0x1,%ebx +80100668: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax +8010066c: 85 c0 test %eax,%eax +8010066e: 74 bf je 8010062f if(c != '%'){ -8010069f: 83 f8 25 cmp $0x25,%eax -801006a2: 75 eb jne 8010068f +80100670: 83 f8 25 cmp $0x25,%eax +80100673: 75 eb jne 80100660 c = fmt[++i] & 0xff; -801006a4: 83 c3 01 add $0x1,%ebx -801006a7: 0f b6 34 1f movzbl (%edi,%ebx,1),%esi +80100675: 83 c3 01 add $0x1,%ebx +80100678: 0f b6 34 1f movzbl (%edi,%ebx,1),%esi if(c == 0) -801006ab: 85 f6 test %esi,%esi -801006ad: 74 af je 8010065e +8010067c: 85 f6 test %esi,%esi +8010067e: 74 af je 8010062f switch(c){ -801006af: 83 fe 70 cmp $0x70,%esi -801006b2: 74 3a je 801006ee -801006b4: 7f 2e jg 801006e4 -801006b6: 83 fe 25 cmp $0x25,%esi -801006b9: 0f 84 92 00 00 00 je 80100751 -801006bf: 83 fe 64 cmp $0x64,%esi -801006c2: 0f 85 98 00 00 00 jne 80100760 +80100680: 83 fe 70 cmp $0x70,%esi +80100683: 74 3a je 801006bf +80100685: 7f 2e jg 801006b5 +80100687: 83 fe 25 cmp $0x25,%esi +8010068a: 0f 84 92 00 00 00 je 80100722 +80100690: 83 fe 64 cmp $0x64,%esi +80100693: 0f 85 98 00 00 00 jne 80100731 printint(*argp++, 10, 1); -801006c8: 8b 45 e4 mov -0x1c(%ebp),%eax -801006cb: 8d 70 04 lea 0x4(%eax),%esi -801006ce: b9 01 00 00 00 mov $0x1,%ecx -801006d3: ba 0a 00 00 00 mov $0xa,%edx -801006d8: 8b 00 mov (%eax),%eax -801006da: e8 69 fe ff ff call 80100548 -801006df: 89 75 e4 mov %esi,-0x1c(%ebp) +80100699: 8b 45 e4 mov -0x1c(%ebp),%eax +8010069c: 8d 70 04 lea 0x4(%eax),%esi +8010069f: b9 01 00 00 00 mov $0x1,%ecx +801006a4: ba 0a 00 00 00 mov $0xa,%edx +801006a9: 8b 00 mov (%eax),%eax +801006ab: e8 72 fe ff ff call 80100522 +801006b0: 89 75 e4 mov %esi,-0x1c(%ebp) break; -801006e2: eb b0 jmp 80100694 +801006b3: eb b0 jmp 80100665 switch(c){ -801006e4: 83 fe 73 cmp $0x73,%esi -801006e7: 74 21 je 8010070a -801006e9: 83 fe 78 cmp $0x78,%esi -801006ec: 75 72 jne 80100760 +801006b5: 83 fe 73 cmp $0x73,%esi +801006b8: 74 21 je 801006db +801006ba: 83 fe 78 cmp $0x78,%esi +801006bd: 75 72 jne 80100731 printint(*argp++, 16, 0); -801006ee: 8b 45 e4 mov -0x1c(%ebp),%eax -801006f1: 8d 70 04 lea 0x4(%eax),%esi -801006f4: b9 00 00 00 00 mov $0x0,%ecx -801006f9: ba 10 00 00 00 mov $0x10,%edx -801006fe: 8b 00 mov (%eax),%eax -80100700: e8 43 fe ff ff call 80100548 -80100705: 89 75 e4 mov %esi,-0x1c(%ebp) +801006bf: 8b 45 e4 mov -0x1c(%ebp),%eax +801006c2: 8d 70 04 lea 0x4(%eax),%esi +801006c5: b9 00 00 00 00 mov $0x0,%ecx +801006ca: ba 10 00 00 00 mov $0x10,%edx +801006cf: 8b 00 mov (%eax),%eax +801006d1: e8 4c fe ff ff call 80100522 +801006d6: 89 75 e4 mov %esi,-0x1c(%ebp) break; -80100708: eb 8a jmp 80100694 +801006d9: eb 8a jmp 80100665 if((s = (char*)*argp++) == 0) -8010070a: 8b 45 e4 mov -0x1c(%ebp),%eax -8010070d: 8d 50 04 lea 0x4(%eax),%edx -80100710: 89 55 e0 mov %edx,-0x20(%ebp) -80100713: 8b 00 mov (%eax),%eax -80100715: 85 c0 test %eax,%eax -80100717: 74 11 je 8010072a -80100719: 89 c6 mov %eax,%esi +801006db: 8b 45 e4 mov -0x1c(%ebp),%eax +801006de: 8d 50 04 lea 0x4(%eax),%edx +801006e1: 89 55 e0 mov %edx,-0x20(%ebp) +801006e4: 8b 00 mov (%eax),%eax +801006e6: 85 c0 test %eax,%eax +801006e8: 74 11 je 801006fb +801006ea: 89 c6 mov %eax,%esi for(; *s; s++) -8010071b: 0f b6 00 movzbl (%eax),%eax +801006ec: 0f b6 00 movzbl (%eax),%eax if((s = (char*)*argp++) == 0) -8010071e: 89 55 e4 mov %edx,-0x1c(%ebp) +801006ef: 89 55 e4 mov %edx,-0x1c(%ebp) for(; *s; s++) -80100721: 84 c0 test %al,%al -80100723: 75 0f jne 80100734 -80100725: e9 6a ff ff ff jmp 80100694 +801006f2: 84 c0 test %al,%al +801006f4: 75 0f jne 80100705 +801006f6: e9 6a ff ff ff jmp 80100665 s = "(null)"; -8010072a: be d4 78 10 80 mov $0x801078d4,%esi +801006fb: be f4 75 10 80 mov $0x801075f4,%esi for(; *s; s++) -8010072f: b8 28 00 00 00 mov $0x28,%eax +80100700: b8 28 00 00 00 mov $0x28,%eax consputc(*s); -80100734: 0f be c0 movsbl %al,%eax -80100737: e8 98 fc ff ff call 801003d4 +80100705: 0f be c0 movsbl %al,%eax +80100708: e8 ab fc ff ff call 801003b8 for(; *s; s++) -8010073c: 83 c6 01 add $0x1,%esi -8010073f: 0f b6 06 movzbl (%esi),%eax -80100742: 84 c0 test %al,%al -80100744: 75 ee jne 80100734 +8010070d: 83 c6 01 add $0x1,%esi +80100710: 0f b6 06 movzbl (%esi),%eax +80100713: 84 c0 test %al,%al +80100715: 75 ee jne 80100705 if((s = (char*)*argp++) == 0) -80100746: 8b 45 e0 mov -0x20(%ebp),%eax -80100749: 89 45 e4 mov %eax,-0x1c(%ebp) -8010074c: e9 43 ff ff ff jmp 80100694 +80100717: 8b 45 e0 mov -0x20(%ebp),%eax +8010071a: 89 45 e4 mov %eax,-0x1c(%ebp) +8010071d: e9 43 ff ff ff jmp 80100665 consputc('%'); -80100751: b8 25 00 00 00 mov $0x25,%eax -80100756: e8 79 fc ff ff call 801003d4 +80100722: b8 25 00 00 00 mov $0x25,%eax +80100727: e8 8c fc ff ff call 801003b8 break; -8010075b: e9 34 ff ff ff jmp 80100694 +8010072c: e9 34 ff ff ff jmp 80100665 consputc('%'); -80100760: b8 25 00 00 00 mov $0x25,%eax -80100765: e8 6a fc ff ff call 801003d4 +80100731: b8 25 00 00 00 mov $0x25,%eax +80100736: e8 7d fc ff ff call 801003b8 consputc(c); -8010076a: 89 f0 mov %esi,%eax -8010076c: e8 63 fc ff ff call 801003d4 +8010073b: 89 f0 mov %esi,%eax +8010073d: e8 76 fc ff ff call 801003b8 break; -80100771: e9 1e ff ff ff jmp 80100694 +80100742: e9 1e ff ff ff jmp 80100665 release(&cons.lock); -80100776: 83 ec 0c sub $0xc,%esp -80100779: 68 20 b5 10 80 push $0x8010b520 -8010077e: e8 81 37 00 00 call 80103f04 -80100783: 83 c4 10 add $0x10,%esp -} -80100786: e9 dd fe ff ff jmp 80100668 - -8010078b : -{ -8010078b: f3 0f 1e fb endbr32 -8010078f: 55 push %ebp -80100790: 89 e5 mov %esp,%ebp -80100792: 57 push %edi -80100793: 56 push %esi -80100794: 53 push %ebx -80100795: 83 ec 28 sub $0x28,%esp -80100798: 8b 7d 08 mov 0x8(%ebp),%edi +80100747: 83 ec 0c sub $0xc,%esp +8010074a: 68 20 ff 10 80 push $0x8010ff20 +8010074f: e8 14 36 00 00 call 80103d68 +80100754: 83 c4 10 add $0x10,%esp +} +80100757: e9 dd fe ff ff jmp 80100639 + +8010075c : +{ +8010075c: 55 push %ebp +8010075d: 89 e5 mov %esp,%ebp +8010075f: 57 push %edi +80100760: 56 push %esi +80100761: 53 push %ebx +80100762: 83 ec 28 sub $0x28,%esp +80100765: 8b 7d 08 mov 0x8(%ebp),%edi acquire(&cons.lock); -8010079b: 68 20 b5 10 80 push $0x8010b520 -801007a0: e8 f4 36 00 00 call 80103e99 +80100768: 68 20 ff 10 80 push $0x8010ff20 +8010076d: e8 8f 35 00 00 call 80103d01 while((c = getc()) >= 0){ -801007a5: 83 c4 10 add $0x10,%esp +80100772: 83 c4 10 add $0x10,%esp int c, doprocdump = 0; -801007a8: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) +80100775: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) while(input.e != input.w && -801007af: bb 40 2b 11 80 mov $0x80112b40,%ebx +8010077c: bb 80 fe 10 80 mov $0x8010fe80,%ebx while((c = getc()) >= 0){ -801007b4: eb 19 jmp 801007cf +80100781: eb 19 jmp 8010079c switch(c){ -801007b6: 83 fe 08 cmp $0x8,%esi -801007b9: 0f 84 cf 00 00 00 je 8010088e -801007bf: 83 fe 10 cmp $0x10,%esi -801007c2: 0f 85 f0 00 00 00 jne 801008b8 -801007c8: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) +80100783: 83 fe 08 cmp $0x8,%esi +80100786: 0f 84 cf 00 00 00 je 8010085b +8010078c: 83 fe 10 cmp $0x10,%esi +8010078f: 0f 85 f0 00 00 00 jne 80100885 +80100795: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) while((c = getc()) >= 0){ -801007cf: ff d7 call *%edi -801007d1: 89 c6 mov %eax,%esi -801007d3: 85 c0 test %eax,%eax -801007d5: 0f 88 ea 00 00 00 js 801008c5 +8010079c: ff d7 call *%edi +8010079e: 89 c6 mov %eax,%esi +801007a0: 85 c0 test %eax,%eax +801007a2: 0f 88 ea 00 00 00 js 80100892 switch(c){ -801007db: 83 fe 15 cmp $0x15,%esi -801007de: 74 67 je 80100847 -801007e0: 7e d4 jle 801007b6 -801007e2: 83 fe 7f cmp $0x7f,%esi -801007e5: 0f 84 a3 00 00 00 je 8010088e +801007a8: 83 fe 15 cmp $0x15,%esi +801007ab: 74 67 je 80100814 +801007ad: 7e d4 jle 80100783 +801007af: 83 fe 7f cmp $0x7f,%esi +801007b2: 0f 84 a3 00 00 00 je 8010085b if(c != 0 && input.e-input.r < INPUT_BUF){ -801007eb: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax -801007f1: 89 c2 mov %eax,%edx -801007f3: 2b 93 80 00 00 00 sub 0x80(%ebx),%edx -801007f9: 83 fa 7f cmp $0x7f,%edx -801007fc: 77 d1 ja 801007cf +801007b8: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax +801007be: 89 c2 mov %eax,%edx +801007c0: 2b 93 80 00 00 00 sub 0x80(%ebx),%edx +801007c6: 83 fa 7f cmp $0x7f,%edx +801007c9: 77 d1 ja 8010079c c = (c == '\r') ? '\n' : c; -801007fe: 83 fe 0d cmp $0xd,%esi -80100801: 0f 84 e3 00 00 00 je 801008ea +801007cb: 83 fe 0d cmp $0xd,%esi +801007ce: 0f 84 e3 00 00 00 je 801008b7 input.buf[input.e++ % INPUT_BUF] = c; -80100807: 8d 50 01 lea 0x1(%eax),%edx -8010080a: 89 93 88 00 00 00 mov %edx,0x88(%ebx) -80100810: 83 e0 7f and $0x7f,%eax -80100813: 89 f1 mov %esi,%ecx -80100815: 88 0c 03 mov %cl,(%ebx,%eax,1) +801007d4: 8d 50 01 lea 0x1(%eax),%edx +801007d7: 89 93 88 00 00 00 mov %edx,0x88(%ebx) +801007dd: 83 e0 7f and $0x7f,%eax +801007e0: 89 f1 mov %esi,%ecx +801007e2: 88 0c 03 mov %cl,(%ebx,%eax,1) consputc(c); -80100818: 89 f0 mov %esi,%eax -8010081a: e8 b5 fb ff ff call 801003d4 +801007e5: 89 f0 mov %esi,%eax +801007e7: e8 cc fb ff ff call 801003b8 if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ -8010081f: 83 fe 0a cmp $0xa,%esi -80100822: 0f 84 dc 00 00 00 je 80100904 -80100828: 83 fe 04 cmp $0x4,%esi -8010082b: 0f 84 d3 00 00 00 je 80100904 -80100831: 8b 83 80 00 00 00 mov 0x80(%ebx),%eax -80100837: 83 e8 80 sub $0xffffff80,%eax -8010083a: 39 83 88 00 00 00 cmp %eax,0x88(%ebx) -80100840: 75 8d jne 801007cf -80100842: e9 bd 00 00 00 jmp 80100904 +801007ec: 83 fe 0a cmp $0xa,%esi +801007ef: 0f 84 dc 00 00 00 je 801008d1 +801007f5: 83 fe 04 cmp $0x4,%esi +801007f8: 0f 84 d3 00 00 00 je 801008d1 +801007fe: 8b 83 80 00 00 00 mov 0x80(%ebx),%eax +80100804: 83 e8 80 sub $0xffffff80,%eax +80100807: 39 83 88 00 00 00 cmp %eax,0x88(%ebx) +8010080d: 75 8d jne 8010079c +8010080f: e9 bd 00 00 00 jmp 801008d1 while(input.e != input.w && -80100847: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax -8010084d: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax -80100853: 0f 84 76 ff ff ff je 801007cf +80100814: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax +8010081a: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax +80100820: 0f 84 76 ff ff ff je 8010079c input.buf[(input.e-1) % INPUT_BUF] != '\n'){ -80100859: 83 e8 01 sub $0x1,%eax -8010085c: 89 c2 mov %eax,%edx -8010085e: 83 e2 7f and $0x7f,%edx +80100826: 83 e8 01 sub $0x1,%eax +80100829: 89 c2 mov %eax,%edx +8010082b: 83 e2 7f and $0x7f,%edx while(input.e != input.w && -80100861: 80 3c 13 0a cmpb $0xa,(%ebx,%edx,1) -80100865: 0f 84 64 ff ff ff je 801007cf +8010082e: 80 3c 13 0a cmpb $0xa,(%ebx,%edx,1) +80100832: 0f 84 64 ff ff ff je 8010079c input.e--; -8010086b: 89 83 88 00 00 00 mov %eax,0x88(%ebx) +80100838: 89 83 88 00 00 00 mov %eax,0x88(%ebx) consputc(BACKSPACE); -80100871: b8 00 01 00 00 mov $0x100,%eax -80100876: e8 59 fb ff ff call 801003d4 +8010083e: b8 00 01 00 00 mov $0x100,%eax +80100843: e8 70 fb ff ff call 801003b8 while(input.e != input.w && -8010087b: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax -80100881: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax -80100887: 75 d0 jne 80100859 -80100889: e9 41 ff ff ff jmp 801007cf +80100848: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax +8010084e: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax +80100854: 75 d0 jne 80100826 +80100856: e9 41 ff ff ff jmp 8010079c if(input.e != input.w){ -8010088e: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax -80100894: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax -8010089a: 0f 84 2f ff ff ff je 801007cf +8010085b: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax +80100861: 3b 83 84 00 00 00 cmp 0x84(%ebx),%eax +80100867: 0f 84 2f ff ff ff je 8010079c input.e--; -801008a0: 83 e8 01 sub $0x1,%eax -801008a3: 89 83 88 00 00 00 mov %eax,0x88(%ebx) +8010086d: 83 e8 01 sub $0x1,%eax +80100870: 89 83 88 00 00 00 mov %eax,0x88(%ebx) consputc(BACKSPACE); -801008a9: b8 00 01 00 00 mov $0x100,%eax -801008ae: e8 21 fb ff ff call 801003d4 -801008b3: e9 17 ff ff ff jmp 801007cf +80100876: b8 00 01 00 00 mov $0x100,%eax +8010087b: e8 38 fb ff ff call 801003b8 +80100880: e9 17 ff ff ff jmp 8010079c if(c != 0 && input.e-input.r < INPUT_BUF){ -801008b8: 85 f6 test %esi,%esi -801008ba: 0f 84 0f ff ff ff je 801007cf -801008c0: e9 26 ff ff ff jmp 801007eb +80100885: 85 f6 test %esi,%esi +80100887: 0f 84 0f ff ff ff je 8010079c +8010088d: e9 26 ff ff ff jmp 801007b8 release(&cons.lock); -801008c5: 83 ec 0c sub $0xc,%esp -801008c8: 68 20 b5 10 80 push $0x8010b520 -801008cd: e8 32 36 00 00 call 80103f04 +80100892: 83 ec 0c sub $0xc,%esp +80100895: 68 20 ff 10 80 push $0x8010ff20 +8010089a: e8 c9 34 00 00 call 80103d68 if(doprocdump) { -801008d2: 83 c4 10 add $0x10,%esp -801008d5: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) -801008d9: 75 08 jne 801008e3 -} -801008db: 8d 65 f4 lea -0xc(%ebp),%esp -801008de: 5b pop %ebx -801008df: 5e pop %esi -801008e0: 5f pop %edi -801008e1: 5d pop %ebp -801008e2: c3 ret +8010089f: 83 c4 10 add $0x10,%esp +801008a2: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) +801008a6: 75 08 jne 801008b0 +} +801008a8: 8d 65 f4 lea -0xc(%ebp),%esp +801008ab: 5b pop %ebx +801008ac: 5e pop %esi +801008ad: 5f pop %edi +801008ae: 5d pop %ebp +801008af: c3 ret procdump(); // now call procdump() wo. cons.lock held -801008e3: e8 f7 31 00 00 call 80103adf +801008b0: e8 bf 30 00 00 call 80103974 } -801008e8: eb f1 jmp 801008db +801008b5: eb f1 jmp 801008a8 input.buf[input.e++ % INPUT_BUF] = c; -801008ea: 8d 50 01 lea 0x1(%eax),%edx -801008ed: 89 93 88 00 00 00 mov %edx,0x88(%ebx) -801008f3: 83 e0 7f and $0x7f,%eax -801008f6: c6 04 03 0a movb $0xa,(%ebx,%eax,1) +801008b7: 8d 50 01 lea 0x1(%eax),%edx +801008ba: 89 93 88 00 00 00 mov %edx,0x88(%ebx) +801008c0: 83 e0 7f and $0x7f,%eax +801008c3: c6 04 03 0a movb $0xa,(%ebx,%eax,1) consputc(c); -801008fa: b8 0a 00 00 00 mov $0xa,%eax -801008ff: e8 d0 fa ff ff call 801003d4 +801008c7: b8 0a 00 00 00 mov $0xa,%eax +801008cc: e8 e7 fa ff ff call 801003b8 input.w = input.e; -80100904: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax -8010090a: 89 83 84 00 00 00 mov %eax,0x84(%ebx) +801008d1: 8b 83 88 00 00 00 mov 0x88(%ebx),%eax +801008d7: 89 83 84 00 00 00 mov %eax,0x84(%ebx) wakeup(&input.r); -80100910: 83 ec 0c sub $0xc,%esp -80100913: 68 c0 2b 11 80 push $0x80112bc0 -80100918: e8 1d 31 00 00 call 80103a3a -8010091d: 83 c4 10 add $0x10,%esp -80100920: e9 aa fe ff ff jmp 801007cf +801008dd: 83 ec 0c sub $0xc,%esp +801008e0: 68 00 ff 10 80 push $0x8010ff00 +801008e5: e8 ed 2f 00 00 call 801038d7 +801008ea: 83 c4 10 add $0x10,%esp +801008ed: e9 aa fe ff ff jmp 8010079c -80100925 : +801008f2 : void consoleinit(void) { -80100925: f3 0f 1e fb endbr32 -80100929: 55 push %ebp -8010092a: 89 e5 mov %esp,%ebp -8010092c: 83 ec 10 sub $0x10,%esp +801008f2: 55 push %ebp +801008f3: 89 e5 mov %esp,%ebp +801008f5: 83 ec 10 sub $0x10,%esp initlock(&cons.lock, "console"); -8010092f: 68 e4 78 10 80 push $0x801078e4 -80100934: 68 20 b5 10 80 push $0x8010b520 -80100939: e8 ff 33 00 00 call 80103d3d +801008f8: 68 04 76 10 80 push $0x80107604 +801008fd: 68 20 ff 10 80 push $0x8010ff20 +80100902: e8 b1 32 00 00 call 80103bb8 devsw[CONSOLE].write = consolewrite; -8010093e: c7 05 8c 35 11 80 c9 movl $0x801005c9,0x8011358c -80100945: 05 10 80 +80100907: c7 05 0c 09 11 80 a3 movl $0x801005a3,0x8011090c +8010090e: 05 10 80 devsw[CONSOLE].read = consoleread; -80100948: c7 05 88 35 11 80 64 movl $0x80100264,0x80113588 -8010094f: 02 10 80 +80100911: c7 05 08 09 11 80 54 movl $0x80100254,0x80110908 +80100918: 02 10 80 cons.locking = 1; -80100952: c7 05 54 b5 10 80 01 movl $0x1,0x8010b554 -80100959: 00 00 00 +8010091b: c7 05 54 ff 10 80 01 movl $0x1,0x8010ff54 +80100922: 00 00 00 ioapicenable(IRQ_KBD, 0); -8010095c: 83 c4 08 add $0x8,%esp -8010095f: 6a 00 push $0x0 -80100961: 6a 01 push $0x1 -80100963: e8 1c 17 00 00 call 80102084 +80100925: 83 c4 08 add $0x8,%esp +80100928: 6a 00 push $0x0 +8010092a: 6a 01 push $0x1 +8010092c: e8 98 16 00 00 call 80101fc9 } -80100968: 83 c4 10 add $0x10,%esp -8010096b: c9 leave -8010096c: c3 ret +80100931: 83 c4 10 add $0x10,%esp +80100934: c9 leave +80100935: c3 ret -8010096d : +80100936 : #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { -8010096d: f3 0f 1e fb endbr32 -80100971: 55 push %ebp -80100972: 89 e5 mov %esp,%ebp -80100974: 57 push %edi -80100975: 56 push %esi -80100976: 53 push %ebx -80100977: 81 ec 0c 01 00 00 sub $0x10c,%esp +80100936: 55 push %ebp +80100937: 89 e5 mov %esp,%ebp +80100939: 57 push %edi +8010093a: 56 push %esi +8010093b: 53 push %ebx +8010093c: 81 ec 0c 01 00 00 sub $0x10c,%esp uint argc, sz, sp, ustack[3+MAXARG+1]; struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; struct proc *curproc = myproc(); -8010097d: e8 68 2a 00 00 call 801033ea -80100982: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) +80100942: e8 69 29 00 00 call 801032b0 +80100947: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) begin_op(); -80100988: e8 f3 1e 00 00 call 80102880 +8010094d: e8 2c 1e 00 00 call 8010277e if((ip = namei(path)) == 0){ -8010098d: 83 ec 0c sub $0xc,%esp -80100990: ff 75 08 pushl 0x8(%ebp) -80100993: e8 4c 13 00 00 call 80101ce4 -80100998: 83 c4 10 add $0x10,%esp -8010099b: 85 c0 test %eax,%eax -8010099d: 74 4e je 801009ed -8010099f: 89 c3 mov %eax,%ebx +80100952: 83 ec 0c sub $0xc,%esp +80100955: ff 75 08 push 0x8(%ebp) +80100958: e8 e4 12 00 00 call 80101c41 +8010095d: 83 c4 10 add $0x10,%esp +80100960: 85 c0 test %eax,%eax +80100962: 74 4e je 801009b2 +80100964: 89 c3 mov %eax,%ebx end_op(); cprintf("exec: fail\n"); return -1; } ilock(ip); -801009a1: 83 ec 0c sub $0xc,%esp -801009a4: 50 push %eax -801009a5: e8 82 0b 00 00 call 8010152c +80100966: 83 ec 0c sub $0xc,%esp +80100969: 50 push %eax +8010096a: e8 44 0b 00 00 call 801014b3 pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) -801009aa: 6a 34 push $0x34 -801009ac: 6a 00 push $0x0 -801009ae: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax -801009b4: 50 push %eax -801009b5: 53 push %ebx -801009b6: e8 19 0e 00 00 call 801017d4 -801009bb: 83 c4 20 add $0x20,%esp -801009be: 83 f8 34 cmp $0x34,%eax -801009c1: 75 0c jne 801009cf +8010096f: 6a 34 push $0x34 +80100971: 6a 00 push $0x0 +80100973: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax +80100979: 50 push %eax +8010097a: 53 push %ebx +8010097b: e8 c7 0d 00 00 call 80101747 +80100980: 83 c4 20 add $0x20,%esp +80100983: 83 f8 34 cmp $0x34,%eax +80100986: 75 0c jne 80100994 goto bad; if(elf.magic != ELF_MAGIC) -801009c3: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) -801009ca: 45 4c 46 -801009cd: 74 3a je 80100a09 +80100988: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) +8010098f: 45 4c 46 +80100992: 74 3a je 801009ce bad: if(pgdir) freevm(pgdir); if(ip){ iunlockput(ip); -801009cf: 83 ec 0c sub $0xc,%esp -801009d2: 53 push %ebx -801009d3: e8 a9 0d 00 00 call 80101781 +80100994: 83 ec 0c sub $0xc,%esp +80100997: 53 push %ebx +80100998: e8 5f 0d 00 00 call 801016fc end_op(); -801009d8: e8 22 1f 00 00 call 801028ff -801009dd: 83 c4 10 add $0x10,%esp +8010099d: e8 57 1e 00 00 call 801027f9 +801009a2: 83 c4 10 add $0x10,%esp } return -1; -801009e0: b8 ff ff ff ff mov $0xffffffff,%eax -} -801009e5: 8d 65 f4 lea -0xc(%ebp),%esp -801009e8: 5b pop %ebx -801009e9: 5e pop %esi -801009ea: 5f pop %edi -801009eb: 5d pop %ebp -801009ec: c3 ret +801009a5: b8 ff ff ff ff mov $0xffffffff,%eax +} +801009aa: 8d 65 f4 lea -0xc(%ebp),%esp +801009ad: 5b pop %ebx +801009ae: 5e pop %esi +801009af: 5f pop %edi +801009b0: 5d pop %ebp +801009b1: c3 ret end_op(); -801009ed: e8 0d 1f 00 00 call 801028ff +801009b2: e8 42 1e 00 00 call 801027f9 cprintf("exec: fail\n"); -801009f2: 83 ec 0c sub $0xc,%esp -801009f5: 68 fd 78 10 80 push $0x801078fd -801009fa: e8 2d fc ff ff call 8010062c +801009b7: 83 ec 0c sub $0xc,%esp +801009ba: 68 1d 76 10 80 push $0x8010761d +801009bf: e8 3d fc ff ff call 80100601 return -1; -801009ff: 83 c4 10 add $0x10,%esp -80100a02: b8 ff ff ff ff mov $0xffffffff,%eax -80100a07: eb dc jmp 801009e5 +801009c4: 83 c4 10 add $0x10,%esp +801009c7: b8 ff ff ff ff mov $0xffffffff,%eax +801009cc: eb dc jmp 801009aa if((pgdir = setupkvm()) == 0) -80100a09: e8 f0 5a 00 00 call 801064fe -80100a0e: 89 c7 mov %eax,%edi -80100a10: 85 c0 test %eax,%eax -80100a12: 74 bb je 801009cf +801009ce: e8 be 58 00 00 call 80106291 +801009d3: 89 c7 mov %eax,%edi +801009d5: 85 c0 test %eax,%eax +801009d7: 74 bb je 80100994 for(i=0, off=elf.phoff; i +801009d9: 8b 85 40 ff ff ff mov -0xc0(%ebp),%eax +801009df: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp) +801009e6: 00 +801009e7: 0f 84 c3 00 00 00 je 80100ab0 sz = 0; -80100a28: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) -80100a2f: 00 00 00 +801009ed: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) +801009f4: 00 00 00 for(i=0, off=elf.phoff; i -80100a39: 83 c6 01 add $0x1,%esi -80100a3c: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax -80100a42: 83 c0 20 add $0x20,%eax -80100a45: 0f b7 95 50 ff ff ff movzwl -0xb0(%ebp),%edx -80100a4c: 39 f2 cmp %esi,%edx -80100a4e: 0f 8e a1 00 00 00 jle 80100af5 +801009f7: be 00 00 00 00 mov $0x0,%esi +801009fc: eb 1b jmp 80100a19 +801009fe: 83 c6 01 add $0x1,%esi +80100a01: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax +80100a07: 83 c0 20 add $0x20,%eax +80100a0a: 0f b7 95 50 ff ff ff movzwl -0xb0(%ebp),%edx +80100a11: 39 f2 cmp %esi,%edx +80100a13: 0f 8e a1 00 00 00 jle 80100aba if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) -80100a54: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) -80100a5a: 6a 20 push $0x20 -80100a5c: 50 push %eax -80100a5d: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax -80100a63: 50 push %eax -80100a64: 53 push %ebx -80100a65: e8 6a 0d 00 00 call 801017d4 -80100a6a: 83 c4 10 add $0x10,%esp -80100a6d: 83 f8 20 cmp $0x20,%eax -80100a70: 0f 85 c0 00 00 00 jne 80100b36 +80100a19: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) +80100a1f: 6a 20 push $0x20 +80100a21: 50 push %eax +80100a22: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax +80100a28: 50 push %eax +80100a29: 53 push %ebx +80100a2a: e8 18 0d 00 00 call 80101747 +80100a2f: 83 c4 10 add $0x10,%esp +80100a32: 83 f8 20 cmp $0x20,%eax +80100a35: 0f 85 c0 00 00 00 jne 80100afb if(ph.type != ELF_PROG_LOAD) -80100a76: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) -80100a7d: 75 ba jne 80100a39 +80100a3b: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) +80100a42: 75 ba jne 801009fe if(ph.memsz < ph.filesz) -80100a7f: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax -80100a85: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax -80100a8b: 0f 82 a5 00 00 00 jb 80100b36 +80100a44: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax +80100a4a: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax +80100a50: 0f 82 a5 00 00 00 jb 80100afb if(ph.vaddr + ph.memsz < ph.vaddr) -80100a91: 03 85 0c ff ff ff add -0xf4(%ebp),%eax -80100a97: 0f 82 99 00 00 00 jb 80100b36 +80100a56: 03 85 0c ff ff ff add -0xf4(%ebp),%eax +80100a5c: 0f 82 99 00 00 00 jb 80100afb if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) -80100a9d: 83 ec 04 sub $0x4,%esp -80100aa0: 50 push %eax -80100aa1: ff b5 f0 fe ff ff pushl -0x110(%ebp) -80100aa7: 57 push %edi -80100aa8: e8 e8 58 00 00 call 80106395 -80100aad: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) -80100ab3: 83 c4 10 add $0x10,%esp -80100ab6: 85 c0 test %eax,%eax -80100ab8: 74 7c je 80100b36 +80100a62: 83 ec 04 sub $0x4,%esp +80100a65: 50 push %eax +80100a66: ff b5 f0 fe ff ff push -0x110(%ebp) +80100a6c: 57 push %edi +80100a6d: e8 be 56 00 00 call 80106130 +80100a72: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) +80100a78: 83 c4 10 add $0x10,%esp +80100a7b: 85 c0 test %eax,%eax +80100a7d: 74 7c je 80100afb if(ph.vaddr % PGSIZE != 0) -80100aba: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax -80100ac0: a9 ff 0f 00 00 test $0xfff,%eax -80100ac5: 75 6f jne 80100b36 +80100a7f: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax +80100a85: a9 ff 0f 00 00 test $0xfff,%eax +80100a8a: 75 6f jne 80100afb if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) -80100ac7: 83 ec 0c sub $0xc,%esp -80100aca: ff b5 14 ff ff ff pushl -0xec(%ebp) -80100ad0: ff b5 08 ff ff ff pushl -0xf8(%ebp) -80100ad6: 53 push %ebx -80100ad7: 50 push %eax -80100ad8: 57 push %edi -80100ad9: e8 74 57 00 00 call 80106252 -80100ade: 83 c4 20 add $0x20,%esp -80100ae1: 85 c0 test %eax,%eax -80100ae3: 0f 89 50 ff ff ff jns 80100a39 -80100ae9: eb 4b jmp 80100b36 +80100a8c: 83 ec 0c sub $0xc,%esp +80100a8f: ff b5 14 ff ff ff push -0xec(%ebp) +80100a95: ff b5 08 ff ff ff push -0xf8(%ebp) +80100a9b: 53 push %ebx +80100a9c: 50 push %eax +80100a9d: 57 push %edi +80100a9e: e8 53 55 00 00 call 80105ff6 +80100aa3: 83 c4 20 add $0x20,%esp +80100aa6: 85 c0 test %eax,%eax +80100aa8: 0f 89 50 ff ff ff jns 801009fe +80100aae: eb 4b jmp 80100afb sz = 0; -80100aeb: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) -80100af2: 00 00 00 +80100ab0: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) +80100ab7: 00 00 00 iunlockput(ip); -80100af5: 83 ec 0c sub $0xc,%esp -80100af8: 53 push %ebx -80100af9: e8 83 0c 00 00 call 80101781 +80100aba: 83 ec 0c sub $0xc,%esp +80100abd: 53 push %ebx +80100abe: e8 39 0c 00 00 call 801016fc end_op(); -80100afe: e8 fc 1d 00 00 call 801028ff +80100ac3: e8 31 1d 00 00 call 801027f9 sz = PGROUNDUP(sz); -80100b03: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax -80100b09: 05 ff 0f 00 00 add $0xfff,%eax -80100b0e: 25 00 f0 ff ff and $0xfffff000,%eax +80100ac8: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax +80100ace: 05 ff 0f 00 00 add $0xfff,%eax +80100ad3: 25 00 f0 ff ff and $0xfffff000,%eax if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) -80100b13: 83 c4 0c add $0xc,%esp -80100b16: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx -80100b1c: 52 push %edx -80100b1d: 50 push %eax -80100b1e: 57 push %edi -80100b1f: e8 71 58 00 00 call 80106395 -80100b24: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) -80100b2a: 83 c4 10 add $0x10,%esp +80100ad8: 83 c4 0c add $0xc,%esp +80100adb: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx +80100ae1: 52 push %edx +80100ae2: 50 push %eax +80100ae3: 57 push %edi +80100ae4: e8 47 56 00 00 call 80106130 +80100ae9: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) +80100aef: 83 c4 10 add $0x10,%esp ip = 0; -80100b2d: bb 00 00 00 00 mov $0x0,%ebx +80100af2: bb 00 00 00 00 mov $0x0,%ebx if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) -80100b32: 85 c0 test %eax,%eax -80100b34: 75 1e jne 80100b54 +80100af7: 85 c0 test %eax,%eax +80100af9: 75 1e jne 80100b19 freevm(pgdir); -80100b36: 83 ec 0c sub $0xc,%esp -80100b39: 57 push %edi -80100b3a: e8 48 59 00 00 call 80106487 +80100afb: 83 ec 0c sub $0xc,%esp +80100afe: 57 push %edi +80100aff: e8 1a 57 00 00 call 8010621e if(ip){ -80100b3f: 83 c4 10 add $0x10,%esp -80100b42: 85 db test %ebx,%ebx -80100b44: 0f 85 85 fe ff ff jne 801009cf +80100b04: 83 c4 10 add $0x10,%esp +80100b07: 85 db test %ebx,%ebx +80100b09: 0f 85 85 fe ff ff jne 80100994 return -1; -80100b4a: b8 ff ff ff ff mov $0xffffffff,%eax -80100b4f: e9 91 fe ff ff jmp 801009e5 +80100b0f: b8 ff ff ff ff mov $0xffffffff,%eax +80100b14: e9 91 fe ff ff jmp 801009aa clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); -80100b54: 83 ec 08 sub $0x8,%esp -80100b57: 89 c3 mov %eax,%ebx -80100b59: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax -80100b5f: 50 push %eax -80100b60: 57 push %edi -80100b61: e8 25 5a 00 00 call 8010658b +80100b19: 83 ec 08 sub $0x8,%esp +80100b1c: 89 c3 mov %eax,%ebx +80100b1e: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax +80100b24: 50 push %eax +80100b25: 57 push %edi +80100b26: e8 eb 57 00 00 call 80106316 for(argc = 0; argv[argc]; argc++) { -80100b66: 8b 45 0c mov 0xc(%ebp),%eax -80100b69: 8b 00 mov (%eax),%eax -80100b6b: 83 c4 10 add $0x10,%esp -80100b6e: be 00 00 00 00 mov $0x0,%esi -80100b73: 85 c0 test %eax,%eax -80100b75: 74 5f je 80100bd6 +80100b2b: 8b 45 0c mov 0xc(%ebp),%eax +80100b2e: 8b 00 mov (%eax),%eax +80100b30: 83 c4 10 add $0x10,%esp +80100b33: be 00 00 00 00 mov $0x0,%esi +80100b38: 85 c0 test %eax,%eax +80100b3a: 74 5e je 80100b9a sp = (sp - (strlen(argv[argc]) + 1)) & ~3; -80100b77: 83 ec 0c sub $0xc,%esp -80100b7a: 50 push %eax -80100b7b: e8 9f 35 00 00 call 8010411f -80100b80: f7 d0 not %eax -80100b82: 01 d8 add %ebx,%eax -80100b84: 83 e0 fc and $0xfffffffc,%eax -80100b87: 89 c3 mov %eax,%ebx +80100b3c: 83 ec 0c sub $0xc,%esp +80100b3f: 50 push %eax +80100b40: e8 20 34 00 00 call 80103f65 +80100b45: 29 c3 sub %eax,%ebx +80100b47: 83 eb 01 sub $0x1,%ebx +80100b4a: 83 e3 fc and $0xfffffffc,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) -80100b89: 83 c4 04 add $0x4,%esp -80100b8c: 8b 45 0c mov 0xc(%ebp),%eax -80100b8f: ff 34 b0 pushl (%eax,%esi,4) -80100b92: e8 88 35 00 00 call 8010411f -80100b97: 83 c0 01 add $0x1,%eax -80100b9a: 50 push %eax -80100b9b: 8b 45 0c mov 0xc(%ebp),%eax -80100b9e: ff 34 b0 pushl (%eax,%esi,4) -80100ba1: 53 push %ebx -80100ba2: 57 push %edi -80100ba3: e8 3a 5b 00 00 call 801066e2 -80100ba8: 83 c4 20 add $0x20,%esp -80100bab: 85 c0 test %eax,%eax -80100bad: 0f 88 f0 00 00 00 js 80100ca3 +80100b4d: 83 c4 04 add $0x4,%esp +80100b50: 8b 45 0c mov 0xc(%ebp),%eax +80100b53: ff 34 b0 push (%eax,%esi,4) +80100b56: e8 0a 34 00 00 call 80103f65 +80100b5b: 83 c0 01 add $0x1,%eax +80100b5e: 50 push %eax +80100b5f: 8b 45 0c mov 0xc(%ebp),%eax +80100b62: ff 34 b0 push (%eax,%esi,4) +80100b65: 53 push %ebx +80100b66: 57 push %edi +80100b67: e8 f5 58 00 00 call 80106461 +80100b6c: 83 c4 20 add $0x20,%esp +80100b6f: 85 c0 test %eax,%eax +80100b71: 0f 88 f0 00 00 00 js 80100c67 ustack[3+argc] = sp; -80100bb3: 89 9c b5 64 ff ff ff mov %ebx,-0x9c(%ebp,%esi,4) +80100b77: 89 9c b5 64 ff ff ff mov %ebx,-0x9c(%ebp,%esi,4) for(argc = 0; argv[argc]; argc++) { -80100bba: 83 c6 01 add $0x1,%esi -80100bbd: 8b 45 0c mov 0xc(%ebp),%eax -80100bc0: 8b 04 b0 mov (%eax,%esi,4),%eax -80100bc3: 85 c0 test %eax,%eax -80100bc5: 74 15 je 80100bdc +80100b7e: 83 c6 01 add $0x1,%esi +80100b81: 8b 45 0c mov 0xc(%ebp),%eax +80100b84: 8b 04 b0 mov (%eax,%esi,4),%eax +80100b87: 85 c0 test %eax,%eax +80100b89: 74 15 je 80100ba0 if(argc >= MAXARG) -80100bc7: 83 fe 20 cmp $0x20,%esi -80100bca: 75 ab jne 80100b77 +80100b8b: 83 fe 20 cmp $0x20,%esi +80100b8e: 75 ac jne 80100b3c ip = 0; -80100bcc: bb 00 00 00 00 mov $0x0,%ebx -80100bd1: e9 60 ff ff ff jmp 80100b36 +80100b90: bb 00 00 00 00 mov $0x0,%ebx +80100b95: e9 61 ff ff ff jmp 80100afb sp = sz; -80100bd6: 8b 9d f4 fe ff ff mov -0x10c(%ebp),%ebx +80100b9a: 8b 9d f4 fe ff ff mov -0x10c(%ebp),%ebx ustack[3+argc] = 0; -80100bdc: c7 84 b5 64 ff ff ff movl $0x0,-0x9c(%ebp,%esi,4) -80100be3: 00 00 00 00 +80100ba0: c7 84 b5 64 ff ff ff movl $0x0,-0x9c(%ebp,%esi,4) +80100ba7: 00 00 00 00 ustack[0] = 0xffffffff; // fake return PC -80100be7: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) -80100bee: ff ff ff +80100bab: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) +80100bb2: ff ff ff ustack[1] = argc; -80100bf1: 89 b5 5c ff ff ff mov %esi,-0xa4(%ebp) +80100bb5: 89 b5 5c ff ff ff mov %esi,-0xa4(%ebp) ustack[2] = sp - (argc+1)*4; // argv pointer -80100bf7: 8d 04 b5 04 00 00 00 lea 0x4(,%esi,4),%eax -80100bfe: 89 da mov %ebx,%edx -80100c00: 29 c2 sub %eax,%edx -80100c02: 89 95 60 ff ff ff mov %edx,-0xa0(%ebp) +80100bbb: 8d 04 b5 04 00 00 00 lea 0x4(,%esi,4),%eax +80100bc2: 89 da mov %ebx,%edx +80100bc4: 29 c2 sub %eax,%edx +80100bc6: 89 95 60 ff ff ff mov %edx,-0xa0(%ebp) sp -= (3+argc+1) * 4; -80100c08: 83 c0 0c add $0xc,%eax -80100c0b: 89 de mov %ebx,%esi -80100c0d: 29 c6 sub %eax,%esi +80100bcc: 83 c0 0c add $0xc,%eax +80100bcf: 89 de mov %ebx,%esi +80100bd1: 29 c6 sub %eax,%esi if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) -80100c0f: 50 push %eax -80100c10: 8d 85 58 ff ff ff lea -0xa8(%ebp),%eax -80100c16: 50 push %eax -80100c17: 56 push %esi -80100c18: 57 push %edi -80100c19: e8 c4 5a 00 00 call 801066e2 -80100c1e: 83 c4 10 add $0x10,%esp -80100c21: 85 c0 test %eax,%eax -80100c23: 0f 88 84 00 00 00 js 80100cad +80100bd3: 50 push %eax +80100bd4: 8d 85 58 ff ff ff lea -0xa8(%ebp),%eax +80100bda: 50 push %eax +80100bdb: 56 push %esi +80100bdc: 57 push %edi +80100bdd: e8 7f 58 00 00 call 80106461 +80100be2: 83 c4 10 add $0x10,%esp +80100be5: 85 c0 test %eax,%eax +80100be7: 0f 88 84 00 00 00 js 80100c71 for(last=s=path; *s; s++) -80100c29: 8b 45 08 mov 0x8(%ebp),%eax -80100c2c: 0f b6 10 movzbl (%eax),%edx -80100c2f: 84 d2 test %dl,%dl -80100c31: 74 1a je 80100c4d -80100c33: 83 c0 01 add $0x1,%eax -80100c36: 8b 4d 08 mov 0x8(%ebp),%ecx +80100bed: 8b 45 08 mov 0x8(%ebp),%eax +80100bf0: 0f b6 10 movzbl (%eax),%edx +80100bf3: 84 d2 test %dl,%dl +80100bf5: 74 1a je 80100c11 +80100bf7: 83 c0 01 add $0x1,%eax +80100bfa: 8b 4d 08 mov 0x8(%ebp),%ecx last = s+1; -80100c39: 80 fa 2f cmp $0x2f,%dl -80100c3c: 0f 44 c8 cmove %eax,%ecx +80100bfd: 80 fa 2f cmp $0x2f,%dl +80100c00: 0f 44 c8 cmove %eax,%ecx for(last=s=path; *s; s++) -80100c3f: 83 c0 01 add $0x1,%eax -80100c42: 0f b6 50 ff movzbl -0x1(%eax),%edx -80100c46: 84 d2 test %dl,%dl -80100c48: 75 ef jne 80100c39 -80100c4a: 89 4d 08 mov %ecx,0x8(%ebp) +80100c03: 83 c0 01 add $0x1,%eax +80100c06: 0f b6 50 ff movzbl -0x1(%eax),%edx +80100c0a: 84 d2 test %dl,%dl +80100c0c: 75 ef jne 80100bfd +80100c0e: 89 4d 08 mov %ecx,0x8(%ebp) safestrcpy(curproc->name, last, sizeof(curproc->name)); -80100c4d: 83 ec 04 sub $0x4,%esp -80100c50: 6a 10 push $0x10 -80100c52: ff 75 08 pushl 0x8(%ebp) -80100c55: 8b 9d ec fe ff ff mov -0x114(%ebp),%ebx -80100c5b: 8d 43 6c lea 0x6c(%ebx),%eax -80100c5e: 50 push %eax -80100c5f: e8 81 34 00 00 call 801040e5 +80100c11: 83 ec 04 sub $0x4,%esp +80100c14: 6a 10 push $0x10 +80100c16: ff 75 08 push 0x8(%ebp) +80100c19: 8b 9d ec fe ff ff mov -0x114(%ebp),%ebx +80100c1f: 8d 43 6c lea 0x6c(%ebx),%eax +80100c22: 50 push %eax +80100c23: e8 07 33 00 00 call 80103f2f oldpgdir = curproc->pgdir; -80100c64: 89 d9 mov %ebx,%ecx -80100c66: 8b 5b 04 mov 0x4(%ebx),%ebx +80100c28: 89 d9 mov %ebx,%ecx +80100c2a: 8b 5b 04 mov 0x4(%ebx),%ebx curproc->pgdir = pgdir; -80100c69: 89 79 04 mov %edi,0x4(%ecx) +80100c2d: 89 79 04 mov %edi,0x4(%ecx) curproc->sz = sz; -80100c6c: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi -80100c72: 89 39 mov %edi,(%ecx) +80100c30: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi +80100c36: 89 39 mov %edi,(%ecx) curproc->tf->eip = elf.entry; // main -80100c74: 8b 41 18 mov 0x18(%ecx),%eax -80100c77: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx -80100c7d: 89 50 38 mov %edx,0x38(%eax) +80100c38: 8b 41 18 mov 0x18(%ecx),%eax +80100c3b: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx +80100c41: 89 50 38 mov %edx,0x38(%eax) curproc->tf->esp = sp; -80100c80: 8b 41 18 mov 0x18(%ecx),%eax -80100c83: 89 70 44 mov %esi,0x44(%eax) +80100c44: 8b 41 18 mov 0x18(%ecx),%eax +80100c47: 89 70 44 mov %esi,0x44(%eax) switchuvm(curproc); -80100c86: 89 0c 24 mov %ecx,(%esp) -80100c89: e8 55 54 00 00 call 801060e3 +80100c4a: 89 0c 24 mov %ecx,(%esp) +80100c4d: e8 3d 52 00 00 call 80105e8f freevm(oldpgdir); -80100c8e: 89 1c 24 mov %ebx,(%esp) -80100c91: e8 f1 57 00 00 call 80106487 +80100c52: 89 1c 24 mov %ebx,(%esp) +80100c55: e8 c4 55 00 00 call 8010621e return 0; -80100c96: 83 c4 10 add $0x10,%esp -80100c99: b8 00 00 00 00 mov $0x0,%eax -80100c9e: e9 42 fd ff ff jmp 801009e5 +80100c5a: 83 c4 10 add $0x10,%esp +80100c5d: b8 00 00 00 00 mov $0x0,%eax +80100c62: e9 43 fd ff ff jmp 801009aa ip = 0; -80100ca3: bb 00 00 00 00 mov $0x0,%ebx -80100ca8: e9 89 fe ff ff jmp 80100b36 -80100cad: bb 00 00 00 00 mov $0x0,%ebx -80100cb2: e9 7f fe ff ff jmp 80100b36 +80100c67: bb 00 00 00 00 mov $0x0,%ebx +80100c6c: e9 8a fe ff ff jmp 80100afb +80100c71: bb 00 00 00 00 mov $0x0,%ebx +80100c76: e9 80 fe ff ff jmp 80100afb -80100cb7 : +80100c7b : struct file file[NFILE]; } ftable; void fileinit(void) { -80100cb7: f3 0f 1e fb endbr32 -80100cbb: 55 push %ebp -80100cbc: 89 e5 mov %esp,%ebp -80100cbe: 83 ec 10 sub $0x10,%esp +80100c7b: 55 push %ebp +80100c7c: 89 e5 mov %esp,%ebp +80100c7e: 83 ec 10 sub $0x10,%esp initlock(&ftable.lock, "ftable"); -80100cc1: 68 09 79 10 80 push $0x80107909 -80100cc6: 68 e0 2b 11 80 push $0x80112be0 -80100ccb: e8 6d 30 00 00 call 80103d3d +80100c81: 68 29 76 10 80 push $0x80107629 +80100c86: 68 60 ff 10 80 push $0x8010ff60 +80100c8b: e8 28 2f 00 00 call 80103bb8 } -80100cd0: 83 c4 10 add $0x10,%esp -80100cd3: c9 leave -80100cd4: c3 ret +80100c90: 83 c4 10 add $0x10,%esp +80100c93: c9 leave +80100c94: c3 ret -80100cd5 : +80100c95 : // Allocate a file structure. struct file* filealloc(void) { -80100cd5: f3 0f 1e fb endbr32 -80100cd9: 55 push %ebp -80100cda: 89 e5 mov %esp,%ebp -80100cdc: 53 push %ebx -80100cdd: 83 ec 10 sub $0x10,%esp +80100c95: 55 push %ebp +80100c96: 89 e5 mov %esp,%ebp +80100c98: 53 push %ebx +80100c99: 83 ec 10 sub $0x10,%esp struct file *f; acquire(&ftable.lock); -80100ce0: 68 e0 2b 11 80 push $0x80112be0 -80100ce5: e8 af 31 00 00 call 80103e99 -80100cea: 83 c4 10 add $0x10,%esp +80100c9c: 68 60 ff 10 80 push $0x8010ff60 +80100ca1: e8 5b 30 00 00 call 80103d01 +80100ca6: 83 c4 10 add $0x10,%esp for(f = ftable.file; f < ftable.file + NFILE; f++){ -80100ced: bb 14 2c 11 80 mov $0x80112c14,%ebx +80100ca9: bb 94 ff 10 80 mov $0x8010ff94,%ebx if(f->ref == 0){ -80100cf2: 83 7b 04 00 cmpl $0x0,0x4(%ebx) -80100cf6: 74 22 je 80100d1a +80100cae: 83 7b 04 00 cmpl $0x0,0x4(%ebx) +80100cb2: 74 22 je 80100cd6 for(f = ftable.file; f < ftable.file + NFILE; f++){ -80100cf8: 83 c3 18 add $0x18,%ebx -80100cfb: 81 fb 74 35 11 80 cmp $0x80113574,%ebx -80100d01: 75 ef jne 80100cf2 +80100cb4: 83 c3 18 add $0x18,%ebx +80100cb7: 81 fb f4 08 11 80 cmp $0x801108f4,%ebx +80100cbd: 75 ef jne 80100cae f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); -80100d03: 83 ec 0c sub $0xc,%esp -80100d06: 68 e0 2b 11 80 push $0x80112be0 -80100d0b: e8 f4 31 00 00 call 80103f04 +80100cbf: 83 ec 0c sub $0xc,%esp +80100cc2: 68 60 ff 10 80 push $0x8010ff60 +80100cc7: e8 9c 30 00 00 call 80103d68 return 0; -80100d10: 83 c4 10 add $0x10,%esp -80100d13: bb 00 00 00 00 mov $0x0,%ebx -80100d18: eb 17 jmp 80100d31 +80100ccc: 83 c4 10 add $0x10,%esp +80100ccf: bb 00 00 00 00 mov $0x0,%ebx +80100cd4: eb 17 jmp 80100ced f->ref = 1; -80100d1a: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) +80100cd6: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) release(&ftable.lock); -80100d21: 83 ec 0c sub $0xc,%esp -80100d24: 68 e0 2b 11 80 push $0x80112be0 -80100d29: e8 d6 31 00 00 call 80103f04 +80100cdd: 83 ec 0c sub $0xc,%esp +80100ce0: 68 60 ff 10 80 push $0x8010ff60 +80100ce5: e8 7e 30 00 00 call 80103d68 return f; -80100d2e: 83 c4 10 add $0x10,%esp +80100cea: 83 c4 10 add $0x10,%esp } -80100d31: 89 d8 mov %ebx,%eax -80100d33: 8b 5d fc mov -0x4(%ebp),%ebx -80100d36: c9 leave -80100d37: c3 ret +80100ced: 89 d8 mov %ebx,%eax +80100cef: 8b 5d fc mov -0x4(%ebp),%ebx +80100cf2: c9 leave +80100cf3: c3 ret -80100d38 : +80100cf4 : // Increment ref count for file f. struct file* filedup(struct file *f) { -80100d38: f3 0f 1e fb endbr32 -80100d3c: 55 push %ebp -80100d3d: 89 e5 mov %esp,%ebp -80100d3f: 53 push %ebx -80100d40: 83 ec 10 sub $0x10,%esp -80100d43: 8b 5d 08 mov 0x8(%ebp),%ebx +80100cf4: 55 push %ebp +80100cf5: 89 e5 mov %esp,%ebp +80100cf7: 53 push %ebx +80100cf8: 83 ec 10 sub $0x10,%esp +80100cfb: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ftable.lock); -80100d46: 68 e0 2b 11 80 push $0x80112be0 -80100d4b: e8 49 31 00 00 call 80103e99 +80100cfe: 68 60 ff 10 80 push $0x8010ff60 +80100d03: e8 f9 2f 00 00 call 80103d01 if(f->ref < 1) -80100d50: 8b 43 04 mov 0x4(%ebx),%eax -80100d53: 83 c4 10 add $0x10,%esp -80100d56: 85 c0 test %eax,%eax -80100d58: 7e 1a jle 80100d74 +80100d08: 8b 43 04 mov 0x4(%ebx),%eax +80100d0b: 83 c4 10 add $0x10,%esp +80100d0e: 85 c0 test %eax,%eax +80100d10: 7e 1a jle 80100d2c panic("filedup"); f->ref++; -80100d5a: 83 c0 01 add $0x1,%eax -80100d5d: 89 43 04 mov %eax,0x4(%ebx) +80100d12: 83 c0 01 add $0x1,%eax +80100d15: 89 43 04 mov %eax,0x4(%ebx) release(&ftable.lock); -80100d60: 83 ec 0c sub $0xc,%esp -80100d63: 68 e0 2b 11 80 push $0x80112be0 -80100d68: e8 97 31 00 00 call 80103f04 +80100d18: 83 ec 0c sub $0xc,%esp +80100d1b: 68 60 ff 10 80 push $0x8010ff60 +80100d20: e8 43 30 00 00 call 80103d68 return f; } -80100d6d: 89 d8 mov %ebx,%eax -80100d6f: 8b 5d fc mov -0x4(%ebp),%ebx -80100d72: c9 leave -80100d73: c3 ret +80100d25: 89 d8 mov %ebx,%eax +80100d27: 8b 5d fc mov -0x4(%ebp),%ebx +80100d2a: c9 leave +80100d2b: c3 ret panic("filedup"); -80100d74: 83 ec 0c sub $0xc,%esp -80100d77: 68 10 79 10 80 push $0x80107910 -80100d7c: e8 d7 f5 ff ff call 80100358 +80100d2c: 83 ec 0c sub $0xc,%esp +80100d2f: 68 30 76 10 80 push $0x80107630 +80100d34: e8 07 f6 ff ff call 80100340 -80100d81 : +80100d39 : // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { -80100d81: f3 0f 1e fb endbr32 -80100d85: 55 push %ebp -80100d86: 89 e5 mov %esp,%ebp -80100d88: 57 push %edi -80100d89: 56 push %esi -80100d8a: 53 push %ebx -80100d8b: 83 ec 28 sub $0x28,%esp -80100d8e: 8b 5d 08 mov 0x8(%ebp),%ebx +80100d39: 55 push %ebp +80100d3a: 89 e5 mov %esp,%ebp +80100d3c: 57 push %edi +80100d3d: 56 push %esi +80100d3e: 53 push %ebx +80100d3f: 83 ec 28 sub $0x28,%esp +80100d42: 8b 5d 08 mov 0x8(%ebp),%ebx struct file ff; acquire(&ftable.lock); -80100d91: 68 e0 2b 11 80 push $0x80112be0 -80100d96: e8 fe 30 00 00 call 80103e99 +80100d45: 68 60 ff 10 80 push $0x8010ff60 +80100d4a: e8 b2 2f 00 00 call 80103d01 if(f->ref < 1) -80100d9b: 8b 43 04 mov 0x4(%ebx),%eax -80100d9e: 83 c4 10 add $0x10,%esp -80100da1: 85 c0 test %eax,%eax -80100da3: 7e 5d jle 80100e02 +80100d4f: 8b 43 04 mov 0x4(%ebx),%eax +80100d52: 83 c4 10 add $0x10,%esp +80100d55: 85 c0 test %eax,%eax +80100d57: 7e 5d jle 80100db6 panic("fileclose"); if(--f->ref > 0){ -80100da5: 83 e8 01 sub $0x1,%eax -80100da8: 89 43 04 mov %eax,0x4(%ebx) -80100dab: 85 c0 test %eax,%eax -80100dad: 7f 60 jg 80100e0f +80100d59: 83 e8 01 sub $0x1,%eax +80100d5c: 89 43 04 mov %eax,0x4(%ebx) +80100d5f: 85 c0 test %eax,%eax +80100d61: 7f 60 jg 80100dc3 release(&ftable.lock); return; } ff = *f; -80100daf: 8b 33 mov (%ebx),%esi -80100db1: 0f b6 43 09 movzbl 0x9(%ebx),%eax -80100db5: 88 45 e7 mov %al,-0x19(%ebp) -80100db8: 8b 7b 0c mov 0xc(%ebx),%edi -80100dbb: 8b 43 10 mov 0x10(%ebx),%eax -80100dbe: 89 45 e0 mov %eax,-0x20(%ebp) +80100d63: 8b 33 mov (%ebx),%esi +80100d65: 0f b6 43 09 movzbl 0x9(%ebx),%eax +80100d69: 88 45 e7 mov %al,-0x19(%ebp) +80100d6c: 8b 7b 0c mov 0xc(%ebx),%edi +80100d6f: 8b 43 10 mov 0x10(%ebx),%eax +80100d72: 89 45 e0 mov %eax,-0x20(%ebp) f->ref = 0; -80100dc1: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx) +80100d75: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx) f->type = FD_NONE; -80100dc8: c7 03 00 00 00 00 movl $0x0,(%ebx) +80100d7c: c7 03 00 00 00 00 movl $0x0,(%ebx) release(&ftable.lock); -80100dce: 83 ec 0c sub $0xc,%esp -80100dd1: 68 e0 2b 11 80 push $0x80112be0 -80100dd6: e8 29 31 00 00 call 80103f04 +80100d82: 83 ec 0c sub $0xc,%esp +80100d85: 68 60 ff 10 80 push $0x8010ff60 +80100d8a: e8 d9 2f 00 00 call 80103d68 if(ff.type == FD_PIPE) -80100ddb: 83 c4 10 add $0x10,%esp -80100dde: 83 fe 01 cmp $0x1,%esi -80100de1: 74 44 je 80100e27 +80100d8f: 83 c4 10 add $0x10,%esp +80100d92: 83 fe 01 cmp $0x1,%esi +80100d95: 74 44 je 80100ddb pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ -80100de3: 83 fe 02 cmp $0x2,%esi -80100de6: 75 37 jne 80100e1f +80100d97: 83 fe 02 cmp $0x2,%esi +80100d9a: 75 37 jne 80100dd3 begin_op(); -80100de8: e8 93 1a 00 00 call 80102880 +80100d9c: e8 dd 19 00 00 call 8010277e iput(ff.ip); -80100ded: 83 ec 0c sub $0xc,%esp -80100df0: ff 75 e0 pushl -0x20(%ebp) -80100df3: e8 43 08 00 00 call 8010163b +80100da1: 83 ec 0c sub $0xc,%esp +80100da4: ff 75 e0 push -0x20(%ebp) +80100da7: e8 0e 08 00 00 call 801015ba end_op(); -80100df8: e8 02 1b 00 00 call 801028ff -80100dfd: 83 c4 10 add $0x10,%esp -80100e00: eb 1d jmp 80100e1f +80100dac: e8 48 1a 00 00 call 801027f9 +80100db1: 83 c4 10 add $0x10,%esp +80100db4: eb 1d jmp 80100dd3 panic("fileclose"); -80100e02: 83 ec 0c sub $0xc,%esp -80100e05: 68 18 79 10 80 push $0x80107918 -80100e0a: e8 49 f5 ff ff call 80100358 +80100db6: 83 ec 0c sub $0xc,%esp +80100db9: 68 38 76 10 80 push $0x80107638 +80100dbe: e8 7d f5 ff ff call 80100340 release(&ftable.lock); -80100e0f: 83 ec 0c sub $0xc,%esp -80100e12: 68 e0 2b 11 80 push $0x80112be0 -80100e17: e8 e8 30 00 00 call 80103f04 -80100e1c: 83 c4 10 add $0x10,%esp +80100dc3: 83 ec 0c sub $0xc,%esp +80100dc6: 68 60 ff 10 80 push $0x8010ff60 +80100dcb: e8 98 2f 00 00 call 80103d68 +80100dd0: 83 c4 10 add $0x10,%esp } } -80100e1f: 8d 65 f4 lea -0xc(%ebp),%esp -80100e22: 5b pop %ebx -80100e23: 5e pop %esi -80100e24: 5f pop %edi -80100e25: 5d pop %ebp -80100e26: c3 ret +80100dd3: 8d 65 f4 lea -0xc(%ebp),%esp +80100dd6: 5b pop %ebx +80100dd7: 5e pop %esi +80100dd8: 5f pop %edi +80100dd9: 5d pop %ebp +80100dda: c3 ret pipeclose(ff.pipe, ff.writable); -80100e27: 83 ec 08 sub $0x8,%esp -80100e2a: 0f be 45 e7 movsbl -0x19(%ebp),%eax -80100e2e: 50 push %eax -80100e2f: 57 push %edi -80100e30: e8 80 21 00 00 call 80102fb5 -80100e35: 83 c4 10 add $0x10,%esp -80100e38: eb e5 jmp 80100e1f +80100ddb: 83 ec 08 sub $0x8,%esp +80100dde: 0f be 45 e7 movsbl -0x19(%ebp),%eax +80100de2: 50 push %eax +80100de3: 57 push %edi +80100de4: e8 b4 20 00 00 call 80102e9d +80100de9: 83 c4 10 add $0x10,%esp +80100dec: eb e5 jmp 80100dd3 -80100e3a : +80100dee : // Get metadata about file f. int filestat(struct file *f, struct stat *st) { -80100e3a: f3 0f 1e fb endbr32 -80100e3e: 55 push %ebp -80100e3f: 89 e5 mov %esp,%ebp -80100e41: 53 push %ebx -80100e42: 83 ec 04 sub $0x4,%esp -80100e45: 8b 5d 08 mov 0x8(%ebp),%ebx +80100dee: 55 push %ebp +80100def: 89 e5 mov %esp,%ebp +80100df1: 53 push %ebx +80100df2: 83 ec 04 sub $0x4,%esp +80100df5: 8b 5d 08 mov 0x8(%ebp),%ebx if(f->type == FD_INODE){ -80100e48: 83 3b 02 cmpl $0x2,(%ebx) -80100e4b: 75 31 jne 80100e7e +80100df8: 83 3b 02 cmpl $0x2,(%ebx) +80100dfb: 75 31 jne 80100e2e ilock(f->ip); -80100e4d: 83 ec 0c sub $0xc,%esp -80100e50: ff 73 10 pushl 0x10(%ebx) -80100e53: e8 d4 06 00 00 call 8010152c +80100dfd: 83 ec 0c sub $0xc,%esp +80100e00: ff 73 10 push 0x10(%ebx) +80100e03: e8 ab 06 00 00 call 801014b3 stati(f->ip, st); -80100e58: 83 c4 08 add $0x8,%esp -80100e5b: ff 75 0c pushl 0xc(%ebp) -80100e5e: ff 73 10 pushl 0x10(%ebx) -80100e61: e8 3f 09 00 00 call 801017a5 +80100e08: 83 c4 08 add $0x8,%esp +80100e0b: ff 75 0c push 0xc(%ebp) +80100e0e: ff 73 10 push 0x10(%ebx) +80100e11: e8 06 09 00 00 call 8010171c iunlock(f->ip); -80100e66: 83 c4 04 add $0x4,%esp -80100e69: ff 73 10 pushl 0x10(%ebx) -80100e6c: e8 81 07 00 00 call 801015f2 +80100e16: 83 c4 04 add $0x4,%esp +80100e19: ff 73 10 push 0x10(%ebx) +80100e1c: e8 54 07 00 00 call 80101575 return 0; -80100e71: 83 c4 10 add $0x10,%esp -80100e74: b8 00 00 00 00 mov $0x0,%eax +80100e21: 83 c4 10 add $0x10,%esp +80100e24: b8 00 00 00 00 mov $0x0,%eax } return -1; } -80100e79: 8b 5d fc mov -0x4(%ebp),%ebx -80100e7c: c9 leave -80100e7d: c3 ret +80100e29: 8b 5d fc mov -0x4(%ebp),%ebx +80100e2c: c9 leave +80100e2d: c3 ret return -1; -80100e7e: b8 ff ff ff ff mov $0xffffffff,%eax -80100e83: eb f4 jmp 80100e79 +80100e2e: b8 ff ff ff ff mov $0xffffffff,%eax +80100e33: eb f4 jmp 80100e29 -80100e85 : +80100e35 : // Read from file f. int fileread(struct file *f, char *addr, int n) { -80100e85: f3 0f 1e fb endbr32 -80100e89: 55 push %ebp -80100e8a: 89 e5 mov %esp,%ebp -80100e8c: 56 push %esi -80100e8d: 53 push %ebx -80100e8e: 8b 5d 08 mov 0x8(%ebp),%ebx +80100e35: 55 push %ebp +80100e36: 89 e5 mov %esp,%ebp +80100e38: 56 push %esi +80100e39: 53 push %ebx +80100e3a: 8b 5d 08 mov 0x8(%ebp),%ebx int r; if(f->readable == 0) -80100e91: 80 7b 08 00 cmpb $0x0,0x8(%ebx) -80100e95: 74 70 je 80100f07 +80100e3d: 80 7b 08 00 cmpb $0x0,0x8(%ebx) +80100e41: 74 70 je 80100eb3 return -1; if(f->type == FD_PIPE) -80100e97: 8b 03 mov (%ebx),%eax -80100e99: 83 f8 01 cmp $0x1,%eax -80100e9c: 74 44 je 80100ee2 +80100e43: 8b 03 mov (%ebx),%eax +80100e45: 83 f8 01 cmp $0x1,%eax +80100e48: 74 44 je 80100e8e return piperead(f->pipe, addr, n); if(f->type == FD_INODE){ -80100e9e: 83 f8 02 cmp $0x2,%eax -80100ea1: 75 57 jne 80100efa +80100e4a: 83 f8 02 cmp $0x2,%eax +80100e4d: 75 57 jne 80100ea6 ilock(f->ip); -80100ea3: 83 ec 0c sub $0xc,%esp -80100ea6: ff 73 10 pushl 0x10(%ebx) -80100ea9: e8 7e 06 00 00 call 8010152c +80100e4f: 83 ec 0c sub $0xc,%esp +80100e52: ff 73 10 push 0x10(%ebx) +80100e55: e8 59 06 00 00 call 801014b3 if((r = readi(f->ip, addr, f->off, n)) > 0) -80100eae: ff 75 10 pushl 0x10(%ebp) -80100eb1: ff 73 14 pushl 0x14(%ebx) -80100eb4: ff 75 0c pushl 0xc(%ebp) -80100eb7: ff 73 10 pushl 0x10(%ebx) -80100eba: e8 15 09 00 00 call 801017d4 -80100ebf: 89 c6 mov %eax,%esi -80100ec1: 83 c4 20 add $0x20,%esp -80100ec4: 85 c0 test %eax,%eax -80100ec6: 7e 03 jle 80100ecb +80100e5a: ff 75 10 push 0x10(%ebp) +80100e5d: ff 73 14 push 0x14(%ebx) +80100e60: ff 75 0c push 0xc(%ebp) +80100e63: ff 73 10 push 0x10(%ebx) +80100e66: e8 dc 08 00 00 call 80101747 +80100e6b: 89 c6 mov %eax,%esi +80100e6d: 83 c4 20 add $0x20,%esp +80100e70: 85 c0 test %eax,%eax +80100e72: 7e 03 jle 80100e77 f->off += r; -80100ec8: 01 43 14 add %eax,0x14(%ebx) +80100e74: 01 43 14 add %eax,0x14(%ebx) iunlock(f->ip); -80100ecb: 83 ec 0c sub $0xc,%esp -80100ece: ff 73 10 pushl 0x10(%ebx) -80100ed1: e8 1c 07 00 00 call 801015f2 +80100e77: 83 ec 0c sub $0xc,%esp +80100e7a: ff 73 10 push 0x10(%ebx) +80100e7d: e8 f3 06 00 00 call 80101575 return r; -80100ed6: 83 c4 10 add $0x10,%esp +80100e82: 83 c4 10 add $0x10,%esp } panic("fileread"); } -80100ed9: 89 f0 mov %esi,%eax -80100edb: 8d 65 f8 lea -0x8(%ebp),%esp -80100ede: 5b pop %ebx -80100edf: 5e pop %esi -80100ee0: 5d pop %ebp -80100ee1: c3 ret +80100e85: 89 f0 mov %esi,%eax +80100e87: 8d 65 f8 lea -0x8(%ebp),%esp +80100e8a: 5b pop %ebx +80100e8b: 5e pop %esi +80100e8c: 5d pop %ebp +80100e8d: c3 ret return piperead(f->pipe, addr, n); -80100ee2: 83 ec 04 sub $0x4,%esp -80100ee5: ff 75 10 pushl 0x10(%ebp) -80100ee8: ff 75 0c pushl 0xc(%ebp) -80100eeb: ff 73 0c pushl 0xc(%ebx) -80100eee: e8 42 22 00 00 call 80103135 -80100ef3: 89 c6 mov %eax,%esi -80100ef5: 83 c4 10 add $0x10,%esp -80100ef8: eb df jmp 80100ed9 +80100e8e: 83 ec 04 sub $0x4,%esp +80100e91: ff 75 10 push 0x10(%ebp) +80100e94: ff 75 0c push 0xc(%ebp) +80100e97: ff 73 0c push 0xc(%ebx) +80100e9a: e8 71 21 00 00 call 80103010 +80100e9f: 89 c6 mov %eax,%esi +80100ea1: 83 c4 10 add $0x10,%esp +80100ea4: eb df jmp 80100e85 panic("fileread"); -80100efa: 83 ec 0c sub $0xc,%esp -80100efd: 68 22 79 10 80 push $0x80107922 -80100f02: e8 51 f4 ff ff call 80100358 +80100ea6: 83 ec 0c sub $0xc,%esp +80100ea9: 68 42 76 10 80 push $0x80107642 +80100eae: e8 8d f4 ff ff call 80100340 return -1; -80100f07: be ff ff ff ff mov $0xffffffff,%esi -80100f0c: eb cb jmp 80100ed9 +80100eb3: be ff ff ff ff mov $0xffffffff,%esi +80100eb8: eb cb jmp 80100e85 -80100f0e : +80100eba : //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { -80100f0e: f3 0f 1e fb endbr32 -80100f12: 55 push %ebp -80100f13: 89 e5 mov %esp,%ebp -80100f15: 57 push %edi -80100f16: 56 push %esi -80100f17: 53 push %ebx -80100f18: 83 ec 1c sub $0x1c,%esp -80100f1b: 8b 7d 08 mov 0x8(%ebp),%edi +80100eba: 55 push %ebp +80100ebb: 89 e5 mov %esp,%ebp +80100ebd: 57 push %edi +80100ebe: 56 push %esi +80100ebf: 53 push %ebx +80100ec0: 83 ec 1c sub $0x1c,%esp +80100ec3: 8b 7d 08 mov 0x8(%ebp),%edi int r; if(f->writable == 0) -80100f1e: 80 7f 09 00 cmpb $0x0,0x9(%edi) -80100f22: 0f 84 ea 00 00 00 je 80101012 +80100ec6: 80 7f 09 00 cmpb $0x0,0x9(%edi) +80100eca: 0f 84 ef 00 00 00 je 80100fbf return -1; if(f->type == FD_PIPE) -80100f28: 8b 07 mov (%edi),%eax -80100f2a: 83 f8 01 cmp $0x1,%eax -80100f2d: 74 1a je 80100f49 +80100ed0: 8b 07 mov (%edi),%eax +80100ed2: 83 f8 01 cmp $0x1,%eax +80100ed5: 74 1c je 80100ef3 return pipewrite(f->pipe, addr, n); if(f->type == FD_INODE){ -80100f2f: 83 f8 02 cmp $0x2,%eax -80100f32: 0f 85 cd 00 00 00 jne 80101005 +80100ed7: 83 f8 02 cmp $0x2,%eax +80100eda: 0f 85 d2 00 00 00 jne 80100fb2 // 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){ -80100f38: 83 7d 10 00 cmpl $0x0,0x10(%ebp) -80100f3c: 0f 8e aa 00 00 00 jle 80100fec +80100ee0: 83 7d 10 00 cmpl $0x0,0x10(%ebp) +80100ee4: 0f 8e bf 00 00 00 jle 80100fa9 int i = 0; -80100f42: bb 00 00 00 00 mov $0x0,%ebx -80100f47: eb 3c jmp 80100f85 +80100eea: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) +80100ef1: eb 3e jmp 80100f31 return pipewrite(f->pipe, addr, n); -80100f49: 83 ec 04 sub $0x4,%esp -80100f4c: ff 75 10 pushl 0x10(%ebp) -80100f4f: ff 75 0c pushl 0xc(%ebp) -80100f52: ff 77 0c pushl 0xc(%edi) -80100f55: e8 eb 20 00 00 call 80103045 -80100f5a: 83 c4 10 add $0x10,%esp -80100f5d: e9 9b 00 00 00 jmp 80100ffd +80100ef3: 83 ec 04 sub $0x4,%esp +80100ef6: ff 75 10 push 0x10(%ebp) +80100ef9: ff 75 0c push 0xc(%ebp) +80100efc: ff 77 0c push 0xc(%edi) +80100eff: e8 25 20 00 00 call 80102f29 +80100f04: 83 c4 10 add $0x10,%esp +80100f07: e9 88 00 00 00 jmp 80100f94 + n1 = max; begin_op(); ilock(f->ip); if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) f->off += r; +80100f0c: 01 47 14 add %eax,0x14(%edi) iunlock(f->ip); -80100f62: 83 ec 0c sub $0xc,%esp -80100f65: ff 77 10 pushl 0x10(%edi) -80100f68: e8 85 06 00 00 call 801015f2 +80100f0f: 83 ec 0c sub $0xc,%esp +80100f12: ff 77 10 push 0x10(%edi) +80100f15: e8 5b 06 00 00 call 80101575 end_op(); -80100f6d: e8 8d 19 00 00 call 801028ff +80100f1a: e8 da 18 00 00 call 801027f9 +80100f1f: 83 c4 10 add $0x10,%esp if(r < 0) -80100f72: 83 c4 10 add $0x10,%esp -80100f75: 85 f6 test %esi,%esi -80100f77: 78 78 js 80100ff1 break; if(r != n1) -80100f79: 39 75 e4 cmp %esi,-0x1c(%ebp) -80100f7c: 75 61 jne 80100fdf +80100f22: 39 de cmp %ebx,%esi +80100f24: 75 76 jne 80100f9c panic("short filewrite"); i += r; -80100f7e: 01 f3 add %esi,%ebx +80100f26: 01 5d e4 add %ebx,-0x1c(%ebp) +80100f29: 8b 45 e4 mov -0x1c(%ebp),%eax while(i < n){ -80100f80: 39 5d 10 cmp %ebx,0x10(%ebp) -80100f83: 7e 6c jle 80100ff1 +80100f2c: 39 45 10 cmp %eax,0x10(%ebp) +80100f2f: 7e 54 jle 80100f85 int n1 = n - i; -80100f85: 8b 45 10 mov 0x10(%ebp),%eax -80100f88: 29 d8 sub %ebx,%eax - if(n1 > max) -80100f8a: 3d 00 06 00 00 cmp $0x600,%eax -80100f8f: ba 00 06 00 00 mov $0x600,%edx -80100f94: 0f 4f c2 cmovg %edx,%eax -80100f97: 89 c6 mov %eax,%esi -80100f99: 89 45 e4 mov %eax,-0x1c(%ebp) +80100f31: 8b 75 10 mov 0x10(%ebp),%esi +80100f34: 8b 5d e4 mov -0x1c(%ebp),%ebx +80100f37: 29 de sub %ebx,%esi +80100f39: b8 00 06 00 00 mov $0x600,%eax +80100f3e: 39 c6 cmp %eax,%esi +80100f40: 0f 4f f0 cmovg %eax,%esi begin_op(); -80100f9c: e8 df 18 00 00 call 80102880 +80100f43: e8 36 18 00 00 call 8010277e ilock(f->ip); -80100fa1: 83 ec 0c sub $0xc,%esp -80100fa4: ff 77 10 pushl 0x10(%edi) -80100fa7: e8 80 05 00 00 call 8010152c +80100f48: 83 ec 0c sub $0xc,%esp +80100f4b: ff 77 10 push 0x10(%edi) +80100f4e: e8 60 05 00 00 call 801014b3 if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) -80100fac: 56 push %esi -80100fad: ff 77 14 pushl 0x14(%edi) -80100fb0: 89 d8 mov %ebx,%eax -80100fb2: 03 45 0c add 0xc(%ebp),%eax -80100fb5: 50 push %eax -80100fb6: ff 77 10 pushl 0x10(%edi) -80100fb9: e8 16 09 00 00 call 801018d4 -80100fbe: 89 c6 mov %eax,%esi -80100fc0: 83 c4 20 add $0x20,%esp -80100fc3: 85 c0 test %eax,%eax -80100fc5: 7e 9b jle 80100f62 - f->off += r; -80100fc7: 01 47 14 add %eax,0x14(%edi) +80100f53: 56 push %esi +80100f54: ff 77 14 push 0x14(%edi) +80100f57: 89 d8 mov %ebx,%eax +80100f59: 03 45 0c add 0xc(%ebp),%eax +80100f5c: 50 push %eax +80100f5d: ff 77 10 push 0x10(%edi) +80100f60: e8 de 08 00 00 call 80101843 +80100f65: 89 c3 mov %eax,%ebx +80100f67: 83 c4 20 add $0x20,%esp +80100f6a: 85 c0 test %eax,%eax +80100f6c: 7f 9e jg 80100f0c iunlock(f->ip); -80100fca: 83 ec 0c sub $0xc,%esp -80100fcd: ff 77 10 pushl 0x10(%edi) -80100fd0: e8 1d 06 00 00 call 801015f2 +80100f6e: 83 ec 0c sub $0xc,%esp +80100f71: ff 77 10 push 0x10(%edi) +80100f74: e8 fc 05 00 00 call 80101575 end_op(); -80100fd5: e8 25 19 00 00 call 801028ff -80100fda: 83 c4 10 add $0x10,%esp -80100fdd: eb 9a jmp 80100f79 - panic("short filewrite"); -80100fdf: 83 ec 0c sub $0xc,%esp -80100fe2: 68 2b 79 10 80 push $0x8010792b -80100fe7: e8 6c f3 ff ff call 80100358 - int i = 0; -80100fec: bb 00 00 00 00 mov $0x0,%ebx +80100f79: e8 7b 18 00 00 call 801027f9 + if(r < 0) +80100f7e: 83 c4 10 add $0x10,%esp +80100f81: 85 db test %ebx,%ebx +80100f83: 79 9d jns 80100f22 } return i == n ? n : -1; -80100ff1: 39 5d 10 cmp %ebx,0x10(%ebp) -80100ff4: b8 ff ff ff ff mov $0xffffffff,%eax -80100ff9: 0f 44 45 10 cmove 0x10(%ebp),%eax +80100f85: 8b 45 e4 mov -0x1c(%ebp),%eax +80100f88: 39 45 10 cmp %eax,0x10(%ebp) +80100f8b: b8 ff ff ff ff mov $0xffffffff,%eax +80100f90: 0f 44 45 10 cmove 0x10(%ebp),%eax } panic("filewrite"); } -80100ffd: 8d 65 f4 lea -0xc(%ebp),%esp -80101000: 5b pop %ebx -80101001: 5e pop %esi -80101002: 5f pop %edi -80101003: 5d pop %ebp -80101004: c3 ret +80100f94: 8d 65 f4 lea -0xc(%ebp),%esp +80100f97: 5b pop %ebx +80100f98: 5e pop %esi +80100f99: 5f pop %edi +80100f9a: 5d pop %ebp +80100f9b: c3 ret + panic("short filewrite"); +80100f9c: 83 ec 0c sub $0xc,%esp +80100f9f: 68 4b 76 10 80 push $0x8010764b +80100fa4: e8 97 f3 ff ff call 80100340 + int i = 0; +80100fa9: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) +80100fb0: eb d3 jmp 80100f85 panic("filewrite"); -80101005: 83 ec 0c sub $0xc,%esp -80101008: 68 31 79 10 80 push $0x80107931 -8010100d: e8 46 f3 ff ff call 80100358 +80100fb2: 83 ec 0c sub $0xc,%esp +80100fb5: 68 51 76 10 80 push $0x80107651 +80100fba: e8 81 f3 ff ff call 80100340 return -1; -80101012: b8 ff ff ff ff mov $0xffffffff,%eax -80101017: eb e4 jmp 80100ffd +80100fbf: b8 ff ff ff ff mov $0xffffffff,%eax +80100fc4: eb ce jmp 80100f94 -80101019 : +80100fc6 : } // Free a disk block. static void bfree(int dev, uint b) { -80101019: 55 push %ebp -8010101a: 89 e5 mov %esp,%ebp -8010101c: 56 push %esi -8010101d: 53 push %ebx -8010101e: 89 c1 mov %eax,%ecx -80101020: 89 d3 mov %edx,%ebx +80100fc6: 55 push %ebp +80100fc7: 89 e5 mov %esp,%ebp +80100fc9: 56 push %esi +80100fca: 53 push %ebx +80100fcb: 89 c1 mov %eax,%ecx +80100fcd: 89 d3 mov %edx,%ebx struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); -80101022: 83 ec 08 sub $0x8,%esp -80101025: 89 d0 mov %edx,%eax -80101027: c1 e8 0c shr $0xc,%eax -8010102a: 03 05 f8 35 11 80 add 0x801135f8,%eax -80101030: 50 push %eax -80101031: 51 push %ecx -80101032: e8 77 f0 ff ff call 801000ae -80101037: 89 c6 mov %eax,%esi +80100fcf: 83 ec 08 sub $0x8,%esp +80100fd2: 89 d0 mov %edx,%eax +80100fd4: c1 e8 0c shr $0xc,%eax +80100fd7: 03 05 cc 25 11 80 add 0x801125cc,%eax +80100fdd: 50 push %eax +80100fde: 51 push %ecx +80100fdf: e8 c6 f0 ff ff call 801000aa +80100fe4: 89 c6 mov %eax,%esi bi = b % BPB; m = 1 << (bi % 8); -80101039: 89 d9 mov %ebx,%ecx -8010103b: 83 e1 07 and $0x7,%ecx -8010103e: b8 01 00 00 00 mov $0x1,%eax -80101043: d3 e0 shl %cl,%eax +80100fe6: 89 d9 mov %ebx,%ecx +80100fe8: 83 e1 07 and $0x7,%ecx +80100feb: b8 01 00 00 00 mov $0x1,%eax +80100ff0: d3 e0 shl %cl,%eax bi = b % BPB; -80101045: 81 e3 ff 0f 00 00 and $0xfff,%ebx +80100ff2: 81 e3 ff 0f 00 00 and $0xfff,%ebx if((bp->data[bi/8] & m) == 0) -8010104b: 83 c4 10 add $0x10,%esp -8010104e: c1 fb 03 sar $0x3,%ebx -80101051: 0f b6 54 1e 5c movzbl 0x5c(%esi,%ebx,1),%edx -80101056: 0f b6 ca movzbl %dl,%ecx -80101059: 85 c1 test %eax,%ecx -8010105b: 74 23 je 80101080 +80100ff8: 83 c4 10 add $0x10,%esp +80100ffb: c1 fb 03 sar $0x3,%ebx +80100ffe: 0f b6 54 1e 5c movzbl 0x5c(%esi,%ebx,1),%edx +80101003: 0f b6 ca movzbl %dl,%ecx +80101006: 85 c1 test %eax,%ecx +80101008: 74 23 je 8010102d panic("freeing free block"); bp->data[bi/8] &= ~m; -8010105d: f7 d0 not %eax -8010105f: 21 d0 and %edx,%eax -80101061: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1) +8010100a: f7 d0 not %eax +8010100c: 21 d0 and %edx,%eax +8010100e: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1) log_write(bp); -80101065: 83 ec 0c sub $0xc,%esp -80101068: 56 push %esi -80101069: e8 d7 19 00 00 call 80102a45 +80101012: 83 ec 0c sub $0xc,%esp +80101015: 56 push %esi +80101016: e8 20 19 00 00 call 8010293b brelse(bp); -8010106e: 89 34 24 mov %esi,(%esp) -80101071: e8 57 f1 ff ff call 801001cd -} -80101076: 83 c4 10 add $0x10,%esp -80101079: 8d 65 f8 lea -0x8(%ebp),%esp -8010107c: 5b pop %ebx -8010107d: 5e pop %esi -8010107e: 5d pop %ebp -8010107f: c3 ret +8010101b: 89 34 24 mov %esi,(%esp) +8010101e: e8 9e f1 ff ff call 801001c1 +} +80101023: 83 c4 10 add $0x10,%esp +80101026: 8d 65 f8 lea -0x8(%ebp),%esp +80101029: 5b pop %ebx +8010102a: 5e pop %esi +8010102b: 5d pop %ebp +8010102c: c3 ret panic("freeing free block"); -80101080: 83 ec 0c sub $0xc,%esp -80101083: 68 3b 79 10 80 push $0x8010793b -80101088: e8 cb f2 ff ff call 80100358 - -8010108d : -{ -8010108d: 55 push %ebp -8010108e: 89 e5 mov %esp,%ebp -80101090: 57 push %edi -80101091: 56 push %esi -80101092: 53 push %ebx -80101093: 83 ec 1c sub $0x1c,%esp -80101096: 89 45 d8 mov %eax,-0x28(%ebp) +8010102d: 83 ec 0c sub $0xc,%esp +80101030: 68 5b 76 10 80 push $0x8010765b +80101035: e8 06 f3 ff ff call 80100340 + +8010103a : +{ +8010103a: 55 push %ebp +8010103b: 89 e5 mov %esp,%ebp +8010103d: 57 push %edi +8010103e: 56 push %esi +8010103f: 53 push %ebx +80101040: 83 ec 1c sub $0x1c,%esp +80101043: 89 45 d8 mov %eax,-0x28(%ebp) for(b = 0; b < sb.size; b += BPB){ -80101099: 83 3d e0 35 11 80 00 cmpl $0x0,0x801135e0 -801010a0: 0f 84 ab 00 00 00 je 80101151 -801010a6: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) -801010ad: eb 22 jmp 801010d1 +80101046: 83 3d b4 25 11 80 00 cmpl $0x0,0x801125b4 +8010104d: 0f 84 9c 00 00 00 je 801010ef +80101053: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) +8010105a: eb 20 jmp 8010107c brelse(bp); -801010af: 83 ec 0c sub $0xc,%esp -801010b2: 56 push %esi -801010b3: e8 15 f1 ff ff call 801001cd +8010105c: 83 ec 0c sub $0xc,%esp +8010105f: ff 75 e4 push -0x1c(%ebp) +80101062: e8 5a f1 ff ff call 801001c1 for(b = 0; b < sb.size; b += BPB){ -801010b8: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) -801010bf: 8b 45 dc mov -0x24(%ebp),%eax -801010c2: 83 c4 10 add $0x10,%esp -801010c5: 39 05 e0 35 11 80 cmp %eax,0x801135e0 -801010cb: 0f 86 80 00 00 00 jbe 80101151 +80101067: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) +8010106e: 8b 45 dc mov -0x24(%ebp),%eax +80101071: 83 c4 10 add $0x10,%esp +80101074: 39 05 b4 25 11 80 cmp %eax,0x801125b4 +8010107a: 76 73 jbe 801010ef bp = bread(dev, BBLOCK(b, sb)); -801010d1: 83 ec 08 sub $0x8,%esp -801010d4: 8b 5d dc mov -0x24(%ebp),%ebx -801010d7: 8d 83 ff 0f 00 00 lea 0xfff(%ebx),%eax -801010dd: 85 db test %ebx,%ebx -801010df: 0f 49 c3 cmovns %ebx,%eax -801010e2: c1 f8 0c sar $0xc,%eax -801010e5: 03 05 f8 35 11 80 add 0x801135f8,%eax -801010eb: 50 push %eax -801010ec: ff 75 d8 pushl -0x28(%ebp) -801010ef: e8 ba ef ff ff call 801000ae -801010f4: 89 c6 mov %eax,%esi +8010107c: 83 ec 08 sub $0x8,%esp +8010107f: 8b 75 dc mov -0x24(%ebp),%esi +80101082: 8d 86 ff 0f 00 00 lea 0xfff(%esi),%eax +80101088: 85 f6 test %esi,%esi +8010108a: 0f 49 c6 cmovns %esi,%eax +8010108d: c1 f8 0c sar $0xc,%eax +80101090: 03 05 cc 25 11 80 add 0x801125cc,%eax +80101096: 50 push %eax +80101097: ff 75 d8 push -0x28(%ebp) +8010109a: e8 0b f0 ff ff call 801000aa +8010109f: 89 45 e4 mov %eax,-0x1c(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ -801010f6: a1 e0 35 11 80 mov 0x801135e0,%eax -801010fb: 89 45 e4 mov %eax,-0x1c(%ebp) -801010fe: 83 c4 10 add $0x10,%esp -80101101: bf 00 00 00 00 mov $0x0,%edi -80101106: 39 5d e4 cmp %ebx,-0x1c(%ebp) -80101109: 76 a4 jbe 801010af +801010a2: a1 b4 25 11 80 mov 0x801125b4,%eax +801010a7: 89 45 e0 mov %eax,-0x20(%ebp) +801010aa: 83 c4 10 add $0x10,%esp +801010ad: b8 00 00 00 00 mov $0x0,%eax +801010b2: 39 75 e0 cmp %esi,-0x20(%ebp) +801010b5: 76 a5 jbe 8010105c m = 1 << (bi % 8); -8010110b: 89 f8 mov %edi,%eax -8010110d: c1 f8 1f sar $0x1f,%eax -80101110: c1 e8 1d shr $0x1d,%eax -80101113: 8d 0c 07 lea (%edi,%eax,1),%ecx -80101116: 83 e1 07 and $0x7,%ecx -80101119: 29 c1 sub %eax,%ecx -8010111b: b8 01 00 00 00 mov $0x1,%eax -80101120: d3 e0 shl %cl,%eax -80101122: 89 c1 mov %eax,%ecx +801010b7: 89 c1 mov %eax,%ecx +801010b9: 83 e1 07 and $0x7,%ecx +801010bc: bb 01 00 00 00 mov $0x1,%ebx +801010c1: d3 e3 shl %cl,%ebx if((bp->data[bi/8] & m) == 0){ // Is block free? -80101124: 8d 47 07 lea 0x7(%edi),%eax -80101127: 85 ff test %edi,%edi -80101129: 0f 49 c7 cmovns %edi,%eax -8010112c: c1 f8 03 sar $0x3,%eax -8010112f: 89 45 e0 mov %eax,-0x20(%ebp) -80101132: 0f b6 54 06 5c movzbl 0x5c(%esi,%eax,1),%edx -80101137: 0f b6 c2 movzbl %dl,%eax -8010113a: 85 c8 test %ecx,%eax -8010113c: 74 20 je 8010115e +801010c3: 8d 50 07 lea 0x7(%eax),%edx +801010c6: 85 c0 test %eax,%eax +801010c8: 0f 49 d0 cmovns %eax,%edx +801010cb: c1 fa 03 sar $0x3,%edx +801010ce: 8b 7d e4 mov -0x1c(%ebp),%edi +801010d1: 0f b6 4c 17 5c movzbl 0x5c(%edi,%edx,1),%ecx +801010d6: 0f b6 f9 movzbl %cl,%edi +801010d9: 85 df test %ebx,%edi +801010db: 74 1f je 801010fc for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ -8010113e: 83 c7 01 add $0x1,%edi -80101141: 83 c3 01 add $0x1,%ebx -80101144: 81 ff 00 10 00 00 cmp $0x1000,%edi -8010114a: 75 ba jne 80101106 -8010114c: e9 5e ff ff ff jmp 801010af +801010dd: 83 c0 01 add $0x1,%eax +801010e0: 83 c6 01 add $0x1,%esi +801010e3: 3d 00 10 00 00 cmp $0x1000,%eax +801010e8: 75 c8 jne 801010b2 +801010ea: e9 6d ff ff ff jmp 8010105c panic("balloc: out of blocks"); -80101151: 83 ec 0c sub $0xc,%esp -80101154: 68 4e 79 10 80 push $0x8010794e -80101159: e8 fa f1 ff ff call 80100358 +801010ef: 83 ec 0c sub $0xc,%esp +801010f2: 68 6e 76 10 80 push $0x8010766e +801010f7: e8 44 f2 ff ff call 80100340 bp->data[bi/8] |= m; // Mark block in use. -8010115e: 09 ca or %ecx,%edx -80101160: 8b 45 e0 mov -0x20(%ebp),%eax -80101163: 88 54 06 5c mov %dl,0x5c(%esi,%eax,1) +801010fc: 09 d9 or %ebx,%ecx +801010fe: 8b 5d e4 mov -0x1c(%ebp),%ebx +80101101: 88 4c 13 5c mov %cl,0x5c(%ebx,%edx,1) log_write(bp); -80101167: 83 ec 0c sub $0xc,%esp -8010116a: 56 push %esi -8010116b: e8 d5 18 00 00 call 80102a45 +80101105: 83 ec 0c sub $0xc,%esp +80101108: 53 push %ebx +80101109: e8 2d 18 00 00 call 8010293b brelse(bp); -80101170: 89 34 24 mov %esi,(%esp) -80101173: e8 55 f0 ff ff call 801001cd +8010110e: 89 1c 24 mov %ebx,(%esp) +80101111: e8 ab f0 ff ff call 801001c1 bp = bread(dev, bno); -80101178: 83 c4 08 add $0x8,%esp -8010117b: 53 push %ebx -8010117c: ff 75 d8 pushl -0x28(%ebp) -8010117f: e8 2a ef ff ff call 801000ae -80101184: 89 c6 mov %eax,%esi +80101116: 83 c4 08 add $0x8,%esp +80101119: 56 push %esi +8010111a: ff 75 d8 push -0x28(%ebp) +8010111d: e8 88 ef ff ff call 801000aa +80101122: 89 c3 mov %eax,%ebx memset(bp->data, 0, BSIZE); -80101186: 83 c4 0c add $0xc,%esp -80101189: 68 00 02 00 00 push $0x200 -8010118e: 6a 00 push $0x0 -80101190: 8d 40 5c lea 0x5c(%eax),%eax -80101193: 50 push %eax -80101194: e8 b6 2d 00 00 call 80103f4f +80101124: 83 c4 0c add $0xc,%esp +80101127: 68 00 02 00 00 push $0x200 +8010112c: 6a 00 push $0x0 +8010112e: 8d 40 5c lea 0x5c(%eax),%eax +80101131: 50 push %eax +80101132: e8 78 2c 00 00 call 80103daf log_write(bp); -80101199: 89 34 24 mov %esi,(%esp) -8010119c: e8 a4 18 00 00 call 80102a45 +80101137: 89 1c 24 mov %ebx,(%esp) +8010113a: e8 fc 17 00 00 call 8010293b brelse(bp); -801011a1: 89 34 24 mov %esi,(%esp) -801011a4: e8 24 f0 ff ff call 801001cd +8010113f: 89 1c 24 mov %ebx,(%esp) +80101142: e8 7a f0 ff ff call 801001c1 } -801011a9: 89 d8 mov %ebx,%eax -801011ab: 8d 65 f4 lea -0xc(%ebp),%esp -801011ae: 5b pop %ebx -801011af: 5e pop %esi -801011b0: 5f pop %edi -801011b1: 5d pop %ebp -801011b2: c3 ret +80101147: 89 f0 mov %esi,%eax +80101149: 8d 65 f4 lea -0xc(%ebp),%esp +8010114c: 5b pop %ebx +8010114d: 5e pop %esi +8010114e: 5f pop %edi +8010114f: 5d pop %ebp +80101150: c3 ret -801011b3 : +80101151 : // 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) { -801011b3: 55 push %ebp -801011b4: 89 e5 mov %esp,%ebp -801011b6: 57 push %edi -801011b7: 56 push %esi -801011b8: 53 push %ebx -801011b9: 83 ec 1c sub $0x1c,%esp -801011bc: 89 c3 mov %eax,%ebx +80101151: 55 push %ebp +80101152: 89 e5 mov %esp,%ebp +80101154: 57 push %edi +80101155: 56 push %esi +80101156: 53 push %ebx +80101157: 83 ec 1c sub $0x1c,%esp +8010115a: 89 c3 mov %eax,%ebx +8010115c: 89 d7 mov %edx,%edi uint addr, *a; struct buf *bp; if(bn < NDIRECT){ -801011be: 83 fa 0b cmp $0xb,%edx -801011c1: 76 49 jbe 8010120c +8010115e: 83 fa 0b cmp $0xb,%edx +80101161: 76 45 jbe 801011a8 if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); return addr; } bn -= NDIRECT; -801011c3: 8d 72 f4 lea -0xc(%edx),%esi +80101163: 8d 72 f4 lea -0xc(%edx),%esi if(bn < NINDIRECT){ -801011c6: 83 fe 7f cmp $0x7f,%esi -801011c9: 0f 87 80 00 00 00 ja 8010124f +80101166: 83 fe 7f cmp $0x7f,%esi +80101169: 77 7f ja 801011ea // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) -801011cf: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax -801011d5: 85 c0 test %eax,%eax -801011d7: 74 4b je 80101224 +8010116b: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax +80101171: 85 c0 test %eax,%eax +80101173: 74 4a je 801011bf ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); -801011d9: 83 ec 08 sub $0x8,%esp -801011dc: 50 push %eax -801011dd: ff 33 pushl (%ebx) -801011df: e8 ca ee ff ff call 801000ae -801011e4: 89 c7 mov %eax,%edi +80101175: 83 ec 08 sub $0x8,%esp +80101178: 50 push %eax +80101179: ff 33 push (%ebx) +8010117b: e8 2a ef ff ff call 801000aa +80101180: 89 c7 mov %eax,%edi a = (uint*)bp->data; if((addr = a[bn]) == 0){ -801011e6: 8d 44 b0 5c lea 0x5c(%eax,%esi,4),%eax -801011ea: 89 45 e4 mov %eax,-0x1c(%ebp) -801011ed: 8b 30 mov (%eax),%esi -801011ef: 83 c4 10 add $0x10,%esp -801011f2: 85 f6 test %esi,%esi -801011f4: 74 3d je 80101233 +80101182: 8d 44 b0 5c lea 0x5c(%eax,%esi,4),%eax +80101186: 89 45 e4 mov %eax,-0x1c(%ebp) +80101189: 8b 30 mov (%eax),%esi +8010118b: 83 c4 10 add $0x10,%esp +8010118e: 85 f6 test %esi,%esi +80101190: 74 3c je 801011ce a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); -801011f6: 83 ec 0c sub $0xc,%esp -801011f9: 57 push %edi -801011fa: e8 ce ef ff ff call 801001cd +80101192: 83 ec 0c sub $0xc,%esp +80101195: 57 push %edi +80101196: e8 26 f0 ff ff call 801001c1 return addr; -801011ff: 83 c4 10 add $0x10,%esp +8010119b: 83 c4 10 add $0x10,%esp } panic("bmap: out of range"); } -80101202: 89 f0 mov %esi,%eax -80101204: 8d 65 f4 lea -0xc(%ebp),%esp -80101207: 5b pop %ebx -80101208: 5e pop %esi -80101209: 5f pop %edi -8010120a: 5d pop %ebp -8010120b: c3 ret +8010119e: 89 f0 mov %esi,%eax +801011a0: 8d 65 f4 lea -0xc(%ebp),%esp +801011a3: 5b pop %ebx +801011a4: 5e pop %esi +801011a5: 5f pop %edi +801011a6: 5d pop %ebp +801011a7: c3 ret if((addr = ip->addrs[bn]) == 0) -8010120c: 8d 3c 90 lea (%eax,%edx,4),%edi -8010120f: 8b 77 5c mov 0x5c(%edi),%esi -80101212: 85 f6 test %esi,%esi -80101214: 75 ec jne 80101202 +801011a8: 8b 74 90 5c mov 0x5c(%eax,%edx,4),%esi +801011ac: 85 f6 test %esi,%esi +801011ae: 75 ee jne 8010119e ip->addrs[bn] = addr = balloc(ip->dev); -80101216: 8b 00 mov (%eax),%eax -80101218: e8 70 fe ff ff call 8010108d -8010121d: 89 c6 mov %eax,%esi -8010121f: 89 47 5c mov %eax,0x5c(%edi) -80101222: eb de jmp 80101202 +801011b0: 8b 00 mov (%eax),%eax +801011b2: e8 83 fe ff ff call 8010103a +801011b7: 89 c6 mov %eax,%esi +801011b9: 89 44 bb 5c mov %eax,0x5c(%ebx,%edi,4) +801011bd: eb df jmp 8010119e ip->addrs[NDIRECT] = addr = balloc(ip->dev); -80101224: 8b 03 mov (%ebx),%eax -80101226: e8 62 fe ff ff call 8010108d -8010122b: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx) -80101231: eb a6 jmp 801011d9 +801011bf: 8b 03 mov (%ebx),%eax +801011c1: e8 74 fe ff ff call 8010103a +801011c6: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx) +801011cc: eb a7 jmp 80101175 a[bn] = addr = balloc(ip->dev); -80101233: 8b 03 mov (%ebx),%eax -80101235: e8 53 fe ff ff call 8010108d -8010123a: 89 c6 mov %eax,%esi -8010123c: 8b 45 e4 mov -0x1c(%ebp),%eax -8010123f: 89 30 mov %esi,(%eax) +801011ce: 8b 03 mov (%ebx),%eax +801011d0: e8 65 fe ff ff call 8010103a +801011d5: 89 c6 mov %eax,%esi +801011d7: 8b 45 e4 mov -0x1c(%ebp),%eax +801011da: 89 30 mov %esi,(%eax) log_write(bp); -80101241: 83 ec 0c sub $0xc,%esp -80101244: 57 push %edi -80101245: e8 fb 17 00 00 call 80102a45 -8010124a: 83 c4 10 add $0x10,%esp -8010124d: eb a7 jmp 801011f6 +801011dc: 83 ec 0c sub $0xc,%esp +801011df: 57 push %edi +801011e0: e8 56 17 00 00 call 8010293b +801011e5: 83 c4 10 add $0x10,%esp +801011e8: eb a8 jmp 80101192 panic("bmap: out of range"); -8010124f: 83 ec 0c sub $0xc,%esp -80101252: 68 64 79 10 80 push $0x80107964 -80101257: e8 fc f0 ff ff call 80100358 - -8010125c : -{ -8010125c: 55 push %ebp -8010125d: 89 e5 mov %esp,%ebp -8010125f: 57 push %edi -80101260: 56 push %esi -80101261: 53 push %ebx -80101262: 83 ec 28 sub $0x28,%esp -80101265: 89 c7 mov %eax,%edi -80101267: 89 55 e4 mov %edx,-0x1c(%ebp) +801011ea: 83 ec 0c sub $0xc,%esp +801011ed: 68 84 76 10 80 push $0x80107684 +801011f2: e8 49 f1 ff ff call 80100340 + +801011f7 : +{ +801011f7: 55 push %ebp +801011f8: 89 e5 mov %esp,%ebp +801011fa: 57 push %edi +801011fb: 56 push %esi +801011fc: 53 push %ebx +801011fd: 83 ec 28 sub $0x28,%esp +80101200: 89 c7 mov %eax,%edi +80101202: 89 55 e4 mov %edx,-0x1c(%ebp) acquire(&icache.lock); -8010126a: 68 00 36 11 80 push $0x80113600 -8010126f: e8 25 2c 00 00 call 80103e99 -80101274: 83 c4 10 add $0x10,%esp +80101205: 68 60 09 11 80 push $0x80110960 +8010120a: e8 f2 2a 00 00 call 80103d01 +8010120f: 83 c4 10 add $0x10,%esp empty = 0; -80101277: be 00 00 00 00 mov $0x0,%esi +80101212: be 00 00 00 00 mov $0x0,%esi for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ -8010127c: bb 34 36 11 80 mov $0x80113634,%ebx -80101281: eb 13 jmp 80101296 +80101217: bb 94 09 11 80 mov $0x80110994,%ebx +8010121c: eb 13 jmp 80101231 if(empty == 0 && ip->ref == 0) // Remember empty slot. -80101283: 09 f0 or %esi,%eax -80101285: 0f 44 f3 cmove %ebx,%esi +8010121e: 09 f0 or %esi,%eax +80101220: 0f 44 f3 cmove %ebx,%esi for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ -80101288: 81 c3 90 00 00 00 add $0x90,%ebx -8010128e: 81 fb 54 52 11 80 cmp $0x80115254,%ebx -80101294: 74 2d je 801012c3 +80101223: 81 c3 90 00 00 00 add $0x90,%ebx +80101229: 81 fb b4 25 11 80 cmp $0x801125b4,%ebx +8010122f: 74 2d je 8010125e if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ -80101296: 8b 43 08 mov 0x8(%ebx),%eax -80101299: 85 c0 test %eax,%eax -8010129b: 7e e6 jle 80101283 -8010129d: 39 3b cmp %edi,(%ebx) -8010129f: 75 e7 jne 80101288 -801012a1: 8b 4d e4 mov -0x1c(%ebp),%ecx -801012a4: 39 4b 04 cmp %ecx,0x4(%ebx) -801012a7: 75 df jne 80101288 +80101231: 8b 43 08 mov 0x8(%ebx),%eax +80101234: 85 c0 test %eax,%eax +80101236: 7e e6 jle 8010121e +80101238: 39 3b cmp %edi,(%ebx) +8010123a: 75 e7 jne 80101223 +8010123c: 8b 4d e4 mov -0x1c(%ebp),%ecx +8010123f: 39 4b 04 cmp %ecx,0x4(%ebx) +80101242: 75 df jne 80101223 ip->ref++; -801012a9: 83 c0 01 add $0x1,%eax -801012ac: 89 43 08 mov %eax,0x8(%ebx) +80101244: 83 c0 01 add $0x1,%eax +80101247: 89 43 08 mov %eax,0x8(%ebx) release(&icache.lock); -801012af: 83 ec 0c sub $0xc,%esp -801012b2: 68 00 36 11 80 push $0x80113600 -801012b7: e8 48 2c 00 00 call 80103f04 +8010124a: 83 ec 0c sub $0xc,%esp +8010124d: 68 60 09 11 80 push $0x80110960 +80101252: e8 11 2b 00 00 call 80103d68 return ip; -801012bc: 83 c4 10 add $0x10,%esp -801012bf: 89 de mov %ebx,%esi -801012c1: eb 2a jmp 801012ed +80101257: 83 c4 10 add $0x10,%esp +8010125a: 89 de mov %ebx,%esi +8010125c: eb 2a jmp 80101288 if(empty == 0) -801012c3: 85 f6 test %esi,%esi -801012c5: 74 30 je 801012f7 +8010125e: 85 f6 test %esi,%esi +80101260: 74 30 je 80101292 ip->dev = dev; -801012c7: 89 3e mov %edi,(%esi) +80101262: 89 3e mov %edi,(%esi) ip->inum = inum; -801012c9: 8b 45 e4 mov -0x1c(%ebp),%eax -801012cc: 89 46 04 mov %eax,0x4(%esi) +80101264: 8b 45 e4 mov -0x1c(%ebp),%eax +80101267: 89 46 04 mov %eax,0x4(%esi) ip->ref = 1; -801012cf: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) +8010126a: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) ip->valid = 0; -801012d6: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) +80101271: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) release(&icache.lock); -801012dd: 83 ec 0c sub $0xc,%esp -801012e0: 68 00 36 11 80 push $0x80113600 -801012e5: e8 1a 2c 00 00 call 80103f04 +80101278: 83 ec 0c sub $0xc,%esp +8010127b: 68 60 09 11 80 push $0x80110960 +80101280: e8 e3 2a 00 00 call 80103d68 return ip; -801012ea: 83 c4 10 add $0x10,%esp -} -801012ed: 89 f0 mov %esi,%eax -801012ef: 8d 65 f4 lea -0xc(%ebp),%esp -801012f2: 5b pop %ebx -801012f3: 5e pop %esi -801012f4: 5f pop %edi -801012f5: 5d pop %ebp -801012f6: c3 ret +80101285: 83 c4 10 add $0x10,%esp +} +80101288: 89 f0 mov %esi,%eax +8010128a: 8d 65 f4 lea -0xc(%ebp),%esp +8010128d: 5b pop %ebx +8010128e: 5e pop %esi +8010128f: 5f pop %edi +80101290: 5d pop %ebp +80101291: c3 ret panic("iget: no inodes"); -801012f7: 83 ec 0c sub $0xc,%esp -801012fa: 68 77 79 10 80 push $0x80107977 -801012ff: e8 54 f0 ff ff call 80100358 +80101292: 83 ec 0c sub $0xc,%esp +80101295: 68 97 76 10 80 push $0x80107697 +8010129a: e8 a1 f0 ff ff call 80100340 -80101304 : +8010129f : { -80101304: f3 0f 1e fb endbr32 -80101308: 55 push %ebp -80101309: 89 e5 mov %esp,%ebp -8010130b: 53 push %ebx -8010130c: 83 ec 0c sub $0xc,%esp +8010129f: 55 push %ebp +801012a0: 89 e5 mov %esp,%ebp +801012a2: 53 push %ebx +801012a3: 83 ec 0c sub $0xc,%esp bp = bread(dev, 1); -8010130f: 6a 01 push $0x1 -80101311: ff 75 08 pushl 0x8(%ebp) -80101314: e8 95 ed ff ff call 801000ae -80101319: 89 c3 mov %eax,%ebx +801012a6: 6a 01 push $0x1 +801012a8: ff 75 08 push 0x8(%ebp) +801012ab: e8 fa ed ff ff call 801000aa +801012b0: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); -8010131b: 83 c4 0c add $0xc,%esp -8010131e: 6a 1c push $0x1c -80101320: 8d 40 5c lea 0x5c(%eax),%eax -80101323: 50 push %eax -80101324: ff 75 0c pushl 0xc(%ebp) -80101327: e8 b0 2c 00 00 call 80103fdc +801012b2: 83 c4 0c add $0xc,%esp +801012b5: 6a 1c push $0x1c +801012b7: 8d 40 5c lea 0x5c(%eax),%eax +801012ba: 50 push %eax +801012bb: ff 75 0c push 0xc(%ebp) +801012be: e8 71 2b 00 00 call 80103e34 brelse(bp); -8010132c: 89 1c 24 mov %ebx,(%esp) -8010132f: e8 99 ee ff ff call 801001cd +801012c3: 89 1c 24 mov %ebx,(%esp) +801012c6: e8 f6 ee ff ff call 801001c1 } -80101334: 83 c4 10 add $0x10,%esp -80101337: 8b 5d fc mov -0x4(%ebp),%ebx -8010133a: c9 leave -8010133b: c3 ret +801012cb: 83 c4 10 add $0x10,%esp +801012ce: 8b 5d fc mov -0x4(%ebp),%ebx +801012d1: c9 leave +801012d2: c3 ret -8010133c : +801012d3 : { -8010133c: f3 0f 1e fb endbr32 -80101340: 55 push %ebp -80101341: 89 e5 mov %esp,%ebp -80101343: 56 push %esi -80101344: 53 push %ebx +801012d3: 55 push %ebp +801012d4: 89 e5 mov %esp,%ebp +801012d6: 56 push %esi +801012d7: 53 push %ebx initlock(&icache.lock, "icache"); -80101345: 83 ec 08 sub $0x8,%esp -80101348: 68 87 79 10 80 push $0x80107987 -8010134d: 68 00 36 11 80 push $0x80113600 -80101352: e8 e6 29 00 00 call 80103d3d +801012d8: 83 ec 08 sub $0x8,%esp +801012db: 68 a7 76 10 80 push $0x801076a7 +801012e0: 68 60 09 11 80 push $0x80110960 +801012e5: e8 ce 28 00 00 call 80103bb8 for(i = 0; i < NINODE; i++) { -80101357: bb 40 36 11 80 mov $0x80113640,%ebx -8010135c: be 60 52 11 80 mov $0x80115260,%esi -80101361: 83 c4 10 add $0x10,%esp +801012ea: bb a0 09 11 80 mov $0x801109a0,%ebx +801012ef: be c0 25 11 80 mov $0x801125c0,%esi +801012f4: 83 c4 10 add $0x10,%esp initsleeplock(&icache.inode[i].lock, "inode"); -80101364: 83 ec 08 sub $0x8,%esp -80101367: 68 8e 79 10 80 push $0x8010798e -8010136c: 53 push %ebx -8010136d: e8 b1 28 00 00 call 80103c23 +801012f7: 83 ec 08 sub $0x8,%esp +801012fa: 68 ae 76 10 80 push $0x801076ae +801012ff: 53 push %ebx +80101300: e8 a9 27 00 00 call 80103aae for(i = 0; i < NINODE; i++) { -80101372: 81 c3 90 00 00 00 add $0x90,%ebx -80101378: 83 c4 10 add $0x10,%esp -8010137b: 39 f3 cmp %esi,%ebx -8010137d: 75 e5 jne 80101364 +80101305: 81 c3 90 00 00 00 add $0x90,%ebx +8010130b: 83 c4 10 add $0x10,%esp +8010130e: 39 f3 cmp %esi,%ebx +80101310: 75 e5 jne 801012f7 readsb(dev, &sb); -8010137f: 83 ec 08 sub $0x8,%esp -80101382: 68 e0 35 11 80 push $0x801135e0 -80101387: ff 75 08 pushl 0x8(%ebp) -8010138a: e8 75 ff ff ff call 80101304 +80101312: 83 ec 08 sub $0x8,%esp +80101315: 68 b4 25 11 80 push $0x801125b4 +8010131a: ff 75 08 push 0x8(%ebp) +8010131d: e8 7d ff ff ff call 8010129f cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ -8010138f: ff 35 f8 35 11 80 pushl 0x801135f8 -80101395: ff 35 f4 35 11 80 pushl 0x801135f4 -8010139b: ff 35 f0 35 11 80 pushl 0x801135f0 -801013a1: ff 35 ec 35 11 80 pushl 0x801135ec -801013a7: ff 35 e8 35 11 80 pushl 0x801135e8 -801013ad: ff 35 e4 35 11 80 pushl 0x801135e4 -801013b3: ff 35 e0 35 11 80 pushl 0x801135e0 -801013b9: 68 f4 79 10 80 push $0x801079f4 -801013be: e8 69 f2 ff ff call 8010062c -} -801013c3: 83 c4 30 add $0x30,%esp -801013c6: 8d 65 f8 lea -0x8(%ebp),%esp -801013c9: 5b pop %ebx -801013ca: 5e pop %esi -801013cb: 5d pop %ebp -801013cc: c3 ret - -801013cd : -{ -801013cd: f3 0f 1e fb endbr32 -801013d1: 55 push %ebp -801013d2: 89 e5 mov %esp,%ebp -801013d4: 57 push %edi -801013d5: 56 push %esi -801013d6: 53 push %ebx -801013d7: 83 ec 1c sub $0x1c,%esp -801013da: 8b 45 0c mov 0xc(%ebp),%eax -801013dd: 89 45 e0 mov %eax,-0x20(%ebp) +80101322: ff 35 cc 25 11 80 push 0x801125cc +80101328: ff 35 c8 25 11 80 push 0x801125c8 +8010132e: ff 35 c4 25 11 80 push 0x801125c4 +80101334: ff 35 c0 25 11 80 push 0x801125c0 +8010133a: ff 35 bc 25 11 80 push 0x801125bc +80101340: ff 35 b8 25 11 80 push 0x801125b8 +80101346: ff 35 b4 25 11 80 push 0x801125b4 +8010134c: 68 14 77 10 80 push $0x80107714 +80101351: e8 ab f2 ff ff call 80100601 +} +80101356: 83 c4 30 add $0x30,%esp +80101359: 8d 65 f8 lea -0x8(%ebp),%esp +8010135c: 5b pop %ebx +8010135d: 5e pop %esi +8010135e: 5d pop %ebp +8010135f: c3 ret + +80101360 : +{ +80101360: 55 push %ebp +80101361: 89 e5 mov %esp,%ebp +80101363: 57 push %edi +80101364: 56 push %esi +80101365: 53 push %ebx +80101366: 83 ec 1c sub $0x1c,%esp +80101369: 8b 45 0c mov 0xc(%ebp),%eax +8010136c: 89 45 e0 mov %eax,-0x20(%ebp) for(inum = 1; inum < sb.ninodes; inum++){ -801013e0: 83 3d e8 35 11 80 01 cmpl $0x1,0x801135e8 -801013e7: 76 4d jbe 80101436 -801013e9: bb 01 00 00 00 mov $0x1,%ebx -801013ee: 89 5d e4 mov %ebx,-0x1c(%ebp) +8010136f: 83 3d bc 25 11 80 01 cmpl $0x1,0x801125bc +80101376: 76 4d jbe 801013c5 +80101378: bb 01 00 00 00 mov $0x1,%ebx +8010137d: 89 5d e4 mov %ebx,-0x1c(%ebp) bp = bread(dev, IBLOCK(inum, sb)); -801013f1: 83 ec 08 sub $0x8,%esp -801013f4: 89 d8 mov %ebx,%eax -801013f6: c1 e8 03 shr $0x3,%eax -801013f9: 03 05 f4 35 11 80 add 0x801135f4,%eax -801013ff: 50 push %eax -80101400: ff 75 08 pushl 0x8(%ebp) -80101403: e8 a6 ec ff ff call 801000ae -80101408: 89 c6 mov %eax,%esi +80101380: 83 ec 08 sub $0x8,%esp +80101383: 89 d8 mov %ebx,%eax +80101385: c1 e8 03 shr $0x3,%eax +80101388: 03 05 c8 25 11 80 add 0x801125c8,%eax +8010138e: 50 push %eax +8010138f: ff 75 08 push 0x8(%ebp) +80101392: e8 13 ed ff ff call 801000aa +80101397: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + inum%IPB; -8010140a: 89 d8 mov %ebx,%eax -8010140c: 83 e0 07 and $0x7,%eax -8010140f: c1 e0 06 shl $0x6,%eax -80101412: 8d 7c 06 5c lea 0x5c(%esi,%eax,1),%edi +80101399: 89 d8 mov %ebx,%eax +8010139b: 83 e0 07 and $0x7,%eax +8010139e: c1 e0 06 shl $0x6,%eax +801013a1: 8d 7c 06 5c lea 0x5c(%esi,%eax,1),%edi if(dip->type == 0){ // a free inode -80101416: 83 c4 10 add $0x10,%esp -80101419: 66 83 3f 00 cmpw $0x0,(%edi) -8010141d: 74 24 je 80101443 +801013a5: 83 c4 10 add $0x10,%esp +801013a8: 66 83 3f 00 cmpw $0x0,(%edi) +801013ac: 74 24 je 801013d2 brelse(bp); -8010141f: 83 ec 0c sub $0xc,%esp -80101422: 56 push %esi -80101423: e8 a5 ed ff ff call 801001cd +801013ae: 83 ec 0c sub $0xc,%esp +801013b1: 56 push %esi +801013b2: e8 0a ee ff ff call 801001c1 for(inum = 1; inum < sb.ninodes; inum++){ -80101428: 83 c3 01 add $0x1,%ebx -8010142b: 83 c4 10 add $0x10,%esp -8010142e: 39 1d e8 35 11 80 cmp %ebx,0x801135e8 -80101434: 77 b8 ja 801013ee +801013b7: 83 c3 01 add $0x1,%ebx +801013ba: 83 c4 10 add $0x10,%esp +801013bd: 39 1d bc 25 11 80 cmp %ebx,0x801125bc +801013c3: 77 b8 ja 8010137d panic("ialloc: no inodes"); -80101436: 83 ec 0c sub $0xc,%esp -80101439: 68 94 79 10 80 push $0x80107994 -8010143e: e8 15 ef ff ff call 80100358 +801013c5: 83 ec 0c sub $0xc,%esp +801013c8: 68 b4 76 10 80 push $0x801076b4 +801013cd: e8 6e ef ff ff call 80100340 memset(dip, 0, sizeof(*dip)); -80101443: 83 ec 04 sub $0x4,%esp -80101446: 6a 40 push $0x40 -80101448: 6a 00 push $0x0 -8010144a: 57 push %edi -8010144b: e8 ff 2a 00 00 call 80103f4f +801013d2: 83 ec 04 sub $0x4,%esp +801013d5: 6a 40 push $0x40 +801013d7: 6a 00 push $0x0 +801013d9: 57 push %edi +801013da: e8 d0 29 00 00 call 80103daf dip->type = type; -80101450: 0f b7 45 e0 movzwl -0x20(%ebp),%eax -80101454: 66 89 07 mov %ax,(%edi) +801013df: 0f b7 45 e0 movzwl -0x20(%ebp),%eax +801013e3: 66 89 07 mov %ax,(%edi) log_write(bp); // mark it allocated on the disk -80101457: 89 34 24 mov %esi,(%esp) -8010145a: e8 e6 15 00 00 call 80102a45 +801013e6: 89 34 24 mov %esi,(%esp) +801013e9: e8 4d 15 00 00 call 8010293b brelse(bp); -8010145f: 89 34 24 mov %esi,(%esp) -80101462: e8 66 ed ff ff call 801001cd +801013ee: 89 34 24 mov %esi,(%esp) +801013f1: e8 cb ed ff ff call 801001c1 return iget(dev, inum); -80101467: 8b 55 e4 mov -0x1c(%ebp),%edx -8010146a: 8b 45 08 mov 0x8(%ebp),%eax -8010146d: e8 ea fd ff ff call 8010125c -} -80101472: 8d 65 f4 lea -0xc(%ebp),%esp -80101475: 5b pop %ebx -80101476: 5e pop %esi -80101477: 5f pop %edi -80101478: 5d pop %ebp -80101479: c3 ret - -8010147a : -{ -8010147a: f3 0f 1e fb endbr32 -8010147e: 55 push %ebp -8010147f: 89 e5 mov %esp,%ebp -80101481: 56 push %esi -80101482: 53 push %ebx -80101483: 8b 5d 08 mov 0x8(%ebp),%ebx +801013f6: 8b 55 e4 mov -0x1c(%ebp),%edx +801013f9: 8b 45 08 mov 0x8(%ebp),%eax +801013fc: e8 f6 fd ff ff call 801011f7 +} +80101401: 8d 65 f4 lea -0xc(%ebp),%esp +80101404: 5b pop %ebx +80101405: 5e pop %esi +80101406: 5f pop %edi +80101407: 5d pop %ebp +80101408: c3 ret + +80101409 : +{ +80101409: 55 push %ebp +8010140a: 89 e5 mov %esp,%ebp +8010140c: 56 push %esi +8010140d: 53 push %ebx +8010140e: 8b 5d 08 mov 0x8(%ebp),%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); -80101486: 83 ec 08 sub $0x8,%esp -80101489: 8b 43 04 mov 0x4(%ebx),%eax -8010148c: c1 e8 03 shr $0x3,%eax -8010148f: 03 05 f4 35 11 80 add 0x801135f4,%eax -80101495: 50 push %eax -80101496: ff 33 pushl (%ebx) -80101498: e8 11 ec ff ff call 801000ae -8010149d: 89 c6 mov %eax,%esi +80101411: 83 ec 08 sub $0x8,%esp +80101414: 8b 43 04 mov 0x4(%ebx),%eax +80101417: c1 e8 03 shr $0x3,%eax +8010141a: 03 05 c8 25 11 80 add 0x801125c8,%eax +80101420: 50 push %eax +80101421: ff 33 push (%ebx) +80101423: e8 82 ec ff ff call 801000aa +80101428: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; -8010149f: 8b 43 04 mov 0x4(%ebx),%eax -801014a2: 83 e0 07 and $0x7,%eax -801014a5: c1 e0 06 shl $0x6,%eax -801014a8: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax +8010142a: 8b 43 04 mov 0x4(%ebx),%eax +8010142d: 83 e0 07 and $0x7,%eax +80101430: c1 e0 06 shl $0x6,%eax +80101433: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax dip->type = ip->type; -801014ac: 0f b7 53 50 movzwl 0x50(%ebx),%edx -801014b0: 66 89 10 mov %dx,(%eax) +80101437: 0f b7 53 50 movzwl 0x50(%ebx),%edx +8010143b: 66 89 10 mov %dx,(%eax) dip->major = ip->major; -801014b3: 0f b7 53 52 movzwl 0x52(%ebx),%edx -801014b7: 66 89 50 02 mov %dx,0x2(%eax) +8010143e: 0f b7 53 52 movzwl 0x52(%ebx),%edx +80101442: 66 89 50 02 mov %dx,0x2(%eax) dip->minor = ip->minor; -801014bb: 0f b7 53 54 movzwl 0x54(%ebx),%edx -801014bf: 66 89 50 04 mov %dx,0x4(%eax) +80101446: 0f b7 53 54 movzwl 0x54(%ebx),%edx +8010144a: 66 89 50 04 mov %dx,0x4(%eax) dip->nlink = ip->nlink; -801014c3: 0f b7 53 56 movzwl 0x56(%ebx),%edx -801014c7: 66 89 50 06 mov %dx,0x6(%eax) +8010144e: 0f b7 53 56 movzwl 0x56(%ebx),%edx +80101452: 66 89 50 06 mov %dx,0x6(%eax) dip->size = ip->size; -801014cb: 8b 53 58 mov 0x58(%ebx),%edx -801014ce: 89 50 08 mov %edx,0x8(%eax) +80101456: 8b 53 58 mov 0x58(%ebx),%edx +80101459: 89 50 08 mov %edx,0x8(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); -801014d1: 83 c4 0c add $0xc,%esp -801014d4: 6a 34 push $0x34 -801014d6: 83 c3 5c add $0x5c,%ebx -801014d9: 53 push %ebx -801014da: 83 c0 0c add $0xc,%eax -801014dd: 50 push %eax -801014de: e8 f9 2a 00 00 call 80103fdc +8010145c: 83 c4 0c add $0xc,%esp +8010145f: 6a 34 push $0x34 +80101461: 83 c3 5c add $0x5c,%ebx +80101464: 53 push %ebx +80101465: 83 c0 0c add $0xc,%eax +80101468: 50 push %eax +80101469: e8 c6 29 00 00 call 80103e34 log_write(bp); -801014e3: 89 34 24 mov %esi,(%esp) -801014e6: e8 5a 15 00 00 call 80102a45 +8010146e: 89 34 24 mov %esi,(%esp) +80101471: e8 c5 14 00 00 call 8010293b brelse(bp); -801014eb: 89 34 24 mov %esi,(%esp) -801014ee: e8 da ec ff ff call 801001cd -} -801014f3: 83 c4 10 add $0x10,%esp -801014f6: 8d 65 f8 lea -0x8(%ebp),%esp -801014f9: 5b pop %ebx -801014fa: 5e pop %esi -801014fb: 5d pop %ebp -801014fc: c3 ret - -801014fd : -{ -801014fd: f3 0f 1e fb endbr32 -80101501: 55 push %ebp -80101502: 89 e5 mov %esp,%ebp -80101504: 53 push %ebx -80101505: 83 ec 10 sub $0x10,%esp -80101508: 8b 5d 08 mov 0x8(%ebp),%ebx +80101476: 89 34 24 mov %esi,(%esp) +80101479: e8 43 ed ff ff call 801001c1 +} +8010147e: 83 c4 10 add $0x10,%esp +80101481: 8d 65 f8 lea -0x8(%ebp),%esp +80101484: 5b pop %ebx +80101485: 5e pop %esi +80101486: 5d pop %ebp +80101487: c3 ret + +80101488 : +{ +80101488: 55 push %ebp +80101489: 89 e5 mov %esp,%ebp +8010148b: 53 push %ebx +8010148c: 83 ec 10 sub $0x10,%esp +8010148f: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&icache.lock); -8010150b: 68 00 36 11 80 push $0x80113600 -80101510: e8 84 29 00 00 call 80103e99 +80101492: 68 60 09 11 80 push $0x80110960 +80101497: e8 65 28 00 00 call 80103d01 ip->ref++; -80101515: 83 43 08 01 addl $0x1,0x8(%ebx) +8010149c: 83 43 08 01 addl $0x1,0x8(%ebx) release(&icache.lock); -80101519: c7 04 24 00 36 11 80 movl $0x80113600,(%esp) -80101520: e8 df 29 00 00 call 80103f04 -} -80101525: 89 d8 mov %ebx,%eax -80101527: 8b 5d fc mov -0x4(%ebp),%ebx -8010152a: c9 leave -8010152b: c3 ret - -8010152c : -{ -8010152c: f3 0f 1e fb endbr32 -80101530: 55 push %ebp -80101531: 89 e5 mov %esp,%ebp -80101533: 56 push %esi -80101534: 53 push %ebx -80101535: 8b 5d 08 mov 0x8(%ebp),%ebx +801014a0: c7 04 24 60 09 11 80 movl $0x80110960,(%esp) +801014a7: e8 bc 28 00 00 call 80103d68 +} +801014ac: 89 d8 mov %ebx,%eax +801014ae: 8b 5d fc mov -0x4(%ebp),%ebx +801014b1: c9 leave +801014b2: c3 ret + +801014b3 : +{ +801014b3: 55 push %ebp +801014b4: 89 e5 mov %esp,%ebp +801014b6: 56 push %esi +801014b7: 53 push %ebx +801014b8: 8b 5d 08 mov 0x8(%ebp),%ebx if(ip == 0 || ip->ref < 1) -80101538: 85 db test %ebx,%ebx -8010153a: 74 22 je 8010155e -8010153c: 83 7b 08 00 cmpl $0x0,0x8(%ebx) -80101540: 7e 1c jle 8010155e +801014bb: 85 db test %ebx,%ebx +801014bd: 74 22 je 801014e1 +801014bf: 83 7b 08 00 cmpl $0x0,0x8(%ebx) +801014c3: 7e 1c jle 801014e1 acquiresleep(&ip->lock); -80101542: 83 ec 0c sub $0xc,%esp -80101545: 8d 43 0c lea 0xc(%ebx),%eax -80101548: 50 push %eax -80101549: e8 0c 27 00 00 call 80103c5a +801014c5: 83 ec 0c sub $0xc,%esp +801014c8: 8d 43 0c lea 0xc(%ebx),%eax +801014cb: 50 push %eax +801014cc: e8 10 26 00 00 call 80103ae1 if(ip->valid == 0){ -8010154e: 83 c4 10 add $0x10,%esp -80101551: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx) -80101555: 74 14 je 8010156b -} -80101557: 8d 65 f8 lea -0x8(%ebp),%esp -8010155a: 5b pop %ebx -8010155b: 5e pop %esi -8010155c: 5d pop %ebp -8010155d: c3 ret +801014d1: 83 c4 10 add $0x10,%esp +801014d4: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx) +801014d8: 74 14 je 801014ee +} +801014da: 8d 65 f8 lea -0x8(%ebp),%esp +801014dd: 5b pop %ebx +801014de: 5e pop %esi +801014df: 5d pop %ebp +801014e0: c3 ret panic("ilock"); -8010155e: 83 ec 0c sub $0xc,%esp -80101561: 68 a6 79 10 80 push $0x801079a6 -80101566: e8 ed ed ff ff call 80100358 +801014e1: 83 ec 0c sub $0xc,%esp +801014e4: 68 c6 76 10 80 push $0x801076c6 +801014e9: e8 52 ee ff ff call 80100340 bp = bread(ip->dev, IBLOCK(ip->inum, sb)); -8010156b: 83 ec 08 sub $0x8,%esp -8010156e: 8b 43 04 mov 0x4(%ebx),%eax -80101571: c1 e8 03 shr $0x3,%eax -80101574: 03 05 f4 35 11 80 add 0x801135f4,%eax -8010157a: 50 push %eax -8010157b: ff 33 pushl (%ebx) -8010157d: e8 2c eb ff ff call 801000ae -80101582: 89 c6 mov %eax,%esi +801014ee: 83 ec 08 sub $0x8,%esp +801014f1: 8b 43 04 mov 0x4(%ebx),%eax +801014f4: c1 e8 03 shr $0x3,%eax +801014f7: 03 05 c8 25 11 80 add 0x801125c8,%eax +801014fd: 50 push %eax +801014fe: ff 33 push (%ebx) +80101500: e8 a5 eb ff ff call 801000aa +80101505: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; -80101584: 8b 43 04 mov 0x4(%ebx),%eax -80101587: 83 e0 07 and $0x7,%eax -8010158a: c1 e0 06 shl $0x6,%eax -8010158d: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax +80101507: 8b 43 04 mov 0x4(%ebx),%eax +8010150a: 83 e0 07 and $0x7,%eax +8010150d: c1 e0 06 shl $0x6,%eax +80101510: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax ip->type = dip->type; -80101591: 0f b7 10 movzwl (%eax),%edx -80101594: 66 89 53 50 mov %dx,0x50(%ebx) +80101514: 0f b7 10 movzwl (%eax),%edx +80101517: 66 89 53 50 mov %dx,0x50(%ebx) ip->major = dip->major; -80101598: 0f b7 50 02 movzwl 0x2(%eax),%edx -8010159c: 66 89 53 52 mov %dx,0x52(%ebx) +8010151b: 0f b7 50 02 movzwl 0x2(%eax),%edx +8010151f: 66 89 53 52 mov %dx,0x52(%ebx) ip->minor = dip->minor; -801015a0: 0f b7 50 04 movzwl 0x4(%eax),%edx -801015a4: 66 89 53 54 mov %dx,0x54(%ebx) +80101523: 0f b7 50 04 movzwl 0x4(%eax),%edx +80101527: 66 89 53 54 mov %dx,0x54(%ebx) ip->nlink = dip->nlink; -801015a8: 0f b7 50 06 movzwl 0x6(%eax),%edx -801015ac: 66 89 53 56 mov %dx,0x56(%ebx) +8010152b: 0f b7 50 06 movzwl 0x6(%eax),%edx +8010152f: 66 89 53 56 mov %dx,0x56(%ebx) ip->size = dip->size; -801015b0: 8b 50 08 mov 0x8(%eax),%edx -801015b3: 89 53 58 mov %edx,0x58(%ebx) +80101533: 8b 50 08 mov 0x8(%eax),%edx +80101536: 89 53 58 mov %edx,0x58(%ebx) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); -801015b6: 83 c4 0c add $0xc,%esp -801015b9: 6a 34 push $0x34 -801015bb: 83 c0 0c add $0xc,%eax -801015be: 50 push %eax -801015bf: 8d 43 5c lea 0x5c(%ebx),%eax -801015c2: 50 push %eax -801015c3: e8 14 2a 00 00 call 80103fdc +80101539: 83 c4 0c add $0xc,%esp +8010153c: 6a 34 push $0x34 +8010153e: 83 c0 0c add $0xc,%eax +80101541: 50 push %eax +80101542: 8d 43 5c lea 0x5c(%ebx),%eax +80101545: 50 push %eax +80101546: e8 e9 28 00 00 call 80103e34 brelse(bp); -801015c8: 89 34 24 mov %esi,(%esp) -801015cb: e8 fd eb ff ff call 801001cd +8010154b: 89 34 24 mov %esi,(%esp) +8010154e: e8 6e ec ff ff call 801001c1 ip->valid = 1; -801015d0: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) +80101553: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) if(ip->type == 0) -801015d7: 83 c4 10 add $0x10,%esp -801015da: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) -801015df: 0f 85 72 ff ff ff jne 80101557 +8010155a: 83 c4 10 add $0x10,%esp +8010155d: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) +80101562: 0f 85 72 ff ff ff jne 801014da panic("ilock: no type"); -801015e5: 83 ec 0c sub $0xc,%esp -801015e8: 68 ac 79 10 80 push $0x801079ac -801015ed: e8 66 ed ff ff call 80100358 - -801015f2 : -{ -801015f2: f3 0f 1e fb endbr32 -801015f6: 55 push %ebp -801015f7: 89 e5 mov %esp,%ebp -801015f9: 56 push %esi -801015fa: 53 push %ebx -801015fb: 8b 5d 08 mov 0x8(%ebp),%ebx +80101568: 83 ec 0c sub $0xc,%esp +8010156b: 68 cc 76 10 80 push $0x801076cc +80101570: e8 cb ed ff ff call 80100340 + +80101575 : +{ +80101575: 55 push %ebp +80101576: 89 e5 mov %esp,%ebp +80101578: 56 push %esi +80101579: 53 push %ebx +8010157a: 8b 5d 08 mov 0x8(%ebp),%ebx if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) -801015fe: 85 db test %ebx,%ebx -80101600: 74 2c je 8010162e -80101602: 8d 73 0c lea 0xc(%ebx),%esi -80101605: 83 ec 0c sub $0xc,%esp -80101608: 56 push %esi -80101609: e8 e1 26 00 00 call 80103cef -8010160e: 83 c4 10 add $0x10,%esp -80101611: 85 c0 test %eax,%eax -80101613: 74 19 je 8010162e -80101615: 83 7b 08 00 cmpl $0x0,0x8(%ebx) -80101619: 7e 13 jle 8010162e +8010157d: 85 db test %ebx,%ebx +8010157f: 74 2c je 801015ad +80101581: 8d 73 0c lea 0xc(%ebx),%esi +80101584: 83 ec 0c sub $0xc,%esp +80101587: 56 push %esi +80101588: e8 e1 25 00 00 call 80103b6e +8010158d: 83 c4 10 add $0x10,%esp +80101590: 85 c0 test %eax,%eax +80101592: 74 19 je 801015ad +80101594: 83 7b 08 00 cmpl $0x0,0x8(%ebx) +80101598: 7e 13 jle 801015ad releasesleep(&ip->lock); -8010161b: 83 ec 0c sub $0xc,%esp -8010161e: 56 push %esi -8010161f: e8 8c 26 00 00 call 80103cb0 -} -80101624: 83 c4 10 add $0x10,%esp -80101627: 8d 65 f8 lea -0x8(%ebp),%esp -8010162a: 5b pop %ebx -8010162b: 5e pop %esi -8010162c: 5d pop %ebp -8010162d: c3 ret +8010159a: 83 ec 0c sub $0xc,%esp +8010159d: 56 push %esi +8010159e: e8 90 25 00 00 call 80103b33 +} +801015a3: 83 c4 10 add $0x10,%esp +801015a6: 8d 65 f8 lea -0x8(%ebp),%esp +801015a9: 5b pop %ebx +801015aa: 5e pop %esi +801015ab: 5d pop %ebp +801015ac: c3 ret panic("iunlock"); -8010162e: 83 ec 0c sub $0xc,%esp -80101631: 68 bb 79 10 80 push $0x801079bb -80101636: e8 1d ed ff ff call 80100358 - -8010163b : -{ -8010163b: f3 0f 1e fb endbr32 -8010163f: 55 push %ebp -80101640: 89 e5 mov %esp,%ebp -80101642: 57 push %edi -80101643: 56 push %esi -80101644: 53 push %ebx -80101645: 83 ec 28 sub $0x28,%esp -80101648: 8b 5d 08 mov 0x8(%ebp),%ebx +801015ad: 83 ec 0c sub $0xc,%esp +801015b0: 68 db 76 10 80 push $0x801076db +801015b5: e8 86 ed ff ff call 80100340 + +801015ba : +{ +801015ba: 55 push %ebp +801015bb: 89 e5 mov %esp,%ebp +801015bd: 57 push %edi +801015be: 56 push %esi +801015bf: 53 push %ebx +801015c0: 83 ec 28 sub $0x28,%esp +801015c3: 8b 5d 08 mov 0x8(%ebp),%ebx acquiresleep(&ip->lock); -8010164b: 8d 73 0c lea 0xc(%ebx),%esi -8010164e: 56 push %esi -8010164f: e8 06 26 00 00 call 80103c5a +801015c6: 8d 73 0c lea 0xc(%ebx),%esi +801015c9: 56 push %esi +801015ca: e8 12 25 00 00 call 80103ae1 if(ip->valid && ip->nlink == 0){ -80101654: 83 c4 10 add $0x10,%esp -80101657: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx) -8010165b: 74 07 je 80101664 -8010165d: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) -80101662: 74 30 je 80101694 +801015cf: 83 c4 10 add $0x10,%esp +801015d2: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx) +801015d6: 74 07 je 801015df +801015d8: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) +801015dd: 74 30 je 8010160f releasesleep(&ip->lock); -80101664: 83 ec 0c sub $0xc,%esp -80101667: 56 push %esi -80101668: e8 43 26 00 00 call 80103cb0 +801015df: 83 ec 0c sub $0xc,%esp +801015e2: 56 push %esi +801015e3: e8 4b 25 00 00 call 80103b33 acquire(&icache.lock); -8010166d: c7 04 24 00 36 11 80 movl $0x80113600,(%esp) -80101674: e8 20 28 00 00 call 80103e99 +801015e8: c7 04 24 60 09 11 80 movl $0x80110960,(%esp) +801015ef: e8 0d 27 00 00 call 80103d01 ip->ref--; -80101679: 83 6b 08 01 subl $0x1,0x8(%ebx) +801015f4: 83 6b 08 01 subl $0x1,0x8(%ebx) release(&icache.lock); -8010167d: c7 04 24 00 36 11 80 movl $0x80113600,(%esp) -80101684: e8 7b 28 00 00 call 80103f04 -} -80101689: 83 c4 10 add $0x10,%esp -8010168c: 8d 65 f4 lea -0xc(%ebp),%esp -8010168f: 5b pop %ebx -80101690: 5e pop %esi -80101691: 5f pop %edi -80101692: 5d pop %ebp -80101693: c3 ret +801015f8: c7 04 24 60 09 11 80 movl $0x80110960,(%esp) +801015ff: e8 64 27 00 00 call 80103d68 +} +80101604: 83 c4 10 add $0x10,%esp +80101607: 8d 65 f4 lea -0xc(%ebp),%esp +8010160a: 5b pop %ebx +8010160b: 5e pop %esi +8010160c: 5f pop %edi +8010160d: 5d pop %ebp +8010160e: c3 ret acquire(&icache.lock); -80101694: 83 ec 0c sub $0xc,%esp -80101697: 68 00 36 11 80 push $0x80113600 -8010169c: e8 f8 27 00 00 call 80103e99 +8010160f: 83 ec 0c sub $0xc,%esp +80101612: 68 60 09 11 80 push $0x80110960 +80101617: e8 e5 26 00 00 call 80103d01 int r = ip->ref; -801016a1: 8b 7b 08 mov 0x8(%ebx),%edi +8010161c: 8b 7b 08 mov 0x8(%ebx),%edi release(&icache.lock); -801016a4: c7 04 24 00 36 11 80 movl $0x80113600,(%esp) -801016ab: e8 54 28 00 00 call 80103f04 +8010161f: c7 04 24 60 09 11 80 movl $0x80110960,(%esp) +80101626: e8 3d 27 00 00 call 80103d68 if(r == 1){ -801016b0: 83 c4 10 add $0x10,%esp -801016b3: 83 ff 01 cmp $0x1,%edi -801016b6: 75 ac jne 80101664 -801016b8: 8d 7b 5c lea 0x5c(%ebx),%edi -801016bb: 8d 83 8c 00 00 00 lea 0x8c(%ebx),%eax -801016c1: 89 75 e4 mov %esi,-0x1c(%ebp) -801016c4: 89 c6 mov %eax,%esi -801016c6: eb 07 jmp 801016cf +8010162b: 83 c4 10 add $0x10,%esp +8010162e: 83 ff 01 cmp $0x1,%edi +80101631: 75 ac jne 801015df +80101633: 8d 7b 5c lea 0x5c(%ebx),%edi +80101636: 8d 83 8c 00 00 00 lea 0x8c(%ebx),%eax +8010163c: 89 75 e4 mov %esi,-0x1c(%ebp) +8010163f: 89 c6 mov %eax,%esi +80101641: eb 07 jmp 8010164a { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ -801016c8: 83 c7 04 add $0x4,%edi -801016cb: 39 f7 cmp %esi,%edi -801016cd: 74 15 je 801016e4 +80101643: 83 c7 04 add $0x4,%edi +80101646: 39 f7 cmp %esi,%edi +80101648: 74 15 je 8010165f if(ip->addrs[i]){ -801016cf: 8b 17 mov (%edi),%edx -801016d1: 85 d2 test %edx,%edx -801016d3: 74 f3 je 801016c8 +8010164a: 8b 17 mov (%edi),%edx +8010164c: 85 d2 test %edx,%edx +8010164e: 74 f3 je 80101643 bfree(ip->dev, ip->addrs[i]); -801016d5: 8b 03 mov (%ebx),%eax -801016d7: e8 3d f9 ff ff call 80101019 +80101650: 8b 03 mov (%ebx),%eax +80101652: e8 6f f9 ff ff call 80100fc6 ip->addrs[i] = 0; -801016dc: c7 07 00 00 00 00 movl $0x0,(%edi) -801016e2: eb e4 jmp 801016c8 -801016e4: 8b 75 e4 mov -0x1c(%ebp),%esi +80101657: c7 07 00 00 00 00 movl $0x0,(%edi) +8010165d: eb e4 jmp 80101643 } } if(ip->addrs[NDIRECT]){ -801016e7: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax -801016ed: 85 c0 test %eax,%eax -801016ef: 75 2d jne 8010171e +8010165f: 8b 75 e4 mov -0x1c(%ebp),%esi +80101662: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax +80101668: 85 c0 test %eax,%eax +8010166a: 75 2d jne 80101699 brelse(bp); bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; -801016f1: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) +8010166c: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) iupdate(ip); -801016f8: 83 ec 0c sub $0xc,%esp -801016fb: 53 push %ebx -801016fc: e8 79 fd ff ff call 8010147a +80101673: 83 ec 0c sub $0xc,%esp +80101676: 53 push %ebx +80101677: e8 8d fd ff ff call 80101409 ip->type = 0; -80101701: 66 c7 43 50 00 00 movw $0x0,0x50(%ebx) +8010167c: 66 c7 43 50 00 00 movw $0x0,0x50(%ebx) iupdate(ip); -80101707: 89 1c 24 mov %ebx,(%esp) -8010170a: e8 6b fd ff ff call 8010147a +80101682: 89 1c 24 mov %ebx,(%esp) +80101685: e8 7f fd ff ff call 80101409 ip->valid = 0; -8010170f: c7 43 4c 00 00 00 00 movl $0x0,0x4c(%ebx) -80101716: 83 c4 10 add $0x10,%esp -80101719: e9 46 ff ff ff jmp 80101664 +8010168a: c7 43 4c 00 00 00 00 movl $0x0,0x4c(%ebx) +80101691: 83 c4 10 add $0x10,%esp +80101694: e9 46 ff ff ff jmp 801015df bp = bread(ip->dev, ip->addrs[NDIRECT]); -8010171e: 83 ec 08 sub $0x8,%esp -80101721: 50 push %eax -80101722: ff 33 pushl (%ebx) -80101724: e8 85 e9 ff ff call 801000ae -80101729: 89 45 e4 mov %eax,-0x1c(%ebp) +80101699: 83 ec 08 sub $0x8,%esp +8010169c: 50 push %eax +8010169d: ff 33 push (%ebx) +8010169f: e8 06 ea ff ff call 801000aa +801016a4: 89 45 e4 mov %eax,-0x1c(%ebp) for(j = 0; j < NINDIRECT; j++){ -8010172c: 8d 78 5c lea 0x5c(%eax),%edi -8010172f: 05 5c 02 00 00 add $0x25c,%eax -80101734: 83 c4 10 add $0x10,%esp -80101737: 89 75 e0 mov %esi,-0x20(%ebp) -8010173a: 89 c6 mov %eax,%esi -8010173c: eb 0e jmp 8010174c - bfree(ip->dev, a[j]); -8010173e: 8b 03 mov (%ebx),%eax -80101740: e8 d4 f8 ff ff call 80101019 - for(j = 0; j < NINDIRECT; j++){ -80101745: 83 c7 04 add $0x4,%edi -80101748: 39 f7 cmp %esi,%edi -8010174a: 74 08 je 80101754 +801016a7: 8d 78 5c lea 0x5c(%eax),%edi +801016aa: 05 5c 02 00 00 add $0x25c,%eax +801016af: 83 c4 10 add $0x10,%esp +801016b2: 89 75 e0 mov %esi,-0x20(%ebp) +801016b5: 89 c6 mov %eax,%esi +801016b7: eb 07 jmp 801016c0 +801016b9: 83 c7 04 add $0x4,%edi +801016bc: 39 f7 cmp %esi,%edi +801016be: 74 0f je 801016cf if(a[j]) -8010174c: 8b 17 mov (%edi),%edx -8010174e: 85 d2 test %edx,%edx -80101750: 74 f3 je 80101745 -80101752: eb ea jmp 8010173e -80101754: 8b 75 e0 mov -0x20(%ebp),%esi +801016c0: 8b 17 mov (%edi),%edx +801016c2: 85 d2 test %edx,%edx +801016c4: 74 f3 je 801016b9 + bfree(ip->dev, a[j]); +801016c6: 8b 03 mov (%ebx),%eax +801016c8: e8 f9 f8 ff ff call 80100fc6 +801016cd: eb ea jmp 801016b9 brelse(bp); -80101757: 83 ec 0c sub $0xc,%esp -8010175a: ff 75 e4 pushl -0x1c(%ebp) -8010175d: e8 6b ea ff ff call 801001cd +801016cf: 8b 75 e0 mov -0x20(%ebp),%esi +801016d2: 83 ec 0c sub $0xc,%esp +801016d5: ff 75 e4 push -0x1c(%ebp) +801016d8: e8 e4 ea ff ff call 801001c1 bfree(ip->dev, ip->addrs[NDIRECT]); -80101762: 8b 93 8c 00 00 00 mov 0x8c(%ebx),%edx -80101768: 8b 03 mov (%ebx),%eax -8010176a: e8 aa f8 ff ff call 80101019 +801016dd: 8b 93 8c 00 00 00 mov 0x8c(%ebx),%edx +801016e3: 8b 03 mov (%ebx),%eax +801016e5: e8 dc f8 ff ff call 80100fc6 ip->addrs[NDIRECT] = 0; -8010176f: c7 83 8c 00 00 00 00 movl $0x0,0x8c(%ebx) -80101776: 00 00 00 -80101779: 83 c4 10 add $0x10,%esp -8010177c: e9 70 ff ff ff jmp 801016f1 - -80101781 : -{ -80101781: f3 0f 1e fb endbr32 -80101785: 55 push %ebp -80101786: 89 e5 mov %esp,%ebp -80101788: 53 push %ebx -80101789: 83 ec 10 sub $0x10,%esp -8010178c: 8b 5d 08 mov 0x8(%ebp),%ebx +801016ea: c7 83 8c 00 00 00 00 movl $0x0,0x8c(%ebx) +801016f1: 00 00 00 +801016f4: 83 c4 10 add $0x10,%esp +801016f7: e9 70 ff ff ff jmp 8010166c + +801016fc : +{ +801016fc: 55 push %ebp +801016fd: 89 e5 mov %esp,%ebp +801016ff: 53 push %ebx +80101700: 83 ec 10 sub $0x10,%esp +80101703: 8b 5d 08 mov 0x8(%ebp),%ebx iunlock(ip); -8010178f: 53 push %ebx -80101790: e8 5d fe ff ff call 801015f2 +80101706: 53 push %ebx +80101707: e8 69 fe ff ff call 80101575 iput(ip); -80101795: 89 1c 24 mov %ebx,(%esp) -80101798: e8 9e fe ff ff call 8010163b +8010170c: 89 1c 24 mov %ebx,(%esp) +8010170f: e8 a6 fe ff ff call 801015ba } -8010179d: 83 c4 10 add $0x10,%esp -801017a0: 8b 5d fc mov -0x4(%ebp),%ebx -801017a3: c9 leave -801017a4: c3 ret +80101714: 83 c4 10 add $0x10,%esp +80101717: 8b 5d fc mov -0x4(%ebp),%ebx +8010171a: c9 leave +8010171b: c3 ret -801017a5 : +8010171c : // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { -801017a5: f3 0f 1e fb endbr32 -801017a9: 55 push %ebp -801017aa: 89 e5 mov %esp,%ebp -801017ac: 8b 55 08 mov 0x8(%ebp),%edx -801017af: 8b 45 0c mov 0xc(%ebp),%eax +8010171c: 55 push %ebp +8010171d: 89 e5 mov %esp,%ebp +8010171f: 8b 55 08 mov 0x8(%ebp),%edx +80101722: 8b 45 0c mov 0xc(%ebp),%eax st->dev = ip->dev; -801017b2: 8b 0a mov (%edx),%ecx -801017b4: 89 48 04 mov %ecx,0x4(%eax) +80101725: 8b 0a mov (%edx),%ecx +80101727: 89 48 04 mov %ecx,0x4(%eax) st->ino = ip->inum; -801017b7: 8b 4a 04 mov 0x4(%edx),%ecx -801017ba: 89 48 08 mov %ecx,0x8(%eax) +8010172a: 8b 4a 04 mov 0x4(%edx),%ecx +8010172d: 89 48 08 mov %ecx,0x8(%eax) st->type = ip->type; -801017bd: 0f b7 4a 50 movzwl 0x50(%edx),%ecx -801017c1: 66 89 08 mov %cx,(%eax) +80101730: 0f b7 4a 50 movzwl 0x50(%edx),%ecx +80101734: 66 89 08 mov %cx,(%eax) st->nlink = ip->nlink; -801017c4: 0f b7 4a 56 movzwl 0x56(%edx),%ecx -801017c8: 66 89 48 0c mov %cx,0xc(%eax) +80101737: 0f b7 4a 56 movzwl 0x56(%edx),%ecx +8010173b: 66 89 48 0c mov %cx,0xc(%eax) st->size = ip->size; -801017cc: 8b 52 58 mov 0x58(%edx),%edx -801017cf: 89 50 10 mov %edx,0x10(%eax) +8010173f: 8b 52 58 mov 0x58(%edx),%edx +80101742: 89 50 10 mov %edx,0x10(%eax) } -801017d2: 5d pop %ebp -801017d3: c3 ret +80101745: 5d pop %ebp +80101746: c3 ret -801017d4 : +80101747 : //PAGEBREAK! // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { -801017d4: f3 0f 1e fb endbr32 -801017d8: 55 push %ebp -801017d9: 89 e5 mov %esp,%ebp -801017db: 57 push %edi -801017dc: 56 push %esi -801017dd: 53 push %ebx -801017de: 83 ec 1c sub $0x1c,%esp -801017e1: 8b 75 10 mov 0x10(%ebp),%esi +80101747: 55 push %ebp +80101748: 89 e5 mov %esp,%ebp +8010174a: 57 push %edi +8010174b: 56 push %esi +8010174c: 53 push %ebx +8010174d: 83 ec 1c sub $0x1c,%esp +80101750: 8b 7d 10 mov 0x10(%ebp),%edi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ -801017e4: 8b 45 08 mov 0x8(%ebp),%eax -801017e7: 66 83 78 50 03 cmpw $0x3,0x50(%eax) -801017ec: 0f 84 9d 00 00 00 je 8010188f +80101753: 8b 45 08 mov 0x8(%ebp),%eax +80101756: 66 83 78 50 03 cmpw $0x3,0x50(%eax) +8010175b: 0f 84 9d 00 00 00 je 801017fe 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) -801017f2: 8b 45 08 mov 0x8(%ebp),%eax -801017f5: 8b 40 58 mov 0x58(%eax),%eax -801017f8: 39 f0 cmp %esi,%eax -801017fa: 0f 82 c6 00 00 00 jb 801018c6 -80101800: 89 f2 mov %esi,%edx -80101802: 03 55 14 add 0x14(%ebp),%edx -80101805: 0f 82 c2 00 00 00 jb 801018cd +80101761: 8b 45 08 mov 0x8(%ebp),%eax +80101764: 8b 40 58 mov 0x58(%eax),%eax +80101767: 39 f8 cmp %edi,%eax +80101769: 0f 82 c6 00 00 00 jb 80101835 +8010176f: 89 fa mov %edi,%edx +80101771: 03 55 14 add 0x14(%ebp),%edx +80101774: 0f 82 c2 00 00 00 jb 8010183c return -1; if(off + n > ip->size) n = ip->size - off; -8010180b: 89 c1 mov %eax,%ecx -8010180d: 29 f1 sub %esi,%ecx -8010180f: 39 d0 cmp %edx,%eax -80101811: 0f 43 4d 14 cmovae 0x14(%ebp),%ecx -80101815: 89 4d 14 mov %ecx,0x14(%ebp) +8010177a: 89 c1 mov %eax,%ecx +8010177c: 29 f9 sub %edi,%ecx +8010177e: 39 d0 cmp %edx,%eax +80101780: 0f 43 4d 14 cmovae 0x14(%ebp),%ecx +80101784: 89 4d 14 mov %ecx,0x14(%ebp) for(tot=0; tot -8010181c: bf 00 00 00 00 mov $0x0,%edi +80101787: 85 c9 test %ecx,%ecx +80101789: 74 68 je 801017f3 +8010178b: be 00 00 00 00 mov $0x0,%esi bp = bread(ip->dev, bmap(ip, off/BSIZE)); -80101821: 89 f2 mov %esi,%edx -80101823: c1 ea 09 shr $0x9,%edx -80101826: 8b 45 08 mov 0x8(%ebp),%eax -80101829: e8 85 f9 ff ff call 801011b3 -8010182e: 83 ec 08 sub $0x8,%esp -80101831: 50 push %eax -80101832: 8b 45 08 mov 0x8(%ebp),%eax -80101835: ff 30 pushl (%eax) -80101837: e8 72 e8 ff ff call 801000ae -8010183c: 89 c1 mov %eax,%ecx +80101790: 89 fa mov %edi,%edx +80101792: c1 ea 09 shr $0x9,%edx +80101795: 8b 45 08 mov 0x8(%ebp),%eax +80101798: e8 b4 f9 ff ff call 80101151 +8010179d: 83 ec 08 sub $0x8,%esp +801017a0: 50 push %eax +801017a1: 8b 45 08 mov 0x8(%ebp),%eax +801017a4: ff 30 push (%eax) +801017a6: e8 ff e8 ff ff call 801000aa +801017ab: 89 c1 mov %eax,%ecx m = min(n - tot, BSIZE - off%BSIZE); -8010183e: 89 f0 mov %esi,%eax -80101840: 25 ff 01 00 00 and $0x1ff,%eax -80101845: bb 00 02 00 00 mov $0x200,%ebx -8010184a: 29 c3 sub %eax,%ebx -8010184c: 8b 55 14 mov 0x14(%ebp),%edx -8010184f: 29 fa sub %edi,%edx -80101851: 83 c4 0c add $0xc,%esp -80101854: 39 d3 cmp %edx,%ebx -80101856: 0f 47 da cmova %edx,%ebx +801017ad: 89 f8 mov %edi,%eax +801017af: 25 ff 01 00 00 and $0x1ff,%eax +801017b4: bb 00 02 00 00 mov $0x200,%ebx +801017b9: 29 c3 sub %eax,%ebx +801017bb: 8b 55 14 mov 0x14(%ebp),%edx +801017be: 29 f2 sub %esi,%edx +801017c0: 39 d3 cmp %edx,%ebx +801017c2: 0f 47 da cmova %edx,%ebx memmove(dst, bp->data + off%BSIZE, m); -80101859: 53 push %ebx -8010185a: 89 4d e4 mov %ecx,-0x1c(%ebp) -8010185d: 8d 44 01 5c lea 0x5c(%ecx,%eax,1),%eax -80101861: 50 push %eax -80101862: ff 75 0c pushl 0xc(%ebp) -80101865: e8 72 27 00 00 call 80103fdc +801017c5: 83 c4 0c add $0xc,%esp +801017c8: 53 push %ebx +801017c9: 89 4d e4 mov %ecx,-0x1c(%ebp) +801017cc: 8d 44 01 5c lea 0x5c(%ecx,%eax,1),%eax +801017d0: 50 push %eax +801017d1: ff 75 0c push 0xc(%ebp) +801017d4: e8 5b 26 00 00 call 80103e34 brelse(bp); -8010186a: 83 c4 04 add $0x4,%esp -8010186d: ff 75 e4 pushl -0x1c(%ebp) -80101870: e8 58 e9 ff ff call 801001cd +801017d9: 83 c4 04 add $0x4,%esp +801017dc: ff 75 e4 push -0x1c(%ebp) +801017df: e8 dd e9 ff ff call 801001c1 for(tot=0; tot +801017e4: 01 de add %ebx,%esi +801017e6: 01 df add %ebx,%edi +801017e8: 01 5d 0c add %ebx,0xc(%ebp) +801017eb: 83 c4 10 add $0x10,%esp +801017ee: 39 75 14 cmp %esi,0x14(%ebp) +801017f1: 77 9d ja 80101790 } return n; -80101884: 8b 45 14 mov 0x14(%ebp),%eax -} -80101887: 8d 65 f4 lea -0xc(%ebp),%esp -8010188a: 5b pop %ebx -8010188b: 5e pop %esi -8010188c: 5f pop %edi -8010188d: 5d pop %ebp -8010188e: c3 ret +801017f3: 8b 45 14 mov 0x14(%ebp),%eax +} +801017f6: 8d 65 f4 lea -0xc(%ebp),%esp +801017f9: 5b pop %ebx +801017fa: 5e pop %esi +801017fb: 5f pop %edi +801017fc: 5d pop %ebp +801017fd: c3 ret if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) -8010188f: 0f b7 40 52 movzwl 0x52(%eax),%eax -80101893: 66 83 f8 09 cmp $0x9,%ax -80101897: 77 1f ja 801018b8 -80101899: 98 cwtl -8010189a: 8b 04 c5 80 35 11 80 mov -0x7feeca80(,%eax,8),%eax -801018a1: 85 c0 test %eax,%eax -801018a3: 74 1a je 801018bf +801017fe: 0f b7 40 52 movzwl 0x52(%eax),%eax +80101802: 66 83 f8 09 cmp $0x9,%ax +80101806: 77 1f ja 80101827 +80101808: 98 cwtl +80101809: 8b 04 c5 00 09 11 80 mov -0x7feef700(,%eax,8),%eax +80101810: 85 c0 test %eax,%eax +80101812: 74 1a je 8010182e return devsw[ip->major].read(ip, dst, n); -801018a5: 83 ec 04 sub $0x4,%esp -801018a8: ff 75 14 pushl 0x14(%ebp) -801018ab: ff 75 0c pushl 0xc(%ebp) -801018ae: ff 75 08 pushl 0x8(%ebp) -801018b1: ff d0 call *%eax -801018b3: 83 c4 10 add $0x10,%esp -801018b6: eb cf jmp 80101887 +80101814: 83 ec 04 sub $0x4,%esp +80101817: ff 75 14 push 0x14(%ebp) +8010181a: ff 75 0c push 0xc(%ebp) +8010181d: ff 75 08 push 0x8(%ebp) +80101820: ff d0 call *%eax +80101822: 83 c4 10 add $0x10,%esp +80101825: eb cf jmp 801017f6 return -1; -801018b8: b8 ff ff ff ff mov $0xffffffff,%eax -801018bd: eb c8 jmp 80101887 -801018bf: b8 ff ff ff ff mov $0xffffffff,%eax -801018c4: eb c1 jmp 80101887 +80101827: b8 ff ff ff ff mov $0xffffffff,%eax +8010182c: eb c8 jmp 801017f6 +8010182e: b8 ff ff ff ff mov $0xffffffff,%eax +80101833: eb c1 jmp 801017f6 return -1; -801018c6: b8 ff ff ff ff mov $0xffffffff,%eax -801018cb: eb ba jmp 80101887 -801018cd: b8 ff ff ff ff mov $0xffffffff,%eax -801018d2: eb b3 jmp 80101887 +80101835: b8 ff ff ff ff mov $0xffffffff,%eax +8010183a: eb ba jmp 801017f6 +8010183c: b8 ff ff ff ff mov $0xffffffff,%eax +80101841: eb b3 jmp 801017f6 -801018d4 : +80101843 : // PAGEBREAK! // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { -801018d4: f3 0f 1e fb endbr32 -801018d8: 55 push %ebp -801018d9: 89 e5 mov %esp,%ebp -801018db: 57 push %edi -801018dc: 56 push %esi -801018dd: 53 push %ebx -801018de: 83 ec 1c sub $0x1c,%esp -801018e1: 8b 7d 10 mov 0x10(%ebp),%edi +80101843: 55 push %ebp +80101844: 89 e5 mov %esp,%ebp +80101846: 57 push %edi +80101847: 56 push %esi +80101848: 53 push %ebx +80101849: 83 ec 1c sub $0x1c,%esp +8010184c: 8b 7d 10 mov 0x10(%ebp),%edi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ -801018e4: 8b 45 08 mov 0x8(%ebp),%eax -801018e7: 66 83 78 50 03 cmpw $0x3,0x50(%eax) -801018ec: 0f 84 b0 00 00 00 je 801019a2 +8010184f: 8b 45 08 mov 0x8(%ebp),%eax +80101852: 66 83 78 50 03 cmpw $0x3,0x50(%eax) +80101857: 0f 84 ae 00 00 00 je 8010190b 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) -801018f2: 8b 45 08 mov 0x8(%ebp),%eax -801018f5: 39 78 58 cmp %edi,0x58(%eax) -801018f8: 0f 82 ef 00 00 00 jb 801019ed -801018fe: 89 f8 mov %edi,%eax -80101900: 03 45 14 add 0x14(%ebp),%eax +8010185d: 8b 45 08 mov 0x8(%ebp),%eax +80101860: 39 78 58 cmp %edi,0x58(%eax) +80101863: 0f 82 ed 00 00 00 jb 80101956 +80101869: 89 f8 mov %edi,%eax +8010186b: 03 45 14 add 0x14(%ebp),%eax return -1; if(off + n > MAXFILE*BSIZE) -80101903: 3d 00 18 01 00 cmp $0x11800,%eax -80101908: 0f 87 e6 00 00 00 ja 801019f4 -8010190e: 39 f8 cmp %edi,%eax -80101910: 0f 82 de 00 00 00 jb 801019f4 +8010186e: 3d 00 18 01 00 cmp $0x11800,%eax +80101873: 0f 87 e4 00 00 00 ja 8010195d +80101879: 39 f8 cmp %edi,%eax +8010187b: 0f 82 dc 00 00 00 jb 8010195d return -1; for(tot=0; tot -8010191c: be 00 00 00 00 mov $0x0,%esi +80101881: 83 7d 14 00 cmpl $0x0,0x14(%ebp) +80101885: 74 79 je 80101900 +80101887: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) bp = bread(ip->dev, bmap(ip, off/BSIZE)); -80101921: 89 fa mov %edi,%edx -80101923: c1 ea 09 shr $0x9,%edx -80101926: 8b 45 08 mov 0x8(%ebp),%eax -80101929: e8 85 f8 ff ff call 801011b3 -8010192e: 83 ec 08 sub $0x8,%esp -80101931: 50 push %eax -80101932: 8b 45 08 mov 0x8(%ebp),%eax -80101935: ff 30 pushl (%eax) -80101937: e8 72 e7 ff ff call 801000ae -8010193c: 89 c1 mov %eax,%ecx +8010188e: 89 fa mov %edi,%edx +80101890: c1 ea 09 shr $0x9,%edx +80101893: 8b 45 08 mov 0x8(%ebp),%eax +80101896: e8 b6 f8 ff ff call 80101151 +8010189b: 83 ec 08 sub $0x8,%esp +8010189e: 50 push %eax +8010189f: 8b 45 08 mov 0x8(%ebp),%eax +801018a2: ff 30 push (%eax) +801018a4: e8 01 e8 ff ff call 801000aa +801018a9: 89 c6 mov %eax,%esi m = min(n - tot, BSIZE - off%BSIZE); -8010193e: 89 f8 mov %edi,%eax -80101940: 25 ff 01 00 00 and $0x1ff,%eax -80101945: bb 00 02 00 00 mov $0x200,%ebx -8010194a: 29 c3 sub %eax,%ebx -8010194c: 8b 55 14 mov 0x14(%ebp),%edx -8010194f: 29 f2 sub %esi,%edx -80101951: 83 c4 0c add $0xc,%esp -80101954: 39 d3 cmp %edx,%ebx -80101956: 0f 47 da cmova %edx,%ebx +801018ab: 89 f8 mov %edi,%eax +801018ad: 25 ff 01 00 00 and $0x1ff,%eax +801018b2: bb 00 02 00 00 mov $0x200,%ebx +801018b7: 29 c3 sub %eax,%ebx +801018b9: 8b 55 14 mov 0x14(%ebp),%edx +801018bc: 2b 55 e4 sub -0x1c(%ebp),%edx +801018bf: 39 d3 cmp %edx,%ebx +801018c1: 0f 47 da cmova %edx,%ebx memmove(bp->data + off%BSIZE, src, m); -80101959: 53 push %ebx -8010195a: ff 75 0c pushl 0xc(%ebp) -8010195d: 89 4d e4 mov %ecx,-0x1c(%ebp) -80101960: 8d 44 01 5c lea 0x5c(%ecx,%eax,1),%eax -80101964: 50 push %eax -80101965: e8 72 26 00 00 call 80103fdc +801018c4: 83 c4 0c add $0xc,%esp +801018c7: 53 push %ebx +801018c8: ff 75 0c push 0xc(%ebp) +801018cb: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax +801018cf: 50 push %eax +801018d0: e8 5f 25 00 00 call 80103e34 log_write(bp); -8010196a: 83 c4 04 add $0x4,%esp -8010196d: ff 75 e4 pushl -0x1c(%ebp) -80101970: e8 d0 10 00 00 call 80102a45 +801018d5: 89 34 24 mov %esi,(%esp) +801018d8: e8 5e 10 00 00 call 8010293b brelse(bp); -80101975: 83 c4 04 add $0x4,%esp -80101978: ff 75 e4 pushl -0x1c(%ebp) -8010197b: e8 4d e8 ff ff call 801001cd +801018dd: 89 34 24 mov %esi,(%esp) +801018e0: e8 dc e8 ff ff call 801001c1 for(tot=0; tot +801018e5: 01 5d e4 add %ebx,-0x1c(%ebp) +801018e8: 8b 45 e4 mov -0x1c(%ebp),%eax +801018eb: 01 df add %ebx,%edi +801018ed: 01 5d 0c add %ebx,0xc(%ebp) +801018f0: 83 c4 10 add $0x10,%esp +801018f3: 39 45 14 cmp %eax,0x14(%ebp) +801018f6: 77 96 ja 8010188e } if(n > 0 && off > ip->size){ -8010198f: 8b 45 08 mov 0x8(%ebp),%eax -80101992: 39 78 58 cmp %edi,0x58(%eax) -80101995: 72 34 jb 801019cb +801018f8: 8b 45 08 mov 0x8(%ebp),%eax +801018fb: 39 78 58 cmp %edi,0x58(%eax) +801018fe: 72 34 jb 80101934 ip->size = off; iupdate(ip); } return n; -80101997: 8b 45 14 mov 0x14(%ebp),%eax -} -8010199a: 8d 65 f4 lea -0xc(%ebp),%esp -8010199d: 5b pop %ebx -8010199e: 5e pop %esi -8010199f: 5f pop %edi -801019a0: 5d pop %ebp -801019a1: c3 ret +80101900: 8b 45 14 mov 0x14(%ebp),%eax +} +80101903: 8d 65 f4 lea -0xc(%ebp),%esp +80101906: 5b pop %ebx +80101907: 5e pop %esi +80101908: 5f pop %edi +80101909: 5d pop %ebp +8010190a: c3 ret if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) -801019a2: 0f b7 40 52 movzwl 0x52(%eax),%eax -801019a6: 66 83 f8 09 cmp $0x9,%ax -801019aa: 77 33 ja 801019df -801019ac: 98 cwtl -801019ad: 8b 04 c5 84 35 11 80 mov -0x7feeca7c(,%eax,8),%eax -801019b4: 85 c0 test %eax,%eax -801019b6: 74 2e je 801019e6 +8010190b: 0f b7 40 52 movzwl 0x52(%eax),%eax +8010190f: 66 83 f8 09 cmp $0x9,%ax +80101913: 77 33 ja 80101948 +80101915: 98 cwtl +80101916: 8b 04 c5 04 09 11 80 mov -0x7feef6fc(,%eax,8),%eax +8010191d: 85 c0 test %eax,%eax +8010191f: 74 2e je 8010194f return devsw[ip->major].write(ip, src, n); -801019b8: 83 ec 04 sub $0x4,%esp -801019bb: ff 75 14 pushl 0x14(%ebp) -801019be: ff 75 0c pushl 0xc(%ebp) -801019c1: ff 75 08 pushl 0x8(%ebp) -801019c4: ff d0 call *%eax -801019c6: 83 c4 10 add $0x10,%esp -801019c9: eb cf jmp 8010199a +80101921: 83 ec 04 sub $0x4,%esp +80101924: ff 75 14 push 0x14(%ebp) +80101927: ff 75 0c push 0xc(%ebp) +8010192a: ff 75 08 push 0x8(%ebp) +8010192d: ff d0 call *%eax +8010192f: 83 c4 10 add $0x10,%esp +80101932: eb cf jmp 80101903 ip->size = off; -801019cb: 8b 45 08 mov 0x8(%ebp),%eax -801019ce: 89 78 58 mov %edi,0x58(%eax) +80101934: 8b 45 08 mov 0x8(%ebp),%eax +80101937: 89 78 58 mov %edi,0x58(%eax) iupdate(ip); -801019d1: 83 ec 0c sub $0xc,%esp -801019d4: 50 push %eax -801019d5: e8 a0 fa ff ff call 8010147a -801019da: 83 c4 10 add $0x10,%esp -801019dd: eb b8 jmp 80101997 +8010193a: 83 ec 0c sub $0xc,%esp +8010193d: 50 push %eax +8010193e: e8 c6 fa ff ff call 80101409 +80101943: 83 c4 10 add $0x10,%esp +80101946: eb b8 jmp 80101900 return -1; -801019df: b8 ff ff ff ff mov $0xffffffff,%eax -801019e4: eb b4 jmp 8010199a -801019e6: b8 ff ff ff ff mov $0xffffffff,%eax -801019eb: eb ad jmp 8010199a +80101948: b8 ff ff ff ff mov $0xffffffff,%eax +8010194d: eb b4 jmp 80101903 +8010194f: b8 ff ff ff ff mov $0xffffffff,%eax +80101954: eb ad jmp 80101903 return -1; -801019ed: b8 ff ff ff ff mov $0xffffffff,%eax -801019f2: eb a6 jmp 8010199a +80101956: b8 ff ff ff ff mov $0xffffffff,%eax +8010195b: eb a6 jmp 80101903 return -1; -801019f4: b8 ff ff ff ff mov $0xffffffff,%eax -801019f9: eb 9f jmp 8010199a +8010195d: b8 ff ff ff ff mov $0xffffffff,%eax +80101962: eb 9f jmp 80101903 -801019fb : +80101964 : //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { -801019fb: f3 0f 1e fb endbr32 -801019ff: 55 push %ebp -80101a00: 89 e5 mov %esp,%ebp -80101a02: 83 ec 0c sub $0xc,%esp +80101964: 55 push %ebp +80101965: 89 e5 mov %esp,%ebp +80101967: 83 ec 0c sub $0xc,%esp return strncmp(s, t, DIRSIZ); -80101a05: 6a 0e push $0xe -80101a07: ff 75 0c pushl 0xc(%ebp) -80101a0a: ff 75 08 pushl 0x8(%ebp) -80101a0d: e8 39 26 00 00 call 8010404b +8010196a: 6a 0e push $0xe +8010196c: ff 75 0c push 0xc(%ebp) +8010196f: ff 75 08 push 0x8(%ebp) +80101972: e8 24 25 00 00 call 80103e9b } -80101a12: c9 leave -80101a13: c3 ret +80101977: c9 leave +80101978: c3 ret -80101a14 : +80101979 : // 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) { -80101a14: f3 0f 1e fb endbr32 -80101a18: 55 push %ebp -80101a19: 89 e5 mov %esp,%ebp -80101a1b: 57 push %edi -80101a1c: 56 push %esi -80101a1d: 53 push %ebx -80101a1e: 83 ec 1c sub $0x1c,%esp -80101a21: 8b 75 08 mov 0x8(%ebp),%esi +80101979: 55 push %ebp +8010197a: 89 e5 mov %esp,%ebp +8010197c: 57 push %edi +8010197d: 56 push %esi +8010197e: 53 push %ebx +8010197f: 83 ec 1c sub $0x1c,%esp +80101982: 8b 75 08 mov 0x8(%ebp),%esi uint off, inum; struct dirent de; if(dp->type != T_DIR) -80101a24: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) -80101a29: 75 15 jne 80101a40 +80101985: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) +8010198a: 75 15 jne 801019a1 panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ -80101a2b: bb 00 00 00 00 mov $0x0,%ebx +8010198c: bb 00 00 00 00 mov $0x0,%ebx if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) -80101a30: 8d 7d d8 lea -0x28(%ebp),%edi +80101991: 8d 7d d8 lea -0x28(%ebp),%edi inum = de.inum; return iget(dp->dev, inum); } } return 0; -80101a33: b8 00 00 00 00 mov $0x0,%eax +80101994: b8 00 00 00 00 mov $0x0,%eax for(off = 0; off < dp->size; off += sizeof(de)){ -80101a38: 83 7e 58 00 cmpl $0x0,0x58(%esi) -80101a3c: 75 24 jne 80101a62 -80101a3e: eb 6e jmp 80101aae +80101999: 83 7e 58 00 cmpl $0x0,0x58(%esi) +8010199d: 75 24 jne 801019c3 +8010199f: eb 6e jmp 80101a0f panic("dirlookup not DIR"); -80101a40: 83 ec 0c sub $0xc,%esp -80101a43: 68 c3 79 10 80 push $0x801079c3 -80101a48: e8 0b e9 ff ff call 80100358 +801019a1: 83 ec 0c sub $0xc,%esp +801019a4: 68 e3 76 10 80 push $0x801076e3 +801019a9: e8 92 e9 ff ff call 80100340 panic("dirlookup read"); -80101a4d: 83 ec 0c sub $0xc,%esp -80101a50: 68 d5 79 10 80 push $0x801079d5 -80101a55: e8 fe e8 ff ff call 80100358 +801019ae: 83 ec 0c sub $0xc,%esp +801019b1: 68 f5 76 10 80 push $0x801076f5 +801019b6: e8 85 e9 ff ff call 80100340 for(off = 0; off < dp->size; off += sizeof(de)){ -80101a5a: 83 c3 10 add $0x10,%ebx -80101a5d: 39 5e 58 cmp %ebx,0x58(%esi) -80101a60: 76 47 jbe 80101aa9 +801019bb: 83 c3 10 add $0x10,%ebx +801019be: 39 5e 58 cmp %ebx,0x58(%esi) +801019c1: 76 47 jbe 80101a0a if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) -80101a62: 6a 10 push $0x10 -80101a64: 53 push %ebx -80101a65: 57 push %edi -80101a66: 56 push %esi -80101a67: e8 68 fd ff ff call 801017d4 -80101a6c: 83 c4 10 add $0x10,%esp -80101a6f: 83 f8 10 cmp $0x10,%eax -80101a72: 75 d9 jne 80101a4d +801019c3: 6a 10 push $0x10 +801019c5: 53 push %ebx +801019c6: 57 push %edi +801019c7: 56 push %esi +801019c8: e8 7a fd ff ff call 80101747 +801019cd: 83 c4 10 add $0x10,%esp +801019d0: 83 f8 10 cmp $0x10,%eax +801019d3: 75 d9 jne 801019ae if(de.inum == 0) -80101a74: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) -80101a79: 74 df je 80101a5a +801019d5: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) +801019da: 74 df je 801019bb if(namecmp(name, de.name) == 0){ -80101a7b: 83 ec 08 sub $0x8,%esp -80101a7e: 8d 45 da lea -0x26(%ebp),%eax -80101a81: 50 push %eax -80101a82: ff 75 0c pushl 0xc(%ebp) -80101a85: e8 71 ff ff ff call 801019fb -80101a8a: 83 c4 10 add $0x10,%esp -80101a8d: 85 c0 test %eax,%eax -80101a8f: 75 c9 jne 80101a5a +801019dc: 83 ec 08 sub $0x8,%esp +801019df: 8d 45 da lea -0x26(%ebp),%eax +801019e2: 50 push %eax +801019e3: ff 75 0c push 0xc(%ebp) +801019e6: e8 79 ff ff ff call 80101964 +801019eb: 83 c4 10 add $0x10,%esp +801019ee: 85 c0 test %eax,%eax +801019f0: 75 c9 jne 801019bb if(poff) -80101a91: 83 7d 10 00 cmpl $0x0,0x10(%ebp) -80101a95: 74 05 je 80101a9c +801019f2: 83 7d 10 00 cmpl $0x0,0x10(%ebp) +801019f6: 74 05 je 801019fd *poff = off; -80101a97: 8b 45 10 mov 0x10(%ebp),%eax -80101a9a: 89 18 mov %ebx,(%eax) +801019f8: 8b 45 10 mov 0x10(%ebp),%eax +801019fb: 89 18 mov %ebx,(%eax) inum = de.inum; -80101a9c: 0f b7 55 d8 movzwl -0x28(%ebp),%edx +801019fd: 0f b7 55 d8 movzwl -0x28(%ebp),%edx return iget(dp->dev, inum); -80101aa0: 8b 06 mov (%esi),%eax -80101aa2: e8 b5 f7 ff ff call 8010125c -80101aa7: eb 05 jmp 80101aae +80101a01: 8b 06 mov (%esi),%eax +80101a03: e8 ef f7 ff ff call 801011f7 +80101a08: eb 05 jmp 80101a0f return 0; -80101aa9: b8 00 00 00 00 mov $0x0,%eax +80101a0a: b8 00 00 00 00 mov $0x0,%eax } -80101aae: 8d 65 f4 lea -0xc(%ebp),%esp -80101ab1: 5b pop %ebx -80101ab2: 5e pop %esi -80101ab3: 5f pop %edi -80101ab4: 5d pop %ebp -80101ab5: c3 ret +80101a0f: 8d 65 f4 lea -0xc(%ebp),%esp +80101a12: 5b pop %ebx +80101a13: 5e pop %esi +80101a14: 5f pop %edi +80101a15: 5d pop %ebp +80101a16: c3 ret -80101ab6 : +80101a17 : // 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) { -80101ab6: 55 push %ebp -80101ab7: 89 e5 mov %esp,%ebp -80101ab9: 57 push %edi -80101aba: 56 push %esi -80101abb: 53 push %ebx -80101abc: 83 ec 1c sub $0x1c,%esp -80101abf: 89 c3 mov %eax,%ebx -80101ac1: 89 55 dc mov %edx,-0x24(%ebp) -80101ac4: 89 4d e4 mov %ecx,-0x1c(%ebp) +80101a17: 55 push %ebp +80101a18: 89 e5 mov %esp,%ebp +80101a1a: 57 push %edi +80101a1b: 56 push %esi +80101a1c: 53 push %ebx +80101a1d: 83 ec 1c sub $0x1c,%esp +80101a20: 89 c3 mov %eax,%ebx +80101a22: 89 55 dc mov %edx,-0x24(%ebp) +80101a25: 89 4d e4 mov %ecx,-0x1c(%ebp) struct inode *ip, *next; if(*path == '/') -80101ac7: 80 38 2f cmpb $0x2f,(%eax) -80101aca: 74 1a je 80101ae6 +80101a28: 80 38 2f cmpb $0x2f,(%eax) +80101a2b: 74 1a je 80101a47 ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); -80101acc: e8 19 19 00 00 call 801033ea -80101ad1: 83 ec 0c sub $0xc,%esp -80101ad4: ff 70 68 pushl 0x68(%eax) -80101ad7: e8 21 fa ff ff call 801014fd -80101adc: 89 c7 mov %eax,%edi -80101ade: 83 c4 10 add $0x10,%esp -80101ae1: e9 c2 00 00 00 jmp 80101ba8 +80101a2d: e8 7e 18 00 00 call 801032b0 +80101a32: 83 ec 0c sub $0xc,%esp +80101a35: ff 70 68 push 0x68(%eax) +80101a38: e8 4b fa ff ff call 80101488 +80101a3d: 89 c7 mov %eax,%edi +80101a3f: 83 c4 10 add $0x10,%esp +80101a42: e9 c2 00 00 00 jmp 80101b09 ip = iget(ROOTDEV, ROOTINO); -80101ae6: ba 01 00 00 00 mov $0x1,%edx -80101aeb: b8 01 00 00 00 mov $0x1,%eax -80101af0: e8 67 f7 ff ff call 8010125c -80101af5: 89 c7 mov %eax,%edi -80101af7: e9 ac 00 00 00 jmp 80101ba8 +80101a47: ba 01 00 00 00 mov $0x1,%edx +80101a4c: b8 01 00 00 00 mov $0x1,%eax +80101a51: e8 a1 f7 ff ff call 801011f7 +80101a56: 89 c7 mov %eax,%edi +80101a58: e9 ac 00 00 00 jmp 80101b09 while((path = skipelem(path, name)) != 0){ ilock(ip); if(ip->type != T_DIR){ iunlockput(ip); -80101afc: 83 ec 0c sub $0xc,%esp -80101aff: 57 push %edi -80101b00: e8 7c fc ff ff call 80101781 +80101a5d: 83 ec 0c sub $0xc,%esp +80101a60: 57 push %edi +80101a61: e8 96 fc ff ff call 801016fc return 0; -80101b05: 83 c4 10 add $0x10,%esp -80101b08: bf 00 00 00 00 mov $0x0,%edi +80101a66: 83 c4 10 add $0x10,%esp +80101a69: bf 00 00 00 00 mov $0x0,%edi if(nameiparent){ iput(ip); return 0; } return ip; } -80101b0d: 89 f8 mov %edi,%eax -80101b0f: 8d 65 f4 lea -0xc(%ebp),%esp -80101b12: 5b pop %ebx -80101b13: 5e pop %esi -80101b14: 5f pop %edi -80101b15: 5d pop %ebp -80101b16: c3 ret +80101a6e: 89 f8 mov %edi,%eax +80101a70: 8d 65 f4 lea -0xc(%ebp),%esp +80101a73: 5b pop %ebx +80101a74: 5e pop %esi +80101a75: 5f pop %edi +80101a76: 5d pop %ebp +80101a77: c3 ret iunlock(ip); -80101b17: 83 ec 0c sub $0xc,%esp -80101b1a: 57 push %edi -80101b1b: e8 d2 fa ff ff call 801015f2 +80101a78: 83 ec 0c sub $0xc,%esp +80101a7b: 57 push %edi +80101a7c: e8 f4 fa ff ff call 80101575 return ip; -80101b20: 83 c4 10 add $0x10,%esp -80101b23: eb e8 jmp 80101b0d +80101a81: 83 c4 10 add $0x10,%esp +80101a84: eb e8 jmp 80101a6e iunlockput(ip); -80101b25: 83 ec 0c sub $0xc,%esp -80101b28: 57 push %edi -80101b29: e8 53 fc ff ff call 80101781 +80101a86: 83 ec 0c sub $0xc,%esp +80101a89: 57 push %edi +80101a8a: e8 6d fc ff ff call 801016fc return 0; -80101b2e: 83 c4 10 add $0x10,%esp -80101b31: 89 f7 mov %esi,%edi -80101b33: eb d8 jmp 80101b0d +80101a8f: 83 c4 10 add $0x10,%esp +80101a92: 89 f7 mov %esi,%edi +80101a94: eb d8 jmp 80101a6e len = path - s; -80101b35: 89 f0 mov %esi,%eax -80101b37: 29 d8 sub %ebx,%eax -80101b39: 89 45 e0 mov %eax,-0x20(%ebp) +80101a96: 89 f0 mov %esi,%eax +80101a98: 29 d8 sub %ebx,%eax +80101a9a: 89 45 e0 mov %eax,-0x20(%ebp) if(len >= DIRSIZ) -80101b3c: 83 f8 0d cmp $0xd,%eax -80101b3f: 0f 8e a5 00 00 00 jle 80101bea +80101a9d: 83 f8 0d cmp $0xd,%eax +80101aa0: 0f 8e a5 00 00 00 jle 80101b4b memmove(name, s, DIRSIZ); -80101b45: 83 ec 04 sub $0x4,%esp -80101b48: 6a 0e push $0xe -80101b4a: 53 push %ebx -80101b4b: ff 75 e4 pushl -0x1c(%ebp) -80101b4e: e8 89 24 00 00 call 80103fdc -80101b53: 83 c4 10 add $0x10,%esp +80101aa6: 83 ec 04 sub $0x4,%esp +80101aa9: 6a 0e push $0xe +80101aab: 53 push %ebx +80101aac: ff 75 e4 push -0x1c(%ebp) +80101aaf: e8 80 23 00 00 call 80103e34 +80101ab4: 83 c4 10 add $0x10,%esp path++; -80101b56: 89 f3 mov %esi,%ebx +80101ab7: 89 f3 mov %esi,%ebx while(*path == '/') -80101b58: 80 3b 2f cmpb $0x2f,(%ebx) -80101b5b: 75 08 jne 80101b65 +80101ab9: 80 3b 2f cmpb $0x2f,(%ebx) +80101abc: 75 08 jne 80101ac6 path++; -80101b5d: 83 c3 01 add $0x1,%ebx +80101abe: 83 c3 01 add $0x1,%ebx while(*path == '/') -80101b60: 80 3b 2f cmpb $0x2f,(%ebx) -80101b63: 74 f8 je 80101b5d +80101ac1: 80 3b 2f cmpb $0x2f,(%ebx) +80101ac4: 74 f8 je 80101abe ilock(ip); -80101b65: 83 ec 0c sub $0xc,%esp -80101b68: 57 push %edi -80101b69: e8 be f9 ff ff call 8010152c +80101ac6: 83 ec 0c sub $0xc,%esp +80101ac9: 57 push %edi +80101aca: e8 e4 f9 ff ff call 801014b3 if(ip->type != T_DIR){ -80101b6e: 83 c4 10 add $0x10,%esp -80101b71: 66 83 7f 50 01 cmpw $0x1,0x50(%edi) -80101b76: 75 84 jne 80101afc +80101acf: 83 c4 10 add $0x10,%esp +80101ad2: 66 83 7f 50 01 cmpw $0x1,0x50(%edi) +80101ad7: 75 84 jne 80101a5d if(nameiparent && *path == '\0'){ -80101b78: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) -80101b7c: 74 05 je 80101b83 -80101b7e: 80 3b 00 cmpb $0x0,(%ebx) -80101b81: 74 94 je 80101b17 +80101ad9: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) +80101add: 74 05 je 80101ae4 +80101adf: 80 3b 00 cmpb $0x0,(%ebx) +80101ae2: 74 94 je 80101a78 if((next = dirlookup(ip, name, 0)) == 0){ -80101b83: 83 ec 04 sub $0x4,%esp -80101b86: 6a 00 push $0x0 -80101b88: ff 75 e4 pushl -0x1c(%ebp) -80101b8b: 57 push %edi -80101b8c: e8 83 fe ff ff call 80101a14 -80101b91: 89 c6 mov %eax,%esi -80101b93: 83 c4 10 add $0x10,%esp -80101b96: 85 c0 test %eax,%eax -80101b98: 74 8b je 80101b25 +80101ae4: 83 ec 04 sub $0x4,%esp +80101ae7: 6a 00 push $0x0 +80101ae9: ff 75 e4 push -0x1c(%ebp) +80101aec: 57 push %edi +80101aed: e8 87 fe ff ff call 80101979 +80101af2: 89 c6 mov %eax,%esi +80101af4: 83 c4 10 add $0x10,%esp +80101af7: 85 c0 test %eax,%eax +80101af9: 74 8b je 80101a86 iunlockput(ip); -80101b9a: 83 ec 0c sub $0xc,%esp -80101b9d: 57 push %edi -80101b9e: e8 de fb ff ff call 80101781 -80101ba3: 83 c4 10 add $0x10,%esp +80101afb: 83 ec 0c sub $0xc,%esp +80101afe: 57 push %edi +80101aff: e8 f8 fb ff ff call 801016fc +80101b04: 83 c4 10 add $0x10,%esp ip = next; -80101ba6: 89 f7 mov %esi,%edi +80101b07: 89 f7 mov %esi,%edi while(*path == '/') -80101ba8: 0f b6 03 movzbl (%ebx),%eax -80101bab: 3c 2f cmp $0x2f,%al -80101bad: 75 0a jne 80101bb9 +80101b09: 0f b6 03 movzbl (%ebx),%eax +80101b0c: 3c 2f cmp $0x2f,%al +80101b0e: 75 0a jne 80101b1a path++; -80101baf: 83 c3 01 add $0x1,%ebx +80101b10: 83 c3 01 add $0x1,%ebx while(*path == '/') -80101bb2: 0f b6 03 movzbl (%ebx),%eax -80101bb5: 3c 2f cmp $0x2f,%al -80101bb7: 74 f6 je 80101baf +80101b13: 0f b6 03 movzbl (%ebx),%eax +80101b16: 3c 2f cmp $0x2f,%al +80101b18: 74 f6 je 80101b10 if(*path == 0) -80101bb9: 84 c0 test %al,%al -80101bbb: 74 4e je 80101c0b +80101b1a: 84 c0 test %al,%al +80101b1c: 74 4e je 80101b6c while(*path != '/' && *path != 0) -80101bbd: 0f b6 03 movzbl (%ebx),%eax -80101bc0: 3c 2f cmp $0x2f,%al -80101bc2: 74 1d je 80101be1 -80101bc4: 84 c0 test %al,%al -80101bc6: 74 19 je 80101be1 -80101bc8: 89 de mov %ebx,%esi +80101b1e: 0f b6 03 movzbl (%ebx),%eax +80101b21: 3c 2f cmp $0x2f,%al +80101b23: 74 1d je 80101b42 +80101b25: 84 c0 test %al,%al +80101b27: 74 19 je 80101b42 +80101b29: 89 de mov %ebx,%esi path++; -80101bca: 83 c6 01 add $0x1,%esi +80101b2b: 83 c6 01 add $0x1,%esi while(*path != '/' && *path != 0) -80101bcd: 0f b6 06 movzbl (%esi),%eax -80101bd0: 3c 2f cmp $0x2f,%al -80101bd2: 0f 84 5d ff ff ff je 80101b35 -80101bd8: 84 c0 test %al,%al -80101bda: 75 ee jne 80101bca -80101bdc: e9 54 ff ff ff jmp 80101b35 -80101be1: 89 de mov %ebx,%esi +80101b2e: 0f b6 06 movzbl (%esi),%eax +80101b31: 3c 2f cmp $0x2f,%al +80101b33: 0f 84 5d ff ff ff je 80101a96 +80101b39: 84 c0 test %al,%al +80101b3b: 75 ee jne 80101b2b +80101b3d: e9 54 ff ff ff jmp 80101a96 +80101b42: 89 de mov %ebx,%esi len = path - s; -80101be3: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) +80101b44: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) memmove(name, s, len); -80101bea: 83 ec 04 sub $0x4,%esp -80101bed: ff 75 e0 pushl -0x20(%ebp) -80101bf0: 53 push %ebx -80101bf1: 8b 5d e4 mov -0x1c(%ebp),%ebx -80101bf4: 53 push %ebx -80101bf5: e8 e2 23 00 00 call 80103fdc +80101b4b: 83 ec 04 sub $0x4,%esp +80101b4e: ff 75 e0 push -0x20(%ebp) +80101b51: 53 push %ebx +80101b52: 8b 5d e4 mov -0x1c(%ebp),%ebx +80101b55: 53 push %ebx +80101b56: e8 d9 22 00 00 call 80103e34 name[len] = 0; -80101bfa: 8b 4d e0 mov -0x20(%ebp),%ecx -80101bfd: c6 04 0b 00 movb $0x0,(%ebx,%ecx,1) -80101c01: 83 c4 10 add $0x10,%esp -80101c04: 89 f3 mov %esi,%ebx -80101c06: e9 4d ff ff ff jmp 80101b58 +80101b5b: 8b 4d e0 mov -0x20(%ebp),%ecx +80101b5e: c6 04 0b 00 movb $0x0,(%ebx,%ecx,1) +80101b62: 83 c4 10 add $0x10,%esp +80101b65: 89 f3 mov %esi,%ebx +80101b67: e9 4d ff ff ff jmp 80101ab9 if(nameiparent){ -80101c0b: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) -80101c0f: 0f 84 f8 fe ff ff je 80101b0d +80101b6c: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) +80101b70: 0f 84 f8 fe ff ff je 80101a6e iput(ip); -80101c15: 83 ec 0c sub $0xc,%esp -80101c18: 57 push %edi -80101c19: e8 1d fa ff ff call 8010163b +80101b76: 83 ec 0c sub $0xc,%esp +80101b79: 57 push %edi +80101b7a: e8 3b fa ff ff call 801015ba return 0; -80101c1e: 83 c4 10 add $0x10,%esp -80101c21: bf 00 00 00 00 mov $0x0,%edi -80101c26: e9 e2 fe ff ff jmp 80101b0d - -80101c2b : -{ -80101c2b: f3 0f 1e fb endbr32 -80101c2f: 55 push %ebp -80101c30: 89 e5 mov %esp,%ebp -80101c32: 57 push %edi -80101c33: 56 push %esi -80101c34: 53 push %ebx -80101c35: 83 ec 20 sub $0x20,%esp -80101c38: 8b 75 08 mov 0x8(%ebp),%esi +80101b7f: 83 c4 10 add $0x10,%esp +80101b82: bf 00 00 00 00 mov $0x0,%edi +80101b87: e9 e2 fe ff ff jmp 80101a6e + +80101b8c : +{ +80101b8c: 55 push %ebp +80101b8d: 89 e5 mov %esp,%ebp +80101b8f: 57 push %edi +80101b90: 56 push %esi +80101b91: 53 push %ebx +80101b92: 83 ec 20 sub $0x20,%esp +80101b95: 8b 75 08 mov 0x8(%ebp),%esi if((ip = dirlookup(dp, name, 0)) != 0){ -80101c3b: 6a 00 push $0x0 -80101c3d: ff 75 0c pushl 0xc(%ebp) -80101c40: 56 push %esi -80101c41: e8 ce fd ff ff call 80101a14 -80101c46: 83 c4 10 add $0x10,%esp -80101c49: 85 c0 test %eax,%eax -80101c4b: 75 6a jne 80101cb7 +80101b98: 6a 00 push $0x0 +80101b9a: ff 75 0c push 0xc(%ebp) +80101b9d: 56 push %esi +80101b9e: e8 d6 fd ff ff call 80101979 +80101ba3: 83 c4 10 add $0x10,%esp +80101ba6: 85 c0 test %eax,%eax +80101ba8: 75 6a jne 80101c14 for(off = 0; off < dp->size; off += sizeof(de)){ -80101c4d: 8b 5e 58 mov 0x58(%esi),%ebx -80101c50: 85 db test %ebx,%ebx -80101c52: 74 29 je 80101c7d -80101c54: bb 00 00 00 00 mov $0x0,%ebx +80101baa: 8b 5e 58 mov 0x58(%esi),%ebx +80101bad: 85 db test %ebx,%ebx +80101baf: 74 29 je 80101bda +80101bb1: bb 00 00 00 00 mov $0x0,%ebx if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) -80101c59: 8d 7d d8 lea -0x28(%ebp),%edi -80101c5c: 6a 10 push $0x10 -80101c5e: 53 push %ebx -80101c5f: 57 push %edi -80101c60: 56 push %esi -80101c61: e8 6e fb ff ff call 801017d4 -80101c66: 83 c4 10 add $0x10,%esp -80101c69: 83 f8 10 cmp $0x10,%eax -80101c6c: 75 5c jne 80101cca +80101bb6: 8d 7d d8 lea -0x28(%ebp),%edi +80101bb9: 6a 10 push $0x10 +80101bbb: 53 push %ebx +80101bbc: 57 push %edi +80101bbd: 56 push %esi +80101bbe: e8 84 fb ff ff call 80101747 +80101bc3: 83 c4 10 add $0x10,%esp +80101bc6: 83 f8 10 cmp $0x10,%eax +80101bc9: 75 5c jne 80101c27 if(de.inum == 0) -80101c6e: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) -80101c73: 74 08 je 80101c7d +80101bcb: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) +80101bd0: 74 08 je 80101bda for(off = 0; off < dp->size; off += sizeof(de)){ -80101c75: 83 c3 10 add $0x10,%ebx -80101c78: 3b 5e 58 cmp 0x58(%esi),%ebx -80101c7b: 72 df jb 80101c5c +80101bd2: 83 c3 10 add $0x10,%ebx +80101bd5: 3b 5e 58 cmp 0x58(%esi),%ebx +80101bd8: 72 df jb 80101bb9 strncpy(de.name, name, DIRSIZ); -80101c7d: 83 ec 04 sub $0x4,%esp -80101c80: 6a 0e push $0xe -80101c82: ff 75 0c pushl 0xc(%ebp) -80101c85: 8d 7d d8 lea -0x28(%ebp),%edi -80101c88: 8d 45 da lea -0x26(%ebp),%eax -80101c8b: 50 push %eax -80101c8c: e8 02 24 00 00 call 80104093 +80101bda: 83 ec 04 sub $0x4,%esp +80101bdd: 6a 0e push $0xe +80101bdf: ff 75 0c push 0xc(%ebp) +80101be2: 8d 7d d8 lea -0x28(%ebp),%edi +80101be5: 8d 45 da lea -0x26(%ebp),%eax +80101be8: 50 push %eax +80101be9: e8 f3 22 00 00 call 80103ee1 de.inum = inum; -80101c91: 8b 45 10 mov 0x10(%ebp),%eax -80101c94: 66 89 45 d8 mov %ax,-0x28(%ebp) +80101bee: 8b 45 10 mov 0x10(%ebp),%eax +80101bf1: 66 89 45 d8 mov %ax,-0x28(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) -80101c98: 6a 10 push $0x10 -80101c9a: 53 push %ebx -80101c9b: 57 push %edi -80101c9c: 56 push %esi -80101c9d: e8 32 fc ff ff call 801018d4 -80101ca2: 83 c4 20 add $0x20,%esp -80101ca5: 83 f8 10 cmp $0x10,%eax -80101ca8: 75 2d jne 80101cd7 +80101bf5: 6a 10 push $0x10 +80101bf7: 53 push %ebx +80101bf8: 57 push %edi +80101bf9: 56 push %esi +80101bfa: e8 44 fc ff ff call 80101843 +80101bff: 83 c4 20 add $0x20,%esp +80101c02: 83 f8 10 cmp $0x10,%eax +80101c05: 75 2d jne 80101c34 return 0; -80101caa: b8 00 00 00 00 mov $0x0,%eax -} -80101caf: 8d 65 f4 lea -0xc(%ebp),%esp -80101cb2: 5b pop %ebx -80101cb3: 5e pop %esi -80101cb4: 5f pop %edi -80101cb5: 5d pop %ebp -80101cb6: c3 ret +80101c07: b8 00 00 00 00 mov $0x0,%eax +} +80101c0c: 8d 65 f4 lea -0xc(%ebp),%esp +80101c0f: 5b pop %ebx +80101c10: 5e pop %esi +80101c11: 5f pop %edi +80101c12: 5d pop %ebp +80101c13: c3 ret iput(ip); -80101cb7: 83 ec 0c sub $0xc,%esp -80101cba: 50 push %eax -80101cbb: e8 7b f9 ff ff call 8010163b +80101c14: 83 ec 0c sub $0xc,%esp +80101c17: 50 push %eax +80101c18: e8 9d f9 ff ff call 801015ba return -1; -80101cc0: 83 c4 10 add $0x10,%esp -80101cc3: b8 ff ff ff ff mov $0xffffffff,%eax -80101cc8: eb e5 jmp 80101caf +80101c1d: 83 c4 10 add $0x10,%esp +80101c20: b8 ff ff ff ff mov $0xffffffff,%eax +80101c25: eb e5 jmp 80101c0c panic("dirlink read"); -80101cca: 83 ec 0c sub $0xc,%esp -80101ccd: 68 e4 79 10 80 push $0x801079e4 -80101cd2: e8 81 e6 ff ff call 80100358 +80101c27: 83 ec 0c sub $0xc,%esp +80101c2a: 68 04 77 10 80 push $0x80107704 +80101c2f: e8 0c e7 ff ff call 80100340 panic("dirlink"); -80101cd7: 83 ec 0c sub $0xc,%esp -80101cda: 68 06 80 10 80 push $0x80108006 -80101cdf: e8 74 e6 ff ff call 80100358 +80101c34: 83 ec 0c sub $0xc,%esp +80101c37: 68 26 7d 10 80 push $0x80107d26 +80101c3c: e8 ff e6 ff ff call 80100340 -80101ce4 : +80101c41 : struct inode* namei(char *path) { -80101ce4: f3 0f 1e fb endbr32 -80101ce8: 55 push %ebp -80101ce9: 89 e5 mov %esp,%ebp -80101ceb: 83 ec 18 sub $0x18,%esp +80101c41: 55 push %ebp +80101c42: 89 e5 mov %esp,%ebp +80101c44: 83 ec 18 sub $0x18,%esp char name[DIRSIZ]; return namex(path, 0, name); -80101cee: 8d 4d ea lea -0x16(%ebp),%ecx -80101cf1: ba 00 00 00 00 mov $0x0,%edx -80101cf6: 8b 45 08 mov 0x8(%ebp),%eax -80101cf9: e8 b8 fd ff ff call 80101ab6 +80101c47: 8d 4d ea lea -0x16(%ebp),%ecx +80101c4a: ba 00 00 00 00 mov $0x0,%edx +80101c4f: 8b 45 08 mov 0x8(%ebp),%eax +80101c52: e8 c0 fd ff ff call 80101a17 } -80101cfe: c9 leave -80101cff: c3 ret +80101c57: c9 leave +80101c58: c3 ret -80101d00 : +80101c59 : struct inode* nameiparent(char *path, char *name) { -80101d00: f3 0f 1e fb endbr32 -80101d04: 55 push %ebp -80101d05: 89 e5 mov %esp,%ebp -80101d07: 83 ec 08 sub $0x8,%esp +80101c59: 55 push %ebp +80101c5a: 89 e5 mov %esp,%ebp +80101c5c: 83 ec 08 sub $0x8,%esp return namex(path, 1, name); -80101d0a: 8b 4d 0c mov 0xc(%ebp),%ecx -80101d0d: ba 01 00 00 00 mov $0x1,%edx -80101d12: 8b 45 08 mov 0x8(%ebp),%eax -80101d15: e8 9c fd ff ff call 80101ab6 +80101c5f: 8b 4d 0c mov 0xc(%ebp),%ecx +80101c62: ba 01 00 00 00 mov $0x1,%edx +80101c67: 8b 45 08 mov 0x8(%ebp),%eax +80101c6a: e8 a8 fd ff ff call 80101a17 } -80101d1a: c9 leave -80101d1b: c3 ret +80101c6f: c9 leave +80101c70: c3 ret -80101d1c : +80101c71 : } // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { -80101d1c: 55 push %ebp -80101d1d: 89 e5 mov %esp,%ebp -80101d1f: 56 push %esi -80101d20: 53 push %ebx +80101c71: 55 push %ebp +80101c72: 89 e5 mov %esp,%ebp +80101c74: 56 push %esi +80101c75: 53 push %ebx if(b == 0) -80101d21: 85 c0 test %eax,%eax -80101d23: 0f 84 8b 00 00 00 je 80101db4 -80101d29: 89 c1 mov %eax,%ecx +80101c76: 85 c0 test %eax,%eax +80101c78: 0f 84 8b 00 00 00 je 80101d09 +80101c7e: 89 c1 mov %eax,%ecx panic("idestart"); if(b->blockno >= FSSIZE) -80101d2b: 8b 70 08 mov 0x8(%eax),%esi -80101d2e: 81 fe e7 03 00 00 cmp $0x3e7,%esi -80101d34: 0f 87 87 00 00 00 ja 80101dc1 +80101c80: 8b 58 08 mov 0x8(%eax),%ebx +80101c83: 81 fb e7 03 00 00 cmp $0x3e7,%ebx +80101c89: 0f 87 87 00 00 00 ja 80101d16 asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80101d3a: ba f7 01 00 00 mov $0x1f7,%edx -80101d3f: ec in (%dx),%al +80101c8f: ba f7 01 00 00 mov $0x1f7,%edx +80101c94: ec in (%dx),%al while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) -80101d40: 83 e0 c0 and $0xffffffc0,%eax -80101d43: 3c 40 cmp $0x40,%al -80101d45: 75 f8 jne 80101d3f +80101c95: 83 e0 c0 and $0xffffffc0,%eax +80101c98: 3c 40 cmp $0x40,%al +80101c9a: 75 f8 jne 80101c94 asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80101d47: bb 00 00 00 00 mov $0x0,%ebx -80101d4c: ba f6 03 00 00 mov $0x3f6,%edx -80101d51: 89 d8 mov %ebx,%eax -80101d53: ee out %al,(%dx) -80101d54: b8 01 00 00 00 mov $0x1,%eax -80101d59: ba f2 01 00 00 mov $0x1f2,%edx -80101d5e: ee out %al,(%dx) -80101d5f: ba f3 01 00 00 mov $0x1f3,%edx -80101d64: 89 f0 mov %esi,%eax -80101d66: ee out %al,(%dx) +80101c9c: be 00 00 00 00 mov $0x0,%esi +80101ca1: ba f6 03 00 00 mov $0x3f6,%edx +80101ca6: 89 f0 mov %esi,%eax +80101ca8: ee out %al,(%dx) +80101ca9: b8 01 00 00 00 mov $0x1,%eax +80101cae: ba f2 01 00 00 mov $0x1f2,%edx +80101cb3: ee out %al,(%dx) +80101cb4: ba f3 01 00 00 mov $0x1f3,%edx +80101cb9: 89 d8 mov %ebx,%eax +80101cbb: 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); -80101d67: 89 f0 mov %esi,%eax -80101d69: c1 f8 08 sar $0x8,%eax -80101d6c: ba f4 01 00 00 mov $0x1f4,%edx -80101d71: ee out %al,(%dx) -80101d72: ba f5 01 00 00 mov $0x1f5,%edx -80101d77: 89 d8 mov %ebx,%eax -80101d79: ee out %al,(%dx) +80101cbc: 89 d8 mov %ebx,%eax +80101cbe: c1 f8 08 sar $0x8,%eax +80101cc1: ba f4 01 00 00 mov $0x1f4,%edx +80101cc6: ee out %al,(%dx) +80101cc7: ba f5 01 00 00 mov $0x1f5,%edx +80101ccc: 89 f0 mov %esi,%eax +80101cce: ee out %al,(%dx) outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); -80101d7a: 0f b6 41 04 movzbl 0x4(%ecx),%eax -80101d7e: c1 e0 04 shl $0x4,%eax -80101d81: 83 e0 10 and $0x10,%eax -80101d84: 83 c8 e0 or $0xffffffe0,%eax -80101d87: ba f6 01 00 00 mov $0x1f6,%edx -80101d8c: ee out %al,(%dx) +80101ccf: 0f b6 41 04 movzbl 0x4(%ecx),%eax +80101cd3: c1 e0 04 shl $0x4,%eax +80101cd6: 83 e0 10 and $0x10,%eax +80101cd9: 83 c8 e0 or $0xffffffe0,%eax +80101cdc: ba f6 01 00 00 mov $0x1f6,%edx +80101ce1: ee out %al,(%dx) if(b->flags & B_DIRTY){ -80101d8d: f6 01 04 testb $0x4,(%ecx) -80101d90: 74 3c je 80101dce -80101d92: b8 30 00 00 00 mov $0x30,%eax -80101d97: ba f7 01 00 00 mov $0x1f7,%edx -80101d9c: ee out %al,(%dx) +80101ce2: f6 01 04 testb $0x4,(%ecx) +80101ce5: 74 3c je 80101d23 +80101ce7: b8 30 00 00 00 mov $0x30,%eax +80101cec: ba f7 01 00 00 mov $0x1f7,%edx +80101cf1: ee out %al,(%dx) outb(0x1f7, write_cmd); outsl(0x1f0, b->data, BSIZE/4); -80101d9d: 8d 71 5c lea 0x5c(%ecx),%esi +80101cf2: 8d 71 5c lea 0x5c(%ecx),%esi asm volatile("cld; rep outsl" : -80101da0: b9 80 00 00 00 mov $0x80,%ecx -80101da5: ba f0 01 00 00 mov $0x1f0,%edx -80101daa: fc cld -80101dab: f3 6f rep outsl %ds:(%esi),(%dx) +80101cf5: b9 80 00 00 00 mov $0x80,%ecx +80101cfa: ba f0 01 00 00 mov $0x1f0,%edx +80101cff: fc cld +80101d00: f3 6f rep outsl %ds:(%esi),(%dx) } else { outb(0x1f7, read_cmd); } } -80101dad: 8d 65 f8 lea -0x8(%ebp),%esp -80101db0: 5b pop %ebx -80101db1: 5e pop %esi -80101db2: 5d pop %ebp -80101db3: c3 ret +80101d02: 8d 65 f8 lea -0x8(%ebp),%esp +80101d05: 5b pop %ebx +80101d06: 5e pop %esi +80101d07: 5d pop %ebp +80101d08: c3 ret panic("idestart"); -80101db4: 83 ec 0c sub $0xc,%esp -80101db7: 68 47 7a 10 80 push $0x80107a47 -80101dbc: e8 97 e5 ff ff call 80100358 +80101d09: 83 ec 0c sub $0xc,%esp +80101d0c: 68 67 77 10 80 push $0x80107767 +80101d11: e8 2a e6 ff ff call 80100340 panic("incorrect blockno"); -80101dc1: 83 ec 0c sub $0xc,%esp -80101dc4: 68 50 7a 10 80 push $0x80107a50 -80101dc9: e8 8a e5 ff ff call 80100358 +80101d16: 83 ec 0c sub $0xc,%esp +80101d19: 68 70 77 10 80 push $0x80107770 +80101d1e: e8 1d e6 ff ff call 80100340 asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80101dce: b8 20 00 00 00 mov $0x20,%eax -80101dd3: ba f7 01 00 00 mov $0x1f7,%edx -80101dd8: ee out %al,(%dx) +80101d23: b8 20 00 00 00 mov $0x20,%eax +80101d28: ba f7 01 00 00 mov $0x1f7,%edx +80101d2d: ee out %al,(%dx) } -80101dd9: eb d2 jmp 80101dad +80101d2e: eb d2 jmp 80101d02 -80101ddb : +80101d30 : { -80101ddb: f3 0f 1e fb endbr32 -80101ddf: 55 push %ebp -80101de0: 89 e5 mov %esp,%ebp -80101de2: 83 ec 10 sub $0x10,%esp +80101d30: 55 push %ebp +80101d31: 89 e5 mov %esp,%ebp +80101d33: 83 ec 10 sub $0x10,%esp initlock(&idelock, "ide"); -80101de5: 68 62 7a 10 80 push $0x80107a62 -80101dea: 68 80 b5 10 80 push $0x8010b580 -80101def: e8 49 1f 00 00 call 80103d3d +80101d36: 68 82 77 10 80 push $0x80107782 +80101d3b: 68 00 26 11 80 push $0x80112600 +80101d40: e8 73 1e 00 00 call 80103bb8 ioapicenable(IRQ_IDE, ncpu - 1); -80101df4: 83 c4 08 add $0x8,%esp -80101df7: a1 20 59 11 80 mov 0x80115920,%eax -80101dfc: 83 e8 01 sub $0x1,%eax -80101dff: 50 push %eax -80101e00: 6a 0e push $0xe -80101e02: e8 7d 02 00 00 call 80102084 +80101d45: 83 c4 08 add $0x8,%esp +80101d48: a1 84 27 11 80 mov 0x80112784,%eax +80101d4d: 83 e8 01 sub $0x1,%eax +80101d50: 50 push %eax +80101d51: 6a 0e push $0xe +80101d53: e8 71 02 00 00 call 80101fc9 while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) -80101e07: 83 c4 10 add $0x10,%esp +80101d58: 83 c4 10 add $0x10,%esp asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80101e0a: ba f7 01 00 00 mov $0x1f7,%edx -80101e0f: ec in (%dx),%al -80101e10: 83 e0 c0 and $0xffffffc0,%eax -80101e13: 3c 40 cmp $0x40,%al -80101e15: 75 f8 jne 80101e0f +80101d5b: ba f7 01 00 00 mov $0x1f7,%edx +80101d60: ec in (%dx),%al +80101d61: 83 e0 c0 and $0xffffffc0,%eax +80101d64: 3c 40 cmp $0x40,%al +80101d66: 75 f8 jne 80101d60 asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80101e17: b8 f0 ff ff ff mov $0xfffffff0,%eax -80101e1c: ba f6 01 00 00 mov $0x1f6,%edx -80101e21: ee out %al,(%dx) +80101d68: b8 f0 ff ff ff mov $0xfffffff0,%eax +80101d6d: ba f6 01 00 00 mov $0x1f6,%edx +80101d72: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80101e22: ba f7 01 00 00 mov $0x1f7,%edx -80101e27: ec in (%dx),%al +80101d73: ba f7 01 00 00 mov $0x1f7,%edx +80101d78: ec in (%dx),%al if(inb(0x1f7) != 0){ -80101e28: 84 c0 test %al,%al -80101e2a: 75 11 jne 80101e3d -80101e2c: b9 e7 03 00 00 mov $0x3e7,%ecx -80101e31: ec in (%dx),%al -80101e32: 84 c0 test %al,%al -80101e34: 75 07 jne 80101e3d +80101d79: 84 c0 test %al,%al +80101d7b: 75 11 jne 80101d8e +80101d7d: b9 e7 03 00 00 mov $0x3e7,%ecx +80101d82: ec in (%dx),%al +80101d83: 84 c0 test %al,%al +80101d85: 75 07 jne 80101d8e for(i=0; i<1000; i++){ -80101e36: 83 e9 01 sub $0x1,%ecx -80101e39: 75 f6 jne 80101e31 -80101e3b: eb 0a jmp 80101e47 +80101d87: 83 e9 01 sub $0x1,%ecx +80101d8a: 75 f6 jne 80101d82 +80101d8c: eb 0a jmp 80101d98 havedisk1 = 1; -80101e3d: c7 05 60 b5 10 80 01 movl $0x1,0x8010b560 -80101e44: 00 00 00 +80101d8e: c7 05 e0 25 11 80 01 movl $0x1,0x801125e0 +80101d95: 00 00 00 asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80101e47: b8 e0 ff ff ff mov $0xffffffe0,%eax -80101e4c: ba f6 01 00 00 mov $0x1f6,%edx -80101e51: ee out %al,(%dx) +80101d98: b8 e0 ff ff ff mov $0xffffffe0,%eax +80101d9d: ba f6 01 00 00 mov $0x1f6,%edx +80101da2: ee out %al,(%dx) } -80101e52: c9 leave -80101e53: c3 ret +80101da3: c9 leave +80101da4: c3 ret -80101e54 : +80101da5 : // Interrupt handler. void ideintr(void) { -80101e54: f3 0f 1e fb endbr32 -80101e58: 55 push %ebp -80101e59: 89 e5 mov %esp,%ebp -80101e5b: 57 push %edi -80101e5c: 53 push %ebx +80101da5: 55 push %ebp +80101da6: 89 e5 mov %esp,%ebp +80101da8: 57 push %edi +80101da9: 53 push %ebx struct buf *b; // First queued buffer is the active request. acquire(&idelock); -80101e5d: 83 ec 0c sub $0xc,%esp -80101e60: 68 80 b5 10 80 push $0x8010b580 -80101e65: e8 2f 20 00 00 call 80103e99 +80101daa: 83 ec 0c sub $0xc,%esp +80101dad: 68 00 26 11 80 push $0x80112600 +80101db2: e8 4a 1f 00 00 call 80103d01 if((b = idequeue) == 0){ -80101e6a: 8b 1d 64 b5 10 80 mov 0x8010b564,%ebx -80101e70: 83 c4 10 add $0x10,%esp -80101e73: 85 db test %ebx,%ebx -80101e75: 74 48 je 80101ebf +80101db7: 8b 1d e4 25 11 80 mov 0x801125e4,%ebx +80101dbd: 83 c4 10 add $0x10,%esp +80101dc0: 85 db test %ebx,%ebx +80101dc2: 74 48 je 80101e0c release(&idelock); return; } idequeue = b->qnext; -80101e77: 8b 43 58 mov 0x58(%ebx),%eax -80101e7a: a3 64 b5 10 80 mov %eax,0x8010b564 +80101dc4: 8b 43 58 mov 0x58(%ebx),%eax +80101dc7: a3 e4 25 11 80 mov %eax,0x801125e4 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) -80101e7f: f6 03 04 testb $0x4,(%ebx) -80101e82: 74 4d je 80101ed1 +80101dcc: f6 03 04 testb $0x4,(%ebx) +80101dcf: 74 4d je 80101e1e insl(0x1f0, b->data, BSIZE/4); // Wake process waiting for this buf. b->flags |= B_VALID; b->flags &= ~B_DIRTY; -80101e84: 8b 03 mov (%ebx),%eax -80101e86: 83 e0 fb and $0xfffffffb,%eax -80101e89: 83 c8 02 or $0x2,%eax -80101e8c: 89 03 mov %eax,(%ebx) +80101dd1: 8b 03 mov (%ebx),%eax +80101dd3: 83 e0 fb and $0xfffffffb,%eax +80101dd6: 83 c8 02 or $0x2,%eax +80101dd9: 89 03 mov %eax,(%ebx) wakeup(b); -80101e8e: 83 ec 0c sub $0xc,%esp -80101e91: 53 push %ebx -80101e92: e8 a3 1b 00 00 call 80103a3a +80101ddb: 83 ec 0c sub $0xc,%esp +80101dde: 53 push %ebx +80101ddf: e8 f3 1a 00 00 call 801038d7 // Start disk on next buf in queue. if(idequeue != 0) -80101e97: a1 64 b5 10 80 mov 0x8010b564,%eax -80101e9c: 83 c4 10 add $0x10,%esp -80101e9f: 85 c0 test %eax,%eax -80101ea1: 74 05 je 80101ea8 +80101de4: a1 e4 25 11 80 mov 0x801125e4,%eax +80101de9: 83 c4 10 add $0x10,%esp +80101dec: 85 c0 test %eax,%eax +80101dee: 74 05 je 80101df5 idestart(idequeue); -80101ea3: e8 74 fe ff ff call 80101d1c +80101df0: e8 7c fe ff ff call 80101c71 release(&idelock); -80101ea8: 83 ec 0c sub $0xc,%esp -80101eab: 68 80 b5 10 80 push $0x8010b580 -80101eb0: e8 4f 20 00 00 call 80103f04 -80101eb5: 83 c4 10 add $0x10,%esp -} -80101eb8: 8d 65 f8 lea -0x8(%ebp),%esp -80101ebb: 5b pop %ebx -80101ebc: 5f pop %edi -80101ebd: 5d pop %ebp -80101ebe: c3 ret +80101df5: 83 ec 0c sub $0xc,%esp +80101df8: 68 00 26 11 80 push $0x80112600 +80101dfd: e8 66 1f 00 00 call 80103d68 +80101e02: 83 c4 10 add $0x10,%esp +} +80101e05: 8d 65 f8 lea -0x8(%ebp),%esp +80101e08: 5b pop %ebx +80101e09: 5f pop %edi +80101e0a: 5d pop %ebp +80101e0b: c3 ret release(&idelock); -80101ebf: 83 ec 0c sub $0xc,%esp -80101ec2: 68 80 b5 10 80 push $0x8010b580 -80101ec7: e8 38 20 00 00 call 80103f04 +80101e0c: 83 ec 0c sub $0xc,%esp +80101e0f: 68 00 26 11 80 push $0x80112600 +80101e14: e8 4f 1f 00 00 call 80103d68 return; -80101ecc: 83 c4 10 add $0x10,%esp -80101ecf: eb e7 jmp 80101eb8 +80101e19: 83 c4 10 add $0x10,%esp +80101e1c: eb e7 jmp 80101e05 asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80101ed1: ba f7 01 00 00 mov $0x1f7,%edx -80101ed6: ec in (%dx),%al -80101ed7: 89 c1 mov %eax,%ecx +80101e1e: ba f7 01 00 00 mov $0x1f7,%edx +80101e23: ec in (%dx),%al while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) -80101ed9: 83 e0 c0 and $0xffffffc0,%eax -80101edc: 3c 40 cmp $0x40,%al -80101ede: 75 f6 jne 80101ed6 +80101e24: 89 c1 mov %eax,%ecx +80101e26: 83 e1 c0 and $0xffffffc0,%ecx +80101e29: 80 f9 40 cmp $0x40,%cl +80101e2c: 75 f5 jne 80101e23 if(!(b->flags & B_DIRTY) && idewait(1) >= 0) -80101ee0: f6 c1 21 test $0x21,%cl -80101ee3: 75 9f jne 80101e84 +80101e2e: a8 21 test $0x21,%al +80101e30: 75 9f jne 80101dd1 insl(0x1f0, b->data, BSIZE/4); -80101ee5: 8d 7b 5c lea 0x5c(%ebx),%edi +80101e32: 8d 7b 5c lea 0x5c(%ebx),%edi asm volatile("cld; rep insl" : -80101ee8: b9 80 00 00 00 mov $0x80,%ecx -80101eed: ba f0 01 00 00 mov $0x1f0,%edx -80101ef2: fc cld -80101ef3: f3 6d rep insl (%dx),%es:(%edi) +80101e35: b9 80 00 00 00 mov $0x80,%ecx +80101e3a: ba f0 01 00 00 mov $0x1f0,%edx +80101e3f: fc cld +80101e40: f3 6d rep insl (%dx),%es:(%edi) } -80101ef5: eb 8d jmp 80101e84 +80101e42: eb 8d jmp 80101dd1 -80101ef7 : +80101e44 : // 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) { -80101ef7: f3 0f 1e fb endbr32 -80101efb: 55 push %ebp -80101efc: 89 e5 mov %esp,%ebp -80101efe: 53 push %ebx -80101eff: 83 ec 10 sub $0x10,%esp -80101f02: 8b 5d 08 mov 0x8(%ebp),%ebx +80101e44: 55 push %ebp +80101e45: 89 e5 mov %esp,%ebp +80101e47: 53 push %ebx +80101e48: 83 ec 10 sub $0x10,%esp +80101e4b: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf **pp; if(!holdingsleep(&b->lock)) -80101f05: 8d 43 0c lea 0xc(%ebx),%eax -80101f08: 50 push %eax -80101f09: e8 e1 1d 00 00 call 80103cef -80101f0e: 83 c4 10 add $0x10,%esp -80101f11: 85 c0 test %eax,%eax -80101f13: 0f 84 91 00 00 00 je 80101faa +80101e4e: 8d 43 0c lea 0xc(%ebx),%eax +80101e51: 50 push %eax +80101e52: e8 17 1d 00 00 call 80103b6e +80101e57: 83 c4 10 add $0x10,%esp +80101e5a: 85 c0 test %eax,%eax +80101e5c: 0f 84 91 00 00 00 je 80101ef3 panic("iderw: buf not locked"); if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) -80101f19: 8b 03 mov (%ebx),%eax -80101f1b: 83 e0 06 and $0x6,%eax -80101f1e: 83 f8 02 cmp $0x2,%eax -80101f21: 0f 84 90 00 00 00 je 80101fb7 +80101e62: 8b 03 mov (%ebx),%eax +80101e64: 83 e0 06 and $0x6,%eax +80101e67: 83 f8 02 cmp $0x2,%eax +80101e6a: 0f 84 90 00 00 00 je 80101f00 panic("iderw: nothing to do"); if(b->dev != 0 && !havedisk1) -80101f27: 83 7b 04 00 cmpl $0x0,0x4(%ebx) -80101f2b: 74 0d je 80101f3a -80101f2d: 83 3d 60 b5 10 80 00 cmpl $0x0,0x8010b560 -80101f34: 0f 84 8a 00 00 00 je 80101fc4 +80101e70: 83 7b 04 00 cmpl $0x0,0x4(%ebx) +80101e74: 74 0d je 80101e83 +80101e76: 83 3d e0 25 11 80 00 cmpl $0x0,0x801125e0 +80101e7d: 0f 84 8a 00 00 00 je 80101f0d panic("iderw: ide disk 1 not present"); acquire(&idelock); //DOC:acquire-lock -80101f3a: 83 ec 0c sub $0xc,%esp -80101f3d: 68 80 b5 10 80 push $0x8010b580 -80101f42: e8 52 1f 00 00 call 80103e99 +80101e83: 83 ec 0c sub $0xc,%esp +80101e86: 68 00 26 11 80 push $0x80112600 +80101e8b: e8 71 1e 00 00 call 80103d01 // Append b to idequeue. b->qnext = 0; -80101f47: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) +80101e90: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue -80101f4e: a1 64 b5 10 80 mov 0x8010b564,%eax -80101f53: 83 c4 10 add $0x10,%esp -80101f56: 85 c0 test %eax,%eax -80101f58: 74 77 je 80101fd1 -80101f5a: 89 c2 mov %eax,%edx -80101f5c: 8b 40 58 mov 0x58(%eax),%eax -80101f5f: 85 c0 test %eax,%eax -80101f61: 75 f7 jne 80101f5a -80101f63: 83 c2 58 add $0x58,%edx +80101e97: a1 e4 25 11 80 mov 0x801125e4,%eax +80101e9c: 83 c4 10 add $0x10,%esp +80101e9f: 85 c0 test %eax,%eax +80101ea1: 74 77 je 80101f1a +80101ea3: 89 c2 mov %eax,%edx +80101ea5: 8b 40 58 mov 0x58(%eax),%eax +80101ea8: 85 c0 test %eax,%eax +80101eaa: 75 f7 jne 80101ea3 +80101eac: 83 c2 58 add $0x58,%edx ; *pp = b; -80101f66: 89 1a mov %ebx,(%edx) +80101eaf: 89 1a mov %ebx,(%edx) // Start disk if necessary. if(idequeue == b) -80101f68: 39 1d 64 b5 10 80 cmp %ebx,0x8010b564 -80101f6e: 74 68 je 80101fd8 +80101eb1: 39 1d e4 25 11 80 cmp %ebx,0x801125e4 +80101eb7: 74 68 je 80101f21 idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ -80101f70: 8b 03 mov (%ebx),%eax -80101f72: 83 e0 06 and $0x6,%eax -80101f75: 83 f8 02 cmp $0x2,%eax -80101f78: 74 1b je 80101f95 +80101eb9: 8b 03 mov (%ebx),%eax +80101ebb: 83 e0 06 and $0x6,%eax +80101ebe: 83 f8 02 cmp $0x2,%eax +80101ec1: 74 1b je 80101ede sleep(b, &idelock); -80101f7a: 83 ec 08 sub $0x8,%esp -80101f7d: 68 80 b5 10 80 push $0x8010b580 -80101f82: 53 push %ebx -80101f83: e8 2c 19 00 00 call 801038b4 +80101ec3: 83 ec 08 sub $0x8,%esp +80101ec6: 68 00 26 11 80 push $0x80112600 +80101ecb: 53 push %ebx +80101ecc: e8 88 18 00 00 call 80103759 while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ -80101f88: 8b 03 mov (%ebx),%eax -80101f8a: 83 e0 06 and $0x6,%eax -80101f8d: 83 c4 10 add $0x10,%esp -80101f90: 83 f8 02 cmp $0x2,%eax -80101f93: 75 e5 jne 80101f7a +80101ed1: 8b 03 mov (%ebx),%eax +80101ed3: 83 e0 06 and $0x6,%eax +80101ed6: 83 c4 10 add $0x10,%esp +80101ed9: 83 f8 02 cmp $0x2,%eax +80101edc: 75 e5 jne 80101ec3 } release(&idelock); -80101f95: 83 ec 0c sub $0xc,%esp -80101f98: 68 80 b5 10 80 push $0x8010b580 -80101f9d: e8 62 1f 00 00 call 80103f04 -} -80101fa2: 83 c4 10 add $0x10,%esp -80101fa5: 8b 5d fc mov -0x4(%ebp),%ebx -80101fa8: c9 leave -80101fa9: c3 ret +80101ede: 83 ec 0c sub $0xc,%esp +80101ee1: 68 00 26 11 80 push $0x80112600 +80101ee6: e8 7d 1e 00 00 call 80103d68 +} +80101eeb: 83 c4 10 add $0x10,%esp +80101eee: 8b 5d fc mov -0x4(%ebp),%ebx +80101ef1: c9 leave +80101ef2: c3 ret panic("iderw: buf not locked"); -80101faa: 83 ec 0c sub $0xc,%esp -80101fad: 68 66 7a 10 80 push $0x80107a66 -80101fb2: e8 a1 e3 ff ff call 80100358 +80101ef3: 83 ec 0c sub $0xc,%esp +80101ef6: 68 86 77 10 80 push $0x80107786 +80101efb: e8 40 e4 ff ff call 80100340 panic("iderw: nothing to do"); -80101fb7: 83 ec 0c sub $0xc,%esp -80101fba: 68 7c 7a 10 80 push $0x80107a7c -80101fbf: e8 94 e3 ff ff call 80100358 +80101f00: 83 ec 0c sub $0xc,%esp +80101f03: 68 9c 77 10 80 push $0x8010779c +80101f08: e8 33 e4 ff ff call 80100340 panic("iderw: ide disk 1 not present"); -80101fc4: 83 ec 0c sub $0xc,%esp -80101fc7: 68 91 7a 10 80 push $0x80107a91 -80101fcc: e8 87 e3 ff ff call 80100358 +80101f0d: 83 ec 0c sub $0xc,%esp +80101f10: 68 b1 77 10 80 push $0x801077b1 +80101f15: e8 26 e4 ff ff call 80100340 for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue -80101fd1: ba 64 b5 10 80 mov $0x8010b564,%edx -80101fd6: eb 8e jmp 80101f66 +80101f1a: ba e4 25 11 80 mov $0x801125e4,%edx +80101f1f: eb 8e jmp 80101eaf idestart(b); -80101fd8: 89 d8 mov %ebx,%eax -80101fda: e8 3d fd ff ff call 80101d1c -80101fdf: eb 8f jmp 80101f70 +80101f21: 89 d8 mov %ebx,%eax +80101f23: e8 49 fd ff ff call 80101c71 +80101f28: eb 8f jmp 80101eb9 -80101fe1 : +80101f2a : ioapic->data = data; } void ioapicinit(void) { -80101fe1: f3 0f 1e fb endbr32 -80101fe5: 55 push %ebp -80101fe6: 89 e5 mov %esp,%ebp -80101fe8: 56 push %esi -80101fe9: 53 push %ebx +80101f2a: 55 push %ebp +80101f2b: 89 e5 mov %esp,%ebp +80101f2d: 56 push %esi +80101f2e: 53 push %ebx int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; -80101fea: c7 05 54 52 11 80 00 movl $0xfec00000,0x80115254 -80101ff1: 00 c0 fe +80101f2f: c7 05 34 26 11 80 00 movl $0xfec00000,0x80112634 +80101f36: 00 c0 fe ioapic->reg = reg; -80101ff4: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 -80101ffb: 00 00 00 +80101f39: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 +80101f40: 00 00 00 return ioapic->data; -80101ffe: a1 54 52 11 80 mov 0x80115254,%eax -80102003: 8b 58 10 mov 0x10(%eax),%ebx +80101f43: a1 34 26 11 80 mov 0x80112634,%eax +80101f48: 8b 58 10 mov 0x10(%eax),%ebx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; -80102006: c1 eb 10 shr $0x10,%ebx -80102009: 0f b6 db movzbl %bl,%ebx +80101f4b: c1 eb 10 shr $0x10,%ebx +80101f4e: 0f b6 db movzbl %bl,%ebx ioapic->reg = reg; -8010200c: c7 00 00 00 00 00 movl $0x0,(%eax) +80101f51: c7 00 00 00 00 00 movl $0x0,(%eax) return ioapic->data; -80102012: a1 54 52 11 80 mov 0x80115254,%eax -80102017: 8b 40 10 mov 0x10(%eax),%eax +80101f57: a1 34 26 11 80 mov 0x80112634,%eax +80101f5c: 8b 40 10 mov 0x10(%eax),%eax id = ioapicread(REG_ID) >> 24; if(id != ioapicid) -8010201a: 0f b6 15 80 53 11 80 movzbl 0x80115380,%edx +80101f5f: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx id = ioapicread(REG_ID) >> 24; -80102021: c1 e8 18 shr $0x18,%eax +80101f66: c1 e8 18 shr $0x18,%eax if(id != ioapicid) -80102024: 39 c2 cmp %eax,%edx -80102026: 75 4a jne 80102072 +80101f69: 39 c2 cmp %eax,%edx +80101f6b: 75 4a jne 80101fb7 cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ -80102028: 8d 74 1b 12 lea 0x12(%ebx,%ebx,1),%esi +80101f6d: 8d 74 1b 12 lea 0x12(%ebx,%ebx,1),%esi { -8010202c: b8 10 00 00 00 mov $0x10,%eax -80102031: ba 20 00 00 00 mov $0x20,%edx +80101f71: b8 10 00 00 00 mov $0x10,%eax +80101f76: ba 20 00 00 00 mov $0x20,%edx ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); -80102036: 89 d3 mov %edx,%ebx -80102038: 81 cb 00 00 01 00 or $0x10000,%ebx +80101f7b: 89 d3 mov %edx,%ebx +80101f7d: 81 cb 00 00 01 00 or $0x10000,%ebx ioapic->reg = reg; -8010203e: 8b 0d 54 52 11 80 mov 0x80115254,%ecx -80102044: 89 01 mov %eax,(%ecx) +80101f83: 8b 0d 34 26 11 80 mov 0x80112634,%ecx +80101f89: 89 01 mov %eax,(%ecx) ioapic->data = data; -80102046: 8b 0d 54 52 11 80 mov 0x80115254,%ecx -8010204c: 89 59 10 mov %ebx,0x10(%ecx) +80101f8b: 8b 0d 34 26 11 80 mov 0x80112634,%ecx +80101f91: 89 59 10 mov %ebx,0x10(%ecx) ioapic->reg = reg; -8010204f: 8d 58 01 lea 0x1(%eax),%ebx -80102052: 89 19 mov %ebx,(%ecx) +80101f94: 8d 58 01 lea 0x1(%eax),%ebx +80101f97: 89 19 mov %ebx,(%ecx) ioapic->data = data; -80102054: 8b 0d 54 52 11 80 mov 0x80115254,%ecx -8010205a: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) +80101f99: 8b 0d 34 26 11 80 mov 0x80112634,%ecx +80101f9f: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) for(i = 0; i <= maxintr; i++){ -80102061: 83 c2 01 add $0x1,%edx -80102064: 83 c0 02 add $0x2,%eax -80102067: 39 f0 cmp %esi,%eax -80102069: 75 cb jne 80102036 +80101fa6: 83 c2 01 add $0x1,%edx +80101fa9: 83 c0 02 add $0x2,%eax +80101fac: 39 f0 cmp %esi,%eax +80101fae: 75 cb jne 80101f7b ioapicwrite(REG_TABLE+2*i+1, 0); } } -8010206b: 8d 65 f8 lea -0x8(%ebp),%esp -8010206e: 5b pop %ebx -8010206f: 5e pop %esi -80102070: 5d pop %ebp -80102071: c3 ret +80101fb0: 8d 65 f8 lea -0x8(%ebp),%esp +80101fb3: 5b pop %ebx +80101fb4: 5e pop %esi +80101fb5: 5d pop %ebp +80101fb6: c3 ret cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); -80102072: 83 ec 0c sub $0xc,%esp -80102075: 68 b0 7a 10 80 push $0x80107ab0 -8010207a: e8 ad e5 ff ff call 8010062c -8010207f: 83 c4 10 add $0x10,%esp -80102082: eb a4 jmp 80102028 +80101fb7: 83 ec 0c sub $0xc,%esp +80101fba: 68 d0 77 10 80 push $0x801077d0 +80101fbf: e8 3d e6 ff ff call 80100601 +80101fc4: 83 c4 10 add $0x10,%esp +80101fc7: eb a4 jmp 80101f6d -80102084 : +80101fc9 : void ioapicenable(int irq, int cpunum) { -80102084: f3 0f 1e fb endbr32 -80102088: 55 push %ebp -80102089: 89 e5 mov %esp,%ebp -8010208b: 8b 45 08 mov 0x8(%ebp),%eax +80101fc9: 55 push %ebp +80101fca: 89 e5 mov %esp,%ebp +80101fcc: 8b 45 08 mov 0x8(%ebp),%eax // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); -8010208e: 8d 50 20 lea 0x20(%eax),%edx -80102091: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax +80101fcf: 8d 50 20 lea 0x20(%eax),%edx +80101fd2: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax ioapic->reg = reg; -80102095: 8b 0d 54 52 11 80 mov 0x80115254,%ecx -8010209b: 89 01 mov %eax,(%ecx) +80101fd6: 8b 0d 34 26 11 80 mov 0x80112634,%ecx +80101fdc: 89 01 mov %eax,(%ecx) ioapic->data = data; -8010209d: 8b 0d 54 52 11 80 mov 0x80115254,%ecx -801020a3: 89 51 10 mov %edx,0x10(%ecx) +80101fde: 8b 0d 34 26 11 80 mov 0x80112634,%ecx +80101fe4: 89 51 10 mov %edx,0x10(%ecx) ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); -801020a6: 8b 55 0c mov 0xc(%ebp),%edx -801020a9: c1 e2 18 shl $0x18,%edx -801020ac: 83 c0 01 add $0x1,%eax +80101fe7: 8b 55 0c mov 0xc(%ebp),%edx +80101fea: c1 e2 18 shl $0x18,%edx +80101fed: 83 c0 01 add $0x1,%eax ioapic->reg = reg; -801020af: 89 01 mov %eax,(%ecx) +80101ff0: 89 01 mov %eax,(%ecx) ioapic->data = data; -801020b1: a1 54 52 11 80 mov 0x80115254,%eax -801020b6: 89 50 10 mov %edx,0x10(%eax) +80101ff2: a1 34 26 11 80 mov 0x80112634,%eax +80101ff7: 89 50 10 mov %edx,0x10(%eax) } -801020b9: 5d pop %ebp -801020ba: c3 ret +80101ffa: 5d pop %ebp +80101ffb: c3 ret -801020bb : +80101ffc : // 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) { -801020bb: f3 0f 1e fb endbr32 -801020bf: 55 push %ebp -801020c0: 89 e5 mov %esp,%ebp -801020c2: 53 push %ebx -801020c3: 83 ec 04 sub $0x4,%esp -801020c6: 8b 5d 08 mov 0x8(%ebp),%ebx +80101ffc: 55 push %ebp +80101ffd: 89 e5 mov %esp,%ebp +80101fff: 53 push %ebx +80102000: 83 ec 04 sub $0x4,%esp +80102003: 8b 5d 08 mov 0x8(%ebp),%ebx struct run *r; if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) -801020c9: 81 fb 3c 79 11 80 cmp $0x8011793c,%ebx -801020cf: 0f 92 c0 setb %al -801020d2: 89 d9 mov %ebx,%ecx -801020d4: 81 e1 ff 0f 00 00 and $0xfff,%ecx -801020da: 75 49 jne 80102125 -801020dc: 84 c0 test %al,%al -801020de: 75 45 jne 80102125 -801020e0: 8d 93 00 00 00 80 lea -0x80000000(%ebx),%edx -801020e6: 81 fa ff ff ff 0d cmp $0xdffffff,%edx -801020ec: 77 37 ja 80102125 +80102006: 81 fb 60 79 11 80 cmp $0x80117960,%ebx +8010200c: 0f 92 c0 setb %al +8010200f: 89 d9 mov %ebx,%ecx +80102011: 81 e1 ff 0f 00 00 and $0xfff,%ecx +80102017: 75 49 jne 80102062 +80102019: 84 c0 test %al,%al +8010201b: 75 45 jne 80102062 +8010201d: 8d 93 00 00 00 80 lea -0x80000000(%ebx),%edx +80102023: 81 fa ff ff ff 0d cmp $0xdffffff,%edx +80102029: 77 37 ja 80102062 cprintf("%d %d %d\n",(uint)v%PGSIZE ,v=PHYSTOP); panic("kfree"); } // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); // garbage value -801020ee: 83 ec 04 sub $0x4,%esp -801020f1: 68 00 10 00 00 push $0x1000 -801020f6: 6a 01 push $0x1 -801020f8: 53 push %ebx -801020f9: e8 51 1e 00 00 call 80103f4f +8010202b: 83 ec 04 sub $0x4,%esp +8010202e: 68 00 10 00 00 push $0x1000 +80102033: 6a 01 push $0x1 +80102035: 53 push %ebx +80102036: e8 74 1d 00 00 call 80103daf if(kmem.use_lock) -801020fe: 83 c4 10 add $0x10,%esp -80102101: 83 3d 94 52 11 80 00 cmpl $0x0,0x80115294 -80102108: 75 49 jne 80102153 +8010203b: 83 c4 10 add $0x10,%esp +8010203e: 83 3d 74 26 11 80 00 cmpl $0x0,0x80112674 +80102045: 75 49 jne 80102090 acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; -8010210a: a1 98 52 11 80 mov 0x80115298,%eax -8010210f: 89 03 mov %eax,(%ebx) +80102047: a1 78 26 11 80 mov 0x80112678,%eax +8010204c: 89 03 mov %eax,(%ebx) kmem.freelist = r; -80102111: 89 1d 98 52 11 80 mov %ebx,0x80115298 +8010204e: 89 1d 78 26 11 80 mov %ebx,0x80112678 if(kmem.use_lock) -80102117: 83 3d 94 52 11 80 00 cmpl $0x0,0x80115294 -8010211e: 75 45 jne 80102165 +80102054: 83 3d 74 26 11 80 00 cmpl $0x0,0x80112674 +8010205b: 75 45 jne 801020a2 release(&kmem.lock); } -80102120: 8b 5d fc mov -0x4(%ebp),%ebx -80102123: c9 leave -80102124: c3 ret +8010205d: 8b 5d fc mov -0x4(%ebp),%ebx +80102060: c9 leave +80102061: c3 ret cprintf("%d %d %d\n",(uint)v%PGSIZE ,v=PHYSTOP); -80102125: 81 c3 00 00 00 80 add $0x80000000,%ebx -8010212b: 81 fb ff ff ff 0d cmp $0xdffffff,%ebx -80102131: 0f 97 c2 seta %dl -80102134: 0f b6 d2 movzbl %dl,%edx -80102137: 52 push %edx -80102138: 0f b6 c0 movzbl %al,%eax -8010213b: 50 push %eax -8010213c: 51 push %ecx -8010213d: 68 e2 7a 10 80 push $0x80107ae2 -80102142: e8 e5 e4 ff ff call 8010062c +80102062: 81 c3 00 00 00 80 add $0x80000000,%ebx +80102068: 81 fb ff ff ff 0d cmp $0xdffffff,%ebx +8010206e: 0f 97 c2 seta %dl +80102071: 0f b6 d2 movzbl %dl,%edx +80102074: 52 push %edx +80102075: 0f b6 c0 movzbl %al,%eax +80102078: 50 push %eax +80102079: 51 push %ecx +8010207a: 68 02 78 10 80 push $0x80107802 +8010207f: e8 7d e5 ff ff call 80100601 panic("kfree"); -80102147: c7 04 24 ec 7a 10 80 movl $0x80107aec,(%esp) -8010214e: e8 05 e2 ff ff call 80100358 +80102084: c7 04 24 0c 78 10 80 movl $0x8010780c,(%esp) +8010208b: e8 b0 e2 ff ff call 80100340 acquire(&kmem.lock); -80102153: 83 ec 0c sub $0xc,%esp -80102156: 68 60 52 11 80 push $0x80115260 -8010215b: e8 39 1d 00 00 call 80103e99 -80102160: 83 c4 10 add $0x10,%esp -80102163: eb a5 jmp 8010210a +80102090: 83 ec 0c sub $0xc,%esp +80102093: 68 40 26 11 80 push $0x80112640 +80102098: e8 64 1c 00 00 call 80103d01 +8010209d: 83 c4 10 add $0x10,%esp +801020a0: eb a5 jmp 80102047 release(&kmem.lock); -80102165: 83 ec 0c sub $0xc,%esp -80102168: 68 60 52 11 80 push $0x80115260 -8010216d: e8 92 1d 00 00 call 80103f04 -80102172: 83 c4 10 add $0x10,%esp +801020a2: 83 ec 0c sub $0xc,%esp +801020a5: 68 40 26 11 80 push $0x80112640 +801020aa: e8 b9 1c 00 00 call 80103d68 +801020af: 83 c4 10 add $0x10,%esp } -80102175: eb a9 jmp 80102120 +801020b2: eb a9 jmp 8010205d -80102177 : +801020b4 : { -80102177: f3 0f 1e fb endbr32 -8010217b: 55 push %ebp -8010217c: 89 e5 mov %esp,%ebp -8010217e: 56 push %esi -8010217f: 53 push %ebx -80102180: 8b 75 0c mov 0xc(%ebp),%esi +801020b4: 55 push %ebp +801020b5: 89 e5 mov %esp,%ebp +801020b7: 56 push %esi +801020b8: 53 push %ebx +801020b9: 8b 75 0c mov 0xc(%ebp),%esi p = (char*)PGROUNDUP((uint)vstart); -80102183: 8b 45 08 mov 0x8(%ebp),%eax -80102186: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx -8010218c: 81 e3 00 f0 ff ff and $0xfffff000,%ebx +801020bc: 8b 45 08 mov 0x8(%ebp),%eax +801020bf: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx +801020c5: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) -80102192: 81 c3 00 10 00 00 add $0x1000,%ebx -80102198: 39 de cmp %ebx,%esi -8010219a: 72 1c jb 801021b8 +801020cb: 81 c3 00 10 00 00 add $0x1000,%ebx +801020d1: 39 de cmp %ebx,%esi +801020d3: 72 1c jb 801020f1 kfree(p); -8010219c: 83 ec 0c sub $0xc,%esp -8010219f: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax -801021a5: 50 push %eax -801021a6: e8 10 ff ff ff call 801020bb +801020d5: 83 ec 0c sub $0xc,%esp +801020d8: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax +801020de: 50 push %eax +801020df: e8 18 ff ff ff call 80101ffc for(; p + PGSIZE <= (char*)vend; p += PGSIZE) -801021ab: 81 c3 00 10 00 00 add $0x1000,%ebx -801021b1: 83 c4 10 add $0x10,%esp -801021b4: 39 f3 cmp %esi,%ebx -801021b6: 76 e4 jbe 8010219c -} -801021b8: 8d 65 f8 lea -0x8(%ebp),%esp -801021bb: 5b pop %ebx -801021bc: 5e pop %esi -801021bd: 5d pop %ebp -801021be: c3 ret - -801021bf : -{ -801021bf: f3 0f 1e fb endbr32 -801021c3: 55 push %ebp -801021c4: 89 e5 mov %esp,%ebp -801021c6: 83 ec 10 sub $0x10,%esp +801020e4: 81 c3 00 10 00 00 add $0x1000,%ebx +801020ea: 83 c4 10 add $0x10,%esp +801020ed: 39 f3 cmp %esi,%ebx +801020ef: 76 e4 jbe 801020d5 +} +801020f1: 8d 65 f8 lea -0x8(%ebp),%esp +801020f4: 5b pop %ebx +801020f5: 5e pop %esi +801020f6: 5d pop %ebp +801020f7: c3 ret + +801020f8 : +{ +801020f8: 55 push %ebp +801020f9: 89 e5 mov %esp,%ebp +801020fb: 83 ec 10 sub $0x10,%esp initlock(&kmem.lock, "kmem"); -801021c9: 68 f2 7a 10 80 push $0x80107af2 -801021ce: 68 60 52 11 80 push $0x80115260 -801021d3: e8 65 1b 00 00 call 80103d3d +801020fe: 68 12 78 10 80 push $0x80107812 +80102103: 68 40 26 11 80 push $0x80112640 +80102108: e8 ab 1a 00 00 call 80103bb8 kmem.use_lock = 0; -801021d8: c7 05 94 52 11 80 00 movl $0x0,0x80115294 -801021df: 00 00 00 +8010210d: c7 05 74 26 11 80 00 movl $0x0,0x80112674 +80102114: 00 00 00 freerange(vstart, vend); -801021e2: 83 c4 08 add $0x8,%esp -801021e5: ff 75 0c pushl 0xc(%ebp) -801021e8: ff 75 08 pushl 0x8(%ebp) -801021eb: e8 87 ff ff ff call 80102177 +80102117: 83 c4 08 add $0x8,%esp +8010211a: ff 75 0c push 0xc(%ebp) +8010211d: ff 75 08 push 0x8(%ebp) +80102120: e8 8f ff ff ff call 801020b4 } -801021f0: 83 c4 10 add $0x10,%esp -801021f3: c9 leave -801021f4: c3 ret +80102125: 83 c4 10 add $0x10,%esp +80102128: c9 leave +80102129: c3 ret -801021f5 : +8010212a : { -801021f5: f3 0f 1e fb endbr32 -801021f9: 55 push %ebp -801021fa: 89 e5 mov %esp,%ebp -801021fc: 83 ec 10 sub $0x10,%esp +8010212a: 55 push %ebp +8010212b: 89 e5 mov %esp,%ebp +8010212d: 83 ec 10 sub $0x10,%esp freerange(vstart, vend); -801021ff: ff 75 0c pushl 0xc(%ebp) -80102202: ff 75 08 pushl 0x8(%ebp) -80102205: e8 6d ff ff ff call 80102177 +80102130: ff 75 0c push 0xc(%ebp) +80102133: ff 75 08 push 0x8(%ebp) +80102136: e8 79 ff ff ff call 801020b4 kmem.use_lock = 1; -8010220a: c7 05 94 52 11 80 01 movl $0x1,0x80115294 -80102211: 00 00 00 +8010213b: c7 05 74 26 11 80 01 movl $0x1,0x80112674 +80102142: 00 00 00 } -80102214: 83 c4 10 add $0x10,%esp -80102217: c9 leave -80102218: c3 ret +80102145: 83 c4 10 add $0x10,%esp +80102148: c9 leave +80102149: c3 ret -80102219 : +8010214a : // 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) { -80102219: f3 0f 1e fb endbr32 -8010221d: 55 push %ebp -8010221e: 89 e5 mov %esp,%ebp -80102220: 53 push %ebx -80102221: 83 ec 04 sub $0x4,%esp +8010214a: 55 push %ebp +8010214b: 89 e5 mov %esp,%ebp +8010214d: 53 push %ebx +8010214e: 83 ec 04 sub $0x4,%esp struct run *r; if(kmem.use_lock) -80102224: 83 3d 94 52 11 80 00 cmpl $0x0,0x80115294 -8010222b: 75 21 jne 8010224e +80102151: 83 3d 74 26 11 80 00 cmpl $0x0,0x80112674 +80102158: 75 21 jne 8010217b acquire(&kmem.lock); r = kmem.freelist; -8010222d: 8b 1d 98 52 11 80 mov 0x80115298,%ebx +8010215a: 8b 1d 78 26 11 80 mov 0x80112678,%ebx if(r) -80102233: 85 db test %ebx,%ebx -80102235: 74 10 je 80102247 +80102160: 85 db test %ebx,%ebx +80102162: 74 10 je 80102174 kmem.freelist = r->next; // first element of linked list changed -80102237: 8b 03 mov (%ebx),%eax -80102239: a3 98 52 11 80 mov %eax,0x80115298 +80102164: 8b 03 mov (%ebx),%eax +80102166: a3 78 26 11 80 mov %eax,0x80112678 if(kmem.use_lock) -8010223e: 83 3d 94 52 11 80 00 cmpl $0x0,0x80115294 -80102245: 75 23 jne 8010226a +8010216b: 83 3d 74 26 11 80 00 cmpl $0x0,0x80112674 +80102172: 75 23 jne 80102197 release(&kmem.lock); return (char*)r; } -80102247: 89 d8 mov %ebx,%eax -80102249: 8b 5d fc mov -0x4(%ebp),%ebx -8010224c: c9 leave -8010224d: c3 ret +80102174: 89 d8 mov %ebx,%eax +80102176: 8b 5d fc mov -0x4(%ebp),%ebx +80102179: c9 leave +8010217a: c3 ret acquire(&kmem.lock); -8010224e: 83 ec 0c sub $0xc,%esp -80102251: 68 60 52 11 80 push $0x80115260 -80102256: e8 3e 1c 00 00 call 80103e99 +8010217b: 83 ec 0c sub $0xc,%esp +8010217e: 68 40 26 11 80 push $0x80112640 +80102183: e8 79 1b 00 00 call 80103d01 r = kmem.freelist; -8010225b: 8b 1d 98 52 11 80 mov 0x80115298,%ebx +80102188: 8b 1d 78 26 11 80 mov 0x80112678,%ebx if(r) -80102261: 83 c4 10 add $0x10,%esp -80102264: 85 db test %ebx,%ebx -80102266: 75 cf jne 80102237 -80102268: eb d4 jmp 8010223e +8010218e: 83 c4 10 add $0x10,%esp +80102191: 85 db test %ebx,%ebx +80102193: 75 cf jne 80102164 +80102195: eb d4 jmp 8010216b release(&kmem.lock); -8010226a: 83 ec 0c sub $0xc,%esp -8010226d: 68 60 52 11 80 push $0x80115260 -80102272: e8 8d 1c 00 00 call 80103f04 -80102277: 83 c4 10 add $0x10,%esp +80102197: 83 ec 0c sub $0xc,%esp +8010219a: 68 40 26 11 80 push $0x80112640 +8010219f: e8 c4 1b 00 00 call 80103d68 +801021a4: 83 c4 10 add $0x10,%esp return (char*)r; -8010227a: eb cb jmp 80102247 - -8010227c : -#include "defs.h" -#include "kbd.h" +801021a7: eb cb jmp 80102174 -int -kbdgetc(void) -{ -8010227c: f3 0f 1e fb endbr32 +801021a9 : asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80102280: ba 64 00 00 00 mov $0x64,%edx -80102285: ec in (%dx),%al +801021a9: ba 64 00 00 00 mov $0x64,%edx +801021ae: ec in (%dx),%al normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if((st & KBS_DIB) == 0) -80102286: a8 01 test $0x1,%al -80102288: 0f 84 b7 00 00 00 je 80102345 -8010228e: ba 60 00 00 00 mov $0x60,%edx -80102293: ec in (%dx),%al +801021af: a8 01 test $0x1,%al +801021b1: 0f 84 ad 00 00 00 je 80102264 +801021b7: ba 60 00 00 00 mov $0x60,%edx +801021bc: ec in (%dx),%al return -1; data = inb(KBDATAP); -80102294: 0f b6 d0 movzbl %al,%edx +801021bd: 0f b6 c8 movzbl %al,%ecx if(data == 0xE0){ -80102297: 3c e0 cmp $0xe0,%al -80102299: 74 5b je 801022f6 +801021c0: 3c e0 cmp $0xe0,%al +801021c2: 74 5b je 8010221f shift |= E0ESC; return 0; } else if(data & 0x80){ -8010229b: 84 c0 test %al,%al -8010229d: 78 64 js 80102303 +801021c4: 84 c0 test %al,%al +801021c6: 78 64 js 8010222c // Key released data = (shift & E0ESC ? data : data & 0x7F); shift &= ~(shiftcode[data] | E0ESC); return 0; } else if(shift & E0ESC){ -8010229f: 8b 0d b4 b5 10 80 mov 0x8010b5b4,%ecx -801022a5: f6 c1 40 test $0x40,%cl -801022a8: 74 0f je 801022b9 +801021c8: 8b 15 7c 26 11 80 mov 0x8011267c,%edx +801021ce: f6 c2 40 test $0x40,%dl +801021d1: 74 0f je 801021e2 // Last character was an E0 escape; or with 0x80 data |= 0x80; -801022aa: 83 c8 80 or $0xffffff80,%eax -801022ad: 0f b6 d0 movzbl %al,%edx +801021d3: 83 c8 80 or $0xffffff80,%eax +801021d6: 0f b6 c8 movzbl %al,%ecx shift &= ~E0ESC; -801022b0: 83 e1 bf and $0xffffffbf,%ecx -801022b3: 89 0d b4 b5 10 80 mov %ecx,0x8010b5b4 +801021d9: 83 e2 bf and $0xffffffbf,%edx +801021dc: 89 15 7c 26 11 80 mov %edx,0x8011267c } shift |= shiftcode[data]; -801022b9: 0f b6 8a 20 7c 10 80 movzbl -0x7fef83e0(%edx),%ecx -801022c0: 0b 0d b4 b5 10 80 or 0x8010b5b4,%ecx +801021e2: 0f b6 91 40 79 10 80 movzbl -0x7fef86c0(%ecx),%edx +801021e9: 0b 15 7c 26 11 80 or 0x8011267c,%edx shift ^= togglecode[data]; -801022c6: 0f b6 82 20 7b 10 80 movzbl -0x7fef84e0(%edx),%eax -801022cd: 31 c1 xor %eax,%ecx -801022cf: 89 0d b4 b5 10 80 mov %ecx,0x8010b5b4 +801021ef: 0f b6 81 40 78 10 80 movzbl -0x7fef87c0(%ecx),%eax +801021f6: 31 c2 xor %eax,%edx +801021f8: 89 15 7c 26 11 80 mov %edx,0x8011267c c = charcode[shift & (CTL | SHIFT)][data]; -801022d5: 89 c8 mov %ecx,%eax -801022d7: 83 e0 03 and $0x3,%eax -801022da: 8b 04 85 00 7b 10 80 mov -0x7fef8500(,%eax,4),%eax -801022e1: 0f b6 04 10 movzbl (%eax,%edx,1),%eax +801021fe: 89 d0 mov %edx,%eax +80102200: 83 e0 03 and $0x3,%eax +80102203: 8b 04 85 20 78 10 80 mov -0x7fef87e0(,%eax,4),%eax +8010220a: 0f b6 04 08 movzbl (%eax,%ecx,1),%eax if(shift & CAPSLOCK){ -801022e5: f6 c1 08 test $0x8,%cl -801022e8: 74 61 je 8010234b +8010220e: f6 c2 08 test $0x8,%dl +80102211: 74 56 je 80102269 if('a' <= c && c <= 'z') -801022ea: 8d 50 9f lea -0x61(%eax),%edx -801022ed: 83 fa 19 cmp $0x19,%edx -801022f0: 77 46 ja 80102338 +80102213: 8d 50 9f lea -0x61(%eax),%edx +80102216: 83 fa 19 cmp $0x19,%edx +80102219: 77 3c ja 80102257 c += 'A' - 'a'; -801022f2: 83 e8 20 sub $0x20,%eax -801022f5: c3 ret +8010221b: 83 e8 20 sub $0x20,%eax +8010221e: c3 ret shift |= E0ESC; -801022f6: 83 0d b4 b5 10 80 40 orl $0x40,0x8010b5b4 +8010221f: 83 0d 7c 26 11 80 40 orl $0x40,0x8011267c return 0; -801022fd: b8 00 00 00 00 mov $0x0,%eax -80102302: c3 ret -{ -80102303: 55 push %ebp -80102304: 89 e5 mov %esp,%ebp -80102306: 53 push %ebx +80102226: b8 00 00 00 00 mov $0x0,%eax +8010222b: c3 ret data = (shift & E0ESC ? data : data & 0x7F); -80102307: 8b 0d b4 b5 10 80 mov 0x8010b5b4,%ecx -8010230d: 89 cb mov %ecx,%ebx -8010230f: 83 e3 40 and $0x40,%ebx -80102312: 83 e0 7f and $0x7f,%eax -80102315: 85 db test %ebx,%ebx -80102317: 0f 44 d0 cmove %eax,%edx +8010222c: 8b 15 7c 26 11 80 mov 0x8011267c,%edx +80102232: 83 e0 7f and $0x7f,%eax +80102235: f6 c2 40 test $0x40,%dl +80102238: 0f 44 c8 cmove %eax,%ecx shift &= ~(shiftcode[data] | E0ESC); -8010231a: 0f b6 82 20 7c 10 80 movzbl -0x7fef83e0(%edx),%eax -80102321: 83 c8 40 or $0x40,%eax -80102324: 0f b6 c0 movzbl %al,%eax -80102327: f7 d0 not %eax -80102329: 21 c8 and %ecx,%eax -8010232b: a3 b4 b5 10 80 mov %eax,0x8010b5b4 +8010223b: 0f b6 81 40 79 10 80 movzbl -0x7fef86c0(%ecx),%eax +80102242: 83 c8 40 or $0x40,%eax +80102245: 0f b6 c0 movzbl %al,%eax +80102248: f7 d0 not %eax +8010224a: 21 d0 and %edx,%eax +8010224c: a3 7c 26 11 80 mov %eax,0x8011267c return 0; -80102330: b8 00 00 00 00 mov $0x0,%eax +80102251: b8 00 00 00 00 mov $0x0,%eax +80102256: c3 ret else if('A' <= c && c <= 'Z') +80102257: 8d 48 bf lea -0x41(%eax),%ecx c += 'a' - 'A'; +8010225a: 8d 50 20 lea 0x20(%eax),%edx +8010225d: 83 f9 1a cmp $0x1a,%ecx +80102260: 0f 42 c2 cmovb %edx,%eax } return c; -} -80102335: 5b pop %ebx -80102336: 5d pop %ebp -80102337: c3 ret - else if('A' <= c && c <= 'Z') -80102338: 8d 48 bf lea -0x41(%eax),%ecx - c += 'a' - 'A'; -8010233b: 8d 50 20 lea 0x20(%eax),%edx -8010233e: 83 f9 1a cmp $0x1a,%ecx -80102341: 0f 42 c2 cmovb %edx,%eax - return c; -80102344: c3 ret +80102263: c3 ret return -1; -80102345: b8 ff ff ff ff mov $0xffffffff,%eax -8010234a: c3 ret +80102264: b8 ff ff ff ff mov $0xffffffff,%eax } -8010234b: c3 ret +80102269: c3 ret -8010234c : +8010226a : void kbdintr(void) { -8010234c: f3 0f 1e fb endbr32 -80102350: 55 push %ebp -80102351: 89 e5 mov %esp,%ebp -80102353: 83 ec 14 sub $0x14,%esp +8010226a: 55 push %ebp +8010226b: 89 e5 mov %esp,%ebp +8010226d: 83 ec 14 sub $0x14,%esp consoleintr(kbdgetc); -80102356: 68 7c 22 10 80 push $0x8010227c -8010235b: e8 2b e4 ff ff call 8010078b +80102270: 68 a9 21 10 80 push $0x801021a9 +80102275: e8 e2 e4 ff ff call 8010075c } -80102360: 83 c4 10 add $0x10,%esp -80102363: c9 leave -80102364: c3 ret +8010227a: 83 c4 10 add $0x10,%esp +8010227d: c9 leave +8010227e: c3 ret -80102365 : +8010227f : //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; -80102365: 8b 0d 9c 52 11 80 mov 0x8011529c,%ecx -8010236b: 8d 04 81 lea (%ecx,%eax,4),%eax -8010236e: 89 10 mov %edx,(%eax) +8010227f: 8b 0d 80 26 11 80 mov 0x80112680,%ecx +80102285: 8d 04 81 lea (%ecx,%eax,4),%eax +80102288: 89 10 mov %edx,(%eax) lapic[ID]; // wait for write to finish, by reading -80102370: a1 9c 52 11 80 mov 0x8011529c,%eax -80102375: 8b 40 20 mov 0x20(%eax),%eax +8010228a: a1 80 26 11 80 mov 0x80112680,%eax +8010228f: 8b 40 20 mov 0x20(%eax),%eax } -80102378: c3 ret +80102292: c3 ret -80102379 : +80102293 : return inb(CMOS_RETURN); } static void fill_rtcdate(struct rtcdate *r) { -80102379: 55 push %ebp -8010237a: 89 e5 mov %esp,%ebp -8010237c: 56 push %esi -8010237d: 53 push %ebx -8010237e: 89 c3 mov %eax,%ebx +80102293: 55 push %ebp +80102294: 89 e5 mov %esp,%ebp +80102296: 56 push %esi +80102297: 53 push %ebx +80102298: 89 c1 mov %eax,%ecx asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80102380: be 70 00 00 00 mov $0x70,%esi -80102385: b8 00 00 00 00 mov $0x0,%eax -8010238a: 89 f2 mov %esi,%edx -8010238c: ee out %al,(%dx) +8010229a: be 70 00 00 00 mov $0x70,%esi +8010229f: b8 00 00 00 00 mov $0x0,%eax +801022a4: 89 f2 mov %esi,%edx +801022a6: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -8010238d: b9 71 00 00 00 mov $0x71,%ecx -80102392: 89 ca mov %ecx,%edx -80102394: ec in (%dx),%al +801022a7: bb 71 00 00 00 mov $0x71,%ebx +801022ac: 89 da mov %ebx,%edx +801022ae: ec in (%dx),%al return inb(CMOS_RETURN); -80102395: 0f b6 c0 movzbl %al,%eax -80102398: 89 03 mov %eax,(%ebx) +801022af: 0f b6 c0 movzbl %al,%eax +801022b2: 89 01 mov %eax,(%ecx) asm volatile("out %0,%1" : : "a" (data), "d" (port)); -8010239a: b8 02 00 00 00 mov $0x2,%eax -8010239f: 89 f2 mov %esi,%edx -801023a1: ee out %al,(%dx) +801022b4: b8 02 00 00 00 mov $0x2,%eax +801022b9: 89 f2 mov %esi,%edx +801022bb: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -801023a2: 89 ca mov %ecx,%edx -801023a4: ec in (%dx),%al -801023a5: 0f b6 c0 movzbl %al,%eax -801023a8: 89 43 04 mov %eax,0x4(%ebx) +801022bc: 89 da mov %ebx,%edx +801022be: ec in (%dx),%al +801022bf: 0f b6 c0 movzbl %al,%eax +801022c2: 89 41 04 mov %eax,0x4(%ecx) asm volatile("out %0,%1" : : "a" (data), "d" (port)); -801023ab: b8 04 00 00 00 mov $0x4,%eax -801023b0: 89 f2 mov %esi,%edx -801023b2: ee out %al,(%dx) +801022c5: b8 04 00 00 00 mov $0x4,%eax +801022ca: 89 f2 mov %esi,%edx +801022cc: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -801023b3: 89 ca mov %ecx,%edx -801023b5: ec in (%dx),%al -801023b6: 0f b6 c0 movzbl %al,%eax -801023b9: 89 43 08 mov %eax,0x8(%ebx) +801022cd: 89 da mov %ebx,%edx +801022cf: ec in (%dx),%al +801022d0: 0f b6 c0 movzbl %al,%eax +801022d3: 89 41 08 mov %eax,0x8(%ecx) asm volatile("out %0,%1" : : "a" (data), "d" (port)); -801023bc: b8 07 00 00 00 mov $0x7,%eax -801023c1: 89 f2 mov %esi,%edx -801023c3: ee out %al,(%dx) +801022d6: b8 07 00 00 00 mov $0x7,%eax +801022db: 89 f2 mov %esi,%edx +801022dd: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -801023c4: 89 ca mov %ecx,%edx -801023c6: ec in (%dx),%al -801023c7: 0f b6 c0 movzbl %al,%eax -801023ca: 89 43 0c mov %eax,0xc(%ebx) +801022de: 89 da mov %ebx,%edx +801022e0: ec in (%dx),%al +801022e1: 0f b6 c0 movzbl %al,%eax +801022e4: 89 41 0c mov %eax,0xc(%ecx) asm volatile("out %0,%1" : : "a" (data), "d" (port)); -801023cd: b8 08 00 00 00 mov $0x8,%eax -801023d2: 89 f2 mov %esi,%edx -801023d4: ee out %al,(%dx) +801022e7: b8 08 00 00 00 mov $0x8,%eax +801022ec: 89 f2 mov %esi,%edx +801022ee: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -801023d5: 89 ca mov %ecx,%edx -801023d7: ec in (%dx),%al -801023d8: 0f b6 c0 movzbl %al,%eax -801023db: 89 43 10 mov %eax,0x10(%ebx) +801022ef: 89 da mov %ebx,%edx +801022f1: ec in (%dx),%al +801022f2: 0f b6 c0 movzbl %al,%eax +801022f5: 89 41 10 mov %eax,0x10(%ecx) asm volatile("out %0,%1" : : "a" (data), "d" (port)); -801023de: b8 09 00 00 00 mov $0x9,%eax -801023e3: 89 f2 mov %esi,%edx -801023e5: ee out %al,(%dx) +801022f8: b8 09 00 00 00 mov $0x9,%eax +801022fd: 89 f2 mov %esi,%edx +801022ff: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -801023e6: 89 ca mov %ecx,%edx -801023e8: ec in (%dx),%al -801023e9: 0f b6 c0 movzbl %al,%eax -801023ec: 89 43 14 mov %eax,0x14(%ebx) +80102300: 89 da mov %ebx,%edx +80102302: ec in (%dx),%al +80102303: 0f b6 c0 movzbl %al,%eax +80102306: 89 41 14 mov %eax,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); } -801023ef: 5b pop %ebx -801023f0: 5e pop %esi -801023f1: 5d pop %ebp -801023f2: c3 ret +80102309: 5b pop %ebx +8010230a: 5e pop %esi +8010230b: 5d pop %ebp +8010230c: c3 ret -801023f3 : -{ -801023f3: f3 0f 1e fb endbr32 +8010230d : if(!lapic) -801023f7: 83 3d 9c 52 11 80 00 cmpl $0x0,0x8011529c -801023fe: 0f 84 ff 00 00 00 je 80102503 +8010230d: 83 3d 80 26 11 80 00 cmpl $0x0,0x80112680 +80102314: 0f 84 ff 00 00 00 je 80102419 { -80102404: 55 push %ebp -80102405: 89 e5 mov %esp,%ebp -80102407: 83 ec 08 sub $0x8,%esp +8010231a: 55 push %ebp +8010231b: 89 e5 mov %esp,%ebp +8010231d: 83 ec 08 sub $0x8,%esp lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS)); -8010240a: ba 3f 01 00 00 mov $0x13f,%edx -8010240f: b8 3c 00 00 00 mov $0x3c,%eax -80102414: e8 4c ff ff ff call 80102365 +80102320: ba 3f 01 00 00 mov $0x13f,%edx +80102325: b8 3c 00 00 00 mov $0x3c,%eax +8010232a: e8 50 ff ff ff call 8010227f lapicw(TDCR, X1); -80102419: ba 0b 00 00 00 mov $0xb,%edx -8010241e: b8 f8 00 00 00 mov $0xf8,%eax -80102423: e8 3d ff ff ff call 80102365 +8010232f: ba 0b 00 00 00 mov $0xb,%edx +80102334: b8 f8 00 00 00 mov $0xf8,%eax +80102339: e8 41 ff ff ff call 8010227f lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER)); -80102428: ba 20 00 02 00 mov $0x20020,%edx -8010242d: b8 c8 00 00 00 mov $0xc8,%eax -80102432: e8 2e ff ff ff call 80102365 +8010233e: ba 20 00 02 00 mov $0x20020,%edx +80102343: b8 c8 00 00 00 mov $0xc8,%eax +80102348: e8 32 ff ff ff call 8010227f lapicw(TICR, 10000000); -80102437: ba 80 96 98 00 mov $0x989680,%edx -8010243c: b8 e0 00 00 00 mov $0xe0,%eax -80102441: e8 1f ff ff ff call 80102365 +8010234d: ba 80 96 98 00 mov $0x989680,%edx +80102352: b8 e0 00 00 00 mov $0xe0,%eax +80102357: e8 23 ff ff ff call 8010227f lapicw(LINT0, MASKED); -80102446: ba 00 00 01 00 mov $0x10000,%edx -8010244b: b8 d4 00 00 00 mov $0xd4,%eax -80102450: e8 10 ff ff ff call 80102365 +8010235c: ba 00 00 01 00 mov $0x10000,%edx +80102361: b8 d4 00 00 00 mov $0xd4,%eax +80102366: e8 14 ff ff ff call 8010227f lapicw(LINT1, MASKED); -80102455: ba 00 00 01 00 mov $0x10000,%edx -8010245a: b8 d8 00 00 00 mov $0xd8,%eax -8010245f: e8 01 ff ff ff call 80102365 +8010236b: ba 00 00 01 00 mov $0x10000,%edx +80102370: b8 d8 00 00 00 mov $0xd8,%eax +80102375: e8 05 ff ff ff call 8010227f if(((lapic[VER]>>16) & 0xFF) >= 4) -80102464: a1 9c 52 11 80 mov 0x8011529c,%eax -80102469: 8b 40 30 mov 0x30(%eax),%eax -8010246c: c1 e8 10 shr $0x10,%eax -8010246f: a8 fc test $0xfc,%al -80102471: 75 7c jne 801024ef +8010237a: a1 80 26 11 80 mov 0x80112680,%eax +8010237f: 8b 40 30 mov 0x30(%eax),%eax +80102382: c1 e8 10 shr $0x10,%eax +80102385: a8 fc test $0xfc,%al +80102387: 75 7c jne 80102405 lapicw(ERROR, T_IRQ0 + IRQ_ERROR); -80102473: ba 33 00 00 00 mov $0x33,%edx -80102478: b8 dc 00 00 00 mov $0xdc,%eax -8010247d: e8 e3 fe ff ff call 80102365 +80102389: ba 33 00 00 00 mov $0x33,%edx +8010238e: b8 dc 00 00 00 mov $0xdc,%eax +80102393: e8 e7 fe ff ff call 8010227f lapicw(ESR, 0); -80102482: ba 00 00 00 00 mov $0x0,%edx -80102487: b8 a0 00 00 00 mov $0xa0,%eax -8010248c: e8 d4 fe ff ff call 80102365 +80102398: ba 00 00 00 00 mov $0x0,%edx +8010239d: b8 a0 00 00 00 mov $0xa0,%eax +801023a2: e8 d8 fe ff ff call 8010227f lapicw(ESR, 0); -80102491: ba 00 00 00 00 mov $0x0,%edx -80102496: b8 a0 00 00 00 mov $0xa0,%eax -8010249b: e8 c5 fe ff ff call 80102365 +801023a7: ba 00 00 00 00 mov $0x0,%edx +801023ac: b8 a0 00 00 00 mov $0xa0,%eax +801023b1: e8 c9 fe ff ff call 8010227f lapicw(EOI, 0); -801024a0: ba 00 00 00 00 mov $0x0,%edx -801024a5: b8 2c 00 00 00 mov $0x2c,%eax -801024aa: e8 b6 fe ff ff call 80102365 +801023b6: ba 00 00 00 00 mov $0x0,%edx +801023bb: b8 2c 00 00 00 mov $0x2c,%eax +801023c0: e8 ba fe ff ff call 8010227f lapicw(ICRHI, 0); -801024af: ba 00 00 00 00 mov $0x0,%edx -801024b4: b8 c4 00 00 00 mov $0xc4,%eax -801024b9: e8 a7 fe ff ff call 80102365 +801023c5: ba 00 00 00 00 mov $0x0,%edx +801023ca: b8 c4 00 00 00 mov $0xc4,%eax +801023cf: e8 ab fe ff ff call 8010227f lapicw(ICRLO, BCAST | INIT | LEVEL); -801024be: ba 00 85 08 00 mov $0x88500,%edx -801024c3: b8 c0 00 00 00 mov $0xc0,%eax -801024c8: e8 98 fe ff ff call 80102365 +801023d4: ba 00 85 08 00 mov $0x88500,%edx +801023d9: b8 c0 00 00 00 mov $0xc0,%eax +801023de: e8 9c fe ff ff call 8010227f while(lapic[ICRLO] & DELIVS) -801024cd: 8b 15 9c 52 11 80 mov 0x8011529c,%edx -801024d3: 8b 82 00 03 00 00 mov 0x300(%edx),%eax -801024d9: f6 c4 10 test $0x10,%ah -801024dc: 75 f5 jne 801024d3 +801023e3: 8b 15 80 26 11 80 mov 0x80112680,%edx +801023e9: 8b 82 00 03 00 00 mov 0x300(%edx),%eax +801023ef: f6 c4 10 test $0x10,%ah +801023f2: 75 f5 jne 801023e9 lapicw(TPR, 0); -801024de: ba 00 00 00 00 mov $0x0,%edx -801024e3: b8 20 00 00 00 mov $0x20,%eax -801024e8: e8 78 fe ff ff call 80102365 +801023f4: ba 00 00 00 00 mov $0x0,%edx +801023f9: b8 20 00 00 00 mov $0x20,%eax +801023fe: e8 7c fe ff ff call 8010227f } -801024ed: c9 leave -801024ee: c3 ret +80102403: c9 leave +80102404: c3 ret lapicw(PCINT, MASKED); -801024ef: ba 00 00 01 00 mov $0x10000,%edx -801024f4: b8 d0 00 00 00 mov $0xd0,%eax -801024f9: e8 67 fe ff ff call 80102365 -801024fe: e9 70 ff ff ff jmp 80102473 -80102503: c3 ret +80102405: ba 00 00 01 00 mov $0x10000,%edx +8010240a: b8 d0 00 00 00 mov $0xd0,%eax +8010240f: e8 6b fe ff ff call 8010227f +80102414: e9 70 ff ff ff jmp 80102389 +80102419: c3 ret -80102504 : -{ -80102504: f3 0f 1e fb endbr32 +8010241a : if (!lapic) -80102508: a1 9c 52 11 80 mov 0x8011529c,%eax -8010250d: 85 c0 test %eax,%eax -8010250f: 74 07 je 80102518 +8010241a: a1 80 26 11 80 mov 0x80112680,%eax +8010241f: 85 c0 test %eax,%eax +80102421: 74 07 je 8010242a return lapic[ID] >> 24; -80102511: 8b 40 20 mov 0x20(%eax),%eax -80102514: c1 e8 18 shr $0x18,%eax -80102517: c3 ret +80102423: 8b 40 20 mov 0x20(%eax),%eax +80102426: c1 e8 18 shr $0x18,%eax +80102429: c3 ret return 0; -80102518: b8 00 00 00 00 mov $0x0,%eax +8010242a: b8 00 00 00 00 mov $0x0,%eax } -8010251d: c3 ret +8010242f: c3 ret -8010251e : -{ -8010251e: f3 0f 1e fb endbr32 +80102430 : if(lapic) -80102522: 83 3d 9c 52 11 80 00 cmpl $0x0,0x8011529c -80102529: 74 17 je 80102542 +80102430: 83 3d 80 26 11 80 00 cmpl $0x0,0x80112680 +80102437: 74 17 je 80102450 { -8010252b: 55 push %ebp -8010252c: 89 e5 mov %esp,%ebp -8010252e: 83 ec 08 sub $0x8,%esp +80102439: 55 push %ebp +8010243a: 89 e5 mov %esp,%ebp +8010243c: 83 ec 08 sub $0x8,%esp lapicw(EOI, 0); -80102531: ba 00 00 00 00 mov $0x0,%edx -80102536: b8 2c 00 00 00 mov $0x2c,%eax -8010253b: e8 25 fe ff ff call 80102365 +8010243f: ba 00 00 00 00 mov $0x0,%edx +80102444: b8 2c 00 00 00 mov $0x2c,%eax +80102449: e8 31 fe ff ff call 8010227f } -80102540: c9 leave -80102541: c3 ret -80102542: c3 ret +8010244e: c9 leave +8010244f: c3 ret +80102450: c3 ret -80102543 : -{ -80102543: f3 0f 1e fb endbr32 +80102451 : } -80102547: c3 ret +80102451: c3 ret -80102548 : +80102452 : { -80102548: f3 0f 1e fb endbr32 -8010254c: 55 push %ebp -8010254d: 89 e5 mov %esp,%ebp -8010254f: 56 push %esi -80102550: 53 push %ebx -80102551: 8b 75 08 mov 0x8(%ebp),%esi -80102554: 8b 5d 0c mov 0xc(%ebp),%ebx +80102452: 55 push %ebp +80102453: 89 e5 mov %esp,%ebp +80102455: 56 push %esi +80102456: 53 push %ebx +80102457: 8b 75 08 mov 0x8(%ebp),%esi +8010245a: 8b 5d 0c mov 0xc(%ebp),%ebx asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80102557: b8 0f 00 00 00 mov $0xf,%eax -8010255c: ba 70 00 00 00 mov $0x70,%edx -80102561: ee out %al,(%dx) -80102562: b8 0a 00 00 00 mov $0xa,%eax -80102567: ba 71 00 00 00 mov $0x71,%edx -8010256c: ee out %al,(%dx) +8010245d: b8 0f 00 00 00 mov $0xf,%eax +80102462: ba 70 00 00 00 mov $0x70,%edx +80102467: ee out %al,(%dx) +80102468: b8 0a 00 00 00 mov $0xa,%eax +8010246d: ba 71 00 00 00 mov $0x71,%edx +80102472: ee out %al,(%dx) wrv[0] = 0; -8010256d: 66 c7 05 67 04 00 80 movw $0x0,0x80000467 -80102574: 00 00 +80102473: 66 c7 05 67 04 00 80 movw $0x0,0x80000467 +8010247a: 00 00 wrv[1] = addr >> 4; -80102576: 89 d8 mov %ebx,%eax -80102578: c1 e8 04 shr $0x4,%eax -8010257b: 66 a3 69 04 00 80 mov %ax,0x80000469 +8010247c: 89 d8 mov %ebx,%eax +8010247e: c1 e8 04 shr $0x4,%eax +80102481: 66 a3 69 04 00 80 mov %ax,0x80000469 lapicw(ICRHI, apicid<<24); -80102581: c1 e6 18 shl $0x18,%esi -80102584: 89 f2 mov %esi,%edx -80102586: b8 c4 00 00 00 mov $0xc4,%eax -8010258b: e8 d5 fd ff ff call 80102365 +80102487: c1 e6 18 shl $0x18,%esi +8010248a: 89 f2 mov %esi,%edx +8010248c: b8 c4 00 00 00 mov $0xc4,%eax +80102491: e8 e9 fd ff ff call 8010227f lapicw(ICRLO, INIT | LEVEL | ASSERT); -80102590: ba 00 c5 00 00 mov $0xc500,%edx -80102595: b8 c0 00 00 00 mov $0xc0,%eax -8010259a: e8 c6 fd ff ff call 80102365 +80102496: ba 00 c5 00 00 mov $0xc500,%edx +8010249b: b8 c0 00 00 00 mov $0xc0,%eax +801024a0: e8 da fd ff ff call 8010227f lapicw(ICRLO, INIT | LEVEL); -8010259f: ba 00 85 00 00 mov $0x8500,%edx -801025a4: b8 c0 00 00 00 mov $0xc0,%eax -801025a9: e8 b7 fd ff ff call 80102365 +801024a5: ba 00 85 00 00 mov $0x8500,%edx +801024aa: b8 c0 00 00 00 mov $0xc0,%eax +801024af: e8 cb fd ff ff call 8010227f lapicw(ICRLO, STARTUP | (addr>>12)); -801025ae: c1 eb 0c shr $0xc,%ebx -801025b1: 80 cf 06 or $0x6,%bh +801024b4: c1 eb 0c shr $0xc,%ebx +801024b7: 80 cf 06 or $0x6,%bh lapicw(ICRHI, apicid<<24); -801025b4: 89 f2 mov %esi,%edx -801025b6: b8 c4 00 00 00 mov $0xc4,%eax -801025bb: e8 a5 fd ff ff call 80102365 +801024ba: 89 f2 mov %esi,%edx +801024bc: b8 c4 00 00 00 mov $0xc4,%eax +801024c1: e8 b9 fd ff ff call 8010227f lapicw(ICRLO, STARTUP | (addr>>12)); -801025c0: 89 da mov %ebx,%edx -801025c2: b8 c0 00 00 00 mov $0xc0,%eax -801025c7: e8 99 fd ff ff call 80102365 +801024c6: 89 da mov %ebx,%edx +801024c8: b8 c0 00 00 00 mov $0xc0,%eax +801024cd: e8 ad fd ff ff call 8010227f lapicw(ICRHI, apicid<<24); -801025cc: 89 f2 mov %esi,%edx -801025ce: b8 c4 00 00 00 mov $0xc4,%eax -801025d3: e8 8d fd ff ff call 80102365 +801024d2: 89 f2 mov %esi,%edx +801024d4: b8 c4 00 00 00 mov $0xc4,%eax +801024d9: e8 a1 fd ff ff call 8010227f lapicw(ICRLO, STARTUP | (addr>>12)); -801025d8: 89 da mov %ebx,%edx -801025da: b8 c0 00 00 00 mov $0xc0,%eax -801025df: e8 81 fd ff ff call 80102365 +801024de: 89 da mov %ebx,%edx +801024e0: b8 c0 00 00 00 mov $0xc0,%eax +801024e5: e8 95 fd ff ff call 8010227f } -801025e4: 5b pop %ebx -801025e5: 5e pop %esi -801025e6: 5d pop %ebp -801025e7: c3 ret +801024ea: 5b pop %ebx +801024eb: 5e pop %esi +801024ec: 5d pop %ebp +801024ed: c3 ret -801025e8 : +801024ee : // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { -801025e8: f3 0f 1e fb endbr32 -801025ec: 55 push %ebp -801025ed: 89 e5 mov %esp,%ebp -801025ef: 57 push %edi -801025f0: 56 push %esi -801025f1: 53 push %ebx -801025f2: 83 ec 4c sub $0x4c,%esp -801025f5: b8 0b 00 00 00 mov $0xb,%eax -801025fa: ba 70 00 00 00 mov $0x70,%edx -801025ff: ee out %al,(%dx) +801024ee: 55 push %ebp +801024ef: 89 e5 mov %esp,%ebp +801024f1: 57 push %edi +801024f2: 56 push %esi +801024f3: 53 push %ebx +801024f4: 83 ec 4c sub $0x4c,%esp +801024f7: b8 0b 00 00 00 mov $0xb,%eax +801024fc: ba 70 00 00 00 mov $0x70,%edx +80102501: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80102600: ba 71 00 00 00 mov $0x71,%edx -80102605: ec in (%dx),%al +80102502: ba 71 00 00 00 mov $0x71,%edx +80102507: ec in (%dx),%al struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); bcd = (sb & (1 << 2)) == 0; -80102606: 83 e0 04 and $0x4,%eax -80102609: 88 45 b7 mov %al,-0x49(%ebp) +80102508: 83 e0 04 and $0x4,%eax +8010250b: 88 45 b7 mov %al,-0x49(%ebp) // make sure CMOS doesn't modify time while we read it for(;;) { fill_rtcdate(&t1); -8010260c: 8d 75 d0 lea -0x30(%ebp),%esi +8010250e: 8d 75 d0 lea -0x30(%ebp),%esi asm volatile("out %0,%1" : : "a" (data), "d" (port)); -8010260f: bf 0a 00 00 00 mov $0xa,%edi -80102614: 89 f0 mov %esi,%eax -80102616: e8 5e fd ff ff call 80102379 -8010261b: ba 70 00 00 00 mov $0x70,%edx -80102620: 89 f8 mov %edi,%eax -80102622: ee out %al,(%dx) +80102511: bf 0a 00 00 00 mov $0xa,%edi +80102516: 89 f0 mov %esi,%eax +80102518: e8 76 fd ff ff call 80102293 +8010251d: ba 70 00 00 00 mov $0x70,%edx +80102522: 89 f8 mov %edi,%eax +80102524: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80102623: ba 71 00 00 00 mov $0x71,%edx -80102628: ec in (%dx),%al +80102525: ba 71 00 00 00 mov $0x71,%edx +8010252a: ec in (%dx),%al if(cmos_read(CMOS_STATA) & CMOS_UIP) -80102629: 84 c0 test %al,%al -8010262b: 78 e7 js 80102614 +8010252b: 84 c0 test %al,%al +8010252d: 78 e7 js 80102516 continue; fill_rtcdate(&t2); -8010262d: 8d 5d b8 lea -0x48(%ebp),%ebx -80102630: 89 d8 mov %ebx,%eax -80102632: e8 42 fd ff ff call 80102379 +8010252f: 8d 5d b8 lea -0x48(%ebp),%ebx +80102532: 89 d8 mov %ebx,%eax +80102534: e8 5a fd ff ff call 80102293 if(memcmp(&t1, &t2, sizeof(t1)) == 0) -80102637: 83 ec 04 sub $0x4,%esp -8010263a: 6a 18 push $0x18 -8010263c: 53 push %ebx -8010263d: 56 push %esi -8010263e: e8 53 19 00 00 call 80103f96 -80102643: 83 c4 10 add $0x10,%esp -80102646: 85 c0 test %eax,%eax -80102648: 75 ca jne 80102614 +80102539: 83 ec 04 sub $0x4,%esp +8010253c: 6a 18 push $0x18 +8010253e: 53 push %ebx +8010253f: 56 push %esi +80102540: e8 ad 18 00 00 call 80103df2 +80102545: 83 c4 10 add $0x10,%esp +80102548: 85 c0 test %eax,%eax +8010254a: 75 ca jne 80102516 break; } // convert if(bcd) { -8010264a: 80 7d b7 00 cmpb $0x0,-0x49(%ebp) -8010264e: 75 78 jne 801026c8 +8010254c: 80 7d b7 00 cmpb $0x0,-0x49(%ebp) +80102550: 75 78 jne 801025ca #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); -80102650: 8b 45 d0 mov -0x30(%ebp),%eax -80102653: 89 c2 mov %eax,%edx -80102655: c1 ea 04 shr $0x4,%edx -80102658: 8d 14 92 lea (%edx,%edx,4),%edx -8010265b: 83 e0 0f and $0xf,%eax -8010265e: 8d 04 50 lea (%eax,%edx,2),%eax -80102661: 89 45 d0 mov %eax,-0x30(%ebp) +80102552: 8b 45 d0 mov -0x30(%ebp),%eax +80102555: 89 c2 mov %eax,%edx +80102557: c1 ea 04 shr $0x4,%edx +8010255a: 8d 14 92 lea (%edx,%edx,4),%edx +8010255d: 83 e0 0f and $0xf,%eax +80102560: 8d 04 50 lea (%eax,%edx,2),%eax +80102563: 89 45 d0 mov %eax,-0x30(%ebp) CONV(minute); -80102664: 8b 45 d4 mov -0x2c(%ebp),%eax -80102667: 89 c2 mov %eax,%edx -80102669: c1 ea 04 shr $0x4,%edx -8010266c: 8d 14 92 lea (%edx,%edx,4),%edx -8010266f: 83 e0 0f and $0xf,%eax -80102672: 8d 04 50 lea (%eax,%edx,2),%eax -80102675: 89 45 d4 mov %eax,-0x2c(%ebp) +80102566: 8b 45 d4 mov -0x2c(%ebp),%eax +80102569: 89 c2 mov %eax,%edx +8010256b: c1 ea 04 shr $0x4,%edx +8010256e: 8d 14 92 lea (%edx,%edx,4),%edx +80102571: 83 e0 0f and $0xf,%eax +80102574: 8d 04 50 lea (%eax,%edx,2),%eax +80102577: 89 45 d4 mov %eax,-0x2c(%ebp) CONV(hour ); -80102678: 8b 45 d8 mov -0x28(%ebp),%eax -8010267b: 89 c2 mov %eax,%edx -8010267d: c1 ea 04 shr $0x4,%edx -80102680: 8d 14 92 lea (%edx,%edx,4),%edx -80102683: 83 e0 0f and $0xf,%eax -80102686: 8d 04 50 lea (%eax,%edx,2),%eax -80102689: 89 45 d8 mov %eax,-0x28(%ebp) +8010257a: 8b 45 d8 mov -0x28(%ebp),%eax +8010257d: 89 c2 mov %eax,%edx +8010257f: c1 ea 04 shr $0x4,%edx +80102582: 8d 14 92 lea (%edx,%edx,4),%edx +80102585: 83 e0 0f and $0xf,%eax +80102588: 8d 04 50 lea (%eax,%edx,2),%eax +8010258b: 89 45 d8 mov %eax,-0x28(%ebp) CONV(day ); -8010268c: 8b 45 dc mov -0x24(%ebp),%eax -8010268f: 89 c2 mov %eax,%edx -80102691: c1 ea 04 shr $0x4,%edx -80102694: 8d 14 92 lea (%edx,%edx,4),%edx -80102697: 83 e0 0f and $0xf,%eax -8010269a: 8d 04 50 lea (%eax,%edx,2),%eax -8010269d: 89 45 dc mov %eax,-0x24(%ebp) +8010258e: 8b 45 dc mov -0x24(%ebp),%eax +80102591: 89 c2 mov %eax,%edx +80102593: c1 ea 04 shr $0x4,%edx +80102596: 8d 14 92 lea (%edx,%edx,4),%edx +80102599: 83 e0 0f and $0xf,%eax +8010259c: 8d 04 50 lea (%eax,%edx,2),%eax +8010259f: 89 45 dc mov %eax,-0x24(%ebp) CONV(month ); -801026a0: 8b 45 e0 mov -0x20(%ebp),%eax -801026a3: 89 c2 mov %eax,%edx -801026a5: c1 ea 04 shr $0x4,%edx -801026a8: 8d 14 92 lea (%edx,%edx,4),%edx -801026ab: 83 e0 0f and $0xf,%eax -801026ae: 8d 04 50 lea (%eax,%edx,2),%eax -801026b1: 89 45 e0 mov %eax,-0x20(%ebp) +801025a2: 8b 45 e0 mov -0x20(%ebp),%eax +801025a5: 89 c2 mov %eax,%edx +801025a7: c1 ea 04 shr $0x4,%edx +801025aa: 8d 14 92 lea (%edx,%edx,4),%edx +801025ad: 83 e0 0f and $0xf,%eax +801025b0: 8d 04 50 lea (%eax,%edx,2),%eax +801025b3: 89 45 e0 mov %eax,-0x20(%ebp) CONV(year ); -801026b4: 8b 45 e4 mov -0x1c(%ebp),%eax -801026b7: 89 c2 mov %eax,%edx -801026b9: c1 ea 04 shr $0x4,%edx -801026bc: 8d 14 92 lea (%edx,%edx,4),%edx -801026bf: 83 e0 0f and $0xf,%eax -801026c2: 8d 04 50 lea (%eax,%edx,2),%eax -801026c5: 89 45 e4 mov %eax,-0x1c(%ebp) +801025b6: 8b 45 e4 mov -0x1c(%ebp),%eax +801025b9: 89 c2 mov %eax,%edx +801025bb: c1 ea 04 shr $0x4,%edx +801025be: 8d 14 92 lea (%edx,%edx,4),%edx +801025c1: 83 e0 0f and $0xf,%eax +801025c4: 8d 04 50 lea (%eax,%edx,2),%eax +801025c7: 89 45 e4 mov %eax,-0x1c(%ebp) #undef CONV } *r = t1; -801026c8: 8b 45 d0 mov -0x30(%ebp),%eax -801026cb: 8b 4d 08 mov 0x8(%ebp),%ecx -801026ce: 89 01 mov %eax,(%ecx) -801026d0: 8b 45 d4 mov -0x2c(%ebp),%eax -801026d3: 89 41 04 mov %eax,0x4(%ecx) -801026d6: 8b 45 d8 mov -0x28(%ebp),%eax -801026d9: 89 41 08 mov %eax,0x8(%ecx) -801026dc: 8b 45 dc mov -0x24(%ebp),%eax -801026df: 89 41 0c mov %eax,0xc(%ecx) -801026e2: 8b 45 e0 mov -0x20(%ebp),%eax -801026e5: 89 41 10 mov %eax,0x10(%ecx) -801026e8: 8b 45 e4 mov -0x1c(%ebp),%eax -801026eb: 89 41 14 mov %eax,0x14(%ecx) +801025ca: 8b 45 d0 mov -0x30(%ebp),%eax +801025cd: 8b 4d 08 mov 0x8(%ebp),%ecx +801025d0: 89 01 mov %eax,(%ecx) +801025d2: 8b 45 d4 mov -0x2c(%ebp),%eax +801025d5: 89 41 04 mov %eax,0x4(%ecx) +801025d8: 8b 45 d8 mov -0x28(%ebp),%eax +801025db: 89 41 08 mov %eax,0x8(%ecx) +801025de: 8b 45 dc mov -0x24(%ebp),%eax +801025e1: 89 41 0c mov %eax,0xc(%ecx) +801025e4: 8b 45 e0 mov -0x20(%ebp),%eax +801025e7: 89 41 10 mov %eax,0x10(%ecx) +801025ea: 8b 45 e4 mov -0x1c(%ebp),%eax +801025ed: 89 41 14 mov %eax,0x14(%ecx) r->year += 2000; -801026ee: 81 41 14 d0 07 00 00 addl $0x7d0,0x14(%ecx) +801025f0: 81 41 14 d0 07 00 00 addl $0x7d0,0x14(%ecx) } -801026f5: 8d 65 f4 lea -0xc(%ebp),%esp -801026f8: 5b pop %ebx -801026f9: 5e pop %esi -801026fa: 5f pop %edi -801026fb: 5d pop %ebp -801026fc: c3 ret +801025f7: 8d 65 f4 lea -0xc(%ebp),%esp +801025fa: 5b pop %ebx +801025fb: 5e pop %esi +801025fc: 5f pop %edi +801025fd: 5d pop %ebp +801025fe: c3 ret -801026fd : +801025ff : static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { -801026fd: 83 3d e8 52 11 80 00 cmpl $0x0,0x801152e8 -80102704: 0f 8e 84 00 00 00 jle 8010278e -{ -8010270a: 55 push %ebp -8010270b: 89 e5 mov %esp,%ebp -8010270d: 57 push %edi -8010270e: 56 push %esi -8010270f: 53 push %ebx -80102710: 83 ec 1c sub $0x1c,%esp +801025ff: 83 3d e8 26 11 80 00 cmpl $0x0,0x801126e8 +80102606: 0f 8e 84 00 00 00 jle 80102690 +{ +8010260c: 55 push %ebp +8010260d: 89 e5 mov %esp,%ebp +8010260f: 57 push %edi +80102610: 56 push %esi +80102611: 53 push %ebx +80102612: 83 ec 1c sub $0x1c,%esp for (tail = 0; tail < log.lh.n; tail++) { -80102713: be 00 00 00 00 mov $0x0,%esi +80102615: be 00 00 00 00 mov $0x0,%esi struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block -80102718: bf a0 52 11 80 mov $0x801152a0,%edi -8010271d: 83 ec 08 sub $0x8,%esp -80102720: 89 f0 mov %esi,%eax -80102722: 03 47 34 add 0x34(%edi),%eax -80102725: 83 c0 01 add $0x1,%eax -80102728: 50 push %eax -80102729: ff 77 44 pushl 0x44(%edi) -8010272c: e8 7d d9 ff ff call 801000ae -80102731: 89 45 e4 mov %eax,-0x1c(%ebp) +8010261a: bf a0 26 11 80 mov $0x801126a0,%edi +8010261f: 83 ec 08 sub $0x8,%esp +80102622: 89 f0 mov %esi,%eax +80102624: 03 47 34 add 0x34(%edi),%eax +80102627: 83 c0 01 add $0x1,%eax +8010262a: 50 push %eax +8010262b: ff 77 44 push 0x44(%edi) +8010262e: e8 77 da ff ff call 801000aa +80102633: 89 45 e4 mov %eax,-0x1c(%ebp) struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst -80102734: 83 c4 08 add $0x8,%esp -80102737: ff 34 b5 ec 52 11 80 pushl -0x7feead14(,%esi,4) -8010273e: ff 77 44 pushl 0x44(%edi) -80102741: e8 68 d9 ff ff call 801000ae -80102746: 89 c3 mov %eax,%ebx +80102636: 83 c4 08 add $0x8,%esp +80102639: ff 34 b5 ec 26 11 80 push -0x7feed914(,%esi,4) +80102640: ff 77 44 push 0x44(%edi) +80102643: e8 62 da ff ff call 801000aa +80102648: 89 c3 mov %eax,%ebx memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst -80102748: 83 c4 0c add $0xc,%esp -8010274b: 68 00 02 00 00 push $0x200 -80102750: 8b 45 e4 mov -0x1c(%ebp),%eax -80102753: 83 c0 5c add $0x5c,%eax -80102756: 50 push %eax -80102757: 8d 43 5c lea 0x5c(%ebx),%eax -8010275a: 50 push %eax -8010275b: e8 7c 18 00 00 call 80103fdc +8010264a: 83 c4 0c add $0xc,%esp +8010264d: 68 00 02 00 00 push $0x200 +80102652: 8b 45 e4 mov -0x1c(%ebp),%eax +80102655: 83 c0 5c add $0x5c,%eax +80102658: 50 push %eax +80102659: 8d 43 5c lea 0x5c(%ebx),%eax +8010265c: 50 push %eax +8010265d: e8 d2 17 00 00 call 80103e34 bwrite(dbuf); // write dst to disk -80102760: 89 1c 24 mov %ebx,(%esp) -80102763: e8 26 da ff ff call 8010018e +80102662: 89 1c 24 mov %ebx,(%esp) +80102665: e8 1c db ff ff call 80100186 brelse(lbuf); -80102768: 83 c4 04 add $0x4,%esp -8010276b: ff 75 e4 pushl -0x1c(%ebp) -8010276e: e8 5a da ff ff call 801001cd +8010266a: 83 c4 04 add $0x4,%esp +8010266d: ff 75 e4 push -0x1c(%ebp) +80102670: e8 4c db ff ff call 801001c1 brelse(dbuf); -80102773: 89 1c 24 mov %ebx,(%esp) -80102776: e8 52 da ff ff call 801001cd +80102675: 89 1c 24 mov %ebx,(%esp) +80102678: e8 44 db ff ff call 801001c1 for (tail = 0; tail < log.lh.n; tail++) { -8010277b: 83 c6 01 add $0x1,%esi -8010277e: 83 c4 10 add $0x10,%esp -80102781: 39 77 48 cmp %esi,0x48(%edi) -80102784: 7f 97 jg 8010271d +8010267d: 83 c6 01 add $0x1,%esi +80102680: 83 c4 10 add $0x10,%esp +80102683: 39 77 48 cmp %esi,0x48(%edi) +80102686: 7f 97 jg 8010261f } } -80102786: 8d 65 f4 lea -0xc(%ebp),%esp -80102789: 5b pop %ebx -8010278a: 5e pop %esi -8010278b: 5f pop %edi -8010278c: 5d pop %ebp -8010278d: c3 ret -8010278e: c3 ret +80102688: 8d 65 f4 lea -0xc(%ebp),%esp +8010268b: 5b pop %ebx +8010268c: 5e pop %esi +8010268d: 5f pop %edi +8010268e: 5d pop %ebp +8010268f: c3 ret +80102690: c3 ret -8010278f : +80102691 : // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { -8010278f: 55 push %ebp -80102790: 89 e5 mov %esp,%ebp -80102792: 53 push %ebx -80102793: 83 ec 0c sub $0xc,%esp +80102691: 55 push %ebp +80102692: 89 e5 mov %esp,%ebp +80102694: 53 push %ebx +80102695: 83 ec 0c sub $0xc,%esp struct buf *buf = bread(log.dev, log.start); -80102796: ff 35 d4 52 11 80 pushl 0x801152d4 -8010279c: ff 35 e4 52 11 80 pushl 0x801152e4 -801027a2: e8 07 d9 ff ff call 801000ae -801027a7: 89 c3 mov %eax,%ebx +80102698: ff 35 d4 26 11 80 push 0x801126d4 +8010269e: ff 35 e4 26 11 80 push 0x801126e4 +801026a4: e8 01 da ff ff call 801000aa +801026a9: 89 c3 mov %eax,%ebx struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; -801027a9: 8b 0d e8 52 11 80 mov 0x801152e8,%ecx -801027af: 89 48 5c mov %ecx,0x5c(%eax) +801026ab: 8b 0d e8 26 11 80 mov 0x801126e8,%ecx +801026b1: 89 48 5c mov %ecx,0x5c(%eax) for (i = 0; i < log.lh.n; i++) { -801027b2: 83 c4 10 add $0x10,%esp -801027b5: 85 c9 test %ecx,%ecx -801027b7: 7e 17 jle 801027d0 -801027b9: b8 00 00 00 00 mov $0x0,%eax +801026b4: 83 c4 10 add $0x10,%esp +801026b7: 85 c9 test %ecx,%ecx +801026b9: 7e 17 jle 801026d2 +801026bb: b8 00 00 00 00 mov $0x0,%eax hb->block[i] = log.lh.block[i]; -801027be: 8b 14 85 ec 52 11 80 mov -0x7feead14(,%eax,4),%edx -801027c5: 89 54 83 60 mov %edx,0x60(%ebx,%eax,4) +801026c0: 8b 14 85 ec 26 11 80 mov -0x7feed914(,%eax,4),%edx +801026c7: 89 54 83 60 mov %edx,0x60(%ebx,%eax,4) for (i = 0; i < log.lh.n; i++) { -801027c9: 83 c0 01 add $0x1,%eax -801027cc: 39 c1 cmp %eax,%ecx -801027ce: 75 ee jne 801027be +801026cb: 83 c0 01 add $0x1,%eax +801026ce: 39 c1 cmp %eax,%ecx +801026d0: 75 ee jne 801026c0 } bwrite(buf); -801027d0: 83 ec 0c sub $0xc,%esp -801027d3: 53 push %ebx -801027d4: e8 b5 d9 ff ff call 8010018e +801026d2: 83 ec 0c sub $0xc,%esp +801026d5: 53 push %ebx +801026d6: e8 ab da ff ff call 80100186 brelse(buf); -801027d9: 89 1c 24 mov %ebx,(%esp) -801027dc: e8 ec d9 ff ff call 801001cd -} -801027e1: 83 c4 10 add $0x10,%esp -801027e4: 8b 5d fc mov -0x4(%ebp),%ebx -801027e7: c9 leave -801027e8: c3 ret - -801027e9 : -{ -801027e9: f3 0f 1e fb endbr32 -801027ed: 55 push %ebp -801027ee: 89 e5 mov %esp,%ebp -801027f0: 53 push %ebx -801027f1: 83 ec 2c sub $0x2c,%esp -801027f4: 8b 5d 08 mov 0x8(%ebp),%ebx +801026db: 89 1c 24 mov %ebx,(%esp) +801026de: e8 de da ff ff call 801001c1 +} +801026e3: 83 c4 10 add $0x10,%esp +801026e6: 8b 5d fc mov -0x4(%ebp),%ebx +801026e9: c9 leave +801026ea: c3 ret + +801026eb : +{ +801026eb: 55 push %ebp +801026ec: 89 e5 mov %esp,%ebp +801026ee: 53 push %ebx +801026ef: 83 ec 2c sub $0x2c,%esp +801026f2: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&log.lock, "log"); -801027f7: 68 20 7d 10 80 push $0x80107d20 -801027fc: 68 a0 52 11 80 push $0x801152a0 -80102801: e8 37 15 00 00 call 80103d3d +801026f5: 68 40 7a 10 80 push $0x80107a40 +801026fa: 68 a0 26 11 80 push $0x801126a0 +801026ff: e8 b4 14 00 00 call 80103bb8 readsb(dev, &sb); -80102806: 83 c4 08 add $0x8,%esp -80102809: 8d 45 dc lea -0x24(%ebp),%eax -8010280c: 50 push %eax -8010280d: 53 push %ebx -8010280e: e8 f1 ea ff ff call 80101304 +80102704: 83 c4 08 add $0x8,%esp +80102707: 8d 45 dc lea -0x24(%ebp),%eax +8010270a: 50 push %eax +8010270b: 53 push %ebx +8010270c: e8 8e eb ff ff call 8010129f log.start = sb.logstart; -80102813: 8b 45 ec mov -0x14(%ebp),%eax -80102816: a3 d4 52 11 80 mov %eax,0x801152d4 +80102711: 8b 45 ec mov -0x14(%ebp),%eax +80102714: a3 d4 26 11 80 mov %eax,0x801126d4 log.size = sb.nlog; -8010281b: 8b 55 e8 mov -0x18(%ebp),%edx -8010281e: 89 15 d8 52 11 80 mov %edx,0x801152d8 +80102719: 8b 55 e8 mov -0x18(%ebp),%edx +8010271c: 89 15 d8 26 11 80 mov %edx,0x801126d8 log.dev = dev; -80102824: 89 1d e4 52 11 80 mov %ebx,0x801152e4 +80102722: 89 1d e4 26 11 80 mov %ebx,0x801126e4 struct buf *buf = bread(log.dev, log.start); -8010282a: 83 c4 08 add $0x8,%esp -8010282d: 50 push %eax -8010282e: 53 push %ebx -8010282f: e8 7a d8 ff ff call 801000ae +80102728: 83 c4 08 add $0x8,%esp +8010272b: 50 push %eax +8010272c: 53 push %ebx +8010272d: e8 78 d9 ff ff call 801000aa log.lh.n = lh->n; -80102834: 8b 48 5c mov 0x5c(%eax),%ecx -80102837: 89 0d e8 52 11 80 mov %ecx,0x801152e8 +80102732: 8b 58 5c mov 0x5c(%eax),%ebx +80102735: 89 1d e8 26 11 80 mov %ebx,0x801126e8 for (i = 0; i < log.lh.n; i++) { -8010283d: 83 c4 10 add $0x10,%esp -80102840: 85 c9 test %ecx,%ecx -80102842: 7e 17 jle 8010285b -80102844: ba 00 00 00 00 mov $0x0,%edx +8010273b: 83 c4 10 add $0x10,%esp +8010273e: 85 db test %ebx,%ebx +80102740: 7e 17 jle 80102759 +80102742: ba 00 00 00 00 mov $0x0,%edx log.lh.block[i] = lh->block[i]; -80102849: 8b 5c 90 60 mov 0x60(%eax,%edx,4),%ebx -8010284d: 89 1c 95 ec 52 11 80 mov %ebx,-0x7feead14(,%edx,4) +80102747: 8b 4c 90 60 mov 0x60(%eax,%edx,4),%ecx +8010274b: 89 0c 95 ec 26 11 80 mov %ecx,-0x7feed914(,%edx,4) for (i = 0; i < log.lh.n; i++) { -80102854: 83 c2 01 add $0x1,%edx -80102857: 39 d1 cmp %edx,%ecx -80102859: 75 ee jne 80102849 +80102752: 83 c2 01 add $0x1,%edx +80102755: 39 d3 cmp %edx,%ebx +80102757: 75 ee jne 80102747 brelse(buf); -8010285b: 83 ec 0c sub $0xc,%esp -8010285e: 50 push %eax -8010285f: e8 69 d9 ff ff call 801001cd +80102759: 83 ec 0c sub $0xc,%esp +8010275c: 50 push %eax +8010275d: e8 5f da ff ff call 801001c1 static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk -80102864: e8 94 fe ff ff call 801026fd +80102762: e8 98 fe ff ff call 801025ff log.lh.n = 0; -80102869: c7 05 e8 52 11 80 00 movl $0x0,0x801152e8 -80102870: 00 00 00 +80102767: c7 05 e8 26 11 80 00 movl $0x0,0x801126e8 +8010276e: 00 00 00 write_head(); // clear the log -80102873: e8 17 ff ff ff call 8010278f +80102771: e8 1b ff ff ff call 80102691 } -80102878: 83 c4 10 add $0x10,%esp -8010287b: 8b 5d fc mov -0x4(%ebp),%ebx -8010287e: c9 leave -8010287f: c3 ret +80102776: 83 c4 10 add $0x10,%esp +80102779: 8b 5d fc mov -0x4(%ebp),%ebx +8010277c: c9 leave +8010277d: c3 ret -80102880 : +8010277e : } // called at the start of each FS system call. void begin_op(void) { -80102880: f3 0f 1e fb endbr32 -80102884: 55 push %ebp -80102885: 89 e5 mov %esp,%ebp -80102887: 53 push %ebx -80102888: 83 ec 10 sub $0x10,%esp +8010277e: 55 push %ebp +8010277f: 89 e5 mov %esp,%ebp +80102781: 53 push %ebx +80102782: 83 ec 10 sub $0x10,%esp acquire(&log.lock); -8010288b: 68 a0 52 11 80 push $0x801152a0 -80102890: e8 04 16 00 00 call 80103e99 -80102895: 83 c4 10 add $0x10,%esp +80102785: 68 a0 26 11 80 push $0x801126a0 +8010278a: e8 72 15 00 00 call 80103d01 +8010278f: 83 c4 10 add $0x10,%esp while(1){ if(log.committing){ -80102898: bb a0 52 11 80 mov $0x801152a0,%ebx -8010289d: eb 15 jmp 801028b4 +80102792: bb a0 26 11 80 mov $0x801126a0,%ebx +80102797: eb 15 jmp 801027ae sleep(&log, &log.lock); -8010289f: 83 ec 08 sub $0x8,%esp -801028a2: 68 a0 52 11 80 push $0x801152a0 -801028a7: 68 a0 52 11 80 push $0x801152a0 -801028ac: e8 03 10 00 00 call 801038b4 -801028b1: 83 c4 10 add $0x10,%esp +80102799: 83 ec 08 sub $0x8,%esp +8010279c: 68 a0 26 11 80 push $0x801126a0 +801027a1: 68 a0 26 11 80 push $0x801126a0 +801027a6: e8 ae 0f 00 00 call 80103759 +801027ab: 83 c4 10 add $0x10,%esp if(log.committing){ -801028b4: 83 7b 40 00 cmpl $0x0,0x40(%ebx) -801028b8: 75 e5 jne 8010289f +801027ae: 83 7b 40 00 cmpl $0x0,0x40(%ebx) +801027b2: 75 e5 jne 80102799 } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ -801028ba: 8b 43 3c mov 0x3c(%ebx),%eax -801028bd: 83 c0 01 add $0x1,%eax -801028c0: 8d 0c 80 lea (%eax,%eax,4),%ecx -801028c3: 8b 53 48 mov 0x48(%ebx),%edx -801028c6: 8d 14 4a lea (%edx,%ecx,2),%edx -801028c9: 83 fa 1e cmp $0x1e,%edx -801028cc: 7e 17 jle 801028e5 +801027b4: 8b 43 3c mov 0x3c(%ebx),%eax +801027b7: 83 c0 01 add $0x1,%eax +801027ba: 8d 0c 80 lea (%eax,%eax,4),%ecx +801027bd: 8b 53 48 mov 0x48(%ebx),%edx +801027c0: 8d 14 4a lea (%edx,%ecx,2),%edx +801027c3: 83 fa 1e cmp $0x1e,%edx +801027c6: 7e 17 jle 801027df // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); -801028ce: 83 ec 08 sub $0x8,%esp -801028d1: 68 a0 52 11 80 push $0x801152a0 -801028d6: 68 a0 52 11 80 push $0x801152a0 -801028db: e8 d4 0f 00 00 call 801038b4 -801028e0: 83 c4 10 add $0x10,%esp -801028e3: eb cf jmp 801028b4 +801027c8: 83 ec 08 sub $0x8,%esp +801027cb: 68 a0 26 11 80 push $0x801126a0 +801027d0: 68 a0 26 11 80 push $0x801126a0 +801027d5: e8 7f 0f 00 00 call 80103759 +801027da: 83 c4 10 add $0x10,%esp +801027dd: eb cf jmp 801027ae } else { log.outstanding += 1; -801028e5: a3 dc 52 11 80 mov %eax,0x801152dc +801027df: a3 dc 26 11 80 mov %eax,0x801126dc release(&log.lock); -801028ea: 83 ec 0c sub $0xc,%esp -801028ed: 68 a0 52 11 80 push $0x801152a0 -801028f2: e8 0d 16 00 00 call 80103f04 +801027e4: 83 ec 0c sub $0xc,%esp +801027e7: 68 a0 26 11 80 push $0x801126a0 +801027ec: e8 77 15 00 00 call 80103d68 break; } } } -801028f7: 83 c4 10 add $0x10,%esp -801028fa: 8b 5d fc mov -0x4(%ebp),%ebx -801028fd: c9 leave -801028fe: c3 ret +801027f1: 83 c4 10 add $0x10,%esp +801027f4: 8b 5d fc mov -0x4(%ebp),%ebx +801027f7: c9 leave +801027f8: c3 ret -801028ff : +801027f9 : // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { -801028ff: f3 0f 1e fb endbr32 -80102903: 55 push %ebp -80102904: 89 e5 mov %esp,%ebp -80102906: 57 push %edi -80102907: 56 push %esi -80102908: 53 push %ebx -80102909: 83 ec 28 sub $0x28,%esp +801027f9: 55 push %ebp +801027fa: 89 e5 mov %esp,%ebp +801027fc: 57 push %edi +801027fd: 56 push %esi +801027fe: 53 push %ebx +801027ff: 83 ec 28 sub $0x28,%esp int do_commit = 0; acquire(&log.lock); -8010290c: 68 a0 52 11 80 push $0x801152a0 -80102911: e8 83 15 00 00 call 80103e99 +80102802: 68 a0 26 11 80 push $0x801126a0 +80102807: e8 f5 14 00 00 call 80103d01 log.outstanding -= 1; -80102916: a1 dc 52 11 80 mov 0x801152dc,%eax -8010291b: 8d 58 ff lea -0x1(%eax),%ebx -8010291e: 89 1d dc 52 11 80 mov %ebx,0x801152dc +8010280c: a1 dc 26 11 80 mov 0x801126dc,%eax +80102811: 8d 58 ff lea -0x1(%eax),%ebx +80102814: 89 1d dc 26 11 80 mov %ebx,0x801126dc if(log.committing) -80102924: 83 c4 10 add $0x10,%esp -80102927: 83 3d e0 52 11 80 00 cmpl $0x0,0x801152e0 -8010292e: 75 66 jne 80102996 +8010281a: 83 c4 10 add $0x10,%esp +8010281d: 83 3d e0 26 11 80 00 cmpl $0x0,0x801126e0 +80102824: 75 60 jne 80102886 panic("log.committing"); if(log.outstanding == 0){ -80102930: 85 db test %ebx,%ebx -80102932: 75 6f jne 801029a3 +80102826: 85 db test %ebx,%ebx +80102828: 75 69 jne 80102893 do_commit = 1; log.committing = 1; -80102934: c7 05 e0 52 11 80 01 movl $0x1,0x801152e0 -8010293b: 00 00 00 +8010282a: c7 05 e0 26 11 80 01 movl $0x1,0x801126e0 +80102831: 00 00 00 // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); } release(&log.lock); -8010293e: 83 ec 0c sub $0xc,%esp -80102941: 68 a0 52 11 80 push $0x801152a0 -80102946: e8 b9 15 00 00 call 80103f04 +80102834: 83 ec 0c sub $0xc,%esp +80102837: 68 a0 26 11 80 push $0x801126a0 +8010283c: e8 27 15 00 00 call 80103d68 } static void commit() { if (log.lh.n > 0) { -8010294b: 83 c4 10 add $0x10,%esp +80102841: 83 c4 10 add $0x10,%esp struct buf *to = bread(log.dev, log.start+tail+1); // log block -8010294e: bf a0 52 11 80 mov $0x801152a0,%edi +80102844: bf a0 26 11 80 mov $0x801126a0,%edi if (log.lh.n > 0) { -80102953: 83 3d e8 52 11 80 00 cmpl $0x0,0x801152e8 -8010295a: 7f 65 jg 801029c1 +80102849: 83 3d e8 26 11 80 00 cmpl $0x0,0x801126e8 +80102850: 7f 65 jg 801028b7 acquire(&log.lock); -8010295c: 83 ec 0c sub $0xc,%esp -8010295f: 68 a0 52 11 80 push $0x801152a0 -80102964: e8 30 15 00 00 call 80103e99 +80102852: 83 ec 0c sub $0xc,%esp +80102855: 68 a0 26 11 80 push $0x801126a0 +8010285a: e8 a2 14 00 00 call 80103d01 log.committing = 0; -80102969: c7 05 e0 52 11 80 00 movl $0x0,0x801152e0 -80102970: 00 00 00 +8010285f: c7 05 e0 26 11 80 00 movl $0x0,0x801126e0 +80102866: 00 00 00 wakeup(&log); -80102973: c7 04 24 a0 52 11 80 movl $0x801152a0,(%esp) -8010297a: e8 bb 10 00 00 call 80103a3a +80102869: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp) +80102870: e8 62 10 00 00 call 801038d7 release(&log.lock); -8010297f: c7 04 24 a0 52 11 80 movl $0x801152a0,(%esp) -80102986: e8 79 15 00 00 call 80103f04 -8010298b: 83 c4 10 add $0x10,%esp -} -8010298e: 8d 65 f4 lea -0xc(%ebp),%esp -80102991: 5b pop %ebx -80102992: 5e pop %esi -80102993: 5f pop %edi -80102994: 5d pop %ebp -80102995: c3 ret +80102875: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp) +8010287c: e8 e7 14 00 00 call 80103d68 +80102881: 83 c4 10 add $0x10,%esp +} +80102884: eb 29 jmp 801028af panic("log.committing"); -80102996: 83 ec 0c sub $0xc,%esp -80102999: 68 24 7d 10 80 push $0x80107d24 -8010299e: e8 b5 d9 ff ff call 80100358 +80102886: 83 ec 0c sub $0xc,%esp +80102889: 68 44 7a 10 80 push $0x80107a44 +8010288e: e8 ad da ff ff call 80100340 wakeup(&log); -801029a3: 83 ec 0c sub $0xc,%esp -801029a6: 68 a0 52 11 80 push $0x801152a0 -801029ab: e8 8a 10 00 00 call 80103a3a +80102893: 83 ec 0c sub $0xc,%esp +80102896: 68 a0 26 11 80 push $0x801126a0 +8010289b: e8 37 10 00 00 call 801038d7 release(&log.lock); -801029b0: c7 04 24 a0 52 11 80 movl $0x801152a0,(%esp) -801029b7: e8 48 15 00 00 call 80103f04 -801029bc: 83 c4 10 add $0x10,%esp -801029bf: eb cd jmp 8010298e +801028a0: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp) +801028a7: e8 bc 14 00 00 call 80103d68 +801028ac: 83 c4 10 add $0x10,%esp +} +801028af: 8d 65 f4 lea -0xc(%ebp),%esp +801028b2: 5b pop %ebx +801028b3: 5e pop %esi +801028b4: 5f pop %edi +801028b5: 5d pop %ebp +801028b6: c3 ret struct buf *to = bread(log.dev, log.start+tail+1); // log block -801029c1: 83 ec 08 sub $0x8,%esp -801029c4: 89 d8 mov %ebx,%eax -801029c6: 03 47 34 add 0x34(%edi),%eax -801029c9: 83 c0 01 add $0x1,%eax -801029cc: 50 push %eax -801029cd: ff 77 44 pushl 0x44(%edi) -801029d0: e8 d9 d6 ff ff call 801000ae -801029d5: 89 c6 mov %eax,%esi +801028b7: 83 ec 08 sub $0x8,%esp +801028ba: 89 d8 mov %ebx,%eax +801028bc: 03 47 34 add 0x34(%edi),%eax +801028bf: 83 c0 01 add $0x1,%eax +801028c2: 50 push %eax +801028c3: ff 77 44 push 0x44(%edi) +801028c6: e8 df d7 ff ff call 801000aa +801028cb: 89 c6 mov %eax,%esi struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block -801029d7: 83 c4 08 add $0x8,%esp -801029da: ff 34 9d ec 52 11 80 pushl -0x7feead14(,%ebx,4) -801029e1: ff 77 44 pushl 0x44(%edi) -801029e4: e8 c5 d6 ff ff call 801000ae +801028cd: 83 c4 08 add $0x8,%esp +801028d0: ff 34 9d ec 26 11 80 push -0x7feed914(,%ebx,4) +801028d7: ff 77 44 push 0x44(%edi) +801028da: e8 cb d7 ff ff call 801000aa memmove(to->data, from->data, BSIZE); -801029e9: 83 c4 0c add $0xc,%esp -801029ec: 68 00 02 00 00 push $0x200 -801029f1: 89 45 e4 mov %eax,-0x1c(%ebp) -801029f4: 83 c0 5c add $0x5c,%eax -801029f7: 50 push %eax -801029f8: 8d 46 5c lea 0x5c(%esi),%eax -801029fb: 50 push %eax -801029fc: e8 db 15 00 00 call 80103fdc +801028df: 83 c4 0c add $0xc,%esp +801028e2: 68 00 02 00 00 push $0x200 +801028e7: 89 45 e4 mov %eax,-0x1c(%ebp) +801028ea: 83 c0 5c add $0x5c,%eax +801028ed: 50 push %eax +801028ee: 8d 46 5c lea 0x5c(%esi),%eax +801028f1: 50 push %eax +801028f2: e8 3d 15 00 00 call 80103e34 bwrite(to); // write the log -80102a01: 89 34 24 mov %esi,(%esp) -80102a04: e8 85 d7 ff ff call 8010018e +801028f7: 89 34 24 mov %esi,(%esp) +801028fa: e8 87 d8 ff ff call 80100186 brelse(from); -80102a09: 83 c4 04 add $0x4,%esp -80102a0c: ff 75 e4 pushl -0x1c(%ebp) -80102a0f: e8 b9 d7 ff ff call 801001cd +801028ff: 83 c4 04 add $0x4,%esp +80102902: ff 75 e4 push -0x1c(%ebp) +80102905: e8 b7 d8 ff ff call 801001c1 brelse(to); -80102a14: 89 34 24 mov %esi,(%esp) -80102a17: e8 b1 d7 ff ff call 801001cd +8010290a: 89 34 24 mov %esi,(%esp) +8010290d: e8 af d8 ff ff call 801001c1 for (tail = 0; tail < log.lh.n; tail++) { -80102a1c: 83 c3 01 add $0x1,%ebx -80102a1f: 83 c4 10 add $0x10,%esp -80102a22: 3b 5f 48 cmp 0x48(%edi),%ebx -80102a25: 7c 9a jl 801029c1 +80102912: 83 c3 01 add $0x1,%ebx +80102915: 83 c4 10 add $0x10,%esp +80102918: 3b 5f 48 cmp 0x48(%edi),%ebx +8010291b: 7c 9a jl 801028b7 write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit -80102a27: e8 63 fd ff ff call 8010278f +8010291d: e8 6f fd ff ff call 80102691 install_trans(); // Now install writes to home locations -80102a2c: e8 cc fc ff ff call 801026fd +80102922: e8 d8 fc ff ff call 801025ff log.lh.n = 0; -80102a31: c7 05 e8 52 11 80 00 movl $0x0,0x801152e8 -80102a38: 00 00 00 +80102927: c7 05 e8 26 11 80 00 movl $0x0,0x801126e8 +8010292e: 00 00 00 write_head(); // Erase the transaction from the log -80102a3b: e8 4f fd ff ff call 8010278f -80102a40: e9 17 ff ff ff jmp 8010295c +80102931: e8 5b fd ff ff call 80102691 +80102936: e9 17 ff ff ff jmp 80102852 -80102a45 : +8010293b : // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { -80102a45: f3 0f 1e fb endbr32 -80102a49: 55 push %ebp -80102a4a: 89 e5 mov %esp,%ebp -80102a4c: 53 push %ebx -80102a4d: 83 ec 04 sub $0x4,%esp -80102a50: 8b 5d 08 mov 0x8(%ebp),%ebx +8010293b: 55 push %ebp +8010293c: 89 e5 mov %esp,%ebp +8010293e: 53 push %ebx +8010293f: 83 ec 04 sub $0x4,%esp +80102942: 8b 5d 08 mov 0x8(%ebp),%ebx int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) -80102a53: 8b 15 e8 52 11 80 mov 0x801152e8,%edx -80102a59: 83 fa 1d cmp $0x1d,%edx -80102a5c: 7f 5c jg 80102aba -80102a5e: a1 d8 52 11 80 mov 0x801152d8,%eax -80102a63: 83 e8 01 sub $0x1,%eax -80102a66: 39 c2 cmp %eax,%edx -80102a68: 7d 50 jge 80102aba +80102945: 8b 15 e8 26 11 80 mov 0x801126e8,%edx +8010294b: 83 fa 1d cmp $0x1d,%edx +8010294e: 7f 5c jg 801029ac +80102950: a1 d8 26 11 80 mov 0x801126d8,%eax +80102955: 83 e8 01 sub $0x1,%eax +80102958: 39 c2 cmp %eax,%edx +8010295a: 7d 50 jge 801029ac panic("too big a transaction"); if (log.outstanding < 1) -80102a6a: 83 3d dc 52 11 80 00 cmpl $0x0,0x801152dc -80102a71: 7e 54 jle 80102ac7 +8010295c: 83 3d dc 26 11 80 00 cmpl $0x0,0x801126dc +80102963: 7e 54 jle 801029b9 panic("log_write outside of trans"); acquire(&log.lock); -80102a73: 83 ec 0c sub $0xc,%esp -80102a76: 68 a0 52 11 80 push $0x801152a0 -80102a7b: e8 19 14 00 00 call 80103e99 +80102965: 83 ec 0c sub $0xc,%esp +80102968: 68 a0 26 11 80 push $0x801126a0 +8010296d: e8 8f 13 00 00 call 80103d01 for (i = 0; i < log.lh.n; i++) { -80102a80: 8b 15 e8 52 11 80 mov 0x801152e8,%edx -80102a86: 83 c4 10 add $0x10,%esp -80102a89: 85 d2 test %edx,%edx -80102a8b: 7e 47 jle 80102ad4 +80102972: 8b 15 e8 26 11 80 mov 0x801126e8,%edx +80102978: 83 c4 10 add $0x10,%esp +8010297b: 85 d2 test %edx,%edx +8010297d: 7e 47 jle 801029c6 if (log.lh.block[i] == b->blockno) // log absorbtion -80102a8d: 8b 4b 08 mov 0x8(%ebx),%ecx +8010297f: 8b 4b 08 mov 0x8(%ebx),%ecx for (i = 0; i < log.lh.n; i++) { -80102a90: b8 00 00 00 00 mov $0x0,%eax +80102982: b8 00 00 00 00 mov $0x0,%eax if (log.lh.block[i] == b->blockno) // log absorbtion -80102a95: 39 0c 85 ec 52 11 80 cmp %ecx,-0x7feead14(,%eax,4) -80102a9c: 74 3b je 80102ad9 +80102987: 39 0c 85 ec 26 11 80 cmp %ecx,-0x7feed914(,%eax,4) +8010298e: 74 3b je 801029cb for (i = 0; i < log.lh.n; i++) { -80102a9e: 83 c0 01 add $0x1,%eax -80102aa1: 39 d0 cmp %edx,%eax -80102aa3: 75 f0 jne 80102a95 +80102990: 83 c0 01 add $0x1,%eax +80102993: 39 d0 cmp %edx,%eax +80102995: 75 f0 jne 80102987 break; } log.lh.block[i] = b->blockno; -80102aa5: 8b 43 08 mov 0x8(%ebx),%eax -80102aa8: 89 04 95 ec 52 11 80 mov %eax,-0x7feead14(,%edx,4) +80102997: 8b 43 08 mov 0x8(%ebx),%eax +8010299a: 89 04 95 ec 26 11 80 mov %eax,-0x7feed914(,%edx,4) if (i == log.lh.n) log.lh.n++; -80102aaf: 83 c2 01 add $0x1,%edx -80102ab2: 89 15 e8 52 11 80 mov %edx,0x801152e8 -80102ab8: eb 2d jmp 80102ae7 +801029a1: 83 c2 01 add $0x1,%edx +801029a4: 89 15 e8 26 11 80 mov %edx,0x801126e8 +801029aa: eb 2d jmp 801029d9 panic("too big a transaction"); -80102aba: 83 ec 0c sub $0xc,%esp -80102abd: 68 33 7d 10 80 push $0x80107d33 -80102ac2: e8 91 d8 ff ff call 80100358 +801029ac: 83 ec 0c sub $0xc,%esp +801029af: 68 53 7a 10 80 push $0x80107a53 +801029b4: e8 87 d9 ff ff call 80100340 panic("log_write outside of trans"); -80102ac7: 83 ec 0c sub $0xc,%esp -80102aca: 68 49 7d 10 80 push $0x80107d49 -80102acf: e8 84 d8 ff ff call 80100358 +801029b9: 83 ec 0c sub $0xc,%esp +801029bc: 68 69 7a 10 80 push $0x80107a69 +801029c1: e8 7a d9 ff ff call 80100340 for (i = 0; i < log.lh.n; i++) { -80102ad4: b8 00 00 00 00 mov $0x0,%eax +801029c6: b8 00 00 00 00 mov $0x0,%eax log.lh.block[i] = b->blockno; -80102ad9: 8b 4b 08 mov 0x8(%ebx),%ecx -80102adc: 89 0c 85 ec 52 11 80 mov %ecx,-0x7feead14(,%eax,4) +801029cb: 8b 4b 08 mov 0x8(%ebx),%ecx +801029ce: 89 0c 85 ec 26 11 80 mov %ecx,-0x7feed914(,%eax,4) if (i == log.lh.n) -80102ae3: 39 c2 cmp %eax,%edx -80102ae5: 74 18 je 80102aff +801029d5: 39 c2 cmp %eax,%edx +801029d7: 74 15 je 801029ee b->flags |= B_DIRTY; // prevent eviction -80102ae7: 83 0b 04 orl $0x4,(%ebx) +801029d9: 83 0b 04 orl $0x4,(%ebx) release(&log.lock); -80102aea: 83 ec 0c sub $0xc,%esp -80102aed: 68 a0 52 11 80 push $0x801152a0 -80102af2: e8 0d 14 00 00 call 80103f04 +801029dc: 83 ec 0c sub $0xc,%esp +801029df: 68 a0 26 11 80 push $0x801126a0 +801029e4: e8 7f 13 00 00 call 80103d68 } -80102af7: 83 c4 10 add $0x10,%esp -80102afa: 8b 5d fc mov -0x4(%ebp),%ebx -80102afd: c9 leave -80102afe: c3 ret -80102aff: 89 c2 mov %eax,%edx -80102b01: eb ac jmp 80102aaf +801029e9: 8b 5d fc mov -0x4(%ebp),%ebx +801029ec: c9 leave +801029ed: c3 ret +801029ee: 89 c2 mov %eax,%edx +801029f0: eb af jmp 801029a1 -80102b03 : +801029f2 : } // Common CPU setup code. static void mpmain(void) { -80102b03: 55 push %ebp -80102b04: 89 e5 mov %esp,%ebp -80102b06: 53 push %ebx -80102b07: 83 ec 04 sub $0x4,%esp +801029f2: 55 push %ebp +801029f3: 89 e5 mov %esp,%ebp +801029f5: 53 push %ebx +801029f6: 83 ec 04 sub $0x4,%esp cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); -80102b0a: e8 bc 08 00 00 call 801033cb -80102b0f: 89 c3 mov %eax,%ebx -80102b11: e8 b5 08 00 00 call 801033cb -80102b16: 83 ec 04 sub $0x4,%esp -80102b19: 53 push %ebx -80102b1a: 50 push %eax -80102b1b: 68 64 7d 10 80 push $0x80107d64 -80102b20: e8 07 db ff ff call 8010062c +801029f9: e8 97 08 00 00 call 80103295 +801029fe: 89 c3 mov %eax,%ebx +80102a00: e8 90 08 00 00 call 80103295 +80102a05: 83 ec 04 sub $0x4,%esp +80102a08: 53 push %ebx +80102a09: 50 push %eax +80102a0a: 68 84 7a 10 80 push $0x80107a84 +80102a0f: e8 ed db ff ff call 80100601 idtinit(); // load idt register -80102b25: e8 d7 25 00 00 call 80105101 +80102a14: e8 b2 24 00 00 call 80104ecb xchg(&(mycpu()->started), 1); // tell startothers() we're up -80102b2a: e8 37 08 00 00 call 80103366 -80102b2f: 89 c2 mov %eax,%edx +80102a19: e8 18 08 00 00 call 80103236 +80102a1e: 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" : -80102b31: b8 01 00 00 00 mov $0x1,%eax -80102b36: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) +80102a20: b8 01 00 00 00 mov $0x1,%eax +80102a25: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) scheduler(); // start running processes -80102b3d: e8 35 0b 00 00 call 80103677 +80102a2c: e8 fb 0a 00 00 call 8010352c -80102b42 : +80102a31 : { -80102b42: f3 0f 1e fb endbr32 -80102b46: 55 push %ebp -80102b47: 89 e5 mov %esp,%ebp -80102b49: 83 ec 08 sub $0x8,%esp +80102a31: 55 push %ebp +80102a32: 89 e5 mov %esp,%ebp +80102a34: 83 ec 08 sub $0x8,%esp switchkvm(); -80102b4c: e8 80 35 00 00 call 801060d1 +80102a37: e8 45 34 00 00 call 80105e81 seginit(); -80102b51: e8 90 34 00 00 call 80105fe6 +80102a3c: e8 59 33 00 00 call 80105d9a lapicinit(); -80102b56: e8 98 f8 ff ff call 801023f3 +80102a41: e8 c7 f8 ff ff call 8010230d mpmain(); -80102b5b: e8 a3 ff ff ff call 80102b03 - -80102b60
: -{ -80102b60: f3 0f 1e fb endbr32 -80102b64: 8d 4c 24 04 lea 0x4(%esp),%ecx -80102b68: 83 e4 f0 and $0xfffffff0,%esp -80102b6b: ff 71 fc pushl -0x4(%ecx) -80102b6e: 55 push %ebp -80102b6f: 89 e5 mov %esp,%ebp -80102b71: 53 push %ebx -80102b72: 51 push %ecx +80102a46: e8 a7 ff ff ff call 801029f2 + +80102a4b
: +{ +80102a4b: 8d 4c 24 04 lea 0x4(%esp),%ecx +80102a4f: 83 e4 f0 and $0xfffffff0,%esp +80102a52: ff 71 fc push -0x4(%ecx) +80102a55: 55 push %ebp +80102a56: 89 e5 mov %esp,%ebp +80102a58: 53 push %ebx +80102a59: 51 push %ecx kinit1(end, P2V(4*1024*1024)); // phys page allocator -80102b73: 83 ec 08 sub $0x8,%esp -80102b76: 68 00 00 40 80 push $0x80400000 -80102b7b: 68 3c 79 11 80 push $0x8011793c -80102b80: e8 3a f6 ff ff call 801021bf +80102a5a: 83 ec 08 sub $0x8,%esp +80102a5d: 68 00 00 40 80 push $0x80400000 +80102a62: 68 60 79 11 80 push $0x80117960 +80102a67: e8 8c f6 ff ff call 801020f8 kvmalloc(); // kernel page table -80102b85: e8 e6 39 00 00 call 80106570 +80102a6c: e8 8e 38 00 00 call 801062ff mpinit(); // detect other processors -80102b8a: e8 55 01 00 00 call 80102ce4 +80102a71: e8 5d 01 00 00 call 80102bd3 lapicinit(); // interrupt controller -80102b8f: e8 5f f8 ff ff call 801023f3 +80102a76: e8 92 f8 ff ff call 8010230d seginit(); // segment descriptors -80102b94: e8 4d 34 00 00 call 80105fe6 +80102a7b: e8 1a 33 00 00 call 80105d9a picinit(); // disable pic -80102b99: e8 02 03 00 00 call 80102ea0 +80102a80: e8 0b 03 00 00 call 80102d90 ioapicinit(); // another interrupt controller -80102b9e: e8 3e f4 ff ff call 80101fe1 +80102a85: e8 a0 f4 ff ff call 80101f2a consoleinit(); // console hardware -80102ba3: e8 7d dd ff ff call 80100925 +80102a8a: e8 63 de ff ff call 801008f2 uartinit(); // serial port -80102ba8: e8 20 28 00 00 call 801053cd +80102a8f: e8 f2 26 00 00 call 80105186 pinit(); // process table -80102bad: e8 82 07 00 00 call 80103334 +80102a94: e8 6f 07 00 00 call 80103208 tvinit(); // trap vectors -80102bb2: e8 bb 24 00 00 call 80105072 +80102a99: e8 a2 23 00 00 call 80104e40 binit(); // buffer cache -80102bb7: e8 78 d4 ff ff call 80100034 +80102a9e: e8 91 d5 ff ff call 80100034 fileinit(); // file table -80102bbc: e8 f6 e0 ff ff call 80100cb7 +80102aa3: e8 d3 e1 ff ff call 80100c7b ideinit(); // disk -80102bc1: e8 15 f2 ff ff call 80101ddb +80102aa8: e8 83 f2 ff ff call 80101d30 // Write entry code to unused memory at 0x7000. // The linker has placed the image of entryother.S in // _binary_entryother_start. code = P2V(0x7000); memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); -80102bc6: 83 c4 0c add $0xc,%esp -80102bc9: 68 8a 00 00 00 push $0x8a -80102bce: 68 8c b4 10 80 push $0x8010b48c -80102bd3: 68 00 70 00 80 push $0x80007000 -80102bd8: e8 ff 13 00 00 call 80103fdc +80102aad: 83 c4 0c add $0xc,%esp +80102ab0: 68 8a 00 00 00 push $0x8a +80102ab5: 68 8c b4 10 80 push $0x8010b48c +80102aba: 68 00 70 00 80 push $0x80007000 +80102abf: e8 70 13 00 00 call 80103e34 for(c = cpus; c < cpus+ncpu; c++){ -80102bdd: 69 05 20 59 11 80 b0 imul $0xb0,0x80115920,%eax -80102be4: 00 00 00 -80102be7: 05 a0 53 11 80 add $0x801153a0,%eax -80102bec: 83 c4 10 add $0x10,%esp -80102bef: 3d a0 53 11 80 cmp $0x801153a0,%eax -80102bf4: 76 6c jbe 80102c62 -80102bf6: bb a0 53 11 80 mov $0x801153a0,%ebx -80102bfb: eb 5a jmp 80102c57 +80102ac4: 69 05 84 27 11 80 b0 imul $0xb0,0x80112784,%eax +80102acb: 00 00 00 +80102ace: 05 a0 27 11 80 add $0x801127a0,%eax +80102ad3: 83 c4 10 add $0x10,%esp +80102ad6: 3d a0 27 11 80 cmp $0x801127a0,%eax +80102adb: 76 6c jbe 80102b49 +80102add: bb a0 27 11 80 mov $0x801127a0,%ebx +80102ae2: eb 19 jmp 80102afd +80102ae4: 81 c3 b0 00 00 00 add $0xb0,%ebx +80102aea: 69 05 84 27 11 80 b0 imul $0xb0,0x80112784,%eax +80102af1: 00 00 00 +80102af4: 05 a0 27 11 80 add $0x801127a0,%eax +80102af9: 39 c3 cmp %eax,%ebx +80102afb: 73 4c jae 80102b49 + if(c == mycpu()) // We've started already. +80102afd: e8 34 07 00 00 call 80103236 +80102b02: 39 c3 cmp %eax,%ebx +80102b04: 74 de je 80102ae4 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(); -80102bfd: e8 17 f6 ff ff call 80102219 +80102b06: e8 3f f6 ff ff call 8010214a *(void**)(code-4) = stack + KSTACKSIZE; -80102c02: 05 00 10 00 00 add $0x1000,%eax -80102c07: a3 fc 6f 00 80 mov %eax,0x80006ffc +80102b0b: 05 00 10 00 00 add $0x1000,%eax +80102b10: a3 fc 6f 00 80 mov %eax,0x80006ffc *(void(**)(void))(code-8) = mpenter; -80102c0c: c7 05 f8 6f 00 80 42 movl $0x80102b42,0x80006ff8 -80102c13: 2b 10 80 +80102b15: c7 05 f8 6f 00 80 31 movl $0x80102a31,0x80006ff8 +80102b1c: 2a 10 80 *(int**)(code-12) = (void *) V2P(entrypgdir); -80102c16: c7 05 f4 6f 00 80 00 movl $0x10a000,0x80006ff4 -80102c1d: a0 10 00 +80102b1f: c7 05 f4 6f 00 80 00 movl $0x10a000,0x80006ff4 +80102b26: a0 10 00 lapicstartap(c->apicid, V2P(code)); -80102c20: 83 ec 08 sub $0x8,%esp -80102c23: 68 00 70 00 00 push $0x7000 -80102c28: 0f b6 03 movzbl (%ebx),%eax -80102c2b: 50 push %eax -80102c2c: e8 17 f9 ff ff call 80102548 +80102b29: 83 ec 08 sub $0x8,%esp +80102b2c: 68 00 70 00 00 push $0x7000 +80102b31: 0f b6 03 movzbl (%ebx),%eax +80102b34: 50 push %eax +80102b35: e8 18 f9 ff ff call 80102452 // wait for cpu to finish mpmain() while(c->started == 0) -80102c31: 83 c4 10 add $0x10,%esp -80102c34: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax -80102c3a: 85 c0 test %eax,%eax -80102c3c: 74 f6 je 80102c34 - for(c = cpus; c < cpus+ncpu; c++){ -80102c3e: 81 c3 b0 00 00 00 add $0xb0,%ebx -80102c44: 69 05 20 59 11 80 b0 imul $0xb0,0x80115920,%eax -80102c4b: 00 00 00 -80102c4e: 05 a0 53 11 80 add $0x801153a0,%eax -80102c53: 39 c3 cmp %eax,%ebx -80102c55: 73 0b jae 80102c62 - if(c == mycpu()) // We've started already. -80102c57: e8 0a 07 00 00 call 80103366 -80102c5c: 39 c3 cmp %eax,%ebx -80102c5e: 74 de je 80102c3e -80102c60: eb 9b jmp 80102bfd +80102b3a: 83 c4 10 add $0x10,%esp +80102b3d: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax +80102b43: 85 c0 test %eax,%eax +80102b45: 74 f6 je 80102b3d +80102b47: eb 9b jmp 80102ae4 kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() -80102c62: 83 ec 08 sub $0x8,%esp -80102c65: 68 00 00 00 8e push $0x8e000000 -80102c6a: 68 00 00 40 80 push $0x80400000 -80102c6f: e8 81 f5 ff ff call 801021f5 +80102b49: 83 ec 08 sub $0x8,%esp +80102b4c: 68 00 00 00 8e push $0x8e000000 +80102b51: 68 00 00 40 80 push $0x80400000 +80102b56: e8 cf f5 ff ff call 8010212a slabinit(); -80102c74: e8 c3 3e 00 00 call 80106b3c +80102b5b: e8 13 3d 00 00 call 80106873 userinit(); // first user process -80102c79: e8 94 07 00 00 call 80103412 +80102b60: e8 6e 07 00 00 call 801032d3 mpmain(); // finish this processor's setup -80102c7e: e8 80 fe ff ff call 80102b03 +80102b65: e8 88 fe ff ff call 801029f2 -80102c83 : +80102b6a : } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { -80102c83: 55 push %ebp -80102c84: 89 e5 mov %esp,%ebp -80102c86: 57 push %edi -80102c87: 56 push %esi -80102c88: 53 push %ebx -80102c89: 83 ec 0c sub $0xc,%esp +80102b6a: 55 push %ebp +80102b6b: 89 e5 mov %esp,%ebp +80102b6d: 57 push %edi +80102b6e: 56 push %esi +80102b6f: 53 push %ebx +80102b70: 83 ec 0c sub $0xc,%esp uchar *e, *p, *addr; addr = P2V(a); -80102c8c: 8d 98 00 00 00 80 lea -0x80000000(%eax),%ebx +80102b73: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi e = addr+len; -80102c92: 8d 34 13 lea (%ebx,%edx,1),%esi +80102b79: 8d 3c 16 lea (%esi,%edx,1),%edi for(p = addr; p < e; p += sizeof(struct mp)) -80102c95: 39 f3 cmp %esi,%ebx -80102c97: 72 12 jb 80102cab - if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) - return (struct mp*)p; - return 0; -80102c99: bb 00 00 00 00 mov $0x0,%ebx -80102c9e: eb 3a jmp 80102cda +80102b7c: 39 fe cmp %edi,%esi +80102b7e: 73 4c jae 80102bcc +80102b80: 8d 98 10 00 00 80 lea -0x7ffffff0(%eax),%ebx +80102b86: eb 0e jmp 80102b96 if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) -80102ca0: 84 c0 test %al,%al -80102ca2: 74 36 je 80102cda +80102b88: 84 c0 test %al,%al +80102b8a: 74 36 je 80102bc2 for(p = addr; p < e; p += sizeof(struct mp)) -80102ca4: 83 c3 10 add $0x10,%ebx -80102ca7: 39 de cmp %ebx,%esi -80102ca9: 76 2a jbe 80102cd5 +80102b8c: 83 c6 10 add $0x10,%esi +80102b8f: 83 c3 10 add $0x10,%ebx +80102b92: 39 f7 cmp %esi,%edi +80102b94: 76 27 jbe 80102bbd if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) -80102cab: 83 ec 04 sub $0x4,%esp -80102cae: 6a 04 push $0x4 -80102cb0: 68 78 7d 10 80 push $0x80107d78 -80102cb5: 53 push %ebx -80102cb6: e8 db 12 00 00 call 80103f96 -80102cbb: 83 c4 10 add $0x10,%esp -80102cbe: 85 c0 test %eax,%eax -80102cc0: 75 e2 jne 80102ca4 -80102cc2: 89 da mov %ebx,%edx - for(i=0; i +80102ba6: 83 c4 10 add $0x10,%esp +80102ba9: 85 c0 test %eax,%eax +80102bab: 75 df jne 80102b8c +80102bad: 89 f2 mov %esi,%edx sum += addr[i]; -80102cc7: 0f b6 0a movzbl (%edx),%ecx -80102cca: 01 c8 add %ecx,%eax +80102baf: 0f b6 0a movzbl (%edx),%ecx +80102bb2: 01 c8 add %ecx,%eax for(i=0; i -80102cd3: eb cb jmp 80102ca0 +80102bb4: 83 c2 01 add $0x1,%edx +80102bb7: 39 da cmp %ebx,%edx +80102bb9: 75 f4 jne 80102baf +80102bbb: eb cb jmp 80102b88 + return (struct mp*)p; return 0; -80102cd5: bb 00 00 00 00 mov $0x0,%ebx -} -80102cda: 89 d8 mov %ebx,%eax -80102cdc: 8d 65 f4 lea -0xc(%ebp),%esp -80102cdf: 5b pop %ebx -80102ce0: 5e pop %esi -80102ce1: 5f pop %edi -80102ce2: 5d pop %ebp -80102ce3: c3 ret +80102bbd: be 00 00 00 00 mov $0x0,%esi +} +80102bc2: 89 f0 mov %esi,%eax +80102bc4: 8d 65 f4 lea -0xc(%ebp),%esp +80102bc7: 5b pop %ebx +80102bc8: 5e pop %esi +80102bc9: 5f pop %edi +80102bca: 5d pop %ebp +80102bcb: c3 ret + return 0; +80102bcc: be 00 00 00 00 mov $0x0,%esi +80102bd1: eb ef jmp 80102bc2 -80102ce4 : +80102bd3 : return conf; } void mpinit(void) { -80102ce4: f3 0f 1e fb endbr32 -80102ce8: 55 push %ebp -80102ce9: 89 e5 mov %esp,%ebp -80102ceb: 57 push %edi -80102cec: 56 push %esi -80102ced: 53 push %ebx -80102cee: 83 ec 1c sub $0x1c,%esp +80102bd3: 55 push %ebp +80102bd4: 89 e5 mov %esp,%ebp +80102bd6: 57 push %edi +80102bd7: 56 push %esi +80102bd8: 53 push %ebx +80102bd9: 83 ec 1c sub $0x1c,%esp if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ -80102cf1: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax -80102cf8: c1 e0 08 shl $0x8,%eax -80102cfb: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx -80102d02: 09 d0 or %edx,%eax -80102d04: c1 e0 04 shl $0x4,%eax -80102d07: 0f 84 c0 00 00 00 je 80102dcd +80102bdc: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax +80102be3: c1 e0 08 shl $0x8,%eax +80102be6: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx +80102bed: 09 d0 or %edx,%eax +80102bef: c1 e0 04 shl $0x4,%eax +80102bf2: 0f 84 c5 00 00 00 je 80102cbd if((mp = mpsearch1(p, 1024))) -80102d0d: ba 00 04 00 00 mov $0x400,%edx -80102d12: e8 6c ff ff ff call 80102c83 -80102d17: 89 45 e0 mov %eax,-0x20(%ebp) -80102d1a: 85 c0 test %eax,%eax -80102d1c: 75 1a jne 80102d38 +80102bf8: ba 00 04 00 00 mov $0x400,%edx +80102bfd: e8 68 ff ff ff call 80102b6a +80102c02: 89 45 e0 mov %eax,-0x20(%ebp) +80102c05: 85 c0 test %eax,%eax +80102c07: 75 1a jne 80102c23 return mpsearch1(0xF0000, 0x10000); -80102d1e: ba 00 00 01 00 mov $0x10000,%edx -80102d23: b8 00 00 0f 00 mov $0xf0000,%eax -80102d28: e8 56 ff ff ff call 80102c83 -80102d2d: 89 45 e0 mov %eax,-0x20(%ebp) +80102c09: ba 00 00 01 00 mov $0x10000,%edx +80102c0e: b8 00 00 0f 00 mov $0xf0000,%eax +80102c13: e8 52 ff ff ff call 80102b6a +80102c18: 89 45 e0 mov %eax,-0x20(%ebp) if((mp = mpsearch()) == 0 || mp->physaddr == 0) -80102d30: 85 c0 test %eax,%eax -80102d32: 0f 84 5b 01 00 00 je 80102e93 -80102d38: 8b 45 e0 mov -0x20(%ebp),%eax -80102d3b: 8b 70 04 mov 0x4(%eax),%esi -80102d3e: 85 f6 test %esi,%esi -80102d40: 0f 84 4d 01 00 00 je 80102e93 +80102c1b: 85 c0 test %eax,%eax +80102c1d: 0f 84 60 01 00 00 je 80102d83 +80102c23: 8b 45 e0 mov -0x20(%ebp),%eax +80102c26: 8b 70 04 mov 0x4(%eax),%esi +80102c29: 85 f6 test %esi,%esi +80102c2b: 0f 84 52 01 00 00 je 80102d83 conf = (struct mpconf*) P2V((uint) mp->physaddr); -80102d46: 8d be 00 00 00 80 lea -0x80000000(%esi),%edi +80102c31: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax +80102c37: 89 45 e4 mov %eax,-0x1c(%ebp) if(memcmp(conf, "PCMP", 4) != 0) -80102d4c: 83 ec 04 sub $0x4,%esp -80102d4f: 6a 04 push $0x4 -80102d51: 68 7d 7d 10 80 push $0x80107d7d -80102d56: 57 push %edi -80102d57: e8 3a 12 00 00 call 80103f96 -80102d5c: 89 45 e4 mov %eax,-0x1c(%ebp) -80102d5f: 83 c4 10 add $0x10,%esp -80102d62: 85 c0 test %eax,%eax -80102d64: 0f 85 29 01 00 00 jne 80102e93 +80102c3a: 83 ec 04 sub $0x4,%esp +80102c3d: 6a 04 push $0x4 +80102c3f: 68 9d 7a 10 80 push $0x80107a9d +80102c44: 50 push %eax +80102c45: e8 a8 11 00 00 call 80103df2 +80102c4a: 89 c3 mov %eax,%ebx +80102c4c: 83 c4 10 add $0x10,%esp +80102c4f: 85 c0 test %eax,%eax +80102c51: 0f 85 2c 01 00 00 jne 80102d83 if(conf->version != 1 && conf->version != 4) -80102d6a: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax -80102d71: 3c 01 cmp $0x1,%al -80102d73: 74 08 je 80102d7d -80102d75: 3c 04 cmp $0x4,%al -80102d77: 0f 85 16 01 00 00 jne 80102e93 +80102c57: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax +80102c5e: 3c 01 cmp $0x1,%al +80102c60: 74 08 je 80102c6a +80102c62: 3c 04 cmp $0x4,%al +80102c64: 0f 85 19 01 00 00 jne 80102d83 if(sum((uchar*)conf, conf->length) != 0) -80102d7d: 0f b7 96 04 00 00 80 movzwl -0x7ffffffc(%esi),%edx +80102c6a: 0f b7 96 04 00 00 80 movzwl -0x7ffffffc(%esi),%edx for(i=0; i -80102d89: 89 f0 mov %esi,%eax -80102d8b: 0f b7 d2 movzwl %dx,%edx -80102d8e: 8d 1c 32 lea (%edx,%esi,1),%ebx +80102c71: 66 85 d2 test %dx,%dx +80102c74: 74 22 je 80102c98 +80102c76: 89 f0 mov %esi,%eax +80102c78: 0f b7 d2 movzwl %dx,%edx +80102c7b: 8d 3c 32 lea (%edx,%esi,1),%edi sum = 0; -80102d91: 8b 55 e4 mov -0x1c(%ebp),%edx +80102c7e: 89 da mov %ebx,%edx sum += addr[i]; -80102d94: 0f b6 88 00 00 00 80 movzbl -0x80000000(%eax),%ecx -80102d9b: 01 ca add %ecx,%edx +80102c80: 0f b6 88 00 00 00 80 movzbl -0x80000000(%eax),%ecx +80102c87: 01 ca add %ecx,%edx for(i=0; i +80102c89: 83 c0 01 add $0x1,%eax +80102c8c: 39 f8 cmp %edi,%eax +80102c8e: 75 f0 jne 80102c80 if(sum((uchar*)conf, conf->length) != 0) -80102da4: 84 d2 test %dl,%dl -80102da6: 0f 85 e7 00 00 00 jne 80102e93 +80102c90: 84 d2 test %dl,%dl +80102c92: 0f 85 eb 00 00 00 jne 80102d83 struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; -80102dac: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax -80102db2: a3 9c 52 11 80 mov %eax,0x8011529c +80102c98: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax +80102c9e: a3 80 26 11 80 mov %eax,0x80112680 for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; plength; p +80102cbb: eb 40 jmp 80102cfd p = ((bda[0x14]<<8)|bda[0x13])*1024; -80102dcd: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax -80102dd4: c1 e0 08 shl $0x8,%eax -80102dd7: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx -80102dde: 09 d0 or %edx,%eax -80102de0: c1 e0 0a shl $0xa,%eax +80102cbd: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax +80102cc4: c1 e0 08 shl $0x8,%eax +80102cc7: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx +80102cce: 09 d0 or %edx,%eax +80102cd0: c1 e0 0a shl $0xa,%eax if((mp = mpsearch1(p-1024, 1024))) -80102de3: 2d 00 04 00 00 sub $0x400,%eax -80102de8: ba 00 04 00 00 mov $0x400,%edx -80102ded: e8 91 fe ff ff call 80102c83 -80102df2: 89 45 e0 mov %eax,-0x20(%ebp) -80102df5: 85 c0 test %eax,%eax -80102df7: 0f 85 3b ff ff ff jne 80102d38 -80102dfd: e9 1c ff ff ff jmp 80102d1e +80102cd3: 2d 00 04 00 00 sub $0x400,%eax +80102cd8: ba 00 04 00 00 mov $0x400,%edx +80102cdd: e8 88 fe ff ff call 80102b6a +80102ce2: 89 45 e0 mov %eax,-0x20(%ebp) +80102ce5: 85 c0 test %eax,%eax +80102ce7: 0f 85 36 ff ff ff jne 80102c23 +80102ced: e9 17 ff ff ff jmp 80102c09 switch(*p){ -80102e02: 83 e9 03 sub $0x3,%ecx -80102e05: 80 f9 01 cmp $0x1,%cl -80102e08: 76 15 jbe 80102e1f -80102e0a: 8b 75 e4 mov -0x1c(%ebp),%esi +80102cf2: 83 e9 03 sub $0x3,%ecx +80102cf5: 80 f9 01 cmp $0x1,%cl +80102cf8: 76 15 jbe 80102d0f +80102cfa: 8b 75 e4 mov -0x1c(%ebp),%esi for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p +80102cfd: 39 d0 cmp %edx,%eax +80102cff: 73 4b jae 80102d4c switch(*p){ -80102e11: 0f b6 08 movzbl (%eax),%ecx -80102e14: 80 f9 02 cmp $0x2,%cl -80102e17: 74 34 je 80102e4d -80102e19: 77 e7 ja 80102e02 -80102e1b: 84 c9 test %cl,%cl -80102e1d: 74 05 je 80102e24 +80102d01: 0f b6 08 movzbl (%eax),%ecx +80102d04: 80 f9 02 cmp $0x2,%cl +80102d07: 74 34 je 80102d3d +80102d09: 77 e7 ja 80102cf2 +80102d0b: 84 c9 test %cl,%cl +80102d0d: 74 05 je 80102d14 p += sizeof(struct mpioapic); continue; case MPBUS: case MPIOINTR: case MPLINTR: p += 8; -80102e1f: 83 c0 08 add $0x8,%eax +80102d0f: 83 c0 08 add $0x8,%eax continue; -80102e22: eb e9 jmp 80102e0d +80102d12: eb e9 jmp 80102cfd if(ncpu < NCPU) { -80102e24: 8b 0d 20 59 11 80 mov 0x80115920,%ecx -80102e2a: 83 f9 07 cmp $0x7,%ecx -80102e2d: 7f 19 jg 80102e48 +80102d14: 8b 0d 84 27 11 80 mov 0x80112784,%ecx +80102d1a: 83 f9 07 cmp $0x7,%ecx +80102d1d: 7f 19 jg 80102d38 cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu -80102e2f: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi -80102e35: 0f b6 58 01 movzbl 0x1(%eax),%ebx -80102e39: 88 9f a0 53 11 80 mov %bl,-0x7feeac60(%edi) +80102d1f: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi +80102d25: 0f b6 58 01 movzbl 0x1(%eax),%ebx +80102d29: 88 9f a0 27 11 80 mov %bl,-0x7feed860(%edi) ncpu++; -80102e3f: 83 c1 01 add $0x1,%ecx -80102e42: 89 0d 20 59 11 80 mov %ecx,0x80115920 +80102d2f: 83 c1 01 add $0x1,%ecx +80102d32: 89 0d 84 27 11 80 mov %ecx,0x80112784 p += sizeof(struct mpproc); -80102e48: 83 c0 14 add $0x14,%eax +80102d38: 83 c0 14 add $0x14,%eax continue; -80102e4b: eb c0 jmp 80102e0d +80102d3b: eb c0 jmp 80102cfd ioapicid = ioapic->apicno; -80102e4d: 0f b6 48 01 movzbl 0x1(%eax),%ecx -80102e51: 88 0d 80 53 11 80 mov %cl,0x80115380 +80102d3d: 0f b6 48 01 movzbl 0x1(%eax),%ecx +80102d41: 88 0d 80 27 11 80 mov %cl,0x80112780 p += sizeof(struct mpioapic); -80102e57: 83 c0 08 add $0x8,%eax +80102d47: 83 c0 08 add $0x8,%eax continue; -80102e5a: eb b1 jmp 80102e0d +80102d4a: eb b1 jmp 80102cfd default: ismp = 0; break; } } if(!ismp) -80102e5c: 85 f6 test %esi,%esi -80102e5e: 74 26 je 80102e86 +80102d4c: 85 f6 test %esi,%esi +80102d4e: 74 26 je 80102d76 panic("Didn't find a suitable machine"); if(mp->imcrp){ -80102e60: 8b 45 e0 mov -0x20(%ebp),%eax -80102e63: 80 78 0c 00 cmpb $0x0,0xc(%eax) -80102e67: 74 15 je 80102e7e +80102d50: 8b 45 e0 mov -0x20(%ebp),%eax +80102d53: 80 78 0c 00 cmpb $0x0,0xc(%eax) +80102d57: 74 15 je 80102d6e asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80102e69: b8 70 00 00 00 mov $0x70,%eax -80102e6e: ba 22 00 00 00 mov $0x22,%edx -80102e73: ee out %al,(%dx) +80102d59: b8 70 00 00 00 mov $0x70,%eax +80102d5e: ba 22 00 00 00 mov $0x22,%edx +80102d63: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80102e74: ba 23 00 00 00 mov $0x23,%edx -80102e79: ec in (%dx),%al +80102d64: ba 23 00 00 00 mov $0x23,%edx +80102d69: 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. -80102e7a: 83 c8 01 or $0x1,%eax +80102d6a: 83 c8 01 or $0x1,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); -80102e7d: ee out %al,(%dx) +80102d6d: ee out %al,(%dx) } } -80102e7e: 8d 65 f4 lea -0xc(%ebp),%esp -80102e81: 5b pop %ebx -80102e82: 5e pop %esi -80102e83: 5f pop %edi -80102e84: 5d pop %ebp -80102e85: c3 ret +80102d6e: 8d 65 f4 lea -0xc(%ebp),%esp +80102d71: 5b pop %ebx +80102d72: 5e pop %esi +80102d73: 5f pop %edi +80102d74: 5d pop %ebp +80102d75: c3 ret panic("Didn't find a suitable machine"); -80102e86: 83 ec 0c sub $0xc,%esp -80102e89: 68 9c 7d 10 80 push $0x80107d9c -80102e8e: e8 c5 d4 ff ff call 80100358 +80102d76: 83 ec 0c sub $0xc,%esp +80102d79: 68 bc 7a 10 80 push $0x80107abc +80102d7e: e8 bd d5 ff ff call 80100340 panic("Expect to run on an SMP"); -80102e93: 83 ec 0c sub $0xc,%esp -80102e96: 68 82 7d 10 80 push $0x80107d82 -80102e9b: e8 b8 d4 ff ff call 80100358 - -80102ea0 : -#define IO_PIC2 0xA0 // Slave (IRQs 8-15) - -// Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware. -void +80102d83: 83 ec 0c sub $0xc,%esp +80102d86: 68 a2 7a 10 80 push $0x80107aa2 +80102d8b: e8 b0 d5 ff ff call 80100340 + +80102d90 : +80102d90: b8 ff ff ff ff mov $0xffffffff,%eax +80102d95: ba 21 00 00 00 mov $0x21,%edx +80102d9a: ee out %al,(%dx) +80102d9b: ba a1 00 00 00 mov $0xa1,%edx +80102da0: ee out %al,(%dx) picinit(void) { -80102ea0: f3 0f 1e fb endbr32 -80102ea4: b8 ff ff ff ff mov $0xffffffff,%eax -80102ea9: ba 21 00 00 00 mov $0x21,%edx -80102eae: ee out %al,(%dx) -80102eaf: ba a1 00 00 00 mov $0xa1,%edx -80102eb4: ee out %al,(%dx) // mask all interrupts outb(IO_PIC1+1, 0xFF); outb(IO_PIC2+1, 0xFF); } -80102eb5: c3 ret +80102da1: c3 ret -80102eb6 : +80102da2 : int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { -80102eb6: f3 0f 1e fb endbr32 -80102eba: 55 push %ebp -80102ebb: 89 e5 mov %esp,%ebp -80102ebd: 57 push %edi -80102ebe: 56 push %esi -80102ebf: 53 push %ebx -80102ec0: 83 ec 0c sub $0xc,%esp -80102ec3: 8b 5d 08 mov 0x8(%ebp),%ebx -80102ec6: 8b 75 0c mov 0xc(%ebp),%esi +80102da2: 55 push %ebp +80102da3: 89 e5 mov %esp,%ebp +80102da5: 57 push %edi +80102da6: 56 push %esi +80102da7: 53 push %ebx +80102da8: 83 ec 0c sub $0xc,%esp +80102dab: 8b 5d 08 mov 0x8(%ebp),%ebx +80102dae: 8b 75 0c mov 0xc(%ebp),%esi struct pipe *p; p = 0; *f0 = *f1 = 0; -80102ec9: c7 06 00 00 00 00 movl $0x0,(%esi) -80102ecf: c7 03 00 00 00 00 movl $0x0,(%ebx) +80102db1: c7 06 00 00 00 00 movl $0x0,(%esi) +80102db7: c7 03 00 00 00 00 movl $0x0,(%ebx) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) -80102ed5: e8 fb dd ff ff call 80100cd5 -80102eda: 89 03 mov %eax,(%ebx) -80102edc: 85 c0 test %eax,%eax -80102ede: 0f 84 a6 00 00 00 je 80102f8a -80102ee4: e8 ec dd ff ff call 80100cd5 -80102ee9: 89 06 mov %eax,(%esi) -80102eeb: 85 c0 test %eax,%eax -80102eed: 0f 84 85 00 00 00 je 80102f78 +80102dbd: e8 d3 de ff ff call 80100c95 +80102dc2: 89 03 mov %eax,(%ebx) +80102dc4: 85 c0 test %eax,%eax +80102dc6: 0f 84 a6 00 00 00 je 80102e72 +80102dcc: e8 c4 de ff ff call 80100c95 +80102dd1: 89 06 mov %eax,(%esi) +80102dd3: 85 c0 test %eax,%eax +80102dd5: 0f 84 85 00 00 00 je 80102e60 goto bad; if((p = (struct pipe*)kalloc()) == 0) -80102ef3: e8 21 f3 ff ff call 80102219 -80102ef8: 89 c7 mov %eax,%edi -80102efa: 85 c0 test %eax,%eax -80102efc: 74 72 je 80102f70 +80102ddb: e8 6a f3 ff ff call 8010214a +80102de0: 89 c7 mov %eax,%edi +80102de2: 85 c0 test %eax,%eax +80102de4: 74 72 je 80102e58 goto bad; p->readopen = 1; -80102efe: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) -80102f05: 00 00 00 +80102de6: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) +80102ded: 00 00 00 p->writeopen = 1; -80102f08: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) -80102f0f: 00 00 00 +80102df0: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) +80102df7: 00 00 00 p->nwrite = 0; -80102f12: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) -80102f19: 00 00 00 +80102dfa: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) +80102e01: 00 00 00 p->nread = 0; -80102f1c: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) -80102f23: 00 00 00 +80102e04: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) +80102e0b: 00 00 00 initlock(&p->lock, "pipe"); -80102f26: 83 ec 08 sub $0x8,%esp -80102f29: 68 bb 7d 10 80 push $0x80107dbb -80102f2e: 50 push %eax -80102f2f: e8 09 0e 00 00 call 80103d3d +80102e0e: 83 ec 08 sub $0x8,%esp +80102e11: 68 db 7a 10 80 push $0x80107adb +80102e16: 50 push %eax +80102e17: e8 9c 0d 00 00 call 80103bb8 (*f0)->type = FD_PIPE; -80102f34: 8b 03 mov (%ebx),%eax -80102f36: c7 00 01 00 00 00 movl $0x1,(%eax) +80102e1c: 8b 03 mov (%ebx),%eax +80102e1e: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; -80102f3c: 8b 03 mov (%ebx),%eax -80102f3e: c6 40 08 01 movb $0x1,0x8(%eax) +80102e24: 8b 03 mov (%ebx),%eax +80102e26: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; -80102f42: 8b 03 mov (%ebx),%eax -80102f44: c6 40 09 00 movb $0x0,0x9(%eax) +80102e2a: 8b 03 mov (%ebx),%eax +80102e2c: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; -80102f48: 8b 03 mov (%ebx),%eax -80102f4a: 89 78 0c mov %edi,0xc(%eax) +80102e30: 8b 03 mov (%ebx),%eax +80102e32: 89 78 0c mov %edi,0xc(%eax) (*f1)->type = FD_PIPE; -80102f4d: 8b 06 mov (%esi),%eax -80102f4f: c7 00 01 00 00 00 movl $0x1,(%eax) +80102e35: 8b 06 mov (%esi),%eax +80102e37: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; -80102f55: 8b 06 mov (%esi),%eax -80102f57: c6 40 08 00 movb $0x0,0x8(%eax) +80102e3d: 8b 06 mov (%esi),%eax +80102e3f: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; -80102f5b: 8b 06 mov (%esi),%eax -80102f5d: c6 40 09 01 movb $0x1,0x9(%eax) +80102e43: 8b 06 mov (%esi),%eax +80102e45: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; -80102f61: 8b 06 mov (%esi),%eax -80102f63: 89 78 0c mov %edi,0xc(%eax) +80102e49: 8b 06 mov (%esi),%eax +80102e4b: 89 78 0c mov %edi,0xc(%eax) return 0; -80102f66: 83 c4 10 add $0x10,%esp -80102f69: b8 00 00 00 00 mov $0x0,%eax -80102f6e: eb 36 jmp 80102fa6 +80102e4e: 83 c4 10 add $0x10,%esp +80102e51: b8 00 00 00 00 mov $0x0,%eax +80102e56: eb 36 jmp 80102e8e //PAGEBREAK: 20 bad: if(p) kfree((char*)p); if(*f0) -80102f70: 8b 03 mov (%ebx),%eax -80102f72: 85 c0 test %eax,%eax -80102f74: 75 08 jne 80102f7e -80102f76: eb 12 jmp 80102f8a -80102f78: 8b 03 mov (%ebx),%eax -80102f7a: 85 c0 test %eax,%eax -80102f7c: 74 30 je 80102fae +80102e58: 8b 03 mov (%ebx),%eax +80102e5a: 85 c0 test %eax,%eax +80102e5c: 75 08 jne 80102e66 +80102e5e: eb 12 jmp 80102e72 +80102e60: 8b 03 mov (%ebx),%eax +80102e62: 85 c0 test %eax,%eax +80102e64: 74 30 je 80102e96 fileclose(*f0); -80102f7e: 83 ec 0c sub $0xc,%esp -80102f81: 50 push %eax -80102f82: e8 fa dd ff ff call 80100d81 -80102f87: 83 c4 10 add $0x10,%esp +80102e66: 83 ec 0c sub $0xc,%esp +80102e69: 50 push %eax +80102e6a: e8 ca de ff ff call 80100d39 +80102e6f: 83 c4 10 add $0x10,%esp if(*f1) -80102f8a: 8b 16 mov (%esi),%edx +80102e72: 8b 16 mov (%esi),%edx fileclose(*f1); return -1; -80102f8c: b8 ff ff ff ff mov $0xffffffff,%eax +80102e74: b8 ff ff ff ff mov $0xffffffff,%eax if(*f1) -80102f91: 85 d2 test %edx,%edx -80102f93: 74 11 je 80102fa6 +80102e79: 85 d2 test %edx,%edx +80102e7b: 74 11 je 80102e8e fileclose(*f1); -80102f95: 83 ec 0c sub $0xc,%esp -80102f98: 52 push %edx -80102f99: e8 e3 dd ff ff call 80100d81 -80102f9e: 83 c4 10 add $0x10,%esp +80102e7d: 83 ec 0c sub $0xc,%esp +80102e80: 52 push %edx +80102e81: e8 b3 de ff ff call 80100d39 +80102e86: 83 c4 10 add $0x10,%esp return -1; -80102fa1: b8 ff ff ff ff mov $0xffffffff,%eax -} -80102fa6: 8d 65 f4 lea -0xc(%ebp),%esp -80102fa9: 5b pop %ebx -80102faa: 5e pop %esi -80102fab: 5f pop %edi -80102fac: 5d pop %ebp -80102fad: c3 ret +80102e89: b8 ff ff ff ff mov $0xffffffff,%eax +} +80102e8e: 8d 65 f4 lea -0xc(%ebp),%esp +80102e91: 5b pop %ebx +80102e92: 5e pop %esi +80102e93: 5f pop %edi +80102e94: 5d pop %ebp +80102e95: c3 ret return -1; -80102fae: b8 ff ff ff ff mov $0xffffffff,%eax -80102fb3: eb f1 jmp 80102fa6 +80102e96: b8 ff ff ff ff mov $0xffffffff,%eax +80102e9b: eb f1 jmp 80102e8e -80102fb5 : +80102e9d : void pipeclose(struct pipe *p, int writable) { -80102fb5: f3 0f 1e fb endbr32 -80102fb9: 55 push %ebp -80102fba: 89 e5 mov %esp,%ebp -80102fbc: 53 push %ebx -80102fbd: 83 ec 10 sub $0x10,%esp -80102fc0: 8b 5d 08 mov 0x8(%ebp),%ebx +80102e9d: 55 push %ebp +80102e9e: 89 e5 mov %esp,%ebp +80102ea0: 53 push %ebx +80102ea1: 83 ec 10 sub $0x10,%esp +80102ea4: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&p->lock); -80102fc3: 53 push %ebx -80102fc4: e8 d0 0e 00 00 call 80103e99 +80102ea7: 53 push %ebx +80102ea8: e8 54 0e 00 00 call 80103d01 if(writable){ -80102fc9: 83 c4 10 add $0x10,%esp -80102fcc: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) -80102fd0: 74 3f je 80103011 +80102ead: 83 c4 10 add $0x10,%esp +80102eb0: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) +80102eb4: 74 3f je 80102ef5 p->writeopen = 0; -80102fd2: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) -80102fd9: 00 00 00 +80102eb6: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) +80102ebd: 00 00 00 wakeup(&p->nread); -80102fdc: 83 ec 0c sub $0xc,%esp -80102fdf: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax -80102fe5: 50 push %eax -80102fe6: e8 4f 0a 00 00 call 80103a3a -80102feb: 83 c4 10 add $0x10,%esp +80102ec0: 83 ec 0c sub $0xc,%esp +80102ec3: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax +80102ec9: 50 push %eax +80102eca: e8 08 0a 00 00 call 801038d7 +80102ecf: 83 c4 10 add $0x10,%esp } else { p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ -80102fee: 83 bb 3c 02 00 00 00 cmpl $0x0,0x23c(%ebx) -80102ff5: 75 09 jne 80103000 -80102ff7: 83 bb 40 02 00 00 00 cmpl $0x0,0x240(%ebx) -80102ffe: 74 2f je 8010302f +80102ed2: 83 bb 3c 02 00 00 00 cmpl $0x0,0x23c(%ebx) +80102ed9: 75 09 jne 80102ee4 +80102edb: 83 bb 40 02 00 00 00 cmpl $0x0,0x240(%ebx) +80102ee2: 74 2f je 80102f13 release(&p->lock); kfree((char*)p); } else release(&p->lock); -80103000: 83 ec 0c sub $0xc,%esp -80103003: 53 push %ebx -80103004: e8 fb 0e 00 00 call 80103f04 -80103009: 83 c4 10 add $0x10,%esp -} -8010300c: 8b 5d fc mov -0x4(%ebp),%ebx -8010300f: c9 leave -80103010: c3 ret +80102ee4: 83 ec 0c sub $0xc,%esp +80102ee7: 53 push %ebx +80102ee8: e8 7b 0e 00 00 call 80103d68 +80102eed: 83 c4 10 add $0x10,%esp +} +80102ef0: 8b 5d fc mov -0x4(%ebp),%ebx +80102ef3: c9 leave +80102ef4: c3 ret p->readopen = 0; -80103011: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) -80103018: 00 00 00 +80102ef5: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) +80102efc: 00 00 00 wakeup(&p->nwrite); -8010301b: 83 ec 0c sub $0xc,%esp -8010301e: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax -80103024: 50 push %eax -80103025: e8 10 0a 00 00 call 80103a3a -8010302a: 83 c4 10 add $0x10,%esp -8010302d: eb bf jmp 80102fee +80102eff: 83 ec 0c sub $0xc,%esp +80102f02: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax +80102f08: 50 push %eax +80102f09: e8 c9 09 00 00 call 801038d7 +80102f0e: 83 c4 10 add $0x10,%esp +80102f11: eb bf jmp 80102ed2 release(&p->lock); -8010302f: 83 ec 0c sub $0xc,%esp -80103032: 53 push %ebx -80103033: e8 cc 0e 00 00 call 80103f04 +80102f13: 83 ec 0c sub $0xc,%esp +80102f16: 53 push %ebx +80102f17: e8 4c 0e 00 00 call 80103d68 kfree((char*)p); -80103038: 89 1c 24 mov %ebx,(%esp) -8010303b: e8 7b f0 ff ff call 801020bb -80103040: 83 c4 10 add $0x10,%esp -80103043: eb c7 jmp 8010300c +80102f1c: 89 1c 24 mov %ebx,(%esp) +80102f1f: e8 d8 f0 ff ff call 80101ffc +80102f24: 83 c4 10 add $0x10,%esp +80102f27: eb c7 jmp 80102ef0 -80103045 : +80102f29 : //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { -80103045: f3 0f 1e fb endbr32 -80103049: 55 push %ebp -8010304a: 89 e5 mov %esp,%ebp -8010304c: 57 push %edi -8010304d: 56 push %esi -8010304e: 53 push %ebx -8010304f: 83 ec 28 sub $0x28,%esp -80103052: 8b 5d 08 mov 0x8(%ebp),%ebx -80103055: 8b 75 0c mov 0xc(%ebp),%esi +80102f29: 55 push %ebp +80102f2a: 89 e5 mov %esp,%ebp +80102f2c: 57 push %edi +80102f2d: 56 push %esi +80102f2e: 53 push %ebx +80102f2f: 83 ec 28 sub $0x28,%esp +80102f32: 8b 5d 08 mov 0x8(%ebp),%ebx +80102f35: 8b 75 0c mov 0xc(%ebp),%esi int i; acquire(&p->lock); -80103058: 89 5d e4 mov %ebx,-0x1c(%ebp) -8010305b: 53 push %ebx -8010305c: e8 38 0e 00 00 call 80103e99 +80102f38: 53 push %ebx +80102f39: e8 c3 0d 00 00 call 80103d01 for(i = 0; i < n; i++){ -80103061: 83 c4 10 add $0x10,%esp -80103064: 83 7d 10 00 cmpl $0x0,0x10(%ebp) -80103068: 0f 8e 8f 00 00 00 jle 801030fd -8010306e: 89 75 e0 mov %esi,-0x20(%ebp) -80103071: 03 75 10 add 0x10(%ebp),%esi -80103074: 89 75 dc mov %esi,-0x24(%ebp) +80102f3e: 83 c4 10 add $0x10,%esp +80102f41: 83 7d 10 00 cmpl $0x0,0x10(%ebp) +80102f45: 0f 8e 8d 00 00 00 jle 80102fd8 +80102f4b: 89 75 e4 mov %esi,-0x1c(%ebp) +80102f4e: 03 75 10 add 0x10(%ebp),%esi +80102f51: 89 75 e0 mov %esi,-0x20(%ebp) while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || myproc()->killed){ release(&p->lock); return -1; } wakeup(&p->nread); -80103077: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi +80102f54: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full -8010307d: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx -80103083: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax -80103089: 05 00 02 00 00 add $0x200,%eax +80102f5a: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx +80102f60: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax +80102f66: 05 00 02 00 00 add $0x200,%eax sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep -8010308e: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi +80102f6b: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full -80103094: 39 c2 cmp %eax,%edx -80103096: 75 41 jne 801030d9 +80102f71: 39 c2 cmp %eax,%edx +80102f73: 75 3f jne 80102fb4 if(p->readopen == 0 || myproc()->killed){ -80103098: 83 bb 3c 02 00 00 00 cmpl $0x0,0x23c(%ebx) -8010309f: 74 7b je 8010311c -801030a1: e8 44 03 00 00 call 801033ea -801030a6: 83 78 24 00 cmpl $0x0,0x24(%eax) -801030aa: 75 70 jne 8010311c +80102f75: 83 bb 3c 02 00 00 00 cmpl $0x0,0x23c(%ebx) +80102f7c: 74 79 je 80102ff7 +80102f7e: e8 2d 03 00 00 call 801032b0 +80102f83: 83 78 24 00 cmpl $0x0,0x24(%eax) +80102f87: 75 6e jne 80102ff7 wakeup(&p->nread); -801030ac: 83 ec 0c sub $0xc,%esp -801030af: 57 push %edi -801030b0: e8 85 09 00 00 call 80103a3a +80102f89: 83 ec 0c sub $0xc,%esp +80102f8c: 57 push %edi +80102f8d: e8 45 09 00 00 call 801038d7 sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep -801030b5: 83 c4 08 add $0x8,%esp -801030b8: ff 75 e4 pushl -0x1c(%ebp) -801030bb: 56 push %esi -801030bc: e8 f3 07 00 00 call 801038b4 +80102f92: 83 c4 08 add $0x8,%esp +80102f95: 53 push %ebx +80102f96: 56 push %esi +80102f97: e8 bd 07 00 00 call 80103759 while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full -801030c1: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx -801030c7: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax -801030cd: 05 00 02 00 00 add $0x200,%eax -801030d2: 83 c4 10 add $0x10,%esp -801030d5: 39 c2 cmp %eax,%edx -801030d7: 74 bf je 80103098 +80102f9c: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx +80102fa2: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax +80102fa8: 05 00 02 00 00 add $0x200,%eax +80102fad: 83 c4 10 add $0x10,%esp +80102fb0: 39 c2 cmp %eax,%edx +80102fb2: 74 c1 je 80102f75 } p->data[p->nwrite++ % PIPESIZE] = addr[i]; -801030d9: 8d 42 01 lea 0x1(%edx),%eax -801030dc: 89 83 38 02 00 00 mov %eax,0x238(%ebx) -801030e2: 8b 4d e0 mov -0x20(%ebp),%ecx -801030e5: 0f b6 01 movzbl (%ecx),%eax -801030e8: 81 e2 ff 01 00 00 and $0x1ff,%edx -801030ee: 88 44 13 34 mov %al,0x34(%ebx,%edx,1) +80102fb4: 8d 42 01 lea 0x1(%edx),%eax +80102fb7: 89 83 38 02 00 00 mov %eax,0x238(%ebx) +80102fbd: 8b 4d e4 mov -0x1c(%ebp),%ecx +80102fc0: 0f b6 01 movzbl (%ecx),%eax +80102fc3: 81 e2 ff 01 00 00 and $0x1ff,%edx +80102fc9: 88 44 13 34 mov %al,0x34(%ebx,%edx,1) for(i = 0; i < n; i++){ -801030f2: 83 c1 01 add $0x1,%ecx -801030f5: 89 4d e0 mov %ecx,-0x20(%ebp) -801030f8: 3b 4d dc cmp -0x24(%ebp),%ecx -801030fb: 75 80 jne 8010307d +80102fcd: 83 c1 01 add $0x1,%ecx +80102fd0: 89 4d e4 mov %ecx,-0x1c(%ebp) +80102fd3: 3b 4d e0 cmp -0x20(%ebp),%ecx +80102fd6: 75 82 jne 80102f5a } wakeup(&p->nread); //DOC: pipewrite-wakeup1 -801030fd: 83 ec 0c sub $0xc,%esp -80103100: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax -80103106: 50 push %eax -80103107: e8 2e 09 00 00 call 80103a3a +80102fd8: 83 ec 0c sub $0xc,%esp +80102fdb: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax +80102fe1: 50 push %eax +80102fe2: e8 f0 08 00 00 call 801038d7 release(&p->lock); -8010310c: 89 1c 24 mov %ebx,(%esp) -8010310f: e8 f0 0d 00 00 call 80103f04 +80102fe7: 89 1c 24 mov %ebx,(%esp) +80102fea: e8 79 0d 00 00 call 80103d68 return n; -80103114: 83 c4 10 add $0x10,%esp -80103117: 8b 45 10 mov 0x10(%ebp),%eax -8010311a: eb 11 jmp 8010312d +80102fef: 83 c4 10 add $0x10,%esp +80102ff2: 8b 45 10 mov 0x10(%ebp),%eax +80102ff5: eb 11 jmp 80103008 release(&p->lock); -8010311c: 83 ec 0c sub $0xc,%esp -8010311f: 53 push %ebx -80103120: e8 df 0d 00 00 call 80103f04 +80102ff7: 83 ec 0c sub $0xc,%esp +80102ffa: 53 push %ebx +80102ffb: e8 68 0d 00 00 call 80103d68 return -1; -80103125: 83 c4 10 add $0x10,%esp -80103128: b8 ff ff ff ff mov $0xffffffff,%eax +80103000: 83 c4 10 add $0x10,%esp +80103003: b8 ff ff ff ff mov $0xffffffff,%eax } -8010312d: 8d 65 f4 lea -0xc(%ebp),%esp -80103130: 5b pop %ebx -80103131: 5e pop %esi -80103132: 5f pop %edi -80103133: 5d pop %ebp -80103134: c3 ret +80103008: 8d 65 f4 lea -0xc(%ebp),%esp +8010300b: 5b pop %ebx +8010300c: 5e pop %esi +8010300d: 5f pop %edi +8010300e: 5d pop %ebp +8010300f: c3 ret -80103135 : +80103010 : int piperead(struct pipe *p, char *addr, int n) { -80103135: f3 0f 1e fb endbr32 -80103139: 55 push %ebp -8010313a: 89 e5 mov %esp,%ebp -8010313c: 57 push %edi -8010313d: 56 push %esi -8010313e: 53 push %ebx -8010313f: 83 ec 18 sub $0x18,%esp -80103142: 8b 5d 08 mov 0x8(%ebp),%ebx +80103010: 55 push %ebp +80103011: 89 e5 mov %esp,%ebp +80103013: 57 push %edi +80103014: 56 push %esi +80103015: 53 push %ebx +80103016: 83 ec 18 sub $0x18,%esp +80103019: 8b 5d 08 mov 0x8(%ebp),%ebx +8010301c: 8b 7d 0c mov 0xc(%ebp),%edi int i; acquire(&p->lock); -80103145: 89 df mov %ebx,%edi -80103147: 53 push %ebx -80103148: e8 4c 0d 00 00 call 80103e99 +8010301f: 53 push %ebx +80103020: e8 dc 0c 00 00 call 80103d01 while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty -8010314d: 83 c4 10 add $0x10,%esp +80103025: 83 c4 10 add $0x10,%esp if(myproc()->killed){ release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep -80103150: 8d b3 34 02 00 00 lea 0x234(%ebx),%esi +80103028: 8d b3 34 02 00 00 lea 0x234(%ebx),%esi while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty -80103156: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax -8010315c: 39 83 34 02 00 00 cmp %eax,0x234(%ebx) -80103162: 75 2f jne 80103193 -80103164: 83 bb 40 02 00 00 00 cmpl $0x0,0x240(%ebx) -8010316b: 74 26 je 80103193 +8010302e: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax +80103034: 39 83 34 02 00 00 cmp %eax,0x234(%ebx) +8010303a: 75 2f jne 8010306b +8010303c: 83 bb 40 02 00 00 00 cmpl $0x0,0x240(%ebx) +80103043: 74 26 je 8010306b if(myproc()->killed){ -8010316d: e8 78 02 00 00 call 801033ea -80103172: 83 78 24 00 cmpl $0x0,0x24(%eax) -80103176: 75 79 jne 801031f1 +80103045: e8 66 02 00 00 call 801032b0 +8010304a: 83 78 24 00 cmpl $0x0,0x24(%eax) +8010304e: 75 79 jne 801030c9 sleep(&p->nread, &p->lock); //DOC: piperead-sleep -80103178: 83 ec 08 sub $0x8,%esp -8010317b: 57 push %edi -8010317c: 56 push %esi -8010317d: e8 32 07 00 00 call 801038b4 +80103050: 83 ec 08 sub $0x8,%esp +80103053: 53 push %ebx +80103054: 56 push %esi +80103055: e8 ff 06 00 00 call 80103759 while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty -80103182: 83 c4 10 add $0x10,%esp -80103185: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax -8010318b: 39 83 34 02 00 00 cmp %eax,0x234(%ebx) -80103191: 74 d1 je 80103164 +8010305a: 83 c4 10 add $0x10,%esp +8010305d: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax +80103063: 39 83 34 02 00 00 cmp %eax,0x234(%ebx) +80103069: 74 d1 je 8010303c } for(i = 0; i < n; i++){ //DOC: piperead-copy -80103193: be 00 00 00 00 mov $0x0,%esi -80103198: 83 7d 10 00 cmpl $0x0,0x10(%ebp) -8010319c: 7e 2f jle 801031cd +8010306b: be 00 00 00 00 mov $0x0,%esi +80103070: 83 7d 10 00 cmpl $0x0,0x10(%ebp) +80103074: 7e 2f jle 801030a5 if(p->nread == p->nwrite) -8010319e: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax -801031a4: 3b 83 38 02 00 00 cmp 0x238(%ebx),%eax -801031aa: 74 21 je 801031cd +80103076: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax +8010307c: 3b 83 38 02 00 00 cmp 0x238(%ebx),%eax +80103082: 74 21 je 801030a5 break; addr[i] = p->data[p->nread++ % PIPESIZE]; -801031ac: 8d 50 01 lea 0x1(%eax),%edx -801031af: 89 93 34 02 00 00 mov %edx,0x234(%ebx) -801031b5: 25 ff 01 00 00 and $0x1ff,%eax -801031ba: 0f b6 44 03 34 movzbl 0x34(%ebx,%eax,1),%eax -801031bf: 8b 4d 0c mov 0xc(%ebp),%ecx -801031c2: 88 04 31 mov %al,(%ecx,%esi,1) +80103084: 8d 50 01 lea 0x1(%eax),%edx +80103087: 89 93 34 02 00 00 mov %edx,0x234(%ebx) +8010308d: 25 ff 01 00 00 and $0x1ff,%eax +80103092: 0f b6 44 03 34 movzbl 0x34(%ebx,%eax,1),%eax +80103097: 88 04 37 mov %al,(%edi,%esi,1) for(i = 0; i < n; i++){ //DOC: piperead-copy -801031c5: 83 c6 01 add $0x1,%esi -801031c8: 39 75 10 cmp %esi,0x10(%ebp) -801031cb: 75 d1 jne 8010319e +8010309a: 83 c6 01 add $0x1,%esi +8010309d: 39 75 10 cmp %esi,0x10(%ebp) +801030a0: 75 d4 jne 80103076 +801030a2: 8b 75 10 mov 0x10(%ebp),%esi } wakeup(&p->nwrite); //DOC: piperead-wakeup -801031cd: 83 ec 0c sub $0xc,%esp -801031d0: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax -801031d6: 50 push %eax -801031d7: e8 5e 08 00 00 call 80103a3a +801030a5: 83 ec 0c sub $0xc,%esp +801030a8: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax +801030ae: 50 push %eax +801030af: e8 23 08 00 00 call 801038d7 release(&p->lock); -801031dc: 89 1c 24 mov %ebx,(%esp) -801031df: e8 20 0d 00 00 call 80103f04 +801030b4: 89 1c 24 mov %ebx,(%esp) +801030b7: e8 ac 0c 00 00 call 80103d68 return i; -801031e4: 83 c4 10 add $0x10,%esp -} -801031e7: 89 f0 mov %esi,%eax -801031e9: 8d 65 f4 lea -0xc(%ebp),%esp -801031ec: 5b pop %ebx -801031ed: 5e pop %esi -801031ee: 5f pop %edi -801031ef: 5d pop %ebp -801031f0: c3 ret +801030bc: 83 c4 10 add $0x10,%esp +} +801030bf: 89 f0 mov %esi,%eax +801030c1: 8d 65 f4 lea -0xc(%ebp),%esp +801030c4: 5b pop %ebx +801030c5: 5e pop %esi +801030c6: 5f pop %edi +801030c7: 5d pop %ebp +801030c8: c3 ret release(&p->lock); -801031f1: 83 ec 0c sub $0xc,%esp -801031f4: 53 push %ebx -801031f5: e8 0a 0d 00 00 call 80103f04 +801030c9: 83 ec 0c sub $0xc,%esp +801030cc: 53 push %ebx +801030cd: e8 96 0c 00 00 call 80103d68 return -1; -801031fa: 83 c4 10 add $0x10,%esp -801031fd: be ff ff ff ff mov $0xffffffff,%esi -80103202: eb e3 jmp 801031e7 +801030d2: 83 c4 10 add $0x10,%esp +801030d5: be ff ff ff ff mov $0xffffffff,%esi +801030da: eb e3 jmp 801030bf -80103204 : +801030dc : static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) -80103204: ba 74 59 11 80 mov $0x80115974,%edx -80103209: eb 15 jmp 80103220 +801030dc: ba 54 2d 11 80 mov $0x80112d54,%edx +801030e1: eb 0e jmp 801030f1 +801030e3: 81 c2 84 00 00 00 add $0x84,%edx +801030e9: 81 fa 94 35 11 80 cmp $0x80113594,%edx +801030ef: 74 14 je 80103105 if(p->state == SLEEPING && p->chan == chan) +801030f1: 83 7a 0c 02 cmpl $0x2,0xc(%edx) +801030f5: 75 ec jne 801030e3 +801030f7: 39 42 20 cmp %eax,0x20(%edx) +801030fa: 75 e7 jne 801030e3 p->state = RUNNABLE; -8010320b: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) -80103212: 81 c2 84 00 00 00 add $0x84,%edx -80103218: 81 fa b4 61 11 80 cmp $0x801161b4,%edx -8010321e: 74 0d je 8010322d - if(p->state == SLEEPING && p->chan == chan) -80103220: 83 7a 0c 02 cmpl $0x2,0xc(%edx) -80103224: 75 ec jne 80103212 -80103226: 39 42 20 cmp %eax,0x20(%edx) -80103229: 75 e7 jne 80103212 -8010322b: eb de jmp 8010320b +801030fc: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) +80103103: eb de jmp 801030e3 } -8010322d: c3 ret +80103105: c3 ret -8010322e : +80103106 : { -8010322e: 55 push %ebp -8010322f: 89 e5 mov %esp,%ebp -80103231: 53 push %ebx -80103232: 83 ec 10 sub $0x10,%esp +80103106: 55 push %ebp +80103107: 89 e5 mov %esp,%ebp +80103109: 53 push %ebx +8010310a: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); -80103235: 68 40 59 11 80 push $0x80115940 -8010323a: e8 5a 0c 00 00 call 80103e99 -8010323f: 83 c4 10 add $0x10,%esp +8010310d: 68 20 2d 11 80 push $0x80112d20 +80103112: e8 ea 0b 00 00 call 80103d01 +80103117: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) -80103242: bb 74 59 11 80 mov $0x80115974,%ebx +8010311a: bb 54 2d 11 80 mov $0x80112d54,%ebx if(p->state == UNUSED) -80103247: 83 7b 0c 00 cmpl $0x0,0xc(%ebx) -8010324b: 74 2a je 80103277 +8010311f: 83 7b 0c 00 cmpl $0x0,0xc(%ebx) +80103123: 74 2a je 8010314f for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) -8010324d: 81 c3 84 00 00 00 add $0x84,%ebx -80103253: 81 fb b4 61 11 80 cmp $0x801161b4,%ebx -80103259: 75 ec jne 80103247 +80103125: 81 c3 84 00 00 00 add $0x84,%ebx +8010312b: 81 fb 94 35 11 80 cmp $0x80113594,%ebx +80103131: 75 ec jne 8010311f release(&ptable.lock); -8010325b: 83 ec 0c sub $0xc,%esp -8010325e: 68 40 59 11 80 push $0x80115940 -80103263: e8 9c 0c 00 00 call 80103f04 +80103133: 83 ec 0c sub $0xc,%esp +80103136: 68 20 2d 11 80 push $0x80112d20 +8010313b: e8 28 0c 00 00 call 80103d68 return 0; -80103268: 83 c4 10 add $0x10,%esp -8010326b: bb 00 00 00 00 mov $0x0,%ebx +80103140: 83 c4 10 add $0x10,%esp +80103143: bb 00 00 00 00 mov $0x0,%ebx } -80103270: 89 d8 mov %ebx,%eax -80103272: 8b 5d fc mov -0x4(%ebp),%ebx -80103275: c9 leave -80103276: c3 ret +80103148: 89 d8 mov %ebx,%eax +8010314a: 8b 5d fc mov -0x4(%ebp),%ebx +8010314d: c9 leave +8010314e: c3 ret p->state = EMBRYO; -80103277: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) +8010314f: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) p->pid = nextpid++; -8010327e: a1 04 b0 10 80 mov 0x8010b004,%eax -80103283: 8d 50 01 lea 0x1(%eax),%edx -80103286: 89 15 04 b0 10 80 mov %edx,0x8010b004 -8010328c: 89 43 10 mov %eax,0x10(%ebx) +80103156: a1 04 b0 10 80 mov 0x8010b004,%eax +8010315b: 8d 50 01 lea 0x1(%eax),%edx +8010315e: 89 15 04 b0 10 80 mov %edx,0x8010b004 +80103164: 89 43 10 mov %eax,0x10(%ebx) release(&ptable.lock); -8010328f: 83 ec 0c sub $0xc,%esp -80103292: 68 40 59 11 80 push $0x80115940 -80103297: e8 68 0c 00 00 call 80103f04 +80103167: 83 ec 0c sub $0xc,%esp +8010316a: 68 20 2d 11 80 push $0x80112d20 +8010316f: e8 f4 0b 00 00 call 80103d68 if((p->kstack = kalloc()) == 0){ -8010329c: e8 78 ef ff ff call 80102219 -801032a1: 89 43 08 mov %eax,0x8(%ebx) -801032a4: 83 c4 10 add $0x10,%esp -801032a7: 85 c0 test %eax,%eax -801032a9: 74 37 je 801032e2 +80103174: e8 d1 ef ff ff call 8010214a +80103179: 89 43 08 mov %eax,0x8(%ebx) +8010317c: 83 c4 10 add $0x10,%esp +8010317f: 85 c0 test %eax,%eax +80103181: 74 37 je 801031ba sp -= sizeof *p->tf; -801032ab: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx -801032b1: 89 53 18 mov %edx,0x18(%ebx) +80103183: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx +80103189: 89 53 18 mov %edx,0x18(%ebx) *(uint*)sp = (uint)trapret; -801032b4: c7 80 b0 0f 00 00 67 movl $0x80105067,0xfb0(%eax) -801032bb: 50 10 80 +8010318c: c7 80 b0 0f 00 00 35 movl $0x80104e35,0xfb0(%eax) +80103193: 4e 10 80 sp -= sizeof *p->context; -801032be: 05 9c 0f 00 00 add $0xf9c,%eax +80103196: 05 9c 0f 00 00 add $0xf9c,%eax p->context = (struct context*)sp; -801032c3: 89 43 1c mov %eax,0x1c(%ebx) +8010319b: 89 43 1c mov %eax,0x1c(%ebx) memset(p->context, 0, sizeof *p->context); -801032c6: 83 ec 04 sub $0x4,%esp -801032c9: 6a 14 push $0x14 -801032cb: 6a 00 push $0x0 -801032cd: 50 push %eax -801032ce: e8 7c 0c 00 00 call 80103f4f +8010319e: 83 ec 04 sub $0x4,%esp +801031a1: 6a 14 push $0x14 +801031a3: 6a 00 push $0x0 +801031a5: 50 push %eax +801031a6: e8 04 0c 00 00 call 80103daf p->context->eip = (uint)forkret; -801032d3: 8b 43 1c mov 0x1c(%ebx),%eax -801032d6: c7 40 10 ed 32 10 80 movl $0x801032ed,0x10(%eax) +801031ab: 8b 43 1c mov 0x1c(%ebx),%eax +801031ae: c7 40 10 c5 31 10 80 movl $0x801031c5,0x10(%eax) return p; -801032dd: 83 c4 10 add $0x10,%esp -801032e0: eb 8e jmp 80103270 +801031b5: 83 c4 10 add $0x10,%esp +801031b8: eb 8e jmp 80103148 p->state = UNUSED; -801032e2: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) +801031ba: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return 0; -801032e9: 89 c3 mov %eax,%ebx -801032eb: eb 83 jmp 80103270 +801031c1: 89 c3 mov %eax,%ebx +801031c3: eb 83 jmp 80103148 -801032ed : +801031c5 : { -801032ed: f3 0f 1e fb endbr32 -801032f1: 55 push %ebp -801032f2: 89 e5 mov %esp,%ebp -801032f4: 83 ec 14 sub $0x14,%esp +801031c5: 55 push %ebp +801031c6: 89 e5 mov %esp,%ebp +801031c8: 83 ec 14 sub $0x14,%esp release(&ptable.lock); -801032f7: 68 40 59 11 80 push $0x80115940 -801032fc: e8 03 0c 00 00 call 80103f04 +801031cb: 68 20 2d 11 80 push $0x80112d20 +801031d0: e8 93 0b 00 00 call 80103d68 if (first) { -80103301: 83 c4 10 add $0x10,%esp -80103304: 83 3d 00 b0 10 80 00 cmpl $0x0,0x8010b000 -8010330b: 75 02 jne 8010330f +801031d5: 83 c4 10 add $0x10,%esp +801031d8: 83 3d 00 b0 10 80 00 cmpl $0x0,0x8010b000 +801031df: 75 02 jne 801031e3 } -8010330d: c9 leave -8010330e: c3 ret +801031e1: c9 leave +801031e2: c3 ret first = 0; -8010330f: c7 05 00 b0 10 80 00 movl $0x0,0x8010b000 -80103316: 00 00 00 +801031e3: c7 05 00 b0 10 80 00 movl $0x0,0x8010b000 +801031ea: 00 00 00 iinit(ROOTDEV); -80103319: 83 ec 0c sub $0xc,%esp -8010331c: 6a 01 push $0x1 -8010331e: e8 19 e0 ff ff call 8010133c +801031ed: 83 ec 0c sub $0xc,%esp +801031f0: 6a 01 push $0x1 +801031f2: e8 dc e0 ff ff call 801012d3 initlog(ROOTDEV); -80103323: c7 04 24 01 00 00 00 movl $0x1,(%esp) -8010332a: e8 ba f4 ff ff call 801027e9 -8010332f: 83 c4 10 add $0x10,%esp +801031f7: c7 04 24 01 00 00 00 movl $0x1,(%esp) +801031fe: e8 e8 f4 ff ff call 801026eb +80103203: 83 c4 10 add $0x10,%esp } -80103332: eb d9 jmp 8010330d +80103206: eb d9 jmp 801031e1 -80103334 : +80103208 : { -80103334: f3 0f 1e fb endbr32 -80103338: 55 push %ebp -80103339: 89 e5 mov %esp,%ebp -8010333b: 83 ec 0c sub $0xc,%esp +80103208: 55 push %ebp +80103209: 89 e5 mov %esp,%ebp +8010320b: 83 ec 0c sub $0xc,%esp memset(ptable.proc, 0, sizeof *ptable.proc); -8010333e: 68 84 00 00 00 push $0x84 -80103343: 6a 00 push $0x0 -80103345: 68 74 59 11 80 push $0x80115974 -8010334a: e8 00 0c 00 00 call 80103f4f +8010320e: 68 84 00 00 00 push $0x84 +80103213: 6a 00 push $0x0 +80103215: 68 54 2d 11 80 push $0x80112d54 +8010321a: e8 90 0b 00 00 call 80103daf initlock(&ptable.lock, "ptable"); -8010334f: 83 c4 08 add $0x8,%esp -80103352: 68 c0 7d 10 80 push $0x80107dc0 -80103357: 68 40 59 11 80 push $0x80115940 -8010335c: e8 dc 09 00 00 call 80103d3d -} -80103361: 83 c4 10 add $0x10,%esp -80103364: c9 leave -80103365: c3 ret - -80103366 : -{ -80103366: f3 0f 1e fb endbr32 -8010336a: 55 push %ebp -8010336b: 89 e5 mov %esp,%ebp -8010336d: 56 push %esi -8010336e: 53 push %ebx +8010321f: 83 c4 08 add $0x8,%esp +80103222: 68 e0 7a 10 80 push $0x80107ae0 +80103227: 68 20 2d 11 80 push $0x80112d20 +8010322c: e8 87 09 00 00 call 80103bb8 +} +80103231: 83 c4 10 add $0x10,%esp +80103234: c9 leave +80103235: c3 ret + +80103236 : +{ +80103236: 55 push %ebp +80103237: 89 e5 mov %esp,%ebp +80103239: 56 push %esi +8010323a: 53 push %ebx asm volatile("pushfl; popl %0" : "=r" (eflags)); -8010336f: 9c pushf -80103370: 58 pop %eax +8010323b: 9c pushf +8010323c: 58 pop %eax if(readeflags()&FL_IF) -80103371: f6 c4 02 test $0x2,%ah -80103374: 75 3b jne 801033b1 +8010323d: f6 c4 02 test $0x2,%ah +80103240: 75 39 jne 8010327b apicid = lapicid(); -80103376: e8 89 f1 ff ff call 80102504 -8010337b: 89 c3 mov %eax,%ebx +80103242: e8 d3 f1 ff ff call 8010241a for (i = 0; i < ncpu; ++i) { -8010337d: 8b 35 20 59 11 80 mov 0x80115920,%esi -80103383: 85 f6 test %esi,%esi -80103385: 7e 1d jle 801033a4 -80103387: ba 00 00 00 00 mov $0x0,%edx +80103247: 8b 35 84 27 11 80 mov 0x80112784,%esi +8010324d: 85 f6 test %esi,%esi +8010324f: 7e 1d jle 8010326e +80103251: ba 00 00 00 00 mov $0x0,%edx if (cpus[i].apicid == apicid) -8010338c: 69 ca b0 00 00 00 imul $0xb0,%edx,%ecx -80103392: 0f b6 81 a0 53 11 80 movzbl -0x7feeac60(%ecx),%eax -80103399: 39 d8 cmp %ebx,%eax -8010339b: 74 21 je 801033be +80103256: 69 ca b0 00 00 00 imul $0xb0,%edx,%ecx +8010325c: 0f b6 99 a0 27 11 80 movzbl -0x7feed860(%ecx),%ebx +80103263: 39 c3 cmp %eax,%ebx +80103265: 74 21 je 80103288 for (i = 0; i < ncpu; ++i) { -8010339d: 83 c2 01 add $0x1,%edx -801033a0: 39 f2 cmp %esi,%edx -801033a2: 75 e8 jne 8010338c +80103267: 83 c2 01 add $0x1,%edx +8010326a: 39 f2 cmp %esi,%edx +8010326c: 75 e8 jne 80103256 panic("unknown apicid\n"); -801033a4: 83 ec 0c sub $0xc,%esp -801033a7: 68 c7 7d 10 80 push $0x80107dc7 -801033ac: e8 a7 cf ff ff call 80100358 +8010326e: 83 ec 0c sub $0xc,%esp +80103271: 68 e7 7a 10 80 push $0x80107ae7 +80103276: e8 c5 d0 ff ff call 80100340 panic("mycpu called with interrupts enabled\n"); -801033b1: 83 ec 0c sub $0xc,%esp -801033b4: 68 bc 7e 10 80 push $0x80107ebc -801033b9: e8 9a cf ff ff call 80100358 +8010327b: 83 ec 0c sub $0xc,%esp +8010327e: 68 dc 7b 10 80 push $0x80107bdc +80103283: e8 b8 d0 ff ff call 80100340 return &cpus[i]; -801033be: 8d 81 a0 53 11 80 lea -0x7feeac60(%ecx),%eax +80103288: 8d 81 a0 27 11 80 lea -0x7feed860(%ecx),%eax } -801033c4: 8d 65 f8 lea -0x8(%ebp),%esp -801033c7: 5b pop %ebx -801033c8: 5e pop %esi -801033c9: 5d pop %ebp -801033ca: c3 ret +8010328e: 8d 65 f8 lea -0x8(%ebp),%esp +80103291: 5b pop %ebx +80103292: 5e pop %esi +80103293: 5d pop %ebp +80103294: c3 ret -801033cb : +80103295 : cpuid() { -801033cb: f3 0f 1e fb endbr32 -801033cf: 55 push %ebp -801033d0: 89 e5 mov %esp,%ebp -801033d2: 83 ec 08 sub $0x8,%esp +80103295: 55 push %ebp +80103296: 89 e5 mov %esp,%ebp +80103298: 83 ec 08 sub $0x8,%esp return mycpu()-cpus; -801033d5: e8 8c ff ff ff call 80103366 -801033da: 2d a0 53 11 80 sub $0x801153a0,%eax -801033df: c1 f8 04 sar $0x4,%eax -801033e2: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax +8010329b: e8 96 ff ff ff call 80103236 +801032a0: 2d a0 27 11 80 sub $0x801127a0,%eax +801032a5: c1 f8 04 sar $0x4,%eax +801032a8: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax } -801033e8: c9 leave -801033e9: c3 ret +801032ae: c9 leave +801032af: c3 ret -801033ea : +801032b0 : myproc(void) { -801033ea: f3 0f 1e fb endbr32 -801033ee: 55 push %ebp -801033ef: 89 e5 mov %esp,%ebp -801033f1: 53 push %ebx -801033f2: 83 ec 04 sub $0x4,%esp +801032b0: 55 push %ebp +801032b1: 89 e5 mov %esp,%ebp +801032b3: 53 push %ebx +801032b4: 83 ec 04 sub $0x4,%esp pushcli(); -801033f5: e8 c2 09 00 00 call 80103dbc +801032b7: e8 75 09 00 00 call 80103c31 c = mycpu(); -801033fa: e8 67 ff ff ff call 80103366 +801032bc: e8 75 ff ff ff call 80103236 p = c->proc; -801033ff: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx +801032c1: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); -80103405: e8 f3 09 00 00 call 80103dfd +801032c7: e8 a1 09 00 00 call 80103c6d } -8010340a: 89 d8 mov %ebx,%eax -8010340c: 83 c4 04 add $0x4,%esp -8010340f: 5b pop %ebx -80103410: 5d pop %ebp -80103411: c3 ret +801032cc: 89 d8 mov %ebx,%eax +801032ce: 8b 5d fc mov -0x4(%ebp),%ebx +801032d1: c9 leave +801032d2: c3 ret -80103412 : +801032d3 : { -80103412: f3 0f 1e fb endbr32 -80103416: 55 push %ebp -80103417: 89 e5 mov %esp,%ebp -80103419: 53 push %ebx -8010341a: 83 ec 04 sub $0x4,%esp +801032d3: 55 push %ebp +801032d4: 89 e5 mov %esp,%ebp +801032d6: 53 push %ebx +801032d7: 83 ec 04 sub $0x4,%esp p = allocproc(); -8010341d: e8 0c fe ff ff call 8010322e -80103422: 89 c3 mov %eax,%ebx +801032da: e8 27 fe ff ff call 80103106 +801032df: 89 c3 mov %eax,%ebx initproc = p; -80103424: a3 b8 b5 10 80 mov %eax,0x8010b5b8 +801032e1: a3 94 35 11 80 mov %eax,0x80113594 if((p->pgdir = setupkvm()) == 0) -80103429: e8 d0 30 00 00 call 801064fe -8010342e: 89 43 04 mov %eax,0x4(%ebx) -80103431: 85 c0 test %eax,%eax -80103433: 0f 84 b7 00 00 00 je 801034f0 +801032e6: e8 a6 2f 00 00 call 80106291 +801032eb: 89 43 04 mov %eax,0x4(%ebx) +801032ee: 85 c0 test %eax,%eax +801032f0: 0f 84 b7 00 00 00 je 801033ad inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); -80103439: 83 ec 04 sub $0x4,%esp -8010343c: 68 2c 00 00 00 push $0x2c -80103441: 68 60 b4 10 80 push $0x8010b460 -80103446: 50 push %eax -80103447: e8 99 2d 00 00 call 801061e5 +801032f6: 83 ec 04 sub $0x4,%esp +801032f9: 68 2c 00 00 00 push $0x2c +801032fe: 68 60 b4 10 80 push $0x8010b460 +80103303: 50 push %eax +80103304: e8 84 2c 00 00 call 80105f8d p->sz = PGSIZE; -8010344c: c7 03 00 10 00 00 movl $0x1000,(%ebx) +80103309: c7 03 00 10 00 00 movl $0x1000,(%ebx) memset(p->tf, 0, sizeof(*p->tf)); -80103452: 83 c4 0c add $0xc,%esp -80103455: 6a 4c push $0x4c -80103457: 6a 00 push $0x0 -80103459: ff 73 18 pushl 0x18(%ebx) -8010345c: e8 ee 0a 00 00 call 80103f4f +8010330f: 83 c4 0c add $0xc,%esp +80103312: 6a 4c push $0x4c +80103314: 6a 00 push $0x0 +80103316: ff 73 18 push 0x18(%ebx) +80103319: e8 91 0a 00 00 call 80103daf p->tf->cs = (SEG_UCODE << 3) | DPL_USER; -80103461: 8b 43 18 mov 0x18(%ebx),%eax -80103464: 66 c7 40 3c 1b 00 movw $0x1b,0x3c(%eax) +8010331e: 8b 43 18 mov 0x18(%ebx),%eax +80103321: 66 c7 40 3c 1b 00 movw $0x1b,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; -8010346a: 8b 43 18 mov 0x18(%ebx),%eax -8010346d: 66 c7 40 2c 23 00 movw $0x23,0x2c(%eax) +80103327: 8b 43 18 mov 0x18(%ebx),%eax +8010332a: 66 c7 40 2c 23 00 movw $0x23,0x2c(%eax) p->tf->es = p->tf->ds; -80103473: 8b 43 18 mov 0x18(%ebx),%eax -80103476: 0f b7 50 2c movzwl 0x2c(%eax),%edx -8010347a: 66 89 50 28 mov %dx,0x28(%eax) +80103330: 8b 43 18 mov 0x18(%ebx),%eax +80103333: 0f b7 50 2c movzwl 0x2c(%eax),%edx +80103337: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; -8010347e: 8b 43 18 mov 0x18(%ebx),%eax -80103481: 0f b7 50 2c movzwl 0x2c(%eax),%edx -80103485: 66 89 50 48 mov %dx,0x48(%eax) +8010333b: 8b 43 18 mov 0x18(%ebx),%eax +8010333e: 0f b7 50 2c movzwl 0x2c(%eax),%edx +80103342: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; -80103489: 8b 43 18 mov 0x18(%ebx),%eax -8010348c: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) +80103346: 8b 43 18 mov 0x18(%ebx),%eax +80103349: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; -80103493: 8b 43 18 mov 0x18(%ebx),%eax -80103496: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) +80103350: 8b 43 18 mov 0x18(%ebx),%eax +80103353: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S -8010349d: 8b 43 18 mov 0x18(%ebx),%eax -801034a0: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) +8010335a: 8b 43 18 mov 0x18(%ebx),%eax +8010335d: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); -801034a7: 83 c4 0c add $0xc,%esp -801034aa: 6a 10 push $0x10 -801034ac: 68 f0 7d 10 80 push $0x80107df0 -801034b1: 8d 43 6c lea 0x6c(%ebx),%eax -801034b4: 50 push %eax -801034b5: e8 2b 0c 00 00 call 801040e5 +80103364: 83 c4 0c add $0xc,%esp +80103367: 6a 10 push $0x10 +80103369: 68 10 7b 10 80 push $0x80107b10 +8010336e: 8d 43 6c lea 0x6c(%ebx),%eax +80103371: 50 push %eax +80103372: e8 b8 0b 00 00 call 80103f2f p->cwd = namei("/"); -801034ba: c7 04 24 f9 7d 10 80 movl $0x80107df9,(%esp) -801034c1: e8 1e e8 ff ff call 80101ce4 -801034c6: 89 43 68 mov %eax,0x68(%ebx) +80103377: c7 04 24 19 7b 10 80 movl $0x80107b19,(%esp) +8010337e: e8 be e8 ff ff call 80101c41 +80103383: 89 43 68 mov %eax,0x68(%ebx) acquire(&ptable.lock); -801034c9: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -801034d0: e8 c4 09 00 00 call 80103e99 +80103386: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +8010338d: e8 6f 09 00 00 call 80103d01 p->state = RUNNABLE; -801034d5: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) +80103392: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) release(&ptable.lock); -801034dc: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -801034e3: e8 1c 0a 00 00 call 80103f04 +80103399: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801033a0: e8 c3 09 00 00 call 80103d68 } -801034e8: 83 c4 10 add $0x10,%esp -801034eb: 8b 5d fc mov -0x4(%ebp),%ebx -801034ee: c9 leave -801034ef: c3 ret +801033a5: 83 c4 10 add $0x10,%esp +801033a8: 8b 5d fc mov -0x4(%ebp),%ebx +801033ab: c9 leave +801033ac: c3 ret panic("userinit: out of memory?"); -801034f0: 83 ec 0c sub $0xc,%esp -801034f3: 68 d7 7d 10 80 push $0x80107dd7 -801034f8: e8 5b ce ff ff call 80100358 - -801034fd : -{ -801034fd: f3 0f 1e fb endbr32 -80103501: 55 push %ebp -80103502: 89 e5 mov %esp,%ebp -80103504: 56 push %esi -80103505: 53 push %ebx -80103506: 8b 75 08 mov 0x8(%ebp),%esi +801033ad: 83 ec 0c sub $0xc,%esp +801033b0: 68 f7 7a 10 80 push $0x80107af7 +801033b5: e8 86 cf ff ff call 80100340 + +801033ba : +{ +801033ba: 55 push %ebp +801033bb: 89 e5 mov %esp,%ebp +801033bd: 56 push %esi +801033be: 53 push %ebx +801033bf: 8b 75 08 mov 0x8(%ebp),%esi struct proc *curproc = myproc(); -80103509: e8 dc fe ff ff call 801033ea -8010350e: 89 c3 mov %eax,%ebx +801033c2: e8 e9 fe ff ff call 801032b0 +801033c7: 89 c3 mov %eax,%ebx sz = curproc->sz; -80103510: 8b 00 mov (%eax),%eax +801033c9: 8b 00 mov (%eax),%eax if(n > 0){ -80103512: 85 f6 test %esi,%esi -80103514: 7f 1c jg 80103532 +801033cb: 85 f6 test %esi,%esi +801033cd: 7f 1c jg 801033eb } else if(n < 0){ -80103516: 78 37 js 8010354f +801033cf: 78 37 js 80103408 curproc->sz = sz; -80103518: 89 03 mov %eax,(%ebx) +801033d1: 89 03 mov %eax,(%ebx) switchuvm(curproc); -8010351a: 83 ec 0c sub $0xc,%esp -8010351d: 53 push %ebx -8010351e: e8 c0 2b 00 00 call 801060e3 +801033d3: 83 ec 0c sub $0xc,%esp +801033d6: 53 push %ebx +801033d7: e8 b3 2a 00 00 call 80105e8f return 0; -80103523: 83 c4 10 add $0x10,%esp -80103526: b8 00 00 00 00 mov $0x0,%eax -} -8010352b: 8d 65 f8 lea -0x8(%ebp),%esp -8010352e: 5b pop %ebx -8010352f: 5e pop %esi -80103530: 5d pop %ebp -80103531: c3 ret +801033dc: 83 c4 10 add $0x10,%esp +801033df: b8 00 00 00 00 mov $0x0,%eax +} +801033e4: 8d 65 f8 lea -0x8(%ebp),%esp +801033e7: 5b pop %ebx +801033e8: 5e pop %esi +801033e9: 5d pop %ebp +801033ea: c3 ret if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) -80103532: 83 ec 04 sub $0x4,%esp -80103535: 01 c6 add %eax,%esi -80103537: 56 push %esi -80103538: 50 push %eax -80103539: ff 73 04 pushl 0x4(%ebx) -8010353c: e8 54 2e 00 00 call 80106395 -80103541: 83 c4 10 add $0x10,%esp -80103544: 85 c0 test %eax,%eax -80103546: 75 d0 jne 80103518 +801033eb: 83 ec 04 sub $0x4,%esp +801033ee: 01 c6 add %eax,%esi +801033f0: 56 push %esi +801033f1: 50 push %eax +801033f2: ff 73 04 push 0x4(%ebx) +801033f5: e8 36 2d 00 00 call 80106130 +801033fa: 83 c4 10 add $0x10,%esp +801033fd: 85 c0 test %eax,%eax +801033ff: 75 d0 jne 801033d1 return -1; -80103548: b8 ff ff ff ff mov $0xffffffff,%eax -8010354d: eb dc jmp 8010352b +80103401: b8 ff ff ff ff mov $0xffffffff,%eax +80103406: eb dc jmp 801033e4 if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) -8010354f: 83 ec 04 sub $0x4,%esp -80103552: 01 c6 add %eax,%esi -80103554: 56 push %esi -80103555: 50 push %eax -80103556: ff 73 04 pushl 0x4(%ebx) -80103559: e8 a4 2d 00 00 call 80106302 -8010355e: 83 c4 10 add $0x10,%esp -80103561: 85 c0 test %eax,%eax -80103563: 75 b3 jne 80103518 +80103408: 83 ec 04 sub $0x4,%esp +8010340b: 01 c6 add %eax,%esi +8010340d: 56 push %esi +8010340e: 50 push %eax +8010340f: ff 73 04 push 0x4(%ebx) +80103412: e8 8a 2c 00 00 call 801060a1 +80103417: 83 c4 10 add $0x10,%esp +8010341a: 85 c0 test %eax,%eax +8010341c: 75 b3 jne 801033d1 return -1; -80103565: b8 ff ff ff ff mov $0xffffffff,%eax -8010356a: eb bf jmp 8010352b - -8010356c : -{ -8010356c: f3 0f 1e fb endbr32 -80103570: 55 push %ebp -80103571: 89 e5 mov %esp,%ebp -80103573: 57 push %edi -80103574: 56 push %esi -80103575: 53 push %ebx -80103576: 83 ec 1c sub $0x1c,%esp +8010341e: b8 ff ff ff ff mov $0xffffffff,%eax +80103423: eb bf jmp 801033e4 + +80103425 : +{ +80103425: 55 push %ebp +80103426: 89 e5 mov %esp,%ebp +80103428: 57 push %edi +80103429: 56 push %esi +8010342a: 53 push %ebx +8010342b: 83 ec 1c sub $0x1c,%esp struct proc *curproc = myproc(); -80103579: e8 6c fe ff ff call 801033ea -8010357e: 89 c3 mov %eax,%ebx +8010342e: e8 7d fe ff ff call 801032b0 +80103433: 89 c3 mov %eax,%ebx if((np = allocproc()) == 0){ -80103580: e8 a9 fc ff ff call 8010322e -80103585: 89 45 e4 mov %eax,-0x1c(%ebp) -80103588: 85 c0 test %eax,%eax -8010358a: 0f 84 e0 00 00 00 je 80103670 -80103590: 89 c7 mov %eax,%edi +80103435: e8 cc fc ff ff call 80103106 +8010343a: 89 45 e4 mov %eax,-0x1c(%ebp) +8010343d: 85 c0 test %eax,%eax +8010343f: 0f 84 e0 00 00 00 je 80103525 +80103445: 89 c7 mov %eax,%edi if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ -80103592: 83 ec 08 sub $0x8,%esp -80103595: ff 33 pushl (%ebx) -80103597: ff 73 04 pushl 0x4(%ebx) -8010359a: e8 1c 30 00 00 call 801065bb -8010359f: 89 47 04 mov %eax,0x4(%edi) -801035a2: 83 c4 10 add $0x10,%esp -801035a5: 85 c0 test %eax,%eax -801035a7: 74 2a je 801035d3 +80103447: 83 ec 08 sub $0x8,%esp +8010344a: ff 33 push (%ebx) +8010344c: ff 73 04 push 0x4(%ebx) +8010344f: e8 ee 2e 00 00 call 80106342 +80103454: 89 47 04 mov %eax,0x4(%edi) +80103457: 83 c4 10 add $0x10,%esp +8010345a: 85 c0 test %eax,%eax +8010345c: 74 2a je 80103488 np->sz = curproc->sz; -801035a9: 8b 03 mov (%ebx),%eax -801035ab: 8b 4d e4 mov -0x1c(%ebp),%ecx -801035ae: 89 01 mov %eax,(%ecx) +8010345e: 8b 03 mov (%ebx),%eax +80103460: 8b 4d e4 mov -0x1c(%ebp),%ecx +80103463: 89 01 mov %eax,(%ecx) np->parent = curproc; -801035b0: 89 c8 mov %ecx,%eax -801035b2: 89 59 14 mov %ebx,0x14(%ecx) +80103465: 89 c8 mov %ecx,%eax +80103467: 89 59 14 mov %ebx,0x14(%ecx) *np->tf = *curproc->tf; -801035b5: 8b 73 18 mov 0x18(%ebx),%esi -801035b8: 8b 79 18 mov 0x18(%ecx),%edi -801035bb: b9 13 00 00 00 mov $0x13,%ecx -801035c0: f3 a5 rep movsl %ds:(%esi),%es:(%edi) +8010346a: 8b 73 18 mov 0x18(%ebx),%esi +8010346d: 8b 79 18 mov 0x18(%ecx),%edi +80103470: b9 13 00 00 00 mov $0x13,%ecx +80103475: f3 a5 rep movsl %ds:(%esi),%es:(%edi) np->tf->eax = 0; -801035c2: 8b 40 18 mov 0x18(%eax),%eax -801035c5: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) +80103477: 8b 40 18 mov 0x18(%eax),%eax +8010347a: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) -801035cc: be 00 00 00 00 mov $0x0,%esi -801035d1: eb 41 jmp 80103614 +80103481: be 00 00 00 00 mov $0x0,%esi +80103486: eb 2e jmp 801034b6 kfree(np->kstack); -801035d3: 83 ec 0c sub $0xc,%esp -801035d6: 8b 5d e4 mov -0x1c(%ebp),%ebx -801035d9: ff 73 08 pushl 0x8(%ebx) -801035dc: e8 da ea ff ff call 801020bb +80103488: 83 ec 0c sub $0xc,%esp +8010348b: 8b 5d e4 mov -0x1c(%ebp),%ebx +8010348e: ff 73 08 push 0x8(%ebx) +80103491: e8 66 eb ff ff call 80101ffc np->kstack = 0; -801035e1: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) +80103496: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) np->state = UNUSED; -801035e8: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) +8010349d: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return -1; -801035ef: 83 c4 10 add $0x10,%esp -801035f2: bb ff ff ff ff mov $0xffffffff,%ebx -801035f7: eb 6d jmp 80103666 - np->ofile[i] = filedup(curproc->ofile[i]); -801035f9: 83 ec 0c sub $0xc,%esp -801035fc: 50 push %eax -801035fd: e8 36 d7 ff ff call 80100d38 -80103602: 8b 55 e4 mov -0x1c(%ebp),%edx -80103605: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) -80103609: 83 c4 10 add $0x10,%esp +801034a4: 83 c4 10 add $0x10,%esp +801034a7: bb ff ff ff ff mov $0xffffffff,%ebx +801034ac: eb 6d jmp 8010351b for(i = 0; i < NOFILE; i++) -8010360c: 83 c6 01 add $0x1,%esi -8010360f: 83 fe 10 cmp $0x10,%esi -80103612: 74 0a je 8010361e +801034ae: 83 c6 01 add $0x1,%esi +801034b1: 83 fe 10 cmp $0x10,%esi +801034b4: 74 1d je 801034d3 if(curproc->ofile[i]) -80103614: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax -80103618: 85 c0 test %eax,%eax -8010361a: 75 dd jne 801035f9 -8010361c: eb ee jmp 8010360c +801034b6: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax +801034ba: 85 c0 test %eax,%eax +801034bc: 74 f0 je 801034ae + np->ofile[i] = filedup(curproc->ofile[i]); +801034be: 83 ec 0c sub $0xc,%esp +801034c1: 50 push %eax +801034c2: e8 2d d8 ff ff call 80100cf4 +801034c7: 8b 55 e4 mov -0x1c(%ebp),%edx +801034ca: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) +801034ce: 83 c4 10 add $0x10,%esp +801034d1: eb db jmp 801034ae np->cwd = idup(curproc->cwd); -8010361e: 83 ec 0c sub $0xc,%esp -80103621: ff 73 68 pushl 0x68(%ebx) -80103624: e8 d4 de ff ff call 801014fd -80103629: 8b 7d e4 mov -0x1c(%ebp),%edi -8010362c: 89 47 68 mov %eax,0x68(%edi) +801034d3: 83 ec 0c sub $0xc,%esp +801034d6: ff 73 68 push 0x68(%ebx) +801034d9: e8 aa df ff ff call 80101488 +801034de: 8b 7d e4 mov -0x1c(%ebp),%edi +801034e1: 89 47 68 mov %eax,0x68(%edi) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); -8010362f: 83 c4 0c add $0xc,%esp -80103632: 6a 10 push $0x10 -80103634: 83 c3 6c add $0x6c,%ebx -80103637: 53 push %ebx -80103638: 8d 47 6c lea 0x6c(%edi),%eax -8010363b: 50 push %eax -8010363c: e8 a4 0a 00 00 call 801040e5 +801034e4: 83 c4 0c add $0xc,%esp +801034e7: 6a 10 push $0x10 +801034e9: 83 c3 6c add $0x6c,%ebx +801034ec: 53 push %ebx +801034ed: 8d 47 6c lea 0x6c(%edi),%eax +801034f0: 50 push %eax +801034f1: e8 39 0a 00 00 call 80103f2f pid = np->pid; -80103641: 8b 5f 10 mov 0x10(%edi),%ebx +801034f6: 8b 5f 10 mov 0x10(%edi),%ebx acquire(&ptable.lock); -80103644: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -8010364b: e8 49 08 00 00 call 80103e99 +801034f9: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103500: e8 fc 07 00 00 call 80103d01 np->state = RUNNABLE; -80103650: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) +80103505: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) release(&ptable.lock); -80103657: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -8010365e: e8 a1 08 00 00 call 80103f04 +8010350c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103513: e8 50 08 00 00 call 80103d68 return pid; -80103663: 83 c4 10 add $0x10,%esp -} -80103666: 89 d8 mov %ebx,%eax -80103668: 8d 65 f4 lea -0xc(%ebp),%esp -8010366b: 5b pop %ebx -8010366c: 5e pop %esi -8010366d: 5f pop %edi -8010366e: 5d pop %ebp -8010366f: c3 ret +80103518: 83 c4 10 add $0x10,%esp +} +8010351b: 89 d8 mov %ebx,%eax +8010351d: 8d 65 f4 lea -0xc(%ebp),%esp +80103520: 5b pop %ebx +80103521: 5e pop %esi +80103522: 5f pop %edi +80103523: 5d pop %ebp +80103524: c3 ret return -1; -80103670: bb ff ff ff ff mov $0xffffffff,%ebx -80103675: eb ef jmp 80103666 - -80103677 : -{ -80103677: f3 0f 1e fb endbr32 -8010367b: 55 push %ebp -8010367c: 89 e5 mov %esp,%ebp -8010367e: 57 push %edi -8010367f: 56 push %esi -80103680: 53 push %ebx -80103681: 83 ec 0c sub $0xc,%esp +80103525: bb ff ff ff ff mov $0xffffffff,%ebx +8010352a: eb ef jmp 8010351b + +8010352c : +{ +8010352c: 55 push %ebp +8010352d: 89 e5 mov %esp,%ebp +8010352f: 57 push %edi +80103530: 56 push %esi +80103531: 53 push %ebx +80103532: 83 ec 0c sub $0xc,%esp struct cpu *c = mycpu(); -80103684: e8 dd fc ff ff call 80103366 -80103689: 89 c6 mov %eax,%esi +80103535: e8 fc fc ff ff call 80103236 +8010353a: 89 c6 mov %eax,%esi c->proc = 0; -8010368b: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) -80103692: 00 00 00 +8010353c: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) +80103543: 00 00 00 swtch(&(c->scheduler), p->context); -80103695: 8d 78 04 lea 0x4(%eax),%edi -80103698: eb 5a jmp 801036f4 +80103546: 8d 78 04 lea 0x4(%eax),%edi +80103549: eb 5a jmp 801035a5 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -8010369a: 81 c3 84 00 00 00 add $0x84,%ebx -801036a0: 81 fb b4 61 11 80 cmp $0x801161b4,%ebx -801036a6: 74 3c je 801036e4 +8010354b: 81 c3 84 00 00 00 add $0x84,%ebx +80103551: 81 fb 94 35 11 80 cmp $0x80113594,%ebx +80103557: 74 3c je 80103595 if(p->state != RUNNABLE) -801036a8: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) -801036ac: 75 ec jne 8010369a +80103559: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) +8010355d: 75 ec jne 8010354b c->proc = p; -801036ae: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) +8010355f: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); -801036b4: 83 ec 0c sub $0xc,%esp -801036b7: 53 push %ebx -801036b8: e8 26 2a 00 00 call 801060e3 +80103565: 83 ec 0c sub $0xc,%esp +80103568: 53 push %ebx +80103569: e8 21 29 00 00 call 80105e8f p->state = RUNNING; -801036bd: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) +8010356e: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) swtch(&(c->scheduler), p->context); -801036c4: 83 c4 08 add $0x8,%esp -801036c7: ff 73 1c pushl 0x1c(%ebx) -801036ca: 57 push %edi -801036cb: e8 75 0a 00 00 call 80104145 +80103575: 83 c4 08 add $0x8,%esp +80103578: ff 73 1c push 0x1c(%ebx) +8010357b: 57 push %edi +8010357c: e8 06 0a 00 00 call 80103f87 switchkvm(); -801036d0: e8 fc 29 00 00 call 801060d1 +80103581: e8 fb 28 00 00 call 80105e81 c->proc = 0; -801036d5: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) -801036dc: 00 00 00 -801036df: 83 c4 10 add $0x10,%esp -801036e2: eb b6 jmp 8010369a +80103586: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) +8010358d: 00 00 00 +80103590: 83 c4 10 add $0x10,%esp +80103593: eb b6 jmp 8010354b release(&ptable.lock); -801036e4: 83 ec 0c sub $0xc,%esp -801036e7: 68 40 59 11 80 push $0x80115940 -801036ec: e8 13 08 00 00 call 80103f04 +80103595: 83 ec 0c sub $0xc,%esp +80103598: 68 20 2d 11 80 push $0x80112d20 +8010359d: e8 c6 07 00 00 call 80103d68 sti(); -801036f1: 83 c4 10 add $0x10,%esp +801035a2: 83 c4 10 add $0x10,%esp asm volatile("sti"); -801036f4: fb sti +801035a5: fb sti acquire(&ptable.lock); -801036f5: 83 ec 0c sub $0xc,%esp -801036f8: 68 40 59 11 80 push $0x80115940 -801036fd: e8 97 07 00 00 call 80103e99 -80103702: 83 c4 10 add $0x10,%esp +801035a6: 83 ec 0c sub $0xc,%esp +801035a9: 68 20 2d 11 80 push $0x80112d20 +801035ae: e8 4e 07 00 00 call 80103d01 +801035b3: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103705: bb 74 59 11 80 mov $0x80115974,%ebx -8010370a: eb 9c jmp 801036a8 +801035b6: bb 54 2d 11 80 mov $0x80112d54,%ebx +801035bb: eb 9c jmp 80103559 -8010370c : +801035bd : { -8010370c: f3 0f 1e fb endbr32 -80103710: 55 push %ebp -80103711: 89 e5 mov %esp,%ebp -80103713: 56 push %esi -80103714: 53 push %ebx +801035bd: 55 push %ebp +801035be: 89 e5 mov %esp,%ebp +801035c0: 56 push %esi +801035c1: 53 push %ebx struct proc *p = myproc(); -80103715: e8 d0 fc ff ff call 801033ea -8010371a: 89 c3 mov %eax,%ebx +801035c2: e8 e9 fc ff ff call 801032b0 +801035c7: 89 c3 mov %eax,%ebx if(!holding(&ptable.lock)) -8010371c: 83 ec 0c sub $0xc,%esp -8010371f: 68 40 59 11 80 push $0x80115940 -80103724: e8 38 07 00 00 call 80103e61 -80103729: 83 c4 10 add $0x10,%esp -8010372c: 85 c0 test %eax,%eax -8010372e: 74 4f je 8010377f +801035c9: 83 ec 0c sub $0xc,%esp +801035cc: 68 20 2d 11 80 push $0x80112d20 +801035d1: e8 f7 06 00 00 call 80103ccd +801035d6: 83 c4 10 add $0x10,%esp +801035d9: 85 c0 test %eax,%eax +801035db: 74 4f je 8010362c if(mycpu()->ncli != 1) -80103730: e8 31 fc ff ff call 80103366 -80103735: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) -8010373c: 75 4e jne 8010378c +801035dd: e8 54 fc ff ff call 80103236 +801035e2: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) +801035e9: 75 4e jne 80103639 if(p->state == RUNNING) -8010373e: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) -80103742: 74 55 je 80103799 +801035eb: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) +801035ef: 74 55 je 80103646 asm volatile("pushfl; popl %0" : "=r" (eflags)); -80103744: 9c pushf -80103745: 58 pop %eax +801035f1: 9c pushf +801035f2: 58 pop %eax if(readeflags()&FL_IF) -80103746: f6 c4 02 test $0x2,%ah -80103749: 75 5b jne 801037a6 +801035f3: f6 c4 02 test $0x2,%ah +801035f6: 75 5b jne 80103653 intena = mycpu()->intena; -8010374b: e8 16 fc ff ff call 80103366 -80103750: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi +801035f8: e8 39 fc ff ff call 80103236 +801035fd: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi swtch(&p->context, mycpu()->scheduler); -80103756: e8 0b fc ff ff call 80103366 -8010375b: 83 ec 08 sub $0x8,%esp -8010375e: ff 70 04 pushl 0x4(%eax) -80103761: 83 c3 1c add $0x1c,%ebx -80103764: 53 push %ebx -80103765: e8 db 09 00 00 call 80104145 +80103603: e8 2e fc ff ff call 80103236 +80103608: 83 ec 08 sub $0x8,%esp +8010360b: ff 70 04 push 0x4(%eax) +8010360e: 83 c3 1c add $0x1c,%ebx +80103611: 53 push %ebx +80103612: e8 70 09 00 00 call 80103f87 mycpu()->intena = intena; -8010376a: e8 f7 fb ff ff call 80103366 -8010376f: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) -} -80103775: 83 c4 10 add $0x10,%esp -80103778: 8d 65 f8 lea -0x8(%ebp),%esp -8010377b: 5b pop %ebx -8010377c: 5e pop %esi -8010377d: 5d pop %ebp -8010377e: c3 ret +80103617: e8 1a fc ff ff call 80103236 +8010361c: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) +} +80103622: 83 c4 10 add $0x10,%esp +80103625: 8d 65 f8 lea -0x8(%ebp),%esp +80103628: 5b pop %ebx +80103629: 5e pop %esi +8010362a: 5d pop %ebp +8010362b: c3 ret panic("sched ptable.lock"); -8010377f: 83 ec 0c sub $0xc,%esp -80103782: 68 fb 7d 10 80 push $0x80107dfb -80103787: e8 cc cb ff ff call 80100358 +8010362c: 83 ec 0c sub $0xc,%esp +8010362f: 68 1b 7b 10 80 push $0x80107b1b +80103634: e8 07 cd ff ff call 80100340 panic("sched locks"); -8010378c: 83 ec 0c sub $0xc,%esp -8010378f: 68 0d 7e 10 80 push $0x80107e0d -80103794: e8 bf cb ff ff call 80100358 +80103639: 83 ec 0c sub $0xc,%esp +8010363c: 68 2d 7b 10 80 push $0x80107b2d +80103641: e8 fa cc ff ff call 80100340 panic("sched running"); -80103799: 83 ec 0c sub $0xc,%esp -8010379c: 68 19 7e 10 80 push $0x80107e19 -801037a1: e8 b2 cb ff ff call 80100358 +80103646: 83 ec 0c sub $0xc,%esp +80103649: 68 39 7b 10 80 push $0x80107b39 +8010364e: e8 ed cc ff ff call 80100340 panic("sched interruptible"); -801037a6: 83 ec 0c sub $0xc,%esp -801037a9: 68 27 7e 10 80 push $0x80107e27 -801037ae: e8 a5 cb ff ff call 80100358 - -801037b3 : -{ -801037b3: f3 0f 1e fb endbr32 -801037b7: 55 push %ebp -801037b8: 89 e5 mov %esp,%ebp -801037ba: 57 push %edi -801037bb: 56 push %esi -801037bc: 53 push %ebx -801037bd: 83 ec 0c sub $0xc,%esp +80103653: 83 ec 0c sub $0xc,%esp +80103656: 68 47 7b 10 80 push $0x80107b47 +8010365b: e8 e0 cc ff ff call 80100340 + +80103660 : +{ +80103660: 55 push %ebp +80103661: 89 e5 mov %esp,%ebp +80103663: 57 push %edi +80103664: 56 push %esi +80103665: 53 push %ebx +80103666: 83 ec 0c sub $0xc,%esp struct proc *curproc = myproc(); -801037c0: e8 25 fc ff ff call 801033ea -801037c5: 89 c6 mov %eax,%esi +80103669: e8 42 fc ff ff call 801032b0 +8010366e: 89 c6 mov %eax,%esi if(curproc == initproc) -801037c7: 8d 58 28 lea 0x28(%eax),%ebx -801037ca: 8d 78 68 lea 0x68(%eax),%edi -801037cd: 39 05 b8 b5 10 80 cmp %eax,0x8010b5b8 -801037d3: 75 26 jne 801037fb +80103670: 8d 58 28 lea 0x28(%eax),%ebx +80103673: 8d 78 68 lea 0x68(%eax),%edi +80103676: 39 05 94 35 11 80 cmp %eax,0x80113594 +8010367c: 75 14 jne 80103692 panic("init exiting"); -801037d5: 83 ec 0c sub $0xc,%esp -801037d8: 68 3b 7e 10 80 push $0x80107e3b -801037dd: e8 76 cb ff ff call 80100358 - fileclose(curproc->ofile[fd]); -801037e2: 83 ec 0c sub $0xc,%esp -801037e5: 50 push %eax -801037e6: e8 96 d5 ff ff call 80100d81 - curproc->ofile[fd] = 0; -801037eb: c7 03 00 00 00 00 movl $0x0,(%ebx) -801037f1: 83 c4 10 add $0x10,%esp +8010367e: 83 ec 0c sub $0xc,%esp +80103681: 68 5b 7b 10 80 push $0x80107b5b +80103686: e8 b5 cc ff ff call 80100340 for(fd = 0; fd < NOFILE; fd++){ -801037f4: 83 c3 04 add $0x4,%ebx -801037f7: 39 fb cmp %edi,%ebx -801037f9: 74 08 je 80103803 +8010368b: 83 c3 04 add $0x4,%ebx +8010368e: 39 fb cmp %edi,%ebx +80103690: 74 1a je 801036ac if(curproc->ofile[fd]){ -801037fb: 8b 03 mov (%ebx),%eax -801037fd: 85 c0 test %eax,%eax -801037ff: 75 e1 jne 801037e2 -80103801: eb f1 jmp 801037f4 +80103692: 8b 03 mov (%ebx),%eax +80103694: 85 c0 test %eax,%eax +80103696: 74 f3 je 8010368b + fileclose(curproc->ofile[fd]); +80103698: 83 ec 0c sub $0xc,%esp +8010369b: 50 push %eax +8010369c: e8 98 d6 ff ff call 80100d39 + curproc->ofile[fd] = 0; +801036a1: c7 03 00 00 00 00 movl $0x0,(%ebx) +801036a7: 83 c4 10 add $0x10,%esp +801036aa: eb df jmp 8010368b begin_op(); -80103803: e8 78 f0 ff ff call 80102880 +801036ac: e8 cd f0 ff ff call 8010277e iput(curproc->cwd); -80103808: 83 ec 0c sub $0xc,%esp -8010380b: ff 76 68 pushl 0x68(%esi) -8010380e: e8 28 de ff ff call 8010163b +801036b1: 83 ec 0c sub $0xc,%esp +801036b4: ff 76 68 push 0x68(%esi) +801036b7: e8 fe de ff ff call 801015ba end_op(); -80103813: e8 e7 f0 ff ff call 801028ff +801036bc: e8 38 f1 ff ff call 801027f9 curproc->cwd = 0; -80103818: c7 46 68 00 00 00 00 movl $0x0,0x68(%esi) +801036c1: c7 46 68 00 00 00 00 movl $0x0,0x68(%esi) acquire(&ptable.lock); -8010381f: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -80103826: e8 6e 06 00 00 call 80103e99 +801036c8: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801036cf: e8 2d 06 00 00 call 80103d01 wakeup1(curproc->parent); -8010382b: 8b 46 14 mov 0x14(%esi),%eax -8010382e: e8 d1 f9 ff ff call 80103204 -80103833: 83 c4 10 add $0x10,%esp +801036d4: 8b 46 14 mov 0x14(%esi),%eax +801036d7: e8 00 fa ff ff call 801030dc +801036dc: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103836: bb 74 59 11 80 mov $0x80115974,%ebx -8010383b: eb 13 jmp 80103850 - wakeup1(initproc); -8010383d: e8 c2 f9 ff ff call 80103204 - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103842: 81 c3 84 00 00 00 add $0x84,%ebx -80103848: 81 fb b4 61 11 80 cmp $0x801161b4,%ebx -8010384e: 74 15 je 80103865 +801036df: bb 54 2d 11 80 mov $0x80112d54,%ebx +801036e4: eb 0e jmp 801036f4 +801036e6: 81 c3 84 00 00 00 add $0x84,%ebx +801036ec: 81 fb 94 35 11 80 cmp $0x80113594,%ebx +801036f2: 74 1a je 8010370e if(p->parent == curproc){ -80103850: 39 73 14 cmp %esi,0x14(%ebx) -80103853: 75 ed jne 80103842 +801036f4: 39 73 14 cmp %esi,0x14(%ebx) +801036f7: 75 ed jne 801036e6 p->parent = initproc; -80103855: a1 b8 b5 10 80 mov 0x8010b5b8,%eax -8010385a: 89 43 14 mov %eax,0x14(%ebx) +801036f9: a1 94 35 11 80 mov 0x80113594,%eax +801036fe: 89 43 14 mov %eax,0x14(%ebx) if(p->state == ZOMBIE) -8010385d: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) -80103861: 75 df jne 80103842 -80103863: eb d8 jmp 8010383d +80103701: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) +80103705: 75 df jne 801036e6 + wakeup1(initproc); +80103707: e8 d0 f9 ff ff call 801030dc +8010370c: eb d8 jmp 801036e6 curproc->state = ZOMBIE; -80103865: c7 46 0c 05 00 00 00 movl $0x5,0xc(%esi) +8010370e: c7 46 0c 05 00 00 00 movl $0x5,0xc(%esi) sched(); -8010386c: e8 9b fe ff ff call 8010370c +80103715: e8 a3 fe ff ff call 801035bd panic("zombie exit"); -80103871: 83 ec 0c sub $0xc,%esp -80103874: 68 48 7e 10 80 push $0x80107e48 -80103879: e8 da ca ff ff call 80100358 +8010371a: 83 ec 0c sub $0xc,%esp +8010371d: 68 68 7b 10 80 push $0x80107b68 +80103722: e8 19 cc ff ff call 80100340 -8010387e : +80103727 : { -8010387e: f3 0f 1e fb endbr32 -80103882: 55 push %ebp -80103883: 89 e5 mov %esp,%ebp -80103885: 83 ec 14 sub $0x14,%esp +80103727: 55 push %ebp +80103728: 89 e5 mov %esp,%ebp +8010372a: 83 ec 14 sub $0x14,%esp acquire(&ptable.lock); //DOC: yieldlock -80103888: 68 40 59 11 80 push $0x80115940 -8010388d: e8 07 06 00 00 call 80103e99 +8010372d: 68 20 2d 11 80 push $0x80112d20 +80103732: e8 ca 05 00 00 call 80103d01 myproc()->state = RUNNABLE; -80103892: e8 53 fb ff ff call 801033ea -80103897: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) +80103737: e8 74 fb ff ff call 801032b0 +8010373c: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) sched(); -8010389e: e8 69 fe ff ff call 8010370c +80103743: e8 75 fe ff ff call 801035bd release(&ptable.lock); -801038a3: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -801038aa: e8 55 06 00 00 call 80103f04 +80103748: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +8010374f: e8 14 06 00 00 call 80103d68 } -801038af: 83 c4 10 add $0x10,%esp -801038b2: c9 leave -801038b3: c3 ret +80103754: 83 c4 10 add $0x10,%esp +80103757: c9 leave +80103758: c3 ret -801038b4 : +80103759 : { -801038b4: f3 0f 1e fb endbr32 -801038b8: 55 push %ebp -801038b9: 89 e5 mov %esp,%ebp -801038bb: 56 push %esi -801038bc: 53 push %ebx -801038bd: 8b 75 0c mov 0xc(%ebp),%esi +80103759: 55 push %ebp +8010375a: 89 e5 mov %esp,%ebp +8010375c: 56 push %esi +8010375d: 53 push %ebx +8010375e: 8b 75 0c mov 0xc(%ebp),%esi struct proc *p = myproc(); -801038c0: e8 25 fb ff ff call 801033ea +80103761: e8 4a fb ff ff call 801032b0 if(p == 0) -801038c5: 85 c0 test %eax,%eax -801038c7: 74 5a je 80103923 -801038c9: 89 c3 mov %eax,%ebx +80103766: 85 c0 test %eax,%eax +80103768: 74 5a je 801037c4 +8010376a: 89 c3 mov %eax,%ebx if(lk == 0) -801038cb: 85 f6 test %esi,%esi -801038cd: 74 61 je 80103930 +8010376c: 85 f6 test %esi,%esi +8010376e: 74 61 je 801037d1 if(lk != &ptable.lock){ //DOC: sleeplock0 -801038cf: 81 fe 40 59 11 80 cmp $0x80115940,%esi -801038d5: 74 66 je 8010393d +80103770: 81 fe 20 2d 11 80 cmp $0x80112d20,%esi +80103776: 74 66 je 801037de acquire(&ptable.lock); //DOC: sleeplock1 -801038d7: 83 ec 0c sub $0xc,%esp -801038da: 68 40 59 11 80 push $0x80115940 -801038df: e8 b5 05 00 00 call 80103e99 +80103778: 83 ec 0c sub $0xc,%esp +8010377b: 68 20 2d 11 80 push $0x80112d20 +80103780: e8 7c 05 00 00 call 80103d01 release(lk); -801038e4: 89 34 24 mov %esi,(%esp) -801038e7: e8 18 06 00 00 call 80103f04 +80103785: 89 34 24 mov %esi,(%esp) +80103788: e8 db 05 00 00 call 80103d68 p->chan = chan; -801038ec: 8b 45 08 mov 0x8(%ebp),%eax -801038ef: 89 43 20 mov %eax,0x20(%ebx) +8010378d: 8b 45 08 mov 0x8(%ebp),%eax +80103790: 89 43 20 mov %eax,0x20(%ebx) p->state = SLEEPING; -801038f2: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) +80103793: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); -801038f9: e8 0e fe ff ff call 8010370c +8010379a: e8 1e fe ff ff call 801035bd p->chan = 0; -801038fe: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) +8010379f: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) release(&ptable.lock); -80103905: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -8010390c: e8 f3 05 00 00 call 80103f04 +801037a6: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801037ad: e8 b6 05 00 00 call 80103d68 acquire(lk); -80103911: 89 34 24 mov %esi,(%esp) -80103914: e8 80 05 00 00 call 80103e99 -80103919: 83 c4 10 add $0x10,%esp -} -8010391c: 8d 65 f8 lea -0x8(%ebp),%esp -8010391f: 5b pop %ebx -80103920: 5e pop %esi -80103921: 5d pop %ebp -80103922: c3 ret +801037b2: 89 34 24 mov %esi,(%esp) +801037b5: e8 47 05 00 00 call 80103d01 +801037ba: 83 c4 10 add $0x10,%esp +} +801037bd: 8d 65 f8 lea -0x8(%ebp),%esp +801037c0: 5b pop %ebx +801037c1: 5e pop %esi +801037c2: 5d pop %ebp +801037c3: c3 ret panic("sleep"); -80103923: 83 ec 0c sub $0xc,%esp -80103926: 68 54 7e 10 80 push $0x80107e54 -8010392b: e8 28 ca ff ff call 80100358 +801037c4: 83 ec 0c sub $0xc,%esp +801037c7: 68 74 7b 10 80 push $0x80107b74 +801037cc: e8 6f cb ff ff call 80100340 panic("sleep without lk"); -80103930: 83 ec 0c sub $0xc,%esp -80103933: 68 5a 7e 10 80 push $0x80107e5a -80103938: e8 1b ca ff ff call 80100358 +801037d1: 83 ec 0c sub $0xc,%esp +801037d4: 68 7a 7b 10 80 push $0x80107b7a +801037d9: e8 62 cb ff ff call 80100340 p->chan = chan; -8010393d: 8b 45 08 mov 0x8(%ebp),%eax -80103940: 89 43 20 mov %eax,0x20(%ebx) +801037de: 8b 45 08 mov 0x8(%ebp),%eax +801037e1: 89 43 20 mov %eax,0x20(%ebx) p->state = SLEEPING; -80103943: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) +801037e4: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); -8010394a: e8 bd fd ff ff call 8010370c +801037eb: e8 cd fd ff ff call 801035bd p->chan = 0; -8010394f: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) +801037f0: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) if(lk != &ptable.lock){ //DOC: sleeplock2 -80103956: eb c4 jmp 8010391c +801037f7: eb c4 jmp 801037bd -80103958 : +801037f9 : { -80103958: f3 0f 1e fb endbr32 -8010395c: 55 push %ebp -8010395d: 89 e5 mov %esp,%ebp -8010395f: 57 push %edi -80103960: 56 push %esi -80103961: 53 push %ebx -80103962: 83 ec 0c sub $0xc,%esp +801037f9: 55 push %ebp +801037fa: 89 e5 mov %esp,%ebp +801037fc: 57 push %edi +801037fd: 56 push %esi +801037fe: 53 push %ebx +801037ff: 83 ec 0c sub $0xc,%esp struct proc *curproc = myproc(); -80103965: e8 80 fa ff ff call 801033ea -8010396a: 89 c6 mov %eax,%esi +80103802: e8 a9 fa ff ff call 801032b0 +80103807: 89 c6 mov %eax,%esi acquire(&ptable.lock); -8010396c: 83 ec 0c sub $0xc,%esp -8010396f: 68 40 59 11 80 push $0x80115940 -80103974: e8 20 05 00 00 call 80103e99 -80103979: 83 c4 10 add $0x10,%esp +80103809: 83 ec 0c sub $0xc,%esp +8010380c: 68 20 2d 11 80 push $0x80112d20 +80103811: e8 eb 04 00 00 call 80103d01 +80103816: 83 c4 10 add $0x10,%esp havekids = 1; -8010397c: bf 01 00 00 00 mov $0x1,%edi +80103819: bf 01 00 00 00 mov $0x1,%edi havekids = 0; -80103981: b8 00 00 00 00 mov $0x0,%eax +8010381e: b8 00 00 00 00 mov $0x0,%eax for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103986: bb 74 59 11 80 mov $0x80115974,%ebx -8010398b: eb 5f jmp 801039ec +80103823: bb 54 2d 11 80 mov $0x80112d54,%ebx +80103828: eb 5f jmp 80103889 pid = p->pid; -8010398d: 8b 73 10 mov 0x10(%ebx),%esi +8010382a: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); -80103990: 83 ec 0c sub $0xc,%esp -80103993: ff 73 08 pushl 0x8(%ebx) -80103996: e8 20 e7 ff ff call 801020bb +8010382d: 83 ec 0c sub $0xc,%esp +80103830: ff 73 08 push 0x8(%ebx) +80103833: e8 c4 e7 ff ff call 80101ffc p->kstack = 0; -8010399b: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) +80103838: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); -801039a2: 83 c4 04 add $0x4,%esp -801039a5: ff 73 04 pushl 0x4(%ebx) -801039a8: e8 da 2a 00 00 call 80106487 +8010383f: 83 c4 04 add $0x4,%esp +80103842: ff 73 04 push 0x4(%ebx) +80103845: e8 d4 29 00 00 call 8010621e p->pid = 0; -801039ad: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) +8010384a: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; -801039b4: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) +80103851: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; -801039bb: c6 43 6c 00 movb $0x0,0x6c(%ebx) +80103858: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; -801039bf: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) +8010385c: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; -801039c6: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) +80103863: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) release(&ptable.lock); -801039cd: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -801039d4: e8 2b 05 00 00 call 80103f04 +8010386a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +80103871: e8 f2 04 00 00 call 80103d68 return pid; -801039d9: 83 c4 10 add $0x10,%esp -801039dc: eb 3c jmp 80103a1a +80103876: 83 c4 10 add $0x10,%esp +80103879: eb 3c jmp 801038b7 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -801039de: 81 c3 84 00 00 00 add $0x84,%ebx -801039e4: 81 fb b4 61 11 80 cmp $0x801161b4,%ebx -801039ea: 74 0f je 801039fb +8010387b: 81 c3 84 00 00 00 add $0x84,%ebx +80103881: 81 fb 94 35 11 80 cmp $0x80113594,%ebx +80103887: 74 0f je 80103898 if(p->parent != curproc) -801039ec: 39 73 14 cmp %esi,0x14(%ebx) -801039ef: 75 ed jne 801039de +80103889: 39 73 14 cmp %esi,0x14(%ebx) +8010388c: 75 ed jne 8010387b if(p->state == ZOMBIE){ -801039f1: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) -801039f5: 74 96 je 8010398d +8010388e: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) +80103892: 74 96 je 8010382a havekids = 1; -801039f7: 89 f8 mov %edi,%eax -801039f9: eb e3 jmp 801039de +80103894: 89 f8 mov %edi,%eax +80103896: eb e3 jmp 8010387b if(!havekids || curproc->killed){ -801039fb: 85 c0 test %eax,%eax -801039fd: 74 06 je 80103a05 -801039ff: 83 7e 24 00 cmpl $0x0,0x24(%esi) -80103a03: 74 1f je 80103a24 +80103898: 85 c0 test %eax,%eax +8010389a: 74 06 je 801038a2 +8010389c: 83 7e 24 00 cmpl $0x0,0x24(%esi) +801038a0: 74 1f je 801038c1 release(&ptable.lock); -80103a05: 83 ec 0c sub $0xc,%esp -80103a08: 68 40 59 11 80 push $0x80115940 -80103a0d: e8 f2 04 00 00 call 80103f04 +801038a2: 83 ec 0c sub $0xc,%esp +801038a5: 68 20 2d 11 80 push $0x80112d20 +801038aa: e8 b9 04 00 00 call 80103d68 return -1; -80103a12: 83 c4 10 add $0x10,%esp -80103a15: be ff ff ff ff mov $0xffffffff,%esi -} -80103a1a: 89 f0 mov %esi,%eax -80103a1c: 8d 65 f4 lea -0xc(%ebp),%esp -80103a1f: 5b pop %ebx -80103a20: 5e pop %esi -80103a21: 5f pop %edi -80103a22: 5d pop %ebp -80103a23: c3 ret +801038af: 83 c4 10 add $0x10,%esp +801038b2: be ff ff ff ff mov $0xffffffff,%esi +} +801038b7: 89 f0 mov %esi,%eax +801038b9: 8d 65 f4 lea -0xc(%ebp),%esp +801038bc: 5b pop %ebx +801038bd: 5e pop %esi +801038be: 5f pop %edi +801038bf: 5d pop %ebp +801038c0: c3 ret sleep(curproc, &ptable.lock); //DOC: wait-sleep -80103a24: 83 ec 08 sub $0x8,%esp -80103a27: 68 40 59 11 80 push $0x80115940 -80103a2c: 56 push %esi -80103a2d: e8 82 fe ff ff call 801038b4 +801038c1: 83 ec 08 sub $0x8,%esp +801038c4: 68 20 2d 11 80 push $0x80112d20 +801038c9: 56 push %esi +801038ca: e8 8a fe ff ff call 80103759 havekids = 0; -80103a32: 83 c4 10 add $0x10,%esp -80103a35: e9 47 ff ff ff jmp 80103981 +801038cf: 83 c4 10 add $0x10,%esp +801038d2: e9 47 ff ff ff jmp 8010381e -80103a3a : +801038d7 : // Wake up all processes sleeping on chan. void wakeup(void *chan) { -80103a3a: f3 0f 1e fb endbr32 -80103a3e: 55 push %ebp -80103a3f: 89 e5 mov %esp,%ebp -80103a41: 83 ec 14 sub $0x14,%esp +801038d7: 55 push %ebp +801038d8: 89 e5 mov %esp,%ebp +801038da: 83 ec 14 sub $0x14,%esp acquire(&ptable.lock); -80103a44: 68 40 59 11 80 push $0x80115940 -80103a49: e8 4b 04 00 00 call 80103e99 +801038dd: 68 20 2d 11 80 push $0x80112d20 +801038e2: e8 1a 04 00 00 call 80103d01 wakeup1(chan); -80103a4e: 8b 45 08 mov 0x8(%ebp),%eax -80103a51: e8 ae f7 ff ff call 80103204 +801038e7: 8b 45 08 mov 0x8(%ebp),%eax +801038ea: e8 ed f7 ff ff call 801030dc release(&ptable.lock); -80103a56: c7 04 24 40 59 11 80 movl $0x80115940,(%esp) -80103a5d: e8 a2 04 00 00 call 80103f04 +801038ef: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) +801038f6: e8 6d 04 00 00 call 80103d68 } -80103a62: 83 c4 10 add $0x10,%esp -80103a65: c9 leave -80103a66: c3 ret +801038fb: 83 c4 10 add $0x10,%esp +801038fe: c9 leave +801038ff: c3 ret -80103a67 : +80103900 : // 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) { -80103a67: f3 0f 1e fb endbr32 -80103a6b: 55 push %ebp -80103a6c: 89 e5 mov %esp,%ebp -80103a6e: 53 push %ebx -80103a6f: 83 ec 10 sub $0x10,%esp -80103a72: 8b 5d 08 mov 0x8(%ebp),%ebx +80103900: 55 push %ebp +80103901: 89 e5 mov %esp,%ebp +80103903: 53 push %ebx +80103904: 83 ec 10 sub $0x10,%esp +80103907: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *p; acquire(&ptable.lock); -80103a75: 68 40 59 11 80 push $0x80115940 -80103a7a: e8 1a 04 00 00 call 80103e99 -80103a7f: 83 c4 10 add $0x10,%esp +8010390a: 68 20 2d 11 80 push $0x80112d20 +8010390f: e8 ed 03 00 00 call 80103d01 +80103914: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103a82: b8 74 59 11 80 mov $0x80115974,%eax +80103917: b8 54 2d 11 80 mov $0x80112d54,%eax if(p->pid == pid){ -80103a87: 39 58 10 cmp %ebx,0x10(%eax) -80103a8a: 74 26 je 80103ab2 +8010391c: 39 58 10 cmp %ebx,0x10(%eax) +8010391f: 74 26 je 80103947 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103a8c: 05 84 00 00 00 add $0x84,%eax -80103a91: 3d b4 61 11 80 cmp $0x801161b4,%eax -80103a96: 75 ef jne 80103a87 +80103921: 05 84 00 00 00 add $0x84,%eax +80103926: 3d 94 35 11 80 cmp $0x80113594,%eax +8010392b: 75 ef jne 8010391c p->state = RUNNABLE; release(&ptable.lock); return 0; } } release(&ptable.lock); -80103a98: 83 ec 0c sub $0xc,%esp -80103a9b: 68 40 59 11 80 push $0x80115940 -80103aa0: e8 5f 04 00 00 call 80103f04 +8010392d: 83 ec 0c sub $0xc,%esp +80103930: 68 20 2d 11 80 push $0x80112d20 +80103935: e8 2e 04 00 00 call 80103d68 return -1; -80103aa5: 83 c4 10 add $0x10,%esp -80103aa8: b8 ff ff ff ff mov $0xffffffff,%eax +8010393a: 83 c4 10 add $0x10,%esp +8010393d: b8 ff ff ff ff mov $0xffffffff,%eax } -80103aad: 8b 5d fc mov -0x4(%ebp),%ebx -80103ab0: c9 leave -80103ab1: c3 ret +80103942: 8b 5d fc mov -0x4(%ebp),%ebx +80103945: c9 leave +80103946: c3 ret p->killed = 1; -80103ab2: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) +80103947: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) if(p->state == SLEEPING) -80103ab9: 83 78 0c 02 cmpl $0x2,0xc(%eax) -80103abd: 74 17 je 80103ad6 +8010394e: 83 78 0c 02 cmpl $0x2,0xc(%eax) +80103952: 74 17 je 8010396b release(&ptable.lock); -80103abf: 83 ec 0c sub $0xc,%esp -80103ac2: 68 40 59 11 80 push $0x80115940 -80103ac7: e8 38 04 00 00 call 80103f04 +80103954: 83 ec 0c sub $0xc,%esp +80103957: 68 20 2d 11 80 push $0x80112d20 +8010395c: e8 07 04 00 00 call 80103d68 return 0; -80103acc: 83 c4 10 add $0x10,%esp -80103acf: b8 00 00 00 00 mov $0x0,%eax -80103ad4: eb d7 jmp 80103aad +80103961: 83 c4 10 add $0x10,%esp +80103964: b8 00 00 00 00 mov $0x0,%eax +80103969: eb d7 jmp 80103942 p->state = RUNNABLE; -80103ad6: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) -80103add: eb e0 jmp 80103abf +8010396b: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) +80103972: eb e0 jmp 80103954 -80103adf : +80103974 : // 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) { -80103adf: f3 0f 1e fb endbr32 -80103ae3: 55 push %ebp -80103ae4: 89 e5 mov %esp,%ebp -80103ae6: 57 push %edi -80103ae7: 56 push %esi -80103ae8: 53 push %ebx -80103ae9: 83 ec 3c sub $0x3c,%esp +80103974: 55 push %ebp +80103975: 89 e5 mov %esp,%ebp +80103977: 57 push %edi +80103978: 56 push %esi +80103979: 53 push %ebx +8010397a: 83 ec 3c sub $0x3c,%esp int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103aec: bb e0 59 11 80 mov $0x801159e0,%ebx -80103af1: bf 20 62 11 80 mov $0x80116220,%edi -80103af6: eb 32 jmp 80103b2a +8010397d: bb c0 2d 11 80 mov $0x80112dc0,%ebx +80103982: bf 00 36 11 80 mov $0x80113600,%edi +80103987: eb 32 jmp 801039bb continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) state = states[p->state]; else state = "???"; cprintf("%d %s %s %p", p->pid, state, p->name); -80103af8: 56 push %esi -80103af9: 50 push %eax -80103afa: ff 76 a4 pushl -0x5c(%esi) -80103afd: 68 6f 7e 10 80 push $0x80107e6f -80103b02: e8 25 cb ff ff call 8010062c +80103989: 56 push %esi +8010398a: 52 push %edx +8010398b: ff 76 a4 push -0x5c(%esi) +8010398e: 68 8f 7b 10 80 push $0x80107b8f +80103993: e8 69 cc ff ff call 80100601 //cprintf("%d %s %s", p->pid, state, p->name); if(p->state == SLEEPING){ -80103b07: 83 c4 10 add $0x10,%esp -80103b0a: 83 7e a0 02 cmpl $0x2,-0x60(%esi) -80103b0e: 74 40 je 80103b50 +80103998: 83 c4 10 add $0x10,%esp +8010399b: 83 7e a0 02 cmpl $0x2,-0x60(%esi) +8010399f: 74 40 je 801039e1 getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); -80103b10: 83 ec 0c sub $0xc,%esp -80103b13: 68 1f 82 10 80 push $0x8010821f -80103b18: e8 0f cb ff ff call 8010062c -80103b1d: 83 c4 10 add $0x10,%esp +801039a1: 83 ec 0c sub $0xc,%esp +801039a4: 68 3f 7f 10 80 push $0x80107f3f +801039a9: e8 53 cc ff ff call 80100601 +801039ae: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ -80103b20: 81 c3 84 00 00 00 add $0x84,%ebx -80103b26: 39 fb cmp %edi,%ebx -80103b28: 74 65 je 80103b8f +801039b1: 81 c3 84 00 00 00 add $0x84,%ebx +801039b7: 39 fb cmp %edi,%ebx +801039b9: 74 65 je 80103a20 if(p->state == UNUSED) -80103b2a: 89 de mov %ebx,%esi -80103b2c: 8b 53 a0 mov -0x60(%ebx),%edx -80103b2f: 85 d2 test %edx,%edx -80103b31: 74 ed je 80103b20 +801039bb: 89 de mov %ebx,%esi +801039bd: 8b 43 a0 mov -0x60(%ebx),%eax +801039c0: 85 c0 test %eax,%eax +801039c2: 74 ed je 801039b1 state = "???"; -80103b33: b8 6b 7e 10 80 mov $0x80107e6b,%eax +801039c4: ba 8b 7b 10 80 mov $0x80107b8b,%edx if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) -80103b38: 83 fa 05 cmp $0x5,%edx -80103b3b: 77 bb ja 80103af8 -80103b3d: 8b 04 95 fc 7e 10 80 mov -0x7fef8104(,%edx,4),%eax -80103b44: 85 c0 test %eax,%eax +801039c9: 83 f8 05 cmp $0x5,%eax +801039cc: 77 bb ja 80103989 +801039ce: 8b 14 85 1c 7c 10 80 mov -0x7fef83e4(,%eax,4),%edx state = "???"; -80103b46: ba 6b 7e 10 80 mov $0x80107e6b,%edx -80103b4b: 0f 44 c2 cmove %edx,%eax -80103b4e: eb a8 jmp 80103af8 +801039d5: 85 d2 test %edx,%edx +801039d7: b8 8b 7b 10 80 mov $0x80107b8b,%eax +801039dc: 0f 44 d0 cmove %eax,%edx +801039df: eb a8 jmp 80103989 getcallerpcs((uint*)p->context->ebp+2, pc); -80103b50: 83 ec 08 sub $0x8,%esp -80103b53: 8d 45 c0 lea -0x40(%ebp),%eax -80103b56: 50 push %eax -80103b57: 8b 46 b0 mov -0x50(%esi),%eax -80103b5a: 8b 40 0c mov 0xc(%eax),%eax -80103b5d: 83 c0 08 add $0x8,%eax -80103b60: 50 push %eax -80103b61: e8 f6 01 00 00 call 80103d5c +801039e1: 83 ec 08 sub $0x8,%esp +801039e4: 8d 45 c0 lea -0x40(%ebp),%eax +801039e7: 50 push %eax +801039e8: 8b 46 b0 mov -0x50(%esi),%eax +801039eb: 8b 40 0c mov 0xc(%eax),%eax +801039ee: 83 c0 08 add $0x8,%eax +801039f1: 50 push %eax +801039f2: e8 dc 01 00 00 call 80103bd3 for(i=0; i<10 && pc[i] != 0; i++) -80103b66: 8d 75 c0 lea -0x40(%ebp),%esi -80103b69: 83 c4 10 add $0x10,%esp -80103b6c: 8b 06 mov (%esi),%eax -80103b6e: 85 c0 test %eax,%eax -80103b70: 74 9e je 80103b10 +801039f7: 8d 75 c0 lea -0x40(%ebp),%esi +801039fa: 83 c4 10 add $0x10,%esp +801039fd: 8b 06 mov (%esi),%eax +801039ff: 85 c0 test %eax,%eax +80103a01: 74 9e je 801039a1 cprintf(" %p", pc[i]); -80103b72: 83 ec 08 sub $0x8,%esp -80103b75: 50 push %eax -80103b76: 68 77 7e 10 80 push $0x80107e77 -80103b7b: e8 ac ca ff ff call 8010062c +80103a03: 83 ec 08 sub $0x8,%esp +80103a06: 50 push %eax +80103a07: 68 97 7b 10 80 push $0x80107b97 +80103a0c: e8 f0 cb ff ff call 80100601 for(i=0; i<10 && pc[i] != 0; i++) -80103b80: 83 c6 04 add $0x4,%esi -80103b83: 83 c4 10 add $0x10,%esp -80103b86: 8d 45 e8 lea -0x18(%ebp),%eax -80103b89: 39 c6 cmp %eax,%esi -80103b8b: 75 df jne 80103b6c -80103b8d: eb 81 jmp 80103b10 +80103a11: 83 c6 04 add $0x4,%esi +80103a14: 83 c4 10 add $0x10,%esp +80103a17: 8d 45 e8 lea -0x18(%ebp),%eax +80103a1a: 39 c6 cmp %eax,%esi +80103a1c: 75 df jne 801039fd +80103a1e: eb 81 jmp 801039a1 } } -80103b8f: 8d 65 f4 lea -0xc(%ebp),%esp -80103b92: 5b pop %ebx -80103b93: 5e pop %esi -80103b94: 5f pop %edi -80103b95: 5d pop %ebp -80103b96: c3 ret +80103a20: 8d 65 f4 lea -0xc(%ebp),%esp +80103a23: 5b pop %ebx +80103a24: 5e pop %esi +80103a25: 5f pop %edi +80103a26: 5d pop %ebp +80103a27: c3 ret -80103b97 : +80103a28 : void ps(void) { -80103b97: f3 0f 1e fb endbr32 -80103b9b: 55 push %ebp -80103b9c: 89 e5 mov %esp,%ebp -80103b9e: 57 push %edi -80103b9f: 56 push %esi -80103ba0: 53 push %ebx -80103ba1: 83 ec 18 sub $0x18,%esp +80103a28: 55 push %ebp +80103a29: 89 e5 mov %esp,%ebp +80103a2b: 57 push %edi +80103a2c: 56 push %esi +80103a2d: 53 push %ebx +80103a2e: 83 ec 18 sub $0x18,%esp [ZOMBIE] "zombie" }; struct proc *p; char *state, *name; acquire(&ptable.lock); -80103ba4: 68 40 59 11 80 push $0x80115940 -80103ba9: e8 eb 02 00 00 call 80103e99 -80103bae: 83 c4 10 add $0x10,%esp +80103a31: 68 20 2d 11 80 push $0x80112d20 +80103a36: e8 c6 02 00 00 call 80103d01 +80103a3b: 83 c4 10 add $0x10,%esp for( p = ptable.proc; p < &ptable.proc[NPROC]; p++) -80103bb1: bb 74 59 11 80 mov $0x80115974,%ebx +80103a3e: bb 54 2d 11 80 mov $0x80112d54,%ebx { if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) state = states[p->state]; else state = "???"; -80103bb6: bf 6b 7e 10 80 mov $0x80107e6b,%edi -80103bbb: be 7b 7e 10 80 mov $0x80107e7b,%esi -80103bc0: eb 2e jmp 80103bf0 +80103a43: bf 8b 7b 10 80 mov $0x80107b8b,%edi +80103a48: be 9b 7b 10 80 mov $0x80107b9b,%esi +80103a4d: eb 2c jmp 80103a7b if(p->state == UNUSED) -80103bc2: 85 c0 test %eax,%eax -80103bc4: 8d 4b 6c lea 0x6c(%ebx),%ecx -80103bc7: 89 c8 mov %ecx,%eax -80103bc9: 0f 44 c6 cmove %esi,%eax +80103a4f: 8d 43 6c lea 0x6c(%ebx),%eax +80103a52: 85 c9 test %ecx,%ecx +80103a54: 0f 44 c6 cmove %esi,%eax name = "unknown"; else name = p->name; cprintf("%d %s %s %p\n", p->pid, state, name, p); -80103bcc: 83 ec 0c sub $0xc,%esp -80103bcf: 53 push %ebx -80103bd0: 50 push %eax -80103bd1: 52 push %edx -80103bd2: ff 73 10 pushl 0x10(%ebx) -80103bd5: 68 83 7e 10 80 push $0x80107e83 -80103bda: e8 4d ca ff ff call 8010062c +80103a57: 83 ec 0c sub $0xc,%esp +80103a5a: 53 push %ebx +80103a5b: 50 push %eax +80103a5c: 52 push %edx +80103a5d: ff 73 10 push 0x10(%ebx) +80103a60: 68 a3 7b 10 80 push $0x80107ba3 +80103a65: e8 97 cb ff ff call 80100601 for( p = ptable.proc; p < &ptable.proc[NPROC]; p++) -80103bdf: 81 c3 84 00 00 00 add $0x84,%ebx -80103be5: 83 c4 20 add $0x20,%esp -80103be8: 81 fb b4 61 11 80 cmp $0x801161b4,%ebx -80103bee: 74 1b je 80103c0b +80103a6a: 81 c3 84 00 00 00 add $0x84,%ebx +80103a70: 83 c4 20 add $0x20,%esp +80103a73: 81 fb 94 35 11 80 cmp $0x80113594,%ebx +80103a79: 74 1b je 80103a96 if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) -80103bf0: 8b 43 0c mov 0xc(%ebx),%eax +80103a7b: 8b 4b 0c mov 0xc(%ebx),%ecx state = "???"; -80103bf3: ba 6b 7e 10 80 mov $0x80107e6b,%edx +80103a7e: ba 8b 7b 10 80 mov $0x80107b8b,%edx if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) -80103bf8: 83 f8 05 cmp $0x5,%eax -80103bfb: 77 c5 ja 80103bc2 -80103bfd: 8b 14 85 e4 7e 10 80 mov -0x7fef811c(,%eax,4),%edx -80103c04: 85 d2 test %edx,%edx +80103a83: 83 f9 05 cmp $0x5,%ecx +80103a86: 77 c7 ja 80103a4f +80103a88: 8b 14 8d 04 7c 10 80 mov -0x7fef83fc(,%ecx,4),%edx state = "???"; -80103c06: 0f 44 d7 cmove %edi,%edx -80103c09: eb b7 jmp 80103bc2 +80103a8f: 85 d2 test %edx,%edx +80103a91: 0f 44 d7 cmove %edi,%edx +80103a94: eb b9 jmp 80103a4f } release(&ptable.lock); -80103c0b: 83 ec 0c sub $0xc,%esp -80103c0e: 68 40 59 11 80 push $0x80115940 -80103c13: e8 ec 02 00 00 call 80103f04 +80103a96: 83 ec 0c sub $0xc,%esp +80103a99: 68 20 2d 11 80 push $0x80112d20 +80103a9e: e8 c5 02 00 00 call 80103d68 return; -80103c18: 83 c4 10 add $0x10,%esp +80103aa3: 83 c4 10 add $0x10,%esp } -80103c1b: 8d 65 f4 lea -0xc(%ebp),%esp -80103c1e: 5b pop %ebx -80103c1f: 5e pop %esi -80103c20: 5f pop %edi -80103c21: 5d pop %ebp -80103c22: c3 ret +80103aa6: 8d 65 f4 lea -0xc(%ebp),%esp +80103aa9: 5b pop %ebx +80103aaa: 5e pop %esi +80103aab: 5f pop %edi +80103aac: 5d pop %ebp +80103aad: c3 ret -80103c23 : +80103aae : #include "spinlock.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { -80103c23: f3 0f 1e fb endbr32 -80103c27: 55 push %ebp -80103c28: 89 e5 mov %esp,%ebp -80103c2a: 53 push %ebx -80103c2b: 83 ec 0c sub $0xc,%esp -80103c2e: 8b 5d 08 mov 0x8(%ebp),%ebx +80103aae: 55 push %ebp +80103aaf: 89 e5 mov %esp,%ebp +80103ab1: 53 push %ebx +80103ab2: 83 ec 0c sub $0xc,%esp +80103ab5: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&lk->lk, "sleep lock"); -80103c31: 68 14 7f 10 80 push $0x80107f14 -80103c36: 8d 43 04 lea 0x4(%ebx),%eax -80103c39: 50 push %eax -80103c3a: e8 fe 00 00 00 call 80103d3d +80103ab8: 68 34 7c 10 80 push $0x80107c34 +80103abd: 8d 43 04 lea 0x4(%ebx),%eax +80103ac0: 50 push %eax +80103ac1: e8 f2 00 00 00 call 80103bb8 lk->name = name; -80103c3f: 8b 45 0c mov 0xc(%ebp),%eax -80103c42: 89 43 38 mov %eax,0x38(%ebx) +80103ac6: 8b 45 0c mov 0xc(%ebp),%eax +80103ac9: 89 43 38 mov %eax,0x38(%ebx) lk->locked = 0; -80103c45: c7 03 00 00 00 00 movl $0x0,(%ebx) +80103acc: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; -80103c4b: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) +80103ad2: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) } -80103c52: 83 c4 10 add $0x10,%esp -80103c55: 8b 5d fc mov -0x4(%ebp),%ebx -80103c58: c9 leave -80103c59: c3 ret +80103ad9: 83 c4 10 add $0x10,%esp +80103adc: 8b 5d fc mov -0x4(%ebp),%ebx +80103adf: c9 leave +80103ae0: c3 ret -80103c5a : +80103ae1 : void acquiresleep(struct sleeplock *lk) { -80103c5a: f3 0f 1e fb endbr32 -80103c5e: 55 push %ebp -80103c5f: 89 e5 mov %esp,%ebp -80103c61: 56 push %esi -80103c62: 53 push %ebx -80103c63: 8b 5d 08 mov 0x8(%ebp),%ebx +80103ae1: 55 push %ebp +80103ae2: 89 e5 mov %esp,%ebp +80103ae4: 56 push %esi +80103ae5: 53 push %ebx +80103ae6: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); -80103c66: 8d 73 04 lea 0x4(%ebx),%esi -80103c69: 83 ec 0c sub $0xc,%esp -80103c6c: 56 push %esi -80103c6d: e8 27 02 00 00 call 80103e99 +80103ae9: 8d 73 04 lea 0x4(%ebx),%esi +80103aec: 83 ec 0c sub $0xc,%esp +80103aef: 56 push %esi +80103af0: e8 0c 02 00 00 call 80103d01 while (lk->locked) { -80103c72: 83 c4 10 add $0x10,%esp -80103c75: 83 3b 00 cmpl $0x0,(%ebx) -80103c78: 74 12 je 80103c8c +80103af5: 83 c4 10 add $0x10,%esp +80103af8: 83 3b 00 cmpl $0x0,(%ebx) +80103afb: 74 12 je 80103b0f sleep(lk, &lk->lk); -80103c7a: 83 ec 08 sub $0x8,%esp -80103c7d: 56 push %esi -80103c7e: 53 push %ebx -80103c7f: e8 30 fc ff ff call 801038b4 +80103afd: 83 ec 08 sub $0x8,%esp +80103b00: 56 push %esi +80103b01: 53 push %ebx +80103b02: e8 52 fc ff ff call 80103759 while (lk->locked) { -80103c84: 83 c4 10 add $0x10,%esp -80103c87: 83 3b 00 cmpl $0x0,(%ebx) -80103c8a: 75 ee jne 80103c7a +80103b07: 83 c4 10 add $0x10,%esp +80103b0a: 83 3b 00 cmpl $0x0,(%ebx) +80103b0d: 75 ee jne 80103afd } lk->locked = 1; -80103c8c: c7 03 01 00 00 00 movl $0x1,(%ebx) +80103b0f: c7 03 01 00 00 00 movl $0x1,(%ebx) lk->pid = myproc()->pid; -80103c92: e8 53 f7 ff ff call 801033ea -80103c97: 8b 40 10 mov 0x10(%eax),%eax -80103c9a: 89 43 3c mov %eax,0x3c(%ebx) +80103b15: e8 96 f7 ff ff call 801032b0 +80103b1a: 8b 40 10 mov 0x10(%eax),%eax +80103b1d: 89 43 3c mov %eax,0x3c(%ebx) release(&lk->lk); -80103c9d: 83 ec 0c sub $0xc,%esp -80103ca0: 56 push %esi -80103ca1: e8 5e 02 00 00 call 80103f04 +80103b20: 83 ec 0c sub $0xc,%esp +80103b23: 56 push %esi +80103b24: e8 3f 02 00 00 call 80103d68 } -80103ca6: 83 c4 10 add $0x10,%esp -80103ca9: 8d 65 f8 lea -0x8(%ebp),%esp -80103cac: 5b pop %ebx -80103cad: 5e pop %esi -80103cae: 5d pop %ebp -80103caf: c3 ret +80103b29: 83 c4 10 add $0x10,%esp +80103b2c: 8d 65 f8 lea -0x8(%ebp),%esp +80103b2f: 5b pop %ebx +80103b30: 5e pop %esi +80103b31: 5d pop %ebp +80103b32: c3 ret -80103cb0 : +80103b33 : void releasesleep(struct sleeplock *lk) { -80103cb0: f3 0f 1e fb endbr32 -80103cb4: 55 push %ebp -80103cb5: 89 e5 mov %esp,%ebp -80103cb7: 56 push %esi -80103cb8: 53 push %ebx -80103cb9: 8b 5d 08 mov 0x8(%ebp),%ebx +80103b33: 55 push %ebp +80103b34: 89 e5 mov %esp,%ebp +80103b36: 56 push %esi +80103b37: 53 push %ebx +80103b38: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); -80103cbc: 8d 73 04 lea 0x4(%ebx),%esi -80103cbf: 83 ec 0c sub $0xc,%esp -80103cc2: 56 push %esi -80103cc3: e8 d1 01 00 00 call 80103e99 +80103b3b: 8d 73 04 lea 0x4(%ebx),%esi +80103b3e: 83 ec 0c sub $0xc,%esp +80103b41: 56 push %esi +80103b42: e8 ba 01 00 00 call 80103d01 lk->locked = 0; -80103cc8: c7 03 00 00 00 00 movl $0x0,(%ebx) +80103b47: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; -80103cce: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) +80103b4d: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) wakeup(lk); -80103cd5: 89 1c 24 mov %ebx,(%esp) -80103cd8: e8 5d fd ff ff call 80103a3a +80103b54: 89 1c 24 mov %ebx,(%esp) +80103b57: e8 7b fd ff ff call 801038d7 release(&lk->lk); -80103cdd: 89 34 24 mov %esi,(%esp) -80103ce0: e8 1f 02 00 00 call 80103f04 +80103b5c: 89 34 24 mov %esi,(%esp) +80103b5f: e8 04 02 00 00 call 80103d68 } -80103ce5: 83 c4 10 add $0x10,%esp -80103ce8: 8d 65 f8 lea -0x8(%ebp),%esp -80103ceb: 5b pop %ebx -80103cec: 5e pop %esi -80103ced: 5d pop %ebp -80103cee: c3 ret +80103b64: 83 c4 10 add $0x10,%esp +80103b67: 8d 65 f8 lea -0x8(%ebp),%esp +80103b6a: 5b pop %ebx +80103b6b: 5e pop %esi +80103b6c: 5d pop %ebp +80103b6d: c3 ret -80103cef : +80103b6e : int holdingsleep(struct sleeplock *lk) { -80103cef: f3 0f 1e fb endbr32 -80103cf3: 55 push %ebp -80103cf4: 89 e5 mov %esp,%ebp -80103cf6: 57 push %edi -80103cf7: 56 push %esi -80103cf8: 53 push %ebx -80103cf9: 83 ec 18 sub $0x18,%esp -80103cfc: 8b 5d 08 mov 0x8(%ebp),%ebx +80103b6e: 55 push %ebp +80103b6f: 89 e5 mov %esp,%ebp +80103b71: 57 push %edi +80103b72: 56 push %esi +80103b73: 53 push %ebx +80103b74: 83 ec 18 sub $0x18,%esp +80103b77: 8b 5d 08 mov 0x8(%ebp),%ebx int r; acquire(&lk->lk); -80103cff: 8d 73 04 lea 0x4(%ebx),%esi -80103d02: 56 push %esi -80103d03: e8 91 01 00 00 call 80103e99 +80103b7a: 8d 73 04 lea 0x4(%ebx),%esi +80103b7d: 56 push %esi +80103b7e: e8 7e 01 00 00 call 80103d01 r = lk->locked && (lk->pid == myproc()->pid); -80103d08: 83 c4 10 add $0x10,%esp -80103d0b: bf 00 00 00 00 mov $0x0,%edi -80103d10: 83 3b 00 cmpl $0x0,(%ebx) -80103d13: 75 13 jne 80103d28 +80103b83: 83 c4 10 add $0x10,%esp +80103b86: bf 00 00 00 00 mov $0x0,%edi +80103b8b: 83 3b 00 cmpl $0x0,(%ebx) +80103b8e: 75 13 jne 80103ba3 release(&lk->lk); -80103d15: 83 ec 0c sub $0xc,%esp -80103d18: 56 push %esi -80103d19: e8 e6 01 00 00 call 80103f04 +80103b90: 83 ec 0c sub $0xc,%esp +80103b93: 56 push %esi +80103b94: e8 cf 01 00 00 call 80103d68 return r; } -80103d1e: 89 f8 mov %edi,%eax -80103d20: 8d 65 f4 lea -0xc(%ebp),%esp -80103d23: 5b pop %ebx -80103d24: 5e pop %esi -80103d25: 5f pop %edi -80103d26: 5d pop %ebp -80103d27: c3 ret +80103b99: 89 f8 mov %edi,%eax +80103b9b: 8d 65 f4 lea -0xc(%ebp),%esp +80103b9e: 5b pop %ebx +80103b9f: 5e pop %esi +80103ba0: 5f pop %edi +80103ba1: 5d pop %ebp +80103ba2: c3 ret r = lk->locked && (lk->pid == myproc()->pid); -80103d28: 8b 5b 3c mov 0x3c(%ebx),%ebx -80103d2b: e8 ba f6 ff ff call 801033ea -80103d30: 39 58 10 cmp %ebx,0x10(%eax) -80103d33: 0f 94 c0 sete %al -80103d36: 0f b6 c0 movzbl %al,%eax -80103d39: 89 c7 mov %eax,%edi -80103d3b: eb d8 jmp 80103d15 - -80103d3d : +80103ba3: 8b 5b 3c mov 0x3c(%ebx),%ebx +80103ba6: e8 05 f7 ff ff call 801032b0 +80103bab: 39 58 10 cmp %ebx,0x10(%eax) +80103bae: 0f 94 c0 sete %al +80103bb1: 0f b6 c0 movzbl %al,%eax +80103bb4: 89 c7 mov %eax,%edi +80103bb6: eb d8 jmp 80103b90 + +80103bb8 : #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { -80103d3d: f3 0f 1e fb endbr32 -80103d41: 55 push %ebp -80103d42: 89 e5 mov %esp,%ebp -80103d44: 8b 45 08 mov 0x8(%ebp),%eax +80103bb8: 55 push %ebp +80103bb9: 89 e5 mov %esp,%ebp +80103bbb: 8b 45 08 mov 0x8(%ebp),%eax lk->name = name; -80103d47: 8b 55 0c mov 0xc(%ebp),%edx -80103d4a: 89 50 04 mov %edx,0x4(%eax) +80103bbe: 8b 55 0c mov 0xc(%ebp),%edx +80103bc1: 89 50 04 mov %edx,0x4(%eax) lk->locked = 0; -80103d4d: c7 00 00 00 00 00 movl $0x0,(%eax) +80103bc4: c7 00 00 00 00 00 movl $0x0,(%eax) lk->cpu = 0; -80103d53: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) +80103bca: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } -80103d5a: 5d pop %ebp -80103d5b: c3 ret +80103bd1: 5d pop %ebp +80103bd2: c3 ret -80103d5c : +80103bd3 : } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { -80103d5c: f3 0f 1e fb endbr32 -80103d60: 55 push %ebp -80103d61: 89 e5 mov %esp,%ebp -80103d63: 53 push %ebx -80103d64: 8b 45 08 mov 0x8(%ebp),%eax -80103d67: 8b 4d 0c mov 0xc(%ebp),%ecx +80103bd3: 55 push %ebp +80103bd4: 89 e5 mov %esp,%ebp +80103bd6: 53 push %ebx +80103bd7: 8b 45 08 mov 0x8(%ebp),%eax +80103bda: 8b 4d 0c mov 0xc(%ebp),%ecx uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) -80103d6a: 8d 90 f8 ff ff 7f lea 0x7ffffff8(%eax),%edx -80103d70: 81 fa fe ff ff 7f cmp $0x7ffffffe,%edx -80103d76: 77 2d ja 80103da5 +80103bdd: 8d 90 f8 ff ff 7f lea 0x7ffffff8(%eax),%edx +80103be3: 81 fa fe ff ff 7f cmp $0x7ffffffe,%edx +80103be9: 77 2d ja 80103c18 break; pcs[i] = ebp[1]; // saved %eip -80103d78: 8b 50 fc mov -0x4(%eax),%edx -80103d7b: 89 11 mov %edx,(%ecx) +80103beb: 8b 50 fc mov -0x4(%eax),%edx +80103bee: 89 11 mov %edx,(%ecx) ebp = (uint*)ebp[0]; // saved %ebp -80103d7d: 8b 50 f8 mov -0x8(%eax),%edx +80103bf0: 8b 50 f8 mov -0x8(%eax),%edx for(i = 0; i < 10; i++){ -80103d80: b8 01 00 00 00 mov $0x1,%eax +80103bf3: b8 01 00 00 00 mov $0x1,%eax if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) -80103d85: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx -80103d8b: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx -80103d91: 77 17 ja 80103daa +80103bf8: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx +80103bfe: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx +80103c04: 77 17 ja 80103c1d pcs[i] = ebp[1]; // saved %eip -80103d93: 8b 5a 04 mov 0x4(%edx),%ebx -80103d96: 89 1c 81 mov %ebx,(%ecx,%eax,4) +80103c06: 8b 5a 04 mov 0x4(%edx),%ebx +80103c09: 89 1c 81 mov %ebx,(%ecx,%eax,4) ebp = (uint*)ebp[0]; // saved %ebp -80103d99: 8b 12 mov (%edx),%edx +80103c0c: 8b 12 mov (%edx),%edx for(i = 0; i < 10; i++){ -80103d9b: 83 c0 01 add $0x1,%eax -80103d9e: 83 f8 0a cmp $0xa,%eax -80103da1: 75 e2 jne 80103d85 -80103da3: eb 14 jmp 80103db9 -80103da5: b8 00 00 00 00 mov $0x0,%eax +80103c0e: 83 c0 01 add $0x1,%eax +80103c11: 83 f8 0a cmp $0xa,%eax +80103c14: 75 e2 jne 80103bf8 +80103c16: eb 14 jmp 80103c2c +80103c18: b8 00 00 00 00 mov $0x0,%eax } for(; i < 10; i++) pcs[i] = 0; -80103daa: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) +80103c1d: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) for(; i < 10; i++) -80103db1: 83 c0 01 add $0x1,%eax -80103db4: 83 f8 09 cmp $0x9,%eax -80103db7: 7e f1 jle 80103daa +80103c24: 83 c0 01 add $0x1,%eax +80103c27: 83 f8 09 cmp $0x9,%eax +80103c2a: 7e f1 jle 80103c1d } -80103db9: 5b pop %ebx -80103dba: 5d pop %ebp -80103dbb: c3 ret +80103c2c: 8b 5d fc mov -0x4(%ebp),%ebx +80103c2f: c9 leave +80103c30: c3 ret -80103dbc : +80103c31 : // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { -80103dbc: f3 0f 1e fb endbr32 -80103dc0: 55 push %ebp -80103dc1: 89 e5 mov %esp,%ebp -80103dc3: 53 push %ebx -80103dc4: 83 ec 04 sub $0x4,%esp -80103dc7: 9c pushf -80103dc8: 5b pop %ebx +80103c31: 55 push %ebp +80103c32: 89 e5 mov %esp,%ebp +80103c34: 53 push %ebx +80103c35: 83 ec 04 sub $0x4,%esp +80103c38: 9c pushf +80103c39: 5b pop %ebx asm volatile("cli"); -80103dc9: fa cli +80103c3a: fa cli int eflags; eflags = readeflags(); cli(); if(mycpu()->ncli == 0) -80103dca: e8 97 f5 ff ff call 80103366 -80103dcf: 83 b8 a4 00 00 00 00 cmpl $0x0,0xa4(%eax) -80103dd6: 74 12 je 80103dea +80103c3b: e8 f6 f5 ff ff call 80103236 +80103c40: 83 b8 a4 00 00 00 00 cmpl $0x0,0xa4(%eax) +80103c47: 74 11 je 80103c5a mycpu()->intena = eflags & FL_IF; mycpu()->ncli += 1; -80103dd8: e8 89 f5 ff ff call 80103366 -80103ddd: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) +80103c49: e8 e8 f5 ff ff call 80103236 +80103c4e: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) } -80103de4: 83 c4 04 add $0x4,%esp -80103de7: 5b pop %ebx -80103de8: 5d pop %ebp -80103de9: c3 ret +80103c55: 8b 5d fc mov -0x4(%ebp),%ebx +80103c58: c9 leave +80103c59: c3 ret mycpu()->intena = eflags & FL_IF; -80103dea: e8 77 f5 ff ff call 80103366 -80103def: 81 e3 00 02 00 00 and $0x200,%ebx -80103df5: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) -80103dfb: eb db jmp 80103dd8 +80103c5a: e8 d7 f5 ff ff call 80103236 +80103c5f: 81 e3 00 02 00 00 and $0x200,%ebx +80103c65: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) +80103c6b: eb dc jmp 80103c49 -80103dfd : +80103c6d : void popcli(void) { -80103dfd: f3 0f 1e fb endbr32 -80103e01: 55 push %ebp -80103e02: 89 e5 mov %esp,%ebp -80103e04: 83 ec 08 sub $0x8,%esp +80103c6d: 55 push %ebp +80103c6e: 89 e5 mov %esp,%ebp +80103c70: 83 ec 08 sub $0x8,%esp asm volatile("pushfl; popl %0" : "=r" (eflags)); -80103e07: 9c pushf -80103e08: 58 pop %eax +80103c73: 9c pushf +80103c74: 58 pop %eax if(readeflags()&FL_IF) -80103e09: f6 c4 02 test $0x2,%ah -80103e0c: 75 28 jne 80103e36 +80103c75: f6 c4 02 test $0x2,%ah +80103c78: 75 28 jne 80103ca2 panic("popcli - interruptible"); if(--mycpu()->ncli < 0) -80103e0e: e8 53 f5 ff ff call 80103366 -80103e13: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx -80103e19: 8d 51 ff lea -0x1(%ecx),%edx -80103e1c: 89 90 a4 00 00 00 mov %edx,0xa4(%eax) -80103e22: 85 d2 test %edx,%edx -80103e24: 78 1d js 80103e43 +80103c7a: e8 b7 f5 ff ff call 80103236 +80103c7f: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx +80103c85: 8d 51 ff lea -0x1(%ecx),%edx +80103c88: 89 90 a4 00 00 00 mov %edx,0xa4(%eax) +80103c8e: 85 d2 test %edx,%edx +80103c90: 78 1d js 80103caf panic("popcli"); if(mycpu()->ncli == 0 && mycpu()->intena) -80103e26: e8 3b f5 ff ff call 80103366 -80103e2b: 83 b8 a4 00 00 00 00 cmpl $0x0,0xa4(%eax) -80103e32: 74 1c je 80103e50 +80103c92: e8 9f f5 ff ff call 80103236 +80103c97: 83 b8 a4 00 00 00 00 cmpl $0x0,0xa4(%eax) +80103c9e: 74 1c je 80103cbc sti(); } -80103e34: c9 leave -80103e35: c3 ret +80103ca0: c9 leave +80103ca1: c3 ret panic("popcli - interruptible"); -80103e36: 83 ec 0c sub $0xc,%esp -80103e39: 68 1f 7f 10 80 push $0x80107f1f -80103e3e: e8 15 c5 ff ff call 80100358 +80103ca2: 83 ec 0c sub $0xc,%esp +80103ca5: 68 3f 7c 10 80 push $0x80107c3f +80103caa: e8 91 c6 ff ff call 80100340 panic("popcli"); -80103e43: 83 ec 0c sub $0xc,%esp -80103e46: 68 36 7f 10 80 push $0x80107f36 -80103e4b: e8 08 c5 ff ff call 80100358 +80103caf: 83 ec 0c sub $0xc,%esp +80103cb2: 68 56 7c 10 80 push $0x80107c56 +80103cb7: e8 84 c6 ff ff call 80100340 if(mycpu()->ncli == 0 && mycpu()->intena) -80103e50: e8 11 f5 ff ff call 80103366 -80103e55: 83 b8 a8 00 00 00 00 cmpl $0x0,0xa8(%eax) -80103e5c: 74 d6 je 80103e34 +80103cbc: e8 75 f5 ff ff call 80103236 +80103cc1: 83 b8 a8 00 00 00 00 cmpl $0x0,0xa8(%eax) +80103cc8: 74 d6 je 80103ca0 asm volatile("sti"); -80103e5e: fb sti +80103cca: fb sti } -80103e5f: eb d3 jmp 80103e34 +80103ccb: eb d3 jmp 80103ca0 -80103e61 : +80103ccd : { -80103e61: f3 0f 1e fb endbr32 -80103e65: 55 push %ebp -80103e66: 89 e5 mov %esp,%ebp -80103e68: 56 push %esi -80103e69: 53 push %ebx -80103e6a: 8b 75 08 mov 0x8(%ebp),%esi +80103ccd: 55 push %ebp +80103cce: 89 e5 mov %esp,%ebp +80103cd0: 56 push %esi +80103cd1: 53 push %ebx +80103cd2: 8b 75 08 mov 0x8(%ebp),%esi pushcli(); -80103e6d: e8 4a ff ff ff call 80103dbc +80103cd5: e8 57 ff ff ff call 80103c31 r = lock->locked && lock->cpu == mycpu(); -80103e72: bb 00 00 00 00 mov $0x0,%ebx -80103e77: 83 3e 00 cmpl $0x0,(%esi) -80103e7a: 75 0b jne 80103e87 +80103cda: bb 00 00 00 00 mov $0x0,%ebx +80103cdf: 83 3e 00 cmpl $0x0,(%esi) +80103ce2: 75 0b jne 80103cef popcli(); -80103e7c: e8 7c ff ff ff call 80103dfd +80103ce4: e8 84 ff ff ff call 80103c6d } -80103e81: 89 d8 mov %ebx,%eax -80103e83: 5b pop %ebx -80103e84: 5e pop %esi -80103e85: 5d pop %ebp -80103e86: c3 ret +80103ce9: 89 d8 mov %ebx,%eax +80103ceb: 5b pop %ebx +80103cec: 5e pop %esi +80103ced: 5d pop %ebp +80103cee: c3 ret r = lock->locked && lock->cpu == mycpu(); -80103e87: 8b 5e 08 mov 0x8(%esi),%ebx -80103e8a: e8 d7 f4 ff ff call 80103366 -80103e8f: 39 c3 cmp %eax,%ebx -80103e91: 0f 94 c3 sete %bl -80103e94: 0f b6 db movzbl %bl,%ebx -80103e97: eb e3 jmp 80103e7c - -80103e99 : -{ -80103e99: f3 0f 1e fb endbr32 -80103e9d: 55 push %ebp -80103e9e: 89 e5 mov %esp,%ebp -80103ea0: 53 push %ebx -80103ea1: 83 ec 04 sub $0x4,%esp +80103cef: 8b 5e 08 mov 0x8(%esi),%ebx +80103cf2: e8 3f f5 ff ff call 80103236 +80103cf7: 39 c3 cmp %eax,%ebx +80103cf9: 0f 94 c3 sete %bl +80103cfc: 0f b6 db movzbl %bl,%ebx +80103cff: eb e3 jmp 80103ce4 + +80103d01 : +{ +80103d01: 55 push %ebp +80103d02: 89 e5 mov %esp,%ebp +80103d04: 53 push %ebx +80103d05: 83 ec 04 sub $0x4,%esp pushcli(); // disable interrupts to avoid deadlock. -80103ea4: e8 13 ff ff ff call 80103dbc +80103d08: e8 24 ff ff ff call 80103c31 if(holding(lk)) -80103ea9: 83 ec 0c sub $0xc,%esp -80103eac: ff 75 08 pushl 0x8(%ebp) -80103eaf: e8 ad ff ff ff call 80103e61 -80103eb4: 83 c4 10 add $0x10,%esp -80103eb7: 85 c0 test %eax,%eax -80103eb9: 75 3c jne 80103ef7 +80103d0d: 83 ec 0c sub $0xc,%esp +80103d10: ff 75 08 push 0x8(%ebp) +80103d13: e8 b5 ff ff ff call 80103ccd +80103d18: 83 c4 10 add $0x10,%esp +80103d1b: 85 c0 test %eax,%eax +80103d1d: 75 3c jne 80103d5b asm volatile("lock; xchgl %0, %1" : -80103ebb: b9 01 00 00 00 mov $0x1,%ecx +80103d1f: b9 01 00 00 00 mov $0x1,%ecx while(xchg(&lk->locked, 1) != 0) -80103ec0: 8b 55 08 mov 0x8(%ebp),%edx -80103ec3: 89 c8 mov %ecx,%eax -80103ec5: f0 87 02 lock xchg %eax,(%edx) -80103ec8: 85 c0 test %eax,%eax -80103eca: 75 f4 jne 80103ec0 +80103d24: 8b 55 08 mov 0x8(%ebp),%edx +80103d27: 89 c8 mov %ecx,%eax +80103d29: f0 87 02 lock xchg %eax,(%edx) +80103d2c: 85 c0 test %eax,%eax +80103d2e: 75 f4 jne 80103d24 __sync_synchronize(); -80103ecc: f0 83 0c 24 00 lock orl $0x0,(%esp) +80103d30: f0 83 0c 24 00 lock orl $0x0,(%esp) lk->cpu = mycpu(); -80103ed1: 8b 5d 08 mov 0x8(%ebp),%ebx -80103ed4: e8 8d f4 ff ff call 80103366 -80103ed9: 89 43 08 mov %eax,0x8(%ebx) +80103d35: 8b 5d 08 mov 0x8(%ebp),%ebx +80103d38: e8 f9 f4 ff ff call 80103236 +80103d3d: 89 43 08 mov %eax,0x8(%ebx) getcallerpcs(&lk, lk->pcs); -80103edc: 83 ec 08 sub $0x8,%esp -80103edf: 8b 45 08 mov 0x8(%ebp),%eax -80103ee2: 83 c0 0c add $0xc,%eax -80103ee5: 50 push %eax -80103ee6: 8d 45 08 lea 0x8(%ebp),%eax -80103ee9: 50 push %eax -80103eea: e8 6d fe ff ff call 80103d5c -} -80103eef: 83 c4 10 add $0x10,%esp -80103ef2: 8b 5d fc mov -0x4(%ebp),%ebx -80103ef5: c9 leave -80103ef6: c3 ret +80103d40: 83 ec 08 sub $0x8,%esp +80103d43: 8b 45 08 mov 0x8(%ebp),%eax +80103d46: 83 c0 0c add $0xc,%eax +80103d49: 50 push %eax +80103d4a: 8d 45 08 lea 0x8(%ebp),%eax +80103d4d: 50 push %eax +80103d4e: e8 80 fe ff ff call 80103bd3 +} +80103d53: 83 c4 10 add $0x10,%esp +80103d56: 8b 5d fc mov -0x4(%ebp),%ebx +80103d59: c9 leave +80103d5a: c3 ret panic("acquire"); -80103ef7: 83 ec 0c sub $0xc,%esp -80103efa: 68 3d 7f 10 80 push $0x80107f3d -80103eff: e8 54 c4 ff ff call 80100358 - -80103f04 : -{ -80103f04: f3 0f 1e fb endbr32 -80103f08: 55 push %ebp -80103f09: 89 e5 mov %esp,%ebp -80103f0b: 53 push %ebx -80103f0c: 83 ec 10 sub $0x10,%esp -80103f0f: 8b 5d 08 mov 0x8(%ebp),%ebx +80103d5b: 83 ec 0c sub $0xc,%esp +80103d5e: 68 5d 7c 10 80 push $0x80107c5d +80103d63: e8 d8 c5 ff ff call 80100340 + +80103d68 : +{ +80103d68: 55 push %ebp +80103d69: 89 e5 mov %esp,%ebp +80103d6b: 53 push %ebx +80103d6c: 83 ec 10 sub $0x10,%esp +80103d6f: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holding(lk)) -80103f12: 53 push %ebx -80103f13: e8 49 ff ff ff call 80103e61 -80103f18: 83 c4 10 add $0x10,%esp -80103f1b: 85 c0 test %eax,%eax -80103f1d: 74 23 je 80103f42 +80103d72: 53 push %ebx +80103d73: e8 55 ff ff ff call 80103ccd +80103d78: 83 c4 10 add $0x10,%esp +80103d7b: 85 c0 test %eax,%eax +80103d7d: 74 23 je 80103da2 lk->pcs[0] = 0; -80103f1f: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) +80103d7f: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) lk->cpu = 0; -80103f26: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) +80103d86: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) __sync_synchronize(); -80103f2d: f0 83 0c 24 00 lock orl $0x0,(%esp) +80103d8d: f0 83 0c 24 00 lock orl $0x0,(%esp) asm volatile("movl $0, %0" : "+m" (lk->locked) : ); -80103f32: c7 03 00 00 00 00 movl $0x0,(%ebx) +80103d92: c7 03 00 00 00 00 movl $0x0,(%ebx) popcli(); -80103f38: e8 c0 fe ff ff call 80103dfd +80103d98: e8 d0 fe ff ff call 80103c6d } -80103f3d: 8b 5d fc mov -0x4(%ebp),%ebx -80103f40: c9 leave -80103f41: c3 ret +80103d9d: 8b 5d fc mov -0x4(%ebp),%ebx +80103da0: c9 leave +80103da1: c3 ret panic("release"); -80103f42: 83 ec 0c sub $0xc,%esp -80103f45: 68 45 7f 10 80 push $0x80107f45 -80103f4a: e8 09 c4 ff ff call 80100358 +80103da2: 83 ec 0c sub $0xc,%esp +80103da5: 68 65 7c 10 80 push $0x80107c65 +80103daa: e8 91 c5 ff ff call 80100340 -80103f4f : +80103daf : #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { -80103f4f: f3 0f 1e fb endbr32 -80103f53: 55 push %ebp -80103f54: 89 e5 mov %esp,%ebp -80103f56: 57 push %edi -80103f57: 53 push %ebx -80103f58: 8b 55 08 mov 0x8(%ebp),%edx -80103f5b: 8b 45 0c mov 0xc(%ebp),%eax -80103f5e: 8b 4d 10 mov 0x10(%ebp),%ecx +80103daf: 55 push %ebp +80103db0: 89 e5 mov %esp,%ebp +80103db2: 57 push %edi +80103db3: 53 push %ebx +80103db4: 8b 55 08 mov 0x8(%ebp),%edx +80103db7: 8b 45 0c mov 0xc(%ebp),%eax +80103dba: 8b 4d 10 mov 0x10(%ebp),%ecx if ((int)dst%4 == 0 && n%4 == 0){ -80103f61: 89 d7 mov %edx,%edi -80103f63: 09 cf or %ecx,%edi -80103f65: f7 c7 03 00 00 00 test $0x3,%edi -80103f6b: 75 1e jne 80103f8b +80103dbd: 89 d7 mov %edx,%edi +80103dbf: 09 cf or %ecx,%edi +80103dc1: f7 c7 03 00 00 00 test $0x3,%edi +80103dc7: 75 1e jne 80103de7 c &= 0xFF; -80103f6d: 0f b6 f8 movzbl %al,%edi +80103dc9: 0f b6 f8 movzbl %al,%edi stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); -80103f70: c1 e9 02 shr $0x2,%ecx -80103f73: c1 e0 18 shl $0x18,%eax -80103f76: 89 fb mov %edi,%ebx -80103f78: c1 e3 10 shl $0x10,%ebx -80103f7b: 09 d8 or %ebx,%eax -80103f7d: 09 f8 or %edi,%eax -80103f7f: c1 e7 08 shl $0x8,%edi -80103f82: 09 f8 or %edi,%eax +80103dcc: c1 e9 02 shr $0x2,%ecx +80103dcf: c1 e0 18 shl $0x18,%eax +80103dd2: 89 fb mov %edi,%ebx +80103dd4: c1 e3 10 shl $0x10,%ebx +80103dd7: 09 d8 or %ebx,%eax +80103dd9: 09 f8 or %edi,%eax +80103ddb: c1 e7 08 shl $0x8,%edi +80103dde: 09 f8 or %edi,%eax asm volatile("cld; rep stosl" : -80103f84: 89 d7 mov %edx,%edi -80103f86: fc cld -80103f87: f3 ab rep stos %eax,%es:(%edi) +80103de0: 89 d7 mov %edx,%edi +80103de2: fc cld +80103de3: f3 ab rep stos %eax,%es:(%edi) } -80103f89: eb 05 jmp 80103f90 +80103de5: eb 05 jmp 80103dec asm volatile("cld; rep stosb" : -80103f8b: 89 d7 mov %edx,%edi -80103f8d: fc cld -80103f8e: f3 aa rep stos %al,%es:(%edi) +80103de7: 89 d7 mov %edx,%edi +80103de9: fc cld +80103dea: f3 aa rep stos %al,%es:(%edi) } else stosb(dst, c, n); return dst; } -80103f90: 89 d0 mov %edx,%eax -80103f92: 5b pop %ebx -80103f93: 5f pop %edi -80103f94: 5d pop %ebp -80103f95: c3 ret +80103dec: 89 d0 mov %edx,%eax +80103dee: 5b pop %ebx +80103def: 5f pop %edi +80103df0: 5d pop %ebp +80103df1: c3 ret -80103f96 : +80103df2 : int memcmp(const void *v1, const void *v2, uint n) { -80103f96: f3 0f 1e fb endbr32 -80103f9a: 55 push %ebp -80103f9b: 89 e5 mov %esp,%ebp -80103f9d: 56 push %esi -80103f9e: 53 push %ebx -80103f9f: 8b 45 08 mov 0x8(%ebp),%eax -80103fa2: 8b 55 0c mov 0xc(%ebp),%edx -80103fa5: 8b 75 10 mov 0x10(%ebp),%esi +80103df2: 55 push %ebp +80103df3: 89 e5 mov %esp,%ebp +80103df5: 56 push %esi +80103df6: 53 push %ebx +80103df7: 8b 45 08 mov 0x8(%ebp),%eax +80103dfa: 8b 55 0c mov 0xc(%ebp),%edx +80103dfd: 8b 75 10 mov 0x10(%ebp),%esi const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ -80103fa8: 85 f6 test %esi,%esi -80103faa: 74 29 je 80103fd5 -80103fac: 01 c6 add %eax,%esi +80103e00: 85 f6 test %esi,%esi +80103e02: 74 29 je 80103e2d +80103e04: 01 c6 add %eax,%esi if(*s1 != *s2) -80103fae: 0f b6 08 movzbl (%eax),%ecx -80103fb1: 0f b6 1a movzbl (%edx),%ebx -80103fb4: 38 d9 cmp %bl,%cl -80103fb6: 75 11 jne 80103fc9 +80103e06: 0f b6 08 movzbl (%eax),%ecx +80103e09: 0f b6 1a movzbl (%edx),%ebx +80103e0c: 38 d9 cmp %bl,%cl +80103e0e: 75 11 jne 80103e21 return *s1 - *s2; s1++, s2++; -80103fb8: 83 c0 01 add $0x1,%eax -80103fbb: 83 c2 01 add $0x1,%edx +80103e10: 83 c0 01 add $0x1,%eax +80103e13: 83 c2 01 add $0x1,%edx while(n-- > 0){ -80103fbe: 39 c6 cmp %eax,%esi -80103fc0: 75 ec jne 80103fae +80103e16: 39 c6 cmp %eax,%esi +80103e18: 75 ec jne 80103e06 } return 0; -80103fc2: b8 00 00 00 00 mov $0x0,%eax -80103fc7: eb 08 jmp 80103fd1 +80103e1a: b8 00 00 00 00 mov $0x0,%eax +80103e1f: eb 08 jmp 80103e29 return *s1 - *s2; -80103fc9: 0f b6 c1 movzbl %cl,%eax -80103fcc: 0f b6 db movzbl %bl,%ebx -80103fcf: 29 d8 sub %ebx,%eax -} -80103fd1: 5b pop %ebx -80103fd2: 5e pop %esi -80103fd3: 5d pop %ebp -80103fd4: c3 ret +80103e21: 0f b6 c1 movzbl %cl,%eax +80103e24: 0f b6 db movzbl %bl,%ebx +80103e27: 29 d8 sub %ebx,%eax +} +80103e29: 5b pop %ebx +80103e2a: 5e pop %esi +80103e2b: 5d pop %ebp +80103e2c: c3 ret return 0; -80103fd5: b8 00 00 00 00 mov $0x0,%eax -80103fda: eb f5 jmp 80103fd1 +80103e2d: b8 00 00 00 00 mov $0x0,%eax +80103e32: eb f5 jmp 80103e29 -80103fdc : +80103e34 : void* memmove(void *dst, const void *src, uint n) { -80103fdc: f3 0f 1e fb endbr32 -80103fe0: 55 push %ebp -80103fe1: 89 e5 mov %esp,%ebp -80103fe3: 56 push %esi -80103fe4: 53 push %ebx -80103fe5: 8b 75 08 mov 0x8(%ebp),%esi -80103fe8: 8b 45 0c mov 0xc(%ebp),%eax -80103feb: 8b 4d 10 mov 0x10(%ebp),%ecx +80103e34: 55 push %ebp +80103e35: 89 e5 mov %esp,%ebp +80103e37: 56 push %esi +80103e38: 53 push %ebx +80103e39: 8b 75 08 mov 0x8(%ebp),%esi +80103e3c: 8b 45 0c mov 0xc(%ebp),%eax +80103e3f: 8b 4d 10 mov 0x10(%ebp),%ecx const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ -80103fee: 39 f0 cmp %esi,%eax -80103ff0: 72 20 jb 80104012 +80103e42: 39 f0 cmp %esi,%eax +80103e44: 72 20 jb 80103e66 s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) -80103ff2: 8d 1c 08 lea (%eax,%ecx,1),%ebx -80103ff5: 89 f2 mov %esi,%edx -80103ff7: 85 c9 test %ecx,%ecx -80103ff9: 74 11 je 8010400c +80103e46: 8d 1c 08 lea (%eax,%ecx,1),%ebx +80103e49: 89 f2 mov %esi,%edx +80103e4b: 85 c9 test %ecx,%ecx +80103e4d: 74 11 je 80103e60 *d++ = *s++; -80103ffb: 83 c0 01 add $0x1,%eax -80103ffe: 83 c2 01 add $0x1,%edx -80104001: 0f b6 48 ff movzbl -0x1(%eax),%ecx -80104005: 88 4a ff mov %cl,-0x1(%edx) +80103e4f: 83 c0 01 add $0x1,%eax +80103e52: 83 c2 01 add $0x1,%edx +80103e55: 0f b6 48 ff movzbl -0x1(%eax),%ecx +80103e59: 88 4a ff mov %cl,-0x1(%edx) while(n-- > 0) -80104008: 39 d8 cmp %ebx,%eax -8010400a: 75 ef jne 80103ffb +80103e5c: 39 d8 cmp %ebx,%eax +80103e5e: 75 ef jne 80103e4f return dst; } -8010400c: 89 f0 mov %esi,%eax -8010400e: 5b pop %ebx -8010400f: 5e pop %esi -80104010: 5d pop %ebp -80104011: c3 ret +80103e60: 89 f0 mov %esi,%eax +80103e62: 5b pop %ebx +80103e63: 5e pop %esi +80103e64: 5d pop %ebp +80103e65: c3 ret if(s < d && s + n > d){ -80104012: 8d 14 08 lea (%eax,%ecx,1),%edx -80104015: 39 d6 cmp %edx,%esi -80104017: 73 d9 jae 80103ff2 +80103e66: 8d 14 08 lea (%eax,%ecx,1),%edx +80103e69: 39 d6 cmp %edx,%esi +80103e6b: 73 d9 jae 80103e46 while(n-- > 0) -80104019: 8d 51 ff lea -0x1(%ecx),%edx -8010401c: 85 c9 test %ecx,%ecx -8010401e: 74 ec je 8010400c +80103e6d: 8d 51 ff lea -0x1(%ecx),%edx +80103e70: 85 c9 test %ecx,%ecx +80103e72: 74 ec je 80103e60 *--d = *--s; -80104020: 0f b6 0c 10 movzbl (%eax,%edx,1),%ecx -80104024: 88 0c 16 mov %cl,(%esi,%edx,1) +80103e74: 0f b6 0c 10 movzbl (%eax,%edx,1),%ecx +80103e78: 88 0c 16 mov %cl,(%esi,%edx,1) while(n-- > 0) -80104027: 83 ea 01 sub $0x1,%edx -8010402a: 83 fa ff cmp $0xffffffff,%edx -8010402d: 75 f1 jne 80104020 -8010402f: eb db jmp 8010400c +80103e7b: 83 ea 01 sub $0x1,%edx +80103e7e: 83 fa ff cmp $0xffffffff,%edx +80103e81: 75 f1 jne 80103e74 +80103e83: eb db jmp 80103e60 -80104031 : +80103e85 : // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { -80104031: f3 0f 1e fb endbr32 -80104035: 55 push %ebp -80104036: 89 e5 mov %esp,%ebp -80104038: 83 ec 0c sub $0xc,%esp +80103e85: 55 push %ebp +80103e86: 89 e5 mov %esp,%ebp +80103e88: 83 ec 0c sub $0xc,%esp return memmove(dst, src, n); -8010403b: ff 75 10 pushl 0x10(%ebp) -8010403e: ff 75 0c pushl 0xc(%ebp) -80104041: ff 75 08 pushl 0x8(%ebp) -80104044: e8 93 ff ff ff call 80103fdc +80103e8b: ff 75 10 push 0x10(%ebp) +80103e8e: ff 75 0c push 0xc(%ebp) +80103e91: ff 75 08 push 0x8(%ebp) +80103e94: e8 9b ff ff ff call 80103e34 } -80104049: c9 leave -8010404a: c3 ret +80103e99: c9 leave +80103e9a: c3 ret -8010404b : +80103e9b : int strncmp(const char *p, const char *q, uint n) { -8010404b: f3 0f 1e fb endbr32 -8010404f: 55 push %ebp -80104050: 89 e5 mov %esp,%ebp -80104052: 53 push %ebx -80104053: 8b 55 08 mov 0x8(%ebp),%edx -80104056: 8b 4d 0c mov 0xc(%ebp),%ecx -80104059: 8b 45 10 mov 0x10(%ebp),%eax +80103e9b: 55 push %ebp +80103e9c: 89 e5 mov %esp,%ebp +80103e9e: 53 push %ebx +80103e9f: 8b 55 08 mov 0x8(%ebp),%edx +80103ea2: 8b 4d 0c mov 0xc(%ebp),%ecx +80103ea5: 8b 45 10 mov 0x10(%ebp),%eax while(n > 0 && *p && *p == *q) -8010405c: 85 c0 test %eax,%eax -8010405e: 74 29 je 80104089 -80104060: 0f b6 1a movzbl (%edx),%ebx -80104063: 84 db test %bl,%bl -80104065: 74 16 je 8010407d -80104067: 3a 19 cmp (%ecx),%bl -80104069: 75 12 jne 8010407d +80103ea8: 85 c0 test %eax,%eax +80103eaa: 74 29 je 80103ed5 +80103eac: 0f b6 1a movzbl (%edx),%ebx +80103eaf: 84 db test %bl,%bl +80103eb1: 74 16 je 80103ec9 +80103eb3: 3a 19 cmp (%ecx),%bl +80103eb5: 75 12 jne 80103ec9 n--, p++, q++; -8010406b: 83 c2 01 add $0x1,%edx -8010406e: 83 c1 01 add $0x1,%ecx +80103eb7: 83 c2 01 add $0x1,%edx +80103eba: 83 c1 01 add $0x1,%ecx while(n > 0 && *p && *p == *q) -80104071: 83 e8 01 sub $0x1,%eax -80104074: 75 ea jne 80104060 +80103ebd: 83 e8 01 sub $0x1,%eax +80103ec0: 75 ea jne 80103eac if(n == 0) return 0; -80104076: b8 00 00 00 00 mov $0x0,%eax -8010407b: eb 0c jmp 80104089 +80103ec2: b8 00 00 00 00 mov $0x0,%eax +80103ec7: eb 0c jmp 80103ed5 if(n == 0) -8010407d: 85 c0 test %eax,%eax -8010407f: 74 0b je 8010408c +80103ec9: 85 c0 test %eax,%eax +80103ecb: 74 0d je 80103eda return (uchar)*p - (uchar)*q; -80104081: 0f b6 02 movzbl (%edx),%eax -80104084: 0f b6 11 movzbl (%ecx),%edx -80104087: 29 d0 sub %edx,%eax +80103ecd: 0f b6 02 movzbl (%edx),%eax +80103ed0: 0f b6 11 movzbl (%ecx),%edx +80103ed3: 29 d0 sub %edx,%eax } -80104089: 5b pop %ebx -8010408a: 5d pop %ebp -8010408b: c3 ret +80103ed5: 8b 5d fc mov -0x4(%ebp),%ebx +80103ed8: c9 leave +80103ed9: c3 ret return 0; -8010408c: b8 00 00 00 00 mov $0x0,%eax -80104091: eb f6 jmp 80104089 +80103eda: b8 00 00 00 00 mov $0x0,%eax +80103edf: eb f4 jmp 80103ed5 -80104093 : +80103ee1 : char* strncpy(char *s, const char *t, int n) { -80104093: f3 0f 1e fb endbr32 -80104097: 55 push %ebp -80104098: 89 e5 mov %esp,%ebp -8010409a: 57 push %edi -8010409b: 56 push %esi -8010409c: 53 push %ebx -8010409d: 8b 75 08 mov 0x8(%ebp),%esi -801040a0: 8b 45 10 mov 0x10(%ebp),%eax +80103ee1: 55 push %ebp +80103ee2: 89 e5 mov %esp,%ebp +80103ee4: 57 push %edi +80103ee5: 56 push %esi +80103ee6: 53 push %ebx +80103ee7: 8b 75 08 mov 0x8(%ebp),%esi +80103eea: 8b 4d 10 mov 0x10(%ebp),%ecx char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) -801040a3: 89 f2 mov %esi,%edx -801040a5: 89 c3 mov %eax,%ebx -801040a7: 83 e8 01 sub $0x1,%eax -801040aa: 85 db test %ebx,%ebx -801040ac: 7e 17 jle 801040c5 -801040ae: 83 45 0c 01 addl $0x1,0xc(%ebp) -801040b2: 83 c2 01 add $0x1,%edx -801040b5: 8b 7d 0c mov 0xc(%ebp),%edi -801040b8: 0f b6 7f ff movzbl -0x1(%edi),%edi -801040bc: 89 f9 mov %edi,%ecx -801040be: 88 4a ff mov %cl,-0x1(%edx) -801040c1: 84 c9 test %cl,%cl -801040c3: 75 e0 jne 801040a5 +80103eed: 89 f0 mov %esi,%eax +80103eef: 89 cb mov %ecx,%ebx +80103ef1: 83 e9 01 sub $0x1,%ecx +80103ef4: 85 db test %ebx,%ebx +80103ef6: 7e 17 jle 80103f0f +80103ef8: 83 45 0c 01 addl $0x1,0xc(%ebp) +80103efc: 83 c0 01 add $0x1,%eax +80103eff: 8b 7d 0c mov 0xc(%ebp),%edi +80103f02: 0f b6 7f ff movzbl -0x1(%edi),%edi +80103f06: 89 fa mov %edi,%edx +80103f08: 88 50 ff mov %dl,-0x1(%eax) +80103f0b: 84 d2 test %dl,%dl +80103f0d: 75 e0 jne 80103eef ; while(n-- > 0) -801040c5: 89 d1 mov %edx,%ecx -801040c7: 85 c0 test %eax,%eax -801040c9: 7e 13 jle 801040de +80103f0f: 89 c2 mov %eax,%edx +80103f11: 85 c9 test %ecx,%ecx +80103f13: 7e 13 jle 80103f28 *s++ = 0; -801040cb: 83 c1 01 add $0x1,%ecx -801040ce: c6 41 ff 00 movb $0x0,-0x1(%ecx) +80103f15: 83 c2 01 add $0x1,%edx +80103f18: c6 42 ff 00 movb $0x0,-0x1(%edx) while(n-- > 0) -801040d2: 89 c8 mov %ecx,%eax -801040d4: f7 d0 not %eax -801040d6: 01 d8 add %ebx,%eax -801040d8: 01 d0 add %edx,%eax -801040da: 85 c0 test %eax,%eax -801040dc: 7f ed jg 801040cb +80103f1c: 89 d9 mov %ebx,%ecx +80103f1e: 29 d1 sub %edx,%ecx +80103f20: 8d 4c 08 ff lea -0x1(%eax,%ecx,1),%ecx +80103f24: 85 c9 test %ecx,%ecx +80103f26: 7f ed jg 80103f15 return os; } -801040de: 89 f0 mov %esi,%eax -801040e0: 5b pop %ebx -801040e1: 5e pop %esi -801040e2: 5f pop %edi -801040e3: 5d pop %ebp -801040e4: c3 ret +80103f28: 89 f0 mov %esi,%eax +80103f2a: 5b pop %ebx +80103f2b: 5e pop %esi +80103f2c: 5f pop %edi +80103f2d: 5d pop %ebp +80103f2e: c3 ret -801040e5 : +80103f2f : // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { -801040e5: f3 0f 1e fb endbr32 -801040e9: 55 push %ebp -801040ea: 89 e5 mov %esp,%ebp -801040ec: 56 push %esi -801040ed: 53 push %ebx -801040ee: 8b 75 08 mov 0x8(%ebp),%esi -801040f1: 8b 45 0c mov 0xc(%ebp),%eax -801040f4: 8b 55 10 mov 0x10(%ebp),%edx +80103f2f: 55 push %ebp +80103f30: 89 e5 mov %esp,%ebp +80103f32: 56 push %esi +80103f33: 53 push %ebx +80103f34: 8b 75 08 mov 0x8(%ebp),%esi +80103f37: 8b 45 0c mov 0xc(%ebp),%eax +80103f3a: 8b 55 10 mov 0x10(%ebp),%edx char *os; os = s; if(n <= 0) -801040f7: 85 d2 test %edx,%edx -801040f9: 7e 1e jle 80104119 -801040fb: 8d 5c 10 ff lea -0x1(%eax,%edx,1),%ebx -801040ff: 89 f2 mov %esi,%edx +80103f3d: 85 d2 test %edx,%edx +80103f3f: 7e 1e jle 80103f5f +80103f41: 8d 5c 10 ff lea -0x1(%eax,%edx,1),%ebx +80103f45: 89 f2 mov %esi,%edx return os; while(--n > 0 && (*s++ = *t++) != 0) -80104101: 39 d8 cmp %ebx,%eax -80104103: 74 11 je 80104116 -80104105: 83 c0 01 add $0x1,%eax -80104108: 83 c2 01 add $0x1,%edx -8010410b: 0f b6 48 ff movzbl -0x1(%eax),%ecx -8010410f: 88 4a ff mov %cl,-0x1(%edx) -80104112: 84 c9 test %cl,%cl -80104114: 75 eb jne 80104101 +80103f47: 39 d8 cmp %ebx,%eax +80103f49: 74 11 je 80103f5c +80103f4b: 83 c0 01 add $0x1,%eax +80103f4e: 83 c2 01 add $0x1,%edx +80103f51: 0f b6 48 ff movzbl -0x1(%eax),%ecx +80103f55: 88 4a ff mov %cl,-0x1(%edx) +80103f58: 84 c9 test %cl,%cl +80103f5a: 75 eb jne 80103f47 ; *s = 0; -80104116: c6 02 00 movb $0x0,(%edx) +80103f5c: c6 02 00 movb $0x0,(%edx) return os; } -80104119: 89 f0 mov %esi,%eax -8010411b: 5b pop %ebx -8010411c: 5e pop %esi -8010411d: 5d pop %ebp -8010411e: c3 ret +80103f5f: 89 f0 mov %esi,%eax +80103f61: 5b pop %ebx +80103f62: 5e pop %esi +80103f63: 5d pop %ebp +80103f64: c3 ret -8010411f : +80103f65 : int strlen(const char *s) { -8010411f: f3 0f 1e fb endbr32 -80104123: 55 push %ebp -80104124: 89 e5 mov %esp,%ebp -80104126: 8b 55 08 mov 0x8(%ebp),%edx +80103f65: 55 push %ebp +80103f66: 89 e5 mov %esp,%ebp +80103f68: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) -80104129: 80 3a 00 cmpb $0x0,(%edx) -8010412c: 74 10 je 8010413e -8010412e: b8 00 00 00 00 mov $0x0,%eax -80104133: 83 c0 01 add $0x1,%eax -80104136: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) -8010413a: 75 f7 jne 80104133 +80103f6b: 80 3a 00 cmpb $0x0,(%edx) +80103f6e: 74 10 je 80103f80 +80103f70: b8 00 00 00 00 mov $0x0,%eax +80103f75: 83 c0 01 add $0x1,%eax +80103f78: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) +80103f7c: 75 f7 jne 80103f75 ; return n; } -8010413c: 5d pop %ebp -8010413d: c3 ret +80103f7e: 5d pop %ebp +80103f7f: c3 ret for(n = 0; s[n]; n++) -8010413e: b8 00 00 00 00 mov $0x0,%eax +80103f80: b8 00 00 00 00 mov $0x0,%eax return n; -80104143: eb f7 jmp 8010413c +80103f85: eb f7 jmp 80103f7e -80104145 : +80103f87 : # 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 -80104145: 8b 44 24 04 mov 0x4(%esp),%eax +80103f87: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx -80104149: 8b 54 24 08 mov 0x8(%esp),%edx +80103f8b: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-saved registers pushl %ebp -8010414d: 55 push %ebp +80103f8f: 55 push %ebp pushl %ebx -8010414e: 53 push %ebx +80103f90: 53 push %ebx pushl %esi -8010414f: 56 push %esi +80103f91: 56 push %esi pushl %edi -80104150: 57 push %edi +80103f92: 57 push %edi # Switch stacks movl %esp, (%eax) -80104151: 89 20 mov %esp,(%eax) +80103f93: 89 20 mov %esp,(%eax) movl %edx, %esp -80104153: 89 d4 mov %edx,%esp +80103f95: 89 d4 mov %edx,%esp # Load new callee-saved registers popl %edi -80104155: 5f pop %edi +80103f97: 5f pop %edi popl %esi -80104156: 5e pop %esi +80103f98: 5e pop %esi popl %ebx -80104157: 5b pop %ebx +80103f99: 5b pop %ebx popl %ebp -80104158: 5d pop %ebp +80103f9a: 5d pop %ebp ret -80104159: c3 ret +80103f9b: c3 ret -8010415a : +80103f9c : // 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) { -8010415a: f3 0f 1e fb endbr32 -8010415e: 55 push %ebp -8010415f: 89 e5 mov %esp,%ebp -80104161: 53 push %ebx -80104162: 83 ec 04 sub $0x4,%esp -80104165: 8b 5d 08 mov 0x8(%ebp),%ebx +80103f9c: 55 push %ebp +80103f9d: 89 e5 mov %esp,%ebp +80103f9f: 53 push %ebx +80103fa0: 83 ec 04 sub $0x4,%esp +80103fa3: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *curproc = myproc(); -80104168: e8 7d f2 ff ff call 801033ea +80103fa6: e8 05 f3 ff ff call 801032b0 if(addr >= curproc->sz || addr+4 > curproc->sz) -8010416d: 8b 00 mov (%eax),%eax -8010416f: 39 d8 cmp %ebx,%eax -80104171: 76 19 jbe 8010418c -80104173: 8d 53 04 lea 0x4(%ebx),%edx -80104176: 39 d0 cmp %edx,%eax -80104178: 72 19 jb 80104193 +80103fab: 8b 00 mov (%eax),%eax +80103fad: 39 d8 cmp %ebx,%eax +80103faf: 76 18 jbe 80103fc9 +80103fb1: 8d 53 04 lea 0x4(%ebx),%edx +80103fb4: 39 d0 cmp %edx,%eax +80103fb6: 72 18 jb 80103fd0 return -1; *ip = *(int*)(addr); -8010417a: 8b 13 mov (%ebx),%edx -8010417c: 8b 45 0c mov 0xc(%ebp),%eax -8010417f: 89 10 mov %edx,(%eax) +80103fb8: 8b 13 mov (%ebx),%edx +80103fba: 8b 45 0c mov 0xc(%ebp),%eax +80103fbd: 89 10 mov %edx,(%eax) return 0; -80104181: b8 00 00 00 00 mov $0x0,%eax +80103fbf: b8 00 00 00 00 mov $0x0,%eax } -80104186: 83 c4 04 add $0x4,%esp -80104189: 5b pop %ebx -8010418a: 5d pop %ebp -8010418b: c3 ret +80103fc4: 8b 5d fc mov -0x4(%ebp),%ebx +80103fc7: c9 leave +80103fc8: c3 ret return -1; -8010418c: b8 ff ff ff ff mov $0xffffffff,%eax -80104191: eb f3 jmp 80104186 -80104193: b8 ff ff ff ff mov $0xffffffff,%eax -80104198: eb ec jmp 80104186 +80103fc9: b8 ff ff ff ff mov $0xffffffff,%eax +80103fce: eb f4 jmp 80103fc4 +80103fd0: b8 ff ff ff ff mov $0xffffffff,%eax +80103fd5: eb ed jmp 80103fc4 -8010419a : +80103fd7 : // 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) { -8010419a: f3 0f 1e fb endbr32 -8010419e: 55 push %ebp -8010419f: 89 e5 mov %esp,%ebp -801041a1: 53 push %ebx -801041a2: 83 ec 04 sub $0x4,%esp -801041a5: 8b 5d 08 mov 0x8(%ebp),%ebx +80103fd7: 55 push %ebp +80103fd8: 89 e5 mov %esp,%ebp +80103fda: 53 push %ebx +80103fdb: 83 ec 04 sub $0x4,%esp +80103fde: 8b 5d 08 mov 0x8(%ebp),%ebx char *s, *ep; struct proc *curproc = myproc(); -801041a8: e8 3d f2 ff ff call 801033ea +80103fe1: e8 ca f2 ff ff call 801032b0 if(addr >= curproc->sz) -801041ad: 39 18 cmp %ebx,(%eax) -801041af: 76 28 jbe 801041d9 +80103fe6: 39 18 cmp %ebx,(%eax) +80103fe8: 76 27 jbe 80104011 return -1; *pp = (char*)addr; -801041b1: 8b 55 0c mov 0xc(%ebp),%edx -801041b4: 89 1a mov %ebx,(%edx) +80103fea: 8b 55 0c mov 0xc(%ebp),%edx +80103fed: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; -801041b6: 8b 10 mov (%eax),%edx +80103fef: 8b 10 mov (%eax),%edx for(s = *pp; s < ep; s++){ -801041b8: 39 d3 cmp %edx,%ebx -801041ba: 73 24 jae 801041e0 -801041bc: 89 d8 mov %ebx,%eax +80103ff1: 39 d3 cmp %edx,%ebx +80103ff3: 73 23 jae 80104018 +80103ff5: 89 d8 mov %ebx,%eax if(*s == 0) -801041be: 80 38 00 cmpb $0x0,(%eax) -801041c1: 74 0e je 801041d1 +80103ff7: 80 38 00 cmpb $0x0,(%eax) +80103ffa: 74 0e je 8010400a for(s = *pp; s < ep; s++){ -801041c3: 83 c0 01 add $0x1,%eax -801041c6: 39 c2 cmp %eax,%edx -801041c8: 77 f4 ja 801041be +80103ffc: 83 c0 01 add $0x1,%eax +80103fff: 39 c2 cmp %eax,%edx +80104001: 77 f4 ja 80103ff7 return s - *pp; } return -1; -801041ca: b8 ff ff ff ff mov $0xffffffff,%eax -801041cf: eb 02 jmp 801041d3 +80104003: b8 ff ff ff ff mov $0xffffffff,%eax +80104008: eb 02 jmp 8010400c return s - *pp; -801041d1: 29 d8 sub %ebx,%eax +8010400a: 29 d8 sub %ebx,%eax } -801041d3: 83 c4 04 add $0x4,%esp -801041d6: 5b pop %ebx -801041d7: 5d pop %ebp -801041d8: c3 ret +8010400c: 8b 5d fc mov -0x4(%ebp),%ebx +8010400f: c9 leave +80104010: c3 ret return -1; -801041d9: b8 ff ff ff ff mov $0xffffffff,%eax -801041de: eb f3 jmp 801041d3 +80104011: b8 ff ff ff ff mov $0xffffffff,%eax +80104016: eb f4 jmp 8010400c return -1; -801041e0: b8 ff ff ff ff mov $0xffffffff,%eax -801041e5: eb ec jmp 801041d3 +80104018: b8 ff ff ff ff mov $0xffffffff,%eax +8010401d: eb ed jmp 8010400c -801041e7 : +8010401f : // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { -801041e7: f3 0f 1e fb endbr32 -801041eb: 55 push %ebp -801041ec: 89 e5 mov %esp,%ebp -801041ee: 83 ec 08 sub $0x8,%esp +8010401f: 55 push %ebp +80104020: 89 e5 mov %esp,%ebp +80104022: 83 ec 08 sub $0x8,%esp return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); -801041f1: e8 f4 f1 ff ff call 801033ea -801041f6: 83 ec 08 sub $0x8,%esp -801041f9: ff 75 0c pushl 0xc(%ebp) -801041fc: 8b 40 18 mov 0x18(%eax),%eax -801041ff: 8b 40 44 mov 0x44(%eax),%eax -80104202: 8b 55 08 mov 0x8(%ebp),%edx -80104205: 8d 44 90 04 lea 0x4(%eax,%edx,4),%eax -80104209: 50 push %eax -8010420a: e8 4b ff ff ff call 8010415a -} -8010420f: c9 leave -80104210: c3 ret - -80104211 : +80104025: e8 86 f2 ff ff call 801032b0 +8010402a: 83 ec 08 sub $0x8,%esp +8010402d: ff 75 0c push 0xc(%ebp) +80104030: 8b 40 18 mov 0x18(%eax),%eax +80104033: 8b 40 44 mov 0x44(%eax),%eax +80104036: 8b 55 08 mov 0x8(%ebp),%edx +80104039: 8d 44 90 04 lea 0x4(%eax,%edx,4),%eax +8010403d: 50 push %eax +8010403e: e8 59 ff ff ff call 80103f9c +} +80104043: c9 leave +80104044: c3 ret + +80104045 : // 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) { -80104211: f3 0f 1e fb endbr32 -80104215: 55 push %ebp -80104216: 89 e5 mov %esp,%ebp -80104218: 56 push %esi -80104219: 53 push %ebx -8010421a: 83 ec 10 sub $0x10,%esp -8010421d: 8b 5d 10 mov 0x10(%ebp),%ebx +80104045: 55 push %ebp +80104046: 89 e5 mov %esp,%ebp +80104048: 56 push %esi +80104049: 53 push %ebx +8010404a: 83 ec 10 sub $0x10,%esp +8010404d: 8b 5d 10 mov 0x10(%ebp),%ebx int i; struct proc *curproc = myproc(); -80104220: e8 c5 f1 ff ff call 801033ea -80104225: 89 c6 mov %eax,%esi +80104050: e8 5b f2 ff ff call 801032b0 +80104055: 89 c6 mov %eax,%esi if(argint(n, &i) < 0) -80104227: 83 ec 08 sub $0x8,%esp -8010422a: 8d 45 f4 lea -0xc(%ebp),%eax -8010422d: 50 push %eax -8010422e: ff 75 08 pushl 0x8(%ebp) -80104231: e8 b1 ff ff ff call 801041e7 +80104057: 83 ec 08 sub $0x8,%esp +8010405a: 8d 45 f4 lea -0xc(%ebp),%eax +8010405d: 50 push %eax +8010405e: ff 75 08 push 0x8(%ebp) +80104061: e8 b9 ff ff ff call 8010401f return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) -80104236: 83 c4 10 add $0x10,%esp -80104239: 85 db test %ebx,%ebx -8010423b: 78 24 js 80104261 -8010423d: 85 c0 test %eax,%eax -8010423f: 78 20 js 80104261 -80104241: 8b 16 mov (%esi),%edx -80104243: 8b 45 f4 mov -0xc(%ebp),%eax -80104246: 39 c2 cmp %eax,%edx -80104248: 76 1e jbe 80104268 -8010424a: 01 c3 add %eax,%ebx -8010424c: 39 da cmp %ebx,%edx -8010424e: 72 1f jb 8010426f +80104066: 83 c4 10 add $0x10,%esp +80104069: 09 d8 or %ebx,%eax +8010406b: 78 20 js 8010408d +8010406d: 8b 16 mov (%esi),%edx +8010406f: 8b 45 f4 mov -0xc(%ebp),%eax +80104072: 39 c2 cmp %eax,%edx +80104074: 76 1e jbe 80104094 +80104076: 01 c3 add %eax,%ebx +80104078: 39 da cmp %ebx,%edx +8010407a: 72 1f jb 8010409b return -1; *pp = (char*)i; -80104250: 8b 55 0c mov 0xc(%ebp),%edx -80104253: 89 02 mov %eax,(%edx) +8010407c: 8b 55 0c mov 0xc(%ebp),%edx +8010407f: 89 02 mov %eax,(%edx) return 0; -80104255: b8 00 00 00 00 mov $0x0,%eax +80104081: b8 00 00 00 00 mov $0x0,%eax } -8010425a: 8d 65 f8 lea -0x8(%ebp),%esp -8010425d: 5b pop %ebx -8010425e: 5e pop %esi -8010425f: 5d pop %ebp -80104260: c3 ret +80104086: 8d 65 f8 lea -0x8(%ebp),%esp +80104089: 5b pop %ebx +8010408a: 5e pop %esi +8010408b: 5d pop %ebp +8010408c: c3 ret return -1; -80104261: b8 ff ff ff ff mov $0xffffffff,%eax -80104266: eb f2 jmp 8010425a -80104268: b8 ff ff ff ff mov $0xffffffff,%eax -8010426d: eb eb jmp 8010425a -8010426f: b8 ff ff ff ff mov $0xffffffff,%eax -80104274: eb e4 jmp 8010425a - -80104276 : +8010408d: b8 ff ff ff ff mov $0xffffffff,%eax +80104092: eb f2 jmp 80104086 +80104094: b8 ff ff ff ff mov $0xffffffff,%eax +80104099: eb eb jmp 80104086 +8010409b: b8 ff ff ff ff mov $0xffffffff,%eax +801040a0: eb e4 jmp 80104086 + +801040a2 : // 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) { -80104276: f3 0f 1e fb endbr32 -8010427a: 55 push %ebp -8010427b: 89 e5 mov %esp,%ebp -8010427d: 83 ec 20 sub $0x20,%esp +801040a2: 55 push %ebp +801040a3: 89 e5 mov %esp,%ebp +801040a5: 83 ec 20 sub $0x20,%esp int addr; if(argint(n, &addr) < 0) -80104280: 8d 45 f4 lea -0xc(%ebp),%eax -80104283: 50 push %eax -80104284: ff 75 08 pushl 0x8(%ebp) -80104287: e8 5b ff ff ff call 801041e7 -8010428c: 83 c4 10 add $0x10,%esp -8010428f: 85 c0 test %eax,%eax -80104291: 78 13 js 801042a6 +801040a8: 8d 45 f4 lea -0xc(%ebp),%eax +801040ab: 50 push %eax +801040ac: ff 75 08 push 0x8(%ebp) +801040af: e8 6b ff ff ff call 8010401f +801040b4: 83 c4 10 add $0x10,%esp +801040b7: 85 c0 test %eax,%eax +801040b9: 78 13 js 801040ce return -1; return fetchstr(addr, pp); -80104293: 83 ec 08 sub $0x8,%esp -80104296: ff 75 0c pushl 0xc(%ebp) -80104299: ff 75 f4 pushl -0xc(%ebp) -8010429c: e8 f9 fe ff ff call 8010419a -801042a1: 83 c4 10 add $0x10,%esp -} -801042a4: c9 leave -801042a5: c3 ret +801040bb: 83 ec 08 sub $0x8,%esp +801040be: ff 75 0c push 0xc(%ebp) +801040c1: ff 75 f4 push -0xc(%ebp) +801040c4: e8 0e ff ff ff call 80103fd7 +801040c9: 83 c4 10 add $0x10,%esp +} +801040cc: c9 leave +801040cd: c3 ret return -1; -801042a6: b8 ff ff ff ff mov $0xffffffff,%eax -801042ab: eb f7 jmp 801042a4 +801040ce: b8 ff ff ff ff mov $0xffffffff,%eax +801040d3: eb f7 jmp 801040cc -801042ad : +801040d5 : [SYS_ps] sys_ps, }; void syscall(void) { -801042ad: f3 0f 1e fb endbr32 -801042b1: 55 push %ebp -801042b2: 89 e5 mov %esp,%ebp -801042b4: 53 push %ebx -801042b5: 83 ec 04 sub $0x4,%esp +801040d5: 55 push %ebp +801040d6: 89 e5 mov %esp,%ebp +801040d8: 53 push %ebx +801040d9: 83 ec 04 sub $0x4,%esp int num; struct proc *curproc = myproc(); -801042b8: e8 2d f1 ff ff call 801033ea -801042bd: 89 c3 mov %eax,%ebx +801040dc: e8 cf f1 ff ff call 801032b0 +801040e1: 89 c3 mov %eax,%ebx num = curproc->tf->eax; -801042bf: 8b 40 18 mov 0x18(%eax),%eax -801042c2: 8b 40 1c mov 0x1c(%eax),%eax +801040e3: 8b 40 18 mov 0x18(%eax),%eax +801040e6: 8b 40 1c mov 0x1c(%eax),%eax if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { -801042c5: 8d 50 ff lea -0x1(%eax),%edx -801042c8: 83 fa 16 cmp $0x16,%edx -801042cb: 77 17 ja 801042e4 -801042cd: 8b 14 85 80 7f 10 80 mov -0x7fef8080(,%eax,4),%edx -801042d4: 85 d2 test %edx,%edx -801042d6: 74 0c je 801042e4 +801040e9: 8d 50 ff lea -0x1(%eax),%edx +801040ec: 83 fa 16 cmp $0x16,%edx +801040ef: 77 17 ja 80104108 +801040f1: 8b 14 85 a0 7c 10 80 mov -0x7fef8360(,%eax,4),%edx +801040f8: 85 d2 test %edx,%edx +801040fa: 74 0c je 80104108 curproc->tf->eax = syscalls[num](); -801042d8: ff d2 call *%edx -801042da: 89 c2 mov %eax,%edx -801042dc: 8b 43 18 mov 0x18(%ebx),%eax -801042df: 89 50 1c mov %edx,0x1c(%eax) -801042e2: eb 1f jmp 80104303 +801040fc: ff d2 call *%edx +801040fe: 89 c2 mov %eax,%edx +80104100: 8b 43 18 mov 0x18(%ebx),%eax +80104103: 89 50 1c mov %edx,0x1c(%eax) +80104106: eb 1f jmp 80104127 } else { cprintf("%d %s: unknown sys call %d\n", -801042e4: 50 push %eax +80104108: 50 push %eax curproc->pid, curproc->name, num); -801042e5: 8d 43 6c lea 0x6c(%ebx),%eax +80104109: 8d 43 6c lea 0x6c(%ebx),%eax cprintf("%d %s: unknown sys call %d\n", -801042e8: 50 push %eax -801042e9: ff 73 10 pushl 0x10(%ebx) -801042ec: 68 4d 7f 10 80 push $0x80107f4d -801042f1: e8 36 c3 ff ff call 8010062c +8010410c: 50 push %eax +8010410d: ff 73 10 push 0x10(%ebx) +80104110: 68 6d 7c 10 80 push $0x80107c6d +80104115: e8 e7 c4 ff ff call 80100601 curproc->tf->eax = -1; -801042f6: 8b 43 18 mov 0x18(%ebx),%eax -801042f9: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) -80104300: 83 c4 10 add $0x10,%esp +8010411a: 8b 43 18 mov 0x18(%ebx),%eax +8010411d: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) +80104124: 83 c4 10 add $0x10,%esp } } -80104303: 8b 5d fc mov -0x4(%ebp),%ebx -80104306: c9 leave -80104307: c3 ret +80104127: 8b 5d fc mov -0x4(%ebp),%ebx +8010412a: c9 leave +8010412b: c3 ret -80104308 : +8010412c : // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) { -80104308: 55 push %ebp -80104309: 89 e5 mov %esp,%ebp -8010430b: 56 push %esi -8010430c: 53 push %ebx -8010430d: 83 ec 18 sub $0x18,%esp -80104310: 89 d6 mov %edx,%esi -80104312: 89 cb mov %ecx,%ebx +8010412c: 55 push %ebp +8010412d: 89 e5 mov %esp,%ebp +8010412f: 56 push %esi +80104130: 53 push %ebx +80104131: 83 ec 18 sub $0x18,%esp +80104134: 89 d6 mov %edx,%esi +80104136: 89 cb mov %ecx,%ebx int fd; struct file *f; if(argint(n, &fd) < 0) -80104314: 8d 55 f4 lea -0xc(%ebp),%edx -80104317: 52 push %edx -80104318: 50 push %eax -80104319: e8 c9 fe ff ff call 801041e7 -8010431e: 83 c4 10 add $0x10,%esp -80104321: 85 c0 test %eax,%eax -80104323: 78 30 js 80104355 +80104138: 8d 55 f4 lea -0xc(%ebp),%edx +8010413b: 52 push %edx +8010413c: 50 push %eax +8010413d: e8 dd fe ff ff call 8010401f +80104142: 83 c4 10 add $0x10,%esp +80104145: 85 c0 test %eax,%eax +80104147: 78 30 js 80104179 return -1; if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) -80104325: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) -80104329: 77 31 ja 8010435c -8010432b: e8 ba f0 ff ff call 801033ea -80104330: 89 c2 mov %eax,%edx -80104332: 8b 45 f4 mov -0xc(%ebp),%eax -80104335: 8b 54 82 28 mov 0x28(%edx,%eax,4),%edx -80104339: 85 d2 test %edx,%edx -8010433b: 74 26 je 80104363 +80104149: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) +8010414d: 77 31 ja 80104180 +8010414f: e8 5c f1 ff ff call 801032b0 +80104154: 89 c2 mov %eax,%edx +80104156: 8b 45 f4 mov -0xc(%ebp),%eax +80104159: 8b 54 82 28 mov 0x28(%edx,%eax,4),%edx +8010415d: 85 d2 test %edx,%edx +8010415f: 74 26 je 80104187 return -1; if(pfd) -8010433d: 85 f6 test %esi,%esi -8010433f: 74 02 je 80104343 +80104161: 85 f6 test %esi,%esi +80104163: 74 02 je 80104167 *pfd = fd; -80104341: 89 06 mov %eax,(%esi) +80104165: 89 06 mov %eax,(%esi) if(pf) *pf = f; return 0; -80104343: b8 00 00 00 00 mov $0x0,%eax +80104167: b8 00 00 00 00 mov $0x0,%eax if(pf) -80104348: 85 db test %ebx,%ebx -8010434a: 74 02 je 8010434e +8010416c: 85 db test %ebx,%ebx +8010416e: 74 02 je 80104172 *pf = f; -8010434c: 89 13 mov %edx,(%ebx) +80104170: 89 13 mov %edx,(%ebx) } -8010434e: 8d 65 f8 lea -0x8(%ebp),%esp -80104351: 5b pop %ebx -80104352: 5e pop %esi -80104353: 5d pop %ebp -80104354: c3 ret +80104172: 8d 65 f8 lea -0x8(%ebp),%esp +80104175: 5b pop %ebx +80104176: 5e pop %esi +80104177: 5d pop %ebp +80104178: c3 ret return -1; -80104355: b8 ff ff ff ff mov $0xffffffff,%eax -8010435a: eb f2 jmp 8010434e +80104179: b8 ff ff ff ff mov $0xffffffff,%eax +8010417e: eb f2 jmp 80104172 return -1; -8010435c: b8 ff ff ff ff mov $0xffffffff,%eax -80104361: eb eb jmp 8010434e -80104363: b8 ff ff ff ff mov $0xffffffff,%eax -80104368: eb e4 jmp 8010434e +80104180: b8 ff ff ff ff mov $0xffffffff,%eax +80104185: eb eb jmp 80104172 +80104187: b8 ff ff ff ff mov $0xffffffff,%eax +8010418c: eb e4 jmp 80104172 -8010436a : +8010418e : // Allocate a file descriptor for the given file. // Takes over file reference from caller on success. static int fdalloc(struct file *f) { -8010436a: 55 push %ebp -8010436b: 89 e5 mov %esp,%ebp -8010436d: 53 push %ebx -8010436e: 83 ec 04 sub $0x4,%esp -80104371: 89 c3 mov %eax,%ebx +8010418e: 55 push %ebp +8010418f: 89 e5 mov %esp,%ebp +80104191: 53 push %ebx +80104192: 83 ec 04 sub $0x4,%esp +80104195: 89 c3 mov %eax,%ebx int fd; struct proc *curproc = myproc(); -80104373: e8 72 f0 ff ff call 801033ea -80104378: 89 c2 mov %eax,%edx +80104197: e8 14 f1 ff ff call 801032b0 +8010419c: 89 c2 mov %eax,%edx for(fd = 0; fd < NOFILE; fd++){ -8010437a: b8 00 00 00 00 mov $0x0,%eax +8010419e: b8 00 00 00 00 mov $0x0,%eax if(curproc->ofile[fd] == 0){ -8010437f: 83 7c 82 28 00 cmpl $0x0,0x28(%edx,%eax,4) -80104384: 74 13 je 80104399 +801041a3: 83 7c 82 28 00 cmpl $0x0,0x28(%edx,%eax,4) +801041a8: 74 12 je 801041bc for(fd = 0; fd < NOFILE; fd++){ -80104386: 83 c0 01 add $0x1,%eax -80104389: 83 f8 10 cmp $0x10,%eax -8010438c: 75 f1 jne 8010437f +801041aa: 83 c0 01 add $0x1,%eax +801041ad: 83 f8 10 cmp $0x10,%eax +801041b0: 75 f1 jne 801041a3 curproc->ofile[fd] = f; return fd; } } return -1; -8010438e: b8 ff ff ff ff mov $0xffffffff,%eax +801041b2: b8 ff ff ff ff mov $0xffffffff,%eax } -80104393: 83 c4 04 add $0x4,%esp -80104396: 5b pop %ebx -80104397: 5d pop %ebp -80104398: c3 ret +801041b7: 8b 5d fc mov -0x4(%ebp),%ebx +801041ba: c9 leave +801041bb: c3 ret curproc->ofile[fd] = f; -80104399: 89 5c 82 28 mov %ebx,0x28(%edx,%eax,4) +801041bc: 89 5c 82 28 mov %ebx,0x28(%edx,%eax,4) return fd; -8010439d: eb f4 jmp 80104393 +801041c0: eb f5 jmp 801041b7 -8010439f : +801041c2 : return -1; } static struct inode* create(char *path, short type, short major, short minor) { -8010439f: 55 push %ebp -801043a0: 89 e5 mov %esp,%ebp -801043a2: 57 push %edi -801043a3: 56 push %esi -801043a4: 53 push %ebx -801043a5: 83 ec 34 sub $0x34,%esp -801043a8: 89 55 d4 mov %edx,-0x2c(%ebp) -801043ab: 89 4d d0 mov %ecx,-0x30(%ebp) -801043ae: 8b 7d 08 mov 0x8(%ebp),%edi +801041c2: 55 push %ebp +801041c3: 89 e5 mov %esp,%ebp +801041c5: 57 push %edi +801041c6: 56 push %esi +801041c7: 53 push %ebx +801041c8: 83 ec 34 sub $0x34,%esp +801041cb: 89 55 d4 mov %edx,-0x2c(%ebp) +801041ce: 89 4d d0 mov %ecx,-0x30(%ebp) +801041d1: 8b 7d 08 mov 0x8(%ebp),%edi struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) -801043b1: 8d 55 da lea -0x26(%ebp),%edx -801043b4: 52 push %edx -801043b5: 50 push %eax -801043b6: e8 45 d9 ff ff call 80101d00 -801043bb: 89 c6 mov %eax,%esi -801043bd: 83 c4 10 add $0x10,%esp -801043c0: 85 c0 test %eax,%eax -801043c2: 0f 84 2d 01 00 00 je 801044f5 +801041d4: 8d 55 da lea -0x26(%ebp),%edx +801041d7: 52 push %edx +801041d8: 50 push %eax +801041d9: e8 7b da ff ff call 80101c59 +801041de: 89 c6 mov %eax,%esi +801041e0: 83 c4 10 add $0x10,%esp +801041e3: 85 c0 test %eax,%eax +801041e5: 0f 84 2d 01 00 00 je 80104318 return 0; ilock(dp); -801043c8: 83 ec 0c sub $0xc,%esp -801043cb: 50 push %eax -801043cc: e8 5b d1 ff ff call 8010152c +801041eb: 83 ec 0c sub $0xc,%esp +801041ee: 50 push %eax +801041ef: e8 bf d2 ff ff call 801014b3 if((ip = dirlookup(dp, name, 0)) != 0){ -801043d1: 83 c4 0c add $0xc,%esp -801043d4: 6a 00 push $0x0 -801043d6: 8d 45 da lea -0x26(%ebp),%eax -801043d9: 50 push %eax -801043da: 56 push %esi -801043db: e8 34 d6 ff ff call 80101a14 -801043e0: 89 c3 mov %eax,%ebx -801043e2: 83 c4 10 add $0x10,%esp -801043e5: 85 c0 test %eax,%eax -801043e7: 74 3d je 80104426 +801041f4: 83 c4 0c add $0xc,%esp +801041f7: 6a 00 push $0x0 +801041f9: 8d 45 da lea -0x26(%ebp),%eax +801041fc: 50 push %eax +801041fd: 56 push %esi +801041fe: e8 76 d7 ff ff call 80101979 +80104203: 89 c3 mov %eax,%ebx +80104205: 83 c4 10 add $0x10,%esp +80104208: 85 c0 test %eax,%eax +8010420a: 74 3d je 80104249 iunlockput(dp); -801043e9: 83 ec 0c sub $0xc,%esp -801043ec: 56 push %esi -801043ed: e8 8f d3 ff ff call 80101781 +8010420c: 83 ec 0c sub $0xc,%esp +8010420f: 56 push %esi +80104210: e8 e7 d4 ff ff call 801016fc ilock(ip); -801043f2: 89 1c 24 mov %ebx,(%esp) -801043f5: e8 32 d1 ff ff call 8010152c +80104215: 89 1c 24 mov %ebx,(%esp) +80104218: e8 96 d2 ff ff call 801014b3 if(type == T_FILE && ip->type == T_FILE) -801043fa: 83 c4 10 add $0x10,%esp -801043fd: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) -80104402: 75 07 jne 8010440b -80104404: 66 83 7b 50 02 cmpw $0x2,0x50(%ebx) -80104409: 74 11 je 8010441c +8010421d: 83 c4 10 add $0x10,%esp +80104220: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) +80104225: 75 07 jne 8010422e +80104227: 66 83 7b 50 02 cmpw $0x2,0x50(%ebx) +8010422c: 74 11 je 8010423f return ip; iunlockput(ip); -8010440b: 83 ec 0c sub $0xc,%esp -8010440e: 53 push %ebx -8010440f: e8 6d d3 ff ff call 80101781 +8010422e: 83 ec 0c sub $0xc,%esp +80104231: 53 push %ebx +80104232: e8 c5 d4 ff ff call 801016fc return 0; -80104414: 83 c4 10 add $0x10,%esp -80104417: bb 00 00 00 00 mov $0x0,%ebx +80104237: 83 c4 10 add $0x10,%esp +8010423a: bb 00 00 00 00 mov $0x0,%ebx panic("create: dirlink"); iunlockput(dp); return ip; } -8010441c: 89 d8 mov %ebx,%eax -8010441e: 8d 65 f4 lea -0xc(%ebp),%esp -80104421: 5b pop %ebx -80104422: 5e pop %esi -80104423: 5f pop %edi -80104424: 5d pop %ebp -80104425: c3 ret +8010423f: 89 d8 mov %ebx,%eax +80104241: 8d 65 f4 lea -0xc(%ebp),%esp +80104244: 5b pop %ebx +80104245: 5e pop %esi +80104246: 5f pop %edi +80104247: 5d pop %ebp +80104248: c3 ret if((ip = ialloc(dp->dev, type)) == 0) -80104426: 83 ec 08 sub $0x8,%esp -80104429: 0f bf 45 d4 movswl -0x2c(%ebp),%eax -8010442d: 50 push %eax -8010442e: ff 36 pushl (%esi) -80104430: e8 98 cf ff ff call 801013cd -80104435: 89 c3 mov %eax,%ebx -80104437: 83 c4 10 add $0x10,%esp -8010443a: 85 c0 test %eax,%eax -8010443c: 74 52 je 80104490 +80104249: 83 ec 08 sub $0x8,%esp +8010424c: 0f bf 45 d4 movswl -0x2c(%ebp),%eax +80104250: 50 push %eax +80104251: ff 36 push (%esi) +80104253: e8 08 d1 ff ff call 80101360 +80104258: 89 c3 mov %eax,%ebx +8010425a: 83 c4 10 add $0x10,%esp +8010425d: 85 c0 test %eax,%eax +8010425f: 74 52 je 801042b3 ilock(ip); -8010443e: 83 ec 0c sub $0xc,%esp -80104441: 50 push %eax -80104442: e8 e5 d0 ff ff call 8010152c +80104261: 83 ec 0c sub $0xc,%esp +80104264: 50 push %eax +80104265: e8 49 d2 ff ff call 801014b3 ip->major = major; -80104447: 0f b7 45 d0 movzwl -0x30(%ebp),%eax -8010444b: 66 89 43 52 mov %ax,0x52(%ebx) +8010426a: 0f b7 45 d0 movzwl -0x30(%ebp),%eax +8010426e: 66 89 43 52 mov %ax,0x52(%ebx) ip->minor = minor; -8010444f: 66 89 7b 54 mov %di,0x54(%ebx) +80104272: 66 89 7b 54 mov %di,0x54(%ebx) ip->nlink = 1; -80104453: 66 c7 43 56 01 00 movw $0x1,0x56(%ebx) +80104276: 66 c7 43 56 01 00 movw $0x1,0x56(%ebx) iupdate(ip); -80104459: 89 1c 24 mov %ebx,(%esp) -8010445c: e8 19 d0 ff ff call 8010147a +8010427c: 89 1c 24 mov %ebx,(%esp) +8010427f: e8 85 d1 ff ff call 80101409 if(type == T_DIR){ // Create . and .. entries. -80104461: 83 c4 10 add $0x10,%esp -80104464: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) -80104469: 74 32 je 8010449d +80104284: 83 c4 10 add $0x10,%esp +80104287: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) +8010428c: 74 32 je 801042c0 if(dirlink(dp, name, ip->inum) < 0) -8010446b: 83 ec 04 sub $0x4,%esp -8010446e: ff 73 04 pushl 0x4(%ebx) -80104471: 8d 45 da lea -0x26(%ebp),%eax -80104474: 50 push %eax -80104475: 56 push %esi -80104476: e8 b0 d7 ff ff call 80101c2b -8010447b: 83 c4 10 add $0x10,%esp -8010447e: 85 c0 test %eax,%eax -80104480: 78 66 js 801044e8 +8010428e: 83 ec 04 sub $0x4,%esp +80104291: ff 73 04 push 0x4(%ebx) +80104294: 8d 45 da lea -0x26(%ebp),%eax +80104297: 50 push %eax +80104298: 56 push %esi +80104299: e8 ee d8 ff ff call 80101b8c +8010429e: 83 c4 10 add $0x10,%esp +801042a1: 85 c0 test %eax,%eax +801042a3: 78 66 js 8010430b iunlockput(dp); -80104482: 83 ec 0c sub $0xc,%esp -80104485: 56 push %esi -80104486: e8 f6 d2 ff ff call 80101781 +801042a5: 83 ec 0c sub $0xc,%esp +801042a8: 56 push %esi +801042a9: e8 4e d4 ff ff call 801016fc return ip; -8010448b: 83 c4 10 add $0x10,%esp -8010448e: eb 8c jmp 8010441c +801042ae: 83 c4 10 add $0x10,%esp +801042b1: eb 8c jmp 8010423f panic("create: ialloc"); -80104490: 83 ec 0c sub $0xc,%esp -80104493: 68 e0 7f 10 80 push $0x80107fe0 -80104498: e8 bb be ff ff call 80100358 +801042b3: 83 ec 0c sub $0xc,%esp +801042b6: 68 00 7d 10 80 push $0x80107d00 +801042bb: e8 80 c0 ff ff call 80100340 dp->nlink++; // for ".." -8010449d: 66 83 46 56 01 addw $0x1,0x56(%esi) +801042c0: 66 83 46 56 01 addw $0x1,0x56(%esi) iupdate(dp); -801044a2: 83 ec 0c sub $0xc,%esp -801044a5: 56 push %esi -801044a6: e8 cf cf ff ff call 8010147a +801042c5: 83 ec 0c sub $0xc,%esp +801042c8: 56 push %esi +801042c9: e8 3b d1 ff ff call 80101409 if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) -801044ab: 83 c4 0c add $0xc,%esp -801044ae: ff 73 04 pushl 0x4(%ebx) -801044b1: 68 f0 7f 10 80 push $0x80107ff0 -801044b6: 53 push %ebx -801044b7: e8 6f d7 ff ff call 80101c2b -801044bc: 83 c4 10 add $0x10,%esp -801044bf: 85 c0 test %eax,%eax -801044c1: 78 18 js 801044db -801044c3: 83 ec 04 sub $0x4,%esp -801044c6: ff 76 04 pushl 0x4(%esi) -801044c9: 68 ef 7f 10 80 push $0x80107fef -801044ce: 53 push %ebx -801044cf: e8 57 d7 ff ff call 80101c2b -801044d4: 83 c4 10 add $0x10,%esp -801044d7: 85 c0 test %eax,%eax -801044d9: 79 90 jns 8010446b +801042ce: 83 c4 0c add $0xc,%esp +801042d1: ff 73 04 push 0x4(%ebx) +801042d4: 68 10 7d 10 80 push $0x80107d10 +801042d9: 53 push %ebx +801042da: e8 ad d8 ff ff call 80101b8c +801042df: 83 c4 10 add $0x10,%esp +801042e2: 85 c0 test %eax,%eax +801042e4: 78 18 js 801042fe +801042e6: 83 ec 04 sub $0x4,%esp +801042e9: ff 76 04 push 0x4(%esi) +801042ec: 68 0f 7d 10 80 push $0x80107d0f +801042f1: 53 push %ebx +801042f2: e8 95 d8 ff ff call 80101b8c +801042f7: 83 c4 10 add $0x10,%esp +801042fa: 85 c0 test %eax,%eax +801042fc: 79 90 jns 8010428e panic("create dots"); -801044db: 83 ec 0c sub $0xc,%esp -801044de: 68 f2 7f 10 80 push $0x80107ff2 -801044e3: e8 70 be ff ff call 80100358 +801042fe: 83 ec 0c sub $0xc,%esp +80104301: 68 12 7d 10 80 push $0x80107d12 +80104306: e8 35 c0 ff ff call 80100340 panic("create: dirlink"); -801044e8: 83 ec 0c sub $0xc,%esp -801044eb: 68 fe 7f 10 80 push $0x80107ffe -801044f0: e8 63 be ff ff call 80100358 +8010430b: 83 ec 0c sub $0xc,%esp +8010430e: 68 1e 7d 10 80 push $0x80107d1e +80104313: e8 28 c0 ff ff call 80100340 return 0; -801044f5: 89 c3 mov %eax,%ebx -801044f7: e9 20 ff ff ff jmp 8010441c +80104318: 89 c3 mov %eax,%ebx +8010431a: e9 20 ff ff ff jmp 8010423f -801044fc : +8010431f : { -801044fc: f3 0f 1e fb endbr32 -80104500: 55 push %ebp -80104501: 89 e5 mov %esp,%ebp -80104503: 53 push %ebx -80104504: 83 ec 14 sub $0x14,%esp +8010431f: 55 push %ebp +80104320: 89 e5 mov %esp,%ebp +80104322: 56 push %esi +80104323: 53 push %ebx +80104324: 83 ec 10 sub $0x10,%esp if(argfd(0, 0, &f) < 0) -80104507: 8d 4d f4 lea -0xc(%ebp),%ecx -8010450a: ba 00 00 00 00 mov $0x0,%edx -8010450f: b8 00 00 00 00 mov $0x0,%eax -80104514: e8 ef fd ff ff call 80104308 -80104519: 85 c0 test %eax,%eax -8010451b: 78 23 js 80104540 +80104327: 8d 4d f4 lea -0xc(%ebp),%ecx +8010432a: ba 00 00 00 00 mov $0x0,%edx +8010432f: b8 00 00 00 00 mov $0x0,%eax +80104334: e8 f3 fd ff ff call 8010412c +80104339: 85 c0 test %eax,%eax +8010433b: 78 25 js 80104362 if((fd=fdalloc(f)) < 0) -8010451d: 8b 45 f4 mov -0xc(%ebp),%eax -80104520: e8 45 fe ff ff call 8010436a -80104525: 89 c3 mov %eax,%ebx -80104527: 85 c0 test %eax,%eax -80104529: 78 1c js 80104547 +8010433d: 8b 75 f4 mov -0xc(%ebp),%esi +80104340: 89 f0 mov %esi,%eax +80104342: e8 47 fe ff ff call 8010418e +80104347: 89 c3 mov %eax,%ebx +80104349: 85 c0 test %eax,%eax +8010434b: 78 1c js 80104369 filedup(f); -8010452b: 83 ec 0c sub $0xc,%esp -8010452e: ff 75 f4 pushl -0xc(%ebp) -80104531: e8 02 c8 ff ff call 80100d38 +8010434d: 83 ec 0c sub $0xc,%esp +80104350: 56 push %esi +80104351: e8 9e c9 ff ff call 80100cf4 return fd; -80104536: 83 c4 10 add $0x10,%esp -} -80104539: 89 d8 mov %ebx,%eax -8010453b: 8b 5d fc mov -0x4(%ebp),%ebx -8010453e: c9 leave -8010453f: c3 ret +80104356: 83 c4 10 add $0x10,%esp +} +80104359: 89 d8 mov %ebx,%eax +8010435b: 8d 65 f8 lea -0x8(%ebp),%esp +8010435e: 5b pop %ebx +8010435f: 5e pop %esi +80104360: 5d pop %ebp +80104361: c3 ret return -1; -80104540: bb ff ff ff ff mov $0xffffffff,%ebx -80104545: eb f2 jmp 80104539 +80104362: bb ff ff ff ff mov $0xffffffff,%ebx +80104367: eb f0 jmp 80104359 return -1; -80104547: bb ff ff ff ff mov $0xffffffff,%ebx -8010454c: eb eb jmp 80104539 +80104369: bb ff ff ff ff mov $0xffffffff,%ebx +8010436e: eb e9 jmp 80104359 -8010454e : +80104370 : { -8010454e: f3 0f 1e fb endbr32 -80104552: 55 push %ebp -80104553: 89 e5 mov %esp,%ebp -80104555: 83 ec 18 sub $0x18,%esp +80104370: 55 push %ebp +80104371: 89 e5 mov %esp,%ebp +80104373: 83 ec 18 sub $0x18,%esp if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) -80104558: 8d 4d f4 lea -0xc(%ebp),%ecx -8010455b: ba 00 00 00 00 mov $0x0,%edx -80104560: b8 00 00 00 00 mov $0x0,%eax -80104565: e8 9e fd ff ff call 80104308 -8010456a: 85 c0 test %eax,%eax -8010456c: 78 43 js 801045b1 -8010456e: 83 ec 08 sub $0x8,%esp -80104571: 8d 45 f0 lea -0x10(%ebp),%eax -80104574: 50 push %eax -80104575: 6a 02 push $0x2 -80104577: e8 6b fc ff ff call 801041e7 -8010457c: 83 c4 10 add $0x10,%esp -8010457f: 85 c0 test %eax,%eax -80104581: 78 35 js 801045b8 -80104583: 83 ec 04 sub $0x4,%esp -80104586: ff 75 f0 pushl -0x10(%ebp) -80104589: 8d 45 ec lea -0x14(%ebp),%eax -8010458c: 50 push %eax -8010458d: 6a 01 push $0x1 -8010458f: e8 7d fc ff ff call 80104211 -80104594: 83 c4 10 add $0x10,%esp -80104597: 85 c0 test %eax,%eax -80104599: 78 24 js 801045bf +80104376: 8d 4d f4 lea -0xc(%ebp),%ecx +80104379: ba 00 00 00 00 mov $0x0,%edx +8010437e: b8 00 00 00 00 mov $0x0,%eax +80104383: e8 a4 fd ff ff call 8010412c +80104388: 85 c0 test %eax,%eax +8010438a: 78 43 js 801043cf +8010438c: 83 ec 08 sub $0x8,%esp +8010438f: 8d 45 f0 lea -0x10(%ebp),%eax +80104392: 50 push %eax +80104393: 6a 02 push $0x2 +80104395: e8 85 fc ff ff call 8010401f +8010439a: 83 c4 10 add $0x10,%esp +8010439d: 85 c0 test %eax,%eax +8010439f: 78 35 js 801043d6 +801043a1: 83 ec 04 sub $0x4,%esp +801043a4: ff 75 f0 push -0x10(%ebp) +801043a7: 8d 45 ec lea -0x14(%ebp),%eax +801043aa: 50 push %eax +801043ab: 6a 01 push $0x1 +801043ad: e8 93 fc ff ff call 80104045 +801043b2: 83 c4 10 add $0x10,%esp +801043b5: 85 c0 test %eax,%eax +801043b7: 78 24 js 801043dd return fileread(f, p, n); -8010459b: 83 ec 04 sub $0x4,%esp -8010459e: ff 75 f0 pushl -0x10(%ebp) -801045a1: ff 75 ec pushl -0x14(%ebp) -801045a4: ff 75 f4 pushl -0xc(%ebp) -801045a7: e8 d9 c8 ff ff call 80100e85 -801045ac: 83 c4 10 add $0x10,%esp -} -801045af: c9 leave -801045b0: c3 ret +801043b9: 83 ec 04 sub $0x4,%esp +801043bc: ff 75 f0 push -0x10(%ebp) +801043bf: ff 75 ec push -0x14(%ebp) +801043c2: ff 75 f4 push -0xc(%ebp) +801043c5: e8 6b ca ff ff call 80100e35 +801043ca: 83 c4 10 add $0x10,%esp +} +801043cd: c9 leave +801043ce: c3 ret return -1; -801045b1: b8 ff ff ff ff mov $0xffffffff,%eax -801045b6: eb f7 jmp 801045af -801045b8: b8 ff ff ff ff mov $0xffffffff,%eax -801045bd: eb f0 jmp 801045af -801045bf: b8 ff ff ff ff mov $0xffffffff,%eax -801045c4: eb e9 jmp 801045af - -801045c6 : -{ -801045c6: f3 0f 1e fb endbr32 -801045ca: 55 push %ebp -801045cb: 89 e5 mov %esp,%ebp -801045cd: 83 ec 18 sub $0x18,%esp +801043cf: b8 ff ff ff ff mov $0xffffffff,%eax +801043d4: eb f7 jmp 801043cd +801043d6: b8 ff ff ff ff mov $0xffffffff,%eax +801043db: eb f0 jmp 801043cd +801043dd: b8 ff ff ff ff mov $0xffffffff,%eax +801043e2: eb e9 jmp 801043cd + +801043e4 : +{ +801043e4: 55 push %ebp +801043e5: 89 e5 mov %esp,%ebp +801043e7: 83 ec 18 sub $0x18,%esp if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) -801045d0: 8d 4d f4 lea -0xc(%ebp),%ecx -801045d3: ba 00 00 00 00 mov $0x0,%edx -801045d8: b8 00 00 00 00 mov $0x0,%eax -801045dd: e8 26 fd ff ff call 80104308 -801045e2: 85 c0 test %eax,%eax -801045e4: 78 43 js 80104629 -801045e6: 83 ec 08 sub $0x8,%esp -801045e9: 8d 45 f0 lea -0x10(%ebp),%eax -801045ec: 50 push %eax -801045ed: 6a 02 push $0x2 -801045ef: e8 f3 fb ff ff call 801041e7 -801045f4: 83 c4 10 add $0x10,%esp -801045f7: 85 c0 test %eax,%eax -801045f9: 78 35 js 80104630 -801045fb: 83 ec 04 sub $0x4,%esp -801045fe: ff 75 f0 pushl -0x10(%ebp) -80104601: 8d 45 ec lea -0x14(%ebp),%eax -80104604: 50 push %eax -80104605: 6a 01 push $0x1 -80104607: e8 05 fc ff ff call 80104211 -8010460c: 83 c4 10 add $0x10,%esp -8010460f: 85 c0 test %eax,%eax -80104611: 78 24 js 80104637 +801043ea: 8d 4d f4 lea -0xc(%ebp),%ecx +801043ed: ba 00 00 00 00 mov $0x0,%edx +801043f2: b8 00 00 00 00 mov $0x0,%eax +801043f7: e8 30 fd ff ff call 8010412c +801043fc: 85 c0 test %eax,%eax +801043fe: 78 43 js 80104443 +80104400: 83 ec 08 sub $0x8,%esp +80104403: 8d 45 f0 lea -0x10(%ebp),%eax +80104406: 50 push %eax +80104407: 6a 02 push $0x2 +80104409: e8 11 fc ff ff call 8010401f +8010440e: 83 c4 10 add $0x10,%esp +80104411: 85 c0 test %eax,%eax +80104413: 78 35 js 8010444a +80104415: 83 ec 04 sub $0x4,%esp +80104418: ff 75 f0 push -0x10(%ebp) +8010441b: 8d 45 ec lea -0x14(%ebp),%eax +8010441e: 50 push %eax +8010441f: 6a 01 push $0x1 +80104421: e8 1f fc ff ff call 80104045 +80104426: 83 c4 10 add $0x10,%esp +80104429: 85 c0 test %eax,%eax +8010442b: 78 24 js 80104451 return filewrite(f, p, n); -80104613: 83 ec 04 sub $0x4,%esp -80104616: ff 75 f0 pushl -0x10(%ebp) -80104619: ff 75 ec pushl -0x14(%ebp) -8010461c: ff 75 f4 pushl -0xc(%ebp) -8010461f: e8 ea c8 ff ff call 80100f0e -80104624: 83 c4 10 add $0x10,%esp -} -80104627: c9 leave -80104628: c3 ret +8010442d: 83 ec 04 sub $0x4,%esp +80104430: ff 75 f0 push -0x10(%ebp) +80104433: ff 75 ec push -0x14(%ebp) +80104436: ff 75 f4 push -0xc(%ebp) +80104439: e8 7c ca ff ff call 80100eba +8010443e: 83 c4 10 add $0x10,%esp +} +80104441: c9 leave +80104442: c3 ret return -1; -80104629: b8 ff ff ff ff mov $0xffffffff,%eax -8010462e: eb f7 jmp 80104627 -80104630: b8 ff ff ff ff mov $0xffffffff,%eax -80104635: eb f0 jmp 80104627 -80104637: b8 ff ff ff ff mov $0xffffffff,%eax -8010463c: eb e9 jmp 80104627 - -8010463e : -{ -8010463e: f3 0f 1e fb endbr32 -80104642: 55 push %ebp -80104643: 89 e5 mov %esp,%ebp -80104645: 83 ec 18 sub $0x18,%esp +80104443: b8 ff ff ff ff mov $0xffffffff,%eax +80104448: eb f7 jmp 80104441 +8010444a: b8 ff ff ff ff mov $0xffffffff,%eax +8010444f: eb f0 jmp 80104441 +80104451: b8 ff ff ff ff mov $0xffffffff,%eax +80104456: eb e9 jmp 80104441 + +80104458 : +{ +80104458: 55 push %ebp +80104459: 89 e5 mov %esp,%ebp +8010445b: 83 ec 18 sub $0x18,%esp if(argfd(0, &fd, &f) < 0) -80104648: 8d 4d f0 lea -0x10(%ebp),%ecx -8010464b: 8d 55 f4 lea -0xc(%ebp),%edx -8010464e: b8 00 00 00 00 mov $0x0,%eax -80104653: e8 b0 fc ff ff call 80104308 -80104658: 85 c0 test %eax,%eax -8010465a: 78 25 js 80104681 +8010445e: 8d 4d f0 lea -0x10(%ebp),%ecx +80104461: 8d 55 f4 lea -0xc(%ebp),%edx +80104464: b8 00 00 00 00 mov $0x0,%eax +80104469: e8 be fc ff ff call 8010412c +8010446e: 85 c0 test %eax,%eax +80104470: 78 25 js 80104497 myproc()->ofile[fd] = 0; -8010465c: e8 89 ed ff ff call 801033ea -80104661: 8b 55 f4 mov -0xc(%ebp),%edx -80104664: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4) -8010466b: 00 +80104472: e8 39 ee ff ff call 801032b0 +80104477: 8b 55 f4 mov -0xc(%ebp),%edx +8010447a: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4) +80104481: 00 fileclose(f); -8010466c: 83 ec 0c sub $0xc,%esp -8010466f: ff 75 f0 pushl -0x10(%ebp) -80104672: e8 0a c7 ff ff call 80100d81 +80104482: 83 ec 0c sub $0xc,%esp +80104485: ff 75 f0 push -0x10(%ebp) +80104488: e8 ac c8 ff ff call 80100d39 return 0; -80104677: 83 c4 10 add $0x10,%esp -8010467a: b8 00 00 00 00 mov $0x0,%eax +8010448d: 83 c4 10 add $0x10,%esp +80104490: b8 00 00 00 00 mov $0x0,%eax } -8010467f: c9 leave -80104680: c3 ret +80104495: c9 leave +80104496: c3 ret return -1; -80104681: b8 ff ff ff ff mov $0xffffffff,%eax -80104686: eb f7 jmp 8010467f +80104497: b8 ff ff ff ff mov $0xffffffff,%eax +8010449c: eb f7 jmp 80104495 -80104688 : +8010449e : { -80104688: f3 0f 1e fb endbr32 -8010468c: 55 push %ebp -8010468d: 89 e5 mov %esp,%ebp -8010468f: 83 ec 18 sub $0x18,%esp +8010449e: 55 push %ebp +8010449f: 89 e5 mov %esp,%ebp +801044a1: 83 ec 18 sub $0x18,%esp if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) -80104692: 8d 4d f4 lea -0xc(%ebp),%ecx -80104695: ba 00 00 00 00 mov $0x0,%edx -8010469a: b8 00 00 00 00 mov $0x0,%eax -8010469f: e8 64 fc ff ff call 80104308 -801046a4: 85 c0 test %eax,%eax -801046a6: 78 2a js 801046d2 -801046a8: 83 ec 04 sub $0x4,%esp -801046ab: 6a 14 push $0x14 -801046ad: 8d 45 f0 lea -0x10(%ebp),%eax -801046b0: 50 push %eax -801046b1: 6a 01 push $0x1 -801046b3: e8 59 fb ff ff call 80104211 -801046b8: 83 c4 10 add $0x10,%esp -801046bb: 85 c0 test %eax,%eax -801046bd: 78 1a js 801046d9 +801044a4: 8d 4d f4 lea -0xc(%ebp),%ecx +801044a7: ba 00 00 00 00 mov $0x0,%edx +801044ac: b8 00 00 00 00 mov $0x0,%eax +801044b1: e8 76 fc ff ff call 8010412c +801044b6: 85 c0 test %eax,%eax +801044b8: 78 2a js 801044e4 +801044ba: 83 ec 04 sub $0x4,%esp +801044bd: 6a 14 push $0x14 +801044bf: 8d 45 f0 lea -0x10(%ebp),%eax +801044c2: 50 push %eax +801044c3: 6a 01 push $0x1 +801044c5: e8 7b fb ff ff call 80104045 +801044ca: 83 c4 10 add $0x10,%esp +801044cd: 85 c0 test %eax,%eax +801044cf: 78 1a js 801044eb return filestat(f, st); -801046bf: 83 ec 08 sub $0x8,%esp -801046c2: ff 75 f0 pushl -0x10(%ebp) -801046c5: ff 75 f4 pushl -0xc(%ebp) -801046c8: e8 6d c7 ff ff call 80100e3a -801046cd: 83 c4 10 add $0x10,%esp -} -801046d0: c9 leave -801046d1: c3 ret +801044d1: 83 ec 08 sub $0x8,%esp +801044d4: ff 75 f0 push -0x10(%ebp) +801044d7: ff 75 f4 push -0xc(%ebp) +801044da: e8 0f c9 ff ff call 80100dee +801044df: 83 c4 10 add $0x10,%esp +} +801044e2: c9 leave +801044e3: c3 ret return -1; -801046d2: b8 ff ff ff ff mov $0xffffffff,%eax -801046d7: eb f7 jmp 801046d0 -801046d9: b8 ff ff ff ff mov $0xffffffff,%eax -801046de: eb f0 jmp 801046d0 - -801046e0 : -{ -801046e0: f3 0f 1e fb endbr32 -801046e4: 55 push %ebp -801046e5: 89 e5 mov %esp,%ebp -801046e7: 56 push %esi -801046e8: 53 push %ebx -801046e9: 83 ec 28 sub $0x28,%esp +801044e4: b8 ff ff ff ff mov $0xffffffff,%eax +801044e9: eb f7 jmp 801044e2 +801044eb: b8 ff ff ff ff mov $0xffffffff,%eax +801044f0: eb f0 jmp 801044e2 + +801044f2 : +{ +801044f2: 55 push %ebp +801044f3: 89 e5 mov %esp,%ebp +801044f5: 56 push %esi +801044f6: 53 push %ebx +801044f7: 83 ec 28 sub $0x28,%esp if(argstr(0, &old) < 0 || argstr(1, &new) < 0) -801046ec: 8d 45 e0 lea -0x20(%ebp),%eax -801046ef: 50 push %eax -801046f0: 6a 00 push $0x0 -801046f2: e8 7f fb ff ff call 80104276 -801046f7: 83 c4 10 add $0x10,%esp -801046fa: 85 c0 test %eax,%eax -801046fc: 0f 88 26 01 00 00 js 80104828 -80104702: 83 ec 08 sub $0x8,%esp -80104705: 8d 45 e4 lea -0x1c(%ebp),%eax -80104708: 50 push %eax -80104709: 6a 01 push $0x1 -8010470b: e8 66 fb ff ff call 80104276 -80104710: 83 c4 10 add $0x10,%esp -80104713: 85 c0 test %eax,%eax -80104715: 0f 88 14 01 00 00 js 8010482f +801044fa: 8d 45 e0 lea -0x20(%ebp),%eax +801044fd: 50 push %eax +801044fe: 6a 00 push $0x0 +80104500: e8 9d fb ff ff call 801040a2 +80104505: 83 c4 10 add $0x10,%esp +80104508: 85 c0 test %eax,%eax +8010450a: 0f 88 26 01 00 00 js 80104636 +80104510: 83 ec 08 sub $0x8,%esp +80104513: 8d 45 e4 lea -0x1c(%ebp),%eax +80104516: 50 push %eax +80104517: 6a 01 push $0x1 +80104519: e8 84 fb ff ff call 801040a2 +8010451e: 83 c4 10 add $0x10,%esp +80104521: 85 c0 test %eax,%eax +80104523: 0f 88 14 01 00 00 js 8010463d begin_op(); -8010471b: e8 60 e1 ff ff call 80102880 +80104529: e8 50 e2 ff ff call 8010277e if((ip = namei(old)) == 0){ -80104720: 83 ec 0c sub $0xc,%esp -80104723: ff 75 e0 pushl -0x20(%ebp) -80104726: e8 b9 d5 ff ff call 80101ce4 -8010472b: 89 c3 mov %eax,%ebx -8010472d: 83 c4 10 add $0x10,%esp -80104730: 85 c0 test %eax,%eax -80104732: 0f 84 93 00 00 00 je 801047cb +8010452e: 83 ec 0c sub $0xc,%esp +80104531: ff 75 e0 push -0x20(%ebp) +80104534: e8 08 d7 ff ff call 80101c41 +80104539: 89 c3 mov %eax,%ebx +8010453b: 83 c4 10 add $0x10,%esp +8010453e: 85 c0 test %eax,%eax +80104540: 0f 84 93 00 00 00 je 801045d9 ilock(ip); -80104738: 83 ec 0c sub $0xc,%esp -8010473b: 50 push %eax -8010473c: e8 eb cd ff ff call 8010152c +80104546: 83 ec 0c sub $0xc,%esp +80104549: 50 push %eax +8010454a: e8 64 cf ff ff call 801014b3 if(ip->type == T_DIR){ -80104741: 83 c4 10 add $0x10,%esp -80104744: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) -80104749: 0f 84 88 00 00 00 je 801047d7 +8010454f: 83 c4 10 add $0x10,%esp +80104552: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +80104557: 0f 84 88 00 00 00 je 801045e5 ip->nlink++; -8010474f: 66 83 43 56 01 addw $0x1,0x56(%ebx) +8010455d: 66 83 43 56 01 addw $0x1,0x56(%ebx) iupdate(ip); -80104754: 83 ec 0c sub $0xc,%esp -80104757: 53 push %ebx -80104758: e8 1d cd ff ff call 8010147a +80104562: 83 ec 0c sub $0xc,%esp +80104565: 53 push %ebx +80104566: e8 9e ce ff ff call 80101409 iunlock(ip); -8010475d: 89 1c 24 mov %ebx,(%esp) -80104760: e8 8d ce ff ff call 801015f2 +8010456b: 89 1c 24 mov %ebx,(%esp) +8010456e: e8 02 d0 ff ff call 80101575 if((dp = nameiparent(new, name)) == 0) -80104765: 83 c4 08 add $0x8,%esp -80104768: 8d 45 ea lea -0x16(%ebp),%eax -8010476b: 50 push %eax -8010476c: ff 75 e4 pushl -0x1c(%ebp) -8010476f: e8 8c d5 ff ff call 80101d00 -80104774: 89 c6 mov %eax,%esi -80104776: 83 c4 10 add $0x10,%esp -80104779: 85 c0 test %eax,%eax -8010477b: 74 7e je 801047fb +80104573: 83 c4 08 add $0x8,%esp +80104576: 8d 45 ea lea -0x16(%ebp),%eax +80104579: 50 push %eax +8010457a: ff 75 e4 push -0x1c(%ebp) +8010457d: e8 d7 d6 ff ff call 80101c59 +80104582: 89 c6 mov %eax,%esi +80104584: 83 c4 10 add $0x10,%esp +80104587: 85 c0 test %eax,%eax +80104589: 74 7e je 80104609 ilock(dp); -8010477d: 83 ec 0c sub $0xc,%esp -80104780: 50 push %eax -80104781: e8 a6 cd ff ff call 8010152c +8010458b: 83 ec 0c sub $0xc,%esp +8010458e: 50 push %eax +8010458f: e8 1f cf ff ff call 801014b3 if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ -80104786: 83 c4 10 add $0x10,%esp -80104789: 8b 03 mov (%ebx),%eax -8010478b: 39 06 cmp %eax,(%esi) -8010478d: 75 60 jne 801047ef -8010478f: 83 ec 04 sub $0x4,%esp -80104792: ff 73 04 pushl 0x4(%ebx) -80104795: 8d 45 ea lea -0x16(%ebp),%eax -80104798: 50 push %eax -80104799: 56 push %esi -8010479a: e8 8c d4 ff ff call 80101c2b -8010479f: 83 c4 10 add $0x10,%esp -801047a2: 85 c0 test %eax,%eax -801047a4: 78 49 js 801047ef +80104594: 83 c4 10 add $0x10,%esp +80104597: 8b 03 mov (%ebx),%eax +80104599: 39 06 cmp %eax,(%esi) +8010459b: 75 60 jne 801045fd +8010459d: 83 ec 04 sub $0x4,%esp +801045a0: ff 73 04 push 0x4(%ebx) +801045a3: 8d 45 ea lea -0x16(%ebp),%eax +801045a6: 50 push %eax +801045a7: 56 push %esi +801045a8: e8 df d5 ff ff call 80101b8c +801045ad: 83 c4 10 add $0x10,%esp +801045b0: 85 c0 test %eax,%eax +801045b2: 78 49 js 801045fd iunlockput(dp); -801047a6: 83 ec 0c sub $0xc,%esp -801047a9: 56 push %esi -801047aa: e8 d2 cf ff ff call 80101781 +801045b4: 83 ec 0c sub $0xc,%esp +801045b7: 56 push %esi +801045b8: e8 3f d1 ff ff call 801016fc iput(ip); -801047af: 89 1c 24 mov %ebx,(%esp) -801047b2: e8 84 ce ff ff call 8010163b +801045bd: 89 1c 24 mov %ebx,(%esp) +801045c0: e8 f5 cf ff ff call 801015ba end_op(); -801047b7: e8 43 e1 ff ff call 801028ff +801045c5: e8 2f e2 ff ff call 801027f9 return 0; -801047bc: 83 c4 10 add $0x10,%esp -801047bf: b8 00 00 00 00 mov $0x0,%eax -} -801047c4: 8d 65 f8 lea -0x8(%ebp),%esp -801047c7: 5b pop %ebx -801047c8: 5e pop %esi -801047c9: 5d pop %ebp -801047ca: c3 ret +801045ca: 83 c4 10 add $0x10,%esp +801045cd: b8 00 00 00 00 mov $0x0,%eax +} +801045d2: 8d 65 f8 lea -0x8(%ebp),%esp +801045d5: 5b pop %ebx +801045d6: 5e pop %esi +801045d7: 5d pop %ebp +801045d8: c3 ret end_op(); -801047cb: e8 2f e1 ff ff call 801028ff +801045d9: e8 1b e2 ff ff call 801027f9 return -1; -801047d0: b8 ff ff ff ff mov $0xffffffff,%eax -801047d5: eb ed jmp 801047c4 +801045de: b8 ff ff ff ff mov $0xffffffff,%eax +801045e3: eb ed jmp 801045d2 iunlockput(ip); -801047d7: 83 ec 0c sub $0xc,%esp -801047da: 53 push %ebx -801047db: e8 a1 cf ff ff call 80101781 +801045e5: 83 ec 0c sub $0xc,%esp +801045e8: 53 push %ebx +801045e9: e8 0e d1 ff ff call 801016fc end_op(); -801047e0: e8 1a e1 ff ff call 801028ff +801045ee: e8 06 e2 ff ff call 801027f9 return -1; -801047e5: 83 c4 10 add $0x10,%esp -801047e8: b8 ff ff ff ff mov $0xffffffff,%eax -801047ed: eb d5 jmp 801047c4 +801045f3: 83 c4 10 add $0x10,%esp +801045f6: b8 ff ff ff ff mov $0xffffffff,%eax +801045fb: eb d5 jmp 801045d2 iunlockput(dp); -801047ef: 83 ec 0c sub $0xc,%esp -801047f2: 56 push %esi -801047f3: e8 89 cf ff ff call 80101781 +801045fd: 83 ec 0c sub $0xc,%esp +80104600: 56 push %esi +80104601: e8 f6 d0 ff ff call 801016fc goto bad; -801047f8: 83 c4 10 add $0x10,%esp +80104606: 83 c4 10 add $0x10,%esp ilock(ip); -801047fb: 83 ec 0c sub $0xc,%esp -801047fe: 53 push %ebx -801047ff: e8 28 cd ff ff call 8010152c +80104609: 83 ec 0c sub $0xc,%esp +8010460c: 53 push %ebx +8010460d: e8 a1 ce ff ff call 801014b3 ip->nlink--; -80104804: 66 83 6b 56 01 subw $0x1,0x56(%ebx) +80104612: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); -80104809: 89 1c 24 mov %ebx,(%esp) -8010480c: e8 69 cc ff ff call 8010147a +80104617: 89 1c 24 mov %ebx,(%esp) +8010461a: e8 ea cd ff ff call 80101409 iunlockput(ip); -80104811: 89 1c 24 mov %ebx,(%esp) -80104814: e8 68 cf ff ff call 80101781 +8010461f: 89 1c 24 mov %ebx,(%esp) +80104622: e8 d5 d0 ff ff call 801016fc end_op(); -80104819: e8 e1 e0 ff ff call 801028ff +80104627: e8 cd e1 ff ff call 801027f9 return -1; -8010481e: 83 c4 10 add $0x10,%esp -80104821: b8 ff ff ff ff mov $0xffffffff,%eax -80104826: eb 9c jmp 801047c4 +8010462c: 83 c4 10 add $0x10,%esp +8010462f: b8 ff ff ff ff mov $0xffffffff,%eax +80104634: eb 9c jmp 801045d2 return -1; -80104828: b8 ff ff ff ff mov $0xffffffff,%eax -8010482d: eb 95 jmp 801047c4 -8010482f: b8 ff ff ff ff mov $0xffffffff,%eax -80104834: eb 8e jmp 801047c4 - -80104836 : -{ -80104836: f3 0f 1e fb endbr32 -8010483a: 55 push %ebp -8010483b: 89 e5 mov %esp,%ebp -8010483d: 57 push %edi -8010483e: 56 push %esi -8010483f: 53 push %ebx -80104840: 83 ec 54 sub $0x54,%esp +80104636: b8 ff ff ff ff mov $0xffffffff,%eax +8010463b: eb 95 jmp 801045d2 +8010463d: b8 ff ff ff ff mov $0xffffffff,%eax +80104642: eb 8e jmp 801045d2 + +80104644 : +{ +80104644: 55 push %ebp +80104645: 89 e5 mov %esp,%ebp +80104647: 57 push %edi +80104648: 56 push %esi +80104649: 53 push %ebx +8010464a: 83 ec 54 sub $0x54,%esp if(argstr(0, &path) < 0) -80104843: 8d 45 c4 lea -0x3c(%ebp),%eax -80104846: 50 push %eax -80104847: 6a 00 push $0x0 -80104849: e8 28 fa ff ff call 80104276 -8010484e: 83 c4 10 add $0x10,%esp -80104851: 85 c0 test %eax,%eax -80104853: 0f 88 81 01 00 00 js 801049da +8010464d: 8d 45 c4 lea -0x3c(%ebp),%eax +80104650: 50 push %eax +80104651: 6a 00 push $0x0 +80104653: e8 4a fa ff ff call 801040a2 +80104658: 83 c4 10 add $0x10,%esp +8010465b: 85 c0 test %eax,%eax +8010465d: 0f 88 81 01 00 00 js 801047e4 begin_op(); -80104859: e8 22 e0 ff ff call 80102880 +80104663: e8 16 e1 ff ff call 8010277e if((dp = nameiparent(path, name)) == 0){ -8010485e: 83 ec 08 sub $0x8,%esp -80104861: 8d 45 ca lea -0x36(%ebp),%eax -80104864: 50 push %eax -80104865: ff 75 c4 pushl -0x3c(%ebp) -80104868: e8 93 d4 ff ff call 80101d00 -8010486d: 89 c6 mov %eax,%esi -8010486f: 83 c4 10 add $0x10,%esp -80104872: 85 c0 test %eax,%eax -80104874: 0f 84 df 00 00 00 je 80104959 +80104668: 83 ec 08 sub $0x8,%esp +8010466b: 8d 45 ca lea -0x36(%ebp),%eax +8010466e: 50 push %eax +8010466f: ff 75 c4 push -0x3c(%ebp) +80104672: e8 e2 d5 ff ff call 80101c59 +80104677: 89 c7 mov %eax,%edi +80104679: 83 c4 10 add $0x10,%esp +8010467c: 85 c0 test %eax,%eax +8010467e: 0f 84 df 00 00 00 je 80104763 ilock(dp); -8010487a: 83 ec 0c sub $0xc,%esp -8010487d: 50 push %eax -8010487e: e8 a9 cc ff ff call 8010152c +80104684: 83 ec 0c sub $0xc,%esp +80104687: 50 push %eax +80104688: e8 26 ce ff ff call 801014b3 if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) -80104883: 83 c4 08 add $0x8,%esp -80104886: 68 f0 7f 10 80 push $0x80107ff0 -8010488b: 8d 45 ca lea -0x36(%ebp),%eax -8010488e: 50 push %eax -8010488f: e8 67 d1 ff ff call 801019fb -80104894: 83 c4 10 add $0x10,%esp -80104897: 85 c0 test %eax,%eax -80104899: 0f 84 51 01 00 00 je 801049f0 -8010489f: 83 ec 08 sub $0x8,%esp -801048a2: 68 ef 7f 10 80 push $0x80107fef -801048a7: 8d 45 ca lea -0x36(%ebp),%eax -801048aa: 50 push %eax -801048ab: e8 4b d1 ff ff call 801019fb -801048b0: 83 c4 10 add $0x10,%esp -801048b3: 85 c0 test %eax,%eax -801048b5: 0f 84 35 01 00 00 je 801049f0 +8010468d: 83 c4 08 add $0x8,%esp +80104690: 68 10 7d 10 80 push $0x80107d10 +80104695: 8d 45 ca lea -0x36(%ebp),%eax +80104698: 50 push %eax +80104699: e8 c6 d2 ff ff call 80101964 +8010469e: 83 c4 10 add $0x10,%esp +801046a1: 85 c0 test %eax,%eax +801046a3: 0f 84 51 01 00 00 je 801047fa +801046a9: 83 ec 08 sub $0x8,%esp +801046ac: 68 0f 7d 10 80 push $0x80107d0f +801046b1: 8d 45 ca lea -0x36(%ebp),%eax +801046b4: 50 push %eax +801046b5: e8 aa d2 ff ff call 80101964 +801046ba: 83 c4 10 add $0x10,%esp +801046bd: 85 c0 test %eax,%eax +801046bf: 0f 84 35 01 00 00 je 801047fa if((ip = dirlookup(dp, name, &off)) == 0) -801048bb: 83 ec 04 sub $0x4,%esp -801048be: 8d 45 c0 lea -0x40(%ebp),%eax -801048c1: 50 push %eax -801048c2: 8d 45 ca lea -0x36(%ebp),%eax -801048c5: 50 push %eax -801048c6: 56 push %esi -801048c7: e8 48 d1 ff ff call 80101a14 -801048cc: 89 c3 mov %eax,%ebx -801048ce: 83 c4 10 add $0x10,%esp -801048d1: 85 c0 test %eax,%eax -801048d3: 0f 84 17 01 00 00 je 801049f0 +801046c5: 83 ec 04 sub $0x4,%esp +801046c8: 8d 45 c0 lea -0x40(%ebp),%eax +801046cb: 50 push %eax +801046cc: 8d 45 ca lea -0x36(%ebp),%eax +801046cf: 50 push %eax +801046d0: 57 push %edi +801046d1: e8 a3 d2 ff ff call 80101979 +801046d6: 89 c3 mov %eax,%ebx +801046d8: 83 c4 10 add $0x10,%esp +801046db: 85 c0 test %eax,%eax +801046dd: 0f 84 17 01 00 00 je 801047fa ilock(ip); -801048d9: 83 ec 0c sub $0xc,%esp -801048dc: 50 push %eax -801048dd: e8 4a cc ff ff call 8010152c +801046e3: 83 ec 0c sub $0xc,%esp +801046e6: 50 push %eax +801046e7: e8 c7 cd ff ff call 801014b3 if(ip->nlink < 1) -801048e2: 83 c4 10 add $0x10,%esp -801048e5: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) -801048ea: 7e 79 jle 80104965 +801046ec: 83 c4 10 add $0x10,%esp +801046ef: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) +801046f4: 7e 79 jle 8010476f if(ip->type == T_DIR && !isdirempty(ip)){ -801048ec: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) -801048f1: 74 7f je 80104972 +801046f6: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +801046fb: 74 7f je 8010477c memset(&de, 0, sizeof(de)); -801048f3: 83 ec 04 sub $0x4,%esp -801048f6: 6a 10 push $0x10 -801048f8: 6a 00 push $0x0 -801048fa: 8d 7d d8 lea -0x28(%ebp),%edi -801048fd: 57 push %edi -801048fe: e8 4c f6 ff ff call 80103f4f +801046fd: 83 ec 04 sub $0x4,%esp +80104700: 6a 10 push $0x10 +80104702: 6a 00 push $0x0 +80104704: 8d 75 d8 lea -0x28(%ebp),%esi +80104707: 56 push %esi +80104708: e8 a2 f6 ff ff call 80103daf if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) -80104903: 6a 10 push $0x10 -80104905: ff 75 c0 pushl -0x40(%ebp) -80104908: 57 push %edi -80104909: 56 push %esi -8010490a: e8 c5 cf ff ff call 801018d4 -8010490f: 83 c4 20 add $0x20,%esp -80104912: 83 f8 10 cmp $0x10,%eax -80104915: 0f 85 9c 00 00 00 jne 801049b7 +8010470d: 6a 10 push $0x10 +8010470f: ff 75 c0 push -0x40(%ebp) +80104712: 56 push %esi +80104713: 57 push %edi +80104714: e8 2a d1 ff ff call 80101843 +80104719: 83 c4 20 add $0x20,%esp +8010471c: 83 f8 10 cmp $0x10,%eax +8010471f: 0f 85 9c 00 00 00 jne 801047c1 if(ip->type == T_DIR){ -8010491b: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) -80104920: 0f 84 9e 00 00 00 je 801049c4 +80104725: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +8010472a: 0f 84 9e 00 00 00 je 801047ce iunlockput(dp); -80104926: 83 ec 0c sub $0xc,%esp -80104929: 56 push %esi -8010492a: e8 52 ce ff ff call 80101781 +80104730: 83 ec 0c sub $0xc,%esp +80104733: 57 push %edi +80104734: e8 c3 cf ff ff call 801016fc ip->nlink--; -8010492f: 66 83 6b 56 01 subw $0x1,0x56(%ebx) +80104739: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); -80104934: 89 1c 24 mov %ebx,(%esp) -80104937: e8 3e cb ff ff call 8010147a +8010473e: 89 1c 24 mov %ebx,(%esp) +80104741: e8 c3 cc ff ff call 80101409 iunlockput(ip); -8010493c: 89 1c 24 mov %ebx,(%esp) -8010493f: e8 3d ce ff ff call 80101781 +80104746: 89 1c 24 mov %ebx,(%esp) +80104749: e8 ae cf ff ff call 801016fc end_op(); -80104944: e8 b6 df ff ff call 801028ff +8010474e: e8 a6 e0 ff ff call 801027f9 return 0; -80104949: 83 c4 10 add $0x10,%esp -8010494c: b8 00 00 00 00 mov $0x0,%eax -} -80104951: 8d 65 f4 lea -0xc(%ebp),%esp -80104954: 5b pop %ebx -80104955: 5e pop %esi -80104956: 5f pop %edi -80104957: 5d pop %ebp -80104958: c3 ret +80104753: 83 c4 10 add $0x10,%esp +80104756: b8 00 00 00 00 mov $0x0,%eax +} +8010475b: 8d 65 f4 lea -0xc(%ebp),%esp +8010475e: 5b pop %ebx +8010475f: 5e pop %esi +80104760: 5f pop %edi +80104761: 5d pop %ebp +80104762: c3 ret end_op(); -80104959: e8 a1 df ff ff call 801028ff +80104763: e8 91 e0 ff ff call 801027f9 return -1; -8010495e: b8 ff ff ff ff mov $0xffffffff,%eax -80104963: eb ec jmp 80104951 +80104768: b8 ff ff ff ff mov $0xffffffff,%eax +8010476d: eb ec jmp 8010475b panic("unlink: nlink < 1"); -80104965: 83 ec 0c sub $0xc,%esp -80104968: 68 0e 80 10 80 push $0x8010800e -8010496d: e8 e6 b9 ff ff call 80100358 +8010476f: 83 ec 0c sub $0xc,%esp +80104772: 68 2e 7d 10 80 push $0x80107d2e +80104777: e8 c4 bb ff ff call 80100340 for(off=2*sizeof(de); offsize; off+=sizeof(de)){ -80104972: 83 7b 58 20 cmpl $0x20,0x58(%ebx) -80104976: 0f 86 77 ff ff ff jbe 801048f3 -8010497c: bf 20 00 00 00 mov $0x20,%edi +8010477c: 83 7b 58 20 cmpl $0x20,0x58(%ebx) +80104780: 0f 86 77 ff ff ff jbe 801046fd +80104786: be 20 00 00 00 mov $0x20,%esi if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) -80104981: 6a 10 push $0x10 -80104983: 57 push %edi -80104984: 8d 45 b0 lea -0x50(%ebp),%eax -80104987: 50 push %eax -80104988: 53 push %ebx -80104989: e8 46 ce ff ff call 801017d4 -8010498e: 83 c4 10 add $0x10,%esp -80104991: 83 f8 10 cmp $0x10,%eax -80104994: 75 14 jne 801049aa +8010478b: 6a 10 push $0x10 +8010478d: 56 push %esi +8010478e: 8d 45 b0 lea -0x50(%ebp),%eax +80104791: 50 push %eax +80104792: 53 push %ebx +80104793: e8 af cf ff ff call 80101747 +80104798: 83 c4 10 add $0x10,%esp +8010479b: 83 f8 10 cmp $0x10,%eax +8010479e: 75 14 jne 801047b4 if(de.inum != 0) -80104996: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp) -8010499b: 75 47 jne 801049e4 +801047a0: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp) +801047a5: 75 47 jne 801047ee for(off=2*sizeof(de); offsize; off+=sizeof(de)){ -8010499d: 83 c7 10 add $0x10,%edi -801049a0: 3b 7b 58 cmp 0x58(%ebx),%edi -801049a3: 72 dc jb 80104981 -801049a5: e9 49 ff ff ff jmp 801048f3 +801047a7: 83 c6 10 add $0x10,%esi +801047aa: 3b 73 58 cmp 0x58(%ebx),%esi +801047ad: 72 dc jb 8010478b +801047af: e9 49 ff ff ff jmp 801046fd panic("isdirempty: readi"); -801049aa: 83 ec 0c sub $0xc,%esp -801049ad: 68 20 80 10 80 push $0x80108020 -801049b2: e8 a1 b9 ff ff call 80100358 +801047b4: 83 ec 0c sub $0xc,%esp +801047b7: 68 40 7d 10 80 push $0x80107d40 +801047bc: e8 7f bb ff ff call 80100340 panic("unlink: writei"); -801049b7: 83 ec 0c sub $0xc,%esp -801049ba: 68 32 80 10 80 push $0x80108032 -801049bf: e8 94 b9 ff ff call 80100358 +801047c1: 83 ec 0c sub $0xc,%esp +801047c4: 68 52 7d 10 80 push $0x80107d52 +801047c9: e8 72 bb ff ff call 80100340 dp->nlink--; -801049c4: 66 83 6e 56 01 subw $0x1,0x56(%esi) +801047ce: 66 83 6f 56 01 subw $0x1,0x56(%edi) iupdate(dp); -801049c9: 83 ec 0c sub $0xc,%esp -801049cc: 56 push %esi -801049cd: e8 a8 ca ff ff call 8010147a -801049d2: 83 c4 10 add $0x10,%esp -801049d5: e9 4c ff ff ff jmp 80104926 +801047d3: 83 ec 0c sub $0xc,%esp +801047d6: 57 push %edi +801047d7: e8 2d cc ff ff call 80101409 +801047dc: 83 c4 10 add $0x10,%esp +801047df: e9 4c ff ff ff jmp 80104730 return -1; -801049da: b8 ff ff ff ff mov $0xffffffff,%eax -801049df: e9 6d ff ff ff jmp 80104951 +801047e4: b8 ff ff ff ff mov $0xffffffff,%eax +801047e9: e9 6d ff ff ff jmp 8010475b iunlockput(ip); -801049e4: 83 ec 0c sub $0xc,%esp -801049e7: 53 push %ebx -801049e8: e8 94 cd ff ff call 80101781 +801047ee: 83 ec 0c sub $0xc,%esp +801047f1: 53 push %ebx +801047f2: e8 05 cf ff ff call 801016fc goto bad; -801049ed: 83 c4 10 add $0x10,%esp +801047f7: 83 c4 10 add $0x10,%esp iunlockput(dp); -801049f0: 83 ec 0c sub $0xc,%esp -801049f3: 56 push %esi -801049f4: e8 88 cd ff ff call 80101781 +801047fa: 83 ec 0c sub $0xc,%esp +801047fd: 57 push %edi +801047fe: e8 f9 ce ff ff call 801016fc end_op(); -801049f9: e8 01 df ff ff call 801028ff +80104803: e8 f1 df ff ff call 801027f9 return -1; -801049fe: 83 c4 10 add $0x10,%esp -80104a01: b8 ff ff ff ff mov $0xffffffff,%eax -80104a06: e9 46 ff ff ff jmp 80104951 +80104808: 83 c4 10 add $0x10,%esp +8010480b: b8 ff ff ff ff mov $0xffffffff,%eax +80104810: e9 46 ff ff ff jmp 8010475b -80104a0b : +80104815 : int sys_open(void) { -80104a0b: f3 0f 1e fb endbr32 -80104a0f: 55 push %ebp -80104a10: 89 e5 mov %esp,%ebp -80104a12: 57 push %edi -80104a13: 56 push %esi -80104a14: 53 push %ebx -80104a15: 83 ec 24 sub $0x24,%esp +80104815: 55 push %ebp +80104816: 89 e5 mov %esp,%ebp +80104818: 57 push %edi +80104819: 56 push %esi +8010481a: 53 push %ebx +8010481b: 83 ec 24 sub $0x24,%esp char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) -80104a18: 8d 45 e4 lea -0x1c(%ebp),%eax -80104a1b: 50 push %eax -80104a1c: 6a 00 push $0x0 -80104a1e: e8 53 f8 ff ff call 80104276 -80104a23: 83 c4 10 add $0x10,%esp -80104a26: 85 c0 test %eax,%eax -80104a28: 0f 88 0b 01 00 00 js 80104b39 -80104a2e: 83 ec 08 sub $0x8,%esp -80104a31: 8d 45 e0 lea -0x20(%ebp),%eax -80104a34: 50 push %eax -80104a35: 6a 01 push $0x1 -80104a37: e8 ab f7 ff ff call 801041e7 -80104a3c: 83 c4 10 add $0x10,%esp -80104a3f: 85 c0 test %eax,%eax -80104a41: 0f 88 f9 00 00 00 js 80104b40 +8010481e: 8d 45 e4 lea -0x1c(%ebp),%eax +80104821: 50 push %eax +80104822: 6a 00 push $0x0 +80104824: e8 79 f8 ff ff call 801040a2 +80104829: 83 c4 10 add $0x10,%esp +8010482c: 85 c0 test %eax,%eax +8010482e: 0f 88 0b 01 00 00 js 8010493f +80104834: 83 ec 08 sub $0x8,%esp +80104837: 8d 45 e0 lea -0x20(%ebp),%eax +8010483a: 50 push %eax +8010483b: 6a 01 push $0x1 +8010483d: e8 dd f7 ff ff call 8010401f +80104842: 83 c4 10 add $0x10,%esp +80104845: 85 c0 test %eax,%eax +80104847: 0f 88 f9 00 00 00 js 80104946 return -1; begin_op(); -80104a47: e8 34 de ff ff call 80102880 +8010484d: e8 2c df ff ff call 8010277e if(omode & O_CREATE){ -80104a4c: f6 45 e1 02 testb $0x2,-0x1f(%ebp) -80104a50: 0f 84 8a 00 00 00 je 80104ae0 +80104852: f6 45 e1 02 testb $0x2,-0x1f(%ebp) +80104856: 0f 84 8a 00 00 00 je 801048e6 ip = create(path, T_FILE, 0, 0); -80104a56: 83 ec 0c sub $0xc,%esp -80104a59: 6a 00 push $0x0 -80104a5b: b9 00 00 00 00 mov $0x0,%ecx -80104a60: ba 02 00 00 00 mov $0x2,%edx -80104a65: 8b 45 e4 mov -0x1c(%ebp),%eax -80104a68: e8 32 f9 ff ff call 8010439f -80104a6d: 89 c6 mov %eax,%esi +8010485c: 83 ec 0c sub $0xc,%esp +8010485f: 6a 00 push $0x0 +80104861: b9 00 00 00 00 mov $0x0,%ecx +80104866: ba 02 00 00 00 mov $0x2,%edx +8010486b: 8b 45 e4 mov -0x1c(%ebp),%eax +8010486e: e8 4f f9 ff ff call 801041c2 +80104873: 89 c6 mov %eax,%esi if(ip == 0){ -80104a6f: 83 c4 10 add $0x10,%esp -80104a72: 85 c0 test %eax,%eax -80104a74: 74 5e je 80104ad4 +80104875: 83 c4 10 add $0x10,%esp +80104878: 85 c0 test %eax,%eax +8010487a: 74 5e je 801048da end_op(); return -1; } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ -80104a76: e8 5a c2 ff ff call 80100cd5 -80104a7b: 89 c3 mov %eax,%ebx -80104a7d: 85 c0 test %eax,%eax -80104a7f: 0f 84 ce 00 00 00 je 80104b53 -80104a85: e8 e0 f8 ff ff call 8010436a -80104a8a: 89 c7 mov %eax,%edi -80104a8c: 85 c0 test %eax,%eax -80104a8e: 0f 88 b3 00 00 00 js 80104b47 +8010487c: e8 14 c4 ff ff call 80100c95 +80104881: 89 c3 mov %eax,%ebx +80104883: 85 c0 test %eax,%eax +80104885: 0f 84 ce 00 00 00 je 80104959 +8010488b: e8 fe f8 ff ff call 8010418e +80104890: 89 c7 mov %eax,%edi +80104892: 85 c0 test %eax,%eax +80104894: 0f 88 b3 00 00 00 js 8010494d fileclose(f); iunlockput(ip); end_op(); return -1; } iunlock(ip); -80104a94: 83 ec 0c sub $0xc,%esp -80104a97: 56 push %esi -80104a98: e8 55 cb ff ff call 801015f2 +8010489a: 83 ec 0c sub $0xc,%esp +8010489d: 56 push %esi +8010489e: e8 d2 cc ff ff call 80101575 end_op(); -80104a9d: e8 5d de ff ff call 801028ff +801048a3: e8 51 df ff ff call 801027f9 f->type = FD_INODE; -80104aa2: c7 03 02 00 00 00 movl $0x2,(%ebx) +801048a8: c7 03 02 00 00 00 movl $0x2,(%ebx) f->ip = ip; -80104aa8: 89 73 10 mov %esi,0x10(%ebx) +801048ae: 89 73 10 mov %esi,0x10(%ebx) f->off = 0; -80104aab: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) +801048b1: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) f->readable = !(omode & O_WRONLY); -80104ab2: 8b 55 e0 mov -0x20(%ebp),%edx -80104ab5: 89 d0 mov %edx,%eax -80104ab7: 83 f0 01 xor $0x1,%eax -80104aba: 83 e0 01 and $0x1,%eax -80104abd: 88 43 08 mov %al,0x8(%ebx) +801048b8: 8b 55 e0 mov -0x20(%ebp),%edx +801048bb: 89 d0 mov %edx,%eax +801048bd: 83 f0 01 xor $0x1,%eax +801048c0: 83 e0 01 and $0x1,%eax +801048c3: 88 43 08 mov %al,0x8(%ebx) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); -80104ac0: 83 c4 10 add $0x10,%esp -80104ac3: f6 c2 03 test $0x3,%dl -80104ac6: 0f 95 43 09 setne 0x9(%ebx) +801048c6: 83 c4 10 add $0x10,%esp +801048c9: f6 c2 03 test $0x3,%dl +801048cc: 0f 95 43 09 setne 0x9(%ebx) return fd; } -80104aca: 89 f8 mov %edi,%eax -80104acc: 8d 65 f4 lea -0xc(%ebp),%esp -80104acf: 5b pop %ebx -80104ad0: 5e pop %esi -80104ad1: 5f pop %edi -80104ad2: 5d pop %ebp -80104ad3: c3 ret +801048d0: 89 f8 mov %edi,%eax +801048d2: 8d 65 f4 lea -0xc(%ebp),%esp +801048d5: 5b pop %ebx +801048d6: 5e pop %esi +801048d7: 5f pop %edi +801048d8: 5d pop %ebp +801048d9: c3 ret end_op(); -80104ad4: e8 26 de ff ff call 801028ff +801048da: e8 1a df ff ff call 801027f9 return -1; -80104ad9: bf ff ff ff ff mov $0xffffffff,%edi -80104ade: eb ea jmp 80104aca +801048df: bf ff ff ff ff mov $0xffffffff,%edi +801048e4: eb ea jmp 801048d0 if((ip = namei(path)) == 0){ -80104ae0: 83 ec 0c sub $0xc,%esp -80104ae3: ff 75 e4 pushl -0x1c(%ebp) -80104ae6: e8 f9 d1 ff ff call 80101ce4 -80104aeb: 89 c6 mov %eax,%esi -80104aed: 83 c4 10 add $0x10,%esp -80104af0: 85 c0 test %eax,%eax -80104af2: 74 39 je 80104b2d +801048e6: 83 ec 0c sub $0xc,%esp +801048e9: ff 75 e4 push -0x1c(%ebp) +801048ec: e8 50 d3 ff ff call 80101c41 +801048f1: 89 c6 mov %eax,%esi +801048f3: 83 c4 10 add $0x10,%esp +801048f6: 85 c0 test %eax,%eax +801048f8: 74 39 je 80104933 ilock(ip); -80104af4: 83 ec 0c sub $0xc,%esp -80104af7: 50 push %eax -80104af8: e8 2f ca ff ff call 8010152c +801048fa: 83 ec 0c sub $0xc,%esp +801048fd: 50 push %eax +801048fe: e8 b0 cb ff ff call 801014b3 if(ip->type == T_DIR && omode != O_RDONLY){ -80104afd: 83 c4 10 add $0x10,%esp -80104b00: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) -80104b05: 0f 85 6b ff ff ff jne 80104a76 -80104b0b: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) -80104b0f: 0f 84 61 ff ff ff je 80104a76 +80104903: 83 c4 10 add $0x10,%esp +80104906: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) +8010490b: 0f 85 6b ff ff ff jne 8010487c +80104911: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) +80104915: 0f 84 61 ff ff ff je 8010487c iunlockput(ip); -80104b15: 83 ec 0c sub $0xc,%esp -80104b18: 56 push %esi -80104b19: e8 63 cc ff ff call 80101781 +8010491b: 83 ec 0c sub $0xc,%esp +8010491e: 56 push %esi +8010491f: e8 d8 cd ff ff call 801016fc end_op(); -80104b1e: e8 dc dd ff ff call 801028ff +80104924: e8 d0 de ff ff call 801027f9 return -1; -80104b23: 83 c4 10 add $0x10,%esp -80104b26: bf ff ff ff ff mov $0xffffffff,%edi -80104b2b: eb 9d jmp 80104aca +80104929: 83 c4 10 add $0x10,%esp +8010492c: bf ff ff ff ff mov $0xffffffff,%edi +80104931: eb 9d jmp 801048d0 end_op(); -80104b2d: e8 cd dd ff ff call 801028ff +80104933: e8 c1 de ff ff call 801027f9 return -1; -80104b32: bf ff ff ff ff mov $0xffffffff,%edi -80104b37: eb 91 jmp 80104aca +80104938: bf ff ff ff ff mov $0xffffffff,%edi +8010493d: eb 91 jmp 801048d0 return -1; -80104b39: bf ff ff ff ff mov $0xffffffff,%edi -80104b3e: eb 8a jmp 80104aca -80104b40: bf ff ff ff ff mov $0xffffffff,%edi -80104b45: eb 83 jmp 80104aca +8010493f: bf ff ff ff ff mov $0xffffffff,%edi +80104944: eb 8a jmp 801048d0 +80104946: bf ff ff ff ff mov $0xffffffff,%edi +8010494b: eb 83 jmp 801048d0 fileclose(f); -80104b47: 83 ec 0c sub $0xc,%esp -80104b4a: 53 push %ebx -80104b4b: e8 31 c2 ff ff call 80100d81 -80104b50: 83 c4 10 add $0x10,%esp +8010494d: 83 ec 0c sub $0xc,%esp +80104950: 53 push %ebx +80104951: e8 e3 c3 ff ff call 80100d39 +80104956: 83 c4 10 add $0x10,%esp iunlockput(ip); -80104b53: 83 ec 0c sub $0xc,%esp -80104b56: 56 push %esi -80104b57: e8 25 cc ff ff call 80101781 +80104959: 83 ec 0c sub $0xc,%esp +8010495c: 56 push %esi +8010495d: e8 9a cd ff ff call 801016fc end_op(); -80104b5c: e8 9e dd ff ff call 801028ff +80104962: e8 92 de ff ff call 801027f9 return -1; -80104b61: 83 c4 10 add $0x10,%esp -80104b64: bf ff ff ff ff mov $0xffffffff,%edi -80104b69: e9 5c ff ff ff jmp 80104aca +80104967: 83 c4 10 add $0x10,%esp +8010496a: bf ff ff ff ff mov $0xffffffff,%edi +8010496f: e9 5c ff ff ff jmp 801048d0 -80104b6e : +80104974 : int sys_mkdir(void) { -80104b6e: f3 0f 1e fb endbr32 -80104b72: 55 push %ebp -80104b73: 89 e5 mov %esp,%ebp -80104b75: 83 ec 18 sub $0x18,%esp +80104974: 55 push %ebp +80104975: 89 e5 mov %esp,%ebp +80104977: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); -80104b78: e8 03 dd ff ff call 80102880 +8010497a: e8 ff dd ff ff call 8010277e if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ -80104b7d: 83 ec 08 sub $0x8,%esp -80104b80: 8d 45 f4 lea -0xc(%ebp),%eax -80104b83: 50 push %eax -80104b84: 6a 00 push $0x0 -80104b86: e8 eb f6 ff ff call 80104276 -80104b8b: 83 c4 10 add $0x10,%esp -80104b8e: 85 c0 test %eax,%eax -80104b90: 78 36 js 80104bc8 -80104b92: 83 ec 0c sub $0xc,%esp -80104b95: 6a 00 push $0x0 -80104b97: b9 00 00 00 00 mov $0x0,%ecx -80104b9c: ba 01 00 00 00 mov $0x1,%edx -80104ba1: 8b 45 f4 mov -0xc(%ebp),%eax -80104ba4: e8 f6 f7 ff ff call 8010439f -80104ba9: 83 c4 10 add $0x10,%esp -80104bac: 85 c0 test %eax,%eax -80104bae: 74 18 je 80104bc8 +8010497f: 83 ec 08 sub $0x8,%esp +80104982: 8d 45 f4 lea -0xc(%ebp),%eax +80104985: 50 push %eax +80104986: 6a 00 push $0x0 +80104988: e8 15 f7 ff ff call 801040a2 +8010498d: 83 c4 10 add $0x10,%esp +80104990: 85 c0 test %eax,%eax +80104992: 78 36 js 801049ca +80104994: 83 ec 0c sub $0xc,%esp +80104997: 6a 00 push $0x0 +80104999: b9 00 00 00 00 mov $0x0,%ecx +8010499e: ba 01 00 00 00 mov $0x1,%edx +801049a3: 8b 45 f4 mov -0xc(%ebp),%eax +801049a6: e8 17 f8 ff ff call 801041c2 +801049ab: 83 c4 10 add $0x10,%esp +801049ae: 85 c0 test %eax,%eax +801049b0: 74 18 je 801049ca end_op(); return -1; } iunlockput(ip); -80104bb0: 83 ec 0c sub $0xc,%esp -80104bb3: 50 push %eax -80104bb4: e8 c8 cb ff ff call 80101781 +801049b2: 83 ec 0c sub $0xc,%esp +801049b5: 50 push %eax +801049b6: e8 41 cd ff ff call 801016fc end_op(); -80104bb9: e8 41 dd ff ff call 801028ff +801049bb: e8 39 de ff ff call 801027f9 return 0; -80104bbe: 83 c4 10 add $0x10,%esp -80104bc1: b8 00 00 00 00 mov $0x0,%eax +801049c0: 83 c4 10 add $0x10,%esp +801049c3: b8 00 00 00 00 mov $0x0,%eax } -80104bc6: c9 leave -80104bc7: c3 ret +801049c8: c9 leave +801049c9: c3 ret end_op(); -80104bc8: e8 32 dd ff ff call 801028ff +801049ca: e8 2a de ff ff call 801027f9 return -1; -80104bcd: b8 ff ff ff ff mov $0xffffffff,%eax -80104bd2: eb f2 jmp 80104bc6 +801049cf: b8 ff ff ff ff mov $0xffffffff,%eax +801049d4: eb f2 jmp 801049c8 -80104bd4 : +801049d6 : int sys_mknod(void) { -80104bd4: f3 0f 1e fb endbr32 -80104bd8: 55 push %ebp -80104bd9: 89 e5 mov %esp,%ebp -80104bdb: 83 ec 18 sub $0x18,%esp +801049d6: 55 push %ebp +801049d7: 89 e5 mov %esp,%ebp +801049d9: 83 ec 18 sub $0x18,%esp struct inode *ip; char *path; int major, minor; begin_op(); -80104bde: e8 9d dc ff ff call 80102880 +801049dc: e8 9d dd ff ff call 8010277e if((argstr(0, &path)) < 0 || -80104be3: 83 ec 08 sub $0x8,%esp -80104be6: 8d 45 f4 lea -0xc(%ebp),%eax -80104be9: 50 push %eax -80104bea: 6a 00 push $0x0 -80104bec: e8 85 f6 ff ff call 80104276 -80104bf1: 83 c4 10 add $0x10,%esp -80104bf4: 85 c0 test %eax,%eax -80104bf6: 78 62 js 80104c5a +801049e1: 83 ec 08 sub $0x8,%esp +801049e4: 8d 45 f4 lea -0xc(%ebp),%eax +801049e7: 50 push %eax +801049e8: 6a 00 push $0x0 +801049ea: e8 b3 f6 ff ff call 801040a2 +801049ef: 83 c4 10 add $0x10,%esp +801049f2: 85 c0 test %eax,%eax +801049f4: 78 62 js 80104a58 argint(1, &major) < 0 || -80104bf8: 83 ec 08 sub $0x8,%esp -80104bfb: 8d 45 f0 lea -0x10(%ebp),%eax -80104bfe: 50 push %eax -80104bff: 6a 01 push $0x1 -80104c01: e8 e1 f5 ff ff call 801041e7 +801049f6: 83 ec 08 sub $0x8,%esp +801049f9: 8d 45 f0 lea -0x10(%ebp),%eax +801049fc: 50 push %eax +801049fd: 6a 01 push $0x1 +801049ff: e8 1b f6 ff ff call 8010401f if((argstr(0, &path)) < 0 || -80104c06: 83 c4 10 add $0x10,%esp -80104c09: 85 c0 test %eax,%eax -80104c0b: 78 4d js 80104c5a +80104a04: 83 c4 10 add $0x10,%esp +80104a07: 85 c0 test %eax,%eax +80104a09: 78 4d js 80104a58 argint(2, &minor) < 0 || -80104c0d: 83 ec 08 sub $0x8,%esp -80104c10: 8d 45 ec lea -0x14(%ebp),%eax -80104c13: 50 push %eax -80104c14: 6a 02 push $0x2 -80104c16: e8 cc f5 ff ff call 801041e7 +80104a0b: 83 ec 08 sub $0x8,%esp +80104a0e: 8d 45 ec lea -0x14(%ebp),%eax +80104a11: 50 push %eax +80104a12: 6a 02 push $0x2 +80104a14: e8 06 f6 ff ff call 8010401f argint(1, &major) < 0 || -80104c1b: 83 c4 10 add $0x10,%esp -80104c1e: 85 c0 test %eax,%eax -80104c20: 78 38 js 80104c5a +80104a19: 83 c4 10 add $0x10,%esp +80104a1c: 85 c0 test %eax,%eax +80104a1e: 78 38 js 80104a58 (ip = create(path, T_DEV, major, minor)) == 0){ -80104c22: 0f bf 4d f0 movswl -0x10(%ebp),%ecx -80104c26: 83 ec 0c sub $0xc,%esp -80104c29: 0f bf 45 ec movswl -0x14(%ebp),%eax -80104c2d: 50 push %eax -80104c2e: ba 03 00 00 00 mov $0x3,%edx -80104c33: 8b 45 f4 mov -0xc(%ebp),%eax -80104c36: e8 64 f7 ff ff call 8010439f +80104a20: 0f bf 4d f0 movswl -0x10(%ebp),%ecx +80104a24: 83 ec 0c sub $0xc,%esp +80104a27: 0f bf 45 ec movswl -0x14(%ebp),%eax +80104a2b: 50 push %eax +80104a2c: ba 03 00 00 00 mov $0x3,%edx +80104a31: 8b 45 f4 mov -0xc(%ebp),%eax +80104a34: e8 89 f7 ff ff call 801041c2 argint(2, &minor) < 0 || -80104c3b: 83 c4 10 add $0x10,%esp -80104c3e: 85 c0 test %eax,%eax -80104c40: 74 18 je 80104c5a +80104a39: 83 c4 10 add $0x10,%esp +80104a3c: 85 c0 test %eax,%eax +80104a3e: 74 18 je 80104a58 end_op(); return -1; } iunlockput(ip); -80104c42: 83 ec 0c sub $0xc,%esp -80104c45: 50 push %eax -80104c46: e8 36 cb ff ff call 80101781 +80104a40: 83 ec 0c sub $0xc,%esp +80104a43: 50 push %eax +80104a44: e8 b3 cc ff ff call 801016fc end_op(); -80104c4b: e8 af dc ff ff call 801028ff +80104a49: e8 ab dd ff ff call 801027f9 return 0; -80104c50: 83 c4 10 add $0x10,%esp -80104c53: b8 00 00 00 00 mov $0x0,%eax +80104a4e: 83 c4 10 add $0x10,%esp +80104a51: b8 00 00 00 00 mov $0x0,%eax } -80104c58: c9 leave -80104c59: c3 ret +80104a56: c9 leave +80104a57: c3 ret end_op(); -80104c5a: e8 a0 dc ff ff call 801028ff +80104a58: e8 9c dd ff ff call 801027f9 return -1; -80104c5f: b8 ff ff ff ff mov $0xffffffff,%eax -80104c64: eb f2 jmp 80104c58 +80104a5d: b8 ff ff ff ff mov $0xffffffff,%eax +80104a62: eb f2 jmp 80104a56 -80104c66 : +80104a64 : int sys_chdir(void) { -80104c66: f3 0f 1e fb endbr32 -80104c6a: 55 push %ebp -80104c6b: 89 e5 mov %esp,%ebp -80104c6d: 56 push %esi -80104c6e: 53 push %ebx -80104c6f: 83 ec 10 sub $0x10,%esp +80104a64: 55 push %ebp +80104a65: 89 e5 mov %esp,%ebp +80104a67: 56 push %esi +80104a68: 53 push %ebx +80104a69: 83 ec 10 sub $0x10,%esp char *path; struct inode *ip; struct proc *curproc = myproc(); -80104c72: e8 73 e7 ff ff call 801033ea -80104c77: 89 c6 mov %eax,%esi +80104a6c: e8 3f e8 ff ff call 801032b0 +80104a71: 89 c6 mov %eax,%esi begin_op(); -80104c79: e8 02 dc ff ff call 80102880 +80104a73: e8 06 dd ff ff call 8010277e if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ -80104c7e: 83 ec 08 sub $0x8,%esp -80104c81: 8d 45 f4 lea -0xc(%ebp),%eax -80104c84: 50 push %eax -80104c85: 6a 00 push $0x0 -80104c87: e8 ea f5 ff ff call 80104276 -80104c8c: 83 c4 10 add $0x10,%esp -80104c8f: 85 c0 test %eax,%eax -80104c91: 78 52 js 80104ce5 -80104c93: 83 ec 0c sub $0xc,%esp -80104c96: ff 75 f4 pushl -0xc(%ebp) -80104c99: e8 46 d0 ff ff call 80101ce4 -80104c9e: 89 c3 mov %eax,%ebx -80104ca0: 83 c4 10 add $0x10,%esp -80104ca3: 85 c0 test %eax,%eax -80104ca5: 74 3e je 80104ce5 +80104a78: 83 ec 08 sub $0x8,%esp +80104a7b: 8d 45 f4 lea -0xc(%ebp),%eax +80104a7e: 50 push %eax +80104a7f: 6a 00 push $0x0 +80104a81: e8 1c f6 ff ff call 801040a2 +80104a86: 83 c4 10 add $0x10,%esp +80104a89: 85 c0 test %eax,%eax +80104a8b: 78 52 js 80104adf +80104a8d: 83 ec 0c sub $0xc,%esp +80104a90: ff 75 f4 push -0xc(%ebp) +80104a93: e8 a9 d1 ff ff call 80101c41 +80104a98: 89 c3 mov %eax,%ebx +80104a9a: 83 c4 10 add $0x10,%esp +80104a9d: 85 c0 test %eax,%eax +80104a9f: 74 3e je 80104adf end_op(); return -1; } ilock(ip); -80104ca7: 83 ec 0c sub $0xc,%esp -80104caa: 50 push %eax -80104cab: e8 7c c8 ff ff call 8010152c +80104aa1: 83 ec 0c sub $0xc,%esp +80104aa4: 50 push %eax +80104aa5: e8 09 ca ff ff call 801014b3 if(ip->type != T_DIR){ -80104cb0: 83 c4 10 add $0x10,%esp -80104cb3: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) -80104cb8: 75 37 jne 80104cf1 +80104aaa: 83 c4 10 add $0x10,%esp +80104aad: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) +80104ab2: 75 37 jne 80104aeb iunlockput(ip); end_op(); return -1; } iunlock(ip); -80104cba: 83 ec 0c sub $0xc,%esp -80104cbd: 53 push %ebx -80104cbe: e8 2f c9 ff ff call 801015f2 +80104ab4: 83 ec 0c sub $0xc,%esp +80104ab7: 53 push %ebx +80104ab8: e8 b8 ca ff ff call 80101575 iput(curproc->cwd); -80104cc3: 83 c4 04 add $0x4,%esp -80104cc6: ff 76 68 pushl 0x68(%esi) -80104cc9: e8 6d c9 ff ff call 8010163b +80104abd: 83 c4 04 add $0x4,%esp +80104ac0: ff 76 68 push 0x68(%esi) +80104ac3: e8 f2 ca ff ff call 801015ba end_op(); -80104cce: e8 2c dc ff ff call 801028ff +80104ac8: e8 2c dd ff ff call 801027f9 curproc->cwd = ip; -80104cd3: 89 5e 68 mov %ebx,0x68(%esi) +80104acd: 89 5e 68 mov %ebx,0x68(%esi) return 0; -80104cd6: 83 c4 10 add $0x10,%esp -80104cd9: b8 00 00 00 00 mov $0x0,%eax -} -80104cde: 8d 65 f8 lea -0x8(%ebp),%esp -80104ce1: 5b pop %ebx -80104ce2: 5e pop %esi -80104ce3: 5d pop %ebp -80104ce4: c3 ret +80104ad0: 83 c4 10 add $0x10,%esp +80104ad3: b8 00 00 00 00 mov $0x0,%eax +} +80104ad8: 8d 65 f8 lea -0x8(%ebp),%esp +80104adb: 5b pop %ebx +80104adc: 5e pop %esi +80104add: 5d pop %ebp +80104ade: c3 ret end_op(); -80104ce5: e8 15 dc ff ff call 801028ff +80104adf: e8 15 dd ff ff call 801027f9 return -1; -80104cea: b8 ff ff ff ff mov $0xffffffff,%eax -80104cef: eb ed jmp 80104cde +80104ae4: b8 ff ff ff ff mov $0xffffffff,%eax +80104ae9: eb ed jmp 80104ad8 iunlockput(ip); -80104cf1: 83 ec 0c sub $0xc,%esp -80104cf4: 53 push %ebx -80104cf5: e8 87 ca ff ff call 80101781 +80104aeb: 83 ec 0c sub $0xc,%esp +80104aee: 53 push %ebx +80104aef: e8 08 cc ff ff call 801016fc end_op(); -80104cfa: e8 00 dc ff ff call 801028ff +80104af4: e8 00 dd ff ff call 801027f9 return -1; -80104cff: 83 c4 10 add $0x10,%esp -80104d02: b8 ff ff ff ff mov $0xffffffff,%eax -80104d07: eb d5 jmp 80104cde +80104af9: 83 c4 10 add $0x10,%esp +80104afc: b8 ff ff ff ff mov $0xffffffff,%eax +80104b01: eb d5 jmp 80104ad8 -80104d09 : +80104b03 : int sys_exec(void) { -80104d09: f3 0f 1e fb endbr32 -80104d0d: 55 push %ebp -80104d0e: 89 e5 mov %esp,%ebp -80104d10: 57 push %edi -80104d11: 56 push %esi -80104d12: 53 push %ebx -80104d13: 81 ec a4 00 00 00 sub $0xa4,%esp +80104b03: 55 push %ebp +80104b04: 89 e5 mov %esp,%ebp +80104b06: 57 push %edi +80104b07: 56 push %esi +80104b08: 53 push %ebx +80104b09: 81 ec a4 00 00 00 sub $0xa4,%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ -80104d19: 8d 45 e4 lea -0x1c(%ebp),%eax -80104d1c: 50 push %eax -80104d1d: 6a 00 push $0x0 -80104d1f: e8 52 f5 ff ff call 80104276 -80104d24: 83 c4 10 add $0x10,%esp -80104d27: 85 c0 test %eax,%eax -80104d29: 0f 88 ba 00 00 00 js 80104de9 -80104d2f: 83 ec 08 sub $0x8,%esp -80104d32: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax -80104d38: 50 push %eax -80104d39: 6a 01 push $0x1 -80104d3b: e8 a7 f4 ff ff call 801041e7 -80104d40: 83 c4 10 add $0x10,%esp -80104d43: 85 c0 test %eax,%eax -80104d45: 0f 88 a5 00 00 00 js 80104df0 +80104b0f: 8d 45 e4 lea -0x1c(%ebp),%eax +80104b12: 50 push %eax +80104b13: 6a 00 push $0x0 +80104b15: e8 88 f5 ff ff call 801040a2 +80104b1a: 83 c4 10 add $0x10,%esp +80104b1d: 85 c0 test %eax,%eax +80104b1f: 0f 88 ba 00 00 00 js 80104bdf +80104b25: 83 ec 08 sub $0x8,%esp +80104b28: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax +80104b2e: 50 push %eax +80104b2f: 6a 01 push $0x1 +80104b31: e8 e9 f4 ff ff call 8010401f +80104b36: 83 c4 10 add $0x10,%esp +80104b39: 85 c0 test %eax,%eax +80104b3b: 0f 88 a5 00 00 00 js 80104be6 return -1; } memset(argv, 0, sizeof(argv)); -80104d4b: 83 ec 04 sub $0x4,%esp -80104d4e: 68 80 00 00 00 push $0x80 -80104d53: 6a 00 push $0x0 -80104d55: 8d 85 64 ff ff ff lea -0x9c(%ebp),%eax -80104d5b: 50 push %eax -80104d5c: e8 ee f1 ff ff call 80103f4f -80104d61: 83 c4 10 add $0x10,%esp +80104b41: 83 ec 04 sub $0x4,%esp +80104b44: 68 80 00 00 00 push $0x80 +80104b49: 6a 00 push $0x0 +80104b4b: 8d 85 64 ff ff ff lea -0x9c(%ebp),%eax +80104b51: 50 push %eax +80104b52: e8 58 f2 ff ff call 80103daf +80104b57: 83 c4 10 add $0x10,%esp for(i=0;; i++){ -80104d64: be 00 00 00 00 mov $0x0,%esi +80104b5a: be 00 00 00 00 mov $0x0,%esi if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) -80104d69: 8d bd 5c ff ff ff lea -0xa4(%ebp),%edi -80104d6f: 8d 1c b5 00 00 00 00 lea 0x0(,%esi,4),%ebx -80104d76: 83 ec 08 sub $0x8,%esp -80104d79: 57 push %edi -80104d7a: 89 d8 mov %ebx,%eax -80104d7c: 03 85 60 ff ff ff add -0xa0(%ebp),%eax -80104d82: 50 push %eax -80104d83: e8 d2 f3 ff ff call 8010415a -80104d88: 83 c4 10 add $0x10,%esp -80104d8b: 85 c0 test %eax,%eax -80104d8d: 78 68 js 80104df7 +80104b5f: 8d bd 5c ff ff ff lea -0xa4(%ebp),%edi +80104b65: 8d 1c b5 00 00 00 00 lea 0x0(,%esi,4),%ebx +80104b6c: 83 ec 08 sub $0x8,%esp +80104b6f: 57 push %edi +80104b70: 89 d8 mov %ebx,%eax +80104b72: 03 85 60 ff ff ff add -0xa0(%ebp),%eax +80104b78: 50 push %eax +80104b79: e8 1e f4 ff ff call 80103f9c +80104b7e: 83 c4 10 add $0x10,%esp +80104b81: 85 c0 test %eax,%eax +80104b83: 78 68 js 80104bed return -1; if(uarg == 0){ -80104d8f: 8b 85 5c ff ff ff mov -0xa4(%ebp),%eax -80104d95: 85 c0 test %eax,%eax -80104d97: 74 2e je 80104dc7 +80104b85: 8b 85 5c ff ff ff mov -0xa4(%ebp),%eax +80104b8b: 85 c0 test %eax,%eax +80104b8d: 74 2e je 80104bbd argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) -80104d99: 83 ec 08 sub $0x8,%esp -80104d9c: 8d 95 64 ff ff ff lea -0x9c(%ebp),%edx -80104da2: 01 d3 add %edx,%ebx -80104da4: 53 push %ebx -80104da5: 50 push %eax -80104da6: e8 ef f3 ff ff call 8010419a -80104dab: 83 c4 10 add $0x10,%esp -80104dae: 85 c0 test %eax,%eax -80104db0: 78 4c js 80104dfe +80104b8f: 83 ec 08 sub $0x8,%esp +80104b92: 8d 95 64 ff ff ff lea -0x9c(%ebp),%edx +80104b98: 01 d3 add %edx,%ebx +80104b9a: 53 push %ebx +80104b9b: 50 push %eax +80104b9c: e8 36 f4 ff ff call 80103fd7 +80104ba1: 83 c4 10 add $0x10,%esp +80104ba4: 85 c0 test %eax,%eax +80104ba6: 78 4c js 80104bf4 for(i=0;; i++){ -80104db2: 83 c6 01 add $0x1,%esi +80104ba8: 83 c6 01 add $0x1,%esi if(i >= NELEM(argv)) -80104db5: 83 fe 20 cmp $0x20,%esi -80104db8: 75 b5 jne 80104d6f +80104bab: 83 fe 20 cmp $0x20,%esi +80104bae: 75 b5 jne 80104b65 return -1; -80104dba: b8 ff ff ff ff mov $0xffffffff,%eax +80104bb0: b8 ff ff ff ff mov $0xffffffff,%eax return -1; } return exec(path, argv); } -80104dbf: 8d 65 f4 lea -0xc(%ebp),%esp -80104dc2: 5b pop %ebx -80104dc3: 5e pop %esi -80104dc4: 5f pop %edi -80104dc5: 5d pop %ebp -80104dc6: c3 ret +80104bb5: 8d 65 f4 lea -0xc(%ebp),%esp +80104bb8: 5b pop %ebx +80104bb9: 5e pop %esi +80104bba: 5f pop %edi +80104bbb: 5d pop %ebp +80104bbc: c3 ret argv[i] = 0; -80104dc7: c7 84 b5 64 ff ff ff movl $0x0,-0x9c(%ebp,%esi,4) -80104dce: 00 00 00 00 +80104bbd: c7 84 b5 64 ff ff ff movl $0x0,-0x9c(%ebp,%esi,4) +80104bc4: 00 00 00 00 return exec(path, argv); -80104dd2: 83 ec 08 sub $0x8,%esp -80104dd5: 8d 85 64 ff ff ff lea -0x9c(%ebp),%eax -80104ddb: 50 push %eax -80104ddc: ff 75 e4 pushl -0x1c(%ebp) -80104ddf: e8 89 bb ff ff call 8010096d -80104de4: 83 c4 10 add $0x10,%esp -80104de7: eb d6 jmp 80104dbf +80104bc8: 83 ec 08 sub $0x8,%esp +80104bcb: 8d 85 64 ff ff ff lea -0x9c(%ebp),%eax +80104bd1: 50 push %eax +80104bd2: ff 75 e4 push -0x1c(%ebp) +80104bd5: e8 5c bd ff ff call 80100936 +80104bda: 83 c4 10 add $0x10,%esp +80104bdd: eb d6 jmp 80104bb5 return -1; -80104de9: b8 ff ff ff ff mov $0xffffffff,%eax -80104dee: eb cf jmp 80104dbf -80104df0: b8 ff ff ff ff mov $0xffffffff,%eax -80104df5: eb c8 jmp 80104dbf +80104bdf: b8 ff ff ff ff mov $0xffffffff,%eax +80104be4: eb cf jmp 80104bb5 +80104be6: b8 ff ff ff ff mov $0xffffffff,%eax +80104beb: eb c8 jmp 80104bb5 return -1; -80104df7: b8 ff ff ff ff mov $0xffffffff,%eax -80104dfc: eb c1 jmp 80104dbf +80104bed: b8 ff ff ff ff mov $0xffffffff,%eax +80104bf2: eb c1 jmp 80104bb5 return -1; -80104dfe: b8 ff ff ff ff mov $0xffffffff,%eax -80104e03: eb ba jmp 80104dbf +80104bf4: b8 ff ff ff ff mov $0xffffffff,%eax +80104bf9: eb ba jmp 80104bb5 -80104e05 : +80104bfb : int sys_pipe(void) { -80104e05: f3 0f 1e fb endbr32 -80104e09: 55 push %ebp -80104e0a: 89 e5 mov %esp,%ebp -80104e0c: 53 push %ebx -80104e0d: 83 ec 18 sub $0x18,%esp +80104bfb: 55 push %ebp +80104bfc: 89 e5 mov %esp,%ebp +80104bfe: 53 push %ebx +80104bff: 83 ec 18 sub $0x18,%esp int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) -80104e10: 6a 08 push $0x8 -80104e12: 8d 45 f4 lea -0xc(%ebp),%eax -80104e15: 50 push %eax -80104e16: 6a 00 push $0x0 -80104e18: e8 f4 f3 ff ff call 80104211 -80104e1d: 83 c4 10 add $0x10,%esp -80104e20: 85 c0 test %eax,%eax -80104e22: 78 46 js 80104e6a +80104c02: 6a 08 push $0x8 +80104c04: 8d 45 f4 lea -0xc(%ebp),%eax +80104c07: 50 push %eax +80104c08: 6a 00 push $0x0 +80104c0a: e8 36 f4 ff ff call 80104045 +80104c0f: 83 c4 10 add $0x10,%esp +80104c12: 85 c0 test %eax,%eax +80104c14: 78 46 js 80104c5c return -1; if(pipealloc(&rf, &wf) < 0) -80104e24: 83 ec 08 sub $0x8,%esp -80104e27: 8d 45 ec lea -0x14(%ebp),%eax -80104e2a: 50 push %eax -80104e2b: 8d 45 f0 lea -0x10(%ebp),%eax -80104e2e: 50 push %eax -80104e2f: e8 82 e0 ff ff call 80102eb6 -80104e34: 83 c4 10 add $0x10,%esp -80104e37: 85 c0 test %eax,%eax -80104e39: 78 36 js 80104e71 +80104c16: 83 ec 08 sub $0x8,%esp +80104c19: 8d 45 ec lea -0x14(%ebp),%eax +80104c1c: 50 push %eax +80104c1d: 8d 45 f0 lea -0x10(%ebp),%eax +80104c20: 50 push %eax +80104c21: e8 7c e1 ff ff call 80102da2 +80104c26: 83 c4 10 add $0x10,%esp +80104c29: 85 c0 test %eax,%eax +80104c2b: 78 36 js 80104c63 return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ -80104e3b: 8b 45 f0 mov -0x10(%ebp),%eax -80104e3e: e8 27 f5 ff ff call 8010436a -80104e43: 89 c3 mov %eax,%ebx -80104e45: 85 c0 test %eax,%eax -80104e47: 78 3c js 80104e85 -80104e49: 8b 45 ec mov -0x14(%ebp),%eax -80104e4c: e8 19 f5 ff ff call 8010436a -80104e51: 85 c0 test %eax,%eax -80104e53: 78 23 js 80104e78 +80104c2d: 8b 45 f0 mov -0x10(%ebp),%eax +80104c30: e8 59 f5 ff ff call 8010418e +80104c35: 89 c3 mov %eax,%ebx +80104c37: 85 c0 test %eax,%eax +80104c39: 78 3c js 80104c77 +80104c3b: 8b 45 ec mov -0x14(%ebp),%eax +80104c3e: e8 4b f5 ff ff call 8010418e +80104c43: 85 c0 test %eax,%eax +80104c45: 78 23 js 80104c6a myproc()->ofile[fd0] = 0; fileclose(rf); fileclose(wf); return -1; } fd[0] = fd0; -80104e55: 8b 55 f4 mov -0xc(%ebp),%edx -80104e58: 89 1a mov %ebx,(%edx) +80104c47: 8b 55 f4 mov -0xc(%ebp),%edx +80104c4a: 89 1a mov %ebx,(%edx) fd[1] = fd1; -80104e5a: 8b 55 f4 mov -0xc(%ebp),%edx -80104e5d: 89 42 04 mov %eax,0x4(%edx) +80104c4c: 8b 55 f4 mov -0xc(%ebp),%edx +80104c4f: 89 42 04 mov %eax,0x4(%edx) return 0; -80104e60: b8 00 00 00 00 mov $0x0,%eax +80104c52: b8 00 00 00 00 mov $0x0,%eax } -80104e65: 8b 5d fc mov -0x4(%ebp),%ebx -80104e68: c9 leave -80104e69: c3 ret +80104c57: 8b 5d fc mov -0x4(%ebp),%ebx +80104c5a: c9 leave +80104c5b: c3 ret return -1; -80104e6a: b8 ff ff ff ff mov $0xffffffff,%eax -80104e6f: eb f4 jmp 80104e65 +80104c5c: b8 ff ff ff ff mov $0xffffffff,%eax +80104c61: eb f4 jmp 80104c57 return -1; -80104e71: b8 ff ff ff ff mov $0xffffffff,%eax -80104e76: eb ed jmp 80104e65 +80104c63: b8 ff ff ff ff mov $0xffffffff,%eax +80104c68: eb ed jmp 80104c57 myproc()->ofile[fd0] = 0; -80104e78: e8 6d e5 ff ff call 801033ea -80104e7d: c7 44 98 28 00 00 00 movl $0x0,0x28(%eax,%ebx,4) -80104e84: 00 +80104c6a: e8 41 e6 ff ff call 801032b0 +80104c6f: c7 44 98 28 00 00 00 movl $0x0,0x28(%eax,%ebx,4) +80104c76: 00 fileclose(rf); -80104e85: 83 ec 0c sub $0xc,%esp -80104e88: ff 75 f0 pushl -0x10(%ebp) -80104e8b: e8 f1 be ff ff call 80100d81 +80104c77: 83 ec 0c sub $0xc,%esp +80104c7a: ff 75 f0 push -0x10(%ebp) +80104c7d: e8 b7 c0 ff ff call 80100d39 fileclose(wf); -80104e90: 83 c4 04 add $0x4,%esp -80104e93: ff 75 ec pushl -0x14(%ebp) -80104e96: e8 e6 be ff ff call 80100d81 +80104c82: 83 c4 04 add $0x4,%esp +80104c85: ff 75 ec push -0x14(%ebp) +80104c88: e8 ac c0 ff ff call 80100d39 return -1; -80104e9b: 83 c4 10 add $0x10,%esp -80104e9e: b8 ff ff ff ff mov $0xffffffff,%eax -80104ea3: eb c0 jmp 80104e65 +80104c8d: 83 c4 10 add $0x10,%esp +80104c90: b8 ff ff ff ff mov $0xffffffff,%eax +80104c95: eb c0 jmp 80104c57 -80104ea5 : +80104c97 : #include "mmu.h" #include "proc.h" int sys_fork(void) { -80104ea5: f3 0f 1e fb endbr32 -80104ea9: 55 push %ebp -80104eaa: 89 e5 mov %esp,%ebp -80104eac: 83 ec 08 sub $0x8,%esp +80104c97: 55 push %ebp +80104c98: 89 e5 mov %esp,%ebp +80104c9a: 83 ec 08 sub $0x8,%esp return fork(); -80104eaf: e8 b8 e6 ff ff call 8010356c +80104c9d: e8 83 e7 ff ff call 80103425 } -80104eb4: c9 leave -80104eb5: c3 ret +80104ca2: c9 leave +80104ca3: c3 ret -80104eb6 : +80104ca4 : int sys_exit(void) { -80104eb6: f3 0f 1e fb endbr32 -80104eba: 55 push %ebp -80104ebb: 89 e5 mov %esp,%ebp -80104ebd: 83 ec 08 sub $0x8,%esp +80104ca4: 55 push %ebp +80104ca5: 89 e5 mov %esp,%ebp +80104ca7: 83 ec 08 sub $0x8,%esp exit(); -80104ec0: e8 ee e8 ff ff call 801037b3 +80104caa: e8 b1 e9 ff ff call 80103660 return 0; // not reached } -80104ec5: b8 00 00 00 00 mov $0x0,%eax -80104eca: c9 leave -80104ecb: c3 ret +80104caf: b8 00 00 00 00 mov $0x0,%eax +80104cb4: c9 leave +80104cb5: c3 ret -80104ecc : +80104cb6 : int sys_wait(void) { -80104ecc: f3 0f 1e fb endbr32 -80104ed0: 55 push %ebp -80104ed1: 89 e5 mov %esp,%ebp -80104ed3: 83 ec 08 sub $0x8,%esp +80104cb6: 55 push %ebp +80104cb7: 89 e5 mov %esp,%ebp +80104cb9: 83 ec 08 sub $0x8,%esp return wait(); -80104ed6: e8 7d ea ff ff call 80103958 +80104cbc: e8 38 eb ff ff call 801037f9 } -80104edb: c9 leave -80104edc: c3 ret +80104cc1: c9 leave +80104cc2: c3 ret -80104edd : +80104cc3 : int sys_kill(void) { -80104edd: f3 0f 1e fb endbr32 -80104ee1: 55 push %ebp -80104ee2: 89 e5 mov %esp,%ebp -80104ee4: 83 ec 20 sub $0x20,%esp +80104cc3: 55 push %ebp +80104cc4: 89 e5 mov %esp,%ebp +80104cc6: 83 ec 20 sub $0x20,%esp int pid; if(argint(0, &pid) < 0) -80104ee7: 8d 45 f4 lea -0xc(%ebp),%eax -80104eea: 50 push %eax -80104eeb: 6a 00 push $0x0 -80104eed: e8 f5 f2 ff ff call 801041e7 -80104ef2: 83 c4 10 add $0x10,%esp -80104ef5: 85 c0 test %eax,%eax -80104ef7: 78 10 js 80104f09 +80104cc9: 8d 45 f4 lea -0xc(%ebp),%eax +80104ccc: 50 push %eax +80104ccd: 6a 00 push $0x0 +80104ccf: e8 4b f3 ff ff call 8010401f +80104cd4: 83 c4 10 add $0x10,%esp +80104cd7: 85 c0 test %eax,%eax +80104cd9: 78 10 js 80104ceb return -1; return kill(pid); -80104ef9: 83 ec 0c sub $0xc,%esp -80104efc: ff 75 f4 pushl -0xc(%ebp) -80104eff: e8 63 eb ff ff call 80103a67 -80104f04: 83 c4 10 add $0x10,%esp +80104cdb: 83 ec 0c sub $0xc,%esp +80104cde: ff 75 f4 push -0xc(%ebp) +80104ce1: e8 1a ec ff ff call 80103900 +80104ce6: 83 c4 10 add $0x10,%esp } -80104f07: c9 leave -80104f08: c3 ret +80104ce9: c9 leave +80104cea: c3 ret return -1; -80104f09: b8 ff ff ff ff mov $0xffffffff,%eax -80104f0e: eb f7 jmp 80104f07 +80104ceb: b8 ff ff ff ff mov $0xffffffff,%eax +80104cf0: eb f7 jmp 80104ce9 -80104f10 : +80104cf2 : int sys_getpid(void) { -80104f10: f3 0f 1e fb endbr32 -80104f14: 55 push %ebp -80104f15: 89 e5 mov %esp,%ebp -80104f17: 83 ec 08 sub $0x8,%esp +80104cf2: 55 push %ebp +80104cf3: 89 e5 mov %esp,%ebp +80104cf5: 83 ec 08 sub $0x8,%esp return myproc()->pid; -80104f1a: e8 cb e4 ff ff call 801033ea -80104f1f: 8b 40 10 mov 0x10(%eax),%eax +80104cf8: e8 b3 e5 ff ff call 801032b0 +80104cfd: 8b 40 10 mov 0x10(%eax),%eax } -80104f22: c9 leave -80104f23: c3 ret +80104d00: c9 leave +80104d01: c3 ret -80104f24 : +80104d02 : int sys_sbrk(void) { -80104f24: f3 0f 1e fb endbr32 -80104f28: 55 push %ebp -80104f29: 89 e5 mov %esp,%ebp -80104f2b: 53 push %ebx -80104f2c: 83 ec 1c sub $0x1c,%esp +80104d02: 55 push %ebp +80104d03: 89 e5 mov %esp,%ebp +80104d05: 53 push %ebx +80104d06: 83 ec 1c sub $0x1c,%esp int addr; int n; if(argint(0, &n) < 0) -80104f2f: 8d 45 f4 lea -0xc(%ebp),%eax -80104f32: 50 push %eax -80104f33: 6a 00 push $0x0 -80104f35: e8 ad f2 ff ff call 801041e7 -80104f3a: 83 c4 10 add $0x10,%esp -80104f3d: 85 c0 test %eax,%eax -80104f3f: 78 26 js 80104f67 +80104d09: 8d 45 f4 lea -0xc(%ebp),%eax +80104d0c: 50 push %eax +80104d0d: 6a 00 push $0x0 +80104d0f: e8 0b f3 ff ff call 8010401f +80104d14: 83 c4 10 add $0x10,%esp +80104d17: 85 c0 test %eax,%eax +80104d19: 78 26 js 80104d41 return -1; addr = myproc()->sz; -80104f41: e8 a4 e4 ff ff call 801033ea -80104f46: 8b 18 mov (%eax),%ebx +80104d1b: e8 90 e5 ff ff call 801032b0 +80104d20: 8b 18 mov (%eax),%ebx if(growproc(n) < 0) -80104f48: 83 ec 0c sub $0xc,%esp -80104f4b: ff 75 f4 pushl -0xc(%ebp) -80104f4e: e8 aa e5 ff ff call 801034fd -80104f53: 83 c4 10 add $0x10,%esp +80104d22: 83 ec 0c sub $0xc,%esp +80104d25: ff 75 f4 push -0xc(%ebp) +80104d28: e8 8d e6 ff ff call 801033ba +80104d2d: 83 c4 10 add $0x10,%esp return -1; -80104f56: 85 c0 test %eax,%eax -80104f58: b8 ff ff ff ff mov $0xffffffff,%eax -80104f5d: 0f 48 d8 cmovs %eax,%ebx +80104d30: 85 c0 test %eax,%eax +80104d32: b8 ff ff ff ff mov $0xffffffff,%eax +80104d37: 0f 48 d8 cmovs %eax,%ebx return addr; } -80104f60: 89 d8 mov %ebx,%eax -80104f62: 8b 5d fc mov -0x4(%ebp),%ebx -80104f65: c9 leave -80104f66: c3 ret +80104d3a: 89 d8 mov %ebx,%eax +80104d3c: 8b 5d fc mov -0x4(%ebp),%ebx +80104d3f: c9 leave +80104d40: c3 ret return -1; -80104f67: bb ff ff ff ff mov $0xffffffff,%ebx -80104f6c: eb f2 jmp 80104f60 +80104d41: bb ff ff ff ff mov $0xffffffff,%ebx +80104d46: eb f2 jmp 80104d3a -80104f6e : +80104d48 : int sys_sleep(void) { -80104f6e: f3 0f 1e fb endbr32 -80104f72: 55 push %ebp -80104f73: 89 e5 mov %esp,%ebp -80104f75: 53 push %ebx -80104f76: 83 ec 1c sub $0x1c,%esp +80104d48: 55 push %ebp +80104d49: 89 e5 mov %esp,%ebp +80104d4b: 53 push %ebx +80104d4c: 83 ec 1c sub $0x1c,%esp int n; uint ticks0; if(argint(0, &n) < 0) -80104f79: 8d 45 f4 lea -0xc(%ebp),%eax -80104f7c: 50 push %eax -80104f7d: 6a 00 push $0x0 -80104f7f: e8 63 f2 ff ff call 801041e7 -80104f84: 83 c4 10 add $0x10,%esp -80104f87: 85 c0 test %eax,%eax -80104f89: 78 79 js 80105004 +80104d4f: 8d 45 f4 lea -0xc(%ebp),%eax +80104d52: 50 push %eax +80104d53: 6a 00 push $0x0 +80104d55: e8 c5 f2 ff ff call 8010401f +80104d5a: 83 c4 10 add $0x10,%esp +80104d5d: 85 c0 test %eax,%eax +80104d5f: 78 79 js 80104dda return -1; acquire(&tickslock); -80104f8b: 83 ec 0c sub $0xc,%esp -80104f8e: 68 c0 61 11 80 push $0x801161c0 -80104f93: e8 01 ef ff ff call 80103e99 +80104d61: 83 ec 0c sub $0xc,%esp +80104d64: 68 c0 35 11 80 push $0x801135c0 +80104d69: e8 93 ef ff ff call 80103d01 ticks0 = ticks; -80104f98: 8b 1d 00 6a 11 80 mov 0x80116a00,%ebx +80104d6e: 8b 1d a0 35 11 80 mov 0x801135a0,%ebx while(ticks - ticks0 < n){ -80104f9e: 83 c4 10 add $0x10,%esp -80104fa1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) -80104fa5: 74 2c je 80104fd3 +80104d74: 83 c4 10 add $0x10,%esp +80104d77: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) +80104d7b: 74 2c je 80104da9 if(myproc()->killed){ -80104fa7: e8 3e e4 ff ff call 801033ea -80104fac: 83 78 24 00 cmpl $0x0,0x24(%eax) -80104fb0: 75 3b jne 80104fed +80104d7d: e8 2e e5 ff ff call 801032b0 +80104d82: 83 78 24 00 cmpl $0x0,0x24(%eax) +80104d86: 75 3b jne 80104dc3 release(&tickslock); return -1; } sleep(&ticks, &tickslock); -80104fb2: 83 ec 08 sub $0x8,%esp -80104fb5: 68 c0 61 11 80 push $0x801161c0 -80104fba: 68 00 6a 11 80 push $0x80116a00 -80104fbf: e8 f0 e8 ff ff call 801038b4 +80104d88: 83 ec 08 sub $0x8,%esp +80104d8b: 68 c0 35 11 80 push $0x801135c0 +80104d90: 68 a0 35 11 80 push $0x801135a0 +80104d95: e8 bf e9 ff ff call 80103759 while(ticks - ticks0 < n){ -80104fc4: a1 00 6a 11 80 mov 0x80116a00,%eax -80104fc9: 29 d8 sub %ebx,%eax -80104fcb: 83 c4 10 add $0x10,%esp -80104fce: 3b 45 f4 cmp -0xc(%ebp),%eax -80104fd1: 72 d4 jb 80104fa7 +80104d9a: a1 a0 35 11 80 mov 0x801135a0,%eax +80104d9f: 29 d8 sub %ebx,%eax +80104da1: 83 c4 10 add $0x10,%esp +80104da4: 3b 45 f4 cmp -0xc(%ebp),%eax +80104da7: 72 d4 jb 80104d7d } release(&tickslock); -80104fd3: 83 ec 0c sub $0xc,%esp -80104fd6: 68 c0 61 11 80 push $0x801161c0 -80104fdb: e8 24 ef ff ff call 80103f04 +80104da9: 83 ec 0c sub $0xc,%esp +80104dac: 68 c0 35 11 80 push $0x801135c0 +80104db1: e8 b2 ef ff ff call 80103d68 return 0; -80104fe0: 83 c4 10 add $0x10,%esp -80104fe3: b8 00 00 00 00 mov $0x0,%eax +80104db6: 83 c4 10 add $0x10,%esp +80104db9: b8 00 00 00 00 mov $0x0,%eax } -80104fe8: 8b 5d fc mov -0x4(%ebp),%ebx -80104feb: c9 leave -80104fec: c3 ret +80104dbe: 8b 5d fc mov -0x4(%ebp),%ebx +80104dc1: c9 leave +80104dc2: c3 ret release(&tickslock); -80104fed: 83 ec 0c sub $0xc,%esp -80104ff0: 68 c0 61 11 80 push $0x801161c0 -80104ff5: e8 0a ef ff ff call 80103f04 +80104dc3: 83 ec 0c sub $0xc,%esp +80104dc6: 68 c0 35 11 80 push $0x801135c0 +80104dcb: e8 98 ef ff ff call 80103d68 return -1; -80104ffa: 83 c4 10 add $0x10,%esp -80104ffd: b8 ff ff ff ff mov $0xffffffff,%eax -80105002: eb e4 jmp 80104fe8 +80104dd0: 83 c4 10 add $0x10,%esp +80104dd3: b8 ff ff ff ff mov $0xffffffff,%eax +80104dd8: eb e4 jmp 80104dbe return -1; -80105004: b8 ff ff ff ff mov $0xffffffff,%eax -80105009: eb dd jmp 80104fe8 +80104dda: b8 ff ff ff ff mov $0xffffffff,%eax +80104ddf: eb dd jmp 80104dbe -8010500b : +80104de1 : // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { -8010500b: f3 0f 1e fb endbr32 -8010500f: 55 push %ebp -80105010: 89 e5 mov %esp,%ebp -80105012: 53 push %ebx -80105013: 83 ec 10 sub $0x10,%esp +80104de1: 55 push %ebp +80104de2: 89 e5 mov %esp,%ebp +80104de4: 53 push %ebx +80104de5: 83 ec 10 sub $0x10,%esp uint xticks; acquire(&tickslock); -80105016: 68 c0 61 11 80 push $0x801161c0 -8010501b: e8 79 ee ff ff call 80103e99 +80104de8: 68 c0 35 11 80 push $0x801135c0 +80104ded: e8 0f ef ff ff call 80103d01 xticks = ticks; -80105020: 8b 1d 00 6a 11 80 mov 0x80116a00,%ebx +80104df2: 8b 1d a0 35 11 80 mov 0x801135a0,%ebx release(&tickslock); -80105026: c7 04 24 c0 61 11 80 movl $0x801161c0,(%esp) -8010502d: e8 d2 ee ff ff call 80103f04 +80104df8: c7 04 24 c0 35 11 80 movl $0x801135c0,(%esp) +80104dff: e8 64 ef ff ff call 80103d68 return xticks; } -80105032: 89 d8 mov %ebx,%eax -80105034: 8b 5d fc mov -0x4(%ebp),%ebx -80105037: c9 leave -80105038: c3 ret +80104e04: 89 d8 mov %ebx,%eax +80104e06: 8b 5d fc mov -0x4(%ebp),%ebx +80104e09: c9 leave +80104e0a: c3 ret -80105039 : +80104e0b : int sys_ps(void) { -80105039: f3 0f 1e fb endbr32 -8010503d: 55 push %ebp -8010503e: 89 e5 mov %esp,%ebp -80105040: 83 ec 08 sub $0x8,%esp +80104e0b: 55 push %ebp +80104e0c: 89 e5 mov %esp,%ebp +80104e0e: 83 ec 08 sub $0x8,%esp ps(); -80105043: e8 4f eb ff ff call 80103b97 +80104e11: e8 12 ec ff ff call 80103a28 return 0; } -80105048: b8 00 00 00 00 mov $0x0,%eax -8010504d: c9 leave -8010504e: c3 ret +80104e16: b8 00 00 00 00 mov $0x0,%eax +80104e1b: c9 leave +80104e1c: c3 ret -8010504f : +80104e1d : # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds -8010504f: 1e push %ds +80104e1d: 1e push %ds pushl %es -80105050: 06 push %es +80104e1e: 06 push %es pushl %fs -80105051: 0f a0 push %fs +80104e1f: 0f a0 push %fs pushl %gs -80105053: 0f a8 push %gs +80104e21: 0f a8 push %gs pushal -80105055: 60 pusha +80104e23: 60 pusha # Set up data segments. movw $(SEG_KDATA<<3), %ax -80105056: 66 b8 10 00 mov $0x10,%ax +80104e24: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds -8010505a: 8e d8 mov %eax,%ds +80104e28: 8e d8 mov %eax,%ds movw %ax, %es -8010505c: 8e c0 mov %eax,%es +80104e2a: 8e c0 mov %eax,%es # Call trap(tf), where tf=%esp pushl %esp -8010505e: 54 push %esp +80104e2c: 54 push %esp call trap -8010505f: e8 c5 00 00 00 call 80105129 +80104e2d: e8 bd 00 00 00 call 80104eef addl $4, %esp -80105064: 83 c4 04 add $0x4,%esp +80104e32: 83 c4 04 add $0x4,%esp -80105067 : +80104e35 : # Return falls through to trapret... .globl trapret trapret: popal -80105067: 61 popa +80104e35: 61 popa popl %gs -80105068: 0f a9 pop %gs +80104e36: 0f a9 pop %gs popl %fs -8010506a: 0f a1 pop %fs +80104e38: 0f a1 pop %fs popl %es -8010506c: 07 pop %es +80104e3a: 07 pop %es popl %ds -8010506d: 1f pop %ds +80104e3b: 1f pop %ds addl $0x8, %esp # trapno and errcode -8010506e: 83 c4 08 add $0x8,%esp +80104e3c: 83 c4 08 add $0x8,%esp iret -80105071: cf iret +80104e3f: cf iret -80105072 : +80104e40 : struct spinlock tickslock; uint ticks; void tvinit(void) { -80105072: f3 0f 1e fb endbr32 -80105076: 55 push %ebp -80105077: 89 e5 mov %esp,%ebp -80105079: 83 ec 08 sub $0x8,%esp +80104e40: 55 push %ebp +80104e41: 89 e5 mov %esp,%ebp +80104e43: 83 ec 08 sub $0x8,%esp int i; for(i = 0; i < 256; i++) -8010507c: b8 00 00 00 00 mov $0x0,%eax +80104e46: b8 00 00 00 00 mov $0x0,%eax SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); -80105081: 8b 14 85 08 b0 10 80 mov -0x7fef4ff8(,%eax,4),%edx -80105088: 66 89 14 c5 00 62 11 mov %dx,-0x7fee9e00(,%eax,8) -8010508f: 80 -80105090: 66 c7 04 c5 02 62 11 movw $0x8,-0x7fee9dfe(,%eax,8) -80105097: 80 08 00 -8010509a: c6 04 c5 04 62 11 80 movb $0x0,-0x7fee9dfc(,%eax,8) -801050a1: 00 -801050a2: c6 04 c5 05 62 11 80 movb $0x8e,-0x7fee9dfb(,%eax,8) -801050a9: 8e -801050aa: c1 ea 10 shr $0x10,%edx -801050ad: 66 89 14 c5 06 62 11 mov %dx,-0x7fee9dfa(,%eax,8) -801050b4: 80 +80104e4b: 8b 14 85 08 b0 10 80 mov -0x7fef4ff8(,%eax,4),%edx +80104e52: 66 89 14 c5 00 36 11 mov %dx,-0x7feeca00(,%eax,8) +80104e59: 80 +80104e5a: 66 c7 04 c5 02 36 11 movw $0x8,-0x7feec9fe(,%eax,8) +80104e61: 80 08 00 +80104e64: c6 04 c5 04 36 11 80 movb $0x0,-0x7feec9fc(,%eax,8) +80104e6b: 00 +80104e6c: c6 04 c5 05 36 11 80 movb $0x8e,-0x7feec9fb(,%eax,8) +80104e73: 8e +80104e74: c1 ea 10 shr $0x10,%edx +80104e77: 66 89 14 c5 06 36 11 mov %dx,-0x7feec9fa(,%eax,8) +80104e7e: 80 for(i = 0; i < 256; i++) -801050b5: 83 c0 01 add $0x1,%eax -801050b8: 3d 00 01 00 00 cmp $0x100,%eax -801050bd: 75 c2 jne 80105081 +80104e7f: 83 c0 01 add $0x1,%eax +80104e82: 3d 00 01 00 00 cmp $0x100,%eax +80104e87: 75 c2 jne 80104e4b SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); -801050bf: a1 08 b1 10 80 mov 0x8010b108,%eax -801050c4: 66 a3 00 64 11 80 mov %ax,0x80116400 -801050ca: 66 c7 05 02 64 11 80 movw $0x8,0x80116402 -801050d1: 08 00 -801050d3: c6 05 04 64 11 80 00 movb $0x0,0x80116404 -801050da: c6 05 05 64 11 80 ef movb $0xef,0x80116405 -801050e1: c1 e8 10 shr $0x10,%eax -801050e4: 66 a3 06 64 11 80 mov %ax,0x80116406 +80104e89: a1 08 b1 10 80 mov 0x8010b108,%eax +80104e8e: 66 a3 00 38 11 80 mov %ax,0x80113800 +80104e94: 66 c7 05 02 38 11 80 movw $0x8,0x80113802 +80104e9b: 08 00 +80104e9d: c6 05 04 38 11 80 00 movb $0x0,0x80113804 +80104ea4: c6 05 05 38 11 80 ef movb $0xef,0x80113805 +80104eab: c1 e8 10 shr $0x10,%eax +80104eae: 66 a3 06 38 11 80 mov %ax,0x80113806 initlock(&tickslock, "time"); -801050ea: 83 ec 08 sub $0x8,%esp -801050ed: 68 41 80 10 80 push $0x80108041 -801050f2: 68 c0 61 11 80 push $0x801161c0 -801050f7: e8 41 ec ff ff call 80103d3d +80104eb4: 83 ec 08 sub $0x8,%esp +80104eb7: 68 61 7d 10 80 push $0x80107d61 +80104ebc: 68 c0 35 11 80 push $0x801135c0 +80104ec1: e8 f2 ec ff ff call 80103bb8 } -801050fc: 83 c4 10 add $0x10,%esp -801050ff: c9 leave -80105100: c3 ret +80104ec6: 83 c4 10 add $0x10,%esp +80104ec9: c9 leave +80104eca: c3 ret -80105101 : +80104ecb : void idtinit(void) { -80105101: f3 0f 1e fb endbr32 -80105105: 55 push %ebp -80105106: 89 e5 mov %esp,%ebp -80105108: 83 ec 10 sub $0x10,%esp +80104ecb: 55 push %ebp +80104ecc: 89 e5 mov %esp,%ebp +80104ece: 83 ec 10 sub $0x10,%esp pd[0] = size-1; -8010510b: 66 c7 45 fa ff 07 movw $0x7ff,-0x6(%ebp) +80104ed1: 66 c7 45 fa ff 07 movw $0x7ff,-0x6(%ebp) pd[1] = (uint)p; -80105111: b8 00 62 11 80 mov $0x80116200,%eax -80105116: 66 89 45 fc mov %ax,-0x4(%ebp) +80104ed7: b8 00 36 11 80 mov $0x80113600,%eax +80104edc: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; -8010511a: c1 e8 10 shr $0x10,%eax -8010511d: 66 89 45 fe mov %ax,-0x2(%ebp) +80104ee0: c1 e8 10 shr $0x10,%eax +80104ee3: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); -80105121: 8d 45 fa lea -0x6(%ebp),%eax -80105124: 0f 01 18 lidtl (%eax) +80104ee7: 8d 45 fa lea -0x6(%ebp),%eax +80104eea: 0f 01 18 lidtl (%eax) lidt(idt, sizeof(idt)); } -80105127: c9 leave -80105128: c3 ret +80104eed: c9 leave +80104eee: c3 ret -80105129 : +80104eef : //PAGEBREAK: 41 void trap(struct trapframe *tf) { -80105129: f3 0f 1e fb endbr32 -8010512d: 55 push %ebp -8010512e: 89 e5 mov %esp,%ebp -80105130: 57 push %edi -80105131: 56 push %esi -80105132: 53 push %ebx -80105133: 83 ec 1c sub $0x1c,%esp -80105136: 8b 5d 08 mov 0x8(%ebp),%ebx +80104eef: 55 push %ebp +80104ef0: 89 e5 mov %esp,%ebp +80104ef2: 57 push %edi +80104ef3: 56 push %esi +80104ef4: 53 push %ebx +80104ef5: 83 ec 1c sub $0x1c,%esp +80104ef8: 8b 5d 08 mov 0x8(%ebp),%ebx if(tf->trapno == T_SYSCALL){ -80105139: 8b 43 30 mov 0x30(%ebx),%eax -8010513c: 83 f8 40 cmp $0x40,%eax -8010513f: 74 14 je 80105155 +80104efb: 8b 43 30 mov 0x30(%ebx),%eax +80104efe: 83 f8 40 cmp $0x40,%eax +80104f01: 74 13 je 80104f16 if(myproc()->killed) exit(); return; } switch(tf->trapno){ -80105141: 83 e8 20 sub $0x20,%eax -80105144: 83 f8 1f cmp $0x1f,%eax -80105147: 0f 87 38 01 00 00 ja 80105285 -8010514d: 3e ff 24 85 e8 80 10 notrack jmp *-0x7fef7f18(,%eax,4) -80105154: 80 +80104f03: 83 e8 20 sub $0x20,%eax +80104f06: 83 f8 1f cmp $0x1f,%eax +80104f09: 0f 87 37 01 00 00 ja 80105046 +80104f0f: ff 24 85 08 7e 10 80 jmp *-0x7fef81f8(,%eax,4) if(myproc()->killed) -80105155: e8 90 e2 ff ff call 801033ea -8010515a: 83 78 24 00 cmpl $0x0,0x24(%eax) -8010515e: 75 1f jne 8010517f +80104f16: e8 95 e3 ff ff call 801032b0 +80104f1b: 83 78 24 00 cmpl $0x0,0x24(%eax) +80104f1f: 75 1f jne 80104f40 myproc()->tf = tf; -80105160: e8 85 e2 ff ff call 801033ea -80105165: 89 58 18 mov %ebx,0x18(%eax) +80104f21: e8 8a e3 ff ff call 801032b0 +80104f26: 89 58 18 mov %ebx,0x18(%eax) syscall(); -80105168: e8 40 f1 ff ff call 801042ad +80104f29: e8 a7 f1 ff ff call 801040d5 if(myproc()->killed) -8010516d: e8 78 e2 ff ff call 801033ea -80105172: 83 78 24 00 cmpl $0x0,0x24(%eax) -80105176: 74 7e je 801051f6 +80104f2e: e8 7d e3 ff ff call 801032b0 +80104f33: 83 78 24 00 cmpl $0x0,0x24(%eax) +80104f37: 74 7e je 80104fb7 exit(); -80105178: e8 36 e6 ff ff call 801037b3 -8010517d: eb 77 jmp 801051f6 +80104f39: e8 22 e7 ff ff call 80103660 +80104f3e: eb 77 jmp 80104fb7 exit(); -8010517f: e8 2f e6 ff ff call 801037b3 -80105184: eb da jmp 80105160 +80104f40: e8 1b e7 ff ff call 80103660 +80104f45: eb da jmp 80104f21 case T_IRQ0 + IRQ_TIMER: if(cpuid() == 0){ -80105186: e8 40 e2 ff ff call 801033cb -8010518b: 85 c0 test %eax,%eax -8010518d: 74 6f je 801051fe +80104f47: e8 49 e3 ff ff call 80103295 +80104f4c: 85 c0 test %eax,%eax +80104f4e: 74 6f je 80104fbf acquire(&tickslock); ticks++; wakeup(&ticks); release(&tickslock); } lapiceoi(); -8010518f: e8 8a d3 ff ff call 8010251e +80104f50: e8 db d4 ff ff call 80102430 } // 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) -80105194: e8 51 e2 ff ff call 801033ea -80105199: 85 c0 test %eax,%eax -8010519b: 74 1c je 801051b9 -8010519d: e8 48 e2 ff ff call 801033ea -801051a2: 83 78 24 00 cmpl $0x0,0x24(%eax) -801051a6: 74 11 je 801051b9 -801051a8: 0f b7 43 3c movzwl 0x3c(%ebx),%eax -801051ac: 83 e0 03 and $0x3,%eax -801051af: 66 83 f8 03 cmp $0x3,%ax -801051b3: 0f 84 62 01 00 00 je 8010531b +80104f55: e8 56 e3 ff ff call 801032b0 +80104f5a: 85 c0 test %eax,%eax +80104f5c: 74 1c je 80104f7a +80104f5e: e8 4d e3 ff ff call 801032b0 +80104f63: 83 78 24 00 cmpl $0x0,0x24(%eax) +80104f67: 74 11 je 80104f7a +80104f69: 0f b7 43 3c movzwl 0x3c(%ebx),%eax +80104f6d: 83 e0 03 and $0x3,%eax +80104f70: 66 83 f8 03 cmp $0x3,%ax +80104f74: 0f 84 62 01 00 00 je 801050dc exit(); // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(myproc() && myproc()->state == RUNNING && -801051b9: e8 2c e2 ff ff call 801033ea -801051be: 85 c0 test %eax,%eax -801051c0: 74 0f je 801051d1 -801051c2: e8 23 e2 ff ff call 801033ea -801051c7: 83 78 0c 04 cmpl $0x4,0xc(%eax) -801051cb: 0f 84 54 01 00 00 je 80105325 +80104f7a: e8 31 e3 ff ff call 801032b0 +80104f7f: 85 c0 test %eax,%eax +80104f81: 74 0f je 80104f92 +80104f83: e8 28 e3 ff ff call 801032b0 +80104f88: 83 78 0c 04 cmpl $0x4,0xc(%eax) +80104f8c: 0f 84 54 01 00 00 je 801050e6 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) -801051d1: e8 14 e2 ff ff call 801033ea -801051d6: 85 c0 test %eax,%eax -801051d8: 74 1c je 801051f6 -801051da: e8 0b e2 ff ff call 801033ea -801051df: 83 78 24 00 cmpl $0x0,0x24(%eax) -801051e3: 74 11 je 801051f6 -801051e5: 0f b7 43 3c movzwl 0x3c(%ebx),%eax -801051e9: 83 e0 03 and $0x3,%eax -801051ec: 66 83 f8 03 cmp $0x3,%ax -801051f0: 0f 84 43 01 00 00 je 80105339 +80104f92: e8 19 e3 ff ff call 801032b0 +80104f97: 85 c0 test %eax,%eax +80104f99: 74 1c je 80104fb7 +80104f9b: e8 10 e3 ff ff call 801032b0 +80104fa0: 83 78 24 00 cmpl $0x0,0x24(%eax) +80104fa4: 74 11 je 80104fb7 +80104fa6: 0f b7 43 3c movzwl 0x3c(%ebx),%eax +80104faa: 83 e0 03 and $0x3,%eax +80104fad: 66 83 f8 03 cmp $0x3,%ax +80104fb1: 0f 84 43 01 00 00 je 801050fa exit(); } -801051f6: 8d 65 f4 lea -0xc(%ebp),%esp -801051f9: 5b pop %ebx -801051fa: 5e pop %esi -801051fb: 5f pop %edi -801051fc: 5d pop %ebp -801051fd: c3 ret +80104fb7: 8d 65 f4 lea -0xc(%ebp),%esp +80104fba: 5b pop %ebx +80104fbb: 5e pop %esi +80104fbc: 5f pop %edi +80104fbd: 5d pop %ebp +80104fbe: c3 ret acquire(&tickslock); -801051fe: 83 ec 0c sub $0xc,%esp -80105201: 68 c0 61 11 80 push $0x801161c0 -80105206: e8 8e ec ff ff call 80103e99 +80104fbf: 83 ec 0c sub $0xc,%esp +80104fc2: 68 c0 35 11 80 push $0x801135c0 +80104fc7: e8 35 ed ff ff call 80103d01 ticks++; -8010520b: 83 05 00 6a 11 80 01 addl $0x1,0x80116a00 +80104fcc: 83 05 a0 35 11 80 01 addl $0x1,0x801135a0 wakeup(&ticks); -80105212: c7 04 24 00 6a 11 80 movl $0x80116a00,(%esp) -80105219: e8 1c e8 ff ff call 80103a3a +80104fd3: c7 04 24 a0 35 11 80 movl $0x801135a0,(%esp) +80104fda: e8 f8 e8 ff ff call 801038d7 release(&tickslock); -8010521e: c7 04 24 c0 61 11 80 movl $0x801161c0,(%esp) -80105225: e8 da ec ff ff call 80103f04 -8010522a: 83 c4 10 add $0x10,%esp -8010522d: e9 5d ff ff ff jmp 8010518f +80104fdf: c7 04 24 c0 35 11 80 movl $0x801135c0,(%esp) +80104fe6: e8 7d ed ff ff call 80103d68 +80104feb: 83 c4 10 add $0x10,%esp +80104fee: e9 5d ff ff ff jmp 80104f50 ideintr(); -80105232: e8 1d cc ff ff call 80101e54 +80104ff3: e8 ad cd ff ff call 80101da5 lapiceoi(); -80105237: e8 e2 d2 ff ff call 8010251e +80104ff8: e8 33 d4 ff ff call 80102430 break; -8010523c: e9 53 ff ff ff jmp 80105194 +80104ffd: e9 53 ff ff ff jmp 80104f55 kbdintr(); -80105241: e8 06 d1 ff ff call 8010234c +80105002: e8 63 d2 ff ff call 8010226a lapiceoi(); -80105246: e8 d3 d2 ff ff call 8010251e +80105007: e8 24 d4 ff ff call 80102430 break; -8010524b: e9 44 ff ff ff jmp 80105194 +8010500c: e9 44 ff ff ff jmp 80104f55 uartintr(); -80105250: e8 21 02 00 00 call 80105476 +80105011: e8 15 02 00 00 call 8010522b lapiceoi(); -80105255: e8 c4 d2 ff ff call 8010251e +80105016: e8 15 d4 ff ff call 80102430 break; -8010525a: e9 35 ff ff ff jmp 80105194 +8010501b: e9 35 ff ff ff jmp 80104f55 cprintf("cpu%d: spurious interrupt at %x:%x\n", -8010525f: 8b 7b 38 mov 0x38(%ebx),%edi -80105262: 0f b7 73 3c movzwl 0x3c(%ebx),%esi -80105266: e8 60 e1 ff ff call 801033cb -8010526b: 57 push %edi -8010526c: 56 push %esi -8010526d: 50 push %eax -8010526e: 68 4c 80 10 80 push $0x8010804c -80105273: e8 b4 b3 ff ff call 8010062c +80105020: 8b 7b 38 mov 0x38(%ebx),%edi +80105023: 0f b7 73 3c movzwl 0x3c(%ebx),%esi +80105027: e8 69 e2 ff ff call 80103295 +8010502c: 57 push %edi +8010502d: 56 push %esi +8010502e: 50 push %eax +8010502f: 68 6c 7d 10 80 push $0x80107d6c +80105034: e8 c8 b5 ff ff call 80100601 lapiceoi(); -80105278: e8 a1 d2 ff ff call 8010251e +80105039: e8 f2 d3 ff ff call 80102430 break; -8010527d: 83 c4 10 add $0x10,%esp -80105280: e9 0f ff ff ff jmp 80105194 +8010503e: 83 c4 10 add $0x10,%esp +80105041: e9 0f ff ff ff jmp 80104f55 if(myproc() == 0 || (tf->cs&3) == 0){ -80105285: e8 60 e1 ff ff call 801033ea -8010528a: 85 c0 test %eax,%eax -8010528c: 74 62 je 801052f0 -8010528e: f6 43 3c 03 testb $0x3,0x3c(%ebx) -80105292: 74 5c je 801052f0 +80105046: e8 65 e2 ff ff call 801032b0 +8010504b: 85 c0 test %eax,%eax +8010504d: 74 62 je 801050b1 +8010504f: f6 43 3c 03 testb $0x3,0x3c(%ebx) +80105053: 74 5c je 801050b1 static inline uint rcr2(void) { uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); -80105294: 0f 20 d7 mov %cr2,%edi +80105055: 0f 20 d7 mov %cr2,%edi cprintf("pid %d %s: trap %d err %d on cpu %d " -80105297: 8b 73 38 mov 0x38(%ebx),%esi -8010529a: e8 2c e1 ff ff call 801033cb -8010529f: 89 45 e4 mov %eax,-0x1c(%ebp) -801052a2: 8b 4b 34 mov 0x34(%ebx),%ecx -801052a5: 89 4d e0 mov %ecx,-0x20(%ebp) -801052a8: 8b 53 30 mov 0x30(%ebx),%edx -801052ab: 89 55 dc mov %edx,-0x24(%ebp) +80105058: 8b 73 38 mov 0x38(%ebx),%esi +8010505b: e8 35 e2 ff ff call 80103295 +80105060: 89 45 e4 mov %eax,-0x1c(%ebp) +80105063: 8b 4b 34 mov 0x34(%ebx),%ecx +80105066: 89 4d e0 mov %ecx,-0x20(%ebp) +80105069: 8b 53 30 mov 0x30(%ebx),%edx +8010506c: 89 55 dc mov %edx,-0x24(%ebp) myproc()->pid, myproc()->name, tf->trapno, -801052ae: e8 37 e1 ff ff call 801033ea -801052b3: 89 45 d8 mov %eax,-0x28(%ebp) -801052b6: e8 2f e1 ff ff call 801033ea -801052bb: 89 c2 mov %eax,%edx +8010506f: e8 3c e2 ff ff call 801032b0 +80105074: 89 45 d8 mov %eax,-0x28(%ebp) +80105077: e8 34 e2 ff ff call 801032b0 +8010507c: 89 c2 mov %eax,%edx cprintf("pid %d %s: trap %d err %d on cpu %d " -801052bd: 57 push %edi -801052be: 56 push %esi -801052bf: ff 75 e4 pushl -0x1c(%ebp) -801052c2: ff 75 e0 pushl -0x20(%ebp) -801052c5: ff 75 dc pushl -0x24(%ebp) +8010507e: 57 push %edi +8010507f: 56 push %esi +80105080: ff 75 e4 push -0x1c(%ebp) +80105083: ff 75 e0 push -0x20(%ebp) +80105086: ff 75 dc push -0x24(%ebp) myproc()->pid, myproc()->name, tf->trapno, -801052c8: 8b 45 d8 mov -0x28(%ebp),%eax -801052cb: 83 c0 6c add $0x6c,%eax +80105089: 8b 45 d8 mov -0x28(%ebp),%eax +8010508c: 83 c0 6c add $0x6c,%eax cprintf("pid %d %s: trap %d err %d on cpu %d " -801052ce: 50 push %eax -801052cf: ff 72 10 pushl 0x10(%edx) -801052d2: 68 a4 80 10 80 push $0x801080a4 -801052d7: e8 50 b3 ff ff call 8010062c +8010508f: 50 push %eax +80105090: ff 72 10 push 0x10(%edx) +80105093: 68 c4 7d 10 80 push $0x80107dc4 +80105098: e8 64 b5 ff ff call 80100601 myproc()->killed = 1; -801052dc: 83 c4 20 add $0x20,%esp -801052df: e8 06 e1 ff ff call 801033ea -801052e4: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) -801052eb: e9 a4 fe ff ff jmp 80105194 -801052f0: 0f 20 d7 mov %cr2,%edi +8010509d: 83 c4 20 add $0x20,%esp +801050a0: e8 0b e2 ff ff call 801032b0 +801050a5: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) +801050ac: e9 a4 fe ff ff jmp 80104f55 +801050b1: 0f 20 d7 mov %cr2,%edi cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", -801052f3: 8b 73 38 mov 0x38(%ebx),%esi -801052f6: e8 d0 e0 ff ff call 801033cb -801052fb: 83 ec 0c sub $0xc,%esp -801052fe: 57 push %edi -801052ff: 56 push %esi -80105300: 50 push %eax -80105301: ff 73 30 pushl 0x30(%ebx) -80105304: 68 70 80 10 80 push $0x80108070 -80105309: e8 1e b3 ff ff call 8010062c +801050b4: 8b 73 38 mov 0x38(%ebx),%esi +801050b7: e8 d9 e1 ff ff call 80103295 +801050bc: 83 ec 0c sub $0xc,%esp +801050bf: 57 push %edi +801050c0: 56 push %esi +801050c1: 50 push %eax +801050c2: ff 73 30 push 0x30(%ebx) +801050c5: 68 90 7d 10 80 push $0x80107d90 +801050ca: e8 32 b5 ff ff call 80100601 panic("trap"); -8010530e: 83 c4 14 add $0x14,%esp -80105311: 68 46 80 10 80 push $0x80108046 -80105316: e8 3d b0 ff ff call 80100358 +801050cf: 83 c4 14 add $0x14,%esp +801050d2: 68 66 7d 10 80 push $0x80107d66 +801050d7: e8 64 b2 ff ff call 80100340 exit(); -8010531b: e8 93 e4 ff ff call 801037b3 -80105320: e9 94 fe ff ff jmp 801051b9 +801050dc: e8 7f e5 ff ff call 80103660 +801050e1: e9 94 fe ff ff jmp 80104f7a if(myproc() && myproc()->state == RUNNING && -80105325: 83 7b 30 20 cmpl $0x20,0x30(%ebx) -80105329: 0f 85 a2 fe ff ff jne 801051d1 +801050e6: 83 7b 30 20 cmpl $0x20,0x30(%ebx) +801050ea: 0f 85 a2 fe ff ff jne 80104f92 yield(); -8010532f: e8 4a e5 ff ff call 8010387e -80105334: e9 98 fe ff ff jmp 801051d1 +801050f0: e8 32 e6 ff ff call 80103727 +801050f5: e9 98 fe ff ff jmp 80104f92 exit(); -80105339: e8 75 e4 ff ff call 801037b3 -8010533e: e9 b3 fe ff ff jmp 801051f6 +801050fa: e8 61 e5 ff ff call 80103660 +801050ff: e9 b3 fe ff ff jmp 80104fb7 -80105343 : - outb(COM1+0, c); +80105104 : } static int uartgetc(void) { -80105343: f3 0f 1e fb endbr32 if(!uart) -80105347: 83 3d bc b5 10 80 00 cmpl $0x0,0x8010b5bc -8010534e: 74 14 je 80105364 +80105104: 83 3d 00 3e 11 80 00 cmpl $0x0,0x80113e00 +8010510b: 74 14 je 80105121 asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -80105350: ba fd 03 00 00 mov $0x3fd,%edx -80105355: ec in (%dx),%al +8010510d: ba fd 03 00 00 mov $0x3fd,%edx +80105112: ec in (%dx),%al return -1; if(!(inb(COM1+5) & 0x01)) -80105356: a8 01 test $0x1,%al -80105358: 74 10 je 8010536a -8010535a: ba f8 03 00 00 mov $0x3f8,%edx -8010535f: ec in (%dx),%al +80105113: a8 01 test $0x1,%al +80105115: 74 10 je 80105127 +80105117: ba f8 03 00 00 mov $0x3f8,%edx +8010511c: ec in (%dx),%al return -1; return inb(COM1+0); -80105360: 0f b6 c0 movzbl %al,%eax -80105363: c3 ret +8010511d: 0f b6 c0 movzbl %al,%eax +80105120: c3 ret return -1; -80105364: b8 ff ff ff ff mov $0xffffffff,%eax -80105369: c3 ret +80105121: b8 ff ff ff ff mov $0xffffffff,%eax +80105126: c3 ret return -1; -8010536a: b8 ff ff ff ff mov $0xffffffff,%eax +80105127: b8 ff ff ff ff mov $0xffffffff,%eax } -8010536f: c3 ret +8010512c: c3 ret -80105370 : -{ -80105370: f3 0f 1e fb endbr32 +8010512d : if(!uart) -80105374: 83 3d bc b5 10 80 00 cmpl $0x0,0x8010b5bc -8010537b: 74 4f je 801053cc -{ -8010537d: 55 push %ebp -8010537e: 89 e5 mov %esp,%ebp -80105380: 56 push %esi -80105381: 53 push %ebx -80105382: ba fd 03 00 00 mov $0x3fd,%edx -80105387: ec in (%dx),%al +8010512d: 83 3d 00 3e 11 80 00 cmpl $0x0,0x80113e00 +80105134: 74 4f je 80105185 +{ +80105136: 55 push %ebp +80105137: 89 e5 mov %esp,%ebp +80105139: 56 push %esi +8010513a: 53 push %ebx +8010513b: ba fd 03 00 00 mov $0x3fd,%edx +80105140: ec in (%dx),%al for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) -80105388: a8 20 test $0x20,%al -8010538a: 75 30 jne 801053bc +80105141: a8 20 test $0x20,%al +80105143: 75 30 jne 80105175 microdelay(10); -8010538c: 83 ec 0c sub $0xc,%esp -8010538f: 6a 0a push $0xa -80105391: e8 ad d1 ff ff call 80102543 -80105396: 83 c4 10 add $0x10,%esp -80105399: bb 7f 00 00 00 mov $0x7f,%ebx -8010539e: be fd 03 00 00 mov $0x3fd,%esi -801053a3: 89 f2 mov %esi,%edx -801053a5: ec in (%dx),%al +80105145: 83 ec 0c sub $0xc,%esp +80105148: 6a 0a push $0xa +8010514a: e8 02 d3 ff ff call 80102451 +8010514f: 83 c4 10 add $0x10,%esp +80105152: bb 7f 00 00 00 mov $0x7f,%ebx +80105157: be fd 03 00 00 mov $0x3fd,%esi +8010515c: 89 f2 mov %esi,%edx +8010515e: ec in (%dx),%al for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) -801053a6: a8 20 test $0x20,%al -801053a8: 75 12 jne 801053bc +8010515f: a8 20 test $0x20,%al +80105161: 75 12 jne 80105175 microdelay(10); -801053aa: 83 ec 0c sub $0xc,%esp -801053ad: 6a 0a push $0xa -801053af: e8 8f d1 ff ff call 80102543 +80105163: 83 ec 0c sub $0xc,%esp +80105166: 6a 0a push $0xa +80105168: e8 e4 d2 ff ff call 80102451 for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) -801053b4: 83 c4 10 add $0x10,%esp -801053b7: 83 eb 01 sub $0x1,%ebx -801053ba: 75 e7 jne 801053a3 +8010516d: 83 c4 10 add $0x10,%esp +80105170: 83 eb 01 sub $0x1,%ebx +80105173: 75 e7 jne 8010515c asm volatile("out %0,%1" : : "a" (data), "d" (port)); -801053bc: 8b 45 08 mov 0x8(%ebp),%eax -801053bf: ba f8 03 00 00 mov $0x3f8,%edx -801053c4: ee out %al,(%dx) -} -801053c5: 8d 65 f8 lea -0x8(%ebp),%esp -801053c8: 5b pop %ebx -801053c9: 5e pop %esi -801053ca: 5d pop %ebp -801053cb: c3 ret -801053cc: c3 ret - -801053cd : -{ -801053cd: f3 0f 1e fb endbr32 -801053d1: 55 push %ebp -801053d2: 89 e5 mov %esp,%ebp -801053d4: 56 push %esi -801053d5: 53 push %ebx -801053d6: b9 00 00 00 00 mov $0x0,%ecx -801053db: ba fa 03 00 00 mov $0x3fa,%edx -801053e0: 89 c8 mov %ecx,%eax -801053e2: ee out %al,(%dx) -801053e3: be fb 03 00 00 mov $0x3fb,%esi -801053e8: b8 80 ff ff ff mov $0xffffff80,%eax -801053ed: 89 f2 mov %esi,%edx -801053ef: ee out %al,(%dx) -801053f0: b8 0c 00 00 00 mov $0xc,%eax -801053f5: ba f8 03 00 00 mov $0x3f8,%edx -801053fa: ee out %al,(%dx) -801053fb: bb f9 03 00 00 mov $0x3f9,%ebx -80105400: 89 c8 mov %ecx,%eax -80105402: 89 da mov %ebx,%edx -80105404: ee out %al,(%dx) -80105405: b8 03 00 00 00 mov $0x3,%eax -8010540a: 89 f2 mov %esi,%edx -8010540c: ee out %al,(%dx) -8010540d: ba fc 03 00 00 mov $0x3fc,%edx -80105412: 89 c8 mov %ecx,%eax -80105414: ee out %al,(%dx) -80105415: b8 01 00 00 00 mov $0x1,%eax -8010541a: 89 da mov %ebx,%edx -8010541c: ee out %al,(%dx) +80105175: 8b 45 08 mov 0x8(%ebp),%eax +80105178: ba f8 03 00 00 mov $0x3f8,%edx +8010517d: ee out %al,(%dx) +} +8010517e: 8d 65 f8 lea -0x8(%ebp),%esp +80105181: 5b pop %ebx +80105182: 5e pop %esi +80105183: 5d pop %ebp +80105184: c3 ret +80105185: c3 ret + +80105186 : +{ +80105186: 55 push %ebp +80105187: 89 e5 mov %esp,%ebp +80105189: 56 push %esi +8010518a: 53 push %ebx +8010518b: b9 00 00 00 00 mov $0x0,%ecx +80105190: ba fa 03 00 00 mov $0x3fa,%edx +80105195: 89 c8 mov %ecx,%eax +80105197: ee out %al,(%dx) +80105198: be fb 03 00 00 mov $0x3fb,%esi +8010519d: b8 80 ff ff ff mov $0xffffff80,%eax +801051a2: 89 f2 mov %esi,%edx +801051a4: ee out %al,(%dx) +801051a5: b8 0c 00 00 00 mov $0xc,%eax +801051aa: ba f8 03 00 00 mov $0x3f8,%edx +801051af: ee out %al,(%dx) +801051b0: bb f9 03 00 00 mov $0x3f9,%ebx +801051b5: 89 c8 mov %ecx,%eax +801051b7: 89 da mov %ebx,%edx +801051b9: ee out %al,(%dx) +801051ba: b8 03 00 00 00 mov $0x3,%eax +801051bf: 89 f2 mov %esi,%edx +801051c1: ee out %al,(%dx) +801051c2: ba fc 03 00 00 mov $0x3fc,%edx +801051c7: 89 c8 mov %ecx,%eax +801051c9: ee out %al,(%dx) +801051ca: b8 01 00 00 00 mov $0x1,%eax +801051cf: 89 da mov %ebx,%edx +801051d1: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); -8010541d: ba fd 03 00 00 mov $0x3fd,%edx -80105422: ec in (%dx),%al +801051d2: ba fd 03 00 00 mov $0x3fd,%edx +801051d7: ec in (%dx),%al if(inb(COM1+5) == 0xFF) -80105423: 3c ff cmp $0xff,%al -80105425: 74 48 je 8010546f +801051d8: 3c ff cmp $0xff,%al +801051da: 74 48 je 80105224 uart = 1; -80105427: c7 05 bc b5 10 80 01 movl $0x1,0x8010b5bc -8010542e: 00 00 00 -80105431: ba fa 03 00 00 mov $0x3fa,%edx -80105436: ec in (%dx),%al -80105437: ba f8 03 00 00 mov $0x3f8,%edx -8010543c: ec in (%dx),%al +801051dc: c7 05 00 3e 11 80 01 movl $0x1,0x80113e00 +801051e3: 00 00 00 +801051e6: ba fa 03 00 00 mov $0x3fa,%edx +801051eb: ec in (%dx),%al +801051ec: ba f8 03 00 00 mov $0x3f8,%edx +801051f1: ec in (%dx),%al ioapicenable(IRQ_COM1, 0); -8010543d: 83 ec 08 sub $0x8,%esp -80105440: 6a 00 push $0x0 -80105442: 6a 04 push $0x4 -80105444: e8 3b cc ff ff call 80102084 -80105449: 83 c4 10 add $0x10,%esp +801051f2: 83 ec 08 sub $0x8,%esp +801051f5: 6a 00 push $0x0 +801051f7: 6a 04 push $0x4 +801051f9: e8 cb cd ff ff call 80101fc9 +801051fe: 83 c4 10 add $0x10,%esp for(p="xv6...\n"; *p; p++) -8010544c: bb 68 81 10 80 mov $0x80108168,%ebx -80105451: b8 78 00 00 00 mov $0x78,%eax +80105201: bb 88 7e 10 80 mov $0x80107e88,%ebx +80105206: b8 78 00 00 00 mov $0x78,%eax uartputc(*p); -80105456: 83 ec 0c sub $0xc,%esp -80105459: 0f be c0 movsbl %al,%eax -8010545c: 50 push %eax -8010545d: e8 0e ff ff ff call 80105370 +8010520b: 83 ec 0c sub $0xc,%esp +8010520e: 0f be c0 movsbl %al,%eax +80105211: 50 push %eax +80105212: e8 16 ff ff ff call 8010512d for(p="xv6...\n"; *p; p++) -80105462: 83 c3 01 add $0x1,%ebx -80105465: 0f b6 03 movzbl (%ebx),%eax -80105468: 83 c4 10 add $0x10,%esp -8010546b: 84 c0 test %al,%al -8010546d: 75 e7 jne 80105456 +80105217: 83 c3 01 add $0x1,%ebx +8010521a: 0f b6 03 movzbl (%ebx),%eax +8010521d: 83 c4 10 add $0x10,%esp +80105220: 84 c0 test %al,%al +80105222: 75 e7 jne 8010520b } -8010546f: 8d 65 f8 lea -0x8(%ebp),%esp -80105472: 5b pop %ebx -80105473: 5e pop %esi -80105474: 5d pop %ebp -80105475: c3 ret +80105224: 8d 65 f8 lea -0x8(%ebp),%esp +80105227: 5b pop %ebx +80105228: 5e pop %esi +80105229: 5d pop %ebp +8010522a: c3 ret -80105476 : +8010522b : void uartintr(void) { -80105476: f3 0f 1e fb endbr32 -8010547a: 55 push %ebp -8010547b: 89 e5 mov %esp,%ebp -8010547d: 83 ec 14 sub $0x14,%esp +8010522b: 55 push %ebp +8010522c: 89 e5 mov %esp,%ebp +8010522e: 83 ec 14 sub $0x14,%esp consoleintr(uartgetc); -80105480: 68 43 53 10 80 push $0x80105343 -80105485: e8 01 b3 ff ff call 8010078b +80105231: 68 04 51 10 80 push $0x80105104 +80105236: e8 21 b5 ff ff call 8010075c } -8010548a: 83 c4 10 add $0x10,%esp -8010548d: c9 leave -8010548e: c3 ret +8010523b: 83 c4 10 add $0x10,%esp +8010523e: c9 leave +8010523f: c3 ret -8010548f : +80105240 : # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 -8010548f: 6a 00 push $0x0 +80105240: 6a 00 push $0x0 pushl $0 -80105491: 6a 00 push $0x0 +80105242: 6a 00 push $0x0 jmp alltraps -80105493: e9 b7 fb ff ff jmp 8010504f +80105244: e9 d4 fb ff ff jmp 80104e1d -80105498 : +80105249 : .globl vector1 vector1: pushl $0 -80105498: 6a 00 push $0x0 +80105249: 6a 00 push $0x0 pushl $1 -8010549a: 6a 01 push $0x1 +8010524b: 6a 01 push $0x1 jmp alltraps -8010549c: e9 ae fb ff ff jmp 8010504f +8010524d: e9 cb fb ff ff jmp 80104e1d -801054a1 : +80105252 : .globl vector2 vector2: pushl $0 -801054a1: 6a 00 push $0x0 +80105252: 6a 00 push $0x0 pushl $2 -801054a3: 6a 02 push $0x2 +80105254: 6a 02 push $0x2 jmp alltraps -801054a5: e9 a5 fb ff ff jmp 8010504f +80105256: e9 c2 fb ff ff jmp 80104e1d -801054aa : +8010525b : .globl vector3 vector3: pushl $0 -801054aa: 6a 00 push $0x0 +8010525b: 6a 00 push $0x0 pushl $3 -801054ac: 6a 03 push $0x3 +8010525d: 6a 03 push $0x3 jmp alltraps -801054ae: e9 9c fb ff ff jmp 8010504f +8010525f: e9 b9 fb ff ff jmp 80104e1d -801054b3 : +80105264 : .globl vector4 vector4: pushl $0 -801054b3: 6a 00 push $0x0 +80105264: 6a 00 push $0x0 pushl $4 -801054b5: 6a 04 push $0x4 +80105266: 6a 04 push $0x4 jmp alltraps -801054b7: e9 93 fb ff ff jmp 8010504f +80105268: e9 b0 fb ff ff jmp 80104e1d -801054bc : +8010526d : .globl vector5 vector5: pushl $0 -801054bc: 6a 00 push $0x0 +8010526d: 6a 00 push $0x0 pushl $5 -801054be: 6a 05 push $0x5 +8010526f: 6a 05 push $0x5 jmp alltraps -801054c0: e9 8a fb ff ff jmp 8010504f +80105271: e9 a7 fb ff ff jmp 80104e1d -801054c5 : +80105276 : .globl vector6 vector6: pushl $0 -801054c5: 6a 00 push $0x0 +80105276: 6a 00 push $0x0 pushl $6 -801054c7: 6a 06 push $0x6 +80105278: 6a 06 push $0x6 jmp alltraps -801054c9: e9 81 fb ff ff jmp 8010504f +8010527a: e9 9e fb ff ff jmp 80104e1d -801054ce : +8010527f : .globl vector7 vector7: pushl $0 -801054ce: 6a 00 push $0x0 +8010527f: 6a 00 push $0x0 pushl $7 -801054d0: 6a 07 push $0x7 +80105281: 6a 07 push $0x7 jmp alltraps -801054d2: e9 78 fb ff ff jmp 8010504f +80105283: e9 95 fb ff ff jmp 80104e1d -801054d7 : +80105288 : .globl vector8 vector8: pushl $8 -801054d7: 6a 08 push $0x8 +80105288: 6a 08 push $0x8 jmp alltraps -801054d9: e9 71 fb ff ff jmp 8010504f +8010528a: e9 8e fb ff ff jmp 80104e1d -801054de : +8010528f : .globl vector9 vector9: pushl $0 -801054de: 6a 00 push $0x0 +8010528f: 6a 00 push $0x0 pushl $9 -801054e0: 6a 09 push $0x9 +80105291: 6a 09 push $0x9 jmp alltraps -801054e2: e9 68 fb ff ff jmp 8010504f +80105293: e9 85 fb ff ff jmp 80104e1d -801054e7 : +80105298 : .globl vector10 vector10: pushl $10 -801054e7: 6a 0a push $0xa +80105298: 6a 0a push $0xa jmp alltraps -801054e9: e9 61 fb ff ff jmp 8010504f +8010529a: e9 7e fb ff ff jmp 80104e1d -801054ee : +8010529f : .globl vector11 vector11: pushl $11 -801054ee: 6a 0b push $0xb +8010529f: 6a 0b push $0xb jmp alltraps -801054f0: e9 5a fb ff ff jmp 8010504f +801052a1: e9 77 fb ff ff jmp 80104e1d -801054f5 : +801052a6 : .globl vector12 vector12: pushl $12 -801054f5: 6a 0c push $0xc +801052a6: 6a 0c push $0xc jmp alltraps -801054f7: e9 53 fb ff ff jmp 8010504f +801052a8: e9 70 fb ff ff jmp 80104e1d -801054fc : +801052ad : .globl vector13 vector13: pushl $13 -801054fc: 6a 0d push $0xd +801052ad: 6a 0d push $0xd jmp alltraps -801054fe: e9 4c fb ff ff jmp 8010504f +801052af: e9 69 fb ff ff jmp 80104e1d -80105503 : +801052b4 : .globl vector14 vector14: pushl $14 -80105503: 6a 0e push $0xe +801052b4: 6a 0e push $0xe jmp alltraps -80105505: e9 45 fb ff ff jmp 8010504f +801052b6: e9 62 fb ff ff jmp 80104e1d -8010550a : +801052bb : .globl vector15 vector15: pushl $0 -8010550a: 6a 00 push $0x0 +801052bb: 6a 00 push $0x0 pushl $15 -8010550c: 6a 0f push $0xf +801052bd: 6a 0f push $0xf jmp alltraps -8010550e: e9 3c fb ff ff jmp 8010504f +801052bf: e9 59 fb ff ff jmp 80104e1d -80105513 : +801052c4 : .globl vector16 vector16: pushl $0 -80105513: 6a 00 push $0x0 +801052c4: 6a 00 push $0x0 pushl $16 -80105515: 6a 10 push $0x10 +801052c6: 6a 10 push $0x10 jmp alltraps -80105517: e9 33 fb ff ff jmp 8010504f +801052c8: e9 50 fb ff ff jmp 80104e1d -8010551c : +801052cd : .globl vector17 vector17: pushl $17 -8010551c: 6a 11 push $0x11 +801052cd: 6a 11 push $0x11 jmp alltraps -8010551e: e9 2c fb ff ff jmp 8010504f +801052cf: e9 49 fb ff ff jmp 80104e1d -80105523 : +801052d4 : .globl vector18 vector18: pushl $0 -80105523: 6a 00 push $0x0 +801052d4: 6a 00 push $0x0 pushl $18 -80105525: 6a 12 push $0x12 +801052d6: 6a 12 push $0x12 jmp alltraps -80105527: e9 23 fb ff ff jmp 8010504f +801052d8: e9 40 fb ff ff jmp 80104e1d -8010552c : +801052dd : .globl vector19 vector19: pushl $0 -8010552c: 6a 00 push $0x0 +801052dd: 6a 00 push $0x0 pushl $19 -8010552e: 6a 13 push $0x13 +801052df: 6a 13 push $0x13 jmp alltraps -80105530: e9 1a fb ff ff jmp 8010504f +801052e1: e9 37 fb ff ff jmp 80104e1d -80105535 : +801052e6 : .globl vector20 vector20: pushl $0 -80105535: 6a 00 push $0x0 +801052e6: 6a 00 push $0x0 pushl $20 -80105537: 6a 14 push $0x14 +801052e8: 6a 14 push $0x14 jmp alltraps -80105539: e9 11 fb ff ff jmp 8010504f +801052ea: e9 2e fb ff ff jmp 80104e1d -8010553e : +801052ef : .globl vector21 vector21: pushl $0 -8010553e: 6a 00 push $0x0 +801052ef: 6a 00 push $0x0 pushl $21 -80105540: 6a 15 push $0x15 +801052f1: 6a 15 push $0x15 jmp alltraps -80105542: e9 08 fb ff ff jmp 8010504f +801052f3: e9 25 fb ff ff jmp 80104e1d -80105547 : +801052f8 : .globl vector22 vector22: pushl $0 -80105547: 6a 00 push $0x0 +801052f8: 6a 00 push $0x0 pushl $22 -80105549: 6a 16 push $0x16 +801052fa: 6a 16 push $0x16 jmp alltraps -8010554b: e9 ff fa ff ff jmp 8010504f +801052fc: e9 1c fb ff ff jmp 80104e1d -80105550 : +80105301 : .globl vector23 vector23: pushl $0 -80105550: 6a 00 push $0x0 +80105301: 6a 00 push $0x0 pushl $23 -80105552: 6a 17 push $0x17 +80105303: 6a 17 push $0x17 jmp alltraps -80105554: e9 f6 fa ff ff jmp 8010504f +80105305: e9 13 fb ff ff jmp 80104e1d -80105559 : +8010530a : .globl vector24 vector24: pushl $0 -80105559: 6a 00 push $0x0 +8010530a: 6a 00 push $0x0 pushl $24 -8010555b: 6a 18 push $0x18 +8010530c: 6a 18 push $0x18 jmp alltraps -8010555d: e9 ed fa ff ff jmp 8010504f +8010530e: e9 0a fb ff ff jmp 80104e1d -80105562 : +80105313 : .globl vector25 vector25: pushl $0 -80105562: 6a 00 push $0x0 +80105313: 6a 00 push $0x0 pushl $25 -80105564: 6a 19 push $0x19 +80105315: 6a 19 push $0x19 jmp alltraps -80105566: e9 e4 fa ff ff jmp 8010504f +80105317: e9 01 fb ff ff jmp 80104e1d -8010556b : +8010531c : .globl vector26 vector26: pushl $0 -8010556b: 6a 00 push $0x0 +8010531c: 6a 00 push $0x0 pushl $26 -8010556d: 6a 1a push $0x1a +8010531e: 6a 1a push $0x1a jmp alltraps -8010556f: e9 db fa ff ff jmp 8010504f +80105320: e9 f8 fa ff ff jmp 80104e1d -80105574 : +80105325 : .globl vector27 vector27: pushl $0 -80105574: 6a 00 push $0x0 +80105325: 6a 00 push $0x0 pushl $27 -80105576: 6a 1b push $0x1b +80105327: 6a 1b push $0x1b jmp alltraps -80105578: e9 d2 fa ff ff jmp 8010504f +80105329: e9 ef fa ff ff jmp 80104e1d -8010557d : +8010532e : .globl vector28 vector28: pushl $0 -8010557d: 6a 00 push $0x0 +8010532e: 6a 00 push $0x0 pushl $28 -8010557f: 6a 1c push $0x1c +80105330: 6a 1c push $0x1c jmp alltraps -80105581: e9 c9 fa ff ff jmp 8010504f +80105332: e9 e6 fa ff ff jmp 80104e1d -80105586 : +80105337 : .globl vector29 vector29: pushl $0 -80105586: 6a 00 push $0x0 +80105337: 6a 00 push $0x0 pushl $29 -80105588: 6a 1d push $0x1d +80105339: 6a 1d push $0x1d jmp alltraps -8010558a: e9 c0 fa ff ff jmp 8010504f +8010533b: e9 dd fa ff ff jmp 80104e1d -8010558f : +80105340 : .globl vector30 vector30: pushl $0 -8010558f: 6a 00 push $0x0 +80105340: 6a 00 push $0x0 pushl $30 -80105591: 6a 1e push $0x1e +80105342: 6a 1e push $0x1e jmp alltraps -80105593: e9 b7 fa ff ff jmp 8010504f +80105344: e9 d4 fa ff ff jmp 80104e1d -80105598 : +80105349 : .globl vector31 vector31: pushl $0 -80105598: 6a 00 push $0x0 +80105349: 6a 00 push $0x0 pushl $31 -8010559a: 6a 1f push $0x1f +8010534b: 6a 1f push $0x1f jmp alltraps -8010559c: e9 ae fa ff ff jmp 8010504f +8010534d: e9 cb fa ff ff jmp 80104e1d -801055a1 : +80105352 : .globl vector32 vector32: pushl $0 -801055a1: 6a 00 push $0x0 +80105352: 6a 00 push $0x0 pushl $32 -801055a3: 6a 20 push $0x20 +80105354: 6a 20 push $0x20 jmp alltraps -801055a5: e9 a5 fa ff ff jmp 8010504f +80105356: e9 c2 fa ff ff jmp 80104e1d -801055aa : +8010535b : .globl vector33 vector33: pushl $0 -801055aa: 6a 00 push $0x0 +8010535b: 6a 00 push $0x0 pushl $33 -801055ac: 6a 21 push $0x21 +8010535d: 6a 21 push $0x21 jmp alltraps -801055ae: e9 9c fa ff ff jmp 8010504f +8010535f: e9 b9 fa ff ff jmp 80104e1d -801055b3 : +80105364 : .globl vector34 vector34: pushl $0 -801055b3: 6a 00 push $0x0 +80105364: 6a 00 push $0x0 pushl $34 -801055b5: 6a 22 push $0x22 +80105366: 6a 22 push $0x22 jmp alltraps -801055b7: e9 93 fa ff ff jmp 8010504f +80105368: e9 b0 fa ff ff jmp 80104e1d -801055bc : +8010536d : .globl vector35 vector35: pushl $0 -801055bc: 6a 00 push $0x0 +8010536d: 6a 00 push $0x0 pushl $35 -801055be: 6a 23 push $0x23 +8010536f: 6a 23 push $0x23 jmp alltraps -801055c0: e9 8a fa ff ff jmp 8010504f +80105371: e9 a7 fa ff ff jmp 80104e1d -801055c5 : +80105376 : .globl vector36 vector36: pushl $0 -801055c5: 6a 00 push $0x0 +80105376: 6a 00 push $0x0 pushl $36 -801055c7: 6a 24 push $0x24 +80105378: 6a 24 push $0x24 jmp alltraps -801055c9: e9 81 fa ff ff jmp 8010504f +8010537a: e9 9e fa ff ff jmp 80104e1d -801055ce : +8010537f : .globl vector37 vector37: pushl $0 -801055ce: 6a 00 push $0x0 +8010537f: 6a 00 push $0x0 pushl $37 -801055d0: 6a 25 push $0x25 +80105381: 6a 25 push $0x25 jmp alltraps -801055d2: e9 78 fa ff ff jmp 8010504f +80105383: e9 95 fa ff ff jmp 80104e1d -801055d7 : +80105388 : .globl vector38 vector38: pushl $0 -801055d7: 6a 00 push $0x0 +80105388: 6a 00 push $0x0 pushl $38 -801055d9: 6a 26 push $0x26 +8010538a: 6a 26 push $0x26 jmp alltraps -801055db: e9 6f fa ff ff jmp 8010504f +8010538c: e9 8c fa ff ff jmp 80104e1d -801055e0 : +80105391 : .globl vector39 vector39: pushl $0 -801055e0: 6a 00 push $0x0 +80105391: 6a 00 push $0x0 pushl $39 -801055e2: 6a 27 push $0x27 +80105393: 6a 27 push $0x27 jmp alltraps -801055e4: e9 66 fa ff ff jmp 8010504f +80105395: e9 83 fa ff ff jmp 80104e1d -801055e9 : +8010539a : .globl vector40 vector40: pushl $0 -801055e9: 6a 00 push $0x0 +8010539a: 6a 00 push $0x0 pushl $40 -801055eb: 6a 28 push $0x28 +8010539c: 6a 28 push $0x28 jmp alltraps -801055ed: e9 5d fa ff ff jmp 8010504f +8010539e: e9 7a fa ff ff jmp 80104e1d -801055f2 : +801053a3 : .globl vector41 vector41: pushl $0 -801055f2: 6a 00 push $0x0 +801053a3: 6a 00 push $0x0 pushl $41 -801055f4: 6a 29 push $0x29 +801053a5: 6a 29 push $0x29 jmp alltraps -801055f6: e9 54 fa ff ff jmp 8010504f +801053a7: e9 71 fa ff ff jmp 80104e1d -801055fb : +801053ac : .globl vector42 vector42: pushl $0 -801055fb: 6a 00 push $0x0 +801053ac: 6a 00 push $0x0 pushl $42 -801055fd: 6a 2a push $0x2a +801053ae: 6a 2a push $0x2a jmp alltraps -801055ff: e9 4b fa ff ff jmp 8010504f +801053b0: e9 68 fa ff ff jmp 80104e1d -80105604 : +801053b5 : .globl vector43 vector43: pushl $0 -80105604: 6a 00 push $0x0 +801053b5: 6a 00 push $0x0 pushl $43 -80105606: 6a 2b push $0x2b +801053b7: 6a 2b push $0x2b jmp alltraps -80105608: e9 42 fa ff ff jmp 8010504f +801053b9: e9 5f fa ff ff jmp 80104e1d -8010560d : +801053be : .globl vector44 vector44: pushl $0 -8010560d: 6a 00 push $0x0 +801053be: 6a 00 push $0x0 pushl $44 -8010560f: 6a 2c push $0x2c +801053c0: 6a 2c push $0x2c jmp alltraps -80105611: e9 39 fa ff ff jmp 8010504f +801053c2: e9 56 fa ff ff jmp 80104e1d -80105616 : +801053c7 : .globl vector45 vector45: pushl $0 -80105616: 6a 00 push $0x0 +801053c7: 6a 00 push $0x0 pushl $45 -80105618: 6a 2d push $0x2d +801053c9: 6a 2d push $0x2d jmp alltraps -8010561a: e9 30 fa ff ff jmp 8010504f +801053cb: e9 4d fa ff ff jmp 80104e1d -8010561f : +801053d0 : .globl vector46 vector46: pushl $0 -8010561f: 6a 00 push $0x0 +801053d0: 6a 00 push $0x0 pushl $46 -80105621: 6a 2e push $0x2e +801053d2: 6a 2e push $0x2e jmp alltraps -80105623: e9 27 fa ff ff jmp 8010504f +801053d4: e9 44 fa ff ff jmp 80104e1d -80105628 : +801053d9 : .globl vector47 vector47: pushl $0 -80105628: 6a 00 push $0x0 +801053d9: 6a 00 push $0x0 pushl $47 -8010562a: 6a 2f push $0x2f +801053db: 6a 2f push $0x2f jmp alltraps -8010562c: e9 1e fa ff ff jmp 8010504f +801053dd: e9 3b fa ff ff jmp 80104e1d -80105631 : +801053e2 : .globl vector48 vector48: pushl $0 -80105631: 6a 00 push $0x0 +801053e2: 6a 00 push $0x0 pushl $48 -80105633: 6a 30 push $0x30 +801053e4: 6a 30 push $0x30 jmp alltraps -80105635: e9 15 fa ff ff jmp 8010504f +801053e6: e9 32 fa ff ff jmp 80104e1d -8010563a : +801053eb : .globl vector49 vector49: pushl $0 -8010563a: 6a 00 push $0x0 +801053eb: 6a 00 push $0x0 pushl $49 -8010563c: 6a 31 push $0x31 +801053ed: 6a 31 push $0x31 jmp alltraps -8010563e: e9 0c fa ff ff jmp 8010504f +801053ef: e9 29 fa ff ff jmp 80104e1d -80105643 : +801053f4 : .globl vector50 vector50: pushl $0 -80105643: 6a 00 push $0x0 +801053f4: 6a 00 push $0x0 pushl $50 -80105645: 6a 32 push $0x32 +801053f6: 6a 32 push $0x32 jmp alltraps -80105647: e9 03 fa ff ff jmp 8010504f +801053f8: e9 20 fa ff ff jmp 80104e1d -8010564c : +801053fd : .globl vector51 vector51: pushl $0 -8010564c: 6a 00 push $0x0 +801053fd: 6a 00 push $0x0 pushl $51 -8010564e: 6a 33 push $0x33 +801053ff: 6a 33 push $0x33 jmp alltraps -80105650: e9 fa f9 ff ff jmp 8010504f +80105401: e9 17 fa ff ff jmp 80104e1d -80105655 : +80105406 : .globl vector52 vector52: pushl $0 -80105655: 6a 00 push $0x0 +80105406: 6a 00 push $0x0 pushl $52 -80105657: 6a 34 push $0x34 +80105408: 6a 34 push $0x34 jmp alltraps -80105659: e9 f1 f9 ff ff jmp 8010504f +8010540a: e9 0e fa ff ff jmp 80104e1d -8010565e : +8010540f : .globl vector53 vector53: pushl $0 -8010565e: 6a 00 push $0x0 +8010540f: 6a 00 push $0x0 pushl $53 -80105660: 6a 35 push $0x35 +80105411: 6a 35 push $0x35 jmp alltraps -80105662: e9 e8 f9 ff ff jmp 8010504f +80105413: e9 05 fa ff ff jmp 80104e1d -80105667 : +80105418 : .globl vector54 vector54: pushl $0 -80105667: 6a 00 push $0x0 +80105418: 6a 00 push $0x0 pushl $54 -80105669: 6a 36 push $0x36 +8010541a: 6a 36 push $0x36 jmp alltraps -8010566b: e9 df f9 ff ff jmp 8010504f +8010541c: e9 fc f9 ff ff jmp 80104e1d -80105670 : +80105421 : .globl vector55 vector55: pushl $0 -80105670: 6a 00 push $0x0 +80105421: 6a 00 push $0x0 pushl $55 -80105672: 6a 37 push $0x37 +80105423: 6a 37 push $0x37 jmp alltraps -80105674: e9 d6 f9 ff ff jmp 8010504f +80105425: e9 f3 f9 ff ff jmp 80104e1d -80105679 : +8010542a : .globl vector56 vector56: pushl $0 -80105679: 6a 00 push $0x0 +8010542a: 6a 00 push $0x0 pushl $56 -8010567b: 6a 38 push $0x38 +8010542c: 6a 38 push $0x38 jmp alltraps -8010567d: e9 cd f9 ff ff jmp 8010504f +8010542e: e9 ea f9 ff ff jmp 80104e1d -80105682 : +80105433 : .globl vector57 vector57: pushl $0 -80105682: 6a 00 push $0x0 +80105433: 6a 00 push $0x0 pushl $57 -80105684: 6a 39 push $0x39 +80105435: 6a 39 push $0x39 jmp alltraps -80105686: e9 c4 f9 ff ff jmp 8010504f +80105437: e9 e1 f9 ff ff jmp 80104e1d -8010568b : +8010543c : .globl vector58 vector58: pushl $0 -8010568b: 6a 00 push $0x0 +8010543c: 6a 00 push $0x0 pushl $58 -8010568d: 6a 3a push $0x3a +8010543e: 6a 3a push $0x3a jmp alltraps -8010568f: e9 bb f9 ff ff jmp 8010504f +80105440: e9 d8 f9 ff ff jmp 80104e1d -80105694 : +80105445 : .globl vector59 vector59: pushl $0 -80105694: 6a 00 push $0x0 +80105445: 6a 00 push $0x0 pushl $59 -80105696: 6a 3b push $0x3b +80105447: 6a 3b push $0x3b jmp alltraps -80105698: e9 b2 f9 ff ff jmp 8010504f +80105449: e9 cf f9 ff ff jmp 80104e1d -8010569d : +8010544e : .globl vector60 vector60: pushl $0 -8010569d: 6a 00 push $0x0 +8010544e: 6a 00 push $0x0 pushl $60 -8010569f: 6a 3c push $0x3c +80105450: 6a 3c push $0x3c jmp alltraps -801056a1: e9 a9 f9 ff ff jmp 8010504f +80105452: e9 c6 f9 ff ff jmp 80104e1d -801056a6 : +80105457 : .globl vector61 vector61: pushl $0 -801056a6: 6a 00 push $0x0 +80105457: 6a 00 push $0x0 pushl $61 -801056a8: 6a 3d push $0x3d +80105459: 6a 3d push $0x3d jmp alltraps -801056aa: e9 a0 f9 ff ff jmp 8010504f +8010545b: e9 bd f9 ff ff jmp 80104e1d -801056af : +80105460 : .globl vector62 vector62: pushl $0 -801056af: 6a 00 push $0x0 +80105460: 6a 00 push $0x0 pushl $62 -801056b1: 6a 3e push $0x3e +80105462: 6a 3e push $0x3e jmp alltraps -801056b3: e9 97 f9 ff ff jmp 8010504f +80105464: e9 b4 f9 ff ff jmp 80104e1d -801056b8 : +80105469 : .globl vector63 vector63: pushl $0 -801056b8: 6a 00 push $0x0 +80105469: 6a 00 push $0x0 pushl $63 -801056ba: 6a 3f push $0x3f +8010546b: 6a 3f push $0x3f jmp alltraps -801056bc: e9 8e f9 ff ff jmp 8010504f +8010546d: e9 ab f9 ff ff jmp 80104e1d -801056c1 : +80105472 : .globl vector64 vector64: pushl $0 -801056c1: 6a 00 push $0x0 +80105472: 6a 00 push $0x0 pushl $64 -801056c3: 6a 40 push $0x40 +80105474: 6a 40 push $0x40 jmp alltraps -801056c5: e9 85 f9 ff ff jmp 8010504f +80105476: e9 a2 f9 ff ff jmp 80104e1d -801056ca : +8010547b : .globl vector65 vector65: pushl $0 -801056ca: 6a 00 push $0x0 +8010547b: 6a 00 push $0x0 pushl $65 -801056cc: 6a 41 push $0x41 +8010547d: 6a 41 push $0x41 jmp alltraps -801056ce: e9 7c f9 ff ff jmp 8010504f +8010547f: e9 99 f9 ff ff jmp 80104e1d -801056d3 : +80105484 : .globl vector66 vector66: pushl $0 -801056d3: 6a 00 push $0x0 +80105484: 6a 00 push $0x0 pushl $66 -801056d5: 6a 42 push $0x42 +80105486: 6a 42 push $0x42 jmp alltraps -801056d7: e9 73 f9 ff ff jmp 8010504f +80105488: e9 90 f9 ff ff jmp 80104e1d -801056dc : +8010548d : .globl vector67 vector67: pushl $0 -801056dc: 6a 00 push $0x0 +8010548d: 6a 00 push $0x0 pushl $67 -801056de: 6a 43 push $0x43 +8010548f: 6a 43 push $0x43 jmp alltraps -801056e0: e9 6a f9 ff ff jmp 8010504f +80105491: e9 87 f9 ff ff jmp 80104e1d -801056e5 : +80105496 : .globl vector68 vector68: pushl $0 -801056e5: 6a 00 push $0x0 +80105496: 6a 00 push $0x0 pushl $68 -801056e7: 6a 44 push $0x44 +80105498: 6a 44 push $0x44 jmp alltraps -801056e9: e9 61 f9 ff ff jmp 8010504f +8010549a: e9 7e f9 ff ff jmp 80104e1d -801056ee : +8010549f : .globl vector69 vector69: pushl $0 -801056ee: 6a 00 push $0x0 +8010549f: 6a 00 push $0x0 pushl $69 -801056f0: 6a 45 push $0x45 +801054a1: 6a 45 push $0x45 jmp alltraps -801056f2: e9 58 f9 ff ff jmp 8010504f +801054a3: e9 75 f9 ff ff jmp 80104e1d -801056f7 : +801054a8 : .globl vector70 vector70: pushl $0 -801056f7: 6a 00 push $0x0 +801054a8: 6a 00 push $0x0 pushl $70 -801056f9: 6a 46 push $0x46 +801054aa: 6a 46 push $0x46 jmp alltraps -801056fb: e9 4f f9 ff ff jmp 8010504f +801054ac: e9 6c f9 ff ff jmp 80104e1d -80105700 : +801054b1 : .globl vector71 vector71: pushl $0 -80105700: 6a 00 push $0x0 +801054b1: 6a 00 push $0x0 pushl $71 -80105702: 6a 47 push $0x47 +801054b3: 6a 47 push $0x47 jmp alltraps -80105704: e9 46 f9 ff ff jmp 8010504f +801054b5: e9 63 f9 ff ff jmp 80104e1d -80105709 : +801054ba : .globl vector72 vector72: pushl $0 -80105709: 6a 00 push $0x0 +801054ba: 6a 00 push $0x0 pushl $72 -8010570b: 6a 48 push $0x48 +801054bc: 6a 48 push $0x48 jmp alltraps -8010570d: e9 3d f9 ff ff jmp 8010504f +801054be: e9 5a f9 ff ff jmp 80104e1d -80105712 : +801054c3 : .globl vector73 vector73: pushl $0 -80105712: 6a 00 push $0x0 +801054c3: 6a 00 push $0x0 pushl $73 -80105714: 6a 49 push $0x49 +801054c5: 6a 49 push $0x49 jmp alltraps -80105716: e9 34 f9 ff ff jmp 8010504f +801054c7: e9 51 f9 ff ff jmp 80104e1d -8010571b : +801054cc : .globl vector74 vector74: pushl $0 -8010571b: 6a 00 push $0x0 +801054cc: 6a 00 push $0x0 pushl $74 -8010571d: 6a 4a push $0x4a +801054ce: 6a 4a push $0x4a jmp alltraps -8010571f: e9 2b f9 ff ff jmp 8010504f +801054d0: e9 48 f9 ff ff jmp 80104e1d -80105724 : +801054d5 : .globl vector75 vector75: pushl $0 -80105724: 6a 00 push $0x0 +801054d5: 6a 00 push $0x0 pushl $75 -80105726: 6a 4b push $0x4b +801054d7: 6a 4b push $0x4b jmp alltraps -80105728: e9 22 f9 ff ff jmp 8010504f +801054d9: e9 3f f9 ff ff jmp 80104e1d -8010572d : +801054de : .globl vector76 vector76: pushl $0 -8010572d: 6a 00 push $0x0 +801054de: 6a 00 push $0x0 pushl $76 -8010572f: 6a 4c push $0x4c +801054e0: 6a 4c push $0x4c jmp alltraps -80105731: e9 19 f9 ff ff jmp 8010504f +801054e2: e9 36 f9 ff ff jmp 80104e1d -80105736 : +801054e7 : .globl vector77 vector77: pushl $0 -80105736: 6a 00 push $0x0 +801054e7: 6a 00 push $0x0 pushl $77 -80105738: 6a 4d push $0x4d +801054e9: 6a 4d push $0x4d jmp alltraps -8010573a: e9 10 f9 ff ff jmp 8010504f +801054eb: e9 2d f9 ff ff jmp 80104e1d -8010573f : +801054f0 : .globl vector78 vector78: pushl $0 -8010573f: 6a 00 push $0x0 +801054f0: 6a 00 push $0x0 pushl $78 -80105741: 6a 4e push $0x4e +801054f2: 6a 4e push $0x4e jmp alltraps -80105743: e9 07 f9 ff ff jmp 8010504f +801054f4: e9 24 f9 ff ff jmp 80104e1d -80105748 : +801054f9 : .globl vector79 vector79: pushl $0 -80105748: 6a 00 push $0x0 +801054f9: 6a 00 push $0x0 pushl $79 -8010574a: 6a 4f push $0x4f +801054fb: 6a 4f push $0x4f jmp alltraps -8010574c: e9 fe f8 ff ff jmp 8010504f +801054fd: e9 1b f9 ff ff jmp 80104e1d -80105751 : +80105502 : .globl vector80 vector80: pushl $0 -80105751: 6a 00 push $0x0 +80105502: 6a 00 push $0x0 pushl $80 -80105753: 6a 50 push $0x50 +80105504: 6a 50 push $0x50 jmp alltraps -80105755: e9 f5 f8 ff ff jmp 8010504f +80105506: e9 12 f9 ff ff jmp 80104e1d -8010575a : +8010550b : .globl vector81 vector81: pushl $0 -8010575a: 6a 00 push $0x0 +8010550b: 6a 00 push $0x0 pushl $81 -8010575c: 6a 51 push $0x51 +8010550d: 6a 51 push $0x51 jmp alltraps -8010575e: e9 ec f8 ff ff jmp 8010504f +8010550f: e9 09 f9 ff ff jmp 80104e1d -80105763 : +80105514 : .globl vector82 vector82: pushl $0 -80105763: 6a 00 push $0x0 +80105514: 6a 00 push $0x0 pushl $82 -80105765: 6a 52 push $0x52 +80105516: 6a 52 push $0x52 jmp alltraps -80105767: e9 e3 f8 ff ff jmp 8010504f +80105518: e9 00 f9 ff ff jmp 80104e1d -8010576c : +8010551d : .globl vector83 vector83: pushl $0 -8010576c: 6a 00 push $0x0 +8010551d: 6a 00 push $0x0 pushl $83 -8010576e: 6a 53 push $0x53 +8010551f: 6a 53 push $0x53 jmp alltraps -80105770: e9 da f8 ff ff jmp 8010504f +80105521: e9 f7 f8 ff ff jmp 80104e1d -80105775 : +80105526 : .globl vector84 vector84: pushl $0 -80105775: 6a 00 push $0x0 +80105526: 6a 00 push $0x0 pushl $84 -80105777: 6a 54 push $0x54 +80105528: 6a 54 push $0x54 jmp alltraps -80105779: e9 d1 f8 ff ff jmp 8010504f +8010552a: e9 ee f8 ff ff jmp 80104e1d -8010577e : +8010552f : .globl vector85 vector85: pushl $0 -8010577e: 6a 00 push $0x0 +8010552f: 6a 00 push $0x0 pushl $85 -80105780: 6a 55 push $0x55 +80105531: 6a 55 push $0x55 jmp alltraps -80105782: e9 c8 f8 ff ff jmp 8010504f +80105533: e9 e5 f8 ff ff jmp 80104e1d -80105787 : +80105538 : .globl vector86 vector86: pushl $0 -80105787: 6a 00 push $0x0 +80105538: 6a 00 push $0x0 pushl $86 -80105789: 6a 56 push $0x56 +8010553a: 6a 56 push $0x56 jmp alltraps -8010578b: e9 bf f8 ff ff jmp 8010504f +8010553c: e9 dc f8 ff ff jmp 80104e1d -80105790 : +80105541 : .globl vector87 vector87: pushl $0 -80105790: 6a 00 push $0x0 +80105541: 6a 00 push $0x0 pushl $87 -80105792: 6a 57 push $0x57 +80105543: 6a 57 push $0x57 jmp alltraps -80105794: e9 b6 f8 ff ff jmp 8010504f +80105545: e9 d3 f8 ff ff jmp 80104e1d -80105799 : +8010554a : .globl vector88 vector88: pushl $0 -80105799: 6a 00 push $0x0 +8010554a: 6a 00 push $0x0 pushl $88 -8010579b: 6a 58 push $0x58 +8010554c: 6a 58 push $0x58 jmp alltraps -8010579d: e9 ad f8 ff ff jmp 8010504f +8010554e: e9 ca f8 ff ff jmp 80104e1d -801057a2 : +80105553 : .globl vector89 vector89: pushl $0 -801057a2: 6a 00 push $0x0 +80105553: 6a 00 push $0x0 pushl $89 -801057a4: 6a 59 push $0x59 +80105555: 6a 59 push $0x59 jmp alltraps -801057a6: e9 a4 f8 ff ff jmp 8010504f +80105557: e9 c1 f8 ff ff jmp 80104e1d -801057ab : +8010555c : .globl vector90 vector90: pushl $0 -801057ab: 6a 00 push $0x0 +8010555c: 6a 00 push $0x0 pushl $90 -801057ad: 6a 5a push $0x5a +8010555e: 6a 5a push $0x5a jmp alltraps -801057af: e9 9b f8 ff ff jmp 8010504f +80105560: e9 b8 f8 ff ff jmp 80104e1d -801057b4 : +80105565 : .globl vector91 vector91: pushl $0 -801057b4: 6a 00 push $0x0 +80105565: 6a 00 push $0x0 pushl $91 -801057b6: 6a 5b push $0x5b +80105567: 6a 5b push $0x5b jmp alltraps -801057b8: e9 92 f8 ff ff jmp 8010504f +80105569: e9 af f8 ff ff jmp 80104e1d -801057bd : +8010556e : .globl vector92 vector92: pushl $0 -801057bd: 6a 00 push $0x0 +8010556e: 6a 00 push $0x0 pushl $92 -801057bf: 6a 5c push $0x5c +80105570: 6a 5c push $0x5c jmp alltraps -801057c1: e9 89 f8 ff ff jmp 8010504f +80105572: e9 a6 f8 ff ff jmp 80104e1d -801057c6 : +80105577 : .globl vector93 vector93: pushl $0 -801057c6: 6a 00 push $0x0 +80105577: 6a 00 push $0x0 pushl $93 -801057c8: 6a 5d push $0x5d +80105579: 6a 5d push $0x5d jmp alltraps -801057ca: e9 80 f8 ff ff jmp 8010504f +8010557b: e9 9d f8 ff ff jmp 80104e1d -801057cf : +80105580 : .globl vector94 vector94: pushl $0 -801057cf: 6a 00 push $0x0 +80105580: 6a 00 push $0x0 pushl $94 -801057d1: 6a 5e push $0x5e +80105582: 6a 5e push $0x5e jmp alltraps -801057d3: e9 77 f8 ff ff jmp 8010504f +80105584: e9 94 f8 ff ff jmp 80104e1d -801057d8 : +80105589 : .globl vector95 vector95: pushl $0 -801057d8: 6a 00 push $0x0 +80105589: 6a 00 push $0x0 pushl $95 -801057da: 6a 5f push $0x5f +8010558b: 6a 5f push $0x5f jmp alltraps -801057dc: e9 6e f8 ff ff jmp 8010504f +8010558d: e9 8b f8 ff ff jmp 80104e1d -801057e1 : +80105592 : .globl vector96 vector96: pushl $0 -801057e1: 6a 00 push $0x0 +80105592: 6a 00 push $0x0 pushl $96 -801057e3: 6a 60 push $0x60 +80105594: 6a 60 push $0x60 jmp alltraps -801057e5: e9 65 f8 ff ff jmp 8010504f +80105596: e9 82 f8 ff ff jmp 80104e1d -801057ea : +8010559b : .globl vector97 vector97: pushl $0 -801057ea: 6a 00 push $0x0 +8010559b: 6a 00 push $0x0 pushl $97 -801057ec: 6a 61 push $0x61 +8010559d: 6a 61 push $0x61 jmp alltraps -801057ee: e9 5c f8 ff ff jmp 8010504f +8010559f: e9 79 f8 ff ff jmp 80104e1d -801057f3 : +801055a4 : .globl vector98 vector98: pushl $0 -801057f3: 6a 00 push $0x0 +801055a4: 6a 00 push $0x0 pushl $98 -801057f5: 6a 62 push $0x62 +801055a6: 6a 62 push $0x62 jmp alltraps -801057f7: e9 53 f8 ff ff jmp 8010504f +801055a8: e9 70 f8 ff ff jmp 80104e1d -801057fc : +801055ad : .globl vector99 vector99: pushl $0 -801057fc: 6a 00 push $0x0 +801055ad: 6a 00 push $0x0 pushl $99 -801057fe: 6a 63 push $0x63 +801055af: 6a 63 push $0x63 jmp alltraps -80105800: e9 4a f8 ff ff jmp 8010504f +801055b1: e9 67 f8 ff ff jmp 80104e1d -80105805 : +801055b6 : .globl vector100 vector100: pushl $0 -80105805: 6a 00 push $0x0 +801055b6: 6a 00 push $0x0 pushl $100 -80105807: 6a 64 push $0x64 +801055b8: 6a 64 push $0x64 jmp alltraps -80105809: e9 41 f8 ff ff jmp 8010504f +801055ba: e9 5e f8 ff ff jmp 80104e1d -8010580e : +801055bf : .globl vector101 vector101: pushl $0 -8010580e: 6a 00 push $0x0 +801055bf: 6a 00 push $0x0 pushl $101 -80105810: 6a 65 push $0x65 +801055c1: 6a 65 push $0x65 jmp alltraps -80105812: e9 38 f8 ff ff jmp 8010504f +801055c3: e9 55 f8 ff ff jmp 80104e1d -80105817 : +801055c8 : .globl vector102 vector102: pushl $0 -80105817: 6a 00 push $0x0 +801055c8: 6a 00 push $0x0 pushl $102 -80105819: 6a 66 push $0x66 +801055ca: 6a 66 push $0x66 jmp alltraps -8010581b: e9 2f f8 ff ff jmp 8010504f +801055cc: e9 4c f8 ff ff jmp 80104e1d -80105820 : +801055d1 : .globl vector103 vector103: pushl $0 -80105820: 6a 00 push $0x0 +801055d1: 6a 00 push $0x0 pushl $103 -80105822: 6a 67 push $0x67 +801055d3: 6a 67 push $0x67 jmp alltraps -80105824: e9 26 f8 ff ff jmp 8010504f +801055d5: e9 43 f8 ff ff jmp 80104e1d -80105829 : +801055da : .globl vector104 vector104: pushl $0 -80105829: 6a 00 push $0x0 +801055da: 6a 00 push $0x0 pushl $104 -8010582b: 6a 68 push $0x68 +801055dc: 6a 68 push $0x68 jmp alltraps -8010582d: e9 1d f8 ff ff jmp 8010504f +801055de: e9 3a f8 ff ff jmp 80104e1d -80105832 : +801055e3 : .globl vector105 vector105: pushl $0 -80105832: 6a 00 push $0x0 +801055e3: 6a 00 push $0x0 pushl $105 -80105834: 6a 69 push $0x69 +801055e5: 6a 69 push $0x69 jmp alltraps -80105836: e9 14 f8 ff ff jmp 8010504f +801055e7: e9 31 f8 ff ff jmp 80104e1d -8010583b : +801055ec : .globl vector106 vector106: pushl $0 -8010583b: 6a 00 push $0x0 +801055ec: 6a 00 push $0x0 pushl $106 -8010583d: 6a 6a push $0x6a +801055ee: 6a 6a push $0x6a jmp alltraps -8010583f: e9 0b f8 ff ff jmp 8010504f +801055f0: e9 28 f8 ff ff jmp 80104e1d -80105844 : +801055f5 : .globl vector107 vector107: pushl $0 -80105844: 6a 00 push $0x0 +801055f5: 6a 00 push $0x0 pushl $107 -80105846: 6a 6b push $0x6b +801055f7: 6a 6b push $0x6b jmp alltraps -80105848: e9 02 f8 ff ff jmp 8010504f +801055f9: e9 1f f8 ff ff jmp 80104e1d -8010584d : +801055fe : .globl vector108 vector108: pushl $0 -8010584d: 6a 00 push $0x0 +801055fe: 6a 00 push $0x0 pushl $108 -8010584f: 6a 6c push $0x6c +80105600: 6a 6c push $0x6c jmp alltraps -80105851: e9 f9 f7 ff ff jmp 8010504f +80105602: e9 16 f8 ff ff jmp 80104e1d -80105856 : +80105607 : .globl vector109 vector109: pushl $0 -80105856: 6a 00 push $0x0 +80105607: 6a 00 push $0x0 pushl $109 -80105858: 6a 6d push $0x6d +80105609: 6a 6d push $0x6d jmp alltraps -8010585a: e9 f0 f7 ff ff jmp 8010504f +8010560b: e9 0d f8 ff ff jmp 80104e1d -8010585f : +80105610 : .globl vector110 vector110: pushl $0 -8010585f: 6a 00 push $0x0 +80105610: 6a 00 push $0x0 pushl $110 -80105861: 6a 6e push $0x6e +80105612: 6a 6e push $0x6e jmp alltraps -80105863: e9 e7 f7 ff ff jmp 8010504f +80105614: e9 04 f8 ff ff jmp 80104e1d -80105868 : +80105619 : .globl vector111 vector111: pushl $0 -80105868: 6a 00 push $0x0 +80105619: 6a 00 push $0x0 pushl $111 -8010586a: 6a 6f push $0x6f +8010561b: 6a 6f push $0x6f jmp alltraps -8010586c: e9 de f7 ff ff jmp 8010504f +8010561d: e9 fb f7 ff ff jmp 80104e1d -80105871 : +80105622 : .globl vector112 vector112: pushl $0 -80105871: 6a 00 push $0x0 +80105622: 6a 00 push $0x0 pushl $112 -80105873: 6a 70 push $0x70 +80105624: 6a 70 push $0x70 jmp alltraps -80105875: e9 d5 f7 ff ff jmp 8010504f +80105626: e9 f2 f7 ff ff jmp 80104e1d -8010587a : +8010562b : .globl vector113 vector113: pushl $0 -8010587a: 6a 00 push $0x0 +8010562b: 6a 00 push $0x0 pushl $113 -8010587c: 6a 71 push $0x71 +8010562d: 6a 71 push $0x71 jmp alltraps -8010587e: e9 cc f7 ff ff jmp 8010504f +8010562f: e9 e9 f7 ff ff jmp 80104e1d -80105883 : +80105634 : .globl vector114 vector114: pushl $0 -80105883: 6a 00 push $0x0 +80105634: 6a 00 push $0x0 pushl $114 -80105885: 6a 72 push $0x72 +80105636: 6a 72 push $0x72 jmp alltraps -80105887: e9 c3 f7 ff ff jmp 8010504f +80105638: e9 e0 f7 ff ff jmp 80104e1d -8010588c : +8010563d : .globl vector115 vector115: pushl $0 -8010588c: 6a 00 push $0x0 +8010563d: 6a 00 push $0x0 pushl $115 -8010588e: 6a 73 push $0x73 +8010563f: 6a 73 push $0x73 jmp alltraps -80105890: e9 ba f7 ff ff jmp 8010504f +80105641: e9 d7 f7 ff ff jmp 80104e1d -80105895 : +80105646 : .globl vector116 vector116: pushl $0 -80105895: 6a 00 push $0x0 +80105646: 6a 00 push $0x0 pushl $116 -80105897: 6a 74 push $0x74 +80105648: 6a 74 push $0x74 jmp alltraps -80105899: e9 b1 f7 ff ff jmp 8010504f +8010564a: e9 ce f7 ff ff jmp 80104e1d -8010589e : +8010564f : .globl vector117 vector117: pushl $0 -8010589e: 6a 00 push $0x0 +8010564f: 6a 00 push $0x0 pushl $117 -801058a0: 6a 75 push $0x75 +80105651: 6a 75 push $0x75 jmp alltraps -801058a2: e9 a8 f7 ff ff jmp 8010504f +80105653: e9 c5 f7 ff ff jmp 80104e1d -801058a7 : +80105658 : .globl vector118 vector118: pushl $0 -801058a7: 6a 00 push $0x0 +80105658: 6a 00 push $0x0 pushl $118 -801058a9: 6a 76 push $0x76 +8010565a: 6a 76 push $0x76 jmp alltraps -801058ab: e9 9f f7 ff ff jmp 8010504f +8010565c: e9 bc f7 ff ff jmp 80104e1d -801058b0 : +80105661 : .globl vector119 vector119: pushl $0 -801058b0: 6a 00 push $0x0 +80105661: 6a 00 push $0x0 pushl $119 -801058b2: 6a 77 push $0x77 +80105663: 6a 77 push $0x77 jmp alltraps -801058b4: e9 96 f7 ff ff jmp 8010504f +80105665: e9 b3 f7 ff ff jmp 80104e1d -801058b9 : +8010566a : .globl vector120 vector120: pushl $0 -801058b9: 6a 00 push $0x0 +8010566a: 6a 00 push $0x0 pushl $120 -801058bb: 6a 78 push $0x78 +8010566c: 6a 78 push $0x78 jmp alltraps -801058bd: e9 8d f7 ff ff jmp 8010504f +8010566e: e9 aa f7 ff ff jmp 80104e1d -801058c2 : +80105673 : .globl vector121 vector121: pushl $0 -801058c2: 6a 00 push $0x0 +80105673: 6a 00 push $0x0 pushl $121 -801058c4: 6a 79 push $0x79 +80105675: 6a 79 push $0x79 jmp alltraps -801058c6: e9 84 f7 ff ff jmp 8010504f +80105677: e9 a1 f7 ff ff jmp 80104e1d -801058cb : +8010567c : .globl vector122 vector122: pushl $0 -801058cb: 6a 00 push $0x0 +8010567c: 6a 00 push $0x0 pushl $122 -801058cd: 6a 7a push $0x7a +8010567e: 6a 7a push $0x7a jmp alltraps -801058cf: e9 7b f7 ff ff jmp 8010504f +80105680: e9 98 f7 ff ff jmp 80104e1d -801058d4 : +80105685 : .globl vector123 vector123: pushl $0 -801058d4: 6a 00 push $0x0 +80105685: 6a 00 push $0x0 pushl $123 -801058d6: 6a 7b push $0x7b +80105687: 6a 7b push $0x7b jmp alltraps -801058d8: e9 72 f7 ff ff jmp 8010504f +80105689: e9 8f f7 ff ff jmp 80104e1d -801058dd : +8010568e : .globl vector124 vector124: pushl $0 -801058dd: 6a 00 push $0x0 +8010568e: 6a 00 push $0x0 pushl $124 -801058df: 6a 7c push $0x7c +80105690: 6a 7c push $0x7c jmp alltraps -801058e1: e9 69 f7 ff ff jmp 8010504f +80105692: e9 86 f7 ff ff jmp 80104e1d -801058e6 : +80105697 : .globl vector125 vector125: pushl $0 -801058e6: 6a 00 push $0x0 +80105697: 6a 00 push $0x0 pushl $125 -801058e8: 6a 7d push $0x7d +80105699: 6a 7d push $0x7d jmp alltraps -801058ea: e9 60 f7 ff ff jmp 8010504f +8010569b: e9 7d f7 ff ff jmp 80104e1d -801058ef : +801056a0 : .globl vector126 vector126: pushl $0 -801058ef: 6a 00 push $0x0 +801056a0: 6a 00 push $0x0 pushl $126 -801058f1: 6a 7e push $0x7e +801056a2: 6a 7e push $0x7e jmp alltraps -801058f3: e9 57 f7 ff ff jmp 8010504f +801056a4: e9 74 f7 ff ff jmp 80104e1d -801058f8 : +801056a9 : .globl vector127 vector127: pushl $0 -801058f8: 6a 00 push $0x0 +801056a9: 6a 00 push $0x0 pushl $127 -801058fa: 6a 7f push $0x7f +801056ab: 6a 7f push $0x7f jmp alltraps -801058fc: e9 4e f7 ff ff jmp 8010504f +801056ad: e9 6b f7 ff ff jmp 80104e1d -80105901 : +801056b2 : .globl vector128 vector128: pushl $0 -80105901: 6a 00 push $0x0 +801056b2: 6a 00 push $0x0 pushl $128 -80105903: 68 80 00 00 00 push $0x80 +801056b4: 68 80 00 00 00 push $0x80 jmp alltraps -80105908: e9 42 f7 ff ff jmp 8010504f +801056b9: e9 5f f7 ff ff jmp 80104e1d -8010590d : +801056be : .globl vector129 vector129: pushl $0 -8010590d: 6a 00 push $0x0 +801056be: 6a 00 push $0x0 pushl $129 -8010590f: 68 81 00 00 00 push $0x81 +801056c0: 68 81 00 00 00 push $0x81 jmp alltraps -80105914: e9 36 f7 ff ff jmp 8010504f +801056c5: e9 53 f7 ff ff jmp 80104e1d -80105919 : +801056ca : .globl vector130 vector130: pushl $0 -80105919: 6a 00 push $0x0 +801056ca: 6a 00 push $0x0 pushl $130 -8010591b: 68 82 00 00 00 push $0x82 +801056cc: 68 82 00 00 00 push $0x82 jmp alltraps -80105920: e9 2a f7 ff ff jmp 8010504f +801056d1: e9 47 f7 ff ff jmp 80104e1d -80105925 : +801056d6 : .globl vector131 vector131: pushl $0 -80105925: 6a 00 push $0x0 +801056d6: 6a 00 push $0x0 pushl $131 -80105927: 68 83 00 00 00 push $0x83 +801056d8: 68 83 00 00 00 push $0x83 jmp alltraps -8010592c: e9 1e f7 ff ff jmp 8010504f +801056dd: e9 3b f7 ff ff jmp 80104e1d -80105931 : +801056e2 : .globl vector132 vector132: pushl $0 -80105931: 6a 00 push $0x0 +801056e2: 6a 00 push $0x0 pushl $132 -80105933: 68 84 00 00 00 push $0x84 +801056e4: 68 84 00 00 00 push $0x84 jmp alltraps -80105938: e9 12 f7 ff ff jmp 8010504f +801056e9: e9 2f f7 ff ff jmp 80104e1d -8010593d : +801056ee : .globl vector133 vector133: pushl $0 -8010593d: 6a 00 push $0x0 +801056ee: 6a 00 push $0x0 pushl $133 -8010593f: 68 85 00 00 00 push $0x85 +801056f0: 68 85 00 00 00 push $0x85 jmp alltraps -80105944: e9 06 f7 ff ff jmp 8010504f +801056f5: e9 23 f7 ff ff jmp 80104e1d -80105949 : +801056fa : .globl vector134 vector134: pushl $0 -80105949: 6a 00 push $0x0 +801056fa: 6a 00 push $0x0 pushl $134 -8010594b: 68 86 00 00 00 push $0x86 +801056fc: 68 86 00 00 00 push $0x86 jmp alltraps -80105950: e9 fa f6 ff ff jmp 8010504f +80105701: e9 17 f7 ff ff jmp 80104e1d -80105955 : +80105706 : .globl vector135 vector135: pushl $0 -80105955: 6a 00 push $0x0 +80105706: 6a 00 push $0x0 pushl $135 -80105957: 68 87 00 00 00 push $0x87 +80105708: 68 87 00 00 00 push $0x87 jmp alltraps -8010595c: e9 ee f6 ff ff jmp 8010504f +8010570d: e9 0b f7 ff ff jmp 80104e1d -80105961 : +80105712 : .globl vector136 vector136: pushl $0 -80105961: 6a 00 push $0x0 +80105712: 6a 00 push $0x0 pushl $136 -80105963: 68 88 00 00 00 push $0x88 +80105714: 68 88 00 00 00 push $0x88 jmp alltraps -80105968: e9 e2 f6 ff ff jmp 8010504f +80105719: e9 ff f6 ff ff jmp 80104e1d -8010596d : +8010571e : .globl vector137 vector137: pushl $0 -8010596d: 6a 00 push $0x0 +8010571e: 6a 00 push $0x0 pushl $137 -8010596f: 68 89 00 00 00 push $0x89 +80105720: 68 89 00 00 00 push $0x89 jmp alltraps -80105974: e9 d6 f6 ff ff jmp 8010504f +80105725: e9 f3 f6 ff ff jmp 80104e1d -80105979 : +8010572a : .globl vector138 vector138: pushl $0 -80105979: 6a 00 push $0x0 +8010572a: 6a 00 push $0x0 pushl $138 -8010597b: 68 8a 00 00 00 push $0x8a +8010572c: 68 8a 00 00 00 push $0x8a jmp alltraps -80105980: e9 ca f6 ff ff jmp 8010504f +80105731: e9 e7 f6 ff ff jmp 80104e1d -80105985 : +80105736 : .globl vector139 vector139: pushl $0 -80105985: 6a 00 push $0x0 +80105736: 6a 00 push $0x0 pushl $139 -80105987: 68 8b 00 00 00 push $0x8b +80105738: 68 8b 00 00 00 push $0x8b jmp alltraps -8010598c: e9 be f6 ff ff jmp 8010504f +8010573d: e9 db f6 ff ff jmp 80104e1d -80105991 : +80105742 : .globl vector140 vector140: pushl $0 -80105991: 6a 00 push $0x0 +80105742: 6a 00 push $0x0 pushl $140 -80105993: 68 8c 00 00 00 push $0x8c +80105744: 68 8c 00 00 00 push $0x8c jmp alltraps -80105998: e9 b2 f6 ff ff jmp 8010504f +80105749: e9 cf f6 ff ff jmp 80104e1d -8010599d : +8010574e : .globl vector141 vector141: pushl $0 -8010599d: 6a 00 push $0x0 +8010574e: 6a 00 push $0x0 pushl $141 -8010599f: 68 8d 00 00 00 push $0x8d +80105750: 68 8d 00 00 00 push $0x8d jmp alltraps -801059a4: e9 a6 f6 ff ff jmp 8010504f +80105755: e9 c3 f6 ff ff jmp 80104e1d -801059a9 : +8010575a : .globl vector142 vector142: pushl $0 -801059a9: 6a 00 push $0x0 +8010575a: 6a 00 push $0x0 pushl $142 -801059ab: 68 8e 00 00 00 push $0x8e +8010575c: 68 8e 00 00 00 push $0x8e jmp alltraps -801059b0: e9 9a f6 ff ff jmp 8010504f +80105761: e9 b7 f6 ff ff jmp 80104e1d -801059b5 : +80105766 : .globl vector143 vector143: pushl $0 -801059b5: 6a 00 push $0x0 +80105766: 6a 00 push $0x0 pushl $143 -801059b7: 68 8f 00 00 00 push $0x8f +80105768: 68 8f 00 00 00 push $0x8f jmp alltraps -801059bc: e9 8e f6 ff ff jmp 8010504f +8010576d: e9 ab f6 ff ff jmp 80104e1d -801059c1 : +80105772 : .globl vector144 vector144: pushl $0 -801059c1: 6a 00 push $0x0 +80105772: 6a 00 push $0x0 pushl $144 -801059c3: 68 90 00 00 00 push $0x90 +80105774: 68 90 00 00 00 push $0x90 jmp alltraps -801059c8: e9 82 f6 ff ff jmp 8010504f +80105779: e9 9f f6 ff ff jmp 80104e1d -801059cd : +8010577e : .globl vector145 vector145: pushl $0 -801059cd: 6a 00 push $0x0 +8010577e: 6a 00 push $0x0 pushl $145 -801059cf: 68 91 00 00 00 push $0x91 +80105780: 68 91 00 00 00 push $0x91 jmp alltraps -801059d4: e9 76 f6 ff ff jmp 8010504f +80105785: e9 93 f6 ff ff jmp 80104e1d -801059d9 : +8010578a : .globl vector146 vector146: pushl $0 -801059d9: 6a 00 push $0x0 +8010578a: 6a 00 push $0x0 pushl $146 -801059db: 68 92 00 00 00 push $0x92 +8010578c: 68 92 00 00 00 push $0x92 jmp alltraps -801059e0: e9 6a f6 ff ff jmp 8010504f +80105791: e9 87 f6 ff ff jmp 80104e1d -801059e5 : +80105796 : .globl vector147 vector147: pushl $0 -801059e5: 6a 00 push $0x0 +80105796: 6a 00 push $0x0 pushl $147 -801059e7: 68 93 00 00 00 push $0x93 +80105798: 68 93 00 00 00 push $0x93 jmp alltraps -801059ec: e9 5e f6 ff ff jmp 8010504f +8010579d: e9 7b f6 ff ff jmp 80104e1d -801059f1 : +801057a2 : .globl vector148 vector148: pushl $0 -801059f1: 6a 00 push $0x0 +801057a2: 6a 00 push $0x0 pushl $148 -801059f3: 68 94 00 00 00 push $0x94 +801057a4: 68 94 00 00 00 push $0x94 jmp alltraps -801059f8: e9 52 f6 ff ff jmp 8010504f +801057a9: e9 6f f6 ff ff jmp 80104e1d -801059fd : +801057ae : .globl vector149 vector149: pushl $0 -801059fd: 6a 00 push $0x0 +801057ae: 6a 00 push $0x0 pushl $149 -801059ff: 68 95 00 00 00 push $0x95 +801057b0: 68 95 00 00 00 push $0x95 jmp alltraps -80105a04: e9 46 f6 ff ff jmp 8010504f +801057b5: e9 63 f6 ff ff jmp 80104e1d -80105a09 : +801057ba : .globl vector150 vector150: pushl $0 -80105a09: 6a 00 push $0x0 +801057ba: 6a 00 push $0x0 pushl $150 -80105a0b: 68 96 00 00 00 push $0x96 +801057bc: 68 96 00 00 00 push $0x96 jmp alltraps -80105a10: e9 3a f6 ff ff jmp 8010504f +801057c1: e9 57 f6 ff ff jmp 80104e1d -80105a15 : +801057c6 : .globl vector151 vector151: pushl $0 -80105a15: 6a 00 push $0x0 +801057c6: 6a 00 push $0x0 pushl $151 -80105a17: 68 97 00 00 00 push $0x97 +801057c8: 68 97 00 00 00 push $0x97 jmp alltraps -80105a1c: e9 2e f6 ff ff jmp 8010504f +801057cd: e9 4b f6 ff ff jmp 80104e1d -80105a21 : +801057d2 : .globl vector152 vector152: pushl $0 -80105a21: 6a 00 push $0x0 +801057d2: 6a 00 push $0x0 pushl $152 -80105a23: 68 98 00 00 00 push $0x98 +801057d4: 68 98 00 00 00 push $0x98 jmp alltraps -80105a28: e9 22 f6 ff ff jmp 8010504f +801057d9: e9 3f f6 ff ff jmp 80104e1d -80105a2d : +801057de : .globl vector153 vector153: pushl $0 -80105a2d: 6a 00 push $0x0 +801057de: 6a 00 push $0x0 pushl $153 -80105a2f: 68 99 00 00 00 push $0x99 +801057e0: 68 99 00 00 00 push $0x99 jmp alltraps -80105a34: e9 16 f6 ff ff jmp 8010504f +801057e5: e9 33 f6 ff ff jmp 80104e1d -80105a39 : +801057ea : .globl vector154 vector154: pushl $0 -80105a39: 6a 00 push $0x0 +801057ea: 6a 00 push $0x0 pushl $154 -80105a3b: 68 9a 00 00 00 push $0x9a +801057ec: 68 9a 00 00 00 push $0x9a jmp alltraps -80105a40: e9 0a f6 ff ff jmp 8010504f +801057f1: e9 27 f6 ff ff jmp 80104e1d -80105a45 : +801057f6 : .globl vector155 vector155: pushl $0 -80105a45: 6a 00 push $0x0 +801057f6: 6a 00 push $0x0 pushl $155 -80105a47: 68 9b 00 00 00 push $0x9b +801057f8: 68 9b 00 00 00 push $0x9b jmp alltraps -80105a4c: e9 fe f5 ff ff jmp 8010504f +801057fd: e9 1b f6 ff ff jmp 80104e1d -80105a51 : +80105802 : .globl vector156 vector156: pushl $0 -80105a51: 6a 00 push $0x0 +80105802: 6a 00 push $0x0 pushl $156 -80105a53: 68 9c 00 00 00 push $0x9c +80105804: 68 9c 00 00 00 push $0x9c jmp alltraps -80105a58: e9 f2 f5 ff ff jmp 8010504f +80105809: e9 0f f6 ff ff jmp 80104e1d -80105a5d : +8010580e : .globl vector157 vector157: pushl $0 -80105a5d: 6a 00 push $0x0 +8010580e: 6a 00 push $0x0 pushl $157 -80105a5f: 68 9d 00 00 00 push $0x9d +80105810: 68 9d 00 00 00 push $0x9d jmp alltraps -80105a64: e9 e6 f5 ff ff jmp 8010504f +80105815: e9 03 f6 ff ff jmp 80104e1d -80105a69 : +8010581a : .globl vector158 vector158: pushl $0 -80105a69: 6a 00 push $0x0 +8010581a: 6a 00 push $0x0 pushl $158 -80105a6b: 68 9e 00 00 00 push $0x9e +8010581c: 68 9e 00 00 00 push $0x9e jmp alltraps -80105a70: e9 da f5 ff ff jmp 8010504f +80105821: e9 f7 f5 ff ff jmp 80104e1d -80105a75 : +80105826 : .globl vector159 vector159: pushl $0 -80105a75: 6a 00 push $0x0 +80105826: 6a 00 push $0x0 pushl $159 -80105a77: 68 9f 00 00 00 push $0x9f +80105828: 68 9f 00 00 00 push $0x9f jmp alltraps -80105a7c: e9 ce f5 ff ff jmp 8010504f +8010582d: e9 eb f5 ff ff jmp 80104e1d -80105a81 : +80105832 : .globl vector160 vector160: pushl $0 -80105a81: 6a 00 push $0x0 +80105832: 6a 00 push $0x0 pushl $160 -80105a83: 68 a0 00 00 00 push $0xa0 +80105834: 68 a0 00 00 00 push $0xa0 jmp alltraps -80105a88: e9 c2 f5 ff ff jmp 8010504f +80105839: e9 df f5 ff ff jmp 80104e1d -80105a8d : +8010583e : .globl vector161 vector161: pushl $0 -80105a8d: 6a 00 push $0x0 +8010583e: 6a 00 push $0x0 pushl $161 -80105a8f: 68 a1 00 00 00 push $0xa1 +80105840: 68 a1 00 00 00 push $0xa1 jmp alltraps -80105a94: e9 b6 f5 ff ff jmp 8010504f +80105845: e9 d3 f5 ff ff jmp 80104e1d -80105a99 : +8010584a : .globl vector162 vector162: pushl $0 -80105a99: 6a 00 push $0x0 +8010584a: 6a 00 push $0x0 pushl $162 -80105a9b: 68 a2 00 00 00 push $0xa2 +8010584c: 68 a2 00 00 00 push $0xa2 jmp alltraps -80105aa0: e9 aa f5 ff ff jmp 8010504f +80105851: e9 c7 f5 ff ff jmp 80104e1d -80105aa5 : +80105856 : .globl vector163 vector163: pushl $0 -80105aa5: 6a 00 push $0x0 +80105856: 6a 00 push $0x0 pushl $163 -80105aa7: 68 a3 00 00 00 push $0xa3 +80105858: 68 a3 00 00 00 push $0xa3 jmp alltraps -80105aac: e9 9e f5 ff ff jmp 8010504f +8010585d: e9 bb f5 ff ff jmp 80104e1d -80105ab1 : +80105862 : .globl vector164 vector164: pushl $0 -80105ab1: 6a 00 push $0x0 +80105862: 6a 00 push $0x0 pushl $164 -80105ab3: 68 a4 00 00 00 push $0xa4 +80105864: 68 a4 00 00 00 push $0xa4 jmp alltraps -80105ab8: e9 92 f5 ff ff jmp 8010504f +80105869: e9 af f5 ff ff jmp 80104e1d -80105abd : +8010586e : .globl vector165 vector165: pushl $0 -80105abd: 6a 00 push $0x0 +8010586e: 6a 00 push $0x0 pushl $165 -80105abf: 68 a5 00 00 00 push $0xa5 +80105870: 68 a5 00 00 00 push $0xa5 jmp alltraps -80105ac4: e9 86 f5 ff ff jmp 8010504f +80105875: e9 a3 f5 ff ff jmp 80104e1d -80105ac9 : +8010587a : .globl vector166 vector166: pushl $0 -80105ac9: 6a 00 push $0x0 +8010587a: 6a 00 push $0x0 pushl $166 -80105acb: 68 a6 00 00 00 push $0xa6 +8010587c: 68 a6 00 00 00 push $0xa6 jmp alltraps -80105ad0: e9 7a f5 ff ff jmp 8010504f +80105881: e9 97 f5 ff ff jmp 80104e1d -80105ad5 : +80105886 : .globl vector167 vector167: pushl $0 -80105ad5: 6a 00 push $0x0 +80105886: 6a 00 push $0x0 pushl $167 -80105ad7: 68 a7 00 00 00 push $0xa7 +80105888: 68 a7 00 00 00 push $0xa7 jmp alltraps -80105adc: e9 6e f5 ff ff jmp 8010504f +8010588d: e9 8b f5 ff ff jmp 80104e1d -80105ae1 : +80105892 : .globl vector168 vector168: pushl $0 -80105ae1: 6a 00 push $0x0 +80105892: 6a 00 push $0x0 pushl $168 -80105ae3: 68 a8 00 00 00 push $0xa8 +80105894: 68 a8 00 00 00 push $0xa8 jmp alltraps -80105ae8: e9 62 f5 ff ff jmp 8010504f +80105899: e9 7f f5 ff ff jmp 80104e1d -80105aed : +8010589e : .globl vector169 vector169: pushl $0 -80105aed: 6a 00 push $0x0 +8010589e: 6a 00 push $0x0 pushl $169 -80105aef: 68 a9 00 00 00 push $0xa9 +801058a0: 68 a9 00 00 00 push $0xa9 jmp alltraps -80105af4: e9 56 f5 ff ff jmp 8010504f +801058a5: e9 73 f5 ff ff jmp 80104e1d -80105af9 : +801058aa : .globl vector170 vector170: pushl $0 -80105af9: 6a 00 push $0x0 +801058aa: 6a 00 push $0x0 pushl $170 -80105afb: 68 aa 00 00 00 push $0xaa +801058ac: 68 aa 00 00 00 push $0xaa jmp alltraps -80105b00: e9 4a f5 ff ff jmp 8010504f +801058b1: e9 67 f5 ff ff jmp 80104e1d -80105b05 : +801058b6 : .globl vector171 vector171: pushl $0 -80105b05: 6a 00 push $0x0 +801058b6: 6a 00 push $0x0 pushl $171 -80105b07: 68 ab 00 00 00 push $0xab +801058b8: 68 ab 00 00 00 push $0xab jmp alltraps -80105b0c: e9 3e f5 ff ff jmp 8010504f +801058bd: e9 5b f5 ff ff jmp 80104e1d -80105b11 : +801058c2 : .globl vector172 vector172: pushl $0 -80105b11: 6a 00 push $0x0 +801058c2: 6a 00 push $0x0 pushl $172 -80105b13: 68 ac 00 00 00 push $0xac +801058c4: 68 ac 00 00 00 push $0xac jmp alltraps -80105b18: e9 32 f5 ff ff jmp 8010504f +801058c9: e9 4f f5 ff ff jmp 80104e1d -80105b1d : +801058ce : .globl vector173 vector173: pushl $0 -80105b1d: 6a 00 push $0x0 +801058ce: 6a 00 push $0x0 pushl $173 -80105b1f: 68 ad 00 00 00 push $0xad +801058d0: 68 ad 00 00 00 push $0xad jmp alltraps -80105b24: e9 26 f5 ff ff jmp 8010504f +801058d5: e9 43 f5 ff ff jmp 80104e1d -80105b29 : +801058da : .globl vector174 vector174: pushl $0 -80105b29: 6a 00 push $0x0 +801058da: 6a 00 push $0x0 pushl $174 -80105b2b: 68 ae 00 00 00 push $0xae +801058dc: 68 ae 00 00 00 push $0xae jmp alltraps -80105b30: e9 1a f5 ff ff jmp 8010504f +801058e1: e9 37 f5 ff ff jmp 80104e1d -80105b35 : +801058e6 : .globl vector175 vector175: pushl $0 -80105b35: 6a 00 push $0x0 +801058e6: 6a 00 push $0x0 pushl $175 -80105b37: 68 af 00 00 00 push $0xaf +801058e8: 68 af 00 00 00 push $0xaf jmp alltraps -80105b3c: e9 0e f5 ff ff jmp 8010504f +801058ed: e9 2b f5 ff ff jmp 80104e1d -80105b41 : +801058f2 : .globl vector176 vector176: pushl $0 -80105b41: 6a 00 push $0x0 +801058f2: 6a 00 push $0x0 pushl $176 -80105b43: 68 b0 00 00 00 push $0xb0 +801058f4: 68 b0 00 00 00 push $0xb0 jmp alltraps -80105b48: e9 02 f5 ff ff jmp 8010504f +801058f9: e9 1f f5 ff ff jmp 80104e1d -80105b4d : +801058fe : .globl vector177 vector177: pushl $0 -80105b4d: 6a 00 push $0x0 +801058fe: 6a 00 push $0x0 pushl $177 -80105b4f: 68 b1 00 00 00 push $0xb1 +80105900: 68 b1 00 00 00 push $0xb1 jmp alltraps -80105b54: e9 f6 f4 ff ff jmp 8010504f +80105905: e9 13 f5 ff ff jmp 80104e1d -80105b59 : +8010590a : .globl vector178 vector178: pushl $0 -80105b59: 6a 00 push $0x0 +8010590a: 6a 00 push $0x0 pushl $178 -80105b5b: 68 b2 00 00 00 push $0xb2 +8010590c: 68 b2 00 00 00 push $0xb2 jmp alltraps -80105b60: e9 ea f4 ff ff jmp 8010504f +80105911: e9 07 f5 ff ff jmp 80104e1d -80105b65 : +80105916 : .globl vector179 vector179: pushl $0 -80105b65: 6a 00 push $0x0 +80105916: 6a 00 push $0x0 pushl $179 -80105b67: 68 b3 00 00 00 push $0xb3 +80105918: 68 b3 00 00 00 push $0xb3 jmp alltraps -80105b6c: e9 de f4 ff ff jmp 8010504f +8010591d: e9 fb f4 ff ff jmp 80104e1d -80105b71 : +80105922 : .globl vector180 vector180: pushl $0 -80105b71: 6a 00 push $0x0 +80105922: 6a 00 push $0x0 pushl $180 -80105b73: 68 b4 00 00 00 push $0xb4 +80105924: 68 b4 00 00 00 push $0xb4 jmp alltraps -80105b78: e9 d2 f4 ff ff jmp 8010504f +80105929: e9 ef f4 ff ff jmp 80104e1d -80105b7d : +8010592e : .globl vector181 vector181: pushl $0 -80105b7d: 6a 00 push $0x0 +8010592e: 6a 00 push $0x0 pushl $181 -80105b7f: 68 b5 00 00 00 push $0xb5 +80105930: 68 b5 00 00 00 push $0xb5 jmp alltraps -80105b84: e9 c6 f4 ff ff jmp 8010504f +80105935: e9 e3 f4 ff ff jmp 80104e1d -80105b89 : +8010593a : .globl vector182 vector182: pushl $0 -80105b89: 6a 00 push $0x0 +8010593a: 6a 00 push $0x0 pushl $182 -80105b8b: 68 b6 00 00 00 push $0xb6 +8010593c: 68 b6 00 00 00 push $0xb6 jmp alltraps -80105b90: e9 ba f4 ff ff jmp 8010504f +80105941: e9 d7 f4 ff ff jmp 80104e1d -80105b95 : +80105946 : .globl vector183 vector183: pushl $0 -80105b95: 6a 00 push $0x0 +80105946: 6a 00 push $0x0 pushl $183 -80105b97: 68 b7 00 00 00 push $0xb7 +80105948: 68 b7 00 00 00 push $0xb7 jmp alltraps -80105b9c: e9 ae f4 ff ff jmp 8010504f +8010594d: e9 cb f4 ff ff jmp 80104e1d -80105ba1 : +80105952 : .globl vector184 vector184: pushl $0 -80105ba1: 6a 00 push $0x0 +80105952: 6a 00 push $0x0 pushl $184 -80105ba3: 68 b8 00 00 00 push $0xb8 +80105954: 68 b8 00 00 00 push $0xb8 jmp alltraps -80105ba8: e9 a2 f4 ff ff jmp 8010504f +80105959: e9 bf f4 ff ff jmp 80104e1d -80105bad : +8010595e : .globl vector185 vector185: pushl $0 -80105bad: 6a 00 push $0x0 +8010595e: 6a 00 push $0x0 pushl $185 -80105baf: 68 b9 00 00 00 push $0xb9 +80105960: 68 b9 00 00 00 push $0xb9 jmp alltraps -80105bb4: e9 96 f4 ff ff jmp 8010504f +80105965: e9 b3 f4 ff ff jmp 80104e1d -80105bb9 : +8010596a : .globl vector186 vector186: pushl $0 -80105bb9: 6a 00 push $0x0 +8010596a: 6a 00 push $0x0 pushl $186 -80105bbb: 68 ba 00 00 00 push $0xba +8010596c: 68 ba 00 00 00 push $0xba jmp alltraps -80105bc0: e9 8a f4 ff ff jmp 8010504f +80105971: e9 a7 f4 ff ff jmp 80104e1d -80105bc5 : +80105976 : .globl vector187 vector187: pushl $0 -80105bc5: 6a 00 push $0x0 +80105976: 6a 00 push $0x0 pushl $187 -80105bc7: 68 bb 00 00 00 push $0xbb +80105978: 68 bb 00 00 00 push $0xbb jmp alltraps -80105bcc: e9 7e f4 ff ff jmp 8010504f +8010597d: e9 9b f4 ff ff jmp 80104e1d -80105bd1 : +80105982 : .globl vector188 vector188: pushl $0 -80105bd1: 6a 00 push $0x0 +80105982: 6a 00 push $0x0 pushl $188 -80105bd3: 68 bc 00 00 00 push $0xbc +80105984: 68 bc 00 00 00 push $0xbc jmp alltraps -80105bd8: e9 72 f4 ff ff jmp 8010504f +80105989: e9 8f f4 ff ff jmp 80104e1d -80105bdd : +8010598e : .globl vector189 vector189: pushl $0 -80105bdd: 6a 00 push $0x0 +8010598e: 6a 00 push $0x0 pushl $189 -80105bdf: 68 bd 00 00 00 push $0xbd +80105990: 68 bd 00 00 00 push $0xbd jmp alltraps -80105be4: e9 66 f4 ff ff jmp 8010504f +80105995: e9 83 f4 ff ff jmp 80104e1d -80105be9 : +8010599a : .globl vector190 vector190: pushl $0 -80105be9: 6a 00 push $0x0 +8010599a: 6a 00 push $0x0 pushl $190 -80105beb: 68 be 00 00 00 push $0xbe +8010599c: 68 be 00 00 00 push $0xbe jmp alltraps -80105bf0: e9 5a f4 ff ff jmp 8010504f +801059a1: e9 77 f4 ff ff jmp 80104e1d -80105bf5 : +801059a6 : .globl vector191 vector191: pushl $0 -80105bf5: 6a 00 push $0x0 +801059a6: 6a 00 push $0x0 pushl $191 -80105bf7: 68 bf 00 00 00 push $0xbf +801059a8: 68 bf 00 00 00 push $0xbf jmp alltraps -80105bfc: e9 4e f4 ff ff jmp 8010504f +801059ad: e9 6b f4 ff ff jmp 80104e1d -80105c01 : +801059b2 : .globl vector192 vector192: pushl $0 -80105c01: 6a 00 push $0x0 +801059b2: 6a 00 push $0x0 pushl $192 -80105c03: 68 c0 00 00 00 push $0xc0 +801059b4: 68 c0 00 00 00 push $0xc0 jmp alltraps -80105c08: e9 42 f4 ff ff jmp 8010504f +801059b9: e9 5f f4 ff ff jmp 80104e1d -80105c0d : +801059be : .globl vector193 vector193: pushl $0 -80105c0d: 6a 00 push $0x0 +801059be: 6a 00 push $0x0 pushl $193 -80105c0f: 68 c1 00 00 00 push $0xc1 +801059c0: 68 c1 00 00 00 push $0xc1 jmp alltraps -80105c14: e9 36 f4 ff ff jmp 8010504f +801059c5: e9 53 f4 ff ff jmp 80104e1d -80105c19 : +801059ca : .globl vector194 vector194: pushl $0 -80105c19: 6a 00 push $0x0 +801059ca: 6a 00 push $0x0 pushl $194 -80105c1b: 68 c2 00 00 00 push $0xc2 +801059cc: 68 c2 00 00 00 push $0xc2 jmp alltraps -80105c20: e9 2a f4 ff ff jmp 8010504f +801059d1: e9 47 f4 ff ff jmp 80104e1d -80105c25 : +801059d6 : .globl vector195 vector195: pushl $0 -80105c25: 6a 00 push $0x0 +801059d6: 6a 00 push $0x0 pushl $195 -80105c27: 68 c3 00 00 00 push $0xc3 +801059d8: 68 c3 00 00 00 push $0xc3 jmp alltraps -80105c2c: e9 1e f4 ff ff jmp 8010504f +801059dd: e9 3b f4 ff ff jmp 80104e1d -80105c31 : +801059e2 : .globl vector196 vector196: pushl $0 -80105c31: 6a 00 push $0x0 +801059e2: 6a 00 push $0x0 pushl $196 -80105c33: 68 c4 00 00 00 push $0xc4 +801059e4: 68 c4 00 00 00 push $0xc4 jmp alltraps -80105c38: e9 12 f4 ff ff jmp 8010504f +801059e9: e9 2f f4 ff ff jmp 80104e1d -80105c3d : +801059ee : .globl vector197 vector197: pushl $0 -80105c3d: 6a 00 push $0x0 +801059ee: 6a 00 push $0x0 pushl $197 -80105c3f: 68 c5 00 00 00 push $0xc5 +801059f0: 68 c5 00 00 00 push $0xc5 jmp alltraps -80105c44: e9 06 f4 ff ff jmp 8010504f +801059f5: e9 23 f4 ff ff jmp 80104e1d -80105c49 : +801059fa : .globl vector198 vector198: pushl $0 -80105c49: 6a 00 push $0x0 +801059fa: 6a 00 push $0x0 pushl $198 -80105c4b: 68 c6 00 00 00 push $0xc6 +801059fc: 68 c6 00 00 00 push $0xc6 jmp alltraps -80105c50: e9 fa f3 ff ff jmp 8010504f +80105a01: e9 17 f4 ff ff jmp 80104e1d -80105c55 : +80105a06 : .globl vector199 vector199: pushl $0 -80105c55: 6a 00 push $0x0 +80105a06: 6a 00 push $0x0 pushl $199 -80105c57: 68 c7 00 00 00 push $0xc7 +80105a08: 68 c7 00 00 00 push $0xc7 jmp alltraps -80105c5c: e9 ee f3 ff ff jmp 8010504f +80105a0d: e9 0b f4 ff ff jmp 80104e1d -80105c61 : +80105a12 : .globl vector200 vector200: pushl $0 -80105c61: 6a 00 push $0x0 +80105a12: 6a 00 push $0x0 pushl $200 -80105c63: 68 c8 00 00 00 push $0xc8 +80105a14: 68 c8 00 00 00 push $0xc8 jmp alltraps -80105c68: e9 e2 f3 ff ff jmp 8010504f +80105a19: e9 ff f3 ff ff jmp 80104e1d -80105c6d : +80105a1e : .globl vector201 vector201: pushl $0 -80105c6d: 6a 00 push $0x0 +80105a1e: 6a 00 push $0x0 pushl $201 -80105c6f: 68 c9 00 00 00 push $0xc9 +80105a20: 68 c9 00 00 00 push $0xc9 jmp alltraps -80105c74: e9 d6 f3 ff ff jmp 8010504f +80105a25: e9 f3 f3 ff ff jmp 80104e1d -80105c79 : +80105a2a : .globl vector202 vector202: pushl $0 -80105c79: 6a 00 push $0x0 +80105a2a: 6a 00 push $0x0 pushl $202 -80105c7b: 68 ca 00 00 00 push $0xca +80105a2c: 68 ca 00 00 00 push $0xca jmp alltraps -80105c80: e9 ca f3 ff ff jmp 8010504f +80105a31: e9 e7 f3 ff ff jmp 80104e1d -80105c85 : +80105a36 : .globl vector203 vector203: pushl $0 -80105c85: 6a 00 push $0x0 +80105a36: 6a 00 push $0x0 pushl $203 -80105c87: 68 cb 00 00 00 push $0xcb +80105a38: 68 cb 00 00 00 push $0xcb jmp alltraps -80105c8c: e9 be f3 ff ff jmp 8010504f +80105a3d: e9 db f3 ff ff jmp 80104e1d -80105c91 : +80105a42 : .globl vector204 vector204: pushl $0 -80105c91: 6a 00 push $0x0 +80105a42: 6a 00 push $0x0 pushl $204 -80105c93: 68 cc 00 00 00 push $0xcc +80105a44: 68 cc 00 00 00 push $0xcc jmp alltraps -80105c98: e9 b2 f3 ff ff jmp 8010504f +80105a49: e9 cf f3 ff ff jmp 80104e1d -80105c9d : +80105a4e : .globl vector205 vector205: pushl $0 -80105c9d: 6a 00 push $0x0 +80105a4e: 6a 00 push $0x0 pushl $205 -80105c9f: 68 cd 00 00 00 push $0xcd +80105a50: 68 cd 00 00 00 push $0xcd jmp alltraps -80105ca4: e9 a6 f3 ff ff jmp 8010504f +80105a55: e9 c3 f3 ff ff jmp 80104e1d -80105ca9 : +80105a5a : .globl vector206 vector206: pushl $0 -80105ca9: 6a 00 push $0x0 +80105a5a: 6a 00 push $0x0 pushl $206 -80105cab: 68 ce 00 00 00 push $0xce +80105a5c: 68 ce 00 00 00 push $0xce jmp alltraps -80105cb0: e9 9a f3 ff ff jmp 8010504f +80105a61: e9 b7 f3 ff ff jmp 80104e1d -80105cb5 : +80105a66 : .globl vector207 vector207: pushl $0 -80105cb5: 6a 00 push $0x0 +80105a66: 6a 00 push $0x0 pushl $207 -80105cb7: 68 cf 00 00 00 push $0xcf +80105a68: 68 cf 00 00 00 push $0xcf jmp alltraps -80105cbc: e9 8e f3 ff ff jmp 8010504f +80105a6d: e9 ab f3 ff ff jmp 80104e1d -80105cc1 : +80105a72 : .globl vector208 vector208: pushl $0 -80105cc1: 6a 00 push $0x0 +80105a72: 6a 00 push $0x0 pushl $208 -80105cc3: 68 d0 00 00 00 push $0xd0 +80105a74: 68 d0 00 00 00 push $0xd0 jmp alltraps -80105cc8: e9 82 f3 ff ff jmp 8010504f +80105a79: e9 9f f3 ff ff jmp 80104e1d -80105ccd : +80105a7e : .globl vector209 vector209: pushl $0 -80105ccd: 6a 00 push $0x0 +80105a7e: 6a 00 push $0x0 pushl $209 -80105ccf: 68 d1 00 00 00 push $0xd1 +80105a80: 68 d1 00 00 00 push $0xd1 jmp alltraps -80105cd4: e9 76 f3 ff ff jmp 8010504f +80105a85: e9 93 f3 ff ff jmp 80104e1d -80105cd9 : +80105a8a : .globl vector210 vector210: pushl $0 -80105cd9: 6a 00 push $0x0 +80105a8a: 6a 00 push $0x0 pushl $210 -80105cdb: 68 d2 00 00 00 push $0xd2 +80105a8c: 68 d2 00 00 00 push $0xd2 jmp alltraps -80105ce0: e9 6a f3 ff ff jmp 8010504f +80105a91: e9 87 f3 ff ff jmp 80104e1d -80105ce5 : +80105a96 : .globl vector211 vector211: pushl $0 -80105ce5: 6a 00 push $0x0 +80105a96: 6a 00 push $0x0 pushl $211 -80105ce7: 68 d3 00 00 00 push $0xd3 +80105a98: 68 d3 00 00 00 push $0xd3 jmp alltraps -80105cec: e9 5e f3 ff ff jmp 8010504f +80105a9d: e9 7b f3 ff ff jmp 80104e1d -80105cf1 : +80105aa2 : .globl vector212 vector212: pushl $0 -80105cf1: 6a 00 push $0x0 +80105aa2: 6a 00 push $0x0 pushl $212 -80105cf3: 68 d4 00 00 00 push $0xd4 +80105aa4: 68 d4 00 00 00 push $0xd4 jmp alltraps -80105cf8: e9 52 f3 ff ff jmp 8010504f +80105aa9: e9 6f f3 ff ff jmp 80104e1d -80105cfd : +80105aae : .globl vector213 vector213: pushl $0 -80105cfd: 6a 00 push $0x0 +80105aae: 6a 00 push $0x0 pushl $213 -80105cff: 68 d5 00 00 00 push $0xd5 +80105ab0: 68 d5 00 00 00 push $0xd5 jmp alltraps -80105d04: e9 46 f3 ff ff jmp 8010504f +80105ab5: e9 63 f3 ff ff jmp 80104e1d -80105d09 : +80105aba : .globl vector214 vector214: pushl $0 -80105d09: 6a 00 push $0x0 +80105aba: 6a 00 push $0x0 pushl $214 -80105d0b: 68 d6 00 00 00 push $0xd6 +80105abc: 68 d6 00 00 00 push $0xd6 jmp alltraps -80105d10: e9 3a f3 ff ff jmp 8010504f +80105ac1: e9 57 f3 ff ff jmp 80104e1d -80105d15 : +80105ac6 : .globl vector215 vector215: pushl $0 -80105d15: 6a 00 push $0x0 +80105ac6: 6a 00 push $0x0 pushl $215 -80105d17: 68 d7 00 00 00 push $0xd7 +80105ac8: 68 d7 00 00 00 push $0xd7 jmp alltraps -80105d1c: e9 2e f3 ff ff jmp 8010504f +80105acd: e9 4b f3 ff ff jmp 80104e1d -80105d21 : +80105ad2 : .globl vector216 vector216: pushl $0 -80105d21: 6a 00 push $0x0 +80105ad2: 6a 00 push $0x0 pushl $216 -80105d23: 68 d8 00 00 00 push $0xd8 +80105ad4: 68 d8 00 00 00 push $0xd8 jmp alltraps -80105d28: e9 22 f3 ff ff jmp 8010504f +80105ad9: e9 3f f3 ff ff jmp 80104e1d -80105d2d : +80105ade : .globl vector217 vector217: pushl $0 -80105d2d: 6a 00 push $0x0 +80105ade: 6a 00 push $0x0 pushl $217 -80105d2f: 68 d9 00 00 00 push $0xd9 +80105ae0: 68 d9 00 00 00 push $0xd9 jmp alltraps -80105d34: e9 16 f3 ff ff jmp 8010504f +80105ae5: e9 33 f3 ff ff jmp 80104e1d -80105d39 : +80105aea : .globl vector218 vector218: pushl $0 -80105d39: 6a 00 push $0x0 +80105aea: 6a 00 push $0x0 pushl $218 -80105d3b: 68 da 00 00 00 push $0xda +80105aec: 68 da 00 00 00 push $0xda jmp alltraps -80105d40: e9 0a f3 ff ff jmp 8010504f +80105af1: e9 27 f3 ff ff jmp 80104e1d -80105d45 : +80105af6 : .globl vector219 vector219: pushl $0 -80105d45: 6a 00 push $0x0 +80105af6: 6a 00 push $0x0 pushl $219 -80105d47: 68 db 00 00 00 push $0xdb +80105af8: 68 db 00 00 00 push $0xdb jmp alltraps -80105d4c: e9 fe f2 ff ff jmp 8010504f +80105afd: e9 1b f3 ff ff jmp 80104e1d -80105d51 : +80105b02 : .globl vector220 vector220: pushl $0 -80105d51: 6a 00 push $0x0 +80105b02: 6a 00 push $0x0 pushl $220 -80105d53: 68 dc 00 00 00 push $0xdc +80105b04: 68 dc 00 00 00 push $0xdc jmp alltraps -80105d58: e9 f2 f2 ff ff jmp 8010504f +80105b09: e9 0f f3 ff ff jmp 80104e1d -80105d5d : +80105b0e : .globl vector221 vector221: pushl $0 -80105d5d: 6a 00 push $0x0 +80105b0e: 6a 00 push $0x0 pushl $221 -80105d5f: 68 dd 00 00 00 push $0xdd +80105b10: 68 dd 00 00 00 push $0xdd jmp alltraps -80105d64: e9 e6 f2 ff ff jmp 8010504f +80105b15: e9 03 f3 ff ff jmp 80104e1d -80105d69 : +80105b1a : .globl vector222 vector222: pushl $0 -80105d69: 6a 00 push $0x0 +80105b1a: 6a 00 push $0x0 pushl $222 -80105d6b: 68 de 00 00 00 push $0xde +80105b1c: 68 de 00 00 00 push $0xde jmp alltraps -80105d70: e9 da f2 ff ff jmp 8010504f +80105b21: e9 f7 f2 ff ff jmp 80104e1d -80105d75 : +80105b26 : .globl vector223 vector223: pushl $0 -80105d75: 6a 00 push $0x0 +80105b26: 6a 00 push $0x0 pushl $223 -80105d77: 68 df 00 00 00 push $0xdf +80105b28: 68 df 00 00 00 push $0xdf jmp alltraps -80105d7c: e9 ce f2 ff ff jmp 8010504f +80105b2d: e9 eb f2 ff ff jmp 80104e1d -80105d81 : +80105b32 : .globl vector224 vector224: pushl $0 -80105d81: 6a 00 push $0x0 +80105b32: 6a 00 push $0x0 pushl $224 -80105d83: 68 e0 00 00 00 push $0xe0 +80105b34: 68 e0 00 00 00 push $0xe0 jmp alltraps -80105d88: e9 c2 f2 ff ff jmp 8010504f +80105b39: e9 df f2 ff ff jmp 80104e1d -80105d8d : +80105b3e : .globl vector225 vector225: pushl $0 -80105d8d: 6a 00 push $0x0 +80105b3e: 6a 00 push $0x0 pushl $225 -80105d8f: 68 e1 00 00 00 push $0xe1 +80105b40: 68 e1 00 00 00 push $0xe1 jmp alltraps -80105d94: e9 b6 f2 ff ff jmp 8010504f +80105b45: e9 d3 f2 ff ff jmp 80104e1d -80105d99 : +80105b4a : .globl vector226 vector226: pushl $0 -80105d99: 6a 00 push $0x0 +80105b4a: 6a 00 push $0x0 pushl $226 -80105d9b: 68 e2 00 00 00 push $0xe2 +80105b4c: 68 e2 00 00 00 push $0xe2 jmp alltraps -80105da0: e9 aa f2 ff ff jmp 8010504f +80105b51: e9 c7 f2 ff ff jmp 80104e1d -80105da5 : +80105b56 : .globl vector227 vector227: pushl $0 -80105da5: 6a 00 push $0x0 +80105b56: 6a 00 push $0x0 pushl $227 -80105da7: 68 e3 00 00 00 push $0xe3 +80105b58: 68 e3 00 00 00 push $0xe3 jmp alltraps -80105dac: e9 9e f2 ff ff jmp 8010504f +80105b5d: e9 bb f2 ff ff jmp 80104e1d -80105db1 : +80105b62 : .globl vector228 vector228: pushl $0 -80105db1: 6a 00 push $0x0 +80105b62: 6a 00 push $0x0 pushl $228 -80105db3: 68 e4 00 00 00 push $0xe4 +80105b64: 68 e4 00 00 00 push $0xe4 jmp alltraps -80105db8: e9 92 f2 ff ff jmp 8010504f +80105b69: e9 af f2 ff ff jmp 80104e1d -80105dbd : +80105b6e : .globl vector229 vector229: pushl $0 -80105dbd: 6a 00 push $0x0 +80105b6e: 6a 00 push $0x0 pushl $229 -80105dbf: 68 e5 00 00 00 push $0xe5 +80105b70: 68 e5 00 00 00 push $0xe5 jmp alltraps -80105dc4: e9 86 f2 ff ff jmp 8010504f +80105b75: e9 a3 f2 ff ff jmp 80104e1d -80105dc9 : +80105b7a : .globl vector230 vector230: pushl $0 -80105dc9: 6a 00 push $0x0 +80105b7a: 6a 00 push $0x0 pushl $230 -80105dcb: 68 e6 00 00 00 push $0xe6 +80105b7c: 68 e6 00 00 00 push $0xe6 jmp alltraps -80105dd0: e9 7a f2 ff ff jmp 8010504f +80105b81: e9 97 f2 ff ff jmp 80104e1d -80105dd5 : +80105b86 : .globl vector231 vector231: pushl $0 -80105dd5: 6a 00 push $0x0 +80105b86: 6a 00 push $0x0 pushl $231 -80105dd7: 68 e7 00 00 00 push $0xe7 +80105b88: 68 e7 00 00 00 push $0xe7 jmp alltraps -80105ddc: e9 6e f2 ff ff jmp 8010504f +80105b8d: e9 8b f2 ff ff jmp 80104e1d -80105de1 : +80105b92 : .globl vector232 vector232: pushl $0 -80105de1: 6a 00 push $0x0 +80105b92: 6a 00 push $0x0 pushl $232 -80105de3: 68 e8 00 00 00 push $0xe8 +80105b94: 68 e8 00 00 00 push $0xe8 jmp alltraps -80105de8: e9 62 f2 ff ff jmp 8010504f +80105b99: e9 7f f2 ff ff jmp 80104e1d -80105ded : +80105b9e : .globl vector233 vector233: pushl $0 -80105ded: 6a 00 push $0x0 +80105b9e: 6a 00 push $0x0 pushl $233 -80105def: 68 e9 00 00 00 push $0xe9 +80105ba0: 68 e9 00 00 00 push $0xe9 jmp alltraps -80105df4: e9 56 f2 ff ff jmp 8010504f +80105ba5: e9 73 f2 ff ff jmp 80104e1d -80105df9 : +80105baa : .globl vector234 vector234: pushl $0 -80105df9: 6a 00 push $0x0 +80105baa: 6a 00 push $0x0 pushl $234 -80105dfb: 68 ea 00 00 00 push $0xea +80105bac: 68 ea 00 00 00 push $0xea jmp alltraps -80105e00: e9 4a f2 ff ff jmp 8010504f +80105bb1: e9 67 f2 ff ff jmp 80104e1d -80105e05 : +80105bb6 : .globl vector235 vector235: pushl $0 -80105e05: 6a 00 push $0x0 +80105bb6: 6a 00 push $0x0 pushl $235 -80105e07: 68 eb 00 00 00 push $0xeb +80105bb8: 68 eb 00 00 00 push $0xeb jmp alltraps -80105e0c: e9 3e f2 ff ff jmp 8010504f +80105bbd: e9 5b f2 ff ff jmp 80104e1d -80105e11 : +80105bc2 : .globl vector236 vector236: pushl $0 -80105e11: 6a 00 push $0x0 +80105bc2: 6a 00 push $0x0 pushl $236 -80105e13: 68 ec 00 00 00 push $0xec +80105bc4: 68 ec 00 00 00 push $0xec jmp alltraps -80105e18: e9 32 f2 ff ff jmp 8010504f +80105bc9: e9 4f f2 ff ff jmp 80104e1d -80105e1d : +80105bce : .globl vector237 vector237: pushl $0 -80105e1d: 6a 00 push $0x0 +80105bce: 6a 00 push $0x0 pushl $237 -80105e1f: 68 ed 00 00 00 push $0xed +80105bd0: 68 ed 00 00 00 push $0xed jmp alltraps -80105e24: e9 26 f2 ff ff jmp 8010504f +80105bd5: e9 43 f2 ff ff jmp 80104e1d -80105e29 : +80105bda : .globl vector238 vector238: pushl $0 -80105e29: 6a 00 push $0x0 +80105bda: 6a 00 push $0x0 pushl $238 -80105e2b: 68 ee 00 00 00 push $0xee +80105bdc: 68 ee 00 00 00 push $0xee jmp alltraps -80105e30: e9 1a f2 ff ff jmp 8010504f +80105be1: e9 37 f2 ff ff jmp 80104e1d -80105e35 : +80105be6 : .globl vector239 vector239: pushl $0 -80105e35: 6a 00 push $0x0 +80105be6: 6a 00 push $0x0 pushl $239 -80105e37: 68 ef 00 00 00 push $0xef +80105be8: 68 ef 00 00 00 push $0xef jmp alltraps -80105e3c: e9 0e f2 ff ff jmp 8010504f +80105bed: e9 2b f2 ff ff jmp 80104e1d -80105e41 : +80105bf2 : .globl vector240 vector240: pushl $0 -80105e41: 6a 00 push $0x0 +80105bf2: 6a 00 push $0x0 pushl $240 -80105e43: 68 f0 00 00 00 push $0xf0 +80105bf4: 68 f0 00 00 00 push $0xf0 jmp alltraps -80105e48: e9 02 f2 ff ff jmp 8010504f +80105bf9: e9 1f f2 ff ff jmp 80104e1d -80105e4d : +80105bfe : .globl vector241 vector241: pushl $0 -80105e4d: 6a 00 push $0x0 +80105bfe: 6a 00 push $0x0 pushl $241 -80105e4f: 68 f1 00 00 00 push $0xf1 +80105c00: 68 f1 00 00 00 push $0xf1 jmp alltraps -80105e54: e9 f6 f1 ff ff jmp 8010504f +80105c05: e9 13 f2 ff ff jmp 80104e1d -80105e59 : +80105c0a : .globl vector242 vector242: pushl $0 -80105e59: 6a 00 push $0x0 +80105c0a: 6a 00 push $0x0 pushl $242 -80105e5b: 68 f2 00 00 00 push $0xf2 +80105c0c: 68 f2 00 00 00 push $0xf2 jmp alltraps -80105e60: e9 ea f1 ff ff jmp 8010504f +80105c11: e9 07 f2 ff ff jmp 80104e1d -80105e65 : +80105c16 : .globl vector243 vector243: pushl $0 -80105e65: 6a 00 push $0x0 +80105c16: 6a 00 push $0x0 pushl $243 -80105e67: 68 f3 00 00 00 push $0xf3 +80105c18: 68 f3 00 00 00 push $0xf3 jmp alltraps -80105e6c: e9 de f1 ff ff jmp 8010504f +80105c1d: e9 fb f1 ff ff jmp 80104e1d -80105e71 : +80105c22 : .globl vector244 vector244: pushl $0 -80105e71: 6a 00 push $0x0 +80105c22: 6a 00 push $0x0 pushl $244 -80105e73: 68 f4 00 00 00 push $0xf4 +80105c24: 68 f4 00 00 00 push $0xf4 jmp alltraps -80105e78: e9 d2 f1 ff ff jmp 8010504f +80105c29: e9 ef f1 ff ff jmp 80104e1d -80105e7d : +80105c2e : .globl vector245 vector245: pushl $0 -80105e7d: 6a 00 push $0x0 +80105c2e: 6a 00 push $0x0 pushl $245 -80105e7f: 68 f5 00 00 00 push $0xf5 +80105c30: 68 f5 00 00 00 push $0xf5 jmp alltraps -80105e84: e9 c6 f1 ff ff jmp 8010504f +80105c35: e9 e3 f1 ff ff jmp 80104e1d -80105e89 : +80105c3a : .globl vector246 vector246: pushl $0 -80105e89: 6a 00 push $0x0 +80105c3a: 6a 00 push $0x0 pushl $246 -80105e8b: 68 f6 00 00 00 push $0xf6 +80105c3c: 68 f6 00 00 00 push $0xf6 jmp alltraps -80105e90: e9 ba f1 ff ff jmp 8010504f +80105c41: e9 d7 f1 ff ff jmp 80104e1d -80105e95 : +80105c46 : .globl vector247 vector247: pushl $0 -80105e95: 6a 00 push $0x0 +80105c46: 6a 00 push $0x0 pushl $247 -80105e97: 68 f7 00 00 00 push $0xf7 +80105c48: 68 f7 00 00 00 push $0xf7 jmp alltraps -80105e9c: e9 ae f1 ff ff jmp 8010504f +80105c4d: e9 cb f1 ff ff jmp 80104e1d -80105ea1 : +80105c52 : .globl vector248 vector248: pushl $0 -80105ea1: 6a 00 push $0x0 +80105c52: 6a 00 push $0x0 pushl $248 -80105ea3: 68 f8 00 00 00 push $0xf8 +80105c54: 68 f8 00 00 00 push $0xf8 jmp alltraps -80105ea8: e9 a2 f1 ff ff jmp 8010504f +80105c59: e9 bf f1 ff ff jmp 80104e1d -80105ead : +80105c5e : .globl vector249 vector249: pushl $0 -80105ead: 6a 00 push $0x0 +80105c5e: 6a 00 push $0x0 pushl $249 -80105eaf: 68 f9 00 00 00 push $0xf9 +80105c60: 68 f9 00 00 00 push $0xf9 jmp alltraps -80105eb4: e9 96 f1 ff ff jmp 8010504f +80105c65: e9 b3 f1 ff ff jmp 80104e1d -80105eb9 : +80105c6a : .globl vector250 vector250: pushl $0 -80105eb9: 6a 00 push $0x0 +80105c6a: 6a 00 push $0x0 pushl $250 -80105ebb: 68 fa 00 00 00 push $0xfa +80105c6c: 68 fa 00 00 00 push $0xfa jmp alltraps -80105ec0: e9 8a f1 ff ff jmp 8010504f +80105c71: e9 a7 f1 ff ff jmp 80104e1d -80105ec5 : +80105c76 : .globl vector251 vector251: pushl $0 -80105ec5: 6a 00 push $0x0 +80105c76: 6a 00 push $0x0 pushl $251 -80105ec7: 68 fb 00 00 00 push $0xfb +80105c78: 68 fb 00 00 00 push $0xfb jmp alltraps -80105ecc: e9 7e f1 ff ff jmp 8010504f +80105c7d: e9 9b f1 ff ff jmp 80104e1d -80105ed1 : +80105c82 : .globl vector252 vector252: pushl $0 -80105ed1: 6a 00 push $0x0 +80105c82: 6a 00 push $0x0 pushl $252 -80105ed3: 68 fc 00 00 00 push $0xfc +80105c84: 68 fc 00 00 00 push $0xfc jmp alltraps -80105ed8: e9 72 f1 ff ff jmp 8010504f +80105c89: e9 8f f1 ff ff jmp 80104e1d -80105edd : +80105c8e : .globl vector253 vector253: pushl $0 -80105edd: 6a 00 push $0x0 +80105c8e: 6a 00 push $0x0 pushl $253 -80105edf: 68 fd 00 00 00 push $0xfd +80105c90: 68 fd 00 00 00 push $0xfd jmp alltraps -80105ee4: e9 66 f1 ff ff jmp 8010504f +80105c95: e9 83 f1 ff ff jmp 80104e1d -80105ee9 : +80105c9a : .globl vector254 vector254: pushl $0 -80105ee9: 6a 00 push $0x0 +80105c9a: 6a 00 push $0x0 pushl $254 -80105eeb: 68 fe 00 00 00 push $0xfe +80105c9c: 68 fe 00 00 00 push $0xfe jmp alltraps -80105ef0: e9 5a f1 ff ff jmp 8010504f +80105ca1: e9 77 f1 ff ff jmp 80104e1d -80105ef5 : +80105ca6 : .globl vector255 vector255: pushl $0 -80105ef5: 6a 00 push $0x0 +80105ca6: 6a 00 push $0x0 pushl $255 -80105ef7: 68 ff 00 00 00 push $0xff +80105ca8: 68 ff 00 00 00 push $0xff jmp alltraps -80105efc: e9 4e f1 ff ff jmp 8010504f +80105cad: e9 6b f1 ff ff jmp 80104e1d -80105f01 : +80105cb2 : // 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) { -80105f01: 55 push %ebp -80105f02: 89 e5 mov %esp,%ebp -80105f04: 57 push %edi -80105f05: 56 push %esi -80105f06: 53 push %ebx -80105f07: 83 ec 0c sub $0xc,%esp -80105f0a: 89 d6 mov %edx,%esi +80105cb2: 55 push %ebp +80105cb3: 89 e5 mov %esp,%ebp +80105cb5: 57 push %edi +80105cb6: 56 push %esi +80105cb7: 53 push %ebx +80105cb8: 83 ec 0c sub $0xc,%esp +80105cbb: 89 d6 mov %edx,%esi pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; -80105f0c: c1 ea 16 shr $0x16,%edx -80105f0f: 8d 3c 90 lea (%eax,%edx,4),%edi +80105cbd: c1 ea 16 shr $0x16,%edx +80105cc0: 8d 3c 90 lea (%eax,%edx,4),%edi if(*pde & PTE_P){ -80105f12: 8b 1f mov (%edi),%ebx -80105f14: f6 c3 01 test $0x1,%bl -80105f17: 74 21 je 80105f3a +80105cc3: 8b 1f mov (%edi),%ebx +80105cc5: f6 c3 01 test $0x1,%bl +80105cc8: 74 21 je 80105ceb pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); -80105f19: 81 e3 00 f0 ff ff and $0xfffff000,%ebx -80105f1f: 81 c3 00 00 00 80 add $0x80000000,%ebx +80105cca: 81 e3 00 f0 ff ff and $0xfffff000,%ebx +80105cd0: 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)]; -80105f25: c1 ee 0a shr $0xa,%esi -80105f28: 81 e6 fc 0f 00 00 and $0xffc,%esi -80105f2e: 01 f3 add %esi,%ebx -} -80105f30: 89 d8 mov %ebx,%eax -80105f32: 8d 65 f4 lea -0xc(%ebp),%esp -80105f35: 5b pop %ebx -80105f36: 5e pop %esi -80105f37: 5f pop %edi -80105f38: 5d pop %ebp -80105f39: c3 ret +80105cd6: c1 ee 0a shr $0xa,%esi +80105cd9: 81 e6 fc 0f 00 00 and $0xffc,%esi +80105cdf: 01 f3 add %esi,%ebx +} +80105ce1: 89 d8 mov %ebx,%eax +80105ce3: 8d 65 f4 lea -0xc(%ebp),%esp +80105ce6: 5b pop %ebx +80105ce7: 5e pop %esi +80105ce8: 5f pop %edi +80105ce9: 5d pop %ebp +80105cea: c3 ret return 0; -80105f3a: bb 00 00 00 00 mov $0x0,%ebx +80105ceb: bb 00 00 00 00 mov $0x0,%ebx if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) -80105f3f: 85 c9 test %ecx,%ecx -80105f41: 74 ed je 80105f30 -80105f43: e8 d1 c2 ff ff call 80102219 -80105f48: 89 c3 mov %eax,%ebx -80105f4a: 85 c0 test %eax,%eax -80105f4c: 74 e2 je 80105f30 +80105cf0: 85 c9 test %ecx,%ecx +80105cf2: 74 ed je 80105ce1 +80105cf4: e8 51 c4 ff ff call 8010214a +80105cf9: 89 c3 mov %eax,%ebx +80105cfb: 85 c0 test %eax,%eax +80105cfd: 74 e2 je 80105ce1 memset(pgtab, 0, PGSIZE); -80105f4e: 83 ec 04 sub $0x4,%esp -80105f51: 68 00 10 00 00 push $0x1000 -80105f56: 6a 00 push $0x0 -80105f58: 50 push %eax -80105f59: e8 f1 df ff ff call 80103f4f +80105cff: 83 ec 04 sub $0x4,%esp +80105d02: 68 00 10 00 00 push $0x1000 +80105d07: 6a 00 push $0x0 +80105d09: 50 push %eax +80105d0a: e8 a0 e0 ff ff call 80103daf *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; -80105f5e: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax -80105f64: 83 c8 07 or $0x7,%eax -80105f67: 89 07 mov %eax,(%edi) -80105f69: 83 c4 10 add $0x10,%esp -80105f6c: eb b7 jmp 80105f25 +80105d0f: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +80105d15: 83 c8 07 or $0x7,%eax +80105d18: 89 07 mov %eax,(%edi) +80105d1a: 83 c4 10 add $0x10,%esp +80105d1d: eb b7 jmp 80105cd6 -80105f6e : +80105d1f : // 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) { -80105f6e: 55 push %ebp -80105f6f: 89 e5 mov %esp,%ebp -80105f71: 57 push %edi -80105f72: 56 push %esi -80105f73: 53 push %ebx -80105f74: 83 ec 1c sub $0x1c,%esp -80105f77: 89 45 e4 mov %eax,-0x1c(%ebp) +80105d1f: 55 push %ebp +80105d20: 89 e5 mov %esp,%ebp +80105d22: 57 push %edi +80105d23: 56 push %esi +80105d24: 53 push %ebx +80105d25: 83 ec 1c sub $0x1c,%esp +80105d28: 89 45 e4 mov %eax,-0x1c(%ebp) +80105d2b: 89 d0 mov %edx,%eax char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); -80105f7a: 89 d0 mov %edx,%eax -80105f7c: 25 00 f0 ff ff and $0xfffff000,%eax -80105f81: 89 c6 mov %eax,%esi +80105d2d: 81 e2 00 f0 ff ff and $0xfffff000,%edx +80105d33: 89 d6 mov %edx,%esi last = (char*)PGROUNDDOWN(((uint)va) + size - 1); -80105f83: 8d 54 0a ff lea -0x1(%edx,%ecx,1),%edx -80105f87: 81 e2 00 f0 ff ff and $0xfffff000,%edx -80105f8d: 89 55 e0 mov %edx,-0x20(%ebp) -80105f90: 8b 7d 08 mov 0x8(%ebp),%edi -80105f93: 29 c7 sub %eax,%edi -80105f95: 8d 1c 3e lea (%esi,%edi,1),%ebx +80105d35: 8d 7c 08 ff lea -0x1(%eax,%ecx,1),%edi +80105d39: 81 e7 00 f0 ff ff and $0xfffff000,%edi +80105d3f: 8b 45 08 mov 0x8(%ebp),%eax +80105d42: 29 d0 sub %edx,%eax +80105d44: 89 45 e0 mov %eax,-0x20(%ebp) +80105d47: 8b 45 e0 mov -0x20(%ebp),%eax +80105d4a: 8d 1c 06 lea (%esi,%eax,1),%ebx for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) -80105f98: b9 01 00 00 00 mov $0x1,%ecx -80105f9d: 89 f2 mov %esi,%edx -80105f9f: 8b 45 e4 mov -0x1c(%ebp),%eax -80105fa2: e8 5a ff ff ff call 80105f01 -80105fa7: 85 c0 test %eax,%eax -80105fa9: 74 27 je 80105fd2 +80105d4d: b9 01 00 00 00 mov $0x1,%ecx +80105d52: 89 f2 mov %esi,%edx +80105d54: 8b 45 e4 mov -0x1c(%ebp),%eax +80105d57: e8 56 ff ff ff call 80105cb2 +80105d5c: 85 c0 test %eax,%eax +80105d5e: 74 26 je 80105d86 return -1; if(*pte & PTE_P) -80105fab: f6 00 01 testb $0x1,(%eax) -80105fae: 75 15 jne 80105fc5 +80105d60: f6 00 01 testb $0x1,(%eax) +80105d63: 75 14 jne 80105d79 panic("remap"); *pte = pa | perm | PTE_P; -80105fb0: 0b 5d 0c or 0xc(%ebp),%ebx -80105fb3: 83 cb 01 or $0x1,%ebx -80105fb6: 89 18 mov %ebx,(%eax) +80105d65: 0b 5d 0c or 0xc(%ebp),%ebx +80105d68: 83 cb 01 or $0x1,%ebx +80105d6b: 89 18 mov %ebx,(%eax) if(a == last) -80105fb8: 3b 75 e0 cmp -0x20(%ebp),%esi -80105fbb: 74 22 je 80105fdf +80105d6d: 39 fe cmp %edi,%esi +80105d6f: 74 22 je 80105d93 break; a += PGSIZE; -80105fbd: 81 c6 00 10 00 00 add $0x1000,%esi +80105d71: 81 c6 00 10 00 00 add $0x1000,%esi if((pte = walkpgdir(pgdir, a, 1)) == 0) -80105fc3: eb d0 jmp 80105f95 +80105d77: eb ce jmp 80105d47 panic("remap"); -80105fc5: 83 ec 0c sub $0xc,%esp -80105fc8: 68 70 81 10 80 push $0x80108170 -80105fcd: e8 86 a3 ff ff call 80100358 +80105d79: 83 ec 0c sub $0xc,%esp +80105d7c: 68 90 7e 10 80 push $0x80107e90 +80105d81: e8 ba a5 ff ff call 80100340 return -1; -80105fd2: b8 ff ff ff ff mov $0xffffffff,%eax +80105d86: b8 ff ff ff ff mov $0xffffffff,%eax pa += PGSIZE; } return 0; } -80105fd7: 8d 65 f4 lea -0xc(%ebp),%esp -80105fda: 5b pop %ebx -80105fdb: 5e pop %esi -80105fdc: 5f pop %edi -80105fdd: 5d pop %ebp -80105fde: c3 ret +80105d8b: 8d 65 f4 lea -0xc(%ebp),%esp +80105d8e: 5b pop %ebx +80105d8f: 5e pop %esi +80105d90: 5f pop %edi +80105d91: 5d pop %ebp +80105d92: c3 ret return 0; -80105fdf: b8 00 00 00 00 mov $0x0,%eax -80105fe4: eb f1 jmp 80105fd7 +80105d93: b8 00 00 00 00 mov $0x0,%eax +80105d98: eb f1 jmp 80105d8b -80105fe6 : +80105d9a : { -80105fe6: f3 0f 1e fb endbr32 -80105fea: 55 push %ebp -80105feb: 89 e5 mov %esp,%ebp -80105fed: 83 ec 18 sub $0x18,%esp +80105d9a: 55 push %ebp +80105d9b: 89 e5 mov %esp,%ebp +80105d9d: 83 ec 18 sub $0x18,%esp c = &cpus[cpuid()]; -80105ff0: e8 d6 d3 ff ff call 801033cb +80105da0: e8 f0 d4 ff ff call 80103295 c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); -80105ff5: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax -80105ffb: 66 c7 80 18 54 11 80 movw $0xffff,-0x7feeabe8(%eax) -80106002: ff ff -80106004: 66 c7 80 1a 54 11 80 movw $0x0,-0x7feeabe6(%eax) -8010600b: 00 00 -8010600d: c6 80 1c 54 11 80 00 movb $0x0,-0x7feeabe4(%eax) -80106014: c6 80 1d 54 11 80 9a movb $0x9a,-0x7feeabe3(%eax) -8010601b: c6 80 1e 54 11 80 cf movb $0xcf,-0x7feeabe2(%eax) -80106022: c6 80 1f 54 11 80 00 movb $0x0,-0x7feeabe1(%eax) +80105da5: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax +80105dab: 66 c7 80 18 28 11 80 movw $0xffff,-0x7feed7e8(%eax) +80105db2: ff ff +80105db4: 66 c7 80 1a 28 11 80 movw $0x0,-0x7feed7e6(%eax) +80105dbb: 00 00 +80105dbd: c6 80 1c 28 11 80 00 movb $0x0,-0x7feed7e4(%eax) +80105dc4: c6 80 1d 28 11 80 9a movb $0x9a,-0x7feed7e3(%eax) +80105dcb: c6 80 1e 28 11 80 cf movb $0xcf,-0x7feed7e2(%eax) +80105dd2: c6 80 1f 28 11 80 00 movb $0x0,-0x7feed7e1(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); -80106029: 66 c7 80 20 54 11 80 movw $0xffff,-0x7feeabe0(%eax) -80106030: ff ff -80106032: 66 c7 80 22 54 11 80 movw $0x0,-0x7feeabde(%eax) -80106039: 00 00 -8010603b: c6 80 24 54 11 80 00 movb $0x0,-0x7feeabdc(%eax) -80106042: c6 80 25 54 11 80 92 movb $0x92,-0x7feeabdb(%eax) -80106049: c6 80 26 54 11 80 cf movb $0xcf,-0x7feeabda(%eax) -80106050: c6 80 27 54 11 80 00 movb $0x0,-0x7feeabd9(%eax) +80105dd9: 66 c7 80 20 28 11 80 movw $0xffff,-0x7feed7e0(%eax) +80105de0: ff ff +80105de2: 66 c7 80 22 28 11 80 movw $0x0,-0x7feed7de(%eax) +80105de9: 00 00 +80105deb: c6 80 24 28 11 80 00 movb $0x0,-0x7feed7dc(%eax) +80105df2: c6 80 25 28 11 80 92 movb $0x92,-0x7feed7db(%eax) +80105df9: c6 80 26 28 11 80 cf movb $0xcf,-0x7feed7da(%eax) +80105e00: c6 80 27 28 11 80 00 movb $0x0,-0x7feed7d9(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); -80106057: 66 c7 80 28 54 11 80 movw $0xffff,-0x7feeabd8(%eax) -8010605e: ff ff -80106060: 66 c7 80 2a 54 11 80 movw $0x0,-0x7feeabd6(%eax) -80106067: 00 00 -80106069: c6 80 2c 54 11 80 00 movb $0x0,-0x7feeabd4(%eax) -80106070: c6 80 2d 54 11 80 fa movb $0xfa,-0x7feeabd3(%eax) -80106077: c6 80 2e 54 11 80 cf movb $0xcf,-0x7feeabd2(%eax) -8010607e: c6 80 2f 54 11 80 00 movb $0x0,-0x7feeabd1(%eax) +80105e07: 66 c7 80 28 28 11 80 movw $0xffff,-0x7feed7d8(%eax) +80105e0e: ff ff +80105e10: 66 c7 80 2a 28 11 80 movw $0x0,-0x7feed7d6(%eax) +80105e17: 00 00 +80105e19: c6 80 2c 28 11 80 00 movb $0x0,-0x7feed7d4(%eax) +80105e20: c6 80 2d 28 11 80 fa movb $0xfa,-0x7feed7d3(%eax) +80105e27: c6 80 2e 28 11 80 cf movb $0xcf,-0x7feed7d2(%eax) +80105e2e: c6 80 2f 28 11 80 00 movb $0x0,-0x7feed7d1(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); -80106085: 66 c7 80 30 54 11 80 movw $0xffff,-0x7feeabd0(%eax) -8010608c: ff ff -8010608e: 66 c7 80 32 54 11 80 movw $0x0,-0x7feeabce(%eax) -80106095: 00 00 -80106097: c6 80 34 54 11 80 00 movb $0x0,-0x7feeabcc(%eax) -8010609e: c6 80 35 54 11 80 f2 movb $0xf2,-0x7feeabcb(%eax) -801060a5: c6 80 36 54 11 80 cf movb $0xcf,-0x7feeabca(%eax) -801060ac: c6 80 37 54 11 80 00 movb $0x0,-0x7feeabc9(%eax) +80105e35: 66 c7 80 30 28 11 80 movw $0xffff,-0x7feed7d0(%eax) +80105e3c: ff ff +80105e3e: 66 c7 80 32 28 11 80 movw $0x0,-0x7feed7ce(%eax) +80105e45: 00 00 +80105e47: c6 80 34 28 11 80 00 movb $0x0,-0x7feed7cc(%eax) +80105e4e: c6 80 35 28 11 80 f2 movb $0xf2,-0x7feed7cb(%eax) +80105e55: c6 80 36 28 11 80 cf movb $0xcf,-0x7feed7ca(%eax) +80105e5c: c6 80 37 28 11 80 00 movb $0x0,-0x7feed7c9(%eax) lgdt(c->gdt, sizeof(c->gdt)); -801060b3: 05 10 54 11 80 add $0x80115410,%eax +80105e63: 05 10 28 11 80 add $0x80112810,%eax pd[0] = size-1; -801060b8: 66 c7 45 f2 2f 00 movw $0x2f,-0xe(%ebp) +80105e68: 66 c7 45 f2 2f 00 movw $0x2f,-0xe(%ebp) pd[1] = (uint)p; -801060be: 66 89 45 f4 mov %ax,-0xc(%ebp) +80105e6e: 66 89 45 f4 mov %ax,-0xc(%ebp) pd[2] = (uint)p >> 16; -801060c2: c1 e8 10 shr $0x10,%eax -801060c5: 66 89 45 f6 mov %ax,-0xa(%ebp) +80105e72: c1 e8 10 shr $0x10,%eax +80105e75: 66 89 45 f6 mov %ax,-0xa(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); -801060c9: 8d 45 f2 lea -0xe(%ebp),%eax -801060cc: 0f 01 10 lgdtl (%eax) +80105e79: 8d 45 f2 lea -0xe(%ebp),%eax +80105e7c: 0f 01 10 lgdtl (%eax) } -801060cf: c9 leave -801060d0: c3 ret - -801060d1 : +80105e7f: c9 leave +80105e80: c3 ret +80105e81 : // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { -801060d1: f3 0f 1e fb endbr32 lcr3(V2P(kpgdir)); // switch to the kernel page table -801060d5: a1 04 6a 11 80 mov 0x80116a04,%eax -801060da: 05 00 00 00 80 add $0x80000000,%eax +80105e81: a1 04 3e 11 80 mov 0x80113e04,%eax +80105e86: 05 00 00 00 80 add $0x80000000,%eax } static inline void lcr3(uint val) { asm volatile("movl %0,%%cr3" : : "r" (val)); -801060df: 0f 22 d8 mov %eax,%cr3 +80105e8b: 0f 22 d8 mov %eax,%cr3 } -801060e2: c3 ret +80105e8e: c3 ret -801060e3 : +80105e8f : // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { -801060e3: f3 0f 1e fb endbr32 -801060e7: 55 push %ebp -801060e8: 89 e5 mov %esp,%ebp -801060ea: 57 push %edi -801060eb: 56 push %esi -801060ec: 53 push %ebx -801060ed: 83 ec 1c sub $0x1c,%esp -801060f0: 8b 75 08 mov 0x8(%ebp),%esi +80105e8f: 55 push %ebp +80105e90: 89 e5 mov %esp,%ebp +80105e92: 57 push %edi +80105e93: 56 push %esi +80105e94: 53 push %ebx +80105e95: 83 ec 1c sub $0x1c,%esp +80105e98: 8b 75 08 mov 0x8(%ebp),%esi if(p == 0) -801060f3: 85 f6 test %esi,%esi -801060f5: 0f 84 c3 00 00 00 je 801061be +80105e9b: 85 f6 test %esi,%esi +80105e9d: 0f 84 c3 00 00 00 je 80105f66 panic("switchuvm: no process"); if(p->kstack == 0) -801060fb: 83 7e 08 00 cmpl $0x0,0x8(%esi) -801060ff: 0f 84 c6 00 00 00 je 801061cb +80105ea3: 83 7e 08 00 cmpl $0x0,0x8(%esi) +80105ea7: 0f 84 c6 00 00 00 je 80105f73 panic("switchuvm: no kstack"); if(p->pgdir == 0) -80106105: 83 7e 04 00 cmpl $0x0,0x4(%esi) -80106109: 0f 84 c9 00 00 00 je 801061d8 +80105ead: 83 7e 04 00 cmpl $0x0,0x4(%esi) +80105eb1: 0f 84 c9 00 00 00 je 80105f80 panic("switchuvm: no pgdir"); pushcli(); -8010610f: e8 a8 dc ff ff call 80103dbc +80105eb7: e8 75 dd ff ff call 80103c31 mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, -80106114: e8 4d d2 ff ff call 80103366 -80106119: 89 c3 mov %eax,%ebx -8010611b: e8 46 d2 ff ff call 80103366 -80106120: 89 c7 mov %eax,%edi -80106122: e8 3f d2 ff ff call 80103366 -80106127: 89 45 e4 mov %eax,-0x1c(%ebp) -8010612a: e8 37 d2 ff ff call 80103366 -8010612f: 66 c7 83 98 00 00 00 movw $0x67,0x98(%ebx) -80106136: 67 00 -80106138: 83 c7 08 add $0x8,%edi -8010613b: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) -80106142: 8b 55 e4 mov -0x1c(%ebp),%edx -80106145: 83 c2 08 add $0x8,%edx -80106148: c1 ea 10 shr $0x10,%edx -8010614b: 88 93 9c 00 00 00 mov %dl,0x9c(%ebx) -80106151: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) -80106158: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) -8010615f: 83 c0 08 add $0x8,%eax -80106162: c1 e8 18 shr $0x18,%eax -80106165: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) +80105ebc: e8 75 d3 ff ff call 80103236 +80105ec1: 89 c3 mov %eax,%ebx +80105ec3: e8 6e d3 ff ff call 80103236 +80105ec8: 89 c7 mov %eax,%edi +80105eca: e8 67 d3 ff ff call 80103236 +80105ecf: 89 45 e4 mov %eax,-0x1c(%ebp) +80105ed2: e8 5f d3 ff ff call 80103236 +80105ed7: 66 c7 83 98 00 00 00 movw $0x67,0x98(%ebx) +80105ede: 67 00 +80105ee0: 83 c7 08 add $0x8,%edi +80105ee3: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) +80105eea: 8b 55 e4 mov -0x1c(%ebp),%edx +80105eed: 83 c2 08 add $0x8,%edx +80105ef0: c1 ea 10 shr $0x10,%edx +80105ef3: 88 93 9c 00 00 00 mov %dl,0x9c(%ebx) +80105ef9: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) +80105f00: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) +80105f07: 83 c0 08 add $0x8,%eax +80105f0a: c1 e8 18 shr $0x18,%eax +80105f0d: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) sizeof(mycpu()->ts)-1, 0); mycpu()->gdt[SEG_TSS].s = 0; -8010616b: e8 f6 d1 ff ff call 80103366 -80106170: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) +80105f13: e8 1e d3 ff ff call 80103236 +80105f18: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) mycpu()->ts.ss0 = SEG_KDATA << 3; -80106177: e8 ea d1 ff ff call 80103366 -8010617c: 66 c7 40 10 10 00 movw $0x10,0x10(%eax) +80105f1f: e8 12 d3 ff ff call 80103236 +80105f24: 66 c7 40 10 10 00 movw $0x10,0x10(%eax) mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; -80106182: 8b 5e 08 mov 0x8(%esi),%ebx -80106185: e8 dc d1 ff ff call 80103366 -8010618a: 81 c3 00 10 00 00 add $0x1000,%ebx -80106190: 89 58 0c mov %ebx,0xc(%eax) +80105f2a: 8b 5e 08 mov 0x8(%esi),%ebx +80105f2d: e8 04 d3 ff ff call 80103236 +80105f32: 81 c3 00 10 00 00 add $0x1000,%ebx +80105f38: 89 58 0c mov %ebx,0xc(%eax) // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit // forbids I/O instructions (e.g., inb and outb) from user space mycpu()->ts.iomb = (ushort) 0xFFFF; -80106193: e8 ce d1 ff ff call 80103366 -80106198: 66 c7 40 6e ff ff movw $0xffff,0x6e(%eax) +80105f3b: e8 f6 d2 ff ff call 80103236 +80105f40: 66 c7 40 6e ff ff movw $0xffff,0x6e(%eax) asm volatile("ltr %0" : : "r" (sel)); -8010619e: b8 28 00 00 00 mov $0x28,%eax -801061a3: 0f 00 d8 ltr %ax +80105f46: b8 28 00 00 00 mov $0x28,%eax +80105f4b: 0f 00 d8 ltr %ax ltr(SEG_TSS << 3); lcr3(V2P(p->pgdir)); // switch to process's address space -801061a6: 8b 46 04 mov 0x4(%esi),%eax -801061a9: 05 00 00 00 80 add $0x80000000,%eax +80105f4e: 8b 46 04 mov 0x4(%esi),%eax +80105f51: 05 00 00 00 80 add $0x80000000,%eax asm volatile("movl %0,%%cr3" : : "r" (val)); -801061ae: 0f 22 d8 mov %eax,%cr3 +80105f56: 0f 22 d8 mov %eax,%cr3 popcli(); -801061b1: e8 47 dc ff ff call 80103dfd -} -801061b6: 8d 65 f4 lea -0xc(%ebp),%esp -801061b9: 5b pop %ebx -801061ba: 5e pop %esi -801061bb: 5f pop %edi -801061bc: 5d pop %ebp -801061bd: c3 ret +80105f59: e8 0f dd ff ff call 80103c6d +} +80105f5e: 8d 65 f4 lea -0xc(%ebp),%esp +80105f61: 5b pop %ebx +80105f62: 5e pop %esi +80105f63: 5f pop %edi +80105f64: 5d pop %ebp +80105f65: c3 ret panic("switchuvm: no process"); -801061be: 83 ec 0c sub $0xc,%esp -801061c1: 68 76 81 10 80 push $0x80108176 -801061c6: e8 8d a1 ff ff call 80100358 +80105f66: 83 ec 0c sub $0xc,%esp +80105f69: 68 96 7e 10 80 push $0x80107e96 +80105f6e: e8 cd a3 ff ff call 80100340 panic("switchuvm: no kstack"); -801061cb: 83 ec 0c sub $0xc,%esp -801061ce: 68 8c 81 10 80 push $0x8010818c -801061d3: e8 80 a1 ff ff call 80100358 +80105f73: 83 ec 0c sub $0xc,%esp +80105f76: 68 ac 7e 10 80 push $0x80107eac +80105f7b: e8 c0 a3 ff ff call 80100340 panic("switchuvm: no pgdir"); -801061d8: 83 ec 0c sub $0xc,%esp -801061db: 68 a1 81 10 80 push $0x801081a1 -801061e0: e8 73 a1 ff ff call 80100358 +80105f80: 83 ec 0c sub $0xc,%esp +80105f83: 68 c1 7e 10 80 push $0x80107ec1 +80105f88: e8 b3 a3 ff ff call 80100340 -801061e5 : +80105f8d : // Load the initcode into address 0 of pgdir. // sz must be less than a page. void inituvm(pde_t *pgdir, char *init, uint sz) { -801061e5: f3 0f 1e fb endbr32 -801061e9: 55 push %ebp -801061ea: 89 e5 mov %esp,%ebp -801061ec: 56 push %esi -801061ed: 53 push %ebx -801061ee: 8b 75 10 mov 0x10(%ebp),%esi +80105f8d: 55 push %ebp +80105f8e: 89 e5 mov %esp,%ebp +80105f90: 56 push %esi +80105f91: 53 push %ebx +80105f92: 8b 75 10 mov 0x10(%ebp),%esi char *mem; if(sz >= PGSIZE) -801061f1: 81 fe ff 0f 00 00 cmp $0xfff,%esi -801061f7: 77 4c ja 80106245 +80105f95: 81 fe ff 0f 00 00 cmp $0xfff,%esi +80105f9b: 77 4c ja 80105fe9 panic("inituvm: more than a page"); mem = kalloc(); -801061f9: e8 1b c0 ff ff call 80102219 -801061fe: 89 c3 mov %eax,%ebx +80105f9d: e8 a8 c1 ff ff call 8010214a +80105fa2: 89 c3 mov %eax,%ebx memset(mem, 0, PGSIZE); -80106200: 83 ec 04 sub $0x4,%esp -80106203: 68 00 10 00 00 push $0x1000 -80106208: 6a 00 push $0x0 -8010620a: 50 push %eax -8010620b: e8 3f dd ff ff call 80103f4f +80105fa4: 83 ec 04 sub $0x4,%esp +80105fa7: 68 00 10 00 00 push $0x1000 +80105fac: 6a 00 push $0x0 +80105fae: 50 push %eax +80105faf: e8 fb dd ff ff call 80103daf mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); -80106210: 83 c4 08 add $0x8,%esp -80106213: 6a 06 push $0x6 -80106215: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax -8010621b: 50 push %eax -8010621c: b9 00 10 00 00 mov $0x1000,%ecx -80106221: ba 00 00 00 00 mov $0x0,%edx -80106226: 8b 45 08 mov 0x8(%ebp),%eax -80106229: e8 40 fd ff ff call 80105f6e +80105fb4: 83 c4 08 add $0x8,%esp +80105fb7: 6a 06 push $0x6 +80105fb9: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +80105fbf: 50 push %eax +80105fc0: b9 00 10 00 00 mov $0x1000,%ecx +80105fc5: ba 00 00 00 00 mov $0x0,%edx +80105fca: 8b 45 08 mov 0x8(%ebp),%eax +80105fcd: e8 4d fd ff ff call 80105d1f memmove(mem, init, sz); -8010622e: 83 c4 0c add $0xc,%esp -80106231: 56 push %esi -80106232: ff 75 0c pushl 0xc(%ebp) -80106235: 53 push %ebx -80106236: e8 a1 dd ff ff call 80103fdc -} -8010623b: 83 c4 10 add $0x10,%esp -8010623e: 8d 65 f8 lea -0x8(%ebp),%esp -80106241: 5b pop %ebx -80106242: 5e pop %esi -80106243: 5d pop %ebp -80106244: c3 ret +80105fd2: 83 c4 0c add $0xc,%esp +80105fd5: 56 push %esi +80105fd6: ff 75 0c push 0xc(%ebp) +80105fd9: 53 push %ebx +80105fda: e8 55 de ff ff call 80103e34 +} +80105fdf: 83 c4 10 add $0x10,%esp +80105fe2: 8d 65 f8 lea -0x8(%ebp),%esp +80105fe5: 5b pop %ebx +80105fe6: 5e pop %esi +80105fe7: 5d pop %ebp +80105fe8: c3 ret panic("inituvm: more than a page"); -80106245: 83 ec 0c sub $0xc,%esp -80106248: 68 b5 81 10 80 push $0x801081b5 -8010624d: e8 06 a1 ff ff call 80100358 +80105fe9: 83 ec 0c sub $0xc,%esp +80105fec: 68 d5 7e 10 80 push $0x80107ed5 +80105ff1: e8 4a a3 ff ff call 80100340 -80106252 : +80105ff6 : // Load a program segment into pgdir. addr must be page-aligned // and the pages from addr to addr+sz must already be mapped. int loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz) { -80106252: f3 0f 1e fb endbr32 -80106256: 55 push %ebp -80106257: 89 e5 mov %esp,%ebp -80106259: 57 push %edi -8010625a: 56 push %esi -8010625b: 53 push %ebx -8010625c: 83 ec 1c sub $0x1c,%esp -8010625f: 8b 45 0c mov 0xc(%ebp),%eax -80106262: 8b 75 18 mov 0x18(%ebp),%esi +80105ff6: 55 push %ebp +80105ff7: 89 e5 mov %esp,%ebp +80105ff9: 57 push %edi +80105ffa: 56 push %esi +80105ffb: 53 push %ebx +80105ffc: 83 ec 1c sub $0x1c,%esp +80105fff: 8b 45 0c mov 0xc(%ebp),%eax +80106002: 8b 75 18 mov 0x18(%ebp),%esi uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) -80106265: a9 ff 0f 00 00 test $0xfff,%eax -8010626a: 75 6f jne 801062db +80106005: a9 ff 0f 00 00 test $0xfff,%eax +8010600a: 75 6e jne 8010607a panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ -8010626c: 89 f3 mov %esi,%ebx +8010600c: 89 f3 mov %esi,%ebx if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) -8010626e: 8d 04 30 lea (%eax,%esi,1),%eax -80106271: 89 45 e4 mov %eax,-0x1c(%ebp) +8010600e: 01 f0 add %esi,%eax +80106010: 89 45 e4 mov %eax,-0x1c(%ebp) else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) return -1; } return 0; -80106274: b8 00 00 00 00 mov $0x0,%eax +80106013: b8 00 00 00 00 mov $0x0,%eax for(i = 0; i < sz; i += PGSIZE){ -80106279: 85 f6 test %esi,%esi -8010627b: 74 7d je 801062fa +80106018: 85 f6 test %esi,%esi +8010601a: 74 7d je 80106099 if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) -8010627d: 8b 55 e4 mov -0x1c(%ebp),%edx -80106280: 29 da sub %ebx,%edx -80106282: b9 00 00 00 00 mov $0x0,%ecx -80106287: 8b 45 08 mov 0x8(%ebp),%eax -8010628a: e8 72 fc ff ff call 80105f01 -8010628f: 85 c0 test %eax,%eax -80106291: 74 55 je 801062e8 +8010601c: 8b 55 e4 mov -0x1c(%ebp),%edx +8010601f: 29 da sub %ebx,%edx +80106021: b9 00 00 00 00 mov $0x0,%ecx +80106026: 8b 45 08 mov 0x8(%ebp),%eax +80106029: e8 84 fc ff ff call 80105cb2 +8010602e: 85 c0 test %eax,%eax +80106030: 74 55 je 80106087 pa = PTE_ADDR(*pte); -80106293: 8b 00 mov (%eax),%eax -80106295: 25 00 f0 ff ff and $0xfffff000,%eax +80106032: 8b 00 mov (%eax),%eax +80106034: 25 00 f0 ff ff and $0xfffff000,%eax n = sz - i; -8010629a: 81 fb ff 0f 00 00 cmp $0xfff,%ebx -801062a0: bf 00 10 00 00 mov $0x1000,%edi -801062a5: 0f 46 fb cmovbe %ebx,%edi +80106039: 81 fb ff 0f 00 00 cmp $0xfff,%ebx +8010603f: bf 00 10 00 00 mov $0x1000,%edi +80106044: 0f 46 fb cmovbe %ebx,%edi if(readi(ip, P2V(pa), offset+i, n) != n) -801062a8: 57 push %edi -801062a9: 89 f2 mov %esi,%edx -801062ab: 03 55 14 add 0x14(%ebp),%edx -801062ae: 29 da sub %ebx,%edx -801062b0: 52 push %edx -801062b1: 05 00 00 00 80 add $0x80000000,%eax -801062b6: 50 push %eax -801062b7: ff 75 10 pushl 0x10(%ebp) -801062ba: e8 15 b5 ff ff call 801017d4 -801062bf: 83 c4 10 add $0x10,%esp -801062c2: 39 f8 cmp %edi,%eax -801062c4: 75 2f jne 801062f5 +80106047: 57 push %edi +80106048: 89 f2 mov %esi,%edx +8010604a: 03 55 14 add 0x14(%ebp),%edx +8010604d: 29 da sub %ebx,%edx +8010604f: 52 push %edx +80106050: 05 00 00 00 80 add $0x80000000,%eax +80106055: 50 push %eax +80106056: ff 75 10 push 0x10(%ebp) +80106059: e8 e9 b6 ff ff call 80101747 +8010605e: 83 c4 10 add $0x10,%esp +80106061: 39 f8 cmp %edi,%eax +80106063: 75 2f jne 80106094 for(i = 0; i < sz; i += PGSIZE){ -801062c6: 81 eb 00 10 00 00 sub $0x1000,%ebx -801062cc: 89 f0 mov %esi,%eax -801062ce: 29 d8 sub %ebx,%eax -801062d0: 39 c6 cmp %eax,%esi -801062d2: 77 a9 ja 8010627d +80106065: 81 eb 00 10 00 00 sub $0x1000,%ebx +8010606b: 89 f0 mov %esi,%eax +8010606d: 29 d8 sub %ebx,%eax +8010606f: 39 c6 cmp %eax,%esi +80106071: 77 a9 ja 8010601c return 0; -801062d4: b8 00 00 00 00 mov $0x0,%eax -801062d9: eb 1f jmp 801062fa +80106073: b8 00 00 00 00 mov $0x0,%eax +80106078: eb 1f jmp 80106099 panic("loaduvm: addr must be page aligned"); -801062db: 83 ec 0c sub $0xc,%esp -801062de: 68 70 82 10 80 push $0x80108270 -801062e3: e8 70 a0 ff ff call 80100358 +8010607a: 83 ec 0c sub $0xc,%esp +8010607d: 68 90 7f 10 80 push $0x80107f90 +80106082: e8 b9 a2 ff ff call 80100340 panic("loaduvm: address should exist"); -801062e8: 83 ec 0c sub $0xc,%esp -801062eb: 68 cf 81 10 80 push $0x801081cf -801062f0: e8 63 a0 ff ff call 80100358 +80106087: 83 ec 0c sub $0xc,%esp +8010608a: 68 ef 7e 10 80 push $0x80107eef +8010608f: e8 ac a2 ff ff call 80100340 return -1; -801062f5: b8 ff ff ff ff mov $0xffffffff,%eax +80106094: b8 ff ff ff ff mov $0xffffffff,%eax } -801062fa: 8d 65 f4 lea -0xc(%ebp),%esp -801062fd: 5b pop %ebx -801062fe: 5e pop %esi -801062ff: 5f pop %edi -80106300: 5d pop %ebp -80106301: c3 ret +80106099: 8d 65 f4 lea -0xc(%ebp),%esp +8010609c: 5b pop %ebx +8010609d: 5e pop %esi +8010609e: 5f pop %edi +8010609f: 5d pop %ebp +801060a0: c3 ret -80106302 : +801060a1 : // 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) { -80106302: f3 0f 1e fb endbr32 -80106306: 55 push %ebp -80106307: 89 e5 mov %esp,%ebp -80106309: 57 push %edi -8010630a: 56 push %esi -8010630b: 53 push %ebx -8010630c: 83 ec 0c sub $0xc,%esp -8010630f: 8b 7d 0c mov 0xc(%ebp),%edi +801060a1: 55 push %ebp +801060a2: 89 e5 mov %esp,%ebp +801060a4: 57 push %edi +801060a5: 56 push %esi +801060a6: 53 push %ebx +801060a7: 83 ec 0c sub $0xc,%esp +801060aa: 8b 7d 0c mov 0xc(%ebp),%edi pte_t *pte; uint a, pa; if(newsz >= oldsz) return oldsz; -80106312: 89 f8 mov %edi,%eax +801060ad: 89 f8 mov %edi,%eax if(newsz >= oldsz) -80106314: 39 7d 10 cmp %edi,0x10(%ebp) -80106317: 73 16 jae 8010632f +801060af: 39 7d 10 cmp %edi,0x10(%ebp) +801060b2: 73 16 jae 801060ca a = PGROUNDUP(newsz); -80106319: 8b 45 10 mov 0x10(%ebp),%eax -8010631c: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx -80106322: 81 e3 00 f0 ff ff and $0xfffff000,%ebx +801060b4: 8b 45 10 mov 0x10(%ebp),%eax +801060b7: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx +801060bd: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; a < oldsz; a += PGSIZE){ -80106328: 39 df cmp %ebx,%edi -8010632a: 77 21 ja 8010634d +801060c3: 39 df cmp %ebx,%edi +801060c5: 77 21 ja 801060e8 char *v = P2V(pa); kfree(v); *pte = 0; } } return newsz; -8010632c: 8b 45 10 mov 0x10(%ebp),%eax -} -8010632f: 8d 65 f4 lea -0xc(%ebp),%esp -80106332: 5b pop %ebx -80106333: 5e pop %esi -80106334: 5f pop %edi -80106335: 5d pop %ebp -80106336: c3 ret +801060c7: 8b 45 10 mov 0x10(%ebp),%eax +} +801060ca: 8d 65 f4 lea -0xc(%ebp),%esp +801060cd: 5b pop %ebx +801060ce: 5e pop %esi +801060cf: 5f pop %edi +801060d0: 5d pop %ebp +801060d1: c3 ret a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; -80106337: 81 e3 00 00 c0 ff and $0xffc00000,%ebx -8010633d: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx +801060d2: 81 e3 00 00 c0 ff and $0xffc00000,%ebx +801060d8: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx for(; a < oldsz; a += PGSIZE){ -80106343: 81 c3 00 10 00 00 add $0x1000,%ebx -80106349: 39 df cmp %ebx,%edi -8010634b: 76 df jbe 8010632c +801060de: 81 c3 00 10 00 00 add $0x1000,%ebx +801060e4: 39 df cmp %ebx,%edi +801060e6: 76 df jbe 801060c7 pte = walkpgdir(pgdir, (char*)a, 0); -8010634d: b9 00 00 00 00 mov $0x0,%ecx -80106352: 89 da mov %ebx,%edx -80106354: 8b 45 08 mov 0x8(%ebp),%eax -80106357: e8 a5 fb ff ff call 80105f01 -8010635c: 89 c6 mov %eax,%esi +801060e8: b9 00 00 00 00 mov $0x0,%ecx +801060ed: 89 da mov %ebx,%edx +801060ef: 8b 45 08 mov 0x8(%ebp),%eax +801060f2: e8 bb fb ff ff call 80105cb2 +801060f7: 89 c6 mov %eax,%esi if(!pte) -8010635e: 85 c0 test %eax,%eax -80106360: 74 d5 je 80106337 +801060f9: 85 c0 test %eax,%eax +801060fb: 74 d5 je 801060d2 else if((*pte & PTE_P) != 0){ -80106362: 8b 00 mov (%eax),%eax -80106364: a8 01 test $0x1,%al -80106366: 74 db je 80106343 +801060fd: 8b 00 mov (%eax),%eax +801060ff: a8 01 test $0x1,%al +80106101: 74 db je 801060de if(pa == 0) -80106368: 25 00 f0 ff ff and $0xfffff000,%eax -8010636d: 74 19 je 80106388 +80106103: 25 00 f0 ff ff and $0xfffff000,%eax +80106108: 74 19 je 80106123 kfree(v); -8010636f: 83 ec 0c sub $0xc,%esp +8010610a: 83 ec 0c sub $0xc,%esp char *v = P2V(pa); -80106372: 05 00 00 00 80 add $0x80000000,%eax +8010610d: 05 00 00 00 80 add $0x80000000,%eax kfree(v); -80106377: 50 push %eax -80106378: e8 3e bd ff ff call 801020bb +80106112: 50 push %eax +80106113: e8 e4 be ff ff call 80101ffc *pte = 0; -8010637d: c7 06 00 00 00 00 movl $0x0,(%esi) -80106383: 83 c4 10 add $0x10,%esp -80106386: eb bb jmp 80106343 +80106118: c7 06 00 00 00 00 movl $0x0,(%esi) +8010611e: 83 c4 10 add $0x10,%esp +80106121: eb bb jmp 801060de panic("kfree"); -80106388: 83 ec 0c sub $0xc,%esp -8010638b: 68 ec 7a 10 80 push $0x80107aec -80106390: e8 c3 9f ff ff call 80100358 - -80106395 : -{ -80106395: f3 0f 1e fb endbr32 -80106399: 55 push %ebp -8010639a: 89 e5 mov %esp,%ebp -8010639c: 57 push %edi -8010639d: 56 push %esi -8010639e: 53 push %ebx -8010639f: 83 ec 1c sub $0x1c,%esp -801063a2: 8b 7d 10 mov 0x10(%ebp),%edi +80106123: 83 ec 0c sub $0xc,%esp +80106126: 68 0c 78 10 80 push $0x8010780c +8010612b: e8 10 a2 ff ff call 80100340 + +80106130 : +{ +80106130: 55 push %ebp +80106131: 89 e5 mov %esp,%ebp +80106133: 57 push %edi +80106134: 56 push %esi +80106135: 53 push %ebx +80106136: 83 ec 1c sub $0x1c,%esp +80106139: 8b 7d 10 mov 0x10(%ebp),%edi if(newsz >= KERNBASE) -801063a5: 89 7d e4 mov %edi,-0x1c(%ebp) -801063a8: 85 ff test %edi,%edi -801063aa: 0f 88 c5 00 00 00 js 80106475 +8010613c: 89 7d e4 mov %edi,-0x1c(%ebp) +8010613f: 85 ff test %edi,%edi +80106141: 0f 88 c5 00 00 00 js 8010620c if(newsz < oldsz) -801063b0: 3b 7d 0c cmp 0xc(%ebp),%edi -801063b3: 72 60 jb 80106415 +80106147: 3b 7d 0c cmp 0xc(%ebp),%edi +8010614a: 72 60 jb 801061ac a = PGROUNDUP(oldsz); -801063b5: 8b 45 0c mov 0xc(%ebp),%eax -801063b8: 8d b0 ff 0f 00 00 lea 0xfff(%eax),%esi -801063be: 81 e6 00 f0 ff ff and $0xfffff000,%esi +8010614c: 8b 45 0c mov 0xc(%ebp),%eax +8010614f: 8d b0 ff 0f 00 00 lea 0xfff(%eax),%esi +80106155: 81 e6 00 f0 ff ff and $0xfffff000,%esi for(; a < newsz; a += PGSIZE){ -801063c4: 39 f7 cmp %esi,%edi -801063c6: 0f 86 b0 00 00 00 jbe 8010647c +8010615b: 39 f7 cmp %esi,%edi +8010615d: 0f 86 b0 00 00 00 jbe 80106213 mem = kalloc(); -801063cc: e8 48 be ff ff call 80102219 -801063d1: 89 c3 mov %eax,%ebx +80106163: e8 e2 bf ff ff call 8010214a +80106168: 89 c3 mov %eax,%ebx if(mem == 0){ -801063d3: 85 c0 test %eax,%eax -801063d5: 74 46 je 8010641d +8010616a: 85 c0 test %eax,%eax +8010616c: 74 46 je 801061b4 memset(mem, 0, PGSIZE); -801063d7: 83 ec 04 sub $0x4,%esp -801063da: 68 00 10 00 00 push $0x1000 -801063df: 6a 00 push $0x0 -801063e1: 50 push %eax -801063e2: e8 68 db ff ff call 80103f4f +8010616e: 83 ec 04 sub $0x4,%esp +80106171: 68 00 10 00 00 push $0x1000 +80106176: 6a 00 push $0x0 +80106178: 50 push %eax +80106179: e8 31 dc ff ff call 80103daf if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ -801063e7: 83 c4 08 add $0x8,%esp -801063ea: 6a 06 push $0x6 -801063ec: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax -801063f2: 50 push %eax -801063f3: b9 00 10 00 00 mov $0x1000,%ecx -801063f8: 89 f2 mov %esi,%edx -801063fa: 8b 45 08 mov 0x8(%ebp),%eax -801063fd: e8 6c fb ff ff call 80105f6e -80106402: 83 c4 10 add $0x10,%esp -80106405: 85 c0 test %eax,%eax -80106407: 78 3c js 80106445 +8010617e: 83 c4 08 add $0x8,%esp +80106181: 6a 06 push $0x6 +80106183: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +80106189: 50 push %eax +8010618a: b9 00 10 00 00 mov $0x1000,%ecx +8010618f: 89 f2 mov %esi,%edx +80106191: 8b 45 08 mov 0x8(%ebp),%eax +80106194: e8 86 fb ff ff call 80105d1f +80106199: 83 c4 10 add $0x10,%esp +8010619c: 85 c0 test %eax,%eax +8010619e: 78 3c js 801061dc for(; a < newsz; a += PGSIZE){ -80106409: 81 c6 00 10 00 00 add $0x1000,%esi -8010640f: 39 f7 cmp %esi,%edi -80106411: 77 b9 ja 801063cc -80106413: eb 67 jmp 8010647c +801061a0: 81 c6 00 10 00 00 add $0x1000,%esi +801061a6: 39 f7 cmp %esi,%edi +801061a8: 77 b9 ja 80106163 +801061aa: eb 67 jmp 80106213 return oldsz; -80106415: 8b 45 0c mov 0xc(%ebp),%eax -80106418: 89 45 e4 mov %eax,-0x1c(%ebp) -8010641b: eb 5f jmp 8010647c +801061ac: 8b 45 0c mov 0xc(%ebp),%eax +801061af: 89 45 e4 mov %eax,-0x1c(%ebp) +801061b2: eb 5f jmp 80106213 cprintf("allocuvm out of memory\n"); -8010641d: 83 ec 0c sub $0xc,%esp -80106420: 68 ed 81 10 80 push $0x801081ed -80106425: e8 02 a2 ff ff call 8010062c +801061b4: 83 ec 0c sub $0xc,%esp +801061b7: 68 0d 7f 10 80 push $0x80107f0d +801061bc: e8 40 a4 ff ff call 80100601 deallocuvm(pgdir, newsz, oldsz); -8010642a: 83 c4 0c add $0xc,%esp -8010642d: ff 75 0c pushl 0xc(%ebp) -80106430: 57 push %edi -80106431: ff 75 08 pushl 0x8(%ebp) -80106434: e8 c9 fe ff ff call 80106302 +801061c1: 83 c4 0c add $0xc,%esp +801061c4: ff 75 0c push 0xc(%ebp) +801061c7: 57 push %edi +801061c8: ff 75 08 push 0x8(%ebp) +801061cb: e8 d1 fe ff ff call 801060a1 return 0; -80106439: 83 c4 10 add $0x10,%esp -8010643c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) -80106443: eb 37 jmp 8010647c +801061d0: 83 c4 10 add $0x10,%esp +801061d3: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) +801061da: eb 37 jmp 80106213 cprintf("allocuvm out of memory (2)\n"); -80106445: 83 ec 0c sub $0xc,%esp -80106448: 68 05 82 10 80 push $0x80108205 -8010644d: e8 da a1 ff ff call 8010062c +801061dc: 83 ec 0c sub $0xc,%esp +801061df: 68 25 7f 10 80 push $0x80107f25 +801061e4: e8 18 a4 ff ff call 80100601 deallocuvm(pgdir, newsz, oldsz); -80106452: 83 c4 0c add $0xc,%esp -80106455: ff 75 0c pushl 0xc(%ebp) -80106458: 57 push %edi -80106459: ff 75 08 pushl 0x8(%ebp) -8010645c: e8 a1 fe ff ff call 80106302 +801061e9: 83 c4 0c add $0xc,%esp +801061ec: ff 75 0c push 0xc(%ebp) +801061ef: 57 push %edi +801061f0: ff 75 08 push 0x8(%ebp) +801061f3: e8 a9 fe ff ff call 801060a1 kfree(mem); -80106461: 89 1c 24 mov %ebx,(%esp) -80106464: e8 52 bc ff ff call 801020bb +801061f8: 89 1c 24 mov %ebx,(%esp) +801061fb: e8 fc bd ff ff call 80101ffc return 0; -80106469: 83 c4 10 add $0x10,%esp -8010646c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) -80106473: eb 07 jmp 8010647c +80106200: 83 c4 10 add $0x10,%esp +80106203: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) +8010620a: eb 07 jmp 80106213 return 0; -80106475: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) +8010620c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } -8010647c: 8b 45 e4 mov -0x1c(%ebp),%eax -8010647f: 8d 65 f4 lea -0xc(%ebp),%esp -80106482: 5b pop %ebx -80106483: 5e pop %esi -80106484: 5f pop %edi -80106485: 5d pop %ebp -80106486: c3 ret +80106213: 8b 45 e4 mov -0x1c(%ebp),%eax +80106216: 8d 65 f4 lea -0xc(%ebp),%esp +80106219: 5b pop %ebx +8010621a: 5e pop %esi +8010621b: 5f pop %edi +8010621c: 5d pop %ebp +8010621d: c3 ret -80106487 : +8010621e : // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { -80106487: f3 0f 1e fb endbr32 -8010648b: 55 push %ebp -8010648c: 89 e5 mov %esp,%ebp -8010648e: 57 push %edi -8010648f: 56 push %esi -80106490: 53 push %ebx -80106491: 83 ec 0c sub $0xc,%esp -80106494: 8b 7d 08 mov 0x8(%ebp),%edi +8010621e: 55 push %ebp +8010621f: 89 e5 mov %esp,%ebp +80106221: 57 push %edi +80106222: 56 push %esi +80106223: 53 push %ebx +80106224: 83 ec 0c sub $0xc,%esp +80106227: 8b 7d 08 mov 0x8(%ebp),%edi uint i; if(pgdir == 0) -80106497: 85 ff test %edi,%edi -80106499: 74 1d je 801064b8 +8010622a: 85 ff test %edi,%edi +8010622c: 74 1d je 8010624b panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); -8010649b: 83 ec 04 sub $0x4,%esp -8010649e: 6a 00 push $0x0 -801064a0: 68 00 00 00 80 push $0x80000000 -801064a5: 57 push %edi -801064a6: e8 57 fe ff ff call 80106302 +8010622e: 83 ec 04 sub $0x4,%esp +80106231: 6a 00 push $0x0 +80106233: 68 00 00 00 80 push $0x80000000 +80106238: 57 push %edi +80106239: e8 63 fe ff ff call 801060a1 for(i = 0; i < NPDENTRIES; i++){ -801064ab: 89 fb mov %edi,%ebx -801064ad: 8d b7 00 10 00 00 lea 0x1000(%edi),%esi -801064b3: 83 c4 10 add $0x10,%esp -801064b6: eb 2a jmp 801064e2 +8010623e: 89 fb mov %edi,%ebx +80106240: 8d b7 00 10 00 00 lea 0x1000(%edi),%esi +80106246: 83 c4 10 add $0x10,%esp +80106249: eb 14 jmp 8010625f panic("freevm: no pgdir"); -801064b8: 83 ec 0c sub $0xc,%esp -801064bb: 68 21 82 10 80 push $0x80108221 -801064c0: e8 93 9e ff ff call 80100358 +8010624b: 83 ec 0c sub $0xc,%esp +8010624e: 68 41 7f 10 80 push $0x80107f41 +80106253: e8 e8 a0 ff ff call 80100340 + for(i = 0; i < NPDENTRIES; i++){ +80106258: 83 c3 04 add $0x4,%ebx +8010625b: 39 f3 cmp %esi,%ebx +8010625d: 74 1e je 8010627d if(pgdir[i] & PTE_P){ +8010625f: 8b 03 mov (%ebx),%eax +80106261: a8 01 test $0x1,%al +80106263: 74 f3 je 80106258 char * v = P2V(PTE_ADDR(pgdir[i])); kfree(v); -801064c5: 83 ec 0c sub $0xc,%esp +80106265: 83 ec 0c sub $0xc,%esp char * v = P2V(PTE_ADDR(pgdir[i])); -801064c8: 25 00 f0 ff ff and $0xfffff000,%eax -801064cd: 05 00 00 00 80 add $0x80000000,%eax +80106268: 25 00 f0 ff ff and $0xfffff000,%eax +8010626d: 05 00 00 00 80 add $0x80000000,%eax kfree(v); -801064d2: 50 push %eax -801064d3: e8 e3 bb ff ff call 801020bb -801064d8: 83 c4 10 add $0x10,%esp - for(i = 0; i < NPDENTRIES; i++){ -801064db: 83 c3 04 add $0x4,%ebx -801064de: 39 f3 cmp %esi,%ebx -801064e0: 74 08 je 801064ea - if(pgdir[i] & PTE_P){ -801064e2: 8b 03 mov (%ebx),%eax -801064e4: a8 01 test $0x1,%al -801064e6: 74 f3 je 801064db -801064e8: eb db jmp 801064c5 +80106272: 50 push %eax +80106273: e8 84 bd ff ff call 80101ffc +80106278: 83 c4 10 add $0x10,%esp +8010627b: eb db jmp 80106258 } } kfree((char*)pgdir); -801064ea: 83 ec 0c sub $0xc,%esp -801064ed: 57 push %edi -801064ee: e8 c8 bb ff ff call 801020bb -} -801064f3: 83 c4 10 add $0x10,%esp -801064f6: 8d 65 f4 lea -0xc(%ebp),%esp -801064f9: 5b pop %ebx -801064fa: 5e pop %esi -801064fb: 5f pop %edi -801064fc: 5d pop %ebp -801064fd: c3 ret - -801064fe : -{ -801064fe: f3 0f 1e fb endbr32 -80106502: 55 push %ebp -80106503: 89 e5 mov %esp,%ebp -80106505: 56 push %esi -80106506: 53 push %ebx +8010627d: 83 ec 0c sub $0xc,%esp +80106280: 57 push %edi +80106281: e8 76 bd ff ff call 80101ffc +} +80106286: 83 c4 10 add $0x10,%esp +80106289: 8d 65 f4 lea -0xc(%ebp),%esp +8010628c: 5b pop %ebx +8010628d: 5e pop %esi +8010628e: 5f pop %edi +8010628f: 5d pop %ebp +80106290: c3 ret + +80106291 : +{ +80106291: 55 push %ebp +80106292: 89 e5 mov %esp,%ebp +80106294: 56 push %esi +80106295: 53 push %ebx if((pgdir = (pde_t*)kalloc()) == 0) -80106507: e8 0d bd ff ff call 80102219 -8010650c: 89 c6 mov %eax,%esi -8010650e: 85 c0 test %eax,%eax -80106510: 74 42 je 80106554 +80106296: e8 af be ff ff call 8010214a +8010629b: 89 c6 mov %eax,%esi +8010629d: 85 c0 test %eax,%eax +8010629f: 74 42 je 801062e3 memset(pgdir, 0, PGSIZE); -80106512: 83 ec 04 sub $0x4,%esp -80106515: 68 00 10 00 00 push $0x1000 -8010651a: 6a 00 push $0x0 -8010651c: 50 push %eax -8010651d: e8 2d da ff ff call 80103f4f -80106522: 83 c4 10 add $0x10,%esp +801062a1: 83 ec 04 sub $0x4,%esp +801062a4: 68 00 10 00 00 push $0x1000 +801062a9: 6a 00 push $0x0 +801062ab: 50 push %eax +801062ac: e8 fe da ff ff call 80103daf +801062b1: 83 c4 10 add $0x10,%esp for(k = kmap; k < &kmap[NELEM(kmap)]; k++) -80106525: bb 20 b4 10 80 mov $0x8010b420,%ebx +801062b4: bb 20 b4 10 80 mov $0x8010b420,%ebx (uint)k->phys_start, k->perm) < 0) { -8010652a: 8b 43 04 mov 0x4(%ebx),%eax +801062b9: 8b 43 04 mov 0x4(%ebx),%eax if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, -8010652d: 8b 4b 08 mov 0x8(%ebx),%ecx -80106530: 29 c1 sub %eax,%ecx -80106532: 83 ec 08 sub $0x8,%esp -80106535: ff 73 0c pushl 0xc(%ebx) -80106538: 50 push %eax -80106539: 8b 13 mov (%ebx),%edx -8010653b: 89 f0 mov %esi,%eax -8010653d: e8 2c fa ff ff call 80105f6e -80106542: 83 c4 10 add $0x10,%esp -80106545: 85 c0 test %eax,%eax -80106547: 78 14 js 8010655d +801062bc: 8b 4b 08 mov 0x8(%ebx),%ecx +801062bf: 29 c1 sub %eax,%ecx +801062c1: 83 ec 08 sub $0x8,%esp +801062c4: ff 73 0c push 0xc(%ebx) +801062c7: 50 push %eax +801062c8: 8b 13 mov (%ebx),%edx +801062ca: 89 f0 mov %esi,%eax +801062cc: e8 4e fa ff ff call 80105d1f +801062d1: 83 c4 10 add $0x10,%esp +801062d4: 85 c0 test %eax,%eax +801062d6: 78 14 js 801062ec for(k = kmap; k < &kmap[NELEM(kmap)]; k++) -80106549: 83 c3 10 add $0x10,%ebx -8010654c: 81 fb 60 b4 10 80 cmp $0x8010b460,%ebx -80106552: 75 d6 jne 8010652a -} -80106554: 89 f0 mov %esi,%eax -80106556: 8d 65 f8 lea -0x8(%ebp),%esp -80106559: 5b pop %ebx -8010655a: 5e pop %esi -8010655b: 5d pop %ebp -8010655c: c3 ret +801062d8: 83 c3 10 add $0x10,%ebx +801062db: 81 fb 60 b4 10 80 cmp $0x8010b460,%ebx +801062e1: 75 d6 jne 801062b9 +} +801062e3: 89 f0 mov %esi,%eax +801062e5: 8d 65 f8 lea -0x8(%ebp),%esp +801062e8: 5b pop %ebx +801062e9: 5e pop %esi +801062ea: 5d pop %ebp +801062eb: c3 ret freevm(pgdir); -8010655d: 83 ec 0c sub $0xc,%esp -80106560: 56 push %esi -80106561: e8 21 ff ff ff call 80106487 +801062ec: 83 ec 0c sub $0xc,%esp +801062ef: 56 push %esi +801062f0: e8 29 ff ff ff call 8010621e return 0; -80106566: 83 c4 10 add $0x10,%esp -80106569: be 00 00 00 00 mov $0x0,%esi -8010656e: eb e4 jmp 80106554 +801062f5: 83 c4 10 add $0x10,%esp +801062f8: be 00 00 00 00 mov $0x0,%esi +801062fd: eb e4 jmp 801062e3 -80106570 : +801062ff : { -80106570: f3 0f 1e fb endbr32 -80106574: 55 push %ebp -80106575: 89 e5 mov %esp,%ebp -80106577: 83 ec 08 sub $0x8,%esp +801062ff: 55 push %ebp +80106300: 89 e5 mov %esp,%ebp +80106302: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); -8010657a: e8 7f ff ff ff call 801064fe -8010657f: a3 04 6a 11 80 mov %eax,0x80116a04 +80106305: e8 87 ff ff ff call 80106291 +8010630a: a3 04 3e 11 80 mov %eax,0x80113e04 switchkvm(); -80106584: e8 48 fb ff ff call 801060d1 +8010630f: e8 6d fb ff ff call 80105e81 } -80106589: c9 leave -8010658a: c3 ret +80106314: c9 leave +80106315: c3 ret -8010658b : +80106316 : // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { -8010658b: f3 0f 1e fb endbr32 -8010658f: 55 push %ebp -80106590: 89 e5 mov %esp,%ebp -80106592: 83 ec 08 sub $0x8,%esp +80106316: 55 push %ebp +80106317: 89 e5 mov %esp,%ebp +80106319: 83 ec 08 sub $0x8,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); -80106595: b9 00 00 00 00 mov $0x0,%ecx -8010659a: 8b 55 0c mov 0xc(%ebp),%edx -8010659d: 8b 45 08 mov 0x8(%ebp),%eax -801065a0: e8 5c f9 ff ff call 80105f01 +8010631c: b9 00 00 00 00 mov $0x0,%ecx +80106321: 8b 55 0c mov 0xc(%ebp),%edx +80106324: 8b 45 08 mov 0x8(%ebp),%eax +80106327: e8 86 f9 ff ff call 80105cb2 if(pte == 0) -801065a5: 85 c0 test %eax,%eax -801065a7: 74 05 je 801065ae +8010632c: 85 c0 test %eax,%eax +8010632e: 74 05 je 80106335 panic("clearpteu"); *pte &= ~PTE_U; -801065a9: 83 20 fb andl $0xfffffffb,(%eax) +80106330: 83 20 fb andl $0xfffffffb,(%eax) } -801065ac: c9 leave -801065ad: c3 ret +80106333: c9 leave +80106334: c3 ret panic("clearpteu"); -801065ae: 83 ec 0c sub $0xc,%esp -801065b1: 68 32 82 10 80 push $0x80108232 -801065b6: e8 9d 9d ff ff call 80100358 +80106335: 83 ec 0c sub $0xc,%esp +80106338: 68 52 7f 10 80 push $0x80107f52 +8010633d: e8 fe 9f ff ff call 80100340 -801065bb : +80106342 : // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { -801065bb: f3 0f 1e fb endbr32 -801065bf: 55 push %ebp -801065c0: 89 e5 mov %esp,%ebp -801065c2: 57 push %edi -801065c3: 56 push %esi -801065c4: 53 push %ebx -801065c5: 83 ec 1c sub $0x1c,%esp +80106342: 55 push %ebp +80106343: 89 e5 mov %esp,%ebp +80106345: 57 push %edi +80106346: 56 push %esi +80106347: 53 push %ebx +80106348: 83 ec 1c sub $0x1c,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) -801065c8: e8 31 ff ff ff call 801064fe -801065cd: 89 45 dc mov %eax,-0x24(%ebp) -801065d0: 85 c0 test %eax,%eax -801065d2: 0f 84 c7 00 00 00 je 8010669f +8010634b: e8 41 ff ff ff call 80106291 +80106350: 89 45 dc mov %eax,-0x24(%ebp) +80106353: 85 c0 test %eax,%eax +80106355: 0f 84 c7 00 00 00 je 80106422 return 0; for(i = 0; i < sz; i += PGSIZE){ -801065d8: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) -801065dc: 0f 84 bd 00 00 00 je 8010669f -801065e2: bf 00 00 00 00 mov $0x0,%edi +8010635b: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) +8010635f: 0f 84 bd 00 00 00 je 80106422 +80106365: bf 00 00 00 00 mov $0x0,%edi if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) -801065e7: 89 7d e4 mov %edi,-0x1c(%ebp) -801065ea: b9 00 00 00 00 mov $0x0,%ecx -801065ef: 89 fa mov %edi,%edx -801065f1: 8b 45 08 mov 0x8(%ebp),%eax -801065f4: e8 08 f9 ff ff call 80105f01 -801065f9: 85 c0 test %eax,%eax -801065fb: 74 67 je 80106664 +8010636a: 89 7d e4 mov %edi,-0x1c(%ebp) +8010636d: b9 00 00 00 00 mov $0x0,%ecx +80106372: 89 fa mov %edi,%edx +80106374: 8b 45 08 mov 0x8(%ebp),%eax +80106377: e8 36 f9 ff ff call 80105cb2 +8010637c: 85 c0 test %eax,%eax +8010637e: 74 67 je 801063e7 panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) -801065fd: 8b 00 mov (%eax),%eax -801065ff: a8 01 test $0x1,%al -80106601: 74 6e je 80106671 +80106380: 8b 00 mov (%eax),%eax +80106382: a8 01 test $0x1,%al +80106384: 74 6e je 801063f4 panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); -80106603: 89 c6 mov %eax,%esi -80106605: 81 e6 00 f0 ff ff and $0xfffff000,%esi +80106386: 89 c6 mov %eax,%esi +80106388: 81 e6 00 f0 ff ff and $0xfffff000,%esi flags = PTE_FLAGS(*pte); -8010660b: 25 ff 0f 00 00 and $0xfff,%eax -80106610: 89 45 e0 mov %eax,-0x20(%ebp) +8010638e: 25 ff 0f 00 00 and $0xfff,%eax +80106393: 89 45 e0 mov %eax,-0x20(%ebp) if((mem = kalloc()) == 0) -80106613: e8 01 bc ff ff call 80102219 -80106618: 89 c3 mov %eax,%ebx -8010661a: 85 c0 test %eax,%eax -8010661c: 74 6c je 8010668a +80106396: e8 af bd ff ff call 8010214a +8010639b: 89 c3 mov %eax,%ebx +8010639d: 85 c0 test %eax,%eax +8010639f: 74 6c je 8010640d goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); -8010661e: 83 ec 04 sub $0x4,%esp -80106621: 68 00 10 00 00 push $0x1000 -80106626: 81 c6 00 00 00 80 add $0x80000000,%esi -8010662c: 56 push %esi -8010662d: 50 push %eax -8010662e: e8 a9 d9 ff ff call 80103fdc +801063a1: 83 ec 04 sub $0x4,%esp +801063a4: 68 00 10 00 00 push $0x1000 +801063a9: 81 c6 00 00 00 80 add $0x80000000,%esi +801063af: 56 push %esi +801063b0: 50 push %eax +801063b1: e8 7e da ff ff call 80103e34 if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { -80106633: 83 c4 08 add $0x8,%esp -80106636: ff 75 e0 pushl -0x20(%ebp) -80106639: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax -8010663f: 50 push %eax -80106640: b9 00 10 00 00 mov $0x1000,%ecx -80106645: 8b 55 e4 mov -0x1c(%ebp),%edx -80106648: 8b 45 dc mov -0x24(%ebp),%eax -8010664b: e8 1e f9 ff ff call 80105f6e -80106650: 83 c4 10 add $0x10,%esp -80106653: 85 c0 test %eax,%eax -80106655: 78 27 js 8010667e +801063b6: 83 c4 08 add $0x8,%esp +801063b9: ff 75 e0 push -0x20(%ebp) +801063bc: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax +801063c2: 50 push %eax +801063c3: b9 00 10 00 00 mov $0x1000,%ecx +801063c8: 8b 55 e4 mov -0x1c(%ebp),%edx +801063cb: 8b 45 dc mov -0x24(%ebp),%eax +801063ce: e8 4c f9 ff ff call 80105d1f +801063d3: 83 c4 10 add $0x10,%esp +801063d6: 85 c0 test %eax,%eax +801063d8: 78 27 js 80106401 for(i = 0; i < sz; i += PGSIZE){ -80106657: 81 c7 00 10 00 00 add $0x1000,%edi -8010665d: 39 7d 0c cmp %edi,0xc(%ebp) -80106660: 77 85 ja 801065e7 -80106662: eb 3b jmp 8010669f +801063da: 81 c7 00 10 00 00 add $0x1000,%edi +801063e0: 39 7d 0c cmp %edi,0xc(%ebp) +801063e3: 77 85 ja 8010636a +801063e5: eb 3b jmp 80106422 panic("copyuvm: pte should exist"); -80106664: 83 ec 0c sub $0xc,%esp -80106667: 68 3c 82 10 80 push $0x8010823c -8010666c: e8 e7 9c ff ff call 80100358 +801063e7: 83 ec 0c sub $0xc,%esp +801063ea: 68 5c 7f 10 80 push $0x80107f5c +801063ef: e8 4c 9f ff ff call 80100340 panic("copyuvm: page not present"); -80106671: 83 ec 0c sub $0xc,%esp -80106674: 68 56 82 10 80 push $0x80108256 -80106679: e8 da 9c ff ff call 80100358 +801063f4: 83 ec 0c sub $0xc,%esp +801063f7: 68 76 7f 10 80 push $0x80107f76 +801063fc: e8 3f 9f ff ff call 80100340 kfree(mem); -8010667e: 83 ec 0c sub $0xc,%esp -80106681: 53 push %ebx -80106682: e8 34 ba ff ff call 801020bb +80106401: 83 ec 0c sub $0xc,%esp +80106404: 53 push %ebx +80106405: e8 f2 bb ff ff call 80101ffc goto bad; -80106687: 83 c4 10 add $0x10,%esp +8010640a: 83 c4 10 add $0x10,%esp } } return d; bad: freevm(d); -8010668a: 83 ec 0c sub $0xc,%esp -8010668d: ff 75 dc pushl -0x24(%ebp) -80106690: e8 f2 fd ff ff call 80106487 +8010640d: 83 ec 0c sub $0xc,%esp +80106410: ff 75 dc push -0x24(%ebp) +80106413: e8 06 fe ff ff call 8010621e return 0; -80106695: 83 c4 10 add $0x10,%esp -80106698: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) +80106418: 83 c4 10 add $0x10,%esp +8010641b: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) } -8010669f: 8b 45 dc mov -0x24(%ebp),%eax -801066a2: 8d 65 f4 lea -0xc(%ebp),%esp -801066a5: 5b pop %ebx -801066a6: 5e pop %esi -801066a7: 5f pop %edi -801066a8: 5d pop %ebp -801066a9: c3 ret +80106422: 8b 45 dc mov -0x24(%ebp),%eax +80106425: 8d 65 f4 lea -0xc(%ebp),%esp +80106428: 5b pop %ebx +80106429: 5e pop %esi +8010642a: 5f pop %edi +8010642b: 5d pop %ebp +8010642c: c3 ret -801066aa : +8010642d : //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { -801066aa: f3 0f 1e fb endbr32 -801066ae: 55 push %ebp -801066af: 89 e5 mov %esp,%ebp -801066b1: 83 ec 08 sub $0x8,%esp +8010642d: 55 push %ebp +8010642e: 89 e5 mov %esp,%ebp +80106430: 83 ec 08 sub $0x8,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); -801066b4: b9 00 00 00 00 mov $0x0,%ecx -801066b9: 8b 55 0c mov 0xc(%ebp),%edx -801066bc: 8b 45 08 mov 0x8(%ebp),%eax -801066bf: e8 3d f8 ff ff call 80105f01 +80106433: b9 00 00 00 00 mov $0x0,%ecx +80106438: 8b 55 0c mov 0xc(%ebp),%edx +8010643b: 8b 45 08 mov 0x8(%ebp),%eax +8010643e: e8 6f f8 ff ff call 80105cb2 if((*pte & PTE_P) == 0) -801066c4: 8b 00 mov (%eax),%eax +80106443: 8b 00 mov (%eax),%eax return 0; if((*pte & PTE_U) == 0) -801066c6: 89 c2 mov %eax,%edx -801066c8: 83 e2 05 and $0x5,%edx +80106445: 89 c2 mov %eax,%edx +80106447: 83 e2 05 and $0x5,%edx return 0; return (char*)P2V(PTE_ADDR(*pte)); -801066cb: 25 00 f0 ff ff and $0xfffff000,%eax -801066d0: 05 00 00 00 80 add $0x80000000,%eax -801066d5: 83 fa 05 cmp $0x5,%edx -801066d8: ba 00 00 00 00 mov $0x0,%edx -801066dd: 0f 45 c2 cmovne %edx,%eax +8010644a: 25 00 f0 ff ff and $0xfffff000,%eax +8010644f: 05 00 00 00 80 add $0x80000000,%eax +80106454: 83 fa 05 cmp $0x5,%edx +80106457: ba 00 00 00 00 mov $0x0,%edx +8010645c: 0f 45 c2 cmovne %edx,%eax } -801066e0: c9 leave -801066e1: c3 ret +8010645f: c9 leave +80106460: c3 ret -801066e2 : +80106461 : // 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) { -801066e2: f3 0f 1e fb endbr32 -801066e6: 55 push %ebp -801066e7: 89 e5 mov %esp,%ebp -801066e9: 57 push %edi -801066ea: 56 push %esi -801066eb: 53 push %ebx -801066ec: 83 ec 0c sub $0xc,%esp -801066ef: 8b 75 0c mov 0xc(%ebp),%esi +80106461: 55 push %ebp +80106462: 89 e5 mov %esp,%ebp +80106464: 57 push %edi +80106465: 56 push %esi +80106466: 53 push %ebx +80106467: 83 ec 0c sub $0xc,%esp +8010646a: 8b 75 14 mov 0x14(%ebp),%esi char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ -801066f2: 83 7d 14 00 cmpl $0x0,0x14(%ebp) -801066f6: 74 55 je 8010674d +8010646d: 85 f6 test %esi,%esi +8010646f: 74 5a je 801064cb va0 = (uint)PGROUNDDOWN(va); -801066f8: 89 f7 mov %esi,%edi -801066fa: 81 e7 00 f0 ff ff and $0xfffff000,%edi +80106471: 8b 7d 0c mov 0xc(%ebp),%edi +80106474: 81 e7 00 f0 ff ff and $0xfffff000,%edi pa0 = uva2ka(pgdir, (char*)va0); -80106700: 83 ec 08 sub $0x8,%esp -80106703: 57 push %edi -80106704: ff 75 08 pushl 0x8(%ebp) -80106707: e8 9e ff ff ff call 801066aa +8010647a: 83 ec 08 sub $0x8,%esp +8010647d: 57 push %edi +8010647e: ff 75 08 push 0x8(%ebp) +80106481: e8 a7 ff ff ff call 8010642d if(pa0 == 0) -8010670c: 83 c4 10 add $0x10,%esp -8010670f: 85 c0 test %eax,%eax -80106711: 74 41 je 80106754 +80106486: 83 c4 10 add $0x10,%esp +80106489: 85 c0 test %eax,%eax +8010648b: 74 45 je 801064d2 return -1; n = PGSIZE - (va - va0); -80106713: 89 fb mov %edi,%ebx -80106715: 29 f3 sub %esi,%ebx -80106717: 81 c3 00 10 00 00 add $0x1000,%ebx +8010648d: 89 fb mov %edi,%ebx +8010648f: 2b 5d 0c sub 0xc(%ebp),%ebx +80106492: 81 c3 00 10 00 00 add $0x1000,%ebx +80106498: 39 f3 cmp %esi,%ebx +8010649a: 0f 47 de cmova %esi,%ebx if(n > len) -8010671d: 3b 5d 14 cmp 0x14(%ebp),%ebx -80106720: 0f 47 5d 14 cmova 0x14(%ebp),%ebx n = len; memmove(pa0 + (va - va0), buf, n); -80106724: 83 ec 04 sub $0x4,%esp -80106727: 53 push %ebx -80106728: ff 75 10 pushl 0x10(%ebp) -8010672b: 29 fe sub %edi,%esi -8010672d: 01 f0 add %esi,%eax -8010672f: 50 push %eax -80106730: e8 a7 d8 ff ff call 80103fdc +8010649d: 83 ec 04 sub $0x4,%esp +801064a0: 53 push %ebx +801064a1: ff 75 10 push 0x10(%ebp) +801064a4: 8b 55 0c mov 0xc(%ebp),%edx +801064a7: 29 fa sub %edi,%edx +801064a9: 01 d0 add %edx,%eax +801064ab: 50 push %eax +801064ac: e8 83 d9 ff ff call 80103e34 len -= n; buf += n; -80106735: 01 5d 10 add %ebx,0x10(%ebp) +801064b1: 01 5d 10 add %ebx,0x10(%ebp) va = va0 + PGSIZE; -80106738: 8d b7 00 10 00 00 lea 0x1000(%edi),%esi +801064b4: 8d 87 00 10 00 00 lea 0x1000(%edi),%eax +801064ba: 89 45 0c mov %eax,0xc(%ebp) while(len > 0){ -8010673e: 83 c4 10 add $0x10,%esp -80106741: 29 5d 14 sub %ebx,0x14(%ebp) -80106744: 75 b2 jne 801066f8 +801064bd: 83 c4 10 add $0x10,%esp +801064c0: 29 de sub %ebx,%esi +801064c2: 75 ad jne 80106471 } return 0; -80106746: b8 00 00 00 00 mov $0x0,%eax -8010674b: eb 0c jmp 80106759 -8010674d: b8 00 00 00 00 mov $0x0,%eax -80106752: eb 05 jmp 80106759 +801064c4: b8 00 00 00 00 mov $0x0,%eax +801064c9: eb 0c jmp 801064d7 +801064cb: b8 00 00 00 00 mov $0x0,%eax +801064d0: eb 05 jmp 801064d7 return -1; -80106754: b8 ff ff ff ff mov $0xffffffff,%eax +801064d2: b8 ff ff ff ff mov $0xffffffff,%eax } -80106759: 8d 65 f4 lea -0xc(%ebp),%esp -8010675c: 5b pop %ebx -8010675d: 5e pop %esi -8010675e: 5f pop %edi -8010675f: 5d pop %ebp -80106760: c3 ret +801064d7: 8d 65 f4 lea -0xc(%ebp),%esp +801064da: 5b pop %ebx +801064db: 5e pop %esi +801064dc: 5f pop %edi +801064dd: 5d pop %ebp +801064de: c3 ret -80106761 : +801064df : #include int set_bit(int num,int i) { -80106761: f3 0f 1e fb endbr32 -80106765: 55 push %ebp -80106766: 89 e5 mov %esp,%ebp +801064df: 55 push %ebp +801064e0: 89 e5 mov %esp,%ebp return num | (1<: +801064f1 : int get_bit(int num,int i) { -80106777: f3 0f 1e fb endbr32 -8010677b: 55 push %ebp -8010677c: 89 e5 mov %esp,%ebp +801064f1: 55 push %ebp +801064f2: 89 e5 mov %esp,%ebp return ((num&(1<: +80106501 : int clear_bit(int num,int i) { -8010678b: f3 0f 1e fb endbr32 -8010678f: 55 push %ebp -80106790: 89 e5 mov %esp,%ebp +80106501: 55 push %ebp +80106502: 89 e5 mov %esp,%ebp int mask=~(1<: +80106513 : unsigned int getnumofBits(unsigned int n) { -801067a1: f3 0f 1e fb endbr32 -801067a5: 55 push %ebp -801067a6: 89 e5 mov %esp,%ebp -801067a8: 8b 45 08 mov 0x8(%ebp),%eax +80106513: 55 push %ebp +80106514: 89 e5 mov %esp,%ebp +80106516: 8b 45 08 mov 0x8(%ebp),%eax unsigned count=0; while(n!=0) -801067ab: 85 c0 test %eax,%eax -801067ad: 74 10 je 801067bf +80106519: 85 c0 test %eax,%eax +8010651b: 74 10 je 8010652d unsigned count=0; -801067af: ba 00 00 00 00 mov $0x0,%edx +8010651d: ba 00 00 00 00 mov $0x0,%edx { n>>=1; count+=1; -801067b4: 83 c2 01 add $0x1,%edx +80106522: 83 c2 01 add $0x1,%edx while(n!=0) -801067b7: d1 e8 shr %eax -801067b9: 75 f9 jne 801067b4 +80106525: d1 e8 shr %eax +80106527: 75 f9 jne 80106522 } return count; } -801067bb: 89 d0 mov %edx,%eax -801067bd: 5d pop %ebp -801067be: c3 ret +80106529: 89 d0 mov %edx,%eax +8010652b: 5d pop %ebp +8010652c: c3 ret unsigned count=0; -801067bf: 89 c2 mov %eax,%edx +8010652d: 89 c2 mov %eax,%edx return count; -801067c1: eb f8 jmp 801067bb +8010652f: eb f8 jmp 80106529 -801067c3 : +80106531 : unsigned int nextPowerOf2(unsigned int n) { -801067c3: f3 0f 1e fb endbr32 -801067c7: 55 push %ebp -801067c8: 89 e5 mov %esp,%ebp -801067ca: 83 ec 08 sub $0x8,%esp -801067cd: 8b 55 08 mov 0x8(%ebp),%edx +80106531: 55 push %ebp +80106532: 89 e5 mov %esp,%ebp +80106534: 83 ec 08 sub $0x8,%esp +80106537: 8b 55 08 mov 0x8(%ebp),%edx if(n>=0 && n<8) return 8; -801067d0: b8 08 00 00 00 mov $0x8,%eax +8010653a: b8 08 00 00 00 mov $0x8,%eax if(n>=0 && n<8) -801067d5: 83 fa 07 cmp $0x7,%edx -801067d8: 76 1e jbe 801067f8 +8010653f: 83 fa 07 cmp $0x7,%edx +80106542: 76 1e jbe 80106562 if(n && !(n&(n-1))) -801067da: 8d 4a ff lea -0x1(%edx),%ecx +80106544: 8d 4a ff lea -0x1(%edx),%ecx return n; -801067dd: 89 d0 mov %edx,%eax +80106547: 89 d0 mov %edx,%eax if(n && !(n&(n-1))) -801067df: 85 d1 test %edx,%ecx -801067e1: 74 15 je 801067f8 +80106549: 85 d1 test %edx,%ecx +8010654b: 74 15 je 80106562 return 1< -801067ec: 83 c4 10 add $0x10,%esp -801067ef: 89 c1 mov %eax,%ecx -801067f1: b8 01 00 00 00 mov $0x1,%eax -801067f6: d3 e0 shl %cl,%eax -} -801067f8: c9 leave -801067f9: c3 ret - -801067fa : +8010654d: 83 ec 0c sub $0xc,%esp +80106550: 52 push %edx +80106551: e8 bd ff ff ff call 80106513 +80106556: 83 c4 10 add $0x10,%esp +80106559: 89 c1 mov %eax,%ecx +8010655b: b8 01 00 00 00 mov $0x1,%eax +80106560: d3 e0 shl %cl,%eax +} +80106562: c9 leave +80106563: c3 ret + +80106564 : unsigned int getslabIdx(unsigned int n) { -801067fa: f3 0f 1e fb endbr32 -801067fe: 55 push %ebp -801067ff: 89 e5 mov %esp,%ebp -80106801: 83 ec 14 sub $0x14,%esp +80106564: 55 push %ebp +80106565: 89 e5 mov %esp,%ebp +80106567: 83 ec 14 sub $0x14,%esp unsigned slabIdx=getnumofBits(n)-4; -80106804: ff 75 08 pushl 0x8(%ebp) -80106807: e8 95 ff ff ff call 801067a1 -8010680c: 83 c4 10 add $0x10,%esp -8010680f: 83 e8 04 sub $0x4,%eax +8010656a: ff 75 08 push 0x8(%ebp) +8010656d: e8 a1 ff ff ff call 80106513 +80106572: 83 c4 10 add $0x10,%esp +80106575: 83 e8 04 sub $0x4,%eax return slabIdx; } -80106812: c9 leave -80106813: c3 ret +80106578: c9 leave +80106579: c3 ret -80106814 : +8010657a : struct spinlock lock; struct slab slab[NSLAB]; } stable; int returnOffset(int row,int column) { -80106814: f3 0f 1e fb endbr32 -80106818: 55 push %ebp -80106819: 89 e5 mov %esp,%ebp +8010657a: 55 push %ebp +8010657b: 89 e5 mov %esp,%ebp return 8*row + column; -8010681b: 8b 45 08 mov 0x8(%ebp),%eax -8010681e: c1 e0 03 shl $0x3,%eax -80106821: 03 45 0c add 0xc(%ebp),%eax +8010657d: 8b 45 08 mov 0x8(%ebp),%eax +80106580: c1 e0 03 shl $0x3,%eax +80106583: 03 45 0c add 0xc(%ebp),%eax } -80106824: 5d pop %ebp -80106825: c3 ret +80106586: 5d pop %ebp +80106587: c3 ret -80106826 : +80106588 : int setBitmap(int slabIdx) { -80106826: f3 0f 1e fb endbr32 -8010682a: 55 push %ebp -8010682b: 89 e5 mov %esp,%ebp -8010682d: 56 push %esi -8010682e: 53 push %ebx +80106588: 55 push %ebp +80106589: 89 e5 mov %esp,%ebp +8010658b: 56 push %esi +8010658c: 53 push %ebx { if(s->bitmap[j]==0xFF) continue; for(int k=0;k<=7;k++) { if(!(s->bitmap[j]&(1< +8010659a: b9 00 00 00 00 mov $0x0,%ecx +8010659f: eb 1c jmp 801065bd for(int k=0;k<=7;k++) -80106843: b8 00 00 00 00 mov $0x0,%eax +801065a1: b8 00 00 00 00 mov $0x0,%eax return num | (1<bitmap[j]=set_bit(s->bitmap[j],k); -8010684b: 88 13 mov %dl,(%ebx) +801065a9: 88 13 mov %dl,(%ebx) return 8*row + column; -8010684d: 8d 04 c8 lea (%eax,%ecx,8),%eax +801065ab: 8d 04 c8 lea (%eax,%ecx,8),%eax return returnOffset(j,k); } } } return 0; //Unable to find empty space of bitmap } -80106850: 5b pop %ebx -80106851: 5e pop %esi -80106852: 5d pop %ebp -80106853: c3 ret +801065ae: 5b pop %ebx +801065af: 5e pop %esi +801065b0: 5d pop %ebp +801065b1: c3 ret for(int j=0;j +801065b2: 83 c1 01 add $0x1,%ecx +801065b5: 81 f9 00 10 00 00 cmp $0x1000,%ecx +801065bb: 74 22 je 801065df if(!(s->bitmap[j]&(1< +801065bd: 8d 1c 0e lea (%esi,%ecx,1),%ebx +801065c0: 0f b6 04 0e movzbl (%esi,%ecx,1),%eax +801065c4: 0f be d0 movsbl %al,%edx +801065c7: a8 01 test $0x1,%al +801065c9: 74 d6 je 801065a1 for(int k=0;k<=7;k++) -8010686d: b8 01 00 00 00 mov $0x1,%eax +801065cb: b8 01 00 00 00 mov $0x1,%eax if(!(s->bitmap[j]&(1< +801065d0: 0f a3 c2 bt %eax,%edx +801065d3: 73 d1 jae 801065a6 for(int k=0;k<=7;k++) -80106877: 83 c0 01 add $0x1,%eax -8010687a: 83 f8 08 cmp $0x8,%eax -8010687d: 75 f3 jne 80106872 -8010687f: eb d3 jmp 80106854 +801065d5: 83 c0 01 add $0x1,%eax +801065d8: 83 f8 08 cmp $0x8,%eax +801065db: 75 f3 jne 801065d0 +801065dd: eb d3 jmp 801065b2 return 0; //Unable to find empty space of bitmap -80106881: b8 00 00 00 00 mov $0x0,%eax -80106886: eb c8 jmp 80106850 +801065df: b8 00 00 00 00 mov $0x0,%eax +801065e4: eb c8 jmp 801065ae -80106888 : +801065e6 : int getRow(int offset) { -80106888: f3 0f 1e fb endbr32 -8010688c: 55 push %ebp -8010688d: 89 e5 mov %esp,%ebp -8010688f: 8b 55 08 mov 0x8(%ebp),%edx +801065e6: 55 push %ebp +801065e7: 89 e5 mov %esp,%ebp +801065e9: 8b 55 08 mov 0x8(%ebp),%edx return offset/8; -80106892: 8d 42 07 lea 0x7(%edx),%eax -80106895: 85 d2 test %edx,%edx -80106897: 0f 49 c2 cmovns %edx,%eax -8010689a: c1 f8 03 sar $0x3,%eax +801065ec: 8d 42 07 lea 0x7(%edx),%eax +801065ef: 85 d2 test %edx,%edx +801065f1: 0f 49 c2 cmovns %edx,%eax +801065f4: c1 f8 03 sar $0x3,%eax } -8010689d: 5d pop %ebp -8010689e: c3 ret +801065f7: 5d pop %ebp +801065f8: c3 ret -8010689f : +801065f9 : int getColumn(int offset) { -8010689f: f3 0f 1e fb endbr32 -801068a3: 55 push %ebp -801068a4: 89 e5 mov %esp,%ebp -801068a6: 8b 45 08 mov 0x8(%ebp),%eax +801065f9: 55 push %ebp +801065fa: 89 e5 mov %esp,%ebp +801065fc: 8b 45 08 mov 0x8(%ebp),%eax return offset%8; -801068a9: 99 cltd -801068aa: c1 ea 1d shr $0x1d,%edx -801068ad: 01 d0 add %edx,%eax -801068af: 83 e0 07 and $0x7,%eax -801068b2: 29 d0 sub %edx,%eax +801065ff: 99 cltd +80106600: c1 ea 1d shr $0x1d,%edx +80106603: 01 d0 add %edx,%eax +80106605: 83 e0 07 and $0x7,%eax +80106608: 29 d0 sub %edx,%eax } -801068b4: 5d pop %ebp -801068b5: c3 ret +8010660a: 5d pop %ebp +8010660b: c3 ret -801068b6 : +8010660c : bool clearBitmap(int slabIdx,int offset) { -801068b6: f3 0f 1e fb endbr32 -801068ba: 55 push %ebp -801068bb: 89 e5 mov %esp,%ebp -801068bd: 53 push %ebx -801068be: 8b 5d 0c mov 0xc(%ebp),%ebx - return offset%8; -801068c1: 89 d9 mov %ebx,%ecx -801068c3: c1 f9 1f sar $0x1f,%ecx -801068c6: c1 e9 1d shr $0x1d,%ecx -801068c9: 8d 14 0b lea (%ebx,%ecx,1),%edx -801068cc: 83 e2 07 and $0x7,%edx -801068cf: 29 ca sub %ecx,%edx +8010660c: 55 push %ebp +8010660d: 89 e5 mov %esp,%ebp +8010660f: 53 push %ebx +80106610: 8b 55 0c mov 0xc(%ebp),%edx struct slab *s; s=&stable.slab[slabIdx]; bool checkbit=true; int row=getRow(offset); int column=getColumn(offset); if(get_bit(s->bitmap[row],column)) -801068d1: 69 4d 08 a8 01 00 00 imul $0x1a8,0x8(%ebp),%ecx +80106613: 69 4d 08 a8 01 00 00 imul $0x1a8,0x8(%ebp),%ecx return offset/8; -801068d8: 8d 43 07 lea 0x7(%ebx),%eax -801068db: 85 db test %ebx,%ebx -801068dd: 0f 49 c3 cmovns %ebx,%eax -801068e0: c1 f8 03 sar $0x3,%eax +8010661a: 8d 42 07 lea 0x7(%edx),%eax +8010661d: 85 d2 test %edx,%edx +8010661f: 0f 49 c2 cmovns %edx,%eax +80106622: c1 f8 03 sar $0x3,%eax if(get_bit(s->bitmap[row],column)) -801068e3: 03 81 68 6a 11 80 add -0x7fee9598(%ecx),%eax -801068e9: 0f be 08 movsbl (%eax),%ecx +80106625: 03 81 68 3e 11 80 add -0x7feec198(%ecx),%eax +8010662b: 0f be 08 movsbl (%eax),%ecx + return ((num&(1<bitmap[row]=clear_bit(s->bitmap[row],column); else checkbit=false; -801068ec: bb 00 00 00 00 mov $0x0,%ebx +80106631: bb 00 00 00 00 mov $0x0,%ebx if(get_bit(s->bitmap[row],column)) -801068f1: 0f a3 d1 bt %edx,%ecx -801068f4: 73 0a jae 80106900 +80106636: 0f a3 d1 bt %edx,%ecx +80106639: 73 0a jae 80106645 return num&mask; -801068f6: 0f b3 d1 btr %edx,%ecx +8010663b: 0f b3 d1 btr %edx,%ecx s->bitmap[row]=clear_bit(s->bitmap[row],column); -801068f9: 88 08 mov %cl,(%eax) +8010663e: 88 08 mov %cl,(%eax) bool checkbit=true; -801068fb: bb 01 00 00 00 mov $0x1,%ebx +80106640: bb 01 00 00 00 mov $0x1,%ebx return checkbit; } -80106900: 89 d8 mov %ebx,%eax -80106902: 5b pop %ebx -80106903: 5d pop %ebp -80106904: c3 ret +80106645: 89 d8 mov %ebx,%eax +80106647: 8b 5d fc mov -0x4(%ebp),%ebx +8010664a: c9 leave +8010664b: c3 ret -80106905 : +8010664c : bool checkEmpty(int startOffset,int endOffset,int slabIdx) { -80106905: f3 0f 1e fb endbr32 -80106909: 55 push %ebp -8010690a: 89 e5 mov %esp,%ebp -8010690c: 57 push %edi -8010690d: 56 push %esi -8010690e: 53 push %ebx -8010690f: 83 ec 0c sub $0xc,%esp -80106912: 8b 55 08 mov 0x8(%ebp),%edx -80106915: 8b 45 0c mov 0xc(%ebp),%eax +8010664c: 55 push %ebp +8010664d: 89 e5 mov %esp,%ebp +8010664f: 57 push %edi +80106650: 56 push %esi +80106651: 53 push %ebx +80106652: 83 ec 08 sub $0x8,%esp +80106655: 8b 4d 08 mov 0x8(%ebp),%ecx +80106658: 8b 45 0c mov 0xc(%ebp),%eax return offset/8; -80106918: 8d 4a 07 lea 0x7(%edx),%ecx -8010691b: 85 d2 test %edx,%edx -8010691d: 0f 49 ca cmovns %edx,%ecx -80106920: c1 f9 03 sar $0x3,%ecx -80106923: 89 4d ec mov %ecx,-0x14(%ebp) -80106926: 89 cb mov %ecx,%ebx +8010665b: 8d 51 07 lea 0x7(%ecx),%edx +8010665e: 85 c9 test %ecx,%ecx +80106660: 0f 49 d1 cmovns %ecx,%edx +80106663: 89 d7 mov %edx,%edi +80106665: c1 ff 03 sar $0x3,%edi return offset%8; -80106928: 89 d6 mov %edx,%esi -8010692a: c1 fe 1f sar $0x1f,%esi -8010692d: c1 ee 1d shr $0x1d,%esi -80106930: 8d 0c 32 lea (%edx,%esi,1),%ecx -80106933: 83 e1 07 and $0x7,%ecx -80106936: 29 f1 sub %esi,%ecx +80106668: 89 ca mov %ecx,%edx +8010666a: c1 fa 1f sar $0x1f,%edx +8010666d: c1 ea 1d shr $0x1d,%edx +80106670: 8d 34 11 lea (%ecx,%edx,1),%esi +80106673: 83 e6 07 and $0x7,%esi +80106676: 29 d6 sub %edx,%esi return offset/8; -80106938: 8d 50 07 lea 0x7(%eax),%edx -8010693b: 85 c0 test %eax,%eax -8010693d: 0f 49 d0 cmovns %eax,%edx -80106940: c1 fa 03 sar $0x3,%edx -80106943: 89 55 e8 mov %edx,-0x18(%ebp) -80106946: 89 55 f0 mov %edx,-0x10(%ebp) +80106678: 8d 50 07 lea 0x7(%eax),%edx +8010667b: 85 c0 test %eax,%eax +8010667d: 0f 49 d0 cmovns %eax,%edx +80106680: c1 fa 03 sar $0x3,%edx +80106683: 89 55 f0 mov %edx,-0x10(%ebp) return offset%8; -80106949: 89 c2 mov %eax,%edx -8010694b: c1 fa 1f sar $0x1f,%edx -8010694e: 89 d7 mov %edx,%edi -80106950: c1 ef 1d shr $0x1d,%edi -80106953: 8d 14 38 lea (%eax,%edi,1),%edx -80106956: 83 e2 07 and $0x7,%edx -80106959: 29 fa sub %edi,%edx +80106686: 99 cltd +80106687: c1 ea 1d shr $0x1d,%edx +8010668a: 89 55 ec mov %edx,-0x14(%ebp) +8010668d: 01 c2 add %eax,%edx +8010668f: 83 e2 07 and $0x7,%edx +80106692: 2b 55 ec sub -0x14(%ebp),%edx int startColumn=getColumn(startOffset); int endRow=getRow(endOffset); int endColumn=getColumn(endOffset); // cprintf("startOffset: %d, endOffset %d\n",startOffset,endOffset); // cprintf("startRow:%d endRow:%d\n",startRow,endRow); for(int i=startRow;i<=endRow;i++) -8010695b: 8b 7d e8 mov -0x18(%ebp),%edi -8010695e: 39 df cmp %ebx,%edi -80106960: 7c 55 jl 801069b7 -80106962: 89 ce mov %ecx,%esi -80106964: b8 01 00 00 00 mov $0x1,%eax -80106969: d3 e0 shl %cl,%eax -8010696b: 89 45 ec mov %eax,-0x14(%ebp) +80106695: 39 7d f0 cmp %edi,-0x10(%ebp) +80106698: 7c 58 jl 801066f2 +8010669a: 89 fb mov %edi,%ebx +8010669c: 83 e1 07 and $0x7,%ecx +8010669f: b8 01 00 00 00 mov $0x1,%eax +801066a4: d3 e0 shl %cl,%eax +801066a6: 89 45 ec mov %eax,-0x14(%ebp) { for(int j=startColumn;j<=endColumn;j++) { if(get_bit(s->bitmap[i],j)) -8010696e: 69 7d 10 a8 01 00 00 imul $0x1a8,0x10(%ebp),%edi -80106975: 81 c7 20 6a 11 80 add $0x80116a20,%edi -8010697b: eb 08 jmp 80106985 +801066a9: 69 7d 10 a8 01 00 00 imul $0x1a8,0x10(%ebp),%edi +801066b0: 81 c7 20 3e 11 80 add $0x80113e20,%edi +801066b6: eb 08 jmp 801066c0 for(int i=startRow;i<=endRow;i++) -8010697d: 83 c3 01 add $0x1,%ebx -80106980: 3b 5d f0 cmp -0x10(%ebp),%ebx -80106983: 7f 39 jg 801069be +801066b8: 83 c3 01 add $0x1,%ebx +801066bb: 3b 5d f0 cmp -0x10(%ebp),%ebx +801066be: 7f 39 jg 801066f9 for(int j=startColumn;j<=endColumn;j++) -80106985: 39 f2 cmp %esi,%edx -80106987: 7c f4 jl 8010697d +801066c0: 39 f2 cmp %esi,%edx +801066c2: 7c f4 jl 801066b8 if(get_bit(s->bitmap[i],j)) -80106989: 8b 47 48 mov 0x48(%edi),%eax -8010698c: 0f be 0c 18 movsbl (%eax,%ebx,1),%ecx -80106990: 85 4d ec test %ecx,-0x14(%ebp) -80106993: 75 1b jne 801069b0 +801066c4: 8b 47 48 mov 0x48(%edi),%eax +801066c7: 0f be 0c 18 movsbl (%eax,%ebx,1),%ecx +801066cb: 85 4d ec test %ecx,-0x14(%ebp) +801066ce: 75 1b jne 801066eb for(int j=startColumn;j<=endColumn;j++) -80106995: 89 f0 mov %esi,%eax -80106997: 83 c0 01 add $0x1,%eax -8010699a: 39 d0 cmp %edx,%eax -8010699c: 7f df jg 8010697d +801066d0: 89 f0 mov %esi,%eax +801066d2: 83 c0 01 add $0x1,%eax +801066d5: 39 d0 cmp %edx,%eax +801066d7: 7f df jg 801066b8 if(get_bit(s->bitmap[i],j)) -8010699e: 0f a3 c1 bt %eax,%ecx -801069a1: 73 f4 jae 80106997 -801069a3: b8 00 00 00 00 mov $0x0,%eax +801066d9: 0f a3 c1 bt %eax,%ecx +801066dc: 73 f4 jae 801066d2 +801066de: b8 00 00 00 00 mov $0x0,%eax } if(empty==false) break; } return empty; } -801069a8: 83 c4 0c add $0xc,%esp -801069ab: 5b pop %ebx -801069ac: 5e pop %esi -801069ad: 5f pop %edi -801069ae: 5d pop %ebp -801069af: c3 ret +801066e3: 83 c4 08 add $0x8,%esp +801066e6: 5b pop %ebx +801066e7: 5e pop %esi +801066e8: 5f pop %edi +801066e9: 5d pop %ebp +801066ea: c3 ret if(get_bit(s->bitmap[i],j)) -801069b0: b8 00 00 00 00 mov $0x0,%eax -801069b5: eb f1 jmp 801069a8 +801066eb: b8 00 00 00 00 mov $0x0,%eax +801066f0: eb f1 jmp 801066e3 bool empty=true; -801069b7: b8 01 00 00 00 mov $0x1,%eax -801069bc: eb ea jmp 801069a8 -801069be: b8 01 00 00 00 mov $0x1,%eax +801066f2: b8 01 00 00 00 mov $0x1,%eax +801066f7: eb ea jmp 801066e3 +801066f9: b8 01 00 00 00 mov $0x1,%eax return empty; -801069c3: eb e3 jmp 801069a8 +801066fe: eb e3 jmp 801066e3 -801069c5 : +80106700 : int checkNewpage(int slabIdx) { -801069c5: f3 0f 1e fb endbr32 -801069c9: 55 push %ebp -801069ca: 89 e5 mov %esp,%ebp -801069cc: 57 push %edi -801069cd: 56 push %esi -801069ce: 53 push %ebx -801069cf: 8b 7d 08 mov 0x8(%ebp),%edi +80106700: 55 push %ebp +80106701: 89 e5 mov %esp,%ebp +80106703: 57 push %edi +80106704: 56 push %esi +80106705: 53 push %ebx +80106706: 8b 7d 08 mov 0x8(%ebp),%edi bool find0=false; for(int i=0;ibitmap[i],j)) -801069d2: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax -801069d8: 8b 88 68 6a 11 80 mov -0x7fee9598(%eax),%ecx -801069de: 8d b1 00 10 00 00 lea 0x1000(%ecx),%esi +80106709: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax +8010670f: 8b 88 68 3e 11 80 mov -0x7feec198(%eax),%ecx +80106715: 8d b1 00 10 00 00 lea 0x1000(%ecx),%esi int cnt=0; -801069e4: bb 00 00 00 00 mov $0x0,%ebx -801069e9: eb 07 jmp 801069f2 +8010671b: bb 00 00 00 00 mov $0x0,%ebx +80106720: eb 07 jmp 80106729 for(int i=0;i +80106722: 83 c1 01 add $0x1,%ecx +80106725: 39 f1 cmp %esi,%ecx +80106727: 74 24 je 8010674d if(get_bit(s->bitmap[i],j)) -801069f2: 0f b6 01 movzbl (%ecx),%eax -801069f5: 0f be d0 movsbl %al,%edx -801069f8: a8 01 test $0x1,%al -801069fa: 74 1a je 80106a16 +80106729: 0f b6 01 movzbl (%ecx),%eax +8010672c: 0f be d0 movsbl %al,%edx +8010672f: a8 01 test $0x1,%al +80106731: 74 1a je 8010674d cnt++; -801069fc: 83 c3 01 add $0x1,%ebx +80106733: 83 c3 01 add $0x1,%ebx for(int j=0;j<=7;j++) -801069ff: b8 01 00 00 00 mov $0x1,%eax +80106736: b8 01 00 00 00 mov $0x1,%eax if(get_bit(s->bitmap[i],j)) -80106a04: 0f a3 c2 bt %eax,%edx -80106a07: 73 0d jae 80106a16 +8010673b: 0f a3 c2 bt %eax,%edx +8010673e: 73 0d jae 8010674d cnt++; -80106a09: 83 c3 01 add $0x1,%ebx +80106740: 83 c3 01 add $0x1,%ebx for(int j=0;j<=7;j++) -80106a0c: 83 c0 01 add $0x1,%eax -80106a0f: 83 f8 08 cmp $0x8,%eax -80106a12: 75 f0 jne 80106a04 -80106a14: eb d5 jmp 801069eb +80106743: 83 c0 01 add $0x1,%eax +80106746: 83 f8 08 cmp $0x8,%eax +80106749: 75 f0 jne 8010673b +8010674b: eb d5 jmp 80106722 } } if(find0) break; } if(cnt%s->num_objects_per_page==0) -80106a16: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax -80106a1c: 8b 88 64 6a 11 80 mov -0x7fee959c(%eax),%ecx -80106a22: 89 d8 mov %ebx,%eax -80106a24: 99 cltd -80106a25: f7 f9 idiv %ecx -80106a27: 89 d6 mov %edx,%esi -80106a29: 85 d2 test %edx,%edx -80106a2b: 75 28 jne 80106a55 +8010674d: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax +80106753: 8b 88 64 3e 11 80 mov -0x7feec19c(%eax),%ecx +80106759: 89 d8 mov %ebx,%eax +8010675b: 99 cltd +8010675c: f7 f9 idiv %ecx +8010675e: 89 d6 mov %edx,%esi +80106760: 85 d2 test %edx,%edx +80106762: 75 28 jne 8010678c { int startOffset=(cnt/s->num_objects_per_page)*s->num_objects_per_page; -80106a2d: 89 d8 mov %ebx,%eax -80106a2f: 99 cltd -80106a30: f7 f9 idiv %ecx -80106a32: 89 c3 mov %eax,%ebx -80106a34: 0f af d9 imul %ecx,%ebx +80106764: 89 d8 mov %ebx,%eax +80106766: 99 cltd +80106767: f7 f9 idiv %ecx +80106769: 89 c3 mov %eax,%ebx +8010676b: 0f af d9 imul %ecx,%ebx int endOffset=(startOffset+s->num_objects_per_page)-1; if(checkEmpty(startOffset,endOffset,slabIdx)) -80106a37: 57 push %edi +8010676e: 57 push %edi int endOffset=(startOffset+s->num_objects_per_page)-1; -80106a38: 8d 44 19 ff lea -0x1(%ecx,%ebx,1),%eax +8010676f: 8d 44 19 ff lea -0x1(%ecx,%ebx,1),%eax if(checkEmpty(startOffset,endOffset,slabIdx)) -80106a3c: 50 push %eax -80106a3d: 53 push %ebx -80106a3e: e8 c2 fe ff ff call 80106905 -80106a43: 83 c4 0c add $0xc,%esp +80106773: 50 push %eax +80106774: 53 push %ebx +80106775: e8 d2 fe ff ff call 8010664c +8010677a: 83 c4 0c add $0xc,%esp { return startOffset; -80106a46: 84 c0 test %al,%al -80106a48: 0f 45 f3 cmovne %ebx,%esi +8010677d: 84 c0 test %al,%al +8010677f: 0f 45 f3 cmovne %ebx,%esi } } return 0; } -80106a4b: 89 f0 mov %esi,%eax -80106a4d: 8d 65 f4 lea -0xc(%ebp),%esp -80106a50: 5b pop %ebx -80106a51: 5e pop %esi -80106a52: 5f pop %edi -80106a53: 5d pop %ebp -80106a54: c3 ret +80106782: 89 f0 mov %esi,%eax +80106784: 8d 65 f4 lea -0xc(%ebp),%esp +80106787: 5b pop %ebx +80106788: 5e pop %esi +80106789: 5f pop %edi +8010678a: 5d pop %ebp +8010678b: c3 ret return 0; -80106a55: be 00 00 00 00 mov $0x0,%esi -80106a5a: eb ef jmp 80106a4b +8010678c: be 00 00 00 00 mov $0x0,%esi +80106791: eb ef jmp 80106782 -80106a5c : +80106793 : int getpageNum(int slabIdx) { -80106a5c: f3 0f 1e fb endbr32 -80106a60: 55 push %ebp -80106a61: 89 e5 mov %esp,%ebp -80106a63: 57 push %edi -80106a64: 56 push %esi -80106a65: 53 push %ebx -80106a66: 83 ec 04 sub $0x4,%esp -80106a69: 8b 4d 08 mov 0x8(%ebp),%ecx +80106793: 55 push %ebp +80106794: 89 e5 mov %esp,%ebp +80106796: 57 push %edi +80106797: 56 push %esi +80106798: 53 push %ebx +80106799: 83 ec 04 sub $0x4,%esp +8010679c: 8b 4d 08 mov 0x8(%ebp),%ecx struct slab *s; s=&stable.slab[slabIdx]; int page=0; //size 2048 - 1024 if(slabIdx>=7) -80106a6c: 83 f9 06 cmp $0x6,%ecx -80106a6f: 7f 2e jg 80106a9f +8010679f: 83 f9 06 cmp $0x6,%ecx +801067a2: 7f 2d jg 801067d1 //size 8 - 512 else { for(int i=0;isize)) { for(int j=i;jsize);j++) -80106a71: 69 f9 a8 01 00 00 imul $0x1a8,%ecx,%edi -80106a77: b8 00 02 00 00 mov $0x200,%eax -80106a7c: 99 cltd -80106a7d: f7 bf 54 6a 11 80 idivl -0x7fee95ac(%edi) -80106a83: 89 c7 mov %eax,%edi -80106a85: bb 00 00 00 00 mov $0x0,%ebx +801067a4: 69 f9 a8 01 00 00 imul $0x1a8,%ecx,%edi +801067aa: b8 00 02 00 00 mov $0x200,%eax +801067af: 99 cltd +801067b0: f7 bf 54 3e 11 80 idivl -0x7feec1ac(%edi) +801067b6: 89 45 f0 mov %eax,-0x10(%ebp) +801067b9: ba 00 00 00 00 mov $0x0,%edx int page=0; -80106a8a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) +801067be: bf 00 00 00 00 mov $0x0,%edi { if(s->bitmap[j]!=0x00) -80106a91: 69 c9 a8 01 00 00 imul $0x1a8,%ecx,%ecx -80106a97: 81 c1 20 6a 11 80 add $0x80116a20,%ecx -80106a9d: eb 71 jmp 80106b10 +801067c3: 69 c9 a8 01 00 00 imul $0x1a8,%ecx,%ecx +801067c9: 81 c1 20 3e 11 80 add $0x80113e20,%ecx +801067cf: eb 75 jmp 80106846 for(int k=j;ksize);k++) -80106a9f: 69 f9 a8 01 00 00 imul $0x1a8,%ecx,%edi -80106aa5: b8 00 10 00 00 mov $0x1000,%eax -80106aaa: 99 cltd -80106aab: f7 bf 54 6a 11 80 idivl -0x7fee95ac(%edi) -80106ab1: 89 c6 mov %eax,%esi +801067d1: 69 f9 a8 01 00 00 imul $0x1a8,%ecx,%edi +801067d7: b8 00 10 00 00 mov $0x1000,%eax +801067dc: 99 cltd +801067dd: f7 bf 54 3e 11 80 idivl -0x7feec1ac(%edi) +801067e3: 89 45 f0 mov %eax,-0x10(%ebp) for(int i=0;ibitmap[i],k)) -80106abf: 8d bf 20 6a 11 80 lea -0x7fee95e0(%edi),%edi -80106ac5: eb 36 jmp 80106afd +801067f0: 69 c9 a8 01 00 00 imul $0x1a8,%ecx,%ecx +801067f6: 8d b1 20 3e 11 80 lea -0x7feec1e0(%ecx),%esi +801067fc: eb 36 jmp 80106834 page++; -80106ac7: 83 45 f0 01 addl $0x1,-0x10(%ebp) +801067fe: 83 c7 01 add $0x1,%edi for(int j=0;j<=7;j+=(PGSIZE/s->size)) -80106acb: 83 fa 07 cmp $0x7,%edx -80106ace: 7f 22 jg 80106af2 +80106801: 83 fa 07 cmp $0x7,%edx +80106804: 7f 23 jg 80106829 for(int k=j;ksize);k++) -80106ad0: 89 d0 mov %edx,%eax -80106ad2: 01 f2 add %esi,%edx -80106ad4: 39 c2 cmp %eax,%edx -80106ad6: 7e f3 jle 80106acb +80106806: 89 d0 mov %edx,%eax +80106808: 03 55 f0 add -0x10(%ebp),%edx +8010680b: 39 c2 cmp %eax,%edx +8010680d: 7e f2 jle 80106801 if(get_bit(s->bitmap[i],k)) -80106ad8: 8b 4f 48 mov 0x48(%edi),%ecx -80106adb: 0f be 0c 19 movsbl (%ecx,%ebx,1),%ecx -80106adf: 0f a3 c1 bt %eax,%ecx -80106ae2: 72 e3 jb 80106ac7 +8010680f: 8b 4e 48 mov 0x48(%esi),%ecx +80106812: 0f be 0c 19 movsbl (%ecx,%ebx,1),%ecx +80106816: 0f a3 c1 bt %eax,%ecx +80106819: 72 e3 jb 801067fe for(int k=j;ksize);k++) -80106ae4: 83 c0 01 add $0x1,%eax -80106ae7: 39 d0 cmp %edx,%eax -80106ae9: 74 e0 je 80106acb +8010681b: 83 c0 01 add $0x1,%eax +8010681e: 39 d0 cmp %edx,%eax +80106820: 74 df je 80106801 if(get_bit(s->bitmap[i],k)) -80106aeb: 0f a3 c1 bt %eax,%ecx -80106aee: 73 f4 jae 80106ae4 -80106af0: eb d5 jmp 80106ac7 +80106822: 0f a3 c1 bt %eax,%ecx +80106825: 73 f4 jae 8010681b +80106827: eb d5 jmp 801067fe for(int i=0;i +80106829: 83 c3 01 add $0x1,%ebx +8010682c: 81 fb 00 10 00 00 cmp $0x1000,%ebx +80106832: 74 35 je 80106869 for(int j=0;j<=7;j+=(PGSIZE/s->size)) -80106afd: ba 00 00 00 00 mov $0x0,%edx -80106b02: eb cc jmp 80106ad0 +80106834: ba 00 00 00 00 mov $0x0,%edx +80106839: eb cb jmp 80106806 { page++; -80106b04: 83 45 f0 01 addl $0x1,-0x10(%ebp) +8010683b: 83 c7 01 add $0x1,%edi for(int i=0;isize)) -80106b08: 81 fe ff 0f 00 00 cmp $0xfff,%esi -80106b0e: 7f 21 jg 80106b31 -80106b10: 89 da mov %ebx,%edx +8010683e: 81 fb ff 0f 00 00 cmp $0xfff,%ebx +80106844: 7f 23 jg 80106869 +80106846: 89 d6 mov %edx,%esi for(int j=i;jsize);j++) -80106b12: 89 d8 mov %ebx,%eax -80106b14: 01 fb add %edi,%ebx -80106b16: 89 de mov %ebx,%esi -80106b18: 39 d3 cmp %edx,%ebx -80106b1a: 7e ec jle 80106b08 +80106848: 89 d0 mov %edx,%eax +8010684a: 03 55 f0 add -0x10(%ebp),%edx +8010684d: 89 d3 mov %edx,%ebx +8010684f: 39 f2 cmp %esi,%edx +80106851: 7e eb jle 8010683e +80106853: 03 41 48 add 0x48(%ecx),%eax +80106856: 89 d6 mov %edx,%esi +80106858: 03 71 48 add 0x48(%ecx),%esi if(s->bitmap[j]!=0x00) -80106b1c: 8b 51 48 mov 0x48(%ecx),%edx -80106b1f: 01 d0 add %edx,%eax -80106b21: 01 da add %ebx,%edx -80106b23: 80 38 00 cmpb $0x0,(%eax) -80106b26: 75 dc jne 80106b04 +8010685b: 80 38 00 cmpb $0x0,(%eax) +8010685e: 75 db jne 8010683b for(int j=i;jsize);j++) -80106b28: 83 c0 01 add $0x1,%eax -80106b2b: 39 d0 cmp %edx,%eax -80106b2d: 75 f4 jne 80106b23 -80106b2f: eb d7 jmp 80106b08 +80106860: 83 c0 01 add $0x1,%eax +80106863: 39 f0 cmp %esi,%eax +80106865: 75 f4 jne 8010685b +80106867: eb d5 jmp 8010683e } } } } return page; } -80106b31: 8b 45 f0 mov -0x10(%ebp),%eax -80106b34: 83 c4 04 add $0x4,%esp -80106b37: 5b pop %ebx -80106b38: 5e pop %esi -80106b39: 5f pop %edi -80106b3a: 5d pop %ebp -80106b3b: c3 ret +80106869: 89 f8 mov %edi,%eax +8010686b: 83 c4 04 add $0x4,%esp +8010686e: 5b pop %ebx +8010686f: 5e pop %esi +80106870: 5f pop %edi +80106871: 5d pop %ebp +80106872: c3 ret -80106b3c : +80106873 : void slabinit() { -80106b3c: f3 0f 1e fb endbr32 -80106b40: 55 push %ebp -80106b41: 89 e5 mov %esp,%ebp -80106b43: 57 push %edi -80106b44: 56 push %esi -80106b45: 53 push %ebx -80106b46: 83 ec 18 sub $0x18,%esp +80106873: 55 push %ebp +80106874: 89 e5 mov %esp,%ebp +80106876: 57 push %edi +80106877: 56 push %esi +80106878: 53 push %ebx +80106879: 83 ec 18 sub $0x18,%esp acquire(&stable.lock); -80106b49: 68 20 6a 11 80 push $0x80116a20 -80106b4e: e8 46 d3 ff ff call 80103e99 +8010687c: 68 20 3e 11 80 push $0x80113e20 +80106881: e8 7b d4 ff ff call 80103d01 stable.slab[0].size=8; -80106b53: c7 05 54 6a 11 80 08 movl $0x8,0x80116a54 -80106b5a: 00 00 00 +80106886: c7 05 54 3e 11 80 08 movl $0x8,0x80113e54 +8010688d: 00 00 00 stable.slab[0].num_objects_per_page=PGSIZE/stable.slab[0].size; -80106b5d: c7 05 64 6a 11 80 00 movl $0x200,0x80116a64 -80106b64: 02 00 00 +80106890: c7 05 64 3e 11 80 00 movl $0x200,0x80113e64 +80106897: 02 00 00 stable.slab[0].num_used_objects=0; -80106b67: c7 05 60 6a 11 80 00 movl $0x0,0x80116a60 -80106b6e: 00 00 00 +8010689a: c7 05 60 3e 11 80 00 movl $0x0,0x80113e60 +801068a1: 00 00 00 stable.slab[0].num_free_objects=stable.slab[0].num_objects_per_page*64; -80106b71: c7 05 5c 6a 11 80 00 movl $0x8000,0x80116a5c -80106b78: 80 00 00 +801068a4: c7 05 5c 3e 11 80 00 movl $0x8000,0x80113e5c +801068ab: 80 00 00 //allocate one page for bitmap, allocate one page for slab cache stable.slab[0].bitmap=stable.slab[0].page[0]; -80106b7b: a1 6c 6a 11 80 mov 0x80116a6c,%eax -80106b80: a3 68 6a 11 80 mov %eax,0x80116a68 +801068ae: a1 6c 3e 11 80 mov 0x80113e6c,%eax +801068b3: a3 68 3e 11 80 mov %eax,0x80113e68 stable.slab[0].bitmap=kalloc(); -80106b85: e8 8f b6 ff ff call 80102219 -80106b8a: a3 68 6a 11 80 mov %eax,0x80116a68 +801068b8: e8 8d b8 ff ff call 8010214a +801068bd: a3 68 3e 11 80 mov %eax,0x80113e68 memset(stable.slab[0].bitmap,0,PGSIZE); -80106b8f: 83 c4 0c add $0xc,%esp -80106b92: 68 00 10 00 00 push $0x1000 -80106b97: 6a 00 push $0x0 -80106b99: 50 push %eax -80106b9a: e8 b0 d3 ff ff call 80103f4f +801068c2: 83 c4 0c add $0xc,%esp +801068c5: 68 00 10 00 00 push $0x1000 +801068ca: 6a 00 push $0x0 +801068cc: 50 push %eax +801068cd: e8 dd d4 ff ff call 80103daf stable.slab[0].page[1]=kalloc(); -80106b9f: e8 75 b6 ff ff call 80102219 -80106ba4: a3 70 6a 11 80 mov %eax,0x80116a70 +801068d2: e8 73 b8 ff ff call 8010214a +801068d7: a3 70 3e 11 80 mov %eax,0x80113e70 stable.slab[0].num_pages=1; -80106ba9: c7 05 58 6a 11 80 01 movl $0x1,0x80116a58 -80106bb0: 00 00 00 +801068dc: c7 05 58 3e 11 80 01 movl $0x1,0x80113e58 +801068e3: 00 00 00 release(&stable.lock); -80106bb3: c7 04 24 20 6a 11 80 movl $0x80116a20,(%esp) -80106bba: e8 45 d3 ff ff call 80103f04 +801068e6: c7 04 24 20 3e 11 80 movl $0x80113e20,(%esp) +801068ed: e8 76 d4 ff ff call 80103d68 acquire(&stable.lock); -80106bbf: c7 04 24 20 6a 11 80 movl $0x80116a20,(%esp) -80106bc6: e8 ce d2 ff ff call 80103e99 +801068f2: c7 04 24 20 3e 11 80 movl $0x80113e20,(%esp) +801068f9: e8 03 d4 ff ff call 80103d01 for(int i=1;i -80106c17: 89 83 bc 01 00 00 mov %eax,0x1bc(%ebx) +80106945: e8 00 b8 ff ff call 8010214a +8010694a: 89 83 bc 01 00 00 mov %eax,0x1bc(%ebx) memset(stable.slab[i].bitmap,0,PGSIZE); -80106c1d: 83 ec 04 sub $0x4,%esp -80106c20: 68 00 10 00 00 push $0x1000 -80106c25: 6a 00 push $0x0 -80106c27: 50 push %eax -80106c28: e8 22 d3 ff ff call 80103f4f +80106950: 83 ec 04 sub $0x4,%esp +80106953: 68 00 10 00 00 push $0x1000 +80106958: 6a 00 push $0x0 +8010695a: 50 push %eax +8010695b: e8 4f d4 ff ff call 80103daf stable.slab[i].page[1]=kalloc(); -80106c2d: e8 e7 b5 ff ff call 80102219 -80106c32: 89 83 c4 01 00 00 mov %eax,0x1c4(%ebx) +80106960: e8 e5 b7 ff ff call 8010214a +80106965: 89 83 c4 01 00 00 mov %eax,0x1c4(%ebx) stable.slab[i].num_pages=1; -80106c38: c7 83 ac 01 00 00 01 movl $0x1,0x1ac(%ebx) -80106c3f: 00 00 00 +8010696b: c7 83 ac 01 00 00 01 movl $0x1,0x1ac(%ebx) +80106972: 00 00 00 for(int i=1;i +80106975: 81 c3 a8 01 00 00 add $0x1a8,%ebx +8010697b: 83 c4 10 add $0x10,%esp +8010697e: 39 fb cmp %edi,%ebx +80106980: 75 8e jne 80106910 } release(&stable.lock); -80106c4f: 83 ec 0c sub $0xc,%esp -80106c52: 68 20 6a 11 80 push $0x80116a20 -80106c57: e8 a8 d2 ff ff call 80103f04 -} -80106c5c: 83 c4 10 add $0x10,%esp -80106c5f: 8d 65 f4 lea -0xc(%ebp),%esp -80106c62: 5b pop %ebx -80106c63: 5e pop %esi -80106c64: 5f pop %edi -80106c65: 5d pop %ebp -80106c66: c3 ret - -80106c67 : +80106982: 83 ec 0c sub $0xc,%esp +80106985: 68 20 3e 11 80 push $0x80113e20 +8010698a: e8 d9 d3 ff ff call 80103d68 +} +8010698f: 83 c4 10 add $0x10,%esp +80106992: 8d 65 f4 lea -0xc(%ebp),%esp +80106995: 5b pop %ebx +80106996: 5e pop %esi +80106997: 5f pop %edi +80106998: 5d pop %ebp +80106999: c3 ret + +8010699a : char *kmalloc(int size){ -80106c67: f3 0f 1e fb endbr32 -80106c6b: 55 push %ebp -80106c6c: 89 e5 mov %esp,%ebp -80106c6e: 57 push %edi -80106c6f: 56 push %esi -80106c70: 53 push %ebx -80106c71: 83 ec 0c sub $0xc,%esp -80106c74: 8b 7d 08 mov 0x8(%ebp),%edi +8010699a: 55 push %ebp +8010699b: 89 e5 mov %esp,%ebp +8010699d: 57 push %edi +8010699e: 56 push %esi +8010699f: 53 push %ebx +801069a0: 83 ec 0c sub $0xc,%esp +801069a3: 8b 7d 08 mov 0x8(%ebp),%edi //out of range error needs to be handled if(size > 2048 || size<=0) -80106c77: 8d 57 ff lea -0x1(%edi),%edx +801069a6: 8d 57 ff lea -0x1(%edi),%edx return 0; -80106c7a: b8 00 00 00 00 mov $0x0,%eax +801069a9: b8 00 00 00 00 mov $0x0,%eax if(size > 2048 || size<=0) -80106c7f: 81 fa ff 07 00 00 cmp $0x7ff,%edx -80106c85: 0f 87 dc 00 00 00 ja 80106d67 +801069ae: 81 fa ff 07 00 00 cmp $0x7ff,%edx +801069b4: 0f 87 dc 00 00 00 ja 80106a96 //choose the byte 8 or 16 .. etc by getting index of slab int slabIdx=getslabIdx(nextPowerOf2(size)); -80106c8b: 83 ec 0c sub $0xc,%esp -80106c8e: 57 push %edi -80106c8f: e8 2f fb ff ff call 801067c3 -80106c94: 89 04 24 mov %eax,(%esp) -80106c97: e8 5e fb ff ff call 801067fa -80106c9c: 83 c4 10 add $0x10,%esp -80106c9f: 89 c6 mov %eax,%esi +801069ba: 83 ec 0c sub $0xc,%esp +801069bd: 57 push %edi +801069be: e8 6e fb ff ff call 80106531 +801069c3: 89 04 24 mov %eax,(%esp) +801069c6: e8 99 fb ff ff call 80106564 +801069cb: 83 c4 10 add $0x10,%esp +801069ce: 89 c3 mov %eax,%ebx struct slab *s; s=&stable.slab[slabIdx]; //can't alloc if num of used object is full if(s->num_used_objects==s->num_objects_per_page*MAX_PAGES_PER_SLAB) -80106ca1: 69 c0 a8 01 00 00 imul $0x1a8,%eax,%eax -80106ca7: 6b 90 64 6a 11 80 64 imul $0x64,-0x7fee959c(%eax),%edx -80106cae: 39 90 60 6a 11 80 cmp %edx,-0x7fee95a0(%eax) -80106cb4: 0f 84 db 00 00 00 je 80106d95 +801069d0: 69 c0 a8 01 00 00 imul $0x1a8,%eax,%eax +801069d6: 6b 90 64 3e 11 80 64 imul $0x64,-0x7feec19c(%eax),%edx +801069dd: 39 90 60 3e 11 80 cmp %edx,-0x7feec1a0(%eax) +801069e3: 0f 84 db 00 00 00 je 80106ac4 return 0; if(stable.slab[0].num_used_objects==stable.slab[0].num_objects_per_page*64) -80106cba: a1 64 6a 11 80 mov 0x80116a64,%eax -80106cbf: c1 e0 06 shl $0x6,%eax -80106cc2: 39 05 60 6a 11 80 cmp %eax,0x80116a60 -80106cc8: 0f 84 ce 00 00 00 je 80106d9c +801069e9: a1 64 3e 11 80 mov 0x80113e64,%eax +801069ee: c1 e0 06 shl $0x6,%eax +801069f1: 39 05 60 3e 11 80 cmp %eax,0x80113e60 +801069f7: 0f 84 ce 00 00 00 je 80106acb return 0; int startOffset=0; acquire(&stable.lock); -80106cce: 83 ec 0c sub $0xc,%esp -80106cd1: 68 20 6a 11 80 push $0x80116a20 -80106cd6: e8 be d1 ff ff call 80103e99 +801069fd: 83 ec 0c sub $0xc,%esp +80106a00: 68 20 3e 11 80 push $0x80113e20 +80106a05: e8 f7 d2 ff ff call 80103d01 if((startOffset=checkNewpage(slabIdx)) && s->num_used_objects!=0) -80106cdb: 89 34 24 mov %esi,(%esp) -80106cde: e8 e2 fc ff ff call 801069c5 -80106ce3: 83 c4 10 add $0x10,%esp -80106ce6: 85 c0 test %eax,%eax -80106ce8: 74 0f je 80106cf9 -80106cea: 69 d6 a8 01 00 00 imul $0x1a8,%esi,%edx -80106cf0: 83 ba 60 6a 11 80 00 cmpl $0x0,-0x7fee95a0(%edx) -80106cf7: 75 76 jne 80106d6f +80106a0a: 89 1c 24 mov %ebx,(%esp) +80106a0d: e8 ee fc ff ff call 80106700 +80106a12: 83 c4 10 add $0x10,%esp +80106a15: 85 c0 test %eax,%eax +80106a17: 74 0f je 80106a28 +80106a19: 69 d3 a8 01 00 00 imul $0x1a8,%ebx,%edx +80106a1f: 83 ba 60 3e 11 80 00 cmpl $0x0,-0x7feec1a0(%edx) +80106a26: 75 76 jne 80106a9e { s->page[startOffset/s->num_objects_per_page+1]=kalloc(); //current page +1 } int bitOffset=setBitmap(slabIdx); -80106cf9: 83 ec 0c sub $0xc,%esp -80106cfc: 56 push %esi -80106cfd: e8 24 fb ff ff call 80106826 -80106d02: 89 c3 mov %eax,%ebx +80106a28: 83 ec 0c sub $0xc,%esp +80106a2b: 53 push %ebx +80106a2c: e8 57 fb ff ff call 80106588 +80106a31: 89 c6 mov %eax,%esi //getPageNumfrom bitmap s->num_pages=getpageNum(slabIdx); -80106d04: 89 34 24 mov %esi,(%esp) -80106d07: e8 50 fd ff ff call 80106a5c -80106d0c: 83 c4 0c add $0xc,%esp -80106d0f: 69 d6 a8 01 00 00 imul $0x1a8,%esi,%edx -80106d15: 8d 8a 20 6a 11 80 lea -0x7fee95e0(%edx),%ecx -80106d1b: 89 82 58 6a 11 80 mov %eax,-0x7fee95a8(%edx) +80106a33: 89 1c 24 mov %ebx,(%esp) +80106a36: e8 58 fd ff ff call 80106793 +80106a3b: 83 c4 0c add $0xc,%esp +80106a3e: 69 d3 a8 01 00 00 imul $0x1a8,%ebx,%edx +80106a44: 8d 8a 20 3e 11 80 lea -0x7feec1e0(%edx),%ecx +80106a4a: 89 82 58 3e 11 80 mov %eax,-0x7feec1a8(%edx) s->num_free_objects-=1; -80106d21: 83 69 3c 01 subl $0x1,0x3c(%ecx) +80106a50: 83 69 3c 01 subl $0x1,0x3c(%ecx) s->num_used_objects+=1; -80106d25: 83 41 40 01 addl $0x1,0x40(%ecx) +80106a54: 83 41 40 01 addl $0x1,0x40(%ecx) int nowpage=bitOffset/s->num_objects_per_page+1; -80106d29: 89 d8 mov %ebx,%eax -80106d2b: 99 cltd -80106d2c: f7 79 44 idivl 0x44(%ecx) -80106d2f: 89 d3 mov %edx,%ebx +80106a58: 89 f0 mov %esi,%eax +80106a5a: 99 cltd +80106a5b: f7 79 44 idivl 0x44(%ecx) int pageOffset=(bitOffset%s->num_objects_per_page)*(1<<(slabIdx+3))*sizeof(char); -80106d31: 8d 4e 03 lea 0x3(%esi),%ecx -80106d34: d3 e3 shl %cl,%ebx +80106a5e: 8d 4b 03 lea 0x3(%ebx),%ecx +80106a61: 89 d6 mov %edx,%esi +80106a63: d3 e6 shl %cl,%esi memset(s->page[nowpage]+pageOffset,0,size*sizeof(char)); -80106d36: 57 push %edi -80106d37: 6a 00 push $0x0 -80106d39: 6b f6 6a imul $0x6a,%esi,%esi -80106d3c: 8d 74 30 11 lea 0x11(%eax,%esi,1),%esi -80106d40: 89 d8 mov %ebx,%eax -80106d42: 03 04 b5 2c 6a 11 80 add -0x7fee95d4(,%esi,4),%eax -80106d49: 50 push %eax -80106d4a: e8 00 d2 ff ff call 80103f4f +80106a65: 57 push %edi +80106a66: 6a 00 push $0x0 +80106a68: 6b db 6a imul $0x6a,%ebx,%ebx +80106a6b: 8d 5c 18 11 lea 0x11(%eax,%ebx,1),%ebx +80106a6f: 89 f0 mov %esi,%eax +80106a71: 03 04 9d 2c 3e 11 80 add -0x7feec1d4(,%ebx,4),%eax +80106a78: 50 push %eax +80106a79: e8 31 d3 ff ff call 80103daf release(&stable.lock); -80106d4f: c7 04 24 20 6a 11 80 movl $0x80116a20,(%esp) -80106d56: e8 a9 d1 ff ff call 80103f04 +80106a7e: c7 04 24 20 3e 11 80 movl $0x80113e20,(%esp) +80106a85: e8 de d2 ff ff call 80103d68 return s->page[nowpage]+pageOffset; -80106d5b: 89 d8 mov %ebx,%eax -80106d5d: 03 04 b5 2c 6a 11 80 add -0x7fee95d4(,%esi,4),%eax -80106d64: 83 c4 10 add $0x10,%esp -} -80106d67: 8d 65 f4 lea -0xc(%ebp),%esp -80106d6a: 5b pop %ebx -80106d6b: 5e pop %esi -80106d6c: 5f pop %edi -80106d6d: 5d pop %ebp -80106d6e: c3 ret +80106a8a: 89 f0 mov %esi,%eax +80106a8c: 03 04 9d 2c 3e 11 80 add -0x7feec1d4(,%ebx,4),%eax +80106a93: 83 c4 10 add $0x10,%esp +} +80106a96: 8d 65 f4 lea -0xc(%ebp),%esp +80106a99: 5b pop %ebx +80106a9a: 5e pop %esi +80106a9b: 5f pop %edi +80106a9c: 5d pop %ebp +80106a9d: c3 ret s->page[startOffset/s->num_objects_per_page+1]=kalloc(); //current page +1 -80106d6f: 89 d1 mov %edx,%ecx -80106d71: 99 cltd -80106d72: f7 b9 64 6a 11 80 idivl -0x7fee959c(%ecx) -80106d78: 8d 58 01 lea 0x1(%eax),%ebx -80106d7b: e8 99 b4 ff ff call 80102219 -80106d80: 89 c2 mov %eax,%edx -80106d82: 6b c6 6a imul $0x6a,%esi,%eax -80106d85: 8d 44 03 10 lea 0x10(%ebx,%eax,1),%eax -80106d89: 89 14 85 2c 6a 11 80 mov %edx,-0x7fee95d4(,%eax,4) -80106d90: e9 64 ff ff ff jmp 80106cf9 +80106a9e: 89 d1 mov %edx,%ecx +80106aa0: 99 cltd +80106aa1: f7 b9 64 3e 11 80 idivl -0x7feec19c(%ecx) +80106aa7: 8d 70 01 lea 0x1(%eax),%esi +80106aaa: e8 9b b6 ff ff call 8010214a +80106aaf: 89 c2 mov %eax,%edx +80106ab1: 6b c3 6a imul $0x6a,%ebx,%eax +80106ab4: 8d 44 06 10 lea 0x10(%esi,%eax,1),%eax +80106ab8: 89 14 85 2c 3e 11 80 mov %edx,-0x7feec1d4(,%eax,4) +80106abf: e9 64 ff ff ff jmp 80106a28 return 0; -80106d95: b8 00 00 00 00 mov $0x0,%eax -80106d9a: eb cb jmp 80106d67 +80106ac4: b8 00 00 00 00 mov $0x0,%eax +80106ac9: eb cb jmp 80106a96 return 0; -80106d9c: b8 00 00 00 00 mov $0x0,%eax -80106da1: eb c4 jmp 80106d67 +80106acb: b8 00 00 00 00 mov $0x0,%eax +80106ad0: eb c4 jmp 80106a96 -80106da3 : +80106ad2 : void kmfree(char *addr, int size){ -80106da3: f3 0f 1e fb endbr32 -80106da7: 55 push %ebp -80106da8: 89 e5 mov %esp,%ebp -80106daa: 57 push %edi -80106dab: 56 push %esi -80106dac: 53 push %ebx -80106dad: 83 ec 28 sub $0x28,%esp -80106db0: 8b 75 08 mov 0x8(%ebp),%esi -80106db3: 8b 5d 0c mov 0xc(%ebp),%ebx +80106ad2: 55 push %ebp +80106ad3: 89 e5 mov %esp,%ebp +80106ad5: 57 push %edi +80106ad6: 56 push %esi +80106ad7: 53 push %ebx +80106ad8: 83 ec 28 sub $0x28,%esp +80106adb: 8b 75 08 mov 0x8(%ebp),%esi +80106ade: 8b 5d 0c mov 0xc(%ebp),%ebx struct slab *s; int slabIdx=getslabIdx(size); -80106db6: 53 push %ebx -80106db7: e8 3e fa ff ff call 801067fa -80106dbc: 89 c7 mov %eax,%edi +80106ae1: 53 push %ebx +80106ae2: e8 7d fa ff ff call 80106564 +80106ae7: 89 c7 mov %eax,%edi s=&stable.slab[slabIdx]; acquire(&stable.lock); -80106dbe: c7 04 24 20 6a 11 80 movl $0x80116a20,(%esp) -80106dc5: e8 cf d0 ff ff call 80103e99 +80106ae9: c7 04 24 20 3e 11 80 movl $0x80113e20,(%esp) +80106af0: e8 0c d2 ff ff call 80103d01 if(s->num_used_objects==0) -80106dca: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax -80106dd0: 83 c4 10 add $0x10,%esp -80106dd3: 83 b8 60 6a 11 80 00 cmpl $0x0,-0x7fee95a0(%eax) -80106dda: 74 2f je 80106e0b +80106af5: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax +80106afb: 83 c4 10 add $0x10,%esp +80106afe: 83 b8 60 3e 11 80 00 cmpl $0x0,-0x7feec1a0(%eax) +80106b05: 74 2f je 80106b36 release(&stable.lock); return; } //set the garbage in slab; memset(addr,1,size); -80106ddc: 83 ec 04 sub $0x4,%esp -80106ddf: 53 push %ebx -80106de0: 6a 01 push $0x1 -80106de2: 56 push %esi -80106de3: e8 67 d1 ff ff call 80103f4f +80106b07: 83 ec 04 sub $0x4,%esp +80106b0a: 53 push %ebx +80106b0b: 6a 01 push $0x1 +80106b0d: 56 push %esi +80106b0e: e8 9c d2 ff ff call 80103daf //bitmap operation //get the adress page Number int pageNum=0; for(int i=1;i<=100;i++) -80106de8: 69 d7 a8 01 00 00 imul $0x1a8,%edi,%edx -80106dee: 83 c4 10 add $0x10,%esp -80106df1: bb 01 00 00 00 mov $0x1,%ebx +80106b13: 69 d7 a8 01 00 00 imul $0x1a8,%edi,%edx +80106b19: 83 c4 10 add $0x10,%esp +80106b1c: bb 01 00 00 00 mov $0x1,%ebx { if(addr-s->page[i]>=0 && addr-s->page[i] +80106b21: 89 f0 mov %esi,%eax +80106b23: 2b 84 9a 6c 3e 11 80 sub -0x7feec194(%edx,%ebx,4),%eax +80106b2a: 3d ff 0f 00 00 cmp $0xfff,%eax +80106b2f: 76 1a jbe 80106b4b for(int i=1;i<=100;i++) -80106e06: 83 c3 01 add $0x1,%ebx -80106e09: eb eb jmp 80106df6 +80106b31: 83 c3 01 add $0x1,%ebx +80106b34: eb eb jmp 80106b21 release(&stable.lock); -80106e0b: 83 ec 0c sub $0xc,%esp -80106e0e: 68 20 6a 11 80 push $0x80116a20 -80106e13: e8 ec d0 ff ff call 80103f04 +80106b36: 83 ec 0c sub $0xc,%esp +80106b39: 68 20 3e 11 80 push $0x80113e20 +80106b3e: e8 25 d2 ff ff call 80103d68 return; -80106e18: 83 c4 10 add $0x10,%esp -80106e1b: e9 93 00 00 00 jmp 80106eb3 +80106b43: 83 c4 10 add $0x10,%esp +80106b46: e9 91 00 00 00 jmp 80106bdc break; } } //get the offset to make 0 appropriate bitmap int offset=0; offset=((pageNum-1)*s->num_objects_per_page)+(addr-s->page[pageNum])/s->size; -80106e20: 8d 43 ff lea -0x1(%ebx),%eax -80106e23: 89 45 e4 mov %eax,-0x1c(%ebp) +80106b4b: 8d 43 ff lea -0x1(%ebx),%eax +80106b4e: 89 45 e4 mov %eax,-0x1c(%ebp) if(clearBitmap(slabIdx,offset)) -80106e26: 83 ec 08 sub $0x8,%esp +80106b51: 83 ec 08 sub $0x8,%esp offset=((pageNum-1)*s->num_objects_per_page)+(addr-s->page[pageNum])/s->size; -80106e29: 6b c7 6a imul $0x6a,%edi,%eax -80106e2c: 8d 44 03 10 lea 0x10(%ebx,%eax,1),%eax -80106e30: 89 f1 mov %esi,%ecx -80106e32: 2b 0c 85 2c 6a 11 80 sub -0x7fee95d4(,%eax,4),%ecx -80106e39: 89 c8 mov %ecx,%eax -80106e3b: 69 cf a8 01 00 00 imul $0x1a8,%edi,%ecx -80106e41: 99 cltd -80106e42: f7 b9 54 6a 11 80 idivl -0x7fee95ac(%ecx) -80106e48: 8b 75 e4 mov -0x1c(%ebp),%esi -80106e4b: 0f af b1 64 6a 11 80 imul -0x7fee959c(%ecx),%esi -80106e52: 01 f0 add %esi,%eax +80106b54: 6b c7 6a imul $0x6a,%edi,%eax +80106b57: 8d 44 03 10 lea 0x10(%ebx,%eax,1),%eax +80106b5b: 2b 34 85 2c 3e 11 80 sub -0x7feec1d4(,%eax,4),%esi +80106b62: 89 f0 mov %esi,%eax +80106b64: 69 cf a8 01 00 00 imul $0x1a8,%edi,%ecx +80106b6a: 99 cltd +80106b6b: f7 b9 54 3e 11 80 idivl -0x7feec1ac(%ecx) +80106b71: 8b 55 e4 mov -0x1c(%ebp),%edx +80106b74: 0f af 91 64 3e 11 80 imul -0x7feec19c(%ecx),%edx +80106b7b: 01 d0 add %edx,%eax if(clearBitmap(slabIdx,offset)) -80106e54: 50 push %eax -80106e55: 57 push %edi -80106e56: e8 5b fa ff ff call 801068b6 -80106e5b: 83 c4 10 add $0x10,%esp -80106e5e: 84 c0 test %al,%al -80106e60: 74 14 je 80106e76 +80106b7d: 50 push %eax +80106b7e: 57 push %edi +80106b7f: e8 88 fa ff ff call 8010660c +80106b84: 83 c4 10 add $0x10,%esp +80106b87: 84 c0 test %al,%al +80106b89: 74 14 je 80106b9f { stable.slab[slabIdx].num_free_objects+=1; -80106e62: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax -80106e68: 83 80 5c 6a 11 80 01 addl $0x1,-0x7fee95a4(%eax) +80106b8b: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax +80106b91: 83 80 5c 3e 11 80 01 addl $0x1,-0x7feec1a4(%eax) stable.slab[slabIdx].num_used_objects-=1; -80106e6f: 83 a8 60 6a 11 80 01 subl $0x1,-0x7fee95a0(%eax) +80106b98: 83 a8 60 3e 11 80 01 subl $0x1,-0x7feec1a0(%eax) } //page free int startOffset=(pageNum-1)*s->num_objects_per_page; int endOffset=(startOffset+s->num_objects_per_page)-1; if(pageNum!=1 && checkEmpty(startOffset,endOffset,slabIdx)) -80106e76: 83 fb 01 cmp $0x1,%ebx -80106e79: 74 28 je 80106ea3 +80106b9f: 83 fb 01 cmp $0x1,%ebx +80106ba2: 74 28 je 80106bcc int startOffset=(pageNum-1)*s->num_objects_per_page; -80106e7b: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax -80106e81: 8b 90 64 6a 11 80 mov -0x7fee959c(%eax),%edx -80106e87: 8b 45 e4 mov -0x1c(%ebp),%eax -80106e8a: 0f af c2 imul %edx,%eax +80106ba4: 69 c7 a8 01 00 00 imul $0x1a8,%edi,%eax +80106baa: 8b 90 64 3e 11 80 mov -0x7feec19c(%eax),%edx +80106bb0: 8b 45 e4 mov -0x1c(%ebp),%eax +80106bb3: 0f af c2 imul %edx,%eax if(pageNum!=1 && checkEmpty(startOffset,endOffset,slabIdx)) -80106e8d: 83 ec 04 sub $0x4,%esp -80106e90: 57 push %edi +80106bb6: 83 ec 04 sub $0x4,%esp +80106bb9: 57 push %edi int endOffset=(startOffset+s->num_objects_per_page)-1; -80106e91: 8d 54 02 ff lea -0x1(%edx,%eax,1),%edx +80106bba: 8d 54 02 ff lea -0x1(%edx,%eax,1),%edx if(pageNum!=1 && checkEmpty(startOffset,endOffset,slabIdx)) -80106e95: 52 push %edx -80106e96: 50 push %eax -80106e97: e8 69 fa ff ff call 80106905 -80106e9c: 83 c4 10 add $0x10,%esp -80106e9f: 84 c0 test %al,%al -80106ea1: 75 18 jne 80106ebb +80106bbe: 52 push %edx +80106bbf: 50 push %eax +80106bc0: e8 87 fa ff ff call 8010664c +80106bc5: 83 c4 10 add $0x10,%esp +80106bc8: 84 c0 test %al,%al +80106bca: 75 18 jne 80106be4 { kfree(s->page[pageNum]); s->num_pages-=1; } release(&stable.lock); -80106ea3: 83 ec 0c sub $0xc,%esp -80106ea6: 68 20 6a 11 80 push $0x80116a20 -80106eab: e8 54 d0 ff ff call 80103f04 -80106eb0: 83 c4 10 add $0x10,%esp +80106bcc: 83 ec 0c sub $0xc,%esp +80106bcf: 68 20 3e 11 80 push $0x80113e20 +80106bd4: e8 8f d1 ff ff call 80103d68 +80106bd9: 83 c4 10 add $0x10,%esp // return; } -80106eb3: 8d 65 f4 lea -0xc(%ebp),%esp -80106eb6: 5b pop %ebx -80106eb7: 5e pop %esi -80106eb8: 5f pop %edi -80106eb9: 5d pop %ebp -80106eba: c3 ret +80106bdc: 8d 65 f4 lea -0xc(%ebp),%esp +80106bdf: 5b pop %ebx +80106be0: 5e pop %esi +80106be1: 5f pop %edi +80106be2: 5d pop %ebp +80106be3: c3 ret kfree(s->page[pageNum]); -80106ebb: 83 ec 0c sub $0xc,%esp -80106ebe: 6b c7 6a imul $0x6a,%edi,%eax -80106ec1: 8d 44 03 10 lea 0x10(%ebx,%eax,1),%eax -80106ec5: ff 34 85 2c 6a 11 80 pushl -0x7fee95d4(,%eax,4) -80106ecc: e8 ea b1 ff ff call 801020bb +80106be4: 83 ec 0c sub $0xc,%esp +80106be7: 6b c7 6a imul $0x6a,%edi,%eax +80106bea: 8d 44 03 10 lea 0x10(%ebx,%eax,1),%eax +80106bee: ff 34 85 2c 3e 11 80 push -0x7feec1d4(,%eax,4) +80106bf5: e8 02 b4 ff ff call 80101ffc s->num_pages-=1; -80106ed1: 69 ff a8 01 00 00 imul $0x1a8,%edi,%edi -80106ed7: 83 af 58 6a 11 80 01 subl $0x1,-0x7fee95a8(%edi) -80106ede: 83 c4 10 add $0x10,%esp -80106ee1: eb c0 jmp 80106ea3 +80106bfa: 69 ff a8 01 00 00 imul $0x1a8,%edi,%edi +80106c00: 83 af 58 3e 11 80 01 subl $0x1,-0x7feec1a8(%edi) +80106c07: 83 c4 10 add $0x10,%esp +80106c0a: eb c0 jmp 80106bcc -80106ee3 : +80106c0c : // for(s = stable.slab; s < &stable.slab[NSLAB]; s++){ // cprintf("%d\t%d\t\t%d\t\t%d\n", // s->size, s->num_pages, s->num_used_objects, s->num_free_objects); // } // } void slabdump(){ -80106ee3: f3 0f 1e fb endbr32 -80106ee7: 55 push %ebp -80106ee8: 89 e5 mov %esp,%ebp -80106eea: 57 push %edi -80106eeb: 56 push %esi -80106eec: 53 push %ebx -80106eed: 83 ec 18 sub $0x18,%esp +80106c0c: 55 push %ebp +80106c0d: 89 e5 mov %esp,%ebp +80106c0f: 57 push %edi +80106c10: 56 push %esi +80106c11: 53 push %ebx +80106c12: 83 ec 18 sub $0x18,%esp cprintf("__slabdump__\n"); -80106ef0: 68 93 82 10 80 push $0x80108293 -80106ef5: e8 32 97 ff ff call 8010062c +80106c15: 68 b3 7f 10 80 push $0x80107fb3 +80106c1a: e8 e2 99 ff ff call 80100601 struct slab *s; cprintf("size\tnum_pages\tused_objects\tfree_objects\n"); -80106efa: c7 04 24 bc 82 10 80 movl $0x801082bc,(%esp) -80106f01: e8 26 97 ff ff call 8010062c -80106f06: 83 c4 10 add $0x10,%esp +80106c1f: c7 04 24 dc 7f 10 80 movl $0x80107fdc,(%esp) +80106c26: e8 d6 99 ff ff call 80100601 +80106c2b: 83 c4 10 add $0x10,%esp for(s = stable.slab; s < &stable.slab[NSLAB]; s++){ -80106f09: bf 54 6a 11 80 mov $0x80116a54,%edi -80106f0e: eb 64 jmp 80106f74 +80106c2e: bf 54 3e 11 80 mov $0x80113e54,%edi +80106c33: eb 64 jmp 80106c99 { for(int j=7;j>=0;j--) { cprintf("%d",get_bit(s->bitmap[i],j)); } cprintf(" "); -80106f10: 83 ec 0c sub $0xc,%esp -80106f13: 68 b1 7e 10 80 push $0x80107eb1 -80106f18: e8 0f 97 ff ff call 8010062c +80106c35: 83 ec 0c sub $0xc,%esp +80106c38: 68 d1 7b 10 80 push $0x80107bd1 +80106c3d: e8 bf 99 ff ff call 80100601 for(int i=0;i<60;i++) -80106f1d: 83 c6 01 add $0x1,%esi -80106f20: 83 c4 10 add $0x10,%esp -80106f23: 83 fe 3c cmp $0x3c,%esi -80106f26: 74 2e je 80106f56 +80106c42: 83 c6 01 add $0x1,%esi +80106c45: 83 c4 10 add $0x10,%esp +80106c48: 83 fe 3c cmp $0x3c,%esi +80106c4b: 74 2e je 80106c7b for(int j=7;j>=0;j--) -80106f28: bb 07 00 00 00 mov $0x7,%ebx +80106c4d: bb 07 00 00 00 mov $0x7,%ebx cprintf("%d",get_bit(s->bitmap[i],j)); -80106f2d: 83 ec 08 sub $0x8,%esp -80106f30: 8b 47 14 mov 0x14(%edi),%eax -80106f33: 0f be 04 30 movsbl (%eax,%esi,1),%eax +80106c52: 83 ec 08 sub $0x8,%esp +80106c55: 8b 47 14 mov 0x14(%edi),%eax +80106c58: 0f be 04 30 movsbl (%eax,%esi,1),%eax return ((num&(1<bitmap[i],j)); -80106f3e: 50 push %eax -80106f3f: 68 b9 82 10 80 push $0x801082b9 -80106f44: e8 e3 96 ff ff call 8010062c +80106c63: 50 push %eax +80106c64: 68 d9 7f 10 80 push $0x80107fd9 +80106c69: e8 93 99 ff ff call 80100601 for(int j=7;j>=0;j--) -80106f49: 83 eb 01 sub $0x1,%ebx -80106f4c: 83 c4 10 add $0x10,%esp -80106f4f: 83 fb ff cmp $0xffffffff,%ebx -80106f52: 75 d9 jne 80106f2d -80106f54: eb ba jmp 80106f10 +80106c6e: 83 eb 01 sub $0x1,%ebx +80106c71: 83 c4 10 add $0x10,%esp +80106c74: 83 fb ff cmp $0xffffffff,%ebx +80106c77: 75 d9 jne 80106c52 +80106c79: eb ba jmp 80106c35 } cprintf("\n"); -80106f56: 83 ec 0c sub $0xc,%esp -80106f59: 68 1f 82 10 80 push $0x8010821f -80106f5e: e8 c9 96 ff ff call 8010062c +80106c7b: 83 ec 0c sub $0xc,%esp +80106c7e: 68 3f 7f 10 80 push $0x80107f3f +80106c83: e8 79 99 ff ff call 80100601 for(s = stable.slab; s < &stable.slab[NSLAB]; s++){ -80106f63: 81 c7 a8 01 00 00 add $0x1a8,%edi -80106f69: 83 c4 10 add $0x10,%esp -80106f6c: 81 ff 3c 79 11 80 cmp $0x8011793c,%edi -80106f72: 74 2f je 80106fa3 +80106c88: 81 c7 a8 01 00 00 add $0x1a8,%edi +80106c8e: 83 c4 10 add $0x10,%esp +80106c91: 81 ff 3c 4d 11 80 cmp $0x80114d3c,%edi +80106c97: 74 2f je 80106cc8 cprintf("%d\t%d\t\t%d\t\t%d\n", -80106f74: 83 ec 0c sub $0xc,%esp -80106f77: ff 77 08 pushl 0x8(%edi) -80106f7a: ff 77 0c pushl 0xc(%edi) -80106f7d: ff 77 04 pushl 0x4(%edi) -80106f80: ff 37 pushl (%edi) -80106f82: 68 a1 82 10 80 push $0x801082a1 -80106f87: e8 a0 96 ff ff call 8010062c +80106c99: 83 ec 0c sub $0xc,%esp +80106c9c: ff 77 08 push 0x8(%edi) +80106c9f: ff 77 0c push 0xc(%edi) +80106ca2: ff 77 04 push 0x4(%edi) +80106ca5: ff 37 push (%edi) +80106ca7: 68 c1 7f 10 80 push $0x80107fc1 +80106cac: e8 50 99 ff ff call 80100601 cprintf("Bitmap: "); -80106f8c: 83 c4 14 add $0x14,%esp -80106f8f: 68 b0 82 10 80 push $0x801082b0 -80106f94: e8 93 96 ff ff call 8010062c -80106f99: 83 c4 10 add $0x10,%esp +80106cb1: 83 c4 14 add $0x14,%esp +80106cb4: 68 d0 7f 10 80 push $0x80107fd0 +80106cb9: e8 43 99 ff ff call 80100601 +80106cbe: 83 c4 10 add $0x10,%esp for(int i=0;i<60;i++) -80106f9c: be 00 00 00 00 mov $0x0,%esi -80106fa1: eb 85 jmp 80106f28 +80106cc1: be 00 00 00 00 mov $0x0,%esi +80106cc6: eb 85 jmp 80106c4d } } -80106fa3: 8d 65 f4 lea -0xc(%ebp),%esp -80106fa6: 5b pop %ebx -80106fa7: 5e pop %esi -80106fa8: 5f pop %edi -80106fa9: 5d pop %ebp -80106faa: c3 ret +80106cc8: 8d 65 f4 lea -0xc(%ebp),%esp +80106ccb: 5b pop %ebx +80106ccc: 5e pop %esi +80106ccd: 5f pop %edi +80106cce: 5d pop %ebp +80106ccf: c3 ret -80106fab : +80106cd0 : int numobj_slab(int slabid) { -80106fab: f3 0f 1e fb endbr32 -80106faf: 55 push %ebp -80106fb0: 89 e5 mov %esp,%ebp +80106cd0: 55 push %ebp +80106cd1: 89 e5 mov %esp,%ebp return stable.slab[slabid].num_used_objects; -80106fb2: 69 45 08 a8 01 00 00 imul $0x1a8,0x8(%ebp),%eax -80106fb9: 8b 80 60 6a 11 80 mov -0x7fee95a0(%eax),%eax +80106cd3: 69 45 08 a8 01 00 00 imul $0x1a8,0x8(%ebp),%eax +80106cda: 8b 80 60 3e 11 80 mov -0x7feec1a0(%eax),%eax } -80106fbf: 5d pop %ebp -80106fc0: c3 ret +80106ce0: 5d pop %ebp +80106ce1: c3 ret -80106fc1 : +80106ce2 : Thereby, you should pass all tests in the slabtest() function as is. Note that, you can edit the test function only for the debugging purpose. */ int* t[NSLAB][MAXTEST] = {}; void slabtest(){ -80106fc1: f3 0f 1e fb endbr32 -80106fc5: 55 push %ebp -80106fc6: 89 e5 mov %esp,%ebp -80106fc8: 57 push %edi -80106fc9: 56 push %esi -80106fca: 53 push %ebx -80106fcb: 83 ec 48 sub $0x48,%esp +80106ce2: 55 push %ebp +80106ce3: 89 e5 mov %esp,%ebp +80106ce5: 57 push %edi +80106ce6: 56 push %esi +80106ce7: 53 push %ebx +80106ce8: 83 ec 48 sub $0x48,%esp int counter = 1; -80106fce: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) +80106ceb: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) * to locate the VMA (virtual memory address) of an multiple of 4 bytes. * You can check the VMA of .stab by executing 'objdump -h kernel' in your xv6 source dir. * If the VMA is not aligned to the multiple of 4B, then adjust (add/del chars) * the literal string in the cprintf function */ cprintf("==== SLAB TEST ====\n"); -80106fd5: 68 f1 82 10 80 push $0x801082f1 -80106fda: e8 4d 96 ff ff call 8010062c +80106cf2: 68 11 80 10 80 push $0x80108011 +80106cf7: e8 05 99 ff ff call 80100601 * cprintf(); * slabdump(); */ /* TEST1: Single slab alloc */ cprintf("==== TEST1 =====\n"); -80106fdf: c7 04 24 06 83 10 80 movl $0x80108306,(%esp) -80106fe6: e8 41 96 ff ff call 8010062c +80106cfc: c7 04 24 26 80 10 80 movl $0x80108026,(%esp) +80106d03: e8 f9 98 ff ff call 80100601 start = counter; -80106feb: 8b 5d e4 mov -0x1c(%ebp),%ebx +80106d08: 8b 5d e4 mov -0x1c(%ebp),%ebx t[0][0] = (int*) kmalloc (TESTSIZE); -80106fee: c7 04 24 00 08 00 00 movl $0x800,(%esp) -80106ff5: e8 6d fc ff ff call 80106c67 -80106ffa: a3 c0 b5 10 80 mov %eax,0x8010b5c0 +80106d0b: c7 04 24 00 08 00 00 movl $0x800,(%esp) +80106d12: e8 83 fc ff ff call 8010699a +80106d17: a3 40 4d 11 80 mov %eax,0x80114d40 *(t[0][0]) = counter; -80106fff: 8b 55 e4 mov -0x1c(%ebp),%edx -80107002: 89 10 mov %edx,(%eax) +80106d1c: 8b 55 e4 mov -0x1c(%ebp),%edx +80106d1f: 89 10 mov %edx,(%eax) counter++; -80107004: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +80106d21: 83 45 e4 01 addl $0x1,-0x1c(%ebp) slabdump(); -80107008: e8 d6 fe ff ff call 80106ee3 +80106d25: e8 e2 fe ff ff call 80106c0c cprintf( (*(t[0][0]) == start && numobj_slab(TESTSLABID) == 1) ? "OK\n":"WRONG\n"); -8010700d: 83 c4 10 add $0x10,%esp -80107010: b8 ea 82 10 80 mov $0x801082ea,%eax -80107015: 8b 15 c0 b5 10 80 mov 0x8010b5c0,%edx -8010701b: 39 1a cmp %ebx,(%edx) -8010701d: 0f 84 a7 00 00 00 je 801070ca -80107023: 83 ec 0c sub $0xc,%esp -80107026: 50 push %eax -80107027: e8 00 96 ff ff call 8010062c +80106d2a: 83 c4 10 add $0x10,%esp +80106d2d: b8 0a 80 10 80 mov $0x8010800a,%eax +80106d32: 8b 15 40 4d 11 80 mov 0x80114d40,%edx +80106d38: 39 1a cmp %ebx,(%edx) +80106d3a: 0f 84 a7 00 00 00 je 80106de7 +80106d40: 83 ec 0c sub $0xc,%esp +80106d43: 50 push %eax +80106d44: e8 b8 98 ff ff call 80100601 kmfree ((char*) t[0][0], TESTSIZE); -8010702c: 83 c4 08 add $0x8,%esp -8010702f: 68 00 08 00 00 push $0x800 -80107034: ff 35 c0 b5 10 80 pushl 0x8010b5c0 -8010703a: e8 64 fd ff ff call 80106da3 +80106d49: 83 c4 08 add $0x8,%esp +80106d4c: 68 00 08 00 00 push $0x800 +80106d51: ff 35 40 4d 11 80 push 0x80114d40 +80106d57: e8 76 fd ff ff call 80106ad2 slabdump(); -8010703f: e8 9f fe ff ff call 80106ee3 +80106d5c: e8 ab fe ff ff call 80106c0c /* TEST1: Single slab alloc: the size not equal to a power of 2. */ cprintf("==== TEST2 =====\n"); -80107044: c7 04 24 18 83 10 80 movl $0x80108318,(%esp) -8010704b: e8 dc 95 ff ff call 8010062c +80106d61: c7 04 24 38 80 10 80 movl $0x80108038,(%esp) +80106d68: e8 94 98 ff ff call 80100601 start = counter; -80107050: 8b 5d e4 mov -0x1c(%ebp),%ebx +80106d6d: 8b 5d e4 mov -0x1c(%ebp),%ebx t[0][0] = (int*) kmalloc (TESTSIZE-10); -80107053: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) -8010705a: e8 08 fc ff ff call 80106c67 -8010705f: a3 c0 b5 10 80 mov %eax,0x8010b5c0 +80106d70: c7 04 24 f6 07 00 00 movl $0x7f6,(%esp) +80106d77: e8 1e fc ff ff call 8010699a +80106d7c: a3 40 4d 11 80 mov %eax,0x80114d40 *(t[0][0]) = counter; -80107064: 8b 55 e4 mov -0x1c(%ebp),%edx -80107067: 89 10 mov %edx,(%eax) +80106d81: 8b 55 e4 mov -0x1c(%ebp),%edx +80106d84: 89 10 mov %edx,(%eax) slabdump(); -80107069: e8 75 fe ff ff call 80106ee3 +80106d86: e8 81 fe ff ff call 80106c0c counter++; -8010706e: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +80106d8b: 83 45 e4 01 addl $0x1,-0x1c(%ebp) cprintf( (*(t[0][0]) == start && numobj_slab(TESTSLABID) == 1) ? "OK\n":"WRONG\n"); -80107072: 83 c4 10 add $0x10,%esp -80107075: b8 ea 82 10 80 mov $0x801082ea,%eax -8010707a: 8b 15 c0 b5 10 80 mov 0x8010b5c0,%edx -80107080: 39 1a cmp %ebx,(%edx) -80107082: 74 68 je 801070ec -80107084: 83 ec 0c sub $0xc,%esp -80107087: 50 push %eax -80107088: e8 9f 95 ff ff call 8010062c +80106d8f: 83 c4 10 add $0x10,%esp +80106d92: b8 0a 80 10 80 mov $0x8010800a,%eax +80106d97: 8b 15 40 4d 11 80 mov 0x80114d40,%edx +80106d9d: 39 1a cmp %ebx,(%edx) +80106d9f: 74 68 je 80106e09 +80106da1: 83 ec 0c sub $0xc,%esp +80106da4: 50 push %eax +80106da5: e8 57 98 ff ff call 80100601 kmfree ((char*) t[0][0], TESTSIZE); -8010708d: 83 c4 08 add $0x8,%esp -80107090: 68 00 08 00 00 push $0x800 -80107095: ff 35 c0 b5 10 80 pushl 0x8010b5c0 -8010709b: e8 03 fd ff ff call 80106da3 +80106daa: 83 c4 08 add $0x8,%esp +80106dad: 68 00 08 00 00 push $0x800 +80106db2: ff 35 40 4d 11 80 push 0x80114d40 +80106db8: e8 15 fd ff ff call 80106ad2 slabdump(); -801070a0: e8 3e fe ff ff call 80106ee3 +80106dbd: e8 4a fe ff ff call 80106c0c /* TEST3: Multiple slabs alloc */ cprintf("==== TEST3 =====\n"); -801070a5: c7 04 24 2a 83 10 80 movl $0x8010832a,(%esp) -801070ac: e8 7b 95 ff ff call 8010062c +80106dc2: c7 04 24 4a 80 10 80 movl $0x8010804a,(%esp) +80106dc9: e8 33 98 ff ff call 80100601 start = counter; -801070b1: 8b 75 e4 mov -0x1c(%ebp),%esi +80106dce: 8b 75 e4 mov -0x1c(%ebp),%esi for (int i=0; i +80106de2: 89 75 cc mov %esi,-0x34(%ebp) +80106de5: eb 59 jmp 80106e40 cprintf( (*(t[0][0]) == start && numobj_slab(TESTSLABID) == 1) ? "OK\n":"WRONG\n"); -801070ca: 83 ec 0c sub $0xc,%esp -801070cd: 6a 08 push $0x8 -801070cf: e8 d7 fe ff ff call 80106fab -801070d4: 83 c4 10 add $0x10,%esp -801070d7: 83 f8 01 cmp $0x1,%eax -801070da: b8 e6 82 10 80 mov $0x801082e6,%eax -801070df: ba ea 82 10 80 mov $0x801082ea,%edx -801070e4: 0f 45 c2 cmovne %edx,%eax -801070e7: e9 37 ff ff ff jmp 80107023 +80106de7: 83 ec 0c sub $0xc,%esp +80106dea: 6a 08 push $0x8 +80106dec: e8 df fe ff ff call 80106cd0 +80106df1: 83 c4 10 add $0x10,%esp +80106df4: 83 f8 01 cmp $0x1,%eax +80106df7: b8 06 80 10 80 mov $0x80108006,%eax +80106dfc: ba 0a 80 10 80 mov $0x8010800a,%edx +80106e01: 0f 45 c2 cmovne %edx,%eax +80106e04: e9 37 ff ff ff jmp 80106d40 cprintf( (*(t[0][0]) == start && numobj_slab(TESTSLABID) == 1) ? "OK\n":"WRONG\n"); -801070ec: 83 ec 0c sub $0xc,%esp -801070ef: 6a 08 push $0x8 -801070f1: e8 b5 fe ff ff call 80106fab -801070f6: 83 c4 10 add $0x10,%esp -801070f9: 83 f8 01 cmp $0x1,%eax -801070fc: b8 e6 82 10 80 mov $0x801082e6,%eax -80107101: ba ea 82 10 80 mov $0x801082ea,%edx -80107106: 0f 45 c2 cmovne %edx,%eax -80107109: e9 76 ff ff ff jmp 80107084 - memmove (t[i][0]+j, &counter, sizeof(int)); -8010710e: 83 ec 04 sub $0x4,%esp -80107111: 6a 04 push $0x4 -80107113: 8d 45 e4 lea -0x1c(%ebp),%eax -80107116: 50 push %eax -80107117: 8b 07 mov (%edi),%eax -80107119: 8d 04 98 lea (%eax,%ebx,4),%eax -8010711c: 50 push %eax -8010711d: e8 ba ce ff ff call 80103fdc - counter++; -80107122: 83 45 e4 01 addl $0x1,-0x1c(%ebp) - for (int j=0; j +80106e09: 83 ec 0c sub $0xc,%esp +80106e0c: 6a 08 push $0x8 +80106e0e: e8 bd fe ff ff call 80106cd0 +80106e13: 83 c4 10 add $0x10,%esp +80106e16: 83 f8 01 cmp $0x1,%eax +80106e19: b8 06 80 10 80 mov $0x80108006,%eax +80106e1e: ba 0a 80 10 80 mov $0x8010800a,%edx +80106e23: 0f 45 c2 cmovne %edx,%eax +80106e26: e9 76 ff ff ff jmp 80106da1 for (int i=0; i +80106e2b: 83 45 d0 01 addl $0x1,-0x30(%ebp) +80106e2f: 81 45 d4 20 03 00 00 addl $0x320,-0x2c(%ebp) +80106e36: 8b 45 d4 mov -0x2c(%ebp),%eax +80106e39: 3d 60 69 11 80 cmp $0x80116960,%eax +80106e3e: 74 51 je 80106e91 int slabsize = 1 << (i+3); -80107145: bb 01 00 00 00 mov $0x1,%ebx -8010714a: 0f b6 4d d0 movzbl -0x30(%ebp),%ecx -8010714e: d3 e3 shl %cl,%ebx +80106e40: bb 01 00 00 00 mov $0x1,%ebx +80106e45: 0f b6 4d d0 movzbl -0x30(%ebp),%ecx +80106e49: d3 e3 shl %cl,%ebx t[i][0] = (int*) kmalloc (slabsize); -80107150: 83 ec 0c sub $0xc,%esp -80107153: 53 push %ebx -80107154: e8 0e fb ff ff call 80106c67 -80107159: 8b 55 d4 mov -0x2c(%ebp),%edx -8010715c: 89 d7 mov %edx,%edi -8010715e: 89 02 mov %eax,(%edx) +80106e4b: 83 ec 0c sub $0xc,%esp +80106e4e: 53 push %ebx +80106e4f: e8 46 fb ff ff call 8010699a +80106e54: 8b 55 d4 mov -0x2c(%ebp),%edx +80106e57: 89 d7 mov %edx,%edi +80106e59: 89 02 mov %eax,(%edx) + for (int j=0; j +80106e68: bb 00 00 00 00 mov $0x0,%ebx + memmove (t[i][0]+j, &counter, sizeof(int)); +80106e6d: 83 ec 04 sub $0x4,%esp +80106e70: 6a 04 push $0x4 +80106e72: 8d 45 e4 lea -0x1c(%ebp),%eax +80106e75: 50 push %eax +80106e76: 8b 07 mov (%edi),%eax +80106e78: 8d 04 98 lea (%eax,%ebx,4),%eax +80106e7b: 50 push %eax +80106e7c: e8 b3 cf ff ff call 80103e34 + counter++; +80106e81: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int j=0; j -8010716d: bb 00 00 00 00 mov $0x0,%ebx -80107172: eb 9a jmp 8010710e -80107174: 8b 75 cc mov -0x34(%ebp),%esi -80107177: c7 45 d4 c0 b5 10 80 movl $0x8010b5c0,-0x2c(%ebp) -8010717e: b9 03 00 00 00 mov $0x3,%ecx +80106e85: 83 c3 01 add $0x1,%ebx +80106e88: 83 c4 10 add $0x10,%esp +80106e8b: 39 de cmp %ebx,%esi +80106e8d: 77 de ja 80106e6d +80106e8f: eb 9a jmp 80106e2b +80106e91: 8b 75 cc mov -0x34(%ebp),%esi +80106e94: c7 45 d4 40 4d 11 80 movl $0x80114d40,-0x2c(%ebp) +80106e9b: b9 03 00 00 00 mov $0x3,%ecx } } // CHECK pass = 1; -80107183: bf 01 00 00 00 mov $0x1,%edi -80107188: eb 14 jmp 8010719e +80106ea0: bf 01 00 00 00 mov $0x1,%edi +80106ea5: eb 14 jmp 80106ebb for (int j=0; j < slabsize/sizeof(int); j++) { // cprintf("%d, %d, %d, %d\n", i, j, *(t[i][0]+j), start); //YOU MAY USE THIS if ( *(t[i][0]+j) != start ) { pass = 0; -8010718a: bf 00 00 00 00 mov $0x0,%edi +80106ea7: bf 00 00 00 00 mov $0x0,%edi for (int i=0; i +80106eac: 83 c1 01 add $0x1,%ecx +80106eaf: 81 45 d4 20 03 00 00 addl $0x320,-0x2c(%ebp) +80106eb6: 83 f9 0c cmp $0xc,%ecx +80106eb9: 74 2c je 80106ee7 int slabsize = 1 << (i+3); -8010719e: b8 01 00 00 00 mov $0x1,%eax -801071a3: d3 e0 shl %cl,%eax +80106ebb: b8 01 00 00 00 mov $0x1,%eax +80106ec0: d3 e0 shl %cl,%eax for (int j=0; j < slabsize/sizeof(int); j++) -801071a5: 89 c3 mov %eax,%ebx -801071a7: c1 eb 02 shr $0x2,%ebx -801071aa: 83 f8 03 cmp $0x3,%eax -801071ad: 76 e0 jbe 8010718f +80106ec2: 89 c3 mov %eax,%ebx +80106ec4: c1 eb 02 shr $0x2,%ebx +80106ec7: 83 f8 03 cmp $0x3,%eax +80106eca: 76 e0 jbe 80106eac if ( *(t[i][0]+j) != start ) -801071af: 8b 45 d4 mov -0x2c(%ebp),%eax -801071b2: 8b 10 mov (%eax),%edx +80106ecc: 8b 45 d4 mov -0x2c(%ebp),%eax +80106ecf: 8b 10 mov (%eax),%edx for (int j=0; j < slabsize/sizeof(int); j++) -801071b4: b8 00 00 00 00 mov $0x0,%eax +80106ed1: b8 00 00 00 00 mov $0x0,%eax if ( *(t[i][0]+j) != start ) -801071b9: 39 34 82 cmp %esi,(%edx,%eax,4) -801071bc: 75 cc jne 8010718a +80106ed6: 39 34 82 cmp %esi,(%edx,%eax,4) +80106ed9: 75 cc jne 80106ea7 break; } start++; -801071be: 83 c6 01 add $0x1,%esi +80106edb: 83 c6 01 add $0x1,%esi for (int j=0; j < slabsize/sizeof(int); j++) -801071c1: 83 c0 01 add $0x1,%eax -801071c4: 39 d8 cmp %ebx,%eax -801071c6: 72 f1 jb 801071b9 -801071c8: eb c5 jmp 8010718f +80106ede: 83 c0 01 add $0x1,%eax +80106ee1: 39 d8 cmp %ebx,%eax +80106ee3: 72 f1 jb 80106ed6 +80106ee5: eb c5 jmp 80106eac } } slabdump(); -801071ca: e8 14 fd ff ff call 80106ee3 +80106ee7: e8 20 fd ff ff call 80106c0c cprintf( pass ? "OK\n" : "WRONG\n"); -801071cf: 85 ff test %edi,%edi -801071d1: b8 e6 82 10 80 mov $0x801082e6,%eax -801071d6: ba ea 82 10 80 mov $0x801082ea,%edx -801071db: 0f 44 c2 cmove %edx,%eax -801071de: 83 ec 0c sub $0xc,%esp -801071e1: 50 push %eax -801071e2: e8 45 94 ff ff call 8010062c -801071e7: 83 c4 10 add $0x10,%esp -801071ea: be c0 b5 10 80 mov $0x8010b5c0,%esi -801071ef: bb 03 00 00 00 mov $0x3,%ebx +80106eec: 85 ff test %edi,%edi +80106eee: b8 06 80 10 80 mov $0x80108006,%eax +80106ef3: ba 0a 80 10 80 mov $0x8010800a,%edx +80106ef8: 0f 44 c2 cmove %edx,%eax +80106efb: 83 ec 0c sub $0xc,%esp +80106efe: 50 push %eax +80106eff: e8 fd 96 ff ff call 80100601 +80106f04: 83 c4 10 add $0x10,%esp +80106f07: be 40 4d 11 80 mov $0x80114d40,%esi +80106f0c: bb 03 00 00 00 mov $0x3,%ebx for (int i=0; i +80106f1f: 50 push %eax +80106f20: ff 36 push (%esi) +80106f22: e8 ab fb ff ff call 80106ad2 for (int i=0; i +80106f27: 83 c3 01 add $0x1,%ebx +80106f2a: 81 c6 20 03 00 00 add $0x320,%esi +80106f30: 83 c4 10 add $0x10,%esp +80106f33: 83 fb 0c cmp $0xc,%ebx +80106f36: 75 de jne 80106f16 } slabdump(); -8010721b: e8 c3 fc ff ff call 80106ee3 +80106f38: e8 cf fc ff ff call 80106c0c /* TEST4: Multiple slabs alloc2 */ cprintf("==== TEST4 =====\n"); -80107220: 83 ec 0c sub $0xc,%esp -80107223: 68 3c 83 10 80 push $0x8010833c -80107228: e8 ff 93 ff ff call 8010062c +80106f3d: 83 ec 0c sub $0xc,%esp +80106f40: 68 5c 80 10 80 push $0x8010805c +80106f45: e8 b7 96 ff ff call 80100601 start = counter; -8010722d: 8b 7d e4 mov -0x1c(%ebp),%edi +80106f4a: 8b 7d e4 mov -0x1c(%ebp),%edi for (int i=0; i +80106f65: 89 7d c0 mov %edi,-0x40(%ebp) +80106f68: eb 67 jmp 80106fd1 for (int j=0; j +80106f6a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) +80106f6e: 8b 45 d4 mov -0x2c(%ebp),%eax +80106f71: 39 45 d0 cmp %eax,-0x30(%ebp) +80106f74: 74 44 je 80106fba t[i][j] = (int*) kmalloc (slabsize); -80107259: 83 ec 0c sub $0xc,%esp -8010725c: ff 75 cc pushl -0x34(%ebp) -8010725f: e8 03 fa ff ff call 80106c67 -80107264: 8b 4d d4 mov -0x2c(%ebp),%ecx -80107267: 89 ce mov %ecx,%esi -80107269: 89 01 mov %eax,(%ecx) +80106f76: 83 ec 0c sub $0xc,%esp +80106f79: 8b 5d cc mov -0x34(%ebp),%ebx +80106f7c: 53 push %ebx +80106f7d: e8 18 fa ff ff call 8010699a +80106f82: 8b 4d d4 mov -0x2c(%ebp),%ecx +80106f85: 89 ce mov %ecx,%esi +80106f87: 89 01 mov %eax,(%ecx) for (int k=0; k -80107274: bb 00 00 00 00 mov $0x0,%ebx +80106f89: 83 c4 10 add $0x10,%esp +80106f8c: 83 fb 03 cmp $0x3,%ebx +80106f8f: 76 d9 jbe 80106f6a +80106f91: bb 00 00 00 00 mov $0x0,%ebx memmove (t[i][j]+k, &counter, sizeof(int)); -80107279: 83 ec 04 sub $0x4,%esp -8010727c: 6a 04 push $0x4 -8010727e: 8d 45 e4 lea -0x1c(%ebp),%eax -80107281: 50 push %eax -80107282: 8b 06 mov (%esi),%eax -80107284: 8d 04 98 lea (%eax,%ebx,4),%eax -80107287: 50 push %eax -80107288: e8 4f cd ff ff call 80103fdc +80106f96: 83 ec 04 sub $0x4,%esp +80106f99: 6a 04 push $0x4 +80106f9b: 8d 45 e4 lea -0x1c(%ebp),%eax +80106f9e: 50 push %eax +80106f9f: 8b 06 mov (%esi),%eax +80106fa1: 8d 04 98 lea (%eax,%ebx,4),%eax +80106fa4: 50 push %eax +80106fa5: e8 8a ce ff ff call 80103e34 counter++; -8010728d: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +80106faa: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k -8010729b: eb b0 jmp 8010724d +80106fae: 83 c3 01 add $0x1,%ebx +80106fb1: 83 c4 10 add $0x10,%esp +80106fb4: 39 fb cmp %edi,%ebx +80106fb6: 72 de jb 80106f96 +80106fb8: eb b0 jmp 80106f6a for (int i=0; i +80106fba: 83 45 c8 01 addl $0x1,-0x38(%ebp) +80106fbe: 81 45 d0 20 03 00 00 addl $0x320,-0x30(%ebp) +80106fc5: 8b 45 d0 mov -0x30(%ebp),%eax +80106fc8: ba 80 6c 11 80 mov $0x80116c80,%edx +80106fcd: 39 c2 cmp %eax,%edx +80106fcf: 74 20 je 80106ff1 int slabsize = 1 << (i+3); -801072b4: b8 01 00 00 00 mov $0x1,%eax -801072b9: 0f b6 4d c4 movzbl -0x3c(%ebp),%ecx -801072bd: d3 e0 shl %cl,%eax -801072bf: 89 45 cc mov %eax,-0x34(%ebp) +80106fd1: b8 01 00 00 00 mov $0x1,%eax +80106fd6: 0f b6 4d c8 movzbl -0x38(%ebp),%ecx +80106fda: d3 e0 shl %cl,%eax +80106fdc: 89 45 cc mov %eax,-0x34(%ebp) for (int k=0; k -801072d7: 8b 7d bc mov -0x44(%ebp),%edi +80106fdf: c1 e8 02 shr $0x2,%eax +80106fe2: 89 c7 mov %eax,%edi +80106fe4: 8b 45 d0 mov -0x30(%ebp),%eax +80106fe7: 2d 20 03 00 00 sub $0x320,%eax +80106fec: 89 45 d4 mov %eax,-0x2c(%ebp) +80106fef: eb 85 jmp 80106f76 } } } slabdump(); -801072da: e8 04 fc ff ff call 80106ee3 -801072df: c7 45 d4 e0 b8 10 80 movl $0x8010b8e0,-0x2c(%ebp) -801072e6: c7 45 cc 03 00 00 00 movl $0x3,-0x34(%ebp) +80106ff1: 8b 7d c0 mov -0x40(%ebp),%edi +80106ff4: e8 13 fc ff ff call 80106c0c +80106ff9: c7 45 d4 60 50 11 80 movl $0x80115060,-0x2c(%ebp) +80107000: c7 45 cc 03 00 00 00 movl $0x3,-0x34(%ebp) // CHECK pass = 1; -801072ed: c7 45 d0 01 00 00 00 movl $0x1,-0x30(%ebp) -801072f4: eb 43 jmp 80107339 +80107007: c7 45 d0 01 00 00 00 movl $0x1,-0x30(%ebp) +8010700e: eb 43 jmp 80107053 for (int k=0; k +80107017: 83 c3 04 add $0x4,%ebx +8010701a: 3b 5d d4 cmp -0x2c(%ebp),%ebx +8010701d: 74 1d je 8010703c for (int k=0; k +8010701f: 83 fe 03 cmp $0x3,%esi +80107022: 76 f3 jbe 80107017 if (*(t[i][j]+k) != start) -8010730a: 8b 13 mov (%ebx),%edx +80107024: 8b 13 mov (%ebx),%edx for (int k=0; k +8010702b: 39 3c 82 cmp %edi,(%edx,%eax,4) +8010702e: 75 e0 jne 80107010 break; } start++; -80107316: 83 c7 01 add $0x1,%edi +80107030: 83 c7 01 add $0x1,%edi for (int k=0; k -80107320: eb db jmp 801072fd +80107033: 83 c0 01 add $0x1,%eax +80107036: 39 c8 cmp %ecx,%eax +80107038: 72 f1 jb 8010702b +8010703a: eb db jmp 80107017 for (int i=0; i +8010703c: 83 45 cc 01 addl $0x1,-0x34(%ebp) +80107040: 81 45 d4 20 03 00 00 addl $0x320,-0x2c(%ebp) +80107047: 8b 45 d4 mov -0x2c(%ebp),%eax +8010704a: ba 80 6c 11 80 mov $0x80116c80,%edx +8010704f: 39 c2 cmp %eax,%edx +80107051: 74 1b je 8010706e int slabsize = 1 << (i+3); -80107339: be 01 00 00 00 mov $0x1,%esi -8010733e: 0f b6 4d cc movzbl -0x34(%ebp),%ecx -80107342: d3 e6 shl %cl,%esi +80107053: be 01 00 00 00 mov $0x1,%esi +80107058: 0f b6 4d cc movzbl -0x34(%ebp),%ecx +8010705c: d3 e6 shl %cl,%esi for (int k=0; k +8010705e: 89 f1 mov %esi,%ecx +80107060: c1 e9 02 shr $0x2,%ecx +80107063: 8b 45 d4 mov -0x2c(%ebp),%eax +80107066: 8d 98 e0 fc ff ff lea -0x320(%eax),%ebx +8010706c: eb b1 jmp 8010701f } } } cprintf( pass ? "OK\n" : "WRONG\n"); -80107354: 83 7d d0 00 cmpl $0x0,-0x30(%ebp) -80107358: b8 e6 82 10 80 mov $0x801082e6,%eax -8010735d: ba ea 82 10 80 mov $0x801082ea,%edx -80107362: 0f 44 c2 cmove %edx,%eax -80107365: 83 ec 0c sub $0xc,%esp -80107368: 50 push %eax -80107369: e8 be 92 ff ff call 8010062c -8010736e: 83 c4 10 add $0x10,%esp -80107371: bf 03 00 00 00 mov $0x3,%edi +8010706e: 83 7d d0 00 cmpl $0x0,-0x30(%ebp) +80107072: b8 06 80 10 80 mov $0x80108006,%eax +80107077: ba 0a 80 10 80 mov $0x8010800a,%edx +8010707c: 0f 44 c2 cmove %edx,%eax +8010707f: 83 ec 0c sub $0xc,%esp +80107082: 50 push %eax +80107083: e8 79 95 ff ff call 80100601 +80107088: 83 c4 10 add $0x10,%esp +8010708b: bf 03 00 00 00 mov $0x3,%edi // slabdump(); for (int i=0; i +801070a7: 83 ec 08 sub $0x8,%esp +801070aa: 57 push %edi +801070ab: ff 33 push (%ebx) +801070ad: e8 20 fa ff ff call 80106ad2 for (int j=0; j +801070b2: 83 c3 04 add $0x4,%ebx +801070b5: 83 c4 10 add $0x10,%esp +801070b8: 39 f3 cmp %esi,%ebx +801070ba: 75 eb jne 801070a7 for (int i=0; i +801070bc: 83 45 d4 01 addl $0x1,-0x2c(%ebp) +801070c0: 81 c6 20 03 00 00 add $0x320,%esi +801070c6: 81 fe 80 6c 11 80 cmp $0x80116c80,%esi +801070cc: 75 c8 jne 80107096 // slabdump(); } } slabdump(); -801073b4: e8 2a fb ff ff call 80106ee3 +801070ce: e8 39 fb ff ff call 80106c0c /* TEST5: ALLOC MORE THAN 100 PAGES */ cprintf("==== TEST5 =====\n"); -801073b9: 83 ec 0c sub $0xc,%esp -801073bc: 68 4e 83 10 80 push $0x8010834e -801073c1: e8 66 92 ff ff call 8010062c -801073c6: 83 c4 10 add $0x10,%esp +801070d3: 83 ec 0c sub $0xc,%esp +801070d6: 68 6e 80 10 80 push $0x8010806e +801070db: e8 21 95 ff ff call 80100601 +801070e0: 83 c4 10 add $0x10,%esp start = counter; for (int j=0; j - for (int j=0; j +801070ea: 8d 7d e4 lea -0x1c(%ebp),%edi t[0][j] = (int*) kmalloc (TESTSIZE); -801073e3: 83 ec 0c sub $0xc,%esp -801073e6: 68 00 08 00 00 push $0x800 -801073eb: e8 77 f8 ff ff call 80106c67 -801073f0: 8b 55 d4 mov -0x2c(%ebp),%edx -801073f3: 89 d6 mov %edx,%esi -801073f5: 89 04 95 c0 b5 10 80 mov %eax,-0x7fef4a40(,%edx,4) -801073fc: 83 c4 10 add $0x10,%esp -801073ff: bb 00 00 00 00 mov $0x0,%ebx +801070ed: 83 ec 0c sub $0xc,%esp +801070f0: 68 00 08 00 00 push $0x800 +801070f5: e8 a0 f8 ff ff call 8010699a +801070fa: 8b 55 d4 mov -0x2c(%ebp),%edx +801070fd: 89 d6 mov %edx,%esi +801070ff: 89 04 95 40 4d 11 80 mov %eax,-0x7feeb2c0(,%edx,4) +80107106: 83 c4 10 add $0x10,%esp +80107109: bb 00 00 00 00 mov $0x0,%ebx memmove (t[0][j]+k, &counter, sizeof(int)); -80107404: 83 ec 04 sub $0x4,%esp -80107407: 6a 04 push $0x4 -80107409: 57 push %edi -8010740a: 89 d8 mov %ebx,%eax -8010740c: 03 04 b5 c0 b5 10 80 add -0x7fef4a40(,%esi,4),%eax -80107413: 50 push %eax -80107414: e8 c3 cb ff ff call 80103fdc +8010710e: 83 ec 04 sub $0x4,%esp +80107111: 6a 04 push $0x4 +80107113: 57 push %edi +80107114: 89 d8 mov %ebx,%eax +80107116: 03 04 b5 40 4d 11 80 add -0x7feeb2c0(,%esi,4),%eax +8010711d: 50 push %eax +8010711e: e8 11 cd ff ff call 80103e34 counter++; -80107419: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +80107123: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k -8010742b: eb a8 jmp 801073d5 +80107127: 83 c3 04 add $0x4,%ebx +8010712a: 83 c4 10 add $0x10,%esp +8010712d: 81 fb 00 08 00 00 cmp $0x800,%ebx +80107133: 75 d9 jne 8010710e + for (int j=0; j } } tmp = (int*) kmalloc (TESTSIZE); -8010742d: 83 ec 0c sub $0xc,%esp -80107430: 68 00 08 00 00 push $0x800 -80107435: e8 2d f8 ff ff call 80106c67 -8010743a: 89 c2 mov %eax,%edx +80107143: 83 ec 0c sub $0xc,%esp +80107146: 68 00 08 00 00 push $0x800 +8010714b: e8 4a f8 ff ff call 8010699a +80107150: 89 c2 mov %eax,%edx cprintf( (!tmp && numobj_slab (TESTSLABID) == MAXTEST) ? "OK\n" : "WRONG\n"); -8010743c: 83 c4 10 add $0x10,%esp -8010743f: b8 ea 82 10 80 mov $0x801082ea,%eax -80107444: 85 d2 test %edx,%edx -80107446: 74 5b je 801074a3 -80107448: 83 ec 0c sub $0xc,%esp -8010744b: 50 push %eax -8010744c: e8 db 91 ff ff call 8010062c +80107152: 83 c4 10 add $0x10,%esp +80107155: b8 0a 80 10 80 mov $0x8010800a,%eax +8010715a: 85 d2 test %edx,%edx +8010715c: 0f 84 cb 00 00 00 je 8010722d +80107162: 83 ec 0c sub $0xc,%esp +80107165: 50 push %eax +80107166: e8 96 94 ff ff call 80100601 slabdump(); -80107451: e8 8d fa ff ff call 80106ee3 +8010716b: e8 9c fa ff ff call 80106c0c /* TEST6: ALLOC AFTER FREE */ cprintf("==== TEST6 =====\n"); -80107456: c7 04 24 60 83 10 80 movl $0x80108360,(%esp) -8010745d: e8 ca 91 ff ff call 8010062c -80107462: 83 c4 10 add $0x10,%esp +80107170: c7 04 24 80 80 10 80 movl $0x80108080,(%esp) +80107177: e8 85 94 ff ff call 80100601 +8010717c: 83 c4 10 add $0x10,%esp for (int j=0; j +80107184: 83 ec 08 sub $0x8,%esp +80107187: 68 00 08 00 00 push $0x800 +8010718c: ff 34 9d 40 4d 11 80 push -0x7feeb2c0(,%ebx,4) +80107193: e8 3a f9 ff ff call 80106ad2 for (int j=0; j +80107198: 83 c3 01 add $0x1,%ebx +8010719b: 83 c4 10 add $0x10,%esp +8010719e: 81 fb c8 00 00 00 cmp $0xc8,%ebx +801071a4: 75 de jne 80107184 } slabdump(); -8010748c: e8 52 fa ff ff call 80106ee3 +801071a6: e8 61 fa ff ff call 80106c0c start = counter; -80107491: 8b 45 e4 mov -0x1c(%ebp),%eax -80107494: 89 45 d0 mov %eax,-0x30(%ebp) +801071ab: 8b 45 e4 mov -0x1c(%ebp),%eax +801071ae: 89 45 d0 mov %eax,-0x30(%ebp) for (int j=0; j - cprintf( (!tmp && numobj_slab (TESTSLABID) == MAXTEST) ? "OK\n" : "WRONG\n"); -801074a3: 83 ec 0c sub $0xc,%esp -801074a6: 6a 08 push $0x8 -801074a8: e8 fe fa ff ff call 80106fab -801074ad: 83 c4 10 add $0x10,%esp -801074b0: 3d c8 00 00 00 cmp $0xc8,%eax -801074b5: b8 e6 82 10 80 mov $0x801082e6,%eax -801074ba: ba ea 82 10 80 mov $0x801082ea,%edx -801074bf: 0f 45 c2 cmovne %edx,%eax -801074c2: eb 84 jmp 80107448 - for (int j=0; j +801071b8: 8d 7d e4 lea -0x1c(%ebp),%edi t[0][j] = (int*) kmalloc (TESTSIZE); -801074d2: 83 ec 0c sub $0xc,%esp -801074d5: 68 00 08 00 00 push $0x800 -801074da: e8 88 f7 ff ff call 80106c67 -801074df: 8b 55 d4 mov -0x2c(%ebp),%edx -801074e2: 89 d6 mov %edx,%esi -801074e4: 89 04 95 c0 b5 10 80 mov %eax,-0x7fef4a40(,%edx,4) -801074eb: 83 c4 10 add $0x10,%esp -801074ee: bb 00 00 00 00 mov $0x0,%ebx +801071bb: 83 ec 0c sub $0xc,%esp +801071be: 68 00 08 00 00 push $0x800 +801071c3: e8 d2 f7 ff ff call 8010699a +801071c8: 8b 55 d4 mov -0x2c(%ebp),%edx +801071cb: 89 d6 mov %edx,%esi +801071cd: 89 04 95 40 4d 11 80 mov %eax,-0x7feeb2c0(,%edx,4) +801071d4: 83 c4 10 add $0x10,%esp +801071d7: bb 00 00 00 00 mov $0x0,%ebx memmove (t[0][j]+k, &counter, sizeof(int)); -801074f3: 83 ec 04 sub $0x4,%esp -801074f6: 6a 04 push $0x4 -801074f8: 57 push %edi -801074f9: 89 d8 mov %ebx,%eax -801074fb: 03 04 b5 c0 b5 10 80 add -0x7fef4a40(,%esi,4),%eax -80107502: 50 push %eax -80107503: e8 d4 ca ff ff call 80103fdc +801071dc: 83 ec 04 sub $0x4,%esp +801071df: 6a 04 push $0x4 +801071e1: 57 push %edi +801071e2: 89 d8 mov %ebx,%eax +801071e4: 03 04 b5 40 4d 11 80 add -0x7feeb2c0(,%esi,4),%eax +801071eb: 50 push %eax +801071ec: e8 43 cc ff ff call 80103e34 counter++; -80107508: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +801071f1: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k -8010751a: eb a8 jmp 801074c4 +801071f5: 83 c3 04 add $0x4,%ebx +801071f8: 83 c4 10 add $0x10,%esp +801071fb: 81 fb 00 08 00 00 cmp $0x800,%ebx +80107201: 75 d9 jne 801071dc + for (int j=0; j } } slabdump(); -8010751c: e8 c2 f9 ff ff call 80106ee3 +80107211: e8 f6 f9 ff ff call 80106c0c // CHECK pass = 1; for (int j=0; j +8010721b: bf 01 00 00 00 mov $0x1,%edi { for (int k=0; k + cprintf( (!tmp && numobj_slab (TESTSLABID) == MAXTEST) ? "OK\n" : "WRONG\n"); +8010722d: 83 ec 0c sub $0xc,%esp +80107230: 6a 08 push $0x8 +80107232: e8 99 fa ff ff call 80106cd0 +80107237: 83 c4 10 add $0x10,%esp +8010723a: 3d c8 00 00 00 cmp $0xc8,%eax +8010723f: b8 06 80 10 80 mov $0x80108006,%eax +80107244: ba 0a 80 10 80 mov $0x8010800a,%edx +80107249: 0f 45 c2 cmovne %edx,%eax +8010724c: e9 11 ff ff ff jmp 80107162 + pass = 0; +80107251: 89 75 d4 mov %esi,-0x2c(%ebp) for (int j=0; j +80107254: 83 c1 01 add $0x1,%ecx +80107257: 81 f9 c8 00 00 00 cmp $0xc8,%ecx +8010725d: 74 26 je 80107285 for (int k=0; k +80107275: 39 04 82 cmp %eax,(%edx,%eax,4) +80107278: 75 d7 jne 80107251 break; } start++; -8010755d: 83 c0 01 add $0x1,%eax +8010727a: 83 c0 01 add $0x1,%eax for (int k=0; k -80107564: eb cf jmp 80107535 +8010727d: 39 c3 cmp %eax,%ebx +8010727f: 75 f4 jne 80107275 + start++; +80107281: 89 d8 mov %ebx,%eax +80107283: eb cf jmp 80107254 } } cprintf( pass ? "OK\n" : "WRONG\n"); -80107566: 85 db test %ebx,%ebx -80107568: b8 e6 82 10 80 mov $0x801082e6,%eax -8010756d: ba ea 82 10 80 mov $0x801082ea,%edx -80107572: 0f 44 c2 cmove %edx,%eax -80107575: 83 ec 0c sub $0xc,%esp -80107578: 50 push %eax -80107579: e8 ae 90 ff ff call 8010062c -8010757e: 83 c4 10 add $0x10,%esp +80107285: 8b 7d d4 mov -0x2c(%ebp),%edi +80107288: 85 ff test %edi,%edi +8010728a: b8 06 80 10 80 mov $0x80108006,%eax +8010728f: ba 0a 80 10 80 mov $0x8010800a,%edx +80107294: 0f 44 c2 cmove %edx,%eax +80107297: 83 ec 0c sub $0xc,%esp +8010729a: 50 push %eax +8010729b: e8 61 93 ff ff call 80100601 +801072a0: 83 c4 10 add $0x10,%esp for (int j=0; j +801072a8: 83 ec 08 sub $0x8,%esp +801072ab: 68 00 08 00 00 push $0x800 +801072b0: ff 34 9d 40 4d 11 80 push -0x7feeb2c0(,%ebx,4) +801072b7: e8 16 f8 ff ff call 80106ad2 for (int j=0; j +801072bc: 83 c3 01 add $0x1,%ebx +801072bf: 83 c4 10 add $0x10,%esp +801072c2: 81 fb c8 00 00 00 cmp $0xc8,%ebx +801072c8: 75 de jne 801072a8 // slabdump(); } slabdump(); -801075a8: e8 36 f9 ff ff call 80106ee3 +801072ca: e8 3d f9 ff ff call 80106c0c //alloc and free and alloc cprintf("==== TEST7 =====\n"); -801075ad: 83 ec 0c sub $0xc,%esp -801075b0: 68 72 83 10 80 push $0x80108372 -801075b5: e8 72 90 ff ff call 8010062c -801075ba: 83 c4 10 add $0x10,%esp +801072cf: 83 ec 0c sub $0xc,%esp +801072d2: 68 92 80 10 80 push $0x80108092 +801072d7: e8 25 93 ff ff call 80100601 +801072dc: 83 c4 10 add $0x10,%esp for (int j=0; j<16; j++) -801075bd: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) +801072df: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) { t[0][j] = (int*) kmalloc (TESTSIZE2); for (int k=0; k -801075d4: 8b 55 d4 mov -0x2c(%ebp),%edx -801075d7: 89 d7 mov %edx,%edi -801075d9: 89 04 95 c0 b5 10 80 mov %eax,-0x7fef4a40(,%edx,4) -801075e0: 83 c4 10 add $0x10,%esp -801075e3: bb 00 00 00 00 mov $0x0,%ebx +801072e9: 83 ec 0c sub $0xc,%esp +801072ec: 68 00 02 00 00 push $0x200 +801072f1: e8 a4 f6 ff ff call 8010699a +801072f6: 8b 55 d4 mov -0x2c(%ebp),%edx +801072f9: 89 d7 mov %edx,%edi +801072fb: 89 04 95 40 4d 11 80 mov %eax,-0x7feeb2c0(,%edx,4) +80107302: 83 c4 10 add $0x10,%esp +80107305: bb 00 00 00 00 mov $0x0,%ebx memmove (t[0][j]+k, &counter, sizeof(int)); -801075e8: 83 ec 04 sub $0x4,%esp -801075eb: 6a 04 push $0x4 -801075ed: 56 push %esi -801075ee: 89 d8 mov %ebx,%eax -801075f0: 03 04 bd c0 b5 10 80 add -0x7fef4a40(,%edi,4),%eax -801075f7: 50 push %eax -801075f8: e8 df c9 ff ff call 80103fdc +8010730a: 83 ec 04 sub $0x4,%esp +8010730d: 6a 04 push $0x4 +8010730f: 56 push %esi +80107310: 89 d8 mov %ebx,%eax +80107312: 03 04 bd 40 4d 11 80 add -0x7feeb2c0(,%edi,4),%eax +80107319: 50 push %eax +8010731a: e8 15 cb ff ff call 80103e34 counter++; -801075fd: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +8010731f: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k +80107323: 83 c3 04 add $0x4,%ebx +80107326: 83 c4 10 add $0x10,%esp +80107329: 81 fb 00 02 00 00 cmp $0x200,%ebx +8010732f: 75 d9 jne 8010730a for (int j=0; j<16; j++) -8010760f: 83 45 d4 01 addl $0x1,-0x2c(%ebp) -80107613: 8b 45 d4 mov -0x2c(%ebp),%eax -80107616: 83 f8 10 cmp $0x10,%eax -80107619: 75 ac jne 801075c7 +80107331: 83 45 d4 01 addl $0x1,-0x2c(%ebp) +80107335: 8b 45 d4 mov -0x2c(%ebp),%eax +80107338: 83 f8 10 cmp $0x10,%eax +8010733b: 75 ac jne 801072e9 } } slabdump(); -8010761b: e8 c3 f8 ff ff call 80106ee3 +8010733d: e8 ca f8 ff ff call 80106c0c for (int j=10; j<12; j++) { kmfree((char*) t[0][j], TESTSIZE2); -80107620: 83 ec 08 sub $0x8,%esp -80107623: 68 00 02 00 00 push $0x200 -80107628: ff 35 e8 b5 10 80 pushl 0x8010b5e8 -8010762e: e8 70 f7 ff ff call 80106da3 -80107633: 83 c4 08 add $0x8,%esp -80107636: 68 00 02 00 00 push $0x200 -8010763b: ff 35 ec b5 10 80 pushl 0x8010b5ec -80107641: e8 5d f7 ff ff call 80106da3 +80107342: 83 ec 08 sub $0x8,%esp +80107345: 68 00 02 00 00 push $0x200 +8010734a: ff 35 68 4d 11 80 push 0x80114d68 +80107350: e8 7d f7 ff ff call 80106ad2 +80107355: 83 c4 08 add $0x8,%esp +80107358: 68 00 02 00 00 push $0x200 +8010735d: ff 35 6c 4d 11 80 push 0x80114d6c +80107363: e8 6a f7 ff ff call 80106ad2 } for (int j=13; j<15; j++) { kmfree((char*) t[0][j], TESTSIZE2); -80107646: 83 c4 08 add $0x8,%esp -80107649: 68 00 02 00 00 push $0x200 -8010764e: ff 35 f4 b5 10 80 pushl 0x8010b5f4 -80107654: e8 4a f7 ff ff call 80106da3 -80107659: 83 c4 08 add $0x8,%esp -8010765c: 68 00 02 00 00 push $0x200 -80107661: ff 35 f8 b5 10 80 pushl 0x8010b5f8 -80107667: e8 37 f7 ff ff call 80106da3 +80107368: 83 c4 08 add $0x8,%esp +8010736b: 68 00 02 00 00 push $0x200 +80107370: ff 35 74 4d 11 80 push 0x80114d74 +80107376: e8 57 f7 ff ff call 80106ad2 +8010737b: 83 c4 08 add $0x8,%esp +8010737e: 68 00 02 00 00 push $0x200 +80107383: ff 35 78 4d 11 80 push 0x80114d78 +80107389: e8 44 f7 ff ff call 80106ad2 } slabdump(); -8010766c: e8 72 f8 ff ff call 80106ee3 -80107671: 83 c4 10 add $0x10,%esp +8010738e: e8 79 f8 ff ff call 80106c0c +80107393: 83 c4 10 add $0x10,%esp for (int j=10; j<12; j++) -80107674: c7 45 d4 0a 00 00 00 movl $0xa,-0x2c(%ebp) +80107396: c7 45 d4 0a 00 00 00 movl $0xa,-0x2c(%ebp) { t[0][j] = (int*) kmalloc (TESTSIZE2); for (int k=0; k -8010768b: 8b 55 d4 mov -0x2c(%ebp),%edx -8010768e: 89 d7 mov %edx,%edi -80107690: 89 04 95 c0 b5 10 80 mov %eax,-0x7fef4a40(,%edx,4) -80107697: 83 c4 10 add $0x10,%esp -8010769a: bb 00 00 00 00 mov $0x0,%ebx +801073a0: 83 ec 0c sub $0xc,%esp +801073a3: 68 00 02 00 00 push $0x200 +801073a8: e8 ed f5 ff ff call 8010699a +801073ad: 8b 55 d4 mov -0x2c(%ebp),%edx +801073b0: 89 d7 mov %edx,%edi +801073b2: 89 04 95 40 4d 11 80 mov %eax,-0x7feeb2c0(,%edx,4) +801073b9: 83 c4 10 add $0x10,%esp +801073bc: bb 00 00 00 00 mov $0x0,%ebx memmove (t[0][j]+k, &counter, sizeof(int)); -8010769f: 83 ec 04 sub $0x4,%esp -801076a2: 6a 04 push $0x4 -801076a4: 56 push %esi -801076a5: 89 d8 mov %ebx,%eax -801076a7: 03 04 bd c0 b5 10 80 add -0x7fef4a40(,%edi,4),%eax -801076ae: 50 push %eax -801076af: e8 28 c9 ff ff call 80103fdc +801073c1: 83 ec 04 sub $0x4,%esp +801073c4: 6a 04 push $0x4 +801073c6: 56 push %esi +801073c7: 89 d8 mov %ebx,%eax +801073c9: 03 04 bd 40 4d 11 80 add -0x7feeb2c0(,%edi,4),%eax +801073d0: 50 push %eax +801073d1: e8 5e ca ff ff call 80103e34 counter++; -801076b4: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +801073d6: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k +801073da: 83 c3 04 add $0x4,%ebx +801073dd: 83 c4 10 add $0x10,%esp +801073e0: 81 fb 00 02 00 00 cmp $0x200,%ebx +801073e6: 75 d9 jne 801073c1 for (int j=10; j<12; j++) -801076c6: 83 45 d4 01 addl $0x1,-0x2c(%ebp) -801076ca: 8b 45 d4 mov -0x2c(%ebp),%eax -801076cd: 83 f8 0c cmp $0xc,%eax -801076d0: 75 ac jne 8010767e +801073e8: 83 45 d4 01 addl $0x1,-0x2c(%ebp) +801073ec: 8b 45 d4 mov -0x2c(%ebp),%eax +801073ef: 83 f8 0c cmp $0xc,%eax +801073f2: 75 ac jne 801073a0 } } slabdump(); -801076d2: e8 0c f8 ff ff call 80106ee3 +801073f4: e8 13 f8 ff ff call 80106c0c for (int j=8; j<16; j++) -801076d7: bb 08 00 00 00 mov $0x8,%ebx +801073f9: bb 08 00 00 00 mov $0x8,%ebx { kmfree((char*) t[0][j], TESTSIZE2); -801076dc: 83 ec 08 sub $0x8,%esp -801076df: 68 00 02 00 00 push $0x200 -801076e4: ff 34 9d c0 b5 10 80 pushl -0x7fef4a40(,%ebx,4) -801076eb: e8 b3 f6 ff ff call 80106da3 +801073fe: 83 ec 08 sub $0x8,%esp +80107401: 68 00 02 00 00 push $0x200 +80107406: ff 34 9d 40 4d 11 80 push -0x7feeb2c0(,%ebx,4) +8010740d: e8 c0 f6 ff ff call 80106ad2 for (int j=8; j<16; j++) -801076f0: 83 c3 01 add $0x1,%ebx -801076f3: 83 c4 10 add $0x10,%esp -801076f6: 83 fb 10 cmp $0x10,%ebx -801076f9: 75 e1 jne 801076dc +80107412: 83 c3 01 add $0x1,%ebx +80107415: 83 c4 10 add $0x10,%esp +80107418: 83 fb 10 cmp $0x10,%ebx +8010741b: 75 e1 jne 801073fe } - slabdump(); -801076fb: e8 e3 f7 ff ff call 80106ee3 for (int j=0; j<8; j++) -80107700: bb 00 00 00 00 mov $0x0,%ebx +8010741d: bb 00 00 00 00 mov $0x0,%ebx { kmfree((char*) t[0][j], TESTSIZE2); -80107705: 83 ec 08 sub $0x8,%esp -80107708: 68 00 02 00 00 push $0x200 -8010770d: ff 34 9d c0 b5 10 80 pushl -0x7fef4a40(,%ebx,4) -80107714: e8 8a f6 ff ff call 80106da3 +80107422: 83 ec 08 sub $0x8,%esp +80107425: 68 00 02 00 00 push $0x200 +8010742a: ff 34 9d 40 4d 11 80 push -0x7feeb2c0(,%ebx,4) +80107431: e8 9c f6 ff ff call 80106ad2 for (int j=0; j<8; j++) -80107719: 83 c3 01 add $0x1,%ebx -8010771c: 83 c4 10 add $0x10,%esp -8010771f: 83 fb 08 cmp $0x8,%ebx -80107722: 75 e1 jne 80107705 -80107724: 89 5d d0 mov %ebx,-0x30(%ebp) +80107436: 83 c3 01 add $0x1,%ebx +80107439: 83 c4 10 add $0x10,%esp +8010743c: 83 fb 08 cmp $0x8,%ebx +8010743f: 75 e1 jne 80107422 } slabdump(); -80107727: e8 b7 f7 ff ff call 80106ee3 +80107441: 89 5d d0 mov %ebx,-0x30(%ebp) +80107444: e8 c3 f7 ff ff call 80106c0c cprintf("==== TEST8 =====\n"); -8010772c: 83 ec 0c sub $0xc,%esp -8010772f: 68 84 83 10 80 push $0x80108384 -80107734: e8 f3 8e ff ff call 8010062c -80107739: 83 c4 10 add $0x10,%esp +80107449: 83 ec 0c sub $0xc,%esp +8010744c: 68 a4 80 10 80 push $0x801080a4 +80107451: e8 ab 91 ff ff call 80100601 +80107456: 83 c4 10 add $0x10,%esp for (int j=0; j<24; j++) -8010773c: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) +80107459: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) { t[0][j] = (int*) kmalloc (TESTSIZE2); for (int k=0; k -80107753: 8b 55 d4 mov -0x2c(%ebp),%edx -80107756: 89 d6 mov %edx,%esi -80107758: 89 04 95 c0 b5 10 80 mov %eax,-0x7fef4a40(,%edx,4) -8010775f: 83 c4 10 add $0x10,%esp -80107762: bb 00 00 00 00 mov $0x0,%ebx +80107463: 83 ec 0c sub $0xc,%esp +80107466: 68 00 02 00 00 push $0x200 +8010746b: e8 2a f5 ff ff call 8010699a +80107470: 8b 55 d4 mov -0x2c(%ebp),%edx +80107473: 89 d6 mov %edx,%esi +80107475: 89 04 95 40 4d 11 80 mov %eax,-0x7feeb2c0(,%edx,4) +8010747c: 83 c4 10 add $0x10,%esp +8010747f: bb 00 00 00 00 mov $0x0,%ebx memmove (t[0][j]+k, &counter, sizeof(int)); -80107767: 83 ec 04 sub $0x4,%esp -8010776a: 6a 04 push $0x4 -8010776c: 57 push %edi -8010776d: 89 d8 mov %ebx,%eax -8010776f: 03 04 b5 c0 b5 10 80 add -0x7fef4a40(,%esi,4),%eax -80107776: 50 push %eax -80107777: e8 60 c8 ff ff call 80103fdc +80107484: 83 ec 04 sub $0x4,%esp +80107487: 6a 04 push $0x4 +80107489: 57 push %edi +8010748a: 89 d8 mov %ebx,%eax +8010748c: 03 04 b5 40 4d 11 80 add -0x7feeb2c0(,%esi,4),%eax +80107493: 50 push %eax +80107494: e8 9b c9 ff ff call 80103e34 counter++; -8010777c: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +80107499: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k +8010749d: 83 c3 04 add $0x4,%ebx +801074a0: 83 c4 10 add $0x10,%esp +801074a3: 81 fb 00 02 00 00 cmp $0x200,%ebx +801074a9: 75 d9 jne 80107484 for (int j=0; j<24; j++) -8010778e: 83 45 d4 01 addl $0x1,-0x2c(%ebp) -80107792: 8b 45 d4 mov -0x2c(%ebp),%eax -80107795: 83 f8 18 cmp $0x18,%eax -80107798: 75 ac jne 80107746 +801074ab: 83 45 d4 01 addl $0x1,-0x2c(%ebp) +801074af: 8b 45 d4 mov -0x2c(%ebp),%eax +801074b2: 83 f8 18 cmp $0x18,%eax +801074b5: 75 ac jne 80107463 } } slabdump(); -8010779a: e8 44 f7 ff ff call 80106ee3 +801074b7: e8 50 f7 ff ff call 80106c0c for (int j=8; j<16; j++) -8010779f: 8b 5d d0 mov -0x30(%ebp),%ebx +801074bc: 8b 5d d0 mov -0x30(%ebp),%ebx { kmfree((char*) t[0][j], TESTSIZE2); -801077a2: 83 ec 08 sub $0x8,%esp -801077a5: 68 00 02 00 00 push $0x200 -801077aa: ff 34 9d c0 b5 10 80 pushl -0x7fef4a40(,%ebx,4) -801077b1: e8 ed f5 ff ff call 80106da3 +801074bf: 83 ec 08 sub $0x8,%esp +801074c2: 68 00 02 00 00 push $0x200 +801074c7: ff 34 9d 40 4d 11 80 push -0x7feeb2c0(,%ebx,4) +801074ce: e8 ff f5 ff ff call 80106ad2 for (int j=8; j<16; j++) -801077b6: 83 c3 01 add $0x1,%ebx -801077b9: 83 c4 10 add $0x10,%esp -801077bc: 83 fb 10 cmp $0x10,%ebx -801077bf: 75 e1 jne 801077a2 +801074d3: 83 c3 01 add $0x1,%ebx +801074d6: 83 c4 10 add $0x10,%esp +801074d9: 83 fb 10 cmp $0x10,%ebx +801074dc: 75 e1 jne 801074bf } slabdump(); -801077c1: e8 1d f7 ff ff call 80106ee3 +801074de: e8 29 f7 ff ff call 80106c0c for (int j=8; j<16; j++) { t[0][j] = (int*) kmalloc (TESTSIZE2); for (int k=0; k -801077d6: 8b 55 d0 mov -0x30(%ebp),%edx -801077d9: 89 d7 mov %edx,%edi -801077db: 89 04 95 c0 b5 10 80 mov %eax,-0x7fef4a40(,%edx,4) -801077e2: 83 c4 10 add $0x10,%esp -801077e5: bb 00 00 00 00 mov $0x0,%ebx +801074e6: 83 ec 0c sub $0xc,%esp +801074e9: 68 00 02 00 00 push $0x200 +801074ee: e8 a7 f4 ff ff call 8010699a +801074f3: 8b 55 d0 mov -0x30(%ebp),%edx +801074f6: 89 d7 mov %edx,%edi +801074f8: 89 04 95 40 4d 11 80 mov %eax,-0x7feeb2c0(,%edx,4) +801074ff: 83 c4 10 add $0x10,%esp +80107502: bb 00 00 00 00 mov $0x0,%ebx memmove (t[0][j]+k, &counter, sizeof(int)); -801077ea: 83 ec 04 sub $0x4,%esp -801077ed: 6a 04 push $0x4 -801077ef: 56 push %esi -801077f0: 89 d8 mov %ebx,%eax -801077f2: 03 04 bd c0 b5 10 80 add -0x7fef4a40(,%edi,4),%eax -801077f9: 50 push %eax -801077fa: e8 dd c7 ff ff call 80103fdc +80107507: 83 ec 04 sub $0x4,%esp +8010750a: 6a 04 push $0x4 +8010750c: 56 push %esi +8010750d: 89 d8 mov %ebx,%eax +8010750f: 03 04 bd 40 4d 11 80 add -0x7feeb2c0(,%edi,4),%eax +80107516: 50 push %eax +80107517: e8 18 c9 ff ff call 80103e34 counter++; -801077ff: 83 45 e4 01 addl $0x1,-0x1c(%ebp) +8010751c: 83 45 e4 01 addl $0x1,-0x1c(%ebp) for (int k=0; k +80107520: 83 c3 04 add $0x4,%ebx +80107523: 83 c4 10 add $0x10,%esp +80107526: 81 fb 00 02 00 00 cmp $0x200,%ebx +8010752c: 75 d9 jne 80107507 for (int j=8; j<16; j++) -80107811: 83 45 d0 01 addl $0x1,-0x30(%ebp) -80107815: 8b 45 d0 mov -0x30(%ebp),%eax -80107818: 83 f8 10 cmp $0x10,%eax -8010781b: 75 ac jne 801077c9 +8010752e: 83 45 d0 01 addl $0x1,-0x30(%ebp) +80107532: 8b 45 d0 mov -0x30(%ebp),%eax +80107535: 83 f8 10 cmp $0x10,%eax +80107538: 75 ac jne 801074e6 } } slabdump(); -8010781d: e8 c1 f6 ff ff call 80106ee3 +8010753a: e8 cd f6 ff ff call 80106c0c for (int j=0; j<24; j++) -80107822: bb 00 00 00 00 mov $0x0,%ebx +8010753f: bb 00 00 00 00 mov $0x0,%ebx { kmfree((char*) t[0][j], TESTSIZE2); -80107827: 83 ec 08 sub $0x8,%esp -8010782a: 68 00 02 00 00 push $0x200 -8010782f: ff 34 9d c0 b5 10 80 pushl -0x7fef4a40(,%ebx,4) -80107836: e8 68 f5 ff ff call 80106da3 - slabdump(); -8010783b: e8 a3 f6 ff ff call 80106ee3 +80107544: 83 ec 08 sub $0x8,%esp +80107547: 68 00 02 00 00 push $0x200 +8010754c: ff 34 9d 40 4d 11 80 push -0x7feeb2c0(,%ebx,4) +80107553: e8 7a f5 ff ff call 80106ad2 for (int j=0; j<24; j++) -80107840: 83 c3 01 add $0x1,%ebx -80107843: 83 c4 10 add $0x10,%esp -80107846: 83 fb 18 cmp $0x18,%ebx -80107849: 75 dc jne 80107827 +80107558: 83 c3 01 add $0x1,%ebx +8010755b: 83 c4 10 add $0x10,%esp +8010755e: 83 fb 18 cmp $0x18,%ebx +80107561: 75 e1 jne 80107544 } slabdump(); -8010784b: e8 93 f6 ff ff call 80106ee3 +80107563: e8 a4 f6 ff ff call 80106c0c } -80107850: 8d 65 f4 lea -0xc(%ebp),%esp -80107853: 5b pop %ebx -80107854: 5e pop %esi -80107855: 5f pop %edi -80107856: 5d pop %ebp -80107857: c3 ret +80107568: 8d 65 f4 lea -0xc(%ebp),%esp +8010756b: 5b pop %ebx +8010756c: 5e pop %esi +8010756d: 5f pop %edi +8010756e: 5d pop %ebp +8010756f: c3 ret -80107858 : +80107570 : #include "memlayout.h" #include "mmu.h" #include "spinlock.h" #include "slab.h" int sys_slabtest(){ -80107858: f3 0f 1e fb endbr32 -8010785c: 55 push %ebp -8010785d: 89 e5 mov %esp,%ebp -8010785f: 83 ec 08 sub $0x8,%esp +80107570: 55 push %ebp +80107571: 89 e5 mov %esp,%ebp +80107573: 83 ec 08 sub $0x8,%esp slabtest(); -80107862: e8 5a f7 ff ff call 80106fc1 +80107576: e8 67 f7 ff ff call 80106ce2 return 0; } -80107867: b8 00 00 00 00 mov $0x0,%eax -8010786c: c9 leave -8010786d: c3 ret +8010757b: b8 00 00 00 00 mov $0x0,%eax +80107580: c9 leave +80107581: c3 ret diff --git a/src/kernel.sym b/src/kernel.sym index 927a6f5..a447b32 100644 --- a/src/kernel.sym +++ b/src/kernel.sym @@ -1,547 +1,535 @@ -80100000 .text -80107880 .rodata -80109000 .data -8010b520 .bss -00000000 .debug_line -00000000 .debug_info -00000000 .debug_abbrev -00000000 .debug_aranges -00000000 .debug_str -00000000 .debug_loc -00000000 .comment -00000000 .debug_ranges 00000000 bio.c 00000000 console.c -8010b520 cons -8010b558 panicked -801003d4 consputc -80100548 printint -801078ec digits.1591 +8010ff20 cons +8010ff58 panicked +801003b8 consputc +80100522 printint +8010760c digits.0 00000000 exec.c 00000000 file.c 00000000 fs.c -80101019 bfree -8010108d balloc -801011b3 bmap -8010125c iget -80101ab6 namex +80100fc6 bfree +8010103a balloc +80101151 bmap +801011f7 iget +80101a17 namex 00000000 ide.c -80101d1c idestart -8010b580 idelock -8010b560 havedisk1 -8010b564 idequeue +80101c71 idestart +80112600 idelock +801125e0 havedisk1 +801125e4 idequeue 00000000 ioapic.c 00000000 kalloc.c 00000000 kbd.c -8010b5b4 shift.1430 -80107c20 shiftcode -80107b20 togglecode -80107b00 charcode.1431 +8011267c shift.1 +80107940 shiftcode +80107840 togglecode +80107820 charcode.0 80109200 normalmap 80109100 shiftmap 80109000 ctlmap 00000000 lapic.c -80102365 lapicw -80102379 fill_rtcdate +8010227f lapicw +80102293 fill_rtcdate 00000000 log.c -801026fd install_trans -8010278f write_head +801025ff install_trans +80102691 write_head 00000000 main.c -80102b03 mpmain -80102b42 mpenter +801029f2 mpmain +80102a31 mpenter 00000000 mp.c -80102c83 mpsearch1 +80102b6a mpsearch1 00000000 picirq.c 00000000 pipe.c 00000000 proc.c -80103204 wakeup1 -8010322e allocproc -8010b000 first.1633 -8010b5b8 initproc -80107efc states.1659 -80107ee4 states.1674 +801030dc wakeup1 +80103106 allocproc +8010b000 first.2 +80113594 initproc +80107c1c states.1 +80107c04 states.0 00000000 sleeplock.c 00000000 spinlock.c 00000000 string.c 00000000 syscall.c -80107f80 syscalls +80107ca0 syscalls 00000000 sysfile.c -80104308 argfd -8010436a fdalloc -8010439f create +8010412c argfd +8010418e fdalloc +801041c2 create 00000000 sysproc.c 00000000 trap.c 00000000 uart.c -80105343 uartgetc -8010b5bc uart +80105104 uartgetc +80113e00 uart 00000000 vm.c -80105f01 walkpgdir -80105f6e mappages +80105cb2 walkpgdir +80105d1f mappages 8010b420 kmap 00000000 slab.c 00000000 slabtest.c 00000000 sysslab.c -80100264 consoleread -80105e59 vector242 -801058b0 vector119 +80100254 consoleread +80105c0a vector242 +80105661 vector119 8010000c entry -80105790 vector87 -80105787 vector86 -801040e5 safestrcpy -8010463e sys_close -80105ec5 vector251 -8010b5c0 t -801057b4 vector91 -801055aa vector33 -80105a99 vector162 -8010387e yield -801152a0 log -80115260 kmem -80105cfd vector213 -8010584d vector108 -801053cd uartinit -80105604 vector43 -8010251e lapiceoi -80105abd vector165 -80105bad vector185 -80101fe1 ioapicinit -8010588c vector115 -80100e85 fileread -801058cb vector122 -80104f24 sys_sbrk -80115380 ioapicid -801067c3 nextPowerOf2 -80105a51 vector156 -801067a1 getnumofBits -80105e7d vector245 -80115254 ioapic -80105bdd vector189 -801054ce vector7 -801056a6 vector61 -80105559 vector24 -80105868 vector111 -80105c61 vector200 -801056dc vector67 -80106826 setBitmap -80106a5c getpageNum -80105979 vector138 -8010571b vector74 -8010370c sched -80103fdc memmove -80105682 vector57 -801042ad syscall -80105d09 vector214 -801057fc vector99 -801033cb cpuid -801018d4 writei -8010599d vector141 -80104ea5 sys_fork -8010e1e0 bcache -80105b11 vector172 -80105e4d vector241 -80103d5c getcallerpcs -80104b6e sys_mkdir -80105edd vector253 -801054aa vector3 -801054a1 vector2 -801019fb namecmp -80105da5 vector227 -80105cd9 vector210 -80104276 argstr -80105d81 vector224 -80103b97 ps -801055f2 vector41 -8010062c cprintf -80100d38 filedup -80101ce4 namei -8010553e vector21 +80105541 vector87 +80105538 vector86 +80103f2f safestrcpy +80104458 sys_close +80105c76 vector251 +80114d40 t +80105565 vector91 +8010535b vector33 +8010584a vector162 +80103727 yield +801126a0 log +80112640 kmem +80105aae vector213 +801055fe vector108 +80105186 uartinit +801053b5 vector43 +80102430 lapiceoi +8010586e vector165 +8010595e vector185 +80101f2a ioapicinit +8010563d vector115 +80100e35 fileread +8010567c vector122 +80104d02 sys_sbrk +80112780 ioapicid +80106531 nextPowerOf2 +80105802 vector156 +80106513 getnumofBits +80105c2e vector245 +80112634 ioapic +8010598e vector189 +8010527f vector7 +80105457 vector61 +8010530a vector24 +80105619 vector111 +80105a12 vector200 +8010548d vector67 +80106588 setBitmap +80106793 getpageNum +8010572a vector138 +801054cc vector74 +801035bd sched +80103e34 memmove +80105433 vector57 +801040d5 syscall +80105aba vector214 +801055ad vector99 +80103295 cpuid +80101843 writei +8010574e vector141 +80104c97 sys_fork +8010b520 bcache +801058c2 vector172 +80105bfe vector241 +80103bd3 getcallerpcs +80104974 sys_mkdir +80105c8e vector253 +8010525b vector3 +80105252 vector2 +80101964 namecmp +80105b56 vector227 +80105a8a vector210 +801040a2 argstr +80105b32 vector224 +80103a28 ps +801053a3 vector41 +80100601 cprintf +80100cf4 filedup +80101c41 namei +801052ef vector21 80100034 binit -80105b4d vector177 -801058a7 vector118 -801056f7 vector70 -801056ee vector69 -80105e1d vector237 -801056c1 vector64 -80105574 vector27 -80105931 vector132 -80106761 set_bit -80105bb9 vector186 -8010454e sys_read -80105d2d vector217 -8010415a fetchint -801064fe setupkvm -80106814 returnOffset -80104031 memcpy -80106487 freevm -801067fa getslabIdx -80105498 vector1 -80105b59 vector178 -801055d7 vector38 -801020bb kfree -80105e29 vector238 -80103366 mycpu -8010163b iput -80106b3c slabinit -8010593d vector133 -80105712 vector73 -801059c1 vector144 -80105ee9 vector254 -80101304 readsb +801058fe vector177 +80105658 vector118 +801054a8 vector70 +8010549f vector69 +80105bce vector237 +80105472 vector64 +80105325 vector27 +801056e2 vector132 +801064df set_bit +8010596a vector186 +80104370 sys_read +80105ade vector217 +80103f9c fetchint +80106291 setupkvm +8010657a returnOffset +80103e85 memcpy +8010621e freevm +80106564 getslabIdx +80105249 vector1 +8010590a vector178 +80105388 vector38 +80101ffc kfree +80105bda vector238 +80103236 mycpu +801015ba iput +80106873 slabinit +801056ee vector133 +801054c3 vector73 +80105772 vector144 +80105c9a vector254 +8010129f readsb 8010b004 nextpid -8010580e vector101 -80105ce5 vector211 -80102ce4 mpinit -80105b29 vector174 -80105e65 vector243 -80100cb7 fileinit -80103d3d initlock -80105901 vector128 -801066e2 copyout -8010575a vector81 -801038b4 sleep -80102543 microdelay -801054fc vector13 -8010564c vector51 -80105513 vector16 -80112b40 input -80105e41 vector240 -80105667 vector54 -8010552c vector19 -801057bd vector92 -80105e71 vector244 -801017a5 stati -80105991 vector140 -80104edd sys_kill -80105616 vector45 -80105748 vector79 -80102fb5 pipeclose -80105dbd vector229 -80105a69 vector158 -80104688 sys_fstat -801005c9 consolewrite -801055e0 vector39 -80105ae1 vector168 -80106da3 kmfree -801028ff end_op -801055bc vector35 -8010587a vector113 -80102177 freerange -801058e6 vector125 -80106395 allocuvm -8010689f getColumn -80105067 trapret -80105d21 vector216 -801056b8 vector63 -8010556b vector26 -80105c0d vector193 -801023f3 lapicinit -80105c31 vector196 -80105ccd vector209 -801054b3 vector4 -80105af9 vector170 -8010d1e0 stack -80105961 vector136 -801054e7 vector10 -80105ca9 vector206 -801015f2 iunlock -80104f6e sys_sleep -80105ef5 vector255 -80105b7d vector181 -80105694 vector59 -8010577e vector85 -80105775 vector84 -80105b95 vector183 -80105a75 vector159 -80105cf1 vector212 -801046e0 sys_link -80105628 vector47 -80105db1 vector228 -801055fb vector42 -80105883 vector114 -80106fc1 slabtest -801066aa uva2ka -80105b35 vector175 -801059b5 vector143 -80100cd5 filealloc -80103a3a wakeup -80105919 vector130 -80105e89 vector246 -801054de vector9 -801059a9 vector142 -80105805 vector100 -80105c6d vector201 -8010658b clearpteu -801033ea myproc -80105072 tvinit -80105039 sys_ps -8010569d vector60 -80105550 vector23 -80116a20 stable -801014fd idup -80105e11 vector236 -8010234c kbdintr -80104a0b sys_open -80105dd5 vector231 -801056d3 vector66 -80105586 vector29 -801017d4 readi -80105955 vector135 -8010078b consoleintr -80103a67 kill -80105736 vector77 -801013cd ialloc -80105b71 vector180 -80116a04 kpgdir -80105cc1 vector208 -801025e8 cmostime -80105476 uartintr -801057f3 vector98 -801057ea vector97 -80105b41 vector176 -80105c19 vector194 -801055a1 vector32 -8011793c end -80105c55 vector199 -80105925 vector131 -80105ed1 vector252 -80100f0e filewrite -8010548f vector0 -801068b6 clearBitmap -801041e7 argint -8010096d exec -801059cd vector145 -801045c6 sys_write -80103f04 release -8010419a fetchstr -80105844 vector107 -801055e9 vector40 -80103958 wait -80105817 vector102 +801055bf vector101 +80105a96 vector211 +80102bd3 mpinit +801058da vector174 +80105c16 vector243 +80100c7b fileinit +80103bb8 initlock +801056b2 vector128 +80106461 copyout +8010550b vector81 +80103759 sleep +80102451 microdelay +801052ad vector13 +801053fd vector51 +801052c4 vector16 +8010fe80 input +80105bf2 vector240 +80105418 vector54 +801052dd vector19 +8010556e vector92 +80105c22 vector244 +8010171c stati +80105742 vector140 +80104cc3 sys_kill +801053c7 vector45 +801054f9 vector79 +80102e9d pipeclose +80105b6e vector229 +8010581a vector158 +8010449e sys_fstat +801005a3 consolewrite +80105391 vector39 +80105892 vector168 +80106ad2 kmfree +801027f9 end_op +8010536d vector35 +8010562b vector113 +801020b4 freerange +80105697 vector125 +80106130 allocuvm +801065f9 getColumn +80104e35 trapret +80105ad2 vector216 +80105469 vector63 +8010531c vector26 +801059be vector193 +8010230d lapicinit +801059e2 vector196 +80105a7e vector209 +80105264 vector4 +801058aa vector170 +80116960 stack +80105712 vector136 +80105298 vector10 +80105a5a vector206 +80101575 iunlock +80104d48 sys_sleep +80105ca6 vector255 +8010592e vector181 +80105445 vector59 +8010552f vector85 +80105526 vector84 +80105946 vector183 +80105826 vector159 +80105aa2 vector212 +801044f2 sys_link +801053d9 vector47 +80105b62 vector228 +801053ac vector42 +80105634 vector114 +80106ce2 slabtest +8010642d uva2ka +801058e6 vector175 +80105766 vector143 +80100c95 filealloc +801038d7 wakeup +801056ca vector130 +80105c3a vector246 +8010528f vector9 +8010575a vector142 +801055b6 vector100 +80105a1e vector201 +80106316 clearpteu +801032b0 myproc +80104e40 tvinit +80104e0b sys_ps +8010544e vector60 +80105301 vector23 +80113e20 stable +80101488 idup +80105bc2 vector236 +8010226a kbdintr +80104815 sys_open +80105b86 vector231 +80105484 vector66 +80105337 vector29 +80101747 readi +80105706 vector135 +8010075c consoleintr +80103900 kill +801054e7 vector77 +80101360 ialloc +80105922 vector180 +80113e04 kpgdir +80105a72 vector208 +801024ee cmostime +8010522b uartintr +801055a4 vector98 +8010559b vector97 +801058f2 vector176 +801059ca vector194 +80105352 vector32 +80117960 end +80105a06 vector199 +801056d6 vector131 +80105c82 vector252 +80100eba filewrite +80105240 vector0 +8010660c clearBitmap +8010401f argint +80100936 exec +8010577e vector145 +801043e4 sys_write +80103d68 release +80103fd7 fetchstr +801055f5 vector107 +8010539a vector40 +801037f9 wait +801055c8 vector102 8010a000 entrypgdir 0010000c _start -80105679 vector56 -801056e5 vector68 -801054c5 vector6 +8010542a vector56 +80105496 vector68 +80105276 vector6 8010b48c _binary_initcode_end 80100000 multiboot_header -8010590d vector129 -80103677 scheduler -80101a14 dirlookup -80105c3d vector197 -80100d81 fileclose -80102880 begin_op -80105a21 vector152 -80106570 kvmalloc -80105dc9 vector230 -8010404b strncmp -801055ce vector37 -80105c9d vector205 -80105a8d vector161 -801161c0 tickslock -80103045 pipewrite -80104093 strncpy -80105700 vector71 -801065bb copyuvm -80112be0 ftable -80105a81 vector160 -80104211 argptr -80105d15 vector215 -80105a5d vector157 -801044fc sys_dup -80105871 vector112 -80100358 panic -801032ed forkret -80105b89 vector182 -801054f5 vector12 -80103f96 memcmp -8010227c kbdgetc -80105856 vector109 -80105535 vector20 -8010356c fork -8010565e vector53 -80105523 vector18 +801056be vector129 +8010352c scheduler +80101979 dirlookup +801059ee vector197 +80100d39 fileclose +8010277e begin_op +801057d2 vector152 +801062ff kvmalloc +80105b7a vector230 +80103e9b strncmp +8010537f vector37 +80105a4e vector205 +8010583e vector161 +801135c0 tickslock +80102f29 pipewrite +80103ee1 strncpy +801054b1 vector71 +80106342 copyuvm +8010ff60 ftable +80105832 vector160 +80104045 argptr +80105ac6 vector215 +8010580e vector157 +8010431f sys_dup +80105622 vector112 +80100340 panic +801031c5 forkret +8010593a vector182 +801052a6 vector12 +80103df2 memcmp +801021a9 kbdgetc +80105607 vector109 +801052e6 vector20 +80103425 fork +8010540f vector53 +801052d4 vector18 0000008a _binary_entryother_size -801153a0 cpus -80103cb0 releasesleep -801057d8 vector95 -80103e61 holding -801135e0 sb -80103e99 acquire -80105d99 vector226 -80101d00 nameiparent -8010563a vector49 -8010560d vector44 -8011529c lapic -8010573f vector78 -8010504f alltraps -80105b1d vector173 -8010589e vector117 -80105763 vector82 -80105d69 vector222 -801054d7 vector8 -80106ee3 slabdump -801059fd vector149 -8010147a iupdate +801127a0 cpus +80103b33 releasesleep +80105589 vector95 +80103ccd holding +801125b4 sb +80103d01 acquire +80105b4a vector226 +80101c59 nameiparent +801053eb vector49 +801053be vector44 +80112680 lapic +801054f0 vector78 +80104e1d alltraps +801058ce vector173 +8010564f vector117 +80105514 vector82 +80105b1a vector222 +80105288 vector8 +80106c0c slabdump +801057ae vector149 +80101409 iupdate 80109000 data -80103f4f memset -80105de1 vector232 -80102b60 main -801060d1 switchkvm -8010583b vector106 -80105d51 vector220 -801057ab vector90 -80105aa5 vector163 -80105df9 vector234 -80102a45 log_write -80103c5a acquiresleep -80104836 sys_unlink -801056af vector62 -80105562 vector25 -80105c49 vector198 -801058b9 vector120 +80103daf memset +80105b92 vector232 +80102a4b main +80105e81 switchkvm +801055ec vector106 +80105b02 vector220 +8010555c vector90 +80105856 vector163 +80105baa vector234 +8010293b log_write +80103ae1 acquiresleep +80104644 sys_unlink +80105460 vector62 +80105313 vector25 +801059fa vector198 +8010566a vector120 8010b48c _binary_entryother_start -801021bf kinit1 -80105643 vector50 -8010550a vector15 -80105a15 vector151 -8010576c vector83 -801057a2 vector89 -80105799 vector88 -80105129 trap -8010500b sys_uptime -80105b65 vector179 -801055b3 vector34 -8010561f vector46 -80105949 vector134 -80105d75 vector223 -80116200 idt -80105d39 vector218 -80103334 pinit -80106302 deallocuvm -80106fab numobj_slab -80105d8d vector225 -80102504 lapicid -80105bc5 vector187 -801034fd growproc -80103cef holdingsleep -8010678b clear_bit -80115920 ncpu -8010558f vector30 -80103412 userinit -80106888 getRow -801000ae bread -801058f8 vector127 -80103135 piperead -80116a00 ticks -80105c01 vector192 -80105ac9 vector166 -80100925 consoleinit -80106777 get_bit -8010572d vector76 -80105724 vector75 -80101e54 ideintr -80105c25 vector195 -80105a09 vector150 -8010568b vector58 -80105ea1 vector248 -801058d4 vector123 -801057e1 vector96 -80105598 vector31 -80105c85 vector203 -80105985 vector139 -80105a2d vector153 -80105ab1 vector164 -80103adf procdump -801058c2 vector121 -80105370 uartputc -801054bc vector5 -80105ad5 vector167 -80105a45 vector155 -80105ead vector249 -801001cd brelse -80105eb9 vector250 -801069c5 checkNewpage -801058dd vector124 -8010585f vector110 -80105c91 vector204 -8010152c ilock -80104d09 sys_exec -8010596d vector137 +801020f8 kinit1 +801053f4 vector50 +801052bb vector15 +801057c6 vector151 +8010551d vector83 +80105553 vector89 +8010554a vector88 +80104eef trap +80104de1 sys_uptime +80105916 vector179 +80105364 vector34 +801053d0 vector46 +801056fa vector134 +80105b26 vector223 +80113600 idt +80105aea vector218 +80103208 pinit +801060a1 deallocuvm +80106cd0 numobj_slab +80105b3e vector225 +8010241a lapicid +80105976 vector187 +801033ba growproc +80103b6e holdingsleep +80106501 clear_bit +80112784 ncpu +80105340 vector30 +801032d3 userinit +801065e6 getRow +801000aa bread +801056a9 vector127 +80103010 piperead +801135a0 ticks +801059b2 vector192 +8010587a vector166 +801008f2 consoleinit +801064f1 get_bit +801054de vector76 +801054d5 vector75 +80101da5 ideintr +801059d6 vector195 +801057ba vector150 +8010543c vector58 +80105c52 vector248 +80105685 vector123 +80105592 vector96 +80105349 vector31 +80105a36 vector203 +80105736 vector139 +801057de vector153 +80105862 vector164 +80103974 procdump +80105673 vector121 +8010512d uartputc +8010526d vector5 +80105886 vector167 +801057f6 vector155 +80105c5e vector249 +801001c1 brelse +80105c6a vector250 +80106700 checkNewpage +8010568e vector124 +80105610 vector110 +80105a42 vector204 +801014b3 ilock +80104b03 sys_exec +8010571e vector137 8010b460 _binary_initcode_start -80104145 swtch -80105e95 vector247 -80105547 vector22 -80105c79 vector202 -80105fe6 seginit -80101781 iunlockput -80105709 vector72 -80105670 vector55 -801058ef vector126 -801056ca vector65 -8010557d vector28 +80103f87 swtch +80105c46 vector247 +801052f8 vector22 +80105a2a vector202 +80105d9a seginit +801016fc iunlockput +801054ba vector72 +80105421 vector55 +801056a0 vector126 +8010547b vector65 +8010532e vector28 8010b516 _binary_entryother_end -80105aed vector169 -8010018e bwrite -80105ded vector233 -80106c67 kmalloc -80105101 idtinit -801037b3 exit -80104ecc sys_wait -80104eb6 sys_exit -80101c2b dirlink +8010589e vector169 +80100186 bwrite +80105b9e vector233 +8010699a kmalloc +80104ecb idtinit +80103660 exit +80104cb6 sys_wait +80104ca4 sys_exit +80101b8c dirlink 0000002c _binary_initcode_size -801059e5 vector147 -80103c23 initsleeplock -80106905 checkEmpty -80101ddb ideinit -80106252 loaduvm -80105829 vector104 -80107858 sys_slabtest -80105895 vector116 -80115940 ptable -80102084 ioapicenable -80103dfd popcli +80105796 vector147 +80103aae initsleeplock +8010664c checkEmpty +80101d30 ideinit +80105ff6 loaduvm +801055da vector104 +80107570 sys_slabtest +80105646 vector116 +80112d20 ptable +80101fc9 ioapicenable +80103c6d popcli 8010b008 vectors -80105655 vector52 -8010551c vector17 -80105ba1 vector184 -8010411f strlen -80104e05 sys_pipe -8010133c iinit -80102ea0 picinit -80105cb5 vector207 -801061e5 inituvm -80105be9 vector190 -80105e35 vector239 -801057cf vector94 -801057c6 vector93 -801027e9 initlog -80105bd1 vector188 -80105631 vector48 -80101ef7 iderw -80105d45 vector219 -801059f1 vector148 -80105d5d vector221 -80102219 kalloc -80113580 devsw -80104f10 sys_getpid -80105751 vector80 -80105b05 vector171 -80105a39 vector154 -801055c5 vector36 -80102eb6 pipealloc -80105e05 vector235 -80105832 vector105 -80104c66 sys_chdir -80113600 icache -801059d9 vector146 -80105bf5 vector191 -80105820 vector103 -80104bd4 sys_mknod -80102548 lapicstartap -801060e3 switchuvm -80103dbc pushcli -801021f5 kinit2 -801054ee vector11 -80105503 vector14 -80100e3a filestat +80105406 vector52 +801052cd vector17 +80105952 vector184 +80103f65 strlen +80104bfb sys_pipe +801012d3 iinit +80102d90 picinit +80105a66 vector207 +80105f8d inituvm +8010599a vector190 +80105be6 vector239 +80105580 vector94 +80105577 vector93 +801026eb initlog +80105982 vector188 +801053e2 vector48 +80101e44 iderw +80105af6 vector219 +801057a2 vector148 +80105b0e vector221 +8010214a kalloc +80110900 devsw +80104cf2 sys_getpid +80105502 vector80 +801058b6 vector171 +801057ea vector154 +80105376 vector36 +80102da2 pipealloc +80105bb6 vector235 +801055e3 vector105 +80104a64 sys_chdir +80110960 icache +8010578a vector146 +801059a6 vector191 +801055d1 vector103 +801049d6 sys_mknod +80102452 lapicstartap +80105e8f switchuvm +80103c31 pushcli +8010212a kinit2 +8010529f vector11 +801052b4 vector14 +80100dee filestat diff --git a/src/lapic.d b/src/lapic.d new file mode 100644 index 0000000..6e62387 --- /dev/null +++ b/src/lapic.d @@ -0,0 +1,2 @@ +lapic.o: lapic.c /usr/include/stdc-predef.h param.h types.h defs.h date.h \ + memlayout.h traps.h mmu.h x86.h diff --git a/src/lapic.o b/src/lapic.o new file mode 100644 index 0000000..d165675 Binary files /dev/null and b/src/lapic.o differ diff --git a/src/log.d b/src/log.d new file mode 100644 index 0000000..04c8930 --- /dev/null +++ b/src/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/src/log.o b/src/log.o new file mode 100644 index 0000000..fd5fcdb Binary files /dev/null and b/src/log.o differ diff --git a/src/main.d b/src/main.d new file mode 100644 index 0000000..354dab4 --- /dev/null +++ b/src/main.d @@ -0,0 +1,2 @@ +main.o: main.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h proc.h x86.h diff --git a/src/main.o b/src/main.o new file mode 100644 index 0000000..b0cf226 Binary files /dev/null and b/src/main.o differ diff --git a/src/mkfs b/src/mkfs index b9cac01..150890c 100755 Binary files a/src/mkfs and b/src/mkfs differ diff --git a/src/mp.d b/src/mp.d new file mode 100644 index 0000000..0714441 --- /dev/null +++ b/src/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/src/mp.o b/src/mp.o new file mode 100644 index 0000000..cd0fae4 Binary files /dev/null and b/src/mp.o differ diff --git a/src/picirq.d b/src/picirq.d new file mode 100644 index 0000000..5233e7e --- /dev/null +++ b/src/picirq.d @@ -0,0 +1 @@ +picirq.o: picirq.c /usr/include/stdc-predef.h types.h x86.h traps.h diff --git a/src/picirq.o b/src/picirq.o new file mode 100644 index 0000000..a19f7b5 Binary files /dev/null and b/src/picirq.o differ diff --git a/src/pipe.d b/src/pipe.d new file mode 100644 index 0000000..3d0eac9 --- /dev/null +++ b/src/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/src/pipe.o b/src/pipe.o new file mode 100644 index 0000000..b2bc992 Binary files /dev/null and b/src/pipe.o differ diff --git a/src/printf.d b/src/printf.d new file mode 100644 index 0000000..ddd3a8d --- /dev/null +++ b/src/printf.d @@ -0,0 +1 @@ +printf.o: printf.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/printf.o b/src/printf.o new file mode 100644 index 0000000..6fdc87b Binary files /dev/null and b/src/printf.o differ diff --git a/src/proc.d b/src/proc.d new file mode 100644 index 0000000..9396fef --- /dev/null +++ b/src/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/src/proc.o b/src/proc.o new file mode 100644 index 0000000..e0e7549 Binary files /dev/null and b/src/proc.o differ diff --git a/src/slab.d b/src/slab.d new file mode 100644 index 0000000..9bb9eac --- /dev/null +++ b/src/slab.d @@ -0,0 +1,3 @@ +slab.o: slab.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h spinlock.h slab.h \ + /usr/lib/gcc/x86_64-linux-gnu/11/include/stdbool.h diff --git a/src/slab.o b/src/slab.o new file mode 100644 index 0000000..d352d19 Binary files /dev/null and b/src/slab.o differ diff --git a/src/slabtest.c b/src/slabtest.c index 1fd6ebc..373f5b8 100644 --- a/src/slabtest.c +++ b/src/slabtest.c @@ -243,7 +243,6 @@ void slabtest(){ { kmfree((char*) t[0][j], TESTSIZE2); } - slabdump(); for (int j=0; j<8; j++) { kmfree((char*) t[0][j], TESTSIZE2); @@ -278,7 +277,6 @@ void slabtest(){ for (int j=0; j<24; j++) { kmfree((char*) t[0][j], TESTSIZE2); - slabdump(); } slabdump(); } diff --git a/src/slabtest.d b/src/slabtest.d new file mode 100644 index 0000000..d04139e --- /dev/null +++ b/src/slabtest.d @@ -0,0 +1,2 @@ +slabtest.o: slabtest.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h spinlock.h slab.h diff --git a/src/slabtest.o b/src/slabtest.o new file mode 100644 index 0000000..8f3eff4 Binary files /dev/null and b/src/slabtest.o differ diff --git a/src/sleeplock.d b/src/sleeplock.d new file mode 100644 index 0000000..e50551a --- /dev/null +++ b/src/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/src/sleeplock.o b/src/sleeplock.o new file mode 100644 index 0000000..c840780 Binary files /dev/null and b/src/sleeplock.o differ diff --git a/src/spinlock.d b/src/spinlock.d new file mode 100644 index 0000000..9f70952 --- /dev/null +++ b/src/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/src/spinlock.o b/src/spinlock.o new file mode 100644 index 0000000..f235206 Binary files /dev/null and b/src/spinlock.o differ diff --git a/src/string.d b/src/string.d new file mode 100644 index 0000000..68931ed --- /dev/null +++ b/src/string.d @@ -0,0 +1 @@ +string.o: string.c /usr/include/stdc-predef.h types.h x86.h diff --git a/src/string.o b/src/string.o new file mode 100644 index 0000000..675814d Binary files /dev/null and b/src/string.o differ diff --git a/src/swtch.o b/src/swtch.o new file mode 100644 index 0000000..fc24ea4 Binary files /dev/null and b/src/swtch.o differ diff --git a/src/syscall.d b/src/syscall.d new file mode 100644 index 0000000..4649283 --- /dev/null +++ b/src/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/src/syscall.o b/src/syscall.o new file mode 100644 index 0000000..e92cd87 Binary files /dev/null and b/src/syscall.o differ diff --git a/src/sysfile.d b/src/sysfile.d new file mode 100644 index 0000000..74f1a20 --- /dev/null +++ b/src/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/src/sysfile.o b/src/sysfile.o new file mode 100644 index 0000000..5fd5a2a Binary files /dev/null and b/src/sysfile.o differ diff --git a/src/sysproc.d b/src/sysproc.d new file mode 100644 index 0000000..2f26f0c --- /dev/null +++ b/src/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/src/sysproc.o b/src/sysproc.o new file mode 100644 index 0000000..307d9d7 Binary files /dev/null and b/src/sysproc.o differ diff --git a/src/sysslab.d b/src/sysslab.d new file mode 100644 index 0000000..4c16f39 --- /dev/null +++ b/src/sysslab.d @@ -0,0 +1,2 @@ +sysslab.o: sysslab.c /usr/include/stdc-predef.h types.h defs.h param.h \ + memlayout.h mmu.h spinlock.h slab.h diff --git a/src/sysslab.o b/src/sysslab.o new file mode 100644 index 0000000..bc781ab Binary files /dev/null and b/src/sysslab.o differ diff --git a/src/trap.d b/src/trap.d new file mode 100644 index 0000000..c48ab89 --- /dev/null +++ b/src/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/src/trap.o b/src/trap.o new file mode 100644 index 0000000..83e3636 Binary files /dev/null and b/src/trap.o differ diff --git a/src/trapasm.o b/src/trapasm.o new file mode 100644 index 0000000..1a9159c Binary files /dev/null and b/src/trapasm.o differ diff --git a/src/uart.d b/src/uart.d new file mode 100644 index 0000000..d156629 --- /dev/null +++ b/src/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/src/uart.o b/src/uart.o new file mode 100644 index 0000000..7fd1910 Binary files /dev/null and b/src/uart.o differ diff --git a/src/ulib.d b/src/ulib.d new file mode 100644 index 0000000..61f575e --- /dev/null +++ b/src/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/src/ulib.o b/src/ulib.o new file mode 100644 index 0000000..7b7a3c7 Binary files /dev/null and b/src/ulib.o differ diff --git a/src/umalloc.d b/src/umalloc.d new file mode 100644 index 0000000..cc1d152 --- /dev/null +++ b/src/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/src/umalloc.o b/src/umalloc.o new file mode 100644 index 0000000..d4ee92c Binary files /dev/null and b/src/umalloc.o differ diff --git a/src/user/_cat b/src/user/_cat index 991cad3..48cf608 100755 Binary files a/src/user/_cat and b/src/user/_cat differ diff --git a/src/user/_echo b/src/user/_echo index 66e18e4..9603a51 100755 Binary files a/src/user/_echo and b/src/user/_echo differ diff --git a/src/user/_forktest b/src/user/_forktest index 398ea42..03e95ed 100755 Binary files a/src/user/_forktest and b/src/user/_forktest differ diff --git a/src/user/_grep b/src/user/_grep index 36630bf..3ef1175 100755 Binary files a/src/user/_grep and b/src/user/_grep differ diff --git a/src/user/_init b/src/user/_init index 054b48b..f8406bc 100755 Binary files a/src/user/_init and b/src/user/_init differ diff --git a/src/user/_kill b/src/user/_kill index be36b58..8374628 100755 Binary files a/src/user/_kill and b/src/user/_kill differ diff --git a/src/user/_ln b/src/user/_ln index fbeccb5..bf2a36b 100755 Binary files a/src/user/_ln and b/src/user/_ln differ diff --git a/src/user/_ls b/src/user/_ls index 2628be5..ce6caec 100755 Binary files a/src/user/_ls and b/src/user/_ls differ diff --git a/src/user/_mkdir b/src/user/_mkdir index 6e16cea..6bb84e9 100755 Binary files a/src/user/_mkdir and b/src/user/_mkdir differ diff --git a/src/user/_ps b/src/user/_ps index c28e9fa..04725b7 100755 Binary files a/src/user/_ps and b/src/user/_ps differ diff --git a/src/user/_rm b/src/user/_rm index 9fcce19..4f85726 100755 Binary files a/src/user/_rm and b/src/user/_rm differ diff --git a/src/user/_sh b/src/user/_sh index 5e632fd..db58358 100755 Binary files a/src/user/_sh and b/src/user/_sh differ diff --git a/src/user/_slabtest b/src/user/_slabtest index cf6aec7..b400709 100755 Binary files a/src/user/_slabtest and b/src/user/_slabtest differ diff --git a/src/user/_stressfs b/src/user/_stressfs index 4270e8d..e813414 100755 Binary files a/src/user/_stressfs and b/src/user/_stressfs differ diff --git a/src/user/_usertests b/src/user/_usertests index 7e8d922..12232fd 100755 Binary files a/src/user/_usertests and b/src/user/_usertests differ diff --git a/src/user/_wc b/src/user/_wc index d573c08..7826ca5 100755 Binary files a/src/user/_wc and b/src/user/_wc differ diff --git a/src/user/_zombie b/src/user/_zombie index 7906d28..2f2def7 100755 Binary files a/src/user/_zombie and b/src/user/_zombie differ diff --git a/src/user/cat.asm b/src/user/cat.asm index 368adc9..e78a1be 100644 --- a/src/user/cat.asm +++ b/src/user/cat.asm @@ -11,1151 +11,1119 @@ char buf[512]; void cat(int fd) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 56 push %esi - 8: 53 push %ebx - 9: 8b 75 08 mov 0x8(%ebp),%esi + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 56 push %esi + 4: 53 push %ebx + 5: 8b 75 08 mov 0x8(%ebp),%esi int n; while((n = read(fd, buf, sizeof(buf))) > 0) { - c: 83 ec 04 sub $0x4,%esp - f: 68 00 02 00 00 push $0x200 - 14: 68 60 0a 00 00 push $0xa60 - 19: 56 push %esi - 1a: e8 e0 02 00 00 call 2ff - 1f: 89 c3 mov %eax,%ebx - 21: 83 c4 10 add $0x10,%esp - 24: 85 c0 test %eax,%eax - 26: 7e 2b jle 53 + 8: 83 ec 04 sub $0x4,%esp + b: 68 00 02 00 00 push $0x200 + 10: 68 40 0a 00 00 push $0xa40 + 15: 56 push %esi + 16: e8 be 02 00 00 call 2d9 + 1b: 89 c3 mov %eax,%ebx + 1d: 83 c4 10 add $0x10,%esp + 20: 85 c0 test %eax,%eax + 22: 7e 2b jle 4f if (write(1, buf, n) != n) { - 28: 83 ec 04 sub $0x4,%esp - 2b: 53 push %ebx - 2c: 68 60 0a 00 00 push $0xa60 - 31: 6a 01 push $0x1 - 33: e8 cf 02 00 00 call 307 - 38: 83 c4 10 add $0x10,%esp - 3b: 39 d8 cmp %ebx,%eax - 3d: 74 cd je c + 24: 83 ec 04 sub $0x4,%esp + 27: 53 push %ebx + 28: 68 40 0a 00 00 push $0xa40 + 2d: 6a 01 push $0x1 + 2f: e8 ad 02 00 00 call 2e1 + 34: 83 c4 10 add $0x10,%esp + 37: 39 d8 cmp %ebx,%eax + 39: 74 cd je 8 printf(1, "cat: write error\n"); - 3f: 83 ec 08 sub $0x8,%esp - 42: 68 44 07 00 00 push $0x744 - 47: 6a 01 push $0x1 - 49: e8 dd 03 00 00 call 42b + 3b: 83 ec 08 sub $0x8,%esp + 3e: 68 00 07 00 00 push $0x700 + 43: 6a 01 push $0x1 + 45: e8 bf 03 00 00 call 409 exit(); - 4e: e8 94 02 00 00 call 2e7 + 4a: e8 72 02 00 00 call 2c1 } } if(n < 0){ - 53: 78 07 js 5c + 4f: 78 07 js 58 printf(1, "cat: read error\n"); exit(); } } - 55: 8d 65 f8 lea -0x8(%ebp),%esp - 58: 5b pop %ebx - 59: 5e pop %esi - 5a: 5d pop %ebp - 5b: c3 ret + 51: 8d 65 f8 lea -0x8(%ebp),%esp + 54: 5b pop %ebx + 55: 5e pop %esi + 56: 5d pop %ebp + 57: c3 ret printf(1, "cat: read error\n"); - 5c: 83 ec 08 sub $0x8,%esp - 5f: 68 56 07 00 00 push $0x756 - 64: 6a 01 push $0x1 - 66: e8 c0 03 00 00 call 42b + 58: 83 ec 08 sub $0x8,%esp + 5b: 68 12 07 00 00 push $0x712 + 60: 6a 01 push $0x1 + 62: e8 a2 03 00 00 call 409 exit(); - 6b: e8 77 02 00 00 call 2e7 + 67: e8 55 02 00 00 call 2c1 -00000070
: +0000006c
: int main(int argc, char *argv[]) { - 70: f3 0f 1e fb endbr32 - 74: 8d 4c 24 04 lea 0x4(%esp),%ecx - 78: 83 e4 f0 and $0xfffffff0,%esp - 7b: ff 71 fc pushl -0x4(%ecx) - 7e: 55 push %ebp - 7f: 89 e5 mov %esp,%ebp - 81: 57 push %edi - 82: 56 push %esi - 83: 53 push %ebx - 84: 51 push %ecx - 85: 83 ec 18 sub $0x18,%esp - 88: 8b 01 mov (%ecx),%eax - 8a: 89 45 e4 mov %eax,-0x1c(%ebp) - 8d: 8b 71 04 mov 0x4(%ecx),%esi + 6c: 8d 4c 24 04 lea 0x4(%esp),%ecx + 70: 83 e4 f0 and $0xfffffff0,%esp + 73: ff 71 fc push -0x4(%ecx) + 76: 55 push %ebp + 77: 89 e5 mov %esp,%ebp + 79: 57 push %edi + 7a: 56 push %esi + 7b: 53 push %ebx + 7c: 51 push %ecx + 7d: 83 ec 18 sub $0x18,%esp + 80: 8b 01 mov (%ecx),%eax + 82: 89 45 e4 mov %eax,-0x1c(%ebp) + 85: 8b 71 04 mov 0x4(%ecx),%esi int fd, i; if(argc <= 1){ - 90: 83 c6 04 add $0x4,%esi + 88: 83 c6 04 add $0x4,%esi cat(0); exit(); } for(i = 1; i < argc; i++){ - 93: bf 01 00 00 00 mov $0x1,%edi + 8b: bf 01 00 00 00 mov $0x1,%edi if(argc <= 1){ - 98: 83 f8 01 cmp $0x1,%eax - 9b: 7e 3c jle d9 + 90: 83 f8 01 cmp $0x1,%eax + 93: 7e 3c jle d1 if((fd = open(argv[i], 0)) < 0){ - 9d: 89 75 e0 mov %esi,-0x20(%ebp) - a0: 83 ec 08 sub $0x8,%esp - a3: 6a 00 push $0x0 - a5: ff 36 pushl (%esi) - a7: e8 7b 02 00 00 call 327 - ac: 89 c3 mov %eax,%ebx - ae: 83 c4 10 add $0x10,%esp - b1: 85 c0 test %eax,%eax - b3: 78 33 js e8 + 95: 89 75 e0 mov %esi,-0x20(%ebp) + 98: 83 ec 08 sub $0x8,%esp + 9b: 6a 00 push $0x0 + 9d: ff 36 push (%esi) + 9f: e8 5d 02 00 00 call 301 + a4: 89 c3 mov %eax,%ebx + a6: 83 c4 10 add $0x10,%esp + a9: 85 c0 test %eax,%eax + ab: 78 33 js e0 printf(1, "cat: cannot open %s\n", argv[i]); exit(); } cat(fd); - b5: 83 ec 0c sub $0xc,%esp - b8: 50 push %eax - b9: e8 42 ff ff ff call 0 + ad: 83 ec 0c sub $0xc,%esp + b0: 50 push %eax + b1: e8 4a ff ff ff call 0 close(fd); - be: 89 1c 24 mov %ebx,(%esp) - c1: e8 49 02 00 00 call 30f + b6: 89 1c 24 mov %ebx,(%esp) + b9: e8 2b 02 00 00 call 2e9 for(i = 1; i < argc; i++){ - c6: 83 c7 01 add $0x1,%edi - c9: 83 c6 04 add $0x4,%esi - cc: 83 c4 10 add $0x10,%esp - cf: 39 7d e4 cmp %edi,-0x1c(%ebp) - d2: 75 c9 jne 9d + be: 83 c7 01 add $0x1,%edi + c1: 83 c6 04 add $0x4,%esi + c4: 83 c4 10 add $0x10,%esp + c7: 39 7d e4 cmp %edi,-0x1c(%ebp) + ca: 75 c9 jne 95 } exit(); - d4: e8 0e 02 00 00 call 2e7 + cc: e8 f0 01 00 00 call 2c1 cat(0); - d9: 83 ec 0c sub $0xc,%esp - dc: 6a 00 push $0x0 - de: e8 1d ff ff ff call 0 + d1: 83 ec 0c sub $0xc,%esp + d4: 6a 00 push $0x0 + d6: e8 25 ff ff ff call 0 exit(); - e3: e8 ff 01 00 00 call 2e7 + db: e8 e1 01 00 00 call 2c1 printf(1, "cat: cannot open %s\n", argv[i]); - e8: 83 ec 04 sub $0x4,%esp - eb: 8b 45 e0 mov -0x20(%ebp),%eax - ee: ff 30 pushl (%eax) - f0: 68 67 07 00 00 push $0x767 - f5: 6a 01 push $0x1 - f7: e8 2f 03 00 00 call 42b + e0: 83 ec 04 sub $0x4,%esp + e3: 8b 45 e0 mov -0x20(%ebp),%eax + e6: ff 30 push (%eax) + e8: 68 23 07 00 00 push $0x723 + ed: 6a 01 push $0x1 + ef: e8 15 03 00 00 call 409 exit(); - fc: e8 e6 01 00 00 call 2e7 + f4: e8 c8 01 00 00 call 2c1 -00000101 : +000000f9 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 101: f3 0f 1e fb endbr32 - 105: 55 push %ebp - 106: 89 e5 mov %esp,%ebp - 108: 53 push %ebx - 109: 8b 4d 08 mov 0x8(%ebp),%ecx - 10c: 8b 5d 0c mov 0xc(%ebp),%ebx + f9: 55 push %ebp + fa: 89 e5 mov %esp,%ebp + fc: 53 push %ebx + fd: 8b 4d 08 mov 0x8(%ebp),%ecx + 100: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 10f: b8 00 00 00 00 mov $0x0,%eax - 114: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 118: 88 14 01 mov %dl,(%ecx,%eax,1) - 11b: 83 c0 01 add $0x1,%eax - 11e: 84 d2 test %dl,%dl - 120: 75 f2 jne 114 + 103: b8 00 00 00 00 mov $0x0,%eax + 108: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 10c: 88 14 01 mov %dl,(%ecx,%eax,1) + 10f: 83 c0 01 add $0x1,%eax + 112: 84 d2 test %dl,%dl + 114: 75 f2 jne 108 ; return os; } - 122: 89 c8 mov %ecx,%eax - 124: 5b pop %ebx - 125: 5d pop %ebp - 126: c3 ret + 116: 89 c8 mov %ecx,%eax + 118: 8b 5d fc mov -0x4(%ebp),%ebx + 11b: c9 leave + 11c: c3 ret -00000127 : +0000011d : int strcmp(const char *p, const char *q) { - 127: f3 0f 1e fb endbr32 - 12b: 55 push %ebp - 12c: 89 e5 mov %esp,%ebp - 12e: 8b 4d 08 mov 0x8(%ebp),%ecx - 131: 8b 55 0c mov 0xc(%ebp),%edx + 11d: 55 push %ebp + 11e: 89 e5 mov %esp,%ebp + 120: 8b 4d 08 mov 0x8(%ebp),%ecx + 123: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 134: 0f b6 01 movzbl (%ecx),%eax - 137: 84 c0 test %al,%al - 139: 74 11 je 14c - 13b: 38 02 cmp %al,(%edx) - 13d: 75 0d jne 14c + 126: 0f b6 01 movzbl (%ecx),%eax + 129: 84 c0 test %al,%al + 12b: 74 11 je 13e + 12d: 38 02 cmp %al,(%edx) + 12f: 75 0d jne 13e p++, q++; - 13f: 83 c1 01 add $0x1,%ecx - 142: 83 c2 01 add $0x1,%edx + 131: 83 c1 01 add $0x1,%ecx + 134: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 145: 0f b6 01 movzbl (%ecx),%eax - 148: 84 c0 test %al,%al - 14a: 75 ef jne 13b + 137: 0f b6 01 movzbl (%ecx),%eax + 13a: 84 c0 test %al,%al + 13c: 75 ef jne 12d return (uchar)*p - (uchar)*q; - 14c: 0f b6 c0 movzbl %al,%eax - 14f: 0f b6 12 movzbl (%edx),%edx - 152: 29 d0 sub %edx,%eax + 13e: 0f b6 c0 movzbl %al,%eax + 141: 0f b6 12 movzbl (%edx),%edx + 144: 29 d0 sub %edx,%eax } - 154: 5d pop %ebp - 155: c3 ret + 146: 5d pop %ebp + 147: c3 ret -00000156 : +00000148 : uint strlen(const char *s) { - 156: f3 0f 1e fb endbr32 - 15a: 55 push %ebp - 15b: 89 e5 mov %esp,%ebp - 15d: 8b 55 08 mov 0x8(%ebp),%edx + 148: 55 push %ebp + 149: 89 e5 mov %esp,%ebp + 14b: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 160: 80 3a 00 cmpb $0x0,(%edx) - 163: 74 14 je 179 - 165: b8 00 00 00 00 mov $0x0,%eax - 16a: 83 c0 01 add $0x1,%eax - 16d: 89 c1 mov %eax,%ecx - 16f: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 173: 75 f5 jne 16a + 14e: 80 3a 00 cmpb $0x0,(%edx) + 151: 74 14 je 167 + 153: b8 00 00 00 00 mov $0x0,%eax + 158: 83 c0 01 add $0x1,%eax + 15b: 89 c1 mov %eax,%ecx + 15d: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 161: 75 f5 jne 158 ; return n; } - 175: 89 c8 mov %ecx,%eax - 177: 5d pop %ebp - 178: c3 ret + 163: 89 c8 mov %ecx,%eax + 165: 5d pop %ebp + 166: c3 ret for(n = 0; s[n]; n++) - 179: b9 00 00 00 00 mov $0x0,%ecx + 167: b9 00 00 00 00 mov $0x0,%ecx return n; - 17e: eb f5 jmp 175 + 16c: eb f5 jmp 163 -00000180 : +0000016e : void* memset(void *dst, int c, uint n) { - 180: f3 0f 1e fb endbr32 - 184: 55 push %ebp - 185: 89 e5 mov %esp,%ebp - 187: 57 push %edi - 188: 8b 55 08 mov 0x8(%ebp),%edx + 16e: 55 push %ebp + 16f: 89 e5 mov %esp,%ebp + 171: 57 push %edi + 172: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 18b: 89 d7 mov %edx,%edi - 18d: 8b 4d 10 mov 0x10(%ebp),%ecx - 190: 8b 45 0c mov 0xc(%ebp),%eax - 193: fc cld - 194: f3 aa rep stos %al,%es:(%edi) + 175: 89 d7 mov %edx,%edi + 177: 8b 4d 10 mov 0x10(%ebp),%ecx + 17a: 8b 45 0c mov 0xc(%ebp),%eax + 17d: fc cld + 17e: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 196: 89 d0 mov %edx,%eax - 198: 5f pop %edi - 199: 5d pop %ebp - 19a: c3 ret + 180: 89 d0 mov %edx,%eax + 182: 8b 7d fc mov -0x4(%ebp),%edi + 185: c9 leave + 186: c3 ret -0000019b : +00000187 : char* strchr(const char *s, char c) { - 19b: f3 0f 1e fb endbr32 - 19f: 55 push %ebp - 1a0: 89 e5 mov %esp,%ebp - 1a2: 8b 45 08 mov 0x8(%ebp),%eax - 1a5: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 187: 55 push %ebp + 188: 89 e5 mov %esp,%ebp + 18a: 8b 45 08 mov 0x8(%ebp),%eax + 18d: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 1a9: 0f b6 10 movzbl (%eax),%edx - 1ac: 84 d2 test %dl,%dl - 1ae: 74 15 je 1c5 + 191: 0f b6 10 movzbl (%eax),%edx + 194: 84 d2 test %dl,%dl + 196: 74 15 je 1ad if(*s == c) - 1b0: 38 d1 cmp %dl,%cl - 1b2: 74 0f je 1c3 + 198: 38 d1 cmp %dl,%cl + 19a: 74 0f je 1ab for(; *s; s++) - 1b4: 83 c0 01 add $0x1,%eax - 1b7: 0f b6 10 movzbl (%eax),%edx - 1ba: 84 d2 test %dl,%dl - 1bc: 75 f2 jne 1b0 + 19c: 83 c0 01 add $0x1,%eax + 19f: 0f b6 10 movzbl (%eax),%edx + 1a2: 84 d2 test %dl,%dl + 1a4: 75 f2 jne 198 return (char*)s; return 0; - 1be: b8 00 00 00 00 mov $0x0,%eax + 1a6: b8 00 00 00 00 mov $0x0,%eax } - 1c3: 5d pop %ebp - 1c4: c3 ret + 1ab: 5d pop %ebp + 1ac: c3 ret return 0; - 1c5: b8 00 00 00 00 mov $0x0,%eax - 1ca: eb f7 jmp 1c3 + 1ad: b8 00 00 00 00 mov $0x0,%eax + 1b2: eb f7 jmp 1ab -000001cc : +000001b4 : char* gets(char *buf, int max) { - 1cc: f3 0f 1e fb endbr32 - 1d0: 55 push %ebp - 1d1: 89 e5 mov %esp,%ebp - 1d3: 57 push %edi - 1d4: 56 push %esi - 1d5: 53 push %ebx - 1d6: 83 ec 2c sub $0x2c,%esp - 1d9: 8b 75 08 mov 0x8(%ebp),%esi + 1b4: 55 push %ebp + 1b5: 89 e5 mov %esp,%ebp + 1b7: 57 push %edi + 1b8: 56 push %esi + 1b9: 53 push %ebx + 1ba: 83 ec 2c sub $0x2c,%esp + 1bd: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 1dc: bb 00 00 00 00 mov $0x0,%ebx + 1c0: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 1e1: 8d 7d e7 lea -0x19(%ebp),%edi + 1c5: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 1e4: 89 5d d4 mov %ebx,-0x2c(%ebp) - 1e7: 83 c3 01 add $0x1,%ebx - 1ea: 3b 5d 0c cmp 0xc(%ebp),%ebx - 1ed: 7d 27 jge 216 + 1c8: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1cb: 83 c3 01 add $0x1,%ebx + 1ce: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1d1: 7d 27 jge 1fa cc = read(0, &c, 1); - 1ef: 83 ec 04 sub $0x4,%esp - 1f2: 6a 01 push $0x1 - 1f4: 57 push %edi - 1f5: 6a 00 push $0x0 - 1f7: e8 03 01 00 00 call 2ff + 1d3: 83 ec 04 sub $0x4,%esp + 1d6: 6a 01 push $0x1 + 1d8: 57 push %edi + 1d9: 6a 00 push $0x0 + 1db: e8 f9 00 00 00 call 2d9 if(cc < 1) - 1fc: 83 c4 10 add $0x10,%esp - 1ff: 85 c0 test %eax,%eax - 201: 7e 13 jle 216 + 1e0: 83 c4 10 add $0x10,%esp + 1e3: 85 c0 test %eax,%eax + 1e5: 7e 13 jle 1fa break; buf[i++] = c; - 203: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 207: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 1e7: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 1eb: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 20b: 3c 0a cmp $0xa,%al - 20d: 74 04 je 213 - 20f: 3c 0d cmp $0xd,%al - 211: 75 d1 jne 1e4 + 1ef: 3c 0a cmp $0xa,%al + 1f1: 74 04 je 1f7 + 1f3: 3c 0d cmp $0xd,%al + 1f5: 75 d1 jne 1c8 for(i=0; i+1 < max; ){ - 213: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1f7: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 216: 8b 45 d4 mov -0x2c(%ebp),%eax - 219: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 1fa: 8b 45 d4 mov -0x2c(%ebp),%eax + 1fd: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 21d: 89 f0 mov %esi,%eax - 21f: 8d 65 f4 lea -0xc(%ebp),%esp - 222: 5b pop %ebx - 223: 5e pop %esi - 224: 5f pop %edi - 225: 5d pop %ebp - 226: c3 ret + 201: 89 f0 mov %esi,%eax + 203: 8d 65 f4 lea -0xc(%ebp),%esp + 206: 5b pop %ebx + 207: 5e pop %esi + 208: 5f pop %edi + 209: 5d pop %ebp + 20a: c3 ret -00000227 : +0000020b : int stat(const char *n, struct stat *st) { - 227: f3 0f 1e fb endbr32 - 22b: 55 push %ebp - 22c: 89 e5 mov %esp,%ebp - 22e: 56 push %esi - 22f: 53 push %ebx + 20b: 55 push %ebp + 20c: 89 e5 mov %esp,%ebp + 20e: 56 push %esi + 20f: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 230: 83 ec 08 sub $0x8,%esp - 233: 6a 00 push $0x0 - 235: ff 75 08 pushl 0x8(%ebp) - 238: e8 ea 00 00 00 call 327 + 210: 83 ec 08 sub $0x8,%esp + 213: 6a 00 push $0x0 + 215: ff 75 08 push 0x8(%ebp) + 218: e8 e4 00 00 00 call 301 if(fd < 0) - 23d: 83 c4 10 add $0x10,%esp - 240: 85 c0 test %eax,%eax - 242: 78 24 js 268 - 244: 89 c3 mov %eax,%ebx + 21d: 83 c4 10 add $0x10,%esp + 220: 85 c0 test %eax,%eax + 222: 78 24 js 248 + 224: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 246: 83 ec 08 sub $0x8,%esp - 249: ff 75 0c pushl 0xc(%ebp) - 24c: 50 push %eax - 24d: e8 ed 00 00 00 call 33f - 252: 89 c6 mov %eax,%esi + 226: 83 ec 08 sub $0x8,%esp + 229: ff 75 0c push 0xc(%ebp) + 22c: 50 push %eax + 22d: e8 e7 00 00 00 call 319 + 232: 89 c6 mov %eax,%esi close(fd); - 254: 89 1c 24 mov %ebx,(%esp) - 257: e8 b3 00 00 00 call 30f + 234: 89 1c 24 mov %ebx,(%esp) + 237: e8 ad 00 00 00 call 2e9 return r; - 25c: 83 c4 10 add $0x10,%esp + 23c: 83 c4 10 add $0x10,%esp } - 25f: 89 f0 mov %esi,%eax - 261: 8d 65 f8 lea -0x8(%ebp),%esp - 264: 5b pop %ebx - 265: 5e pop %esi - 266: 5d pop %ebp - 267: c3 ret + 23f: 89 f0 mov %esi,%eax + 241: 8d 65 f8 lea -0x8(%ebp),%esp + 244: 5b pop %ebx + 245: 5e pop %esi + 246: 5d pop %ebp + 247: c3 ret return -1; - 268: be ff ff ff ff mov $0xffffffff,%esi - 26d: eb f0 jmp 25f + 248: be ff ff ff ff mov $0xffffffff,%esi + 24d: eb f0 jmp 23f -0000026f : +0000024f : int atoi(const char *s) { - 26f: f3 0f 1e fb endbr32 - 273: 55 push %ebp - 274: 89 e5 mov %esp,%ebp - 276: 53 push %ebx - 277: 8b 55 08 mov 0x8(%ebp),%edx + 24f: 55 push %ebp + 250: 89 e5 mov %esp,%ebp + 252: 53 push %ebx + 253: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 27a: 0f b6 02 movzbl (%edx),%eax - 27d: 8d 48 d0 lea -0x30(%eax),%ecx - 280: 80 f9 09 cmp $0x9,%cl - 283: 77 22 ja 2a7 + 256: 0f b6 02 movzbl (%edx),%eax + 259: 8d 48 d0 lea -0x30(%eax),%ecx + 25c: 80 f9 09 cmp $0x9,%cl + 25f: 77 24 ja 285 n = 0; - 285: b9 00 00 00 00 mov $0x0,%ecx + 261: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 28a: 83 c2 01 add $0x1,%edx - 28d: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 290: 0f be c0 movsbl %al,%eax - 293: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 266: 83 c2 01 add $0x1,%edx + 269: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 26c: 0f be c0 movsbl %al,%eax + 26f: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 297: 0f b6 02 movzbl (%edx),%eax - 29a: 8d 58 d0 lea -0x30(%eax),%ebx - 29d: 80 fb 09 cmp $0x9,%bl - 2a0: 76 e8 jbe 28a + 273: 0f b6 02 movzbl (%edx),%eax + 276: 8d 58 d0 lea -0x30(%eax),%ebx + 279: 80 fb 09 cmp $0x9,%bl + 27c: 76 e8 jbe 266 return n; } - 2a2: 89 c8 mov %ecx,%eax - 2a4: 5b pop %ebx - 2a5: 5d pop %ebp - 2a6: c3 ret + 27e: 89 c8 mov %ecx,%eax + 280: 8b 5d fc mov -0x4(%ebp),%ebx + 283: c9 leave + 284: c3 ret n = 0; - 2a7: b9 00 00 00 00 mov $0x0,%ecx + 285: b9 00 00 00 00 mov $0x0,%ecx return n; - 2ac: eb f4 jmp 2a2 + 28a: eb f2 jmp 27e -000002ae : +0000028c : void* memmove(void *vdst, const void *vsrc, int n) { - 2ae: f3 0f 1e fb endbr32 - 2b2: 55 push %ebp - 2b3: 89 e5 mov %esp,%ebp - 2b5: 56 push %esi - 2b6: 53 push %ebx - 2b7: 8b 75 08 mov 0x8(%ebp),%esi - 2ba: 8b 55 0c mov 0xc(%ebp),%edx - 2bd: 8b 5d 10 mov 0x10(%ebp),%ebx + 28c: 55 push %ebp + 28d: 89 e5 mov %esp,%ebp + 28f: 56 push %esi + 290: 53 push %ebx + 291: 8b 75 08 mov 0x8(%ebp),%esi + 294: 8b 55 0c mov 0xc(%ebp),%edx + 297: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 2c0: 85 db test %ebx,%ebx - 2c2: 7e 15 jle 2d9 - 2c4: 01 f3 add %esi,%ebx + 29a: 85 db test %ebx,%ebx + 29c: 7e 15 jle 2b3 + 29e: 01 f3 add %esi,%ebx dst = vdst; - 2c6: 89 f0 mov %esi,%eax + 2a0: 89 f0 mov %esi,%eax *dst++ = *src++; - 2c8: 83 c2 01 add $0x1,%edx - 2cb: 83 c0 01 add $0x1,%eax - 2ce: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 2d2: 88 48 ff mov %cl,-0x1(%eax) + 2a2: 83 c2 01 add $0x1,%edx + 2a5: 83 c0 01 add $0x1,%eax + 2a8: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 2ac: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 2d5: 39 c3 cmp %eax,%ebx - 2d7: 75 ef jne 2c8 + 2af: 39 c3 cmp %eax,%ebx + 2b1: 75 ef jne 2a2 return vdst; } - 2d9: 89 f0 mov %esi,%eax - 2db: 5b pop %ebx - 2dc: 5e pop %esi - 2dd: 5d pop %ebp - 2de: c3 ret + 2b3: 89 f0 mov %esi,%eax + 2b5: 5b pop %ebx + 2b6: 5e pop %esi + 2b7: 5d pop %ebp + 2b8: c3 ret -000002df : +000002b9 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 2df: b8 01 00 00 00 mov $0x1,%eax - 2e4: cd 40 int $0x40 - 2e6: c3 ret + 2b9: b8 01 00 00 00 mov $0x1,%eax + 2be: cd 40 int $0x40 + 2c0: c3 ret -000002e7 : +000002c1 : SYSCALL(exit) - 2e7: b8 02 00 00 00 mov $0x2,%eax - 2ec: cd 40 int $0x40 - 2ee: c3 ret + 2c1: b8 02 00 00 00 mov $0x2,%eax + 2c6: cd 40 int $0x40 + 2c8: c3 ret -000002ef : +000002c9 : SYSCALL(wait) - 2ef: b8 03 00 00 00 mov $0x3,%eax - 2f4: cd 40 int $0x40 - 2f6: c3 ret + 2c9: b8 03 00 00 00 mov $0x3,%eax + 2ce: cd 40 int $0x40 + 2d0: c3 ret -000002f7 : +000002d1 : SYSCALL(pipe) - 2f7: b8 04 00 00 00 mov $0x4,%eax - 2fc: cd 40 int $0x40 - 2fe: c3 ret + 2d1: b8 04 00 00 00 mov $0x4,%eax + 2d6: cd 40 int $0x40 + 2d8: c3 ret -000002ff : +000002d9 : SYSCALL(read) - 2ff: b8 05 00 00 00 mov $0x5,%eax - 304: cd 40 int $0x40 - 306: c3 ret + 2d9: b8 05 00 00 00 mov $0x5,%eax + 2de: cd 40 int $0x40 + 2e0: c3 ret -00000307 : +000002e1 : SYSCALL(write) - 307: b8 10 00 00 00 mov $0x10,%eax - 30c: cd 40 int $0x40 - 30e: c3 ret + 2e1: b8 10 00 00 00 mov $0x10,%eax + 2e6: cd 40 int $0x40 + 2e8: c3 ret -0000030f : +000002e9 : SYSCALL(close) - 30f: b8 15 00 00 00 mov $0x15,%eax - 314: cd 40 int $0x40 - 316: c3 ret + 2e9: b8 15 00 00 00 mov $0x15,%eax + 2ee: cd 40 int $0x40 + 2f0: c3 ret -00000317 : +000002f1 : SYSCALL(kill) - 317: b8 06 00 00 00 mov $0x6,%eax - 31c: cd 40 int $0x40 - 31e: c3 ret + 2f1: b8 06 00 00 00 mov $0x6,%eax + 2f6: cd 40 int $0x40 + 2f8: c3 ret -0000031f : +000002f9 : SYSCALL(exec) - 31f: b8 07 00 00 00 mov $0x7,%eax - 324: cd 40 int $0x40 - 326: c3 ret + 2f9: b8 07 00 00 00 mov $0x7,%eax + 2fe: cd 40 int $0x40 + 300: c3 ret -00000327 : +00000301 : SYSCALL(open) - 327: b8 0f 00 00 00 mov $0xf,%eax - 32c: cd 40 int $0x40 - 32e: c3 ret + 301: b8 0f 00 00 00 mov $0xf,%eax + 306: cd 40 int $0x40 + 308: c3 ret -0000032f : +00000309 : SYSCALL(mknod) - 32f: b8 11 00 00 00 mov $0x11,%eax - 334: cd 40 int $0x40 - 336: c3 ret + 309: b8 11 00 00 00 mov $0x11,%eax + 30e: cd 40 int $0x40 + 310: c3 ret -00000337 : +00000311 : SYSCALL(unlink) - 337: b8 12 00 00 00 mov $0x12,%eax - 33c: cd 40 int $0x40 - 33e: c3 ret + 311: b8 12 00 00 00 mov $0x12,%eax + 316: cd 40 int $0x40 + 318: c3 ret -0000033f : +00000319 : SYSCALL(fstat) - 33f: b8 08 00 00 00 mov $0x8,%eax - 344: cd 40 int $0x40 - 346: c3 ret + 319: b8 08 00 00 00 mov $0x8,%eax + 31e: cd 40 int $0x40 + 320: c3 ret -00000347 : +00000321 : SYSCALL(link) - 347: b8 13 00 00 00 mov $0x13,%eax - 34c: cd 40 int $0x40 - 34e: c3 ret + 321: b8 13 00 00 00 mov $0x13,%eax + 326: cd 40 int $0x40 + 328: c3 ret -0000034f : +00000329 : SYSCALL(mkdir) - 34f: b8 14 00 00 00 mov $0x14,%eax - 354: cd 40 int $0x40 - 356: c3 ret + 329: b8 14 00 00 00 mov $0x14,%eax + 32e: cd 40 int $0x40 + 330: c3 ret -00000357 : +00000331 : SYSCALL(chdir) - 357: b8 09 00 00 00 mov $0x9,%eax - 35c: cd 40 int $0x40 - 35e: c3 ret + 331: b8 09 00 00 00 mov $0x9,%eax + 336: cd 40 int $0x40 + 338: c3 ret -0000035f : +00000339 : SYSCALL(dup) - 35f: b8 0a 00 00 00 mov $0xa,%eax - 364: cd 40 int $0x40 - 366: c3 ret + 339: b8 0a 00 00 00 mov $0xa,%eax + 33e: cd 40 int $0x40 + 340: c3 ret -00000367 : +00000341 : SYSCALL(getpid) - 367: b8 0b 00 00 00 mov $0xb,%eax - 36c: cd 40 int $0x40 - 36e: c3 ret + 341: b8 0b 00 00 00 mov $0xb,%eax + 346: cd 40 int $0x40 + 348: c3 ret -0000036f : +00000349 : SYSCALL(sbrk) - 36f: b8 0c 00 00 00 mov $0xc,%eax - 374: cd 40 int $0x40 - 376: c3 ret + 349: b8 0c 00 00 00 mov $0xc,%eax + 34e: cd 40 int $0x40 + 350: c3 ret -00000377 : +00000351 : SYSCALL(sleep) - 377: b8 0d 00 00 00 mov $0xd,%eax - 37c: cd 40 int $0x40 - 37e: c3 ret + 351: b8 0d 00 00 00 mov $0xd,%eax + 356: cd 40 int $0x40 + 358: c3 ret -0000037f : +00000359 : SYSCALL(uptime) - 37f: b8 0e 00 00 00 mov $0xe,%eax - 384: cd 40 int $0x40 - 386: c3 ret + 359: b8 0e 00 00 00 mov $0xe,%eax + 35e: cd 40 int $0x40 + 360: c3 ret -00000387 : +00000361 : SYSCALL(slabtest) - 387: b8 16 00 00 00 mov $0x16,%eax - 38c: cd 40 int $0x40 - 38e: c3 ret + 361: b8 16 00 00 00 mov $0x16,%eax + 366: cd 40 int $0x40 + 368: c3 ret -0000038f : +00000369 : SYSCALL(ps) - 38f: b8 17 00 00 00 mov $0x17,%eax - 394: cd 40 int $0x40 - 396: c3 ret + 369: b8 17 00 00 00 mov $0x17,%eax + 36e: cd 40 int $0x40 + 370: c3 ret -00000397 : +00000371 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 397: 55 push %ebp - 398: 89 e5 mov %esp,%ebp - 39a: 57 push %edi - 39b: 56 push %esi - 39c: 53 push %ebx - 39d: 83 ec 3c sub $0x3c,%esp - 3a0: 89 45 c4 mov %eax,-0x3c(%ebp) - 3a3: 89 d3 mov %edx,%ebx + 371: 55 push %ebp + 372: 89 e5 mov %esp,%ebp + 374: 57 push %edi + 375: 56 push %esi + 376: 53 push %ebx + 377: 83 ec 3c sub $0x3c,%esp + 37a: 89 45 c4 mov %eax,-0x3c(%ebp) + 37d: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 3a5: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 3a9: 74 77 je 422 - 3ab: 85 d2 test %edx,%edx - 3ad: 79 73 jns 422 + 37f: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 383: 74 79 je 3fe + 385: 85 d2 test %edx,%edx + 387: 79 75 jns 3fe neg = 1; x = -xx; - 3af: f7 db neg %ebx + 389: 89 d1 mov %edx,%ecx + 38b: f7 d9 neg %ecx neg = 1; - 3b1: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 38d: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 3b8: be 00 00 00 00 mov $0x0,%esi + 394: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 3bd: 89 f7 mov %esi,%edi - 3bf: 83 c6 01 add $0x1,%esi - 3c2: 89 d8 mov %ebx,%eax - 3c4: ba 00 00 00 00 mov $0x0,%edx - 3c9: f7 f1 div %ecx - 3cb: 0f b6 92 84 07 00 00 movzbl 0x784(%edx),%edx - 3d2: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 399: 89 df mov %ebx,%edi + 39b: 83 c3 01 add $0x1,%ebx + 39e: 89 c8 mov %ecx,%eax + 3a0: ba 00 00 00 00 mov $0x0,%edx + 3a5: f7 f6 div %esi + 3a7: 0f b6 92 98 07 00 00 movzbl 0x798(%edx),%edx + 3ae: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 3d6: 89 da mov %ebx,%edx - 3d8: 89 c3 mov %eax,%ebx - 3da: 39 d1 cmp %edx,%ecx - 3dc: 76 df jbe 3bd + 3b2: 89 ca mov %ecx,%edx + 3b4: 89 c1 mov %eax,%ecx + 3b6: 39 d6 cmp %edx,%esi + 3b8: 76 df jbe 399 if(neg) - 3de: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 3e2: 74 08 je 3ec + 3ba: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 3be: 74 08 je 3c8 buf[i++] = '-'; - 3e4: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 3e9: 8d 77 02 lea 0x2(%edi),%esi + 3c0: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 3c5: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 3ec: 85 f6 test %esi,%esi - 3ee: 7e 2a jle 41a - 3f0: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 3f4: 8d 7d d8 lea -0x28(%ebp),%edi + 3c8: 85 db test %ebx,%ebx + 3ca: 7e 2a jle 3f6 + 3cc: 8d 7d d8 lea -0x28(%ebp),%edi + 3cf: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 3f7: 8d 75 d7 lea -0x29(%ebp),%esi + 3d3: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 3fa: 0f b6 03 movzbl (%ebx),%eax - 3fd: 88 45 d7 mov %al,-0x29(%ebp) + 3d6: 0f b6 03 movzbl (%ebx),%eax + 3d9: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 400: 83 ec 04 sub $0x4,%esp - 403: 6a 01 push $0x1 - 405: 56 push %esi - 406: ff 75 c4 pushl -0x3c(%ebp) - 409: e8 f9 fe ff ff call 307 + 3dc: 83 ec 04 sub $0x4,%esp + 3df: 6a 01 push $0x1 + 3e1: 56 push %esi + 3e2: ff 75 c4 push -0x3c(%ebp) + 3e5: e8 f7 fe ff ff call 2e1 while(--i >= 0) - 40e: 89 d8 mov %ebx,%eax - 410: 83 eb 01 sub $0x1,%ebx - 413: 83 c4 10 add $0x10,%esp - 416: 39 f8 cmp %edi,%eax - 418: 75 e0 jne 3fa + 3ea: 89 d8 mov %ebx,%eax + 3ec: 83 eb 01 sub $0x1,%ebx + 3ef: 83 c4 10 add $0x10,%esp + 3f2: 39 f8 cmp %edi,%eax + 3f4: 75 e0 jne 3d6 } - 41a: 8d 65 f4 lea -0xc(%ebp),%esp - 41d: 5b pop %ebx - 41e: 5e pop %esi - 41f: 5f pop %edi - 420: 5d pop %ebp - 421: c3 ret + 3f6: 8d 65 f4 lea -0xc(%ebp),%esp + 3f9: 5b pop %ebx + 3fa: 5e pop %esi + 3fb: 5f pop %edi + 3fc: 5d pop %ebp + 3fd: c3 ret + x = xx; + 3fe: 89 d1 mov %edx,%ecx neg = 0; - 422: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 429: eb 8d jmp 3b8 + 400: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 407: eb 8b jmp 394 -0000042b : +00000409 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 42b: f3 0f 1e fb endbr32 - 42f: 55 push %ebp - 430: 89 e5 mov %esp,%ebp - 432: 57 push %edi - 433: 56 push %esi - 434: 53 push %ebx - 435: 83 ec 2c sub $0x2c,%esp + 409: 55 push %ebp + 40a: 89 e5 mov %esp,%ebp + 40c: 57 push %edi + 40d: 56 push %esi + 40e: 53 push %ebx + 40f: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 438: 8b 75 0c mov 0xc(%ebp),%esi - 43b: 0f b6 1e movzbl (%esi),%ebx - 43e: 84 db test %bl,%bl - 440: 0f 84 ab 01 00 00 je 5f1 - 446: 83 c6 01 add $0x1,%esi + 412: 8b 75 0c mov 0xc(%ebp),%esi + 415: 0f b6 1e movzbl (%esi),%ebx + 418: 84 db test %bl,%bl + 41a: 0f 84 9f 01 00 00 je 5bf + 420: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 449: 8d 45 10 lea 0x10(%ebp),%eax - 44c: 89 45 d4 mov %eax,-0x2c(%ebp) + 423: 8d 45 10 lea 0x10(%ebp),%eax + 426: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 44f: bf 00 00 00 00 mov $0x0,%edi - 454: eb 2d jmp 483 + 429: bf 00 00 00 00 mov $0x0,%edi + 42e: eb 2d jmp 45d c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 456: 88 5d e7 mov %bl,-0x19(%ebp) + 430: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 459: 83 ec 04 sub $0x4,%esp - 45c: 6a 01 push $0x1 - 45e: 8d 45 e7 lea -0x19(%ebp),%eax - 461: 50 push %eax - 462: ff 75 08 pushl 0x8(%ebp) - 465: e8 9d fe ff ff call 307 + 433: 83 ec 04 sub $0x4,%esp + 436: 6a 01 push $0x1 + 438: 8d 45 e7 lea -0x19(%ebp),%eax + 43b: 50 push %eax + 43c: ff 75 08 push 0x8(%ebp) + 43f: e8 9d fe ff ff call 2e1 putc(fd, c); - 46a: 83 c4 10 add $0x10,%esp - 46d: eb 05 jmp 474 + 444: 83 c4 10 add $0x10,%esp + 447: eb 05 jmp 44e } } else if(state == '%'){ - 46f: 83 ff 25 cmp $0x25,%edi - 472: 74 22 je 496 + 449: 83 ff 25 cmp $0x25,%edi + 44c: 74 1f je 46d for(i = 0; fmt[i]; i++){ - 474: 83 c6 01 add $0x1,%esi - 477: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 47b: 84 db test %bl,%bl - 47d: 0f 84 6e 01 00 00 je 5f1 + 44e: 83 c6 01 add $0x1,%esi + 451: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 455: 84 db test %bl,%bl + 457: 0f 84 62 01 00 00 je 5bf c = fmt[i] & 0xff; - 483: 0f be d3 movsbl %bl,%edx - 486: 0f b6 c3 movzbl %bl,%eax + 45d: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 489: 85 ff test %edi,%edi - 48b: 75 e2 jne 46f + 460: 85 ff test %edi,%edi + 462: 75 e5 jne 449 if(c == '%'){ - 48d: 83 f8 25 cmp $0x25,%eax - 490: 75 c4 jne 456 + 464: 83 f8 25 cmp $0x25,%eax + 467: 75 c7 jne 430 state = '%'; - 492: 89 c7 mov %eax,%edi - 494: eb de jmp 474 + 469: 89 c7 mov %eax,%edi + 46b: eb e1 jmp 44e if(c == 'd'){ - 496: 83 f8 64 cmp $0x64,%eax - 499: 74 59 je 4f4 + 46d: 83 f8 25 cmp $0x25,%eax + 470: 0f 84 f2 00 00 00 je 568 + 476: 8d 50 9d lea -0x63(%eax),%edx + 479: 83 fa 15 cmp $0x15,%edx + 47c: 0f 87 07 01 00 00 ja 589 + 482: 0f 87 01 01 00 00 ja 589 + 488: ff 24 95 40 07 00 00 jmp *0x740(,%edx,4) printint(fd, *ap, 10, 1); + 48f: 83 ec 0c sub $0xc,%esp + 492: 6a 01 push $0x1 + 494: b9 0a 00 00 00 mov $0xa,%ecx + 499: 8b 7d d4 mov -0x2c(%ebp),%edi + 49c: 8b 17 mov (%edi),%edx + 49e: 8b 45 08 mov 0x8(%ebp),%eax + 4a1: e8 cb fe ff ff call 371 ap++; - } else if(c == 'x' || c == 'p'){ - 49b: 81 e2 f7 00 00 00 and $0xf7,%edx - 4a1: 83 fa 70 cmp $0x70,%edx - 4a4: 74 7a je 520 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 4a6: 83 f8 73 cmp $0x73,%eax - 4a9: 0f 84 9d 00 00 00 je 54c - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 4af: 83 f8 63 cmp $0x63,%eax - 4b2: 0f 84 ec 00 00 00 je 5a4 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 4b8: 83 f8 25 cmp $0x25,%eax - 4bb: 0f 84 0f 01 00 00 je 5d0 - putc(fd, c); + 4a6: 89 f8 mov %edi,%eax + 4a8: 83 c0 04 add $0x4,%eax + 4ab: 89 45 d4 mov %eax,-0x2c(%ebp) + 4ae: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 4c1: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 4c5: 83 ec 04 sub $0x4,%esp - 4c8: 6a 01 push $0x1 - 4ca: 8d 45 e7 lea -0x19(%ebp),%eax - 4cd: 50 push %eax - 4ce: ff 75 08 pushl 0x8(%ebp) - 4d1: e8 31 fe ff ff call 307 - putc(fd, c); - 4d6: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 4d9: 83 c4 0c add $0xc,%esp - 4dc: 6a 01 push $0x1 - 4de: 8d 45 e7 lea -0x19(%ebp),%eax - 4e1: 50 push %eax - 4e2: ff 75 08 pushl 0x8(%ebp) - 4e5: e8 1d fe ff ff call 307 putc(fd, c); - 4ea: 83 c4 10 add $0x10,%esp } state = 0; - 4ed: bf 00 00 00 00 mov $0x0,%edi - 4f2: eb 80 jmp 474 - printint(fd, *ap, 10, 1); - 4f4: 83 ec 0c sub $0xc,%esp - 4f7: 6a 01 push $0x1 - 4f9: b9 0a 00 00 00 mov $0xa,%ecx - 4fe: 8b 7d d4 mov -0x2c(%ebp),%edi - 501: 8b 17 mov (%edi),%edx - 503: 8b 45 08 mov 0x8(%ebp),%eax - 506: e8 8c fe ff ff call 397 - ap++; - 50b: 89 f8 mov %edi,%eax - 50d: 83 c0 04 add $0x4,%eax - 510: 89 45 d4 mov %eax,-0x2c(%ebp) - 513: 83 c4 10 add $0x10,%esp - state = 0; - 516: bf 00 00 00 00 mov $0x0,%edi - 51b: e9 54 ff ff ff jmp 474 + 4b1: bf 00 00 00 00 mov $0x0,%edi + 4b6: eb 96 jmp 44e printint(fd, *ap, 16, 0); - 520: 83 ec 0c sub $0xc,%esp - 523: 6a 00 push $0x0 - 525: b9 10 00 00 00 mov $0x10,%ecx - 52a: 8b 7d d4 mov -0x2c(%ebp),%edi - 52d: 8b 17 mov (%edi),%edx - 52f: 8b 45 08 mov 0x8(%ebp),%eax - 532: e8 60 fe ff ff call 397 + 4b8: 83 ec 0c sub $0xc,%esp + 4bb: 6a 00 push $0x0 + 4bd: b9 10 00 00 00 mov $0x10,%ecx + 4c2: 8b 7d d4 mov -0x2c(%ebp),%edi + 4c5: 8b 17 mov (%edi),%edx + 4c7: 8b 45 08 mov 0x8(%ebp),%eax + 4ca: e8 a2 fe ff ff call 371 ap++; - 537: 89 f8 mov %edi,%eax - 539: 83 c0 04 add $0x4,%eax - 53c: 89 45 d4 mov %eax,-0x2c(%ebp) - 53f: 83 c4 10 add $0x10,%esp + 4cf: 89 f8 mov %edi,%eax + 4d1: 83 c0 04 add $0x4,%eax + 4d4: 89 45 d4 mov %eax,-0x2c(%ebp) + 4d7: 83 c4 10 add $0x10,%esp state = 0; - 542: bf 00 00 00 00 mov $0x0,%edi - 547: e9 28 ff ff ff jmp 474 + 4da: bf 00 00 00 00 mov $0x0,%edi + 4df: e9 6a ff ff ff jmp 44e s = (char*)*ap; - 54c: 8b 4d d4 mov -0x2c(%ebp),%ecx - 54f: 8b 01 mov (%ecx),%eax + 4e4: 8b 4d d4 mov -0x2c(%ebp),%ecx + 4e7: 8b 01 mov (%ecx),%eax ap++; - 551: 83 c1 04 add $0x4,%ecx - 554: 89 4d d4 mov %ecx,-0x2c(%ebp) + 4e9: 83 c1 04 add $0x4,%ecx + 4ec: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 557: 85 c0 test %eax,%eax - 559: 74 13 je 56e + 4ef: 85 c0 test %eax,%eax + 4f1: 74 13 je 506 s = (char*)*ap; - 55b: 89 c3 mov %eax,%ebx + 4f3: 89 c3 mov %eax,%ebx while(*s != 0){ - 55d: 0f b6 00 movzbl (%eax),%eax + 4f5: 0f b6 00 movzbl (%eax),%eax state = 0; - 560: bf 00 00 00 00 mov $0x0,%edi + 4f8: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 565: 84 c0 test %al,%al - 567: 75 0f jne 578 - 569: e9 06 ff ff ff jmp 474 + 4fd: 84 c0 test %al,%al + 4ff: 75 0f jne 510 + 501: e9 48 ff ff ff jmp 44e s = "(null)"; - 56e: bb 7c 07 00 00 mov $0x77c,%ebx + 506: bb 38 07 00 00 mov $0x738,%ebx while(*s != 0){ - 573: b8 28 00 00 00 mov $0x28,%eax - 578: 8b 7d 08 mov 0x8(%ebp),%edi + 50b: b8 28 00 00 00 mov $0x28,%eax + 510: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 57b: 88 45 e7 mov %al,-0x19(%ebp) + 513: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 57e: 83 ec 04 sub $0x4,%esp - 581: 6a 01 push $0x1 - 583: 8d 45 e7 lea -0x19(%ebp),%eax - 586: 50 push %eax - 587: 57 push %edi - 588: e8 7a fd ff ff call 307 + 516: 83 ec 04 sub $0x4,%esp + 519: 6a 01 push $0x1 + 51b: 8d 45 e7 lea -0x19(%ebp),%eax + 51e: 50 push %eax + 51f: 57 push %edi + 520: e8 bc fd ff ff call 2e1 s++; - 58d: 83 c3 01 add $0x1,%ebx + 525: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 590: 0f b6 03 movzbl (%ebx),%eax - 593: 83 c4 10 add $0x10,%esp - 596: 84 c0 test %al,%al - 598: 75 e1 jne 57b + 528: 0f b6 03 movzbl (%ebx),%eax + 52b: 83 c4 10 add $0x10,%esp + 52e: 84 c0 test %al,%al + 530: 75 e1 jne 513 state = 0; - 59a: bf 00 00 00 00 mov $0x0,%edi - 59f: e9 d0 fe ff ff jmp 474 + 532: bf 00 00 00 00 mov $0x0,%edi + 537: e9 12 ff ff ff jmp 44e putc(fd, *ap); - 5a4: 8b 7d d4 mov -0x2c(%ebp),%edi - 5a7: 8b 07 mov (%edi),%eax - 5a9: 88 45 e7 mov %al,-0x19(%ebp) + 53c: 8b 7d d4 mov -0x2c(%ebp),%edi + 53f: 8b 07 mov (%edi),%eax + 541: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 5ac: 83 ec 04 sub $0x4,%esp - 5af: 6a 01 push $0x1 - 5b1: 8d 45 e7 lea -0x19(%ebp),%eax - 5b4: 50 push %eax - 5b5: ff 75 08 pushl 0x8(%ebp) - 5b8: e8 4a fd ff ff call 307 + 544: 83 ec 04 sub $0x4,%esp + 547: 6a 01 push $0x1 + 549: 8d 45 e7 lea -0x19(%ebp),%eax + 54c: 50 push %eax + 54d: ff 75 08 push 0x8(%ebp) + 550: e8 8c fd ff ff call 2e1 ap++; - 5bd: 83 c7 04 add $0x4,%edi - 5c0: 89 7d d4 mov %edi,-0x2c(%ebp) - 5c3: 83 c4 10 add $0x10,%esp + 555: 83 c7 04 add $0x4,%edi + 558: 89 7d d4 mov %edi,-0x2c(%ebp) + 55b: 83 c4 10 add $0x10,%esp state = 0; - 5c6: bf 00 00 00 00 mov $0x0,%edi - 5cb: e9 a4 fe ff ff jmp 474 + 55e: bf 00 00 00 00 mov $0x0,%edi + 563: e9 e6 fe ff ff jmp 44e putc(fd, c); - 5d0: 88 5d e7 mov %bl,-0x19(%ebp) + 568: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 5d3: 83 ec 04 sub $0x4,%esp - 5d6: 6a 01 push $0x1 - 5d8: 8d 45 e7 lea -0x19(%ebp),%eax - 5db: 50 push %eax - 5dc: ff 75 08 pushl 0x8(%ebp) - 5df: e8 23 fd ff ff call 307 - 5e4: 83 c4 10 add $0x10,%esp + 56b: 83 ec 04 sub $0x4,%esp + 56e: 6a 01 push $0x1 + 570: 8d 45 e7 lea -0x19(%ebp),%eax + 573: 50 push %eax + 574: ff 75 08 push 0x8(%ebp) + 577: e8 65 fd ff ff call 2e1 + 57c: 83 c4 10 add $0x10,%esp + state = 0; + 57f: bf 00 00 00 00 mov $0x0,%edi + 584: e9 c5 fe ff ff jmp 44e + putc(fd, '%'); + 589: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 58d: 83 ec 04 sub $0x4,%esp + 590: 6a 01 push $0x1 + 592: 8d 45 e7 lea -0x19(%ebp),%eax + 595: 50 push %eax + 596: ff 75 08 push 0x8(%ebp) + 599: e8 43 fd ff ff call 2e1 + putc(fd, c); + 59e: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 5a1: 83 c4 0c add $0xc,%esp + 5a4: 6a 01 push $0x1 + 5a6: 8d 45 e7 lea -0x19(%ebp),%eax + 5a9: 50 push %eax + 5aa: ff 75 08 push 0x8(%ebp) + 5ad: e8 2f fd ff ff call 2e1 + putc(fd, c); + 5b2: 83 c4 10 add $0x10,%esp state = 0; - 5e7: bf 00 00 00 00 mov $0x0,%edi - 5ec: e9 83 fe ff ff jmp 474 + 5b5: bf 00 00 00 00 mov $0x0,%edi + 5ba: e9 8f fe ff ff jmp 44e } } } - 5f1: 8d 65 f4 lea -0xc(%ebp),%esp - 5f4: 5b pop %ebx - 5f5: 5e pop %esi - 5f6: 5f pop %edi - 5f7: 5d pop %ebp - 5f8: c3 ret - -000005f9 : + 5bf: 8d 65 f4 lea -0xc(%ebp),%esp + 5c2: 5b pop %ebx + 5c3: 5e pop %esi + 5c4: 5f pop %edi + 5c5: 5d pop %ebp + 5c6: c3 ret + +000005c7 : static Header base; static Header *freep; void free(void *ap) { - 5f9: f3 0f 1e fb endbr32 - 5fd: 55 push %ebp - 5fe: 89 e5 mov %esp,%ebp - 600: 57 push %edi - 601: 56 push %esi - 602: 53 push %ebx - 603: 8b 5d 08 mov 0x8(%ebp),%ebx + 5c7: 55 push %ebp + 5c8: 89 e5 mov %esp,%ebp + 5ca: 57 push %edi + 5cb: 56 push %esi + 5cc: 53 push %ebx + 5cd: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 606: 8d 4b f8 lea -0x8(%ebx),%ecx + 5d0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 609: a1 40 0a 00 00 mov 0xa40,%eax - 60e: eb 0c jmp 61c + 5d3: a1 40 0c 00 00 mov 0xc40,%eax + 5d8: eb 0c jmp 5e6 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 610: 8b 10 mov (%eax),%edx - 612: 39 c2 cmp %eax,%edx - 614: 77 04 ja 61a - 616: 39 ca cmp %ecx,%edx - 618: 77 10 ja 62a + 5da: 8b 10 mov (%eax),%edx + 5dc: 39 c2 cmp %eax,%edx + 5de: 77 04 ja 5e4 + 5e0: 39 ca cmp %ecx,%edx + 5e2: 77 10 ja 5f4 { - 61a: 89 d0 mov %edx,%eax + 5e4: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 61c: 39 c8 cmp %ecx,%eax - 61e: 73 f0 jae 610 - 620: 8b 10 mov (%eax),%edx - 622: 39 ca cmp %ecx,%edx - 624: 77 04 ja 62a + 5e6: 39 c8 cmp %ecx,%eax + 5e8: 73 f0 jae 5da + 5ea: 8b 10 mov (%eax),%edx + 5ec: 39 ca cmp %ecx,%edx + 5ee: 77 04 ja 5f4 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 626: 39 c2 cmp %eax,%edx - 628: 77 f0 ja 61a + 5f0: 39 c2 cmp %eax,%edx + 5f2: 77 f0 ja 5e4 break; if(bp + bp->s.size == p->s.ptr){ - 62a: 8b 73 fc mov -0x4(%ebx),%esi - 62d: 8b 10 mov (%eax),%edx - 62f: 8d 3c f1 lea (%ecx,%esi,8),%edi - 632: 39 fa cmp %edi,%edx - 634: 74 19 je 64f + 5f4: 8b 73 fc mov -0x4(%ebx),%esi + 5f7: 8b 10 mov (%eax),%edx + 5f9: 8d 3c f1 lea (%ecx,%esi,8),%edi + 5fc: 39 fa cmp %edi,%edx + 5fe: 74 19 je 619 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 600: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 636: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 639: 8b 50 04 mov 0x4(%eax),%edx - 63c: 8d 34 d0 lea (%eax,%edx,8),%esi - 63f: 39 f1 cmp %esi,%ecx - 641: 74 1b je 65e + 603: 8b 50 04 mov 0x4(%eax),%edx + 606: 8d 34 d0 lea (%eax,%edx,8),%esi + 609: 39 f1 cmp %esi,%ecx + 60b: 74 18 je 625 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 60d: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 643: 89 08 mov %ecx,(%eax) freep = p; - 645: a3 40 0a 00 00 mov %eax,0xa40 + 60f: a3 40 0c 00 00 mov %eax,0xc40 } - 64a: 5b pop %ebx - 64b: 5e pop %esi - 64c: 5f pop %edi - 64d: 5d pop %ebp - 64e: c3 ret + 614: 5b pop %ebx + 615: 5e pop %esi + 616: 5f pop %edi + 617: 5d pop %ebp + 618: c3 ret bp->s.size += p->s.ptr->s.size; - 64f: 03 72 04 add 0x4(%edx),%esi - 652: 89 73 fc mov %esi,-0x4(%ebx) + 619: 03 72 04 add 0x4(%edx),%esi + 61c: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 655: 8b 10 mov (%eax),%edx - 657: 8b 12 mov (%edx),%edx - 659: 89 53 f8 mov %edx,-0x8(%ebx) - 65c: eb db jmp 639 + 61f: 8b 10 mov (%eax),%edx + 621: 8b 12 mov (%edx),%edx + 623: eb db jmp 600 p->s.size += bp->s.size; - 65e: 03 53 fc add -0x4(%ebx),%edx - 661: 89 50 04 mov %edx,0x4(%eax) + 625: 03 53 fc add -0x4(%ebx),%edx + 628: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 664: 8b 53 f8 mov -0x8(%ebx),%edx - 667: 89 10 mov %edx,(%eax) - 669: eb da jmp 645 + 62b: 8b 4b f8 mov -0x8(%ebx),%ecx + 62e: eb dd jmp 60d -0000066b : +00000630 : return freep; } void* malloc(uint nbytes) { - 66b: f3 0f 1e fb endbr32 - 66f: 55 push %ebp - 670: 89 e5 mov %esp,%ebp - 672: 57 push %edi - 673: 56 push %esi - 674: 53 push %ebx - 675: 83 ec 0c sub $0xc,%esp + 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 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 678: 8b 45 08 mov 0x8(%ebp),%eax - 67b: 8d 58 07 lea 0x7(%eax),%ebx - 67e: c1 eb 03 shr $0x3,%ebx - 681: 83 c3 01 add $0x1,%ebx + 639: 8b 45 08 mov 0x8(%ebp),%eax + 63c: 8d 58 07 lea 0x7(%eax),%ebx + 63f: c1 eb 03 shr $0x3,%ebx + 642: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 684: 8b 15 40 0a 00 00 mov 0xa40,%edx - 68a: 85 d2 test %edx,%edx - 68c: 74 20 je 6ae + 645: 8b 15 40 0c 00 00 mov 0xc40,%edx + 64b: 85 d2 test %edx,%edx + 64d: 74 1c je 66b base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 68e: 8b 02 mov (%edx),%eax + 64f: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 690: 8b 48 04 mov 0x4(%eax),%ecx - 693: 39 cb cmp %ecx,%ebx - 695: 76 3c jbe 6d3 - 697: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 69d: be 00 10 00 00 mov $0x1000,%esi - 6a2: 0f 43 f3 cmovae %ebx,%esi + 651: 8b 48 04 mov 0x4(%eax),%ecx + 654: 39 cb cmp %ecx,%ebx + 656: 76 38 jbe 690 + 658: be 00 10 00 00 mov $0x1000,%esi + 65d: 39 f3 cmp %esi,%ebx + 65f: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 6a5: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 6ac: eb 72 jmp 720 + 662: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 669: eb 72 jmp 6dd base.s.ptr = freep = prevp = &base; - 6ae: c7 05 40 0a 00 00 44 movl $0xa44,0xa40 - 6b5: 0a 00 00 - 6b8: c7 05 44 0a 00 00 44 movl $0xa44,0xa44 - 6bf: 0a 00 00 + 66b: c7 05 40 0c 00 00 44 movl $0xc44,0xc40 + 672: 0c 00 00 + 675: c7 05 44 0c 00 00 44 movl $0xc44,0xc44 + 67c: 0c 00 00 base.s.size = 0; - 6c2: c7 05 48 0a 00 00 00 movl $0x0,0xa48 - 6c9: 00 00 00 + 67f: c7 05 48 0c 00 00 00 movl $0x0,0xc48 + 686: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6cc: b8 44 0a 00 00 mov $0xa44,%eax - 6d1: eb c4 jmp 697 + 689: b8 44 0c 00 00 mov $0xc44,%eax + 68e: eb c8 jmp 658 if(p->s.size == nunits) - 6d3: 39 cb cmp %ecx,%ebx - 6d5: 74 1e je 6f5 + 690: 39 cb cmp %ecx,%ebx + 692: 74 1e je 6b2 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 6d7: 29 d9 sub %ebx,%ecx - 6d9: 89 48 04 mov %ecx,0x4(%eax) + 694: 29 d9 sub %ebx,%ecx + 696: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 6dc: 8d 04 c8 lea (%eax,%ecx,8),%eax + 699: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 6df: 89 58 04 mov %ebx,0x4(%eax) + 69c: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 6e2: 89 15 40 0a 00 00 mov %edx,0xa40 + 69f: 89 15 40 0c 00 00 mov %edx,0xc40 return (void*)(p + 1); - 6e8: 8d 50 08 lea 0x8(%eax),%edx + 6a5: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 6eb: 89 d0 mov %edx,%eax - 6ed: 8d 65 f4 lea -0xc(%ebp),%esp - 6f0: 5b pop %ebx - 6f1: 5e pop %esi - 6f2: 5f pop %edi - 6f3: 5d pop %ebp - 6f4: c3 ret + 6a8: 89 d0 mov %edx,%eax + 6aa: 8d 65 f4 lea -0xc(%ebp),%esp + 6ad: 5b pop %ebx + 6ae: 5e pop %esi + 6af: 5f pop %edi + 6b0: 5d pop %ebp + 6b1: c3 ret prevp->s.ptr = p->s.ptr; - 6f5: 8b 08 mov (%eax),%ecx - 6f7: 89 0a mov %ecx,(%edx) - 6f9: eb e7 jmp 6e2 + 6b2: 8b 08 mov (%eax),%ecx + 6b4: 89 0a mov %ecx,(%edx) + 6b6: eb e7 jmp 69f hp->s.size = nu; - 6fb: 89 70 04 mov %esi,0x4(%eax) + 6b8: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 6fe: 83 ec 0c sub $0xc,%esp - 701: 83 c0 08 add $0x8,%eax - 704: 50 push %eax - 705: e8 ef fe ff ff call 5f9 + 6bb: 83 ec 0c sub $0xc,%esp + 6be: 83 c0 08 add $0x8,%eax + 6c1: 50 push %eax + 6c2: e8 00 ff ff ff call 5c7 return freep; - 70a: 8b 15 40 0a 00 00 mov 0xa40,%edx + 6c7: 8b 15 40 0c 00 00 mov 0xc40,%edx if((p = morecore(nunits)) == 0) - 710: 83 c4 10 add $0x10,%esp - 713: 85 d2 test %edx,%edx - 715: 74 d4 je 6eb + 6cd: 83 c4 10 add $0x10,%esp + 6d0: 85 d2 test %edx,%edx + 6d2: 74 d4 je 6a8 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 717: 8b 02 mov (%edx),%eax + 6d4: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 719: 8b 48 04 mov 0x4(%eax),%ecx - 71c: 39 d9 cmp %ebx,%ecx - 71e: 73 b3 jae 6d3 + 6d6: 8b 48 04 mov 0x4(%eax),%ecx + 6d9: 39 d9 cmp %ebx,%ecx + 6db: 73 b3 jae 690 if(p == freep) - 720: 89 c2 mov %eax,%edx - 722: 39 05 40 0a 00 00 cmp %eax,0xa40 - 728: 75 ed jne 717 + 6dd: 89 c2 mov %eax,%edx + 6df: 39 05 40 0c 00 00 cmp %eax,0xc40 + 6e5: 75 ed jne 6d4 p = sbrk(nu * sizeof(Header)); - 72a: 83 ec 0c sub $0xc,%esp - 72d: 57 push %edi - 72e: e8 3c fc ff ff call 36f + 6e7: 83 ec 0c sub $0xc,%esp + 6ea: 57 push %edi + 6eb: e8 59 fc ff ff call 349 if(p == (char*)-1) - 733: 83 c4 10 add $0x10,%esp - 736: 83 f8 ff cmp $0xffffffff,%eax - 739: 75 c0 jne 6fb + 6f0: 83 c4 10 add $0x10,%esp + 6f3: 83 f8 ff cmp $0xffffffff,%eax + 6f6: 75 c0 jne 6b8 return 0; - 73b: ba 00 00 00 00 mov $0x0,%edx - 740: eb a9 jmp 6eb + 6f8: ba 00 00 00 00 mov $0x0,%edx + 6fd: eb a9 jmp 6a8 diff --git a/src/user/cat.d b/src/user/cat.d new file mode 100644 index 0000000..5bed19b --- /dev/null +++ b/src/user/cat.d @@ -0,0 +1 @@ +user/cat.o: user/cat.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/cat.o b/src/user/cat.o new file mode 100644 index 0000000..a05a57b Binary files /dev/null and b/src/user/cat.o differ diff --git a/src/user/cat.sym b/src/user/cat.sym index a82520f..0a25d87 100644 --- a/src/user/cat.sym +++ b/src/user/cat.sym @@ -1,61 +1,49 @@ -00000000 .text -00000744 .rodata -00000798 .eh_frame -00000a40 .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 -00000397 printint -00000784 digits.1089 +00000371 printint +00000798 digits.0 00000000 umalloc.c -00000a40 freep -00000a44 base -00000101 strcpy -0000042b printf -000002ae memmove -0000032f mknod -0000038f ps -000001cc gets -00000367 getpid +00000c40 freep +00000c44 base +000000f9 strcpy +00000409 printf +0000028c memmove +00000309 mknod +00000369 ps +000001b4 gets +00000341 getpid 00000000 cat -0000066b malloc -00000377 sleep -000002f7 pipe -00000387 slabtest -00000307 write -0000033f fstat -00000317 kill -00000357 chdir -0000031f exec -000002ef wait -000002ff read -00000337 unlink -000002df fork -0000036f sbrk -0000037f uptime -00000a24 __bss_start -00000180 memset -00000070 main -00000127 strcmp -0000035f dup -00000a60 buf -00000227 stat -00000a24 _edata -00000c60 _end -00000347 link -000002e7 exit -0000026f atoi -00000156 strlen -00000327 open -0000019b strchr -0000034f mkdir -0000030f close -000005f9 free +00000630 malloc +00000351 sleep +000002d1 pipe +00000361 slabtest +000002e1 write +00000319 fstat +000002f1 kill +00000331 chdir +000002f9 exec +000002c9 wait +000002d9 read +00000311 unlink +000002b9 fork +00000349 sbrk +00000359 uptime +00000a38 __bss_start +0000016e memset +0000006c main +0000011d strcmp +00000339 dup +00000a40 buf +0000020b stat +00000a38 _edata +00000c4c _end +00000321 link +000002c1 exit +0000024f atoi +00000148 strlen +00000301 open +00000187 strchr +00000329 mkdir +000002e9 close +000005c7 free diff --git a/src/user/echo.asm b/src/user/echo.asm index be6ec5d..e557a96 100644 --- a/src/user/echo.asm +++ b/src/user/echo.asm @@ -11,1063 +11,1027 @@ Disassembly of section .text: int main(int argc, char *argv[]) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 57 push %edi - 12: 56 push %esi - 13: 53 push %ebx - 14: 51 push %ecx - 15: 83 ec 18 sub $0x18,%esp - 18: 8b 01 mov (%ecx),%eax - 1a: 89 45 e4 mov %eax,-0x1c(%ebp) - 1d: 8b 79 04 mov 0x4(%ecx),%edi + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 57 push %edi + e: 56 push %esi + f: 53 push %ebx + 10: 51 push %ecx + 11: 83 ec 08 sub $0x8,%esp + 14: 8b 31 mov (%ecx),%esi + 16: 8b 79 04 mov 0x4(%ecx),%edi int i; for(i = 1; i < argc; i++) - 20: 83 f8 01 cmp $0x1,%eax - 23: 7e 41 jle 66 - 25: 8d 5f 04 lea 0x4(%edi),%ebx - 28: 8d 74 87 fc lea -0x4(%edi,%eax,4),%esi + 19: 83 fe 01 cmp $0x1,%esi + 1c: 7e 3e jle 5c + 1e: bb 01 00 00 00 mov $0x1,%ebx printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); - 2c: 39 f3 cmp %esi,%ebx - 2e: 74 1b je 4b - 30: 68 ac 06 00 00 push $0x6ac - 35: ff 33 pushl (%ebx) - 37: 68 ae 06 00 00 push $0x6ae - 3c: 6a 01 push $0x1 - 3e: e8 52 03 00 00 call 395 - for(i = 1; i < argc; i++) - 43: 83 c3 04 add $0x4,%ebx - 46: 83 c4 10 add $0x10,%esp - 49: eb e1 jmp 2c - printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); - 4b: 68 b3 06 00 00 push $0x6b3 - 50: 8b 45 e4 mov -0x1c(%ebp),%eax - 53: ff 74 87 fc pushl -0x4(%edi,%eax,4) - 57: 68 ae 06 00 00 push $0x6ae - 5c: 6a 01 push $0x1 - 5e: e8 32 03 00 00 call 395 - 63: 83 c4 10 add $0x10,%esp + 23: 83 c3 01 add $0x1,%ebx + 26: 39 f3 cmp %esi,%ebx + 28: 74 1a je 44 + 2a: 68 68 06 00 00 push $0x668 + 2f: ff 74 9f fc push -0x4(%edi,%ebx,4) + 33: 68 6a 06 00 00 push $0x66a + 38: 6a 01 push $0x1 + 3a: e8 32 03 00 00 call 371 + 3f: 83 c4 10 add $0x10,%esp + 42: eb df jmp 23 + 44: 68 6f 06 00 00 push $0x66f + 49: ff 74 b7 fc push -0x4(%edi,%esi,4) + 4d: 68 6a 06 00 00 push $0x66a + 52: 6a 01 push $0x1 + 54: e8 18 03 00 00 call 371 + 59: 83 c4 10 add $0x10,%esp exit(); - 66: e8 e6 01 00 00 call 251 + 5c: e8 c8 01 00 00 call 229 -0000006b : +00000061 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 6b: f3 0f 1e fb endbr32 - 6f: 55 push %ebp - 70: 89 e5 mov %esp,%ebp - 72: 53 push %ebx - 73: 8b 4d 08 mov 0x8(%ebp),%ecx - 76: 8b 5d 0c mov 0xc(%ebp),%ebx + 61: 55 push %ebp + 62: 89 e5 mov %esp,%ebp + 64: 53 push %ebx + 65: 8b 4d 08 mov 0x8(%ebp),%ecx + 68: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 79: b8 00 00 00 00 mov $0x0,%eax - 7e: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 82: 88 14 01 mov %dl,(%ecx,%eax,1) - 85: 83 c0 01 add $0x1,%eax - 88: 84 d2 test %dl,%dl - 8a: 75 f2 jne 7e + 6b: b8 00 00 00 00 mov $0x0,%eax + 70: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 74: 88 14 01 mov %dl,(%ecx,%eax,1) + 77: 83 c0 01 add $0x1,%eax + 7a: 84 d2 test %dl,%dl + 7c: 75 f2 jne 70 ; return os; } - 8c: 89 c8 mov %ecx,%eax - 8e: 5b pop %ebx - 8f: 5d pop %ebp - 90: c3 ret + 7e: 89 c8 mov %ecx,%eax + 80: 8b 5d fc mov -0x4(%ebp),%ebx + 83: c9 leave + 84: c3 ret -00000091 : +00000085 : int strcmp(const char *p, const char *q) { - 91: f3 0f 1e fb endbr32 - 95: 55 push %ebp - 96: 89 e5 mov %esp,%ebp - 98: 8b 4d 08 mov 0x8(%ebp),%ecx - 9b: 8b 55 0c mov 0xc(%ebp),%edx + 85: 55 push %ebp + 86: 89 e5 mov %esp,%ebp + 88: 8b 4d 08 mov 0x8(%ebp),%ecx + 8b: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 9e: 0f b6 01 movzbl (%ecx),%eax - a1: 84 c0 test %al,%al - a3: 74 11 je b6 - a5: 38 02 cmp %al,(%edx) - a7: 75 0d jne b6 + 8e: 0f b6 01 movzbl (%ecx),%eax + 91: 84 c0 test %al,%al + 93: 74 11 je a6 + 95: 38 02 cmp %al,(%edx) + 97: 75 0d jne a6 p++, q++; - a9: 83 c1 01 add $0x1,%ecx - ac: 83 c2 01 add $0x1,%edx + 99: 83 c1 01 add $0x1,%ecx + 9c: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - af: 0f b6 01 movzbl (%ecx),%eax - b2: 84 c0 test %al,%al - b4: 75 ef jne a5 + 9f: 0f b6 01 movzbl (%ecx),%eax + a2: 84 c0 test %al,%al + a4: 75 ef jne 95 return (uchar)*p - (uchar)*q; - b6: 0f b6 c0 movzbl %al,%eax - b9: 0f b6 12 movzbl (%edx),%edx - bc: 29 d0 sub %edx,%eax + a6: 0f b6 c0 movzbl %al,%eax + a9: 0f b6 12 movzbl (%edx),%edx + ac: 29 d0 sub %edx,%eax } - be: 5d pop %ebp - bf: c3 ret + ae: 5d pop %ebp + af: c3 ret -000000c0 : +000000b0 : uint strlen(const char *s) { - c0: f3 0f 1e fb endbr32 - c4: 55 push %ebp - c5: 89 e5 mov %esp,%ebp - c7: 8b 55 08 mov 0x8(%ebp),%edx + b0: 55 push %ebp + b1: 89 e5 mov %esp,%ebp + b3: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - ca: 80 3a 00 cmpb $0x0,(%edx) - cd: 74 14 je e3 - cf: b8 00 00 00 00 mov $0x0,%eax - d4: 83 c0 01 add $0x1,%eax - d7: 89 c1 mov %eax,%ecx - d9: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - dd: 75 f5 jne d4 + b6: 80 3a 00 cmpb $0x0,(%edx) + b9: 74 14 je cf + bb: b8 00 00 00 00 mov $0x0,%eax + c0: 83 c0 01 add $0x1,%eax + c3: 89 c1 mov %eax,%ecx + c5: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + c9: 75 f5 jne c0 ; return n; } - df: 89 c8 mov %ecx,%eax - e1: 5d pop %ebp - e2: c3 ret + cb: 89 c8 mov %ecx,%eax + cd: 5d pop %ebp + ce: c3 ret for(n = 0; s[n]; n++) - e3: b9 00 00 00 00 mov $0x0,%ecx + cf: b9 00 00 00 00 mov $0x0,%ecx return n; - e8: eb f5 jmp df + d4: eb f5 jmp cb -000000ea : +000000d6 : void* memset(void *dst, int c, uint n) { - ea: f3 0f 1e fb endbr32 - ee: 55 push %ebp - ef: 89 e5 mov %esp,%ebp - f1: 57 push %edi - f2: 8b 55 08 mov 0x8(%ebp),%edx + d6: 55 push %ebp + d7: 89 e5 mov %esp,%ebp + d9: 57 push %edi + da: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - f5: 89 d7 mov %edx,%edi - f7: 8b 4d 10 mov 0x10(%ebp),%ecx - fa: 8b 45 0c mov 0xc(%ebp),%eax - fd: fc cld - fe: f3 aa rep stos %al,%es:(%edi) + dd: 89 d7 mov %edx,%edi + df: 8b 4d 10 mov 0x10(%ebp),%ecx + e2: 8b 45 0c mov 0xc(%ebp),%eax + e5: fc cld + e6: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 100: 89 d0 mov %edx,%eax - 102: 5f pop %edi - 103: 5d pop %ebp - 104: c3 ret + e8: 89 d0 mov %edx,%eax + ea: 8b 7d fc mov -0x4(%ebp),%edi + ed: c9 leave + ee: c3 ret -00000105 : +000000ef : char* strchr(const char *s, char c) { - 105: f3 0f 1e fb endbr32 - 109: 55 push %ebp - 10a: 89 e5 mov %esp,%ebp - 10c: 8b 45 08 mov 0x8(%ebp),%eax - 10f: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + ef: 55 push %ebp + f0: 89 e5 mov %esp,%ebp + f2: 8b 45 08 mov 0x8(%ebp),%eax + f5: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 113: 0f b6 10 movzbl (%eax),%edx - 116: 84 d2 test %dl,%dl - 118: 74 15 je 12f + f9: 0f b6 10 movzbl (%eax),%edx + fc: 84 d2 test %dl,%dl + fe: 74 15 je 115 if(*s == c) - 11a: 38 d1 cmp %dl,%cl - 11c: 74 0f je 12d + 100: 38 d1 cmp %dl,%cl + 102: 74 0f je 113 for(; *s; s++) - 11e: 83 c0 01 add $0x1,%eax - 121: 0f b6 10 movzbl (%eax),%edx - 124: 84 d2 test %dl,%dl - 126: 75 f2 jne 11a + 104: 83 c0 01 add $0x1,%eax + 107: 0f b6 10 movzbl (%eax),%edx + 10a: 84 d2 test %dl,%dl + 10c: 75 f2 jne 100 return (char*)s; return 0; - 128: b8 00 00 00 00 mov $0x0,%eax + 10e: b8 00 00 00 00 mov $0x0,%eax } - 12d: 5d pop %ebp - 12e: c3 ret + 113: 5d pop %ebp + 114: c3 ret return 0; - 12f: b8 00 00 00 00 mov $0x0,%eax - 134: eb f7 jmp 12d + 115: b8 00 00 00 00 mov $0x0,%eax + 11a: eb f7 jmp 113 -00000136 : +0000011c : char* gets(char *buf, int max) { - 136: f3 0f 1e fb endbr32 - 13a: 55 push %ebp - 13b: 89 e5 mov %esp,%ebp - 13d: 57 push %edi - 13e: 56 push %esi - 13f: 53 push %ebx - 140: 83 ec 2c sub $0x2c,%esp - 143: 8b 75 08 mov 0x8(%ebp),%esi + 11c: 55 push %ebp + 11d: 89 e5 mov %esp,%ebp + 11f: 57 push %edi + 120: 56 push %esi + 121: 53 push %ebx + 122: 83 ec 2c sub $0x2c,%esp + 125: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 146: bb 00 00 00 00 mov $0x0,%ebx + 128: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 14b: 8d 7d e7 lea -0x19(%ebp),%edi + 12d: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 14e: 89 5d d4 mov %ebx,-0x2c(%ebp) - 151: 83 c3 01 add $0x1,%ebx - 154: 3b 5d 0c cmp 0xc(%ebp),%ebx - 157: 7d 27 jge 180 + 130: 89 5d d4 mov %ebx,-0x2c(%ebp) + 133: 83 c3 01 add $0x1,%ebx + 136: 3b 5d 0c cmp 0xc(%ebp),%ebx + 139: 7d 27 jge 162 cc = read(0, &c, 1); - 159: 83 ec 04 sub $0x4,%esp - 15c: 6a 01 push $0x1 - 15e: 57 push %edi - 15f: 6a 00 push $0x0 - 161: e8 03 01 00 00 call 269 + 13b: 83 ec 04 sub $0x4,%esp + 13e: 6a 01 push $0x1 + 140: 57 push %edi + 141: 6a 00 push $0x0 + 143: e8 f9 00 00 00 call 241 if(cc < 1) - 166: 83 c4 10 add $0x10,%esp - 169: 85 c0 test %eax,%eax - 16b: 7e 13 jle 180 + 148: 83 c4 10 add $0x10,%esp + 14b: 85 c0 test %eax,%eax + 14d: 7e 13 jle 162 break; buf[i++] = c; - 16d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 171: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 14f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 153: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 175: 3c 0a cmp $0xa,%al - 177: 74 04 je 17d - 179: 3c 0d cmp $0xd,%al - 17b: 75 d1 jne 14e + 157: 3c 0a cmp $0xa,%al + 159: 74 04 je 15f + 15b: 3c 0d cmp $0xd,%al + 15d: 75 d1 jne 130 for(i=0; i+1 < max; ){ - 17d: 89 5d d4 mov %ebx,-0x2c(%ebp) + 15f: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 180: 8b 45 d4 mov -0x2c(%ebp),%eax - 183: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 162: 8b 45 d4 mov -0x2c(%ebp),%eax + 165: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 187: 89 f0 mov %esi,%eax - 189: 8d 65 f4 lea -0xc(%ebp),%esp - 18c: 5b pop %ebx - 18d: 5e pop %esi - 18e: 5f pop %edi - 18f: 5d pop %ebp - 190: c3 ret + 169: 89 f0 mov %esi,%eax + 16b: 8d 65 f4 lea -0xc(%ebp),%esp + 16e: 5b pop %ebx + 16f: 5e pop %esi + 170: 5f pop %edi + 171: 5d pop %ebp + 172: c3 ret -00000191 : +00000173 : int stat(const char *n, struct stat *st) { - 191: f3 0f 1e fb endbr32 - 195: 55 push %ebp - 196: 89 e5 mov %esp,%ebp - 198: 56 push %esi - 199: 53 push %ebx + 173: 55 push %ebp + 174: 89 e5 mov %esp,%ebp + 176: 56 push %esi + 177: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 19a: 83 ec 08 sub $0x8,%esp - 19d: 6a 00 push $0x0 - 19f: ff 75 08 pushl 0x8(%ebp) - 1a2: e8 ea 00 00 00 call 291 + 178: 83 ec 08 sub $0x8,%esp + 17b: 6a 00 push $0x0 + 17d: ff 75 08 push 0x8(%ebp) + 180: e8 e4 00 00 00 call 269 if(fd < 0) - 1a7: 83 c4 10 add $0x10,%esp - 1aa: 85 c0 test %eax,%eax - 1ac: 78 24 js 1d2 - 1ae: 89 c3 mov %eax,%ebx + 185: 83 c4 10 add $0x10,%esp + 188: 85 c0 test %eax,%eax + 18a: 78 24 js 1b0 + 18c: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 1b0: 83 ec 08 sub $0x8,%esp - 1b3: ff 75 0c pushl 0xc(%ebp) - 1b6: 50 push %eax - 1b7: e8 ed 00 00 00 call 2a9 - 1bc: 89 c6 mov %eax,%esi + 18e: 83 ec 08 sub $0x8,%esp + 191: ff 75 0c push 0xc(%ebp) + 194: 50 push %eax + 195: e8 e7 00 00 00 call 281 + 19a: 89 c6 mov %eax,%esi close(fd); - 1be: 89 1c 24 mov %ebx,(%esp) - 1c1: e8 b3 00 00 00 call 279 + 19c: 89 1c 24 mov %ebx,(%esp) + 19f: e8 ad 00 00 00 call 251 return r; - 1c6: 83 c4 10 add $0x10,%esp + 1a4: 83 c4 10 add $0x10,%esp } - 1c9: 89 f0 mov %esi,%eax - 1cb: 8d 65 f8 lea -0x8(%ebp),%esp - 1ce: 5b pop %ebx - 1cf: 5e pop %esi - 1d0: 5d pop %ebp - 1d1: c3 ret + 1a7: 89 f0 mov %esi,%eax + 1a9: 8d 65 f8 lea -0x8(%ebp),%esp + 1ac: 5b pop %ebx + 1ad: 5e pop %esi + 1ae: 5d pop %ebp + 1af: c3 ret return -1; - 1d2: be ff ff ff ff mov $0xffffffff,%esi - 1d7: eb f0 jmp 1c9 + 1b0: be ff ff ff ff mov $0xffffffff,%esi + 1b5: eb f0 jmp 1a7 -000001d9 : +000001b7 : int atoi(const char *s) { - 1d9: f3 0f 1e fb endbr32 - 1dd: 55 push %ebp - 1de: 89 e5 mov %esp,%ebp - 1e0: 53 push %ebx - 1e1: 8b 55 08 mov 0x8(%ebp),%edx + 1b7: 55 push %ebp + 1b8: 89 e5 mov %esp,%ebp + 1ba: 53 push %ebx + 1bb: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1e4: 0f b6 02 movzbl (%edx),%eax - 1e7: 8d 48 d0 lea -0x30(%eax),%ecx - 1ea: 80 f9 09 cmp $0x9,%cl - 1ed: 77 22 ja 211 + 1be: 0f b6 02 movzbl (%edx),%eax + 1c1: 8d 48 d0 lea -0x30(%eax),%ecx + 1c4: 80 f9 09 cmp $0x9,%cl + 1c7: 77 24 ja 1ed n = 0; - 1ef: b9 00 00 00 00 mov $0x0,%ecx + 1c9: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 1f4: 83 c2 01 add $0x1,%edx - 1f7: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 1fa: 0f be c0 movsbl %al,%eax - 1fd: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 1ce: 83 c2 01 add $0x1,%edx + 1d1: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 1d4: 0f be c0 movsbl %al,%eax + 1d7: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 201: 0f b6 02 movzbl (%edx),%eax - 204: 8d 58 d0 lea -0x30(%eax),%ebx - 207: 80 fb 09 cmp $0x9,%bl - 20a: 76 e8 jbe 1f4 + 1db: 0f b6 02 movzbl (%edx),%eax + 1de: 8d 58 d0 lea -0x30(%eax),%ebx + 1e1: 80 fb 09 cmp $0x9,%bl + 1e4: 76 e8 jbe 1ce return n; } - 20c: 89 c8 mov %ecx,%eax - 20e: 5b pop %ebx - 20f: 5d pop %ebp - 210: c3 ret + 1e6: 89 c8 mov %ecx,%eax + 1e8: 8b 5d fc mov -0x4(%ebp),%ebx + 1eb: c9 leave + 1ec: c3 ret n = 0; - 211: b9 00 00 00 00 mov $0x0,%ecx + 1ed: b9 00 00 00 00 mov $0x0,%ecx return n; - 216: eb f4 jmp 20c + 1f2: eb f2 jmp 1e6 -00000218 : +000001f4 : void* memmove(void *vdst, const void *vsrc, int n) { - 218: f3 0f 1e fb endbr32 - 21c: 55 push %ebp - 21d: 89 e5 mov %esp,%ebp - 21f: 56 push %esi - 220: 53 push %ebx - 221: 8b 75 08 mov 0x8(%ebp),%esi - 224: 8b 55 0c mov 0xc(%ebp),%edx - 227: 8b 5d 10 mov 0x10(%ebp),%ebx + 1f4: 55 push %ebp + 1f5: 89 e5 mov %esp,%ebp + 1f7: 56 push %esi + 1f8: 53 push %ebx + 1f9: 8b 75 08 mov 0x8(%ebp),%esi + 1fc: 8b 55 0c mov 0xc(%ebp),%edx + 1ff: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 22a: 85 db test %ebx,%ebx - 22c: 7e 15 jle 243 - 22e: 01 f3 add %esi,%ebx + 202: 85 db test %ebx,%ebx + 204: 7e 15 jle 21b + 206: 01 f3 add %esi,%ebx dst = vdst; - 230: 89 f0 mov %esi,%eax + 208: 89 f0 mov %esi,%eax *dst++ = *src++; - 232: 83 c2 01 add $0x1,%edx - 235: 83 c0 01 add $0x1,%eax - 238: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 23c: 88 48 ff mov %cl,-0x1(%eax) + 20a: 83 c2 01 add $0x1,%edx + 20d: 83 c0 01 add $0x1,%eax + 210: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 214: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 23f: 39 c3 cmp %eax,%ebx - 241: 75 ef jne 232 + 217: 39 c3 cmp %eax,%ebx + 219: 75 ef jne 20a return vdst; } - 243: 89 f0 mov %esi,%eax - 245: 5b pop %ebx - 246: 5e pop %esi - 247: 5d pop %ebp - 248: c3 ret + 21b: 89 f0 mov %esi,%eax + 21d: 5b pop %ebx + 21e: 5e pop %esi + 21f: 5d pop %ebp + 220: c3 ret -00000249 : +00000221 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 249: b8 01 00 00 00 mov $0x1,%eax + 221: b8 01 00 00 00 mov $0x1,%eax + 226: cd 40 int $0x40 + 228: c3 ret + +00000229 : +SYSCALL(exit) + 229: b8 02 00 00 00 mov $0x2,%eax + 22e: cd 40 int $0x40 + 230: c3 ret + +00000231 : +SYSCALL(wait) + 231: b8 03 00 00 00 mov $0x3,%eax + 236: cd 40 int $0x40 + 238: c3 ret + +00000239 : +SYSCALL(pipe) + 239: b8 04 00 00 00 mov $0x4,%eax + 23e: cd 40 int $0x40 + 240: c3 ret + +00000241 : +SYSCALL(read) + 241: b8 05 00 00 00 mov $0x5,%eax + 246: cd 40 int $0x40 + 248: c3 ret + +00000249 : +SYSCALL(write) + 249: b8 10 00 00 00 mov $0x10,%eax 24e: cd 40 int $0x40 250: c3 ret -00000251 : -SYSCALL(exit) - 251: b8 02 00 00 00 mov $0x2,%eax +00000251 : +SYSCALL(close) + 251: b8 15 00 00 00 mov $0x15,%eax 256: cd 40 int $0x40 258: c3 ret -00000259 : -SYSCALL(wait) - 259: b8 03 00 00 00 mov $0x3,%eax +00000259 : +SYSCALL(kill) + 259: b8 06 00 00 00 mov $0x6,%eax 25e: cd 40 int $0x40 260: c3 ret -00000261 : -SYSCALL(pipe) - 261: b8 04 00 00 00 mov $0x4,%eax +00000261 : +SYSCALL(exec) + 261: b8 07 00 00 00 mov $0x7,%eax 266: cd 40 int $0x40 268: c3 ret -00000269 : -SYSCALL(read) - 269: b8 05 00 00 00 mov $0x5,%eax +00000269 : +SYSCALL(open) + 269: b8 0f 00 00 00 mov $0xf,%eax 26e: cd 40 int $0x40 270: c3 ret -00000271 : -SYSCALL(write) - 271: b8 10 00 00 00 mov $0x10,%eax +00000271 : +SYSCALL(mknod) + 271: b8 11 00 00 00 mov $0x11,%eax 276: cd 40 int $0x40 278: c3 ret -00000279 : -SYSCALL(close) - 279: b8 15 00 00 00 mov $0x15,%eax +00000279 : +SYSCALL(unlink) + 279: b8 12 00 00 00 mov $0x12,%eax 27e: cd 40 int $0x40 280: c3 ret -00000281 : -SYSCALL(kill) - 281: b8 06 00 00 00 mov $0x6,%eax +00000281 : +SYSCALL(fstat) + 281: b8 08 00 00 00 mov $0x8,%eax 286: cd 40 int $0x40 288: c3 ret -00000289 : -SYSCALL(exec) - 289: b8 07 00 00 00 mov $0x7,%eax +00000289 : +SYSCALL(link) + 289: b8 13 00 00 00 mov $0x13,%eax 28e: cd 40 int $0x40 290: c3 ret -00000291 : -SYSCALL(open) - 291: b8 0f 00 00 00 mov $0xf,%eax +00000291 : +SYSCALL(mkdir) + 291: b8 14 00 00 00 mov $0x14,%eax 296: cd 40 int $0x40 298: c3 ret -00000299 : -SYSCALL(mknod) - 299: b8 11 00 00 00 mov $0x11,%eax +00000299 : +SYSCALL(chdir) + 299: b8 09 00 00 00 mov $0x9,%eax 29e: cd 40 int $0x40 2a0: c3 ret -000002a1 : -SYSCALL(unlink) - 2a1: b8 12 00 00 00 mov $0x12,%eax +000002a1 : +SYSCALL(dup) + 2a1: b8 0a 00 00 00 mov $0xa,%eax 2a6: cd 40 int $0x40 2a8: c3 ret -000002a9 : -SYSCALL(fstat) - 2a9: b8 08 00 00 00 mov $0x8,%eax +000002a9 : +SYSCALL(getpid) + 2a9: b8 0b 00 00 00 mov $0xb,%eax 2ae: cd 40 int $0x40 2b0: c3 ret -000002b1 : -SYSCALL(link) - 2b1: b8 13 00 00 00 mov $0x13,%eax +000002b1 : +SYSCALL(sbrk) + 2b1: b8 0c 00 00 00 mov $0xc,%eax 2b6: cd 40 int $0x40 2b8: c3 ret -000002b9 : -SYSCALL(mkdir) - 2b9: b8 14 00 00 00 mov $0x14,%eax +000002b9 : +SYSCALL(sleep) + 2b9: b8 0d 00 00 00 mov $0xd,%eax 2be: cd 40 int $0x40 2c0: c3 ret -000002c1 : -SYSCALL(chdir) - 2c1: b8 09 00 00 00 mov $0x9,%eax +000002c1 : +SYSCALL(uptime) + 2c1: b8 0e 00 00 00 mov $0xe,%eax 2c6: cd 40 int $0x40 2c8: c3 ret -000002c9 : -SYSCALL(dup) - 2c9: b8 0a 00 00 00 mov $0xa,%eax +000002c9 : +SYSCALL(slabtest) + 2c9: b8 16 00 00 00 mov $0x16,%eax 2ce: cd 40 int $0x40 2d0: c3 ret -000002d1 : -SYSCALL(getpid) - 2d1: b8 0b 00 00 00 mov $0xb,%eax +000002d1 : +SYSCALL(ps) + 2d1: b8 17 00 00 00 mov $0x17,%eax 2d6: cd 40 int $0x40 2d8: c3 ret -000002d9 : -SYSCALL(sbrk) - 2d9: b8 0c 00 00 00 mov $0xc,%eax - 2de: cd 40 int $0x40 - 2e0: c3 ret - -000002e1 : -SYSCALL(sleep) - 2e1: b8 0d 00 00 00 mov $0xd,%eax - 2e6: cd 40 int $0x40 - 2e8: c3 ret - -000002e9 : -SYSCALL(uptime) - 2e9: b8 0e 00 00 00 mov $0xe,%eax - 2ee: cd 40 int $0x40 - 2f0: c3 ret - -000002f1 : -SYSCALL(slabtest) - 2f1: b8 16 00 00 00 mov $0x16,%eax - 2f6: cd 40 int $0x40 - 2f8: c3 ret - -000002f9 : -SYSCALL(ps) - 2f9: b8 17 00 00 00 mov $0x17,%eax - 2fe: cd 40 int $0x40 - 300: c3 ret - -00000301 : +000002d9 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 301: 55 push %ebp - 302: 89 e5 mov %esp,%ebp - 304: 57 push %edi - 305: 56 push %esi - 306: 53 push %ebx - 307: 83 ec 3c sub $0x3c,%esp - 30a: 89 45 c4 mov %eax,-0x3c(%ebp) - 30d: 89 d3 mov %edx,%ebx + 2d9: 55 push %ebp + 2da: 89 e5 mov %esp,%ebp + 2dc: 57 push %edi + 2dd: 56 push %esi + 2de: 53 push %ebx + 2df: 83 ec 3c sub $0x3c,%esp + 2e2: 89 45 c4 mov %eax,-0x3c(%ebp) + 2e5: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 30f: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 313: 74 77 je 38c - 315: 85 d2 test %edx,%edx - 317: 79 73 jns 38c + 2e7: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 2eb: 74 79 je 366 + 2ed: 85 d2 test %edx,%edx + 2ef: 79 75 jns 366 neg = 1; x = -xx; - 319: f7 db neg %ebx + 2f1: 89 d1 mov %edx,%ecx + 2f3: f7 d9 neg %ecx neg = 1; - 31b: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 2f5: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 322: be 00 00 00 00 mov $0x0,%esi + 2fc: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 327: 89 f7 mov %esi,%edi - 329: 83 c6 01 add $0x1,%esi - 32c: 89 d8 mov %ebx,%eax - 32e: ba 00 00 00 00 mov $0x0,%edx - 333: f7 f1 div %ecx - 335: 0f b6 92 bc 06 00 00 movzbl 0x6bc(%edx),%edx - 33c: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 301: 89 df mov %ebx,%edi + 303: 83 c3 01 add $0x1,%ebx + 306: 89 c8 mov %ecx,%eax + 308: ba 00 00 00 00 mov $0x0,%edx + 30d: f7 f6 div %esi + 30f: 0f b6 92 d0 06 00 00 movzbl 0x6d0(%edx),%edx + 316: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 340: 89 da mov %ebx,%edx - 342: 89 c3 mov %eax,%ebx - 344: 39 d1 cmp %edx,%ecx - 346: 76 df jbe 327 + 31a: 89 ca mov %ecx,%edx + 31c: 89 c1 mov %eax,%ecx + 31e: 39 d6 cmp %edx,%esi + 320: 76 df jbe 301 if(neg) - 348: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 34c: 74 08 je 356 + 322: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 326: 74 08 je 330 buf[i++] = '-'; - 34e: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 353: 8d 77 02 lea 0x2(%edi),%esi + 328: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 32d: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 356: 85 f6 test %esi,%esi - 358: 7e 2a jle 384 - 35a: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 35e: 8d 7d d8 lea -0x28(%ebp),%edi + 330: 85 db test %ebx,%ebx + 332: 7e 2a jle 35e + 334: 8d 7d d8 lea -0x28(%ebp),%edi + 337: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 361: 8d 75 d7 lea -0x29(%ebp),%esi + 33b: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 364: 0f b6 03 movzbl (%ebx),%eax - 367: 88 45 d7 mov %al,-0x29(%ebp) + 33e: 0f b6 03 movzbl (%ebx),%eax + 341: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 36a: 83 ec 04 sub $0x4,%esp - 36d: 6a 01 push $0x1 - 36f: 56 push %esi - 370: ff 75 c4 pushl -0x3c(%ebp) - 373: e8 f9 fe ff ff call 271 + 344: 83 ec 04 sub $0x4,%esp + 347: 6a 01 push $0x1 + 349: 56 push %esi + 34a: ff 75 c4 push -0x3c(%ebp) + 34d: e8 f7 fe ff ff call 249 while(--i >= 0) - 378: 89 d8 mov %ebx,%eax - 37a: 83 eb 01 sub $0x1,%ebx - 37d: 83 c4 10 add $0x10,%esp - 380: 39 f8 cmp %edi,%eax - 382: 75 e0 jne 364 + 352: 89 d8 mov %ebx,%eax + 354: 83 eb 01 sub $0x1,%ebx + 357: 83 c4 10 add $0x10,%esp + 35a: 39 f8 cmp %edi,%eax + 35c: 75 e0 jne 33e } - 384: 8d 65 f4 lea -0xc(%ebp),%esp - 387: 5b pop %ebx - 388: 5e pop %esi - 389: 5f pop %edi - 38a: 5d pop %ebp - 38b: c3 ret + 35e: 8d 65 f4 lea -0xc(%ebp),%esp + 361: 5b pop %ebx + 362: 5e pop %esi + 363: 5f pop %edi + 364: 5d pop %ebp + 365: c3 ret + x = xx; + 366: 89 d1 mov %edx,%ecx neg = 0; - 38c: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 393: eb 8d jmp 322 + 368: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 36f: eb 8b jmp 2fc -00000395 : +00000371 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 395: f3 0f 1e fb endbr32 - 399: 55 push %ebp - 39a: 89 e5 mov %esp,%ebp - 39c: 57 push %edi - 39d: 56 push %esi - 39e: 53 push %ebx - 39f: 83 ec 2c sub $0x2c,%esp + 371: 55 push %ebp + 372: 89 e5 mov %esp,%ebp + 374: 57 push %edi + 375: 56 push %esi + 376: 53 push %ebx + 377: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 3a2: 8b 75 0c mov 0xc(%ebp),%esi - 3a5: 0f b6 1e movzbl (%esi),%ebx - 3a8: 84 db test %bl,%bl - 3aa: 0f 84 ab 01 00 00 je 55b - 3b0: 83 c6 01 add $0x1,%esi + 37a: 8b 75 0c mov 0xc(%ebp),%esi + 37d: 0f b6 1e movzbl (%esi),%ebx + 380: 84 db test %bl,%bl + 382: 0f 84 9f 01 00 00 je 527 + 388: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 3b3: 8d 45 10 lea 0x10(%ebp),%eax - 3b6: 89 45 d4 mov %eax,-0x2c(%ebp) + 38b: 8d 45 10 lea 0x10(%ebp),%eax + 38e: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 3b9: bf 00 00 00 00 mov $0x0,%edi - 3be: eb 2d jmp 3ed + 391: bf 00 00 00 00 mov $0x0,%edi + 396: eb 2d jmp 3c5 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 3c0: 88 5d e7 mov %bl,-0x19(%ebp) + 398: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3c3: 83 ec 04 sub $0x4,%esp - 3c6: 6a 01 push $0x1 - 3c8: 8d 45 e7 lea -0x19(%ebp),%eax - 3cb: 50 push %eax - 3cc: ff 75 08 pushl 0x8(%ebp) - 3cf: e8 9d fe ff ff call 271 + 39b: 83 ec 04 sub $0x4,%esp + 39e: 6a 01 push $0x1 + 3a0: 8d 45 e7 lea -0x19(%ebp),%eax + 3a3: 50 push %eax + 3a4: ff 75 08 push 0x8(%ebp) + 3a7: e8 9d fe ff ff call 249 putc(fd, c); - 3d4: 83 c4 10 add $0x10,%esp - 3d7: eb 05 jmp 3de + 3ac: 83 c4 10 add $0x10,%esp + 3af: eb 05 jmp 3b6 } } else if(state == '%'){ - 3d9: 83 ff 25 cmp $0x25,%edi - 3dc: 74 22 je 400 + 3b1: 83 ff 25 cmp $0x25,%edi + 3b4: 74 1f je 3d5 for(i = 0; fmt[i]; i++){ - 3de: 83 c6 01 add $0x1,%esi - 3e1: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3e5: 84 db test %bl,%bl - 3e7: 0f 84 6e 01 00 00 je 55b + 3b6: 83 c6 01 add $0x1,%esi + 3b9: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 3bd: 84 db test %bl,%bl + 3bf: 0f 84 62 01 00 00 je 527 c = fmt[i] & 0xff; - 3ed: 0f be d3 movsbl %bl,%edx - 3f0: 0f b6 c3 movzbl %bl,%eax + 3c5: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 3f3: 85 ff test %edi,%edi - 3f5: 75 e2 jne 3d9 + 3c8: 85 ff test %edi,%edi + 3ca: 75 e5 jne 3b1 if(c == '%'){ - 3f7: 83 f8 25 cmp $0x25,%eax - 3fa: 75 c4 jne 3c0 + 3cc: 83 f8 25 cmp $0x25,%eax + 3cf: 75 c7 jne 398 state = '%'; - 3fc: 89 c7 mov %eax,%edi - 3fe: eb de jmp 3de + 3d1: 89 c7 mov %eax,%edi + 3d3: eb e1 jmp 3b6 if(c == 'd'){ - 400: 83 f8 64 cmp $0x64,%eax - 403: 74 59 je 45e + 3d5: 83 f8 25 cmp $0x25,%eax + 3d8: 0f 84 f2 00 00 00 je 4d0 + 3de: 8d 50 9d lea -0x63(%eax),%edx + 3e1: 83 fa 15 cmp $0x15,%edx + 3e4: 0f 87 07 01 00 00 ja 4f1 + 3ea: 0f 87 01 01 00 00 ja 4f1 + 3f0: ff 24 95 78 06 00 00 jmp *0x678(,%edx,4) printint(fd, *ap, 10, 1); + 3f7: 83 ec 0c sub $0xc,%esp + 3fa: 6a 01 push $0x1 + 3fc: b9 0a 00 00 00 mov $0xa,%ecx + 401: 8b 7d d4 mov -0x2c(%ebp),%edi + 404: 8b 17 mov (%edi),%edx + 406: 8b 45 08 mov 0x8(%ebp),%eax + 409: e8 cb fe ff ff call 2d9 ap++; - } else if(c == 'x' || c == 'p'){ - 405: 81 e2 f7 00 00 00 and $0xf7,%edx - 40b: 83 fa 70 cmp $0x70,%edx - 40e: 74 7a je 48a - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 410: 83 f8 73 cmp $0x73,%eax - 413: 0f 84 9d 00 00 00 je 4b6 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 419: 83 f8 63 cmp $0x63,%eax - 41c: 0f 84 ec 00 00 00 je 50e - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 422: 83 f8 25 cmp $0x25,%eax - 425: 0f 84 0f 01 00 00 je 53a - putc(fd, c); + 40e: 89 f8 mov %edi,%eax + 410: 83 c0 04 add $0x4,%eax + 413: 89 45 d4 mov %eax,-0x2c(%ebp) + 416: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 42b: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 42f: 83 ec 04 sub $0x4,%esp - 432: 6a 01 push $0x1 - 434: 8d 45 e7 lea -0x19(%ebp),%eax - 437: 50 push %eax - 438: ff 75 08 pushl 0x8(%ebp) - 43b: e8 31 fe ff ff call 271 - putc(fd, c); - 440: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 443: 83 c4 0c add $0xc,%esp - 446: 6a 01 push $0x1 - 448: 8d 45 e7 lea -0x19(%ebp),%eax - 44b: 50 push %eax - 44c: ff 75 08 pushl 0x8(%ebp) - 44f: e8 1d fe ff ff call 271 putc(fd, c); - 454: 83 c4 10 add $0x10,%esp } state = 0; - 457: bf 00 00 00 00 mov $0x0,%edi - 45c: eb 80 jmp 3de - printint(fd, *ap, 10, 1); - 45e: 83 ec 0c sub $0xc,%esp - 461: 6a 01 push $0x1 - 463: b9 0a 00 00 00 mov $0xa,%ecx - 468: 8b 7d d4 mov -0x2c(%ebp),%edi - 46b: 8b 17 mov (%edi),%edx - 46d: 8b 45 08 mov 0x8(%ebp),%eax - 470: e8 8c fe ff ff call 301 - ap++; - 475: 89 f8 mov %edi,%eax - 477: 83 c0 04 add $0x4,%eax - 47a: 89 45 d4 mov %eax,-0x2c(%ebp) - 47d: 83 c4 10 add $0x10,%esp - state = 0; - 480: bf 00 00 00 00 mov $0x0,%edi - 485: e9 54 ff ff ff jmp 3de + 419: bf 00 00 00 00 mov $0x0,%edi + 41e: eb 96 jmp 3b6 printint(fd, *ap, 16, 0); - 48a: 83 ec 0c sub $0xc,%esp - 48d: 6a 00 push $0x0 - 48f: b9 10 00 00 00 mov $0x10,%ecx - 494: 8b 7d d4 mov -0x2c(%ebp),%edi - 497: 8b 17 mov (%edi),%edx - 499: 8b 45 08 mov 0x8(%ebp),%eax - 49c: e8 60 fe ff ff call 301 + 420: 83 ec 0c sub $0xc,%esp + 423: 6a 00 push $0x0 + 425: b9 10 00 00 00 mov $0x10,%ecx + 42a: 8b 7d d4 mov -0x2c(%ebp),%edi + 42d: 8b 17 mov (%edi),%edx + 42f: 8b 45 08 mov 0x8(%ebp),%eax + 432: e8 a2 fe ff ff call 2d9 ap++; - 4a1: 89 f8 mov %edi,%eax - 4a3: 83 c0 04 add $0x4,%eax - 4a6: 89 45 d4 mov %eax,-0x2c(%ebp) - 4a9: 83 c4 10 add $0x10,%esp + 437: 89 f8 mov %edi,%eax + 439: 83 c0 04 add $0x4,%eax + 43c: 89 45 d4 mov %eax,-0x2c(%ebp) + 43f: 83 c4 10 add $0x10,%esp state = 0; - 4ac: bf 00 00 00 00 mov $0x0,%edi - 4b1: e9 28 ff ff ff jmp 3de + 442: bf 00 00 00 00 mov $0x0,%edi + 447: e9 6a ff ff ff jmp 3b6 s = (char*)*ap; - 4b6: 8b 4d d4 mov -0x2c(%ebp),%ecx - 4b9: 8b 01 mov (%ecx),%eax + 44c: 8b 4d d4 mov -0x2c(%ebp),%ecx + 44f: 8b 01 mov (%ecx),%eax ap++; - 4bb: 83 c1 04 add $0x4,%ecx - 4be: 89 4d d4 mov %ecx,-0x2c(%ebp) + 451: 83 c1 04 add $0x4,%ecx + 454: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 4c1: 85 c0 test %eax,%eax - 4c3: 74 13 je 4d8 + 457: 85 c0 test %eax,%eax + 459: 74 13 je 46e s = (char*)*ap; - 4c5: 89 c3 mov %eax,%ebx + 45b: 89 c3 mov %eax,%ebx while(*s != 0){ - 4c7: 0f b6 00 movzbl (%eax),%eax + 45d: 0f b6 00 movzbl (%eax),%eax state = 0; - 4ca: bf 00 00 00 00 mov $0x0,%edi + 460: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 4cf: 84 c0 test %al,%al - 4d1: 75 0f jne 4e2 - 4d3: e9 06 ff ff ff jmp 3de + 465: 84 c0 test %al,%al + 467: 75 0f jne 478 + 469: e9 48 ff ff ff jmp 3b6 s = "(null)"; - 4d8: bb b5 06 00 00 mov $0x6b5,%ebx + 46e: bb 71 06 00 00 mov $0x671,%ebx while(*s != 0){ - 4dd: b8 28 00 00 00 mov $0x28,%eax - 4e2: 8b 7d 08 mov 0x8(%ebp),%edi + 473: b8 28 00 00 00 mov $0x28,%eax + 478: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4e5: 88 45 e7 mov %al,-0x19(%ebp) + 47b: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4e8: 83 ec 04 sub $0x4,%esp - 4eb: 6a 01 push $0x1 - 4ed: 8d 45 e7 lea -0x19(%ebp),%eax - 4f0: 50 push %eax - 4f1: 57 push %edi - 4f2: e8 7a fd ff ff call 271 + 47e: 83 ec 04 sub $0x4,%esp + 481: 6a 01 push $0x1 + 483: 8d 45 e7 lea -0x19(%ebp),%eax + 486: 50 push %eax + 487: 57 push %edi + 488: e8 bc fd ff ff call 249 s++; - 4f7: 83 c3 01 add $0x1,%ebx + 48d: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 4fa: 0f b6 03 movzbl (%ebx),%eax - 4fd: 83 c4 10 add $0x10,%esp - 500: 84 c0 test %al,%al - 502: 75 e1 jne 4e5 + 490: 0f b6 03 movzbl (%ebx),%eax + 493: 83 c4 10 add $0x10,%esp + 496: 84 c0 test %al,%al + 498: 75 e1 jne 47b state = 0; - 504: bf 00 00 00 00 mov $0x0,%edi - 509: e9 d0 fe ff ff jmp 3de + 49a: bf 00 00 00 00 mov $0x0,%edi + 49f: e9 12 ff ff ff jmp 3b6 putc(fd, *ap); - 50e: 8b 7d d4 mov -0x2c(%ebp),%edi - 511: 8b 07 mov (%edi),%eax - 513: 88 45 e7 mov %al,-0x19(%ebp) + 4a4: 8b 7d d4 mov -0x2c(%ebp),%edi + 4a7: 8b 07 mov (%edi),%eax + 4a9: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 516: 83 ec 04 sub $0x4,%esp - 519: 6a 01 push $0x1 - 51b: 8d 45 e7 lea -0x19(%ebp),%eax - 51e: 50 push %eax - 51f: ff 75 08 pushl 0x8(%ebp) - 522: e8 4a fd ff ff call 271 + 4ac: 83 ec 04 sub $0x4,%esp + 4af: 6a 01 push $0x1 + 4b1: 8d 45 e7 lea -0x19(%ebp),%eax + 4b4: 50 push %eax + 4b5: ff 75 08 push 0x8(%ebp) + 4b8: e8 8c fd ff ff call 249 ap++; - 527: 83 c7 04 add $0x4,%edi - 52a: 89 7d d4 mov %edi,-0x2c(%ebp) - 52d: 83 c4 10 add $0x10,%esp + 4bd: 83 c7 04 add $0x4,%edi + 4c0: 89 7d d4 mov %edi,-0x2c(%ebp) + 4c3: 83 c4 10 add $0x10,%esp + state = 0; + 4c6: bf 00 00 00 00 mov $0x0,%edi + 4cb: e9 e6 fe ff ff jmp 3b6 + putc(fd, c); + 4d0: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 4d3: 83 ec 04 sub $0x4,%esp + 4d6: 6a 01 push $0x1 + 4d8: 8d 45 e7 lea -0x19(%ebp),%eax + 4db: 50 push %eax + 4dc: ff 75 08 push 0x8(%ebp) + 4df: e8 65 fd ff ff call 249 + 4e4: 83 c4 10 add $0x10,%esp state = 0; - 530: bf 00 00 00 00 mov $0x0,%edi - 535: e9 a4 fe ff ff jmp 3de + 4e7: bf 00 00 00 00 mov $0x0,%edi + 4ec: e9 c5 fe ff ff jmp 3b6 + putc(fd, '%'); + 4f1: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 4f5: 83 ec 04 sub $0x4,%esp + 4f8: 6a 01 push $0x1 + 4fa: 8d 45 e7 lea -0x19(%ebp),%eax + 4fd: 50 push %eax + 4fe: ff 75 08 push 0x8(%ebp) + 501: e8 43 fd ff ff call 249 putc(fd, c); - 53a: 88 5d e7 mov %bl,-0x19(%ebp) + 506: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 53d: 83 ec 04 sub $0x4,%esp - 540: 6a 01 push $0x1 - 542: 8d 45 e7 lea -0x19(%ebp),%eax - 545: 50 push %eax - 546: ff 75 08 pushl 0x8(%ebp) - 549: e8 23 fd ff ff call 271 - 54e: 83 c4 10 add $0x10,%esp + 509: 83 c4 0c add $0xc,%esp + 50c: 6a 01 push $0x1 + 50e: 8d 45 e7 lea -0x19(%ebp),%eax + 511: 50 push %eax + 512: ff 75 08 push 0x8(%ebp) + 515: e8 2f fd ff ff call 249 + putc(fd, c); + 51a: 83 c4 10 add $0x10,%esp state = 0; - 551: bf 00 00 00 00 mov $0x0,%edi - 556: e9 83 fe ff ff jmp 3de + 51d: bf 00 00 00 00 mov $0x0,%edi + 522: e9 8f fe ff ff jmp 3b6 } } } - 55b: 8d 65 f4 lea -0xc(%ebp),%esp - 55e: 5b pop %ebx - 55f: 5e pop %esi - 560: 5f pop %edi - 561: 5d pop %ebp - 562: c3 ret - -00000563 : + 527: 8d 65 f4 lea -0xc(%ebp),%esp + 52a: 5b pop %ebx + 52b: 5e pop %esi + 52c: 5f pop %edi + 52d: 5d pop %ebp + 52e: c3 ret + +0000052f : static Header base; static Header *freep; void free(void *ap) { - 563: f3 0f 1e fb endbr32 - 567: 55 push %ebp - 568: 89 e5 mov %esp,%ebp - 56a: 57 push %edi - 56b: 56 push %esi - 56c: 53 push %ebx - 56d: 8b 5d 08 mov 0x8(%ebp),%ebx + 52f: 55 push %ebp + 530: 89 e5 mov %esp,%ebp + 532: 57 push %edi + 533: 56 push %esi + 534: 53 push %ebx + 535: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 570: 8d 4b f8 lea -0x8(%ebx),%ecx + 538: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 573: a1 30 09 00 00 mov 0x930,%eax - 578: eb 0c jmp 586 + 53b: a1 44 09 00 00 mov 0x944,%eax + 540: eb 0c jmp 54e if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 57a: 8b 10 mov (%eax),%edx - 57c: 39 c2 cmp %eax,%edx - 57e: 77 04 ja 584 - 580: 39 ca cmp %ecx,%edx - 582: 77 10 ja 594 + 542: 8b 10 mov (%eax),%edx + 544: 39 c2 cmp %eax,%edx + 546: 77 04 ja 54c + 548: 39 ca cmp %ecx,%edx + 54a: 77 10 ja 55c { - 584: 89 d0 mov %edx,%eax + 54c: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 586: 39 c8 cmp %ecx,%eax - 588: 73 f0 jae 57a - 58a: 8b 10 mov (%eax),%edx - 58c: 39 ca cmp %ecx,%edx - 58e: 77 04 ja 594 + 54e: 39 c8 cmp %ecx,%eax + 550: 73 f0 jae 542 + 552: 8b 10 mov (%eax),%edx + 554: 39 ca cmp %ecx,%edx + 556: 77 04 ja 55c if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 590: 39 c2 cmp %eax,%edx - 592: 77 f0 ja 584 + 558: 39 c2 cmp %eax,%edx + 55a: 77 f0 ja 54c break; if(bp + bp->s.size == p->s.ptr){ - 594: 8b 73 fc mov -0x4(%ebx),%esi - 597: 8b 10 mov (%eax),%edx - 599: 8d 3c f1 lea (%ecx,%esi,8),%edi - 59c: 39 fa cmp %edi,%edx - 59e: 74 19 je 5b9 + 55c: 8b 73 fc mov -0x4(%ebx),%esi + 55f: 8b 10 mov (%eax),%edx + 561: 8d 3c f1 lea (%ecx,%esi,8),%edi + 564: 39 fa cmp %edi,%edx + 566: 74 19 je 581 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 568: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 5a0: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 5a3: 8b 50 04 mov 0x4(%eax),%edx - 5a6: 8d 34 d0 lea (%eax,%edx,8),%esi - 5a9: 39 f1 cmp %esi,%ecx - 5ab: 74 1b je 5c8 + 56b: 8b 50 04 mov 0x4(%eax),%edx + 56e: 8d 34 d0 lea (%eax,%edx,8),%esi + 571: 39 f1 cmp %esi,%ecx + 573: 74 18 je 58d p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 575: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 5ad: 89 08 mov %ecx,(%eax) freep = p; - 5af: a3 30 09 00 00 mov %eax,0x930 + 577: a3 44 09 00 00 mov %eax,0x944 } - 5b4: 5b pop %ebx - 5b5: 5e pop %esi - 5b6: 5f pop %edi - 5b7: 5d pop %ebp - 5b8: c3 ret + 57c: 5b pop %ebx + 57d: 5e pop %esi + 57e: 5f pop %edi + 57f: 5d pop %ebp + 580: c3 ret bp->s.size += p->s.ptr->s.size; - 5b9: 03 72 04 add 0x4(%edx),%esi - 5bc: 89 73 fc mov %esi,-0x4(%ebx) + 581: 03 72 04 add 0x4(%edx),%esi + 584: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 5bf: 8b 10 mov (%eax),%edx - 5c1: 8b 12 mov (%edx),%edx - 5c3: 89 53 f8 mov %edx,-0x8(%ebx) - 5c6: eb db jmp 5a3 + 587: 8b 10 mov (%eax),%edx + 589: 8b 12 mov (%edx),%edx + 58b: eb db jmp 568 p->s.size += bp->s.size; - 5c8: 03 53 fc add -0x4(%ebx),%edx - 5cb: 89 50 04 mov %edx,0x4(%eax) + 58d: 03 53 fc add -0x4(%ebx),%edx + 590: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 5ce: 8b 53 f8 mov -0x8(%ebx),%edx - 5d1: 89 10 mov %edx,(%eax) - 5d3: eb da jmp 5af + 593: 8b 4b f8 mov -0x8(%ebx),%ecx + 596: eb dd jmp 575 -000005d5 : +00000598 : return freep; } void* malloc(uint nbytes) { - 5d5: f3 0f 1e fb endbr32 - 5d9: 55 push %ebp - 5da: 89 e5 mov %esp,%ebp - 5dc: 57 push %edi - 5dd: 56 push %esi - 5de: 53 push %ebx - 5df: 83 ec 0c sub $0xc,%esp + 598: 55 push %ebp + 599: 89 e5 mov %esp,%ebp + 59b: 57 push %edi + 59c: 56 push %esi + 59d: 53 push %ebx + 59e: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5e2: 8b 45 08 mov 0x8(%ebp),%eax - 5e5: 8d 58 07 lea 0x7(%eax),%ebx - 5e8: c1 eb 03 shr $0x3,%ebx - 5eb: 83 c3 01 add $0x1,%ebx + 5a1: 8b 45 08 mov 0x8(%ebp),%eax + 5a4: 8d 58 07 lea 0x7(%eax),%ebx + 5a7: c1 eb 03 shr $0x3,%ebx + 5aa: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5ee: 8b 15 30 09 00 00 mov 0x930,%edx - 5f4: 85 d2 test %edx,%edx - 5f6: 74 20 je 618 + 5ad: 8b 15 44 09 00 00 mov 0x944,%edx + 5b3: 85 d2 test %edx,%edx + 5b5: 74 1c je 5d3 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5f8: 8b 02 mov (%edx),%eax + 5b7: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 5fa: 8b 48 04 mov 0x4(%eax),%ecx - 5fd: 39 cb cmp %ecx,%ebx - 5ff: 76 3c jbe 63d - 601: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 607: be 00 10 00 00 mov $0x1000,%esi - 60c: 0f 43 f3 cmovae %ebx,%esi + 5b9: 8b 48 04 mov 0x4(%eax),%ecx + 5bc: 39 cb cmp %ecx,%ebx + 5be: 76 38 jbe 5f8 + 5c0: be 00 10 00 00 mov $0x1000,%esi + 5c5: 39 f3 cmp %esi,%ebx + 5c7: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 60f: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 616: eb 72 jmp 68a + 5ca: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 5d1: eb 72 jmp 645 base.s.ptr = freep = prevp = &base; - 618: c7 05 30 09 00 00 34 movl $0x934,0x930 - 61f: 09 00 00 - 622: c7 05 34 09 00 00 34 movl $0x934,0x934 - 629: 09 00 00 + 5d3: c7 05 44 09 00 00 48 movl $0x948,0x944 + 5da: 09 00 00 + 5dd: c7 05 48 09 00 00 48 movl $0x948,0x948 + 5e4: 09 00 00 base.s.size = 0; - 62c: c7 05 38 09 00 00 00 movl $0x0,0x938 - 633: 00 00 00 + 5e7: c7 05 4c 09 00 00 00 movl $0x0,0x94c + 5ee: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 636: b8 34 09 00 00 mov $0x934,%eax - 63b: eb c4 jmp 601 + 5f1: b8 48 09 00 00 mov $0x948,%eax + 5f6: eb c8 jmp 5c0 if(p->s.size == nunits) - 63d: 39 cb cmp %ecx,%ebx - 63f: 74 1e je 65f + 5f8: 39 cb cmp %ecx,%ebx + 5fa: 74 1e je 61a prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 641: 29 d9 sub %ebx,%ecx - 643: 89 48 04 mov %ecx,0x4(%eax) + 5fc: 29 d9 sub %ebx,%ecx + 5fe: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 646: 8d 04 c8 lea (%eax,%ecx,8),%eax + 601: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 649: 89 58 04 mov %ebx,0x4(%eax) + 604: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 64c: 89 15 30 09 00 00 mov %edx,0x930 + 607: 89 15 44 09 00 00 mov %edx,0x944 return (void*)(p + 1); - 652: 8d 50 08 lea 0x8(%eax),%edx + 60d: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 655: 89 d0 mov %edx,%eax - 657: 8d 65 f4 lea -0xc(%ebp),%esp - 65a: 5b pop %ebx - 65b: 5e pop %esi - 65c: 5f pop %edi - 65d: 5d pop %ebp - 65e: c3 ret + 610: 89 d0 mov %edx,%eax + 612: 8d 65 f4 lea -0xc(%ebp),%esp + 615: 5b pop %ebx + 616: 5e pop %esi + 617: 5f pop %edi + 618: 5d pop %ebp + 619: c3 ret prevp->s.ptr = p->s.ptr; - 65f: 8b 08 mov (%eax),%ecx - 661: 89 0a mov %ecx,(%edx) - 663: eb e7 jmp 64c + 61a: 8b 08 mov (%eax),%ecx + 61c: 89 0a mov %ecx,(%edx) + 61e: eb e7 jmp 607 hp->s.size = nu; - 665: 89 70 04 mov %esi,0x4(%eax) + 620: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 668: 83 ec 0c sub $0xc,%esp - 66b: 83 c0 08 add $0x8,%eax - 66e: 50 push %eax - 66f: e8 ef fe ff ff call 563 + 623: 83 ec 0c sub $0xc,%esp + 626: 83 c0 08 add $0x8,%eax + 629: 50 push %eax + 62a: e8 00 ff ff ff call 52f return freep; - 674: 8b 15 30 09 00 00 mov 0x930,%edx + 62f: 8b 15 44 09 00 00 mov 0x944,%edx if((p = morecore(nunits)) == 0) - 67a: 83 c4 10 add $0x10,%esp - 67d: 85 d2 test %edx,%edx - 67f: 74 d4 je 655 + 635: 83 c4 10 add $0x10,%esp + 638: 85 d2 test %edx,%edx + 63a: 74 d4 je 610 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 681: 8b 02 mov (%edx),%eax + 63c: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 683: 8b 48 04 mov 0x4(%eax),%ecx - 686: 39 d9 cmp %ebx,%ecx - 688: 73 b3 jae 63d + 63e: 8b 48 04 mov 0x4(%eax),%ecx + 641: 39 d9 cmp %ebx,%ecx + 643: 73 b3 jae 5f8 if(p == freep) - 68a: 89 c2 mov %eax,%edx - 68c: 39 05 30 09 00 00 cmp %eax,0x930 - 692: 75 ed jne 681 + 645: 89 c2 mov %eax,%edx + 647: 39 05 44 09 00 00 cmp %eax,0x944 + 64d: 75 ed jne 63c p = sbrk(nu * sizeof(Header)); - 694: 83 ec 0c sub $0xc,%esp - 697: 57 push %edi - 698: e8 3c fc ff ff call 2d9 + 64f: 83 ec 0c sub $0xc,%esp + 652: 57 push %edi + 653: e8 59 fc ff ff call 2b1 if(p == (char*)-1) - 69d: 83 c4 10 add $0x10,%esp - 6a0: 83 f8 ff cmp $0xffffffff,%eax - 6a3: 75 c0 jne 665 + 658: 83 c4 10 add $0x10,%esp + 65b: 83 f8 ff cmp $0xffffffff,%eax + 65e: 75 c0 jne 620 return 0; - 6a5: ba 00 00 00 00 mov $0x0,%edx - 6aa: eb a9 jmp 655 + 660: ba 00 00 00 00 mov $0x0,%edx + 665: eb a9 jmp 610 diff --git a/src/user/echo.d b/src/user/echo.d new file mode 100644 index 0000000..e4d01cd --- /dev/null +++ b/src/user/echo.d @@ -0,0 +1 @@ +user/echo.o: user/echo.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/echo.o b/src/user/echo.o new file mode 100644 index 0000000..ac38d54 Binary files /dev/null and b/src/user/echo.o differ diff --git a/src/user/echo.sym b/src/user/echo.sym index cd8a099..e30014f 100644 --- a/src/user/echo.sym +++ b/src/user/echo.sym @@ -1,59 +1,47 @@ -00000000 .text -000006ac .rodata -000006d0 .eh_frame -00000930 .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 -00000301 printint -000006bc digits.1089 +000002d9 printint +000006d0 digits.0 00000000 umalloc.c -00000930 freep -00000934 base -0000006b strcpy -00000395 printf -00000218 memmove -00000299 mknod -000002f9 ps -00000136 gets -000002d1 getpid -000005d5 malloc -000002e1 sleep -00000261 pipe -000002f1 slabtest -00000271 write -000002a9 fstat -00000281 kill -000002c1 chdir -00000289 exec -00000259 wait -00000269 read -000002a1 unlink -00000249 fork -000002d9 sbrk -000002e9 uptime -00000930 __bss_start -000000ea memset +00000944 freep +00000948 base +00000061 strcpy +00000371 printf +000001f4 memmove +00000271 mknod +000002d1 ps +0000011c gets +000002a9 getpid +00000598 malloc +000002b9 sleep +00000239 pipe +000002c9 slabtest +00000249 write +00000281 fstat +00000259 kill +00000299 chdir +00000261 exec +00000231 wait +00000241 read +00000279 unlink +00000221 fork +000002b1 sbrk +000002c1 uptime +00000944 __bss_start +000000d6 memset 00000000 main -00000091 strcmp -000002c9 dup -00000191 stat -00000930 _edata -0000093c _end -000002b1 link -00000251 exit -000001d9 atoi -000000c0 strlen -00000291 open -00000105 strchr -000002b9 mkdir -00000279 close -00000563 free +00000085 strcmp +000002a1 dup +00000173 stat +00000944 _edata +00000950 _end +00000289 link +00000229 exit +000001b7 atoi +000000b0 strlen +00000269 open +000000ef strchr +00000291 mkdir +00000251 close +0000052f free diff --git a/src/user/forktest.asm b/src/user/forktest.asm index cf37953..f43d520 100644 --- a/src/user/forktest.asm +++ b/src/user/forktest.asm @@ -11,1152 +11,1119 @@ Disassembly of section .text: void print(int fd, const char *s, ...) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 53 push %ebx - 8: 83 ec 10 sub $0x10,%esp - b: 8b 5d 0c mov 0xc(%ebp),%ebx + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 53 push %ebx + 4: 83 ec 10 sub $0x10,%esp + 7: 8b 5d 0c mov 0xc(%ebp),%ebx write(fd, s, strlen(s)); - e: 53 push %ebx - f: e8 34 01 00 00 call 148 - 14: 83 c4 0c add $0xc,%esp - 17: 50 push %eax - 18: 53 push %ebx - 19: ff 75 08 pushl 0x8(%ebp) - 1c: e8 d8 02 00 00 call 2f9 + a: 53 push %ebx + b: e8 26 01 00 00 call 136 + 10: 83 c4 0c add $0xc,%esp + 13: 50 push %eax + 14: 53 push %ebx + 15: ff 75 08 push 0x8(%ebp) + 18: e8 b2 02 00 00 call 2cf } - 21: 83 c4 10 add $0x10,%esp - 24: 8b 5d fc mov -0x4(%ebp),%ebx - 27: c9 leave - 28: c3 ret + 1d: 83 c4 10 add $0x10,%esp + 20: 8b 5d fc mov -0x4(%ebp),%ebx + 23: c9 leave + 24: c3 ret -00000029 : +00000025 : void forktest(void) { - 29: f3 0f 1e fb endbr32 - 2d: 55 push %ebp - 2e: 89 e5 mov %esp,%ebp - 30: 53 push %ebx - 31: 83 ec 0c sub $0xc,%esp + 25: 55 push %ebp + 26: 89 e5 mov %esp,%ebp + 28: 53 push %ebx + 29: 83 ec 0c sub $0xc,%esp int n, pid; print(1, "fork test\n"); - 34: 68 34 07 00 00 push $0x734 - 39: 6a 01 push $0x1 - 3b: e8 c0 ff ff ff call 0 - 40: 83 c4 10 add $0x10,%esp + 2c: 68 f0 06 00 00 push $0x6f0 + 31: 6a 01 push $0x1 + 33: e8 c8 ff ff ff call 0 + 38: 83 c4 10 add $0x10,%esp for(n=0; n + 40: e8 62 02 00 00 call 2a7 if(pid < 0) - 4d: 85 c0 test %eax,%eax - 4f: 78 2b js 7c + 45: 85 c0 test %eax,%eax + 47: 78 2b js 74 break; if(pid == 0) - 51: 74 24 je 77 + 49: 74 24 je 6f for(n=0; n + 4b: 83 c3 01 add $0x1,%ebx + 4e: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 54: 75 ea jne 40 exit(); } if(n == N){ print(1, "fork claimed to work N times!\n", N); - 5e: 83 ec 04 sub $0x4,%esp - 61: 68 e8 03 00 00 push $0x3e8 - 66: 68 74 07 00 00 push $0x774 - 6b: 6a 01 push $0x1 - 6d: e8 8e ff ff ff call 0 + 56: 83 ec 04 sub $0x4,%esp + 59: 68 e8 03 00 00 push $0x3e8 + 5e: 68 30 07 00 00 push $0x730 + 63: 6a 01 push $0x1 + 65: e8 96 ff ff ff call 0 exit(); - 72: e8 62 02 00 00 call 2d9 + 6a: e8 40 02 00 00 call 2af exit(); - 77: e8 5d 02 00 00 call 2d9 + 6f: e8 3b 02 00 00 call 2af if(n == N){ - 7c: 81 fb e8 03 00 00 cmp $0x3e8,%ebx - 82: 74 da je 5e + 74: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 7a: 74 da je 56 } for(; n > 0; n--){ - 84: 85 db test %ebx,%ebx - 86: 7e 0e jle 96 + 7c: 85 db test %ebx,%ebx + 7e: 7e 0e jle 8e if(wait() < 0){ - 88: e8 54 02 00 00 call 2e1 - 8d: 85 c0 test %eax,%eax - 8f: 78 26 js b7 + 80: e8 32 02 00 00 call 2b7 + 85: 85 c0 test %eax,%eax + 87: 78 26 js af for(; n > 0; n--){ - 91: 83 eb 01 sub $0x1,%ebx - 94: 75 f2 jne 88 + 89: 83 eb 01 sub $0x1,%ebx + 8c: 75 f2 jne 80 print(1, "wait stopped early\n"); exit(); } } if(wait() != -1){ - 96: e8 46 02 00 00 call 2e1 - 9b: 83 f8 ff cmp $0xffffffff,%eax - 9e: 75 2b jne cb + 8e: e8 24 02 00 00 call 2b7 + 93: 83 f8 ff cmp $0xffffffff,%eax + 96: 75 2b jne c3 print(1, "wait got too many\n"); exit(); } print(1, "fork test OK\n"); - a0: 83 ec 08 sub $0x8,%esp - a3: 68 66 07 00 00 push $0x766 - a8: 6a 01 push $0x1 - aa: e8 51 ff ff ff call 0 + 98: 83 ec 08 sub $0x8,%esp + 9b: 68 22 07 00 00 push $0x722 + a0: 6a 01 push $0x1 + a2: e8 59 ff ff ff call 0 } - af: 83 c4 10 add $0x10,%esp - b2: 8b 5d fc mov -0x4(%ebp),%ebx - b5: c9 leave - b6: c3 ret + a7: 83 c4 10 add $0x10,%esp + aa: 8b 5d fc mov -0x4(%ebp),%ebx + ad: c9 leave + ae: c3 ret print(1, "wait stopped early\n"); - b7: 83 ec 08 sub $0x8,%esp - ba: 68 3f 07 00 00 push $0x73f - bf: 6a 01 push $0x1 - c1: e8 3a ff ff ff call 0 + af: 83 ec 08 sub $0x8,%esp + b2: 68 fb 06 00 00 push $0x6fb + b7: 6a 01 push $0x1 + b9: e8 42 ff ff ff call 0 exit(); - c6: e8 0e 02 00 00 call 2d9 + be: e8 ec 01 00 00 call 2af print(1, "wait got too many\n"); - cb: 83 ec 08 sub $0x8,%esp - ce: 68 53 07 00 00 push $0x753 - d3: 6a 01 push $0x1 - d5: e8 26 ff ff ff call 0 + c3: 83 ec 08 sub $0x8,%esp + c6: 68 0f 07 00 00 push $0x70f + cb: 6a 01 push $0x1 + cd: e8 2e ff ff ff call 0 exit(); - da: e8 fa 01 00 00 call 2d9 + d2: e8 d8 01 00 00 call 2af -000000df
: +000000d7
: int main(void) { - df: f3 0f 1e fb endbr32 - e3: 55 push %ebp - e4: 89 e5 mov %esp,%ebp - e6: 83 e4 f0 and $0xfffffff0,%esp + d7: 55 push %ebp + d8: 89 e5 mov %esp,%ebp + da: 83 e4 f0 and $0xfffffff0,%esp forktest(); - e9: e8 3b ff ff ff call 29 + dd: e8 43 ff ff ff call 25 exit(); - ee: e8 e6 01 00 00 call 2d9 + e2: e8 c8 01 00 00 call 2af -000000f3 : +000000e7 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - f3: f3 0f 1e fb endbr32 - f7: 55 push %ebp - f8: 89 e5 mov %esp,%ebp - fa: 53 push %ebx - fb: 8b 4d 08 mov 0x8(%ebp),%ecx - fe: 8b 5d 0c mov 0xc(%ebp),%ebx + e7: 55 push %ebp + e8: 89 e5 mov %esp,%ebp + ea: 53 push %ebx + eb: 8b 4d 08 mov 0x8(%ebp),%ecx + ee: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 101: b8 00 00 00 00 mov $0x0,%eax - 106: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 10a: 88 14 01 mov %dl,(%ecx,%eax,1) - 10d: 83 c0 01 add $0x1,%eax - 110: 84 d2 test %dl,%dl - 112: 75 f2 jne 106 + f1: b8 00 00 00 00 mov $0x0,%eax + f6: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + fa: 88 14 01 mov %dl,(%ecx,%eax,1) + fd: 83 c0 01 add $0x1,%eax + 100: 84 d2 test %dl,%dl + 102: 75 f2 jne f6 ; return os; } - 114: 89 c8 mov %ecx,%eax - 116: 5b pop %ebx - 117: 5d pop %ebp - 118: c3 ret + 104: 89 c8 mov %ecx,%eax + 106: 8b 5d fc mov -0x4(%ebp),%ebx + 109: c9 leave + 10a: c3 ret -00000119 : +0000010b : int strcmp(const char *p, const char *q) { - 119: f3 0f 1e fb endbr32 - 11d: 55 push %ebp - 11e: 89 e5 mov %esp,%ebp - 120: 8b 4d 08 mov 0x8(%ebp),%ecx - 123: 8b 55 0c mov 0xc(%ebp),%edx + 10b: 55 push %ebp + 10c: 89 e5 mov %esp,%ebp + 10e: 8b 4d 08 mov 0x8(%ebp),%ecx + 111: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 126: 0f b6 01 movzbl (%ecx),%eax - 129: 84 c0 test %al,%al - 12b: 74 11 je 13e - 12d: 38 02 cmp %al,(%edx) - 12f: 75 0d jne 13e + 114: 0f b6 01 movzbl (%ecx),%eax + 117: 84 c0 test %al,%al + 119: 74 11 je 12c + 11b: 38 02 cmp %al,(%edx) + 11d: 75 0d jne 12c p++, q++; - 131: 83 c1 01 add $0x1,%ecx - 134: 83 c2 01 add $0x1,%edx + 11f: 83 c1 01 add $0x1,%ecx + 122: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 137: 0f b6 01 movzbl (%ecx),%eax - 13a: 84 c0 test %al,%al - 13c: 75 ef jne 12d + 125: 0f b6 01 movzbl (%ecx),%eax + 128: 84 c0 test %al,%al + 12a: 75 ef jne 11b return (uchar)*p - (uchar)*q; - 13e: 0f b6 c0 movzbl %al,%eax - 141: 0f b6 12 movzbl (%edx),%edx - 144: 29 d0 sub %edx,%eax + 12c: 0f b6 c0 movzbl %al,%eax + 12f: 0f b6 12 movzbl (%edx),%edx + 132: 29 d0 sub %edx,%eax } - 146: 5d pop %ebp - 147: c3 ret + 134: 5d pop %ebp + 135: c3 ret -00000148 : +00000136 : uint strlen(const char *s) { - 148: f3 0f 1e fb endbr32 - 14c: 55 push %ebp - 14d: 89 e5 mov %esp,%ebp - 14f: 8b 55 08 mov 0x8(%ebp),%edx + 136: 55 push %ebp + 137: 89 e5 mov %esp,%ebp + 139: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 152: 80 3a 00 cmpb $0x0,(%edx) - 155: 74 14 je 16b - 157: b8 00 00 00 00 mov $0x0,%eax - 15c: 83 c0 01 add $0x1,%eax - 15f: 89 c1 mov %eax,%ecx - 161: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 165: 75 f5 jne 15c + 13c: 80 3a 00 cmpb $0x0,(%edx) + 13f: 74 14 je 155 + 141: b8 00 00 00 00 mov $0x0,%eax + 146: 83 c0 01 add $0x1,%eax + 149: 89 c1 mov %eax,%ecx + 14b: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 14f: 75 f5 jne 146 ; return n; } - 167: 89 c8 mov %ecx,%eax - 169: 5d pop %ebp - 16a: c3 ret + 151: 89 c8 mov %ecx,%eax + 153: 5d pop %ebp + 154: c3 ret for(n = 0; s[n]; n++) - 16b: b9 00 00 00 00 mov $0x0,%ecx + 155: b9 00 00 00 00 mov $0x0,%ecx return n; - 170: eb f5 jmp 167 + 15a: eb f5 jmp 151 -00000172 : +0000015c : void* memset(void *dst, int c, uint n) { - 172: f3 0f 1e fb endbr32 - 176: 55 push %ebp - 177: 89 e5 mov %esp,%ebp - 179: 57 push %edi - 17a: 8b 55 08 mov 0x8(%ebp),%edx + 15c: 55 push %ebp + 15d: 89 e5 mov %esp,%ebp + 15f: 57 push %edi + 160: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 17d: 89 d7 mov %edx,%edi - 17f: 8b 4d 10 mov 0x10(%ebp),%ecx - 182: 8b 45 0c mov 0xc(%ebp),%eax - 185: fc cld - 186: f3 aa rep stos %al,%es:(%edi) + 163: 89 d7 mov %edx,%edi + 165: 8b 4d 10 mov 0x10(%ebp),%ecx + 168: 8b 45 0c mov 0xc(%ebp),%eax + 16b: fc cld + 16c: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 188: 89 d0 mov %edx,%eax - 18a: 5f pop %edi - 18b: 5d pop %ebp - 18c: c3 ret + 16e: 89 d0 mov %edx,%eax + 170: 8b 7d fc mov -0x4(%ebp),%edi + 173: c9 leave + 174: c3 ret -0000018d : +00000175 : char* strchr(const char *s, char c) { - 18d: f3 0f 1e fb endbr32 - 191: 55 push %ebp - 192: 89 e5 mov %esp,%ebp - 194: 8b 45 08 mov 0x8(%ebp),%eax - 197: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 175: 55 push %ebp + 176: 89 e5 mov %esp,%ebp + 178: 8b 45 08 mov 0x8(%ebp),%eax + 17b: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 19b: 0f b6 10 movzbl (%eax),%edx - 19e: 84 d2 test %dl,%dl - 1a0: 74 15 je 1b7 + 17f: 0f b6 10 movzbl (%eax),%edx + 182: 84 d2 test %dl,%dl + 184: 74 15 je 19b if(*s == c) - 1a2: 38 d1 cmp %dl,%cl - 1a4: 74 0f je 1b5 + 186: 38 d1 cmp %dl,%cl + 188: 74 0f je 199 for(; *s; s++) - 1a6: 83 c0 01 add $0x1,%eax - 1a9: 0f b6 10 movzbl (%eax),%edx - 1ac: 84 d2 test %dl,%dl - 1ae: 75 f2 jne 1a2 + 18a: 83 c0 01 add $0x1,%eax + 18d: 0f b6 10 movzbl (%eax),%edx + 190: 84 d2 test %dl,%dl + 192: 75 f2 jne 186 return (char*)s; return 0; - 1b0: b8 00 00 00 00 mov $0x0,%eax + 194: b8 00 00 00 00 mov $0x0,%eax } - 1b5: 5d pop %ebp - 1b6: c3 ret + 199: 5d pop %ebp + 19a: c3 ret return 0; - 1b7: b8 00 00 00 00 mov $0x0,%eax - 1bc: eb f7 jmp 1b5 + 19b: b8 00 00 00 00 mov $0x0,%eax + 1a0: eb f7 jmp 199 -000001be : +000001a2 : char* gets(char *buf, int max) { - 1be: f3 0f 1e fb endbr32 - 1c2: 55 push %ebp - 1c3: 89 e5 mov %esp,%ebp - 1c5: 57 push %edi - 1c6: 56 push %esi - 1c7: 53 push %ebx - 1c8: 83 ec 2c sub $0x2c,%esp - 1cb: 8b 75 08 mov 0x8(%ebp),%esi + 1a2: 55 push %ebp + 1a3: 89 e5 mov %esp,%ebp + 1a5: 57 push %edi + 1a6: 56 push %esi + 1a7: 53 push %ebx + 1a8: 83 ec 2c sub $0x2c,%esp + 1ab: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 1ce: bb 00 00 00 00 mov $0x0,%ebx + 1ae: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 1d3: 8d 7d e7 lea -0x19(%ebp),%edi + 1b3: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 1d6: 89 5d d4 mov %ebx,-0x2c(%ebp) - 1d9: 83 c3 01 add $0x1,%ebx - 1dc: 3b 5d 0c cmp 0xc(%ebp),%ebx - 1df: 7d 27 jge 208 + 1b6: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1b9: 83 c3 01 add $0x1,%ebx + 1bc: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1bf: 7d 27 jge 1e8 cc = read(0, &c, 1); - 1e1: 83 ec 04 sub $0x4,%esp - 1e4: 6a 01 push $0x1 - 1e6: 57 push %edi - 1e7: 6a 00 push $0x0 - 1e9: e8 03 01 00 00 call 2f1 + 1c1: 83 ec 04 sub $0x4,%esp + 1c4: 6a 01 push $0x1 + 1c6: 57 push %edi + 1c7: 6a 00 push $0x0 + 1c9: e8 f9 00 00 00 call 2c7 if(cc < 1) - 1ee: 83 c4 10 add $0x10,%esp - 1f1: 85 c0 test %eax,%eax - 1f3: 7e 13 jle 208 + 1ce: 83 c4 10 add $0x10,%esp + 1d1: 85 c0 test %eax,%eax + 1d3: 7e 13 jle 1e8 break; buf[i++] = c; - 1f5: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 1f9: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 1d5: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 1d9: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 1fd: 3c 0a cmp $0xa,%al - 1ff: 74 04 je 205 - 201: 3c 0d cmp $0xd,%al - 203: 75 d1 jne 1d6 + 1dd: 3c 0a cmp $0xa,%al + 1df: 74 04 je 1e5 + 1e1: 3c 0d cmp $0xd,%al + 1e3: 75 d1 jne 1b6 for(i=0; i+1 < max; ){ - 205: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1e5: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 208: 8b 45 d4 mov -0x2c(%ebp),%eax - 20b: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 1e8: 8b 45 d4 mov -0x2c(%ebp),%eax + 1eb: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 20f: 89 f0 mov %esi,%eax - 211: 8d 65 f4 lea -0xc(%ebp),%esp - 214: 5b pop %ebx - 215: 5e pop %esi - 216: 5f pop %edi - 217: 5d pop %ebp - 218: c3 ret + 1ef: 89 f0 mov %esi,%eax + 1f1: 8d 65 f4 lea -0xc(%ebp),%esp + 1f4: 5b pop %ebx + 1f5: 5e pop %esi + 1f6: 5f pop %edi + 1f7: 5d pop %ebp + 1f8: c3 ret -00000219 : +000001f9 : int stat(const char *n, struct stat *st) { - 219: f3 0f 1e fb endbr32 - 21d: 55 push %ebp - 21e: 89 e5 mov %esp,%ebp - 220: 56 push %esi - 221: 53 push %ebx + 1f9: 55 push %ebp + 1fa: 89 e5 mov %esp,%ebp + 1fc: 56 push %esi + 1fd: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 222: 83 ec 08 sub $0x8,%esp - 225: 6a 00 push $0x0 - 227: ff 75 08 pushl 0x8(%ebp) - 22a: e8 ea 00 00 00 call 319 + 1fe: 83 ec 08 sub $0x8,%esp + 201: 6a 00 push $0x0 + 203: ff 75 08 push 0x8(%ebp) + 206: e8 e4 00 00 00 call 2ef if(fd < 0) - 22f: 83 c4 10 add $0x10,%esp - 232: 85 c0 test %eax,%eax - 234: 78 24 js 25a - 236: 89 c3 mov %eax,%ebx + 20b: 83 c4 10 add $0x10,%esp + 20e: 85 c0 test %eax,%eax + 210: 78 24 js 236 + 212: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 238: 83 ec 08 sub $0x8,%esp - 23b: ff 75 0c pushl 0xc(%ebp) - 23e: 50 push %eax - 23f: e8 ed 00 00 00 call 331 - 244: 89 c6 mov %eax,%esi + 214: 83 ec 08 sub $0x8,%esp + 217: ff 75 0c push 0xc(%ebp) + 21a: 50 push %eax + 21b: e8 e7 00 00 00 call 307 + 220: 89 c6 mov %eax,%esi close(fd); - 246: 89 1c 24 mov %ebx,(%esp) - 249: e8 b3 00 00 00 call 301 + 222: 89 1c 24 mov %ebx,(%esp) + 225: e8 ad 00 00 00 call 2d7 return r; - 24e: 83 c4 10 add $0x10,%esp + 22a: 83 c4 10 add $0x10,%esp } - 251: 89 f0 mov %esi,%eax - 253: 8d 65 f8 lea -0x8(%ebp),%esp - 256: 5b pop %ebx - 257: 5e pop %esi - 258: 5d pop %ebp - 259: c3 ret + 22d: 89 f0 mov %esi,%eax + 22f: 8d 65 f8 lea -0x8(%ebp),%esp + 232: 5b pop %ebx + 233: 5e pop %esi + 234: 5d pop %ebp + 235: c3 ret return -1; - 25a: be ff ff ff ff mov $0xffffffff,%esi - 25f: eb f0 jmp 251 + 236: be ff ff ff ff mov $0xffffffff,%esi + 23b: eb f0 jmp 22d -00000261 : +0000023d : int atoi(const char *s) { - 261: f3 0f 1e fb endbr32 - 265: 55 push %ebp - 266: 89 e5 mov %esp,%ebp - 268: 53 push %ebx - 269: 8b 55 08 mov 0x8(%ebp),%edx + 23d: 55 push %ebp + 23e: 89 e5 mov %esp,%ebp + 240: 53 push %ebx + 241: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 26c: 0f b6 02 movzbl (%edx),%eax - 26f: 8d 48 d0 lea -0x30(%eax),%ecx - 272: 80 f9 09 cmp $0x9,%cl - 275: 77 22 ja 299 + 244: 0f b6 02 movzbl (%edx),%eax + 247: 8d 48 d0 lea -0x30(%eax),%ecx + 24a: 80 f9 09 cmp $0x9,%cl + 24d: 77 24 ja 273 n = 0; - 277: b9 00 00 00 00 mov $0x0,%ecx + 24f: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 27c: 83 c2 01 add $0x1,%edx - 27f: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 282: 0f be c0 movsbl %al,%eax - 285: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 254: 83 c2 01 add $0x1,%edx + 257: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 25a: 0f be c0 movsbl %al,%eax + 25d: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 289: 0f b6 02 movzbl (%edx),%eax - 28c: 8d 58 d0 lea -0x30(%eax),%ebx - 28f: 80 fb 09 cmp $0x9,%bl - 292: 76 e8 jbe 27c + 261: 0f b6 02 movzbl (%edx),%eax + 264: 8d 58 d0 lea -0x30(%eax),%ebx + 267: 80 fb 09 cmp $0x9,%bl + 26a: 76 e8 jbe 254 return n; } - 294: 89 c8 mov %ecx,%eax - 296: 5b pop %ebx - 297: 5d pop %ebp - 298: c3 ret + 26c: 89 c8 mov %ecx,%eax + 26e: 8b 5d fc mov -0x4(%ebp),%ebx + 271: c9 leave + 272: c3 ret n = 0; - 299: b9 00 00 00 00 mov $0x0,%ecx + 273: b9 00 00 00 00 mov $0x0,%ecx return n; - 29e: eb f4 jmp 294 + 278: eb f2 jmp 26c -000002a0 : +0000027a : void* memmove(void *vdst, const void *vsrc, int n) { - 2a0: f3 0f 1e fb endbr32 - 2a4: 55 push %ebp - 2a5: 89 e5 mov %esp,%ebp - 2a7: 56 push %esi - 2a8: 53 push %ebx - 2a9: 8b 75 08 mov 0x8(%ebp),%esi - 2ac: 8b 55 0c mov 0xc(%ebp),%edx - 2af: 8b 5d 10 mov 0x10(%ebp),%ebx + 27a: 55 push %ebp + 27b: 89 e5 mov %esp,%ebp + 27d: 56 push %esi + 27e: 53 push %ebx + 27f: 8b 75 08 mov 0x8(%ebp),%esi + 282: 8b 55 0c mov 0xc(%ebp),%edx + 285: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 2b2: 85 db test %ebx,%ebx - 2b4: 7e 15 jle 2cb - 2b6: 01 f3 add %esi,%ebx + 288: 85 db test %ebx,%ebx + 28a: 7e 15 jle 2a1 + 28c: 01 f3 add %esi,%ebx dst = vdst; - 2b8: 89 f0 mov %esi,%eax + 28e: 89 f0 mov %esi,%eax *dst++ = *src++; - 2ba: 83 c2 01 add $0x1,%edx - 2bd: 83 c0 01 add $0x1,%eax - 2c0: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 2c4: 88 48 ff mov %cl,-0x1(%eax) + 290: 83 c2 01 add $0x1,%edx + 293: 83 c0 01 add $0x1,%eax + 296: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 29a: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 2c7: 39 c3 cmp %eax,%ebx - 2c9: 75 ef jne 2ba + 29d: 39 c3 cmp %eax,%ebx + 29f: 75 ef jne 290 return vdst; } - 2cb: 89 f0 mov %esi,%eax - 2cd: 5b pop %ebx - 2ce: 5e pop %esi - 2cf: 5d pop %ebp - 2d0: c3 ret + 2a1: 89 f0 mov %esi,%eax + 2a3: 5b pop %ebx + 2a4: 5e pop %esi + 2a5: 5d pop %ebp + 2a6: c3 ret -000002d1 : +000002a7 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 2d1: b8 01 00 00 00 mov $0x1,%eax - 2d6: cd 40 int $0x40 - 2d8: c3 ret + 2a7: b8 01 00 00 00 mov $0x1,%eax + 2ac: cd 40 int $0x40 + 2ae: c3 ret -000002d9 : +000002af : SYSCALL(exit) - 2d9: b8 02 00 00 00 mov $0x2,%eax - 2de: cd 40 int $0x40 - 2e0: c3 ret + 2af: b8 02 00 00 00 mov $0x2,%eax + 2b4: cd 40 int $0x40 + 2b6: c3 ret -000002e1 : +000002b7 : SYSCALL(wait) - 2e1: b8 03 00 00 00 mov $0x3,%eax - 2e6: cd 40 int $0x40 - 2e8: c3 ret + 2b7: b8 03 00 00 00 mov $0x3,%eax + 2bc: cd 40 int $0x40 + 2be: c3 ret -000002e9 : +000002bf : SYSCALL(pipe) - 2e9: b8 04 00 00 00 mov $0x4,%eax - 2ee: cd 40 int $0x40 - 2f0: c3 ret + 2bf: b8 04 00 00 00 mov $0x4,%eax + 2c4: cd 40 int $0x40 + 2c6: c3 ret -000002f1 : +000002c7 : SYSCALL(read) - 2f1: b8 05 00 00 00 mov $0x5,%eax - 2f6: cd 40 int $0x40 - 2f8: c3 ret + 2c7: b8 05 00 00 00 mov $0x5,%eax + 2cc: cd 40 int $0x40 + 2ce: c3 ret -000002f9 : +000002cf : SYSCALL(write) - 2f9: b8 10 00 00 00 mov $0x10,%eax - 2fe: cd 40 int $0x40 - 300: c3 ret + 2cf: b8 10 00 00 00 mov $0x10,%eax + 2d4: cd 40 int $0x40 + 2d6: c3 ret -00000301 : +000002d7 : SYSCALL(close) - 301: b8 15 00 00 00 mov $0x15,%eax - 306: cd 40 int $0x40 - 308: c3 ret + 2d7: b8 15 00 00 00 mov $0x15,%eax + 2dc: cd 40 int $0x40 + 2de: c3 ret -00000309 : +000002df : SYSCALL(kill) - 309: b8 06 00 00 00 mov $0x6,%eax - 30e: cd 40 int $0x40 - 310: c3 ret + 2df: b8 06 00 00 00 mov $0x6,%eax + 2e4: cd 40 int $0x40 + 2e6: c3 ret -00000311 : +000002e7 : SYSCALL(exec) - 311: b8 07 00 00 00 mov $0x7,%eax - 316: cd 40 int $0x40 - 318: c3 ret + 2e7: b8 07 00 00 00 mov $0x7,%eax + 2ec: cd 40 int $0x40 + 2ee: c3 ret -00000319 : +000002ef : SYSCALL(open) - 319: b8 0f 00 00 00 mov $0xf,%eax - 31e: cd 40 int $0x40 - 320: c3 ret + 2ef: b8 0f 00 00 00 mov $0xf,%eax + 2f4: cd 40 int $0x40 + 2f6: c3 ret -00000321 : +000002f7 : SYSCALL(mknod) - 321: b8 11 00 00 00 mov $0x11,%eax - 326: cd 40 int $0x40 - 328: c3 ret + 2f7: b8 11 00 00 00 mov $0x11,%eax + 2fc: cd 40 int $0x40 + 2fe: c3 ret -00000329 : +000002ff : SYSCALL(unlink) - 329: b8 12 00 00 00 mov $0x12,%eax - 32e: cd 40 int $0x40 - 330: c3 ret + 2ff: b8 12 00 00 00 mov $0x12,%eax + 304: cd 40 int $0x40 + 306: c3 ret -00000331 : +00000307 : SYSCALL(fstat) - 331: b8 08 00 00 00 mov $0x8,%eax - 336: cd 40 int $0x40 - 338: c3 ret + 307: b8 08 00 00 00 mov $0x8,%eax + 30c: cd 40 int $0x40 + 30e: c3 ret -00000339 : +0000030f : SYSCALL(link) - 339: b8 13 00 00 00 mov $0x13,%eax - 33e: cd 40 int $0x40 - 340: c3 ret + 30f: b8 13 00 00 00 mov $0x13,%eax + 314: cd 40 int $0x40 + 316: c3 ret -00000341 : +00000317 : SYSCALL(mkdir) - 341: b8 14 00 00 00 mov $0x14,%eax - 346: cd 40 int $0x40 - 348: c3 ret + 317: b8 14 00 00 00 mov $0x14,%eax + 31c: cd 40 int $0x40 + 31e: c3 ret -00000349 : +0000031f : SYSCALL(chdir) - 349: b8 09 00 00 00 mov $0x9,%eax - 34e: cd 40 int $0x40 - 350: c3 ret + 31f: b8 09 00 00 00 mov $0x9,%eax + 324: cd 40 int $0x40 + 326: c3 ret -00000351 : +00000327 : SYSCALL(dup) - 351: b8 0a 00 00 00 mov $0xa,%eax - 356: cd 40 int $0x40 - 358: c3 ret + 327: b8 0a 00 00 00 mov $0xa,%eax + 32c: cd 40 int $0x40 + 32e: c3 ret -00000359 : +0000032f : SYSCALL(getpid) - 359: b8 0b 00 00 00 mov $0xb,%eax - 35e: cd 40 int $0x40 - 360: c3 ret + 32f: b8 0b 00 00 00 mov $0xb,%eax + 334: cd 40 int $0x40 + 336: c3 ret -00000361 : +00000337 : SYSCALL(sbrk) - 361: b8 0c 00 00 00 mov $0xc,%eax - 366: cd 40 int $0x40 - 368: c3 ret + 337: b8 0c 00 00 00 mov $0xc,%eax + 33c: cd 40 int $0x40 + 33e: c3 ret -00000369 : +0000033f : SYSCALL(sleep) - 369: b8 0d 00 00 00 mov $0xd,%eax - 36e: cd 40 int $0x40 - 370: c3 ret + 33f: b8 0d 00 00 00 mov $0xd,%eax + 344: cd 40 int $0x40 + 346: c3 ret -00000371 : +00000347 : SYSCALL(uptime) - 371: b8 0e 00 00 00 mov $0xe,%eax - 376: cd 40 int $0x40 - 378: c3 ret + 347: b8 0e 00 00 00 mov $0xe,%eax + 34c: cd 40 int $0x40 + 34e: c3 ret -00000379 : +0000034f : SYSCALL(slabtest) - 379: b8 16 00 00 00 mov $0x16,%eax - 37e: cd 40 int $0x40 - 380: c3 ret + 34f: b8 16 00 00 00 mov $0x16,%eax + 354: cd 40 int $0x40 + 356: c3 ret -00000381 : +00000357 : SYSCALL(ps) - 381: b8 17 00 00 00 mov $0x17,%eax - 386: cd 40 int $0x40 - 388: c3 ret + 357: b8 17 00 00 00 mov $0x17,%eax + 35c: cd 40 int $0x40 + 35e: c3 ret -00000389 : +0000035f : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 389: 55 push %ebp - 38a: 89 e5 mov %esp,%ebp - 38c: 57 push %edi - 38d: 56 push %esi - 38e: 53 push %ebx - 38f: 83 ec 3c sub $0x3c,%esp - 392: 89 45 c4 mov %eax,-0x3c(%ebp) - 395: 89 d3 mov %edx,%ebx + 35f: 55 push %ebp + 360: 89 e5 mov %esp,%ebp + 362: 57 push %edi + 363: 56 push %esi + 364: 53 push %ebx + 365: 83 ec 3c sub $0x3c,%esp + 368: 89 45 c4 mov %eax,-0x3c(%ebp) + 36b: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 397: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 39b: 74 77 je 414 - 39d: 85 d2 test %edx,%edx - 39f: 79 73 jns 414 + 36d: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 371: 74 79 je 3ec + 373: 85 d2 test %edx,%edx + 375: 79 75 jns 3ec neg = 1; x = -xx; - 3a1: f7 db neg %ebx + 377: 89 d1 mov %edx,%ecx + 379: f7 d9 neg %ecx neg = 1; - 3a3: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 37b: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 3aa: be 00 00 00 00 mov $0x0,%esi + 382: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 3af: 89 f7 mov %esi,%edi - 3b1: 83 c6 01 add $0x1,%esi - 3b4: 89 d8 mov %ebx,%eax - 3b6: ba 00 00 00 00 mov $0x0,%edx - 3bb: f7 f1 div %ecx - 3bd: 0f b6 92 9c 07 00 00 movzbl 0x79c(%edx),%edx - 3c4: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 387: 89 df mov %ebx,%edi + 389: 83 c3 01 add $0x1,%ebx + 38c: 89 c8 mov %ecx,%eax + 38e: ba 00 00 00 00 mov $0x0,%edx + 393: f7 f6 div %esi + 395: 0f b6 92 b0 07 00 00 movzbl 0x7b0(%edx),%edx + 39c: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 3c8: 89 da mov %ebx,%edx - 3ca: 89 c3 mov %eax,%ebx - 3cc: 39 d1 cmp %edx,%ecx - 3ce: 76 df jbe 3af + 3a0: 89 ca mov %ecx,%edx + 3a2: 89 c1 mov %eax,%ecx + 3a4: 39 d6 cmp %edx,%esi + 3a6: 76 df jbe 387 if(neg) - 3d0: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 3d4: 74 08 je 3de + 3a8: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 3ac: 74 08 je 3b6 buf[i++] = '-'; - 3d6: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 3db: 8d 77 02 lea 0x2(%edi),%esi + 3ae: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 3b3: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 3de: 85 f6 test %esi,%esi - 3e0: 7e 2a jle 40c - 3e2: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 3e6: 8d 7d d8 lea -0x28(%ebp),%edi + 3b6: 85 db test %ebx,%ebx + 3b8: 7e 2a jle 3e4 + 3ba: 8d 7d d8 lea -0x28(%ebp),%edi + 3bd: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 3e9: 8d 75 d7 lea -0x29(%ebp),%esi + 3c1: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 3ec: 0f b6 03 movzbl (%ebx),%eax - 3ef: 88 45 d7 mov %al,-0x29(%ebp) + 3c4: 0f b6 03 movzbl (%ebx),%eax + 3c7: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 3f2: 83 ec 04 sub $0x4,%esp - 3f5: 6a 01 push $0x1 - 3f7: 56 push %esi - 3f8: ff 75 c4 pushl -0x3c(%ebp) - 3fb: e8 f9 fe ff ff call 2f9 + 3ca: 83 ec 04 sub $0x4,%esp + 3cd: 6a 01 push $0x1 + 3cf: 56 push %esi + 3d0: ff 75 c4 push -0x3c(%ebp) + 3d3: e8 f7 fe ff ff call 2cf while(--i >= 0) - 400: 89 d8 mov %ebx,%eax - 402: 83 eb 01 sub $0x1,%ebx - 405: 83 c4 10 add $0x10,%esp - 408: 39 f8 cmp %edi,%eax - 40a: 75 e0 jne 3ec + 3d8: 89 d8 mov %ebx,%eax + 3da: 83 eb 01 sub $0x1,%ebx + 3dd: 83 c4 10 add $0x10,%esp + 3e0: 39 f8 cmp %edi,%eax + 3e2: 75 e0 jne 3c4 } - 40c: 8d 65 f4 lea -0xc(%ebp),%esp - 40f: 5b pop %ebx - 410: 5e pop %esi - 411: 5f pop %edi - 412: 5d pop %ebp - 413: c3 ret + 3e4: 8d 65 f4 lea -0xc(%ebp),%esp + 3e7: 5b pop %ebx + 3e8: 5e pop %esi + 3e9: 5f pop %edi + 3ea: 5d pop %ebp + 3eb: c3 ret + x = xx; + 3ec: 89 d1 mov %edx,%ecx neg = 0; - 414: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 41b: eb 8d jmp 3aa + 3ee: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 3f5: eb 8b jmp 382 -0000041d : +000003f7 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 41d: f3 0f 1e fb endbr32 - 421: 55 push %ebp - 422: 89 e5 mov %esp,%ebp - 424: 57 push %edi - 425: 56 push %esi - 426: 53 push %ebx - 427: 83 ec 2c sub $0x2c,%esp + 3f7: 55 push %ebp + 3f8: 89 e5 mov %esp,%ebp + 3fa: 57 push %edi + 3fb: 56 push %esi + 3fc: 53 push %ebx + 3fd: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 42a: 8b 75 0c mov 0xc(%ebp),%esi - 42d: 0f b6 1e movzbl (%esi),%ebx - 430: 84 db test %bl,%bl - 432: 0f 84 ab 01 00 00 je 5e3 - 438: 83 c6 01 add $0x1,%esi + 400: 8b 75 0c mov 0xc(%ebp),%esi + 403: 0f b6 1e movzbl (%esi),%ebx + 406: 84 db test %bl,%bl + 408: 0f 84 9f 01 00 00 je 5ad + 40e: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 43b: 8d 45 10 lea 0x10(%ebp),%eax - 43e: 89 45 d4 mov %eax,-0x2c(%ebp) + 411: 8d 45 10 lea 0x10(%ebp),%eax + 414: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 441: bf 00 00 00 00 mov $0x0,%edi - 446: eb 2d jmp 475 + 417: bf 00 00 00 00 mov $0x0,%edi + 41c: eb 2d jmp 44b c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 448: 88 5d e7 mov %bl,-0x19(%ebp) + 41e: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 44b: 83 ec 04 sub $0x4,%esp - 44e: 6a 01 push $0x1 - 450: 8d 45 e7 lea -0x19(%ebp),%eax - 453: 50 push %eax - 454: ff 75 08 pushl 0x8(%ebp) - 457: e8 9d fe ff ff call 2f9 + 421: 83 ec 04 sub $0x4,%esp + 424: 6a 01 push $0x1 + 426: 8d 45 e7 lea -0x19(%ebp),%eax + 429: 50 push %eax + 42a: ff 75 08 push 0x8(%ebp) + 42d: e8 9d fe ff ff call 2cf putc(fd, c); - 45c: 83 c4 10 add $0x10,%esp - 45f: eb 05 jmp 466 + 432: 83 c4 10 add $0x10,%esp + 435: eb 05 jmp 43c } } else if(state == '%'){ - 461: 83 ff 25 cmp $0x25,%edi - 464: 74 22 je 488 + 437: 83 ff 25 cmp $0x25,%edi + 43a: 74 1f je 45b for(i = 0; fmt[i]; i++){ - 466: 83 c6 01 add $0x1,%esi - 469: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 46d: 84 db test %bl,%bl - 46f: 0f 84 6e 01 00 00 je 5e3 + 43c: 83 c6 01 add $0x1,%esi + 43f: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 443: 84 db test %bl,%bl + 445: 0f 84 62 01 00 00 je 5ad c = fmt[i] & 0xff; - 475: 0f be d3 movsbl %bl,%edx - 478: 0f b6 c3 movzbl %bl,%eax + 44b: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 47b: 85 ff test %edi,%edi - 47d: 75 e2 jne 461 + 44e: 85 ff test %edi,%edi + 450: 75 e5 jne 437 if(c == '%'){ - 47f: 83 f8 25 cmp $0x25,%eax - 482: 75 c4 jne 448 + 452: 83 f8 25 cmp $0x25,%eax + 455: 75 c7 jne 41e state = '%'; - 484: 89 c7 mov %eax,%edi - 486: eb de jmp 466 + 457: 89 c7 mov %eax,%edi + 459: eb e1 jmp 43c if(c == 'd'){ - 488: 83 f8 64 cmp $0x64,%eax - 48b: 74 59 je 4e6 + 45b: 83 f8 25 cmp $0x25,%eax + 45e: 0f 84 f2 00 00 00 je 556 + 464: 8d 50 9d lea -0x63(%eax),%edx + 467: 83 fa 15 cmp $0x15,%edx + 46a: 0f 87 07 01 00 00 ja 577 + 470: 0f 87 01 01 00 00 ja 577 + 476: ff 24 95 58 07 00 00 jmp *0x758(,%edx,4) printint(fd, *ap, 10, 1); + 47d: 83 ec 0c sub $0xc,%esp + 480: 6a 01 push $0x1 + 482: b9 0a 00 00 00 mov $0xa,%ecx + 487: 8b 7d d4 mov -0x2c(%ebp),%edi + 48a: 8b 17 mov (%edi),%edx + 48c: 8b 45 08 mov 0x8(%ebp),%eax + 48f: e8 cb fe ff ff call 35f ap++; - } else if(c == 'x' || c == 'p'){ - 48d: 81 e2 f7 00 00 00 and $0xf7,%edx - 493: 83 fa 70 cmp $0x70,%edx - 496: 74 7a je 512 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 498: 83 f8 73 cmp $0x73,%eax - 49b: 0f 84 9d 00 00 00 je 53e - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 4a1: 83 f8 63 cmp $0x63,%eax - 4a4: 0f 84 ec 00 00 00 je 596 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 4aa: 83 f8 25 cmp $0x25,%eax - 4ad: 0f 84 0f 01 00 00 je 5c2 - putc(fd, c); + 494: 89 f8 mov %edi,%eax + 496: 83 c0 04 add $0x4,%eax + 499: 89 45 d4 mov %eax,-0x2c(%ebp) + 49c: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 4b3: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 4b7: 83 ec 04 sub $0x4,%esp - 4ba: 6a 01 push $0x1 - 4bc: 8d 45 e7 lea -0x19(%ebp),%eax - 4bf: 50 push %eax - 4c0: ff 75 08 pushl 0x8(%ebp) - 4c3: e8 31 fe ff ff call 2f9 putc(fd, c); - 4c8: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 4cb: 83 c4 0c add $0xc,%esp - 4ce: 6a 01 push $0x1 - 4d0: 8d 45 e7 lea -0x19(%ebp),%eax - 4d3: 50 push %eax - 4d4: ff 75 08 pushl 0x8(%ebp) - 4d7: e8 1d fe ff ff call 2f9 - putc(fd, c); - 4dc: 83 c4 10 add $0x10,%esp } state = 0; - 4df: bf 00 00 00 00 mov $0x0,%edi - 4e4: eb 80 jmp 466 - printint(fd, *ap, 10, 1); - 4e6: 83 ec 0c sub $0xc,%esp - 4e9: 6a 01 push $0x1 - 4eb: b9 0a 00 00 00 mov $0xa,%ecx - 4f0: 8b 7d d4 mov -0x2c(%ebp),%edi - 4f3: 8b 17 mov (%edi),%edx - 4f5: 8b 45 08 mov 0x8(%ebp),%eax - 4f8: e8 8c fe ff ff call 389 - ap++; - 4fd: 89 f8 mov %edi,%eax - 4ff: 83 c0 04 add $0x4,%eax - 502: 89 45 d4 mov %eax,-0x2c(%ebp) - 505: 83 c4 10 add $0x10,%esp - state = 0; - 508: bf 00 00 00 00 mov $0x0,%edi - 50d: e9 54 ff ff ff jmp 466 + 49f: bf 00 00 00 00 mov $0x0,%edi + 4a4: eb 96 jmp 43c printint(fd, *ap, 16, 0); - 512: 83 ec 0c sub $0xc,%esp - 515: 6a 00 push $0x0 - 517: b9 10 00 00 00 mov $0x10,%ecx - 51c: 8b 7d d4 mov -0x2c(%ebp),%edi - 51f: 8b 17 mov (%edi),%edx - 521: 8b 45 08 mov 0x8(%ebp),%eax - 524: e8 60 fe ff ff call 389 + 4a6: 83 ec 0c sub $0xc,%esp + 4a9: 6a 00 push $0x0 + 4ab: b9 10 00 00 00 mov $0x10,%ecx + 4b0: 8b 7d d4 mov -0x2c(%ebp),%edi + 4b3: 8b 17 mov (%edi),%edx + 4b5: 8b 45 08 mov 0x8(%ebp),%eax + 4b8: e8 a2 fe ff ff call 35f ap++; - 529: 89 f8 mov %edi,%eax - 52b: 83 c0 04 add $0x4,%eax - 52e: 89 45 d4 mov %eax,-0x2c(%ebp) - 531: 83 c4 10 add $0x10,%esp + 4bd: 89 f8 mov %edi,%eax + 4bf: 83 c0 04 add $0x4,%eax + 4c2: 89 45 d4 mov %eax,-0x2c(%ebp) + 4c5: 83 c4 10 add $0x10,%esp state = 0; - 534: bf 00 00 00 00 mov $0x0,%edi - 539: e9 28 ff ff ff jmp 466 + 4c8: bf 00 00 00 00 mov $0x0,%edi + 4cd: e9 6a ff ff ff jmp 43c s = (char*)*ap; - 53e: 8b 4d d4 mov -0x2c(%ebp),%ecx - 541: 8b 01 mov (%ecx),%eax + 4d2: 8b 4d d4 mov -0x2c(%ebp),%ecx + 4d5: 8b 01 mov (%ecx),%eax ap++; - 543: 83 c1 04 add $0x4,%ecx - 546: 89 4d d4 mov %ecx,-0x2c(%ebp) + 4d7: 83 c1 04 add $0x4,%ecx + 4da: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 549: 85 c0 test %eax,%eax - 54b: 74 13 je 560 + 4dd: 85 c0 test %eax,%eax + 4df: 74 13 je 4f4 s = (char*)*ap; - 54d: 89 c3 mov %eax,%ebx + 4e1: 89 c3 mov %eax,%ebx while(*s != 0){ - 54f: 0f b6 00 movzbl (%eax),%eax + 4e3: 0f b6 00 movzbl (%eax),%eax state = 0; - 552: bf 00 00 00 00 mov $0x0,%edi + 4e6: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 557: 84 c0 test %al,%al - 559: 75 0f jne 56a - 55b: e9 06 ff ff ff jmp 466 + 4eb: 84 c0 test %al,%al + 4ed: 75 0f jne 4fe + 4ef: e9 48 ff ff ff jmp 43c s = "(null)"; - 560: bb 93 07 00 00 mov $0x793,%ebx + 4f4: bb 4f 07 00 00 mov $0x74f,%ebx while(*s != 0){ - 565: b8 28 00 00 00 mov $0x28,%eax - 56a: 8b 7d 08 mov 0x8(%ebp),%edi + 4f9: b8 28 00 00 00 mov $0x28,%eax + 4fe: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 56d: 88 45 e7 mov %al,-0x19(%ebp) + 501: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 570: 83 ec 04 sub $0x4,%esp - 573: 6a 01 push $0x1 - 575: 8d 45 e7 lea -0x19(%ebp),%eax - 578: 50 push %eax - 579: 57 push %edi - 57a: e8 7a fd ff ff call 2f9 + 504: 83 ec 04 sub $0x4,%esp + 507: 6a 01 push $0x1 + 509: 8d 45 e7 lea -0x19(%ebp),%eax + 50c: 50 push %eax + 50d: 57 push %edi + 50e: e8 bc fd ff ff call 2cf s++; - 57f: 83 c3 01 add $0x1,%ebx + 513: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 582: 0f b6 03 movzbl (%ebx),%eax - 585: 83 c4 10 add $0x10,%esp - 588: 84 c0 test %al,%al - 58a: 75 e1 jne 56d + 516: 0f b6 03 movzbl (%ebx),%eax + 519: 83 c4 10 add $0x10,%esp + 51c: 84 c0 test %al,%al + 51e: 75 e1 jne 501 state = 0; - 58c: bf 00 00 00 00 mov $0x0,%edi - 591: e9 d0 fe ff ff jmp 466 + 520: bf 00 00 00 00 mov $0x0,%edi + 525: e9 12 ff ff ff jmp 43c putc(fd, *ap); - 596: 8b 7d d4 mov -0x2c(%ebp),%edi - 599: 8b 07 mov (%edi),%eax - 59b: 88 45 e7 mov %al,-0x19(%ebp) + 52a: 8b 7d d4 mov -0x2c(%ebp),%edi + 52d: 8b 07 mov (%edi),%eax + 52f: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 59e: 83 ec 04 sub $0x4,%esp - 5a1: 6a 01 push $0x1 - 5a3: 8d 45 e7 lea -0x19(%ebp),%eax - 5a6: 50 push %eax - 5a7: ff 75 08 pushl 0x8(%ebp) - 5aa: e8 4a fd ff ff call 2f9 + 532: 83 ec 04 sub $0x4,%esp + 535: 6a 01 push $0x1 + 537: 8d 45 e7 lea -0x19(%ebp),%eax + 53a: 50 push %eax + 53b: ff 75 08 push 0x8(%ebp) + 53e: e8 8c fd ff ff call 2cf ap++; - 5af: 83 c7 04 add $0x4,%edi - 5b2: 89 7d d4 mov %edi,-0x2c(%ebp) - 5b5: 83 c4 10 add $0x10,%esp + 543: 83 c7 04 add $0x4,%edi + 546: 89 7d d4 mov %edi,-0x2c(%ebp) + 549: 83 c4 10 add $0x10,%esp state = 0; - 5b8: bf 00 00 00 00 mov $0x0,%edi - 5bd: e9 a4 fe ff ff jmp 466 + 54c: bf 00 00 00 00 mov $0x0,%edi + 551: e9 e6 fe ff ff jmp 43c putc(fd, c); - 5c2: 88 5d e7 mov %bl,-0x19(%ebp) + 556: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 5c5: 83 ec 04 sub $0x4,%esp - 5c8: 6a 01 push $0x1 - 5ca: 8d 45 e7 lea -0x19(%ebp),%eax - 5cd: 50 push %eax - 5ce: ff 75 08 pushl 0x8(%ebp) - 5d1: e8 23 fd ff ff call 2f9 - 5d6: 83 c4 10 add $0x10,%esp + 559: 83 ec 04 sub $0x4,%esp + 55c: 6a 01 push $0x1 + 55e: 8d 45 e7 lea -0x19(%ebp),%eax + 561: 50 push %eax + 562: ff 75 08 push 0x8(%ebp) + 565: e8 65 fd ff ff call 2cf + 56a: 83 c4 10 add $0x10,%esp + state = 0; + 56d: bf 00 00 00 00 mov $0x0,%edi + 572: e9 c5 fe ff ff jmp 43c + putc(fd, '%'); + 577: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 57b: 83 ec 04 sub $0x4,%esp + 57e: 6a 01 push $0x1 + 580: 8d 45 e7 lea -0x19(%ebp),%eax + 583: 50 push %eax + 584: ff 75 08 push 0x8(%ebp) + 587: e8 43 fd ff ff call 2cf + putc(fd, c); + 58c: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 58f: 83 c4 0c add $0xc,%esp + 592: 6a 01 push $0x1 + 594: 8d 45 e7 lea -0x19(%ebp),%eax + 597: 50 push %eax + 598: ff 75 08 push 0x8(%ebp) + 59b: e8 2f fd ff ff call 2cf + putc(fd, c); + 5a0: 83 c4 10 add $0x10,%esp state = 0; - 5d9: bf 00 00 00 00 mov $0x0,%edi - 5de: e9 83 fe ff ff jmp 466 + 5a3: bf 00 00 00 00 mov $0x0,%edi + 5a8: e9 8f fe ff ff jmp 43c } } } - 5e3: 8d 65 f4 lea -0xc(%ebp),%esp - 5e6: 5b pop %ebx - 5e7: 5e pop %esi - 5e8: 5f pop %edi - 5e9: 5d pop %ebp - 5ea: c3 ret - -000005eb : + 5ad: 8d 65 f4 lea -0xc(%ebp),%esp + 5b0: 5b pop %ebx + 5b1: 5e pop %esi + 5b2: 5f pop %edi + 5b3: 5d pop %ebp + 5b4: c3 ret + +000005b5 : static Header base; static Header *freep; void free(void *ap) { - 5eb: f3 0f 1e fb endbr32 - 5ef: 55 push %ebp - 5f0: 89 e5 mov %esp,%ebp - 5f2: 57 push %edi - 5f3: 56 push %esi - 5f4: 53 push %ebx - 5f5: 8b 5d 08 mov 0x8(%ebp),%ebx + 5b5: 55 push %ebp + 5b6: 89 e5 mov %esp,%ebp + 5b8: 57 push %edi + 5b9: 56 push %esi + 5ba: 53 push %ebx + 5bb: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 5f8: 8d 4b f8 lea -0x8(%ebx),%ecx + 5be: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 5fb: a1 48 0a 00 00 mov 0xa48,%eax - 600: eb 0c jmp 60e + 5c1: a1 5c 0a 00 00 mov 0xa5c,%eax + 5c6: eb 0c jmp 5d4 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 602: 8b 10 mov (%eax),%edx - 604: 39 c2 cmp %eax,%edx - 606: 77 04 ja 60c - 608: 39 ca cmp %ecx,%edx - 60a: 77 10 ja 61c + 5c8: 8b 10 mov (%eax),%edx + 5ca: 39 c2 cmp %eax,%edx + 5cc: 77 04 ja 5d2 + 5ce: 39 ca cmp %ecx,%edx + 5d0: 77 10 ja 5e2 { - 60c: 89 d0 mov %edx,%eax + 5d2: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 60e: 39 c8 cmp %ecx,%eax - 610: 73 f0 jae 602 - 612: 8b 10 mov (%eax),%edx - 614: 39 ca cmp %ecx,%edx - 616: 77 04 ja 61c + 5d4: 39 c8 cmp %ecx,%eax + 5d6: 73 f0 jae 5c8 + 5d8: 8b 10 mov (%eax),%edx + 5da: 39 ca cmp %ecx,%edx + 5dc: 77 04 ja 5e2 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 618: 39 c2 cmp %eax,%edx - 61a: 77 f0 ja 60c + 5de: 39 c2 cmp %eax,%edx + 5e0: 77 f0 ja 5d2 break; if(bp + bp->s.size == p->s.ptr){ - 61c: 8b 73 fc mov -0x4(%ebx),%esi - 61f: 8b 10 mov (%eax),%edx - 621: 8d 3c f1 lea (%ecx,%esi,8),%edi - 624: 39 fa cmp %edi,%edx - 626: 74 19 je 641 + 5e2: 8b 73 fc mov -0x4(%ebx),%esi + 5e5: 8b 10 mov (%eax),%edx + 5e7: 8d 3c f1 lea (%ecx,%esi,8),%edi + 5ea: 39 fa cmp %edi,%edx + 5ec: 74 19 je 607 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 5ee: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 628: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 62b: 8b 50 04 mov 0x4(%eax),%edx - 62e: 8d 34 d0 lea (%eax,%edx,8),%esi - 631: 39 f1 cmp %esi,%ecx - 633: 74 1b je 650 + 5f1: 8b 50 04 mov 0x4(%eax),%edx + 5f4: 8d 34 d0 lea (%eax,%edx,8),%esi + 5f7: 39 f1 cmp %esi,%ecx + 5f9: 74 18 je 613 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 5fb: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 635: 89 08 mov %ecx,(%eax) freep = p; - 637: a3 48 0a 00 00 mov %eax,0xa48 + 5fd: a3 5c 0a 00 00 mov %eax,0xa5c } - 63c: 5b pop %ebx - 63d: 5e pop %esi - 63e: 5f pop %edi - 63f: 5d pop %ebp - 640: c3 ret + 602: 5b pop %ebx + 603: 5e pop %esi + 604: 5f pop %edi + 605: 5d pop %ebp + 606: c3 ret bp->s.size += p->s.ptr->s.size; - 641: 03 72 04 add 0x4(%edx),%esi - 644: 89 73 fc mov %esi,-0x4(%ebx) + 607: 03 72 04 add 0x4(%edx),%esi + 60a: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 647: 8b 10 mov (%eax),%edx - 649: 8b 12 mov (%edx),%edx - 64b: 89 53 f8 mov %edx,-0x8(%ebx) - 64e: eb db jmp 62b + 60d: 8b 10 mov (%eax),%edx + 60f: 8b 12 mov (%edx),%edx + 611: eb db jmp 5ee p->s.size += bp->s.size; - 650: 03 53 fc add -0x4(%ebx),%edx - 653: 89 50 04 mov %edx,0x4(%eax) + 613: 03 53 fc add -0x4(%ebx),%edx + 616: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 656: 8b 53 f8 mov -0x8(%ebx),%edx - 659: 89 10 mov %edx,(%eax) - 65b: eb da jmp 637 + 619: 8b 4b f8 mov -0x8(%ebx),%ecx + 61c: eb dd jmp 5fb -0000065d : +0000061e : return freep; } void* malloc(uint nbytes) { - 65d: f3 0f 1e fb endbr32 - 661: 55 push %ebp - 662: 89 e5 mov %esp,%ebp - 664: 57 push %edi - 665: 56 push %esi - 666: 53 push %ebx - 667: 83 ec 0c sub $0xc,%esp + 61e: 55 push %ebp + 61f: 89 e5 mov %esp,%ebp + 621: 57 push %edi + 622: 56 push %esi + 623: 53 push %ebx + 624: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 66a: 8b 45 08 mov 0x8(%ebp),%eax - 66d: 8d 58 07 lea 0x7(%eax),%ebx - 670: c1 eb 03 shr $0x3,%ebx - 673: 83 c3 01 add $0x1,%ebx + 627: 8b 45 08 mov 0x8(%ebp),%eax + 62a: 8d 58 07 lea 0x7(%eax),%ebx + 62d: c1 eb 03 shr $0x3,%ebx + 630: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 676: 8b 15 48 0a 00 00 mov 0xa48,%edx - 67c: 85 d2 test %edx,%edx - 67e: 74 20 je 6a0 + 633: 8b 15 5c 0a 00 00 mov 0xa5c,%edx + 639: 85 d2 test %edx,%edx + 63b: 74 1c je 659 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 680: 8b 02 mov (%edx),%eax + 63d: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 682: 8b 48 04 mov 0x4(%eax),%ecx - 685: 39 cb cmp %ecx,%ebx - 687: 76 3c jbe 6c5 - 689: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 68f: be 00 10 00 00 mov $0x1000,%esi - 694: 0f 43 f3 cmovae %ebx,%esi + 63f: 8b 48 04 mov 0x4(%eax),%ecx + 642: 39 cb cmp %ecx,%ebx + 644: 76 38 jbe 67e + 646: be 00 10 00 00 mov $0x1000,%esi + 64b: 39 f3 cmp %esi,%ebx + 64d: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 697: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 69e: eb 72 jmp 712 + 650: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 657: eb 72 jmp 6cb base.s.ptr = freep = prevp = &base; - 6a0: c7 05 48 0a 00 00 4c movl $0xa4c,0xa48 - 6a7: 0a 00 00 - 6aa: c7 05 4c 0a 00 00 4c movl $0xa4c,0xa4c - 6b1: 0a 00 00 + 659: c7 05 5c 0a 00 00 60 movl $0xa60,0xa5c + 660: 0a 00 00 + 663: c7 05 60 0a 00 00 60 movl $0xa60,0xa60 + 66a: 0a 00 00 base.s.size = 0; - 6b4: c7 05 50 0a 00 00 00 movl $0x0,0xa50 - 6bb: 00 00 00 + 66d: c7 05 64 0a 00 00 00 movl $0x0,0xa64 + 674: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6be: b8 4c 0a 00 00 mov $0xa4c,%eax - 6c3: eb c4 jmp 689 + 677: b8 60 0a 00 00 mov $0xa60,%eax + 67c: eb c8 jmp 646 if(p->s.size == nunits) - 6c5: 39 cb cmp %ecx,%ebx - 6c7: 74 1e je 6e7 + 67e: 39 cb cmp %ecx,%ebx + 680: 74 1e je 6a0 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 6c9: 29 d9 sub %ebx,%ecx - 6cb: 89 48 04 mov %ecx,0x4(%eax) + 682: 29 d9 sub %ebx,%ecx + 684: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 6ce: 8d 04 c8 lea (%eax,%ecx,8),%eax + 687: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 6d1: 89 58 04 mov %ebx,0x4(%eax) + 68a: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 6d4: 89 15 48 0a 00 00 mov %edx,0xa48 + 68d: 89 15 5c 0a 00 00 mov %edx,0xa5c return (void*)(p + 1); - 6da: 8d 50 08 lea 0x8(%eax),%edx + 693: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 6dd: 89 d0 mov %edx,%eax - 6df: 8d 65 f4 lea -0xc(%ebp),%esp - 6e2: 5b pop %ebx - 6e3: 5e pop %esi - 6e4: 5f pop %edi - 6e5: 5d pop %ebp - 6e6: c3 ret + 696: 89 d0 mov %edx,%eax + 698: 8d 65 f4 lea -0xc(%ebp),%esp + 69b: 5b pop %ebx + 69c: 5e pop %esi + 69d: 5f pop %edi + 69e: 5d pop %ebp + 69f: c3 ret prevp->s.ptr = p->s.ptr; - 6e7: 8b 08 mov (%eax),%ecx - 6e9: 89 0a mov %ecx,(%edx) - 6eb: eb e7 jmp 6d4 + 6a0: 8b 08 mov (%eax),%ecx + 6a2: 89 0a mov %ecx,(%edx) + 6a4: eb e7 jmp 68d hp->s.size = nu; - 6ed: 89 70 04 mov %esi,0x4(%eax) + 6a6: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 6f0: 83 ec 0c sub $0xc,%esp - 6f3: 83 c0 08 add $0x8,%eax - 6f6: 50 push %eax - 6f7: e8 ef fe ff ff call 5eb + 6a9: 83 ec 0c sub $0xc,%esp + 6ac: 83 c0 08 add $0x8,%eax + 6af: 50 push %eax + 6b0: e8 00 ff ff ff call 5b5 return freep; - 6fc: 8b 15 48 0a 00 00 mov 0xa48,%edx + 6b5: 8b 15 5c 0a 00 00 mov 0xa5c,%edx if((p = morecore(nunits)) == 0) - 702: 83 c4 10 add $0x10,%esp - 705: 85 d2 test %edx,%edx - 707: 74 d4 je 6dd + 6bb: 83 c4 10 add $0x10,%esp + 6be: 85 d2 test %edx,%edx + 6c0: 74 d4 je 696 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 709: 8b 02 mov (%edx),%eax + 6c2: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 70b: 8b 48 04 mov 0x4(%eax),%ecx - 70e: 39 d9 cmp %ebx,%ecx - 710: 73 b3 jae 6c5 + 6c4: 8b 48 04 mov 0x4(%eax),%ecx + 6c7: 39 d9 cmp %ebx,%ecx + 6c9: 73 b3 jae 67e if(p == freep) - 712: 89 c2 mov %eax,%edx - 714: 39 05 48 0a 00 00 cmp %eax,0xa48 - 71a: 75 ed jne 709 + 6cb: 89 c2 mov %eax,%edx + 6cd: 39 05 5c 0a 00 00 cmp %eax,0xa5c + 6d3: 75 ed jne 6c2 p = sbrk(nu * sizeof(Header)); - 71c: 83 ec 0c sub $0xc,%esp - 71f: 57 push %edi - 720: e8 3c fc ff ff call 361 + 6d5: 83 ec 0c sub $0xc,%esp + 6d8: 57 push %edi + 6d9: e8 59 fc ff ff call 337 if(p == (char*)-1) - 725: 83 c4 10 add $0x10,%esp - 728: 83 f8 ff cmp $0xffffffff,%eax - 72b: 75 c0 jne 6ed + 6de: 83 c4 10 add $0x10,%esp + 6e1: 83 f8 ff cmp $0xffffffff,%eax + 6e4: 75 c0 jne 6a6 return 0; - 72d: ba 00 00 00 00 mov $0x0,%edx - 732: eb a9 jmp 6dd + 6e6: ba 00 00 00 00 mov $0x0,%edx + 6eb: eb a9 jmp 696 diff --git a/src/user/forktest.d b/src/user/forktest.d new file mode 100644 index 0000000..bedfe5c --- /dev/null +++ b/src/user/forktest.d @@ -0,0 +1,2 @@ +user/forktest.o: user/forktest.c /usr/include/stdc-predef.h types.h \ + stat.h user.h diff --git a/src/user/forktest.o b/src/user/forktest.o new file mode 100644 index 0000000..f811060 Binary files /dev/null and b/src/user/forktest.o differ diff --git a/src/user/forktest.sym b/src/user/forktest.sym index 6a7bbf8..6fd7dd3 100644 --- a/src/user/forktest.sym +++ b/src/user/forktest.sym @@ -1,61 +1,49 @@ -00000000 .text -00000734 .rodata -000007b0 .eh_frame -00000a48 .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 forktest.c 00000000 ulib.c 00000000 printf.c -00000389 printint -0000079c digits.1089 +0000035f printint +000007b0 digits.0 00000000 umalloc.c -00000a48 freep -00000a4c base -000000f3 strcpy +00000a5c freep +00000a60 base +000000e7 strcpy 00000000 print -0000041d printf -000002a0 memmove -00000321 mknod -00000381 ps -000001be gets -00000359 getpid -0000065d malloc -00000369 sleep -00000029 forktest -000002e9 pipe -00000379 slabtest -000002f9 write -00000331 fstat -00000309 kill -00000349 chdir -00000311 exec -000002e1 wait -000002f1 read -00000329 unlink -000002d1 fork -00000361 sbrk -00000371 uptime -00000a48 __bss_start -00000172 memset -000000df main -00000119 strcmp -00000351 dup -00000219 stat -00000a48 _edata -00000a54 _end -00000339 link -000002d9 exit -00000261 atoi -00000148 strlen -00000319 open -0000018d strchr -00000341 mkdir -00000301 close -000005eb free +000003f7 printf +0000027a memmove +000002f7 mknod +00000357 ps +000001a2 gets +0000032f getpid +0000061e malloc +0000033f sleep +00000025 forktest +000002bf pipe +0000034f slabtest +000002cf write +00000307 fstat +000002df kill +0000031f chdir +000002e7 exec +000002b7 wait +000002c7 read +000002ff unlink +000002a7 fork +00000337 sbrk +00000347 uptime +00000a5c __bss_start +0000015c memset +000000d7 main +0000010b strcmp +00000327 dup +000001f9 stat +00000a5c _edata +00000a68 _end +0000030f link +000002af exit +0000023d atoi +00000136 strlen +000002ef open +00000175 strchr +00000317 mkdir +000002d7 close +000005b5 free diff --git a/src/user/grep.asm b/src/user/grep.asm index ead25e9..0aae885 100644 --- a/src/user/grep.asm +++ b/src/user/grep.asm @@ -11,1349 +11,1314 @@ Disassembly of section .text: // matchstar: search for c*re at beginning of text int matchstar(int c, char *re, char *text) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 57 push %edi - 8: 56 push %esi - 9: 53 push %ebx - a: 83 ec 0c sub $0xc,%esp - d: 8b 75 08 mov 0x8(%ebp),%esi - 10: 8b 7d 0c mov 0xc(%ebp),%edi - 13: 8b 5d 10 mov 0x10(%ebp),%ebx + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + 5: 53 push %ebx + 6: 83 ec 0c sub $0xc,%esp + 9: 8b 75 08 mov 0x8(%ebp),%esi + c: 8b 7d 0c mov 0xc(%ebp),%edi + f: 8b 5d 10 mov 0x10(%ebp),%ebx do{ // a * matches zero or more instances if(matchhere(re, text)) - 16: 83 ec 08 sub $0x8,%esp - 19: 53 push %ebx - 1a: 57 push %edi - 1b: e8 2c 00 00 00 call 4c - 20: 83 c4 10 add $0x10,%esp - 23: 85 c0 test %eax,%eax - 25: 75 18 jne 3f + 12: 83 ec 08 sub $0x8,%esp + 15: 53 push %ebx + 16: 57 push %edi + 17: e8 2c 00 00 00 call 48 + 1c: 83 c4 10 add $0x10,%esp + 1f: 85 c0 test %eax,%eax + 21: 75 18 jne 3b return 1; }while(*text!='\0' && (*text++==c || c=='.')); - 27: 0f b6 13 movzbl (%ebx),%edx - 2a: 84 d2 test %dl,%dl - 2c: 74 16 je 44 - 2e: 83 c3 01 add $0x1,%ebx - 31: 83 fe 2e cmp $0x2e,%esi - 34: 74 e0 je 16 - 36: 0f be d2 movsbl %dl,%edx - 39: 39 f2 cmp %esi,%edx - 3b: 74 d9 je 16 - 3d: eb 05 jmp 44 + 23: 0f b6 13 movzbl (%ebx),%edx + 26: 84 d2 test %dl,%dl + 28: 74 16 je 40 + 2a: 83 c3 01 add $0x1,%ebx + 2d: 83 fe 2e cmp $0x2e,%esi + 30: 74 e0 je 12 + 32: 0f be d2 movsbl %dl,%edx + 35: 39 f2 cmp %esi,%edx + 37: 74 d9 je 12 + 39: eb 05 jmp 40 return 1; - 3f: b8 01 00 00 00 mov $0x1,%eax + 3b: b8 01 00 00 00 mov $0x1,%eax return 0; } - 44: 8d 65 f4 lea -0xc(%ebp),%esp - 47: 5b pop %ebx - 48: 5e pop %esi - 49: 5f pop %edi - 4a: 5d pop %ebp - 4b: c3 ret - -0000004c : + 40: 8d 65 f4 lea -0xc(%ebp),%esp + 43: 5b pop %ebx + 44: 5e pop %esi + 45: 5f pop %edi + 46: 5d pop %ebp + 47: c3 ret + +00000048 : { - 4c: f3 0f 1e fb endbr32 - 50: 55 push %ebp - 51: 89 e5 mov %esp,%ebp - 53: 53 push %ebx - 54: 83 ec 04 sub $0x4,%esp - 57: 8b 55 08 mov 0x8(%ebp),%edx + 48: 55 push %ebp + 49: 89 e5 mov %esp,%ebp + 4b: 53 push %ebx + 4c: 83 ec 04 sub $0x4,%esp + 4f: 8b 55 08 mov 0x8(%ebp),%edx if(re[0] == '\0') - 5a: 0f b6 0a movzbl (%edx),%ecx + 52: 0f b6 0a movzbl (%edx),%ecx return 1; - 5d: b8 01 00 00 00 mov $0x1,%eax + 55: b8 01 00 00 00 mov $0x1,%eax if(re[0] == '\0') - 62: 84 c9 test %cl,%cl - 64: 74 29 je 8f + 5a: 84 c9 test %cl,%cl + 5c: 74 29 je 87 if(re[1] == '*') - 66: 0f b6 42 01 movzbl 0x1(%edx),%eax - 6a: 3c 2a cmp $0x2a,%al - 6c: 74 26 je 94 + 5e: 0f b6 42 01 movzbl 0x1(%edx),%eax + 62: 3c 2a cmp $0x2a,%al + 64: 74 26 je 8c if(re[0] == '$' && re[1] == '\0') - 6e: 84 c0 test %al,%al - 70: 75 05 jne 77 - 72: 80 f9 24 cmp $0x24,%cl - 75: 74 35 je ac + 66: 84 c0 test %al,%al + 68: 75 05 jne 6f + 6a: 80 f9 24 cmp $0x24,%cl + 6d: 74 35 je a4 if(*text!='\0' && (re[0]=='.' || re[0]==*text)) - 77: 8b 45 0c mov 0xc(%ebp),%eax - 7a: 0f b6 18 movzbl (%eax),%ebx + 6f: 8b 45 0c mov 0xc(%ebp),%eax + 72: 0f b6 18 movzbl (%eax),%ebx return 0; - 7d: b8 00 00 00 00 mov $0x0,%eax + 75: b8 00 00 00 00 mov $0x0,%eax if(*text!='\0' && (re[0]=='.' || re[0]==*text)) - 82: 84 db test %bl,%bl - 84: 74 09 je 8f - 86: 38 d9 cmp %bl,%cl - 88: 74 30 je ba - 8a: 80 f9 2e cmp $0x2e,%cl - 8d: 74 2b je ba + 7a: 84 db test %bl,%bl + 7c: 74 09 je 87 + 7e: 38 d9 cmp %bl,%cl + 80: 74 30 je b2 + 82: 80 f9 2e cmp $0x2e,%cl + 85: 74 2b je b2 } - 8f: 8b 5d fc mov -0x4(%ebp),%ebx - 92: c9 leave - 93: c3 ret + 87: 8b 5d fc mov -0x4(%ebp),%ebx + 8a: c9 leave + 8b: c3 ret return matchstar(re[0], re+2, text); - 94: 83 ec 04 sub $0x4,%esp - 97: ff 75 0c pushl 0xc(%ebp) - 9a: 83 c2 02 add $0x2,%edx - 9d: 52 push %edx - 9e: 0f be c9 movsbl %cl,%ecx - a1: 51 push %ecx - a2: e8 59 ff ff ff call 0 - a7: 83 c4 10 add $0x10,%esp - aa: eb e3 jmp 8f + 8c: 83 ec 04 sub $0x4,%esp + 8f: ff 75 0c push 0xc(%ebp) + 92: 83 c2 02 add $0x2,%edx + 95: 52 push %edx + 96: 0f be c9 movsbl %cl,%ecx + 99: 51 push %ecx + 9a: e8 61 ff ff ff call 0 + 9f: 83 c4 10 add $0x10,%esp + a2: eb e3 jmp 87 return *text == '\0'; - ac: 8b 45 0c mov 0xc(%ebp),%eax - af: 80 38 00 cmpb $0x0,(%eax) - b2: 0f 94 c0 sete %al - b5: 0f b6 c0 movzbl %al,%eax - b8: eb d5 jmp 8f + a4: 8b 45 0c mov 0xc(%ebp),%eax + a7: 80 38 00 cmpb $0x0,(%eax) + aa: 0f 94 c0 sete %al + ad: 0f b6 c0 movzbl %al,%eax + b0: eb d5 jmp 87 return matchhere(re+1, text+1); - ba: 83 ec 08 sub $0x8,%esp - bd: 8b 45 0c mov 0xc(%ebp),%eax - c0: 83 c0 01 add $0x1,%eax - c3: 50 push %eax - c4: 83 c2 01 add $0x1,%edx - c7: 52 push %edx - c8: e8 7f ff ff ff call 4c - cd: 83 c4 10 add $0x10,%esp - d0: eb bd jmp 8f - -000000d2 : + b2: 83 ec 08 sub $0x8,%esp + b5: 8b 45 0c mov 0xc(%ebp),%eax + b8: 83 c0 01 add $0x1,%eax + bb: 50 push %eax + bc: 83 c2 01 add $0x1,%edx + bf: 52 push %edx + c0: e8 83 ff ff ff call 48 + c5: 83 c4 10 add $0x10,%esp + c8: eb bd jmp 87 + +000000ca : { - d2: f3 0f 1e fb endbr32 - d6: 55 push %ebp - d7: 89 e5 mov %esp,%ebp - d9: 56 push %esi - da: 53 push %ebx - db: 8b 75 08 mov 0x8(%ebp),%esi - de: 8b 5d 0c mov 0xc(%ebp),%ebx + ca: 55 push %ebp + cb: 89 e5 mov %esp,%ebp + cd: 56 push %esi + ce: 53 push %ebx + cf: 8b 75 08 mov 0x8(%ebp),%esi + d2: 8b 5d 0c mov 0xc(%ebp),%ebx if(re[0] == '^') - e1: 80 3e 5e cmpb $0x5e,(%esi) - e4: 74 1c je 102 + d5: 80 3e 5e cmpb $0x5e,(%esi) + d8: 74 1c je f6 if(matchhere(re, text)) - e6: 83 ec 08 sub $0x8,%esp - e9: 53 push %ebx - ea: 56 push %esi - eb: e8 5c ff ff ff call 4c - f0: 83 c4 10 add $0x10,%esp - f3: 85 c0 test %eax,%eax - f5: 75 1d jne 114 + da: 83 ec 08 sub $0x8,%esp + dd: 53 push %ebx + de: 56 push %esi + df: e8 64 ff ff ff call 48 + e4: 83 c4 10 add $0x10,%esp + e7: 85 c0 test %eax,%eax + e9: 75 1d jne 108 }while(*text++ != '\0'); - f7: 83 c3 01 add $0x1,%ebx - fa: 80 7b ff 00 cmpb $0x0,-0x1(%ebx) - fe: 75 e6 jne e6 - 100: eb 17 jmp 119 + eb: 83 c3 01 add $0x1,%ebx + ee: 80 7b ff 00 cmpb $0x0,-0x1(%ebx) + f2: 75 e6 jne da + f4: eb 17 jmp 10d return matchhere(re+1, text); - 102: 83 ec 08 sub $0x8,%esp - 105: 53 push %ebx - 106: 83 c6 01 add $0x1,%esi - 109: 56 push %esi - 10a: e8 3d ff ff ff call 4c - 10f: 83 c4 10 add $0x10,%esp - 112: eb 05 jmp 119 + f6: 83 ec 08 sub $0x8,%esp + f9: 53 push %ebx + fa: 83 c6 01 add $0x1,%esi + fd: 56 push %esi + fe: e8 45 ff ff ff call 48 + 103: 83 c4 10 add $0x10,%esp + 106: eb 05 jmp 10d return 1; - 114: b8 01 00 00 00 mov $0x1,%eax + 108: b8 01 00 00 00 mov $0x1,%eax } - 119: 8d 65 f8 lea -0x8(%ebp),%esp - 11c: 5b pop %ebx - 11d: 5e pop %esi - 11e: 5d pop %ebp - 11f: c3 ret + 10d: 8d 65 f8 lea -0x8(%ebp),%esp + 110: 5b pop %ebx + 111: 5e pop %esi + 112: 5d pop %ebp + 113: c3 ret -00000120 : +00000114 : { - 120: f3 0f 1e fb endbr32 - 124: 55 push %ebp - 125: 89 e5 mov %esp,%ebp - 127: 57 push %edi - 128: 56 push %esi - 129: 53 push %ebx - 12a: 83 ec 1c sub $0x1c,%esp - 12d: 8b 7d 08 mov 0x8(%ebp),%edi + 114: 55 push %ebp + 115: 89 e5 mov %esp,%ebp + 117: 57 push %edi + 118: 56 push %esi + 119: 53 push %ebx + 11a: 83 ec 1c sub $0x1c,%esp + 11d: 8b 7d 08 mov 0x8(%ebp),%edi m = 0; - 130: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) + 120: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ - 137: eb 53 jmp 18c - *q = '\n'; - 139: c6 03 0a movb $0xa,(%ebx) - write(1, p, q+1 - p); - 13c: 83 ec 04 sub $0x4,%esp - 13f: 8d 43 01 lea 0x1(%ebx),%eax - 142: 29 f0 sub %esi,%eax - 144: 50 push %eax - 145: 56 push %esi - 146: 6a 01 push $0x1 - 148: e8 63 03 00 00 call 4b0 - 14d: 83 c4 10 add $0x10,%esp + 127: eb 53 jmp 17c p = q+1; - 150: 8d 73 01 lea 0x1(%ebx),%esi + 129: 8d 73 01 lea 0x1(%ebx),%esi while((q = strchr(p, '\n')) != 0){ - 153: 83 ec 08 sub $0x8,%esp - 156: 6a 0a push $0xa - 158: 56 push %esi - 159: e8 e6 01 00 00 call 344 - 15e: 89 c3 mov %eax,%ebx - 160: 83 c4 10 add $0x10,%esp - 163: 85 c0 test %eax,%eax - 165: 74 16 je 17d + 12c: 83 ec 08 sub $0x8,%esp + 12f: 6a 0a push $0xa + 131: 56 push %esi + 132: e8 f0 01 00 00 call 327 + 137: 89 c3 mov %eax,%ebx + 139: 83 c4 10 add $0x10,%esp + 13c: 85 c0 test %eax,%eax + 13e: 74 2d je 16d *q = 0; - 167: c6 03 00 movb $0x0,(%ebx) + 140: c6 03 00 movb $0x0,(%ebx) if(match(pattern, p)){ - 16a: 83 ec 08 sub $0x8,%esp - 16d: 56 push %esi - 16e: 57 push %edi - 16f: e8 5e ff ff ff call d2 - 174: 83 c4 10 add $0x10,%esp - 177: 85 c0 test %eax,%eax - 179: 74 d5 je 150 - 17b: eb bc jmp 139 + 143: 83 ec 08 sub $0x8,%esp + 146: 56 push %esi + 147: 57 push %edi + 148: e8 7d ff ff ff call ca + 14d: 83 c4 10 add $0x10,%esp + 150: 85 c0 test %eax,%eax + 152: 74 d5 je 129 + *q = '\n'; + 154: c6 03 0a movb $0xa,(%ebx) + write(1, p, q+1 - p); + 157: 83 ec 04 sub $0x4,%esp + 15a: 8d 43 01 lea 0x1(%ebx),%eax + 15d: 29 f0 sub %esi,%eax + 15f: 50 push %eax + 160: 56 push %esi + 161: 6a 01 push $0x1 + 163: e8 19 03 00 00 call 481 + 168: 83 c4 10 add $0x10,%esp + 16b: eb bc jmp 129 if(p == buf) - 17d: 81 fe 80 0c 00 00 cmp $0xc80,%esi - 183: 74 5f je 1e4 + 16d: 81 fe 60 0c 00 00 cmp $0xc60,%esi + 173: 74 62 je 1d7 if(m > 0){ - 185: 8b 4d e4 mov -0x1c(%ebp),%ecx - 188: 85 c9 test %ecx,%ecx - 18a: 7f 38 jg 1c4 + 175: 8b 4d e4 mov -0x1c(%ebp),%ecx + 178: 85 c9 test %ecx,%ecx + 17a: 7f 3b jg 1b7 while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ - 18c: 83 ec 04 sub $0x4,%esp - 18f: b8 ff 03 00 00 mov $0x3ff,%eax - 194: 8b 4d e4 mov -0x1c(%ebp),%ecx - 197: 29 c8 sub %ecx,%eax - 199: 50 push %eax - 19a: 8d 81 80 0c 00 00 lea 0xc80(%ecx),%eax - 1a0: 50 push %eax - 1a1: ff 75 0c pushl 0xc(%ebp) - 1a4: e8 ff 02 00 00 call 4a8 - 1a9: 83 c4 10 add $0x10,%esp - 1ac: 85 c0 test %eax,%eax - 1ae: 7e 3d jle 1ed + 17c: 83 ec 04 sub $0x4,%esp + 17f: b8 ff 03 00 00 mov $0x3ff,%eax + 184: 8b 4d e4 mov -0x1c(%ebp),%ecx + 187: 29 c8 sub %ecx,%eax + 189: 50 push %eax + 18a: 8d 81 60 0c 00 00 lea 0xc60(%ecx),%eax + 190: 50 push %eax + 191: ff 75 0c push 0xc(%ebp) + 194: e8 e0 02 00 00 call 479 + 199: 83 c4 10 add $0x10,%esp + 19c: 85 c0 test %eax,%eax + 19e: 7e 40 jle 1e0 m += n; - 1b0: 01 45 e4 add %eax,-0x1c(%ebp) - 1b3: 8b 55 e4 mov -0x1c(%ebp),%edx + 1a0: 01 45 e4 add %eax,-0x1c(%ebp) + 1a3: 8b 55 e4 mov -0x1c(%ebp),%edx buf[m] = '\0'; - 1b6: c6 82 80 0c 00 00 00 movb $0x0,0xc80(%edx) + 1a6: c6 82 60 0c 00 00 00 movb $0x0,0xc60(%edx) p = buf; - 1bd: be 80 0c 00 00 mov $0xc80,%esi + 1ad: be 60 0c 00 00 mov $0xc60,%esi while((q = strchr(p, '\n')) != 0){ - 1c2: eb 8f jmp 153 + 1b2: e9 75 ff ff ff jmp 12c m -= p - buf; - 1c4: 89 f0 mov %esi,%eax - 1c6: 2d 80 0c 00 00 sub $0xc80,%eax - 1cb: 29 c1 sub %eax,%ecx - 1cd: 89 4d e4 mov %ecx,-0x1c(%ebp) + 1b7: 89 f0 mov %esi,%eax + 1b9: 2d 60 0c 00 00 sub $0xc60,%eax + 1be: 29 c1 sub %eax,%ecx + 1c0: 89 4d e4 mov %ecx,-0x1c(%ebp) memmove(buf, p, m); - 1d0: 83 ec 04 sub $0x4,%esp - 1d3: 51 push %ecx - 1d4: 56 push %esi - 1d5: 68 80 0c 00 00 push $0xc80 - 1da: e8 78 02 00 00 call 457 - 1df: 83 c4 10 add $0x10,%esp - 1e2: eb a8 jmp 18c + 1c3: 83 ec 04 sub $0x4,%esp + 1c6: 51 push %ecx + 1c7: 56 push %esi + 1c8: 68 60 0c 00 00 push $0xc60 + 1cd: e8 5a 02 00 00 call 42c + 1d2: 83 c4 10 add $0x10,%esp + 1d5: eb a5 jmp 17c m = 0; - 1e4: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) - 1eb: eb 9f jmp 18c + 1d7: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) + 1de: eb 9c jmp 17c } - 1ed: 8d 65 f4 lea -0xc(%ebp),%esp - 1f0: 5b pop %ebx - 1f1: 5e pop %esi - 1f2: 5f pop %edi - 1f3: 5d pop %ebp - 1f4: c3 ret - -000001f5
: + 1e0: 8d 65 f4 lea -0xc(%ebp),%esp + 1e3: 5b pop %ebx + 1e4: 5e pop %esi + 1e5: 5f pop %edi + 1e6: 5d pop %ebp + 1e7: c3 ret + +000001e8
: { - 1f5: f3 0f 1e fb endbr32 - 1f9: 8d 4c 24 04 lea 0x4(%esp),%ecx - 1fd: 83 e4 f0 and $0xfffffff0,%esp - 200: ff 71 fc pushl -0x4(%ecx) - 203: 55 push %ebp - 204: 89 e5 mov %esp,%ebp - 206: 57 push %edi - 207: 56 push %esi - 208: 53 push %ebx - 209: 51 push %ecx - 20a: 83 ec 18 sub $0x18,%esp - 20d: 8b 01 mov (%ecx),%eax - 20f: 89 45 e4 mov %eax,-0x1c(%ebp) - 212: 8b 71 04 mov 0x4(%ecx),%esi + 1e8: 8d 4c 24 04 lea 0x4(%esp),%ecx + 1ec: 83 e4 f0 and $0xfffffff0,%esp + 1ef: ff 71 fc push -0x4(%ecx) + 1f2: 55 push %ebp + 1f3: 89 e5 mov %esp,%ebp + 1f5: 57 push %edi + 1f6: 56 push %esi + 1f7: 53 push %ebx + 1f8: 51 push %ecx + 1f9: 83 ec 18 sub $0x18,%esp + 1fc: 8b 01 mov (%ecx),%eax + 1fe: 89 45 e4 mov %eax,-0x1c(%ebp) + 201: 8b 71 04 mov 0x4(%ecx),%esi if(argc <= 1){ - 215: 83 f8 01 cmp $0x1,%eax - 218: 7e 53 jle 26d + 204: 83 f8 01 cmp $0x1,%eax + 207: 7e 53 jle 25c pattern = argv[1]; - 21a: 8b 46 04 mov 0x4(%esi),%eax - 21d: 89 45 e0 mov %eax,-0x20(%ebp) + 209: 8b 46 04 mov 0x4(%esi),%eax + 20c: 89 45 e0 mov %eax,-0x20(%ebp) if(argc <= 2){ - 220: 83 c6 08 add $0x8,%esi + 20f: 83 c6 08 add $0x8,%esi for(i = 2; i < argc; i++){ - 223: bf 02 00 00 00 mov $0x2,%edi + 212: bf 02 00 00 00 mov $0x2,%edi if(argc <= 2){ - 228: 83 7d e4 02 cmpl $0x2,-0x1c(%ebp) - 22c: 7e 53 jle 281 + 217: 83 7d e4 02 cmpl $0x2,-0x1c(%ebp) + 21b: 7e 53 jle 270 if((fd = open(argv[i], 0)) < 0){ - 22e: 89 75 dc mov %esi,-0x24(%ebp) - 231: 83 ec 08 sub $0x8,%esp - 234: 6a 00 push $0x0 - 236: ff 36 pushl (%esi) - 238: e8 93 02 00 00 call 4d0 - 23d: 89 c3 mov %eax,%ebx - 23f: 83 c4 10 add $0x10,%esp - 242: 85 c0 test %eax,%eax - 244: 78 4b js 291 + 21d: 89 75 dc mov %esi,-0x24(%ebp) + 220: 83 ec 08 sub $0x8,%esp + 223: 6a 00 push $0x0 + 225: ff 36 push (%esi) + 227: e8 75 02 00 00 call 4a1 + 22c: 89 c3 mov %eax,%ebx + 22e: 83 c4 10 add $0x10,%esp + 231: 85 c0 test %eax,%eax + 233: 78 4b js 280 grep(pattern, fd); - 246: 83 ec 08 sub $0x8,%esp - 249: 50 push %eax - 24a: ff 75 e0 pushl -0x20(%ebp) - 24d: e8 ce fe ff ff call 120 + 235: 83 ec 08 sub $0x8,%esp + 238: 50 push %eax + 239: ff 75 e0 push -0x20(%ebp) + 23c: e8 d3 fe ff ff call 114 close(fd); - 252: 89 1c 24 mov %ebx,(%esp) - 255: e8 5e 02 00 00 call 4b8 + 241: 89 1c 24 mov %ebx,(%esp) + 244: e8 40 02 00 00 call 489 for(i = 2; i < argc; i++){ - 25a: 83 c7 01 add $0x1,%edi - 25d: 83 c6 04 add $0x4,%esi - 260: 83 c4 10 add $0x10,%esp - 263: 39 7d e4 cmp %edi,-0x1c(%ebp) - 266: 75 c6 jne 22e + 249: 83 c7 01 add $0x1,%edi + 24c: 83 c6 04 add $0x4,%esi + 24f: 83 c4 10 add $0x10,%esp + 252: 39 7d e4 cmp %edi,-0x1c(%ebp) + 255: 75 c6 jne 21d exit(); - 268: e8 23 02 00 00 call 490 + 257: e8 05 02 00 00 call 461 printf(2, "usage: grep pattern [file ...]\n"); - 26d: 83 ec 08 sub $0x8,%esp - 270: 68 ec 08 00 00 push $0x8ec - 275: 6a 02 push $0x2 - 277: e8 58 03 00 00 call 5d4 + 25c: 83 ec 08 sub $0x8,%esp + 25f: 68 a0 08 00 00 push $0x8a0 + 264: 6a 02 push $0x2 + 266: e8 3e 03 00 00 call 5a9 exit(); - 27c: e8 0f 02 00 00 call 490 + 26b: e8 f1 01 00 00 call 461 grep(pattern, 0); - 281: 83 ec 08 sub $0x8,%esp - 284: 6a 00 push $0x0 - 286: 50 push %eax - 287: e8 94 fe ff ff call 120 + 270: 83 ec 08 sub $0x8,%esp + 273: 6a 00 push $0x0 + 275: 50 push %eax + 276: e8 99 fe ff ff call 114 exit(); - 28c: e8 ff 01 00 00 call 490 + 27b: e8 e1 01 00 00 call 461 printf(1, "grep: cannot open %s\n", argv[i]); - 291: 83 ec 04 sub $0x4,%esp - 294: 8b 45 dc mov -0x24(%ebp),%eax - 297: ff 30 pushl (%eax) - 299: 68 0c 09 00 00 push $0x90c - 29e: 6a 01 push $0x1 - 2a0: e8 2f 03 00 00 call 5d4 + 280: 83 ec 04 sub $0x4,%esp + 283: 8b 45 dc mov -0x24(%ebp),%eax + 286: ff 30 push (%eax) + 288: 68 c0 08 00 00 push $0x8c0 + 28d: 6a 01 push $0x1 + 28f: e8 15 03 00 00 call 5a9 exit(); - 2a5: e8 e6 01 00 00 call 490 + 294: e8 c8 01 00 00 call 461 -000002aa : +00000299 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 2aa: f3 0f 1e fb endbr32 - 2ae: 55 push %ebp - 2af: 89 e5 mov %esp,%ebp - 2b1: 53 push %ebx - 2b2: 8b 4d 08 mov 0x8(%ebp),%ecx - 2b5: 8b 5d 0c mov 0xc(%ebp),%ebx + 299: 55 push %ebp + 29a: 89 e5 mov %esp,%ebp + 29c: 53 push %ebx + 29d: 8b 4d 08 mov 0x8(%ebp),%ecx + 2a0: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 2b8: b8 00 00 00 00 mov $0x0,%eax - 2bd: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 2c1: 88 14 01 mov %dl,(%ecx,%eax,1) - 2c4: 83 c0 01 add $0x1,%eax - 2c7: 84 d2 test %dl,%dl - 2c9: 75 f2 jne 2bd + 2a3: b8 00 00 00 00 mov $0x0,%eax + 2a8: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 2ac: 88 14 01 mov %dl,(%ecx,%eax,1) + 2af: 83 c0 01 add $0x1,%eax + 2b2: 84 d2 test %dl,%dl + 2b4: 75 f2 jne 2a8 ; return os; } - 2cb: 89 c8 mov %ecx,%eax - 2cd: 5b pop %ebx - 2ce: 5d pop %ebp - 2cf: c3 ret + 2b6: 89 c8 mov %ecx,%eax + 2b8: 8b 5d fc mov -0x4(%ebp),%ebx + 2bb: c9 leave + 2bc: c3 ret -000002d0 : +000002bd : int strcmp(const char *p, const char *q) { - 2d0: f3 0f 1e fb endbr32 - 2d4: 55 push %ebp - 2d5: 89 e5 mov %esp,%ebp - 2d7: 8b 4d 08 mov 0x8(%ebp),%ecx - 2da: 8b 55 0c mov 0xc(%ebp),%edx + 2bd: 55 push %ebp + 2be: 89 e5 mov %esp,%ebp + 2c0: 8b 4d 08 mov 0x8(%ebp),%ecx + 2c3: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 2dd: 0f b6 01 movzbl (%ecx),%eax - 2e0: 84 c0 test %al,%al - 2e2: 74 11 je 2f5 - 2e4: 38 02 cmp %al,(%edx) - 2e6: 75 0d jne 2f5 + 2c6: 0f b6 01 movzbl (%ecx),%eax + 2c9: 84 c0 test %al,%al + 2cb: 74 11 je 2de + 2cd: 38 02 cmp %al,(%edx) + 2cf: 75 0d jne 2de p++, q++; - 2e8: 83 c1 01 add $0x1,%ecx - 2eb: 83 c2 01 add $0x1,%edx + 2d1: 83 c1 01 add $0x1,%ecx + 2d4: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 2ee: 0f b6 01 movzbl (%ecx),%eax - 2f1: 84 c0 test %al,%al - 2f3: 75 ef jne 2e4 + 2d7: 0f b6 01 movzbl (%ecx),%eax + 2da: 84 c0 test %al,%al + 2dc: 75 ef jne 2cd return (uchar)*p - (uchar)*q; - 2f5: 0f b6 c0 movzbl %al,%eax - 2f8: 0f b6 12 movzbl (%edx),%edx - 2fb: 29 d0 sub %edx,%eax + 2de: 0f b6 c0 movzbl %al,%eax + 2e1: 0f b6 12 movzbl (%edx),%edx + 2e4: 29 d0 sub %edx,%eax } - 2fd: 5d pop %ebp - 2fe: c3 ret + 2e6: 5d pop %ebp + 2e7: c3 ret -000002ff : +000002e8 : uint strlen(const char *s) { - 2ff: f3 0f 1e fb endbr32 - 303: 55 push %ebp - 304: 89 e5 mov %esp,%ebp - 306: 8b 55 08 mov 0x8(%ebp),%edx + 2e8: 55 push %ebp + 2e9: 89 e5 mov %esp,%ebp + 2eb: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 309: 80 3a 00 cmpb $0x0,(%edx) - 30c: 74 14 je 322 - 30e: b8 00 00 00 00 mov $0x0,%eax - 313: 83 c0 01 add $0x1,%eax - 316: 89 c1 mov %eax,%ecx - 318: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 31c: 75 f5 jne 313 + 2ee: 80 3a 00 cmpb $0x0,(%edx) + 2f1: 74 14 je 307 + 2f3: b8 00 00 00 00 mov $0x0,%eax + 2f8: 83 c0 01 add $0x1,%eax + 2fb: 89 c1 mov %eax,%ecx + 2fd: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 301: 75 f5 jne 2f8 ; return n; } - 31e: 89 c8 mov %ecx,%eax - 320: 5d pop %ebp - 321: c3 ret + 303: 89 c8 mov %ecx,%eax + 305: 5d pop %ebp + 306: c3 ret for(n = 0; s[n]; n++) - 322: b9 00 00 00 00 mov $0x0,%ecx + 307: b9 00 00 00 00 mov $0x0,%ecx return n; - 327: eb f5 jmp 31e + 30c: eb f5 jmp 303 -00000329 : +0000030e : void* memset(void *dst, int c, uint n) { - 329: f3 0f 1e fb endbr32 - 32d: 55 push %ebp - 32e: 89 e5 mov %esp,%ebp - 330: 57 push %edi - 331: 8b 55 08 mov 0x8(%ebp),%edx + 30e: 55 push %ebp + 30f: 89 e5 mov %esp,%ebp + 311: 57 push %edi + 312: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 334: 89 d7 mov %edx,%edi - 336: 8b 4d 10 mov 0x10(%ebp),%ecx - 339: 8b 45 0c mov 0xc(%ebp),%eax - 33c: fc cld - 33d: f3 aa rep stos %al,%es:(%edi) + 315: 89 d7 mov %edx,%edi + 317: 8b 4d 10 mov 0x10(%ebp),%ecx + 31a: 8b 45 0c mov 0xc(%ebp),%eax + 31d: fc cld + 31e: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 33f: 89 d0 mov %edx,%eax - 341: 5f pop %edi - 342: 5d pop %ebp - 343: c3 ret + 320: 89 d0 mov %edx,%eax + 322: 8b 7d fc mov -0x4(%ebp),%edi + 325: c9 leave + 326: c3 ret -00000344 : +00000327 : char* strchr(const char *s, char c) { - 344: f3 0f 1e fb endbr32 - 348: 55 push %ebp - 349: 89 e5 mov %esp,%ebp - 34b: 8b 45 08 mov 0x8(%ebp),%eax - 34e: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 327: 55 push %ebp + 328: 89 e5 mov %esp,%ebp + 32a: 8b 45 08 mov 0x8(%ebp),%eax + 32d: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 352: 0f b6 10 movzbl (%eax),%edx - 355: 84 d2 test %dl,%dl - 357: 74 15 je 36e + 331: 0f b6 10 movzbl (%eax),%edx + 334: 84 d2 test %dl,%dl + 336: 74 15 je 34d if(*s == c) - 359: 38 d1 cmp %dl,%cl - 35b: 74 0f je 36c + 338: 38 d1 cmp %dl,%cl + 33a: 74 0f je 34b for(; *s; s++) - 35d: 83 c0 01 add $0x1,%eax - 360: 0f b6 10 movzbl (%eax),%edx - 363: 84 d2 test %dl,%dl - 365: 75 f2 jne 359 + 33c: 83 c0 01 add $0x1,%eax + 33f: 0f b6 10 movzbl (%eax),%edx + 342: 84 d2 test %dl,%dl + 344: 75 f2 jne 338 return (char*)s; return 0; - 367: b8 00 00 00 00 mov $0x0,%eax + 346: b8 00 00 00 00 mov $0x0,%eax } - 36c: 5d pop %ebp - 36d: c3 ret + 34b: 5d pop %ebp + 34c: c3 ret return 0; - 36e: b8 00 00 00 00 mov $0x0,%eax - 373: eb f7 jmp 36c + 34d: b8 00 00 00 00 mov $0x0,%eax + 352: eb f7 jmp 34b -00000375 : +00000354 : char* gets(char *buf, int max) { - 375: f3 0f 1e fb endbr32 - 379: 55 push %ebp - 37a: 89 e5 mov %esp,%ebp - 37c: 57 push %edi - 37d: 56 push %esi - 37e: 53 push %ebx - 37f: 83 ec 2c sub $0x2c,%esp - 382: 8b 75 08 mov 0x8(%ebp),%esi + 354: 55 push %ebp + 355: 89 e5 mov %esp,%ebp + 357: 57 push %edi + 358: 56 push %esi + 359: 53 push %ebx + 35a: 83 ec 2c sub $0x2c,%esp + 35d: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 385: bb 00 00 00 00 mov $0x0,%ebx + 360: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 38a: 8d 7d e7 lea -0x19(%ebp),%edi + 365: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 38d: 89 5d d4 mov %ebx,-0x2c(%ebp) - 390: 83 c3 01 add $0x1,%ebx - 393: 3b 5d 0c cmp 0xc(%ebp),%ebx - 396: 7d 27 jge 3bf + 368: 89 5d d4 mov %ebx,-0x2c(%ebp) + 36b: 83 c3 01 add $0x1,%ebx + 36e: 3b 5d 0c cmp 0xc(%ebp),%ebx + 371: 7d 27 jge 39a cc = read(0, &c, 1); - 398: 83 ec 04 sub $0x4,%esp - 39b: 6a 01 push $0x1 - 39d: 57 push %edi - 39e: 6a 00 push $0x0 - 3a0: e8 03 01 00 00 call 4a8 + 373: 83 ec 04 sub $0x4,%esp + 376: 6a 01 push $0x1 + 378: 57 push %edi + 379: 6a 00 push $0x0 + 37b: e8 f9 00 00 00 call 479 if(cc < 1) - 3a5: 83 c4 10 add $0x10,%esp - 3a8: 85 c0 test %eax,%eax - 3aa: 7e 13 jle 3bf + 380: 83 c4 10 add $0x10,%esp + 383: 85 c0 test %eax,%eax + 385: 7e 13 jle 39a break; buf[i++] = c; - 3ac: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 3b0: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 387: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 38b: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 3b4: 3c 0a cmp $0xa,%al - 3b6: 74 04 je 3bc - 3b8: 3c 0d cmp $0xd,%al - 3ba: 75 d1 jne 38d + 38f: 3c 0a cmp $0xa,%al + 391: 74 04 je 397 + 393: 3c 0d cmp $0xd,%al + 395: 75 d1 jne 368 for(i=0; i+1 < max; ){ - 3bc: 89 5d d4 mov %ebx,-0x2c(%ebp) + 397: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 3bf: 8b 45 d4 mov -0x2c(%ebp),%eax - 3c2: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 39a: 8b 45 d4 mov -0x2c(%ebp),%eax + 39d: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 3c6: 89 f0 mov %esi,%eax - 3c8: 8d 65 f4 lea -0xc(%ebp),%esp - 3cb: 5b pop %ebx - 3cc: 5e pop %esi - 3cd: 5f pop %edi - 3ce: 5d pop %ebp - 3cf: c3 ret + 3a1: 89 f0 mov %esi,%eax + 3a3: 8d 65 f4 lea -0xc(%ebp),%esp + 3a6: 5b pop %ebx + 3a7: 5e pop %esi + 3a8: 5f pop %edi + 3a9: 5d pop %ebp + 3aa: c3 ret -000003d0 : +000003ab : int stat(const char *n, struct stat *st) { - 3d0: f3 0f 1e fb endbr32 - 3d4: 55 push %ebp - 3d5: 89 e5 mov %esp,%ebp - 3d7: 56 push %esi - 3d8: 53 push %ebx + 3ab: 55 push %ebp + 3ac: 89 e5 mov %esp,%ebp + 3ae: 56 push %esi + 3af: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 3d9: 83 ec 08 sub $0x8,%esp - 3dc: 6a 00 push $0x0 - 3de: ff 75 08 pushl 0x8(%ebp) - 3e1: e8 ea 00 00 00 call 4d0 + 3b0: 83 ec 08 sub $0x8,%esp + 3b3: 6a 00 push $0x0 + 3b5: ff 75 08 push 0x8(%ebp) + 3b8: e8 e4 00 00 00 call 4a1 if(fd < 0) - 3e6: 83 c4 10 add $0x10,%esp - 3e9: 85 c0 test %eax,%eax - 3eb: 78 24 js 411 - 3ed: 89 c3 mov %eax,%ebx + 3bd: 83 c4 10 add $0x10,%esp + 3c0: 85 c0 test %eax,%eax + 3c2: 78 24 js 3e8 + 3c4: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 3ef: 83 ec 08 sub $0x8,%esp - 3f2: ff 75 0c pushl 0xc(%ebp) - 3f5: 50 push %eax - 3f6: e8 ed 00 00 00 call 4e8 - 3fb: 89 c6 mov %eax,%esi + 3c6: 83 ec 08 sub $0x8,%esp + 3c9: ff 75 0c push 0xc(%ebp) + 3cc: 50 push %eax + 3cd: e8 e7 00 00 00 call 4b9 + 3d2: 89 c6 mov %eax,%esi close(fd); - 3fd: 89 1c 24 mov %ebx,(%esp) - 400: e8 b3 00 00 00 call 4b8 + 3d4: 89 1c 24 mov %ebx,(%esp) + 3d7: e8 ad 00 00 00 call 489 return r; - 405: 83 c4 10 add $0x10,%esp + 3dc: 83 c4 10 add $0x10,%esp } - 408: 89 f0 mov %esi,%eax - 40a: 8d 65 f8 lea -0x8(%ebp),%esp - 40d: 5b pop %ebx - 40e: 5e pop %esi - 40f: 5d pop %ebp - 410: c3 ret + 3df: 89 f0 mov %esi,%eax + 3e1: 8d 65 f8 lea -0x8(%ebp),%esp + 3e4: 5b pop %ebx + 3e5: 5e pop %esi + 3e6: 5d pop %ebp + 3e7: c3 ret return -1; - 411: be ff ff ff ff mov $0xffffffff,%esi - 416: eb f0 jmp 408 + 3e8: be ff ff ff ff mov $0xffffffff,%esi + 3ed: eb f0 jmp 3df -00000418 : +000003ef : int atoi(const char *s) { - 418: f3 0f 1e fb endbr32 - 41c: 55 push %ebp - 41d: 89 e5 mov %esp,%ebp - 41f: 53 push %ebx - 420: 8b 55 08 mov 0x8(%ebp),%edx + 3ef: 55 push %ebp + 3f0: 89 e5 mov %esp,%ebp + 3f2: 53 push %ebx + 3f3: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 423: 0f b6 02 movzbl (%edx),%eax - 426: 8d 48 d0 lea -0x30(%eax),%ecx - 429: 80 f9 09 cmp $0x9,%cl - 42c: 77 22 ja 450 + 3f6: 0f b6 02 movzbl (%edx),%eax + 3f9: 8d 48 d0 lea -0x30(%eax),%ecx + 3fc: 80 f9 09 cmp $0x9,%cl + 3ff: 77 24 ja 425 n = 0; - 42e: b9 00 00 00 00 mov $0x0,%ecx + 401: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 433: 83 c2 01 add $0x1,%edx - 436: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 439: 0f be c0 movsbl %al,%eax - 43c: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 406: 83 c2 01 add $0x1,%edx + 409: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 40c: 0f be c0 movsbl %al,%eax + 40f: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 440: 0f b6 02 movzbl (%edx),%eax - 443: 8d 58 d0 lea -0x30(%eax),%ebx - 446: 80 fb 09 cmp $0x9,%bl - 449: 76 e8 jbe 433 + 413: 0f b6 02 movzbl (%edx),%eax + 416: 8d 58 d0 lea -0x30(%eax),%ebx + 419: 80 fb 09 cmp $0x9,%bl + 41c: 76 e8 jbe 406 return n; } - 44b: 89 c8 mov %ecx,%eax - 44d: 5b pop %ebx - 44e: 5d pop %ebp - 44f: c3 ret + 41e: 89 c8 mov %ecx,%eax + 420: 8b 5d fc mov -0x4(%ebp),%ebx + 423: c9 leave + 424: c3 ret n = 0; - 450: b9 00 00 00 00 mov $0x0,%ecx + 425: b9 00 00 00 00 mov $0x0,%ecx return n; - 455: eb f4 jmp 44b + 42a: eb f2 jmp 41e -00000457 : +0000042c : void* memmove(void *vdst, const void *vsrc, int n) { - 457: f3 0f 1e fb endbr32 - 45b: 55 push %ebp - 45c: 89 e5 mov %esp,%ebp - 45e: 56 push %esi - 45f: 53 push %ebx - 460: 8b 75 08 mov 0x8(%ebp),%esi - 463: 8b 55 0c mov 0xc(%ebp),%edx - 466: 8b 5d 10 mov 0x10(%ebp),%ebx + 42c: 55 push %ebp + 42d: 89 e5 mov %esp,%ebp + 42f: 56 push %esi + 430: 53 push %ebx + 431: 8b 75 08 mov 0x8(%ebp),%esi + 434: 8b 55 0c mov 0xc(%ebp),%edx + 437: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 469: 85 db test %ebx,%ebx - 46b: 7e 15 jle 482 - 46d: 01 f3 add %esi,%ebx + 43a: 85 db test %ebx,%ebx + 43c: 7e 15 jle 453 + 43e: 01 f3 add %esi,%ebx dst = vdst; - 46f: 89 f0 mov %esi,%eax + 440: 89 f0 mov %esi,%eax *dst++ = *src++; - 471: 83 c2 01 add $0x1,%edx - 474: 83 c0 01 add $0x1,%eax - 477: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 47b: 88 48 ff mov %cl,-0x1(%eax) + 442: 83 c2 01 add $0x1,%edx + 445: 83 c0 01 add $0x1,%eax + 448: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 44c: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 47e: 39 c3 cmp %eax,%ebx - 480: 75 ef jne 471 + 44f: 39 c3 cmp %eax,%ebx + 451: 75 ef jne 442 return vdst; } - 482: 89 f0 mov %esi,%eax - 484: 5b pop %ebx - 485: 5e pop %esi - 486: 5d pop %ebp - 487: c3 ret + 453: 89 f0 mov %esi,%eax + 455: 5b pop %ebx + 456: 5e pop %esi + 457: 5d pop %ebp + 458: c3 ret -00000488 : +00000459 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 488: b8 01 00 00 00 mov $0x1,%eax - 48d: cd 40 int $0x40 - 48f: c3 ret + 459: b8 01 00 00 00 mov $0x1,%eax + 45e: cd 40 int $0x40 + 460: c3 ret -00000490 : +00000461 : SYSCALL(exit) - 490: b8 02 00 00 00 mov $0x2,%eax - 495: cd 40 int $0x40 - 497: c3 ret + 461: b8 02 00 00 00 mov $0x2,%eax + 466: cd 40 int $0x40 + 468: c3 ret -00000498 : +00000469 : SYSCALL(wait) - 498: b8 03 00 00 00 mov $0x3,%eax - 49d: cd 40 int $0x40 - 49f: c3 ret + 469: b8 03 00 00 00 mov $0x3,%eax + 46e: cd 40 int $0x40 + 470: c3 ret -000004a0 : +00000471 : SYSCALL(pipe) - 4a0: b8 04 00 00 00 mov $0x4,%eax - 4a5: cd 40 int $0x40 - 4a7: c3 ret + 471: b8 04 00 00 00 mov $0x4,%eax + 476: cd 40 int $0x40 + 478: c3 ret -000004a8 : +00000479 : SYSCALL(read) - 4a8: b8 05 00 00 00 mov $0x5,%eax - 4ad: cd 40 int $0x40 - 4af: c3 ret + 479: b8 05 00 00 00 mov $0x5,%eax + 47e: cd 40 int $0x40 + 480: c3 ret -000004b0 : +00000481 : SYSCALL(write) - 4b0: b8 10 00 00 00 mov $0x10,%eax - 4b5: cd 40 int $0x40 - 4b7: c3 ret + 481: b8 10 00 00 00 mov $0x10,%eax + 486: cd 40 int $0x40 + 488: c3 ret -000004b8 : +00000489 : SYSCALL(close) - 4b8: b8 15 00 00 00 mov $0x15,%eax - 4bd: cd 40 int $0x40 - 4bf: c3 ret + 489: b8 15 00 00 00 mov $0x15,%eax + 48e: cd 40 int $0x40 + 490: c3 ret -000004c0 : +00000491 : SYSCALL(kill) - 4c0: b8 06 00 00 00 mov $0x6,%eax - 4c5: cd 40 int $0x40 - 4c7: c3 ret + 491: b8 06 00 00 00 mov $0x6,%eax + 496: cd 40 int $0x40 + 498: c3 ret -000004c8 : +00000499 : SYSCALL(exec) - 4c8: b8 07 00 00 00 mov $0x7,%eax - 4cd: cd 40 int $0x40 - 4cf: c3 ret + 499: b8 07 00 00 00 mov $0x7,%eax + 49e: cd 40 int $0x40 + 4a0: c3 ret -000004d0 : +000004a1 : SYSCALL(open) - 4d0: b8 0f 00 00 00 mov $0xf,%eax - 4d5: cd 40 int $0x40 - 4d7: c3 ret + 4a1: b8 0f 00 00 00 mov $0xf,%eax + 4a6: cd 40 int $0x40 + 4a8: c3 ret -000004d8 : +000004a9 : SYSCALL(mknod) - 4d8: b8 11 00 00 00 mov $0x11,%eax - 4dd: cd 40 int $0x40 - 4df: c3 ret + 4a9: b8 11 00 00 00 mov $0x11,%eax + 4ae: cd 40 int $0x40 + 4b0: c3 ret -000004e0 : +000004b1 : SYSCALL(unlink) - 4e0: b8 12 00 00 00 mov $0x12,%eax - 4e5: cd 40 int $0x40 - 4e7: c3 ret + 4b1: b8 12 00 00 00 mov $0x12,%eax + 4b6: cd 40 int $0x40 + 4b8: c3 ret -000004e8 : +000004b9 : SYSCALL(fstat) - 4e8: b8 08 00 00 00 mov $0x8,%eax - 4ed: cd 40 int $0x40 - 4ef: c3 ret + 4b9: b8 08 00 00 00 mov $0x8,%eax + 4be: cd 40 int $0x40 + 4c0: c3 ret -000004f0 : +000004c1 : SYSCALL(link) - 4f0: b8 13 00 00 00 mov $0x13,%eax - 4f5: cd 40 int $0x40 - 4f7: c3 ret + 4c1: b8 13 00 00 00 mov $0x13,%eax + 4c6: cd 40 int $0x40 + 4c8: c3 ret -000004f8 : +000004c9 : SYSCALL(mkdir) - 4f8: b8 14 00 00 00 mov $0x14,%eax - 4fd: cd 40 int $0x40 - 4ff: c3 ret + 4c9: b8 14 00 00 00 mov $0x14,%eax + 4ce: cd 40 int $0x40 + 4d0: c3 ret -00000500 : +000004d1 : SYSCALL(chdir) - 500: b8 09 00 00 00 mov $0x9,%eax - 505: cd 40 int $0x40 - 507: c3 ret + 4d1: b8 09 00 00 00 mov $0x9,%eax + 4d6: cd 40 int $0x40 + 4d8: c3 ret -00000508 : +000004d9 : SYSCALL(dup) - 508: b8 0a 00 00 00 mov $0xa,%eax - 50d: cd 40 int $0x40 - 50f: c3 ret + 4d9: b8 0a 00 00 00 mov $0xa,%eax + 4de: cd 40 int $0x40 + 4e0: c3 ret -00000510 : +000004e1 : SYSCALL(getpid) - 510: b8 0b 00 00 00 mov $0xb,%eax - 515: cd 40 int $0x40 - 517: c3 ret + 4e1: b8 0b 00 00 00 mov $0xb,%eax + 4e6: cd 40 int $0x40 + 4e8: c3 ret -00000518 : +000004e9 : SYSCALL(sbrk) - 518: b8 0c 00 00 00 mov $0xc,%eax - 51d: cd 40 int $0x40 - 51f: c3 ret + 4e9: b8 0c 00 00 00 mov $0xc,%eax + 4ee: cd 40 int $0x40 + 4f0: c3 ret -00000520 : +000004f1 : SYSCALL(sleep) - 520: b8 0d 00 00 00 mov $0xd,%eax - 525: cd 40 int $0x40 - 527: c3 ret + 4f1: b8 0d 00 00 00 mov $0xd,%eax + 4f6: cd 40 int $0x40 + 4f8: c3 ret -00000528 : +000004f9 : SYSCALL(uptime) - 528: b8 0e 00 00 00 mov $0xe,%eax - 52d: cd 40 int $0x40 - 52f: c3 ret + 4f9: b8 0e 00 00 00 mov $0xe,%eax + 4fe: cd 40 int $0x40 + 500: c3 ret -00000530 : +00000501 : SYSCALL(slabtest) - 530: b8 16 00 00 00 mov $0x16,%eax - 535: cd 40 int $0x40 - 537: c3 ret + 501: b8 16 00 00 00 mov $0x16,%eax + 506: cd 40 int $0x40 + 508: c3 ret -00000538 : +00000509 : SYSCALL(ps) - 538: b8 17 00 00 00 mov $0x17,%eax - 53d: cd 40 int $0x40 - 53f: c3 ret + 509: b8 17 00 00 00 mov $0x17,%eax + 50e: cd 40 int $0x40 + 510: c3 ret -00000540 : +00000511 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 540: 55 push %ebp - 541: 89 e5 mov %esp,%ebp - 543: 57 push %edi - 544: 56 push %esi - 545: 53 push %ebx - 546: 83 ec 3c sub $0x3c,%esp - 549: 89 45 c4 mov %eax,-0x3c(%ebp) - 54c: 89 d3 mov %edx,%ebx + 511: 55 push %ebp + 512: 89 e5 mov %esp,%ebp + 514: 57 push %edi + 515: 56 push %esi + 516: 53 push %ebx + 517: 83 ec 3c sub $0x3c,%esp + 51a: 89 45 c4 mov %eax,-0x3c(%ebp) + 51d: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 54e: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 552: 74 77 je 5cb - 554: 85 d2 test %edx,%edx - 556: 79 73 jns 5cb + 51f: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 523: 74 79 je 59e + 525: 85 d2 test %edx,%edx + 527: 79 75 jns 59e neg = 1; x = -xx; - 558: f7 db neg %ebx + 529: 89 d1 mov %edx,%ecx + 52b: f7 d9 neg %ecx neg = 1; - 55a: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 52d: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 561: be 00 00 00 00 mov $0x0,%esi + 534: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 566: 89 f7 mov %esi,%edi - 568: 83 c6 01 add $0x1,%esi - 56b: 89 d8 mov %ebx,%eax - 56d: ba 00 00 00 00 mov $0x0,%edx - 572: f7 f1 div %ecx - 574: 0f b6 92 2c 09 00 00 movzbl 0x92c(%edx),%edx - 57b: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 539: 89 df mov %ebx,%edi + 53b: 83 c3 01 add $0x1,%ebx + 53e: 89 c8 mov %ecx,%eax + 540: ba 00 00 00 00 mov $0x0,%edx + 545: f7 f6 div %esi + 547: 0f b6 92 38 09 00 00 movzbl 0x938(%edx),%edx + 54e: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 57f: 89 da mov %ebx,%edx - 581: 89 c3 mov %eax,%ebx - 583: 39 d1 cmp %edx,%ecx - 585: 76 df jbe 566 + 552: 89 ca mov %ecx,%edx + 554: 89 c1 mov %eax,%ecx + 556: 39 d6 cmp %edx,%esi + 558: 76 df jbe 539 if(neg) - 587: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 58b: 74 08 je 595 + 55a: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 55e: 74 08 je 568 buf[i++] = '-'; - 58d: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 592: 8d 77 02 lea 0x2(%edi),%esi + 560: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 565: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 595: 85 f6 test %esi,%esi - 597: 7e 2a jle 5c3 - 599: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 59d: 8d 7d d8 lea -0x28(%ebp),%edi + 568: 85 db test %ebx,%ebx + 56a: 7e 2a jle 596 + 56c: 8d 7d d8 lea -0x28(%ebp),%edi + 56f: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 5a0: 8d 75 d7 lea -0x29(%ebp),%esi + 573: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 5a3: 0f b6 03 movzbl (%ebx),%eax - 5a6: 88 45 d7 mov %al,-0x29(%ebp) + 576: 0f b6 03 movzbl (%ebx),%eax + 579: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 5a9: 83 ec 04 sub $0x4,%esp - 5ac: 6a 01 push $0x1 - 5ae: 56 push %esi - 5af: ff 75 c4 pushl -0x3c(%ebp) - 5b2: e8 f9 fe ff ff call 4b0 + 57c: 83 ec 04 sub $0x4,%esp + 57f: 6a 01 push $0x1 + 581: 56 push %esi + 582: ff 75 c4 push -0x3c(%ebp) + 585: e8 f7 fe ff ff call 481 while(--i >= 0) - 5b7: 89 d8 mov %ebx,%eax - 5b9: 83 eb 01 sub $0x1,%ebx - 5bc: 83 c4 10 add $0x10,%esp - 5bf: 39 f8 cmp %edi,%eax - 5c1: 75 e0 jne 5a3 + 58a: 89 d8 mov %ebx,%eax + 58c: 83 eb 01 sub $0x1,%ebx + 58f: 83 c4 10 add $0x10,%esp + 592: 39 f8 cmp %edi,%eax + 594: 75 e0 jne 576 } - 5c3: 8d 65 f4 lea -0xc(%ebp),%esp - 5c6: 5b pop %ebx - 5c7: 5e pop %esi - 5c8: 5f pop %edi - 5c9: 5d pop %ebp - 5ca: c3 ret + 596: 8d 65 f4 lea -0xc(%ebp),%esp + 599: 5b pop %ebx + 59a: 5e pop %esi + 59b: 5f pop %edi + 59c: 5d pop %ebp + 59d: c3 ret + x = xx; + 59e: 89 d1 mov %edx,%ecx neg = 0; - 5cb: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 5d2: eb 8d jmp 561 + 5a0: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 5a7: eb 8b jmp 534 -000005d4 : +000005a9 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 5d4: f3 0f 1e fb endbr32 - 5d8: 55 push %ebp - 5d9: 89 e5 mov %esp,%ebp - 5db: 57 push %edi - 5dc: 56 push %esi - 5dd: 53 push %ebx - 5de: 83 ec 2c sub $0x2c,%esp + 5a9: 55 push %ebp + 5aa: 89 e5 mov %esp,%ebp + 5ac: 57 push %edi + 5ad: 56 push %esi + 5ae: 53 push %ebx + 5af: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 5e1: 8b 75 0c mov 0xc(%ebp),%esi - 5e4: 0f b6 1e movzbl (%esi),%ebx - 5e7: 84 db test %bl,%bl - 5e9: 0f 84 ab 01 00 00 je 79a - 5ef: 83 c6 01 add $0x1,%esi + 5b2: 8b 75 0c mov 0xc(%ebp),%esi + 5b5: 0f b6 1e movzbl (%esi),%ebx + 5b8: 84 db test %bl,%bl + 5ba: 0f 84 9f 01 00 00 je 75f + 5c0: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 5f2: 8d 45 10 lea 0x10(%ebp),%eax - 5f5: 89 45 d4 mov %eax,-0x2c(%ebp) + 5c3: 8d 45 10 lea 0x10(%ebp),%eax + 5c6: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 5f8: bf 00 00 00 00 mov $0x0,%edi - 5fd: eb 2d jmp 62c + 5c9: bf 00 00 00 00 mov $0x0,%edi + 5ce: eb 2d jmp 5fd c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 5ff: 88 5d e7 mov %bl,-0x19(%ebp) + 5d0: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 602: 83 ec 04 sub $0x4,%esp - 605: 6a 01 push $0x1 - 607: 8d 45 e7 lea -0x19(%ebp),%eax - 60a: 50 push %eax - 60b: ff 75 08 pushl 0x8(%ebp) - 60e: e8 9d fe ff ff call 4b0 + 5d3: 83 ec 04 sub $0x4,%esp + 5d6: 6a 01 push $0x1 + 5d8: 8d 45 e7 lea -0x19(%ebp),%eax + 5db: 50 push %eax + 5dc: ff 75 08 push 0x8(%ebp) + 5df: e8 9d fe ff ff call 481 putc(fd, c); - 613: 83 c4 10 add $0x10,%esp - 616: eb 05 jmp 61d + 5e4: 83 c4 10 add $0x10,%esp + 5e7: eb 05 jmp 5ee } } else if(state == '%'){ - 618: 83 ff 25 cmp $0x25,%edi - 61b: 74 22 je 63f + 5e9: 83 ff 25 cmp $0x25,%edi + 5ec: 74 1f je 60d for(i = 0; fmt[i]; i++){ - 61d: 83 c6 01 add $0x1,%esi - 620: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 624: 84 db test %bl,%bl - 626: 0f 84 6e 01 00 00 je 79a + 5ee: 83 c6 01 add $0x1,%esi + 5f1: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 5f5: 84 db test %bl,%bl + 5f7: 0f 84 62 01 00 00 je 75f c = fmt[i] & 0xff; - 62c: 0f be d3 movsbl %bl,%edx - 62f: 0f b6 c3 movzbl %bl,%eax + 5fd: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 632: 85 ff test %edi,%edi - 634: 75 e2 jne 618 + 600: 85 ff test %edi,%edi + 602: 75 e5 jne 5e9 if(c == '%'){ - 636: 83 f8 25 cmp $0x25,%eax - 639: 75 c4 jne 5ff + 604: 83 f8 25 cmp $0x25,%eax + 607: 75 c7 jne 5d0 state = '%'; - 63b: 89 c7 mov %eax,%edi - 63d: eb de jmp 61d + 609: 89 c7 mov %eax,%edi + 60b: eb e1 jmp 5ee if(c == 'd'){ - 63f: 83 f8 64 cmp $0x64,%eax - 642: 74 59 je 69d + 60d: 83 f8 25 cmp $0x25,%eax + 610: 0f 84 f2 00 00 00 je 708 + 616: 8d 50 9d lea -0x63(%eax),%edx + 619: 83 fa 15 cmp $0x15,%edx + 61c: 0f 87 07 01 00 00 ja 729 + 622: 0f 87 01 01 00 00 ja 729 + 628: ff 24 95 e0 08 00 00 jmp *0x8e0(,%edx,4) printint(fd, *ap, 10, 1); + 62f: 83 ec 0c sub $0xc,%esp + 632: 6a 01 push $0x1 + 634: b9 0a 00 00 00 mov $0xa,%ecx + 639: 8b 7d d4 mov -0x2c(%ebp),%edi + 63c: 8b 17 mov (%edi),%edx + 63e: 8b 45 08 mov 0x8(%ebp),%eax + 641: e8 cb fe ff ff call 511 ap++; - } else if(c == 'x' || c == 'p'){ - 644: 81 e2 f7 00 00 00 and $0xf7,%edx - 64a: 83 fa 70 cmp $0x70,%edx - 64d: 74 7a je 6c9 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 64f: 83 f8 73 cmp $0x73,%eax - 652: 0f 84 9d 00 00 00 je 6f5 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 658: 83 f8 63 cmp $0x63,%eax - 65b: 0f 84 ec 00 00 00 je 74d - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 661: 83 f8 25 cmp $0x25,%eax - 664: 0f 84 0f 01 00 00 je 779 - putc(fd, c); + 646: 89 f8 mov %edi,%eax + 648: 83 c0 04 add $0x4,%eax + 64b: 89 45 d4 mov %eax,-0x2c(%ebp) + 64e: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 66a: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 66e: 83 ec 04 sub $0x4,%esp - 671: 6a 01 push $0x1 - 673: 8d 45 e7 lea -0x19(%ebp),%eax - 676: 50 push %eax - 677: ff 75 08 pushl 0x8(%ebp) - 67a: e8 31 fe ff ff call 4b0 putc(fd, c); - 67f: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 682: 83 c4 0c add $0xc,%esp - 685: 6a 01 push $0x1 - 687: 8d 45 e7 lea -0x19(%ebp),%eax - 68a: 50 push %eax - 68b: ff 75 08 pushl 0x8(%ebp) - 68e: e8 1d fe ff ff call 4b0 - putc(fd, c); - 693: 83 c4 10 add $0x10,%esp } state = 0; - 696: bf 00 00 00 00 mov $0x0,%edi - 69b: eb 80 jmp 61d - printint(fd, *ap, 10, 1); - 69d: 83 ec 0c sub $0xc,%esp - 6a0: 6a 01 push $0x1 - 6a2: b9 0a 00 00 00 mov $0xa,%ecx - 6a7: 8b 7d d4 mov -0x2c(%ebp),%edi - 6aa: 8b 17 mov (%edi),%edx - 6ac: 8b 45 08 mov 0x8(%ebp),%eax - 6af: e8 8c fe ff ff call 540 - ap++; - 6b4: 89 f8 mov %edi,%eax - 6b6: 83 c0 04 add $0x4,%eax - 6b9: 89 45 d4 mov %eax,-0x2c(%ebp) - 6bc: 83 c4 10 add $0x10,%esp - state = 0; - 6bf: bf 00 00 00 00 mov $0x0,%edi - 6c4: e9 54 ff ff ff jmp 61d + 651: bf 00 00 00 00 mov $0x0,%edi + 656: eb 96 jmp 5ee printint(fd, *ap, 16, 0); - 6c9: 83 ec 0c sub $0xc,%esp - 6cc: 6a 00 push $0x0 - 6ce: b9 10 00 00 00 mov $0x10,%ecx - 6d3: 8b 7d d4 mov -0x2c(%ebp),%edi - 6d6: 8b 17 mov (%edi),%edx - 6d8: 8b 45 08 mov 0x8(%ebp),%eax - 6db: e8 60 fe ff ff call 540 + 658: 83 ec 0c sub $0xc,%esp + 65b: 6a 00 push $0x0 + 65d: b9 10 00 00 00 mov $0x10,%ecx + 662: 8b 7d d4 mov -0x2c(%ebp),%edi + 665: 8b 17 mov (%edi),%edx + 667: 8b 45 08 mov 0x8(%ebp),%eax + 66a: e8 a2 fe ff ff call 511 ap++; - 6e0: 89 f8 mov %edi,%eax - 6e2: 83 c0 04 add $0x4,%eax - 6e5: 89 45 d4 mov %eax,-0x2c(%ebp) - 6e8: 83 c4 10 add $0x10,%esp + 66f: 89 f8 mov %edi,%eax + 671: 83 c0 04 add $0x4,%eax + 674: 89 45 d4 mov %eax,-0x2c(%ebp) + 677: 83 c4 10 add $0x10,%esp state = 0; - 6eb: bf 00 00 00 00 mov $0x0,%edi - 6f0: e9 28 ff ff ff jmp 61d + 67a: bf 00 00 00 00 mov $0x0,%edi + 67f: e9 6a ff ff ff jmp 5ee s = (char*)*ap; - 6f5: 8b 4d d4 mov -0x2c(%ebp),%ecx - 6f8: 8b 01 mov (%ecx),%eax + 684: 8b 4d d4 mov -0x2c(%ebp),%ecx + 687: 8b 01 mov (%ecx),%eax ap++; - 6fa: 83 c1 04 add $0x4,%ecx - 6fd: 89 4d d4 mov %ecx,-0x2c(%ebp) + 689: 83 c1 04 add $0x4,%ecx + 68c: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 700: 85 c0 test %eax,%eax - 702: 74 13 je 717 + 68f: 85 c0 test %eax,%eax + 691: 74 13 je 6a6 s = (char*)*ap; - 704: 89 c3 mov %eax,%ebx + 693: 89 c3 mov %eax,%ebx while(*s != 0){ - 706: 0f b6 00 movzbl (%eax),%eax + 695: 0f b6 00 movzbl (%eax),%eax state = 0; - 709: bf 00 00 00 00 mov $0x0,%edi + 698: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 70e: 84 c0 test %al,%al - 710: 75 0f jne 721 - 712: e9 06 ff ff ff jmp 61d + 69d: 84 c0 test %al,%al + 69f: 75 0f jne 6b0 + 6a1: e9 48 ff ff ff jmp 5ee s = "(null)"; - 717: bb 22 09 00 00 mov $0x922,%ebx + 6a6: bb d6 08 00 00 mov $0x8d6,%ebx while(*s != 0){ - 71c: b8 28 00 00 00 mov $0x28,%eax - 721: 8b 7d 08 mov 0x8(%ebp),%edi + 6ab: b8 28 00 00 00 mov $0x28,%eax + 6b0: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 724: 88 45 e7 mov %al,-0x19(%ebp) + 6b3: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 727: 83 ec 04 sub $0x4,%esp - 72a: 6a 01 push $0x1 - 72c: 8d 45 e7 lea -0x19(%ebp),%eax - 72f: 50 push %eax - 730: 57 push %edi - 731: e8 7a fd ff ff call 4b0 + 6b6: 83 ec 04 sub $0x4,%esp + 6b9: 6a 01 push $0x1 + 6bb: 8d 45 e7 lea -0x19(%ebp),%eax + 6be: 50 push %eax + 6bf: 57 push %edi + 6c0: e8 bc fd ff ff call 481 s++; - 736: 83 c3 01 add $0x1,%ebx + 6c5: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 739: 0f b6 03 movzbl (%ebx),%eax - 73c: 83 c4 10 add $0x10,%esp - 73f: 84 c0 test %al,%al - 741: 75 e1 jne 724 + 6c8: 0f b6 03 movzbl (%ebx),%eax + 6cb: 83 c4 10 add $0x10,%esp + 6ce: 84 c0 test %al,%al + 6d0: 75 e1 jne 6b3 state = 0; - 743: bf 00 00 00 00 mov $0x0,%edi - 748: e9 d0 fe ff ff jmp 61d + 6d2: bf 00 00 00 00 mov $0x0,%edi + 6d7: e9 12 ff ff ff jmp 5ee putc(fd, *ap); - 74d: 8b 7d d4 mov -0x2c(%ebp),%edi - 750: 8b 07 mov (%edi),%eax - 752: 88 45 e7 mov %al,-0x19(%ebp) + 6dc: 8b 7d d4 mov -0x2c(%ebp),%edi + 6df: 8b 07 mov (%edi),%eax + 6e1: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 755: 83 ec 04 sub $0x4,%esp - 758: 6a 01 push $0x1 - 75a: 8d 45 e7 lea -0x19(%ebp),%eax - 75d: 50 push %eax - 75e: ff 75 08 pushl 0x8(%ebp) - 761: e8 4a fd ff ff call 4b0 + 6e4: 83 ec 04 sub $0x4,%esp + 6e7: 6a 01 push $0x1 + 6e9: 8d 45 e7 lea -0x19(%ebp),%eax + 6ec: 50 push %eax + 6ed: ff 75 08 push 0x8(%ebp) + 6f0: e8 8c fd ff ff call 481 ap++; - 766: 83 c7 04 add $0x4,%edi - 769: 89 7d d4 mov %edi,-0x2c(%ebp) - 76c: 83 c4 10 add $0x10,%esp + 6f5: 83 c7 04 add $0x4,%edi + 6f8: 89 7d d4 mov %edi,-0x2c(%ebp) + 6fb: 83 c4 10 add $0x10,%esp state = 0; - 76f: bf 00 00 00 00 mov $0x0,%edi - 774: e9 a4 fe ff ff jmp 61d + 6fe: bf 00 00 00 00 mov $0x0,%edi + 703: e9 e6 fe ff ff jmp 5ee putc(fd, c); - 779: 88 5d e7 mov %bl,-0x19(%ebp) + 708: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 70b: 83 ec 04 sub $0x4,%esp + 70e: 6a 01 push $0x1 + 710: 8d 45 e7 lea -0x19(%ebp),%eax + 713: 50 push %eax + 714: ff 75 08 push 0x8(%ebp) + 717: e8 65 fd ff ff call 481 + 71c: 83 c4 10 add $0x10,%esp + state = 0; + 71f: bf 00 00 00 00 mov $0x0,%edi + 724: e9 c5 fe ff ff jmp 5ee + putc(fd, '%'); + 729: c6 45 e7 25 movb $0x25,-0x19(%ebp) write(fd, &c, 1); - 77c: 83 ec 04 sub $0x4,%esp - 77f: 6a 01 push $0x1 - 781: 8d 45 e7 lea -0x19(%ebp),%eax - 784: 50 push %eax - 785: ff 75 08 pushl 0x8(%ebp) - 788: e8 23 fd ff ff call 4b0 - 78d: 83 c4 10 add $0x10,%esp + 72d: 83 ec 04 sub $0x4,%esp + 730: 6a 01 push $0x1 + 732: 8d 45 e7 lea -0x19(%ebp),%eax + 735: 50 push %eax + 736: ff 75 08 push 0x8(%ebp) + 739: e8 43 fd ff ff call 481 + putc(fd, c); + 73e: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 741: 83 c4 0c add $0xc,%esp + 744: 6a 01 push $0x1 + 746: 8d 45 e7 lea -0x19(%ebp),%eax + 749: 50 push %eax + 74a: ff 75 08 push 0x8(%ebp) + 74d: e8 2f fd ff ff call 481 + putc(fd, c); + 752: 83 c4 10 add $0x10,%esp state = 0; - 790: bf 00 00 00 00 mov $0x0,%edi - 795: e9 83 fe ff ff jmp 61d + 755: bf 00 00 00 00 mov $0x0,%edi + 75a: e9 8f fe ff ff jmp 5ee } } } - 79a: 8d 65 f4 lea -0xc(%ebp),%esp - 79d: 5b pop %ebx - 79e: 5e pop %esi - 79f: 5f pop %edi - 7a0: 5d pop %ebp - 7a1: c3 ret - -000007a2 : + 75f: 8d 65 f4 lea -0xc(%ebp),%esp + 762: 5b pop %ebx + 763: 5e pop %esi + 764: 5f pop %edi + 765: 5d pop %ebp + 766: c3 ret + +00000767 : static Header base; static Header *freep; void free(void *ap) { - 7a2: f3 0f 1e fb endbr32 - 7a6: 55 push %ebp - 7a7: 89 e5 mov %esp,%ebp - 7a9: 57 push %edi - 7aa: 56 push %esi - 7ab: 53 push %ebx - 7ac: 8b 5d 08 mov 0x8(%ebp),%ebx + 767: 55 push %ebp + 768: 89 e5 mov %esp,%ebp + 76a: 57 push %edi + 76b: 56 push %esi + 76c: 53 push %ebx + 76d: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 7af: 8d 4b f8 lea -0x8(%ebx),%ecx + 770: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 7b2: a1 60 0c 00 00 mov 0xc60,%eax - 7b7: eb 0c jmp 7c5 + 773: a1 60 10 00 00 mov 0x1060,%eax + 778: eb 0c jmp 786 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 7b9: 8b 10 mov (%eax),%edx - 7bb: 39 c2 cmp %eax,%edx - 7bd: 77 04 ja 7c3 - 7bf: 39 ca cmp %ecx,%edx - 7c1: 77 10 ja 7d3 + 77a: 8b 10 mov (%eax),%edx + 77c: 39 c2 cmp %eax,%edx + 77e: 77 04 ja 784 + 780: 39 ca cmp %ecx,%edx + 782: 77 10 ja 794 { - 7c3: 89 d0 mov %edx,%eax + 784: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 7c5: 39 c8 cmp %ecx,%eax - 7c7: 73 f0 jae 7b9 - 7c9: 8b 10 mov (%eax),%edx - 7cb: 39 ca cmp %ecx,%edx - 7cd: 77 04 ja 7d3 + 786: 39 c8 cmp %ecx,%eax + 788: 73 f0 jae 77a + 78a: 8b 10 mov (%eax),%edx + 78c: 39 ca cmp %ecx,%edx + 78e: 77 04 ja 794 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 7cf: 39 c2 cmp %eax,%edx - 7d1: 77 f0 ja 7c3 + 790: 39 c2 cmp %eax,%edx + 792: 77 f0 ja 784 break; if(bp + bp->s.size == p->s.ptr){ - 7d3: 8b 73 fc mov -0x4(%ebx),%esi - 7d6: 8b 10 mov (%eax),%edx - 7d8: 8d 3c f1 lea (%ecx,%esi,8),%edi - 7db: 39 fa cmp %edi,%edx - 7dd: 74 19 je 7f8 + 794: 8b 73 fc mov -0x4(%ebx),%esi + 797: 8b 10 mov (%eax),%edx + 799: 8d 3c f1 lea (%ecx,%esi,8),%edi + 79c: 39 fa cmp %edi,%edx + 79e: 74 19 je 7b9 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 7a0: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 7df: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 7e2: 8b 50 04 mov 0x4(%eax),%edx - 7e5: 8d 34 d0 lea (%eax,%edx,8),%esi - 7e8: 39 f1 cmp %esi,%ecx - 7ea: 74 1b je 807 + 7a3: 8b 50 04 mov 0x4(%eax),%edx + 7a6: 8d 34 d0 lea (%eax,%edx,8),%esi + 7a9: 39 f1 cmp %esi,%ecx + 7ab: 74 18 je 7c5 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 7ad: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 7ec: 89 08 mov %ecx,(%eax) freep = p; - 7ee: a3 60 0c 00 00 mov %eax,0xc60 + 7af: a3 60 10 00 00 mov %eax,0x1060 } - 7f3: 5b pop %ebx - 7f4: 5e pop %esi - 7f5: 5f pop %edi - 7f6: 5d pop %ebp - 7f7: c3 ret + 7b4: 5b pop %ebx + 7b5: 5e pop %esi + 7b6: 5f pop %edi + 7b7: 5d pop %ebp + 7b8: c3 ret bp->s.size += p->s.ptr->s.size; - 7f8: 03 72 04 add 0x4(%edx),%esi - 7fb: 89 73 fc mov %esi,-0x4(%ebx) + 7b9: 03 72 04 add 0x4(%edx),%esi + 7bc: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 7fe: 8b 10 mov (%eax),%edx - 800: 8b 12 mov (%edx),%edx - 802: 89 53 f8 mov %edx,-0x8(%ebx) - 805: eb db jmp 7e2 + 7bf: 8b 10 mov (%eax),%edx + 7c1: 8b 12 mov (%edx),%edx + 7c3: eb db jmp 7a0 p->s.size += bp->s.size; - 807: 03 53 fc add -0x4(%ebx),%edx - 80a: 89 50 04 mov %edx,0x4(%eax) + 7c5: 03 53 fc add -0x4(%ebx),%edx + 7c8: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 80d: 8b 53 f8 mov -0x8(%ebx),%edx - 810: 89 10 mov %edx,(%eax) - 812: eb da jmp 7ee + 7cb: 8b 4b f8 mov -0x8(%ebx),%ecx + 7ce: eb dd jmp 7ad -00000814 : +000007d0 : return freep; } void* malloc(uint nbytes) { - 814: f3 0f 1e fb endbr32 - 818: 55 push %ebp - 819: 89 e5 mov %esp,%ebp - 81b: 57 push %edi - 81c: 56 push %esi - 81d: 53 push %ebx - 81e: 83 ec 0c sub $0xc,%esp + 7d0: 55 push %ebp + 7d1: 89 e5 mov %esp,%ebp + 7d3: 57 push %edi + 7d4: 56 push %esi + 7d5: 53 push %ebx + 7d6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 821: 8b 45 08 mov 0x8(%ebp),%eax - 824: 8d 58 07 lea 0x7(%eax),%ebx - 827: c1 eb 03 shr $0x3,%ebx - 82a: 83 c3 01 add $0x1,%ebx + 7d9: 8b 45 08 mov 0x8(%ebp),%eax + 7dc: 8d 58 07 lea 0x7(%eax),%ebx + 7df: c1 eb 03 shr $0x3,%ebx + 7e2: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 82d: 8b 15 60 0c 00 00 mov 0xc60,%edx - 833: 85 d2 test %edx,%edx - 835: 74 20 je 857 + 7e5: 8b 15 60 10 00 00 mov 0x1060,%edx + 7eb: 85 d2 test %edx,%edx + 7ed: 74 1c je 80b base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 837: 8b 02 mov (%edx),%eax + 7ef: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 839: 8b 48 04 mov 0x4(%eax),%ecx - 83c: 39 cb cmp %ecx,%ebx - 83e: 76 3c jbe 87c - 840: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 846: be 00 10 00 00 mov $0x1000,%esi - 84b: 0f 43 f3 cmovae %ebx,%esi + 7f1: 8b 48 04 mov 0x4(%eax),%ecx + 7f4: 39 cb cmp %ecx,%ebx + 7f6: 76 38 jbe 830 + 7f8: be 00 10 00 00 mov $0x1000,%esi + 7fd: 39 f3 cmp %esi,%ebx + 7ff: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 84e: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 855: eb 72 jmp 8c9 + 802: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 809: eb 72 jmp 87d base.s.ptr = freep = prevp = &base; - 857: c7 05 60 0c 00 00 64 movl $0xc64,0xc60 - 85e: 0c 00 00 - 861: c7 05 64 0c 00 00 64 movl $0xc64,0xc64 - 868: 0c 00 00 + 80b: c7 05 60 10 00 00 64 movl $0x1064,0x1060 + 812: 10 00 00 + 815: c7 05 64 10 00 00 64 movl $0x1064,0x1064 + 81c: 10 00 00 base.s.size = 0; - 86b: c7 05 68 0c 00 00 00 movl $0x0,0xc68 - 872: 00 00 00 + 81f: c7 05 68 10 00 00 00 movl $0x0,0x1068 + 826: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 875: b8 64 0c 00 00 mov $0xc64,%eax - 87a: eb c4 jmp 840 + 829: b8 64 10 00 00 mov $0x1064,%eax + 82e: eb c8 jmp 7f8 if(p->s.size == nunits) - 87c: 39 cb cmp %ecx,%ebx - 87e: 74 1e je 89e + 830: 39 cb cmp %ecx,%ebx + 832: 74 1e je 852 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 880: 29 d9 sub %ebx,%ecx - 882: 89 48 04 mov %ecx,0x4(%eax) + 834: 29 d9 sub %ebx,%ecx + 836: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 885: 8d 04 c8 lea (%eax,%ecx,8),%eax + 839: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 888: 89 58 04 mov %ebx,0x4(%eax) + 83c: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 88b: 89 15 60 0c 00 00 mov %edx,0xc60 + 83f: 89 15 60 10 00 00 mov %edx,0x1060 return (void*)(p + 1); - 891: 8d 50 08 lea 0x8(%eax),%edx + 845: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 894: 89 d0 mov %edx,%eax - 896: 8d 65 f4 lea -0xc(%ebp),%esp - 899: 5b pop %ebx - 89a: 5e pop %esi - 89b: 5f pop %edi - 89c: 5d pop %ebp - 89d: c3 ret + 848: 89 d0 mov %edx,%eax + 84a: 8d 65 f4 lea -0xc(%ebp),%esp + 84d: 5b pop %ebx + 84e: 5e pop %esi + 84f: 5f pop %edi + 850: 5d pop %ebp + 851: c3 ret prevp->s.ptr = p->s.ptr; - 89e: 8b 08 mov (%eax),%ecx - 8a0: 89 0a mov %ecx,(%edx) - 8a2: eb e7 jmp 88b + 852: 8b 08 mov (%eax),%ecx + 854: 89 0a mov %ecx,(%edx) + 856: eb e7 jmp 83f hp->s.size = nu; - 8a4: 89 70 04 mov %esi,0x4(%eax) + 858: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 8a7: 83 ec 0c sub $0xc,%esp - 8aa: 83 c0 08 add $0x8,%eax - 8ad: 50 push %eax - 8ae: e8 ef fe ff ff call 7a2 + 85b: 83 ec 0c sub $0xc,%esp + 85e: 83 c0 08 add $0x8,%eax + 861: 50 push %eax + 862: e8 00 ff ff ff call 767 return freep; - 8b3: 8b 15 60 0c 00 00 mov 0xc60,%edx + 867: 8b 15 60 10 00 00 mov 0x1060,%edx if((p = morecore(nunits)) == 0) - 8b9: 83 c4 10 add $0x10,%esp - 8bc: 85 d2 test %edx,%edx - 8be: 74 d4 je 894 + 86d: 83 c4 10 add $0x10,%esp + 870: 85 d2 test %edx,%edx + 872: 74 d4 je 848 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 8c0: 8b 02 mov (%edx),%eax + 874: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 8c2: 8b 48 04 mov 0x4(%eax),%ecx - 8c5: 39 d9 cmp %ebx,%ecx - 8c7: 73 b3 jae 87c + 876: 8b 48 04 mov 0x4(%eax),%ecx + 879: 39 d9 cmp %ebx,%ecx + 87b: 73 b3 jae 830 if(p == freep) - 8c9: 89 c2 mov %eax,%edx - 8cb: 39 05 60 0c 00 00 cmp %eax,0xc60 - 8d1: 75 ed jne 8c0 + 87d: 89 c2 mov %eax,%edx + 87f: 39 05 60 10 00 00 cmp %eax,0x1060 + 885: 75 ed jne 874 p = sbrk(nu * sizeof(Header)); - 8d3: 83 ec 0c sub $0xc,%esp - 8d6: 57 push %edi - 8d7: e8 3c fc ff ff call 518 + 887: 83 ec 0c sub $0xc,%esp + 88a: 57 push %edi + 88b: e8 59 fc ff ff call 4e9 if(p == (char*)-1) - 8dc: 83 c4 10 add $0x10,%esp - 8df: 83 f8 ff cmp $0xffffffff,%eax - 8e2: 75 c0 jne 8a4 + 890: 83 c4 10 add $0x10,%esp + 893: 83 f8 ff cmp $0xffffffff,%eax + 896: 75 c0 jne 858 return 0; - 8e4: ba 00 00 00 00 mov $0x0,%edx - 8e9: eb a9 jmp 894 + 898: ba 00 00 00 00 mov $0x0,%edx + 89d: eb a9 jmp 848 diff --git a/src/user/grep.d b/src/user/grep.d new file mode 100644 index 0000000..2280342 --- /dev/null +++ b/src/user/grep.d @@ -0,0 +1 @@ +user/grep.o: user/grep.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/grep.o b/src/user/grep.o new file mode 100644 index 0000000..c7c9fb8 Binary files /dev/null and b/src/user/grep.o differ diff --git a/src/user/grep.sym b/src/user/grep.sym index 6958482..9bd88ef 100644 --- a/src/user/grep.sym +++ b/src/user/grep.sym @@ -1,64 +1,52 @@ -00000000 .text -000008ec .rodata -00000940 .eh_frame -00000c60 .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 -00000540 printint -0000092c digits.1089 +00000511 printint +00000938 digits.0 00000000 umalloc.c -00000c60 freep -00000c64 base -000002aa strcpy -000005d4 printf -00000457 memmove -0000004c matchhere -000004d8 mknod -00000538 ps -00000375 gets -00000510 getpid -00000120 grep -00000814 malloc -00000520 sleep -000004a0 pipe -00000530 slabtest -000004b0 write -000004e8 fstat -000004c0 kill -00000500 chdir -000004c8 exec -00000498 wait -000004a8 read -000004e0 unlink -00000488 fork -00000518 sbrk -00000528 uptime -00000c48 __bss_start -00000329 memset -000001f5 main +00001060 freep +00001064 base +00000299 strcpy +000005a9 printf +0000042c memmove +00000048 matchhere +000004a9 mknod +00000509 ps +00000354 gets +000004e1 getpid +00000114 grep +000007d0 malloc +000004f1 sleep +00000471 pipe +00000501 slabtest +00000481 write +000004b9 fstat +00000491 kill +000004d1 chdir +00000499 exec +00000469 wait +00000479 read +000004b1 unlink +00000459 fork +000004e9 sbrk +000004f9 uptime +00000c54 __bss_start +0000030e memset +000001e8 main 00000000 matchstar -000002d0 strcmp -00000508 dup -00000c80 buf -000003d0 stat -00000c48 _edata -00001080 _end -000000d2 match -000004f0 link -00000490 exit -00000418 atoi -000002ff strlen -000004d0 open -00000344 strchr -000004f8 mkdir -000004b8 close -000007a2 free +000002bd strcmp +000004d9 dup +00000c60 buf +000003ab stat +00000c54 _edata +0000106c _end +000000ca match +000004c1 link +00000461 exit +000003ef atoi +000002e8 strlen +000004a1 open +00000327 strchr +000004c9 mkdir +00000489 close +00000767 free diff --git a/src/user/init.asm b/src/user/init.asm index c064b8b..6ba5b51 100644 --- a/src/user/init.asm +++ b/src/user/init.asm @@ -11,1117 +11,1086 @@ char *argv[] = { "sh", 0 }; int main(void) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 53 push %ebx - 12: 51 push %ecx + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 53 push %ebx + e: 51 push %ecx int pid, wpid; if(open("console", O_RDWR) < 0){ - 13: 83 ec 08 sub $0x8,%esp - 16: 6a 02 push $0x2 - 18: 68 24 07 00 00 push $0x724 - 1d: e8 e5 02 00 00 call 307 - 22: 83 c4 10 add $0x10,%esp - 25: 85 c0 test %eax,%eax - 27: 78 59 js 82 + f: 83 ec 08 sub $0x8,%esp + 12: 6a 02 push $0x2 + 14: 68 e4 06 00 00 push $0x6e4 + 19: e8 c7 02 00 00 call 2e5 + 1e: 83 c4 10 add $0x10,%esp + 21: 85 c0 test %eax,%eax + 23: 78 59 js 7e mknod("console", 1, 1); open("console", O_RDWR); } dup(0); // stdout - 29: 83 ec 0c sub $0xc,%esp - 2c: 6a 00 push $0x0 - 2e: e8 0c 03 00 00 call 33f + 25: 83 ec 0c sub $0xc,%esp + 28: 6a 00 push $0x0 + 2a: e8 ee 02 00 00 call 31d dup(0); // stderr - 33: c7 04 24 00 00 00 00 movl $0x0,(%esp) - 3a: e8 00 03 00 00 call 33f - 3f: 83 c4 10 add $0x10,%esp + 2f: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 36: e8 e2 02 00 00 call 31d + 3b: 83 c4 10 add $0x10,%esp for(;;){ printf(1, "init: starting sh\n"); - 42: 83 ec 08 sub $0x8,%esp - 45: 68 2c 07 00 00 push $0x72c - 4a: 6a 01 push $0x1 - 4c: e8 ba 03 00 00 call 40b + 3e: 83 ec 08 sub $0x8,%esp + 41: 68 ec 06 00 00 push $0x6ec + 46: 6a 01 push $0x1 + 48: e8 a0 03 00 00 call 3ed pid = fork(); - 51: e8 69 02 00 00 call 2bf - 56: 89 c3 mov %eax,%ebx + 4d: e8 4b 02 00 00 call 29d + 52: 89 c3 mov %eax,%ebx if(pid < 0){ - 58: 83 c4 10 add $0x10,%esp - 5b: 85 c0 test %eax,%eax - 5d: 78 48 js a7 + 54: 83 c4 10 add $0x10,%esp + 57: 85 c0 test %eax,%eax + 59: 78 48 js a3 printf(1, "init: fork failed\n"); exit(); } if(pid == 0){ - 5f: 74 5a je bb + 5b: 74 5a je b7 exec("sh", argv); printf(1, "init: exec sh failed\n"); exit(); } while((wpid=wait()) >= 0 && wpid != pid) - 61: e8 69 02 00 00 call 2cf - 66: 39 c3 cmp %eax,%ebx - 68: 74 d8 je 42 - 6a: 85 c0 test %eax,%eax - 6c: 78 d4 js 42 + 5d: e8 4b 02 00 00 call 2ad + 62: 39 c3 cmp %eax,%ebx + 64: 74 d8 je 3e + 66: 85 c0 test %eax,%eax + 68: 78 d4 js 3e printf(1, "zombie!\n"); - 6e: 83 ec 08 sub $0x8,%esp - 71: 68 6b 07 00 00 push $0x76b - 76: 6a 01 push $0x1 - 78: e8 8e 03 00 00 call 40b - 7d: 83 c4 10 add $0x10,%esp - 80: eb df jmp 61 + 6a: 83 ec 08 sub $0x8,%esp + 6d: 68 2b 07 00 00 push $0x72b + 72: 6a 01 push $0x1 + 74: e8 74 03 00 00 call 3ed + 79: 83 c4 10 add $0x10,%esp + 7c: eb df jmp 5d mknod("console", 1, 1); - 82: 83 ec 04 sub $0x4,%esp - 85: 6a 01 push $0x1 - 87: 6a 01 push $0x1 - 89: 68 24 07 00 00 push $0x724 - 8e: e8 7c 02 00 00 call 30f + 7e: 83 ec 04 sub $0x4,%esp + 81: 6a 01 push $0x1 + 83: 6a 01 push $0x1 + 85: 68 e4 06 00 00 push $0x6e4 + 8a: e8 5e 02 00 00 call 2ed open("console", O_RDWR); - 93: 83 c4 08 add $0x8,%esp - 96: 6a 02 push $0x2 - 98: 68 24 07 00 00 push $0x724 - 9d: e8 65 02 00 00 call 307 - a2: 83 c4 10 add $0x10,%esp - a5: eb 82 jmp 29 + 8f: 83 c4 08 add $0x8,%esp + 92: 6a 02 push $0x2 + 94: 68 e4 06 00 00 push $0x6e4 + 99: e8 47 02 00 00 call 2e5 + 9e: 83 c4 10 add $0x10,%esp + a1: eb 82 jmp 25 printf(1, "init: fork failed\n"); - a7: 83 ec 08 sub $0x8,%esp - aa: 68 3f 07 00 00 push $0x73f - af: 6a 01 push $0x1 - b1: e8 55 03 00 00 call 40b + a3: 83 ec 08 sub $0x8,%esp + a6: 68 ff 06 00 00 push $0x6ff + ab: 6a 01 push $0x1 + ad: e8 3b 03 00 00 call 3ed exit(); - b6: e8 0c 02 00 00 call 2c7 + b2: e8 ee 01 00 00 call 2a5 exec("sh", argv); - bb: 83 ec 08 sub $0x8,%esp - be: 68 e8 09 00 00 push $0x9e8 - c3: 68 52 07 00 00 push $0x752 - c8: e8 32 02 00 00 call 2ff + b7: 83 ec 08 sub $0x8,%esp + ba: 68 00 0a 00 00 push $0xa00 + bf: 68 12 07 00 00 push $0x712 + c4: e8 14 02 00 00 call 2dd printf(1, "init: exec sh failed\n"); - cd: 83 c4 08 add $0x8,%esp - d0: 68 55 07 00 00 push $0x755 - d5: 6a 01 push $0x1 - d7: e8 2f 03 00 00 call 40b + c9: 83 c4 08 add $0x8,%esp + cc: 68 15 07 00 00 push $0x715 + d1: 6a 01 push $0x1 + d3: e8 15 03 00 00 call 3ed exit(); - dc: e8 e6 01 00 00 call 2c7 + d8: e8 c8 01 00 00 call 2a5 -000000e1 : +000000dd : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - e1: f3 0f 1e fb endbr32 - e5: 55 push %ebp - e6: 89 e5 mov %esp,%ebp - e8: 53 push %ebx - e9: 8b 4d 08 mov 0x8(%ebp),%ecx - ec: 8b 5d 0c mov 0xc(%ebp),%ebx + dd: 55 push %ebp + de: 89 e5 mov %esp,%ebp + e0: 53 push %ebx + e1: 8b 4d 08 mov 0x8(%ebp),%ecx + e4: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - ef: b8 00 00 00 00 mov $0x0,%eax - f4: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - f8: 88 14 01 mov %dl,(%ecx,%eax,1) - fb: 83 c0 01 add $0x1,%eax - fe: 84 d2 test %dl,%dl - 100: 75 f2 jne f4 + e7: b8 00 00 00 00 mov $0x0,%eax + ec: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + f0: 88 14 01 mov %dl,(%ecx,%eax,1) + f3: 83 c0 01 add $0x1,%eax + f6: 84 d2 test %dl,%dl + f8: 75 f2 jne ec ; return os; } - 102: 89 c8 mov %ecx,%eax - 104: 5b pop %ebx - 105: 5d pop %ebp - 106: c3 ret + fa: 89 c8 mov %ecx,%eax + fc: 8b 5d fc mov -0x4(%ebp),%ebx + ff: c9 leave + 100: c3 ret -00000107 : +00000101 : int strcmp(const char *p, const char *q) { - 107: f3 0f 1e fb endbr32 - 10b: 55 push %ebp - 10c: 89 e5 mov %esp,%ebp - 10e: 8b 4d 08 mov 0x8(%ebp),%ecx - 111: 8b 55 0c mov 0xc(%ebp),%edx + 101: 55 push %ebp + 102: 89 e5 mov %esp,%ebp + 104: 8b 4d 08 mov 0x8(%ebp),%ecx + 107: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 114: 0f b6 01 movzbl (%ecx),%eax - 117: 84 c0 test %al,%al - 119: 74 11 je 12c - 11b: 38 02 cmp %al,(%edx) - 11d: 75 0d jne 12c + 10a: 0f b6 01 movzbl (%ecx),%eax + 10d: 84 c0 test %al,%al + 10f: 74 11 je 122 + 111: 38 02 cmp %al,(%edx) + 113: 75 0d jne 122 p++, q++; - 11f: 83 c1 01 add $0x1,%ecx - 122: 83 c2 01 add $0x1,%edx + 115: 83 c1 01 add $0x1,%ecx + 118: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 125: 0f b6 01 movzbl (%ecx),%eax - 128: 84 c0 test %al,%al - 12a: 75 ef jne 11b + 11b: 0f b6 01 movzbl (%ecx),%eax + 11e: 84 c0 test %al,%al + 120: 75 ef jne 111 return (uchar)*p - (uchar)*q; - 12c: 0f b6 c0 movzbl %al,%eax - 12f: 0f b6 12 movzbl (%edx),%edx - 132: 29 d0 sub %edx,%eax + 122: 0f b6 c0 movzbl %al,%eax + 125: 0f b6 12 movzbl (%edx),%edx + 128: 29 d0 sub %edx,%eax } - 134: 5d pop %ebp - 135: c3 ret + 12a: 5d pop %ebp + 12b: c3 ret -00000136 : +0000012c : uint strlen(const char *s) { - 136: f3 0f 1e fb endbr32 - 13a: 55 push %ebp - 13b: 89 e5 mov %esp,%ebp - 13d: 8b 55 08 mov 0x8(%ebp),%edx + 12c: 55 push %ebp + 12d: 89 e5 mov %esp,%ebp + 12f: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 140: 80 3a 00 cmpb $0x0,(%edx) - 143: 74 14 je 159 - 145: b8 00 00 00 00 mov $0x0,%eax - 14a: 83 c0 01 add $0x1,%eax - 14d: 89 c1 mov %eax,%ecx - 14f: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 153: 75 f5 jne 14a + 132: 80 3a 00 cmpb $0x0,(%edx) + 135: 74 14 je 14b + 137: b8 00 00 00 00 mov $0x0,%eax + 13c: 83 c0 01 add $0x1,%eax + 13f: 89 c1 mov %eax,%ecx + 141: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 145: 75 f5 jne 13c ; return n; } - 155: 89 c8 mov %ecx,%eax - 157: 5d pop %ebp - 158: c3 ret + 147: 89 c8 mov %ecx,%eax + 149: 5d pop %ebp + 14a: c3 ret for(n = 0; s[n]; n++) - 159: b9 00 00 00 00 mov $0x0,%ecx + 14b: b9 00 00 00 00 mov $0x0,%ecx return n; - 15e: eb f5 jmp 155 + 150: eb f5 jmp 147 -00000160 : +00000152 : void* memset(void *dst, int c, uint n) { - 160: f3 0f 1e fb endbr32 - 164: 55 push %ebp - 165: 89 e5 mov %esp,%ebp - 167: 57 push %edi - 168: 8b 55 08 mov 0x8(%ebp),%edx + 152: 55 push %ebp + 153: 89 e5 mov %esp,%ebp + 155: 57 push %edi + 156: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 16b: 89 d7 mov %edx,%edi - 16d: 8b 4d 10 mov 0x10(%ebp),%ecx - 170: 8b 45 0c mov 0xc(%ebp),%eax - 173: fc cld - 174: f3 aa rep stos %al,%es:(%edi) + 159: 89 d7 mov %edx,%edi + 15b: 8b 4d 10 mov 0x10(%ebp),%ecx + 15e: 8b 45 0c mov 0xc(%ebp),%eax + 161: fc cld + 162: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 176: 89 d0 mov %edx,%eax - 178: 5f pop %edi - 179: 5d pop %ebp - 17a: c3 ret + 164: 89 d0 mov %edx,%eax + 166: 8b 7d fc mov -0x4(%ebp),%edi + 169: c9 leave + 16a: c3 ret -0000017b : +0000016b : char* strchr(const char *s, char c) { - 17b: f3 0f 1e fb endbr32 - 17f: 55 push %ebp - 180: 89 e5 mov %esp,%ebp - 182: 8b 45 08 mov 0x8(%ebp),%eax - 185: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 16b: 55 push %ebp + 16c: 89 e5 mov %esp,%ebp + 16e: 8b 45 08 mov 0x8(%ebp),%eax + 171: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 189: 0f b6 10 movzbl (%eax),%edx - 18c: 84 d2 test %dl,%dl - 18e: 74 15 je 1a5 + 175: 0f b6 10 movzbl (%eax),%edx + 178: 84 d2 test %dl,%dl + 17a: 74 15 je 191 if(*s == c) - 190: 38 d1 cmp %dl,%cl - 192: 74 0f je 1a3 + 17c: 38 d1 cmp %dl,%cl + 17e: 74 0f je 18f for(; *s; s++) - 194: 83 c0 01 add $0x1,%eax - 197: 0f b6 10 movzbl (%eax),%edx - 19a: 84 d2 test %dl,%dl - 19c: 75 f2 jne 190 + 180: 83 c0 01 add $0x1,%eax + 183: 0f b6 10 movzbl (%eax),%edx + 186: 84 d2 test %dl,%dl + 188: 75 f2 jne 17c return (char*)s; return 0; - 19e: b8 00 00 00 00 mov $0x0,%eax + 18a: b8 00 00 00 00 mov $0x0,%eax } - 1a3: 5d pop %ebp - 1a4: c3 ret + 18f: 5d pop %ebp + 190: c3 ret return 0; - 1a5: b8 00 00 00 00 mov $0x0,%eax - 1aa: eb f7 jmp 1a3 + 191: b8 00 00 00 00 mov $0x0,%eax + 196: eb f7 jmp 18f -000001ac : +00000198 : char* gets(char *buf, int max) { - 1ac: f3 0f 1e fb endbr32 - 1b0: 55 push %ebp - 1b1: 89 e5 mov %esp,%ebp - 1b3: 57 push %edi - 1b4: 56 push %esi - 1b5: 53 push %ebx - 1b6: 83 ec 2c sub $0x2c,%esp - 1b9: 8b 75 08 mov 0x8(%ebp),%esi + 198: 55 push %ebp + 199: 89 e5 mov %esp,%ebp + 19b: 57 push %edi + 19c: 56 push %esi + 19d: 53 push %ebx + 19e: 83 ec 2c sub $0x2c,%esp + 1a1: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 1bc: bb 00 00 00 00 mov $0x0,%ebx + 1a4: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 1c1: 8d 7d e7 lea -0x19(%ebp),%edi + 1a9: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 1c4: 89 5d d4 mov %ebx,-0x2c(%ebp) - 1c7: 83 c3 01 add $0x1,%ebx - 1ca: 3b 5d 0c cmp 0xc(%ebp),%ebx - 1cd: 7d 27 jge 1f6 + 1ac: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1af: 83 c3 01 add $0x1,%ebx + 1b2: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1b5: 7d 27 jge 1de cc = read(0, &c, 1); - 1cf: 83 ec 04 sub $0x4,%esp - 1d2: 6a 01 push $0x1 - 1d4: 57 push %edi - 1d5: 6a 00 push $0x0 - 1d7: e8 03 01 00 00 call 2df + 1b7: 83 ec 04 sub $0x4,%esp + 1ba: 6a 01 push $0x1 + 1bc: 57 push %edi + 1bd: 6a 00 push $0x0 + 1bf: e8 f9 00 00 00 call 2bd if(cc < 1) - 1dc: 83 c4 10 add $0x10,%esp - 1df: 85 c0 test %eax,%eax - 1e1: 7e 13 jle 1f6 + 1c4: 83 c4 10 add $0x10,%esp + 1c7: 85 c0 test %eax,%eax + 1c9: 7e 13 jle 1de break; buf[i++] = c; - 1e3: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 1e7: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 1cb: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 1cf: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 1eb: 3c 0a cmp $0xa,%al - 1ed: 74 04 je 1f3 - 1ef: 3c 0d cmp $0xd,%al - 1f1: 75 d1 jne 1c4 + 1d3: 3c 0a cmp $0xa,%al + 1d5: 74 04 je 1db + 1d7: 3c 0d cmp $0xd,%al + 1d9: 75 d1 jne 1ac for(i=0; i+1 < max; ){ - 1f3: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1db: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 1f6: 8b 45 d4 mov -0x2c(%ebp),%eax - 1f9: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 1de: 8b 45 d4 mov -0x2c(%ebp),%eax + 1e1: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 1fd: 89 f0 mov %esi,%eax - 1ff: 8d 65 f4 lea -0xc(%ebp),%esp - 202: 5b pop %ebx - 203: 5e pop %esi - 204: 5f pop %edi - 205: 5d pop %ebp - 206: c3 ret + 1e5: 89 f0 mov %esi,%eax + 1e7: 8d 65 f4 lea -0xc(%ebp),%esp + 1ea: 5b pop %ebx + 1eb: 5e pop %esi + 1ec: 5f pop %edi + 1ed: 5d pop %ebp + 1ee: c3 ret -00000207 : +000001ef : int stat(const char *n, struct stat *st) { - 207: f3 0f 1e fb endbr32 - 20b: 55 push %ebp - 20c: 89 e5 mov %esp,%ebp - 20e: 56 push %esi - 20f: 53 push %ebx + 1ef: 55 push %ebp + 1f0: 89 e5 mov %esp,%ebp + 1f2: 56 push %esi + 1f3: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 210: 83 ec 08 sub $0x8,%esp - 213: 6a 00 push $0x0 - 215: ff 75 08 pushl 0x8(%ebp) - 218: e8 ea 00 00 00 call 307 + 1f4: 83 ec 08 sub $0x8,%esp + 1f7: 6a 00 push $0x0 + 1f9: ff 75 08 push 0x8(%ebp) + 1fc: e8 e4 00 00 00 call 2e5 if(fd < 0) - 21d: 83 c4 10 add $0x10,%esp - 220: 85 c0 test %eax,%eax - 222: 78 24 js 248 - 224: 89 c3 mov %eax,%ebx + 201: 83 c4 10 add $0x10,%esp + 204: 85 c0 test %eax,%eax + 206: 78 24 js 22c + 208: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 226: 83 ec 08 sub $0x8,%esp - 229: ff 75 0c pushl 0xc(%ebp) - 22c: 50 push %eax - 22d: e8 ed 00 00 00 call 31f - 232: 89 c6 mov %eax,%esi + 20a: 83 ec 08 sub $0x8,%esp + 20d: ff 75 0c push 0xc(%ebp) + 210: 50 push %eax + 211: e8 e7 00 00 00 call 2fd + 216: 89 c6 mov %eax,%esi close(fd); - 234: 89 1c 24 mov %ebx,(%esp) - 237: e8 b3 00 00 00 call 2ef + 218: 89 1c 24 mov %ebx,(%esp) + 21b: e8 ad 00 00 00 call 2cd return r; - 23c: 83 c4 10 add $0x10,%esp + 220: 83 c4 10 add $0x10,%esp } - 23f: 89 f0 mov %esi,%eax - 241: 8d 65 f8 lea -0x8(%ebp),%esp - 244: 5b pop %ebx - 245: 5e pop %esi - 246: 5d pop %ebp - 247: c3 ret + 223: 89 f0 mov %esi,%eax + 225: 8d 65 f8 lea -0x8(%ebp),%esp + 228: 5b pop %ebx + 229: 5e pop %esi + 22a: 5d pop %ebp + 22b: c3 ret return -1; - 248: be ff ff ff ff mov $0xffffffff,%esi - 24d: eb f0 jmp 23f + 22c: be ff ff ff ff mov $0xffffffff,%esi + 231: eb f0 jmp 223 -0000024f : +00000233 : int atoi(const char *s) { - 24f: f3 0f 1e fb endbr32 - 253: 55 push %ebp - 254: 89 e5 mov %esp,%ebp - 256: 53 push %ebx - 257: 8b 55 08 mov 0x8(%ebp),%edx + 233: 55 push %ebp + 234: 89 e5 mov %esp,%ebp + 236: 53 push %ebx + 237: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 25a: 0f b6 02 movzbl (%edx),%eax - 25d: 8d 48 d0 lea -0x30(%eax),%ecx - 260: 80 f9 09 cmp $0x9,%cl - 263: 77 22 ja 287 + 23a: 0f b6 02 movzbl (%edx),%eax + 23d: 8d 48 d0 lea -0x30(%eax),%ecx + 240: 80 f9 09 cmp $0x9,%cl + 243: 77 24 ja 269 n = 0; - 265: b9 00 00 00 00 mov $0x0,%ecx + 245: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 26a: 83 c2 01 add $0x1,%edx - 26d: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 270: 0f be c0 movsbl %al,%eax - 273: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 24a: 83 c2 01 add $0x1,%edx + 24d: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 250: 0f be c0 movsbl %al,%eax + 253: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 277: 0f b6 02 movzbl (%edx),%eax - 27a: 8d 58 d0 lea -0x30(%eax),%ebx - 27d: 80 fb 09 cmp $0x9,%bl - 280: 76 e8 jbe 26a + 257: 0f b6 02 movzbl (%edx),%eax + 25a: 8d 58 d0 lea -0x30(%eax),%ebx + 25d: 80 fb 09 cmp $0x9,%bl + 260: 76 e8 jbe 24a return n; } - 282: 89 c8 mov %ecx,%eax - 284: 5b pop %ebx - 285: 5d pop %ebp - 286: c3 ret + 262: 89 c8 mov %ecx,%eax + 264: 8b 5d fc mov -0x4(%ebp),%ebx + 267: c9 leave + 268: c3 ret n = 0; - 287: b9 00 00 00 00 mov $0x0,%ecx + 269: b9 00 00 00 00 mov $0x0,%ecx return n; - 28c: eb f4 jmp 282 + 26e: eb f2 jmp 262 -0000028e : +00000270 : void* memmove(void *vdst, const void *vsrc, int n) { - 28e: f3 0f 1e fb endbr32 - 292: 55 push %ebp - 293: 89 e5 mov %esp,%ebp - 295: 56 push %esi - 296: 53 push %ebx - 297: 8b 75 08 mov 0x8(%ebp),%esi - 29a: 8b 55 0c mov 0xc(%ebp),%edx - 29d: 8b 5d 10 mov 0x10(%ebp),%ebx + 270: 55 push %ebp + 271: 89 e5 mov %esp,%ebp + 273: 56 push %esi + 274: 53 push %ebx + 275: 8b 75 08 mov 0x8(%ebp),%esi + 278: 8b 55 0c mov 0xc(%ebp),%edx + 27b: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 2a0: 85 db test %ebx,%ebx - 2a2: 7e 15 jle 2b9 - 2a4: 01 f3 add %esi,%ebx + 27e: 85 db test %ebx,%ebx + 280: 7e 15 jle 297 + 282: 01 f3 add %esi,%ebx dst = vdst; - 2a6: 89 f0 mov %esi,%eax + 284: 89 f0 mov %esi,%eax *dst++ = *src++; - 2a8: 83 c2 01 add $0x1,%edx - 2ab: 83 c0 01 add $0x1,%eax - 2ae: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 2b2: 88 48 ff mov %cl,-0x1(%eax) + 286: 83 c2 01 add $0x1,%edx + 289: 83 c0 01 add $0x1,%eax + 28c: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 290: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 2b5: 39 c3 cmp %eax,%ebx - 2b7: 75 ef jne 2a8 + 293: 39 c3 cmp %eax,%ebx + 295: 75 ef jne 286 return vdst; } - 2b9: 89 f0 mov %esi,%eax - 2bb: 5b pop %ebx - 2bc: 5e pop %esi - 2bd: 5d pop %ebp - 2be: c3 ret + 297: 89 f0 mov %esi,%eax + 299: 5b pop %ebx + 29a: 5e pop %esi + 29b: 5d pop %ebp + 29c: c3 ret -000002bf : +0000029d : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 2bf: b8 01 00 00 00 mov $0x1,%eax - 2c4: cd 40 int $0x40 - 2c6: c3 ret + 29d: b8 01 00 00 00 mov $0x1,%eax + 2a2: cd 40 int $0x40 + 2a4: c3 ret -000002c7 : +000002a5 : SYSCALL(exit) - 2c7: b8 02 00 00 00 mov $0x2,%eax - 2cc: cd 40 int $0x40 - 2ce: c3 ret + 2a5: b8 02 00 00 00 mov $0x2,%eax + 2aa: cd 40 int $0x40 + 2ac: c3 ret -000002cf : +000002ad : SYSCALL(wait) - 2cf: b8 03 00 00 00 mov $0x3,%eax - 2d4: cd 40 int $0x40 - 2d6: c3 ret + 2ad: b8 03 00 00 00 mov $0x3,%eax + 2b2: cd 40 int $0x40 + 2b4: c3 ret -000002d7 : +000002b5 : SYSCALL(pipe) - 2d7: b8 04 00 00 00 mov $0x4,%eax - 2dc: cd 40 int $0x40 - 2de: c3 ret + 2b5: b8 04 00 00 00 mov $0x4,%eax + 2ba: cd 40 int $0x40 + 2bc: c3 ret -000002df : +000002bd : SYSCALL(read) - 2df: b8 05 00 00 00 mov $0x5,%eax - 2e4: cd 40 int $0x40 - 2e6: c3 ret + 2bd: b8 05 00 00 00 mov $0x5,%eax + 2c2: cd 40 int $0x40 + 2c4: c3 ret -000002e7 : +000002c5 : SYSCALL(write) - 2e7: b8 10 00 00 00 mov $0x10,%eax - 2ec: cd 40 int $0x40 - 2ee: c3 ret + 2c5: b8 10 00 00 00 mov $0x10,%eax + 2ca: cd 40 int $0x40 + 2cc: c3 ret -000002ef : +000002cd : SYSCALL(close) - 2ef: b8 15 00 00 00 mov $0x15,%eax - 2f4: cd 40 int $0x40 - 2f6: c3 ret + 2cd: b8 15 00 00 00 mov $0x15,%eax + 2d2: cd 40 int $0x40 + 2d4: c3 ret -000002f7 : +000002d5 : SYSCALL(kill) - 2f7: b8 06 00 00 00 mov $0x6,%eax - 2fc: cd 40 int $0x40 - 2fe: c3 ret + 2d5: b8 06 00 00 00 mov $0x6,%eax + 2da: cd 40 int $0x40 + 2dc: c3 ret -000002ff : +000002dd : SYSCALL(exec) - 2ff: b8 07 00 00 00 mov $0x7,%eax - 304: cd 40 int $0x40 - 306: c3 ret + 2dd: b8 07 00 00 00 mov $0x7,%eax + 2e2: cd 40 int $0x40 + 2e4: c3 ret -00000307 : +000002e5 : SYSCALL(open) - 307: b8 0f 00 00 00 mov $0xf,%eax - 30c: cd 40 int $0x40 - 30e: c3 ret + 2e5: b8 0f 00 00 00 mov $0xf,%eax + 2ea: cd 40 int $0x40 + 2ec: c3 ret -0000030f : +000002ed : SYSCALL(mknod) - 30f: b8 11 00 00 00 mov $0x11,%eax - 314: cd 40 int $0x40 - 316: c3 ret + 2ed: b8 11 00 00 00 mov $0x11,%eax + 2f2: cd 40 int $0x40 + 2f4: c3 ret -00000317 : +000002f5 : SYSCALL(unlink) - 317: b8 12 00 00 00 mov $0x12,%eax - 31c: cd 40 int $0x40 - 31e: c3 ret + 2f5: b8 12 00 00 00 mov $0x12,%eax + 2fa: cd 40 int $0x40 + 2fc: c3 ret -0000031f : +000002fd : SYSCALL(fstat) - 31f: b8 08 00 00 00 mov $0x8,%eax - 324: cd 40 int $0x40 - 326: c3 ret + 2fd: b8 08 00 00 00 mov $0x8,%eax + 302: cd 40 int $0x40 + 304: c3 ret -00000327 : +00000305 : SYSCALL(link) - 327: b8 13 00 00 00 mov $0x13,%eax - 32c: cd 40 int $0x40 - 32e: c3 ret + 305: b8 13 00 00 00 mov $0x13,%eax + 30a: cd 40 int $0x40 + 30c: c3 ret -0000032f : +0000030d : SYSCALL(mkdir) - 32f: b8 14 00 00 00 mov $0x14,%eax - 334: cd 40 int $0x40 - 336: c3 ret + 30d: b8 14 00 00 00 mov $0x14,%eax + 312: cd 40 int $0x40 + 314: c3 ret -00000337 : +00000315 : SYSCALL(chdir) - 337: b8 09 00 00 00 mov $0x9,%eax - 33c: cd 40 int $0x40 - 33e: c3 ret + 315: b8 09 00 00 00 mov $0x9,%eax + 31a: cd 40 int $0x40 + 31c: c3 ret -0000033f : +0000031d : SYSCALL(dup) - 33f: b8 0a 00 00 00 mov $0xa,%eax - 344: cd 40 int $0x40 - 346: c3 ret + 31d: b8 0a 00 00 00 mov $0xa,%eax + 322: cd 40 int $0x40 + 324: c3 ret -00000347 : +00000325 : SYSCALL(getpid) - 347: b8 0b 00 00 00 mov $0xb,%eax - 34c: cd 40 int $0x40 - 34e: c3 ret + 325: b8 0b 00 00 00 mov $0xb,%eax + 32a: cd 40 int $0x40 + 32c: c3 ret -0000034f : +0000032d : SYSCALL(sbrk) - 34f: b8 0c 00 00 00 mov $0xc,%eax - 354: cd 40 int $0x40 - 356: c3 ret + 32d: b8 0c 00 00 00 mov $0xc,%eax + 332: cd 40 int $0x40 + 334: c3 ret -00000357 : +00000335 : SYSCALL(sleep) - 357: b8 0d 00 00 00 mov $0xd,%eax - 35c: cd 40 int $0x40 - 35e: c3 ret + 335: b8 0d 00 00 00 mov $0xd,%eax + 33a: cd 40 int $0x40 + 33c: c3 ret -0000035f : +0000033d : SYSCALL(uptime) - 35f: b8 0e 00 00 00 mov $0xe,%eax - 364: cd 40 int $0x40 - 366: c3 ret + 33d: b8 0e 00 00 00 mov $0xe,%eax + 342: cd 40 int $0x40 + 344: c3 ret -00000367 : +00000345 : SYSCALL(slabtest) - 367: b8 16 00 00 00 mov $0x16,%eax - 36c: cd 40 int $0x40 - 36e: c3 ret + 345: b8 16 00 00 00 mov $0x16,%eax + 34a: cd 40 int $0x40 + 34c: c3 ret -0000036f : +0000034d : SYSCALL(ps) - 36f: b8 17 00 00 00 mov $0x17,%eax - 374: cd 40 int $0x40 - 376: c3 ret + 34d: b8 17 00 00 00 mov $0x17,%eax + 352: cd 40 int $0x40 + 354: c3 ret -00000377 : +00000355 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 377: 55 push %ebp - 378: 89 e5 mov %esp,%ebp - 37a: 57 push %edi - 37b: 56 push %esi - 37c: 53 push %ebx - 37d: 83 ec 3c sub $0x3c,%esp - 380: 89 45 c4 mov %eax,-0x3c(%ebp) - 383: 89 d3 mov %edx,%ebx + 355: 55 push %ebp + 356: 89 e5 mov %esp,%ebp + 358: 57 push %edi + 359: 56 push %esi + 35a: 53 push %ebx + 35b: 83 ec 3c sub $0x3c,%esp + 35e: 89 45 c4 mov %eax,-0x3c(%ebp) + 361: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 385: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 389: 74 77 je 402 - 38b: 85 d2 test %edx,%edx - 38d: 79 73 jns 402 + 363: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 367: 74 79 je 3e2 + 369: 85 d2 test %edx,%edx + 36b: 79 75 jns 3e2 neg = 1; x = -xx; - 38f: f7 db neg %ebx + 36d: 89 d1 mov %edx,%ecx + 36f: f7 d9 neg %ecx neg = 1; - 391: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 371: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 398: be 00 00 00 00 mov $0x0,%esi + 378: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 39d: 89 f7 mov %esi,%edi - 39f: 83 c6 01 add $0x1,%esi - 3a2: 89 d8 mov %ebx,%eax - 3a4: ba 00 00 00 00 mov $0x0,%edx - 3a9: f7 f1 div %ecx - 3ab: 0f b6 92 7c 07 00 00 movzbl 0x77c(%edx),%edx - 3b2: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 37d: 89 df mov %ebx,%edi + 37f: 83 c3 01 add $0x1,%ebx + 382: 89 c8 mov %ecx,%eax + 384: ba 00 00 00 00 mov $0x0,%edx + 389: f7 f6 div %esi + 38b: 0f b6 92 94 07 00 00 movzbl 0x794(%edx),%edx + 392: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 3b6: 89 da mov %ebx,%edx - 3b8: 89 c3 mov %eax,%ebx - 3ba: 39 d1 cmp %edx,%ecx - 3bc: 76 df jbe 39d + 396: 89 ca mov %ecx,%edx + 398: 89 c1 mov %eax,%ecx + 39a: 39 d6 cmp %edx,%esi + 39c: 76 df jbe 37d if(neg) - 3be: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 3c2: 74 08 je 3cc + 39e: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 3a2: 74 08 je 3ac buf[i++] = '-'; - 3c4: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 3c9: 8d 77 02 lea 0x2(%edi),%esi + 3a4: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 3a9: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 3cc: 85 f6 test %esi,%esi - 3ce: 7e 2a jle 3fa - 3d0: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 3d4: 8d 7d d8 lea -0x28(%ebp),%edi + 3ac: 85 db test %ebx,%ebx + 3ae: 7e 2a jle 3da + 3b0: 8d 7d d8 lea -0x28(%ebp),%edi + 3b3: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 3d7: 8d 75 d7 lea -0x29(%ebp),%esi + 3b7: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 3da: 0f b6 03 movzbl (%ebx),%eax - 3dd: 88 45 d7 mov %al,-0x29(%ebp) + 3ba: 0f b6 03 movzbl (%ebx),%eax + 3bd: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 3e0: 83 ec 04 sub $0x4,%esp - 3e3: 6a 01 push $0x1 - 3e5: 56 push %esi - 3e6: ff 75 c4 pushl -0x3c(%ebp) - 3e9: e8 f9 fe ff ff call 2e7 + 3c0: 83 ec 04 sub $0x4,%esp + 3c3: 6a 01 push $0x1 + 3c5: 56 push %esi + 3c6: ff 75 c4 push -0x3c(%ebp) + 3c9: e8 f7 fe ff ff call 2c5 while(--i >= 0) - 3ee: 89 d8 mov %ebx,%eax - 3f0: 83 eb 01 sub $0x1,%ebx - 3f3: 83 c4 10 add $0x10,%esp - 3f6: 39 f8 cmp %edi,%eax - 3f8: 75 e0 jne 3da + 3ce: 89 d8 mov %ebx,%eax + 3d0: 83 eb 01 sub $0x1,%ebx + 3d3: 83 c4 10 add $0x10,%esp + 3d6: 39 f8 cmp %edi,%eax + 3d8: 75 e0 jne 3ba } - 3fa: 8d 65 f4 lea -0xc(%ebp),%esp - 3fd: 5b pop %ebx - 3fe: 5e pop %esi - 3ff: 5f pop %edi - 400: 5d pop %ebp - 401: c3 ret + 3da: 8d 65 f4 lea -0xc(%ebp),%esp + 3dd: 5b pop %ebx + 3de: 5e pop %esi + 3df: 5f pop %edi + 3e0: 5d pop %ebp + 3e1: c3 ret + x = xx; + 3e2: 89 d1 mov %edx,%ecx neg = 0; - 402: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 409: eb 8d jmp 398 + 3e4: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 3eb: eb 8b jmp 378 -0000040b : +000003ed : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 40b: f3 0f 1e fb endbr32 - 40f: 55 push %ebp - 410: 89 e5 mov %esp,%ebp - 412: 57 push %edi - 413: 56 push %esi - 414: 53 push %ebx - 415: 83 ec 2c sub $0x2c,%esp + 3ed: 55 push %ebp + 3ee: 89 e5 mov %esp,%ebp + 3f0: 57 push %edi + 3f1: 56 push %esi + 3f2: 53 push %ebx + 3f3: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 418: 8b 75 0c mov 0xc(%ebp),%esi - 41b: 0f b6 1e movzbl (%esi),%ebx - 41e: 84 db test %bl,%bl - 420: 0f 84 ab 01 00 00 je 5d1 - 426: 83 c6 01 add $0x1,%esi + 3f6: 8b 75 0c mov 0xc(%ebp),%esi + 3f9: 0f b6 1e movzbl (%esi),%ebx + 3fc: 84 db test %bl,%bl + 3fe: 0f 84 9f 01 00 00 je 5a3 + 404: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 429: 8d 45 10 lea 0x10(%ebp),%eax - 42c: 89 45 d4 mov %eax,-0x2c(%ebp) + 407: 8d 45 10 lea 0x10(%ebp),%eax + 40a: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 42f: bf 00 00 00 00 mov $0x0,%edi - 434: eb 2d jmp 463 + 40d: bf 00 00 00 00 mov $0x0,%edi + 412: eb 2d jmp 441 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 436: 88 5d e7 mov %bl,-0x19(%ebp) + 414: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 439: 83 ec 04 sub $0x4,%esp - 43c: 6a 01 push $0x1 - 43e: 8d 45 e7 lea -0x19(%ebp),%eax - 441: 50 push %eax - 442: ff 75 08 pushl 0x8(%ebp) - 445: e8 9d fe ff ff call 2e7 + 417: 83 ec 04 sub $0x4,%esp + 41a: 6a 01 push $0x1 + 41c: 8d 45 e7 lea -0x19(%ebp),%eax + 41f: 50 push %eax + 420: ff 75 08 push 0x8(%ebp) + 423: e8 9d fe ff ff call 2c5 putc(fd, c); - 44a: 83 c4 10 add $0x10,%esp - 44d: eb 05 jmp 454 + 428: 83 c4 10 add $0x10,%esp + 42b: eb 05 jmp 432 } } else if(state == '%'){ - 44f: 83 ff 25 cmp $0x25,%edi - 452: 74 22 je 476 + 42d: 83 ff 25 cmp $0x25,%edi + 430: 74 1f je 451 for(i = 0; fmt[i]; i++){ - 454: 83 c6 01 add $0x1,%esi - 457: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 45b: 84 db test %bl,%bl - 45d: 0f 84 6e 01 00 00 je 5d1 + 432: 83 c6 01 add $0x1,%esi + 435: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 439: 84 db test %bl,%bl + 43b: 0f 84 62 01 00 00 je 5a3 c = fmt[i] & 0xff; - 463: 0f be d3 movsbl %bl,%edx - 466: 0f b6 c3 movzbl %bl,%eax + 441: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 469: 85 ff test %edi,%edi - 46b: 75 e2 jne 44f + 444: 85 ff test %edi,%edi + 446: 75 e5 jne 42d if(c == '%'){ - 46d: 83 f8 25 cmp $0x25,%eax - 470: 75 c4 jne 436 + 448: 83 f8 25 cmp $0x25,%eax + 44b: 75 c7 jne 414 state = '%'; - 472: 89 c7 mov %eax,%edi - 474: eb de jmp 454 + 44d: 89 c7 mov %eax,%edi + 44f: eb e1 jmp 432 if(c == 'd'){ - 476: 83 f8 64 cmp $0x64,%eax - 479: 74 59 je 4d4 + 451: 83 f8 25 cmp $0x25,%eax + 454: 0f 84 f2 00 00 00 je 54c + 45a: 8d 50 9d lea -0x63(%eax),%edx + 45d: 83 fa 15 cmp $0x15,%edx + 460: 0f 87 07 01 00 00 ja 56d + 466: 0f 87 01 01 00 00 ja 56d + 46c: ff 24 95 3c 07 00 00 jmp *0x73c(,%edx,4) printint(fd, *ap, 10, 1); + 473: 83 ec 0c sub $0xc,%esp + 476: 6a 01 push $0x1 + 478: b9 0a 00 00 00 mov $0xa,%ecx + 47d: 8b 7d d4 mov -0x2c(%ebp),%edi + 480: 8b 17 mov (%edi),%edx + 482: 8b 45 08 mov 0x8(%ebp),%eax + 485: e8 cb fe ff ff call 355 ap++; - } else if(c == 'x' || c == 'p'){ - 47b: 81 e2 f7 00 00 00 and $0xf7,%edx - 481: 83 fa 70 cmp $0x70,%edx - 484: 74 7a je 500 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 486: 83 f8 73 cmp $0x73,%eax - 489: 0f 84 9d 00 00 00 je 52c - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 48f: 83 f8 63 cmp $0x63,%eax - 492: 0f 84 ec 00 00 00 je 584 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 498: 83 f8 25 cmp $0x25,%eax - 49b: 0f 84 0f 01 00 00 je 5b0 - putc(fd, c); + 48a: 89 f8 mov %edi,%eax + 48c: 83 c0 04 add $0x4,%eax + 48f: 89 45 d4 mov %eax,-0x2c(%ebp) + 492: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 4a1: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 4a5: 83 ec 04 sub $0x4,%esp - 4a8: 6a 01 push $0x1 - 4aa: 8d 45 e7 lea -0x19(%ebp),%eax - 4ad: 50 push %eax - 4ae: ff 75 08 pushl 0x8(%ebp) - 4b1: e8 31 fe ff ff call 2e7 putc(fd, c); - 4b6: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 4b9: 83 c4 0c add $0xc,%esp - 4bc: 6a 01 push $0x1 - 4be: 8d 45 e7 lea -0x19(%ebp),%eax - 4c1: 50 push %eax - 4c2: ff 75 08 pushl 0x8(%ebp) - 4c5: e8 1d fe ff ff call 2e7 - putc(fd, c); - 4ca: 83 c4 10 add $0x10,%esp } state = 0; - 4cd: bf 00 00 00 00 mov $0x0,%edi - 4d2: eb 80 jmp 454 - printint(fd, *ap, 10, 1); - 4d4: 83 ec 0c sub $0xc,%esp - 4d7: 6a 01 push $0x1 - 4d9: b9 0a 00 00 00 mov $0xa,%ecx - 4de: 8b 7d d4 mov -0x2c(%ebp),%edi - 4e1: 8b 17 mov (%edi),%edx - 4e3: 8b 45 08 mov 0x8(%ebp),%eax - 4e6: e8 8c fe ff ff call 377 - ap++; - 4eb: 89 f8 mov %edi,%eax - 4ed: 83 c0 04 add $0x4,%eax - 4f0: 89 45 d4 mov %eax,-0x2c(%ebp) - 4f3: 83 c4 10 add $0x10,%esp - state = 0; - 4f6: bf 00 00 00 00 mov $0x0,%edi - 4fb: e9 54 ff ff ff jmp 454 + 495: bf 00 00 00 00 mov $0x0,%edi + 49a: eb 96 jmp 432 printint(fd, *ap, 16, 0); - 500: 83 ec 0c sub $0xc,%esp - 503: 6a 00 push $0x0 - 505: b9 10 00 00 00 mov $0x10,%ecx - 50a: 8b 7d d4 mov -0x2c(%ebp),%edi - 50d: 8b 17 mov (%edi),%edx - 50f: 8b 45 08 mov 0x8(%ebp),%eax - 512: e8 60 fe ff ff call 377 + 49c: 83 ec 0c sub $0xc,%esp + 49f: 6a 00 push $0x0 + 4a1: b9 10 00 00 00 mov $0x10,%ecx + 4a6: 8b 7d d4 mov -0x2c(%ebp),%edi + 4a9: 8b 17 mov (%edi),%edx + 4ab: 8b 45 08 mov 0x8(%ebp),%eax + 4ae: e8 a2 fe ff ff call 355 ap++; - 517: 89 f8 mov %edi,%eax - 519: 83 c0 04 add $0x4,%eax - 51c: 89 45 d4 mov %eax,-0x2c(%ebp) - 51f: 83 c4 10 add $0x10,%esp + 4b3: 89 f8 mov %edi,%eax + 4b5: 83 c0 04 add $0x4,%eax + 4b8: 89 45 d4 mov %eax,-0x2c(%ebp) + 4bb: 83 c4 10 add $0x10,%esp state = 0; - 522: bf 00 00 00 00 mov $0x0,%edi - 527: e9 28 ff ff ff jmp 454 + 4be: bf 00 00 00 00 mov $0x0,%edi + 4c3: e9 6a ff ff ff jmp 432 s = (char*)*ap; - 52c: 8b 4d d4 mov -0x2c(%ebp),%ecx - 52f: 8b 01 mov (%ecx),%eax + 4c8: 8b 4d d4 mov -0x2c(%ebp),%ecx + 4cb: 8b 01 mov (%ecx),%eax ap++; - 531: 83 c1 04 add $0x4,%ecx - 534: 89 4d d4 mov %ecx,-0x2c(%ebp) + 4cd: 83 c1 04 add $0x4,%ecx + 4d0: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 537: 85 c0 test %eax,%eax - 539: 74 13 je 54e + 4d3: 85 c0 test %eax,%eax + 4d5: 74 13 je 4ea s = (char*)*ap; - 53b: 89 c3 mov %eax,%ebx + 4d7: 89 c3 mov %eax,%ebx while(*s != 0){ - 53d: 0f b6 00 movzbl (%eax),%eax + 4d9: 0f b6 00 movzbl (%eax),%eax state = 0; - 540: bf 00 00 00 00 mov $0x0,%edi + 4dc: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 545: 84 c0 test %al,%al - 547: 75 0f jne 558 - 549: e9 06 ff ff ff jmp 454 + 4e1: 84 c0 test %al,%al + 4e3: 75 0f jne 4f4 + 4e5: e9 48 ff ff ff jmp 432 s = "(null)"; - 54e: bb 74 07 00 00 mov $0x774,%ebx + 4ea: bb 34 07 00 00 mov $0x734,%ebx while(*s != 0){ - 553: b8 28 00 00 00 mov $0x28,%eax - 558: 8b 7d 08 mov 0x8(%ebp),%edi + 4ef: b8 28 00 00 00 mov $0x28,%eax + 4f4: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 55b: 88 45 e7 mov %al,-0x19(%ebp) + 4f7: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 55e: 83 ec 04 sub $0x4,%esp - 561: 6a 01 push $0x1 - 563: 8d 45 e7 lea -0x19(%ebp),%eax - 566: 50 push %eax - 567: 57 push %edi - 568: e8 7a fd ff ff call 2e7 + 4fa: 83 ec 04 sub $0x4,%esp + 4fd: 6a 01 push $0x1 + 4ff: 8d 45 e7 lea -0x19(%ebp),%eax + 502: 50 push %eax + 503: 57 push %edi + 504: e8 bc fd ff ff call 2c5 s++; - 56d: 83 c3 01 add $0x1,%ebx + 509: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 570: 0f b6 03 movzbl (%ebx),%eax - 573: 83 c4 10 add $0x10,%esp - 576: 84 c0 test %al,%al - 578: 75 e1 jne 55b + 50c: 0f b6 03 movzbl (%ebx),%eax + 50f: 83 c4 10 add $0x10,%esp + 512: 84 c0 test %al,%al + 514: 75 e1 jne 4f7 state = 0; - 57a: bf 00 00 00 00 mov $0x0,%edi - 57f: e9 d0 fe ff ff jmp 454 + 516: bf 00 00 00 00 mov $0x0,%edi + 51b: e9 12 ff ff ff jmp 432 putc(fd, *ap); - 584: 8b 7d d4 mov -0x2c(%ebp),%edi - 587: 8b 07 mov (%edi),%eax - 589: 88 45 e7 mov %al,-0x19(%ebp) + 520: 8b 7d d4 mov -0x2c(%ebp),%edi + 523: 8b 07 mov (%edi),%eax + 525: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 58c: 83 ec 04 sub $0x4,%esp - 58f: 6a 01 push $0x1 - 591: 8d 45 e7 lea -0x19(%ebp),%eax - 594: 50 push %eax - 595: ff 75 08 pushl 0x8(%ebp) - 598: e8 4a fd ff ff call 2e7 + 528: 83 ec 04 sub $0x4,%esp + 52b: 6a 01 push $0x1 + 52d: 8d 45 e7 lea -0x19(%ebp),%eax + 530: 50 push %eax + 531: ff 75 08 push 0x8(%ebp) + 534: e8 8c fd ff ff call 2c5 ap++; - 59d: 83 c7 04 add $0x4,%edi - 5a0: 89 7d d4 mov %edi,-0x2c(%ebp) - 5a3: 83 c4 10 add $0x10,%esp + 539: 83 c7 04 add $0x4,%edi + 53c: 89 7d d4 mov %edi,-0x2c(%ebp) + 53f: 83 c4 10 add $0x10,%esp state = 0; - 5a6: bf 00 00 00 00 mov $0x0,%edi - 5ab: e9 a4 fe ff ff jmp 454 + 542: bf 00 00 00 00 mov $0x0,%edi + 547: e9 e6 fe ff ff jmp 432 putc(fd, c); - 5b0: 88 5d e7 mov %bl,-0x19(%ebp) + 54c: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 5b3: 83 ec 04 sub $0x4,%esp - 5b6: 6a 01 push $0x1 - 5b8: 8d 45 e7 lea -0x19(%ebp),%eax - 5bb: 50 push %eax - 5bc: ff 75 08 pushl 0x8(%ebp) - 5bf: e8 23 fd ff ff call 2e7 - 5c4: 83 c4 10 add $0x10,%esp + 54f: 83 ec 04 sub $0x4,%esp + 552: 6a 01 push $0x1 + 554: 8d 45 e7 lea -0x19(%ebp),%eax + 557: 50 push %eax + 558: ff 75 08 push 0x8(%ebp) + 55b: e8 65 fd ff ff call 2c5 + 560: 83 c4 10 add $0x10,%esp + state = 0; + 563: bf 00 00 00 00 mov $0x0,%edi + 568: e9 c5 fe ff ff jmp 432 + putc(fd, '%'); + 56d: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 571: 83 ec 04 sub $0x4,%esp + 574: 6a 01 push $0x1 + 576: 8d 45 e7 lea -0x19(%ebp),%eax + 579: 50 push %eax + 57a: ff 75 08 push 0x8(%ebp) + 57d: e8 43 fd ff ff call 2c5 + putc(fd, c); + 582: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 585: 83 c4 0c add $0xc,%esp + 588: 6a 01 push $0x1 + 58a: 8d 45 e7 lea -0x19(%ebp),%eax + 58d: 50 push %eax + 58e: ff 75 08 push 0x8(%ebp) + 591: e8 2f fd ff ff call 2c5 + putc(fd, c); + 596: 83 c4 10 add $0x10,%esp state = 0; - 5c7: bf 00 00 00 00 mov $0x0,%edi - 5cc: e9 83 fe ff ff jmp 454 + 599: bf 00 00 00 00 mov $0x0,%edi + 59e: e9 8f fe ff ff jmp 432 } } } - 5d1: 8d 65 f4 lea -0xc(%ebp),%esp - 5d4: 5b pop %ebx - 5d5: 5e pop %esi - 5d6: 5f pop %edi - 5d7: 5d pop %ebp - 5d8: c3 ret - -000005d9 : + 5a3: 8d 65 f4 lea -0xc(%ebp),%esp + 5a6: 5b pop %ebx + 5a7: 5e pop %esi + 5a8: 5f pop %edi + 5a9: 5d pop %ebp + 5aa: c3 ret + +000005ab : static Header base; static Header *freep; void free(void *ap) { - 5d9: f3 0f 1e fb endbr32 - 5dd: 55 push %ebp - 5de: 89 e5 mov %esp,%ebp - 5e0: 57 push %edi - 5e1: 56 push %esi - 5e2: 53 push %ebx - 5e3: 8b 5d 08 mov 0x8(%ebp),%ebx + 5ab: 55 push %ebp + 5ac: 89 e5 mov %esp,%ebp + 5ae: 57 push %edi + 5af: 56 push %esi + 5b0: 53 push %ebx + 5b1: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 5e6: 8d 4b f8 lea -0x8(%ebx),%ecx + 5b4: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 5e9: a1 f0 09 00 00 mov 0x9f0,%eax - 5ee: eb 0c jmp 5fc + 5b7: a1 08 0a 00 00 mov 0xa08,%eax + 5bc: eb 0c jmp 5ca if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 5f0: 8b 10 mov (%eax),%edx - 5f2: 39 c2 cmp %eax,%edx - 5f4: 77 04 ja 5fa - 5f6: 39 ca cmp %ecx,%edx - 5f8: 77 10 ja 60a + 5be: 8b 10 mov (%eax),%edx + 5c0: 39 c2 cmp %eax,%edx + 5c2: 77 04 ja 5c8 + 5c4: 39 ca cmp %ecx,%edx + 5c6: 77 10 ja 5d8 { - 5fa: 89 d0 mov %edx,%eax + 5c8: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 5fc: 39 c8 cmp %ecx,%eax - 5fe: 73 f0 jae 5f0 - 600: 8b 10 mov (%eax),%edx - 602: 39 ca cmp %ecx,%edx - 604: 77 04 ja 60a + 5ca: 39 c8 cmp %ecx,%eax + 5cc: 73 f0 jae 5be + 5ce: 8b 10 mov (%eax),%edx + 5d0: 39 ca cmp %ecx,%edx + 5d2: 77 04 ja 5d8 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 606: 39 c2 cmp %eax,%edx - 608: 77 f0 ja 5fa + 5d4: 39 c2 cmp %eax,%edx + 5d6: 77 f0 ja 5c8 break; if(bp + bp->s.size == p->s.ptr){ - 60a: 8b 73 fc mov -0x4(%ebx),%esi - 60d: 8b 10 mov (%eax),%edx - 60f: 8d 3c f1 lea (%ecx,%esi,8),%edi - 612: 39 fa cmp %edi,%edx - 614: 74 19 je 62f + 5d8: 8b 73 fc mov -0x4(%ebx),%esi + 5db: 8b 10 mov (%eax),%edx + 5dd: 8d 3c f1 lea (%ecx,%esi,8),%edi + 5e0: 39 fa cmp %edi,%edx + 5e2: 74 19 je 5fd bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 5e4: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 616: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 619: 8b 50 04 mov 0x4(%eax),%edx - 61c: 8d 34 d0 lea (%eax,%edx,8),%esi - 61f: 39 f1 cmp %esi,%ecx - 621: 74 1b je 63e + 5e7: 8b 50 04 mov 0x4(%eax),%edx + 5ea: 8d 34 d0 lea (%eax,%edx,8),%esi + 5ed: 39 f1 cmp %esi,%ecx + 5ef: 74 18 je 609 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 5f1: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 623: 89 08 mov %ecx,(%eax) freep = p; - 625: a3 f0 09 00 00 mov %eax,0x9f0 + 5f3: a3 08 0a 00 00 mov %eax,0xa08 } - 62a: 5b pop %ebx - 62b: 5e pop %esi - 62c: 5f pop %edi - 62d: 5d pop %ebp - 62e: c3 ret + 5f8: 5b pop %ebx + 5f9: 5e pop %esi + 5fa: 5f pop %edi + 5fb: 5d pop %ebp + 5fc: c3 ret bp->s.size += p->s.ptr->s.size; - 62f: 03 72 04 add 0x4(%edx),%esi - 632: 89 73 fc mov %esi,-0x4(%ebx) + 5fd: 03 72 04 add 0x4(%edx),%esi + 600: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 635: 8b 10 mov (%eax),%edx - 637: 8b 12 mov (%edx),%edx - 639: 89 53 f8 mov %edx,-0x8(%ebx) - 63c: eb db jmp 619 + 603: 8b 10 mov (%eax),%edx + 605: 8b 12 mov (%edx),%edx + 607: eb db jmp 5e4 p->s.size += bp->s.size; - 63e: 03 53 fc add -0x4(%ebx),%edx - 641: 89 50 04 mov %edx,0x4(%eax) + 609: 03 53 fc add -0x4(%ebx),%edx + 60c: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 644: 8b 53 f8 mov -0x8(%ebx),%edx - 647: 89 10 mov %edx,(%eax) - 649: eb da jmp 625 + 60f: 8b 4b f8 mov -0x8(%ebx),%ecx + 612: eb dd jmp 5f1 -0000064b : +00000614 : return freep; } void* malloc(uint nbytes) { - 64b: f3 0f 1e fb endbr32 - 64f: 55 push %ebp - 650: 89 e5 mov %esp,%ebp - 652: 57 push %edi - 653: 56 push %esi - 654: 53 push %ebx - 655: 83 ec 0c sub $0xc,%esp + 614: 55 push %ebp + 615: 89 e5 mov %esp,%ebp + 617: 57 push %edi + 618: 56 push %esi + 619: 53 push %ebx + 61a: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 658: 8b 45 08 mov 0x8(%ebp),%eax - 65b: 8d 58 07 lea 0x7(%eax),%ebx - 65e: c1 eb 03 shr $0x3,%ebx - 661: 83 c3 01 add $0x1,%ebx + 61d: 8b 45 08 mov 0x8(%ebp),%eax + 620: 8d 58 07 lea 0x7(%eax),%ebx + 623: c1 eb 03 shr $0x3,%ebx + 626: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 664: 8b 15 f0 09 00 00 mov 0x9f0,%edx - 66a: 85 d2 test %edx,%edx - 66c: 74 20 je 68e + 629: 8b 15 08 0a 00 00 mov 0xa08,%edx + 62f: 85 d2 test %edx,%edx + 631: 74 1c je 64f base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 66e: 8b 02 mov (%edx),%eax + 633: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 670: 8b 48 04 mov 0x4(%eax),%ecx - 673: 39 cb cmp %ecx,%ebx - 675: 76 3c jbe 6b3 - 677: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 67d: be 00 10 00 00 mov $0x1000,%esi - 682: 0f 43 f3 cmovae %ebx,%esi + 635: 8b 48 04 mov 0x4(%eax),%ecx + 638: 39 cb cmp %ecx,%ebx + 63a: 76 38 jbe 674 + 63c: be 00 10 00 00 mov $0x1000,%esi + 641: 39 f3 cmp %esi,%ebx + 643: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 685: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 68c: eb 72 jmp 700 + 646: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 64d: eb 72 jmp 6c1 base.s.ptr = freep = prevp = &base; - 68e: c7 05 f0 09 00 00 f4 movl $0x9f4,0x9f0 - 695: 09 00 00 - 698: c7 05 f4 09 00 00 f4 movl $0x9f4,0x9f4 - 69f: 09 00 00 + 64f: c7 05 08 0a 00 00 0c movl $0xa0c,0xa08 + 656: 0a 00 00 + 659: c7 05 0c 0a 00 00 0c movl $0xa0c,0xa0c + 660: 0a 00 00 base.s.size = 0; - 6a2: c7 05 f8 09 00 00 00 movl $0x0,0x9f8 - 6a9: 00 00 00 + 663: c7 05 10 0a 00 00 00 movl $0x0,0xa10 + 66a: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6ac: b8 f4 09 00 00 mov $0x9f4,%eax - 6b1: eb c4 jmp 677 + 66d: b8 0c 0a 00 00 mov $0xa0c,%eax + 672: eb c8 jmp 63c if(p->s.size == nunits) - 6b3: 39 cb cmp %ecx,%ebx - 6b5: 74 1e je 6d5 + 674: 39 cb cmp %ecx,%ebx + 676: 74 1e je 696 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 6b7: 29 d9 sub %ebx,%ecx - 6b9: 89 48 04 mov %ecx,0x4(%eax) + 678: 29 d9 sub %ebx,%ecx + 67a: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 6bc: 8d 04 c8 lea (%eax,%ecx,8),%eax + 67d: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 6bf: 89 58 04 mov %ebx,0x4(%eax) + 680: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 6c2: 89 15 f0 09 00 00 mov %edx,0x9f0 + 683: 89 15 08 0a 00 00 mov %edx,0xa08 return (void*)(p + 1); - 6c8: 8d 50 08 lea 0x8(%eax),%edx + 689: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 6cb: 89 d0 mov %edx,%eax - 6cd: 8d 65 f4 lea -0xc(%ebp),%esp - 6d0: 5b pop %ebx - 6d1: 5e pop %esi - 6d2: 5f pop %edi - 6d3: 5d pop %ebp - 6d4: c3 ret + 68c: 89 d0 mov %edx,%eax + 68e: 8d 65 f4 lea -0xc(%ebp),%esp + 691: 5b pop %ebx + 692: 5e pop %esi + 693: 5f pop %edi + 694: 5d pop %ebp + 695: c3 ret prevp->s.ptr = p->s.ptr; - 6d5: 8b 08 mov (%eax),%ecx - 6d7: 89 0a mov %ecx,(%edx) - 6d9: eb e7 jmp 6c2 + 696: 8b 08 mov (%eax),%ecx + 698: 89 0a mov %ecx,(%edx) + 69a: eb e7 jmp 683 hp->s.size = nu; - 6db: 89 70 04 mov %esi,0x4(%eax) + 69c: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 6de: 83 ec 0c sub $0xc,%esp - 6e1: 83 c0 08 add $0x8,%eax - 6e4: 50 push %eax - 6e5: e8 ef fe ff ff call 5d9 + 69f: 83 ec 0c sub $0xc,%esp + 6a2: 83 c0 08 add $0x8,%eax + 6a5: 50 push %eax + 6a6: e8 00 ff ff ff call 5ab return freep; - 6ea: 8b 15 f0 09 00 00 mov 0x9f0,%edx + 6ab: 8b 15 08 0a 00 00 mov 0xa08,%edx if((p = morecore(nunits)) == 0) - 6f0: 83 c4 10 add $0x10,%esp - 6f3: 85 d2 test %edx,%edx - 6f5: 74 d4 je 6cb + 6b1: 83 c4 10 add $0x10,%esp + 6b4: 85 d2 test %edx,%edx + 6b6: 74 d4 je 68c for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6f7: 8b 02 mov (%edx),%eax + 6b8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 6f9: 8b 48 04 mov 0x4(%eax),%ecx - 6fc: 39 d9 cmp %ebx,%ecx - 6fe: 73 b3 jae 6b3 + 6ba: 8b 48 04 mov 0x4(%eax),%ecx + 6bd: 39 d9 cmp %ebx,%ecx + 6bf: 73 b3 jae 674 if(p == freep) - 700: 89 c2 mov %eax,%edx - 702: 39 05 f0 09 00 00 cmp %eax,0x9f0 - 708: 75 ed jne 6f7 + 6c1: 89 c2 mov %eax,%edx + 6c3: 39 05 08 0a 00 00 cmp %eax,0xa08 + 6c9: 75 ed jne 6b8 p = sbrk(nu * sizeof(Header)); - 70a: 83 ec 0c sub $0xc,%esp - 70d: 57 push %edi - 70e: e8 3c fc ff ff call 34f + 6cb: 83 ec 0c sub $0xc,%esp + 6ce: 57 push %edi + 6cf: e8 59 fc ff ff call 32d if(p == (char*)-1) - 713: 83 c4 10 add $0x10,%esp - 716: 83 f8 ff cmp $0xffffffff,%eax - 719: 75 c0 jne 6db + 6d4: 83 c4 10 add $0x10,%esp + 6d7: 83 f8 ff cmp $0xffffffff,%eax + 6da: 75 c0 jne 69c return 0; - 71b: ba 00 00 00 00 mov $0x0,%edx - 720: eb a9 jmp 6cb + 6dc: ba 00 00 00 00 mov $0x0,%edx + 6e1: eb a9 jmp 68c diff --git a/src/user/init.d b/src/user/init.d new file mode 100644 index 0000000..565d86a --- /dev/null +++ b/src/user/init.d @@ -0,0 +1,2 @@ +user/init.o: user/init.c /usr/include/stdc-predef.h types.h stat.h user.h \ + fcntl.h diff --git a/src/user/init.o b/src/user/init.o new file mode 100644 index 0000000..ed94c52 Binary files /dev/null and b/src/user/init.o differ diff --git a/src/user/init.sym b/src/user/init.sym index 1927530..425d691 100644 --- a/src/user/init.sym +++ b/src/user/init.sym @@ -1,61 +1,48 @@ -00000000 .text -00000724 .rodata -00000790 .eh_frame -000009e8 .data -000009f0 .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 -00000377 printint -0000077c digits.1089 +00000355 printint +00000794 digits.0 00000000 umalloc.c -000009f0 freep -000009f4 base -000000e1 strcpy -0000040b printf -000009e8 argv -0000028e memmove -0000030f mknod -0000036f ps -000001ac gets -00000347 getpid -0000064b malloc -00000357 sleep -000002d7 pipe -00000367 slabtest -000002e7 write -0000031f fstat -000002f7 kill -00000337 chdir -000002ff exec -000002cf wait -000002df read -00000317 unlink -000002bf fork -0000034f sbrk -0000035f uptime -000009f0 __bss_start -00000160 memset +00000a08 freep +00000a0c base +000000dd strcpy +000003ed printf +00000a00 argv +00000270 memmove +000002ed mknod +0000034d ps +00000198 gets +00000325 getpid +00000614 malloc +00000335 sleep +000002b5 pipe +00000345 slabtest +000002c5 write +000002fd fstat +000002d5 kill +00000315 chdir +000002dd exec +000002ad wait +000002bd read +000002f5 unlink +0000029d fork +0000032d sbrk +0000033d uptime +00000a08 __bss_start +00000152 memset 00000000 main -00000107 strcmp -0000033f dup -00000207 stat -000009f0 _edata -000009fc _end -00000327 link -000002c7 exit -0000024f atoi -00000136 strlen -00000307 open -0000017b strchr -0000032f mkdir -000002ef close -000005d9 free +00000101 strcmp +0000031d dup +000001ef stat +00000a08 _edata +00000a14 _end +00000305 link +000002a5 exit +00000233 atoi +0000012c strlen +000002e5 open +0000016b strchr +0000030d mkdir +000002cd close +000005ab free diff --git a/src/user/kill.asm b/src/user/kill.asm index 38504a9..1a05a3c 100644 --- a/src/user/kill.asm +++ b/src/user/kill.asm @@ -11,1063 +11,1032 @@ Disassembly of section .text: int main(int argc, char **argv) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 56 push %esi - 12: 53 push %ebx - 13: 51 push %ecx - 14: 83 ec 0c sub $0xc,%esp - 17: 8b 01 mov (%ecx),%eax - 19: 8b 51 04 mov 0x4(%ecx),%edx - int i; + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 57 push %edi + e: 56 push %esi + f: 53 push %ebx + 10: 51 push %ecx + 11: 83 ec 08 sub $0x8,%esp + 14: 8b 31 mov (%ecx),%esi + 16: 8b 79 04 mov 0x4(%ecx),%edi if(argc < 2){ - 1c: 83 f8 01 cmp $0x1,%eax - 1f: 7e 27 jle 48 - 21: 8d 5a 04 lea 0x4(%edx),%ebx - 24: 8d 34 82 lea (%edx,%eax,4),%esi printf(2, "usage: kill pid...\n"); exit(); } for(i=1; i kill(atoi(argv[i])); - 27: 83 ec 0c sub $0xc,%esp - 2a: ff 33 pushl (%ebx) - 2c: e8 99 01 00 00 call 1ca - 31: 89 04 24 mov %eax,(%esp) - 34: e8 39 02 00 00 call 272 + 23: 83 ec 0c sub $0xc,%esp + 26: ff 34 9f push (%edi,%ebx,4) + 29: e8 81 01 00 00 call 1af + 2e: 89 04 24 mov %eax,(%esp) + 31: e8 1b 02 00 00 call 251 for(i=1; i + 36: 83 c3 01 add $0x1,%ebx + 39: 83 c4 10 add $0x10,%esp + 3c: 39 de cmp %ebx,%esi + 3e: 75 e3 jne 23 exit(); - 43: e8 fa 01 00 00 call 242 + 40: e8 dc 01 00 00 call 221 printf(2, "usage: kill pid...\n"); - 48: 83 ec 08 sub $0x8,%esp - 4b: 68 a0 06 00 00 push $0x6a0 - 50: 6a 02 push $0x2 - 52: e8 2f 03 00 00 call 386 + 45: 83 ec 08 sub $0x8,%esp + 48: 68 60 06 00 00 push $0x660 + 4d: 6a 02 push $0x2 + 4f: e8 15 03 00 00 call 369 exit(); - 57: e8 e6 01 00 00 call 242 + 54: e8 c8 01 00 00 call 221 -0000005c : +00000059 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 5c: f3 0f 1e fb endbr32 - 60: 55 push %ebp - 61: 89 e5 mov %esp,%ebp - 63: 53 push %ebx - 64: 8b 4d 08 mov 0x8(%ebp),%ecx - 67: 8b 5d 0c mov 0xc(%ebp),%ebx + 59: 55 push %ebp + 5a: 89 e5 mov %esp,%ebp + 5c: 53 push %ebx + 5d: 8b 4d 08 mov 0x8(%ebp),%ecx + 60: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 6a: b8 00 00 00 00 mov $0x0,%eax - 6f: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 73: 88 14 01 mov %dl,(%ecx,%eax,1) - 76: 83 c0 01 add $0x1,%eax - 79: 84 d2 test %dl,%dl - 7b: 75 f2 jne 6f + 63: b8 00 00 00 00 mov $0x0,%eax + 68: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 6c: 88 14 01 mov %dl,(%ecx,%eax,1) + 6f: 83 c0 01 add $0x1,%eax + 72: 84 d2 test %dl,%dl + 74: 75 f2 jne 68 ; return os; } - 7d: 89 c8 mov %ecx,%eax - 7f: 5b pop %ebx - 80: 5d pop %ebp - 81: c3 ret + 76: 89 c8 mov %ecx,%eax + 78: 8b 5d fc mov -0x4(%ebp),%ebx + 7b: c9 leave + 7c: c3 ret -00000082 : +0000007d : int strcmp(const char *p, const char *q) { - 82: f3 0f 1e fb endbr32 - 86: 55 push %ebp - 87: 89 e5 mov %esp,%ebp - 89: 8b 4d 08 mov 0x8(%ebp),%ecx - 8c: 8b 55 0c mov 0xc(%ebp),%edx + 7d: 55 push %ebp + 7e: 89 e5 mov %esp,%ebp + 80: 8b 4d 08 mov 0x8(%ebp),%ecx + 83: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 8f: 0f b6 01 movzbl (%ecx),%eax - 92: 84 c0 test %al,%al - 94: 74 11 je a7 - 96: 38 02 cmp %al,(%edx) - 98: 75 0d jne a7 + 86: 0f b6 01 movzbl (%ecx),%eax + 89: 84 c0 test %al,%al + 8b: 74 11 je 9e + 8d: 38 02 cmp %al,(%edx) + 8f: 75 0d jne 9e p++, q++; - 9a: 83 c1 01 add $0x1,%ecx - 9d: 83 c2 01 add $0x1,%edx + 91: 83 c1 01 add $0x1,%ecx + 94: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - a0: 0f b6 01 movzbl (%ecx),%eax - a3: 84 c0 test %al,%al - a5: 75 ef jne 96 + 97: 0f b6 01 movzbl (%ecx),%eax + 9a: 84 c0 test %al,%al + 9c: 75 ef jne 8d return (uchar)*p - (uchar)*q; - a7: 0f b6 c0 movzbl %al,%eax - aa: 0f b6 12 movzbl (%edx),%edx - ad: 29 d0 sub %edx,%eax + 9e: 0f b6 c0 movzbl %al,%eax + a1: 0f b6 12 movzbl (%edx),%edx + a4: 29 d0 sub %edx,%eax } - af: 5d pop %ebp - b0: c3 ret + a6: 5d pop %ebp + a7: c3 ret -000000b1 : +000000a8 : uint strlen(const char *s) { - b1: f3 0f 1e fb endbr32 - b5: 55 push %ebp - b6: 89 e5 mov %esp,%ebp - b8: 8b 55 08 mov 0x8(%ebp),%edx + a8: 55 push %ebp + a9: 89 e5 mov %esp,%ebp + ab: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - bb: 80 3a 00 cmpb $0x0,(%edx) - be: 74 14 je d4 - c0: b8 00 00 00 00 mov $0x0,%eax - c5: 83 c0 01 add $0x1,%eax - c8: 89 c1 mov %eax,%ecx - ca: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - ce: 75 f5 jne c5 + ae: 80 3a 00 cmpb $0x0,(%edx) + b1: 74 14 je c7 + b3: b8 00 00 00 00 mov $0x0,%eax + b8: 83 c0 01 add $0x1,%eax + bb: 89 c1 mov %eax,%ecx + bd: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + c1: 75 f5 jne b8 ; return n; } - d0: 89 c8 mov %ecx,%eax - d2: 5d pop %ebp - d3: c3 ret + c3: 89 c8 mov %ecx,%eax + c5: 5d pop %ebp + c6: c3 ret for(n = 0; s[n]; n++) - d4: b9 00 00 00 00 mov $0x0,%ecx + c7: b9 00 00 00 00 mov $0x0,%ecx return n; - d9: eb f5 jmp d0 + cc: eb f5 jmp c3 -000000db : +000000ce : void* memset(void *dst, int c, uint n) { - db: f3 0f 1e fb endbr32 - df: 55 push %ebp - e0: 89 e5 mov %esp,%ebp - e2: 57 push %edi - e3: 8b 55 08 mov 0x8(%ebp),%edx + ce: 55 push %ebp + cf: 89 e5 mov %esp,%ebp + d1: 57 push %edi + d2: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - e6: 89 d7 mov %edx,%edi - e8: 8b 4d 10 mov 0x10(%ebp),%ecx - eb: 8b 45 0c mov 0xc(%ebp),%eax - ee: fc cld - ef: f3 aa rep stos %al,%es:(%edi) + d5: 89 d7 mov %edx,%edi + d7: 8b 4d 10 mov 0x10(%ebp),%ecx + da: 8b 45 0c mov 0xc(%ebp),%eax + dd: fc cld + de: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - f1: 89 d0 mov %edx,%eax - f3: 5f pop %edi - f4: 5d pop %ebp - f5: c3 ret + e0: 89 d0 mov %edx,%eax + e2: 8b 7d fc mov -0x4(%ebp),%edi + e5: c9 leave + e6: c3 ret -000000f6 : +000000e7 : char* strchr(const char *s, char c) { - f6: f3 0f 1e fb endbr32 - fa: 55 push %ebp - fb: 89 e5 mov %esp,%ebp - fd: 8b 45 08 mov 0x8(%ebp),%eax - 100: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + e7: 55 push %ebp + e8: 89 e5 mov %esp,%ebp + ea: 8b 45 08 mov 0x8(%ebp),%eax + ed: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 104: 0f b6 10 movzbl (%eax),%edx - 107: 84 d2 test %dl,%dl - 109: 74 15 je 120 + f1: 0f b6 10 movzbl (%eax),%edx + f4: 84 d2 test %dl,%dl + f6: 74 15 je 10d if(*s == c) - 10b: 38 d1 cmp %dl,%cl - 10d: 74 0f je 11e + f8: 38 d1 cmp %dl,%cl + fa: 74 0f je 10b for(; *s; s++) - 10f: 83 c0 01 add $0x1,%eax - 112: 0f b6 10 movzbl (%eax),%edx - 115: 84 d2 test %dl,%dl - 117: 75 f2 jne 10b + fc: 83 c0 01 add $0x1,%eax + ff: 0f b6 10 movzbl (%eax),%edx + 102: 84 d2 test %dl,%dl + 104: 75 f2 jne f8 return (char*)s; return 0; - 119: b8 00 00 00 00 mov $0x0,%eax + 106: b8 00 00 00 00 mov $0x0,%eax } - 11e: 5d pop %ebp - 11f: c3 ret + 10b: 5d pop %ebp + 10c: c3 ret return 0; - 120: b8 00 00 00 00 mov $0x0,%eax - 125: eb f7 jmp 11e + 10d: b8 00 00 00 00 mov $0x0,%eax + 112: eb f7 jmp 10b -00000127 : +00000114 : char* gets(char *buf, int max) { - 127: f3 0f 1e fb endbr32 - 12b: 55 push %ebp - 12c: 89 e5 mov %esp,%ebp - 12e: 57 push %edi - 12f: 56 push %esi - 130: 53 push %ebx - 131: 83 ec 2c sub $0x2c,%esp - 134: 8b 75 08 mov 0x8(%ebp),%esi + 114: 55 push %ebp + 115: 89 e5 mov %esp,%ebp + 117: 57 push %edi + 118: 56 push %esi + 119: 53 push %ebx + 11a: 83 ec 2c sub $0x2c,%esp + 11d: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 137: bb 00 00 00 00 mov $0x0,%ebx + 120: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 13c: 8d 7d e7 lea -0x19(%ebp),%edi + 125: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 13f: 89 5d d4 mov %ebx,-0x2c(%ebp) - 142: 83 c3 01 add $0x1,%ebx - 145: 3b 5d 0c cmp 0xc(%ebp),%ebx - 148: 7d 27 jge 171 + 128: 89 5d d4 mov %ebx,-0x2c(%ebp) + 12b: 83 c3 01 add $0x1,%ebx + 12e: 3b 5d 0c cmp 0xc(%ebp),%ebx + 131: 7d 27 jge 15a cc = read(0, &c, 1); - 14a: 83 ec 04 sub $0x4,%esp - 14d: 6a 01 push $0x1 - 14f: 57 push %edi - 150: 6a 00 push $0x0 - 152: e8 03 01 00 00 call 25a + 133: 83 ec 04 sub $0x4,%esp + 136: 6a 01 push $0x1 + 138: 57 push %edi + 139: 6a 00 push $0x0 + 13b: e8 f9 00 00 00 call 239 if(cc < 1) - 157: 83 c4 10 add $0x10,%esp - 15a: 85 c0 test %eax,%eax - 15c: 7e 13 jle 171 + 140: 83 c4 10 add $0x10,%esp + 143: 85 c0 test %eax,%eax + 145: 7e 13 jle 15a break; buf[i++] = c; - 15e: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 162: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 147: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 14b: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 166: 3c 0a cmp $0xa,%al - 168: 74 04 je 16e - 16a: 3c 0d cmp $0xd,%al - 16c: 75 d1 jne 13f + 14f: 3c 0a cmp $0xa,%al + 151: 74 04 je 157 + 153: 3c 0d cmp $0xd,%al + 155: 75 d1 jne 128 for(i=0; i+1 < max; ){ - 16e: 89 5d d4 mov %ebx,-0x2c(%ebp) + 157: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 171: 8b 45 d4 mov -0x2c(%ebp),%eax - 174: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 15a: 8b 45 d4 mov -0x2c(%ebp),%eax + 15d: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 178: 89 f0 mov %esi,%eax - 17a: 8d 65 f4 lea -0xc(%ebp),%esp - 17d: 5b pop %ebx - 17e: 5e pop %esi - 17f: 5f pop %edi - 180: 5d pop %ebp - 181: c3 ret + 161: 89 f0 mov %esi,%eax + 163: 8d 65 f4 lea -0xc(%ebp),%esp + 166: 5b pop %ebx + 167: 5e pop %esi + 168: 5f pop %edi + 169: 5d pop %ebp + 16a: c3 ret -00000182 : +0000016b : int stat(const char *n, struct stat *st) { - 182: f3 0f 1e fb endbr32 - 186: 55 push %ebp - 187: 89 e5 mov %esp,%ebp - 189: 56 push %esi - 18a: 53 push %ebx + 16b: 55 push %ebp + 16c: 89 e5 mov %esp,%ebp + 16e: 56 push %esi + 16f: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 18b: 83 ec 08 sub $0x8,%esp - 18e: 6a 00 push $0x0 - 190: ff 75 08 pushl 0x8(%ebp) - 193: e8 ea 00 00 00 call 282 + 170: 83 ec 08 sub $0x8,%esp + 173: 6a 00 push $0x0 + 175: ff 75 08 push 0x8(%ebp) + 178: e8 e4 00 00 00 call 261 if(fd < 0) - 198: 83 c4 10 add $0x10,%esp - 19b: 85 c0 test %eax,%eax - 19d: 78 24 js 1c3 - 19f: 89 c3 mov %eax,%ebx + 17d: 83 c4 10 add $0x10,%esp + 180: 85 c0 test %eax,%eax + 182: 78 24 js 1a8 + 184: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 1a1: 83 ec 08 sub $0x8,%esp - 1a4: ff 75 0c pushl 0xc(%ebp) - 1a7: 50 push %eax - 1a8: e8 ed 00 00 00 call 29a - 1ad: 89 c6 mov %eax,%esi + 186: 83 ec 08 sub $0x8,%esp + 189: ff 75 0c push 0xc(%ebp) + 18c: 50 push %eax + 18d: e8 e7 00 00 00 call 279 + 192: 89 c6 mov %eax,%esi close(fd); - 1af: 89 1c 24 mov %ebx,(%esp) - 1b2: e8 b3 00 00 00 call 26a + 194: 89 1c 24 mov %ebx,(%esp) + 197: e8 ad 00 00 00 call 249 return r; - 1b7: 83 c4 10 add $0x10,%esp + 19c: 83 c4 10 add $0x10,%esp } - 1ba: 89 f0 mov %esi,%eax - 1bc: 8d 65 f8 lea -0x8(%ebp),%esp - 1bf: 5b pop %ebx - 1c0: 5e pop %esi - 1c1: 5d pop %ebp - 1c2: c3 ret + 19f: 89 f0 mov %esi,%eax + 1a1: 8d 65 f8 lea -0x8(%ebp),%esp + 1a4: 5b pop %ebx + 1a5: 5e pop %esi + 1a6: 5d pop %ebp + 1a7: c3 ret return -1; - 1c3: be ff ff ff ff mov $0xffffffff,%esi - 1c8: eb f0 jmp 1ba + 1a8: be ff ff ff ff mov $0xffffffff,%esi + 1ad: eb f0 jmp 19f -000001ca : +000001af : int atoi(const char *s) { - 1ca: f3 0f 1e fb endbr32 - 1ce: 55 push %ebp - 1cf: 89 e5 mov %esp,%ebp - 1d1: 53 push %ebx - 1d2: 8b 55 08 mov 0x8(%ebp),%edx + 1af: 55 push %ebp + 1b0: 89 e5 mov %esp,%ebp + 1b2: 53 push %ebx + 1b3: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1d5: 0f b6 02 movzbl (%edx),%eax - 1d8: 8d 48 d0 lea -0x30(%eax),%ecx - 1db: 80 f9 09 cmp $0x9,%cl - 1de: 77 22 ja 202 + 1b6: 0f b6 02 movzbl (%edx),%eax + 1b9: 8d 48 d0 lea -0x30(%eax),%ecx + 1bc: 80 f9 09 cmp $0x9,%cl + 1bf: 77 24 ja 1e5 n = 0; - 1e0: b9 00 00 00 00 mov $0x0,%ecx + 1c1: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 1e5: 83 c2 01 add $0x1,%edx - 1e8: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 1eb: 0f be c0 movsbl %al,%eax - 1ee: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 1c6: 83 c2 01 add $0x1,%edx + 1c9: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 1cc: 0f be c0 movsbl %al,%eax + 1cf: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 1f2: 0f b6 02 movzbl (%edx),%eax - 1f5: 8d 58 d0 lea -0x30(%eax),%ebx - 1f8: 80 fb 09 cmp $0x9,%bl - 1fb: 76 e8 jbe 1e5 + 1d3: 0f b6 02 movzbl (%edx),%eax + 1d6: 8d 58 d0 lea -0x30(%eax),%ebx + 1d9: 80 fb 09 cmp $0x9,%bl + 1dc: 76 e8 jbe 1c6 return n; } - 1fd: 89 c8 mov %ecx,%eax - 1ff: 5b pop %ebx - 200: 5d pop %ebp - 201: c3 ret + 1de: 89 c8 mov %ecx,%eax + 1e0: 8b 5d fc mov -0x4(%ebp),%ebx + 1e3: c9 leave + 1e4: c3 ret n = 0; - 202: b9 00 00 00 00 mov $0x0,%ecx + 1e5: b9 00 00 00 00 mov $0x0,%ecx return n; - 207: eb f4 jmp 1fd + 1ea: eb f2 jmp 1de -00000209 : +000001ec : void* memmove(void *vdst, const void *vsrc, int n) { - 209: f3 0f 1e fb endbr32 - 20d: 55 push %ebp - 20e: 89 e5 mov %esp,%ebp - 210: 56 push %esi - 211: 53 push %ebx - 212: 8b 75 08 mov 0x8(%ebp),%esi - 215: 8b 55 0c mov 0xc(%ebp),%edx - 218: 8b 5d 10 mov 0x10(%ebp),%ebx + 1ec: 55 push %ebp + 1ed: 89 e5 mov %esp,%ebp + 1ef: 56 push %esi + 1f0: 53 push %ebx + 1f1: 8b 75 08 mov 0x8(%ebp),%esi + 1f4: 8b 55 0c mov 0xc(%ebp),%edx + 1f7: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 21b: 85 db test %ebx,%ebx - 21d: 7e 15 jle 234 - 21f: 01 f3 add %esi,%ebx + 1fa: 85 db test %ebx,%ebx + 1fc: 7e 15 jle 213 + 1fe: 01 f3 add %esi,%ebx dst = vdst; - 221: 89 f0 mov %esi,%eax + 200: 89 f0 mov %esi,%eax *dst++ = *src++; - 223: 83 c2 01 add $0x1,%edx - 226: 83 c0 01 add $0x1,%eax - 229: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 22d: 88 48 ff mov %cl,-0x1(%eax) + 202: 83 c2 01 add $0x1,%edx + 205: 83 c0 01 add $0x1,%eax + 208: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 20c: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 230: 39 c3 cmp %eax,%ebx - 232: 75 ef jne 223 + 20f: 39 c3 cmp %eax,%ebx + 211: 75 ef jne 202 return vdst; } - 234: 89 f0 mov %esi,%eax - 236: 5b pop %ebx - 237: 5e pop %esi - 238: 5d pop %ebp - 239: c3 ret + 213: 89 f0 mov %esi,%eax + 215: 5b pop %ebx + 216: 5e pop %esi + 217: 5d pop %ebp + 218: c3 ret -0000023a : +00000219 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 23a: b8 01 00 00 00 mov $0x1,%eax - 23f: cd 40 int $0x40 - 241: c3 ret + 219: b8 01 00 00 00 mov $0x1,%eax + 21e: cd 40 int $0x40 + 220: c3 ret -00000242 : +00000221 : SYSCALL(exit) - 242: b8 02 00 00 00 mov $0x2,%eax - 247: cd 40 int $0x40 - 249: c3 ret + 221: b8 02 00 00 00 mov $0x2,%eax + 226: cd 40 int $0x40 + 228: c3 ret -0000024a : +00000229 : SYSCALL(wait) - 24a: b8 03 00 00 00 mov $0x3,%eax - 24f: cd 40 int $0x40 - 251: c3 ret + 229: b8 03 00 00 00 mov $0x3,%eax + 22e: cd 40 int $0x40 + 230: c3 ret -00000252 : +00000231 : SYSCALL(pipe) - 252: b8 04 00 00 00 mov $0x4,%eax - 257: cd 40 int $0x40 - 259: c3 ret + 231: b8 04 00 00 00 mov $0x4,%eax + 236: cd 40 int $0x40 + 238: c3 ret -0000025a : +00000239 : SYSCALL(read) - 25a: b8 05 00 00 00 mov $0x5,%eax - 25f: cd 40 int $0x40 - 261: c3 ret + 239: b8 05 00 00 00 mov $0x5,%eax + 23e: cd 40 int $0x40 + 240: c3 ret -00000262 : +00000241 : SYSCALL(write) - 262: b8 10 00 00 00 mov $0x10,%eax - 267: cd 40 int $0x40 - 269: c3 ret + 241: b8 10 00 00 00 mov $0x10,%eax + 246: cd 40 int $0x40 + 248: c3 ret -0000026a : +00000249 : SYSCALL(close) - 26a: b8 15 00 00 00 mov $0x15,%eax - 26f: cd 40 int $0x40 - 271: c3 ret + 249: b8 15 00 00 00 mov $0x15,%eax + 24e: cd 40 int $0x40 + 250: c3 ret -00000272 : +00000251 : SYSCALL(kill) - 272: b8 06 00 00 00 mov $0x6,%eax - 277: cd 40 int $0x40 - 279: c3 ret + 251: b8 06 00 00 00 mov $0x6,%eax + 256: cd 40 int $0x40 + 258: c3 ret -0000027a : +00000259 : SYSCALL(exec) - 27a: b8 07 00 00 00 mov $0x7,%eax - 27f: cd 40 int $0x40 - 281: c3 ret + 259: b8 07 00 00 00 mov $0x7,%eax + 25e: cd 40 int $0x40 + 260: c3 ret -00000282 : +00000261 : SYSCALL(open) - 282: b8 0f 00 00 00 mov $0xf,%eax - 287: cd 40 int $0x40 - 289: c3 ret + 261: b8 0f 00 00 00 mov $0xf,%eax + 266: cd 40 int $0x40 + 268: c3 ret -0000028a : +00000269 : SYSCALL(mknod) - 28a: b8 11 00 00 00 mov $0x11,%eax - 28f: cd 40 int $0x40 - 291: c3 ret + 269: b8 11 00 00 00 mov $0x11,%eax + 26e: cd 40 int $0x40 + 270: c3 ret -00000292 : +00000271 : SYSCALL(unlink) - 292: b8 12 00 00 00 mov $0x12,%eax - 297: cd 40 int $0x40 - 299: c3 ret + 271: b8 12 00 00 00 mov $0x12,%eax + 276: cd 40 int $0x40 + 278: c3 ret -0000029a : +00000279 : SYSCALL(fstat) - 29a: b8 08 00 00 00 mov $0x8,%eax - 29f: cd 40 int $0x40 - 2a1: c3 ret + 279: b8 08 00 00 00 mov $0x8,%eax + 27e: cd 40 int $0x40 + 280: c3 ret -000002a2 : +00000281 : SYSCALL(link) - 2a2: b8 13 00 00 00 mov $0x13,%eax - 2a7: cd 40 int $0x40 - 2a9: c3 ret + 281: b8 13 00 00 00 mov $0x13,%eax + 286: cd 40 int $0x40 + 288: c3 ret -000002aa : +00000289 : SYSCALL(mkdir) - 2aa: b8 14 00 00 00 mov $0x14,%eax - 2af: cd 40 int $0x40 - 2b1: c3 ret + 289: b8 14 00 00 00 mov $0x14,%eax + 28e: cd 40 int $0x40 + 290: c3 ret -000002b2 : +00000291 : SYSCALL(chdir) - 2b2: b8 09 00 00 00 mov $0x9,%eax - 2b7: cd 40 int $0x40 - 2b9: c3 ret + 291: b8 09 00 00 00 mov $0x9,%eax + 296: cd 40 int $0x40 + 298: c3 ret -000002ba : +00000299 : SYSCALL(dup) - 2ba: b8 0a 00 00 00 mov $0xa,%eax - 2bf: cd 40 int $0x40 - 2c1: c3 ret + 299: b8 0a 00 00 00 mov $0xa,%eax + 29e: cd 40 int $0x40 + 2a0: c3 ret -000002c2 : +000002a1 : SYSCALL(getpid) - 2c2: b8 0b 00 00 00 mov $0xb,%eax - 2c7: cd 40 int $0x40 - 2c9: c3 ret + 2a1: b8 0b 00 00 00 mov $0xb,%eax + 2a6: cd 40 int $0x40 + 2a8: c3 ret -000002ca : +000002a9 : SYSCALL(sbrk) - 2ca: b8 0c 00 00 00 mov $0xc,%eax - 2cf: cd 40 int $0x40 - 2d1: c3 ret + 2a9: b8 0c 00 00 00 mov $0xc,%eax + 2ae: cd 40 int $0x40 + 2b0: c3 ret -000002d2 : +000002b1 : SYSCALL(sleep) - 2d2: b8 0d 00 00 00 mov $0xd,%eax - 2d7: cd 40 int $0x40 - 2d9: c3 ret + 2b1: b8 0d 00 00 00 mov $0xd,%eax + 2b6: cd 40 int $0x40 + 2b8: c3 ret -000002da : +000002b9 : SYSCALL(uptime) - 2da: b8 0e 00 00 00 mov $0xe,%eax - 2df: cd 40 int $0x40 - 2e1: c3 ret + 2b9: b8 0e 00 00 00 mov $0xe,%eax + 2be: cd 40 int $0x40 + 2c0: c3 ret -000002e2 : +000002c1 : SYSCALL(slabtest) - 2e2: b8 16 00 00 00 mov $0x16,%eax - 2e7: cd 40 int $0x40 - 2e9: c3 ret + 2c1: b8 16 00 00 00 mov $0x16,%eax + 2c6: cd 40 int $0x40 + 2c8: c3 ret -000002ea : +000002c9 : SYSCALL(ps) - 2ea: b8 17 00 00 00 mov $0x17,%eax - 2ef: cd 40 int $0x40 - 2f1: c3 ret + 2c9: b8 17 00 00 00 mov $0x17,%eax + 2ce: cd 40 int $0x40 + 2d0: c3 ret -000002f2 : +000002d1 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 2f2: 55 push %ebp - 2f3: 89 e5 mov %esp,%ebp - 2f5: 57 push %edi - 2f6: 56 push %esi - 2f7: 53 push %ebx - 2f8: 83 ec 3c sub $0x3c,%esp - 2fb: 89 45 c4 mov %eax,-0x3c(%ebp) - 2fe: 89 d3 mov %edx,%ebx + 2d1: 55 push %ebp + 2d2: 89 e5 mov %esp,%ebp + 2d4: 57 push %edi + 2d5: 56 push %esi + 2d6: 53 push %ebx + 2d7: 83 ec 3c sub $0x3c,%esp + 2da: 89 45 c4 mov %eax,-0x3c(%ebp) + 2dd: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 300: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 304: 74 77 je 37d - 306: 85 d2 test %edx,%edx - 308: 79 73 jns 37d + 2df: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 2e3: 74 79 je 35e + 2e5: 85 d2 test %edx,%edx + 2e7: 79 75 jns 35e neg = 1; x = -xx; - 30a: f7 db neg %ebx + 2e9: 89 d1 mov %edx,%ecx + 2eb: f7 d9 neg %ecx neg = 1; - 30c: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 2ed: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 313: be 00 00 00 00 mov $0x0,%esi + 2f4: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 318: 89 f7 mov %esi,%edi - 31a: 83 c6 01 add $0x1,%esi - 31d: 89 d8 mov %ebx,%eax - 31f: ba 00 00 00 00 mov $0x0,%edx - 324: f7 f1 div %ecx - 326: 0f b6 92 bc 06 00 00 movzbl 0x6bc(%edx),%edx - 32d: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 2f9: 89 df mov %ebx,%edi + 2fb: 83 c3 01 add $0x1,%ebx + 2fe: 89 c8 mov %ecx,%eax + 300: ba 00 00 00 00 mov $0x0,%edx + 305: f7 f6 div %esi + 307: 0f b6 92 d4 06 00 00 movzbl 0x6d4(%edx),%edx + 30e: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 331: 89 da mov %ebx,%edx - 333: 89 c3 mov %eax,%ebx - 335: 39 d1 cmp %edx,%ecx - 337: 76 df jbe 318 + 312: 89 ca mov %ecx,%edx + 314: 89 c1 mov %eax,%ecx + 316: 39 d6 cmp %edx,%esi + 318: 76 df jbe 2f9 if(neg) - 339: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 33d: 74 08 je 347 + 31a: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 31e: 74 08 je 328 buf[i++] = '-'; - 33f: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 344: 8d 77 02 lea 0x2(%edi),%esi + 320: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 325: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 347: 85 f6 test %esi,%esi - 349: 7e 2a jle 375 - 34b: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 34f: 8d 7d d8 lea -0x28(%ebp),%edi + 328: 85 db test %ebx,%ebx + 32a: 7e 2a jle 356 + 32c: 8d 7d d8 lea -0x28(%ebp),%edi + 32f: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 352: 8d 75 d7 lea -0x29(%ebp),%esi + 333: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 355: 0f b6 03 movzbl (%ebx),%eax - 358: 88 45 d7 mov %al,-0x29(%ebp) + 336: 0f b6 03 movzbl (%ebx),%eax + 339: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 35b: 83 ec 04 sub $0x4,%esp - 35e: 6a 01 push $0x1 - 360: 56 push %esi - 361: ff 75 c4 pushl -0x3c(%ebp) - 364: e8 f9 fe ff ff call 262 + 33c: 83 ec 04 sub $0x4,%esp + 33f: 6a 01 push $0x1 + 341: 56 push %esi + 342: ff 75 c4 push -0x3c(%ebp) + 345: e8 f7 fe ff ff call 241 while(--i >= 0) - 369: 89 d8 mov %ebx,%eax - 36b: 83 eb 01 sub $0x1,%ebx - 36e: 83 c4 10 add $0x10,%esp - 371: 39 f8 cmp %edi,%eax - 373: 75 e0 jne 355 + 34a: 89 d8 mov %ebx,%eax + 34c: 83 eb 01 sub $0x1,%ebx + 34f: 83 c4 10 add $0x10,%esp + 352: 39 f8 cmp %edi,%eax + 354: 75 e0 jne 336 } - 375: 8d 65 f4 lea -0xc(%ebp),%esp - 378: 5b pop %ebx - 379: 5e pop %esi - 37a: 5f pop %edi - 37b: 5d pop %ebp - 37c: c3 ret + 356: 8d 65 f4 lea -0xc(%ebp),%esp + 359: 5b pop %ebx + 35a: 5e pop %esi + 35b: 5f pop %edi + 35c: 5d pop %ebp + 35d: c3 ret + x = xx; + 35e: 89 d1 mov %edx,%ecx neg = 0; - 37d: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 384: eb 8d jmp 313 + 360: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 367: eb 8b jmp 2f4 -00000386 : +00000369 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 386: f3 0f 1e fb endbr32 - 38a: 55 push %ebp - 38b: 89 e5 mov %esp,%ebp - 38d: 57 push %edi - 38e: 56 push %esi - 38f: 53 push %ebx - 390: 83 ec 2c sub $0x2c,%esp + 369: 55 push %ebp + 36a: 89 e5 mov %esp,%ebp + 36c: 57 push %edi + 36d: 56 push %esi + 36e: 53 push %ebx + 36f: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 393: 8b 75 0c mov 0xc(%ebp),%esi - 396: 0f b6 1e movzbl (%esi),%ebx - 399: 84 db test %bl,%bl - 39b: 0f 84 ab 01 00 00 je 54c - 3a1: 83 c6 01 add $0x1,%esi + 372: 8b 75 0c mov 0xc(%ebp),%esi + 375: 0f b6 1e movzbl (%esi),%ebx + 378: 84 db test %bl,%bl + 37a: 0f 84 9f 01 00 00 je 51f + 380: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 3a4: 8d 45 10 lea 0x10(%ebp),%eax - 3a7: 89 45 d4 mov %eax,-0x2c(%ebp) + 383: 8d 45 10 lea 0x10(%ebp),%eax + 386: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 3aa: bf 00 00 00 00 mov $0x0,%edi - 3af: eb 2d jmp 3de + 389: bf 00 00 00 00 mov $0x0,%edi + 38e: eb 2d jmp 3bd c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 3b1: 88 5d e7 mov %bl,-0x19(%ebp) + 390: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3b4: 83 ec 04 sub $0x4,%esp - 3b7: 6a 01 push $0x1 - 3b9: 8d 45 e7 lea -0x19(%ebp),%eax - 3bc: 50 push %eax - 3bd: ff 75 08 pushl 0x8(%ebp) - 3c0: e8 9d fe ff ff call 262 + 393: 83 ec 04 sub $0x4,%esp + 396: 6a 01 push $0x1 + 398: 8d 45 e7 lea -0x19(%ebp),%eax + 39b: 50 push %eax + 39c: ff 75 08 push 0x8(%ebp) + 39f: e8 9d fe ff ff call 241 putc(fd, c); - 3c5: 83 c4 10 add $0x10,%esp - 3c8: eb 05 jmp 3cf + 3a4: 83 c4 10 add $0x10,%esp + 3a7: eb 05 jmp 3ae } } else if(state == '%'){ - 3ca: 83 ff 25 cmp $0x25,%edi - 3cd: 74 22 je 3f1 + 3a9: 83 ff 25 cmp $0x25,%edi + 3ac: 74 1f je 3cd for(i = 0; fmt[i]; i++){ - 3cf: 83 c6 01 add $0x1,%esi - 3d2: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3d6: 84 db test %bl,%bl - 3d8: 0f 84 6e 01 00 00 je 54c + 3ae: 83 c6 01 add $0x1,%esi + 3b1: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 3b5: 84 db test %bl,%bl + 3b7: 0f 84 62 01 00 00 je 51f c = fmt[i] & 0xff; - 3de: 0f be d3 movsbl %bl,%edx - 3e1: 0f b6 c3 movzbl %bl,%eax + 3bd: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 3e4: 85 ff test %edi,%edi - 3e6: 75 e2 jne 3ca + 3c0: 85 ff test %edi,%edi + 3c2: 75 e5 jne 3a9 if(c == '%'){ - 3e8: 83 f8 25 cmp $0x25,%eax - 3eb: 75 c4 jne 3b1 + 3c4: 83 f8 25 cmp $0x25,%eax + 3c7: 75 c7 jne 390 state = '%'; - 3ed: 89 c7 mov %eax,%edi - 3ef: eb de jmp 3cf + 3c9: 89 c7 mov %eax,%edi + 3cb: eb e1 jmp 3ae if(c == 'd'){ - 3f1: 83 f8 64 cmp $0x64,%eax - 3f4: 74 59 je 44f + 3cd: 83 f8 25 cmp $0x25,%eax + 3d0: 0f 84 f2 00 00 00 je 4c8 + 3d6: 8d 50 9d lea -0x63(%eax),%edx + 3d9: 83 fa 15 cmp $0x15,%edx + 3dc: 0f 87 07 01 00 00 ja 4e9 + 3e2: 0f 87 01 01 00 00 ja 4e9 + 3e8: ff 24 95 7c 06 00 00 jmp *0x67c(,%edx,4) printint(fd, *ap, 10, 1); + 3ef: 83 ec 0c sub $0xc,%esp + 3f2: 6a 01 push $0x1 + 3f4: b9 0a 00 00 00 mov $0xa,%ecx + 3f9: 8b 7d d4 mov -0x2c(%ebp),%edi + 3fc: 8b 17 mov (%edi),%edx + 3fe: 8b 45 08 mov 0x8(%ebp),%eax + 401: e8 cb fe ff ff call 2d1 ap++; - } else if(c == 'x' || c == 'p'){ - 3f6: 81 e2 f7 00 00 00 and $0xf7,%edx - 3fc: 83 fa 70 cmp $0x70,%edx - 3ff: 74 7a je 47b - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 401: 83 f8 73 cmp $0x73,%eax - 404: 0f 84 9d 00 00 00 je 4a7 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 40a: 83 f8 63 cmp $0x63,%eax - 40d: 0f 84 ec 00 00 00 je 4ff - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 413: 83 f8 25 cmp $0x25,%eax - 416: 0f 84 0f 01 00 00 je 52b - putc(fd, c); + 406: 89 f8 mov %edi,%eax + 408: 83 c0 04 add $0x4,%eax + 40b: 89 45 d4 mov %eax,-0x2c(%ebp) + 40e: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 41c: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 420: 83 ec 04 sub $0x4,%esp - 423: 6a 01 push $0x1 - 425: 8d 45 e7 lea -0x19(%ebp),%eax - 428: 50 push %eax - 429: ff 75 08 pushl 0x8(%ebp) - 42c: e8 31 fe ff ff call 262 putc(fd, c); - 431: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 434: 83 c4 0c add $0xc,%esp - 437: 6a 01 push $0x1 - 439: 8d 45 e7 lea -0x19(%ebp),%eax - 43c: 50 push %eax - 43d: ff 75 08 pushl 0x8(%ebp) - 440: e8 1d fe ff ff call 262 - putc(fd, c); - 445: 83 c4 10 add $0x10,%esp } state = 0; - 448: bf 00 00 00 00 mov $0x0,%edi - 44d: eb 80 jmp 3cf - printint(fd, *ap, 10, 1); - 44f: 83 ec 0c sub $0xc,%esp - 452: 6a 01 push $0x1 - 454: b9 0a 00 00 00 mov $0xa,%ecx - 459: 8b 7d d4 mov -0x2c(%ebp),%edi - 45c: 8b 17 mov (%edi),%edx - 45e: 8b 45 08 mov 0x8(%ebp),%eax - 461: e8 8c fe ff ff call 2f2 - ap++; - 466: 89 f8 mov %edi,%eax - 468: 83 c0 04 add $0x4,%eax - 46b: 89 45 d4 mov %eax,-0x2c(%ebp) - 46e: 83 c4 10 add $0x10,%esp - state = 0; - 471: bf 00 00 00 00 mov $0x0,%edi - 476: e9 54 ff ff ff jmp 3cf + 411: bf 00 00 00 00 mov $0x0,%edi + 416: eb 96 jmp 3ae printint(fd, *ap, 16, 0); - 47b: 83 ec 0c sub $0xc,%esp - 47e: 6a 00 push $0x0 - 480: b9 10 00 00 00 mov $0x10,%ecx - 485: 8b 7d d4 mov -0x2c(%ebp),%edi - 488: 8b 17 mov (%edi),%edx - 48a: 8b 45 08 mov 0x8(%ebp),%eax - 48d: e8 60 fe ff ff call 2f2 + 418: 83 ec 0c sub $0xc,%esp + 41b: 6a 00 push $0x0 + 41d: b9 10 00 00 00 mov $0x10,%ecx + 422: 8b 7d d4 mov -0x2c(%ebp),%edi + 425: 8b 17 mov (%edi),%edx + 427: 8b 45 08 mov 0x8(%ebp),%eax + 42a: e8 a2 fe ff ff call 2d1 ap++; - 492: 89 f8 mov %edi,%eax - 494: 83 c0 04 add $0x4,%eax - 497: 89 45 d4 mov %eax,-0x2c(%ebp) - 49a: 83 c4 10 add $0x10,%esp + 42f: 89 f8 mov %edi,%eax + 431: 83 c0 04 add $0x4,%eax + 434: 89 45 d4 mov %eax,-0x2c(%ebp) + 437: 83 c4 10 add $0x10,%esp state = 0; - 49d: bf 00 00 00 00 mov $0x0,%edi - 4a2: e9 28 ff ff ff jmp 3cf + 43a: bf 00 00 00 00 mov $0x0,%edi + 43f: e9 6a ff ff ff jmp 3ae s = (char*)*ap; - 4a7: 8b 4d d4 mov -0x2c(%ebp),%ecx - 4aa: 8b 01 mov (%ecx),%eax + 444: 8b 4d d4 mov -0x2c(%ebp),%ecx + 447: 8b 01 mov (%ecx),%eax ap++; - 4ac: 83 c1 04 add $0x4,%ecx - 4af: 89 4d d4 mov %ecx,-0x2c(%ebp) + 449: 83 c1 04 add $0x4,%ecx + 44c: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 4b2: 85 c0 test %eax,%eax - 4b4: 74 13 je 4c9 + 44f: 85 c0 test %eax,%eax + 451: 74 13 je 466 s = (char*)*ap; - 4b6: 89 c3 mov %eax,%ebx + 453: 89 c3 mov %eax,%ebx while(*s != 0){ - 4b8: 0f b6 00 movzbl (%eax),%eax + 455: 0f b6 00 movzbl (%eax),%eax state = 0; - 4bb: bf 00 00 00 00 mov $0x0,%edi + 458: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 4c0: 84 c0 test %al,%al - 4c2: 75 0f jne 4d3 - 4c4: e9 06 ff ff ff jmp 3cf + 45d: 84 c0 test %al,%al + 45f: 75 0f jne 470 + 461: e9 48 ff ff ff jmp 3ae s = "(null)"; - 4c9: bb b4 06 00 00 mov $0x6b4,%ebx + 466: bb 74 06 00 00 mov $0x674,%ebx while(*s != 0){ - 4ce: b8 28 00 00 00 mov $0x28,%eax - 4d3: 8b 7d 08 mov 0x8(%ebp),%edi + 46b: b8 28 00 00 00 mov $0x28,%eax + 470: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4d6: 88 45 e7 mov %al,-0x19(%ebp) + 473: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4d9: 83 ec 04 sub $0x4,%esp - 4dc: 6a 01 push $0x1 - 4de: 8d 45 e7 lea -0x19(%ebp),%eax - 4e1: 50 push %eax - 4e2: 57 push %edi - 4e3: e8 7a fd ff ff call 262 + 476: 83 ec 04 sub $0x4,%esp + 479: 6a 01 push $0x1 + 47b: 8d 45 e7 lea -0x19(%ebp),%eax + 47e: 50 push %eax + 47f: 57 push %edi + 480: e8 bc fd ff ff call 241 s++; - 4e8: 83 c3 01 add $0x1,%ebx + 485: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 4eb: 0f b6 03 movzbl (%ebx),%eax - 4ee: 83 c4 10 add $0x10,%esp - 4f1: 84 c0 test %al,%al - 4f3: 75 e1 jne 4d6 + 488: 0f b6 03 movzbl (%ebx),%eax + 48b: 83 c4 10 add $0x10,%esp + 48e: 84 c0 test %al,%al + 490: 75 e1 jne 473 state = 0; - 4f5: bf 00 00 00 00 mov $0x0,%edi - 4fa: e9 d0 fe ff ff jmp 3cf + 492: bf 00 00 00 00 mov $0x0,%edi + 497: e9 12 ff ff ff jmp 3ae putc(fd, *ap); - 4ff: 8b 7d d4 mov -0x2c(%ebp),%edi - 502: 8b 07 mov (%edi),%eax - 504: 88 45 e7 mov %al,-0x19(%ebp) + 49c: 8b 7d d4 mov -0x2c(%ebp),%edi + 49f: 8b 07 mov (%edi),%eax + 4a1: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 507: 83 ec 04 sub $0x4,%esp - 50a: 6a 01 push $0x1 - 50c: 8d 45 e7 lea -0x19(%ebp),%eax - 50f: 50 push %eax - 510: ff 75 08 pushl 0x8(%ebp) - 513: e8 4a fd ff ff call 262 + 4a4: 83 ec 04 sub $0x4,%esp + 4a7: 6a 01 push $0x1 + 4a9: 8d 45 e7 lea -0x19(%ebp),%eax + 4ac: 50 push %eax + 4ad: ff 75 08 push 0x8(%ebp) + 4b0: e8 8c fd ff ff call 241 ap++; - 518: 83 c7 04 add $0x4,%edi - 51b: 89 7d d4 mov %edi,-0x2c(%ebp) - 51e: 83 c4 10 add $0x10,%esp + 4b5: 83 c7 04 add $0x4,%edi + 4b8: 89 7d d4 mov %edi,-0x2c(%ebp) + 4bb: 83 c4 10 add $0x10,%esp state = 0; - 521: bf 00 00 00 00 mov $0x0,%edi - 526: e9 a4 fe ff ff jmp 3cf + 4be: bf 00 00 00 00 mov $0x0,%edi + 4c3: e9 e6 fe ff ff jmp 3ae putc(fd, c); - 52b: 88 5d e7 mov %bl,-0x19(%ebp) + 4c8: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 52e: 83 ec 04 sub $0x4,%esp - 531: 6a 01 push $0x1 - 533: 8d 45 e7 lea -0x19(%ebp),%eax - 536: 50 push %eax - 537: ff 75 08 pushl 0x8(%ebp) - 53a: e8 23 fd ff ff call 262 - 53f: 83 c4 10 add $0x10,%esp + 4cb: 83 ec 04 sub $0x4,%esp + 4ce: 6a 01 push $0x1 + 4d0: 8d 45 e7 lea -0x19(%ebp),%eax + 4d3: 50 push %eax + 4d4: ff 75 08 push 0x8(%ebp) + 4d7: e8 65 fd ff ff call 241 + 4dc: 83 c4 10 add $0x10,%esp + state = 0; + 4df: bf 00 00 00 00 mov $0x0,%edi + 4e4: e9 c5 fe ff ff jmp 3ae + putc(fd, '%'); + 4e9: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 4ed: 83 ec 04 sub $0x4,%esp + 4f0: 6a 01 push $0x1 + 4f2: 8d 45 e7 lea -0x19(%ebp),%eax + 4f5: 50 push %eax + 4f6: ff 75 08 push 0x8(%ebp) + 4f9: e8 43 fd ff ff call 241 + putc(fd, c); + 4fe: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 501: 83 c4 0c add $0xc,%esp + 504: 6a 01 push $0x1 + 506: 8d 45 e7 lea -0x19(%ebp),%eax + 509: 50 push %eax + 50a: ff 75 08 push 0x8(%ebp) + 50d: e8 2f fd ff ff call 241 + putc(fd, c); + 512: 83 c4 10 add $0x10,%esp state = 0; - 542: bf 00 00 00 00 mov $0x0,%edi - 547: e9 83 fe ff ff jmp 3cf + 515: bf 00 00 00 00 mov $0x0,%edi + 51a: e9 8f fe ff ff jmp 3ae } } } - 54c: 8d 65 f4 lea -0xc(%ebp),%esp - 54f: 5b pop %ebx - 550: 5e pop %esi - 551: 5f pop %edi - 552: 5d pop %ebp - 553: c3 ret - -00000554 : + 51f: 8d 65 f4 lea -0xc(%ebp),%esp + 522: 5b pop %ebx + 523: 5e pop %esi + 524: 5f pop %edi + 525: 5d pop %ebp + 526: c3 ret + +00000527 : static Header base; static Header *freep; void free(void *ap) { - 554: f3 0f 1e fb endbr32 - 558: 55 push %ebp - 559: 89 e5 mov %esp,%ebp - 55b: 57 push %edi - 55c: 56 push %esi - 55d: 53 push %ebx - 55e: 8b 5d 08 mov 0x8(%ebp),%ebx + 527: 55 push %ebp + 528: 89 e5 mov %esp,%ebp + 52a: 57 push %edi + 52b: 56 push %esi + 52c: 53 push %ebx + 52d: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 561: 8d 4b f8 lea -0x8(%ebx),%ecx + 530: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 564: a1 2c 09 00 00 mov 0x92c,%eax - 569: eb 0c jmp 577 + 533: a1 48 09 00 00 mov 0x948,%eax + 538: eb 0c jmp 546 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 56b: 8b 10 mov (%eax),%edx - 56d: 39 c2 cmp %eax,%edx - 56f: 77 04 ja 575 - 571: 39 ca cmp %ecx,%edx - 573: 77 10 ja 585 + 53a: 8b 10 mov (%eax),%edx + 53c: 39 c2 cmp %eax,%edx + 53e: 77 04 ja 544 + 540: 39 ca cmp %ecx,%edx + 542: 77 10 ja 554 { - 575: 89 d0 mov %edx,%eax + 544: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 577: 39 c8 cmp %ecx,%eax - 579: 73 f0 jae 56b - 57b: 8b 10 mov (%eax),%edx - 57d: 39 ca cmp %ecx,%edx - 57f: 77 04 ja 585 + 546: 39 c8 cmp %ecx,%eax + 548: 73 f0 jae 53a + 54a: 8b 10 mov (%eax),%edx + 54c: 39 ca cmp %ecx,%edx + 54e: 77 04 ja 554 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 581: 39 c2 cmp %eax,%edx - 583: 77 f0 ja 575 + 550: 39 c2 cmp %eax,%edx + 552: 77 f0 ja 544 break; if(bp + bp->s.size == p->s.ptr){ - 585: 8b 73 fc mov -0x4(%ebx),%esi - 588: 8b 10 mov (%eax),%edx - 58a: 8d 3c f1 lea (%ecx,%esi,8),%edi - 58d: 39 fa cmp %edi,%edx - 58f: 74 19 je 5aa + 554: 8b 73 fc mov -0x4(%ebx),%esi + 557: 8b 10 mov (%eax),%edx + 559: 8d 3c f1 lea (%ecx,%esi,8),%edi + 55c: 39 fa cmp %edi,%edx + 55e: 74 19 je 579 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 560: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 591: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 594: 8b 50 04 mov 0x4(%eax),%edx - 597: 8d 34 d0 lea (%eax,%edx,8),%esi - 59a: 39 f1 cmp %esi,%ecx - 59c: 74 1b je 5b9 + 563: 8b 50 04 mov 0x4(%eax),%edx + 566: 8d 34 d0 lea (%eax,%edx,8),%esi + 569: 39 f1 cmp %esi,%ecx + 56b: 74 18 je 585 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 56d: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 59e: 89 08 mov %ecx,(%eax) freep = p; - 5a0: a3 2c 09 00 00 mov %eax,0x92c + 56f: a3 48 09 00 00 mov %eax,0x948 } - 5a5: 5b pop %ebx - 5a6: 5e pop %esi - 5a7: 5f pop %edi - 5a8: 5d pop %ebp - 5a9: c3 ret + 574: 5b pop %ebx + 575: 5e pop %esi + 576: 5f pop %edi + 577: 5d pop %ebp + 578: c3 ret bp->s.size += p->s.ptr->s.size; - 5aa: 03 72 04 add 0x4(%edx),%esi - 5ad: 89 73 fc mov %esi,-0x4(%ebx) + 579: 03 72 04 add 0x4(%edx),%esi + 57c: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 5b0: 8b 10 mov (%eax),%edx - 5b2: 8b 12 mov (%edx),%edx - 5b4: 89 53 f8 mov %edx,-0x8(%ebx) - 5b7: eb db jmp 594 + 57f: 8b 10 mov (%eax),%edx + 581: 8b 12 mov (%edx),%edx + 583: eb db jmp 560 p->s.size += bp->s.size; - 5b9: 03 53 fc add -0x4(%ebx),%edx - 5bc: 89 50 04 mov %edx,0x4(%eax) + 585: 03 53 fc add -0x4(%ebx),%edx + 588: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 5bf: 8b 53 f8 mov -0x8(%ebx),%edx - 5c2: 89 10 mov %edx,(%eax) - 5c4: eb da jmp 5a0 + 58b: 8b 4b f8 mov -0x8(%ebx),%ecx + 58e: eb dd jmp 56d -000005c6 : +00000590 : return freep; } void* malloc(uint nbytes) { - 5c6: f3 0f 1e fb endbr32 - 5ca: 55 push %ebp - 5cb: 89 e5 mov %esp,%ebp - 5cd: 57 push %edi - 5ce: 56 push %esi - 5cf: 53 push %ebx - 5d0: 83 ec 0c sub $0xc,%esp + 590: 55 push %ebp + 591: 89 e5 mov %esp,%ebp + 593: 57 push %edi + 594: 56 push %esi + 595: 53 push %ebx + 596: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5d3: 8b 45 08 mov 0x8(%ebp),%eax - 5d6: 8d 58 07 lea 0x7(%eax),%ebx - 5d9: c1 eb 03 shr $0x3,%ebx - 5dc: 83 c3 01 add $0x1,%ebx + 599: 8b 45 08 mov 0x8(%ebp),%eax + 59c: 8d 58 07 lea 0x7(%eax),%ebx + 59f: c1 eb 03 shr $0x3,%ebx + 5a2: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5df: 8b 15 2c 09 00 00 mov 0x92c,%edx - 5e5: 85 d2 test %edx,%edx - 5e7: 74 20 je 609 + 5a5: 8b 15 48 09 00 00 mov 0x948,%edx + 5ab: 85 d2 test %edx,%edx + 5ad: 74 1c je 5cb base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5e9: 8b 02 mov (%edx),%eax + 5af: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 5eb: 8b 48 04 mov 0x4(%eax),%ecx - 5ee: 39 cb cmp %ecx,%ebx - 5f0: 76 3c jbe 62e - 5f2: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 5f8: be 00 10 00 00 mov $0x1000,%esi - 5fd: 0f 43 f3 cmovae %ebx,%esi + 5b1: 8b 48 04 mov 0x4(%eax),%ecx + 5b4: 39 cb cmp %ecx,%ebx + 5b6: 76 38 jbe 5f0 + 5b8: be 00 10 00 00 mov $0x1000,%esi + 5bd: 39 f3 cmp %esi,%ebx + 5bf: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 600: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 607: eb 72 jmp 67b + 5c2: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 5c9: eb 72 jmp 63d base.s.ptr = freep = prevp = &base; - 609: c7 05 2c 09 00 00 30 movl $0x930,0x92c - 610: 09 00 00 - 613: c7 05 30 09 00 00 30 movl $0x930,0x930 - 61a: 09 00 00 + 5cb: c7 05 48 09 00 00 4c movl $0x94c,0x948 + 5d2: 09 00 00 + 5d5: c7 05 4c 09 00 00 4c movl $0x94c,0x94c + 5dc: 09 00 00 base.s.size = 0; - 61d: c7 05 34 09 00 00 00 movl $0x0,0x934 - 624: 00 00 00 + 5df: c7 05 50 09 00 00 00 movl $0x0,0x950 + 5e6: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 627: b8 30 09 00 00 mov $0x930,%eax - 62c: eb c4 jmp 5f2 + 5e9: b8 4c 09 00 00 mov $0x94c,%eax + 5ee: eb c8 jmp 5b8 if(p->s.size == nunits) - 62e: 39 cb cmp %ecx,%ebx - 630: 74 1e je 650 + 5f0: 39 cb cmp %ecx,%ebx + 5f2: 74 1e je 612 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 632: 29 d9 sub %ebx,%ecx - 634: 89 48 04 mov %ecx,0x4(%eax) + 5f4: 29 d9 sub %ebx,%ecx + 5f6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 637: 8d 04 c8 lea (%eax,%ecx,8),%eax + 5f9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 63a: 89 58 04 mov %ebx,0x4(%eax) + 5fc: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 63d: 89 15 2c 09 00 00 mov %edx,0x92c + 5ff: 89 15 48 09 00 00 mov %edx,0x948 return (void*)(p + 1); - 643: 8d 50 08 lea 0x8(%eax),%edx + 605: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 646: 89 d0 mov %edx,%eax - 648: 8d 65 f4 lea -0xc(%ebp),%esp - 64b: 5b pop %ebx - 64c: 5e pop %esi - 64d: 5f pop %edi - 64e: 5d pop %ebp - 64f: c3 ret + 608: 89 d0 mov %edx,%eax + 60a: 8d 65 f4 lea -0xc(%ebp),%esp + 60d: 5b pop %ebx + 60e: 5e pop %esi + 60f: 5f pop %edi + 610: 5d pop %ebp + 611: c3 ret prevp->s.ptr = p->s.ptr; - 650: 8b 08 mov (%eax),%ecx - 652: 89 0a mov %ecx,(%edx) - 654: eb e7 jmp 63d + 612: 8b 08 mov (%eax),%ecx + 614: 89 0a mov %ecx,(%edx) + 616: eb e7 jmp 5ff hp->s.size = nu; - 656: 89 70 04 mov %esi,0x4(%eax) + 618: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 659: 83 ec 0c sub $0xc,%esp - 65c: 83 c0 08 add $0x8,%eax - 65f: 50 push %eax - 660: e8 ef fe ff ff call 554 + 61b: 83 ec 0c sub $0xc,%esp + 61e: 83 c0 08 add $0x8,%eax + 621: 50 push %eax + 622: e8 00 ff ff ff call 527 return freep; - 665: 8b 15 2c 09 00 00 mov 0x92c,%edx + 627: 8b 15 48 09 00 00 mov 0x948,%edx if((p = morecore(nunits)) == 0) - 66b: 83 c4 10 add $0x10,%esp - 66e: 85 d2 test %edx,%edx - 670: 74 d4 je 646 + 62d: 83 c4 10 add $0x10,%esp + 630: 85 d2 test %edx,%edx + 632: 74 d4 je 608 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 672: 8b 02 mov (%edx),%eax + 634: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 674: 8b 48 04 mov 0x4(%eax),%ecx - 677: 39 d9 cmp %ebx,%ecx - 679: 73 b3 jae 62e + 636: 8b 48 04 mov 0x4(%eax),%ecx + 639: 39 d9 cmp %ebx,%ecx + 63b: 73 b3 jae 5f0 if(p == freep) - 67b: 89 c2 mov %eax,%edx - 67d: 39 05 2c 09 00 00 cmp %eax,0x92c - 683: 75 ed jne 672 + 63d: 89 c2 mov %eax,%edx + 63f: 39 05 48 09 00 00 cmp %eax,0x948 + 645: 75 ed jne 634 p = sbrk(nu * sizeof(Header)); - 685: 83 ec 0c sub $0xc,%esp - 688: 57 push %edi - 689: e8 3c fc ff ff call 2ca + 647: 83 ec 0c sub $0xc,%esp + 64a: 57 push %edi + 64b: e8 59 fc ff ff call 2a9 if(p == (char*)-1) - 68e: 83 c4 10 add $0x10,%esp - 691: 83 f8 ff cmp $0xffffffff,%eax - 694: 75 c0 jne 656 + 650: 83 c4 10 add $0x10,%esp + 653: 83 f8 ff cmp $0xffffffff,%eax + 656: 75 c0 jne 618 return 0; - 696: ba 00 00 00 00 mov $0x0,%edx - 69b: eb a9 jmp 646 + 658: ba 00 00 00 00 mov $0x0,%edx + 65d: eb a9 jmp 608 diff --git a/src/user/kill.d b/src/user/kill.d new file mode 100644 index 0000000..a484589 --- /dev/null +++ b/src/user/kill.d @@ -0,0 +1 @@ +user/kill.o: user/kill.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/kill.o b/src/user/kill.o new file mode 100644 index 0000000..4601a11 Binary files /dev/null and b/src/user/kill.o differ diff --git a/src/user/kill.sym b/src/user/kill.sym index 1b31465..c30315f 100644 --- a/src/user/kill.sym +++ b/src/user/kill.sym @@ -1,59 +1,47 @@ -00000000 .text -000006a0 .rodata -000006d0 .eh_frame -0000092c .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 kill.c 00000000 ulib.c 00000000 printf.c -000002f2 printint -000006bc digits.1089 +000002d1 printint +000006d4 digits.0 00000000 umalloc.c -0000092c freep -00000930 base -0000005c strcpy -00000386 printf -00000209 memmove -0000028a mknod -000002ea ps -00000127 gets -000002c2 getpid -000005c6 malloc -000002d2 sleep -00000252 pipe -000002e2 slabtest -00000262 write -0000029a fstat -00000272 kill -000002b2 chdir -0000027a exec -0000024a wait -0000025a read -00000292 unlink -0000023a fork -000002ca sbrk -000002da uptime -0000092c __bss_start -000000db memset +00000948 freep +0000094c base +00000059 strcpy +00000369 printf +000001ec memmove +00000269 mknod +000002c9 ps +00000114 gets +000002a1 getpid +00000590 malloc +000002b1 sleep +00000231 pipe +000002c1 slabtest +00000241 write +00000279 fstat +00000251 kill +00000291 chdir +00000259 exec +00000229 wait +00000239 read +00000271 unlink +00000219 fork +000002a9 sbrk +000002b9 uptime +00000948 __bss_start +000000ce memset 00000000 main -00000082 strcmp -000002ba dup -00000182 stat -0000092c _edata -00000938 _end -000002a2 link -00000242 exit -000001ca atoi -000000b1 strlen -00000282 open -000000f6 strchr -000002aa mkdir -0000026a close -00000554 free +0000007d strcmp +00000299 dup +0000016b stat +00000948 _edata +00000954 _end +00000281 link +00000221 exit +000001af atoi +000000a8 strlen +00000261 open +000000e7 strchr +00000289 mkdir +00000249 close +00000527 free diff --git a/src/user/ln.asm b/src/user/ln.asm index 84d8280..d2585ef 100644 --- a/src/user/ln.asm +++ b/src/user/ln.asm @@ -11,1059 +11,1028 @@ Disassembly of section .text: int main(int argc, char *argv[]) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 53 push %ebx - 12: 51 push %ecx - 13: 8b 59 04 mov 0x4(%ecx),%ebx + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 53 push %ebx + e: 51 push %ecx + f: 8b 59 04 mov 0x4(%ecx),%ebx if(argc != 3){ - 16: 83 39 03 cmpl $0x3,(%ecx) - 19: 74 14 je 2f + 12: 83 39 03 cmpl $0x3,(%ecx) + 15: 74 14 je 2b printf(2, "Usage: ln old new\n"); - 1b: 83 ec 08 sub $0x8,%esp - 1e: 68 a4 06 00 00 push $0x6a4 - 23: 6a 02 push $0x2 - 25: e8 60 03 00 00 call 38a + 17: 83 ec 08 sub $0x8,%esp + 1a: 68 64 06 00 00 push $0x664 + 1f: 6a 02 push $0x2 + 21: e8 46 03 00 00 call 36c exit(); - 2a: e8 17 02 00 00 call 246 + 26: e8 f9 01 00 00 call 224 } if(link(argv[1], argv[2]) < 0) - 2f: 83 ec 08 sub $0x8,%esp - 32: ff 73 08 pushl 0x8(%ebx) - 35: ff 73 04 pushl 0x4(%ebx) - 38: e8 69 02 00 00 call 2a6 - 3d: 83 c4 10 add $0x10,%esp - 40: 85 c0 test %eax,%eax - 42: 78 05 js 49 + 2b: 83 ec 08 sub $0x8,%esp + 2e: ff 73 08 push 0x8(%ebx) + 31: ff 73 04 push 0x4(%ebx) + 34: e8 4b 02 00 00 call 284 + 39: 83 c4 10 add $0x10,%esp + 3c: 85 c0 test %eax,%eax + 3e: 78 05 js 45 printf(2, "link %s %s: failed\n", argv[1], argv[2]); exit(); - 44: e8 fd 01 00 00 call 246 + 40: e8 df 01 00 00 call 224 printf(2, "link %s %s: failed\n", argv[1], argv[2]); - 49: ff 73 08 pushl 0x8(%ebx) - 4c: ff 73 04 pushl 0x4(%ebx) - 4f: 68 b7 06 00 00 push $0x6b7 - 54: 6a 02 push $0x2 - 56: e8 2f 03 00 00 call 38a - 5b: 83 c4 10 add $0x10,%esp - 5e: eb e4 jmp 44 - -00000060 : + 45: ff 73 08 push 0x8(%ebx) + 48: ff 73 04 push 0x4(%ebx) + 4b: 68 77 06 00 00 push $0x677 + 50: 6a 02 push $0x2 + 52: e8 15 03 00 00 call 36c + 57: 83 c4 10 add $0x10,%esp + 5a: eb e4 jmp 40 + +0000005c : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 60: f3 0f 1e fb endbr32 - 64: 55 push %ebp - 65: 89 e5 mov %esp,%ebp - 67: 53 push %ebx - 68: 8b 4d 08 mov 0x8(%ebp),%ecx - 6b: 8b 5d 0c mov 0xc(%ebp),%ebx + 5c: 55 push %ebp + 5d: 89 e5 mov %esp,%ebp + 5f: 53 push %ebx + 60: 8b 4d 08 mov 0x8(%ebp),%ecx + 63: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 6e: b8 00 00 00 00 mov $0x0,%eax - 73: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 77: 88 14 01 mov %dl,(%ecx,%eax,1) - 7a: 83 c0 01 add $0x1,%eax - 7d: 84 d2 test %dl,%dl - 7f: 75 f2 jne 73 + 66: b8 00 00 00 00 mov $0x0,%eax + 6b: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 6f: 88 14 01 mov %dl,(%ecx,%eax,1) + 72: 83 c0 01 add $0x1,%eax + 75: 84 d2 test %dl,%dl + 77: 75 f2 jne 6b ; return os; } - 81: 89 c8 mov %ecx,%eax - 83: 5b pop %ebx - 84: 5d pop %ebp - 85: c3 ret + 79: 89 c8 mov %ecx,%eax + 7b: 8b 5d fc mov -0x4(%ebp),%ebx + 7e: c9 leave + 7f: c3 ret -00000086 : +00000080 : int strcmp(const char *p, const char *q) { - 86: f3 0f 1e fb endbr32 - 8a: 55 push %ebp - 8b: 89 e5 mov %esp,%ebp - 8d: 8b 4d 08 mov 0x8(%ebp),%ecx - 90: 8b 55 0c mov 0xc(%ebp),%edx + 80: 55 push %ebp + 81: 89 e5 mov %esp,%ebp + 83: 8b 4d 08 mov 0x8(%ebp),%ecx + 86: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 93: 0f b6 01 movzbl (%ecx),%eax - 96: 84 c0 test %al,%al - 98: 74 11 je ab - 9a: 38 02 cmp %al,(%edx) - 9c: 75 0d jne ab + 89: 0f b6 01 movzbl (%ecx),%eax + 8c: 84 c0 test %al,%al + 8e: 74 11 je a1 + 90: 38 02 cmp %al,(%edx) + 92: 75 0d jne a1 p++, q++; - 9e: 83 c1 01 add $0x1,%ecx - a1: 83 c2 01 add $0x1,%edx + 94: 83 c1 01 add $0x1,%ecx + 97: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - a4: 0f b6 01 movzbl (%ecx),%eax - a7: 84 c0 test %al,%al - a9: 75 ef jne 9a + 9a: 0f b6 01 movzbl (%ecx),%eax + 9d: 84 c0 test %al,%al + 9f: 75 ef jne 90 return (uchar)*p - (uchar)*q; - ab: 0f b6 c0 movzbl %al,%eax - ae: 0f b6 12 movzbl (%edx),%edx - b1: 29 d0 sub %edx,%eax + a1: 0f b6 c0 movzbl %al,%eax + a4: 0f b6 12 movzbl (%edx),%edx + a7: 29 d0 sub %edx,%eax } - b3: 5d pop %ebp - b4: c3 ret + a9: 5d pop %ebp + aa: c3 ret -000000b5 : +000000ab : uint strlen(const char *s) { - b5: f3 0f 1e fb endbr32 - b9: 55 push %ebp - ba: 89 e5 mov %esp,%ebp - bc: 8b 55 08 mov 0x8(%ebp),%edx + ab: 55 push %ebp + ac: 89 e5 mov %esp,%ebp + ae: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - bf: 80 3a 00 cmpb $0x0,(%edx) - c2: 74 14 je d8 - c4: b8 00 00 00 00 mov $0x0,%eax - c9: 83 c0 01 add $0x1,%eax - cc: 89 c1 mov %eax,%ecx - ce: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - d2: 75 f5 jne c9 + b1: 80 3a 00 cmpb $0x0,(%edx) + b4: 74 14 je ca + b6: b8 00 00 00 00 mov $0x0,%eax + bb: 83 c0 01 add $0x1,%eax + be: 89 c1 mov %eax,%ecx + c0: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + c4: 75 f5 jne bb ; return n; } - d4: 89 c8 mov %ecx,%eax - d6: 5d pop %ebp - d7: c3 ret + c6: 89 c8 mov %ecx,%eax + c8: 5d pop %ebp + c9: c3 ret for(n = 0; s[n]; n++) - d8: b9 00 00 00 00 mov $0x0,%ecx + ca: b9 00 00 00 00 mov $0x0,%ecx return n; - dd: eb f5 jmp d4 + cf: eb f5 jmp c6 -000000df : +000000d1 : void* memset(void *dst, int c, uint n) { - df: f3 0f 1e fb endbr32 - e3: 55 push %ebp - e4: 89 e5 mov %esp,%ebp - e6: 57 push %edi - e7: 8b 55 08 mov 0x8(%ebp),%edx + d1: 55 push %ebp + d2: 89 e5 mov %esp,%ebp + d4: 57 push %edi + d5: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - ea: 89 d7 mov %edx,%edi - ec: 8b 4d 10 mov 0x10(%ebp),%ecx - ef: 8b 45 0c mov 0xc(%ebp),%eax - f2: fc cld - f3: f3 aa rep stos %al,%es:(%edi) + d8: 89 d7 mov %edx,%edi + da: 8b 4d 10 mov 0x10(%ebp),%ecx + dd: 8b 45 0c mov 0xc(%ebp),%eax + e0: fc cld + e1: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - f5: 89 d0 mov %edx,%eax - f7: 5f pop %edi - f8: 5d pop %ebp - f9: c3 ret + e3: 89 d0 mov %edx,%eax + e5: 8b 7d fc mov -0x4(%ebp),%edi + e8: c9 leave + e9: c3 ret -000000fa : +000000ea : char* strchr(const char *s, char c) { - fa: f3 0f 1e fb endbr32 - fe: 55 push %ebp - ff: 89 e5 mov %esp,%ebp - 101: 8b 45 08 mov 0x8(%ebp),%eax - 104: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + ea: 55 push %ebp + eb: 89 e5 mov %esp,%ebp + ed: 8b 45 08 mov 0x8(%ebp),%eax + f0: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 108: 0f b6 10 movzbl (%eax),%edx - 10b: 84 d2 test %dl,%dl - 10d: 74 15 je 124 + f4: 0f b6 10 movzbl (%eax),%edx + f7: 84 d2 test %dl,%dl + f9: 74 15 je 110 if(*s == c) - 10f: 38 d1 cmp %dl,%cl - 111: 74 0f je 122 + fb: 38 d1 cmp %dl,%cl + fd: 74 0f je 10e for(; *s; s++) - 113: 83 c0 01 add $0x1,%eax - 116: 0f b6 10 movzbl (%eax),%edx - 119: 84 d2 test %dl,%dl - 11b: 75 f2 jne 10f + ff: 83 c0 01 add $0x1,%eax + 102: 0f b6 10 movzbl (%eax),%edx + 105: 84 d2 test %dl,%dl + 107: 75 f2 jne fb return (char*)s; return 0; - 11d: b8 00 00 00 00 mov $0x0,%eax + 109: b8 00 00 00 00 mov $0x0,%eax } - 122: 5d pop %ebp - 123: c3 ret + 10e: 5d pop %ebp + 10f: c3 ret return 0; - 124: b8 00 00 00 00 mov $0x0,%eax - 129: eb f7 jmp 122 + 110: b8 00 00 00 00 mov $0x0,%eax + 115: eb f7 jmp 10e -0000012b : +00000117 : char* gets(char *buf, int max) { - 12b: f3 0f 1e fb endbr32 - 12f: 55 push %ebp - 130: 89 e5 mov %esp,%ebp - 132: 57 push %edi - 133: 56 push %esi - 134: 53 push %ebx - 135: 83 ec 2c sub $0x2c,%esp - 138: 8b 75 08 mov 0x8(%ebp),%esi + 117: 55 push %ebp + 118: 89 e5 mov %esp,%ebp + 11a: 57 push %edi + 11b: 56 push %esi + 11c: 53 push %ebx + 11d: 83 ec 2c sub $0x2c,%esp + 120: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 13b: bb 00 00 00 00 mov $0x0,%ebx + 123: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 140: 8d 7d e7 lea -0x19(%ebp),%edi + 128: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 143: 89 5d d4 mov %ebx,-0x2c(%ebp) - 146: 83 c3 01 add $0x1,%ebx - 149: 3b 5d 0c cmp 0xc(%ebp),%ebx - 14c: 7d 27 jge 175 + 12b: 89 5d d4 mov %ebx,-0x2c(%ebp) + 12e: 83 c3 01 add $0x1,%ebx + 131: 3b 5d 0c cmp 0xc(%ebp),%ebx + 134: 7d 27 jge 15d cc = read(0, &c, 1); - 14e: 83 ec 04 sub $0x4,%esp - 151: 6a 01 push $0x1 - 153: 57 push %edi - 154: 6a 00 push $0x0 - 156: e8 03 01 00 00 call 25e + 136: 83 ec 04 sub $0x4,%esp + 139: 6a 01 push $0x1 + 13b: 57 push %edi + 13c: 6a 00 push $0x0 + 13e: e8 f9 00 00 00 call 23c if(cc < 1) - 15b: 83 c4 10 add $0x10,%esp - 15e: 85 c0 test %eax,%eax - 160: 7e 13 jle 175 + 143: 83 c4 10 add $0x10,%esp + 146: 85 c0 test %eax,%eax + 148: 7e 13 jle 15d break; buf[i++] = c; - 162: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 166: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 14a: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 14e: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 16a: 3c 0a cmp $0xa,%al - 16c: 74 04 je 172 - 16e: 3c 0d cmp $0xd,%al - 170: 75 d1 jne 143 + 152: 3c 0a cmp $0xa,%al + 154: 74 04 je 15a + 156: 3c 0d cmp $0xd,%al + 158: 75 d1 jne 12b for(i=0; i+1 < max; ){ - 172: 89 5d d4 mov %ebx,-0x2c(%ebp) + 15a: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 175: 8b 45 d4 mov -0x2c(%ebp),%eax - 178: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 15d: 8b 45 d4 mov -0x2c(%ebp),%eax + 160: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 17c: 89 f0 mov %esi,%eax - 17e: 8d 65 f4 lea -0xc(%ebp),%esp - 181: 5b pop %ebx - 182: 5e pop %esi - 183: 5f pop %edi - 184: 5d pop %ebp - 185: c3 ret + 164: 89 f0 mov %esi,%eax + 166: 8d 65 f4 lea -0xc(%ebp),%esp + 169: 5b pop %ebx + 16a: 5e pop %esi + 16b: 5f pop %edi + 16c: 5d pop %ebp + 16d: c3 ret -00000186 : +0000016e : int stat(const char *n, struct stat *st) { - 186: f3 0f 1e fb endbr32 - 18a: 55 push %ebp - 18b: 89 e5 mov %esp,%ebp - 18d: 56 push %esi - 18e: 53 push %ebx + 16e: 55 push %ebp + 16f: 89 e5 mov %esp,%ebp + 171: 56 push %esi + 172: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 18f: 83 ec 08 sub $0x8,%esp - 192: 6a 00 push $0x0 - 194: ff 75 08 pushl 0x8(%ebp) - 197: e8 ea 00 00 00 call 286 + 173: 83 ec 08 sub $0x8,%esp + 176: 6a 00 push $0x0 + 178: ff 75 08 push 0x8(%ebp) + 17b: e8 e4 00 00 00 call 264 if(fd < 0) - 19c: 83 c4 10 add $0x10,%esp - 19f: 85 c0 test %eax,%eax - 1a1: 78 24 js 1c7 - 1a3: 89 c3 mov %eax,%ebx + 180: 83 c4 10 add $0x10,%esp + 183: 85 c0 test %eax,%eax + 185: 78 24 js 1ab + 187: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 1a5: 83 ec 08 sub $0x8,%esp - 1a8: ff 75 0c pushl 0xc(%ebp) - 1ab: 50 push %eax - 1ac: e8 ed 00 00 00 call 29e - 1b1: 89 c6 mov %eax,%esi + 189: 83 ec 08 sub $0x8,%esp + 18c: ff 75 0c push 0xc(%ebp) + 18f: 50 push %eax + 190: e8 e7 00 00 00 call 27c + 195: 89 c6 mov %eax,%esi close(fd); - 1b3: 89 1c 24 mov %ebx,(%esp) - 1b6: e8 b3 00 00 00 call 26e + 197: 89 1c 24 mov %ebx,(%esp) + 19a: e8 ad 00 00 00 call 24c return r; - 1bb: 83 c4 10 add $0x10,%esp + 19f: 83 c4 10 add $0x10,%esp } - 1be: 89 f0 mov %esi,%eax - 1c0: 8d 65 f8 lea -0x8(%ebp),%esp - 1c3: 5b pop %ebx - 1c4: 5e pop %esi - 1c5: 5d pop %ebp - 1c6: c3 ret + 1a2: 89 f0 mov %esi,%eax + 1a4: 8d 65 f8 lea -0x8(%ebp),%esp + 1a7: 5b pop %ebx + 1a8: 5e pop %esi + 1a9: 5d pop %ebp + 1aa: c3 ret return -1; - 1c7: be ff ff ff ff mov $0xffffffff,%esi - 1cc: eb f0 jmp 1be + 1ab: be ff ff ff ff mov $0xffffffff,%esi + 1b0: eb f0 jmp 1a2 -000001ce : +000001b2 : int atoi(const char *s) { - 1ce: f3 0f 1e fb endbr32 - 1d2: 55 push %ebp - 1d3: 89 e5 mov %esp,%ebp - 1d5: 53 push %ebx - 1d6: 8b 55 08 mov 0x8(%ebp),%edx + 1b2: 55 push %ebp + 1b3: 89 e5 mov %esp,%ebp + 1b5: 53 push %ebx + 1b6: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1d9: 0f b6 02 movzbl (%edx),%eax - 1dc: 8d 48 d0 lea -0x30(%eax),%ecx - 1df: 80 f9 09 cmp $0x9,%cl - 1e2: 77 22 ja 206 + 1b9: 0f b6 02 movzbl (%edx),%eax + 1bc: 8d 48 d0 lea -0x30(%eax),%ecx + 1bf: 80 f9 09 cmp $0x9,%cl + 1c2: 77 24 ja 1e8 n = 0; - 1e4: b9 00 00 00 00 mov $0x0,%ecx + 1c4: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 1e9: 83 c2 01 add $0x1,%edx - 1ec: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 1ef: 0f be c0 movsbl %al,%eax - 1f2: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 1c9: 83 c2 01 add $0x1,%edx + 1cc: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 1cf: 0f be c0 movsbl %al,%eax + 1d2: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 1f6: 0f b6 02 movzbl (%edx),%eax - 1f9: 8d 58 d0 lea -0x30(%eax),%ebx - 1fc: 80 fb 09 cmp $0x9,%bl - 1ff: 76 e8 jbe 1e9 + 1d6: 0f b6 02 movzbl (%edx),%eax + 1d9: 8d 58 d0 lea -0x30(%eax),%ebx + 1dc: 80 fb 09 cmp $0x9,%bl + 1df: 76 e8 jbe 1c9 return n; } - 201: 89 c8 mov %ecx,%eax - 203: 5b pop %ebx - 204: 5d pop %ebp - 205: c3 ret + 1e1: 89 c8 mov %ecx,%eax + 1e3: 8b 5d fc mov -0x4(%ebp),%ebx + 1e6: c9 leave + 1e7: c3 ret n = 0; - 206: b9 00 00 00 00 mov $0x0,%ecx + 1e8: b9 00 00 00 00 mov $0x0,%ecx return n; - 20b: eb f4 jmp 201 + 1ed: eb f2 jmp 1e1 -0000020d : +000001ef : void* memmove(void *vdst, const void *vsrc, int n) { - 20d: f3 0f 1e fb endbr32 - 211: 55 push %ebp - 212: 89 e5 mov %esp,%ebp - 214: 56 push %esi - 215: 53 push %ebx - 216: 8b 75 08 mov 0x8(%ebp),%esi - 219: 8b 55 0c mov 0xc(%ebp),%edx - 21c: 8b 5d 10 mov 0x10(%ebp),%ebx + 1ef: 55 push %ebp + 1f0: 89 e5 mov %esp,%ebp + 1f2: 56 push %esi + 1f3: 53 push %ebx + 1f4: 8b 75 08 mov 0x8(%ebp),%esi + 1f7: 8b 55 0c mov 0xc(%ebp),%edx + 1fa: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 21f: 85 db test %ebx,%ebx - 221: 7e 15 jle 238 - 223: 01 f3 add %esi,%ebx + 1fd: 85 db test %ebx,%ebx + 1ff: 7e 15 jle 216 + 201: 01 f3 add %esi,%ebx dst = vdst; - 225: 89 f0 mov %esi,%eax + 203: 89 f0 mov %esi,%eax *dst++ = *src++; - 227: 83 c2 01 add $0x1,%edx - 22a: 83 c0 01 add $0x1,%eax - 22d: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 231: 88 48 ff mov %cl,-0x1(%eax) + 205: 83 c2 01 add $0x1,%edx + 208: 83 c0 01 add $0x1,%eax + 20b: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 20f: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 234: 39 c3 cmp %eax,%ebx - 236: 75 ef jne 227 + 212: 39 c3 cmp %eax,%ebx + 214: 75 ef jne 205 return vdst; } - 238: 89 f0 mov %esi,%eax - 23a: 5b pop %ebx - 23b: 5e pop %esi - 23c: 5d pop %ebp - 23d: c3 ret + 216: 89 f0 mov %esi,%eax + 218: 5b pop %ebx + 219: 5e pop %esi + 21a: 5d pop %ebp + 21b: c3 ret -0000023e : +0000021c : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 23e: b8 01 00 00 00 mov $0x1,%eax - 243: cd 40 int $0x40 - 245: c3 ret + 21c: b8 01 00 00 00 mov $0x1,%eax + 221: cd 40 int $0x40 + 223: c3 ret -00000246 : +00000224 : SYSCALL(exit) - 246: b8 02 00 00 00 mov $0x2,%eax - 24b: cd 40 int $0x40 - 24d: c3 ret + 224: b8 02 00 00 00 mov $0x2,%eax + 229: cd 40 int $0x40 + 22b: c3 ret -0000024e : +0000022c : SYSCALL(wait) - 24e: b8 03 00 00 00 mov $0x3,%eax - 253: cd 40 int $0x40 - 255: c3 ret + 22c: b8 03 00 00 00 mov $0x3,%eax + 231: cd 40 int $0x40 + 233: c3 ret -00000256 : +00000234 : SYSCALL(pipe) - 256: b8 04 00 00 00 mov $0x4,%eax - 25b: cd 40 int $0x40 - 25d: c3 ret + 234: b8 04 00 00 00 mov $0x4,%eax + 239: cd 40 int $0x40 + 23b: c3 ret -0000025e : +0000023c : SYSCALL(read) - 25e: b8 05 00 00 00 mov $0x5,%eax - 263: cd 40 int $0x40 - 265: c3 ret + 23c: b8 05 00 00 00 mov $0x5,%eax + 241: cd 40 int $0x40 + 243: c3 ret -00000266 : +00000244 : SYSCALL(write) - 266: b8 10 00 00 00 mov $0x10,%eax - 26b: cd 40 int $0x40 - 26d: c3 ret + 244: b8 10 00 00 00 mov $0x10,%eax + 249: cd 40 int $0x40 + 24b: c3 ret -0000026e : +0000024c : SYSCALL(close) - 26e: b8 15 00 00 00 mov $0x15,%eax - 273: cd 40 int $0x40 - 275: c3 ret + 24c: b8 15 00 00 00 mov $0x15,%eax + 251: cd 40 int $0x40 + 253: c3 ret -00000276 : +00000254 : SYSCALL(kill) - 276: b8 06 00 00 00 mov $0x6,%eax - 27b: cd 40 int $0x40 - 27d: c3 ret + 254: b8 06 00 00 00 mov $0x6,%eax + 259: cd 40 int $0x40 + 25b: c3 ret -0000027e : +0000025c : SYSCALL(exec) - 27e: b8 07 00 00 00 mov $0x7,%eax - 283: cd 40 int $0x40 - 285: c3 ret + 25c: b8 07 00 00 00 mov $0x7,%eax + 261: cd 40 int $0x40 + 263: c3 ret -00000286 : +00000264 : SYSCALL(open) - 286: b8 0f 00 00 00 mov $0xf,%eax - 28b: cd 40 int $0x40 - 28d: c3 ret + 264: b8 0f 00 00 00 mov $0xf,%eax + 269: cd 40 int $0x40 + 26b: c3 ret -0000028e : +0000026c : SYSCALL(mknod) - 28e: b8 11 00 00 00 mov $0x11,%eax - 293: cd 40 int $0x40 - 295: c3 ret + 26c: b8 11 00 00 00 mov $0x11,%eax + 271: cd 40 int $0x40 + 273: c3 ret -00000296 : +00000274 : SYSCALL(unlink) - 296: b8 12 00 00 00 mov $0x12,%eax - 29b: cd 40 int $0x40 - 29d: c3 ret + 274: b8 12 00 00 00 mov $0x12,%eax + 279: cd 40 int $0x40 + 27b: c3 ret -0000029e : +0000027c : SYSCALL(fstat) - 29e: b8 08 00 00 00 mov $0x8,%eax - 2a3: cd 40 int $0x40 - 2a5: c3 ret + 27c: b8 08 00 00 00 mov $0x8,%eax + 281: cd 40 int $0x40 + 283: c3 ret -000002a6 : +00000284 : SYSCALL(link) - 2a6: b8 13 00 00 00 mov $0x13,%eax - 2ab: cd 40 int $0x40 - 2ad: c3 ret + 284: b8 13 00 00 00 mov $0x13,%eax + 289: cd 40 int $0x40 + 28b: c3 ret -000002ae : +0000028c : SYSCALL(mkdir) - 2ae: b8 14 00 00 00 mov $0x14,%eax - 2b3: cd 40 int $0x40 - 2b5: c3 ret + 28c: b8 14 00 00 00 mov $0x14,%eax + 291: cd 40 int $0x40 + 293: c3 ret -000002b6 : +00000294 : SYSCALL(chdir) - 2b6: b8 09 00 00 00 mov $0x9,%eax - 2bb: cd 40 int $0x40 - 2bd: c3 ret + 294: b8 09 00 00 00 mov $0x9,%eax + 299: cd 40 int $0x40 + 29b: c3 ret -000002be : +0000029c : SYSCALL(dup) - 2be: b8 0a 00 00 00 mov $0xa,%eax - 2c3: cd 40 int $0x40 - 2c5: c3 ret + 29c: b8 0a 00 00 00 mov $0xa,%eax + 2a1: cd 40 int $0x40 + 2a3: c3 ret -000002c6 : +000002a4 : SYSCALL(getpid) - 2c6: b8 0b 00 00 00 mov $0xb,%eax - 2cb: cd 40 int $0x40 - 2cd: c3 ret + 2a4: b8 0b 00 00 00 mov $0xb,%eax + 2a9: cd 40 int $0x40 + 2ab: c3 ret -000002ce : +000002ac : SYSCALL(sbrk) - 2ce: b8 0c 00 00 00 mov $0xc,%eax - 2d3: cd 40 int $0x40 - 2d5: c3 ret + 2ac: b8 0c 00 00 00 mov $0xc,%eax + 2b1: cd 40 int $0x40 + 2b3: c3 ret -000002d6 : +000002b4 : SYSCALL(sleep) - 2d6: b8 0d 00 00 00 mov $0xd,%eax - 2db: cd 40 int $0x40 - 2dd: c3 ret + 2b4: b8 0d 00 00 00 mov $0xd,%eax + 2b9: cd 40 int $0x40 + 2bb: c3 ret -000002de : +000002bc : SYSCALL(uptime) - 2de: b8 0e 00 00 00 mov $0xe,%eax - 2e3: cd 40 int $0x40 - 2e5: c3 ret + 2bc: b8 0e 00 00 00 mov $0xe,%eax + 2c1: cd 40 int $0x40 + 2c3: c3 ret -000002e6 : +000002c4 : SYSCALL(slabtest) - 2e6: b8 16 00 00 00 mov $0x16,%eax - 2eb: cd 40 int $0x40 - 2ed: c3 ret + 2c4: b8 16 00 00 00 mov $0x16,%eax + 2c9: cd 40 int $0x40 + 2cb: c3 ret -000002ee : +000002cc : SYSCALL(ps) - 2ee: b8 17 00 00 00 mov $0x17,%eax - 2f3: cd 40 int $0x40 - 2f5: c3 ret + 2cc: b8 17 00 00 00 mov $0x17,%eax + 2d1: cd 40 int $0x40 + 2d3: c3 ret -000002f6 : +000002d4 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 2f6: 55 push %ebp - 2f7: 89 e5 mov %esp,%ebp - 2f9: 57 push %edi - 2fa: 56 push %esi - 2fb: 53 push %ebx - 2fc: 83 ec 3c sub $0x3c,%esp - 2ff: 89 45 c4 mov %eax,-0x3c(%ebp) - 302: 89 d3 mov %edx,%ebx + 2d4: 55 push %ebp + 2d5: 89 e5 mov %esp,%ebp + 2d7: 57 push %edi + 2d8: 56 push %esi + 2d9: 53 push %ebx + 2da: 83 ec 3c sub $0x3c,%esp + 2dd: 89 45 c4 mov %eax,-0x3c(%ebp) + 2e0: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 304: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 308: 74 77 je 381 - 30a: 85 d2 test %edx,%edx - 30c: 79 73 jns 381 + 2e2: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 2e6: 74 79 je 361 + 2e8: 85 d2 test %edx,%edx + 2ea: 79 75 jns 361 neg = 1; x = -xx; - 30e: f7 db neg %ebx + 2ec: 89 d1 mov %edx,%ecx + 2ee: f7 d9 neg %ecx neg = 1; - 310: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 2f0: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 317: be 00 00 00 00 mov $0x0,%esi + 2f7: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 31c: 89 f7 mov %esi,%edi - 31e: 83 c6 01 add $0x1,%esi - 321: 89 d8 mov %ebx,%eax - 323: ba 00 00 00 00 mov $0x0,%edx - 328: f7 f1 div %ecx - 32a: 0f b6 92 d4 06 00 00 movzbl 0x6d4(%edx),%edx - 331: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 2fc: 89 df mov %ebx,%edi + 2fe: 83 c3 01 add $0x1,%ebx + 301: 89 c8 mov %ecx,%eax + 303: ba 00 00 00 00 mov $0x0,%edx + 308: f7 f6 div %esi + 30a: 0f b6 92 ec 06 00 00 movzbl 0x6ec(%edx),%edx + 311: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 335: 89 da mov %ebx,%edx - 337: 89 c3 mov %eax,%ebx - 339: 39 d1 cmp %edx,%ecx - 33b: 76 df jbe 31c + 315: 89 ca mov %ecx,%edx + 317: 89 c1 mov %eax,%ecx + 319: 39 d6 cmp %edx,%esi + 31b: 76 df jbe 2fc if(neg) - 33d: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 341: 74 08 je 34b + 31d: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 321: 74 08 je 32b buf[i++] = '-'; - 343: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 348: 8d 77 02 lea 0x2(%edi),%esi + 323: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 328: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 34b: 85 f6 test %esi,%esi - 34d: 7e 2a jle 379 - 34f: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 353: 8d 7d d8 lea -0x28(%ebp),%edi + 32b: 85 db test %ebx,%ebx + 32d: 7e 2a jle 359 + 32f: 8d 7d d8 lea -0x28(%ebp),%edi + 332: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 356: 8d 75 d7 lea -0x29(%ebp),%esi + 336: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 359: 0f b6 03 movzbl (%ebx),%eax - 35c: 88 45 d7 mov %al,-0x29(%ebp) + 339: 0f b6 03 movzbl (%ebx),%eax + 33c: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 35f: 83 ec 04 sub $0x4,%esp - 362: 6a 01 push $0x1 - 364: 56 push %esi - 365: ff 75 c4 pushl -0x3c(%ebp) - 368: e8 f9 fe ff ff call 266 + 33f: 83 ec 04 sub $0x4,%esp + 342: 6a 01 push $0x1 + 344: 56 push %esi + 345: ff 75 c4 push -0x3c(%ebp) + 348: e8 f7 fe ff ff call 244 while(--i >= 0) - 36d: 89 d8 mov %ebx,%eax - 36f: 83 eb 01 sub $0x1,%ebx - 372: 83 c4 10 add $0x10,%esp - 375: 39 f8 cmp %edi,%eax - 377: 75 e0 jne 359 + 34d: 89 d8 mov %ebx,%eax + 34f: 83 eb 01 sub $0x1,%ebx + 352: 83 c4 10 add $0x10,%esp + 355: 39 f8 cmp %edi,%eax + 357: 75 e0 jne 339 } - 379: 8d 65 f4 lea -0xc(%ebp),%esp - 37c: 5b pop %ebx - 37d: 5e pop %esi - 37e: 5f pop %edi - 37f: 5d pop %ebp - 380: c3 ret + 359: 8d 65 f4 lea -0xc(%ebp),%esp + 35c: 5b pop %ebx + 35d: 5e pop %esi + 35e: 5f pop %edi + 35f: 5d pop %ebp + 360: c3 ret + x = xx; + 361: 89 d1 mov %edx,%ecx neg = 0; - 381: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 388: eb 8d jmp 317 + 363: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 36a: eb 8b jmp 2f7 -0000038a : +0000036c : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 38a: f3 0f 1e fb endbr32 - 38e: 55 push %ebp - 38f: 89 e5 mov %esp,%ebp - 391: 57 push %edi - 392: 56 push %esi - 393: 53 push %ebx - 394: 83 ec 2c sub $0x2c,%esp + 36c: 55 push %ebp + 36d: 89 e5 mov %esp,%ebp + 36f: 57 push %edi + 370: 56 push %esi + 371: 53 push %ebx + 372: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 397: 8b 75 0c mov 0xc(%ebp),%esi - 39a: 0f b6 1e movzbl (%esi),%ebx - 39d: 84 db test %bl,%bl - 39f: 0f 84 ab 01 00 00 je 550 - 3a5: 83 c6 01 add $0x1,%esi + 375: 8b 75 0c mov 0xc(%ebp),%esi + 378: 0f b6 1e movzbl (%esi),%ebx + 37b: 84 db test %bl,%bl + 37d: 0f 84 9f 01 00 00 je 522 + 383: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 3a8: 8d 45 10 lea 0x10(%ebp),%eax - 3ab: 89 45 d4 mov %eax,-0x2c(%ebp) + 386: 8d 45 10 lea 0x10(%ebp),%eax + 389: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 3ae: bf 00 00 00 00 mov $0x0,%edi - 3b3: eb 2d jmp 3e2 + 38c: bf 00 00 00 00 mov $0x0,%edi + 391: eb 2d jmp 3c0 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 3b5: 88 5d e7 mov %bl,-0x19(%ebp) + 393: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3b8: 83 ec 04 sub $0x4,%esp - 3bb: 6a 01 push $0x1 - 3bd: 8d 45 e7 lea -0x19(%ebp),%eax - 3c0: 50 push %eax - 3c1: ff 75 08 pushl 0x8(%ebp) - 3c4: e8 9d fe ff ff call 266 + 396: 83 ec 04 sub $0x4,%esp + 399: 6a 01 push $0x1 + 39b: 8d 45 e7 lea -0x19(%ebp),%eax + 39e: 50 push %eax + 39f: ff 75 08 push 0x8(%ebp) + 3a2: e8 9d fe ff ff call 244 putc(fd, c); - 3c9: 83 c4 10 add $0x10,%esp - 3cc: eb 05 jmp 3d3 + 3a7: 83 c4 10 add $0x10,%esp + 3aa: eb 05 jmp 3b1 } } else if(state == '%'){ - 3ce: 83 ff 25 cmp $0x25,%edi - 3d1: 74 22 je 3f5 + 3ac: 83 ff 25 cmp $0x25,%edi + 3af: 74 1f je 3d0 for(i = 0; fmt[i]; i++){ - 3d3: 83 c6 01 add $0x1,%esi - 3d6: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3da: 84 db test %bl,%bl - 3dc: 0f 84 6e 01 00 00 je 550 + 3b1: 83 c6 01 add $0x1,%esi + 3b4: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 3b8: 84 db test %bl,%bl + 3ba: 0f 84 62 01 00 00 je 522 c = fmt[i] & 0xff; - 3e2: 0f be d3 movsbl %bl,%edx - 3e5: 0f b6 c3 movzbl %bl,%eax + 3c0: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 3e8: 85 ff test %edi,%edi - 3ea: 75 e2 jne 3ce + 3c3: 85 ff test %edi,%edi + 3c5: 75 e5 jne 3ac if(c == '%'){ - 3ec: 83 f8 25 cmp $0x25,%eax - 3ef: 75 c4 jne 3b5 + 3c7: 83 f8 25 cmp $0x25,%eax + 3ca: 75 c7 jne 393 state = '%'; - 3f1: 89 c7 mov %eax,%edi - 3f3: eb de jmp 3d3 + 3cc: 89 c7 mov %eax,%edi + 3ce: eb e1 jmp 3b1 if(c == 'd'){ - 3f5: 83 f8 64 cmp $0x64,%eax - 3f8: 74 59 je 453 + 3d0: 83 f8 25 cmp $0x25,%eax + 3d3: 0f 84 f2 00 00 00 je 4cb + 3d9: 8d 50 9d lea -0x63(%eax),%edx + 3dc: 83 fa 15 cmp $0x15,%edx + 3df: 0f 87 07 01 00 00 ja 4ec + 3e5: 0f 87 01 01 00 00 ja 4ec + 3eb: ff 24 95 94 06 00 00 jmp *0x694(,%edx,4) printint(fd, *ap, 10, 1); + 3f2: 83 ec 0c sub $0xc,%esp + 3f5: 6a 01 push $0x1 + 3f7: b9 0a 00 00 00 mov $0xa,%ecx + 3fc: 8b 7d d4 mov -0x2c(%ebp),%edi + 3ff: 8b 17 mov (%edi),%edx + 401: 8b 45 08 mov 0x8(%ebp),%eax + 404: e8 cb fe ff ff call 2d4 ap++; - } else if(c == 'x' || c == 'p'){ - 3fa: 81 e2 f7 00 00 00 and $0xf7,%edx - 400: 83 fa 70 cmp $0x70,%edx - 403: 74 7a je 47f - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 405: 83 f8 73 cmp $0x73,%eax - 408: 0f 84 9d 00 00 00 je 4ab - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 40e: 83 f8 63 cmp $0x63,%eax - 411: 0f 84 ec 00 00 00 je 503 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 417: 83 f8 25 cmp $0x25,%eax - 41a: 0f 84 0f 01 00 00 je 52f - putc(fd, c); + 409: 89 f8 mov %edi,%eax + 40b: 83 c0 04 add $0x4,%eax + 40e: 89 45 d4 mov %eax,-0x2c(%ebp) + 411: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 420: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 424: 83 ec 04 sub $0x4,%esp - 427: 6a 01 push $0x1 - 429: 8d 45 e7 lea -0x19(%ebp),%eax - 42c: 50 push %eax - 42d: ff 75 08 pushl 0x8(%ebp) - 430: e8 31 fe ff ff call 266 putc(fd, c); - 435: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 438: 83 c4 0c add $0xc,%esp - 43b: 6a 01 push $0x1 - 43d: 8d 45 e7 lea -0x19(%ebp),%eax - 440: 50 push %eax - 441: ff 75 08 pushl 0x8(%ebp) - 444: e8 1d fe ff ff call 266 - putc(fd, c); - 449: 83 c4 10 add $0x10,%esp } state = 0; - 44c: bf 00 00 00 00 mov $0x0,%edi - 451: eb 80 jmp 3d3 - printint(fd, *ap, 10, 1); - 453: 83 ec 0c sub $0xc,%esp - 456: 6a 01 push $0x1 - 458: b9 0a 00 00 00 mov $0xa,%ecx - 45d: 8b 7d d4 mov -0x2c(%ebp),%edi - 460: 8b 17 mov (%edi),%edx - 462: 8b 45 08 mov 0x8(%ebp),%eax - 465: e8 8c fe ff ff call 2f6 - ap++; - 46a: 89 f8 mov %edi,%eax - 46c: 83 c0 04 add $0x4,%eax - 46f: 89 45 d4 mov %eax,-0x2c(%ebp) - 472: 83 c4 10 add $0x10,%esp - state = 0; - 475: bf 00 00 00 00 mov $0x0,%edi - 47a: e9 54 ff ff ff jmp 3d3 + 414: bf 00 00 00 00 mov $0x0,%edi + 419: eb 96 jmp 3b1 printint(fd, *ap, 16, 0); - 47f: 83 ec 0c sub $0xc,%esp - 482: 6a 00 push $0x0 - 484: b9 10 00 00 00 mov $0x10,%ecx - 489: 8b 7d d4 mov -0x2c(%ebp),%edi - 48c: 8b 17 mov (%edi),%edx - 48e: 8b 45 08 mov 0x8(%ebp),%eax - 491: e8 60 fe ff ff call 2f6 + 41b: 83 ec 0c sub $0xc,%esp + 41e: 6a 00 push $0x0 + 420: b9 10 00 00 00 mov $0x10,%ecx + 425: 8b 7d d4 mov -0x2c(%ebp),%edi + 428: 8b 17 mov (%edi),%edx + 42a: 8b 45 08 mov 0x8(%ebp),%eax + 42d: e8 a2 fe ff ff call 2d4 ap++; - 496: 89 f8 mov %edi,%eax - 498: 83 c0 04 add $0x4,%eax - 49b: 89 45 d4 mov %eax,-0x2c(%ebp) - 49e: 83 c4 10 add $0x10,%esp + 432: 89 f8 mov %edi,%eax + 434: 83 c0 04 add $0x4,%eax + 437: 89 45 d4 mov %eax,-0x2c(%ebp) + 43a: 83 c4 10 add $0x10,%esp state = 0; - 4a1: bf 00 00 00 00 mov $0x0,%edi - 4a6: e9 28 ff ff ff jmp 3d3 + 43d: bf 00 00 00 00 mov $0x0,%edi + 442: e9 6a ff ff ff jmp 3b1 s = (char*)*ap; - 4ab: 8b 4d d4 mov -0x2c(%ebp),%ecx - 4ae: 8b 01 mov (%ecx),%eax + 447: 8b 4d d4 mov -0x2c(%ebp),%ecx + 44a: 8b 01 mov (%ecx),%eax ap++; - 4b0: 83 c1 04 add $0x4,%ecx - 4b3: 89 4d d4 mov %ecx,-0x2c(%ebp) + 44c: 83 c1 04 add $0x4,%ecx + 44f: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 4b6: 85 c0 test %eax,%eax - 4b8: 74 13 je 4cd + 452: 85 c0 test %eax,%eax + 454: 74 13 je 469 s = (char*)*ap; - 4ba: 89 c3 mov %eax,%ebx + 456: 89 c3 mov %eax,%ebx while(*s != 0){ - 4bc: 0f b6 00 movzbl (%eax),%eax + 458: 0f b6 00 movzbl (%eax),%eax state = 0; - 4bf: bf 00 00 00 00 mov $0x0,%edi + 45b: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 4c4: 84 c0 test %al,%al - 4c6: 75 0f jne 4d7 - 4c8: e9 06 ff ff ff jmp 3d3 + 460: 84 c0 test %al,%al + 462: 75 0f jne 473 + 464: e9 48 ff ff ff jmp 3b1 s = "(null)"; - 4cd: bb cb 06 00 00 mov $0x6cb,%ebx + 469: bb 8b 06 00 00 mov $0x68b,%ebx while(*s != 0){ - 4d2: b8 28 00 00 00 mov $0x28,%eax - 4d7: 8b 7d 08 mov 0x8(%ebp),%edi + 46e: b8 28 00 00 00 mov $0x28,%eax + 473: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4da: 88 45 e7 mov %al,-0x19(%ebp) + 476: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4dd: 83 ec 04 sub $0x4,%esp - 4e0: 6a 01 push $0x1 - 4e2: 8d 45 e7 lea -0x19(%ebp),%eax - 4e5: 50 push %eax - 4e6: 57 push %edi - 4e7: e8 7a fd ff ff call 266 + 479: 83 ec 04 sub $0x4,%esp + 47c: 6a 01 push $0x1 + 47e: 8d 45 e7 lea -0x19(%ebp),%eax + 481: 50 push %eax + 482: 57 push %edi + 483: e8 bc fd ff ff call 244 s++; - 4ec: 83 c3 01 add $0x1,%ebx + 488: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 4ef: 0f b6 03 movzbl (%ebx),%eax - 4f2: 83 c4 10 add $0x10,%esp - 4f5: 84 c0 test %al,%al - 4f7: 75 e1 jne 4da + 48b: 0f b6 03 movzbl (%ebx),%eax + 48e: 83 c4 10 add $0x10,%esp + 491: 84 c0 test %al,%al + 493: 75 e1 jne 476 state = 0; - 4f9: bf 00 00 00 00 mov $0x0,%edi - 4fe: e9 d0 fe ff ff jmp 3d3 + 495: bf 00 00 00 00 mov $0x0,%edi + 49a: e9 12 ff ff ff jmp 3b1 putc(fd, *ap); - 503: 8b 7d d4 mov -0x2c(%ebp),%edi - 506: 8b 07 mov (%edi),%eax - 508: 88 45 e7 mov %al,-0x19(%ebp) + 49f: 8b 7d d4 mov -0x2c(%ebp),%edi + 4a2: 8b 07 mov (%edi),%eax + 4a4: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 50b: 83 ec 04 sub $0x4,%esp - 50e: 6a 01 push $0x1 - 510: 8d 45 e7 lea -0x19(%ebp),%eax - 513: 50 push %eax - 514: ff 75 08 pushl 0x8(%ebp) - 517: e8 4a fd ff ff call 266 + 4a7: 83 ec 04 sub $0x4,%esp + 4aa: 6a 01 push $0x1 + 4ac: 8d 45 e7 lea -0x19(%ebp),%eax + 4af: 50 push %eax + 4b0: ff 75 08 push 0x8(%ebp) + 4b3: e8 8c fd ff ff call 244 ap++; - 51c: 83 c7 04 add $0x4,%edi - 51f: 89 7d d4 mov %edi,-0x2c(%ebp) - 522: 83 c4 10 add $0x10,%esp + 4b8: 83 c7 04 add $0x4,%edi + 4bb: 89 7d d4 mov %edi,-0x2c(%ebp) + 4be: 83 c4 10 add $0x10,%esp state = 0; - 525: bf 00 00 00 00 mov $0x0,%edi - 52a: e9 a4 fe ff ff jmp 3d3 + 4c1: bf 00 00 00 00 mov $0x0,%edi + 4c6: e9 e6 fe ff ff jmp 3b1 putc(fd, c); - 52f: 88 5d e7 mov %bl,-0x19(%ebp) + 4cb: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 532: 83 ec 04 sub $0x4,%esp - 535: 6a 01 push $0x1 - 537: 8d 45 e7 lea -0x19(%ebp),%eax - 53a: 50 push %eax - 53b: ff 75 08 pushl 0x8(%ebp) - 53e: e8 23 fd ff ff call 266 - 543: 83 c4 10 add $0x10,%esp + 4ce: 83 ec 04 sub $0x4,%esp + 4d1: 6a 01 push $0x1 + 4d3: 8d 45 e7 lea -0x19(%ebp),%eax + 4d6: 50 push %eax + 4d7: ff 75 08 push 0x8(%ebp) + 4da: e8 65 fd ff ff call 244 + 4df: 83 c4 10 add $0x10,%esp + state = 0; + 4e2: bf 00 00 00 00 mov $0x0,%edi + 4e7: e9 c5 fe ff ff jmp 3b1 + putc(fd, '%'); + 4ec: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 4f0: 83 ec 04 sub $0x4,%esp + 4f3: 6a 01 push $0x1 + 4f5: 8d 45 e7 lea -0x19(%ebp),%eax + 4f8: 50 push %eax + 4f9: ff 75 08 push 0x8(%ebp) + 4fc: e8 43 fd ff ff call 244 + putc(fd, c); + 501: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 504: 83 c4 0c add $0xc,%esp + 507: 6a 01 push $0x1 + 509: 8d 45 e7 lea -0x19(%ebp),%eax + 50c: 50 push %eax + 50d: ff 75 08 push 0x8(%ebp) + 510: e8 2f fd ff ff call 244 + putc(fd, c); + 515: 83 c4 10 add $0x10,%esp state = 0; - 546: bf 00 00 00 00 mov $0x0,%edi - 54b: e9 83 fe ff ff jmp 3d3 + 518: bf 00 00 00 00 mov $0x0,%edi + 51d: e9 8f fe ff ff jmp 3b1 } } } - 550: 8d 65 f4 lea -0xc(%ebp),%esp - 553: 5b pop %ebx - 554: 5e pop %esi - 555: 5f pop %edi - 556: 5d pop %ebp - 557: c3 ret - -00000558 : + 522: 8d 65 f4 lea -0xc(%ebp),%esp + 525: 5b pop %ebx + 526: 5e pop %esi + 527: 5f pop %edi + 528: 5d pop %ebp + 529: c3 ret + +0000052a : static Header base; static Header *freep; void free(void *ap) { - 558: f3 0f 1e fb endbr32 - 55c: 55 push %ebp - 55d: 89 e5 mov %esp,%ebp - 55f: 57 push %edi - 560: 56 push %esi - 561: 53 push %ebx - 562: 8b 5d 08 mov 0x8(%ebp),%ebx + 52a: 55 push %ebp + 52b: 89 e5 mov %esp,%ebp + 52d: 57 push %edi + 52e: 56 push %esi + 52f: 53 push %ebx + 530: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 565: 8d 4b f8 lea -0x8(%ebx),%ecx + 533: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 568: a1 40 09 00 00 mov 0x940,%eax - 56d: eb 0c jmp 57b + 536: a1 58 09 00 00 mov 0x958,%eax + 53b: eb 0c jmp 549 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 56f: 8b 10 mov (%eax),%edx - 571: 39 c2 cmp %eax,%edx - 573: 77 04 ja 579 - 575: 39 ca cmp %ecx,%edx - 577: 77 10 ja 589 + 53d: 8b 10 mov (%eax),%edx + 53f: 39 c2 cmp %eax,%edx + 541: 77 04 ja 547 + 543: 39 ca cmp %ecx,%edx + 545: 77 10 ja 557 { - 579: 89 d0 mov %edx,%eax + 547: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 57b: 39 c8 cmp %ecx,%eax - 57d: 73 f0 jae 56f - 57f: 8b 10 mov (%eax),%edx - 581: 39 ca cmp %ecx,%edx - 583: 77 04 ja 589 + 549: 39 c8 cmp %ecx,%eax + 54b: 73 f0 jae 53d + 54d: 8b 10 mov (%eax),%edx + 54f: 39 ca cmp %ecx,%edx + 551: 77 04 ja 557 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 585: 39 c2 cmp %eax,%edx - 587: 77 f0 ja 579 + 553: 39 c2 cmp %eax,%edx + 555: 77 f0 ja 547 break; if(bp + bp->s.size == p->s.ptr){ - 589: 8b 73 fc mov -0x4(%ebx),%esi - 58c: 8b 10 mov (%eax),%edx - 58e: 8d 3c f1 lea (%ecx,%esi,8),%edi - 591: 39 fa cmp %edi,%edx - 593: 74 19 je 5ae + 557: 8b 73 fc mov -0x4(%ebx),%esi + 55a: 8b 10 mov (%eax),%edx + 55c: 8d 3c f1 lea (%ecx,%esi,8),%edi + 55f: 39 fa cmp %edi,%edx + 561: 74 19 je 57c bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 563: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 595: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 598: 8b 50 04 mov 0x4(%eax),%edx - 59b: 8d 34 d0 lea (%eax,%edx,8),%esi - 59e: 39 f1 cmp %esi,%ecx - 5a0: 74 1b je 5bd + 566: 8b 50 04 mov 0x4(%eax),%edx + 569: 8d 34 d0 lea (%eax,%edx,8),%esi + 56c: 39 f1 cmp %esi,%ecx + 56e: 74 18 je 588 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 570: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 5a2: 89 08 mov %ecx,(%eax) freep = p; - 5a4: a3 40 09 00 00 mov %eax,0x940 + 572: a3 58 09 00 00 mov %eax,0x958 } - 5a9: 5b pop %ebx - 5aa: 5e pop %esi - 5ab: 5f pop %edi - 5ac: 5d pop %ebp - 5ad: c3 ret + 577: 5b pop %ebx + 578: 5e pop %esi + 579: 5f pop %edi + 57a: 5d pop %ebp + 57b: c3 ret bp->s.size += p->s.ptr->s.size; - 5ae: 03 72 04 add 0x4(%edx),%esi - 5b1: 89 73 fc mov %esi,-0x4(%ebx) + 57c: 03 72 04 add 0x4(%edx),%esi + 57f: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 5b4: 8b 10 mov (%eax),%edx - 5b6: 8b 12 mov (%edx),%edx - 5b8: 89 53 f8 mov %edx,-0x8(%ebx) - 5bb: eb db jmp 598 + 582: 8b 10 mov (%eax),%edx + 584: 8b 12 mov (%edx),%edx + 586: eb db jmp 563 p->s.size += bp->s.size; - 5bd: 03 53 fc add -0x4(%ebx),%edx - 5c0: 89 50 04 mov %edx,0x4(%eax) + 588: 03 53 fc add -0x4(%ebx),%edx + 58b: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 5c3: 8b 53 f8 mov -0x8(%ebx),%edx - 5c6: 89 10 mov %edx,(%eax) - 5c8: eb da jmp 5a4 + 58e: 8b 4b f8 mov -0x8(%ebx),%ecx + 591: eb dd jmp 570 -000005ca : +00000593 : return freep; } void* malloc(uint nbytes) { - 5ca: f3 0f 1e fb endbr32 - 5ce: 55 push %ebp - 5cf: 89 e5 mov %esp,%ebp - 5d1: 57 push %edi - 5d2: 56 push %esi - 5d3: 53 push %ebx - 5d4: 83 ec 0c sub $0xc,%esp + 593: 55 push %ebp + 594: 89 e5 mov %esp,%ebp + 596: 57 push %edi + 597: 56 push %esi + 598: 53 push %ebx + 599: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5d7: 8b 45 08 mov 0x8(%ebp),%eax - 5da: 8d 58 07 lea 0x7(%eax),%ebx - 5dd: c1 eb 03 shr $0x3,%ebx - 5e0: 83 c3 01 add $0x1,%ebx + 59c: 8b 45 08 mov 0x8(%ebp),%eax + 59f: 8d 58 07 lea 0x7(%eax),%ebx + 5a2: c1 eb 03 shr $0x3,%ebx + 5a5: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5e3: 8b 15 40 09 00 00 mov 0x940,%edx - 5e9: 85 d2 test %edx,%edx - 5eb: 74 20 je 60d + 5a8: 8b 15 58 09 00 00 mov 0x958,%edx + 5ae: 85 d2 test %edx,%edx + 5b0: 74 1c je 5ce base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5ed: 8b 02 mov (%edx),%eax + 5b2: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 5ef: 8b 48 04 mov 0x4(%eax),%ecx - 5f2: 39 cb cmp %ecx,%ebx - 5f4: 76 3c jbe 632 - 5f6: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 5fc: be 00 10 00 00 mov $0x1000,%esi - 601: 0f 43 f3 cmovae %ebx,%esi + 5b4: 8b 48 04 mov 0x4(%eax),%ecx + 5b7: 39 cb cmp %ecx,%ebx + 5b9: 76 38 jbe 5f3 + 5bb: be 00 10 00 00 mov $0x1000,%esi + 5c0: 39 f3 cmp %esi,%ebx + 5c2: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 604: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 60b: eb 72 jmp 67f + 5c5: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 5cc: eb 72 jmp 640 base.s.ptr = freep = prevp = &base; - 60d: c7 05 40 09 00 00 44 movl $0x944,0x940 - 614: 09 00 00 - 617: c7 05 44 09 00 00 44 movl $0x944,0x944 - 61e: 09 00 00 + 5ce: c7 05 58 09 00 00 5c movl $0x95c,0x958 + 5d5: 09 00 00 + 5d8: c7 05 5c 09 00 00 5c movl $0x95c,0x95c + 5df: 09 00 00 base.s.size = 0; - 621: c7 05 48 09 00 00 00 movl $0x0,0x948 - 628: 00 00 00 + 5e2: c7 05 60 09 00 00 00 movl $0x0,0x960 + 5e9: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 62b: b8 44 09 00 00 mov $0x944,%eax - 630: eb c4 jmp 5f6 + 5ec: b8 5c 09 00 00 mov $0x95c,%eax + 5f1: eb c8 jmp 5bb if(p->s.size == nunits) - 632: 39 cb cmp %ecx,%ebx - 634: 74 1e je 654 + 5f3: 39 cb cmp %ecx,%ebx + 5f5: 74 1e je 615 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 636: 29 d9 sub %ebx,%ecx - 638: 89 48 04 mov %ecx,0x4(%eax) + 5f7: 29 d9 sub %ebx,%ecx + 5f9: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 63b: 8d 04 c8 lea (%eax,%ecx,8),%eax + 5fc: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 63e: 89 58 04 mov %ebx,0x4(%eax) + 5ff: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 641: 89 15 40 09 00 00 mov %edx,0x940 + 602: 89 15 58 09 00 00 mov %edx,0x958 return (void*)(p + 1); - 647: 8d 50 08 lea 0x8(%eax),%edx + 608: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 64a: 89 d0 mov %edx,%eax - 64c: 8d 65 f4 lea -0xc(%ebp),%esp - 64f: 5b pop %ebx - 650: 5e pop %esi - 651: 5f pop %edi - 652: 5d pop %ebp - 653: c3 ret + 60b: 89 d0 mov %edx,%eax + 60d: 8d 65 f4 lea -0xc(%ebp),%esp + 610: 5b pop %ebx + 611: 5e pop %esi + 612: 5f pop %edi + 613: 5d pop %ebp + 614: c3 ret prevp->s.ptr = p->s.ptr; - 654: 8b 08 mov (%eax),%ecx - 656: 89 0a mov %ecx,(%edx) - 658: eb e7 jmp 641 + 615: 8b 08 mov (%eax),%ecx + 617: 89 0a mov %ecx,(%edx) + 619: eb e7 jmp 602 hp->s.size = nu; - 65a: 89 70 04 mov %esi,0x4(%eax) + 61b: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 65d: 83 ec 0c sub $0xc,%esp - 660: 83 c0 08 add $0x8,%eax - 663: 50 push %eax - 664: e8 ef fe ff ff call 558 + 61e: 83 ec 0c sub $0xc,%esp + 621: 83 c0 08 add $0x8,%eax + 624: 50 push %eax + 625: e8 00 ff ff ff call 52a return freep; - 669: 8b 15 40 09 00 00 mov 0x940,%edx + 62a: 8b 15 58 09 00 00 mov 0x958,%edx if((p = morecore(nunits)) == 0) - 66f: 83 c4 10 add $0x10,%esp - 672: 85 d2 test %edx,%edx - 674: 74 d4 je 64a + 630: 83 c4 10 add $0x10,%esp + 633: 85 d2 test %edx,%edx + 635: 74 d4 je 60b for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 676: 8b 02 mov (%edx),%eax + 637: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 678: 8b 48 04 mov 0x4(%eax),%ecx - 67b: 39 d9 cmp %ebx,%ecx - 67d: 73 b3 jae 632 + 639: 8b 48 04 mov 0x4(%eax),%ecx + 63c: 39 d9 cmp %ebx,%ecx + 63e: 73 b3 jae 5f3 if(p == freep) - 67f: 89 c2 mov %eax,%edx - 681: 39 05 40 09 00 00 cmp %eax,0x940 - 687: 75 ed jne 676 + 640: 89 c2 mov %eax,%edx + 642: 39 05 58 09 00 00 cmp %eax,0x958 + 648: 75 ed jne 637 p = sbrk(nu * sizeof(Header)); - 689: 83 ec 0c sub $0xc,%esp - 68c: 57 push %edi - 68d: e8 3c fc ff ff call 2ce + 64a: 83 ec 0c sub $0xc,%esp + 64d: 57 push %edi + 64e: e8 59 fc ff ff call 2ac if(p == (char*)-1) - 692: 83 c4 10 add $0x10,%esp - 695: 83 f8 ff cmp $0xffffffff,%eax - 698: 75 c0 jne 65a + 653: 83 c4 10 add $0x10,%esp + 656: 83 f8 ff cmp $0xffffffff,%eax + 659: 75 c0 jne 61b return 0; - 69a: ba 00 00 00 00 mov $0x0,%edx - 69f: eb a9 jmp 64a + 65b: ba 00 00 00 00 mov $0x0,%edx + 660: eb a9 jmp 60b diff --git a/src/user/ln.d b/src/user/ln.d new file mode 100644 index 0000000..a6dabde --- /dev/null +++ b/src/user/ln.d @@ -0,0 +1 @@ +user/ln.o: user/ln.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/ln.o b/src/user/ln.o new file mode 100644 index 0000000..e965723 Binary files /dev/null and b/src/user/ln.o differ diff --git a/src/user/ln.sym b/src/user/ln.sym index 2b3f57e..e7ff64e 100644 --- a/src/user/ln.sym +++ b/src/user/ln.sym @@ -1,59 +1,47 @@ -00000000 .text -000006a4 .rodata -000006e8 .eh_frame -00000940 .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 -000002f6 printint -000006d4 digits.1089 +000002d4 printint +000006ec digits.0 00000000 umalloc.c -00000940 freep -00000944 base -00000060 strcpy -0000038a printf -0000020d memmove -0000028e mknod -000002ee ps -0000012b gets -000002c6 getpid -000005ca malloc -000002d6 sleep -00000256 pipe -000002e6 slabtest -00000266 write -0000029e fstat -00000276 kill -000002b6 chdir -0000027e exec -0000024e wait -0000025e read -00000296 unlink -0000023e fork -000002ce sbrk -000002de uptime -00000940 __bss_start -000000df memset +00000958 freep +0000095c base +0000005c strcpy +0000036c printf +000001ef memmove +0000026c mknod +000002cc ps +00000117 gets +000002a4 getpid +00000593 malloc +000002b4 sleep +00000234 pipe +000002c4 slabtest +00000244 write +0000027c fstat +00000254 kill +00000294 chdir +0000025c exec +0000022c wait +0000023c read +00000274 unlink +0000021c fork +000002ac sbrk +000002bc uptime +00000958 __bss_start +000000d1 memset 00000000 main -00000086 strcmp -000002be dup -00000186 stat -00000940 _edata -0000094c _end -000002a6 link -00000246 exit -000001ce atoi -000000b5 strlen -00000286 open -000000fa strchr -000002ae mkdir -0000026e close -00000558 free +00000080 strcmp +0000029c dup +0000016e stat +00000958 _edata +00000964 _end +00000284 link +00000224 exit +000001b2 atoi +000000ab strlen +00000264 open +000000ea strchr +0000028c mkdir +0000024c close +0000052a free diff --git a/src/user/ls.asm b/src/user/ls.asm index ef9f6d9..edc2d36 100644 --- a/src/user/ls.asm +++ b/src/user/ls.asm @@ -11,1341 +11,1308 @@ Disassembly of section .text: char* fmtname(char *path) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 56 push %esi - 8: 53 push %ebx - 9: 8b 5d 08 mov 0x8(%ebp),%ebx + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 56 push %esi + 4: 53 push %ebx + 5: 8b 5d 08 mov 0x8(%ebp),%ebx static char buf[DIRSIZ+1]; char *p; // Find first character after last slash. for(p=path+strlen(path); p >= path && *p != '/'; p--) - c: 83 ec 0c sub $0xc,%esp - f: 53 push %ebx - 10: e8 1e 03 00 00 call 333 - 15: 83 c4 10 add $0x10,%esp - 18: 01 d8 add %ebx,%eax - 1a: 72 0c jb 28 - 1c: 80 38 2f cmpb $0x2f,(%eax) - 1f: 74 07 je 28 - 21: 83 e8 01 sub $0x1,%eax - 24: 39 c3 cmp %eax,%ebx - 26: 76 f4 jbe 1c + 8: 83 ec 0c sub $0xc,%esp + b: 53 push %ebx + c: e8 11 03 00 00 call 322 + 11: 83 c4 10 add $0x10,%esp + 14: 01 d8 add %ebx,%eax + 16: 72 0c jb 24 + 18: 80 38 2f cmpb $0x2f,(%eax) + 1b: 74 07 je 24 + 1d: 83 e8 01 sub $0x1,%eax + 20: 39 c3 cmp %eax,%ebx + 22: 76 f4 jbe 18 ; p++; - 28: 8d 58 01 lea 0x1(%eax),%ebx + 24: 8d 58 01 lea 0x1(%eax),%ebx // Return blank-padded name. if(strlen(p) >= DIRSIZ) - 2b: 83 ec 0c sub $0xc,%esp - 2e: 53 push %ebx - 2f: e8 ff 02 00 00 call 333 - 34: 83 c4 10 add $0x10,%esp - 37: 83 f8 0d cmp $0xd,%eax - 3a: 76 09 jbe 45 + 27: 83 ec 0c sub $0xc,%esp + 2a: 53 push %ebx + 2b: e8 f2 02 00 00 call 322 + 30: 83 c4 10 add $0x10,%esp + 33: 83 f8 0d cmp $0xd,%eax + 36: 76 09 jbe 41 return p; memmove(buf, p, strlen(p)); memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); return buf; } - 3c: 89 d8 mov %ebx,%eax - 3e: 8d 65 f8 lea -0x8(%ebp),%esp - 41: 5b pop %ebx - 42: 5e pop %esi - 43: 5d pop %ebp - 44: c3 ret + 38: 89 d8 mov %ebx,%eax + 3a: 8d 65 f8 lea -0x8(%ebp),%esp + 3d: 5b pop %ebx + 3e: 5e pop %esi + 3f: 5d pop %ebp + 40: c3 ret memmove(buf, p, strlen(p)); - 45: 83 ec 0c sub $0xc,%esp - 48: 53 push %ebx - 49: e8 e5 02 00 00 call 333 - 4e: 83 c4 0c add $0xc,%esp - 51: 50 push %eax - 52: 53 push %ebx - 53: 68 40 0c 00 00 push $0xc40 - 58: e8 2e 04 00 00 call 48b + 41: 83 ec 0c sub $0xc,%esp + 44: 53 push %ebx + 45: e8 d8 02 00 00 call 322 + 4a: 83 c4 0c add $0xc,%esp + 4d: 50 push %eax + 4e: 53 push %ebx + 4f: 68 58 0c 00 00 push $0xc58 + 54: e8 0d 04 00 00 call 466 memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); - 5d: 89 1c 24 mov %ebx,(%esp) - 60: e8 ce 02 00 00 call 333 - 65: 89 c6 mov %eax,%esi - 67: 89 1c 24 mov %ebx,(%esp) - 6a: e8 c4 02 00 00 call 333 - 6f: 83 c4 0c add $0xc,%esp - 72: ba 0e 00 00 00 mov $0xe,%edx - 77: 29 f2 sub %esi,%edx - 79: 52 push %edx - 7a: 6a 20 push $0x20 - 7c: 05 40 0c 00 00 add $0xc40,%eax - 81: 50 push %eax - 82: e8 d6 02 00 00 call 35d + 59: 89 1c 24 mov %ebx,(%esp) + 5c: e8 c1 02 00 00 call 322 + 61: 89 c6 mov %eax,%esi + 63: 89 1c 24 mov %ebx,(%esp) + 66: e8 b7 02 00 00 call 322 + 6b: 83 c4 0c add $0xc,%esp + 6e: ba 0e 00 00 00 mov $0xe,%edx + 73: 29 f2 sub %esi,%edx + 75: 52 push %edx + 76: 6a 20 push $0x20 + 78: 05 58 0c 00 00 add $0xc58,%eax + 7d: 50 push %eax + 7e: e8 c5 02 00 00 call 348 return buf; - 87: 83 c4 10 add $0x10,%esp - 8a: bb 40 0c 00 00 mov $0xc40,%ebx - 8f: eb ab jmp 3c + 83: 83 c4 10 add $0x10,%esp + 86: bb 58 0c 00 00 mov $0xc58,%ebx + 8b: eb ab jmp 38 -00000091 : +0000008d : void ls(char *path) { - 91: f3 0f 1e fb endbr32 - 95: 55 push %ebp - 96: 89 e5 mov %esp,%ebp - 98: 57 push %edi - 99: 56 push %esi - 9a: 53 push %ebx - 9b: 81 ec 54 02 00 00 sub $0x254,%esp - a1: 8b 5d 08 mov 0x8(%ebp),%ebx + 8d: 55 push %ebp + 8e: 89 e5 mov %esp,%ebp + 90: 57 push %edi + 91: 56 push %esi + 92: 53 push %ebx + 93: 81 ec 54 02 00 00 sub $0x254,%esp + 99: 8b 5d 08 mov 0x8(%ebp),%ebx char buf[512], *p; int fd; struct dirent de; struct stat st; if((fd = open(path, 0)) < 0){ - a4: 6a 00 push $0x0 - a6: 53 push %ebx - a7: e8 58 04 00 00 call 504 - ac: 83 c4 10 add $0x10,%esp - af: 85 c0 test %eax,%eax - b1: 78 7b js 12e - b3: 89 c6 mov %eax,%esi + 9c: 6a 00 push $0x0 + 9e: 53 push %ebx + 9f: e8 37 04 00 00 call 4db + a4: 83 c4 10 add $0x10,%esp + a7: 85 c0 test %eax,%eax + a9: 78 7b js 126 + ab: 89 c6 mov %eax,%esi printf(2, "ls: cannot open %s\n", path); return; } if(fstat(fd, &st) < 0){ - b5: 83 ec 08 sub $0x8,%esp - b8: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax - be: 50 push %eax - bf: 56 push %esi - c0: e8 57 04 00 00 call 51c - c5: 83 c4 10 add $0x10,%esp - c8: 85 c0 test %eax,%eax - ca: 78 77 js 143 + ad: 83 ec 08 sub $0x8,%esp + b0: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax + b6: 50 push %eax + b7: 56 push %esi + b8: e8 36 04 00 00 call 4f3 + bd: 83 c4 10 add $0x10,%esp + c0: 85 c0 test %eax,%eax + c2: 78 77 js 13b printf(2, "ls: cannot stat %s\n", path); close(fd); return; } switch(st.type){ - cc: 0f b7 85 c4 fd ff ff movzwl -0x23c(%ebp),%eax - d3: 66 83 f8 01 cmp $0x1,%ax - d7: 0f 84 83 00 00 00 je 160 - dd: 66 83 f8 02 cmp $0x2,%ax - e1: 75 37 jne 11a + c4: 0f b7 85 c4 fd ff ff movzwl -0x23c(%ebp),%eax + cb: 66 83 f8 01 cmp $0x1,%ax + cf: 0f 84 83 00 00 00 je 158 + d5: 66 83 f8 02 cmp $0x2,%ax + d9: 75 37 jne 112 case T_FILE: printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size); - e3: 8b bd d4 fd ff ff mov -0x22c(%ebp),%edi - e9: 8b 85 cc fd ff ff mov -0x234(%ebp),%eax - ef: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) - f5: 83 ec 0c sub $0xc,%esp - f8: 53 push %ebx - f9: e8 02 ff ff ff call 0 - fe: 83 c4 08 add $0x8,%esp - 101: 57 push %edi - 102: ff b5 b4 fd ff ff pushl -0x24c(%ebp) - 108: 6a 02 push $0x2 - 10a: 50 push %eax - 10b: 68 48 09 00 00 push $0x948 - 110: 6a 01 push $0x1 - 112: e8 f1 04 00 00 call 608 + db: 8b bd d4 fd ff ff mov -0x22c(%ebp),%edi + e1: 8b 85 cc fd ff ff mov -0x234(%ebp),%eax + e7: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) + ed: 83 ec 0c sub $0xc,%esp + f0: 53 push %ebx + f1: e8 0a ff ff ff call 0 + f6: 83 c4 08 add $0x8,%esp + f9: 57 push %edi + fa: ff b5 b4 fd ff ff push -0x24c(%ebp) + 100: 6a 02 push $0x2 + 102: 50 push %eax + 103: 68 04 09 00 00 push $0x904 + 108: 6a 01 push $0x1 + 10a: e8 d4 04 00 00 call 5e3 break; - 117: 83 c4 20 add $0x20,%esp + 10f: 83 c4 20 add $0x20,%esp } printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); } break; } close(fd); - 11a: 83 ec 0c sub $0xc,%esp - 11d: 56 push %esi - 11e: e8 c9 03 00 00 call 4ec - 123: 83 c4 10 add $0x10,%esp + 112: 83 ec 0c sub $0xc,%esp + 115: 56 push %esi + 116: e8 a8 03 00 00 call 4c3 + 11b: 83 c4 10 add $0x10,%esp } - 126: 8d 65 f4 lea -0xc(%ebp),%esp - 129: 5b pop %ebx - 12a: 5e pop %esi - 12b: 5f pop %edi - 12c: 5d pop %ebp - 12d: c3 ret + 11e: 8d 65 f4 lea -0xc(%ebp),%esp + 121: 5b pop %ebx + 122: 5e pop %esi + 123: 5f pop %edi + 124: 5d pop %ebp + 125: c3 ret printf(2, "ls: cannot open %s\n", path); - 12e: 83 ec 04 sub $0x4,%esp - 131: 53 push %ebx - 132: 68 20 09 00 00 push $0x920 - 137: 6a 02 push $0x2 - 139: e8 ca 04 00 00 call 608 + 126: 83 ec 04 sub $0x4,%esp + 129: 53 push %ebx + 12a: 68 dc 08 00 00 push $0x8dc + 12f: 6a 02 push $0x2 + 131: e8 ad 04 00 00 call 5e3 return; - 13e: 83 c4 10 add $0x10,%esp - 141: eb e3 jmp 126 + 136: 83 c4 10 add $0x10,%esp + 139: eb e3 jmp 11e printf(2, "ls: cannot stat %s\n", path); - 143: 83 ec 04 sub $0x4,%esp - 146: 53 push %ebx - 147: 68 34 09 00 00 push $0x934 - 14c: 6a 02 push $0x2 - 14e: e8 b5 04 00 00 call 608 + 13b: 83 ec 04 sub $0x4,%esp + 13e: 53 push %ebx + 13f: 68 f0 08 00 00 push $0x8f0 + 144: 6a 02 push $0x2 + 146: e8 98 04 00 00 call 5e3 close(fd); - 153: 89 34 24 mov %esi,(%esp) - 156: e8 91 03 00 00 call 4ec + 14b: 89 34 24 mov %esi,(%esp) + 14e: e8 70 03 00 00 call 4c3 return; - 15b: 83 c4 10 add $0x10,%esp - 15e: eb c6 jmp 126 + 153: 83 c4 10 add $0x10,%esp + 156: eb c6 jmp 11e if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ - 160: 83 ec 0c sub $0xc,%esp - 163: 53 push %ebx - 164: e8 ca 01 00 00 call 333 - 169: 83 c0 10 add $0x10,%eax - 16c: 83 c4 10 add $0x10,%esp - 16f: 3d 00 02 00 00 cmp $0x200,%eax - 174: 76 14 jbe 18a + 158: 83 ec 0c sub $0xc,%esp + 15b: 53 push %ebx + 15c: e8 c1 01 00 00 call 322 + 161: 83 c0 10 add $0x10,%eax + 164: 83 c4 10 add $0x10,%esp + 167: 3d 00 02 00 00 cmp $0x200,%eax + 16c: 76 14 jbe 182 printf(1, "ls: path too long\n"); - 176: 83 ec 08 sub $0x8,%esp - 179: 68 55 09 00 00 push $0x955 - 17e: 6a 01 push $0x1 - 180: e8 83 04 00 00 call 608 + 16e: 83 ec 08 sub $0x8,%esp + 171: 68 11 09 00 00 push $0x911 + 176: 6a 01 push $0x1 + 178: e8 66 04 00 00 call 5e3 break; - 185: 83 c4 10 add $0x10,%esp - 188: eb 90 jmp 11a + 17d: 83 c4 10 add $0x10,%esp + 180: eb 90 jmp 112 strcpy(buf, path); - 18a: 83 ec 08 sub $0x8,%esp - 18d: 53 push %ebx - 18e: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi - 194: 57 push %edi - 195: e8 44 01 00 00 call 2de + 182: 83 ec 08 sub $0x8,%esp + 185: 53 push %ebx + 186: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi + 18c: 57 push %edi + 18d: e8 41 01 00 00 call 2d3 p = buf+strlen(buf); - 19a: 89 3c 24 mov %edi,(%esp) - 19d: e8 91 01 00 00 call 333 - 1a2: 01 c7 add %eax,%edi + 192: 89 3c 24 mov %edi,(%esp) + 195: e8 88 01 00 00 call 322 + 19a: 01 c7 add %eax,%edi *p++ = '/'; - 1a4: 8d 47 01 lea 0x1(%edi),%eax - 1a7: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp) - 1ad: c6 07 2f movb $0x2f,(%edi) + 19c: 8d 47 01 lea 0x1(%edi),%eax + 19f: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp) + 1a5: c6 07 2f movb $0x2f,(%edi) while(read(fd, &de, sizeof(de)) == sizeof(de)){ - 1b0: 83 c4 10 add $0x10,%esp - 1b3: 8d 9d d8 fd ff ff lea -0x228(%ebp),%ebx - 1b9: eb 19 jmp 1d4 + 1a8: 83 c4 10 add $0x10,%esp + 1ab: 8d 9d d8 fd ff ff lea -0x228(%ebp),%ebx + 1b1: eb 19 jmp 1cc printf(1, "ls: cannot stat %s\n", buf); - 1bb: 83 ec 04 sub $0x4,%esp - 1be: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax - 1c4: 50 push %eax - 1c5: 68 34 09 00 00 push $0x934 - 1ca: 6a 01 push $0x1 - 1cc: e8 37 04 00 00 call 608 + 1b3: 83 ec 04 sub $0x4,%esp + 1b6: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 1bc: 50 push %eax + 1bd: 68 f0 08 00 00 push $0x8f0 + 1c2: 6a 01 push $0x1 + 1c4: e8 1a 04 00 00 call 5e3 continue; - 1d1: 83 c4 10 add $0x10,%esp + 1c9: 83 c4 10 add $0x10,%esp while(read(fd, &de, sizeof(de)) == sizeof(de)){ - 1d4: 83 ec 04 sub $0x4,%esp - 1d7: 6a 10 push $0x10 - 1d9: 53 push %ebx - 1da: 56 push %esi - 1db: e8 fc 02 00 00 call 4dc - 1e0: 83 c4 10 add $0x10,%esp - 1e3: 83 f8 10 cmp $0x10,%eax - 1e6: 0f 85 2e ff ff ff jne 11a + 1cc: 83 ec 04 sub $0x4,%esp + 1cf: 6a 10 push $0x10 + 1d1: 53 push %ebx + 1d2: 56 push %esi + 1d3: e8 db 02 00 00 call 4b3 + 1d8: 83 c4 10 add $0x10,%esp + 1db: 83 f8 10 cmp $0x10,%eax + 1de: 0f 85 2e ff ff ff jne 112 if(de.inum == 0) - 1ec: 66 83 bd d8 fd ff ff cmpw $0x0,-0x228(%ebp) - 1f3: 00 - 1f4: 74 de je 1d4 + 1e4: 66 83 bd d8 fd ff ff cmpw $0x0,-0x228(%ebp) + 1eb: 00 + 1ec: 74 de je 1cc memmove(p, de.name, DIRSIZ); - 1f6: 83 ec 04 sub $0x4,%esp - 1f9: 6a 0e push $0xe - 1fb: 8d 85 da fd ff ff lea -0x226(%ebp),%eax - 201: 50 push %eax - 202: ff b5 a8 fd ff ff pushl -0x258(%ebp) - 208: e8 7e 02 00 00 call 48b + 1ee: 83 ec 04 sub $0x4,%esp + 1f1: 6a 0e push $0xe + 1f3: 8d 85 da fd ff ff lea -0x226(%ebp),%eax + 1f9: 50 push %eax + 1fa: ff b5 a8 fd ff ff push -0x258(%ebp) + 200: e8 61 02 00 00 call 466 p[DIRSIZ] = 0; - 20d: c6 47 0f 00 movb $0x0,0xf(%edi) + 205: c6 47 0f 00 movb $0x0,0xf(%edi) if(stat(buf, &st) < 0){ - 211: 83 c4 08 add $0x8,%esp - 214: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax - 21a: 50 push %eax - 21b: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax - 221: 50 push %eax - 222: e8 dd 01 00 00 call 404 - 227: 83 c4 10 add $0x10,%esp - 22a: 85 c0 test %eax,%eax - 22c: 78 8d js 1bb + 209: 83 c4 08 add $0x8,%esp + 20c: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax + 212: 50 push %eax + 213: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 219: 50 push %eax + 21a: e8 c6 01 00 00 call 3e5 + 21f: 83 c4 10 add $0x10,%esp + 222: 85 c0 test %eax,%eax + 224: 78 8d js 1b3 printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); - 22e: 8b 85 d4 fd ff ff mov -0x22c(%ebp),%eax - 234: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) - 23a: 8b 95 cc fd ff ff mov -0x234(%ebp),%edx - 240: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp) - 246: 0f bf 8d c4 fd ff ff movswl -0x23c(%ebp),%ecx - 24d: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp) - 253: 83 ec 0c sub $0xc,%esp - 256: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax - 25c: 50 push %eax - 25d: e8 9e fd ff ff call 0 - 262: 83 c4 08 add $0x8,%esp - 265: ff b5 b4 fd ff ff pushl -0x24c(%ebp) - 26b: ff b5 b0 fd ff ff pushl -0x250(%ebp) - 271: ff b5 ac fd ff ff pushl -0x254(%ebp) - 277: 50 push %eax - 278: 68 48 09 00 00 push $0x948 - 27d: 6a 01 push $0x1 - 27f: e8 84 03 00 00 call 608 - 284: 83 c4 20 add $0x20,%esp - 287: e9 48 ff ff ff jmp 1d4 - -0000028c
: + 226: 8b 85 d4 fd ff ff mov -0x22c(%ebp),%eax + 22c: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) + 232: 8b 95 cc fd ff ff mov -0x234(%ebp),%edx + 238: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp) + 23e: 0f bf 8d c4 fd ff ff movswl -0x23c(%ebp),%ecx + 245: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp) + 24b: 83 ec 0c sub $0xc,%esp + 24e: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax + 254: 50 push %eax + 255: e8 a6 fd ff ff call 0 + 25a: 83 c4 08 add $0x8,%esp + 25d: ff b5 b4 fd ff ff push -0x24c(%ebp) + 263: ff b5 b0 fd ff ff push -0x250(%ebp) + 269: ff b5 ac fd ff ff push -0x254(%ebp) + 26f: 50 push %eax + 270: 68 04 09 00 00 push $0x904 + 275: 6a 01 push $0x1 + 277: e8 67 03 00 00 call 5e3 + 27c: 83 c4 20 add $0x20,%esp + 27f: e9 48 ff ff ff jmp 1cc + +00000284
: int main(int argc, char *argv[]) { - 28c: f3 0f 1e fb endbr32 - 290: 8d 4c 24 04 lea 0x4(%esp),%ecx - 294: 83 e4 f0 and $0xfffffff0,%esp - 297: ff 71 fc pushl -0x4(%ecx) - 29a: 55 push %ebp - 29b: 89 e5 mov %esp,%ebp - 29d: 56 push %esi - 29e: 53 push %ebx - 29f: 51 push %ecx - 2a0: 83 ec 0c sub $0xc,%esp - 2a3: 8b 01 mov (%ecx),%eax - 2a5: 8b 51 04 mov 0x4(%ecx),%edx - int i; + 284: 8d 4c 24 04 lea 0x4(%esp),%ecx + 288: 83 e4 f0 and $0xfffffff0,%esp + 28b: ff 71 fc push -0x4(%ecx) + 28e: 55 push %ebp + 28f: 89 e5 mov %esp,%ebp + 291: 57 push %edi + 292: 56 push %esi + 293: 53 push %ebx + 294: 51 push %ecx + 295: 83 ec 08 sub $0x8,%esp + 298: 8b 31 mov (%ecx),%esi + 29a: 8b 79 04 mov 0x4(%ecx),%edi if(argc < 2){ - 2a8: 83 f8 01 cmp $0x1,%eax - 2ab: 7e 1f jle 2cc - 2ad: 8d 5a 04 lea 0x4(%edx),%ebx - 2b0: 8d 34 82 lea (%edx,%eax,4),%esi ls("."); exit(); } for(i=1; i ls(argv[i]); - 2b3: 83 ec 0c sub $0xc,%esp - 2b6: ff 33 pushl (%ebx) - 2b8: e8 d4 fd ff ff call 91 + 2a7: 83 ec 0c sub $0xc,%esp + 2aa: ff 34 9f push (%edi,%ebx,4) + 2ad: e8 db fd ff ff call 8d for(i=1; i + 2b2: 83 c3 01 add $0x1,%ebx + 2b5: 83 c4 10 add $0x10,%esp + 2b8: 39 de cmp %ebx,%esi + 2ba: 75 eb jne 2a7 exit(); - 2c7: e8 f8 01 00 00 call 4c4 + 2bc: e8 da 01 00 00 call 49b ls("."); - 2cc: 83 ec 0c sub $0xc,%esp - 2cf: 68 68 09 00 00 push $0x968 - 2d4: e8 b8 fd ff ff call 91 + 2c1: 83 ec 0c sub $0xc,%esp + 2c4: 68 24 09 00 00 push $0x924 + 2c9: e8 bf fd ff ff call 8d exit(); - 2d9: e8 e6 01 00 00 call 4c4 + 2ce: e8 c8 01 00 00 call 49b -000002de : +000002d3 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 2de: f3 0f 1e fb endbr32 - 2e2: 55 push %ebp - 2e3: 89 e5 mov %esp,%ebp - 2e5: 53 push %ebx - 2e6: 8b 4d 08 mov 0x8(%ebp),%ecx - 2e9: 8b 5d 0c mov 0xc(%ebp),%ebx + 2d3: 55 push %ebp + 2d4: 89 e5 mov %esp,%ebp + 2d6: 53 push %ebx + 2d7: 8b 4d 08 mov 0x8(%ebp),%ecx + 2da: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 2ec: b8 00 00 00 00 mov $0x0,%eax - 2f1: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 2f5: 88 14 01 mov %dl,(%ecx,%eax,1) - 2f8: 83 c0 01 add $0x1,%eax - 2fb: 84 d2 test %dl,%dl - 2fd: 75 f2 jne 2f1 + 2dd: b8 00 00 00 00 mov $0x0,%eax + 2e2: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 2e6: 88 14 01 mov %dl,(%ecx,%eax,1) + 2e9: 83 c0 01 add $0x1,%eax + 2ec: 84 d2 test %dl,%dl + 2ee: 75 f2 jne 2e2 ; return os; } - 2ff: 89 c8 mov %ecx,%eax - 301: 5b pop %ebx - 302: 5d pop %ebp - 303: c3 ret + 2f0: 89 c8 mov %ecx,%eax + 2f2: 8b 5d fc mov -0x4(%ebp),%ebx + 2f5: c9 leave + 2f6: c3 ret -00000304 : +000002f7 : int strcmp(const char *p, const char *q) { - 304: f3 0f 1e fb endbr32 - 308: 55 push %ebp - 309: 89 e5 mov %esp,%ebp - 30b: 8b 4d 08 mov 0x8(%ebp),%ecx - 30e: 8b 55 0c mov 0xc(%ebp),%edx + 2f7: 55 push %ebp + 2f8: 89 e5 mov %esp,%ebp + 2fa: 8b 4d 08 mov 0x8(%ebp),%ecx + 2fd: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 311: 0f b6 01 movzbl (%ecx),%eax - 314: 84 c0 test %al,%al - 316: 74 11 je 329 - 318: 38 02 cmp %al,(%edx) - 31a: 75 0d jne 329 + 300: 0f b6 01 movzbl (%ecx),%eax + 303: 84 c0 test %al,%al + 305: 74 11 je 318 + 307: 38 02 cmp %al,(%edx) + 309: 75 0d jne 318 p++, q++; - 31c: 83 c1 01 add $0x1,%ecx - 31f: 83 c2 01 add $0x1,%edx + 30b: 83 c1 01 add $0x1,%ecx + 30e: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 322: 0f b6 01 movzbl (%ecx),%eax - 325: 84 c0 test %al,%al - 327: 75 ef jne 318 + 311: 0f b6 01 movzbl (%ecx),%eax + 314: 84 c0 test %al,%al + 316: 75 ef jne 307 return (uchar)*p - (uchar)*q; - 329: 0f b6 c0 movzbl %al,%eax - 32c: 0f b6 12 movzbl (%edx),%edx - 32f: 29 d0 sub %edx,%eax + 318: 0f b6 c0 movzbl %al,%eax + 31b: 0f b6 12 movzbl (%edx),%edx + 31e: 29 d0 sub %edx,%eax } - 331: 5d pop %ebp - 332: c3 ret + 320: 5d pop %ebp + 321: c3 ret -00000333 : +00000322 : uint strlen(const char *s) { - 333: f3 0f 1e fb endbr32 - 337: 55 push %ebp - 338: 89 e5 mov %esp,%ebp - 33a: 8b 55 08 mov 0x8(%ebp),%edx + 322: 55 push %ebp + 323: 89 e5 mov %esp,%ebp + 325: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 33d: 80 3a 00 cmpb $0x0,(%edx) - 340: 74 14 je 356 - 342: b8 00 00 00 00 mov $0x0,%eax - 347: 83 c0 01 add $0x1,%eax - 34a: 89 c1 mov %eax,%ecx - 34c: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 350: 75 f5 jne 347 + 328: 80 3a 00 cmpb $0x0,(%edx) + 32b: 74 14 je 341 + 32d: b8 00 00 00 00 mov $0x0,%eax + 332: 83 c0 01 add $0x1,%eax + 335: 89 c1 mov %eax,%ecx + 337: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 33b: 75 f5 jne 332 ; return n; } - 352: 89 c8 mov %ecx,%eax - 354: 5d pop %ebp - 355: c3 ret + 33d: 89 c8 mov %ecx,%eax + 33f: 5d pop %ebp + 340: c3 ret for(n = 0; s[n]; n++) - 356: b9 00 00 00 00 mov $0x0,%ecx + 341: b9 00 00 00 00 mov $0x0,%ecx return n; - 35b: eb f5 jmp 352 + 346: eb f5 jmp 33d -0000035d : +00000348 : void* memset(void *dst, int c, uint n) { - 35d: f3 0f 1e fb endbr32 - 361: 55 push %ebp - 362: 89 e5 mov %esp,%ebp - 364: 57 push %edi - 365: 8b 55 08 mov 0x8(%ebp),%edx + 348: 55 push %ebp + 349: 89 e5 mov %esp,%ebp + 34b: 57 push %edi + 34c: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 368: 89 d7 mov %edx,%edi - 36a: 8b 4d 10 mov 0x10(%ebp),%ecx - 36d: 8b 45 0c mov 0xc(%ebp),%eax - 370: fc cld - 371: f3 aa rep stos %al,%es:(%edi) + 34f: 89 d7 mov %edx,%edi + 351: 8b 4d 10 mov 0x10(%ebp),%ecx + 354: 8b 45 0c mov 0xc(%ebp),%eax + 357: fc cld + 358: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 373: 89 d0 mov %edx,%eax - 375: 5f pop %edi - 376: 5d pop %ebp - 377: c3 ret + 35a: 89 d0 mov %edx,%eax + 35c: 8b 7d fc mov -0x4(%ebp),%edi + 35f: c9 leave + 360: c3 ret -00000378 : +00000361 : char* strchr(const char *s, char c) { - 378: f3 0f 1e fb endbr32 - 37c: 55 push %ebp - 37d: 89 e5 mov %esp,%ebp - 37f: 8b 45 08 mov 0x8(%ebp),%eax - 382: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 361: 55 push %ebp + 362: 89 e5 mov %esp,%ebp + 364: 8b 45 08 mov 0x8(%ebp),%eax + 367: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 386: 0f b6 10 movzbl (%eax),%edx - 389: 84 d2 test %dl,%dl - 38b: 74 15 je 3a2 + 36b: 0f b6 10 movzbl (%eax),%edx + 36e: 84 d2 test %dl,%dl + 370: 74 15 je 387 if(*s == c) - 38d: 38 d1 cmp %dl,%cl - 38f: 74 0f je 3a0 + 372: 38 d1 cmp %dl,%cl + 374: 74 0f je 385 for(; *s; s++) - 391: 83 c0 01 add $0x1,%eax - 394: 0f b6 10 movzbl (%eax),%edx - 397: 84 d2 test %dl,%dl - 399: 75 f2 jne 38d + 376: 83 c0 01 add $0x1,%eax + 379: 0f b6 10 movzbl (%eax),%edx + 37c: 84 d2 test %dl,%dl + 37e: 75 f2 jne 372 return (char*)s; return 0; - 39b: b8 00 00 00 00 mov $0x0,%eax + 380: b8 00 00 00 00 mov $0x0,%eax } - 3a0: 5d pop %ebp - 3a1: c3 ret + 385: 5d pop %ebp + 386: c3 ret return 0; - 3a2: b8 00 00 00 00 mov $0x0,%eax - 3a7: eb f7 jmp 3a0 + 387: b8 00 00 00 00 mov $0x0,%eax + 38c: eb f7 jmp 385 -000003a9 : +0000038e : char* gets(char *buf, int max) { - 3a9: f3 0f 1e fb endbr32 - 3ad: 55 push %ebp - 3ae: 89 e5 mov %esp,%ebp - 3b0: 57 push %edi - 3b1: 56 push %esi - 3b2: 53 push %ebx - 3b3: 83 ec 2c sub $0x2c,%esp - 3b6: 8b 75 08 mov 0x8(%ebp),%esi + 38e: 55 push %ebp + 38f: 89 e5 mov %esp,%ebp + 391: 57 push %edi + 392: 56 push %esi + 393: 53 push %ebx + 394: 83 ec 2c sub $0x2c,%esp + 397: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 3b9: bb 00 00 00 00 mov $0x0,%ebx + 39a: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 3be: 8d 7d e7 lea -0x19(%ebp),%edi + 39f: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 3c1: 89 5d d4 mov %ebx,-0x2c(%ebp) - 3c4: 83 c3 01 add $0x1,%ebx - 3c7: 3b 5d 0c cmp 0xc(%ebp),%ebx - 3ca: 7d 27 jge 3f3 + 3a2: 89 5d d4 mov %ebx,-0x2c(%ebp) + 3a5: 83 c3 01 add $0x1,%ebx + 3a8: 3b 5d 0c cmp 0xc(%ebp),%ebx + 3ab: 7d 27 jge 3d4 cc = read(0, &c, 1); - 3cc: 83 ec 04 sub $0x4,%esp - 3cf: 6a 01 push $0x1 - 3d1: 57 push %edi - 3d2: 6a 00 push $0x0 - 3d4: e8 03 01 00 00 call 4dc + 3ad: 83 ec 04 sub $0x4,%esp + 3b0: 6a 01 push $0x1 + 3b2: 57 push %edi + 3b3: 6a 00 push $0x0 + 3b5: e8 f9 00 00 00 call 4b3 if(cc < 1) - 3d9: 83 c4 10 add $0x10,%esp - 3dc: 85 c0 test %eax,%eax - 3de: 7e 13 jle 3f3 + 3ba: 83 c4 10 add $0x10,%esp + 3bd: 85 c0 test %eax,%eax + 3bf: 7e 13 jle 3d4 break; buf[i++] = c; - 3e0: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 3e4: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 3c1: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 3c5: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 3e8: 3c 0a cmp $0xa,%al - 3ea: 74 04 je 3f0 - 3ec: 3c 0d cmp $0xd,%al - 3ee: 75 d1 jne 3c1 + 3c9: 3c 0a cmp $0xa,%al + 3cb: 74 04 je 3d1 + 3cd: 3c 0d cmp $0xd,%al + 3cf: 75 d1 jne 3a2 for(i=0; i+1 < max; ){ - 3f0: 89 5d d4 mov %ebx,-0x2c(%ebp) + 3d1: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 3f3: 8b 45 d4 mov -0x2c(%ebp),%eax - 3f6: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 3d4: 8b 45 d4 mov -0x2c(%ebp),%eax + 3d7: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 3fa: 89 f0 mov %esi,%eax - 3fc: 8d 65 f4 lea -0xc(%ebp),%esp - 3ff: 5b pop %ebx - 400: 5e pop %esi - 401: 5f pop %edi - 402: 5d pop %ebp - 403: c3 ret + 3db: 89 f0 mov %esi,%eax + 3dd: 8d 65 f4 lea -0xc(%ebp),%esp + 3e0: 5b pop %ebx + 3e1: 5e pop %esi + 3e2: 5f pop %edi + 3e3: 5d pop %ebp + 3e4: c3 ret -00000404 : +000003e5 : int stat(const char *n, struct stat *st) { - 404: f3 0f 1e fb endbr32 - 408: 55 push %ebp - 409: 89 e5 mov %esp,%ebp - 40b: 56 push %esi - 40c: 53 push %ebx + 3e5: 55 push %ebp + 3e6: 89 e5 mov %esp,%ebp + 3e8: 56 push %esi + 3e9: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 40d: 83 ec 08 sub $0x8,%esp - 410: 6a 00 push $0x0 - 412: ff 75 08 pushl 0x8(%ebp) - 415: e8 ea 00 00 00 call 504 + 3ea: 83 ec 08 sub $0x8,%esp + 3ed: 6a 00 push $0x0 + 3ef: ff 75 08 push 0x8(%ebp) + 3f2: e8 e4 00 00 00 call 4db if(fd < 0) - 41a: 83 c4 10 add $0x10,%esp - 41d: 85 c0 test %eax,%eax - 41f: 78 24 js 445 - 421: 89 c3 mov %eax,%ebx + 3f7: 83 c4 10 add $0x10,%esp + 3fa: 85 c0 test %eax,%eax + 3fc: 78 24 js 422 + 3fe: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 423: 83 ec 08 sub $0x8,%esp - 426: ff 75 0c pushl 0xc(%ebp) - 429: 50 push %eax - 42a: e8 ed 00 00 00 call 51c - 42f: 89 c6 mov %eax,%esi + 400: 83 ec 08 sub $0x8,%esp + 403: ff 75 0c push 0xc(%ebp) + 406: 50 push %eax + 407: e8 e7 00 00 00 call 4f3 + 40c: 89 c6 mov %eax,%esi close(fd); - 431: 89 1c 24 mov %ebx,(%esp) - 434: e8 b3 00 00 00 call 4ec + 40e: 89 1c 24 mov %ebx,(%esp) + 411: e8 ad 00 00 00 call 4c3 return r; - 439: 83 c4 10 add $0x10,%esp + 416: 83 c4 10 add $0x10,%esp } - 43c: 89 f0 mov %esi,%eax - 43e: 8d 65 f8 lea -0x8(%ebp),%esp - 441: 5b pop %ebx - 442: 5e pop %esi - 443: 5d pop %ebp - 444: c3 ret + 419: 89 f0 mov %esi,%eax + 41b: 8d 65 f8 lea -0x8(%ebp),%esp + 41e: 5b pop %ebx + 41f: 5e pop %esi + 420: 5d pop %ebp + 421: c3 ret return -1; - 445: be ff ff ff ff mov $0xffffffff,%esi - 44a: eb f0 jmp 43c + 422: be ff ff ff ff mov $0xffffffff,%esi + 427: eb f0 jmp 419 -0000044c : +00000429 : int atoi(const char *s) { - 44c: f3 0f 1e fb endbr32 - 450: 55 push %ebp - 451: 89 e5 mov %esp,%ebp - 453: 53 push %ebx - 454: 8b 55 08 mov 0x8(%ebp),%edx + 429: 55 push %ebp + 42a: 89 e5 mov %esp,%ebp + 42c: 53 push %ebx + 42d: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 457: 0f b6 02 movzbl (%edx),%eax - 45a: 8d 48 d0 lea -0x30(%eax),%ecx - 45d: 80 f9 09 cmp $0x9,%cl - 460: 77 22 ja 484 + 430: 0f b6 02 movzbl (%edx),%eax + 433: 8d 48 d0 lea -0x30(%eax),%ecx + 436: 80 f9 09 cmp $0x9,%cl + 439: 77 24 ja 45f n = 0; - 462: b9 00 00 00 00 mov $0x0,%ecx + 43b: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 467: 83 c2 01 add $0x1,%edx - 46a: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 46d: 0f be c0 movsbl %al,%eax - 470: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 440: 83 c2 01 add $0x1,%edx + 443: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 446: 0f be c0 movsbl %al,%eax + 449: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 474: 0f b6 02 movzbl (%edx),%eax - 477: 8d 58 d0 lea -0x30(%eax),%ebx - 47a: 80 fb 09 cmp $0x9,%bl - 47d: 76 e8 jbe 467 + 44d: 0f b6 02 movzbl (%edx),%eax + 450: 8d 58 d0 lea -0x30(%eax),%ebx + 453: 80 fb 09 cmp $0x9,%bl + 456: 76 e8 jbe 440 return n; } - 47f: 89 c8 mov %ecx,%eax - 481: 5b pop %ebx - 482: 5d pop %ebp - 483: c3 ret + 458: 89 c8 mov %ecx,%eax + 45a: 8b 5d fc mov -0x4(%ebp),%ebx + 45d: c9 leave + 45e: c3 ret n = 0; - 484: b9 00 00 00 00 mov $0x0,%ecx + 45f: b9 00 00 00 00 mov $0x0,%ecx return n; - 489: eb f4 jmp 47f + 464: eb f2 jmp 458 -0000048b : +00000466 : void* memmove(void *vdst, const void *vsrc, int n) { - 48b: f3 0f 1e fb endbr32 - 48f: 55 push %ebp - 490: 89 e5 mov %esp,%ebp - 492: 56 push %esi - 493: 53 push %ebx - 494: 8b 75 08 mov 0x8(%ebp),%esi - 497: 8b 55 0c mov 0xc(%ebp),%edx - 49a: 8b 5d 10 mov 0x10(%ebp),%ebx + 466: 55 push %ebp + 467: 89 e5 mov %esp,%ebp + 469: 56 push %esi + 46a: 53 push %ebx + 46b: 8b 75 08 mov 0x8(%ebp),%esi + 46e: 8b 55 0c mov 0xc(%ebp),%edx + 471: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 49d: 85 db test %ebx,%ebx - 49f: 7e 15 jle 4b6 - 4a1: 01 f3 add %esi,%ebx + 474: 85 db test %ebx,%ebx + 476: 7e 15 jle 48d + 478: 01 f3 add %esi,%ebx dst = vdst; - 4a3: 89 f0 mov %esi,%eax + 47a: 89 f0 mov %esi,%eax *dst++ = *src++; - 4a5: 83 c2 01 add $0x1,%edx - 4a8: 83 c0 01 add $0x1,%eax - 4ab: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 4af: 88 48 ff mov %cl,-0x1(%eax) + 47c: 83 c2 01 add $0x1,%edx + 47f: 83 c0 01 add $0x1,%eax + 482: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 486: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 4b2: 39 c3 cmp %eax,%ebx - 4b4: 75 ef jne 4a5 + 489: 39 c3 cmp %eax,%ebx + 48b: 75 ef jne 47c return vdst; } - 4b6: 89 f0 mov %esi,%eax - 4b8: 5b pop %ebx - 4b9: 5e pop %esi - 4ba: 5d pop %ebp - 4bb: c3 ret + 48d: 89 f0 mov %esi,%eax + 48f: 5b pop %ebx + 490: 5e pop %esi + 491: 5d pop %ebp + 492: c3 ret -000004bc : +00000493 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 4bc: b8 01 00 00 00 mov $0x1,%eax - 4c1: cd 40 int $0x40 - 4c3: c3 ret + 493: b8 01 00 00 00 mov $0x1,%eax + 498: cd 40 int $0x40 + 49a: c3 ret -000004c4 : +0000049b : SYSCALL(exit) - 4c4: b8 02 00 00 00 mov $0x2,%eax - 4c9: cd 40 int $0x40 - 4cb: c3 ret + 49b: b8 02 00 00 00 mov $0x2,%eax + 4a0: cd 40 int $0x40 + 4a2: c3 ret -000004cc : +000004a3 : SYSCALL(wait) - 4cc: b8 03 00 00 00 mov $0x3,%eax - 4d1: cd 40 int $0x40 - 4d3: c3 ret + 4a3: b8 03 00 00 00 mov $0x3,%eax + 4a8: cd 40 int $0x40 + 4aa: c3 ret -000004d4 : +000004ab : SYSCALL(pipe) - 4d4: b8 04 00 00 00 mov $0x4,%eax - 4d9: cd 40 int $0x40 - 4db: c3 ret + 4ab: b8 04 00 00 00 mov $0x4,%eax + 4b0: cd 40 int $0x40 + 4b2: c3 ret -000004dc : +000004b3 : SYSCALL(read) - 4dc: b8 05 00 00 00 mov $0x5,%eax - 4e1: cd 40 int $0x40 - 4e3: c3 ret + 4b3: b8 05 00 00 00 mov $0x5,%eax + 4b8: cd 40 int $0x40 + 4ba: c3 ret -000004e4 : +000004bb : SYSCALL(write) - 4e4: b8 10 00 00 00 mov $0x10,%eax - 4e9: cd 40 int $0x40 - 4eb: c3 ret + 4bb: b8 10 00 00 00 mov $0x10,%eax + 4c0: cd 40 int $0x40 + 4c2: c3 ret -000004ec : +000004c3 : SYSCALL(close) - 4ec: b8 15 00 00 00 mov $0x15,%eax - 4f1: cd 40 int $0x40 - 4f3: c3 ret + 4c3: b8 15 00 00 00 mov $0x15,%eax + 4c8: cd 40 int $0x40 + 4ca: c3 ret -000004f4 : +000004cb : SYSCALL(kill) - 4f4: b8 06 00 00 00 mov $0x6,%eax - 4f9: cd 40 int $0x40 - 4fb: c3 ret + 4cb: b8 06 00 00 00 mov $0x6,%eax + 4d0: cd 40 int $0x40 + 4d2: c3 ret -000004fc : +000004d3 : SYSCALL(exec) - 4fc: b8 07 00 00 00 mov $0x7,%eax - 501: cd 40 int $0x40 - 503: c3 ret + 4d3: b8 07 00 00 00 mov $0x7,%eax + 4d8: cd 40 int $0x40 + 4da: c3 ret -00000504 : +000004db : SYSCALL(open) - 504: b8 0f 00 00 00 mov $0xf,%eax - 509: cd 40 int $0x40 - 50b: c3 ret + 4db: b8 0f 00 00 00 mov $0xf,%eax + 4e0: cd 40 int $0x40 + 4e2: c3 ret -0000050c : +000004e3 : SYSCALL(mknod) - 50c: b8 11 00 00 00 mov $0x11,%eax - 511: cd 40 int $0x40 - 513: c3 ret + 4e3: b8 11 00 00 00 mov $0x11,%eax + 4e8: cd 40 int $0x40 + 4ea: c3 ret -00000514 : +000004eb : SYSCALL(unlink) - 514: b8 12 00 00 00 mov $0x12,%eax - 519: cd 40 int $0x40 - 51b: c3 ret + 4eb: b8 12 00 00 00 mov $0x12,%eax + 4f0: cd 40 int $0x40 + 4f2: c3 ret -0000051c : +000004f3 : SYSCALL(fstat) - 51c: b8 08 00 00 00 mov $0x8,%eax - 521: cd 40 int $0x40 - 523: c3 ret + 4f3: b8 08 00 00 00 mov $0x8,%eax + 4f8: cd 40 int $0x40 + 4fa: c3 ret -00000524 : +000004fb : SYSCALL(link) - 524: b8 13 00 00 00 mov $0x13,%eax - 529: cd 40 int $0x40 - 52b: c3 ret + 4fb: b8 13 00 00 00 mov $0x13,%eax + 500: cd 40 int $0x40 + 502: c3 ret -0000052c : +00000503 : SYSCALL(mkdir) - 52c: b8 14 00 00 00 mov $0x14,%eax - 531: cd 40 int $0x40 - 533: c3 ret + 503: b8 14 00 00 00 mov $0x14,%eax + 508: cd 40 int $0x40 + 50a: c3 ret -00000534 : +0000050b : SYSCALL(chdir) - 534: b8 09 00 00 00 mov $0x9,%eax - 539: cd 40 int $0x40 - 53b: c3 ret + 50b: b8 09 00 00 00 mov $0x9,%eax + 510: cd 40 int $0x40 + 512: c3 ret -0000053c : +00000513 : SYSCALL(dup) - 53c: b8 0a 00 00 00 mov $0xa,%eax - 541: cd 40 int $0x40 - 543: c3 ret + 513: b8 0a 00 00 00 mov $0xa,%eax + 518: cd 40 int $0x40 + 51a: c3 ret -00000544 : +0000051b : SYSCALL(getpid) - 544: b8 0b 00 00 00 mov $0xb,%eax - 549: cd 40 int $0x40 - 54b: c3 ret + 51b: b8 0b 00 00 00 mov $0xb,%eax + 520: cd 40 int $0x40 + 522: c3 ret -0000054c : +00000523 : SYSCALL(sbrk) - 54c: b8 0c 00 00 00 mov $0xc,%eax - 551: cd 40 int $0x40 - 553: c3 ret + 523: b8 0c 00 00 00 mov $0xc,%eax + 528: cd 40 int $0x40 + 52a: c3 ret -00000554 : +0000052b : SYSCALL(sleep) - 554: b8 0d 00 00 00 mov $0xd,%eax - 559: cd 40 int $0x40 - 55b: c3 ret + 52b: b8 0d 00 00 00 mov $0xd,%eax + 530: cd 40 int $0x40 + 532: c3 ret -0000055c : +00000533 : SYSCALL(uptime) - 55c: b8 0e 00 00 00 mov $0xe,%eax - 561: cd 40 int $0x40 - 563: c3 ret + 533: b8 0e 00 00 00 mov $0xe,%eax + 538: cd 40 int $0x40 + 53a: c3 ret -00000564 : +0000053b : SYSCALL(slabtest) - 564: b8 16 00 00 00 mov $0x16,%eax - 569: cd 40 int $0x40 - 56b: c3 ret + 53b: b8 16 00 00 00 mov $0x16,%eax + 540: cd 40 int $0x40 + 542: c3 ret -0000056c : +00000543 : SYSCALL(ps) - 56c: b8 17 00 00 00 mov $0x17,%eax - 571: cd 40 int $0x40 - 573: c3 ret + 543: b8 17 00 00 00 mov $0x17,%eax + 548: cd 40 int $0x40 + 54a: c3 ret -00000574 : +0000054b : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 574: 55 push %ebp - 575: 89 e5 mov %esp,%ebp - 577: 57 push %edi - 578: 56 push %esi - 579: 53 push %ebx - 57a: 83 ec 3c sub $0x3c,%esp - 57d: 89 45 c4 mov %eax,-0x3c(%ebp) - 580: 89 d3 mov %edx,%ebx + 54b: 55 push %ebp + 54c: 89 e5 mov %esp,%ebp + 54e: 57 push %edi + 54f: 56 push %esi + 550: 53 push %ebx + 551: 83 ec 3c sub $0x3c,%esp + 554: 89 45 c4 mov %eax,-0x3c(%ebp) + 557: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 582: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 586: 74 77 je 5ff - 588: 85 d2 test %edx,%edx - 58a: 79 73 jns 5ff + 559: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 55d: 74 79 je 5d8 + 55f: 85 d2 test %edx,%edx + 561: 79 75 jns 5d8 neg = 1; x = -xx; - 58c: f7 db neg %ebx + 563: 89 d1 mov %edx,%ecx + 565: f7 d9 neg %ecx neg = 1; - 58e: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 567: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 595: be 00 00 00 00 mov $0x0,%esi + 56e: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 59a: 89 f7 mov %esi,%edi - 59c: 83 c6 01 add $0x1,%esi - 59f: 89 d8 mov %ebx,%eax - 5a1: ba 00 00 00 00 mov $0x0,%edx - 5a6: f7 f1 div %ecx - 5a8: 0f b6 92 74 09 00 00 movzbl 0x974(%edx),%edx - 5af: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 573: 89 df mov %ebx,%edi + 575: 83 c3 01 add $0x1,%ebx + 578: 89 c8 mov %ecx,%eax + 57a: ba 00 00 00 00 mov $0x0,%edx + 57f: f7 f6 div %esi + 581: 0f b6 92 88 09 00 00 movzbl 0x988(%edx),%edx + 588: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 5b3: 89 da mov %ebx,%edx - 5b5: 89 c3 mov %eax,%ebx - 5b7: 39 d1 cmp %edx,%ecx - 5b9: 76 df jbe 59a + 58c: 89 ca mov %ecx,%edx + 58e: 89 c1 mov %eax,%ecx + 590: 39 d6 cmp %edx,%esi + 592: 76 df jbe 573 if(neg) - 5bb: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 5bf: 74 08 je 5c9 + 594: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 598: 74 08 je 5a2 buf[i++] = '-'; - 5c1: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 5c6: 8d 77 02 lea 0x2(%edi),%esi + 59a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 59f: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 5c9: 85 f6 test %esi,%esi - 5cb: 7e 2a jle 5f7 - 5cd: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 5d1: 8d 7d d8 lea -0x28(%ebp),%edi + 5a2: 85 db test %ebx,%ebx + 5a4: 7e 2a jle 5d0 + 5a6: 8d 7d d8 lea -0x28(%ebp),%edi + 5a9: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 5d4: 8d 75 d7 lea -0x29(%ebp),%esi + 5ad: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 5d7: 0f b6 03 movzbl (%ebx),%eax - 5da: 88 45 d7 mov %al,-0x29(%ebp) + 5b0: 0f b6 03 movzbl (%ebx),%eax + 5b3: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 5dd: 83 ec 04 sub $0x4,%esp - 5e0: 6a 01 push $0x1 - 5e2: 56 push %esi - 5e3: ff 75 c4 pushl -0x3c(%ebp) - 5e6: e8 f9 fe ff ff call 4e4 + 5b6: 83 ec 04 sub $0x4,%esp + 5b9: 6a 01 push $0x1 + 5bb: 56 push %esi + 5bc: ff 75 c4 push -0x3c(%ebp) + 5bf: e8 f7 fe ff ff call 4bb while(--i >= 0) - 5eb: 89 d8 mov %ebx,%eax - 5ed: 83 eb 01 sub $0x1,%ebx - 5f0: 83 c4 10 add $0x10,%esp - 5f3: 39 f8 cmp %edi,%eax - 5f5: 75 e0 jne 5d7 + 5c4: 89 d8 mov %ebx,%eax + 5c6: 83 eb 01 sub $0x1,%ebx + 5c9: 83 c4 10 add $0x10,%esp + 5cc: 39 f8 cmp %edi,%eax + 5ce: 75 e0 jne 5b0 } - 5f7: 8d 65 f4 lea -0xc(%ebp),%esp - 5fa: 5b pop %ebx - 5fb: 5e pop %esi - 5fc: 5f pop %edi - 5fd: 5d pop %ebp - 5fe: c3 ret + 5d0: 8d 65 f4 lea -0xc(%ebp),%esp + 5d3: 5b pop %ebx + 5d4: 5e pop %esi + 5d5: 5f pop %edi + 5d6: 5d pop %ebp + 5d7: c3 ret + x = xx; + 5d8: 89 d1 mov %edx,%ecx neg = 0; - 5ff: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 606: eb 8d jmp 595 + 5da: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 5e1: eb 8b jmp 56e -00000608 : +000005e3 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 608: f3 0f 1e fb endbr32 - 60c: 55 push %ebp - 60d: 89 e5 mov %esp,%ebp - 60f: 57 push %edi - 610: 56 push %esi - 611: 53 push %ebx - 612: 83 ec 2c sub $0x2c,%esp + 5e3: 55 push %ebp + 5e4: 89 e5 mov %esp,%ebp + 5e6: 57 push %edi + 5e7: 56 push %esi + 5e8: 53 push %ebx + 5e9: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 615: 8b 75 0c mov 0xc(%ebp),%esi - 618: 0f b6 1e movzbl (%esi),%ebx - 61b: 84 db test %bl,%bl - 61d: 0f 84 ab 01 00 00 je 7ce - 623: 83 c6 01 add $0x1,%esi + 5ec: 8b 75 0c mov 0xc(%ebp),%esi + 5ef: 0f b6 1e movzbl (%esi),%ebx + 5f2: 84 db test %bl,%bl + 5f4: 0f 84 9f 01 00 00 je 799 + 5fa: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 626: 8d 45 10 lea 0x10(%ebp),%eax - 629: 89 45 d4 mov %eax,-0x2c(%ebp) + 5fd: 8d 45 10 lea 0x10(%ebp),%eax + 600: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 62c: bf 00 00 00 00 mov $0x0,%edi - 631: eb 2d jmp 660 + 603: bf 00 00 00 00 mov $0x0,%edi + 608: eb 2d jmp 637 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 633: 88 5d e7 mov %bl,-0x19(%ebp) + 60a: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 636: 83 ec 04 sub $0x4,%esp - 639: 6a 01 push $0x1 - 63b: 8d 45 e7 lea -0x19(%ebp),%eax - 63e: 50 push %eax - 63f: ff 75 08 pushl 0x8(%ebp) - 642: e8 9d fe ff ff call 4e4 + 60d: 83 ec 04 sub $0x4,%esp + 610: 6a 01 push $0x1 + 612: 8d 45 e7 lea -0x19(%ebp),%eax + 615: 50 push %eax + 616: ff 75 08 push 0x8(%ebp) + 619: e8 9d fe ff ff call 4bb putc(fd, c); - 647: 83 c4 10 add $0x10,%esp - 64a: eb 05 jmp 651 + 61e: 83 c4 10 add $0x10,%esp + 621: eb 05 jmp 628 } } else if(state == '%'){ - 64c: 83 ff 25 cmp $0x25,%edi - 64f: 74 22 je 673 + 623: 83 ff 25 cmp $0x25,%edi + 626: 74 1f je 647 for(i = 0; fmt[i]; i++){ - 651: 83 c6 01 add $0x1,%esi - 654: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 658: 84 db test %bl,%bl - 65a: 0f 84 6e 01 00 00 je 7ce + 628: 83 c6 01 add $0x1,%esi + 62b: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 62f: 84 db test %bl,%bl + 631: 0f 84 62 01 00 00 je 799 c = fmt[i] & 0xff; - 660: 0f be d3 movsbl %bl,%edx - 663: 0f b6 c3 movzbl %bl,%eax + 637: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 666: 85 ff test %edi,%edi - 668: 75 e2 jne 64c + 63a: 85 ff test %edi,%edi + 63c: 75 e5 jne 623 if(c == '%'){ - 66a: 83 f8 25 cmp $0x25,%eax - 66d: 75 c4 jne 633 + 63e: 83 f8 25 cmp $0x25,%eax + 641: 75 c7 jne 60a state = '%'; - 66f: 89 c7 mov %eax,%edi - 671: eb de jmp 651 + 643: 89 c7 mov %eax,%edi + 645: eb e1 jmp 628 if(c == 'd'){ - 673: 83 f8 64 cmp $0x64,%eax - 676: 74 59 je 6d1 + 647: 83 f8 25 cmp $0x25,%eax + 64a: 0f 84 f2 00 00 00 je 742 + 650: 8d 50 9d lea -0x63(%eax),%edx + 653: 83 fa 15 cmp $0x15,%edx + 656: 0f 87 07 01 00 00 ja 763 + 65c: 0f 87 01 01 00 00 ja 763 + 662: ff 24 95 30 09 00 00 jmp *0x930(,%edx,4) printint(fd, *ap, 10, 1); + 669: 83 ec 0c sub $0xc,%esp + 66c: 6a 01 push $0x1 + 66e: b9 0a 00 00 00 mov $0xa,%ecx + 673: 8b 7d d4 mov -0x2c(%ebp),%edi + 676: 8b 17 mov (%edi),%edx + 678: 8b 45 08 mov 0x8(%ebp),%eax + 67b: e8 cb fe ff ff call 54b ap++; - } else if(c == 'x' || c == 'p'){ - 678: 81 e2 f7 00 00 00 and $0xf7,%edx - 67e: 83 fa 70 cmp $0x70,%edx - 681: 74 7a je 6fd - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 683: 83 f8 73 cmp $0x73,%eax - 686: 0f 84 9d 00 00 00 je 729 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 68c: 83 f8 63 cmp $0x63,%eax - 68f: 0f 84 ec 00 00 00 je 781 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 695: 83 f8 25 cmp $0x25,%eax - 698: 0f 84 0f 01 00 00 je 7ad - putc(fd, c); + 680: 89 f8 mov %edi,%eax + 682: 83 c0 04 add $0x4,%eax + 685: 89 45 d4 mov %eax,-0x2c(%ebp) + 688: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 69e: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 6a2: 83 ec 04 sub $0x4,%esp - 6a5: 6a 01 push $0x1 - 6a7: 8d 45 e7 lea -0x19(%ebp),%eax - 6aa: 50 push %eax - 6ab: ff 75 08 pushl 0x8(%ebp) - 6ae: e8 31 fe ff ff call 4e4 putc(fd, c); - 6b3: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 6b6: 83 c4 0c add $0xc,%esp - 6b9: 6a 01 push $0x1 - 6bb: 8d 45 e7 lea -0x19(%ebp),%eax - 6be: 50 push %eax - 6bf: ff 75 08 pushl 0x8(%ebp) - 6c2: e8 1d fe ff ff call 4e4 - putc(fd, c); - 6c7: 83 c4 10 add $0x10,%esp } state = 0; - 6ca: bf 00 00 00 00 mov $0x0,%edi - 6cf: eb 80 jmp 651 - printint(fd, *ap, 10, 1); - 6d1: 83 ec 0c sub $0xc,%esp - 6d4: 6a 01 push $0x1 - 6d6: b9 0a 00 00 00 mov $0xa,%ecx - 6db: 8b 7d d4 mov -0x2c(%ebp),%edi - 6de: 8b 17 mov (%edi),%edx - 6e0: 8b 45 08 mov 0x8(%ebp),%eax - 6e3: e8 8c fe ff ff call 574 - ap++; - 6e8: 89 f8 mov %edi,%eax - 6ea: 83 c0 04 add $0x4,%eax - 6ed: 89 45 d4 mov %eax,-0x2c(%ebp) - 6f0: 83 c4 10 add $0x10,%esp - state = 0; - 6f3: bf 00 00 00 00 mov $0x0,%edi - 6f8: e9 54 ff ff ff jmp 651 + 68b: bf 00 00 00 00 mov $0x0,%edi + 690: eb 96 jmp 628 printint(fd, *ap, 16, 0); - 6fd: 83 ec 0c sub $0xc,%esp - 700: 6a 00 push $0x0 - 702: b9 10 00 00 00 mov $0x10,%ecx - 707: 8b 7d d4 mov -0x2c(%ebp),%edi - 70a: 8b 17 mov (%edi),%edx - 70c: 8b 45 08 mov 0x8(%ebp),%eax - 70f: e8 60 fe ff ff call 574 + 692: 83 ec 0c sub $0xc,%esp + 695: 6a 00 push $0x0 + 697: b9 10 00 00 00 mov $0x10,%ecx + 69c: 8b 7d d4 mov -0x2c(%ebp),%edi + 69f: 8b 17 mov (%edi),%edx + 6a1: 8b 45 08 mov 0x8(%ebp),%eax + 6a4: e8 a2 fe ff ff call 54b ap++; - 714: 89 f8 mov %edi,%eax - 716: 83 c0 04 add $0x4,%eax - 719: 89 45 d4 mov %eax,-0x2c(%ebp) - 71c: 83 c4 10 add $0x10,%esp + 6a9: 89 f8 mov %edi,%eax + 6ab: 83 c0 04 add $0x4,%eax + 6ae: 89 45 d4 mov %eax,-0x2c(%ebp) + 6b1: 83 c4 10 add $0x10,%esp state = 0; - 71f: bf 00 00 00 00 mov $0x0,%edi - 724: e9 28 ff ff ff jmp 651 + 6b4: bf 00 00 00 00 mov $0x0,%edi + 6b9: e9 6a ff ff ff jmp 628 s = (char*)*ap; - 729: 8b 4d d4 mov -0x2c(%ebp),%ecx - 72c: 8b 01 mov (%ecx),%eax + 6be: 8b 4d d4 mov -0x2c(%ebp),%ecx + 6c1: 8b 01 mov (%ecx),%eax ap++; - 72e: 83 c1 04 add $0x4,%ecx - 731: 89 4d d4 mov %ecx,-0x2c(%ebp) + 6c3: 83 c1 04 add $0x4,%ecx + 6c6: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 734: 85 c0 test %eax,%eax - 736: 74 13 je 74b + 6c9: 85 c0 test %eax,%eax + 6cb: 74 13 je 6e0 s = (char*)*ap; - 738: 89 c3 mov %eax,%ebx + 6cd: 89 c3 mov %eax,%ebx while(*s != 0){ - 73a: 0f b6 00 movzbl (%eax),%eax + 6cf: 0f b6 00 movzbl (%eax),%eax state = 0; - 73d: bf 00 00 00 00 mov $0x0,%edi + 6d2: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 742: 84 c0 test %al,%al - 744: 75 0f jne 755 - 746: e9 06 ff ff ff jmp 651 + 6d7: 84 c0 test %al,%al + 6d9: 75 0f jne 6ea + 6db: e9 48 ff ff ff jmp 628 s = "(null)"; - 74b: bb 6a 09 00 00 mov $0x96a,%ebx + 6e0: bb 26 09 00 00 mov $0x926,%ebx while(*s != 0){ - 750: b8 28 00 00 00 mov $0x28,%eax - 755: 8b 7d 08 mov 0x8(%ebp),%edi + 6e5: b8 28 00 00 00 mov $0x28,%eax + 6ea: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 758: 88 45 e7 mov %al,-0x19(%ebp) + 6ed: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 75b: 83 ec 04 sub $0x4,%esp - 75e: 6a 01 push $0x1 - 760: 8d 45 e7 lea -0x19(%ebp),%eax - 763: 50 push %eax - 764: 57 push %edi - 765: e8 7a fd ff ff call 4e4 + 6f0: 83 ec 04 sub $0x4,%esp + 6f3: 6a 01 push $0x1 + 6f5: 8d 45 e7 lea -0x19(%ebp),%eax + 6f8: 50 push %eax + 6f9: 57 push %edi + 6fa: e8 bc fd ff ff call 4bb s++; - 76a: 83 c3 01 add $0x1,%ebx + 6ff: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 76d: 0f b6 03 movzbl (%ebx),%eax - 770: 83 c4 10 add $0x10,%esp - 773: 84 c0 test %al,%al - 775: 75 e1 jne 758 + 702: 0f b6 03 movzbl (%ebx),%eax + 705: 83 c4 10 add $0x10,%esp + 708: 84 c0 test %al,%al + 70a: 75 e1 jne 6ed state = 0; - 777: bf 00 00 00 00 mov $0x0,%edi - 77c: e9 d0 fe ff ff jmp 651 + 70c: bf 00 00 00 00 mov $0x0,%edi + 711: e9 12 ff ff ff jmp 628 putc(fd, *ap); - 781: 8b 7d d4 mov -0x2c(%ebp),%edi - 784: 8b 07 mov (%edi),%eax - 786: 88 45 e7 mov %al,-0x19(%ebp) + 716: 8b 7d d4 mov -0x2c(%ebp),%edi + 719: 8b 07 mov (%edi),%eax + 71b: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 789: 83 ec 04 sub $0x4,%esp - 78c: 6a 01 push $0x1 - 78e: 8d 45 e7 lea -0x19(%ebp),%eax - 791: 50 push %eax - 792: ff 75 08 pushl 0x8(%ebp) - 795: e8 4a fd ff ff call 4e4 + 71e: 83 ec 04 sub $0x4,%esp + 721: 6a 01 push $0x1 + 723: 8d 45 e7 lea -0x19(%ebp),%eax + 726: 50 push %eax + 727: ff 75 08 push 0x8(%ebp) + 72a: e8 8c fd ff ff call 4bb ap++; - 79a: 83 c7 04 add $0x4,%edi - 79d: 89 7d d4 mov %edi,-0x2c(%ebp) - 7a0: 83 c4 10 add $0x10,%esp + 72f: 83 c7 04 add $0x4,%edi + 732: 89 7d d4 mov %edi,-0x2c(%ebp) + 735: 83 c4 10 add $0x10,%esp state = 0; - 7a3: bf 00 00 00 00 mov $0x0,%edi - 7a8: e9 a4 fe ff ff jmp 651 + 738: bf 00 00 00 00 mov $0x0,%edi + 73d: e9 e6 fe ff ff jmp 628 putc(fd, c); - 7ad: 88 5d e7 mov %bl,-0x19(%ebp) + 742: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 745: 83 ec 04 sub $0x4,%esp + 748: 6a 01 push $0x1 + 74a: 8d 45 e7 lea -0x19(%ebp),%eax + 74d: 50 push %eax + 74e: ff 75 08 push 0x8(%ebp) + 751: e8 65 fd ff ff call 4bb + 756: 83 c4 10 add $0x10,%esp + state = 0; + 759: bf 00 00 00 00 mov $0x0,%edi + 75e: e9 c5 fe ff ff jmp 628 + putc(fd, '%'); + 763: c6 45 e7 25 movb $0x25,-0x19(%ebp) write(fd, &c, 1); - 7b0: 83 ec 04 sub $0x4,%esp - 7b3: 6a 01 push $0x1 - 7b5: 8d 45 e7 lea -0x19(%ebp),%eax - 7b8: 50 push %eax - 7b9: ff 75 08 pushl 0x8(%ebp) - 7bc: e8 23 fd ff ff call 4e4 - 7c1: 83 c4 10 add $0x10,%esp + 767: 83 ec 04 sub $0x4,%esp + 76a: 6a 01 push $0x1 + 76c: 8d 45 e7 lea -0x19(%ebp),%eax + 76f: 50 push %eax + 770: ff 75 08 push 0x8(%ebp) + 773: e8 43 fd ff ff call 4bb + putc(fd, c); + 778: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 77b: 83 c4 0c add $0xc,%esp + 77e: 6a 01 push $0x1 + 780: 8d 45 e7 lea -0x19(%ebp),%eax + 783: 50 push %eax + 784: ff 75 08 push 0x8(%ebp) + 787: e8 2f fd ff ff call 4bb + putc(fd, c); + 78c: 83 c4 10 add $0x10,%esp state = 0; - 7c4: bf 00 00 00 00 mov $0x0,%edi - 7c9: e9 83 fe ff ff jmp 651 + 78f: bf 00 00 00 00 mov $0x0,%edi + 794: e9 8f fe ff ff jmp 628 } } } - 7ce: 8d 65 f4 lea -0xc(%ebp),%esp - 7d1: 5b pop %ebx - 7d2: 5e pop %esi - 7d3: 5f pop %edi - 7d4: 5d pop %ebp - 7d5: c3 ret - -000007d6 : + 799: 8d 65 f4 lea -0xc(%ebp),%esp + 79c: 5b pop %ebx + 79d: 5e pop %esi + 79e: 5f pop %edi + 79f: 5d pop %ebp + 7a0: c3 ret + +000007a1 : static Header base; static Header *freep; void free(void *ap) { - 7d6: f3 0f 1e fb endbr32 - 7da: 55 push %ebp - 7db: 89 e5 mov %esp,%ebp - 7dd: 57 push %edi - 7de: 56 push %esi - 7df: 53 push %ebx - 7e0: 8b 5d 08 mov 0x8(%ebp),%ebx + 7a1: 55 push %ebp + 7a2: 89 e5 mov %esp,%ebp + 7a4: 57 push %edi + 7a5: 56 push %esi + 7a6: 53 push %ebx + 7a7: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 7e3: 8d 4b f8 lea -0x8(%ebx),%ecx + 7aa: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 7e6: a1 50 0c 00 00 mov 0xc50,%eax - 7eb: eb 0c jmp 7f9 + 7ad: a1 68 0c 00 00 mov 0xc68,%eax + 7b2: eb 0c jmp 7c0 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 7ed: 8b 10 mov (%eax),%edx - 7ef: 39 c2 cmp %eax,%edx - 7f1: 77 04 ja 7f7 - 7f3: 39 ca cmp %ecx,%edx - 7f5: 77 10 ja 807 + 7b4: 8b 10 mov (%eax),%edx + 7b6: 39 c2 cmp %eax,%edx + 7b8: 77 04 ja 7be + 7ba: 39 ca cmp %ecx,%edx + 7bc: 77 10 ja 7ce { - 7f7: 89 d0 mov %edx,%eax + 7be: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 7f9: 39 c8 cmp %ecx,%eax - 7fb: 73 f0 jae 7ed - 7fd: 8b 10 mov (%eax),%edx - 7ff: 39 ca cmp %ecx,%edx - 801: 77 04 ja 807 + 7c0: 39 c8 cmp %ecx,%eax + 7c2: 73 f0 jae 7b4 + 7c4: 8b 10 mov (%eax),%edx + 7c6: 39 ca cmp %ecx,%edx + 7c8: 77 04 ja 7ce if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 803: 39 c2 cmp %eax,%edx - 805: 77 f0 ja 7f7 + 7ca: 39 c2 cmp %eax,%edx + 7cc: 77 f0 ja 7be break; if(bp + bp->s.size == p->s.ptr){ - 807: 8b 73 fc mov -0x4(%ebx),%esi - 80a: 8b 10 mov (%eax),%edx - 80c: 8d 3c f1 lea (%ecx,%esi,8),%edi - 80f: 39 fa cmp %edi,%edx - 811: 74 19 je 82c + 7ce: 8b 73 fc mov -0x4(%ebx),%esi + 7d1: 8b 10 mov (%eax),%edx + 7d3: 8d 3c f1 lea (%ecx,%esi,8),%edi + 7d6: 39 fa cmp %edi,%edx + 7d8: 74 19 je 7f3 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 7da: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 813: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 816: 8b 50 04 mov 0x4(%eax),%edx - 819: 8d 34 d0 lea (%eax,%edx,8),%esi - 81c: 39 f1 cmp %esi,%ecx - 81e: 74 1b je 83b + 7dd: 8b 50 04 mov 0x4(%eax),%edx + 7e0: 8d 34 d0 lea (%eax,%edx,8),%esi + 7e3: 39 f1 cmp %esi,%ecx + 7e5: 74 18 je 7ff p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 7e7: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 820: 89 08 mov %ecx,(%eax) freep = p; - 822: a3 50 0c 00 00 mov %eax,0xc50 + 7e9: a3 68 0c 00 00 mov %eax,0xc68 } - 827: 5b pop %ebx - 828: 5e pop %esi - 829: 5f pop %edi - 82a: 5d pop %ebp - 82b: c3 ret + 7ee: 5b pop %ebx + 7ef: 5e pop %esi + 7f0: 5f pop %edi + 7f1: 5d pop %ebp + 7f2: c3 ret bp->s.size += p->s.ptr->s.size; - 82c: 03 72 04 add 0x4(%edx),%esi - 82f: 89 73 fc mov %esi,-0x4(%ebx) + 7f3: 03 72 04 add 0x4(%edx),%esi + 7f6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 832: 8b 10 mov (%eax),%edx - 834: 8b 12 mov (%edx),%edx - 836: 89 53 f8 mov %edx,-0x8(%ebx) - 839: eb db jmp 816 + 7f9: 8b 10 mov (%eax),%edx + 7fb: 8b 12 mov (%edx),%edx + 7fd: eb db jmp 7da p->s.size += bp->s.size; - 83b: 03 53 fc add -0x4(%ebx),%edx - 83e: 89 50 04 mov %edx,0x4(%eax) + 7ff: 03 53 fc add -0x4(%ebx),%edx + 802: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 841: 8b 53 f8 mov -0x8(%ebx),%edx - 844: 89 10 mov %edx,(%eax) - 846: eb da jmp 822 + 805: 8b 4b f8 mov -0x8(%ebx),%ecx + 808: eb dd jmp 7e7 -00000848 : +0000080a : return freep; } void* malloc(uint nbytes) { - 848: f3 0f 1e fb endbr32 - 84c: 55 push %ebp - 84d: 89 e5 mov %esp,%ebp - 84f: 57 push %edi - 850: 56 push %esi - 851: 53 push %ebx - 852: 83 ec 0c sub $0xc,%esp + 80a: 55 push %ebp + 80b: 89 e5 mov %esp,%ebp + 80d: 57 push %edi + 80e: 56 push %esi + 80f: 53 push %ebx + 810: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 855: 8b 45 08 mov 0x8(%ebp),%eax - 858: 8d 58 07 lea 0x7(%eax),%ebx - 85b: c1 eb 03 shr $0x3,%ebx - 85e: 83 c3 01 add $0x1,%ebx + 813: 8b 45 08 mov 0x8(%ebp),%eax + 816: 8d 58 07 lea 0x7(%eax),%ebx + 819: c1 eb 03 shr $0x3,%ebx + 81c: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 861: 8b 15 50 0c 00 00 mov 0xc50,%edx - 867: 85 d2 test %edx,%edx - 869: 74 20 je 88b + 81f: 8b 15 68 0c 00 00 mov 0xc68,%edx + 825: 85 d2 test %edx,%edx + 827: 74 1c je 845 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 86b: 8b 02 mov (%edx),%eax + 829: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 86d: 8b 48 04 mov 0x4(%eax),%ecx - 870: 39 cb cmp %ecx,%ebx - 872: 76 3c jbe 8b0 - 874: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 87a: be 00 10 00 00 mov $0x1000,%esi - 87f: 0f 43 f3 cmovae %ebx,%esi + 82b: 8b 48 04 mov 0x4(%eax),%ecx + 82e: 39 cb cmp %ecx,%ebx + 830: 76 38 jbe 86a + 832: be 00 10 00 00 mov $0x1000,%esi + 837: 39 f3 cmp %esi,%ebx + 839: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 882: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 889: eb 72 jmp 8fd + 83c: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 843: eb 72 jmp 8b7 base.s.ptr = freep = prevp = &base; - 88b: c7 05 50 0c 00 00 54 movl $0xc54,0xc50 - 892: 0c 00 00 - 895: c7 05 54 0c 00 00 54 movl $0xc54,0xc54 - 89c: 0c 00 00 + 845: c7 05 68 0c 00 00 6c movl $0xc6c,0xc68 + 84c: 0c 00 00 + 84f: c7 05 6c 0c 00 00 6c movl $0xc6c,0xc6c + 856: 0c 00 00 base.s.size = 0; - 89f: c7 05 58 0c 00 00 00 movl $0x0,0xc58 - 8a6: 00 00 00 + 859: c7 05 70 0c 00 00 00 movl $0x0,0xc70 + 860: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 8a9: b8 54 0c 00 00 mov $0xc54,%eax - 8ae: eb c4 jmp 874 + 863: b8 6c 0c 00 00 mov $0xc6c,%eax + 868: eb c8 jmp 832 if(p->s.size == nunits) - 8b0: 39 cb cmp %ecx,%ebx - 8b2: 74 1e je 8d2 + 86a: 39 cb cmp %ecx,%ebx + 86c: 74 1e je 88c prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 8b4: 29 d9 sub %ebx,%ecx - 8b6: 89 48 04 mov %ecx,0x4(%eax) + 86e: 29 d9 sub %ebx,%ecx + 870: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 8b9: 8d 04 c8 lea (%eax,%ecx,8),%eax + 873: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 8bc: 89 58 04 mov %ebx,0x4(%eax) + 876: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 8bf: 89 15 50 0c 00 00 mov %edx,0xc50 + 879: 89 15 68 0c 00 00 mov %edx,0xc68 return (void*)(p + 1); - 8c5: 8d 50 08 lea 0x8(%eax),%edx + 87f: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 8c8: 89 d0 mov %edx,%eax - 8ca: 8d 65 f4 lea -0xc(%ebp),%esp - 8cd: 5b pop %ebx - 8ce: 5e pop %esi - 8cf: 5f pop %edi - 8d0: 5d pop %ebp - 8d1: c3 ret + 882: 89 d0 mov %edx,%eax + 884: 8d 65 f4 lea -0xc(%ebp),%esp + 887: 5b pop %ebx + 888: 5e pop %esi + 889: 5f pop %edi + 88a: 5d pop %ebp + 88b: c3 ret prevp->s.ptr = p->s.ptr; - 8d2: 8b 08 mov (%eax),%ecx - 8d4: 89 0a mov %ecx,(%edx) - 8d6: eb e7 jmp 8bf + 88c: 8b 08 mov (%eax),%ecx + 88e: 89 0a mov %ecx,(%edx) + 890: eb e7 jmp 879 hp->s.size = nu; - 8d8: 89 70 04 mov %esi,0x4(%eax) + 892: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 8db: 83 ec 0c sub $0xc,%esp - 8de: 83 c0 08 add $0x8,%eax - 8e1: 50 push %eax - 8e2: e8 ef fe ff ff call 7d6 + 895: 83 ec 0c sub $0xc,%esp + 898: 83 c0 08 add $0x8,%eax + 89b: 50 push %eax + 89c: e8 00 ff ff ff call 7a1 return freep; - 8e7: 8b 15 50 0c 00 00 mov 0xc50,%edx + 8a1: 8b 15 68 0c 00 00 mov 0xc68,%edx if((p = morecore(nunits)) == 0) - 8ed: 83 c4 10 add $0x10,%esp - 8f0: 85 d2 test %edx,%edx - 8f2: 74 d4 je 8c8 + 8a7: 83 c4 10 add $0x10,%esp + 8aa: 85 d2 test %edx,%edx + 8ac: 74 d4 je 882 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 8f4: 8b 02 mov (%edx),%eax + 8ae: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 8f6: 8b 48 04 mov 0x4(%eax),%ecx - 8f9: 39 d9 cmp %ebx,%ecx - 8fb: 73 b3 jae 8b0 + 8b0: 8b 48 04 mov 0x4(%eax),%ecx + 8b3: 39 d9 cmp %ebx,%ecx + 8b5: 73 b3 jae 86a if(p == freep) - 8fd: 89 c2 mov %eax,%edx - 8ff: 39 05 50 0c 00 00 cmp %eax,0xc50 - 905: 75 ed jne 8f4 + 8b7: 89 c2 mov %eax,%edx + 8b9: 39 05 68 0c 00 00 cmp %eax,0xc68 + 8bf: 75 ed jne 8ae p = sbrk(nu * sizeof(Header)); - 907: 83 ec 0c sub $0xc,%esp - 90a: 57 push %edi - 90b: e8 3c fc ff ff call 54c + 8c1: 83 ec 0c sub $0xc,%esp + 8c4: 57 push %edi + 8c5: e8 59 fc ff ff call 523 if(p == (char*)-1) - 910: 83 c4 10 add $0x10,%esp - 913: 83 f8 ff cmp $0xffffffff,%eax - 916: 75 c0 jne 8d8 + 8ca: 83 c4 10 add $0x10,%esp + 8cd: 83 f8 ff cmp $0xffffffff,%eax + 8d0: 75 c0 jne 892 return 0; - 918: ba 00 00 00 00 mov $0x0,%edx - 91d: eb a9 jmp 8c8 + 8d2: ba 00 00 00 00 mov $0x0,%edx + 8d7: eb a9 jmp 882 diff --git a/src/user/ls.d b/src/user/ls.d new file mode 100644 index 0000000..abb2715 --- /dev/null +++ b/src/user/ls.d @@ -0,0 +1,2 @@ +user/ls.o: user/ls.c /usr/include/stdc-predef.h types.h stat.h user.h \ + fs.h diff --git a/src/user/ls.o b/src/user/ls.o new file mode 100644 index 0000000..4b78b8f Binary files /dev/null and b/src/user/ls.o differ diff --git a/src/user/ls.sym b/src/user/ls.sym index e7d451c..4102590 100644 --- a/src/user/ls.sym +++ b/src/user/ls.sym @@ -1,62 +1,50 @@ -00000000 .text -00000920 .rodata -00000988 .eh_frame -00000c40 .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 ls.c -00000c40 buf.1100 +00000c58 buf.0 00000000 ulib.c 00000000 printf.c -00000574 printint -00000974 digits.1089 +0000054b printint +00000988 digits.0 00000000 umalloc.c -00000c50 freep -00000c54 base -000002de strcpy +00000c68 freep +00000c6c base +000002d3 strcpy 00000000 fmtname -00000608 printf -0000048b memmove -0000050c mknod -0000056c ps -000003a9 gets -00000544 getpid -00000848 malloc -00000554 sleep -000004d4 pipe -00000564 slabtest -000004e4 write -0000051c fstat -000004f4 kill -00000534 chdir -000004fc exec -000004cc wait -000004dc read -00000514 unlink -000004bc fork -0000054c sbrk -0000055c uptime -00000c40 __bss_start -0000035d memset -0000028c main -00000304 strcmp -0000053c dup -00000404 stat -00000c40 _edata -00000c5c _end -00000524 link -00000091 ls -000004c4 exit -0000044c atoi -00000333 strlen -00000504 open -00000378 strchr -0000052c mkdir -000004ec close -000007d6 free +000005e3 printf +00000466 memmove +000004e3 mknod +00000543 ps +0000038e gets +0000051b getpid +0000080a malloc +0000052b sleep +000004ab pipe +0000053b slabtest +000004bb write +000004f3 fstat +000004cb kill +0000050b chdir +000004d3 exec +000004a3 wait +000004b3 read +000004eb unlink +00000493 fork +00000523 sbrk +00000533 uptime +00000c58 __bss_start +00000348 memset +00000284 main +000002f7 strcmp +00000513 dup +000003e5 stat +00000c58 _edata +00000c74 _end +000004fb link +0000008d ls +0000049b exit +00000429 atoi +00000322 strlen +000004db open +00000361 strchr +00000503 mkdir +000004c3 close +000007a1 free diff --git a/src/user/mkdir.asm b/src/user/mkdir.asm index 9de6033..03d695c 100644 --- a/src/user/mkdir.asm +++ b/src/user/mkdir.asm @@ -11,1081 +11,1050 @@ Disassembly of section .text: int main(int argc, char *argv[]) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 57 push %edi - 12: 56 push %esi - 13: 53 push %ebx - 14: 51 push %ecx - 15: 83 ec 18 sub $0x18,%esp - 18: 8b 39 mov (%ecx),%edi - 1a: 8b 59 04 mov 0x4(%ecx),%ebx + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 57 push %edi + e: 56 push %esi + f: 53 push %ebx + 10: 51 push %ecx + 11: 83 ec 18 sub $0x18,%esp + 14: 8b 39 mov (%ecx),%edi + 16: 8b 59 04 mov 0x4(%ecx),%ebx int i; if(argc < 2){ - 1d: 83 c3 04 add $0x4,%ebx + 19: 83 c3 04 add $0x4,%ebx printf(2, "Usage: mkdir files...\n"); exit(); } for(i = 1; i < argc; i++){ - 20: be 01 00 00 00 mov $0x1,%esi + 1c: be 01 00 00 00 mov $0x1,%esi if(argc < 2){ - 25: 83 ff 01 cmp $0x1,%edi - 28: 7e 20 jle 4a + 21: 83 ff 01 cmp $0x1,%edi + 24: 7e 20 jle 46 if(mkdir(argv[i]) < 0){ - 2a: 89 5d e4 mov %ebx,-0x1c(%ebp) - 2d: 83 ec 0c sub $0xc,%esp - 30: ff 33 pushl (%ebx) - 32: e8 91 02 00 00 call 2c8 - 37: 83 c4 10 add $0x10,%esp - 3a: 85 c0 test %eax,%eax - 3c: 78 20 js 5e + 26: 89 5d e4 mov %ebx,-0x1c(%ebp) + 29: 83 ec 0c sub $0xc,%esp + 2c: ff 33 push (%ebx) + 2e: e8 73 02 00 00 call 2a6 + 33: 83 c4 10 add $0x10,%esp + 36: 85 c0 test %eax,%eax + 38: 78 20 js 5a for(i = 1; i < argc; i++){ - 3e: 83 c6 01 add $0x1,%esi - 41: 83 c3 04 add $0x4,%ebx - 44: 39 f7 cmp %esi,%edi - 46: 75 e2 jne 2a - 48: eb 2b jmp 75 + 3a: 83 c6 01 add $0x1,%esi + 3d: 83 c3 04 add $0x4,%ebx + 40: 39 f7 cmp %esi,%edi + 42: 75 e2 jne 26 + 44: eb 2b jmp 71 printf(2, "Usage: mkdir files...\n"); - 4a: 83 ec 08 sub $0x8,%esp - 4d: 68 bc 06 00 00 push $0x6bc - 52: 6a 02 push $0x2 - 54: e8 4b 03 00 00 call 3a4 + 46: 83 ec 08 sub $0x8,%esp + 49: 68 7c 06 00 00 push $0x67c + 4e: 6a 02 push $0x2 + 50: e8 31 03 00 00 call 386 exit(); - 59: e8 02 02 00 00 call 260 + 55: e8 e4 01 00 00 call 23e printf(2, "mkdir: %s failed to create\n", argv[i]); - 5e: 83 ec 04 sub $0x4,%esp - 61: 8b 45 e4 mov -0x1c(%ebp),%eax - 64: ff 30 pushl (%eax) - 66: 68 d3 06 00 00 push $0x6d3 - 6b: 6a 02 push $0x2 - 6d: e8 32 03 00 00 call 3a4 + 5a: 83 ec 04 sub $0x4,%esp + 5d: 8b 45 e4 mov -0x1c(%ebp),%eax + 60: ff 30 push (%eax) + 62: 68 93 06 00 00 push $0x693 + 67: 6a 02 push $0x2 + 69: e8 18 03 00 00 call 386 break; - 72: 83 c4 10 add $0x10,%esp + 6e: 83 c4 10 add $0x10,%esp } } exit(); - 75: e8 e6 01 00 00 call 260 + 71: e8 c8 01 00 00 call 23e -0000007a : +00000076 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 7a: f3 0f 1e fb endbr32 - 7e: 55 push %ebp - 7f: 89 e5 mov %esp,%ebp - 81: 53 push %ebx - 82: 8b 4d 08 mov 0x8(%ebp),%ecx - 85: 8b 5d 0c mov 0xc(%ebp),%ebx + 76: 55 push %ebp + 77: 89 e5 mov %esp,%ebp + 79: 53 push %ebx + 7a: 8b 4d 08 mov 0x8(%ebp),%ecx + 7d: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 88: b8 00 00 00 00 mov $0x0,%eax - 8d: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 91: 88 14 01 mov %dl,(%ecx,%eax,1) - 94: 83 c0 01 add $0x1,%eax - 97: 84 d2 test %dl,%dl - 99: 75 f2 jne 8d + 80: b8 00 00 00 00 mov $0x0,%eax + 85: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 89: 88 14 01 mov %dl,(%ecx,%eax,1) + 8c: 83 c0 01 add $0x1,%eax + 8f: 84 d2 test %dl,%dl + 91: 75 f2 jne 85 ; return os; } - 9b: 89 c8 mov %ecx,%eax - 9d: 5b pop %ebx - 9e: 5d pop %ebp - 9f: c3 ret + 93: 89 c8 mov %ecx,%eax + 95: 8b 5d fc mov -0x4(%ebp),%ebx + 98: c9 leave + 99: c3 ret -000000a0 : +0000009a : int strcmp(const char *p, const char *q) { - a0: f3 0f 1e fb endbr32 - a4: 55 push %ebp - a5: 89 e5 mov %esp,%ebp - a7: 8b 4d 08 mov 0x8(%ebp),%ecx - aa: 8b 55 0c mov 0xc(%ebp),%edx + 9a: 55 push %ebp + 9b: 89 e5 mov %esp,%ebp + 9d: 8b 4d 08 mov 0x8(%ebp),%ecx + a0: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - ad: 0f b6 01 movzbl (%ecx),%eax - b0: 84 c0 test %al,%al - b2: 74 11 je c5 - b4: 38 02 cmp %al,(%edx) - b6: 75 0d jne c5 + a3: 0f b6 01 movzbl (%ecx),%eax + a6: 84 c0 test %al,%al + a8: 74 11 je bb + aa: 38 02 cmp %al,(%edx) + ac: 75 0d jne bb p++, q++; - b8: 83 c1 01 add $0x1,%ecx - bb: 83 c2 01 add $0x1,%edx + ae: 83 c1 01 add $0x1,%ecx + b1: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - be: 0f b6 01 movzbl (%ecx),%eax - c1: 84 c0 test %al,%al - c3: 75 ef jne b4 + b4: 0f b6 01 movzbl (%ecx),%eax + b7: 84 c0 test %al,%al + b9: 75 ef jne aa return (uchar)*p - (uchar)*q; - c5: 0f b6 c0 movzbl %al,%eax - c8: 0f b6 12 movzbl (%edx),%edx - cb: 29 d0 sub %edx,%eax + bb: 0f b6 c0 movzbl %al,%eax + be: 0f b6 12 movzbl (%edx),%edx + c1: 29 d0 sub %edx,%eax } - cd: 5d pop %ebp - ce: c3 ret + c3: 5d pop %ebp + c4: c3 ret -000000cf : +000000c5 : uint strlen(const char *s) { - cf: f3 0f 1e fb endbr32 - d3: 55 push %ebp - d4: 89 e5 mov %esp,%ebp - d6: 8b 55 08 mov 0x8(%ebp),%edx + c5: 55 push %ebp + c6: 89 e5 mov %esp,%ebp + c8: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - d9: 80 3a 00 cmpb $0x0,(%edx) - dc: 74 14 je f2 - de: b8 00 00 00 00 mov $0x0,%eax - e3: 83 c0 01 add $0x1,%eax - e6: 89 c1 mov %eax,%ecx - e8: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - ec: 75 f5 jne e3 + cb: 80 3a 00 cmpb $0x0,(%edx) + ce: 74 14 je e4 + d0: b8 00 00 00 00 mov $0x0,%eax + d5: 83 c0 01 add $0x1,%eax + d8: 89 c1 mov %eax,%ecx + da: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + de: 75 f5 jne d5 ; return n; } - ee: 89 c8 mov %ecx,%eax - f0: 5d pop %ebp - f1: c3 ret + e0: 89 c8 mov %ecx,%eax + e2: 5d pop %ebp + e3: c3 ret for(n = 0; s[n]; n++) - f2: b9 00 00 00 00 mov $0x0,%ecx + e4: b9 00 00 00 00 mov $0x0,%ecx return n; - f7: eb f5 jmp ee + e9: eb f5 jmp e0 -000000f9 : +000000eb : void* memset(void *dst, int c, uint n) { - f9: f3 0f 1e fb endbr32 - fd: 55 push %ebp - fe: 89 e5 mov %esp,%ebp - 100: 57 push %edi - 101: 8b 55 08 mov 0x8(%ebp),%edx + eb: 55 push %ebp + ec: 89 e5 mov %esp,%ebp + ee: 57 push %edi + ef: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 104: 89 d7 mov %edx,%edi - 106: 8b 4d 10 mov 0x10(%ebp),%ecx - 109: 8b 45 0c mov 0xc(%ebp),%eax - 10c: fc cld - 10d: f3 aa rep stos %al,%es:(%edi) + f2: 89 d7 mov %edx,%edi + f4: 8b 4d 10 mov 0x10(%ebp),%ecx + f7: 8b 45 0c mov 0xc(%ebp),%eax + fa: fc cld + fb: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 10f: 89 d0 mov %edx,%eax - 111: 5f pop %edi - 112: 5d pop %ebp - 113: c3 ret + fd: 89 d0 mov %edx,%eax + ff: 8b 7d fc mov -0x4(%ebp),%edi + 102: c9 leave + 103: c3 ret -00000114 : +00000104 : char* strchr(const char *s, char c) { - 114: f3 0f 1e fb endbr32 - 118: 55 push %ebp - 119: 89 e5 mov %esp,%ebp - 11b: 8b 45 08 mov 0x8(%ebp),%eax - 11e: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 104: 55 push %ebp + 105: 89 e5 mov %esp,%ebp + 107: 8b 45 08 mov 0x8(%ebp),%eax + 10a: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 122: 0f b6 10 movzbl (%eax),%edx - 125: 84 d2 test %dl,%dl - 127: 74 15 je 13e + 10e: 0f b6 10 movzbl (%eax),%edx + 111: 84 d2 test %dl,%dl + 113: 74 15 je 12a if(*s == c) - 129: 38 d1 cmp %dl,%cl - 12b: 74 0f je 13c + 115: 38 d1 cmp %dl,%cl + 117: 74 0f je 128 for(; *s; s++) - 12d: 83 c0 01 add $0x1,%eax - 130: 0f b6 10 movzbl (%eax),%edx - 133: 84 d2 test %dl,%dl - 135: 75 f2 jne 129 + 119: 83 c0 01 add $0x1,%eax + 11c: 0f b6 10 movzbl (%eax),%edx + 11f: 84 d2 test %dl,%dl + 121: 75 f2 jne 115 return (char*)s; return 0; - 137: b8 00 00 00 00 mov $0x0,%eax + 123: b8 00 00 00 00 mov $0x0,%eax } - 13c: 5d pop %ebp - 13d: c3 ret + 128: 5d pop %ebp + 129: c3 ret return 0; - 13e: b8 00 00 00 00 mov $0x0,%eax - 143: eb f7 jmp 13c + 12a: b8 00 00 00 00 mov $0x0,%eax + 12f: eb f7 jmp 128 -00000145 : +00000131 : char* gets(char *buf, int max) { - 145: f3 0f 1e fb endbr32 - 149: 55 push %ebp - 14a: 89 e5 mov %esp,%ebp - 14c: 57 push %edi - 14d: 56 push %esi - 14e: 53 push %ebx - 14f: 83 ec 2c sub $0x2c,%esp - 152: 8b 75 08 mov 0x8(%ebp),%esi + 131: 55 push %ebp + 132: 89 e5 mov %esp,%ebp + 134: 57 push %edi + 135: 56 push %esi + 136: 53 push %ebx + 137: 83 ec 2c sub $0x2c,%esp + 13a: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 155: bb 00 00 00 00 mov $0x0,%ebx + 13d: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 15a: 8d 7d e7 lea -0x19(%ebp),%edi + 142: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 15d: 89 5d d4 mov %ebx,-0x2c(%ebp) - 160: 83 c3 01 add $0x1,%ebx - 163: 3b 5d 0c cmp 0xc(%ebp),%ebx - 166: 7d 27 jge 18f + 145: 89 5d d4 mov %ebx,-0x2c(%ebp) + 148: 83 c3 01 add $0x1,%ebx + 14b: 3b 5d 0c cmp 0xc(%ebp),%ebx + 14e: 7d 27 jge 177 cc = read(0, &c, 1); - 168: 83 ec 04 sub $0x4,%esp - 16b: 6a 01 push $0x1 - 16d: 57 push %edi - 16e: 6a 00 push $0x0 - 170: e8 03 01 00 00 call 278 + 150: 83 ec 04 sub $0x4,%esp + 153: 6a 01 push $0x1 + 155: 57 push %edi + 156: 6a 00 push $0x0 + 158: e8 f9 00 00 00 call 256 if(cc < 1) - 175: 83 c4 10 add $0x10,%esp - 178: 85 c0 test %eax,%eax - 17a: 7e 13 jle 18f + 15d: 83 c4 10 add $0x10,%esp + 160: 85 c0 test %eax,%eax + 162: 7e 13 jle 177 break; buf[i++] = c; - 17c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 180: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 164: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 168: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 184: 3c 0a cmp $0xa,%al - 186: 74 04 je 18c - 188: 3c 0d cmp $0xd,%al - 18a: 75 d1 jne 15d + 16c: 3c 0a cmp $0xa,%al + 16e: 74 04 je 174 + 170: 3c 0d cmp $0xd,%al + 172: 75 d1 jne 145 for(i=0; i+1 < max; ){ - 18c: 89 5d d4 mov %ebx,-0x2c(%ebp) + 174: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 18f: 8b 45 d4 mov -0x2c(%ebp),%eax - 192: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 177: 8b 45 d4 mov -0x2c(%ebp),%eax + 17a: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 196: 89 f0 mov %esi,%eax - 198: 8d 65 f4 lea -0xc(%ebp),%esp - 19b: 5b pop %ebx - 19c: 5e pop %esi - 19d: 5f pop %edi - 19e: 5d pop %ebp - 19f: c3 ret + 17e: 89 f0 mov %esi,%eax + 180: 8d 65 f4 lea -0xc(%ebp),%esp + 183: 5b pop %ebx + 184: 5e pop %esi + 185: 5f pop %edi + 186: 5d pop %ebp + 187: c3 ret -000001a0 : +00000188 : int stat(const char *n, struct stat *st) { - 1a0: f3 0f 1e fb endbr32 - 1a4: 55 push %ebp - 1a5: 89 e5 mov %esp,%ebp - 1a7: 56 push %esi - 1a8: 53 push %ebx + 188: 55 push %ebp + 189: 89 e5 mov %esp,%ebp + 18b: 56 push %esi + 18c: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 1a9: 83 ec 08 sub $0x8,%esp - 1ac: 6a 00 push $0x0 - 1ae: ff 75 08 pushl 0x8(%ebp) - 1b1: e8 ea 00 00 00 call 2a0 + 18d: 83 ec 08 sub $0x8,%esp + 190: 6a 00 push $0x0 + 192: ff 75 08 push 0x8(%ebp) + 195: e8 e4 00 00 00 call 27e if(fd < 0) - 1b6: 83 c4 10 add $0x10,%esp - 1b9: 85 c0 test %eax,%eax - 1bb: 78 24 js 1e1 - 1bd: 89 c3 mov %eax,%ebx + 19a: 83 c4 10 add $0x10,%esp + 19d: 85 c0 test %eax,%eax + 19f: 78 24 js 1c5 + 1a1: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 1bf: 83 ec 08 sub $0x8,%esp - 1c2: ff 75 0c pushl 0xc(%ebp) - 1c5: 50 push %eax - 1c6: e8 ed 00 00 00 call 2b8 - 1cb: 89 c6 mov %eax,%esi + 1a3: 83 ec 08 sub $0x8,%esp + 1a6: ff 75 0c push 0xc(%ebp) + 1a9: 50 push %eax + 1aa: e8 e7 00 00 00 call 296 + 1af: 89 c6 mov %eax,%esi close(fd); - 1cd: 89 1c 24 mov %ebx,(%esp) - 1d0: e8 b3 00 00 00 call 288 + 1b1: 89 1c 24 mov %ebx,(%esp) + 1b4: e8 ad 00 00 00 call 266 return r; - 1d5: 83 c4 10 add $0x10,%esp + 1b9: 83 c4 10 add $0x10,%esp } - 1d8: 89 f0 mov %esi,%eax - 1da: 8d 65 f8 lea -0x8(%ebp),%esp - 1dd: 5b pop %ebx - 1de: 5e pop %esi - 1df: 5d pop %ebp - 1e0: c3 ret + 1bc: 89 f0 mov %esi,%eax + 1be: 8d 65 f8 lea -0x8(%ebp),%esp + 1c1: 5b pop %ebx + 1c2: 5e pop %esi + 1c3: 5d pop %ebp + 1c4: c3 ret return -1; - 1e1: be ff ff ff ff mov $0xffffffff,%esi - 1e6: eb f0 jmp 1d8 + 1c5: be ff ff ff ff mov $0xffffffff,%esi + 1ca: eb f0 jmp 1bc -000001e8 : +000001cc : int atoi(const char *s) { - 1e8: f3 0f 1e fb endbr32 - 1ec: 55 push %ebp - 1ed: 89 e5 mov %esp,%ebp - 1ef: 53 push %ebx - 1f0: 8b 55 08 mov 0x8(%ebp),%edx + 1cc: 55 push %ebp + 1cd: 89 e5 mov %esp,%ebp + 1cf: 53 push %ebx + 1d0: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1f3: 0f b6 02 movzbl (%edx),%eax - 1f6: 8d 48 d0 lea -0x30(%eax),%ecx - 1f9: 80 f9 09 cmp $0x9,%cl - 1fc: 77 22 ja 220 + 1d3: 0f b6 02 movzbl (%edx),%eax + 1d6: 8d 48 d0 lea -0x30(%eax),%ecx + 1d9: 80 f9 09 cmp $0x9,%cl + 1dc: 77 24 ja 202 n = 0; - 1fe: b9 00 00 00 00 mov $0x0,%ecx + 1de: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 203: 83 c2 01 add $0x1,%edx - 206: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 209: 0f be c0 movsbl %al,%eax - 20c: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 1e3: 83 c2 01 add $0x1,%edx + 1e6: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 1e9: 0f be c0 movsbl %al,%eax + 1ec: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 210: 0f b6 02 movzbl (%edx),%eax - 213: 8d 58 d0 lea -0x30(%eax),%ebx - 216: 80 fb 09 cmp $0x9,%bl - 219: 76 e8 jbe 203 + 1f0: 0f b6 02 movzbl (%edx),%eax + 1f3: 8d 58 d0 lea -0x30(%eax),%ebx + 1f6: 80 fb 09 cmp $0x9,%bl + 1f9: 76 e8 jbe 1e3 return n; } - 21b: 89 c8 mov %ecx,%eax - 21d: 5b pop %ebx - 21e: 5d pop %ebp - 21f: c3 ret + 1fb: 89 c8 mov %ecx,%eax + 1fd: 8b 5d fc mov -0x4(%ebp),%ebx + 200: c9 leave + 201: c3 ret n = 0; - 220: b9 00 00 00 00 mov $0x0,%ecx + 202: b9 00 00 00 00 mov $0x0,%ecx return n; - 225: eb f4 jmp 21b + 207: eb f2 jmp 1fb -00000227 : +00000209 : void* memmove(void *vdst, const void *vsrc, int n) { - 227: f3 0f 1e fb endbr32 - 22b: 55 push %ebp - 22c: 89 e5 mov %esp,%ebp - 22e: 56 push %esi - 22f: 53 push %ebx - 230: 8b 75 08 mov 0x8(%ebp),%esi - 233: 8b 55 0c mov 0xc(%ebp),%edx - 236: 8b 5d 10 mov 0x10(%ebp),%ebx + 209: 55 push %ebp + 20a: 89 e5 mov %esp,%ebp + 20c: 56 push %esi + 20d: 53 push %ebx + 20e: 8b 75 08 mov 0x8(%ebp),%esi + 211: 8b 55 0c mov 0xc(%ebp),%edx + 214: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 239: 85 db test %ebx,%ebx - 23b: 7e 15 jle 252 - 23d: 01 f3 add %esi,%ebx + 217: 85 db test %ebx,%ebx + 219: 7e 15 jle 230 + 21b: 01 f3 add %esi,%ebx dst = vdst; - 23f: 89 f0 mov %esi,%eax + 21d: 89 f0 mov %esi,%eax *dst++ = *src++; - 241: 83 c2 01 add $0x1,%edx - 244: 83 c0 01 add $0x1,%eax - 247: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 24b: 88 48 ff mov %cl,-0x1(%eax) + 21f: 83 c2 01 add $0x1,%edx + 222: 83 c0 01 add $0x1,%eax + 225: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 229: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 24e: 39 c3 cmp %eax,%ebx - 250: 75 ef jne 241 + 22c: 39 c3 cmp %eax,%ebx + 22e: 75 ef jne 21f return vdst; } - 252: 89 f0 mov %esi,%eax - 254: 5b pop %ebx - 255: 5e pop %esi - 256: 5d pop %ebp - 257: c3 ret + 230: 89 f0 mov %esi,%eax + 232: 5b pop %ebx + 233: 5e pop %esi + 234: 5d pop %ebp + 235: c3 ret -00000258 : +00000236 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 258: b8 01 00 00 00 mov $0x1,%eax - 25d: cd 40 int $0x40 - 25f: c3 ret + 236: b8 01 00 00 00 mov $0x1,%eax + 23b: cd 40 int $0x40 + 23d: c3 ret -00000260 : +0000023e : SYSCALL(exit) - 260: b8 02 00 00 00 mov $0x2,%eax - 265: cd 40 int $0x40 - 267: c3 ret + 23e: b8 02 00 00 00 mov $0x2,%eax + 243: cd 40 int $0x40 + 245: c3 ret -00000268 : +00000246 : SYSCALL(wait) - 268: b8 03 00 00 00 mov $0x3,%eax - 26d: cd 40 int $0x40 - 26f: c3 ret + 246: b8 03 00 00 00 mov $0x3,%eax + 24b: cd 40 int $0x40 + 24d: c3 ret -00000270 : +0000024e : SYSCALL(pipe) - 270: b8 04 00 00 00 mov $0x4,%eax - 275: cd 40 int $0x40 - 277: c3 ret + 24e: b8 04 00 00 00 mov $0x4,%eax + 253: cd 40 int $0x40 + 255: c3 ret -00000278 : +00000256 : SYSCALL(read) - 278: b8 05 00 00 00 mov $0x5,%eax - 27d: cd 40 int $0x40 - 27f: c3 ret + 256: b8 05 00 00 00 mov $0x5,%eax + 25b: cd 40 int $0x40 + 25d: c3 ret -00000280 : +0000025e : SYSCALL(write) - 280: b8 10 00 00 00 mov $0x10,%eax - 285: cd 40 int $0x40 - 287: c3 ret + 25e: b8 10 00 00 00 mov $0x10,%eax + 263: cd 40 int $0x40 + 265: c3 ret -00000288 : +00000266 : SYSCALL(close) - 288: b8 15 00 00 00 mov $0x15,%eax - 28d: cd 40 int $0x40 - 28f: c3 ret + 266: b8 15 00 00 00 mov $0x15,%eax + 26b: cd 40 int $0x40 + 26d: c3 ret -00000290 : +0000026e : SYSCALL(kill) - 290: b8 06 00 00 00 mov $0x6,%eax - 295: cd 40 int $0x40 - 297: c3 ret + 26e: b8 06 00 00 00 mov $0x6,%eax + 273: cd 40 int $0x40 + 275: c3 ret -00000298 : +00000276 : SYSCALL(exec) - 298: b8 07 00 00 00 mov $0x7,%eax - 29d: cd 40 int $0x40 - 29f: c3 ret + 276: b8 07 00 00 00 mov $0x7,%eax + 27b: cd 40 int $0x40 + 27d: c3 ret -000002a0 : +0000027e : SYSCALL(open) - 2a0: b8 0f 00 00 00 mov $0xf,%eax - 2a5: cd 40 int $0x40 - 2a7: c3 ret + 27e: b8 0f 00 00 00 mov $0xf,%eax + 283: cd 40 int $0x40 + 285: c3 ret -000002a8 : +00000286 : SYSCALL(mknod) - 2a8: b8 11 00 00 00 mov $0x11,%eax - 2ad: cd 40 int $0x40 - 2af: c3 ret + 286: b8 11 00 00 00 mov $0x11,%eax + 28b: cd 40 int $0x40 + 28d: c3 ret -000002b0 : +0000028e : SYSCALL(unlink) - 2b0: b8 12 00 00 00 mov $0x12,%eax - 2b5: cd 40 int $0x40 - 2b7: c3 ret + 28e: b8 12 00 00 00 mov $0x12,%eax + 293: cd 40 int $0x40 + 295: c3 ret -000002b8 : +00000296 : SYSCALL(fstat) - 2b8: b8 08 00 00 00 mov $0x8,%eax - 2bd: cd 40 int $0x40 - 2bf: c3 ret + 296: b8 08 00 00 00 mov $0x8,%eax + 29b: cd 40 int $0x40 + 29d: c3 ret -000002c0 : +0000029e : SYSCALL(link) - 2c0: b8 13 00 00 00 mov $0x13,%eax - 2c5: cd 40 int $0x40 - 2c7: c3 ret + 29e: b8 13 00 00 00 mov $0x13,%eax + 2a3: cd 40 int $0x40 + 2a5: c3 ret -000002c8 : +000002a6 : SYSCALL(mkdir) - 2c8: b8 14 00 00 00 mov $0x14,%eax - 2cd: cd 40 int $0x40 - 2cf: c3 ret + 2a6: b8 14 00 00 00 mov $0x14,%eax + 2ab: cd 40 int $0x40 + 2ad: c3 ret -000002d0 : +000002ae : SYSCALL(chdir) - 2d0: b8 09 00 00 00 mov $0x9,%eax - 2d5: cd 40 int $0x40 - 2d7: c3 ret + 2ae: b8 09 00 00 00 mov $0x9,%eax + 2b3: cd 40 int $0x40 + 2b5: c3 ret -000002d8 : +000002b6 : SYSCALL(dup) - 2d8: b8 0a 00 00 00 mov $0xa,%eax - 2dd: cd 40 int $0x40 - 2df: c3 ret + 2b6: b8 0a 00 00 00 mov $0xa,%eax + 2bb: cd 40 int $0x40 + 2bd: c3 ret -000002e0 : +000002be : SYSCALL(getpid) - 2e0: b8 0b 00 00 00 mov $0xb,%eax - 2e5: cd 40 int $0x40 - 2e7: c3 ret + 2be: b8 0b 00 00 00 mov $0xb,%eax + 2c3: cd 40 int $0x40 + 2c5: c3 ret -000002e8 : +000002c6 : SYSCALL(sbrk) - 2e8: b8 0c 00 00 00 mov $0xc,%eax - 2ed: cd 40 int $0x40 - 2ef: c3 ret + 2c6: b8 0c 00 00 00 mov $0xc,%eax + 2cb: cd 40 int $0x40 + 2cd: c3 ret -000002f0 : +000002ce : SYSCALL(sleep) - 2f0: b8 0d 00 00 00 mov $0xd,%eax - 2f5: cd 40 int $0x40 - 2f7: c3 ret + 2ce: b8 0d 00 00 00 mov $0xd,%eax + 2d3: cd 40 int $0x40 + 2d5: c3 ret -000002f8 : +000002d6 : SYSCALL(uptime) - 2f8: b8 0e 00 00 00 mov $0xe,%eax - 2fd: cd 40 int $0x40 - 2ff: c3 ret + 2d6: b8 0e 00 00 00 mov $0xe,%eax + 2db: cd 40 int $0x40 + 2dd: c3 ret -00000300 : +000002de : SYSCALL(slabtest) - 300: b8 16 00 00 00 mov $0x16,%eax - 305: cd 40 int $0x40 - 307: c3 ret + 2de: b8 16 00 00 00 mov $0x16,%eax + 2e3: cd 40 int $0x40 + 2e5: c3 ret -00000308 : +000002e6 : SYSCALL(ps) - 308: b8 17 00 00 00 mov $0x17,%eax - 30d: cd 40 int $0x40 - 30f: c3 ret + 2e6: b8 17 00 00 00 mov $0x17,%eax + 2eb: cd 40 int $0x40 + 2ed: c3 ret -00000310 : +000002ee : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 310: 55 push %ebp - 311: 89 e5 mov %esp,%ebp - 313: 57 push %edi - 314: 56 push %esi - 315: 53 push %ebx - 316: 83 ec 3c sub $0x3c,%esp - 319: 89 45 c4 mov %eax,-0x3c(%ebp) - 31c: 89 d3 mov %edx,%ebx + 2ee: 55 push %ebp + 2ef: 89 e5 mov %esp,%ebp + 2f1: 57 push %edi + 2f2: 56 push %esi + 2f3: 53 push %ebx + 2f4: 83 ec 3c sub $0x3c,%esp + 2f7: 89 45 c4 mov %eax,-0x3c(%ebp) + 2fa: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 31e: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 322: 74 77 je 39b - 324: 85 d2 test %edx,%edx - 326: 79 73 jns 39b + 2fc: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 300: 74 79 je 37b + 302: 85 d2 test %edx,%edx + 304: 79 75 jns 37b neg = 1; x = -xx; - 328: f7 db neg %ebx + 306: 89 d1 mov %edx,%ecx + 308: f7 d9 neg %ecx neg = 1; - 32a: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 30a: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 331: be 00 00 00 00 mov $0x0,%esi + 311: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 336: 89 f7 mov %esi,%edi - 338: 83 c6 01 add $0x1,%esi - 33b: 89 d8 mov %ebx,%eax - 33d: ba 00 00 00 00 mov $0x0,%edx - 342: f7 f1 div %ecx - 344: 0f b6 92 f8 06 00 00 movzbl 0x6f8(%edx),%edx - 34b: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 316: 89 df mov %ebx,%edi + 318: 83 c3 01 add $0x1,%ebx + 31b: 89 c8 mov %ecx,%eax + 31d: ba 00 00 00 00 mov $0x0,%edx + 322: f7 f6 div %esi + 324: 0f b6 92 10 07 00 00 movzbl 0x710(%edx),%edx + 32b: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 34f: 89 da mov %ebx,%edx - 351: 89 c3 mov %eax,%ebx - 353: 39 d1 cmp %edx,%ecx - 355: 76 df jbe 336 + 32f: 89 ca mov %ecx,%edx + 331: 89 c1 mov %eax,%ecx + 333: 39 d6 cmp %edx,%esi + 335: 76 df jbe 316 if(neg) - 357: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 35b: 74 08 je 365 + 337: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 33b: 74 08 je 345 buf[i++] = '-'; - 35d: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 362: 8d 77 02 lea 0x2(%edi),%esi + 33d: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 342: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 365: 85 f6 test %esi,%esi - 367: 7e 2a jle 393 - 369: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 36d: 8d 7d d8 lea -0x28(%ebp),%edi + 345: 85 db test %ebx,%ebx + 347: 7e 2a jle 373 + 349: 8d 7d d8 lea -0x28(%ebp),%edi + 34c: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 370: 8d 75 d7 lea -0x29(%ebp),%esi + 350: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 373: 0f b6 03 movzbl (%ebx),%eax - 376: 88 45 d7 mov %al,-0x29(%ebp) + 353: 0f b6 03 movzbl (%ebx),%eax + 356: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 379: 83 ec 04 sub $0x4,%esp - 37c: 6a 01 push $0x1 - 37e: 56 push %esi - 37f: ff 75 c4 pushl -0x3c(%ebp) - 382: e8 f9 fe ff ff call 280 + 359: 83 ec 04 sub $0x4,%esp + 35c: 6a 01 push $0x1 + 35e: 56 push %esi + 35f: ff 75 c4 push -0x3c(%ebp) + 362: e8 f7 fe ff ff call 25e while(--i >= 0) - 387: 89 d8 mov %ebx,%eax - 389: 83 eb 01 sub $0x1,%ebx - 38c: 83 c4 10 add $0x10,%esp - 38f: 39 f8 cmp %edi,%eax - 391: 75 e0 jne 373 + 367: 89 d8 mov %ebx,%eax + 369: 83 eb 01 sub $0x1,%ebx + 36c: 83 c4 10 add $0x10,%esp + 36f: 39 f8 cmp %edi,%eax + 371: 75 e0 jne 353 } - 393: 8d 65 f4 lea -0xc(%ebp),%esp - 396: 5b pop %ebx - 397: 5e pop %esi - 398: 5f pop %edi - 399: 5d pop %ebp - 39a: c3 ret + 373: 8d 65 f4 lea -0xc(%ebp),%esp + 376: 5b pop %ebx + 377: 5e pop %esi + 378: 5f pop %edi + 379: 5d pop %ebp + 37a: c3 ret + x = xx; + 37b: 89 d1 mov %edx,%ecx neg = 0; - 39b: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 3a2: eb 8d jmp 331 + 37d: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 384: eb 8b jmp 311 -000003a4 : +00000386 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 3a4: f3 0f 1e fb endbr32 - 3a8: 55 push %ebp - 3a9: 89 e5 mov %esp,%ebp - 3ab: 57 push %edi - 3ac: 56 push %esi - 3ad: 53 push %ebx - 3ae: 83 ec 2c sub $0x2c,%esp + 386: 55 push %ebp + 387: 89 e5 mov %esp,%ebp + 389: 57 push %edi + 38a: 56 push %esi + 38b: 53 push %ebx + 38c: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 3b1: 8b 75 0c mov 0xc(%ebp),%esi - 3b4: 0f b6 1e movzbl (%esi),%ebx - 3b7: 84 db test %bl,%bl - 3b9: 0f 84 ab 01 00 00 je 56a - 3bf: 83 c6 01 add $0x1,%esi + 38f: 8b 75 0c mov 0xc(%ebp),%esi + 392: 0f b6 1e movzbl (%esi),%ebx + 395: 84 db test %bl,%bl + 397: 0f 84 9f 01 00 00 je 53c + 39d: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 3c2: 8d 45 10 lea 0x10(%ebp),%eax - 3c5: 89 45 d4 mov %eax,-0x2c(%ebp) + 3a0: 8d 45 10 lea 0x10(%ebp),%eax + 3a3: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 3c8: bf 00 00 00 00 mov $0x0,%edi - 3cd: eb 2d jmp 3fc + 3a6: bf 00 00 00 00 mov $0x0,%edi + 3ab: eb 2d jmp 3da c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 3cf: 88 5d e7 mov %bl,-0x19(%ebp) + 3ad: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3d2: 83 ec 04 sub $0x4,%esp - 3d5: 6a 01 push $0x1 - 3d7: 8d 45 e7 lea -0x19(%ebp),%eax - 3da: 50 push %eax - 3db: ff 75 08 pushl 0x8(%ebp) - 3de: e8 9d fe ff ff call 280 + 3b0: 83 ec 04 sub $0x4,%esp + 3b3: 6a 01 push $0x1 + 3b5: 8d 45 e7 lea -0x19(%ebp),%eax + 3b8: 50 push %eax + 3b9: ff 75 08 push 0x8(%ebp) + 3bc: e8 9d fe ff ff call 25e putc(fd, c); - 3e3: 83 c4 10 add $0x10,%esp - 3e6: eb 05 jmp 3ed + 3c1: 83 c4 10 add $0x10,%esp + 3c4: eb 05 jmp 3cb } } else if(state == '%'){ - 3e8: 83 ff 25 cmp $0x25,%edi - 3eb: 74 22 je 40f + 3c6: 83 ff 25 cmp $0x25,%edi + 3c9: 74 1f je 3ea for(i = 0; fmt[i]; i++){ - 3ed: 83 c6 01 add $0x1,%esi - 3f0: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3f4: 84 db test %bl,%bl - 3f6: 0f 84 6e 01 00 00 je 56a + 3cb: 83 c6 01 add $0x1,%esi + 3ce: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 3d2: 84 db test %bl,%bl + 3d4: 0f 84 62 01 00 00 je 53c c = fmt[i] & 0xff; - 3fc: 0f be d3 movsbl %bl,%edx - 3ff: 0f b6 c3 movzbl %bl,%eax + 3da: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 402: 85 ff test %edi,%edi - 404: 75 e2 jne 3e8 + 3dd: 85 ff test %edi,%edi + 3df: 75 e5 jne 3c6 if(c == '%'){ - 406: 83 f8 25 cmp $0x25,%eax - 409: 75 c4 jne 3cf + 3e1: 83 f8 25 cmp $0x25,%eax + 3e4: 75 c7 jne 3ad state = '%'; - 40b: 89 c7 mov %eax,%edi - 40d: eb de jmp 3ed + 3e6: 89 c7 mov %eax,%edi + 3e8: eb e1 jmp 3cb if(c == 'd'){ - 40f: 83 f8 64 cmp $0x64,%eax - 412: 74 59 je 46d + 3ea: 83 f8 25 cmp $0x25,%eax + 3ed: 0f 84 f2 00 00 00 je 4e5 + 3f3: 8d 50 9d lea -0x63(%eax),%edx + 3f6: 83 fa 15 cmp $0x15,%edx + 3f9: 0f 87 07 01 00 00 ja 506 + 3ff: 0f 87 01 01 00 00 ja 506 + 405: ff 24 95 b8 06 00 00 jmp *0x6b8(,%edx,4) printint(fd, *ap, 10, 1); + 40c: 83 ec 0c sub $0xc,%esp + 40f: 6a 01 push $0x1 + 411: b9 0a 00 00 00 mov $0xa,%ecx + 416: 8b 7d d4 mov -0x2c(%ebp),%edi + 419: 8b 17 mov (%edi),%edx + 41b: 8b 45 08 mov 0x8(%ebp),%eax + 41e: e8 cb fe ff ff call 2ee ap++; - } else if(c == 'x' || c == 'p'){ - 414: 81 e2 f7 00 00 00 and $0xf7,%edx - 41a: 83 fa 70 cmp $0x70,%edx - 41d: 74 7a je 499 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 41f: 83 f8 73 cmp $0x73,%eax - 422: 0f 84 9d 00 00 00 je 4c5 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 428: 83 f8 63 cmp $0x63,%eax - 42b: 0f 84 ec 00 00 00 je 51d - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 431: 83 f8 25 cmp $0x25,%eax - 434: 0f 84 0f 01 00 00 je 549 - putc(fd, c); + 423: 89 f8 mov %edi,%eax + 425: 83 c0 04 add $0x4,%eax + 428: 89 45 d4 mov %eax,-0x2c(%ebp) + 42b: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 43a: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 43e: 83 ec 04 sub $0x4,%esp - 441: 6a 01 push $0x1 - 443: 8d 45 e7 lea -0x19(%ebp),%eax - 446: 50 push %eax - 447: ff 75 08 pushl 0x8(%ebp) - 44a: e8 31 fe ff ff call 280 putc(fd, c); - 44f: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 452: 83 c4 0c add $0xc,%esp - 455: 6a 01 push $0x1 - 457: 8d 45 e7 lea -0x19(%ebp),%eax - 45a: 50 push %eax - 45b: ff 75 08 pushl 0x8(%ebp) - 45e: e8 1d fe ff ff call 280 - putc(fd, c); - 463: 83 c4 10 add $0x10,%esp } state = 0; - 466: bf 00 00 00 00 mov $0x0,%edi - 46b: eb 80 jmp 3ed - printint(fd, *ap, 10, 1); - 46d: 83 ec 0c sub $0xc,%esp - 470: 6a 01 push $0x1 - 472: b9 0a 00 00 00 mov $0xa,%ecx - 477: 8b 7d d4 mov -0x2c(%ebp),%edi - 47a: 8b 17 mov (%edi),%edx - 47c: 8b 45 08 mov 0x8(%ebp),%eax - 47f: e8 8c fe ff ff call 310 - ap++; - 484: 89 f8 mov %edi,%eax - 486: 83 c0 04 add $0x4,%eax - 489: 89 45 d4 mov %eax,-0x2c(%ebp) - 48c: 83 c4 10 add $0x10,%esp - state = 0; - 48f: bf 00 00 00 00 mov $0x0,%edi - 494: e9 54 ff ff ff jmp 3ed + 42e: bf 00 00 00 00 mov $0x0,%edi + 433: eb 96 jmp 3cb printint(fd, *ap, 16, 0); - 499: 83 ec 0c sub $0xc,%esp - 49c: 6a 00 push $0x0 - 49e: b9 10 00 00 00 mov $0x10,%ecx - 4a3: 8b 7d d4 mov -0x2c(%ebp),%edi - 4a6: 8b 17 mov (%edi),%edx - 4a8: 8b 45 08 mov 0x8(%ebp),%eax - 4ab: e8 60 fe ff ff call 310 + 435: 83 ec 0c sub $0xc,%esp + 438: 6a 00 push $0x0 + 43a: b9 10 00 00 00 mov $0x10,%ecx + 43f: 8b 7d d4 mov -0x2c(%ebp),%edi + 442: 8b 17 mov (%edi),%edx + 444: 8b 45 08 mov 0x8(%ebp),%eax + 447: e8 a2 fe ff ff call 2ee ap++; - 4b0: 89 f8 mov %edi,%eax - 4b2: 83 c0 04 add $0x4,%eax - 4b5: 89 45 d4 mov %eax,-0x2c(%ebp) - 4b8: 83 c4 10 add $0x10,%esp + 44c: 89 f8 mov %edi,%eax + 44e: 83 c0 04 add $0x4,%eax + 451: 89 45 d4 mov %eax,-0x2c(%ebp) + 454: 83 c4 10 add $0x10,%esp state = 0; - 4bb: bf 00 00 00 00 mov $0x0,%edi - 4c0: e9 28 ff ff ff jmp 3ed + 457: bf 00 00 00 00 mov $0x0,%edi + 45c: e9 6a ff ff ff jmp 3cb s = (char*)*ap; - 4c5: 8b 4d d4 mov -0x2c(%ebp),%ecx - 4c8: 8b 01 mov (%ecx),%eax + 461: 8b 4d d4 mov -0x2c(%ebp),%ecx + 464: 8b 01 mov (%ecx),%eax ap++; - 4ca: 83 c1 04 add $0x4,%ecx - 4cd: 89 4d d4 mov %ecx,-0x2c(%ebp) + 466: 83 c1 04 add $0x4,%ecx + 469: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 4d0: 85 c0 test %eax,%eax - 4d2: 74 13 je 4e7 + 46c: 85 c0 test %eax,%eax + 46e: 74 13 je 483 s = (char*)*ap; - 4d4: 89 c3 mov %eax,%ebx + 470: 89 c3 mov %eax,%ebx while(*s != 0){ - 4d6: 0f b6 00 movzbl (%eax),%eax + 472: 0f b6 00 movzbl (%eax),%eax state = 0; - 4d9: bf 00 00 00 00 mov $0x0,%edi + 475: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 4de: 84 c0 test %al,%al - 4e0: 75 0f jne 4f1 - 4e2: e9 06 ff ff ff jmp 3ed + 47a: 84 c0 test %al,%al + 47c: 75 0f jne 48d + 47e: e9 48 ff ff ff jmp 3cb s = "(null)"; - 4e7: bb ef 06 00 00 mov $0x6ef,%ebx + 483: bb af 06 00 00 mov $0x6af,%ebx while(*s != 0){ - 4ec: b8 28 00 00 00 mov $0x28,%eax - 4f1: 8b 7d 08 mov 0x8(%ebp),%edi + 488: b8 28 00 00 00 mov $0x28,%eax + 48d: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4f4: 88 45 e7 mov %al,-0x19(%ebp) + 490: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4f7: 83 ec 04 sub $0x4,%esp - 4fa: 6a 01 push $0x1 - 4fc: 8d 45 e7 lea -0x19(%ebp),%eax - 4ff: 50 push %eax - 500: 57 push %edi - 501: e8 7a fd ff ff call 280 + 493: 83 ec 04 sub $0x4,%esp + 496: 6a 01 push $0x1 + 498: 8d 45 e7 lea -0x19(%ebp),%eax + 49b: 50 push %eax + 49c: 57 push %edi + 49d: e8 bc fd ff ff call 25e s++; - 506: 83 c3 01 add $0x1,%ebx + 4a2: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 509: 0f b6 03 movzbl (%ebx),%eax - 50c: 83 c4 10 add $0x10,%esp - 50f: 84 c0 test %al,%al - 511: 75 e1 jne 4f4 + 4a5: 0f b6 03 movzbl (%ebx),%eax + 4a8: 83 c4 10 add $0x10,%esp + 4ab: 84 c0 test %al,%al + 4ad: 75 e1 jne 490 state = 0; - 513: bf 00 00 00 00 mov $0x0,%edi - 518: e9 d0 fe ff ff jmp 3ed + 4af: bf 00 00 00 00 mov $0x0,%edi + 4b4: e9 12 ff ff ff jmp 3cb putc(fd, *ap); - 51d: 8b 7d d4 mov -0x2c(%ebp),%edi - 520: 8b 07 mov (%edi),%eax - 522: 88 45 e7 mov %al,-0x19(%ebp) + 4b9: 8b 7d d4 mov -0x2c(%ebp),%edi + 4bc: 8b 07 mov (%edi),%eax + 4be: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 525: 83 ec 04 sub $0x4,%esp - 528: 6a 01 push $0x1 - 52a: 8d 45 e7 lea -0x19(%ebp),%eax - 52d: 50 push %eax - 52e: ff 75 08 pushl 0x8(%ebp) - 531: e8 4a fd ff ff call 280 + 4c1: 83 ec 04 sub $0x4,%esp + 4c4: 6a 01 push $0x1 + 4c6: 8d 45 e7 lea -0x19(%ebp),%eax + 4c9: 50 push %eax + 4ca: ff 75 08 push 0x8(%ebp) + 4cd: e8 8c fd ff ff call 25e ap++; - 536: 83 c7 04 add $0x4,%edi - 539: 89 7d d4 mov %edi,-0x2c(%ebp) - 53c: 83 c4 10 add $0x10,%esp + 4d2: 83 c7 04 add $0x4,%edi + 4d5: 89 7d d4 mov %edi,-0x2c(%ebp) + 4d8: 83 c4 10 add $0x10,%esp state = 0; - 53f: bf 00 00 00 00 mov $0x0,%edi - 544: e9 a4 fe ff ff jmp 3ed + 4db: bf 00 00 00 00 mov $0x0,%edi + 4e0: e9 e6 fe ff ff jmp 3cb putc(fd, c); - 549: 88 5d e7 mov %bl,-0x19(%ebp) + 4e5: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 54c: 83 ec 04 sub $0x4,%esp - 54f: 6a 01 push $0x1 - 551: 8d 45 e7 lea -0x19(%ebp),%eax - 554: 50 push %eax - 555: ff 75 08 pushl 0x8(%ebp) - 558: e8 23 fd ff ff call 280 - 55d: 83 c4 10 add $0x10,%esp + 4e8: 83 ec 04 sub $0x4,%esp + 4eb: 6a 01 push $0x1 + 4ed: 8d 45 e7 lea -0x19(%ebp),%eax + 4f0: 50 push %eax + 4f1: ff 75 08 push 0x8(%ebp) + 4f4: e8 65 fd ff ff call 25e + 4f9: 83 c4 10 add $0x10,%esp + state = 0; + 4fc: bf 00 00 00 00 mov $0x0,%edi + 501: e9 c5 fe ff ff jmp 3cb + putc(fd, '%'); + 506: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 50a: 83 ec 04 sub $0x4,%esp + 50d: 6a 01 push $0x1 + 50f: 8d 45 e7 lea -0x19(%ebp),%eax + 512: 50 push %eax + 513: ff 75 08 push 0x8(%ebp) + 516: e8 43 fd ff ff call 25e + putc(fd, c); + 51b: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 51e: 83 c4 0c add $0xc,%esp + 521: 6a 01 push $0x1 + 523: 8d 45 e7 lea -0x19(%ebp),%eax + 526: 50 push %eax + 527: ff 75 08 push 0x8(%ebp) + 52a: e8 2f fd ff ff call 25e + putc(fd, c); + 52f: 83 c4 10 add $0x10,%esp state = 0; - 560: bf 00 00 00 00 mov $0x0,%edi - 565: e9 83 fe ff ff jmp 3ed + 532: bf 00 00 00 00 mov $0x0,%edi + 537: e9 8f fe ff ff jmp 3cb } } } - 56a: 8d 65 f4 lea -0xc(%ebp),%esp - 56d: 5b pop %ebx - 56e: 5e pop %esi - 56f: 5f pop %edi - 570: 5d pop %ebp - 571: c3 ret - -00000572 : + 53c: 8d 65 f4 lea -0xc(%ebp),%esp + 53f: 5b pop %ebx + 540: 5e pop %esi + 541: 5f pop %edi + 542: 5d pop %ebp + 543: c3 ret + +00000544 : static Header base; static Header *freep; void free(void *ap) { - 572: f3 0f 1e fb endbr32 - 576: 55 push %ebp - 577: 89 e5 mov %esp,%ebp - 579: 57 push %edi - 57a: 56 push %esi - 57b: 53 push %ebx - 57c: 8b 5d 08 mov 0x8(%ebp),%ebx + 544: 55 push %ebp + 545: 89 e5 mov %esp,%ebp + 547: 57 push %edi + 548: 56 push %esi + 549: 53 push %ebx + 54a: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 57f: 8d 4b f8 lea -0x8(%ebx),%ecx + 54d: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 582: a1 6c 09 00 00 mov 0x96c,%eax - 587: eb 0c jmp 595 + 550: a1 84 09 00 00 mov 0x984,%eax + 555: eb 0c jmp 563 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 589: 8b 10 mov (%eax),%edx - 58b: 39 c2 cmp %eax,%edx - 58d: 77 04 ja 593 - 58f: 39 ca cmp %ecx,%edx - 591: 77 10 ja 5a3 + 557: 8b 10 mov (%eax),%edx + 559: 39 c2 cmp %eax,%edx + 55b: 77 04 ja 561 + 55d: 39 ca cmp %ecx,%edx + 55f: 77 10 ja 571 { - 593: 89 d0 mov %edx,%eax + 561: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 595: 39 c8 cmp %ecx,%eax - 597: 73 f0 jae 589 - 599: 8b 10 mov (%eax),%edx - 59b: 39 ca cmp %ecx,%edx - 59d: 77 04 ja 5a3 + 563: 39 c8 cmp %ecx,%eax + 565: 73 f0 jae 557 + 567: 8b 10 mov (%eax),%edx + 569: 39 ca cmp %ecx,%edx + 56b: 77 04 ja 571 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 59f: 39 c2 cmp %eax,%edx - 5a1: 77 f0 ja 593 + 56d: 39 c2 cmp %eax,%edx + 56f: 77 f0 ja 561 break; if(bp + bp->s.size == p->s.ptr){ - 5a3: 8b 73 fc mov -0x4(%ebx),%esi - 5a6: 8b 10 mov (%eax),%edx - 5a8: 8d 3c f1 lea (%ecx,%esi,8),%edi - 5ab: 39 fa cmp %edi,%edx - 5ad: 74 19 je 5c8 + 571: 8b 73 fc mov -0x4(%ebx),%esi + 574: 8b 10 mov (%eax),%edx + 576: 8d 3c f1 lea (%ecx,%esi,8),%edi + 579: 39 fa cmp %edi,%edx + 57b: 74 19 je 596 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 57d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 5af: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 5b2: 8b 50 04 mov 0x4(%eax),%edx - 5b5: 8d 34 d0 lea (%eax,%edx,8),%esi - 5b8: 39 f1 cmp %esi,%ecx - 5ba: 74 1b je 5d7 + 580: 8b 50 04 mov 0x4(%eax),%edx + 583: 8d 34 d0 lea (%eax,%edx,8),%esi + 586: 39 f1 cmp %esi,%ecx + 588: 74 18 je 5a2 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 58a: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 5bc: 89 08 mov %ecx,(%eax) freep = p; - 5be: a3 6c 09 00 00 mov %eax,0x96c + 58c: a3 84 09 00 00 mov %eax,0x984 } - 5c3: 5b pop %ebx - 5c4: 5e pop %esi - 5c5: 5f pop %edi - 5c6: 5d pop %ebp - 5c7: c3 ret + 591: 5b pop %ebx + 592: 5e pop %esi + 593: 5f pop %edi + 594: 5d pop %ebp + 595: c3 ret bp->s.size += p->s.ptr->s.size; - 5c8: 03 72 04 add 0x4(%edx),%esi - 5cb: 89 73 fc mov %esi,-0x4(%ebx) + 596: 03 72 04 add 0x4(%edx),%esi + 599: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 5ce: 8b 10 mov (%eax),%edx - 5d0: 8b 12 mov (%edx),%edx - 5d2: 89 53 f8 mov %edx,-0x8(%ebx) - 5d5: eb db jmp 5b2 + 59c: 8b 10 mov (%eax),%edx + 59e: 8b 12 mov (%edx),%edx + 5a0: eb db jmp 57d p->s.size += bp->s.size; - 5d7: 03 53 fc add -0x4(%ebx),%edx - 5da: 89 50 04 mov %edx,0x4(%eax) + 5a2: 03 53 fc add -0x4(%ebx),%edx + 5a5: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 5dd: 8b 53 f8 mov -0x8(%ebx),%edx - 5e0: 89 10 mov %edx,(%eax) - 5e2: eb da jmp 5be + 5a8: 8b 4b f8 mov -0x8(%ebx),%ecx + 5ab: eb dd jmp 58a -000005e4 : +000005ad : return freep; } void* malloc(uint nbytes) { - 5e4: f3 0f 1e fb endbr32 - 5e8: 55 push %ebp - 5e9: 89 e5 mov %esp,%ebp - 5eb: 57 push %edi - 5ec: 56 push %esi - 5ed: 53 push %ebx - 5ee: 83 ec 0c sub $0xc,%esp + 5ad: 55 push %ebp + 5ae: 89 e5 mov %esp,%ebp + 5b0: 57 push %edi + 5b1: 56 push %esi + 5b2: 53 push %ebx + 5b3: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5f1: 8b 45 08 mov 0x8(%ebp),%eax - 5f4: 8d 58 07 lea 0x7(%eax),%ebx - 5f7: c1 eb 03 shr $0x3,%ebx - 5fa: 83 c3 01 add $0x1,%ebx + 5b6: 8b 45 08 mov 0x8(%ebp),%eax + 5b9: 8d 58 07 lea 0x7(%eax),%ebx + 5bc: c1 eb 03 shr $0x3,%ebx + 5bf: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5fd: 8b 15 6c 09 00 00 mov 0x96c,%edx - 603: 85 d2 test %edx,%edx - 605: 74 20 je 627 + 5c2: 8b 15 84 09 00 00 mov 0x984,%edx + 5c8: 85 d2 test %edx,%edx + 5ca: 74 1c je 5e8 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 607: 8b 02 mov (%edx),%eax + 5cc: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 609: 8b 48 04 mov 0x4(%eax),%ecx - 60c: 39 cb cmp %ecx,%ebx - 60e: 76 3c jbe 64c - 610: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 616: be 00 10 00 00 mov $0x1000,%esi - 61b: 0f 43 f3 cmovae %ebx,%esi + 5ce: 8b 48 04 mov 0x4(%eax),%ecx + 5d1: 39 cb cmp %ecx,%ebx + 5d3: 76 38 jbe 60d + 5d5: be 00 10 00 00 mov $0x1000,%esi + 5da: 39 f3 cmp %esi,%ebx + 5dc: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 61e: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 625: eb 72 jmp 699 + 5df: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 5e6: eb 72 jmp 65a base.s.ptr = freep = prevp = &base; - 627: c7 05 6c 09 00 00 70 movl $0x970,0x96c - 62e: 09 00 00 - 631: c7 05 70 09 00 00 70 movl $0x970,0x970 - 638: 09 00 00 + 5e8: c7 05 84 09 00 00 88 movl $0x988,0x984 + 5ef: 09 00 00 + 5f2: c7 05 88 09 00 00 88 movl $0x988,0x988 + 5f9: 09 00 00 base.s.size = 0; - 63b: c7 05 74 09 00 00 00 movl $0x0,0x974 - 642: 00 00 00 + 5fc: c7 05 8c 09 00 00 00 movl $0x0,0x98c + 603: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 645: b8 70 09 00 00 mov $0x970,%eax - 64a: eb c4 jmp 610 + 606: b8 88 09 00 00 mov $0x988,%eax + 60b: eb c8 jmp 5d5 if(p->s.size == nunits) - 64c: 39 cb cmp %ecx,%ebx - 64e: 74 1e je 66e + 60d: 39 cb cmp %ecx,%ebx + 60f: 74 1e je 62f prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 650: 29 d9 sub %ebx,%ecx - 652: 89 48 04 mov %ecx,0x4(%eax) + 611: 29 d9 sub %ebx,%ecx + 613: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 655: 8d 04 c8 lea (%eax,%ecx,8),%eax + 616: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 658: 89 58 04 mov %ebx,0x4(%eax) + 619: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 65b: 89 15 6c 09 00 00 mov %edx,0x96c + 61c: 89 15 84 09 00 00 mov %edx,0x984 return (void*)(p + 1); - 661: 8d 50 08 lea 0x8(%eax),%edx + 622: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 664: 89 d0 mov %edx,%eax - 666: 8d 65 f4 lea -0xc(%ebp),%esp - 669: 5b pop %ebx - 66a: 5e pop %esi - 66b: 5f pop %edi - 66c: 5d pop %ebp - 66d: c3 ret + 625: 89 d0 mov %edx,%eax + 627: 8d 65 f4 lea -0xc(%ebp),%esp + 62a: 5b pop %ebx + 62b: 5e pop %esi + 62c: 5f pop %edi + 62d: 5d pop %ebp + 62e: c3 ret prevp->s.ptr = p->s.ptr; - 66e: 8b 08 mov (%eax),%ecx - 670: 89 0a mov %ecx,(%edx) - 672: eb e7 jmp 65b + 62f: 8b 08 mov (%eax),%ecx + 631: 89 0a mov %ecx,(%edx) + 633: eb e7 jmp 61c hp->s.size = nu; - 674: 89 70 04 mov %esi,0x4(%eax) + 635: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 677: 83 ec 0c sub $0xc,%esp - 67a: 83 c0 08 add $0x8,%eax - 67d: 50 push %eax - 67e: e8 ef fe ff ff call 572 + 638: 83 ec 0c sub $0xc,%esp + 63b: 83 c0 08 add $0x8,%eax + 63e: 50 push %eax + 63f: e8 00 ff ff ff call 544 return freep; - 683: 8b 15 6c 09 00 00 mov 0x96c,%edx + 644: 8b 15 84 09 00 00 mov 0x984,%edx if((p = morecore(nunits)) == 0) - 689: 83 c4 10 add $0x10,%esp - 68c: 85 d2 test %edx,%edx - 68e: 74 d4 je 664 + 64a: 83 c4 10 add $0x10,%esp + 64d: 85 d2 test %edx,%edx + 64f: 74 d4 je 625 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 690: 8b 02 mov (%edx),%eax + 651: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 692: 8b 48 04 mov 0x4(%eax),%ecx - 695: 39 d9 cmp %ebx,%ecx - 697: 73 b3 jae 64c + 653: 8b 48 04 mov 0x4(%eax),%ecx + 656: 39 d9 cmp %ebx,%ecx + 658: 73 b3 jae 60d if(p == freep) - 699: 89 c2 mov %eax,%edx - 69b: 39 05 6c 09 00 00 cmp %eax,0x96c - 6a1: 75 ed jne 690 + 65a: 89 c2 mov %eax,%edx + 65c: 39 05 84 09 00 00 cmp %eax,0x984 + 662: 75 ed jne 651 p = sbrk(nu * sizeof(Header)); - 6a3: 83 ec 0c sub $0xc,%esp - 6a6: 57 push %edi - 6a7: e8 3c fc ff ff call 2e8 + 664: 83 ec 0c sub $0xc,%esp + 667: 57 push %edi + 668: e8 59 fc ff ff call 2c6 if(p == (char*)-1) - 6ac: 83 c4 10 add $0x10,%esp - 6af: 83 f8 ff cmp $0xffffffff,%eax - 6b2: 75 c0 jne 674 + 66d: 83 c4 10 add $0x10,%esp + 670: 83 f8 ff cmp $0xffffffff,%eax + 673: 75 c0 jne 635 return 0; - 6b4: ba 00 00 00 00 mov $0x0,%edx - 6b9: eb a9 jmp 664 + 675: ba 00 00 00 00 mov $0x0,%edx + 67a: eb a9 jmp 625 diff --git a/src/user/mkdir.d b/src/user/mkdir.d new file mode 100644 index 0000000..318f105 --- /dev/null +++ b/src/user/mkdir.d @@ -0,0 +1,2 @@ +user/mkdir.o: user/mkdir.c /usr/include/stdc-predef.h types.h stat.h \ + user.h diff --git a/src/user/mkdir.o b/src/user/mkdir.o new file mode 100644 index 0000000..097c91c Binary files /dev/null and b/src/user/mkdir.o differ diff --git a/src/user/mkdir.sym b/src/user/mkdir.sym index a0645ec..54f0b41 100644 --- a/src/user/mkdir.sym +++ b/src/user/mkdir.sym @@ -1,59 +1,47 @@ -00000000 .text -000006bc .rodata -0000070c .eh_frame -0000096c .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 -00000310 printint -000006f8 digits.1089 +000002ee printint +00000710 digits.0 00000000 umalloc.c -0000096c freep -00000970 base -0000007a strcpy -000003a4 printf -00000227 memmove -000002a8 mknod -00000308 ps -00000145 gets -000002e0 getpid -000005e4 malloc -000002f0 sleep -00000270 pipe -00000300 slabtest -00000280 write -000002b8 fstat -00000290 kill -000002d0 chdir -00000298 exec -00000268 wait -00000278 read -000002b0 unlink -00000258 fork -000002e8 sbrk -000002f8 uptime -0000096c __bss_start -000000f9 memset +00000984 freep +00000988 base +00000076 strcpy +00000386 printf +00000209 memmove +00000286 mknod +000002e6 ps +00000131 gets +000002be getpid +000005ad malloc +000002ce sleep +0000024e pipe +000002de slabtest +0000025e write +00000296 fstat +0000026e kill +000002ae chdir +00000276 exec +00000246 wait +00000256 read +0000028e unlink +00000236 fork +000002c6 sbrk +000002d6 uptime +00000984 __bss_start +000000eb memset 00000000 main -000000a0 strcmp -000002d8 dup -000001a0 stat -0000096c _edata -00000978 _end -000002c0 link -00000260 exit -000001e8 atoi -000000cf strlen -000002a0 open -00000114 strchr -000002c8 mkdir -00000288 close -00000572 free +0000009a strcmp +000002b6 dup +00000188 stat +00000984 _edata +00000990 _end +0000029e link +0000023e exit +000001cc atoi +000000c5 strlen +0000027e open +00000104 strchr +000002a6 mkdir +00000266 close +00000544 free diff --git a/src/user/ps.asm b/src/user/ps.asm index c69920c..902084d 100644 --- a/src/user/ps.asm +++ b/src/user/ps.asm @@ -11,1037 +11,1006 @@ Disassembly of section .text: int main(int argc, char **argv) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 51 push %ecx - 12: 83 ec 04 sub $0x4,%esp + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 51 push %ecx + e: 83 ec 04 sub $0x4,%esp ps(); - 15: e8 a2 02 00 00 call 2bc + 11: e8 84 02 00 00 call 29a printf(1, "ps\n"); - 1a: 83 ec 08 sub $0x8,%esp - 1d: 68 70 06 00 00 push $0x670 - 22: 6a 01 push $0x1 - 24: e8 2f 03 00 00 call 358 + 16: 83 ec 08 sub $0x8,%esp + 19: 68 30 06 00 00 push $0x630 + 1e: 6a 01 push $0x1 + 20: e8 15 03 00 00 call 33a exit(); - 29: e8 e6 01 00 00 call 214 + 25: e8 c8 01 00 00 call 1f2 -0000002e : +0000002a : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 2e: f3 0f 1e fb endbr32 - 32: 55 push %ebp - 33: 89 e5 mov %esp,%ebp - 35: 53 push %ebx - 36: 8b 4d 08 mov 0x8(%ebp),%ecx - 39: 8b 5d 0c mov 0xc(%ebp),%ebx + 2a: 55 push %ebp + 2b: 89 e5 mov %esp,%ebp + 2d: 53 push %ebx + 2e: 8b 4d 08 mov 0x8(%ebp),%ecx + 31: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 3c: b8 00 00 00 00 mov $0x0,%eax - 41: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 45: 88 14 01 mov %dl,(%ecx,%eax,1) - 48: 83 c0 01 add $0x1,%eax - 4b: 84 d2 test %dl,%dl - 4d: 75 f2 jne 41 + 34: b8 00 00 00 00 mov $0x0,%eax + 39: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 3d: 88 14 01 mov %dl,(%ecx,%eax,1) + 40: 83 c0 01 add $0x1,%eax + 43: 84 d2 test %dl,%dl + 45: 75 f2 jne 39 ; return os; } - 4f: 89 c8 mov %ecx,%eax - 51: 5b pop %ebx - 52: 5d pop %ebp - 53: c3 ret + 47: 89 c8 mov %ecx,%eax + 49: 8b 5d fc mov -0x4(%ebp),%ebx + 4c: c9 leave + 4d: c3 ret -00000054 : +0000004e : int strcmp(const char *p, const char *q) { - 54: f3 0f 1e fb endbr32 - 58: 55 push %ebp - 59: 89 e5 mov %esp,%ebp - 5b: 8b 4d 08 mov 0x8(%ebp),%ecx - 5e: 8b 55 0c mov 0xc(%ebp),%edx + 4e: 55 push %ebp + 4f: 89 e5 mov %esp,%ebp + 51: 8b 4d 08 mov 0x8(%ebp),%ecx + 54: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 61: 0f b6 01 movzbl (%ecx),%eax - 64: 84 c0 test %al,%al - 66: 74 11 je 79 - 68: 38 02 cmp %al,(%edx) - 6a: 75 0d jne 79 + 57: 0f b6 01 movzbl (%ecx),%eax + 5a: 84 c0 test %al,%al + 5c: 74 11 je 6f + 5e: 38 02 cmp %al,(%edx) + 60: 75 0d jne 6f p++, q++; - 6c: 83 c1 01 add $0x1,%ecx - 6f: 83 c2 01 add $0x1,%edx + 62: 83 c1 01 add $0x1,%ecx + 65: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 72: 0f b6 01 movzbl (%ecx),%eax - 75: 84 c0 test %al,%al - 77: 75 ef jne 68 + 68: 0f b6 01 movzbl (%ecx),%eax + 6b: 84 c0 test %al,%al + 6d: 75 ef jne 5e return (uchar)*p - (uchar)*q; - 79: 0f b6 c0 movzbl %al,%eax - 7c: 0f b6 12 movzbl (%edx),%edx - 7f: 29 d0 sub %edx,%eax + 6f: 0f b6 c0 movzbl %al,%eax + 72: 0f b6 12 movzbl (%edx),%edx + 75: 29 d0 sub %edx,%eax } - 81: 5d pop %ebp - 82: c3 ret + 77: 5d pop %ebp + 78: c3 ret -00000083 : +00000079 : uint strlen(const char *s) { - 83: f3 0f 1e fb endbr32 - 87: 55 push %ebp - 88: 89 e5 mov %esp,%ebp - 8a: 8b 55 08 mov 0x8(%ebp),%edx + 79: 55 push %ebp + 7a: 89 e5 mov %esp,%ebp + 7c: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 8d: 80 3a 00 cmpb $0x0,(%edx) - 90: 74 14 je a6 - 92: b8 00 00 00 00 mov $0x0,%eax - 97: 83 c0 01 add $0x1,%eax - 9a: 89 c1 mov %eax,%ecx - 9c: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - a0: 75 f5 jne 97 + 7f: 80 3a 00 cmpb $0x0,(%edx) + 82: 74 14 je 98 + 84: b8 00 00 00 00 mov $0x0,%eax + 89: 83 c0 01 add $0x1,%eax + 8c: 89 c1 mov %eax,%ecx + 8e: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 92: 75 f5 jne 89 ; return n; } - a2: 89 c8 mov %ecx,%eax - a4: 5d pop %ebp - a5: c3 ret + 94: 89 c8 mov %ecx,%eax + 96: 5d pop %ebp + 97: c3 ret for(n = 0; s[n]; n++) - a6: b9 00 00 00 00 mov $0x0,%ecx + 98: b9 00 00 00 00 mov $0x0,%ecx return n; - ab: eb f5 jmp a2 + 9d: eb f5 jmp 94 -000000ad : +0000009f : void* memset(void *dst, int c, uint n) { - ad: f3 0f 1e fb endbr32 - b1: 55 push %ebp - b2: 89 e5 mov %esp,%ebp - b4: 57 push %edi - b5: 8b 55 08 mov 0x8(%ebp),%edx + 9f: 55 push %ebp + a0: 89 e5 mov %esp,%ebp + a2: 57 push %edi + a3: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - b8: 89 d7 mov %edx,%edi - ba: 8b 4d 10 mov 0x10(%ebp),%ecx - bd: 8b 45 0c mov 0xc(%ebp),%eax - c0: fc cld - c1: f3 aa rep stos %al,%es:(%edi) + a6: 89 d7 mov %edx,%edi + a8: 8b 4d 10 mov 0x10(%ebp),%ecx + ab: 8b 45 0c mov 0xc(%ebp),%eax + ae: fc cld + af: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - c3: 89 d0 mov %edx,%eax - c5: 5f pop %edi - c6: 5d pop %ebp - c7: c3 ret + b1: 89 d0 mov %edx,%eax + b3: 8b 7d fc mov -0x4(%ebp),%edi + b6: c9 leave + b7: c3 ret -000000c8 : +000000b8 : char* strchr(const char *s, char c) { - c8: f3 0f 1e fb endbr32 - cc: 55 push %ebp - cd: 89 e5 mov %esp,%ebp - cf: 8b 45 08 mov 0x8(%ebp),%eax - d2: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + b8: 55 push %ebp + b9: 89 e5 mov %esp,%ebp + bb: 8b 45 08 mov 0x8(%ebp),%eax + be: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - d6: 0f b6 10 movzbl (%eax),%edx - d9: 84 d2 test %dl,%dl - db: 74 15 je f2 + c2: 0f b6 10 movzbl (%eax),%edx + c5: 84 d2 test %dl,%dl + c7: 74 15 je de if(*s == c) - dd: 38 d1 cmp %dl,%cl - df: 74 0f je f0 + c9: 38 d1 cmp %dl,%cl + cb: 74 0f je dc for(; *s; s++) - e1: 83 c0 01 add $0x1,%eax - e4: 0f b6 10 movzbl (%eax),%edx - e7: 84 d2 test %dl,%dl - e9: 75 f2 jne dd + cd: 83 c0 01 add $0x1,%eax + d0: 0f b6 10 movzbl (%eax),%edx + d3: 84 d2 test %dl,%dl + d5: 75 f2 jne c9 return (char*)s; return 0; - eb: b8 00 00 00 00 mov $0x0,%eax + d7: b8 00 00 00 00 mov $0x0,%eax } - f0: 5d pop %ebp - f1: c3 ret + dc: 5d pop %ebp + dd: c3 ret return 0; - f2: b8 00 00 00 00 mov $0x0,%eax - f7: eb f7 jmp f0 + de: b8 00 00 00 00 mov $0x0,%eax + e3: eb f7 jmp dc -000000f9 : +000000e5 : char* gets(char *buf, int max) { - f9: f3 0f 1e fb endbr32 - fd: 55 push %ebp - fe: 89 e5 mov %esp,%ebp - 100: 57 push %edi - 101: 56 push %esi - 102: 53 push %ebx - 103: 83 ec 2c sub $0x2c,%esp - 106: 8b 75 08 mov 0x8(%ebp),%esi + e5: 55 push %ebp + e6: 89 e5 mov %esp,%ebp + e8: 57 push %edi + e9: 56 push %esi + ea: 53 push %ebx + eb: 83 ec 2c sub $0x2c,%esp + ee: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 109: bb 00 00 00 00 mov $0x0,%ebx + f1: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 10e: 8d 7d e7 lea -0x19(%ebp),%edi + f6: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 111: 89 5d d4 mov %ebx,-0x2c(%ebp) - 114: 83 c3 01 add $0x1,%ebx - 117: 3b 5d 0c cmp 0xc(%ebp),%ebx - 11a: 7d 27 jge 143 + f9: 89 5d d4 mov %ebx,-0x2c(%ebp) + fc: 83 c3 01 add $0x1,%ebx + ff: 3b 5d 0c cmp 0xc(%ebp),%ebx + 102: 7d 27 jge 12b cc = read(0, &c, 1); - 11c: 83 ec 04 sub $0x4,%esp - 11f: 6a 01 push $0x1 - 121: 57 push %edi - 122: 6a 00 push $0x0 - 124: e8 03 01 00 00 call 22c + 104: 83 ec 04 sub $0x4,%esp + 107: 6a 01 push $0x1 + 109: 57 push %edi + 10a: 6a 00 push $0x0 + 10c: e8 f9 00 00 00 call 20a if(cc < 1) - 129: 83 c4 10 add $0x10,%esp - 12c: 85 c0 test %eax,%eax - 12e: 7e 13 jle 143 + 111: 83 c4 10 add $0x10,%esp + 114: 85 c0 test %eax,%eax + 116: 7e 13 jle 12b break; buf[i++] = c; - 130: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 134: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 118: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 11c: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 138: 3c 0a cmp $0xa,%al - 13a: 74 04 je 140 - 13c: 3c 0d cmp $0xd,%al - 13e: 75 d1 jne 111 + 120: 3c 0a cmp $0xa,%al + 122: 74 04 je 128 + 124: 3c 0d cmp $0xd,%al + 126: 75 d1 jne f9 for(i=0; i+1 < max; ){ - 140: 89 5d d4 mov %ebx,-0x2c(%ebp) + 128: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 143: 8b 45 d4 mov -0x2c(%ebp),%eax - 146: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 12b: 8b 45 d4 mov -0x2c(%ebp),%eax + 12e: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 14a: 89 f0 mov %esi,%eax - 14c: 8d 65 f4 lea -0xc(%ebp),%esp - 14f: 5b pop %ebx - 150: 5e pop %esi - 151: 5f pop %edi - 152: 5d pop %ebp - 153: c3 ret + 132: 89 f0 mov %esi,%eax + 134: 8d 65 f4 lea -0xc(%ebp),%esp + 137: 5b pop %ebx + 138: 5e pop %esi + 139: 5f pop %edi + 13a: 5d pop %ebp + 13b: c3 ret -00000154 : +0000013c : int stat(const char *n, struct stat *st) { - 154: f3 0f 1e fb endbr32 - 158: 55 push %ebp - 159: 89 e5 mov %esp,%ebp - 15b: 56 push %esi - 15c: 53 push %ebx + 13c: 55 push %ebp + 13d: 89 e5 mov %esp,%ebp + 13f: 56 push %esi + 140: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 15d: 83 ec 08 sub $0x8,%esp - 160: 6a 00 push $0x0 - 162: ff 75 08 pushl 0x8(%ebp) - 165: e8 ea 00 00 00 call 254 + 141: 83 ec 08 sub $0x8,%esp + 144: 6a 00 push $0x0 + 146: ff 75 08 push 0x8(%ebp) + 149: e8 e4 00 00 00 call 232 if(fd < 0) - 16a: 83 c4 10 add $0x10,%esp - 16d: 85 c0 test %eax,%eax - 16f: 78 24 js 195 - 171: 89 c3 mov %eax,%ebx + 14e: 83 c4 10 add $0x10,%esp + 151: 85 c0 test %eax,%eax + 153: 78 24 js 179 + 155: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 173: 83 ec 08 sub $0x8,%esp - 176: ff 75 0c pushl 0xc(%ebp) - 179: 50 push %eax - 17a: e8 ed 00 00 00 call 26c - 17f: 89 c6 mov %eax,%esi + 157: 83 ec 08 sub $0x8,%esp + 15a: ff 75 0c push 0xc(%ebp) + 15d: 50 push %eax + 15e: e8 e7 00 00 00 call 24a + 163: 89 c6 mov %eax,%esi close(fd); - 181: 89 1c 24 mov %ebx,(%esp) - 184: e8 b3 00 00 00 call 23c + 165: 89 1c 24 mov %ebx,(%esp) + 168: e8 ad 00 00 00 call 21a return r; - 189: 83 c4 10 add $0x10,%esp + 16d: 83 c4 10 add $0x10,%esp } - 18c: 89 f0 mov %esi,%eax - 18e: 8d 65 f8 lea -0x8(%ebp),%esp - 191: 5b pop %ebx - 192: 5e pop %esi - 193: 5d pop %ebp - 194: c3 ret + 170: 89 f0 mov %esi,%eax + 172: 8d 65 f8 lea -0x8(%ebp),%esp + 175: 5b pop %ebx + 176: 5e pop %esi + 177: 5d pop %ebp + 178: c3 ret return -1; - 195: be ff ff ff ff mov $0xffffffff,%esi - 19a: eb f0 jmp 18c + 179: be ff ff ff ff mov $0xffffffff,%esi + 17e: eb f0 jmp 170 -0000019c : +00000180 : int atoi(const char *s) { - 19c: f3 0f 1e fb endbr32 - 1a0: 55 push %ebp - 1a1: 89 e5 mov %esp,%ebp - 1a3: 53 push %ebx - 1a4: 8b 55 08 mov 0x8(%ebp),%edx + 180: 55 push %ebp + 181: 89 e5 mov %esp,%ebp + 183: 53 push %ebx + 184: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1a7: 0f b6 02 movzbl (%edx),%eax - 1aa: 8d 48 d0 lea -0x30(%eax),%ecx - 1ad: 80 f9 09 cmp $0x9,%cl - 1b0: 77 22 ja 1d4 + 187: 0f b6 02 movzbl (%edx),%eax + 18a: 8d 48 d0 lea -0x30(%eax),%ecx + 18d: 80 f9 09 cmp $0x9,%cl + 190: 77 24 ja 1b6 n = 0; - 1b2: b9 00 00 00 00 mov $0x0,%ecx + 192: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 1b7: 83 c2 01 add $0x1,%edx - 1ba: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 1bd: 0f be c0 movsbl %al,%eax - 1c0: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 197: 83 c2 01 add $0x1,%edx + 19a: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 19d: 0f be c0 movsbl %al,%eax + 1a0: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 1c4: 0f b6 02 movzbl (%edx),%eax - 1c7: 8d 58 d0 lea -0x30(%eax),%ebx - 1ca: 80 fb 09 cmp $0x9,%bl - 1cd: 76 e8 jbe 1b7 + 1a4: 0f b6 02 movzbl (%edx),%eax + 1a7: 8d 58 d0 lea -0x30(%eax),%ebx + 1aa: 80 fb 09 cmp $0x9,%bl + 1ad: 76 e8 jbe 197 return n; } - 1cf: 89 c8 mov %ecx,%eax - 1d1: 5b pop %ebx - 1d2: 5d pop %ebp - 1d3: c3 ret + 1af: 89 c8 mov %ecx,%eax + 1b1: 8b 5d fc mov -0x4(%ebp),%ebx + 1b4: c9 leave + 1b5: c3 ret n = 0; - 1d4: b9 00 00 00 00 mov $0x0,%ecx + 1b6: b9 00 00 00 00 mov $0x0,%ecx return n; - 1d9: eb f4 jmp 1cf + 1bb: eb f2 jmp 1af -000001db : +000001bd : void* memmove(void *vdst, const void *vsrc, int n) { - 1db: f3 0f 1e fb endbr32 - 1df: 55 push %ebp - 1e0: 89 e5 mov %esp,%ebp - 1e2: 56 push %esi - 1e3: 53 push %ebx - 1e4: 8b 75 08 mov 0x8(%ebp),%esi - 1e7: 8b 55 0c mov 0xc(%ebp),%edx - 1ea: 8b 5d 10 mov 0x10(%ebp),%ebx + 1bd: 55 push %ebp + 1be: 89 e5 mov %esp,%ebp + 1c0: 56 push %esi + 1c1: 53 push %ebx + 1c2: 8b 75 08 mov 0x8(%ebp),%esi + 1c5: 8b 55 0c mov 0xc(%ebp),%edx + 1c8: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 1ed: 85 db test %ebx,%ebx - 1ef: 7e 15 jle 206 - 1f1: 01 f3 add %esi,%ebx + 1cb: 85 db test %ebx,%ebx + 1cd: 7e 15 jle 1e4 + 1cf: 01 f3 add %esi,%ebx dst = vdst; - 1f3: 89 f0 mov %esi,%eax + 1d1: 89 f0 mov %esi,%eax *dst++ = *src++; - 1f5: 83 c2 01 add $0x1,%edx - 1f8: 83 c0 01 add $0x1,%eax - 1fb: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 1ff: 88 48 ff mov %cl,-0x1(%eax) + 1d3: 83 c2 01 add $0x1,%edx + 1d6: 83 c0 01 add $0x1,%eax + 1d9: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 1dd: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 202: 39 c3 cmp %eax,%ebx - 204: 75 ef jne 1f5 + 1e0: 39 c3 cmp %eax,%ebx + 1e2: 75 ef jne 1d3 return vdst; } - 206: 89 f0 mov %esi,%eax - 208: 5b pop %ebx - 209: 5e pop %esi - 20a: 5d pop %ebp - 20b: c3 ret + 1e4: 89 f0 mov %esi,%eax + 1e6: 5b pop %ebx + 1e7: 5e pop %esi + 1e8: 5d pop %ebp + 1e9: c3 ret -0000020c : +000001ea : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 20c: b8 01 00 00 00 mov $0x1,%eax - 211: cd 40 int $0x40 - 213: c3 ret + 1ea: b8 01 00 00 00 mov $0x1,%eax + 1ef: cd 40 int $0x40 + 1f1: c3 ret -00000214 : +000001f2 : SYSCALL(exit) - 214: b8 02 00 00 00 mov $0x2,%eax - 219: cd 40 int $0x40 - 21b: c3 ret + 1f2: b8 02 00 00 00 mov $0x2,%eax + 1f7: cd 40 int $0x40 + 1f9: c3 ret -0000021c : +000001fa : SYSCALL(wait) - 21c: b8 03 00 00 00 mov $0x3,%eax - 221: cd 40 int $0x40 - 223: c3 ret + 1fa: b8 03 00 00 00 mov $0x3,%eax + 1ff: cd 40 int $0x40 + 201: c3 ret -00000224 : +00000202 : SYSCALL(pipe) - 224: b8 04 00 00 00 mov $0x4,%eax - 229: cd 40 int $0x40 - 22b: c3 ret + 202: b8 04 00 00 00 mov $0x4,%eax + 207: cd 40 int $0x40 + 209: c3 ret -0000022c : +0000020a : SYSCALL(read) - 22c: b8 05 00 00 00 mov $0x5,%eax - 231: cd 40 int $0x40 - 233: c3 ret + 20a: b8 05 00 00 00 mov $0x5,%eax + 20f: cd 40 int $0x40 + 211: c3 ret -00000234 : +00000212 : SYSCALL(write) - 234: b8 10 00 00 00 mov $0x10,%eax - 239: cd 40 int $0x40 - 23b: c3 ret + 212: b8 10 00 00 00 mov $0x10,%eax + 217: cd 40 int $0x40 + 219: c3 ret -0000023c : +0000021a : SYSCALL(close) - 23c: b8 15 00 00 00 mov $0x15,%eax - 241: cd 40 int $0x40 - 243: c3 ret + 21a: b8 15 00 00 00 mov $0x15,%eax + 21f: cd 40 int $0x40 + 221: c3 ret -00000244 : +00000222 : SYSCALL(kill) - 244: b8 06 00 00 00 mov $0x6,%eax - 249: cd 40 int $0x40 - 24b: c3 ret + 222: b8 06 00 00 00 mov $0x6,%eax + 227: cd 40 int $0x40 + 229: c3 ret -0000024c : +0000022a : SYSCALL(exec) - 24c: b8 07 00 00 00 mov $0x7,%eax - 251: cd 40 int $0x40 - 253: c3 ret + 22a: b8 07 00 00 00 mov $0x7,%eax + 22f: cd 40 int $0x40 + 231: c3 ret -00000254 : +00000232 : SYSCALL(open) - 254: b8 0f 00 00 00 mov $0xf,%eax - 259: cd 40 int $0x40 - 25b: c3 ret + 232: b8 0f 00 00 00 mov $0xf,%eax + 237: cd 40 int $0x40 + 239: c3 ret -0000025c : +0000023a : SYSCALL(mknod) - 25c: b8 11 00 00 00 mov $0x11,%eax - 261: cd 40 int $0x40 - 263: c3 ret + 23a: b8 11 00 00 00 mov $0x11,%eax + 23f: cd 40 int $0x40 + 241: c3 ret -00000264 : +00000242 : SYSCALL(unlink) - 264: b8 12 00 00 00 mov $0x12,%eax - 269: cd 40 int $0x40 - 26b: c3 ret + 242: b8 12 00 00 00 mov $0x12,%eax + 247: cd 40 int $0x40 + 249: c3 ret -0000026c : +0000024a : SYSCALL(fstat) - 26c: b8 08 00 00 00 mov $0x8,%eax - 271: cd 40 int $0x40 - 273: c3 ret + 24a: b8 08 00 00 00 mov $0x8,%eax + 24f: cd 40 int $0x40 + 251: c3 ret -00000274 : +00000252 : SYSCALL(link) - 274: b8 13 00 00 00 mov $0x13,%eax - 279: cd 40 int $0x40 - 27b: c3 ret + 252: b8 13 00 00 00 mov $0x13,%eax + 257: cd 40 int $0x40 + 259: c3 ret -0000027c : +0000025a : SYSCALL(mkdir) - 27c: b8 14 00 00 00 mov $0x14,%eax - 281: cd 40 int $0x40 - 283: c3 ret + 25a: b8 14 00 00 00 mov $0x14,%eax + 25f: cd 40 int $0x40 + 261: c3 ret -00000284 : +00000262 : SYSCALL(chdir) - 284: b8 09 00 00 00 mov $0x9,%eax - 289: cd 40 int $0x40 - 28b: c3 ret + 262: b8 09 00 00 00 mov $0x9,%eax + 267: cd 40 int $0x40 + 269: c3 ret -0000028c : +0000026a : SYSCALL(dup) - 28c: b8 0a 00 00 00 mov $0xa,%eax - 291: cd 40 int $0x40 - 293: c3 ret + 26a: b8 0a 00 00 00 mov $0xa,%eax + 26f: cd 40 int $0x40 + 271: c3 ret -00000294 : +00000272 : SYSCALL(getpid) - 294: b8 0b 00 00 00 mov $0xb,%eax - 299: cd 40 int $0x40 - 29b: c3 ret + 272: b8 0b 00 00 00 mov $0xb,%eax + 277: cd 40 int $0x40 + 279: c3 ret -0000029c : +0000027a : SYSCALL(sbrk) - 29c: b8 0c 00 00 00 mov $0xc,%eax - 2a1: cd 40 int $0x40 - 2a3: c3 ret + 27a: b8 0c 00 00 00 mov $0xc,%eax + 27f: cd 40 int $0x40 + 281: c3 ret -000002a4 : +00000282 : SYSCALL(sleep) - 2a4: b8 0d 00 00 00 mov $0xd,%eax - 2a9: cd 40 int $0x40 - 2ab: c3 ret + 282: b8 0d 00 00 00 mov $0xd,%eax + 287: cd 40 int $0x40 + 289: c3 ret -000002ac : +0000028a : SYSCALL(uptime) - 2ac: b8 0e 00 00 00 mov $0xe,%eax - 2b1: cd 40 int $0x40 - 2b3: c3 ret + 28a: b8 0e 00 00 00 mov $0xe,%eax + 28f: cd 40 int $0x40 + 291: c3 ret -000002b4 : +00000292 : SYSCALL(slabtest) - 2b4: b8 16 00 00 00 mov $0x16,%eax - 2b9: cd 40 int $0x40 - 2bb: c3 ret + 292: b8 16 00 00 00 mov $0x16,%eax + 297: cd 40 int $0x40 + 299: c3 ret -000002bc : +0000029a : SYSCALL(ps) - 2bc: b8 17 00 00 00 mov $0x17,%eax - 2c1: cd 40 int $0x40 - 2c3: c3 ret + 29a: b8 17 00 00 00 mov $0x17,%eax + 29f: cd 40 int $0x40 + 2a1: c3 ret -000002c4 : +000002a2 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 2c4: 55 push %ebp - 2c5: 89 e5 mov %esp,%ebp - 2c7: 57 push %edi - 2c8: 56 push %esi - 2c9: 53 push %ebx - 2ca: 83 ec 3c sub $0x3c,%esp - 2cd: 89 45 c4 mov %eax,-0x3c(%ebp) - 2d0: 89 d3 mov %edx,%ebx + 2a2: 55 push %ebp + 2a3: 89 e5 mov %esp,%ebp + 2a5: 57 push %edi + 2a6: 56 push %esi + 2a7: 53 push %ebx + 2a8: 83 ec 3c sub $0x3c,%esp + 2ab: 89 45 c4 mov %eax,-0x3c(%ebp) + 2ae: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 2d2: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 2d6: 74 77 je 34f - 2d8: 85 d2 test %edx,%edx - 2da: 79 73 jns 34f + 2b0: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 2b4: 74 79 je 32f + 2b6: 85 d2 test %edx,%edx + 2b8: 79 75 jns 32f neg = 1; x = -xx; - 2dc: f7 db neg %ebx + 2ba: 89 d1 mov %edx,%ecx + 2bc: f7 d9 neg %ecx neg = 1; - 2de: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 2be: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 2e5: be 00 00 00 00 mov $0x0,%esi + 2c5: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 2ea: 89 f7 mov %esi,%edi - 2ec: 83 c6 01 add $0x1,%esi - 2ef: 89 d8 mov %ebx,%eax - 2f1: ba 00 00 00 00 mov $0x0,%edx - 2f6: f7 f1 div %ecx - 2f8: 0f b6 92 7c 06 00 00 movzbl 0x67c(%edx),%edx - 2ff: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 2ca: 89 df mov %ebx,%edi + 2cc: 83 c3 01 add $0x1,%ebx + 2cf: 89 c8 mov %ecx,%eax + 2d1: ba 00 00 00 00 mov $0x0,%edx + 2d6: f7 f6 div %esi + 2d8: 0f b6 92 94 06 00 00 movzbl 0x694(%edx),%edx + 2df: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 303: 89 da mov %ebx,%edx - 305: 89 c3 mov %eax,%ebx - 307: 39 d1 cmp %edx,%ecx - 309: 76 df jbe 2ea + 2e3: 89 ca mov %ecx,%edx + 2e5: 89 c1 mov %eax,%ecx + 2e7: 39 d6 cmp %edx,%esi + 2e9: 76 df jbe 2ca if(neg) - 30b: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 30f: 74 08 je 319 + 2eb: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 2ef: 74 08 je 2f9 buf[i++] = '-'; - 311: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 316: 8d 77 02 lea 0x2(%edi),%esi + 2f1: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 2f6: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 319: 85 f6 test %esi,%esi - 31b: 7e 2a jle 347 - 31d: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 321: 8d 7d d8 lea -0x28(%ebp),%edi + 2f9: 85 db test %ebx,%ebx + 2fb: 7e 2a jle 327 + 2fd: 8d 7d d8 lea -0x28(%ebp),%edi + 300: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 324: 8d 75 d7 lea -0x29(%ebp),%esi + 304: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 327: 0f b6 03 movzbl (%ebx),%eax - 32a: 88 45 d7 mov %al,-0x29(%ebp) + 307: 0f b6 03 movzbl (%ebx),%eax + 30a: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 32d: 83 ec 04 sub $0x4,%esp - 330: 6a 01 push $0x1 - 332: 56 push %esi - 333: ff 75 c4 pushl -0x3c(%ebp) - 336: e8 f9 fe ff ff call 234 + 30d: 83 ec 04 sub $0x4,%esp + 310: 6a 01 push $0x1 + 312: 56 push %esi + 313: ff 75 c4 push -0x3c(%ebp) + 316: e8 f7 fe ff ff call 212 while(--i >= 0) - 33b: 89 d8 mov %ebx,%eax - 33d: 83 eb 01 sub $0x1,%ebx - 340: 83 c4 10 add $0x10,%esp - 343: 39 f8 cmp %edi,%eax - 345: 75 e0 jne 327 + 31b: 89 d8 mov %ebx,%eax + 31d: 83 eb 01 sub $0x1,%ebx + 320: 83 c4 10 add $0x10,%esp + 323: 39 f8 cmp %edi,%eax + 325: 75 e0 jne 307 } - 347: 8d 65 f4 lea -0xc(%ebp),%esp - 34a: 5b pop %ebx - 34b: 5e pop %esi - 34c: 5f pop %edi - 34d: 5d pop %ebp - 34e: c3 ret + 327: 8d 65 f4 lea -0xc(%ebp),%esp + 32a: 5b pop %ebx + 32b: 5e pop %esi + 32c: 5f pop %edi + 32d: 5d pop %ebp + 32e: c3 ret + x = xx; + 32f: 89 d1 mov %edx,%ecx neg = 0; - 34f: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 356: eb 8d jmp 2e5 + 331: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 338: eb 8b jmp 2c5 -00000358 : +0000033a : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 358: f3 0f 1e fb endbr32 - 35c: 55 push %ebp - 35d: 89 e5 mov %esp,%ebp - 35f: 57 push %edi - 360: 56 push %esi - 361: 53 push %ebx - 362: 83 ec 2c sub $0x2c,%esp + 33a: 55 push %ebp + 33b: 89 e5 mov %esp,%ebp + 33d: 57 push %edi + 33e: 56 push %esi + 33f: 53 push %ebx + 340: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 365: 8b 75 0c mov 0xc(%ebp),%esi - 368: 0f b6 1e movzbl (%esi),%ebx - 36b: 84 db test %bl,%bl - 36d: 0f 84 ab 01 00 00 je 51e - 373: 83 c6 01 add $0x1,%esi + 343: 8b 75 0c mov 0xc(%ebp),%esi + 346: 0f b6 1e movzbl (%esi),%ebx + 349: 84 db test %bl,%bl + 34b: 0f 84 9f 01 00 00 je 4f0 + 351: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 376: 8d 45 10 lea 0x10(%ebp),%eax - 379: 89 45 d4 mov %eax,-0x2c(%ebp) + 354: 8d 45 10 lea 0x10(%ebp),%eax + 357: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 37c: bf 00 00 00 00 mov $0x0,%edi - 381: eb 2d jmp 3b0 + 35a: bf 00 00 00 00 mov $0x0,%edi + 35f: eb 2d jmp 38e c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 383: 88 5d e7 mov %bl,-0x19(%ebp) + 361: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 386: 83 ec 04 sub $0x4,%esp - 389: 6a 01 push $0x1 - 38b: 8d 45 e7 lea -0x19(%ebp),%eax - 38e: 50 push %eax - 38f: ff 75 08 pushl 0x8(%ebp) - 392: e8 9d fe ff ff call 234 + 364: 83 ec 04 sub $0x4,%esp + 367: 6a 01 push $0x1 + 369: 8d 45 e7 lea -0x19(%ebp),%eax + 36c: 50 push %eax + 36d: ff 75 08 push 0x8(%ebp) + 370: e8 9d fe ff ff call 212 putc(fd, c); - 397: 83 c4 10 add $0x10,%esp - 39a: eb 05 jmp 3a1 + 375: 83 c4 10 add $0x10,%esp + 378: eb 05 jmp 37f } } else if(state == '%'){ - 39c: 83 ff 25 cmp $0x25,%edi - 39f: 74 22 je 3c3 + 37a: 83 ff 25 cmp $0x25,%edi + 37d: 74 1f je 39e for(i = 0; fmt[i]; i++){ - 3a1: 83 c6 01 add $0x1,%esi - 3a4: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3a8: 84 db test %bl,%bl - 3aa: 0f 84 6e 01 00 00 je 51e + 37f: 83 c6 01 add $0x1,%esi + 382: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 386: 84 db test %bl,%bl + 388: 0f 84 62 01 00 00 je 4f0 c = fmt[i] & 0xff; - 3b0: 0f be d3 movsbl %bl,%edx - 3b3: 0f b6 c3 movzbl %bl,%eax + 38e: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 3b6: 85 ff test %edi,%edi - 3b8: 75 e2 jne 39c + 391: 85 ff test %edi,%edi + 393: 75 e5 jne 37a if(c == '%'){ - 3ba: 83 f8 25 cmp $0x25,%eax - 3bd: 75 c4 jne 383 + 395: 83 f8 25 cmp $0x25,%eax + 398: 75 c7 jne 361 state = '%'; - 3bf: 89 c7 mov %eax,%edi - 3c1: eb de jmp 3a1 + 39a: 89 c7 mov %eax,%edi + 39c: eb e1 jmp 37f if(c == 'd'){ - 3c3: 83 f8 64 cmp $0x64,%eax - 3c6: 74 59 je 421 + 39e: 83 f8 25 cmp $0x25,%eax + 3a1: 0f 84 f2 00 00 00 je 499 + 3a7: 8d 50 9d lea -0x63(%eax),%edx + 3aa: 83 fa 15 cmp $0x15,%edx + 3ad: 0f 87 07 01 00 00 ja 4ba + 3b3: 0f 87 01 01 00 00 ja 4ba + 3b9: ff 24 95 3c 06 00 00 jmp *0x63c(,%edx,4) printint(fd, *ap, 10, 1); + 3c0: 83 ec 0c sub $0xc,%esp + 3c3: 6a 01 push $0x1 + 3c5: b9 0a 00 00 00 mov $0xa,%ecx + 3ca: 8b 7d d4 mov -0x2c(%ebp),%edi + 3cd: 8b 17 mov (%edi),%edx + 3cf: 8b 45 08 mov 0x8(%ebp),%eax + 3d2: e8 cb fe ff ff call 2a2 ap++; - } else if(c == 'x' || c == 'p'){ - 3c8: 81 e2 f7 00 00 00 and $0xf7,%edx - 3ce: 83 fa 70 cmp $0x70,%edx - 3d1: 74 7a je 44d - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 3d3: 83 f8 73 cmp $0x73,%eax - 3d6: 0f 84 9d 00 00 00 je 479 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 3dc: 83 f8 63 cmp $0x63,%eax - 3df: 0f 84 ec 00 00 00 je 4d1 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 3e5: 83 f8 25 cmp $0x25,%eax - 3e8: 0f 84 0f 01 00 00 je 4fd - putc(fd, c); + 3d7: 89 f8 mov %edi,%eax + 3d9: 83 c0 04 add $0x4,%eax + 3dc: 89 45 d4 mov %eax,-0x2c(%ebp) + 3df: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 3ee: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 3f2: 83 ec 04 sub $0x4,%esp - 3f5: 6a 01 push $0x1 - 3f7: 8d 45 e7 lea -0x19(%ebp),%eax - 3fa: 50 push %eax - 3fb: ff 75 08 pushl 0x8(%ebp) - 3fe: e8 31 fe ff ff call 234 putc(fd, c); - 403: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 406: 83 c4 0c add $0xc,%esp - 409: 6a 01 push $0x1 - 40b: 8d 45 e7 lea -0x19(%ebp),%eax - 40e: 50 push %eax - 40f: ff 75 08 pushl 0x8(%ebp) - 412: e8 1d fe ff ff call 234 - putc(fd, c); - 417: 83 c4 10 add $0x10,%esp } state = 0; - 41a: bf 00 00 00 00 mov $0x0,%edi - 41f: eb 80 jmp 3a1 - printint(fd, *ap, 10, 1); - 421: 83 ec 0c sub $0xc,%esp - 424: 6a 01 push $0x1 - 426: b9 0a 00 00 00 mov $0xa,%ecx - 42b: 8b 7d d4 mov -0x2c(%ebp),%edi - 42e: 8b 17 mov (%edi),%edx - 430: 8b 45 08 mov 0x8(%ebp),%eax - 433: e8 8c fe ff ff call 2c4 - ap++; - 438: 89 f8 mov %edi,%eax - 43a: 83 c0 04 add $0x4,%eax - 43d: 89 45 d4 mov %eax,-0x2c(%ebp) - 440: 83 c4 10 add $0x10,%esp - state = 0; - 443: bf 00 00 00 00 mov $0x0,%edi - 448: e9 54 ff ff ff jmp 3a1 + 3e2: bf 00 00 00 00 mov $0x0,%edi + 3e7: eb 96 jmp 37f printint(fd, *ap, 16, 0); - 44d: 83 ec 0c sub $0xc,%esp - 450: 6a 00 push $0x0 - 452: b9 10 00 00 00 mov $0x10,%ecx - 457: 8b 7d d4 mov -0x2c(%ebp),%edi - 45a: 8b 17 mov (%edi),%edx - 45c: 8b 45 08 mov 0x8(%ebp),%eax - 45f: e8 60 fe ff ff call 2c4 + 3e9: 83 ec 0c sub $0xc,%esp + 3ec: 6a 00 push $0x0 + 3ee: b9 10 00 00 00 mov $0x10,%ecx + 3f3: 8b 7d d4 mov -0x2c(%ebp),%edi + 3f6: 8b 17 mov (%edi),%edx + 3f8: 8b 45 08 mov 0x8(%ebp),%eax + 3fb: e8 a2 fe ff ff call 2a2 ap++; - 464: 89 f8 mov %edi,%eax - 466: 83 c0 04 add $0x4,%eax - 469: 89 45 d4 mov %eax,-0x2c(%ebp) - 46c: 83 c4 10 add $0x10,%esp + 400: 89 f8 mov %edi,%eax + 402: 83 c0 04 add $0x4,%eax + 405: 89 45 d4 mov %eax,-0x2c(%ebp) + 408: 83 c4 10 add $0x10,%esp state = 0; - 46f: bf 00 00 00 00 mov $0x0,%edi - 474: e9 28 ff ff ff jmp 3a1 + 40b: bf 00 00 00 00 mov $0x0,%edi + 410: e9 6a ff ff ff jmp 37f s = (char*)*ap; - 479: 8b 4d d4 mov -0x2c(%ebp),%ecx - 47c: 8b 01 mov (%ecx),%eax + 415: 8b 4d d4 mov -0x2c(%ebp),%ecx + 418: 8b 01 mov (%ecx),%eax ap++; - 47e: 83 c1 04 add $0x4,%ecx - 481: 89 4d d4 mov %ecx,-0x2c(%ebp) + 41a: 83 c1 04 add $0x4,%ecx + 41d: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 484: 85 c0 test %eax,%eax - 486: 74 13 je 49b + 420: 85 c0 test %eax,%eax + 422: 74 13 je 437 s = (char*)*ap; - 488: 89 c3 mov %eax,%ebx + 424: 89 c3 mov %eax,%ebx while(*s != 0){ - 48a: 0f b6 00 movzbl (%eax),%eax + 426: 0f b6 00 movzbl (%eax),%eax state = 0; - 48d: bf 00 00 00 00 mov $0x0,%edi + 429: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 492: 84 c0 test %al,%al - 494: 75 0f jne 4a5 - 496: e9 06 ff ff ff jmp 3a1 + 42e: 84 c0 test %al,%al + 430: 75 0f jne 441 + 432: e9 48 ff ff ff jmp 37f s = "(null)"; - 49b: bb 74 06 00 00 mov $0x674,%ebx + 437: bb 34 06 00 00 mov $0x634,%ebx while(*s != 0){ - 4a0: b8 28 00 00 00 mov $0x28,%eax - 4a5: 8b 7d 08 mov 0x8(%ebp),%edi + 43c: b8 28 00 00 00 mov $0x28,%eax + 441: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4a8: 88 45 e7 mov %al,-0x19(%ebp) + 444: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4ab: 83 ec 04 sub $0x4,%esp - 4ae: 6a 01 push $0x1 - 4b0: 8d 45 e7 lea -0x19(%ebp),%eax - 4b3: 50 push %eax - 4b4: 57 push %edi - 4b5: e8 7a fd ff ff call 234 + 447: 83 ec 04 sub $0x4,%esp + 44a: 6a 01 push $0x1 + 44c: 8d 45 e7 lea -0x19(%ebp),%eax + 44f: 50 push %eax + 450: 57 push %edi + 451: e8 bc fd ff ff call 212 s++; - 4ba: 83 c3 01 add $0x1,%ebx + 456: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 4bd: 0f b6 03 movzbl (%ebx),%eax - 4c0: 83 c4 10 add $0x10,%esp - 4c3: 84 c0 test %al,%al - 4c5: 75 e1 jne 4a8 + 459: 0f b6 03 movzbl (%ebx),%eax + 45c: 83 c4 10 add $0x10,%esp + 45f: 84 c0 test %al,%al + 461: 75 e1 jne 444 state = 0; - 4c7: bf 00 00 00 00 mov $0x0,%edi - 4cc: e9 d0 fe ff ff jmp 3a1 + 463: bf 00 00 00 00 mov $0x0,%edi + 468: e9 12 ff ff ff jmp 37f putc(fd, *ap); - 4d1: 8b 7d d4 mov -0x2c(%ebp),%edi - 4d4: 8b 07 mov (%edi),%eax - 4d6: 88 45 e7 mov %al,-0x19(%ebp) + 46d: 8b 7d d4 mov -0x2c(%ebp),%edi + 470: 8b 07 mov (%edi),%eax + 472: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4d9: 83 ec 04 sub $0x4,%esp - 4dc: 6a 01 push $0x1 - 4de: 8d 45 e7 lea -0x19(%ebp),%eax - 4e1: 50 push %eax - 4e2: ff 75 08 pushl 0x8(%ebp) - 4e5: e8 4a fd ff ff call 234 + 475: 83 ec 04 sub $0x4,%esp + 478: 6a 01 push $0x1 + 47a: 8d 45 e7 lea -0x19(%ebp),%eax + 47d: 50 push %eax + 47e: ff 75 08 push 0x8(%ebp) + 481: e8 8c fd ff ff call 212 ap++; - 4ea: 83 c7 04 add $0x4,%edi - 4ed: 89 7d d4 mov %edi,-0x2c(%ebp) - 4f0: 83 c4 10 add $0x10,%esp + 486: 83 c7 04 add $0x4,%edi + 489: 89 7d d4 mov %edi,-0x2c(%ebp) + 48c: 83 c4 10 add $0x10,%esp state = 0; - 4f3: bf 00 00 00 00 mov $0x0,%edi - 4f8: e9 a4 fe ff ff jmp 3a1 + 48f: bf 00 00 00 00 mov $0x0,%edi + 494: e9 e6 fe ff ff jmp 37f putc(fd, c); - 4fd: 88 5d e7 mov %bl,-0x19(%ebp) + 499: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 500: 83 ec 04 sub $0x4,%esp - 503: 6a 01 push $0x1 - 505: 8d 45 e7 lea -0x19(%ebp),%eax - 508: 50 push %eax - 509: ff 75 08 pushl 0x8(%ebp) - 50c: e8 23 fd ff ff call 234 - 511: 83 c4 10 add $0x10,%esp + 49c: 83 ec 04 sub $0x4,%esp + 49f: 6a 01 push $0x1 + 4a1: 8d 45 e7 lea -0x19(%ebp),%eax + 4a4: 50 push %eax + 4a5: ff 75 08 push 0x8(%ebp) + 4a8: e8 65 fd ff ff call 212 + 4ad: 83 c4 10 add $0x10,%esp + state = 0; + 4b0: bf 00 00 00 00 mov $0x0,%edi + 4b5: e9 c5 fe ff ff jmp 37f + putc(fd, '%'); + 4ba: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 4be: 83 ec 04 sub $0x4,%esp + 4c1: 6a 01 push $0x1 + 4c3: 8d 45 e7 lea -0x19(%ebp),%eax + 4c6: 50 push %eax + 4c7: ff 75 08 push 0x8(%ebp) + 4ca: e8 43 fd ff ff call 212 + putc(fd, c); + 4cf: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 4d2: 83 c4 0c add $0xc,%esp + 4d5: 6a 01 push $0x1 + 4d7: 8d 45 e7 lea -0x19(%ebp),%eax + 4da: 50 push %eax + 4db: ff 75 08 push 0x8(%ebp) + 4de: e8 2f fd ff ff call 212 + putc(fd, c); + 4e3: 83 c4 10 add $0x10,%esp state = 0; - 514: bf 00 00 00 00 mov $0x0,%edi - 519: e9 83 fe ff ff jmp 3a1 + 4e6: bf 00 00 00 00 mov $0x0,%edi + 4eb: e9 8f fe ff ff jmp 37f } } } - 51e: 8d 65 f4 lea -0xc(%ebp),%esp - 521: 5b pop %ebx - 522: 5e pop %esi - 523: 5f pop %edi - 524: 5d pop %ebp - 525: c3 ret - -00000526 : + 4f0: 8d 65 f4 lea -0xc(%ebp),%esp + 4f3: 5b pop %ebx + 4f4: 5e pop %esi + 4f5: 5f pop %edi + 4f6: 5d pop %ebp + 4f7: c3 ret + +000004f8 : static Header base; static Header *freep; void free(void *ap) { - 526: f3 0f 1e fb endbr32 - 52a: 55 push %ebp - 52b: 89 e5 mov %esp,%ebp - 52d: 57 push %edi - 52e: 56 push %esi - 52f: 53 push %ebx - 530: 8b 5d 08 mov 0x8(%ebp),%ebx + 4f8: 55 push %ebp + 4f9: 89 e5 mov %esp,%ebp + 4fb: 57 push %edi + 4fc: 56 push %esi + 4fd: 53 push %ebx + 4fe: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 533: 8d 4b f8 lea -0x8(%ebx),%ecx + 501: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 536: a1 e4 08 00 00 mov 0x8e4,%eax - 53b: eb 0c jmp 549 + 504: a1 fc 08 00 00 mov 0x8fc,%eax + 509: eb 0c jmp 517 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 53d: 8b 10 mov (%eax),%edx - 53f: 39 c2 cmp %eax,%edx - 541: 77 04 ja 547 - 543: 39 ca cmp %ecx,%edx - 545: 77 10 ja 557 + 50b: 8b 10 mov (%eax),%edx + 50d: 39 c2 cmp %eax,%edx + 50f: 77 04 ja 515 + 511: 39 ca cmp %ecx,%edx + 513: 77 10 ja 525 { - 547: 89 d0 mov %edx,%eax + 515: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 549: 39 c8 cmp %ecx,%eax - 54b: 73 f0 jae 53d - 54d: 8b 10 mov (%eax),%edx - 54f: 39 ca cmp %ecx,%edx - 551: 77 04 ja 557 + 517: 39 c8 cmp %ecx,%eax + 519: 73 f0 jae 50b + 51b: 8b 10 mov (%eax),%edx + 51d: 39 ca cmp %ecx,%edx + 51f: 77 04 ja 525 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 553: 39 c2 cmp %eax,%edx - 555: 77 f0 ja 547 + 521: 39 c2 cmp %eax,%edx + 523: 77 f0 ja 515 break; if(bp + bp->s.size == p->s.ptr){ - 557: 8b 73 fc mov -0x4(%ebx),%esi - 55a: 8b 10 mov (%eax),%edx - 55c: 8d 3c f1 lea (%ecx,%esi,8),%edi - 55f: 39 fa cmp %edi,%edx - 561: 74 19 je 57c + 525: 8b 73 fc mov -0x4(%ebx),%esi + 528: 8b 10 mov (%eax),%edx + 52a: 8d 3c f1 lea (%ecx,%esi,8),%edi + 52d: 39 fa cmp %edi,%edx + 52f: 74 19 je 54a bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 531: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 563: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 566: 8b 50 04 mov 0x4(%eax),%edx - 569: 8d 34 d0 lea (%eax,%edx,8),%esi - 56c: 39 f1 cmp %esi,%ecx - 56e: 74 1b je 58b + 534: 8b 50 04 mov 0x4(%eax),%edx + 537: 8d 34 d0 lea (%eax,%edx,8),%esi + 53a: 39 f1 cmp %esi,%ecx + 53c: 74 18 je 556 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 53e: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 570: 89 08 mov %ecx,(%eax) freep = p; - 572: a3 e4 08 00 00 mov %eax,0x8e4 + 540: a3 fc 08 00 00 mov %eax,0x8fc } - 577: 5b pop %ebx - 578: 5e pop %esi - 579: 5f pop %edi - 57a: 5d pop %ebp - 57b: c3 ret + 545: 5b pop %ebx + 546: 5e pop %esi + 547: 5f pop %edi + 548: 5d pop %ebp + 549: c3 ret bp->s.size += p->s.ptr->s.size; - 57c: 03 72 04 add 0x4(%edx),%esi - 57f: 89 73 fc mov %esi,-0x4(%ebx) + 54a: 03 72 04 add 0x4(%edx),%esi + 54d: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 582: 8b 10 mov (%eax),%edx - 584: 8b 12 mov (%edx),%edx - 586: 89 53 f8 mov %edx,-0x8(%ebx) - 589: eb db jmp 566 + 550: 8b 10 mov (%eax),%edx + 552: 8b 12 mov (%edx),%edx + 554: eb db jmp 531 p->s.size += bp->s.size; - 58b: 03 53 fc add -0x4(%ebx),%edx - 58e: 89 50 04 mov %edx,0x4(%eax) + 556: 03 53 fc add -0x4(%ebx),%edx + 559: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 591: 8b 53 f8 mov -0x8(%ebx),%edx - 594: 89 10 mov %edx,(%eax) - 596: eb da jmp 572 + 55c: 8b 4b f8 mov -0x8(%ebx),%ecx + 55f: eb dd jmp 53e -00000598 : +00000561 : return freep; } void* malloc(uint nbytes) { - 598: f3 0f 1e fb endbr32 - 59c: 55 push %ebp - 59d: 89 e5 mov %esp,%ebp - 59f: 57 push %edi - 5a0: 56 push %esi - 5a1: 53 push %ebx - 5a2: 83 ec 0c sub $0xc,%esp + 561: 55 push %ebp + 562: 89 e5 mov %esp,%ebp + 564: 57 push %edi + 565: 56 push %esi + 566: 53 push %ebx + 567: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5a5: 8b 45 08 mov 0x8(%ebp),%eax - 5a8: 8d 58 07 lea 0x7(%eax),%ebx - 5ab: c1 eb 03 shr $0x3,%ebx - 5ae: 83 c3 01 add $0x1,%ebx + 56a: 8b 45 08 mov 0x8(%ebp),%eax + 56d: 8d 58 07 lea 0x7(%eax),%ebx + 570: c1 eb 03 shr $0x3,%ebx + 573: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5b1: 8b 15 e4 08 00 00 mov 0x8e4,%edx - 5b7: 85 d2 test %edx,%edx - 5b9: 74 20 je 5db + 576: 8b 15 fc 08 00 00 mov 0x8fc,%edx + 57c: 85 d2 test %edx,%edx + 57e: 74 1c je 59c base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5bb: 8b 02 mov (%edx),%eax + 580: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 5bd: 8b 48 04 mov 0x4(%eax),%ecx - 5c0: 39 cb cmp %ecx,%ebx - 5c2: 76 3c jbe 600 - 5c4: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 5ca: be 00 10 00 00 mov $0x1000,%esi - 5cf: 0f 43 f3 cmovae %ebx,%esi + 582: 8b 48 04 mov 0x4(%eax),%ecx + 585: 39 cb cmp %ecx,%ebx + 587: 76 38 jbe 5c1 + 589: be 00 10 00 00 mov $0x1000,%esi + 58e: 39 f3 cmp %esi,%ebx + 590: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 5d2: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 5d9: eb 72 jmp 64d + 593: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 59a: eb 72 jmp 60e base.s.ptr = freep = prevp = &base; - 5db: c7 05 e4 08 00 00 e8 movl $0x8e8,0x8e4 - 5e2: 08 00 00 - 5e5: c7 05 e8 08 00 00 e8 movl $0x8e8,0x8e8 - 5ec: 08 00 00 + 59c: c7 05 fc 08 00 00 00 movl $0x900,0x8fc + 5a3: 09 00 00 + 5a6: c7 05 00 09 00 00 00 movl $0x900,0x900 + 5ad: 09 00 00 base.s.size = 0; - 5ef: c7 05 ec 08 00 00 00 movl $0x0,0x8ec - 5f6: 00 00 00 + 5b0: c7 05 04 09 00 00 00 movl $0x0,0x904 + 5b7: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5f9: b8 e8 08 00 00 mov $0x8e8,%eax - 5fe: eb c4 jmp 5c4 + 5ba: b8 00 09 00 00 mov $0x900,%eax + 5bf: eb c8 jmp 589 if(p->s.size == nunits) - 600: 39 cb cmp %ecx,%ebx - 602: 74 1e je 622 + 5c1: 39 cb cmp %ecx,%ebx + 5c3: 74 1e je 5e3 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 604: 29 d9 sub %ebx,%ecx - 606: 89 48 04 mov %ecx,0x4(%eax) + 5c5: 29 d9 sub %ebx,%ecx + 5c7: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 609: 8d 04 c8 lea (%eax,%ecx,8),%eax + 5ca: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 60c: 89 58 04 mov %ebx,0x4(%eax) + 5cd: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 60f: 89 15 e4 08 00 00 mov %edx,0x8e4 + 5d0: 89 15 fc 08 00 00 mov %edx,0x8fc return (void*)(p + 1); - 615: 8d 50 08 lea 0x8(%eax),%edx + 5d6: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 618: 89 d0 mov %edx,%eax - 61a: 8d 65 f4 lea -0xc(%ebp),%esp - 61d: 5b pop %ebx - 61e: 5e pop %esi - 61f: 5f pop %edi - 620: 5d pop %ebp - 621: c3 ret + 5d9: 89 d0 mov %edx,%eax + 5db: 8d 65 f4 lea -0xc(%ebp),%esp + 5de: 5b pop %ebx + 5df: 5e pop %esi + 5e0: 5f pop %edi + 5e1: 5d pop %ebp + 5e2: c3 ret prevp->s.ptr = p->s.ptr; - 622: 8b 08 mov (%eax),%ecx - 624: 89 0a mov %ecx,(%edx) - 626: eb e7 jmp 60f + 5e3: 8b 08 mov (%eax),%ecx + 5e5: 89 0a mov %ecx,(%edx) + 5e7: eb e7 jmp 5d0 hp->s.size = nu; - 628: 89 70 04 mov %esi,0x4(%eax) + 5e9: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 62b: 83 ec 0c sub $0xc,%esp - 62e: 83 c0 08 add $0x8,%eax - 631: 50 push %eax - 632: e8 ef fe ff ff call 526 + 5ec: 83 ec 0c sub $0xc,%esp + 5ef: 83 c0 08 add $0x8,%eax + 5f2: 50 push %eax + 5f3: e8 00 ff ff ff call 4f8 return freep; - 637: 8b 15 e4 08 00 00 mov 0x8e4,%edx + 5f8: 8b 15 fc 08 00 00 mov 0x8fc,%edx if((p = morecore(nunits)) == 0) - 63d: 83 c4 10 add $0x10,%esp - 640: 85 d2 test %edx,%edx - 642: 74 d4 je 618 + 5fe: 83 c4 10 add $0x10,%esp + 601: 85 d2 test %edx,%edx + 603: 74 d4 je 5d9 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 644: 8b 02 mov (%edx),%eax + 605: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 646: 8b 48 04 mov 0x4(%eax),%ecx - 649: 39 d9 cmp %ebx,%ecx - 64b: 73 b3 jae 600 + 607: 8b 48 04 mov 0x4(%eax),%ecx + 60a: 39 d9 cmp %ebx,%ecx + 60c: 73 b3 jae 5c1 if(p == freep) - 64d: 89 c2 mov %eax,%edx - 64f: 39 05 e4 08 00 00 cmp %eax,0x8e4 - 655: 75 ed jne 644 + 60e: 89 c2 mov %eax,%edx + 610: 39 05 fc 08 00 00 cmp %eax,0x8fc + 616: 75 ed jne 605 p = sbrk(nu * sizeof(Header)); - 657: 83 ec 0c sub $0xc,%esp - 65a: 57 push %edi - 65b: e8 3c fc ff ff call 29c + 618: 83 ec 0c sub $0xc,%esp + 61b: 57 push %edi + 61c: e8 59 fc ff ff call 27a if(p == (char*)-1) - 660: 83 c4 10 add $0x10,%esp - 663: 83 f8 ff cmp $0xffffffff,%eax - 666: 75 c0 jne 628 + 621: 83 c4 10 add $0x10,%esp + 624: 83 f8 ff cmp $0xffffffff,%eax + 627: 75 c0 jne 5e9 return 0; - 668: ba 00 00 00 00 mov $0x0,%edx - 66d: eb a9 jmp 618 + 629: ba 00 00 00 00 mov $0x0,%edx + 62e: eb a9 jmp 5d9 diff --git a/src/user/ps.d b/src/user/ps.d new file mode 100644 index 0000000..4f5a35c --- /dev/null +++ b/src/user/ps.d @@ -0,0 +1 @@ +user/ps.o: user/ps.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/ps.o b/src/user/ps.o new file mode 100644 index 0000000..05e6c06 Binary files /dev/null and b/src/user/ps.o differ diff --git a/src/user/ps.sym b/src/user/ps.sym index 677b8a1..9b45dc1 100644 --- a/src/user/ps.sym +++ b/src/user/ps.sym @@ -1,59 +1,47 @@ -00000000 .text -00000670 .rodata -00000690 .eh_frame -000008e4 .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 ps.c 00000000 ulib.c 00000000 printf.c -000002c4 printint -0000067c digits.1089 +000002a2 printint +00000694 digits.0 00000000 umalloc.c -000008e4 freep -000008e8 base -0000002e strcpy -00000358 printf -000001db memmove -0000025c mknod -000002bc ps -000000f9 gets -00000294 getpid -00000598 malloc -000002a4 sleep -00000224 pipe -000002b4 slabtest -00000234 write -0000026c fstat -00000244 kill -00000284 chdir -0000024c exec -0000021c wait -0000022c read -00000264 unlink -0000020c fork -0000029c sbrk -000002ac uptime -000008e4 __bss_start -000000ad memset +000008fc freep +00000900 base +0000002a strcpy +0000033a printf +000001bd memmove +0000023a mknod +0000029a ps +000000e5 gets +00000272 getpid +00000561 malloc +00000282 sleep +00000202 pipe +00000292 slabtest +00000212 write +0000024a fstat +00000222 kill +00000262 chdir +0000022a exec +000001fa wait +0000020a read +00000242 unlink +000001ea fork +0000027a sbrk +0000028a uptime +000008fc __bss_start +0000009f memset 00000000 main -00000054 strcmp -0000028c dup -00000154 stat -000008e4 _edata -000008f0 _end -00000274 link -00000214 exit -0000019c atoi -00000083 strlen -00000254 open -000000c8 strchr -0000027c mkdir -0000023c close -00000526 free +0000004e strcmp +0000026a dup +0000013c stat +000008fc _edata +00000908 _end +00000252 link +000001f2 exit +00000180 atoi +00000079 strlen +00000232 open +000000b8 strchr +0000025a mkdir +0000021a close +000004f8 free diff --git a/src/user/rm.asm b/src/user/rm.asm index bbfa02d..c8d3147 100644 --- a/src/user/rm.asm +++ b/src/user/rm.asm @@ -11,1081 +11,1050 @@ Disassembly of section .text: int main(int argc, char *argv[]) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 57 push %edi - 12: 56 push %esi - 13: 53 push %ebx - 14: 51 push %ecx - 15: 83 ec 18 sub $0x18,%esp - 18: 8b 39 mov (%ecx),%edi - 1a: 8b 59 04 mov 0x4(%ecx),%ebx + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 57 push %edi + e: 56 push %esi + f: 53 push %ebx + 10: 51 push %ecx + 11: 83 ec 18 sub $0x18,%esp + 14: 8b 39 mov (%ecx),%edi + 16: 8b 59 04 mov 0x4(%ecx),%ebx int i; if(argc < 2){ - 1d: 83 c3 04 add $0x4,%ebx + 19: 83 c3 04 add $0x4,%ebx printf(2, "Usage: rm files...\n"); exit(); } for(i = 1; i < argc; i++){ - 20: be 01 00 00 00 mov $0x1,%esi + 1c: be 01 00 00 00 mov $0x1,%esi if(argc < 2){ - 25: 83 ff 01 cmp $0x1,%edi - 28: 7e 20 jle 4a + 21: 83 ff 01 cmp $0x1,%edi + 24: 7e 20 jle 46 if(unlink(argv[i]) < 0){ - 2a: 89 5d e4 mov %ebx,-0x1c(%ebp) - 2d: 83 ec 0c sub $0xc,%esp - 30: ff 33 pushl (%ebx) - 32: e8 79 02 00 00 call 2b0 - 37: 83 c4 10 add $0x10,%esp - 3a: 85 c0 test %eax,%eax - 3c: 78 20 js 5e + 26: 89 5d e4 mov %ebx,-0x1c(%ebp) + 29: 83 ec 0c sub $0xc,%esp + 2c: ff 33 push (%ebx) + 2e: e8 5b 02 00 00 call 28e + 33: 83 c4 10 add $0x10,%esp + 36: 85 c0 test %eax,%eax + 38: 78 20 js 5a for(i = 1; i < argc; i++){ - 3e: 83 c6 01 add $0x1,%esi - 41: 83 c3 04 add $0x4,%ebx - 44: 39 f7 cmp %esi,%edi - 46: 75 e2 jne 2a - 48: eb 2b jmp 75 + 3a: 83 c6 01 add $0x1,%esi + 3d: 83 c3 04 add $0x4,%ebx + 40: 39 f7 cmp %esi,%edi + 42: 75 e2 jne 26 + 44: eb 2b jmp 71 printf(2, "Usage: rm files...\n"); - 4a: 83 ec 08 sub $0x8,%esp - 4d: 68 bc 06 00 00 push $0x6bc - 52: 6a 02 push $0x2 - 54: e8 4b 03 00 00 call 3a4 + 46: 83 ec 08 sub $0x8,%esp + 49: 68 7c 06 00 00 push $0x67c + 4e: 6a 02 push $0x2 + 50: e8 31 03 00 00 call 386 exit(); - 59: e8 02 02 00 00 call 260 + 55: e8 e4 01 00 00 call 23e printf(2, "rm: %s failed to delete\n", argv[i]); - 5e: 83 ec 04 sub $0x4,%esp - 61: 8b 45 e4 mov -0x1c(%ebp),%eax - 64: ff 30 pushl (%eax) - 66: 68 d0 06 00 00 push $0x6d0 - 6b: 6a 02 push $0x2 - 6d: e8 32 03 00 00 call 3a4 + 5a: 83 ec 04 sub $0x4,%esp + 5d: 8b 45 e4 mov -0x1c(%ebp),%eax + 60: ff 30 push (%eax) + 62: 68 90 06 00 00 push $0x690 + 67: 6a 02 push $0x2 + 69: e8 18 03 00 00 call 386 break; - 72: 83 c4 10 add $0x10,%esp + 6e: 83 c4 10 add $0x10,%esp } } exit(); - 75: e8 e6 01 00 00 call 260 + 71: e8 c8 01 00 00 call 23e -0000007a : +00000076 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 7a: f3 0f 1e fb endbr32 - 7e: 55 push %ebp - 7f: 89 e5 mov %esp,%ebp - 81: 53 push %ebx - 82: 8b 4d 08 mov 0x8(%ebp),%ecx - 85: 8b 5d 0c mov 0xc(%ebp),%ebx + 76: 55 push %ebp + 77: 89 e5 mov %esp,%ebp + 79: 53 push %ebx + 7a: 8b 4d 08 mov 0x8(%ebp),%ecx + 7d: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 88: b8 00 00 00 00 mov $0x0,%eax - 8d: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 91: 88 14 01 mov %dl,(%ecx,%eax,1) - 94: 83 c0 01 add $0x1,%eax - 97: 84 d2 test %dl,%dl - 99: 75 f2 jne 8d + 80: b8 00 00 00 00 mov $0x0,%eax + 85: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 89: 88 14 01 mov %dl,(%ecx,%eax,1) + 8c: 83 c0 01 add $0x1,%eax + 8f: 84 d2 test %dl,%dl + 91: 75 f2 jne 85 ; return os; } - 9b: 89 c8 mov %ecx,%eax - 9d: 5b pop %ebx - 9e: 5d pop %ebp - 9f: c3 ret + 93: 89 c8 mov %ecx,%eax + 95: 8b 5d fc mov -0x4(%ebp),%ebx + 98: c9 leave + 99: c3 ret -000000a0 : +0000009a : int strcmp(const char *p, const char *q) { - a0: f3 0f 1e fb endbr32 - a4: 55 push %ebp - a5: 89 e5 mov %esp,%ebp - a7: 8b 4d 08 mov 0x8(%ebp),%ecx - aa: 8b 55 0c mov 0xc(%ebp),%edx + 9a: 55 push %ebp + 9b: 89 e5 mov %esp,%ebp + 9d: 8b 4d 08 mov 0x8(%ebp),%ecx + a0: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - ad: 0f b6 01 movzbl (%ecx),%eax - b0: 84 c0 test %al,%al - b2: 74 11 je c5 - b4: 38 02 cmp %al,(%edx) - b6: 75 0d jne c5 + a3: 0f b6 01 movzbl (%ecx),%eax + a6: 84 c0 test %al,%al + a8: 74 11 je bb + aa: 38 02 cmp %al,(%edx) + ac: 75 0d jne bb p++, q++; - b8: 83 c1 01 add $0x1,%ecx - bb: 83 c2 01 add $0x1,%edx + ae: 83 c1 01 add $0x1,%ecx + b1: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - be: 0f b6 01 movzbl (%ecx),%eax - c1: 84 c0 test %al,%al - c3: 75 ef jne b4 + b4: 0f b6 01 movzbl (%ecx),%eax + b7: 84 c0 test %al,%al + b9: 75 ef jne aa return (uchar)*p - (uchar)*q; - c5: 0f b6 c0 movzbl %al,%eax - c8: 0f b6 12 movzbl (%edx),%edx - cb: 29 d0 sub %edx,%eax + bb: 0f b6 c0 movzbl %al,%eax + be: 0f b6 12 movzbl (%edx),%edx + c1: 29 d0 sub %edx,%eax } - cd: 5d pop %ebp - ce: c3 ret + c3: 5d pop %ebp + c4: c3 ret -000000cf : +000000c5 : uint strlen(const char *s) { - cf: f3 0f 1e fb endbr32 - d3: 55 push %ebp - d4: 89 e5 mov %esp,%ebp - d6: 8b 55 08 mov 0x8(%ebp),%edx + c5: 55 push %ebp + c6: 89 e5 mov %esp,%ebp + c8: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - d9: 80 3a 00 cmpb $0x0,(%edx) - dc: 74 14 je f2 - de: b8 00 00 00 00 mov $0x0,%eax - e3: 83 c0 01 add $0x1,%eax - e6: 89 c1 mov %eax,%ecx - e8: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - ec: 75 f5 jne e3 + cb: 80 3a 00 cmpb $0x0,(%edx) + ce: 74 14 je e4 + d0: b8 00 00 00 00 mov $0x0,%eax + d5: 83 c0 01 add $0x1,%eax + d8: 89 c1 mov %eax,%ecx + da: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + de: 75 f5 jne d5 ; return n; } - ee: 89 c8 mov %ecx,%eax - f0: 5d pop %ebp - f1: c3 ret + e0: 89 c8 mov %ecx,%eax + e2: 5d pop %ebp + e3: c3 ret for(n = 0; s[n]; n++) - f2: b9 00 00 00 00 mov $0x0,%ecx + e4: b9 00 00 00 00 mov $0x0,%ecx return n; - f7: eb f5 jmp ee + e9: eb f5 jmp e0 -000000f9 : +000000eb : void* memset(void *dst, int c, uint n) { - f9: f3 0f 1e fb endbr32 - fd: 55 push %ebp - fe: 89 e5 mov %esp,%ebp - 100: 57 push %edi - 101: 8b 55 08 mov 0x8(%ebp),%edx + eb: 55 push %ebp + ec: 89 e5 mov %esp,%ebp + ee: 57 push %edi + ef: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 104: 89 d7 mov %edx,%edi - 106: 8b 4d 10 mov 0x10(%ebp),%ecx - 109: 8b 45 0c mov 0xc(%ebp),%eax - 10c: fc cld - 10d: f3 aa rep stos %al,%es:(%edi) + f2: 89 d7 mov %edx,%edi + f4: 8b 4d 10 mov 0x10(%ebp),%ecx + f7: 8b 45 0c mov 0xc(%ebp),%eax + fa: fc cld + fb: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 10f: 89 d0 mov %edx,%eax - 111: 5f pop %edi - 112: 5d pop %ebp - 113: c3 ret + fd: 89 d0 mov %edx,%eax + ff: 8b 7d fc mov -0x4(%ebp),%edi + 102: c9 leave + 103: c3 ret -00000114 : +00000104 : char* strchr(const char *s, char c) { - 114: f3 0f 1e fb endbr32 - 118: 55 push %ebp - 119: 89 e5 mov %esp,%ebp - 11b: 8b 45 08 mov 0x8(%ebp),%eax - 11e: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 104: 55 push %ebp + 105: 89 e5 mov %esp,%ebp + 107: 8b 45 08 mov 0x8(%ebp),%eax + 10a: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 122: 0f b6 10 movzbl (%eax),%edx - 125: 84 d2 test %dl,%dl - 127: 74 15 je 13e + 10e: 0f b6 10 movzbl (%eax),%edx + 111: 84 d2 test %dl,%dl + 113: 74 15 je 12a if(*s == c) - 129: 38 d1 cmp %dl,%cl - 12b: 74 0f je 13c + 115: 38 d1 cmp %dl,%cl + 117: 74 0f je 128 for(; *s; s++) - 12d: 83 c0 01 add $0x1,%eax - 130: 0f b6 10 movzbl (%eax),%edx - 133: 84 d2 test %dl,%dl - 135: 75 f2 jne 129 + 119: 83 c0 01 add $0x1,%eax + 11c: 0f b6 10 movzbl (%eax),%edx + 11f: 84 d2 test %dl,%dl + 121: 75 f2 jne 115 return (char*)s; return 0; - 137: b8 00 00 00 00 mov $0x0,%eax + 123: b8 00 00 00 00 mov $0x0,%eax } - 13c: 5d pop %ebp - 13d: c3 ret + 128: 5d pop %ebp + 129: c3 ret return 0; - 13e: b8 00 00 00 00 mov $0x0,%eax - 143: eb f7 jmp 13c + 12a: b8 00 00 00 00 mov $0x0,%eax + 12f: eb f7 jmp 128 -00000145 : +00000131 : char* gets(char *buf, int max) { - 145: f3 0f 1e fb endbr32 - 149: 55 push %ebp - 14a: 89 e5 mov %esp,%ebp - 14c: 57 push %edi - 14d: 56 push %esi - 14e: 53 push %ebx - 14f: 83 ec 2c sub $0x2c,%esp - 152: 8b 75 08 mov 0x8(%ebp),%esi + 131: 55 push %ebp + 132: 89 e5 mov %esp,%ebp + 134: 57 push %edi + 135: 56 push %esi + 136: 53 push %ebx + 137: 83 ec 2c sub $0x2c,%esp + 13a: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 155: bb 00 00 00 00 mov $0x0,%ebx + 13d: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 15a: 8d 7d e7 lea -0x19(%ebp),%edi + 142: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 15d: 89 5d d4 mov %ebx,-0x2c(%ebp) - 160: 83 c3 01 add $0x1,%ebx - 163: 3b 5d 0c cmp 0xc(%ebp),%ebx - 166: 7d 27 jge 18f + 145: 89 5d d4 mov %ebx,-0x2c(%ebp) + 148: 83 c3 01 add $0x1,%ebx + 14b: 3b 5d 0c cmp 0xc(%ebp),%ebx + 14e: 7d 27 jge 177 cc = read(0, &c, 1); - 168: 83 ec 04 sub $0x4,%esp - 16b: 6a 01 push $0x1 - 16d: 57 push %edi - 16e: 6a 00 push $0x0 - 170: e8 03 01 00 00 call 278 + 150: 83 ec 04 sub $0x4,%esp + 153: 6a 01 push $0x1 + 155: 57 push %edi + 156: 6a 00 push $0x0 + 158: e8 f9 00 00 00 call 256 if(cc < 1) - 175: 83 c4 10 add $0x10,%esp - 178: 85 c0 test %eax,%eax - 17a: 7e 13 jle 18f + 15d: 83 c4 10 add $0x10,%esp + 160: 85 c0 test %eax,%eax + 162: 7e 13 jle 177 break; buf[i++] = c; - 17c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 180: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 164: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 168: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 184: 3c 0a cmp $0xa,%al - 186: 74 04 je 18c - 188: 3c 0d cmp $0xd,%al - 18a: 75 d1 jne 15d + 16c: 3c 0a cmp $0xa,%al + 16e: 74 04 je 174 + 170: 3c 0d cmp $0xd,%al + 172: 75 d1 jne 145 for(i=0; i+1 < max; ){ - 18c: 89 5d d4 mov %ebx,-0x2c(%ebp) + 174: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 18f: 8b 45 d4 mov -0x2c(%ebp),%eax - 192: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 177: 8b 45 d4 mov -0x2c(%ebp),%eax + 17a: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 196: 89 f0 mov %esi,%eax - 198: 8d 65 f4 lea -0xc(%ebp),%esp - 19b: 5b pop %ebx - 19c: 5e pop %esi - 19d: 5f pop %edi - 19e: 5d pop %ebp - 19f: c3 ret + 17e: 89 f0 mov %esi,%eax + 180: 8d 65 f4 lea -0xc(%ebp),%esp + 183: 5b pop %ebx + 184: 5e pop %esi + 185: 5f pop %edi + 186: 5d pop %ebp + 187: c3 ret -000001a0 : +00000188 : int stat(const char *n, struct stat *st) { - 1a0: f3 0f 1e fb endbr32 - 1a4: 55 push %ebp - 1a5: 89 e5 mov %esp,%ebp - 1a7: 56 push %esi - 1a8: 53 push %ebx + 188: 55 push %ebp + 189: 89 e5 mov %esp,%ebp + 18b: 56 push %esi + 18c: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 1a9: 83 ec 08 sub $0x8,%esp - 1ac: 6a 00 push $0x0 - 1ae: ff 75 08 pushl 0x8(%ebp) - 1b1: e8 ea 00 00 00 call 2a0 + 18d: 83 ec 08 sub $0x8,%esp + 190: 6a 00 push $0x0 + 192: ff 75 08 push 0x8(%ebp) + 195: e8 e4 00 00 00 call 27e if(fd < 0) - 1b6: 83 c4 10 add $0x10,%esp - 1b9: 85 c0 test %eax,%eax - 1bb: 78 24 js 1e1 - 1bd: 89 c3 mov %eax,%ebx + 19a: 83 c4 10 add $0x10,%esp + 19d: 85 c0 test %eax,%eax + 19f: 78 24 js 1c5 + 1a1: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 1bf: 83 ec 08 sub $0x8,%esp - 1c2: ff 75 0c pushl 0xc(%ebp) - 1c5: 50 push %eax - 1c6: e8 ed 00 00 00 call 2b8 - 1cb: 89 c6 mov %eax,%esi + 1a3: 83 ec 08 sub $0x8,%esp + 1a6: ff 75 0c push 0xc(%ebp) + 1a9: 50 push %eax + 1aa: e8 e7 00 00 00 call 296 + 1af: 89 c6 mov %eax,%esi close(fd); - 1cd: 89 1c 24 mov %ebx,(%esp) - 1d0: e8 b3 00 00 00 call 288 + 1b1: 89 1c 24 mov %ebx,(%esp) + 1b4: e8 ad 00 00 00 call 266 return r; - 1d5: 83 c4 10 add $0x10,%esp + 1b9: 83 c4 10 add $0x10,%esp } - 1d8: 89 f0 mov %esi,%eax - 1da: 8d 65 f8 lea -0x8(%ebp),%esp - 1dd: 5b pop %ebx - 1de: 5e pop %esi - 1df: 5d pop %ebp - 1e0: c3 ret + 1bc: 89 f0 mov %esi,%eax + 1be: 8d 65 f8 lea -0x8(%ebp),%esp + 1c1: 5b pop %ebx + 1c2: 5e pop %esi + 1c3: 5d pop %ebp + 1c4: c3 ret return -1; - 1e1: be ff ff ff ff mov $0xffffffff,%esi - 1e6: eb f0 jmp 1d8 + 1c5: be ff ff ff ff mov $0xffffffff,%esi + 1ca: eb f0 jmp 1bc -000001e8 : +000001cc : int atoi(const char *s) { - 1e8: f3 0f 1e fb endbr32 - 1ec: 55 push %ebp - 1ed: 89 e5 mov %esp,%ebp - 1ef: 53 push %ebx - 1f0: 8b 55 08 mov 0x8(%ebp),%edx + 1cc: 55 push %ebp + 1cd: 89 e5 mov %esp,%ebp + 1cf: 53 push %ebx + 1d0: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1f3: 0f b6 02 movzbl (%edx),%eax - 1f6: 8d 48 d0 lea -0x30(%eax),%ecx - 1f9: 80 f9 09 cmp $0x9,%cl - 1fc: 77 22 ja 220 + 1d3: 0f b6 02 movzbl (%edx),%eax + 1d6: 8d 48 d0 lea -0x30(%eax),%ecx + 1d9: 80 f9 09 cmp $0x9,%cl + 1dc: 77 24 ja 202 n = 0; - 1fe: b9 00 00 00 00 mov $0x0,%ecx + 1de: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 203: 83 c2 01 add $0x1,%edx - 206: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 209: 0f be c0 movsbl %al,%eax - 20c: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 1e3: 83 c2 01 add $0x1,%edx + 1e6: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 1e9: 0f be c0 movsbl %al,%eax + 1ec: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 210: 0f b6 02 movzbl (%edx),%eax - 213: 8d 58 d0 lea -0x30(%eax),%ebx - 216: 80 fb 09 cmp $0x9,%bl - 219: 76 e8 jbe 203 + 1f0: 0f b6 02 movzbl (%edx),%eax + 1f3: 8d 58 d0 lea -0x30(%eax),%ebx + 1f6: 80 fb 09 cmp $0x9,%bl + 1f9: 76 e8 jbe 1e3 return n; } - 21b: 89 c8 mov %ecx,%eax - 21d: 5b pop %ebx - 21e: 5d pop %ebp - 21f: c3 ret + 1fb: 89 c8 mov %ecx,%eax + 1fd: 8b 5d fc mov -0x4(%ebp),%ebx + 200: c9 leave + 201: c3 ret n = 0; - 220: b9 00 00 00 00 mov $0x0,%ecx + 202: b9 00 00 00 00 mov $0x0,%ecx return n; - 225: eb f4 jmp 21b + 207: eb f2 jmp 1fb -00000227 : +00000209 : void* memmove(void *vdst, const void *vsrc, int n) { - 227: f3 0f 1e fb endbr32 - 22b: 55 push %ebp - 22c: 89 e5 mov %esp,%ebp - 22e: 56 push %esi - 22f: 53 push %ebx - 230: 8b 75 08 mov 0x8(%ebp),%esi - 233: 8b 55 0c mov 0xc(%ebp),%edx - 236: 8b 5d 10 mov 0x10(%ebp),%ebx + 209: 55 push %ebp + 20a: 89 e5 mov %esp,%ebp + 20c: 56 push %esi + 20d: 53 push %ebx + 20e: 8b 75 08 mov 0x8(%ebp),%esi + 211: 8b 55 0c mov 0xc(%ebp),%edx + 214: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 239: 85 db test %ebx,%ebx - 23b: 7e 15 jle 252 - 23d: 01 f3 add %esi,%ebx + 217: 85 db test %ebx,%ebx + 219: 7e 15 jle 230 + 21b: 01 f3 add %esi,%ebx dst = vdst; - 23f: 89 f0 mov %esi,%eax + 21d: 89 f0 mov %esi,%eax *dst++ = *src++; - 241: 83 c2 01 add $0x1,%edx - 244: 83 c0 01 add $0x1,%eax - 247: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 24b: 88 48 ff mov %cl,-0x1(%eax) + 21f: 83 c2 01 add $0x1,%edx + 222: 83 c0 01 add $0x1,%eax + 225: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 229: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 24e: 39 c3 cmp %eax,%ebx - 250: 75 ef jne 241 + 22c: 39 c3 cmp %eax,%ebx + 22e: 75 ef jne 21f return vdst; } - 252: 89 f0 mov %esi,%eax - 254: 5b pop %ebx - 255: 5e pop %esi - 256: 5d pop %ebp - 257: c3 ret + 230: 89 f0 mov %esi,%eax + 232: 5b pop %ebx + 233: 5e pop %esi + 234: 5d pop %ebp + 235: c3 ret -00000258 : +00000236 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 258: b8 01 00 00 00 mov $0x1,%eax - 25d: cd 40 int $0x40 - 25f: c3 ret + 236: b8 01 00 00 00 mov $0x1,%eax + 23b: cd 40 int $0x40 + 23d: c3 ret -00000260 : +0000023e : SYSCALL(exit) - 260: b8 02 00 00 00 mov $0x2,%eax - 265: cd 40 int $0x40 - 267: c3 ret + 23e: b8 02 00 00 00 mov $0x2,%eax + 243: cd 40 int $0x40 + 245: c3 ret -00000268 : +00000246 : SYSCALL(wait) - 268: b8 03 00 00 00 mov $0x3,%eax - 26d: cd 40 int $0x40 - 26f: c3 ret + 246: b8 03 00 00 00 mov $0x3,%eax + 24b: cd 40 int $0x40 + 24d: c3 ret -00000270 : +0000024e : SYSCALL(pipe) - 270: b8 04 00 00 00 mov $0x4,%eax - 275: cd 40 int $0x40 - 277: c3 ret + 24e: b8 04 00 00 00 mov $0x4,%eax + 253: cd 40 int $0x40 + 255: c3 ret -00000278 : +00000256 : SYSCALL(read) - 278: b8 05 00 00 00 mov $0x5,%eax - 27d: cd 40 int $0x40 - 27f: c3 ret + 256: b8 05 00 00 00 mov $0x5,%eax + 25b: cd 40 int $0x40 + 25d: c3 ret -00000280 : +0000025e : SYSCALL(write) - 280: b8 10 00 00 00 mov $0x10,%eax - 285: cd 40 int $0x40 - 287: c3 ret + 25e: b8 10 00 00 00 mov $0x10,%eax + 263: cd 40 int $0x40 + 265: c3 ret -00000288 : +00000266 : SYSCALL(close) - 288: b8 15 00 00 00 mov $0x15,%eax - 28d: cd 40 int $0x40 - 28f: c3 ret + 266: b8 15 00 00 00 mov $0x15,%eax + 26b: cd 40 int $0x40 + 26d: c3 ret -00000290 : +0000026e : SYSCALL(kill) - 290: b8 06 00 00 00 mov $0x6,%eax - 295: cd 40 int $0x40 - 297: c3 ret + 26e: b8 06 00 00 00 mov $0x6,%eax + 273: cd 40 int $0x40 + 275: c3 ret -00000298 : +00000276 : SYSCALL(exec) - 298: b8 07 00 00 00 mov $0x7,%eax - 29d: cd 40 int $0x40 - 29f: c3 ret + 276: b8 07 00 00 00 mov $0x7,%eax + 27b: cd 40 int $0x40 + 27d: c3 ret -000002a0 : +0000027e : SYSCALL(open) - 2a0: b8 0f 00 00 00 mov $0xf,%eax - 2a5: cd 40 int $0x40 - 2a7: c3 ret + 27e: b8 0f 00 00 00 mov $0xf,%eax + 283: cd 40 int $0x40 + 285: c3 ret -000002a8 : +00000286 : SYSCALL(mknod) - 2a8: b8 11 00 00 00 mov $0x11,%eax - 2ad: cd 40 int $0x40 - 2af: c3 ret + 286: b8 11 00 00 00 mov $0x11,%eax + 28b: cd 40 int $0x40 + 28d: c3 ret -000002b0 : +0000028e : SYSCALL(unlink) - 2b0: b8 12 00 00 00 mov $0x12,%eax - 2b5: cd 40 int $0x40 - 2b7: c3 ret + 28e: b8 12 00 00 00 mov $0x12,%eax + 293: cd 40 int $0x40 + 295: c3 ret -000002b8 : +00000296 : SYSCALL(fstat) - 2b8: b8 08 00 00 00 mov $0x8,%eax - 2bd: cd 40 int $0x40 - 2bf: c3 ret + 296: b8 08 00 00 00 mov $0x8,%eax + 29b: cd 40 int $0x40 + 29d: c3 ret -000002c0 : +0000029e : SYSCALL(link) - 2c0: b8 13 00 00 00 mov $0x13,%eax - 2c5: cd 40 int $0x40 - 2c7: c3 ret + 29e: b8 13 00 00 00 mov $0x13,%eax + 2a3: cd 40 int $0x40 + 2a5: c3 ret -000002c8 : +000002a6 : SYSCALL(mkdir) - 2c8: b8 14 00 00 00 mov $0x14,%eax - 2cd: cd 40 int $0x40 - 2cf: c3 ret + 2a6: b8 14 00 00 00 mov $0x14,%eax + 2ab: cd 40 int $0x40 + 2ad: c3 ret -000002d0 : +000002ae : SYSCALL(chdir) - 2d0: b8 09 00 00 00 mov $0x9,%eax - 2d5: cd 40 int $0x40 - 2d7: c3 ret + 2ae: b8 09 00 00 00 mov $0x9,%eax + 2b3: cd 40 int $0x40 + 2b5: c3 ret -000002d8 : +000002b6 : SYSCALL(dup) - 2d8: b8 0a 00 00 00 mov $0xa,%eax - 2dd: cd 40 int $0x40 - 2df: c3 ret + 2b6: b8 0a 00 00 00 mov $0xa,%eax + 2bb: cd 40 int $0x40 + 2bd: c3 ret -000002e0 : +000002be : SYSCALL(getpid) - 2e0: b8 0b 00 00 00 mov $0xb,%eax - 2e5: cd 40 int $0x40 - 2e7: c3 ret + 2be: b8 0b 00 00 00 mov $0xb,%eax + 2c3: cd 40 int $0x40 + 2c5: c3 ret -000002e8 : +000002c6 : SYSCALL(sbrk) - 2e8: b8 0c 00 00 00 mov $0xc,%eax - 2ed: cd 40 int $0x40 - 2ef: c3 ret + 2c6: b8 0c 00 00 00 mov $0xc,%eax + 2cb: cd 40 int $0x40 + 2cd: c3 ret -000002f0 : +000002ce : SYSCALL(sleep) - 2f0: b8 0d 00 00 00 mov $0xd,%eax - 2f5: cd 40 int $0x40 - 2f7: c3 ret + 2ce: b8 0d 00 00 00 mov $0xd,%eax + 2d3: cd 40 int $0x40 + 2d5: c3 ret -000002f8 : +000002d6 : SYSCALL(uptime) - 2f8: b8 0e 00 00 00 mov $0xe,%eax - 2fd: cd 40 int $0x40 - 2ff: c3 ret + 2d6: b8 0e 00 00 00 mov $0xe,%eax + 2db: cd 40 int $0x40 + 2dd: c3 ret -00000300 : +000002de : SYSCALL(slabtest) - 300: b8 16 00 00 00 mov $0x16,%eax - 305: cd 40 int $0x40 - 307: c3 ret + 2de: b8 16 00 00 00 mov $0x16,%eax + 2e3: cd 40 int $0x40 + 2e5: c3 ret -00000308 : +000002e6 : SYSCALL(ps) - 308: b8 17 00 00 00 mov $0x17,%eax - 30d: cd 40 int $0x40 - 30f: c3 ret + 2e6: b8 17 00 00 00 mov $0x17,%eax + 2eb: cd 40 int $0x40 + 2ed: c3 ret -00000310 : +000002ee : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 310: 55 push %ebp - 311: 89 e5 mov %esp,%ebp - 313: 57 push %edi - 314: 56 push %esi - 315: 53 push %ebx - 316: 83 ec 3c sub $0x3c,%esp - 319: 89 45 c4 mov %eax,-0x3c(%ebp) - 31c: 89 d3 mov %edx,%ebx + 2ee: 55 push %ebp + 2ef: 89 e5 mov %esp,%ebp + 2f1: 57 push %edi + 2f2: 56 push %esi + 2f3: 53 push %ebx + 2f4: 83 ec 3c sub $0x3c,%esp + 2f7: 89 45 c4 mov %eax,-0x3c(%ebp) + 2fa: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 31e: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 322: 74 77 je 39b - 324: 85 d2 test %edx,%edx - 326: 79 73 jns 39b + 2fc: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 300: 74 79 je 37b + 302: 85 d2 test %edx,%edx + 304: 79 75 jns 37b neg = 1; x = -xx; - 328: f7 db neg %ebx + 306: 89 d1 mov %edx,%ecx + 308: f7 d9 neg %ecx neg = 1; - 32a: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 30a: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 331: be 00 00 00 00 mov $0x0,%esi + 311: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 336: 89 f7 mov %esi,%edi - 338: 83 c6 01 add $0x1,%esi - 33b: 89 d8 mov %ebx,%eax - 33d: ba 00 00 00 00 mov $0x0,%edx - 342: f7 f1 div %ecx - 344: 0f b6 92 f0 06 00 00 movzbl 0x6f0(%edx),%edx - 34b: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 316: 89 df mov %ebx,%edi + 318: 83 c3 01 add $0x1,%ebx + 31b: 89 c8 mov %ecx,%eax + 31d: ba 00 00 00 00 mov $0x0,%edx + 322: f7 f6 div %esi + 324: 0f b6 92 08 07 00 00 movzbl 0x708(%edx),%edx + 32b: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 34f: 89 da mov %ebx,%edx - 351: 89 c3 mov %eax,%ebx - 353: 39 d1 cmp %edx,%ecx - 355: 76 df jbe 336 + 32f: 89 ca mov %ecx,%edx + 331: 89 c1 mov %eax,%ecx + 333: 39 d6 cmp %edx,%esi + 335: 76 df jbe 316 if(neg) - 357: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 35b: 74 08 je 365 + 337: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 33b: 74 08 je 345 buf[i++] = '-'; - 35d: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 362: 8d 77 02 lea 0x2(%edi),%esi + 33d: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 342: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 365: 85 f6 test %esi,%esi - 367: 7e 2a jle 393 - 369: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 36d: 8d 7d d8 lea -0x28(%ebp),%edi + 345: 85 db test %ebx,%ebx + 347: 7e 2a jle 373 + 349: 8d 7d d8 lea -0x28(%ebp),%edi + 34c: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 370: 8d 75 d7 lea -0x29(%ebp),%esi + 350: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 373: 0f b6 03 movzbl (%ebx),%eax - 376: 88 45 d7 mov %al,-0x29(%ebp) + 353: 0f b6 03 movzbl (%ebx),%eax + 356: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 379: 83 ec 04 sub $0x4,%esp - 37c: 6a 01 push $0x1 - 37e: 56 push %esi - 37f: ff 75 c4 pushl -0x3c(%ebp) - 382: e8 f9 fe ff ff call 280 + 359: 83 ec 04 sub $0x4,%esp + 35c: 6a 01 push $0x1 + 35e: 56 push %esi + 35f: ff 75 c4 push -0x3c(%ebp) + 362: e8 f7 fe ff ff call 25e while(--i >= 0) - 387: 89 d8 mov %ebx,%eax - 389: 83 eb 01 sub $0x1,%ebx - 38c: 83 c4 10 add $0x10,%esp - 38f: 39 f8 cmp %edi,%eax - 391: 75 e0 jne 373 + 367: 89 d8 mov %ebx,%eax + 369: 83 eb 01 sub $0x1,%ebx + 36c: 83 c4 10 add $0x10,%esp + 36f: 39 f8 cmp %edi,%eax + 371: 75 e0 jne 353 } - 393: 8d 65 f4 lea -0xc(%ebp),%esp - 396: 5b pop %ebx - 397: 5e pop %esi - 398: 5f pop %edi - 399: 5d pop %ebp - 39a: c3 ret + 373: 8d 65 f4 lea -0xc(%ebp),%esp + 376: 5b pop %ebx + 377: 5e pop %esi + 378: 5f pop %edi + 379: 5d pop %ebp + 37a: c3 ret + x = xx; + 37b: 89 d1 mov %edx,%ecx neg = 0; - 39b: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 3a2: eb 8d jmp 331 + 37d: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 384: eb 8b jmp 311 -000003a4 : +00000386 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 3a4: f3 0f 1e fb endbr32 - 3a8: 55 push %ebp - 3a9: 89 e5 mov %esp,%ebp - 3ab: 57 push %edi - 3ac: 56 push %esi - 3ad: 53 push %ebx - 3ae: 83 ec 2c sub $0x2c,%esp + 386: 55 push %ebp + 387: 89 e5 mov %esp,%ebp + 389: 57 push %edi + 38a: 56 push %esi + 38b: 53 push %ebx + 38c: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 3b1: 8b 75 0c mov 0xc(%ebp),%esi - 3b4: 0f b6 1e movzbl (%esi),%ebx - 3b7: 84 db test %bl,%bl - 3b9: 0f 84 ab 01 00 00 je 56a - 3bf: 83 c6 01 add $0x1,%esi + 38f: 8b 75 0c mov 0xc(%ebp),%esi + 392: 0f b6 1e movzbl (%esi),%ebx + 395: 84 db test %bl,%bl + 397: 0f 84 9f 01 00 00 je 53c + 39d: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 3c2: 8d 45 10 lea 0x10(%ebp),%eax - 3c5: 89 45 d4 mov %eax,-0x2c(%ebp) + 3a0: 8d 45 10 lea 0x10(%ebp),%eax + 3a3: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 3c8: bf 00 00 00 00 mov $0x0,%edi - 3cd: eb 2d jmp 3fc + 3a6: bf 00 00 00 00 mov $0x0,%edi + 3ab: eb 2d jmp 3da c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 3cf: 88 5d e7 mov %bl,-0x19(%ebp) + 3ad: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3d2: 83 ec 04 sub $0x4,%esp - 3d5: 6a 01 push $0x1 - 3d7: 8d 45 e7 lea -0x19(%ebp),%eax - 3da: 50 push %eax - 3db: ff 75 08 pushl 0x8(%ebp) - 3de: e8 9d fe ff ff call 280 + 3b0: 83 ec 04 sub $0x4,%esp + 3b3: 6a 01 push $0x1 + 3b5: 8d 45 e7 lea -0x19(%ebp),%eax + 3b8: 50 push %eax + 3b9: ff 75 08 push 0x8(%ebp) + 3bc: e8 9d fe ff ff call 25e putc(fd, c); - 3e3: 83 c4 10 add $0x10,%esp - 3e6: eb 05 jmp 3ed + 3c1: 83 c4 10 add $0x10,%esp + 3c4: eb 05 jmp 3cb } } else if(state == '%'){ - 3e8: 83 ff 25 cmp $0x25,%edi - 3eb: 74 22 je 40f + 3c6: 83 ff 25 cmp $0x25,%edi + 3c9: 74 1f je 3ea for(i = 0; fmt[i]; i++){ - 3ed: 83 c6 01 add $0x1,%esi - 3f0: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3f4: 84 db test %bl,%bl - 3f6: 0f 84 6e 01 00 00 je 56a + 3cb: 83 c6 01 add $0x1,%esi + 3ce: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 3d2: 84 db test %bl,%bl + 3d4: 0f 84 62 01 00 00 je 53c c = fmt[i] & 0xff; - 3fc: 0f be d3 movsbl %bl,%edx - 3ff: 0f b6 c3 movzbl %bl,%eax + 3da: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 402: 85 ff test %edi,%edi - 404: 75 e2 jne 3e8 + 3dd: 85 ff test %edi,%edi + 3df: 75 e5 jne 3c6 if(c == '%'){ - 406: 83 f8 25 cmp $0x25,%eax - 409: 75 c4 jne 3cf + 3e1: 83 f8 25 cmp $0x25,%eax + 3e4: 75 c7 jne 3ad state = '%'; - 40b: 89 c7 mov %eax,%edi - 40d: eb de jmp 3ed + 3e6: 89 c7 mov %eax,%edi + 3e8: eb e1 jmp 3cb if(c == 'd'){ - 40f: 83 f8 64 cmp $0x64,%eax - 412: 74 59 je 46d + 3ea: 83 f8 25 cmp $0x25,%eax + 3ed: 0f 84 f2 00 00 00 je 4e5 + 3f3: 8d 50 9d lea -0x63(%eax),%edx + 3f6: 83 fa 15 cmp $0x15,%edx + 3f9: 0f 87 07 01 00 00 ja 506 + 3ff: 0f 87 01 01 00 00 ja 506 + 405: ff 24 95 b0 06 00 00 jmp *0x6b0(,%edx,4) printint(fd, *ap, 10, 1); + 40c: 83 ec 0c sub $0xc,%esp + 40f: 6a 01 push $0x1 + 411: b9 0a 00 00 00 mov $0xa,%ecx + 416: 8b 7d d4 mov -0x2c(%ebp),%edi + 419: 8b 17 mov (%edi),%edx + 41b: 8b 45 08 mov 0x8(%ebp),%eax + 41e: e8 cb fe ff ff call 2ee ap++; - } else if(c == 'x' || c == 'p'){ - 414: 81 e2 f7 00 00 00 and $0xf7,%edx - 41a: 83 fa 70 cmp $0x70,%edx - 41d: 74 7a je 499 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 41f: 83 f8 73 cmp $0x73,%eax - 422: 0f 84 9d 00 00 00 je 4c5 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 428: 83 f8 63 cmp $0x63,%eax - 42b: 0f 84 ec 00 00 00 je 51d - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 431: 83 f8 25 cmp $0x25,%eax - 434: 0f 84 0f 01 00 00 je 549 - putc(fd, c); + 423: 89 f8 mov %edi,%eax + 425: 83 c0 04 add $0x4,%eax + 428: 89 45 d4 mov %eax,-0x2c(%ebp) + 42b: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 43a: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 43e: 83 ec 04 sub $0x4,%esp - 441: 6a 01 push $0x1 - 443: 8d 45 e7 lea -0x19(%ebp),%eax - 446: 50 push %eax - 447: ff 75 08 pushl 0x8(%ebp) - 44a: e8 31 fe ff ff call 280 putc(fd, c); - 44f: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 452: 83 c4 0c add $0xc,%esp - 455: 6a 01 push $0x1 - 457: 8d 45 e7 lea -0x19(%ebp),%eax - 45a: 50 push %eax - 45b: ff 75 08 pushl 0x8(%ebp) - 45e: e8 1d fe ff ff call 280 - putc(fd, c); - 463: 83 c4 10 add $0x10,%esp } state = 0; - 466: bf 00 00 00 00 mov $0x0,%edi - 46b: eb 80 jmp 3ed - printint(fd, *ap, 10, 1); - 46d: 83 ec 0c sub $0xc,%esp - 470: 6a 01 push $0x1 - 472: b9 0a 00 00 00 mov $0xa,%ecx - 477: 8b 7d d4 mov -0x2c(%ebp),%edi - 47a: 8b 17 mov (%edi),%edx - 47c: 8b 45 08 mov 0x8(%ebp),%eax - 47f: e8 8c fe ff ff call 310 - ap++; - 484: 89 f8 mov %edi,%eax - 486: 83 c0 04 add $0x4,%eax - 489: 89 45 d4 mov %eax,-0x2c(%ebp) - 48c: 83 c4 10 add $0x10,%esp - state = 0; - 48f: bf 00 00 00 00 mov $0x0,%edi - 494: e9 54 ff ff ff jmp 3ed + 42e: bf 00 00 00 00 mov $0x0,%edi + 433: eb 96 jmp 3cb printint(fd, *ap, 16, 0); - 499: 83 ec 0c sub $0xc,%esp - 49c: 6a 00 push $0x0 - 49e: b9 10 00 00 00 mov $0x10,%ecx - 4a3: 8b 7d d4 mov -0x2c(%ebp),%edi - 4a6: 8b 17 mov (%edi),%edx - 4a8: 8b 45 08 mov 0x8(%ebp),%eax - 4ab: e8 60 fe ff ff call 310 + 435: 83 ec 0c sub $0xc,%esp + 438: 6a 00 push $0x0 + 43a: b9 10 00 00 00 mov $0x10,%ecx + 43f: 8b 7d d4 mov -0x2c(%ebp),%edi + 442: 8b 17 mov (%edi),%edx + 444: 8b 45 08 mov 0x8(%ebp),%eax + 447: e8 a2 fe ff ff call 2ee ap++; - 4b0: 89 f8 mov %edi,%eax - 4b2: 83 c0 04 add $0x4,%eax - 4b5: 89 45 d4 mov %eax,-0x2c(%ebp) - 4b8: 83 c4 10 add $0x10,%esp + 44c: 89 f8 mov %edi,%eax + 44e: 83 c0 04 add $0x4,%eax + 451: 89 45 d4 mov %eax,-0x2c(%ebp) + 454: 83 c4 10 add $0x10,%esp state = 0; - 4bb: bf 00 00 00 00 mov $0x0,%edi - 4c0: e9 28 ff ff ff jmp 3ed + 457: bf 00 00 00 00 mov $0x0,%edi + 45c: e9 6a ff ff ff jmp 3cb s = (char*)*ap; - 4c5: 8b 4d d4 mov -0x2c(%ebp),%ecx - 4c8: 8b 01 mov (%ecx),%eax + 461: 8b 4d d4 mov -0x2c(%ebp),%ecx + 464: 8b 01 mov (%ecx),%eax ap++; - 4ca: 83 c1 04 add $0x4,%ecx - 4cd: 89 4d d4 mov %ecx,-0x2c(%ebp) + 466: 83 c1 04 add $0x4,%ecx + 469: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 4d0: 85 c0 test %eax,%eax - 4d2: 74 13 je 4e7 + 46c: 85 c0 test %eax,%eax + 46e: 74 13 je 483 s = (char*)*ap; - 4d4: 89 c3 mov %eax,%ebx + 470: 89 c3 mov %eax,%ebx while(*s != 0){ - 4d6: 0f b6 00 movzbl (%eax),%eax + 472: 0f b6 00 movzbl (%eax),%eax state = 0; - 4d9: bf 00 00 00 00 mov $0x0,%edi + 475: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 4de: 84 c0 test %al,%al - 4e0: 75 0f jne 4f1 - 4e2: e9 06 ff ff ff jmp 3ed + 47a: 84 c0 test %al,%al + 47c: 75 0f jne 48d + 47e: e9 48 ff ff ff jmp 3cb s = "(null)"; - 4e7: bb e9 06 00 00 mov $0x6e9,%ebx + 483: bb a9 06 00 00 mov $0x6a9,%ebx while(*s != 0){ - 4ec: b8 28 00 00 00 mov $0x28,%eax - 4f1: 8b 7d 08 mov 0x8(%ebp),%edi + 488: b8 28 00 00 00 mov $0x28,%eax + 48d: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4f4: 88 45 e7 mov %al,-0x19(%ebp) + 490: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4f7: 83 ec 04 sub $0x4,%esp - 4fa: 6a 01 push $0x1 - 4fc: 8d 45 e7 lea -0x19(%ebp),%eax - 4ff: 50 push %eax - 500: 57 push %edi - 501: e8 7a fd ff ff call 280 + 493: 83 ec 04 sub $0x4,%esp + 496: 6a 01 push $0x1 + 498: 8d 45 e7 lea -0x19(%ebp),%eax + 49b: 50 push %eax + 49c: 57 push %edi + 49d: e8 bc fd ff ff call 25e s++; - 506: 83 c3 01 add $0x1,%ebx + 4a2: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 509: 0f b6 03 movzbl (%ebx),%eax - 50c: 83 c4 10 add $0x10,%esp - 50f: 84 c0 test %al,%al - 511: 75 e1 jne 4f4 + 4a5: 0f b6 03 movzbl (%ebx),%eax + 4a8: 83 c4 10 add $0x10,%esp + 4ab: 84 c0 test %al,%al + 4ad: 75 e1 jne 490 state = 0; - 513: bf 00 00 00 00 mov $0x0,%edi - 518: e9 d0 fe ff ff jmp 3ed + 4af: bf 00 00 00 00 mov $0x0,%edi + 4b4: e9 12 ff ff ff jmp 3cb putc(fd, *ap); - 51d: 8b 7d d4 mov -0x2c(%ebp),%edi - 520: 8b 07 mov (%edi),%eax - 522: 88 45 e7 mov %al,-0x19(%ebp) + 4b9: 8b 7d d4 mov -0x2c(%ebp),%edi + 4bc: 8b 07 mov (%edi),%eax + 4be: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 525: 83 ec 04 sub $0x4,%esp - 528: 6a 01 push $0x1 - 52a: 8d 45 e7 lea -0x19(%ebp),%eax - 52d: 50 push %eax - 52e: ff 75 08 pushl 0x8(%ebp) - 531: e8 4a fd ff ff call 280 + 4c1: 83 ec 04 sub $0x4,%esp + 4c4: 6a 01 push $0x1 + 4c6: 8d 45 e7 lea -0x19(%ebp),%eax + 4c9: 50 push %eax + 4ca: ff 75 08 push 0x8(%ebp) + 4cd: e8 8c fd ff ff call 25e ap++; - 536: 83 c7 04 add $0x4,%edi - 539: 89 7d d4 mov %edi,-0x2c(%ebp) - 53c: 83 c4 10 add $0x10,%esp + 4d2: 83 c7 04 add $0x4,%edi + 4d5: 89 7d d4 mov %edi,-0x2c(%ebp) + 4d8: 83 c4 10 add $0x10,%esp state = 0; - 53f: bf 00 00 00 00 mov $0x0,%edi - 544: e9 a4 fe ff ff jmp 3ed + 4db: bf 00 00 00 00 mov $0x0,%edi + 4e0: e9 e6 fe ff ff jmp 3cb putc(fd, c); - 549: 88 5d e7 mov %bl,-0x19(%ebp) + 4e5: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 54c: 83 ec 04 sub $0x4,%esp - 54f: 6a 01 push $0x1 - 551: 8d 45 e7 lea -0x19(%ebp),%eax - 554: 50 push %eax - 555: ff 75 08 pushl 0x8(%ebp) - 558: e8 23 fd ff ff call 280 - 55d: 83 c4 10 add $0x10,%esp + 4e8: 83 ec 04 sub $0x4,%esp + 4eb: 6a 01 push $0x1 + 4ed: 8d 45 e7 lea -0x19(%ebp),%eax + 4f0: 50 push %eax + 4f1: ff 75 08 push 0x8(%ebp) + 4f4: e8 65 fd ff ff call 25e + 4f9: 83 c4 10 add $0x10,%esp + state = 0; + 4fc: bf 00 00 00 00 mov $0x0,%edi + 501: e9 c5 fe ff ff jmp 3cb + putc(fd, '%'); + 506: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 50a: 83 ec 04 sub $0x4,%esp + 50d: 6a 01 push $0x1 + 50f: 8d 45 e7 lea -0x19(%ebp),%eax + 512: 50 push %eax + 513: ff 75 08 push 0x8(%ebp) + 516: e8 43 fd ff ff call 25e + putc(fd, c); + 51b: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 51e: 83 c4 0c add $0xc,%esp + 521: 6a 01 push $0x1 + 523: 8d 45 e7 lea -0x19(%ebp),%eax + 526: 50 push %eax + 527: ff 75 08 push 0x8(%ebp) + 52a: e8 2f fd ff ff call 25e + putc(fd, c); + 52f: 83 c4 10 add $0x10,%esp state = 0; - 560: bf 00 00 00 00 mov $0x0,%edi - 565: e9 83 fe ff ff jmp 3ed + 532: bf 00 00 00 00 mov $0x0,%edi + 537: e9 8f fe ff ff jmp 3cb } } } - 56a: 8d 65 f4 lea -0xc(%ebp),%esp - 56d: 5b pop %ebx - 56e: 5e pop %esi - 56f: 5f pop %edi - 570: 5d pop %ebp - 571: c3 ret - -00000572 : + 53c: 8d 65 f4 lea -0xc(%ebp),%esp + 53f: 5b pop %ebx + 540: 5e pop %esi + 541: 5f pop %edi + 542: 5d pop %ebp + 543: c3 ret + +00000544 : static Header base; static Header *freep; void free(void *ap) { - 572: f3 0f 1e fb endbr32 - 576: 55 push %ebp - 577: 89 e5 mov %esp,%ebp - 579: 57 push %edi - 57a: 56 push %esi - 57b: 53 push %ebx - 57c: 8b 5d 08 mov 0x8(%ebp),%ebx + 544: 55 push %ebp + 545: 89 e5 mov %esp,%ebp + 547: 57 push %edi + 548: 56 push %esi + 549: 53 push %ebx + 54a: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 57f: 8d 4b f8 lea -0x8(%ebx),%ecx + 54d: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 582: a1 64 09 00 00 mov 0x964,%eax - 587: eb 0c jmp 595 + 550: a1 7c 09 00 00 mov 0x97c,%eax + 555: eb 0c jmp 563 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 589: 8b 10 mov (%eax),%edx - 58b: 39 c2 cmp %eax,%edx - 58d: 77 04 ja 593 - 58f: 39 ca cmp %ecx,%edx - 591: 77 10 ja 5a3 + 557: 8b 10 mov (%eax),%edx + 559: 39 c2 cmp %eax,%edx + 55b: 77 04 ja 561 + 55d: 39 ca cmp %ecx,%edx + 55f: 77 10 ja 571 { - 593: 89 d0 mov %edx,%eax + 561: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 595: 39 c8 cmp %ecx,%eax - 597: 73 f0 jae 589 - 599: 8b 10 mov (%eax),%edx - 59b: 39 ca cmp %ecx,%edx - 59d: 77 04 ja 5a3 + 563: 39 c8 cmp %ecx,%eax + 565: 73 f0 jae 557 + 567: 8b 10 mov (%eax),%edx + 569: 39 ca cmp %ecx,%edx + 56b: 77 04 ja 571 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 59f: 39 c2 cmp %eax,%edx - 5a1: 77 f0 ja 593 + 56d: 39 c2 cmp %eax,%edx + 56f: 77 f0 ja 561 break; if(bp + bp->s.size == p->s.ptr){ - 5a3: 8b 73 fc mov -0x4(%ebx),%esi - 5a6: 8b 10 mov (%eax),%edx - 5a8: 8d 3c f1 lea (%ecx,%esi,8),%edi - 5ab: 39 fa cmp %edi,%edx - 5ad: 74 19 je 5c8 + 571: 8b 73 fc mov -0x4(%ebx),%esi + 574: 8b 10 mov (%eax),%edx + 576: 8d 3c f1 lea (%ecx,%esi,8),%edi + 579: 39 fa cmp %edi,%edx + 57b: 74 19 je 596 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 57d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 5af: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 5b2: 8b 50 04 mov 0x4(%eax),%edx - 5b5: 8d 34 d0 lea (%eax,%edx,8),%esi - 5b8: 39 f1 cmp %esi,%ecx - 5ba: 74 1b je 5d7 + 580: 8b 50 04 mov 0x4(%eax),%edx + 583: 8d 34 d0 lea (%eax,%edx,8),%esi + 586: 39 f1 cmp %esi,%ecx + 588: 74 18 je 5a2 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 58a: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 5bc: 89 08 mov %ecx,(%eax) freep = p; - 5be: a3 64 09 00 00 mov %eax,0x964 + 58c: a3 7c 09 00 00 mov %eax,0x97c } - 5c3: 5b pop %ebx - 5c4: 5e pop %esi - 5c5: 5f pop %edi - 5c6: 5d pop %ebp - 5c7: c3 ret + 591: 5b pop %ebx + 592: 5e pop %esi + 593: 5f pop %edi + 594: 5d pop %ebp + 595: c3 ret bp->s.size += p->s.ptr->s.size; - 5c8: 03 72 04 add 0x4(%edx),%esi - 5cb: 89 73 fc mov %esi,-0x4(%ebx) + 596: 03 72 04 add 0x4(%edx),%esi + 599: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 5ce: 8b 10 mov (%eax),%edx - 5d0: 8b 12 mov (%edx),%edx - 5d2: 89 53 f8 mov %edx,-0x8(%ebx) - 5d5: eb db jmp 5b2 + 59c: 8b 10 mov (%eax),%edx + 59e: 8b 12 mov (%edx),%edx + 5a0: eb db jmp 57d p->s.size += bp->s.size; - 5d7: 03 53 fc add -0x4(%ebx),%edx - 5da: 89 50 04 mov %edx,0x4(%eax) + 5a2: 03 53 fc add -0x4(%ebx),%edx + 5a5: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 5dd: 8b 53 f8 mov -0x8(%ebx),%edx - 5e0: 89 10 mov %edx,(%eax) - 5e2: eb da jmp 5be + 5a8: 8b 4b f8 mov -0x8(%ebx),%ecx + 5ab: eb dd jmp 58a -000005e4 : +000005ad : return freep; } void* malloc(uint nbytes) { - 5e4: f3 0f 1e fb endbr32 - 5e8: 55 push %ebp - 5e9: 89 e5 mov %esp,%ebp - 5eb: 57 push %edi - 5ec: 56 push %esi - 5ed: 53 push %ebx - 5ee: 83 ec 0c sub $0xc,%esp + 5ad: 55 push %ebp + 5ae: 89 e5 mov %esp,%ebp + 5b0: 57 push %edi + 5b1: 56 push %esi + 5b2: 53 push %ebx + 5b3: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5f1: 8b 45 08 mov 0x8(%ebp),%eax - 5f4: 8d 58 07 lea 0x7(%eax),%ebx - 5f7: c1 eb 03 shr $0x3,%ebx - 5fa: 83 c3 01 add $0x1,%ebx + 5b6: 8b 45 08 mov 0x8(%ebp),%eax + 5b9: 8d 58 07 lea 0x7(%eax),%ebx + 5bc: c1 eb 03 shr $0x3,%ebx + 5bf: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5fd: 8b 15 64 09 00 00 mov 0x964,%edx - 603: 85 d2 test %edx,%edx - 605: 74 20 je 627 + 5c2: 8b 15 7c 09 00 00 mov 0x97c,%edx + 5c8: 85 d2 test %edx,%edx + 5ca: 74 1c je 5e8 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 607: 8b 02 mov (%edx),%eax + 5cc: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 609: 8b 48 04 mov 0x4(%eax),%ecx - 60c: 39 cb cmp %ecx,%ebx - 60e: 76 3c jbe 64c - 610: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 616: be 00 10 00 00 mov $0x1000,%esi - 61b: 0f 43 f3 cmovae %ebx,%esi + 5ce: 8b 48 04 mov 0x4(%eax),%ecx + 5d1: 39 cb cmp %ecx,%ebx + 5d3: 76 38 jbe 60d + 5d5: be 00 10 00 00 mov $0x1000,%esi + 5da: 39 f3 cmp %esi,%ebx + 5dc: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 61e: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 625: eb 72 jmp 699 + 5df: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 5e6: eb 72 jmp 65a base.s.ptr = freep = prevp = &base; - 627: c7 05 64 09 00 00 68 movl $0x968,0x964 - 62e: 09 00 00 - 631: c7 05 68 09 00 00 68 movl $0x968,0x968 - 638: 09 00 00 + 5e8: c7 05 7c 09 00 00 80 movl $0x980,0x97c + 5ef: 09 00 00 + 5f2: c7 05 80 09 00 00 80 movl $0x980,0x980 + 5f9: 09 00 00 base.s.size = 0; - 63b: c7 05 6c 09 00 00 00 movl $0x0,0x96c - 642: 00 00 00 + 5fc: c7 05 84 09 00 00 00 movl $0x0,0x984 + 603: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 645: b8 68 09 00 00 mov $0x968,%eax - 64a: eb c4 jmp 610 + 606: b8 80 09 00 00 mov $0x980,%eax + 60b: eb c8 jmp 5d5 if(p->s.size == nunits) - 64c: 39 cb cmp %ecx,%ebx - 64e: 74 1e je 66e + 60d: 39 cb cmp %ecx,%ebx + 60f: 74 1e je 62f prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 650: 29 d9 sub %ebx,%ecx - 652: 89 48 04 mov %ecx,0x4(%eax) + 611: 29 d9 sub %ebx,%ecx + 613: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 655: 8d 04 c8 lea (%eax,%ecx,8),%eax + 616: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 658: 89 58 04 mov %ebx,0x4(%eax) + 619: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 65b: 89 15 64 09 00 00 mov %edx,0x964 + 61c: 89 15 7c 09 00 00 mov %edx,0x97c return (void*)(p + 1); - 661: 8d 50 08 lea 0x8(%eax),%edx + 622: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 664: 89 d0 mov %edx,%eax - 666: 8d 65 f4 lea -0xc(%ebp),%esp - 669: 5b pop %ebx - 66a: 5e pop %esi - 66b: 5f pop %edi - 66c: 5d pop %ebp - 66d: c3 ret + 625: 89 d0 mov %edx,%eax + 627: 8d 65 f4 lea -0xc(%ebp),%esp + 62a: 5b pop %ebx + 62b: 5e pop %esi + 62c: 5f pop %edi + 62d: 5d pop %ebp + 62e: c3 ret prevp->s.ptr = p->s.ptr; - 66e: 8b 08 mov (%eax),%ecx - 670: 89 0a mov %ecx,(%edx) - 672: eb e7 jmp 65b + 62f: 8b 08 mov (%eax),%ecx + 631: 89 0a mov %ecx,(%edx) + 633: eb e7 jmp 61c hp->s.size = nu; - 674: 89 70 04 mov %esi,0x4(%eax) + 635: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 677: 83 ec 0c sub $0xc,%esp - 67a: 83 c0 08 add $0x8,%eax - 67d: 50 push %eax - 67e: e8 ef fe ff ff call 572 + 638: 83 ec 0c sub $0xc,%esp + 63b: 83 c0 08 add $0x8,%eax + 63e: 50 push %eax + 63f: e8 00 ff ff ff call 544 return freep; - 683: 8b 15 64 09 00 00 mov 0x964,%edx + 644: 8b 15 7c 09 00 00 mov 0x97c,%edx if((p = morecore(nunits)) == 0) - 689: 83 c4 10 add $0x10,%esp - 68c: 85 d2 test %edx,%edx - 68e: 74 d4 je 664 + 64a: 83 c4 10 add $0x10,%esp + 64d: 85 d2 test %edx,%edx + 64f: 74 d4 je 625 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 690: 8b 02 mov (%edx),%eax + 651: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 692: 8b 48 04 mov 0x4(%eax),%ecx - 695: 39 d9 cmp %ebx,%ecx - 697: 73 b3 jae 64c + 653: 8b 48 04 mov 0x4(%eax),%ecx + 656: 39 d9 cmp %ebx,%ecx + 658: 73 b3 jae 60d if(p == freep) - 699: 89 c2 mov %eax,%edx - 69b: 39 05 64 09 00 00 cmp %eax,0x964 - 6a1: 75 ed jne 690 + 65a: 89 c2 mov %eax,%edx + 65c: 39 05 7c 09 00 00 cmp %eax,0x97c + 662: 75 ed jne 651 p = sbrk(nu * sizeof(Header)); - 6a3: 83 ec 0c sub $0xc,%esp - 6a6: 57 push %edi - 6a7: e8 3c fc ff ff call 2e8 + 664: 83 ec 0c sub $0xc,%esp + 667: 57 push %edi + 668: e8 59 fc ff ff call 2c6 if(p == (char*)-1) - 6ac: 83 c4 10 add $0x10,%esp - 6af: 83 f8 ff cmp $0xffffffff,%eax - 6b2: 75 c0 jne 674 + 66d: 83 c4 10 add $0x10,%esp + 670: 83 f8 ff cmp $0xffffffff,%eax + 673: 75 c0 jne 635 return 0; - 6b4: ba 00 00 00 00 mov $0x0,%edx - 6b9: eb a9 jmp 664 + 675: ba 00 00 00 00 mov $0x0,%edx + 67a: eb a9 jmp 625 diff --git a/src/user/rm.d b/src/user/rm.d new file mode 100644 index 0000000..dfa40b4 --- /dev/null +++ b/src/user/rm.d @@ -0,0 +1 @@ +user/rm.o: user/rm.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/rm.o b/src/user/rm.o new file mode 100644 index 0000000..342313a Binary files /dev/null and b/src/user/rm.o differ diff --git a/src/user/rm.sym b/src/user/rm.sym index 936e0c7..7c95e75 100644 --- a/src/user/rm.sym +++ b/src/user/rm.sym @@ -1,59 +1,47 @@ -00000000 .text -000006bc .rodata -00000704 .eh_frame -00000964 .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 -00000310 printint -000006f0 digits.1089 +000002ee printint +00000708 digits.0 00000000 umalloc.c -00000964 freep -00000968 base -0000007a strcpy -000003a4 printf -00000227 memmove -000002a8 mknod -00000308 ps -00000145 gets -000002e0 getpid -000005e4 malloc -000002f0 sleep -00000270 pipe -00000300 slabtest -00000280 write -000002b8 fstat -00000290 kill -000002d0 chdir -00000298 exec -00000268 wait -00000278 read -000002b0 unlink -00000258 fork -000002e8 sbrk -000002f8 uptime -00000964 __bss_start -000000f9 memset +0000097c freep +00000980 base +00000076 strcpy +00000386 printf +00000209 memmove +00000286 mknod +000002e6 ps +00000131 gets +000002be getpid +000005ad malloc +000002ce sleep +0000024e pipe +000002de slabtest +0000025e write +00000296 fstat +0000026e kill +000002ae chdir +00000276 exec +00000246 wait +00000256 read +0000028e unlink +00000236 fork +000002c6 sbrk +000002d6 uptime +0000097c __bss_start +000000eb memset 00000000 main -000000a0 strcmp -000002d8 dup -000001a0 stat -00000964 _edata -00000970 _end -000002c0 link -00000260 exit -000001e8 atoi -000000cf strlen -000002a0 open -00000114 strchr -000002c8 mkdir -00000288 close -00000572 free +0000009a strcmp +000002b6 dup +00000188 stat +0000097c _edata +00000988 _end +0000029e link +0000023e exit +000001cc atoi +000000c5 strlen +0000027e open +00000104 strchr +000002a6 mkdir +00000266 close +00000544 free diff --git a/src/user/sh.asm b/src/user/sh.asm index a4bf9d1..7ea6460 100644 --- a/src/user/sh.asm +++ b/src/user/sh.asm @@ -11,2343 +11,2300 @@ Disassembly of section .text: int getcmd(char *buf, int nbuf) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 56 push %esi - 8: 53 push %ebx - 9: 8b 5d 08 mov 0x8(%ebp),%ebx - c: 8b 75 0c mov 0xc(%ebp),%esi + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 56 push %esi + 4: 53 push %ebx + 5: 8b 5d 08 mov 0x8(%ebp),%ebx + 8: 8b 75 0c mov 0xc(%ebp),%esi printf(2, "$ "); - f: 83 ec 08 sub $0x8,%esp - 12: 68 54 10 00 00 push $0x1054 - 17: 6a 02 push $0x2 - 19: e8 1c 0d 00 00 call d3a + b: 83 ec 08 sub $0x8,%esp + e: 68 cc 0f 00 00 push $0xfcc + 13: 6a 02 push $0x2 + 15: e8 b9 0c 00 00 call cd3 memset(buf, 0, nbuf); - 1e: 83 c4 0c add $0xc,%esp - 21: 56 push %esi - 22: 6a 00 push $0x0 - 24: 53 push %ebx - 25: e8 65 0a 00 00 call a8f + 1a: 83 c4 0c add $0xc,%esp + 1d: 56 push %esi + 1e: 6a 00 push $0x0 + 20: 53 push %ebx + 21: e8 12 0a 00 00 call a38 gets(buf, nbuf); - 2a: 83 c4 08 add $0x8,%esp - 2d: 56 push %esi - 2e: 53 push %ebx - 2f: e8 a7 0a 00 00 call adb + 26: 83 c4 08 add $0x8,%esp + 29: 56 push %esi + 2a: 53 push %ebx + 2b: e8 4e 0a 00 00 call a7e if(buf[0] == 0) // EOF - 34: 83 c4 10 add $0x10,%esp - 37: 80 3b 00 cmpb $0x0,(%ebx) - 3a: 0f 94 c0 sete %al - 3d: 0f b6 c0 movzbl %al,%eax - 40: f7 d8 neg %eax + 30: 83 c4 10 add $0x10,%esp + 33: 80 3b 01 cmpb $0x1,(%ebx) + 36: 19 c0 sbb %eax,%eax return -1; return 0; } - 42: 8d 65 f8 lea -0x8(%ebp),%esp - 45: 5b pop %ebx - 46: 5e pop %esi - 47: 5d pop %ebp - 48: c3 ret + 38: 8d 65 f8 lea -0x8(%ebp),%esp + 3b: 5b pop %ebx + 3c: 5e pop %esi + 3d: 5d pop %ebp + 3e: c3 ret -00000049 : +0000003f : exit(); } void panic(char *s) { - 49: f3 0f 1e fb endbr32 - 4d: 55 push %ebp - 4e: 89 e5 mov %esp,%ebp - 50: 83 ec 0c sub $0xc,%esp + 3f: 55 push %ebp + 40: 89 e5 mov %esp,%ebp + 42: 83 ec 0c sub $0xc,%esp printf(2, "%s\n", s); - 53: ff 75 08 pushl 0x8(%ebp) - 56: 68 f1 10 00 00 push $0x10f1 - 5b: 6a 02 push $0x2 - 5d: e8 d8 0c 00 00 call d3a + 45: ff 75 08 push 0x8(%ebp) + 48: 68 69 10 00 00 push $0x1069 + 4d: 6a 02 push $0x2 + 4f: e8 7f 0c 00 00 call cd3 exit(); - 62: e8 8f 0b 00 00 call bf6 + 54: e8 32 0b 00 00 call b8b -00000067 : +00000059 : } int fork1(void) { - 67: f3 0f 1e fb endbr32 - 6b: 55 push %ebp - 6c: 89 e5 mov %esp,%ebp - 6e: 83 ec 08 sub $0x8,%esp + 59: 55 push %ebp + 5a: 89 e5 mov %esp,%ebp + 5c: 83 ec 08 sub $0x8,%esp int pid; pid = fork(); - 71: e8 78 0b 00 00 call bee + 5f: e8 1f 0b 00 00 call b83 if(pid == -1) - 76: 83 f8 ff cmp $0xffffffff,%eax - 79: 74 02 je 7d + 64: 83 f8 ff cmp $0xffffffff,%eax + 67: 74 02 je 6b panic("fork"); return pid; } - 7b: c9 leave - 7c: c3 ret + 69: c9 leave + 6a: c3 ret panic("fork"); - 7d: 83 ec 0c sub $0xc,%esp - 80: 68 57 10 00 00 push $0x1057 - 85: e8 bf ff ff ff call 49 + 6b: 83 ec 0c sub $0xc,%esp + 6e: 68 cf 0f 00 00 push $0xfcf + 73: e8 c7 ff ff ff call 3f -0000008a : +00000078 : { - 8a: f3 0f 1e fb endbr32 - 8e: 55 push %ebp - 8f: 89 e5 mov %esp,%ebp - 91: 53 push %ebx - 92: 83 ec 14 sub $0x14,%esp - 95: 8b 5d 08 mov 0x8(%ebp),%ebx + 78: 55 push %ebp + 79: 89 e5 mov %esp,%ebp + 7b: 53 push %ebx + 7c: 83 ec 14 sub $0x14,%esp + 7f: 8b 5d 08 mov 0x8(%ebp),%ebx if(cmd == 0) - 98: 85 db test %ebx,%ebx - 9a: 74 0f je ab + 82: 85 db test %ebx,%ebx + 84: 74 0e je 94 switch(cmd->type){ - 9c: 83 3b 05 cmpl $0x5,(%ebx) - 9f: 77 0f ja b0 - a1: 8b 03 mov (%ebx),%eax - a3: 3e ff 24 85 0c 11 00 notrack jmp *0x110c(,%eax,4) - aa: 00 + 86: 83 3b 05 cmpl $0x5,(%ebx) + 89: 77 0e ja 99 + 8b: 8b 03 mov (%ebx),%eax + 8d: ff 24 85 84 10 00 00 jmp *0x1084(,%eax,4) exit(); - ab: e8 46 0b 00 00 call bf6 + 94: e8 f2 0a 00 00 call b8b panic("runcmd"); - b0: 83 ec 0c sub $0xc,%esp - b3: 68 5c 10 00 00 push $0x105c - b8: e8 8c ff ff ff call 49 + 99: 83 ec 0c sub $0xc,%esp + 9c: 68 d4 0f 00 00 push $0xfd4 + a1: e8 99 ff ff ff call 3f if(ecmd->argv[0] == 0) - bd: 8b 43 04 mov 0x4(%ebx),%eax - c0: 85 c0 test %eax,%eax - c2: 74 27 je eb + a6: 8b 43 04 mov 0x4(%ebx),%eax + a9: 85 c0 test %eax,%eax + ab: 74 27 je d4 exec(ecmd->argv[0], ecmd->argv); - c4: 83 ec 08 sub $0x8,%esp - c7: 8d 53 04 lea 0x4(%ebx),%edx - ca: 52 push %edx - cb: 50 push %eax - cc: e8 5d 0b 00 00 call c2e + ad: 83 ec 08 sub $0x8,%esp + b0: 8d 53 04 lea 0x4(%ebx),%edx + b3: 52 push %edx + b4: 50 push %eax + b5: e8 09 0b 00 00 call bc3 printf(2, "exec %s failed\n", ecmd->argv[0]); - d1: 83 c4 0c add $0xc,%esp - d4: ff 73 04 pushl 0x4(%ebx) - d7: 68 63 10 00 00 push $0x1063 - dc: 6a 02 push $0x2 - de: e8 57 0c 00 00 call d3a + ba: 83 c4 0c add $0xc,%esp + bd: ff 73 04 push 0x4(%ebx) + c0: 68 db 0f 00 00 push $0xfdb + c5: 6a 02 push $0x2 + c7: e8 07 0c 00 00 call cd3 break; - e3: 83 c4 10 add $0x10,%esp + cc: 83 c4 10 add $0x10,%esp exit(); - e6: e8 0b 0b 00 00 call bf6 + cf: e8 b7 0a 00 00 call b8b exit(); - eb: e8 06 0b 00 00 call bf6 + d4: e8 b2 0a 00 00 call b8b close(rcmd->fd); - f0: 83 ec 0c sub $0xc,%esp - f3: ff 73 14 pushl 0x14(%ebx) - f6: e8 23 0b 00 00 call c1e + d9: 83 ec 0c sub $0xc,%esp + dc: ff 73 14 push 0x14(%ebx) + df: e8 cf 0a 00 00 call bb3 if(open(rcmd->file, rcmd->mode) < 0){ - fb: 83 c4 08 add $0x8,%esp - fe: ff 73 10 pushl 0x10(%ebx) - 101: ff 73 08 pushl 0x8(%ebx) - 104: e8 2d 0b 00 00 call c36 - 109: 83 c4 10 add $0x10,%esp - 10c: 85 c0 test %eax,%eax - 10e: 78 0b js 11b + e4: 83 c4 08 add $0x8,%esp + e7: ff 73 10 push 0x10(%ebx) + ea: ff 73 08 push 0x8(%ebx) + ed: e8 d9 0a 00 00 call bcb + f2: 83 c4 10 add $0x10,%esp + f5: 85 c0 test %eax,%eax + f7: 78 0b js 104 runcmd(rcmd->cmd); - 110: 83 ec 0c sub $0xc,%esp - 113: ff 73 04 pushl 0x4(%ebx) - 116: e8 6f ff ff ff call 8a + f9: 83 ec 0c sub $0xc,%esp + fc: ff 73 04 push 0x4(%ebx) + ff: e8 74 ff ff ff call 78 printf(2, "open %s failed\n", rcmd->file); - 11b: 83 ec 04 sub $0x4,%esp - 11e: ff 73 08 pushl 0x8(%ebx) - 121: 68 73 10 00 00 push $0x1073 - 126: 6a 02 push $0x2 - 128: e8 0d 0c 00 00 call d3a + 104: 83 ec 04 sub $0x4,%esp + 107: ff 73 08 push 0x8(%ebx) + 10a: 68 eb 0f 00 00 push $0xfeb + 10f: 6a 02 push $0x2 + 111: e8 bd 0b 00 00 call cd3 exit(); - 12d: e8 c4 0a 00 00 call bf6 + 116: e8 70 0a 00 00 call b8b if(fork1() == 0) - 132: e8 30 ff ff ff call 67 - 137: 85 c0 test %eax,%eax - 139: 74 10 je 14b + 11b: e8 39 ff ff ff call 59 + 120: 85 c0 test %eax,%eax + 122: 74 10 je 134 wait(); - 13b: e8 be 0a 00 00 call bfe + 124: e8 6a 0a 00 00 call b93 runcmd(lcmd->right); - 140: 83 ec 0c sub $0xc,%esp - 143: ff 73 08 pushl 0x8(%ebx) - 146: e8 3f ff ff ff call 8a + 129: 83 ec 0c sub $0xc,%esp + 12c: ff 73 08 push 0x8(%ebx) + 12f: e8 44 ff ff ff call 78 runcmd(lcmd->left); - 14b: 83 ec 0c sub $0xc,%esp - 14e: ff 73 04 pushl 0x4(%ebx) - 151: e8 34 ff ff ff call 8a + 134: 83 ec 0c sub $0xc,%esp + 137: ff 73 04 push 0x4(%ebx) + 13a: e8 39 ff ff ff call 78 if(pipe(p) < 0) - 156: 83 ec 0c sub $0xc,%esp - 159: 8d 45 f0 lea -0x10(%ebp),%eax - 15c: 50 push %eax - 15d: e8 a4 0a 00 00 call c06 - 162: 83 c4 10 add $0x10,%esp - 165: 85 c0 test %eax,%eax - 167: 78 3a js 1a3 + 13f: 83 ec 0c sub $0xc,%esp + 142: 8d 45 f0 lea -0x10(%ebp),%eax + 145: 50 push %eax + 146: e8 50 0a 00 00 call b9b + 14b: 83 c4 10 add $0x10,%esp + 14e: 85 c0 test %eax,%eax + 150: 78 3a js 18c if(fork1() == 0){ - 169: e8 f9 fe ff ff call 67 - 16e: 85 c0 test %eax,%eax - 170: 74 3e je 1b0 + 152: e8 02 ff ff ff call 59 + 157: 85 c0 test %eax,%eax + 159: 74 3e je 199 if(fork1() == 0){ - 172: e8 f0 fe ff ff call 67 - 177: 85 c0 test %eax,%eax - 179: 74 6b je 1e6 + 15b: e8 f9 fe ff ff call 59 + 160: 85 c0 test %eax,%eax + 162: 74 6b je 1cf close(p[0]); - 17b: 83 ec 0c sub $0xc,%esp - 17e: ff 75 f0 pushl -0x10(%ebp) - 181: e8 98 0a 00 00 call c1e + 164: 83 ec 0c sub $0xc,%esp + 167: ff 75 f0 push -0x10(%ebp) + 16a: e8 44 0a 00 00 call bb3 close(p[1]); - 186: 83 c4 04 add $0x4,%esp - 189: ff 75 f4 pushl -0xc(%ebp) - 18c: e8 8d 0a 00 00 call c1e + 16f: 83 c4 04 add $0x4,%esp + 172: ff 75 f4 push -0xc(%ebp) + 175: e8 39 0a 00 00 call bb3 wait(); - 191: e8 68 0a 00 00 call bfe + 17a: e8 14 0a 00 00 call b93 wait(); - 196: e8 63 0a 00 00 call bfe + 17f: e8 0f 0a 00 00 call b93 break; - 19b: 83 c4 10 add $0x10,%esp - 19e: e9 43 ff ff ff jmp e6 + 184: 83 c4 10 add $0x10,%esp + 187: e9 43 ff ff ff jmp cf panic("pipe"); - 1a3: 83 ec 0c sub $0xc,%esp - 1a6: 68 83 10 00 00 push $0x1083 - 1ab: e8 99 fe ff ff call 49 + 18c: 83 ec 0c sub $0xc,%esp + 18f: 68 fb 0f 00 00 push $0xffb + 194: e8 a6 fe ff ff call 3f close(1); - 1b0: 83 ec 0c sub $0xc,%esp - 1b3: 6a 01 push $0x1 - 1b5: e8 64 0a 00 00 call c1e + 199: 83 ec 0c sub $0xc,%esp + 19c: 6a 01 push $0x1 + 19e: e8 10 0a 00 00 call bb3 dup(p[1]); - 1ba: 83 c4 04 add $0x4,%esp - 1bd: ff 75 f4 pushl -0xc(%ebp) - 1c0: e8 a9 0a 00 00 call c6e + 1a3: 83 c4 04 add $0x4,%esp + 1a6: ff 75 f4 push -0xc(%ebp) + 1a9: e8 55 0a 00 00 call c03 close(p[0]); - 1c5: 83 c4 04 add $0x4,%esp - 1c8: ff 75 f0 pushl -0x10(%ebp) - 1cb: e8 4e 0a 00 00 call c1e + 1ae: 83 c4 04 add $0x4,%esp + 1b1: ff 75 f0 push -0x10(%ebp) + 1b4: e8 fa 09 00 00 call bb3 close(p[1]); - 1d0: 83 c4 04 add $0x4,%esp - 1d3: ff 75 f4 pushl -0xc(%ebp) - 1d6: e8 43 0a 00 00 call c1e + 1b9: 83 c4 04 add $0x4,%esp + 1bc: ff 75 f4 push -0xc(%ebp) + 1bf: e8 ef 09 00 00 call bb3 runcmd(pcmd->left); - 1db: 83 c4 04 add $0x4,%esp - 1de: ff 73 04 pushl 0x4(%ebx) - 1e1: e8 a4 fe ff ff call 8a + 1c4: 83 c4 04 add $0x4,%esp + 1c7: ff 73 04 push 0x4(%ebx) + 1ca: e8 a9 fe ff ff call 78 close(0); - 1e6: 83 ec 0c sub $0xc,%esp - 1e9: 6a 00 push $0x0 - 1eb: e8 2e 0a 00 00 call c1e + 1cf: 83 ec 0c sub $0xc,%esp + 1d2: 6a 00 push $0x0 + 1d4: e8 da 09 00 00 call bb3 dup(p[0]); - 1f0: 83 c4 04 add $0x4,%esp - 1f3: ff 75 f0 pushl -0x10(%ebp) - 1f6: e8 73 0a 00 00 call c6e + 1d9: 83 c4 04 add $0x4,%esp + 1dc: ff 75 f0 push -0x10(%ebp) + 1df: e8 1f 0a 00 00 call c03 close(p[0]); - 1fb: 83 c4 04 add $0x4,%esp - 1fe: ff 75 f0 pushl -0x10(%ebp) - 201: e8 18 0a 00 00 call c1e + 1e4: 83 c4 04 add $0x4,%esp + 1e7: ff 75 f0 push -0x10(%ebp) + 1ea: e8 c4 09 00 00 call bb3 close(p[1]); - 206: 83 c4 04 add $0x4,%esp - 209: ff 75 f4 pushl -0xc(%ebp) - 20c: e8 0d 0a 00 00 call c1e + 1ef: 83 c4 04 add $0x4,%esp + 1f2: ff 75 f4 push -0xc(%ebp) + 1f5: e8 b9 09 00 00 call bb3 runcmd(pcmd->right); - 211: 83 c4 04 add $0x4,%esp - 214: ff 73 08 pushl 0x8(%ebx) - 217: e8 6e fe ff ff call 8a + 1fa: 83 c4 04 add $0x4,%esp + 1fd: ff 73 08 push 0x8(%ebx) + 200: e8 73 fe ff ff call 78 if(fork1() == 0) - 21c: e8 46 fe ff ff call 67 - 221: 85 c0 test %eax,%eax - 223: 0f 85 bd fe ff ff jne e6 + 205: e8 4f fe ff ff call 59 + 20a: 85 c0 test %eax,%eax + 20c: 0f 85 bd fe ff ff jne cf runcmd(bcmd->cmd); - 229: 83 ec 0c sub $0xc,%esp - 22c: ff 73 04 pushl 0x4(%ebx) - 22f: e8 56 fe ff ff call 8a + 212: 83 ec 0c sub $0xc,%esp + 215: ff 73 04 push 0x4(%ebx) + 218: e8 5b fe ff ff call 78 -00000234 : +0000021d : //PAGEBREAK! // Constructors struct cmd* execcmd(void) { - 234: f3 0f 1e fb endbr32 - 238: 55 push %ebp - 239: 89 e5 mov %esp,%ebp - 23b: 53 push %ebx - 23c: 83 ec 10 sub $0x10,%esp + 21d: 55 push %ebp + 21e: 89 e5 mov %esp,%ebp + 220: 53 push %ebx + 221: 83 ec 10 sub $0x10,%esp struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); - 23f: 6a 54 push $0x54 - 241: e8 34 0d 00 00 call f7a - 246: 89 c3 mov %eax,%ebx + 224: 6a 54 push $0x54 + 226: e8 cf 0c 00 00 call efa + 22b: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); - 248: 83 c4 0c add $0xc,%esp - 24b: 6a 54 push $0x54 - 24d: 6a 00 push $0x0 - 24f: 50 push %eax - 250: e8 3a 08 00 00 call a8f + 22d: 83 c4 0c add $0xc,%esp + 230: 6a 54 push $0x54 + 232: 6a 00 push $0x0 + 234: 50 push %eax + 235: e8 fe 07 00 00 call a38 cmd->type = EXEC; - 255: c7 03 01 00 00 00 movl $0x1,(%ebx) + 23a: c7 03 01 00 00 00 movl $0x1,(%ebx) return (struct cmd*)cmd; } - 25b: 89 d8 mov %ebx,%eax - 25d: 8b 5d fc mov -0x4(%ebp),%ebx - 260: c9 leave - 261: c3 ret + 240: 89 d8 mov %ebx,%eax + 242: 8b 5d fc mov -0x4(%ebp),%ebx + 245: c9 leave + 246: c3 ret -00000262 : +00000247 : struct cmd* redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { - 262: f3 0f 1e fb endbr32 - 266: 55 push %ebp - 267: 89 e5 mov %esp,%ebp - 269: 53 push %ebx - 26a: 83 ec 10 sub $0x10,%esp + 247: 55 push %ebp + 248: 89 e5 mov %esp,%ebp + 24a: 53 push %ebx + 24b: 83 ec 10 sub $0x10,%esp struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); - 26d: 6a 18 push $0x18 - 26f: e8 06 0d 00 00 call f7a - 274: 89 c3 mov %eax,%ebx + 24e: 6a 18 push $0x18 + 250: e8 a5 0c 00 00 call efa + 255: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); - 276: 83 c4 0c add $0xc,%esp - 279: 6a 18 push $0x18 - 27b: 6a 00 push $0x0 - 27d: 50 push %eax - 27e: e8 0c 08 00 00 call a8f + 257: 83 c4 0c add $0xc,%esp + 25a: 6a 18 push $0x18 + 25c: 6a 00 push $0x0 + 25e: 50 push %eax + 25f: e8 d4 07 00 00 call a38 cmd->type = REDIR; - 283: c7 03 02 00 00 00 movl $0x2,(%ebx) + 264: c7 03 02 00 00 00 movl $0x2,(%ebx) cmd->cmd = subcmd; - 289: 8b 45 08 mov 0x8(%ebp),%eax - 28c: 89 43 04 mov %eax,0x4(%ebx) + 26a: 8b 45 08 mov 0x8(%ebp),%eax + 26d: 89 43 04 mov %eax,0x4(%ebx) cmd->file = file; - 28f: 8b 45 0c mov 0xc(%ebp),%eax - 292: 89 43 08 mov %eax,0x8(%ebx) + 270: 8b 45 0c mov 0xc(%ebp),%eax + 273: 89 43 08 mov %eax,0x8(%ebx) cmd->efile = efile; - 295: 8b 45 10 mov 0x10(%ebp),%eax - 298: 89 43 0c mov %eax,0xc(%ebx) + 276: 8b 45 10 mov 0x10(%ebp),%eax + 279: 89 43 0c mov %eax,0xc(%ebx) cmd->mode = mode; - 29b: 8b 45 14 mov 0x14(%ebp),%eax - 29e: 89 43 10 mov %eax,0x10(%ebx) + 27c: 8b 45 14 mov 0x14(%ebp),%eax + 27f: 89 43 10 mov %eax,0x10(%ebx) cmd->fd = fd; - 2a1: 8b 45 18 mov 0x18(%ebp),%eax - 2a4: 89 43 14 mov %eax,0x14(%ebx) + 282: 8b 45 18 mov 0x18(%ebp),%eax + 285: 89 43 14 mov %eax,0x14(%ebx) return (struct cmd*)cmd; } - 2a7: 89 d8 mov %ebx,%eax - 2a9: 8b 5d fc mov -0x4(%ebp),%ebx - 2ac: c9 leave - 2ad: c3 ret + 288: 89 d8 mov %ebx,%eax + 28a: 8b 5d fc mov -0x4(%ebp),%ebx + 28d: c9 leave + 28e: c3 ret -000002ae : +0000028f : struct cmd* pipecmd(struct cmd *left, struct cmd *right) { - 2ae: f3 0f 1e fb endbr32 - 2b2: 55 push %ebp - 2b3: 89 e5 mov %esp,%ebp - 2b5: 53 push %ebx - 2b6: 83 ec 10 sub $0x10,%esp + 28f: 55 push %ebp + 290: 89 e5 mov %esp,%ebp + 292: 53 push %ebx + 293: 83 ec 10 sub $0x10,%esp struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); - 2b9: 6a 0c push $0xc - 2bb: e8 ba 0c 00 00 call f7a - 2c0: 89 c3 mov %eax,%ebx + 296: 6a 0c push $0xc + 298: e8 5d 0c 00 00 call efa + 29d: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); - 2c2: 83 c4 0c add $0xc,%esp - 2c5: 6a 0c push $0xc - 2c7: 6a 00 push $0x0 - 2c9: 50 push %eax - 2ca: e8 c0 07 00 00 call a8f + 29f: 83 c4 0c add $0xc,%esp + 2a2: 6a 0c push $0xc + 2a4: 6a 00 push $0x0 + 2a6: 50 push %eax + 2a7: e8 8c 07 00 00 call a38 cmd->type = PIPE; - 2cf: c7 03 03 00 00 00 movl $0x3,(%ebx) + 2ac: c7 03 03 00 00 00 movl $0x3,(%ebx) cmd->left = left; - 2d5: 8b 45 08 mov 0x8(%ebp),%eax - 2d8: 89 43 04 mov %eax,0x4(%ebx) + 2b2: 8b 45 08 mov 0x8(%ebp),%eax + 2b5: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; - 2db: 8b 45 0c mov 0xc(%ebp),%eax - 2de: 89 43 08 mov %eax,0x8(%ebx) + 2b8: 8b 45 0c mov 0xc(%ebp),%eax + 2bb: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd*)cmd; } - 2e1: 89 d8 mov %ebx,%eax - 2e3: 8b 5d fc mov -0x4(%ebp),%ebx - 2e6: c9 leave - 2e7: c3 ret + 2be: 89 d8 mov %ebx,%eax + 2c0: 8b 5d fc mov -0x4(%ebp),%ebx + 2c3: c9 leave + 2c4: c3 ret -000002e8 : +000002c5 : struct cmd* listcmd(struct cmd *left, struct cmd *right) { - 2e8: f3 0f 1e fb endbr32 - 2ec: 55 push %ebp - 2ed: 89 e5 mov %esp,%ebp - 2ef: 53 push %ebx - 2f0: 83 ec 10 sub $0x10,%esp + 2c5: 55 push %ebp + 2c6: 89 e5 mov %esp,%ebp + 2c8: 53 push %ebx + 2c9: 83 ec 10 sub $0x10,%esp struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); - 2f3: 6a 0c push $0xc - 2f5: e8 80 0c 00 00 call f7a - 2fa: 89 c3 mov %eax,%ebx + 2cc: 6a 0c push $0xc + 2ce: e8 27 0c 00 00 call efa + 2d3: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); - 2fc: 83 c4 0c add $0xc,%esp - 2ff: 6a 0c push $0xc - 301: 6a 00 push $0x0 - 303: 50 push %eax - 304: e8 86 07 00 00 call a8f + 2d5: 83 c4 0c add $0xc,%esp + 2d8: 6a 0c push $0xc + 2da: 6a 00 push $0x0 + 2dc: 50 push %eax + 2dd: e8 56 07 00 00 call a38 cmd->type = LIST; - 309: c7 03 04 00 00 00 movl $0x4,(%ebx) + 2e2: c7 03 04 00 00 00 movl $0x4,(%ebx) cmd->left = left; - 30f: 8b 45 08 mov 0x8(%ebp),%eax - 312: 89 43 04 mov %eax,0x4(%ebx) + 2e8: 8b 45 08 mov 0x8(%ebp),%eax + 2eb: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; - 315: 8b 45 0c mov 0xc(%ebp),%eax - 318: 89 43 08 mov %eax,0x8(%ebx) + 2ee: 8b 45 0c mov 0xc(%ebp),%eax + 2f1: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd*)cmd; } - 31b: 89 d8 mov %ebx,%eax - 31d: 8b 5d fc mov -0x4(%ebp),%ebx - 320: c9 leave - 321: c3 ret + 2f4: 89 d8 mov %ebx,%eax + 2f6: 8b 5d fc mov -0x4(%ebp),%ebx + 2f9: c9 leave + 2fa: c3 ret -00000322 : +000002fb : struct cmd* backcmd(struct cmd *subcmd) { - 322: f3 0f 1e fb endbr32 - 326: 55 push %ebp - 327: 89 e5 mov %esp,%ebp - 329: 53 push %ebx - 32a: 83 ec 10 sub $0x10,%esp + 2fb: 55 push %ebp + 2fc: 89 e5 mov %esp,%ebp + 2fe: 53 push %ebx + 2ff: 83 ec 10 sub $0x10,%esp struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); - 32d: 6a 08 push $0x8 - 32f: e8 46 0c 00 00 call f7a - 334: 89 c3 mov %eax,%ebx + 302: 6a 08 push $0x8 + 304: e8 f1 0b 00 00 call efa + 309: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); - 336: 83 c4 0c add $0xc,%esp - 339: 6a 08 push $0x8 - 33b: 6a 00 push $0x0 - 33d: 50 push %eax - 33e: e8 4c 07 00 00 call a8f + 30b: 83 c4 0c add $0xc,%esp + 30e: 6a 08 push $0x8 + 310: 6a 00 push $0x0 + 312: 50 push %eax + 313: e8 20 07 00 00 call a38 cmd->type = BACK; - 343: c7 03 05 00 00 00 movl $0x5,(%ebx) + 318: c7 03 05 00 00 00 movl $0x5,(%ebx) cmd->cmd = subcmd; - 349: 8b 45 08 mov 0x8(%ebp),%eax - 34c: 89 43 04 mov %eax,0x4(%ebx) + 31e: 8b 45 08 mov 0x8(%ebp),%eax + 321: 89 43 04 mov %eax,0x4(%ebx) return (struct cmd*)cmd; } - 34f: 89 d8 mov %ebx,%eax - 351: 8b 5d fc mov -0x4(%ebp),%ebx - 354: c9 leave - 355: c3 ret + 324: 89 d8 mov %ebx,%eax + 326: 8b 5d fc mov -0x4(%ebp),%ebx + 329: c9 leave + 32a: c3 ret -00000356 : +0000032b : char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { - 356: f3 0f 1e fb endbr32 - 35a: 55 push %ebp - 35b: 89 e5 mov %esp,%ebp - 35d: 57 push %edi - 35e: 56 push %esi - 35f: 53 push %ebx - 360: 83 ec 0c sub $0xc,%esp - 363: 8b 75 0c mov 0xc(%ebp),%esi - 366: 8b 7d 10 mov 0x10(%ebp),%edi + 32b: 55 push %ebp + 32c: 89 e5 mov %esp,%ebp + 32e: 57 push %edi + 32f: 56 push %esi + 330: 53 push %ebx + 331: 83 ec 0c sub $0xc,%esp + 334: 8b 75 0c mov 0xc(%ebp),%esi + 337: 8b 7d 10 mov 0x10(%ebp),%edi char *s; int ret; s = *ps; - 369: 8b 45 08 mov 0x8(%ebp),%eax - 36c: 8b 18 mov (%eax),%ebx + 33a: 8b 45 08 mov 0x8(%ebp),%eax + 33d: 8b 18 mov (%eax),%ebx while(s < es && strchr(whitespace, *s)) - 36e: 39 f3 cmp %esi,%ebx - 370: 73 1f jae 391 - 372: 83 ec 08 sub $0x8,%esp - 375: 0f be 03 movsbl (%ebx),%eax - 378: 50 push %eax - 379: 68 8c 16 00 00 push $0x168c - 37e: e8 27 07 00 00 call aaa - 383: 83 c4 10 add $0x10,%esp - 386: 85 c0 test %eax,%eax - 388: 74 07 je 391 + 33f: 39 f3 cmp %esi,%ebx + 341: 73 21 jae 364 + 343: 83 ec 08 sub $0x8,%esp + 346: 0f be 03 movsbl (%ebx),%eax + 349: 50 push %eax + 34a: 68 5c 16 00 00 push $0x165c + 34f: e8 fd 06 00 00 call a51 + 354: 83 c4 10 add $0x10,%esp + 357: 85 c0 test %eax,%eax + 359: 74 09 je 364 s++; - 38a: 83 c3 01 add $0x1,%ebx + 35b: 83 c3 01 add $0x1,%ebx while(s < es && strchr(whitespace, *s)) - 38d: 39 de cmp %ebx,%esi - 38f: 75 e1 jne 372 + 35e: 39 de cmp %ebx,%esi + 360: 75 e1 jne 343 + s++; + 362: 89 f3 mov %esi,%ebx if(q) - 391: 85 ff test %edi,%edi - 393: 74 02 je 397 + 364: 85 ff test %edi,%edi + 366: 74 02 je 36a *q = s; - 395: 89 1f mov %ebx,(%edi) + 368: 89 1f mov %ebx,(%edi) ret = *s; - 397: 0f b6 03 movzbl (%ebx),%eax - 39a: 0f be f8 movsbl %al,%edi + 36a: 0f b6 03 movzbl (%ebx),%eax + 36d: 0f be f8 movsbl %al,%edi switch(*s){ - 39d: 3c 3c cmp $0x3c,%al - 39f: 7f 55 jg 3f6 - 3a1: 3c 3a cmp $0x3a,%al - 3a3: 7f 11 jg 3b6 - 3a5: 84 c0 test %al,%al - 3a7: 74 10 je 3b9 - 3a9: 78 65 js 410 - 3ab: 3c 26 cmp $0x26,%al - 3ad: 74 07 je 3b6 - 3af: 83 e8 28 sub $0x28,%eax - 3b2: 3c 01 cmp $0x1,%al - 3b4: 77 5a ja 410 + 370: 3c 3c cmp $0x3c,%al + 372: 7f 57 jg 3cb + 374: 3c 3a cmp $0x3a,%al + 376: 7f 11 jg 389 + 378: 84 c0 test %al,%al + 37a: 74 10 je 38c + 37c: 78 67 js 3e5 + 37e: 3c 26 cmp $0x26,%al + 380: 74 07 je 389 + 382: 83 e8 28 sub $0x28,%eax + 385: 3c 01 cmp $0x1,%al + 387: 77 5c ja 3e5 case '(': case ')': case ';': case '&': case '<': s++; - 3b6: 83 c3 01 add $0x1,%ebx + 389: 83 c3 01 add $0x1,%ebx ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } if(eq) - 3b9: 83 7d 14 00 cmpl $0x0,0x14(%ebp) - 3bd: 74 05 je 3c4 + 38c: 83 7d 14 00 cmpl $0x0,0x14(%ebp) + 390: 74 05 je 397 *eq = s; - 3bf: 8b 45 14 mov 0x14(%ebp),%eax - 3c2: 89 18 mov %ebx,(%eax) + 392: 8b 45 14 mov 0x14(%ebp),%eax + 395: 89 18 mov %ebx,(%eax) while(s < es && strchr(whitespace, *s)) - 3c4: 39 f3 cmp %esi,%ebx - 3c6: 73 1f jae 3e7 - 3c8: 83 ec 08 sub $0x8,%esp - 3cb: 0f be 03 movsbl (%ebx),%eax - 3ce: 50 push %eax - 3cf: 68 8c 16 00 00 push $0x168c - 3d4: e8 d1 06 00 00 call aaa - 3d9: 83 c4 10 add $0x10,%esp - 3dc: 85 c0 test %eax,%eax - 3de: 74 07 je 3e7 + 397: 39 f3 cmp %esi,%ebx + 399: 73 21 jae 3bc + 39b: 83 ec 08 sub $0x8,%esp + 39e: 0f be 03 movsbl (%ebx),%eax + 3a1: 50 push %eax + 3a2: 68 5c 16 00 00 push $0x165c + 3a7: e8 a5 06 00 00 call a51 + 3ac: 83 c4 10 add $0x10,%esp + 3af: 85 c0 test %eax,%eax + 3b1: 74 09 je 3bc s++; - 3e0: 83 c3 01 add $0x1,%ebx + 3b3: 83 c3 01 add $0x1,%ebx while(s < es && strchr(whitespace, *s)) - 3e3: 39 de cmp %ebx,%esi - 3e5: 75 e1 jne 3c8 + 3b6: 39 de cmp %ebx,%esi + 3b8: 75 e1 jne 39b + s++; + 3ba: 89 f3 mov %esi,%ebx *ps = s; - 3e7: 8b 45 08 mov 0x8(%ebp),%eax - 3ea: 89 18 mov %ebx,(%eax) + 3bc: 8b 45 08 mov 0x8(%ebp),%eax + 3bf: 89 18 mov %ebx,(%eax) return ret; } - 3ec: 89 f8 mov %edi,%eax - 3ee: 8d 65 f4 lea -0xc(%ebp),%esp - 3f1: 5b pop %ebx - 3f2: 5e pop %esi - 3f3: 5f pop %edi - 3f4: 5d pop %ebp - 3f5: c3 ret + 3c1: 89 f8 mov %edi,%eax + 3c3: 8d 65 f4 lea -0xc(%ebp),%esp + 3c6: 5b pop %ebx + 3c7: 5e pop %esi + 3c8: 5f pop %edi + 3c9: 5d pop %ebp + 3ca: c3 ret switch(*s){ - 3f6: 3c 3e cmp $0x3e,%al - 3f8: 75 12 jne 40c + 3cb: 3c 3e cmp $0x3e,%al + 3cd: 75 12 jne 3e1 s++; - 3fa: 8d 43 01 lea 0x1(%ebx),%eax + 3cf: 8d 43 01 lea 0x1(%ebx),%eax if(*s == '>'){ - 3fd: 80 7b 01 3e cmpb $0x3e,0x1(%ebx) - 401: 74 59 je 45c + 3d2: 80 7b 01 3e cmpb $0x3e,0x1(%ebx) + 3d6: 74 5b je 433 s++; - 403: 89 c3 mov %eax,%ebx + 3d8: 89 c3 mov %eax,%ebx ret = *s; - 405: bf 3e 00 00 00 mov $0x3e,%edi - 40a: eb ad jmp 3b9 + 3da: bf 3e 00 00 00 mov $0x3e,%edi + 3df: eb ab jmp 38c switch(*s){ - 40c: 3c 7c cmp $0x7c,%al - 40e: 74 a6 je 3b6 + 3e1: 3c 7c cmp $0x7c,%al + 3e3: 74 a4 je 389 while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) - 410: 39 de cmp %ebx,%esi - 412: 76 37 jbe 44b - 414: 83 ec 08 sub $0x8,%esp - 417: 0f be 03 movsbl (%ebx),%eax - 41a: 50 push %eax - 41b: 68 8c 16 00 00 push $0x168c - 420: e8 85 06 00 00 call aaa - 425: 83 c4 10 add $0x10,%esp - 428: 85 c0 test %eax,%eax - 42a: 75 47 jne 473 - 42c: 83 ec 08 sub $0x8,%esp - 42f: 0f be 03 movsbl (%ebx),%eax - 432: 50 push %eax - 433: 68 84 16 00 00 push $0x1684 - 438: e8 6d 06 00 00 call aaa - 43d: 83 c4 10 add $0x10,%esp - 440: 85 c0 test %eax,%eax - 442: 75 25 jne 469 + 3e5: 39 de cmp %ebx,%esi + 3e7: 76 39 jbe 422 + 3e9: 83 ec 08 sub $0x8,%esp + 3ec: 0f be 03 movsbl (%ebx),%eax + 3ef: 50 push %eax + 3f0: 68 5c 16 00 00 push $0x165c + 3f5: e8 57 06 00 00 call a51 + 3fa: 83 c4 10 add $0x10,%esp + 3fd: 85 c0 test %eax,%eax + 3ff: 75 49 jne 44a + 401: 83 ec 08 sub $0x8,%esp + 404: 0f be 03 movsbl (%ebx),%eax + 407: 50 push %eax + 408: 68 54 16 00 00 push $0x1654 + 40d: e8 3f 06 00 00 call a51 + 412: 83 c4 10 add $0x10,%esp + 415: 85 c0 test %eax,%eax + 417: 75 27 jne 440 s++; - 444: 83 c3 01 add $0x1,%ebx + 419: 83 c3 01 add $0x1,%ebx while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) - 447: 39 de cmp %ebx,%esi - 449: 75 c9 jne 414 + 41c: 39 de cmp %ebx,%esi + 41e: 75 c9 jne 3e9 + s++; + 420: 89 f3 mov %esi,%ebx if(eq) - 44b: bf 61 00 00 00 mov $0x61,%edi - 450: 83 7d 14 00 cmpl $0x0,0x14(%ebp) - 454: 0f 85 65 ff ff ff jne 3bf - 45a: eb 8b jmp 3e7 + 422: bf 61 00 00 00 mov $0x61,%edi + 427: 83 7d 14 00 cmpl $0x0,0x14(%ebp) + 42b: 0f 85 61 ff ff ff jne 392 + 431: eb 89 jmp 3bc s++; - 45c: 83 c3 02 add $0x2,%ebx + 433: 83 c3 02 add $0x2,%ebx ret = '+'; - 45f: bf 2b 00 00 00 mov $0x2b,%edi - 464: e9 50 ff ff ff jmp 3b9 + 436: bf 2b 00 00 00 mov $0x2b,%edi + 43b: e9 4c ff ff ff jmp 38c ret = 'a'; - 469: bf 61 00 00 00 mov $0x61,%edi - 46e: e9 46 ff ff ff jmp 3b9 - 473: bf 61 00 00 00 mov $0x61,%edi - 478: e9 3c ff ff ff jmp 3b9 + 440: bf 61 00 00 00 mov $0x61,%edi + 445: e9 42 ff ff ff jmp 38c + 44a: bf 61 00 00 00 mov $0x61,%edi + 44f: e9 38 ff ff ff jmp 38c -0000047d : +00000454 : int peek(char **ps, char *es, char *toks) { - 47d: f3 0f 1e fb endbr32 - 481: 55 push %ebp - 482: 89 e5 mov %esp,%ebp - 484: 57 push %edi - 485: 56 push %esi - 486: 53 push %ebx - 487: 83 ec 0c sub $0xc,%esp - 48a: 8b 7d 08 mov 0x8(%ebp),%edi - 48d: 8b 75 0c mov 0xc(%ebp),%esi + 454: 55 push %ebp + 455: 89 e5 mov %esp,%ebp + 457: 57 push %edi + 458: 56 push %esi + 459: 53 push %ebx + 45a: 83 ec 0c sub $0xc,%esp + 45d: 8b 7d 08 mov 0x8(%ebp),%edi + 460: 8b 75 0c mov 0xc(%ebp),%esi char *s; s = *ps; - 490: 8b 1f mov (%edi),%ebx + 463: 8b 1f mov (%edi),%ebx while(s < es && strchr(whitespace, *s)) - 492: 39 f3 cmp %esi,%ebx - 494: 73 1f jae 4b5 - 496: 83 ec 08 sub $0x8,%esp - 499: 0f be 03 movsbl (%ebx),%eax - 49c: 50 push %eax - 49d: 68 8c 16 00 00 push $0x168c - 4a2: e8 03 06 00 00 call aaa - 4a7: 83 c4 10 add $0x10,%esp - 4aa: 85 c0 test %eax,%eax - 4ac: 74 07 je 4b5 + 465: 39 f3 cmp %esi,%ebx + 467: 73 21 jae 48a + 469: 83 ec 08 sub $0x8,%esp + 46c: 0f be 03 movsbl (%ebx),%eax + 46f: 50 push %eax + 470: 68 5c 16 00 00 push $0x165c + 475: e8 d7 05 00 00 call a51 + 47a: 83 c4 10 add $0x10,%esp + 47d: 85 c0 test %eax,%eax + 47f: 74 09 je 48a s++; - 4ae: 83 c3 01 add $0x1,%ebx + 481: 83 c3 01 add $0x1,%ebx while(s < es && strchr(whitespace, *s)) - 4b1: 39 de cmp %ebx,%esi - 4b3: 75 e1 jne 496 + 484: 39 de cmp %ebx,%esi + 486: 75 e1 jne 469 + s++; + 488: 89 f3 mov %esi,%ebx *ps = s; - 4b5: 89 1f mov %ebx,(%edi) + 48a: 89 1f mov %ebx,(%edi) return *s && strchr(toks, *s); - 4b7: 0f b6 03 movzbl (%ebx),%eax - 4ba: ba 00 00 00 00 mov $0x0,%edx - 4bf: 84 c0 test %al,%al - 4c1: 75 0a jne 4cd + 48c: 0f b6 03 movzbl (%ebx),%eax + 48f: ba 00 00 00 00 mov $0x0,%edx + 494: 84 c0 test %al,%al + 496: 75 0a jne 4a2 } - 4c3: 89 d0 mov %edx,%eax - 4c5: 8d 65 f4 lea -0xc(%ebp),%esp - 4c8: 5b pop %ebx - 4c9: 5e pop %esi - 4ca: 5f pop %edi - 4cb: 5d pop %ebp - 4cc: c3 ret + 498: 89 d0 mov %edx,%eax + 49a: 8d 65 f4 lea -0xc(%ebp),%esp + 49d: 5b pop %ebx + 49e: 5e pop %esi + 49f: 5f pop %edi + 4a0: 5d pop %ebp + 4a1: c3 ret return *s && strchr(toks, *s); - 4cd: 83 ec 08 sub $0x8,%esp - 4d0: 0f be c0 movsbl %al,%eax - 4d3: 50 push %eax - 4d4: ff 75 10 pushl 0x10(%ebp) - 4d7: e8 ce 05 00 00 call aaa - 4dc: 83 c4 10 add $0x10,%esp - 4df: 85 c0 test %eax,%eax - 4e1: 0f 95 c2 setne %dl - 4e4: 0f b6 d2 movzbl %dl,%edx - 4e7: eb da jmp 4c3 - -000004e9 : + 4a2: 83 ec 08 sub $0x8,%esp + 4a5: 0f be c0 movsbl %al,%eax + 4a8: 50 push %eax + 4a9: ff 75 10 push 0x10(%ebp) + 4ac: e8 a0 05 00 00 call a51 + 4b1: 83 c4 10 add $0x10,%esp + 4b4: 85 c0 test %eax,%eax + 4b6: 0f 95 c2 setne %dl + 4b9: 0f b6 d2 movzbl %dl,%edx + 4bc: eb da jmp 498 + +000004be : return cmd; } struct cmd* parseredirs(struct cmd *cmd, char **ps, char *es) { - 4e9: f3 0f 1e fb endbr32 - 4ed: 55 push %ebp - 4ee: 89 e5 mov %esp,%ebp - 4f0: 57 push %edi - 4f1: 56 push %esi - 4f2: 53 push %ebx - 4f3: 83 ec 1c sub $0x1c,%esp - 4f6: 8b 75 0c mov 0xc(%ebp),%esi - 4f9: 8b 7d 10 mov 0x10(%ebp),%edi + 4be: 55 push %ebp + 4bf: 89 e5 mov %esp,%ebp + 4c1: 57 push %edi + 4c2: 56 push %esi + 4c3: 53 push %ebx + 4c4: 83 ec 1c sub $0x1c,%esp + 4c7: 8b 75 0c mov 0xc(%ebp),%esi + 4ca: 8b 7d 10 mov 0x10(%ebp),%edi int tok; char *q, *eq; while(peek(ps, es, "<>")){ - 4fc: eb 28 jmp 526 + 4cd: eb 28 jmp 4f7 tok = gettoken(ps, es, 0, 0); if(gettoken(ps, es, &q, &eq) != 'a') panic("missing file for redirection"); - 4fe: 83 ec 0c sub $0xc,%esp - 501: 68 88 10 00 00 push $0x1088 - 506: e8 3e fb ff ff call 49 + 4cf: 83 ec 0c sub $0xc,%esp + 4d2: 68 00 10 00 00 push $0x1000 + 4d7: e8 63 fb ff ff call 3f switch(tok){ case '<': cmd = redircmd(cmd, q, eq, O_RDONLY, 0); - 50b: 83 ec 0c sub $0xc,%esp - 50e: 6a 00 push $0x0 - 510: 6a 00 push $0x0 - 512: ff 75 e0 pushl -0x20(%ebp) - 515: ff 75 e4 pushl -0x1c(%ebp) - 518: ff 75 08 pushl 0x8(%ebp) - 51b: e8 42 fd ff ff call 262 - 520: 89 45 08 mov %eax,0x8(%ebp) + 4dc: 83 ec 0c sub $0xc,%esp + 4df: 6a 00 push $0x0 + 4e1: 6a 00 push $0x0 + 4e3: ff 75 e0 push -0x20(%ebp) + 4e6: ff 75 e4 push -0x1c(%ebp) + 4e9: ff 75 08 push 0x8(%ebp) + 4ec: e8 56 fd ff ff call 247 + 4f1: 89 45 08 mov %eax,0x8(%ebp) break; - 523: 83 c4 20 add $0x20,%esp + 4f4: 83 c4 20 add $0x20,%esp while(peek(ps, es, "<>")){ - 526: 83 ec 04 sub $0x4,%esp - 529: 68 a5 10 00 00 push $0x10a5 - 52e: 57 push %edi - 52f: 56 push %esi - 530: e8 48 ff ff ff call 47d - 535: 83 c4 10 add $0x10,%esp - 538: 85 c0 test %eax,%eax - 53a: 74 76 je 5b2 + 4f7: 83 ec 04 sub $0x4,%esp + 4fa: 68 1d 10 00 00 push $0x101d + 4ff: 57 push %edi + 500: 56 push %esi + 501: e8 4e ff ff ff call 454 + 506: 83 c4 10 add $0x10,%esp + 509: 85 c0 test %eax,%eax + 50b: 74 76 je 583 tok = gettoken(ps, es, 0, 0); - 53c: 6a 00 push $0x0 - 53e: 6a 00 push $0x0 - 540: 57 push %edi - 541: 56 push %esi - 542: e8 0f fe ff ff call 356 - 547: 89 c3 mov %eax,%ebx + 50d: 6a 00 push $0x0 + 50f: 6a 00 push $0x0 + 511: 57 push %edi + 512: 56 push %esi + 513: e8 13 fe ff ff call 32b + 518: 89 c3 mov %eax,%ebx if(gettoken(ps, es, &q, &eq) != 'a') - 549: 8d 45 e0 lea -0x20(%ebp),%eax - 54c: 50 push %eax - 54d: 8d 45 e4 lea -0x1c(%ebp),%eax - 550: 50 push %eax - 551: 57 push %edi - 552: 56 push %esi - 553: e8 fe fd ff ff call 356 - 558: 83 c4 20 add $0x20,%esp - 55b: 83 f8 61 cmp $0x61,%eax - 55e: 75 9e jne 4fe + 51a: 8d 45 e0 lea -0x20(%ebp),%eax + 51d: 50 push %eax + 51e: 8d 45 e4 lea -0x1c(%ebp),%eax + 521: 50 push %eax + 522: 57 push %edi + 523: 56 push %esi + 524: e8 02 fe ff ff call 32b + 529: 83 c4 20 add $0x20,%esp + 52c: 83 f8 61 cmp $0x61,%eax + 52f: 75 9e jne 4cf switch(tok){ - 560: 83 fb 3c cmp $0x3c,%ebx - 563: 74 a6 je 50b - 565: 83 fb 3e cmp $0x3e,%ebx - 568: 74 25 je 58f - 56a: 83 fb 2b cmp $0x2b,%ebx - 56d: 75 b7 jne 526 + 531: 83 fb 3c cmp $0x3c,%ebx + 534: 74 a6 je 4dc + 536: 83 fb 3e cmp $0x3e,%ebx + 539: 74 25 je 560 + 53b: 83 fb 2b cmp $0x2b,%ebx + 53e: 75 b7 jne 4f7 case '>': cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); break; case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); - 56f: 83 ec 0c sub $0xc,%esp - 572: 6a 01 push $0x1 - 574: 68 01 02 00 00 push $0x201 - 579: ff 75 e0 pushl -0x20(%ebp) - 57c: ff 75 e4 pushl -0x1c(%ebp) - 57f: ff 75 08 pushl 0x8(%ebp) - 582: e8 db fc ff ff call 262 - 587: 89 45 08 mov %eax,0x8(%ebp) + 540: 83 ec 0c sub $0xc,%esp + 543: 6a 01 push $0x1 + 545: 68 01 02 00 00 push $0x201 + 54a: ff 75 e0 push -0x20(%ebp) + 54d: ff 75 e4 push -0x1c(%ebp) + 550: ff 75 08 push 0x8(%ebp) + 553: e8 ef fc ff ff call 247 + 558: 89 45 08 mov %eax,0x8(%ebp) break; - 58a: 83 c4 20 add $0x20,%esp - 58d: eb 97 jmp 526 + 55b: 83 c4 20 add $0x20,%esp + 55e: eb 97 jmp 4f7 cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); - 58f: 83 ec 0c sub $0xc,%esp - 592: 6a 01 push $0x1 - 594: 68 01 02 00 00 push $0x201 - 599: ff 75 e0 pushl -0x20(%ebp) - 59c: ff 75 e4 pushl -0x1c(%ebp) - 59f: ff 75 08 pushl 0x8(%ebp) - 5a2: e8 bb fc ff ff call 262 - 5a7: 89 45 08 mov %eax,0x8(%ebp) + 560: 83 ec 0c sub $0xc,%esp + 563: 6a 01 push $0x1 + 565: 68 01 02 00 00 push $0x201 + 56a: ff 75 e0 push -0x20(%ebp) + 56d: ff 75 e4 push -0x1c(%ebp) + 570: ff 75 08 push 0x8(%ebp) + 573: e8 cf fc ff ff call 247 + 578: 89 45 08 mov %eax,0x8(%ebp) break; - 5aa: 83 c4 20 add $0x20,%esp - 5ad: e9 74 ff ff ff jmp 526 + 57b: 83 c4 20 add $0x20,%esp + 57e: e9 74 ff ff ff jmp 4f7 } } return cmd; } - 5b2: 8b 45 08 mov 0x8(%ebp),%eax - 5b5: 8d 65 f4 lea -0xc(%ebp),%esp - 5b8: 5b pop %ebx - 5b9: 5e pop %esi - 5ba: 5f pop %edi - 5bb: 5d pop %ebp - 5bc: c3 ret - -000005bd : + 583: 8b 45 08 mov 0x8(%ebp),%eax + 586: 8d 65 f4 lea -0xc(%ebp),%esp + 589: 5b pop %ebx + 58a: 5e pop %esi + 58b: 5f pop %edi + 58c: 5d pop %ebp + 58d: c3 ret + +0000058e : return cmd; } struct cmd* parseexec(char **ps, char *es) { - 5bd: f3 0f 1e fb endbr32 - 5c1: 55 push %ebp - 5c2: 89 e5 mov %esp,%ebp - 5c4: 57 push %edi - 5c5: 56 push %esi - 5c6: 53 push %ebx - 5c7: 83 ec 30 sub $0x30,%esp - 5ca: 8b 75 08 mov 0x8(%ebp),%esi - 5cd: 8b 7d 0c mov 0xc(%ebp),%edi + 58e: 55 push %ebp + 58f: 89 e5 mov %esp,%ebp + 591: 57 push %edi + 592: 56 push %esi + 593: 53 push %ebx + 594: 83 ec 30 sub $0x30,%esp + 597: 8b 75 08 mov 0x8(%ebp),%esi + 59a: 8b 7d 0c mov 0xc(%ebp),%edi char *q, *eq; int tok, argc; struct execcmd *cmd; struct cmd *ret; if(peek(ps, es, "(")) - 5d0: 68 a8 10 00 00 push $0x10a8 - 5d5: 57 push %edi - 5d6: 56 push %esi - 5d7: e8 a1 fe ff ff call 47d - 5dc: 83 c4 10 add $0x10,%esp - 5df: 85 c0 test %eax,%eax - 5e1: 75 1d jne 600 - 5e3: 89 c3 mov %eax,%ebx + 59d: 68 20 10 00 00 push $0x1020 + 5a2: 57 push %edi + 5a3: 56 push %esi + 5a4: e8 ab fe ff ff call 454 + 5a9: 83 c4 10 add $0x10,%esp + 5ac: 85 c0 test %eax,%eax + 5ae: 75 1d jne 5cd + 5b0: 89 c3 mov %eax,%ebx return parseblock(ps, es); ret = execcmd(); - 5e5: e8 4a fc ff ff call 234 - 5ea: 89 45 d0 mov %eax,-0x30(%ebp) + 5b2: e8 66 fc ff ff call 21d + 5b7: 89 45 d0 mov %eax,-0x30(%ebp) cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); - 5ed: 83 ec 04 sub $0x4,%esp - 5f0: 57 push %edi - 5f1: 56 push %esi - 5f2: 50 push %eax - 5f3: e8 f1 fe ff ff call 4e9 - 5f8: 89 45 d4 mov %eax,-0x2c(%ebp) + 5ba: 83 ec 04 sub $0x4,%esp + 5bd: 57 push %edi + 5be: 56 push %esi + 5bf: 50 push %eax + 5c0: e8 f9 fe ff ff call 4be + 5c5: 89 45 d4 mov %eax,-0x2c(%ebp) while(!peek(ps, es, "|)&;")){ - 5fb: 83 c4 10 add $0x10,%esp - 5fe: eb 3b jmp 63b + 5c8: 83 c4 10 add $0x10,%esp + 5cb: eb 3b jmp 608 return parseblock(ps, es); - 600: 83 ec 08 sub $0x8,%esp - 603: 57 push %edi - 604: 56 push %esi - 605: e8 98 01 00 00 call 7a2 - 60a: 89 45 d4 mov %eax,-0x2c(%ebp) - 60d: 83 c4 10 add $0x10,%esp + 5cd: 83 ec 08 sub $0x8,%esp + 5d0: 57 push %edi + 5d1: 56 push %esi + 5d2: e8 8f 01 00 00 call 766 + 5d7: 89 45 d4 mov %eax,-0x2c(%ebp) + 5da: 83 c4 10 add $0x10,%esp ret = parseredirs(ret, ps, es); } cmd->argv[argc] = 0; cmd->eargv[argc] = 0; return ret; } - 610: 8b 45 d4 mov -0x2c(%ebp),%eax - 613: 8d 65 f4 lea -0xc(%ebp),%esp - 616: 5b pop %ebx - 617: 5e pop %esi - 618: 5f pop %edi - 619: 5d pop %ebp - 61a: c3 ret + 5dd: 8b 45 d4 mov -0x2c(%ebp),%eax + 5e0: 8d 65 f4 lea -0xc(%ebp),%esp + 5e3: 5b pop %ebx + 5e4: 5e pop %esi + 5e5: 5f pop %edi + 5e6: 5d pop %ebp + 5e7: c3 ret panic("syntax"); - 61b: 83 ec 0c sub $0xc,%esp - 61e: 68 aa 10 00 00 push $0x10aa - 623: e8 21 fa ff ff call 49 + 5e8: 83 ec 0c sub $0xc,%esp + 5eb: 68 22 10 00 00 push $0x1022 + 5f0: e8 4a fa ff ff call 3f ret = parseredirs(ret, ps, es); - 628: 83 ec 04 sub $0x4,%esp - 62b: 57 push %edi - 62c: 56 push %esi - 62d: ff 75 d4 pushl -0x2c(%ebp) - 630: e8 b4 fe ff ff call 4e9 - 635: 89 45 d4 mov %eax,-0x2c(%ebp) - 638: 83 c4 10 add $0x10,%esp + 5f5: 83 ec 04 sub $0x4,%esp + 5f8: 57 push %edi + 5f9: 56 push %esi + 5fa: ff 75 d4 push -0x2c(%ebp) + 5fd: e8 bc fe ff ff call 4be + 602: 89 45 d4 mov %eax,-0x2c(%ebp) + 605: 83 c4 10 add $0x10,%esp while(!peek(ps, es, "|)&;")){ - 63b: 83 ec 04 sub $0x4,%esp - 63e: 68 bf 10 00 00 push $0x10bf - 643: 57 push %edi - 644: 56 push %esi - 645: e8 33 fe ff ff call 47d - 64a: 83 c4 10 add $0x10,%esp - 64d: 85 c0 test %eax,%eax - 64f: 75 41 jne 692 + 608: 83 ec 04 sub $0x4,%esp + 60b: 68 37 10 00 00 push $0x1037 + 610: 57 push %edi + 611: 56 push %esi + 612: e8 3d fe ff ff call 454 + 617: 83 c4 10 add $0x10,%esp + 61a: 85 c0 test %eax,%eax + 61c: 75 41 jne 65f if((tok=gettoken(ps, es, &q, &eq)) == 0) - 651: 8d 45 e0 lea -0x20(%ebp),%eax - 654: 50 push %eax - 655: 8d 45 e4 lea -0x1c(%ebp),%eax - 658: 50 push %eax - 659: 57 push %edi - 65a: 56 push %esi - 65b: e8 f6 fc ff ff call 356 - 660: 83 c4 10 add $0x10,%esp - 663: 85 c0 test %eax,%eax - 665: 74 2b je 692 + 61e: 8d 45 e0 lea -0x20(%ebp),%eax + 621: 50 push %eax + 622: 8d 45 e4 lea -0x1c(%ebp),%eax + 625: 50 push %eax + 626: 57 push %edi + 627: 56 push %esi + 628: e8 fe fc ff ff call 32b + 62d: 83 c4 10 add $0x10,%esp + 630: 85 c0 test %eax,%eax + 632: 74 2b je 65f if(tok != 'a') - 667: 83 f8 61 cmp $0x61,%eax - 66a: 75 af jne 61b + 634: 83 f8 61 cmp $0x61,%eax + 637: 75 af jne 5e8 cmd->argv[argc] = q; - 66c: 8b 45 e4 mov -0x1c(%ebp),%eax - 66f: 8b 55 d0 mov -0x30(%ebp),%edx - 672: 89 44 9a 04 mov %eax,0x4(%edx,%ebx,4) + 639: 8b 45 e4 mov -0x1c(%ebp),%eax + 63c: 8b 55 d0 mov -0x30(%ebp),%edx + 63f: 89 44 9a 04 mov %eax,0x4(%edx,%ebx,4) cmd->eargv[argc] = eq; - 676: 8b 45 e0 mov -0x20(%ebp),%eax - 679: 89 44 9a 2c mov %eax,0x2c(%edx,%ebx,4) + 643: 8b 45 e0 mov -0x20(%ebp),%eax + 646: 89 44 9a 2c mov %eax,0x2c(%edx,%ebx,4) argc++; - 67d: 83 c3 01 add $0x1,%ebx + 64a: 83 c3 01 add $0x1,%ebx if(argc >= MAXARGS) - 680: 83 fb 0a cmp $0xa,%ebx - 683: 75 a3 jne 628 + 64d: 83 fb 0a cmp $0xa,%ebx + 650: 75 a3 jne 5f5 panic("too many args"); - 685: 83 ec 0c sub $0xc,%esp - 688: 68 b1 10 00 00 push $0x10b1 - 68d: e8 b7 f9 ff ff call 49 + 652: 83 ec 0c sub $0xc,%esp + 655: 68 29 10 00 00 push $0x1029 + 65a: e8 e0 f9 ff ff call 3f cmd->argv[argc] = 0; - 692: 8b 45 d0 mov -0x30(%ebp),%eax - 695: 8d 04 98 lea (%eax,%ebx,4),%eax - 698: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) + 65f: 8b 45 d0 mov -0x30(%ebp),%eax + 662: c7 44 98 04 00 00 00 movl $0x0,0x4(%eax,%ebx,4) + 669: 00 cmd->eargv[argc] = 0; - 69f: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax) + 66a: c7 44 98 2c 00 00 00 movl $0x0,0x2c(%eax,%ebx,4) + 671: 00 return ret; - 6a6: e9 65 ff ff ff jmp 610 + 672: e9 66 ff ff ff jmp 5dd -000006ab : +00000677 : { - 6ab: f3 0f 1e fb endbr32 - 6af: 55 push %ebp - 6b0: 89 e5 mov %esp,%ebp - 6b2: 57 push %edi - 6b3: 56 push %esi - 6b4: 53 push %ebx - 6b5: 83 ec 14 sub $0x14,%esp - 6b8: 8b 75 08 mov 0x8(%ebp),%esi - 6bb: 8b 7d 0c mov 0xc(%ebp),%edi + 677: 55 push %ebp + 678: 89 e5 mov %esp,%ebp + 67a: 57 push %edi + 67b: 56 push %esi + 67c: 53 push %ebx + 67d: 83 ec 14 sub $0x14,%esp + 680: 8b 75 08 mov 0x8(%ebp),%esi + 683: 8b 7d 0c mov 0xc(%ebp),%edi cmd = parseexec(ps, es); - 6be: 57 push %edi - 6bf: 56 push %esi - 6c0: e8 f8 fe ff ff call 5bd - 6c5: 89 c3 mov %eax,%ebx + 686: 57 push %edi + 687: 56 push %esi + 688: e8 01 ff ff ff call 58e + 68d: 89 c3 mov %eax,%ebx if(peek(ps, es, "|")){ - 6c7: 83 c4 0c add $0xc,%esp - 6ca: 68 c4 10 00 00 push $0x10c4 - 6cf: 57 push %edi - 6d0: 56 push %esi - 6d1: e8 a7 fd ff ff call 47d - 6d6: 83 c4 10 add $0x10,%esp - 6d9: 85 c0 test %eax,%eax - 6db: 75 0a jne 6e7 + 68f: 83 c4 0c add $0xc,%esp + 692: 68 3c 10 00 00 push $0x103c + 697: 57 push %edi + 698: 56 push %esi + 699: e8 b6 fd ff ff call 454 + 69e: 83 c4 10 add $0x10,%esp + 6a1: 85 c0 test %eax,%eax + 6a3: 75 0a jne 6af } - 6dd: 89 d8 mov %ebx,%eax - 6df: 8d 65 f4 lea -0xc(%ebp),%esp - 6e2: 5b pop %ebx - 6e3: 5e pop %esi - 6e4: 5f pop %edi - 6e5: 5d pop %ebp - 6e6: c3 ret + 6a5: 89 d8 mov %ebx,%eax + 6a7: 8d 65 f4 lea -0xc(%ebp),%esp + 6aa: 5b pop %ebx + 6ab: 5e pop %esi + 6ac: 5f pop %edi + 6ad: 5d pop %ebp + 6ae: c3 ret gettoken(ps, es, 0, 0); - 6e7: 6a 00 push $0x0 - 6e9: 6a 00 push $0x0 - 6eb: 57 push %edi - 6ec: 56 push %esi - 6ed: e8 64 fc ff ff call 356 + 6af: 6a 00 push $0x0 + 6b1: 6a 00 push $0x0 + 6b3: 57 push %edi + 6b4: 56 push %esi + 6b5: e8 71 fc ff ff call 32b cmd = pipecmd(cmd, parsepipe(ps, es)); - 6f2: 83 c4 08 add $0x8,%esp - 6f5: 57 push %edi - 6f6: 56 push %esi - 6f7: e8 af ff ff ff call 6ab - 6fc: 83 c4 08 add $0x8,%esp - 6ff: 50 push %eax - 700: 53 push %ebx - 701: e8 a8 fb ff ff call 2ae - 706: 89 c3 mov %eax,%ebx - 708: 83 c4 10 add $0x10,%esp + 6ba: 83 c4 08 add $0x8,%esp + 6bd: 57 push %edi + 6be: 56 push %esi + 6bf: e8 b3 ff ff ff call 677 + 6c4: 83 c4 08 add $0x8,%esp + 6c7: 50 push %eax + 6c8: 53 push %ebx + 6c9: e8 c1 fb ff ff call 28f + 6ce: 89 c3 mov %eax,%ebx + 6d0: 83 c4 10 add $0x10,%esp return cmd; - 70b: eb d0 jmp 6dd + 6d3: eb d0 jmp 6a5 -0000070d : +000006d5 : { - 70d: f3 0f 1e fb endbr32 - 711: 55 push %ebp - 712: 89 e5 mov %esp,%ebp - 714: 57 push %edi - 715: 56 push %esi - 716: 53 push %ebx - 717: 83 ec 14 sub $0x14,%esp - 71a: 8b 75 08 mov 0x8(%ebp),%esi - 71d: 8b 7d 0c mov 0xc(%ebp),%edi + 6d5: 55 push %ebp + 6d6: 89 e5 mov %esp,%ebp + 6d8: 57 push %edi + 6d9: 56 push %esi + 6da: 53 push %ebx + 6db: 83 ec 14 sub $0x14,%esp + 6de: 8b 75 08 mov 0x8(%ebp),%esi + 6e1: 8b 7d 0c mov 0xc(%ebp),%edi cmd = parsepipe(ps, es); - 720: 57 push %edi - 721: 56 push %esi - 722: e8 84 ff ff ff call 6ab - 727: 89 c3 mov %eax,%ebx + 6e4: 57 push %edi + 6e5: 56 push %esi + 6e6: e8 8c ff ff ff call 677 + 6eb: 89 c3 mov %eax,%ebx while(peek(ps, es, "&")){ - 729: 83 c4 10 add $0x10,%esp - 72c: 83 ec 04 sub $0x4,%esp - 72f: 68 c6 10 00 00 push $0x10c6 - 734: 57 push %edi - 735: 56 push %esi - 736: e8 42 fd ff ff call 47d - 73b: 83 c4 10 add $0x10,%esp - 73e: 85 c0 test %eax,%eax - 740: 74 1a je 75c + 6ed: 83 c4 10 add $0x10,%esp + 6f0: eb 18 jmp 70a gettoken(ps, es, 0, 0); - 742: 6a 00 push $0x0 - 744: 6a 00 push $0x0 - 746: 57 push %edi - 747: 56 push %esi - 748: e8 09 fc ff ff call 356 + 6f2: 6a 00 push $0x0 + 6f4: 6a 00 push $0x0 + 6f6: 57 push %edi + 6f7: 56 push %esi + 6f8: e8 2e fc ff ff call 32b cmd = backcmd(cmd); - 74d: 89 1c 24 mov %ebx,(%esp) - 750: e8 cd fb ff ff call 322 - 755: 89 c3 mov %eax,%ebx - 757: 83 c4 10 add $0x10,%esp - 75a: eb d0 jmp 72c + 6fd: 89 1c 24 mov %ebx,(%esp) + 700: e8 f6 fb ff ff call 2fb + 705: 89 c3 mov %eax,%ebx + 707: 83 c4 10 add $0x10,%esp + while(peek(ps, es, "&")){ + 70a: 83 ec 04 sub $0x4,%esp + 70d: 68 3e 10 00 00 push $0x103e + 712: 57 push %edi + 713: 56 push %esi + 714: e8 3b fd ff ff call 454 + 719: 83 c4 10 add $0x10,%esp + 71c: 85 c0 test %eax,%eax + 71e: 75 d2 jne 6f2 if(peek(ps, es, ";")){ - 75c: 83 ec 04 sub $0x4,%esp - 75f: 68 c2 10 00 00 push $0x10c2 - 764: 57 push %edi - 765: 56 push %esi - 766: e8 12 fd ff ff call 47d - 76b: 83 c4 10 add $0x10,%esp - 76e: 85 c0 test %eax,%eax - 770: 75 0a jne 77c + 720: 83 ec 04 sub $0x4,%esp + 723: 68 3a 10 00 00 push $0x103a + 728: 57 push %edi + 729: 56 push %esi + 72a: e8 25 fd ff ff call 454 + 72f: 83 c4 10 add $0x10,%esp + 732: 85 c0 test %eax,%eax + 734: 75 0a jne 740 } - 772: 89 d8 mov %ebx,%eax - 774: 8d 65 f4 lea -0xc(%ebp),%esp - 777: 5b pop %ebx - 778: 5e pop %esi - 779: 5f pop %edi - 77a: 5d pop %ebp - 77b: c3 ret + 736: 89 d8 mov %ebx,%eax + 738: 8d 65 f4 lea -0xc(%ebp),%esp + 73b: 5b pop %ebx + 73c: 5e pop %esi + 73d: 5f pop %edi + 73e: 5d pop %ebp + 73f: c3 ret gettoken(ps, es, 0, 0); - 77c: 6a 00 push $0x0 - 77e: 6a 00 push $0x0 - 780: 57 push %edi - 781: 56 push %esi - 782: e8 cf fb ff ff call 356 + 740: 6a 00 push $0x0 + 742: 6a 00 push $0x0 + 744: 57 push %edi + 745: 56 push %esi + 746: e8 e0 fb ff ff call 32b cmd = listcmd(cmd, parseline(ps, es)); - 787: 83 c4 08 add $0x8,%esp - 78a: 57 push %edi - 78b: 56 push %esi - 78c: e8 7c ff ff ff call 70d - 791: 83 c4 08 add $0x8,%esp - 794: 50 push %eax - 795: 53 push %ebx - 796: e8 4d fb ff ff call 2e8 - 79b: 89 c3 mov %eax,%ebx - 79d: 83 c4 10 add $0x10,%esp + 74b: 83 c4 08 add $0x8,%esp + 74e: 57 push %edi + 74f: 56 push %esi + 750: e8 80 ff ff ff call 6d5 + 755: 83 c4 08 add $0x8,%esp + 758: 50 push %eax + 759: 53 push %ebx + 75a: e8 66 fb ff ff call 2c5 + 75f: 89 c3 mov %eax,%ebx + 761: 83 c4 10 add $0x10,%esp return cmd; - 7a0: eb d0 jmp 772 + 764: eb d0 jmp 736 -000007a2 : +00000766 : { - 7a2: f3 0f 1e fb endbr32 - 7a6: 55 push %ebp - 7a7: 89 e5 mov %esp,%ebp - 7a9: 57 push %edi - 7aa: 56 push %esi - 7ab: 53 push %ebx - 7ac: 83 ec 10 sub $0x10,%esp - 7af: 8b 5d 08 mov 0x8(%ebp),%ebx - 7b2: 8b 75 0c mov 0xc(%ebp),%esi + 766: 55 push %ebp + 767: 89 e5 mov %esp,%ebp + 769: 57 push %edi + 76a: 56 push %esi + 76b: 53 push %ebx + 76c: 83 ec 10 sub $0x10,%esp + 76f: 8b 5d 08 mov 0x8(%ebp),%ebx + 772: 8b 75 0c mov 0xc(%ebp),%esi if(!peek(ps, es, "(")) - 7b5: 68 a8 10 00 00 push $0x10a8 - 7ba: 56 push %esi - 7bb: 53 push %ebx - 7bc: e8 bc fc ff ff call 47d - 7c1: 83 c4 10 add $0x10,%esp - 7c4: 85 c0 test %eax,%eax - 7c6: 74 4b je 813 + 775: 68 20 10 00 00 push $0x1020 + 77a: 56 push %esi + 77b: 53 push %ebx + 77c: e8 d3 fc ff ff call 454 + 781: 83 c4 10 add $0x10,%esp + 784: 85 c0 test %eax,%eax + 786: 74 4b je 7d3 gettoken(ps, es, 0, 0); - 7c8: 6a 00 push $0x0 - 7ca: 6a 00 push $0x0 - 7cc: 56 push %esi - 7cd: 53 push %ebx - 7ce: e8 83 fb ff ff call 356 + 788: 6a 00 push $0x0 + 78a: 6a 00 push $0x0 + 78c: 56 push %esi + 78d: 53 push %ebx + 78e: e8 98 fb ff ff call 32b cmd = parseline(ps, es); - 7d3: 83 c4 08 add $0x8,%esp - 7d6: 56 push %esi - 7d7: 53 push %ebx - 7d8: e8 30 ff ff ff call 70d - 7dd: 89 c7 mov %eax,%edi + 793: 83 c4 08 add $0x8,%esp + 796: 56 push %esi + 797: 53 push %ebx + 798: e8 38 ff ff ff call 6d5 + 79d: 89 c7 mov %eax,%edi if(!peek(ps, es, ")")) - 7df: 83 c4 0c add $0xc,%esp - 7e2: 68 e4 10 00 00 push $0x10e4 - 7e7: 56 push %esi - 7e8: 53 push %ebx - 7e9: e8 8f fc ff ff call 47d - 7ee: 83 c4 10 add $0x10,%esp - 7f1: 85 c0 test %eax,%eax - 7f3: 74 2b je 820 + 79f: 83 c4 0c add $0xc,%esp + 7a2: 68 5c 10 00 00 push $0x105c + 7a7: 56 push %esi + 7a8: 53 push %ebx + 7a9: e8 a6 fc ff ff call 454 + 7ae: 83 c4 10 add $0x10,%esp + 7b1: 85 c0 test %eax,%eax + 7b3: 74 2b je 7e0 gettoken(ps, es, 0, 0); - 7f5: 6a 00 push $0x0 - 7f7: 6a 00 push $0x0 - 7f9: 56 push %esi - 7fa: 53 push %ebx - 7fb: e8 56 fb ff ff call 356 + 7b5: 6a 00 push $0x0 + 7b7: 6a 00 push $0x0 + 7b9: 56 push %esi + 7ba: 53 push %ebx + 7bb: e8 6b fb ff ff call 32b cmd = parseredirs(cmd, ps, es); - 800: 83 c4 0c add $0xc,%esp - 803: 56 push %esi - 804: 53 push %ebx - 805: 57 push %edi - 806: e8 de fc ff ff call 4e9 + 7c0: 83 c4 0c add $0xc,%esp + 7c3: 56 push %esi + 7c4: 53 push %ebx + 7c5: 57 push %edi + 7c6: e8 f3 fc ff ff call 4be } - 80b: 8d 65 f4 lea -0xc(%ebp),%esp - 80e: 5b pop %ebx - 80f: 5e pop %esi - 810: 5f pop %edi - 811: 5d pop %ebp - 812: c3 ret + 7cb: 8d 65 f4 lea -0xc(%ebp),%esp + 7ce: 5b pop %ebx + 7cf: 5e pop %esi + 7d0: 5f pop %edi + 7d1: 5d pop %ebp + 7d2: c3 ret panic("parseblock"); - 813: 83 ec 0c sub $0xc,%esp - 816: 68 c8 10 00 00 push $0x10c8 - 81b: e8 29 f8 ff ff call 49 + 7d3: 83 ec 0c sub $0xc,%esp + 7d6: 68 40 10 00 00 push $0x1040 + 7db: e8 5f f8 ff ff call 3f panic("syntax - missing )"); - 820: 83 ec 0c sub $0xc,%esp - 823: 68 d3 10 00 00 push $0x10d3 - 828: e8 1c f8 ff ff call 49 + 7e0: 83 ec 0c sub $0xc,%esp + 7e3: 68 4b 10 00 00 push $0x104b + 7e8: e8 52 f8 ff ff call 3f -0000082d : +000007ed : // NUL-terminate all the counted strings. struct cmd* nulterminate(struct cmd *cmd) { - 82d: f3 0f 1e fb endbr32 - 831: 55 push %ebp - 832: 89 e5 mov %esp,%ebp - 834: 53 push %ebx - 835: 83 ec 04 sub $0x4,%esp - 838: 8b 5d 08 mov 0x8(%ebp),%ebx + 7ed: 55 push %ebp + 7ee: 89 e5 mov %esp,%ebp + 7f0: 53 push %ebx + 7f1: 83 ec 04 sub $0x4,%esp + 7f4: 8b 5d 08 mov 0x8(%ebp),%ebx struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) - 83b: 85 db test %ebx,%ebx - 83d: 74 3d je 87c + 7f7: 85 db test %ebx,%ebx + 7f9: 74 3c je 837 return 0; switch(cmd->type){ - 83f: 83 3b 05 cmpl $0x5,(%ebx) - 842: 77 38 ja 87c - 844: 8b 03 mov (%ebx),%eax - 846: 3e ff 24 85 24 11 00 notrack jmp *0x1124(,%eax,4) - 84d: 00 + 7fb: 83 3b 05 cmpl $0x5,(%ebx) + 7fe: 77 37 ja 837 + 800: 8b 03 mov (%ebx),%eax + 802: ff 24 85 9c 10 00 00 jmp *0x109c(,%eax,4) case EXEC: ecmd = (struct execcmd*)cmd; for(i=0; ecmd->argv[i]; i++) - 84e: 83 7b 04 00 cmpl $0x0,0x4(%ebx) - 852: 74 28 je 87c - 854: 8d 43 08 lea 0x8(%ebx),%eax + 809: 83 7b 04 00 cmpl $0x0,0x4(%ebx) + 80d: 74 28 je 837 + 80f: 8d 43 08 lea 0x8(%ebx),%eax *ecmd->eargv[i] = 0; - 857: 8b 50 24 mov 0x24(%eax),%edx - 85a: c6 02 00 movb $0x0,(%edx) + 812: 8b 50 24 mov 0x24(%eax),%edx + 815: c6 02 00 movb $0x0,(%edx) for(i=0; ecmd->argv[i]; i++) - 85d: 83 c0 04 add $0x4,%eax - 860: 83 78 fc 00 cmpl $0x0,-0x4(%eax) - 864: 75 f1 jne 857 - 866: eb 14 jmp 87c + 818: 83 c0 04 add $0x4,%eax + 81b: 83 78 fc 00 cmpl $0x0,-0x4(%eax) + 81f: 75 f1 jne 812 + 821: eb 14 jmp 837 break; case REDIR: rcmd = (struct redircmd*)cmd; nulterminate(rcmd->cmd); - 868: 83 ec 0c sub $0xc,%esp - 86b: ff 73 04 pushl 0x4(%ebx) - 86e: e8 ba ff ff ff call 82d + 823: 83 ec 0c sub $0xc,%esp + 826: ff 73 04 push 0x4(%ebx) + 829: e8 bf ff ff ff call 7ed *rcmd->efile = 0; - 873: 8b 43 0c mov 0xc(%ebx),%eax - 876: c6 00 00 movb $0x0,(%eax) + 82e: 8b 43 0c mov 0xc(%ebx),%eax + 831: c6 00 00 movb $0x0,(%eax) break; - 879: 83 c4 10 add $0x10,%esp + 834: 83 c4 10 add $0x10,%esp bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); break; } return cmd; } - 87c: 89 d8 mov %ebx,%eax - 87e: 8b 5d fc mov -0x4(%ebp),%ebx - 881: c9 leave - 882: c3 ret + 837: 89 d8 mov %ebx,%eax + 839: 8b 5d fc mov -0x4(%ebp),%ebx + 83c: c9 leave + 83d: c3 ret nulterminate(pcmd->left); - 883: 83 ec 0c sub $0xc,%esp - 886: ff 73 04 pushl 0x4(%ebx) - 889: e8 9f ff ff ff call 82d + 83e: 83 ec 0c sub $0xc,%esp + 841: ff 73 04 push 0x4(%ebx) + 844: e8 a4 ff ff ff call 7ed nulterminate(pcmd->right); - 88e: 83 c4 04 add $0x4,%esp - 891: ff 73 08 pushl 0x8(%ebx) - 894: e8 94 ff ff ff call 82d + 849: 83 c4 04 add $0x4,%esp + 84c: ff 73 08 push 0x8(%ebx) + 84f: e8 99 ff ff ff call 7ed break; - 899: 83 c4 10 add $0x10,%esp - 89c: eb de jmp 87c + 854: 83 c4 10 add $0x10,%esp + 857: eb de jmp 837 nulterminate(lcmd->left); - 89e: 83 ec 0c sub $0xc,%esp - 8a1: ff 73 04 pushl 0x4(%ebx) - 8a4: e8 84 ff ff ff call 82d + 859: 83 ec 0c sub $0xc,%esp + 85c: ff 73 04 push 0x4(%ebx) + 85f: e8 89 ff ff ff call 7ed nulterminate(lcmd->right); - 8a9: 83 c4 04 add $0x4,%esp - 8ac: ff 73 08 pushl 0x8(%ebx) - 8af: e8 79 ff ff ff call 82d + 864: 83 c4 04 add $0x4,%esp + 867: ff 73 08 push 0x8(%ebx) + 86a: e8 7e ff ff ff call 7ed break; - 8b4: 83 c4 10 add $0x10,%esp - 8b7: eb c3 jmp 87c + 86f: 83 c4 10 add $0x10,%esp + 872: eb c3 jmp 837 nulterminate(bcmd->cmd); - 8b9: 83 ec 0c sub $0xc,%esp - 8bc: ff 73 04 pushl 0x4(%ebx) - 8bf: e8 69 ff ff ff call 82d + 874: 83 ec 0c sub $0xc,%esp + 877: ff 73 04 push 0x4(%ebx) + 87a: e8 6e ff ff ff call 7ed break; - 8c4: 83 c4 10 add $0x10,%esp - 8c7: eb b3 jmp 87c + 87f: 83 c4 10 add $0x10,%esp + 882: eb b3 jmp 837 -000008c9 : +00000884 : { - 8c9: f3 0f 1e fb endbr32 - 8cd: 55 push %ebp - 8ce: 89 e5 mov %esp,%ebp - 8d0: 56 push %esi - 8d1: 53 push %ebx + 884: 55 push %ebp + 885: 89 e5 mov %esp,%ebp + 887: 56 push %esi + 888: 53 push %ebx es = s + strlen(s); - 8d2: 8b 5d 08 mov 0x8(%ebp),%ebx - 8d5: 83 ec 0c sub $0xc,%esp - 8d8: 53 push %ebx - 8d9: e8 87 01 00 00 call a65 - 8de: 01 c3 add %eax,%ebx + 889: 8b 5d 08 mov 0x8(%ebp),%ebx + 88c: 83 ec 0c sub $0xc,%esp + 88f: 53 push %ebx + 890: e8 7d 01 00 00 call a12 + 895: 01 c3 add %eax,%ebx cmd = parseline(&s, es); - 8e0: 83 c4 08 add $0x8,%esp - 8e3: 53 push %ebx - 8e4: 8d 45 08 lea 0x8(%ebp),%eax - 8e7: 50 push %eax - 8e8: e8 20 fe ff ff call 70d - 8ed: 89 c6 mov %eax,%esi + 897: 83 c4 08 add $0x8,%esp + 89a: 53 push %ebx + 89b: 8d 45 08 lea 0x8(%ebp),%eax + 89e: 50 push %eax + 89f: e8 31 fe ff ff call 6d5 + 8a4: 89 c6 mov %eax,%esi peek(&s, es, ""); - 8ef: 83 c4 0c add $0xc,%esp - 8f2: 68 72 10 00 00 push $0x1072 - 8f7: 53 push %ebx - 8f8: 8d 45 08 lea 0x8(%ebp),%eax - 8fb: 50 push %eax - 8fc: e8 7c fb ff ff call 47d + 8a6: 83 c4 0c add $0xc,%esp + 8a9: 68 ea 0f 00 00 push $0xfea + 8ae: 53 push %ebx + 8af: 8d 45 08 lea 0x8(%ebp),%eax + 8b2: 50 push %eax + 8b3: e8 9c fb ff ff call 454 if(s != es){ - 901: 8b 45 08 mov 0x8(%ebp),%eax - 904: 83 c4 10 add $0x10,%esp - 907: 39 d8 cmp %ebx,%eax - 909: 75 12 jne 91d + 8b8: 8b 45 08 mov 0x8(%ebp),%eax + 8bb: 83 c4 10 add $0x10,%esp + 8be: 39 d8 cmp %ebx,%eax + 8c0: 75 12 jne 8d4 nulterminate(cmd); - 90b: 83 ec 0c sub $0xc,%esp - 90e: 56 push %esi - 90f: e8 19 ff ff ff call 82d + 8c2: 83 ec 0c sub $0xc,%esp + 8c5: 56 push %esi + 8c6: e8 22 ff ff ff call 7ed } - 914: 89 f0 mov %esi,%eax - 916: 8d 65 f8 lea -0x8(%ebp),%esp - 919: 5b pop %ebx - 91a: 5e pop %esi - 91b: 5d pop %ebp - 91c: c3 ret + 8cb: 89 f0 mov %esi,%eax + 8cd: 8d 65 f8 lea -0x8(%ebp),%esp + 8d0: 5b pop %ebx + 8d1: 5e pop %esi + 8d2: 5d pop %ebp + 8d3: c3 ret printf(2, "leftovers: %s\n", s); - 91d: 83 ec 04 sub $0x4,%esp - 920: 50 push %eax - 921: 68 e6 10 00 00 push $0x10e6 - 926: 6a 02 push $0x2 - 928: e8 0d 04 00 00 call d3a + 8d4: 83 ec 04 sub $0x4,%esp + 8d7: 50 push %eax + 8d8: 68 5e 10 00 00 push $0x105e + 8dd: 6a 02 push $0x2 + 8df: e8 ef 03 00 00 call cd3 panic("syntax"); - 92d: c7 04 24 aa 10 00 00 movl $0x10aa,(%esp) - 934: e8 10 f7 ff ff call 49 + 8e4: c7 04 24 22 10 00 00 movl $0x1022,(%esp) + 8eb: e8 4f f7 ff ff call 3f -00000939
: +000008f0
: { - 939: f3 0f 1e fb endbr32 - 93d: 8d 4c 24 04 lea 0x4(%esp),%ecx - 941: 83 e4 f0 and $0xfffffff0,%esp - 944: ff 71 fc pushl -0x4(%ecx) - 947: 55 push %ebp - 948: 89 e5 mov %esp,%ebp - 94a: 51 push %ecx - 94b: 83 ec 04 sub $0x4,%esp + 8f0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 8f4: 83 e4 f0 and $0xfffffff0,%esp + 8f7: ff 71 fc push -0x4(%ecx) + 8fa: 55 push %ebp + 8fb: 89 e5 mov %esp,%ebp + 8fd: 51 push %ecx + 8fe: 83 ec 04 sub $0x4,%esp while((fd = open("console", O_RDWR)) >= 0){ - 94e: 83 ec 08 sub $0x8,%esp - 951: 6a 02 push $0x2 - 953: 68 f5 10 00 00 push $0x10f5 - 958: e8 d9 02 00 00 call c36 - 95d: 83 c4 10 add $0x10,%esp - 960: 85 c0 test %eax,%eax - 962: 78 21 js 985 + 901: 83 ec 08 sub $0x8,%esp + 904: 6a 02 push $0x2 + 906: 68 6d 10 00 00 push $0x106d + 90b: e8 bb 02 00 00 call bcb + 910: 83 c4 10 add $0x10,%esp + 913: 85 c0 test %eax,%eax + 915: 78 21 js 938 if(fd >= 3){ - 964: 83 f8 02 cmp $0x2,%eax - 967: 7e e5 jle 94e + 917: 83 f8 02 cmp $0x2,%eax + 91a: 7e e5 jle 901 close(fd); - 969: 83 ec 0c sub $0xc,%esp - 96c: 50 push %eax - 96d: e8 ac 02 00 00 call c1e + 91c: 83 ec 0c sub $0xc,%esp + 91f: 50 push %eax + 920: e8 8e 02 00 00 call bb3 break; - 972: 83 c4 10 add $0x10,%esp - 975: eb 0e jmp 985 + 925: 83 c4 10 add $0x10,%esp + 928: eb 0e jmp 938 if(fork1() == 0) - 977: e8 eb f6 ff ff call 67 - 97c: 85 c0 test %eax,%eax - 97e: 74 76 je 9f6 + 92a: e8 2a f7 ff ff call 59 + 92f: 85 c0 test %eax,%eax + 931: 74 76 je 9a9 wait(); - 980: e8 79 02 00 00 call bfe + 933: e8 5b 02 00 00 call b93 while(getcmd(buf, sizeof(buf)) >= 0){ - 985: 83 ec 08 sub $0x8,%esp - 988: 6a 64 push $0x64 - 98a: 68 a0 16 00 00 push $0x16a0 - 98f: e8 6c f6 ff ff call 0 - 994: 83 c4 10 add $0x10,%esp - 997: 85 c0 test %eax,%eax - 999: 78 70 js a0b + 938: 83 ec 08 sub $0x8,%esp + 93b: 6a 64 push $0x64 + 93d: 68 80 16 00 00 push $0x1680 + 942: e8 b9 f6 ff ff call 0 + 947: 83 c4 10 add $0x10,%esp + 94a: 85 c0 test %eax,%eax + 94c: 78 70 js 9be if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ - 99b: 80 3d a0 16 00 00 63 cmpb $0x63,0x16a0 - 9a2: 75 d3 jne 977 - 9a4: 80 3d a1 16 00 00 64 cmpb $0x64,0x16a1 - 9ab: 75 ca jne 977 - 9ad: 80 3d a2 16 00 00 20 cmpb $0x20,0x16a2 - 9b4: 75 c1 jne 977 + 94e: 80 3d 80 16 00 00 63 cmpb $0x63,0x1680 + 955: 75 d3 jne 92a + 957: 80 3d 81 16 00 00 64 cmpb $0x64,0x1681 + 95e: 75 ca jne 92a + 960: 80 3d 82 16 00 00 20 cmpb $0x20,0x1682 + 967: 75 c1 jne 92a buf[strlen(buf)-1] = 0; // chop \n - 9b6: 83 ec 0c sub $0xc,%esp - 9b9: 68 a0 16 00 00 push $0x16a0 - 9be: e8 a2 00 00 00 call a65 - 9c3: c6 80 9f 16 00 00 00 movb $0x0,0x169f(%eax) + 969: 83 ec 0c sub $0xc,%esp + 96c: 68 80 16 00 00 push $0x1680 + 971: e8 9c 00 00 00 call a12 + 976: c6 80 7f 16 00 00 00 movb $0x0,0x167f(%eax) if(chdir(buf+3) < 0) - 9ca: c7 04 24 a3 16 00 00 movl $0x16a3,(%esp) - 9d1: e8 90 02 00 00 call c66 - 9d6: 83 c4 10 add $0x10,%esp - 9d9: 85 c0 test %eax,%eax - 9db: 79 a8 jns 985 + 97d: c7 04 24 83 16 00 00 movl $0x1683,(%esp) + 984: e8 72 02 00 00 call bfb + 989: 83 c4 10 add $0x10,%esp + 98c: 85 c0 test %eax,%eax + 98e: 79 a8 jns 938 printf(2, "cannot cd %s\n", buf+3); - 9dd: 83 ec 04 sub $0x4,%esp - 9e0: 68 a3 16 00 00 push $0x16a3 - 9e5: 68 fd 10 00 00 push $0x10fd - 9ea: 6a 02 push $0x2 - 9ec: e8 49 03 00 00 call d3a - 9f1: 83 c4 10 add $0x10,%esp - 9f4: eb 8f jmp 985 + 990: 83 ec 04 sub $0x4,%esp + 993: 68 83 16 00 00 push $0x1683 + 998: 68 75 10 00 00 push $0x1075 + 99d: 6a 02 push $0x2 + 99f: e8 2f 03 00 00 call cd3 + 9a4: 83 c4 10 add $0x10,%esp + 9a7: eb 8f jmp 938 runcmd(parsecmd(buf)); - 9f6: 83 ec 0c sub $0xc,%esp - 9f9: 68 a0 16 00 00 push $0x16a0 - 9fe: e8 c6 fe ff ff call 8c9 - a03: 89 04 24 mov %eax,(%esp) - a06: e8 7f f6 ff ff call 8a + 9a9: 83 ec 0c sub $0xc,%esp + 9ac: 68 80 16 00 00 push $0x1680 + 9b1: e8 ce fe ff ff call 884 + 9b6: 89 04 24 mov %eax,(%esp) + 9b9: e8 ba f6 ff ff call 78 exit(); - a0b: e8 e6 01 00 00 call bf6 + 9be: e8 c8 01 00 00 call b8b -00000a10 : +000009c3 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - a10: f3 0f 1e fb endbr32 - a14: 55 push %ebp - a15: 89 e5 mov %esp,%ebp - a17: 53 push %ebx - a18: 8b 4d 08 mov 0x8(%ebp),%ecx - a1b: 8b 5d 0c mov 0xc(%ebp),%ebx + 9c3: 55 push %ebp + 9c4: 89 e5 mov %esp,%ebp + 9c6: 53 push %ebx + 9c7: 8b 4d 08 mov 0x8(%ebp),%ecx + 9ca: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - a1e: b8 00 00 00 00 mov $0x0,%eax - a23: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - a27: 88 14 01 mov %dl,(%ecx,%eax,1) - a2a: 83 c0 01 add $0x1,%eax - a2d: 84 d2 test %dl,%dl - a2f: 75 f2 jne a23 + 9cd: b8 00 00 00 00 mov $0x0,%eax + 9d2: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 9d6: 88 14 01 mov %dl,(%ecx,%eax,1) + 9d9: 83 c0 01 add $0x1,%eax + 9dc: 84 d2 test %dl,%dl + 9de: 75 f2 jne 9d2 ; return os; } - a31: 89 c8 mov %ecx,%eax - a33: 5b pop %ebx - a34: 5d pop %ebp - a35: c3 ret + 9e0: 89 c8 mov %ecx,%eax + 9e2: 8b 5d fc mov -0x4(%ebp),%ebx + 9e5: c9 leave + 9e6: c3 ret -00000a36 : +000009e7 : int strcmp(const char *p, const char *q) { - a36: f3 0f 1e fb endbr32 - a3a: 55 push %ebp - a3b: 89 e5 mov %esp,%ebp - a3d: 8b 4d 08 mov 0x8(%ebp),%ecx - a40: 8b 55 0c mov 0xc(%ebp),%edx + 9e7: 55 push %ebp + 9e8: 89 e5 mov %esp,%ebp + 9ea: 8b 4d 08 mov 0x8(%ebp),%ecx + 9ed: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - a43: 0f b6 01 movzbl (%ecx),%eax - a46: 84 c0 test %al,%al - a48: 74 11 je a5b - a4a: 38 02 cmp %al,(%edx) - a4c: 75 0d jne a5b + 9f0: 0f b6 01 movzbl (%ecx),%eax + 9f3: 84 c0 test %al,%al + 9f5: 74 11 je a08 + 9f7: 38 02 cmp %al,(%edx) + 9f9: 75 0d jne a08 p++, q++; - a4e: 83 c1 01 add $0x1,%ecx - a51: 83 c2 01 add $0x1,%edx + 9fb: 83 c1 01 add $0x1,%ecx + 9fe: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - a54: 0f b6 01 movzbl (%ecx),%eax - a57: 84 c0 test %al,%al - a59: 75 ef jne a4a + a01: 0f b6 01 movzbl (%ecx),%eax + a04: 84 c0 test %al,%al + a06: 75 ef jne 9f7 return (uchar)*p - (uchar)*q; - a5b: 0f b6 c0 movzbl %al,%eax - a5e: 0f b6 12 movzbl (%edx),%edx - a61: 29 d0 sub %edx,%eax + a08: 0f b6 c0 movzbl %al,%eax + a0b: 0f b6 12 movzbl (%edx),%edx + a0e: 29 d0 sub %edx,%eax } - a63: 5d pop %ebp - a64: c3 ret + a10: 5d pop %ebp + a11: c3 ret -00000a65 : +00000a12 : uint strlen(const char *s) { - a65: f3 0f 1e fb endbr32 - a69: 55 push %ebp - a6a: 89 e5 mov %esp,%ebp - a6c: 8b 55 08 mov 0x8(%ebp),%edx + a12: 55 push %ebp + a13: 89 e5 mov %esp,%ebp + a15: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - a6f: 80 3a 00 cmpb $0x0,(%edx) - a72: 74 14 je a88 - a74: b8 00 00 00 00 mov $0x0,%eax - a79: 83 c0 01 add $0x1,%eax - a7c: 89 c1 mov %eax,%ecx - a7e: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - a82: 75 f5 jne a79 + a18: 80 3a 00 cmpb $0x0,(%edx) + a1b: 74 14 je a31 + a1d: b8 00 00 00 00 mov $0x0,%eax + a22: 83 c0 01 add $0x1,%eax + a25: 89 c1 mov %eax,%ecx + a27: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + a2b: 75 f5 jne a22 ; return n; } - a84: 89 c8 mov %ecx,%eax - a86: 5d pop %ebp - a87: c3 ret + a2d: 89 c8 mov %ecx,%eax + a2f: 5d pop %ebp + a30: c3 ret for(n = 0; s[n]; n++) - a88: b9 00 00 00 00 mov $0x0,%ecx + a31: b9 00 00 00 00 mov $0x0,%ecx return n; - a8d: eb f5 jmp a84 + a36: eb f5 jmp a2d -00000a8f : +00000a38 : void* memset(void *dst, int c, uint n) { - a8f: f3 0f 1e fb endbr32 - a93: 55 push %ebp - a94: 89 e5 mov %esp,%ebp - a96: 57 push %edi - a97: 8b 55 08 mov 0x8(%ebp),%edx + a38: 55 push %ebp + a39: 89 e5 mov %esp,%ebp + a3b: 57 push %edi + a3c: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - a9a: 89 d7 mov %edx,%edi - a9c: 8b 4d 10 mov 0x10(%ebp),%ecx - a9f: 8b 45 0c mov 0xc(%ebp),%eax - aa2: fc cld - aa3: f3 aa rep stos %al,%es:(%edi) + a3f: 89 d7 mov %edx,%edi + a41: 8b 4d 10 mov 0x10(%ebp),%ecx + a44: 8b 45 0c mov 0xc(%ebp),%eax + a47: fc cld + a48: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - aa5: 89 d0 mov %edx,%eax - aa7: 5f pop %edi - aa8: 5d pop %ebp - aa9: c3 ret + a4a: 89 d0 mov %edx,%eax + a4c: 8b 7d fc mov -0x4(%ebp),%edi + a4f: c9 leave + a50: c3 ret -00000aaa : +00000a51 : char* strchr(const char *s, char c) { - aaa: f3 0f 1e fb endbr32 - aae: 55 push %ebp - aaf: 89 e5 mov %esp,%ebp - ab1: 8b 45 08 mov 0x8(%ebp),%eax - ab4: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + a51: 55 push %ebp + a52: 89 e5 mov %esp,%ebp + a54: 8b 45 08 mov 0x8(%ebp),%eax + a57: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - ab8: 0f b6 10 movzbl (%eax),%edx - abb: 84 d2 test %dl,%dl - abd: 74 15 je ad4 + a5b: 0f b6 10 movzbl (%eax),%edx + a5e: 84 d2 test %dl,%dl + a60: 74 15 je a77 if(*s == c) - abf: 38 d1 cmp %dl,%cl - ac1: 74 0f je ad2 + a62: 38 d1 cmp %dl,%cl + a64: 74 0f je a75 for(; *s; s++) - ac3: 83 c0 01 add $0x1,%eax - ac6: 0f b6 10 movzbl (%eax),%edx - ac9: 84 d2 test %dl,%dl - acb: 75 f2 jne abf + a66: 83 c0 01 add $0x1,%eax + a69: 0f b6 10 movzbl (%eax),%edx + a6c: 84 d2 test %dl,%dl + a6e: 75 f2 jne a62 return (char*)s; return 0; - acd: b8 00 00 00 00 mov $0x0,%eax + a70: b8 00 00 00 00 mov $0x0,%eax } - ad2: 5d pop %ebp - ad3: c3 ret + a75: 5d pop %ebp + a76: c3 ret return 0; - ad4: b8 00 00 00 00 mov $0x0,%eax - ad9: eb f7 jmp ad2 + a77: b8 00 00 00 00 mov $0x0,%eax + a7c: eb f7 jmp a75 -00000adb : +00000a7e : char* gets(char *buf, int max) { - adb: f3 0f 1e fb endbr32 - adf: 55 push %ebp - ae0: 89 e5 mov %esp,%ebp - ae2: 57 push %edi - ae3: 56 push %esi - ae4: 53 push %ebx - ae5: 83 ec 2c sub $0x2c,%esp - ae8: 8b 75 08 mov 0x8(%ebp),%esi + a7e: 55 push %ebp + a7f: 89 e5 mov %esp,%ebp + a81: 57 push %edi + a82: 56 push %esi + a83: 53 push %ebx + a84: 83 ec 2c sub $0x2c,%esp + a87: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - aeb: bb 00 00 00 00 mov $0x0,%ebx + a8a: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - af0: 8d 7d e7 lea -0x19(%ebp),%edi + a8f: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - af3: 89 5d d4 mov %ebx,-0x2c(%ebp) - af6: 83 c3 01 add $0x1,%ebx - af9: 3b 5d 0c cmp 0xc(%ebp),%ebx - afc: 7d 27 jge b25 + a92: 89 5d d4 mov %ebx,-0x2c(%ebp) + a95: 83 c3 01 add $0x1,%ebx + a98: 3b 5d 0c cmp 0xc(%ebp),%ebx + a9b: 7d 27 jge ac4 cc = read(0, &c, 1); - afe: 83 ec 04 sub $0x4,%esp - b01: 6a 01 push $0x1 - b03: 57 push %edi - b04: 6a 00 push $0x0 - b06: e8 03 01 00 00 call c0e + a9d: 83 ec 04 sub $0x4,%esp + aa0: 6a 01 push $0x1 + aa2: 57 push %edi + aa3: 6a 00 push $0x0 + aa5: e8 f9 00 00 00 call ba3 if(cc < 1) - b0b: 83 c4 10 add $0x10,%esp - b0e: 85 c0 test %eax,%eax - b10: 7e 13 jle b25 + aaa: 83 c4 10 add $0x10,%esp + aad: 85 c0 test %eax,%eax + aaf: 7e 13 jle ac4 break; buf[i++] = c; - b12: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - b16: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + ab1: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + ab5: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - b1a: 3c 0a cmp $0xa,%al - b1c: 74 04 je b22 - b1e: 3c 0d cmp $0xd,%al - b20: 75 d1 jne af3 + ab9: 3c 0a cmp $0xa,%al + abb: 74 04 je ac1 + abd: 3c 0d cmp $0xd,%al + abf: 75 d1 jne a92 for(i=0; i+1 < max; ){ - b22: 89 5d d4 mov %ebx,-0x2c(%ebp) + ac1: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - b25: 8b 45 d4 mov -0x2c(%ebp),%eax - b28: c6 04 06 00 movb $0x0,(%esi,%eax,1) + ac4: 8b 45 d4 mov -0x2c(%ebp),%eax + ac7: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - b2c: 89 f0 mov %esi,%eax - b2e: 8d 65 f4 lea -0xc(%ebp),%esp - b31: 5b pop %ebx - b32: 5e pop %esi - b33: 5f pop %edi - b34: 5d pop %ebp - b35: c3 ret + acb: 89 f0 mov %esi,%eax + acd: 8d 65 f4 lea -0xc(%ebp),%esp + ad0: 5b pop %ebx + ad1: 5e pop %esi + ad2: 5f pop %edi + ad3: 5d pop %ebp + ad4: c3 ret -00000b36 : +00000ad5 : int stat(const char *n, struct stat *st) { - b36: f3 0f 1e fb endbr32 - b3a: 55 push %ebp - b3b: 89 e5 mov %esp,%ebp - b3d: 56 push %esi - b3e: 53 push %ebx + ad5: 55 push %ebp + ad6: 89 e5 mov %esp,%ebp + ad8: 56 push %esi + ad9: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - b3f: 83 ec 08 sub $0x8,%esp - b42: 6a 00 push $0x0 - b44: ff 75 08 pushl 0x8(%ebp) - b47: e8 ea 00 00 00 call c36 + ada: 83 ec 08 sub $0x8,%esp + add: 6a 00 push $0x0 + adf: ff 75 08 push 0x8(%ebp) + ae2: e8 e4 00 00 00 call bcb if(fd < 0) - b4c: 83 c4 10 add $0x10,%esp - b4f: 85 c0 test %eax,%eax - b51: 78 24 js b77 - b53: 89 c3 mov %eax,%ebx + ae7: 83 c4 10 add $0x10,%esp + aea: 85 c0 test %eax,%eax + aec: 78 24 js b12 + aee: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - b55: 83 ec 08 sub $0x8,%esp - b58: ff 75 0c pushl 0xc(%ebp) - b5b: 50 push %eax - b5c: e8 ed 00 00 00 call c4e - b61: 89 c6 mov %eax,%esi + af0: 83 ec 08 sub $0x8,%esp + af3: ff 75 0c push 0xc(%ebp) + af6: 50 push %eax + af7: e8 e7 00 00 00 call be3 + afc: 89 c6 mov %eax,%esi close(fd); - b63: 89 1c 24 mov %ebx,(%esp) - b66: e8 b3 00 00 00 call c1e + afe: 89 1c 24 mov %ebx,(%esp) + b01: e8 ad 00 00 00 call bb3 return r; - b6b: 83 c4 10 add $0x10,%esp + b06: 83 c4 10 add $0x10,%esp } - b6e: 89 f0 mov %esi,%eax - b70: 8d 65 f8 lea -0x8(%ebp),%esp - b73: 5b pop %ebx - b74: 5e pop %esi - b75: 5d pop %ebp - b76: c3 ret + b09: 89 f0 mov %esi,%eax + b0b: 8d 65 f8 lea -0x8(%ebp),%esp + b0e: 5b pop %ebx + b0f: 5e pop %esi + b10: 5d pop %ebp + b11: c3 ret return -1; - b77: be ff ff ff ff mov $0xffffffff,%esi - b7c: eb f0 jmp b6e + b12: be ff ff ff ff mov $0xffffffff,%esi + b17: eb f0 jmp b09 -00000b7e : +00000b19 : int atoi(const char *s) { - b7e: f3 0f 1e fb endbr32 - b82: 55 push %ebp - b83: 89 e5 mov %esp,%ebp - b85: 53 push %ebx - b86: 8b 55 08 mov 0x8(%ebp),%edx + b19: 55 push %ebp + b1a: 89 e5 mov %esp,%ebp + b1c: 53 push %ebx + b1d: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - b89: 0f b6 02 movzbl (%edx),%eax - b8c: 8d 48 d0 lea -0x30(%eax),%ecx - b8f: 80 f9 09 cmp $0x9,%cl - b92: 77 22 ja bb6 + b20: 0f b6 02 movzbl (%edx),%eax + b23: 8d 48 d0 lea -0x30(%eax),%ecx + b26: 80 f9 09 cmp $0x9,%cl + b29: 77 24 ja b4f n = 0; - b94: b9 00 00 00 00 mov $0x0,%ecx + b2b: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - b99: 83 c2 01 add $0x1,%edx - b9c: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - b9f: 0f be c0 movsbl %al,%eax - ba2: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + b30: 83 c2 01 add $0x1,%edx + b33: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + b36: 0f be c0 movsbl %al,%eax + b39: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - ba6: 0f b6 02 movzbl (%edx),%eax - ba9: 8d 58 d0 lea -0x30(%eax),%ebx - bac: 80 fb 09 cmp $0x9,%bl - baf: 76 e8 jbe b99 + b3d: 0f b6 02 movzbl (%edx),%eax + b40: 8d 58 d0 lea -0x30(%eax),%ebx + b43: 80 fb 09 cmp $0x9,%bl + b46: 76 e8 jbe b30 return n; } - bb1: 89 c8 mov %ecx,%eax - bb3: 5b pop %ebx - bb4: 5d pop %ebp - bb5: c3 ret + b48: 89 c8 mov %ecx,%eax + b4a: 8b 5d fc mov -0x4(%ebp),%ebx + b4d: c9 leave + b4e: c3 ret n = 0; - bb6: b9 00 00 00 00 mov $0x0,%ecx + b4f: b9 00 00 00 00 mov $0x0,%ecx return n; - bbb: eb f4 jmp bb1 + b54: eb f2 jmp b48 -00000bbd : +00000b56 : void* memmove(void *vdst, const void *vsrc, int n) { - bbd: f3 0f 1e fb endbr32 - bc1: 55 push %ebp - bc2: 89 e5 mov %esp,%ebp - bc4: 56 push %esi - bc5: 53 push %ebx - bc6: 8b 75 08 mov 0x8(%ebp),%esi - bc9: 8b 55 0c mov 0xc(%ebp),%edx - bcc: 8b 5d 10 mov 0x10(%ebp),%ebx + b56: 55 push %ebp + b57: 89 e5 mov %esp,%ebp + b59: 56 push %esi + b5a: 53 push %ebx + b5b: 8b 75 08 mov 0x8(%ebp),%esi + b5e: 8b 55 0c mov 0xc(%ebp),%edx + b61: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - bcf: 85 db test %ebx,%ebx - bd1: 7e 15 jle be8 - bd3: 01 f3 add %esi,%ebx + b64: 85 db test %ebx,%ebx + b66: 7e 15 jle b7d + b68: 01 f3 add %esi,%ebx dst = vdst; - bd5: 89 f0 mov %esi,%eax + b6a: 89 f0 mov %esi,%eax *dst++ = *src++; - bd7: 83 c2 01 add $0x1,%edx - bda: 83 c0 01 add $0x1,%eax - bdd: 0f b6 4a ff movzbl -0x1(%edx),%ecx - be1: 88 48 ff mov %cl,-0x1(%eax) + b6c: 83 c2 01 add $0x1,%edx + b6f: 83 c0 01 add $0x1,%eax + b72: 0f b6 4a ff movzbl -0x1(%edx),%ecx + b76: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - be4: 39 c3 cmp %eax,%ebx - be6: 75 ef jne bd7 + b79: 39 c3 cmp %eax,%ebx + b7b: 75 ef jne b6c return vdst; } - be8: 89 f0 mov %esi,%eax - bea: 5b pop %ebx - beb: 5e pop %esi - bec: 5d pop %ebp - bed: c3 ret + b7d: 89 f0 mov %esi,%eax + b7f: 5b pop %ebx + b80: 5e pop %esi + b81: 5d pop %ebp + b82: c3 ret -00000bee : +00000b83 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - bee: b8 01 00 00 00 mov $0x1,%eax - bf3: cd 40 int $0x40 - bf5: c3 ret + b83: b8 01 00 00 00 mov $0x1,%eax + b88: cd 40 int $0x40 + b8a: c3 ret -00000bf6 : +00000b8b : SYSCALL(exit) - bf6: b8 02 00 00 00 mov $0x2,%eax - bfb: cd 40 int $0x40 - bfd: c3 ret + b8b: b8 02 00 00 00 mov $0x2,%eax + b90: cd 40 int $0x40 + b92: c3 ret -00000bfe : +00000b93 : SYSCALL(wait) - bfe: b8 03 00 00 00 mov $0x3,%eax - c03: cd 40 int $0x40 - c05: c3 ret + b93: b8 03 00 00 00 mov $0x3,%eax + b98: cd 40 int $0x40 + b9a: c3 ret -00000c06 : +00000b9b : SYSCALL(pipe) - c06: b8 04 00 00 00 mov $0x4,%eax - c0b: cd 40 int $0x40 - c0d: c3 ret + b9b: b8 04 00 00 00 mov $0x4,%eax + ba0: cd 40 int $0x40 + ba2: c3 ret -00000c0e : +00000ba3 : SYSCALL(read) - c0e: b8 05 00 00 00 mov $0x5,%eax - c13: cd 40 int $0x40 - c15: c3 ret + ba3: b8 05 00 00 00 mov $0x5,%eax + ba8: cd 40 int $0x40 + baa: c3 ret -00000c16 : +00000bab : SYSCALL(write) - c16: b8 10 00 00 00 mov $0x10,%eax - c1b: cd 40 int $0x40 - c1d: c3 ret + bab: b8 10 00 00 00 mov $0x10,%eax + bb0: cd 40 int $0x40 + bb2: c3 ret -00000c1e : +00000bb3 : SYSCALL(close) - c1e: b8 15 00 00 00 mov $0x15,%eax - c23: cd 40 int $0x40 - c25: c3 ret + bb3: b8 15 00 00 00 mov $0x15,%eax + bb8: cd 40 int $0x40 + bba: c3 ret -00000c26 : +00000bbb : SYSCALL(kill) - c26: b8 06 00 00 00 mov $0x6,%eax - c2b: cd 40 int $0x40 - c2d: c3 ret + bbb: b8 06 00 00 00 mov $0x6,%eax + bc0: cd 40 int $0x40 + bc2: c3 ret -00000c2e : +00000bc3 : SYSCALL(exec) - c2e: b8 07 00 00 00 mov $0x7,%eax - c33: cd 40 int $0x40 - c35: c3 ret + bc3: b8 07 00 00 00 mov $0x7,%eax + bc8: cd 40 int $0x40 + bca: c3 ret -00000c36 : +00000bcb : SYSCALL(open) - c36: b8 0f 00 00 00 mov $0xf,%eax - c3b: cd 40 int $0x40 - c3d: c3 ret + bcb: b8 0f 00 00 00 mov $0xf,%eax + bd0: cd 40 int $0x40 + bd2: c3 ret -00000c3e : +00000bd3 : SYSCALL(mknod) - c3e: b8 11 00 00 00 mov $0x11,%eax - c43: cd 40 int $0x40 - c45: c3 ret + bd3: b8 11 00 00 00 mov $0x11,%eax + bd8: cd 40 int $0x40 + bda: c3 ret -00000c46 : +00000bdb : SYSCALL(unlink) - c46: b8 12 00 00 00 mov $0x12,%eax - c4b: cd 40 int $0x40 - c4d: c3 ret + bdb: b8 12 00 00 00 mov $0x12,%eax + be0: cd 40 int $0x40 + be2: c3 ret -00000c4e : +00000be3 : SYSCALL(fstat) - c4e: b8 08 00 00 00 mov $0x8,%eax - c53: cd 40 int $0x40 - c55: c3 ret + be3: b8 08 00 00 00 mov $0x8,%eax + be8: cd 40 int $0x40 + bea: c3 ret -00000c56 : +00000beb : SYSCALL(link) - c56: b8 13 00 00 00 mov $0x13,%eax - c5b: cd 40 int $0x40 - c5d: c3 ret + beb: b8 13 00 00 00 mov $0x13,%eax + bf0: cd 40 int $0x40 + bf2: c3 ret -00000c5e : +00000bf3 : SYSCALL(mkdir) - c5e: b8 14 00 00 00 mov $0x14,%eax - c63: cd 40 int $0x40 - c65: c3 ret + bf3: b8 14 00 00 00 mov $0x14,%eax + bf8: cd 40 int $0x40 + bfa: c3 ret -00000c66 : +00000bfb : SYSCALL(chdir) - c66: b8 09 00 00 00 mov $0x9,%eax - c6b: cd 40 int $0x40 - c6d: c3 ret + bfb: b8 09 00 00 00 mov $0x9,%eax + c00: cd 40 int $0x40 + c02: c3 ret -00000c6e : +00000c03 : SYSCALL(dup) - c6e: b8 0a 00 00 00 mov $0xa,%eax - c73: cd 40 int $0x40 - c75: c3 ret + c03: b8 0a 00 00 00 mov $0xa,%eax + c08: cd 40 int $0x40 + c0a: c3 ret -00000c76 : +00000c0b : SYSCALL(getpid) - c76: b8 0b 00 00 00 mov $0xb,%eax - c7b: cd 40 int $0x40 - c7d: c3 ret + c0b: b8 0b 00 00 00 mov $0xb,%eax + c10: cd 40 int $0x40 + c12: c3 ret -00000c7e : +00000c13 : SYSCALL(sbrk) - c7e: b8 0c 00 00 00 mov $0xc,%eax - c83: cd 40 int $0x40 - c85: c3 ret + c13: b8 0c 00 00 00 mov $0xc,%eax + c18: cd 40 int $0x40 + c1a: c3 ret -00000c86 : +00000c1b : SYSCALL(sleep) - c86: b8 0d 00 00 00 mov $0xd,%eax - c8b: cd 40 int $0x40 - c8d: c3 ret + c1b: b8 0d 00 00 00 mov $0xd,%eax + c20: cd 40 int $0x40 + c22: c3 ret -00000c8e : +00000c23 : SYSCALL(uptime) - c8e: b8 0e 00 00 00 mov $0xe,%eax - c93: cd 40 int $0x40 - c95: c3 ret + c23: b8 0e 00 00 00 mov $0xe,%eax + c28: cd 40 int $0x40 + c2a: c3 ret -00000c96 : +00000c2b : SYSCALL(slabtest) - c96: b8 16 00 00 00 mov $0x16,%eax - c9b: cd 40 int $0x40 - c9d: c3 ret + c2b: b8 16 00 00 00 mov $0x16,%eax + c30: cd 40 int $0x40 + c32: c3 ret -00000c9e : +00000c33 : SYSCALL(ps) - c9e: b8 17 00 00 00 mov $0x17,%eax - ca3: cd 40 int $0x40 - ca5: c3 ret + c33: b8 17 00 00 00 mov $0x17,%eax + c38: cd 40 int $0x40 + c3a: c3 ret -00000ca6 : +00000c3b : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - ca6: 55 push %ebp - ca7: 89 e5 mov %esp,%ebp - ca9: 57 push %edi - caa: 56 push %esi - cab: 53 push %ebx - cac: 83 ec 3c sub $0x3c,%esp - caf: 89 45 c4 mov %eax,-0x3c(%ebp) - cb2: 89 d3 mov %edx,%ebx + c3b: 55 push %ebp + c3c: 89 e5 mov %esp,%ebp + c3e: 57 push %edi + c3f: 56 push %esi + c40: 53 push %ebx + c41: 83 ec 3c sub $0x3c,%esp + c44: 89 45 c4 mov %eax,-0x3c(%ebp) + c47: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - cb4: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - cb8: 74 77 je d31 - cba: 85 d2 test %edx,%edx - cbc: 79 73 jns d31 + c49: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + c4d: 74 79 je cc8 + c4f: 85 d2 test %edx,%edx + c51: 79 75 jns cc8 neg = 1; x = -xx; - cbe: f7 db neg %ebx + c53: 89 d1 mov %edx,%ecx + c55: f7 d9 neg %ecx neg = 1; - cc0: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + c57: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - cc7: be 00 00 00 00 mov $0x0,%esi + c5e: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - ccc: 89 f7 mov %esi,%edi - cce: 83 c6 01 add $0x1,%esi - cd1: 89 d8 mov %ebx,%eax - cd3: ba 00 00 00 00 mov $0x0,%edx - cd8: f7 f1 div %ecx - cda: 0f b6 92 44 11 00 00 movzbl 0x1144(%edx),%edx - ce1: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + c63: 89 df mov %ebx,%edi + c65: 83 c3 01 add $0x1,%ebx + c68: 89 c8 mov %ecx,%eax + c6a: ba 00 00 00 00 mov $0x0,%edx + c6f: f7 f6 div %esi + c71: 0f b6 92 14 11 00 00 movzbl 0x1114(%edx),%edx + c78: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - ce5: 89 da mov %ebx,%edx - ce7: 89 c3 mov %eax,%ebx - ce9: 39 d1 cmp %edx,%ecx - ceb: 76 df jbe ccc + c7c: 89 ca mov %ecx,%edx + c7e: 89 c1 mov %eax,%ecx + c80: 39 d6 cmp %edx,%esi + c82: 76 df jbe c63 if(neg) - ced: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - cf1: 74 08 je cfb + c84: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + c88: 74 08 je c92 buf[i++] = '-'; - cf3: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - cf8: 8d 77 02 lea 0x2(%edi),%esi + c8a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + c8f: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - cfb: 85 f6 test %esi,%esi - cfd: 7e 2a jle d29 - cff: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - d03: 8d 7d d8 lea -0x28(%ebp),%edi + c92: 85 db test %ebx,%ebx + c94: 7e 2a jle cc0 + c96: 8d 7d d8 lea -0x28(%ebp),%edi + c99: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - d06: 8d 75 d7 lea -0x29(%ebp),%esi + c9d: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - d09: 0f b6 03 movzbl (%ebx),%eax - d0c: 88 45 d7 mov %al,-0x29(%ebp) + ca0: 0f b6 03 movzbl (%ebx),%eax + ca3: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - d0f: 83 ec 04 sub $0x4,%esp - d12: 6a 01 push $0x1 - d14: 56 push %esi - d15: ff 75 c4 pushl -0x3c(%ebp) - d18: e8 f9 fe ff ff call c16 + ca6: 83 ec 04 sub $0x4,%esp + ca9: 6a 01 push $0x1 + cab: 56 push %esi + cac: ff 75 c4 push -0x3c(%ebp) + caf: e8 f7 fe ff ff call bab while(--i >= 0) - d1d: 89 d8 mov %ebx,%eax - d1f: 83 eb 01 sub $0x1,%ebx - d22: 83 c4 10 add $0x10,%esp - d25: 39 f8 cmp %edi,%eax - d27: 75 e0 jne d09 + cb4: 89 d8 mov %ebx,%eax + cb6: 83 eb 01 sub $0x1,%ebx + cb9: 83 c4 10 add $0x10,%esp + cbc: 39 f8 cmp %edi,%eax + cbe: 75 e0 jne ca0 } - d29: 8d 65 f4 lea -0xc(%ebp),%esp - d2c: 5b pop %ebx - d2d: 5e pop %esi - d2e: 5f pop %edi - d2f: 5d pop %ebp - d30: c3 ret + cc0: 8d 65 f4 lea -0xc(%ebp),%esp + cc3: 5b pop %ebx + cc4: 5e pop %esi + cc5: 5f pop %edi + cc6: 5d pop %ebp + cc7: c3 ret + x = xx; + cc8: 89 d1 mov %edx,%ecx neg = 0; - d31: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - d38: eb 8d jmp cc7 + cca: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + cd1: eb 8b jmp c5e -00000d3a : +00000cd3 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - d3a: f3 0f 1e fb endbr32 - d3e: 55 push %ebp - d3f: 89 e5 mov %esp,%ebp - d41: 57 push %edi - d42: 56 push %esi - d43: 53 push %ebx - d44: 83 ec 2c sub $0x2c,%esp + cd3: 55 push %ebp + cd4: 89 e5 mov %esp,%ebp + cd6: 57 push %edi + cd7: 56 push %esi + cd8: 53 push %ebx + cd9: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - d47: 8b 75 0c mov 0xc(%ebp),%esi - d4a: 0f b6 1e movzbl (%esi),%ebx - d4d: 84 db test %bl,%bl - d4f: 0f 84 ab 01 00 00 je f00 - d55: 83 c6 01 add $0x1,%esi + cdc: 8b 75 0c mov 0xc(%ebp),%esi + cdf: 0f b6 1e movzbl (%esi),%ebx + ce2: 84 db test %bl,%bl + ce4: 0f 84 9f 01 00 00 je e89 + cea: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - d58: 8d 45 10 lea 0x10(%ebp),%eax - d5b: 89 45 d4 mov %eax,-0x2c(%ebp) + ced: 8d 45 10 lea 0x10(%ebp),%eax + cf0: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - d5e: bf 00 00 00 00 mov $0x0,%edi - d63: eb 2d jmp d92 + cf3: bf 00 00 00 00 mov $0x0,%edi + cf8: eb 2d jmp d27 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - d65: 88 5d e7 mov %bl,-0x19(%ebp) + cfa: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - d68: 83 ec 04 sub $0x4,%esp - d6b: 6a 01 push $0x1 - d6d: 8d 45 e7 lea -0x19(%ebp),%eax - d70: 50 push %eax - d71: ff 75 08 pushl 0x8(%ebp) - d74: e8 9d fe ff ff call c16 + cfd: 83 ec 04 sub $0x4,%esp + d00: 6a 01 push $0x1 + d02: 8d 45 e7 lea -0x19(%ebp),%eax + d05: 50 push %eax + d06: ff 75 08 push 0x8(%ebp) + d09: e8 9d fe ff ff call bab putc(fd, c); - d79: 83 c4 10 add $0x10,%esp - d7c: eb 05 jmp d83 + d0e: 83 c4 10 add $0x10,%esp + d11: eb 05 jmp d18 } } else if(state == '%'){ - d7e: 83 ff 25 cmp $0x25,%edi - d81: 74 22 je da5 + d13: 83 ff 25 cmp $0x25,%edi + d16: 74 1f je d37 for(i = 0; fmt[i]; i++){ - d83: 83 c6 01 add $0x1,%esi - d86: 0f b6 5e ff movzbl -0x1(%esi),%ebx - d8a: 84 db test %bl,%bl - d8c: 0f 84 6e 01 00 00 je f00 + d18: 83 c6 01 add $0x1,%esi + d1b: 0f b6 5e ff movzbl -0x1(%esi),%ebx + d1f: 84 db test %bl,%bl + d21: 0f 84 62 01 00 00 je e89 c = fmt[i] & 0xff; - d92: 0f be d3 movsbl %bl,%edx - d95: 0f b6 c3 movzbl %bl,%eax + d27: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - d98: 85 ff test %edi,%edi - d9a: 75 e2 jne d7e + d2a: 85 ff test %edi,%edi + d2c: 75 e5 jne d13 if(c == '%'){ - d9c: 83 f8 25 cmp $0x25,%eax - d9f: 75 c4 jne d65 + d2e: 83 f8 25 cmp $0x25,%eax + d31: 75 c7 jne cfa state = '%'; - da1: 89 c7 mov %eax,%edi - da3: eb de jmp d83 + d33: 89 c7 mov %eax,%edi + d35: eb e1 jmp d18 if(c == 'd'){ - da5: 83 f8 64 cmp $0x64,%eax - da8: 74 59 je e03 + d37: 83 f8 25 cmp $0x25,%eax + d3a: 0f 84 f2 00 00 00 je e32 + d40: 8d 50 9d lea -0x63(%eax),%edx + d43: 83 fa 15 cmp $0x15,%edx + d46: 0f 87 07 01 00 00 ja e53 + d4c: 0f 87 01 01 00 00 ja e53 + d52: ff 24 95 bc 10 00 00 jmp *0x10bc(,%edx,4) printint(fd, *ap, 10, 1); + d59: 83 ec 0c sub $0xc,%esp + d5c: 6a 01 push $0x1 + d5e: b9 0a 00 00 00 mov $0xa,%ecx + d63: 8b 7d d4 mov -0x2c(%ebp),%edi + d66: 8b 17 mov (%edi),%edx + d68: 8b 45 08 mov 0x8(%ebp),%eax + d6b: e8 cb fe ff ff call c3b ap++; - } else if(c == 'x' || c == 'p'){ - daa: 81 e2 f7 00 00 00 and $0xf7,%edx - db0: 83 fa 70 cmp $0x70,%edx - db3: 74 7a je e2f - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - db5: 83 f8 73 cmp $0x73,%eax - db8: 0f 84 9d 00 00 00 je e5b - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - dbe: 83 f8 63 cmp $0x63,%eax - dc1: 0f 84 ec 00 00 00 je eb3 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - dc7: 83 f8 25 cmp $0x25,%eax - dca: 0f 84 0f 01 00 00 je edf - putc(fd, c); + d70: 89 f8 mov %edi,%eax + d72: 83 c0 04 add $0x4,%eax + d75: 89 45 d4 mov %eax,-0x2c(%ebp) + d78: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - dd0: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - dd4: 83 ec 04 sub $0x4,%esp - dd7: 6a 01 push $0x1 - dd9: 8d 45 e7 lea -0x19(%ebp),%eax - ddc: 50 push %eax - ddd: ff 75 08 pushl 0x8(%ebp) - de0: e8 31 fe ff ff call c16 - putc(fd, c); - de5: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - de8: 83 c4 0c add $0xc,%esp - deb: 6a 01 push $0x1 - ded: 8d 45 e7 lea -0x19(%ebp),%eax - df0: 50 push %eax - df1: ff 75 08 pushl 0x8(%ebp) - df4: e8 1d fe ff ff call c16 putc(fd, c); - df9: 83 c4 10 add $0x10,%esp } state = 0; - dfc: bf 00 00 00 00 mov $0x0,%edi - e01: eb 80 jmp d83 - printint(fd, *ap, 10, 1); - e03: 83 ec 0c sub $0xc,%esp - e06: 6a 01 push $0x1 - e08: b9 0a 00 00 00 mov $0xa,%ecx - e0d: 8b 7d d4 mov -0x2c(%ebp),%edi - e10: 8b 17 mov (%edi),%edx - e12: 8b 45 08 mov 0x8(%ebp),%eax - e15: e8 8c fe ff ff call ca6 - ap++; - e1a: 89 f8 mov %edi,%eax - e1c: 83 c0 04 add $0x4,%eax - e1f: 89 45 d4 mov %eax,-0x2c(%ebp) - e22: 83 c4 10 add $0x10,%esp - state = 0; - e25: bf 00 00 00 00 mov $0x0,%edi - e2a: e9 54 ff ff ff jmp d83 + d7b: bf 00 00 00 00 mov $0x0,%edi + d80: eb 96 jmp d18 printint(fd, *ap, 16, 0); - e2f: 83 ec 0c sub $0xc,%esp - e32: 6a 00 push $0x0 - e34: b9 10 00 00 00 mov $0x10,%ecx - e39: 8b 7d d4 mov -0x2c(%ebp),%edi - e3c: 8b 17 mov (%edi),%edx - e3e: 8b 45 08 mov 0x8(%ebp),%eax - e41: e8 60 fe ff ff call ca6 + d82: 83 ec 0c sub $0xc,%esp + d85: 6a 00 push $0x0 + d87: b9 10 00 00 00 mov $0x10,%ecx + d8c: 8b 7d d4 mov -0x2c(%ebp),%edi + d8f: 8b 17 mov (%edi),%edx + d91: 8b 45 08 mov 0x8(%ebp),%eax + d94: e8 a2 fe ff ff call c3b ap++; - e46: 89 f8 mov %edi,%eax - e48: 83 c0 04 add $0x4,%eax - e4b: 89 45 d4 mov %eax,-0x2c(%ebp) - e4e: 83 c4 10 add $0x10,%esp + d99: 89 f8 mov %edi,%eax + d9b: 83 c0 04 add $0x4,%eax + d9e: 89 45 d4 mov %eax,-0x2c(%ebp) + da1: 83 c4 10 add $0x10,%esp state = 0; - e51: bf 00 00 00 00 mov $0x0,%edi - e56: e9 28 ff ff ff jmp d83 + da4: bf 00 00 00 00 mov $0x0,%edi + da9: e9 6a ff ff ff jmp d18 s = (char*)*ap; - e5b: 8b 4d d4 mov -0x2c(%ebp),%ecx - e5e: 8b 01 mov (%ecx),%eax + dae: 8b 4d d4 mov -0x2c(%ebp),%ecx + db1: 8b 01 mov (%ecx),%eax ap++; - e60: 83 c1 04 add $0x4,%ecx - e63: 89 4d d4 mov %ecx,-0x2c(%ebp) + db3: 83 c1 04 add $0x4,%ecx + db6: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - e66: 85 c0 test %eax,%eax - e68: 74 13 je e7d + db9: 85 c0 test %eax,%eax + dbb: 74 13 je dd0 s = (char*)*ap; - e6a: 89 c3 mov %eax,%ebx + dbd: 89 c3 mov %eax,%ebx while(*s != 0){ - e6c: 0f b6 00 movzbl (%eax),%eax + dbf: 0f b6 00 movzbl (%eax),%eax state = 0; - e6f: bf 00 00 00 00 mov $0x0,%edi + dc2: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - e74: 84 c0 test %al,%al - e76: 75 0f jne e87 - e78: e9 06 ff ff ff jmp d83 + dc7: 84 c0 test %al,%al + dc9: 75 0f jne dda + dcb: e9 48 ff ff ff jmp d18 s = "(null)"; - e7d: bb 3c 11 00 00 mov $0x113c,%ebx + dd0: bb b4 10 00 00 mov $0x10b4,%ebx while(*s != 0){ - e82: b8 28 00 00 00 mov $0x28,%eax - e87: 8b 7d 08 mov 0x8(%ebp),%edi + dd5: b8 28 00 00 00 mov $0x28,%eax + dda: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - e8a: 88 45 e7 mov %al,-0x19(%ebp) + ddd: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - e8d: 83 ec 04 sub $0x4,%esp - e90: 6a 01 push $0x1 - e92: 8d 45 e7 lea -0x19(%ebp),%eax - e95: 50 push %eax - e96: 57 push %edi - e97: e8 7a fd ff ff call c16 + de0: 83 ec 04 sub $0x4,%esp + de3: 6a 01 push $0x1 + de5: 8d 45 e7 lea -0x19(%ebp),%eax + de8: 50 push %eax + de9: 57 push %edi + dea: e8 bc fd ff ff call bab s++; - e9c: 83 c3 01 add $0x1,%ebx + def: 83 c3 01 add $0x1,%ebx while(*s != 0){ - e9f: 0f b6 03 movzbl (%ebx),%eax - ea2: 83 c4 10 add $0x10,%esp - ea5: 84 c0 test %al,%al - ea7: 75 e1 jne e8a + df2: 0f b6 03 movzbl (%ebx),%eax + df5: 83 c4 10 add $0x10,%esp + df8: 84 c0 test %al,%al + dfa: 75 e1 jne ddd state = 0; - ea9: bf 00 00 00 00 mov $0x0,%edi - eae: e9 d0 fe ff ff jmp d83 + dfc: bf 00 00 00 00 mov $0x0,%edi + e01: e9 12 ff ff ff jmp d18 putc(fd, *ap); - eb3: 8b 7d d4 mov -0x2c(%ebp),%edi - eb6: 8b 07 mov (%edi),%eax - eb8: 88 45 e7 mov %al,-0x19(%ebp) + e06: 8b 7d d4 mov -0x2c(%ebp),%edi + e09: 8b 07 mov (%edi),%eax + e0b: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - ebb: 83 ec 04 sub $0x4,%esp - ebe: 6a 01 push $0x1 - ec0: 8d 45 e7 lea -0x19(%ebp),%eax - ec3: 50 push %eax - ec4: ff 75 08 pushl 0x8(%ebp) - ec7: e8 4a fd ff ff call c16 + e0e: 83 ec 04 sub $0x4,%esp + e11: 6a 01 push $0x1 + e13: 8d 45 e7 lea -0x19(%ebp),%eax + e16: 50 push %eax + e17: ff 75 08 push 0x8(%ebp) + e1a: e8 8c fd ff ff call bab ap++; - ecc: 83 c7 04 add $0x4,%edi - ecf: 89 7d d4 mov %edi,-0x2c(%ebp) - ed2: 83 c4 10 add $0x10,%esp + e1f: 83 c7 04 add $0x4,%edi + e22: 89 7d d4 mov %edi,-0x2c(%ebp) + e25: 83 c4 10 add $0x10,%esp state = 0; - ed5: bf 00 00 00 00 mov $0x0,%edi - eda: e9 a4 fe ff ff jmp d83 + e28: bf 00 00 00 00 mov $0x0,%edi + e2d: e9 e6 fe ff ff jmp d18 putc(fd, c); - edf: 88 5d e7 mov %bl,-0x19(%ebp) + e32: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - ee2: 83 ec 04 sub $0x4,%esp - ee5: 6a 01 push $0x1 - ee7: 8d 45 e7 lea -0x19(%ebp),%eax - eea: 50 push %eax - eeb: ff 75 08 pushl 0x8(%ebp) - eee: e8 23 fd ff ff call c16 - ef3: 83 c4 10 add $0x10,%esp + e35: 83 ec 04 sub $0x4,%esp + e38: 6a 01 push $0x1 + e3a: 8d 45 e7 lea -0x19(%ebp),%eax + e3d: 50 push %eax + e3e: ff 75 08 push 0x8(%ebp) + e41: e8 65 fd ff ff call bab + e46: 83 c4 10 add $0x10,%esp + state = 0; + e49: bf 00 00 00 00 mov $0x0,%edi + e4e: e9 c5 fe ff ff jmp d18 + putc(fd, '%'); + e53: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + e57: 83 ec 04 sub $0x4,%esp + e5a: 6a 01 push $0x1 + e5c: 8d 45 e7 lea -0x19(%ebp),%eax + e5f: 50 push %eax + e60: ff 75 08 push 0x8(%ebp) + e63: e8 43 fd ff ff call bab + putc(fd, c); + e68: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + e6b: 83 c4 0c add $0xc,%esp + e6e: 6a 01 push $0x1 + e70: 8d 45 e7 lea -0x19(%ebp),%eax + e73: 50 push %eax + e74: ff 75 08 push 0x8(%ebp) + e77: e8 2f fd ff ff call bab + putc(fd, c); + e7c: 83 c4 10 add $0x10,%esp state = 0; - ef6: bf 00 00 00 00 mov $0x0,%edi - efb: e9 83 fe ff ff jmp d83 + e7f: bf 00 00 00 00 mov $0x0,%edi + e84: e9 8f fe ff ff jmp d18 } } } - f00: 8d 65 f4 lea -0xc(%ebp),%esp - f03: 5b pop %ebx - f04: 5e pop %esi - f05: 5f pop %edi - f06: 5d pop %ebp - f07: c3 ret - -00000f08 : + e89: 8d 65 f4 lea -0xc(%ebp),%esp + e8c: 5b pop %ebx + e8d: 5e pop %esi + e8e: 5f pop %edi + e8f: 5d pop %ebp + e90: c3 ret + +00000e91 : static Header base; static Header *freep; void free(void *ap) { - f08: f3 0f 1e fb endbr32 - f0c: 55 push %ebp - f0d: 89 e5 mov %esp,%ebp - f0f: 57 push %edi - f10: 56 push %esi - f11: 53 push %ebx - f12: 8b 5d 08 mov 0x8(%ebp),%ebx + e91: 55 push %ebp + e92: 89 e5 mov %esp,%ebp + e94: 57 push %edi + e95: 56 push %esi + e96: 53 push %ebx + e97: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - f15: 8d 4b f8 lea -0x8(%ebx),%ecx + e9a: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - f18: a1 04 17 00 00 mov 0x1704,%eax - f1d: eb 0c jmp f2b + e9d: a1 e4 16 00 00 mov 0x16e4,%eax + ea2: eb 0c jmp eb0 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - f1f: 8b 10 mov (%eax),%edx - f21: 39 c2 cmp %eax,%edx - f23: 77 04 ja f29 - f25: 39 ca cmp %ecx,%edx - f27: 77 10 ja f39 + ea4: 8b 10 mov (%eax),%edx + ea6: 39 c2 cmp %eax,%edx + ea8: 77 04 ja eae + eaa: 39 ca cmp %ecx,%edx + eac: 77 10 ja ebe { - f29: 89 d0 mov %edx,%eax + eae: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - f2b: 39 c8 cmp %ecx,%eax - f2d: 73 f0 jae f1f - f2f: 8b 10 mov (%eax),%edx - f31: 39 ca cmp %ecx,%edx - f33: 77 04 ja f39 + eb0: 39 c8 cmp %ecx,%eax + eb2: 73 f0 jae ea4 + eb4: 8b 10 mov (%eax),%edx + eb6: 39 ca cmp %ecx,%edx + eb8: 77 04 ja ebe if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - f35: 39 c2 cmp %eax,%edx - f37: 77 f0 ja f29 + eba: 39 c2 cmp %eax,%edx + ebc: 77 f0 ja eae break; if(bp + bp->s.size == p->s.ptr){ - f39: 8b 73 fc mov -0x4(%ebx),%esi - f3c: 8b 10 mov (%eax),%edx - f3e: 8d 3c f1 lea (%ecx,%esi,8),%edi - f41: 39 fa cmp %edi,%edx - f43: 74 19 je f5e + ebe: 8b 73 fc mov -0x4(%ebx),%esi + ec1: 8b 10 mov (%eax),%edx + ec3: 8d 3c f1 lea (%ecx,%esi,8),%edi + ec6: 39 fa cmp %edi,%edx + ec8: 74 19 je ee3 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + eca: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - f45: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - f48: 8b 50 04 mov 0x4(%eax),%edx - f4b: 8d 34 d0 lea (%eax,%edx,8),%esi - f4e: 39 f1 cmp %esi,%ecx - f50: 74 1b je f6d + ecd: 8b 50 04 mov 0x4(%eax),%edx + ed0: 8d 34 d0 lea (%eax,%edx,8),%esi + ed3: 39 f1 cmp %esi,%ecx + ed5: 74 18 je eef p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + ed7: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - f52: 89 08 mov %ecx,(%eax) freep = p; - f54: a3 04 17 00 00 mov %eax,0x1704 + ed9: a3 e4 16 00 00 mov %eax,0x16e4 } - f59: 5b pop %ebx - f5a: 5e pop %esi - f5b: 5f pop %edi - f5c: 5d pop %ebp - f5d: c3 ret + ede: 5b pop %ebx + edf: 5e pop %esi + ee0: 5f pop %edi + ee1: 5d pop %ebp + ee2: c3 ret bp->s.size += p->s.ptr->s.size; - f5e: 03 72 04 add 0x4(%edx),%esi - f61: 89 73 fc mov %esi,-0x4(%ebx) + ee3: 03 72 04 add 0x4(%edx),%esi + ee6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - f64: 8b 10 mov (%eax),%edx - f66: 8b 12 mov (%edx),%edx - f68: 89 53 f8 mov %edx,-0x8(%ebx) - f6b: eb db jmp f48 + ee9: 8b 10 mov (%eax),%edx + eeb: 8b 12 mov (%edx),%edx + eed: eb db jmp eca p->s.size += bp->s.size; - f6d: 03 53 fc add -0x4(%ebx),%edx - f70: 89 50 04 mov %edx,0x4(%eax) + eef: 03 53 fc add -0x4(%ebx),%edx + ef2: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - f73: 8b 53 f8 mov -0x8(%ebx),%edx - f76: 89 10 mov %edx,(%eax) - f78: eb da jmp f54 + ef5: 8b 4b f8 mov -0x8(%ebx),%ecx + ef8: eb dd jmp ed7 -00000f7a : +00000efa : return freep; } void* malloc(uint nbytes) { - f7a: f3 0f 1e fb endbr32 - f7e: 55 push %ebp - f7f: 89 e5 mov %esp,%ebp - f81: 57 push %edi - f82: 56 push %esi - f83: 53 push %ebx - f84: 83 ec 0c sub $0xc,%esp + efa: 55 push %ebp + efb: 89 e5 mov %esp,%ebp + efd: 57 push %edi + efe: 56 push %esi + eff: 53 push %ebx + f00: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - f87: 8b 45 08 mov 0x8(%ebp),%eax - f8a: 8d 58 07 lea 0x7(%eax),%ebx - f8d: c1 eb 03 shr $0x3,%ebx - f90: 83 c3 01 add $0x1,%ebx + f03: 8b 45 08 mov 0x8(%ebp),%eax + f06: 8d 58 07 lea 0x7(%eax),%ebx + f09: c1 eb 03 shr $0x3,%ebx + f0c: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - f93: 8b 15 04 17 00 00 mov 0x1704,%edx - f99: 85 d2 test %edx,%edx - f9b: 74 20 je fbd + f0f: 8b 15 e4 16 00 00 mov 0x16e4,%edx + f15: 85 d2 test %edx,%edx + f17: 74 1c je f35 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - f9d: 8b 02 mov (%edx),%eax + f19: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - f9f: 8b 48 04 mov 0x4(%eax),%ecx - fa2: 39 cb cmp %ecx,%ebx - fa4: 76 3c jbe fe2 - fa6: 81 fb 00 10 00 00 cmp $0x1000,%ebx - fac: be 00 10 00 00 mov $0x1000,%esi - fb1: 0f 43 f3 cmovae %ebx,%esi + f1b: 8b 48 04 mov 0x4(%eax),%ecx + f1e: 39 cb cmp %ecx,%ebx + f20: 76 38 jbe f5a + f22: be 00 10 00 00 mov $0x1000,%esi + f27: 39 f3 cmp %esi,%ebx + f29: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - fb4: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - fbb: eb 72 jmp 102f + f2c: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + f33: eb 72 jmp fa7 base.s.ptr = freep = prevp = &base; - fbd: c7 05 04 17 00 00 08 movl $0x1708,0x1704 - fc4: 17 00 00 - fc7: c7 05 08 17 00 00 08 movl $0x1708,0x1708 - fce: 17 00 00 + f35: c7 05 e4 16 00 00 e8 movl $0x16e8,0x16e4 + f3c: 16 00 00 + f3f: c7 05 e8 16 00 00 e8 movl $0x16e8,0x16e8 + f46: 16 00 00 base.s.size = 0; - fd1: c7 05 0c 17 00 00 00 movl $0x0,0x170c - fd8: 00 00 00 + f49: c7 05 ec 16 00 00 00 movl $0x0,0x16ec + f50: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - fdb: b8 08 17 00 00 mov $0x1708,%eax - fe0: eb c4 jmp fa6 + f53: b8 e8 16 00 00 mov $0x16e8,%eax + f58: eb c8 jmp f22 if(p->s.size == nunits) - fe2: 39 cb cmp %ecx,%ebx - fe4: 74 1e je 1004 + f5a: 39 cb cmp %ecx,%ebx + f5c: 74 1e je f7c prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - fe6: 29 d9 sub %ebx,%ecx - fe8: 89 48 04 mov %ecx,0x4(%eax) + f5e: 29 d9 sub %ebx,%ecx + f60: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - feb: 8d 04 c8 lea (%eax,%ecx,8),%eax + f63: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - fee: 89 58 04 mov %ebx,0x4(%eax) + f66: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - ff1: 89 15 04 17 00 00 mov %edx,0x1704 + f69: 89 15 e4 16 00 00 mov %edx,0x16e4 return (void*)(p + 1); - ff7: 8d 50 08 lea 0x8(%eax),%edx + f6f: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - ffa: 89 d0 mov %edx,%eax - ffc: 8d 65 f4 lea -0xc(%ebp),%esp - fff: 5b pop %ebx - 1000: 5e pop %esi - 1001: 5f pop %edi - 1002: 5d pop %ebp - 1003: c3 ret + f72: 89 d0 mov %edx,%eax + f74: 8d 65 f4 lea -0xc(%ebp),%esp + f77: 5b pop %ebx + f78: 5e pop %esi + f79: 5f pop %edi + f7a: 5d pop %ebp + f7b: c3 ret prevp->s.ptr = p->s.ptr; - 1004: 8b 08 mov (%eax),%ecx - 1006: 89 0a mov %ecx,(%edx) - 1008: eb e7 jmp ff1 + f7c: 8b 08 mov (%eax),%ecx + f7e: 89 0a mov %ecx,(%edx) + f80: eb e7 jmp f69 hp->s.size = nu; - 100a: 89 70 04 mov %esi,0x4(%eax) + f82: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 100d: 83 ec 0c sub $0xc,%esp - 1010: 83 c0 08 add $0x8,%eax - 1013: 50 push %eax - 1014: e8 ef fe ff ff call f08 + f85: 83 ec 0c sub $0xc,%esp + f88: 83 c0 08 add $0x8,%eax + f8b: 50 push %eax + f8c: e8 00 ff ff ff call e91 return freep; - 1019: 8b 15 04 17 00 00 mov 0x1704,%edx + f91: 8b 15 e4 16 00 00 mov 0x16e4,%edx if((p = morecore(nunits)) == 0) - 101f: 83 c4 10 add $0x10,%esp - 1022: 85 d2 test %edx,%edx - 1024: 74 d4 je ffa + f97: 83 c4 10 add $0x10,%esp + f9a: 85 d2 test %edx,%edx + f9c: 74 d4 je f72 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 1026: 8b 02 mov (%edx),%eax + f9e: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 1028: 8b 48 04 mov 0x4(%eax),%ecx - 102b: 39 d9 cmp %ebx,%ecx - 102d: 73 b3 jae fe2 + fa0: 8b 48 04 mov 0x4(%eax),%ecx + fa3: 39 d9 cmp %ebx,%ecx + fa5: 73 b3 jae f5a if(p == freep) - 102f: 89 c2 mov %eax,%edx - 1031: 39 05 04 17 00 00 cmp %eax,0x1704 - 1037: 75 ed jne 1026 + fa7: 89 c2 mov %eax,%edx + fa9: 39 05 e4 16 00 00 cmp %eax,0x16e4 + faf: 75 ed jne f9e p = sbrk(nu * sizeof(Header)); - 1039: 83 ec 0c sub $0xc,%esp - 103c: 57 push %edi - 103d: e8 3c fc ff ff call c7e + fb1: 83 ec 0c sub $0xc,%esp + fb4: 57 push %edi + fb5: e8 59 fc ff ff call c13 if(p == (char*)-1) - 1042: 83 c4 10 add $0x10,%esp - 1045: 83 f8 ff cmp $0xffffffff,%eax - 1048: 75 c0 jne 100a + fba: 83 c4 10 add $0x10,%esp + fbd: 83 f8 ff cmp $0xffffffff,%eax + fc0: 75 c0 jne f82 return 0; - 104a: ba 00 00 00 00 mov $0x0,%edx - 104f: eb a9 jmp ffa + fc2: ba 00 00 00 00 mov $0x0,%edx + fc7: eb a9 jmp f72 diff --git a/src/user/sh.d b/src/user/sh.d new file mode 100644 index 0000000..642e9ce --- /dev/null +++ b/src/user/sh.d @@ -0,0 +1 @@ +user/sh.o: user/sh.c /usr/include/stdc-predef.h types.h user.h fcntl.h diff --git a/src/user/sh.o b/src/user/sh.o new file mode 100644 index 0000000..94827b4 Binary files /dev/null and b/src/user/sh.o differ diff --git a/src/user/sh.sym b/src/user/sh.sym index b059fc1..14fd4d2 100644 --- a/src/user/sh.sym +++ b/src/user/sh.sym @@ -1,81 +1,68 @@ -00000000 .text -00001054 .rodata -00001158 .eh_frame -00001684 .data -000016a0 .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 -000016a0 buf.1127 +00001680 buf.0 00000000 ulib.c 00000000 printf.c -00000ca6 printint -00001144 digits.1089 +00000c3b printint +00001114 digits.0 00000000 umalloc.c -00001704 freep -00001708 base -00000a10 strcpy -00000d3a printf -00000bbd memmove -00000c3e mknod -00000234 execcmd -00000c9e ps -00000adb gets -00000c76 getpid -000006ab parsepipe -000008c9 parsecmd -00000322 backcmd -0000047d peek -000004e9 parseredirs -00000356 gettoken -00000f7a malloc -00000c86 sleep -0000168c whitespace -00000067 fork1 -0000082d nulterminate -00000c06 pipe -00000c96 slabtest +000016e4 freep +000016e8 base +000009c3 strcpy +00000cd3 printf +00000b56 memmove +00000bd3 mknod +0000021d execcmd +00000c33 ps +00000a7e gets +00000c0b getpid +00000677 parsepipe +00000884 parsecmd +000002fb backcmd +00000454 peek +000004be parseredirs +0000032b gettoken +00000efa malloc +00000c1b sleep +0000165c whitespace +00000059 fork1 +000007ed nulterminate +00000b9b pipe +00000c2b slabtest 00000000 getcmd -00000c16 write -00000c4e fstat -00000c26 kill -00000c66 chdir -0000070d parseline -0000008a runcmd -000007a2 parseblock -00000c2e exec -00000bfe wait -00001684 symbols -00000c0e read -000005bd parseexec -00000c46 unlink -00000049 panic -00000bee fork -00000c7e sbrk -00000c8e uptime -00001692 __bss_start -00000a8f memset -00000939 main -00000a36 strcmp -00000c6e dup -000002ae pipecmd -00000262 redircmd -00000b36 stat -00001692 _edata -00001710 _end -00000c56 link -00000bf6 exit -00000b7e atoi -00000a65 strlen -00000c36 open -00000aaa strchr -00000c5e mkdir -00000c1e close -000002e8 listcmd -00000f08 free +00000bab write +00000be3 fstat +00000bbb kill +00000bfb chdir +000006d5 parseline +00000078 runcmd +00000766 parseblock +00000bc3 exec +00000b93 wait +00001654 symbols +00000ba3 read +0000058e parseexec +00000bdb unlink +0000003f panic +00000b83 fork +00000c13 sbrk +00000c23 uptime +00001662 __bss_start +00000a38 memset +000008f0 main +000009e7 strcmp +00000c03 dup +0000028f pipecmd +00000247 redircmd +00000ad5 stat +00001662 _edata +000016f0 _end +00000beb link +00000b8b exit +00000b19 atoi +00000a12 strlen +00000bcb open +00000a51 strchr +00000bf3 mkdir +00000bb3 close +000002c5 listcmd +00000e91 free diff --git a/src/user/slabtest.asm b/src/user/slabtest.asm index e18b4fb..0ed3c19 100644 --- a/src/user/slabtest.asm +++ b/src/user/slabtest.asm @@ -11,1029 +11,998 @@ Disassembly of section .text: int main(int argc, char **argv) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 83 e4 f0 and $0xfffffff0,%esp + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 e4 f0 and $0xfffffff0,%esp slabtest(); - a: e8 8b 02 00 00 call 29a + 6: e8 6d 02 00 00 call 278 exit(); - f: e8 e6 01 00 00 call 1fa + b: e8 c8 01 00 00 call 1d8 -00000014 : +00000010 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 14: f3 0f 1e fb endbr32 - 18: 55 push %ebp - 19: 89 e5 mov %esp,%ebp - 1b: 53 push %ebx - 1c: 8b 4d 08 mov 0x8(%ebp),%ecx - 1f: 8b 5d 0c mov 0xc(%ebp),%ebx + 10: 55 push %ebp + 11: 89 e5 mov %esp,%ebp + 13: 53 push %ebx + 14: 8b 4d 08 mov 0x8(%ebp),%ecx + 17: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 22: b8 00 00 00 00 mov $0x0,%eax - 27: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 2b: 88 14 01 mov %dl,(%ecx,%eax,1) - 2e: 83 c0 01 add $0x1,%eax - 31: 84 d2 test %dl,%dl - 33: 75 f2 jne 27 + 1a: b8 00 00 00 00 mov $0x0,%eax + 1f: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 23: 88 14 01 mov %dl,(%ecx,%eax,1) + 26: 83 c0 01 add $0x1,%eax + 29: 84 d2 test %dl,%dl + 2b: 75 f2 jne 1f ; return os; } - 35: 89 c8 mov %ecx,%eax - 37: 5b pop %ebx - 38: 5d pop %ebp - 39: c3 ret + 2d: 89 c8 mov %ecx,%eax + 2f: 8b 5d fc mov -0x4(%ebp),%ebx + 32: c9 leave + 33: c3 ret -0000003a : +00000034 : int strcmp(const char *p, const char *q) { - 3a: f3 0f 1e fb endbr32 - 3e: 55 push %ebp - 3f: 89 e5 mov %esp,%ebp - 41: 8b 4d 08 mov 0x8(%ebp),%ecx - 44: 8b 55 0c mov 0xc(%ebp),%edx + 34: 55 push %ebp + 35: 89 e5 mov %esp,%ebp + 37: 8b 4d 08 mov 0x8(%ebp),%ecx + 3a: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 47: 0f b6 01 movzbl (%ecx),%eax - 4a: 84 c0 test %al,%al - 4c: 74 11 je 5f - 4e: 38 02 cmp %al,(%edx) - 50: 75 0d jne 5f + 3d: 0f b6 01 movzbl (%ecx),%eax + 40: 84 c0 test %al,%al + 42: 74 11 je 55 + 44: 38 02 cmp %al,(%edx) + 46: 75 0d jne 55 p++, q++; - 52: 83 c1 01 add $0x1,%ecx - 55: 83 c2 01 add $0x1,%edx + 48: 83 c1 01 add $0x1,%ecx + 4b: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 58: 0f b6 01 movzbl (%ecx),%eax - 5b: 84 c0 test %al,%al - 5d: 75 ef jne 4e + 4e: 0f b6 01 movzbl (%ecx),%eax + 51: 84 c0 test %al,%al + 53: 75 ef jne 44 return (uchar)*p - (uchar)*q; - 5f: 0f b6 c0 movzbl %al,%eax - 62: 0f b6 12 movzbl (%edx),%edx - 65: 29 d0 sub %edx,%eax + 55: 0f b6 c0 movzbl %al,%eax + 58: 0f b6 12 movzbl (%edx),%edx + 5b: 29 d0 sub %edx,%eax } - 67: 5d pop %ebp - 68: c3 ret + 5d: 5d pop %ebp + 5e: c3 ret -00000069 : +0000005f : uint strlen(const char *s) { - 69: f3 0f 1e fb endbr32 - 6d: 55 push %ebp - 6e: 89 e5 mov %esp,%ebp - 70: 8b 55 08 mov 0x8(%ebp),%edx + 5f: 55 push %ebp + 60: 89 e5 mov %esp,%ebp + 62: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 73: 80 3a 00 cmpb $0x0,(%edx) - 76: 74 14 je 8c - 78: b8 00 00 00 00 mov $0x0,%eax - 7d: 83 c0 01 add $0x1,%eax - 80: 89 c1 mov %eax,%ecx - 82: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 86: 75 f5 jne 7d + 65: 80 3a 00 cmpb $0x0,(%edx) + 68: 74 14 je 7e + 6a: b8 00 00 00 00 mov $0x0,%eax + 6f: 83 c0 01 add $0x1,%eax + 72: 89 c1 mov %eax,%ecx + 74: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 78: 75 f5 jne 6f ; return n; } - 88: 89 c8 mov %ecx,%eax - 8a: 5d pop %ebp - 8b: c3 ret + 7a: 89 c8 mov %ecx,%eax + 7c: 5d pop %ebp + 7d: c3 ret for(n = 0; s[n]; n++) - 8c: b9 00 00 00 00 mov $0x0,%ecx + 7e: b9 00 00 00 00 mov $0x0,%ecx return n; - 91: eb f5 jmp 88 + 83: eb f5 jmp 7a -00000093 : +00000085 : void* memset(void *dst, int c, uint n) { - 93: f3 0f 1e fb endbr32 - 97: 55 push %ebp - 98: 89 e5 mov %esp,%ebp - 9a: 57 push %edi - 9b: 8b 55 08 mov 0x8(%ebp),%edx + 85: 55 push %ebp + 86: 89 e5 mov %esp,%ebp + 88: 57 push %edi + 89: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 9e: 89 d7 mov %edx,%edi - a0: 8b 4d 10 mov 0x10(%ebp),%ecx - a3: 8b 45 0c mov 0xc(%ebp),%eax - a6: fc cld - a7: f3 aa rep stos %al,%es:(%edi) + 8c: 89 d7 mov %edx,%edi + 8e: 8b 4d 10 mov 0x10(%ebp),%ecx + 91: 8b 45 0c mov 0xc(%ebp),%eax + 94: fc cld + 95: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - a9: 89 d0 mov %edx,%eax - ab: 5f pop %edi - ac: 5d pop %ebp - ad: c3 ret + 97: 89 d0 mov %edx,%eax + 99: 8b 7d fc mov -0x4(%ebp),%edi + 9c: c9 leave + 9d: c3 ret -000000ae : +0000009e : char* strchr(const char *s, char c) { - ae: f3 0f 1e fb endbr32 - b2: 55 push %ebp - b3: 89 e5 mov %esp,%ebp - b5: 8b 45 08 mov 0x8(%ebp),%eax - b8: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 9e: 55 push %ebp + 9f: 89 e5 mov %esp,%ebp + a1: 8b 45 08 mov 0x8(%ebp),%eax + a4: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - bc: 0f b6 10 movzbl (%eax),%edx - bf: 84 d2 test %dl,%dl - c1: 74 15 je d8 + a8: 0f b6 10 movzbl (%eax),%edx + ab: 84 d2 test %dl,%dl + ad: 74 15 je c4 if(*s == c) - c3: 38 d1 cmp %dl,%cl - c5: 74 0f je d6 + af: 38 d1 cmp %dl,%cl + b1: 74 0f je c2 for(; *s; s++) - c7: 83 c0 01 add $0x1,%eax - ca: 0f b6 10 movzbl (%eax),%edx - cd: 84 d2 test %dl,%dl - cf: 75 f2 jne c3 + b3: 83 c0 01 add $0x1,%eax + b6: 0f b6 10 movzbl (%eax),%edx + b9: 84 d2 test %dl,%dl + bb: 75 f2 jne af return (char*)s; return 0; - d1: b8 00 00 00 00 mov $0x0,%eax + bd: b8 00 00 00 00 mov $0x0,%eax } - d6: 5d pop %ebp - d7: c3 ret + c2: 5d pop %ebp + c3: c3 ret return 0; - d8: b8 00 00 00 00 mov $0x0,%eax - dd: eb f7 jmp d6 + c4: b8 00 00 00 00 mov $0x0,%eax + c9: eb f7 jmp c2 -000000df : +000000cb : char* gets(char *buf, int max) { - df: f3 0f 1e fb endbr32 - e3: 55 push %ebp - e4: 89 e5 mov %esp,%ebp - e6: 57 push %edi - e7: 56 push %esi - e8: 53 push %ebx - e9: 83 ec 2c sub $0x2c,%esp - ec: 8b 75 08 mov 0x8(%ebp),%esi + cb: 55 push %ebp + cc: 89 e5 mov %esp,%ebp + ce: 57 push %edi + cf: 56 push %esi + d0: 53 push %ebx + d1: 83 ec 2c sub $0x2c,%esp + d4: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - ef: bb 00 00 00 00 mov $0x0,%ebx + d7: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - f4: 8d 7d e7 lea -0x19(%ebp),%edi + dc: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - f7: 89 5d d4 mov %ebx,-0x2c(%ebp) - fa: 83 c3 01 add $0x1,%ebx - fd: 3b 5d 0c cmp 0xc(%ebp),%ebx - 100: 7d 27 jge 129 + df: 89 5d d4 mov %ebx,-0x2c(%ebp) + e2: 83 c3 01 add $0x1,%ebx + e5: 3b 5d 0c cmp 0xc(%ebp),%ebx + e8: 7d 27 jge 111 cc = read(0, &c, 1); - 102: 83 ec 04 sub $0x4,%esp - 105: 6a 01 push $0x1 - 107: 57 push %edi - 108: 6a 00 push $0x0 - 10a: e8 03 01 00 00 call 212 + ea: 83 ec 04 sub $0x4,%esp + ed: 6a 01 push $0x1 + ef: 57 push %edi + f0: 6a 00 push $0x0 + f2: e8 f9 00 00 00 call 1f0 if(cc < 1) - 10f: 83 c4 10 add $0x10,%esp - 112: 85 c0 test %eax,%eax - 114: 7e 13 jle 129 + f7: 83 c4 10 add $0x10,%esp + fa: 85 c0 test %eax,%eax + fc: 7e 13 jle 111 break; buf[i++] = c; - 116: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 11a: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + fe: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 102: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 11e: 3c 0a cmp $0xa,%al - 120: 74 04 je 126 - 122: 3c 0d cmp $0xd,%al - 124: 75 d1 jne f7 + 106: 3c 0a cmp $0xa,%al + 108: 74 04 je 10e + 10a: 3c 0d cmp $0xd,%al + 10c: 75 d1 jne df for(i=0; i+1 < max; ){ - 126: 89 5d d4 mov %ebx,-0x2c(%ebp) + 10e: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 129: 8b 45 d4 mov -0x2c(%ebp),%eax - 12c: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 111: 8b 45 d4 mov -0x2c(%ebp),%eax + 114: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 130: 89 f0 mov %esi,%eax - 132: 8d 65 f4 lea -0xc(%ebp),%esp - 135: 5b pop %ebx - 136: 5e pop %esi - 137: 5f pop %edi - 138: 5d pop %ebp - 139: c3 ret + 118: 89 f0 mov %esi,%eax + 11a: 8d 65 f4 lea -0xc(%ebp),%esp + 11d: 5b pop %ebx + 11e: 5e pop %esi + 11f: 5f pop %edi + 120: 5d pop %ebp + 121: c3 ret -0000013a : +00000122 : int stat(const char *n, struct stat *st) { - 13a: f3 0f 1e fb endbr32 - 13e: 55 push %ebp - 13f: 89 e5 mov %esp,%ebp - 141: 56 push %esi - 142: 53 push %ebx + 122: 55 push %ebp + 123: 89 e5 mov %esp,%ebp + 125: 56 push %esi + 126: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 143: 83 ec 08 sub $0x8,%esp - 146: 6a 00 push $0x0 - 148: ff 75 08 pushl 0x8(%ebp) - 14b: e8 ea 00 00 00 call 23a + 127: 83 ec 08 sub $0x8,%esp + 12a: 6a 00 push $0x0 + 12c: ff 75 08 push 0x8(%ebp) + 12f: e8 e4 00 00 00 call 218 if(fd < 0) - 150: 83 c4 10 add $0x10,%esp - 153: 85 c0 test %eax,%eax - 155: 78 24 js 17b - 157: 89 c3 mov %eax,%ebx + 134: 83 c4 10 add $0x10,%esp + 137: 85 c0 test %eax,%eax + 139: 78 24 js 15f + 13b: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 159: 83 ec 08 sub $0x8,%esp - 15c: ff 75 0c pushl 0xc(%ebp) - 15f: 50 push %eax - 160: e8 ed 00 00 00 call 252 - 165: 89 c6 mov %eax,%esi + 13d: 83 ec 08 sub $0x8,%esp + 140: ff 75 0c push 0xc(%ebp) + 143: 50 push %eax + 144: e8 e7 00 00 00 call 230 + 149: 89 c6 mov %eax,%esi close(fd); - 167: 89 1c 24 mov %ebx,(%esp) - 16a: e8 b3 00 00 00 call 222 + 14b: 89 1c 24 mov %ebx,(%esp) + 14e: e8 ad 00 00 00 call 200 return r; - 16f: 83 c4 10 add $0x10,%esp + 153: 83 c4 10 add $0x10,%esp } - 172: 89 f0 mov %esi,%eax - 174: 8d 65 f8 lea -0x8(%ebp),%esp - 177: 5b pop %ebx - 178: 5e pop %esi - 179: 5d pop %ebp - 17a: c3 ret + 156: 89 f0 mov %esi,%eax + 158: 8d 65 f8 lea -0x8(%ebp),%esp + 15b: 5b pop %ebx + 15c: 5e pop %esi + 15d: 5d pop %ebp + 15e: c3 ret return -1; - 17b: be ff ff ff ff mov $0xffffffff,%esi - 180: eb f0 jmp 172 + 15f: be ff ff ff ff mov $0xffffffff,%esi + 164: eb f0 jmp 156 -00000182 : +00000166 : int atoi(const char *s) { - 182: f3 0f 1e fb endbr32 - 186: 55 push %ebp - 187: 89 e5 mov %esp,%ebp - 189: 53 push %ebx - 18a: 8b 55 08 mov 0x8(%ebp),%edx + 166: 55 push %ebp + 167: 89 e5 mov %esp,%ebp + 169: 53 push %ebx + 16a: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 18d: 0f b6 02 movzbl (%edx),%eax - 190: 8d 48 d0 lea -0x30(%eax),%ecx - 193: 80 f9 09 cmp $0x9,%cl - 196: 77 22 ja 1ba + 16d: 0f b6 02 movzbl (%edx),%eax + 170: 8d 48 d0 lea -0x30(%eax),%ecx + 173: 80 f9 09 cmp $0x9,%cl + 176: 77 24 ja 19c n = 0; - 198: b9 00 00 00 00 mov $0x0,%ecx + 178: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 19d: 83 c2 01 add $0x1,%edx - 1a0: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 1a3: 0f be c0 movsbl %al,%eax - 1a6: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 17d: 83 c2 01 add $0x1,%edx + 180: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 183: 0f be c0 movsbl %al,%eax + 186: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 1aa: 0f b6 02 movzbl (%edx),%eax - 1ad: 8d 58 d0 lea -0x30(%eax),%ebx - 1b0: 80 fb 09 cmp $0x9,%bl - 1b3: 76 e8 jbe 19d + 18a: 0f b6 02 movzbl (%edx),%eax + 18d: 8d 58 d0 lea -0x30(%eax),%ebx + 190: 80 fb 09 cmp $0x9,%bl + 193: 76 e8 jbe 17d return n; } - 1b5: 89 c8 mov %ecx,%eax - 1b7: 5b pop %ebx - 1b8: 5d pop %ebp - 1b9: c3 ret + 195: 89 c8 mov %ecx,%eax + 197: 8b 5d fc mov -0x4(%ebp),%ebx + 19a: c9 leave + 19b: c3 ret n = 0; - 1ba: b9 00 00 00 00 mov $0x0,%ecx + 19c: b9 00 00 00 00 mov $0x0,%ecx return n; - 1bf: eb f4 jmp 1b5 + 1a1: eb f2 jmp 195 -000001c1 : +000001a3 : void* memmove(void *vdst, const void *vsrc, int n) { - 1c1: f3 0f 1e fb endbr32 - 1c5: 55 push %ebp - 1c6: 89 e5 mov %esp,%ebp - 1c8: 56 push %esi - 1c9: 53 push %ebx - 1ca: 8b 75 08 mov 0x8(%ebp),%esi - 1cd: 8b 55 0c mov 0xc(%ebp),%edx - 1d0: 8b 5d 10 mov 0x10(%ebp),%ebx + 1a3: 55 push %ebp + 1a4: 89 e5 mov %esp,%ebp + 1a6: 56 push %esi + 1a7: 53 push %ebx + 1a8: 8b 75 08 mov 0x8(%ebp),%esi + 1ab: 8b 55 0c mov 0xc(%ebp),%edx + 1ae: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 1d3: 85 db test %ebx,%ebx - 1d5: 7e 15 jle 1ec - 1d7: 01 f3 add %esi,%ebx + 1b1: 85 db test %ebx,%ebx + 1b3: 7e 15 jle 1ca + 1b5: 01 f3 add %esi,%ebx dst = vdst; - 1d9: 89 f0 mov %esi,%eax + 1b7: 89 f0 mov %esi,%eax *dst++ = *src++; - 1db: 83 c2 01 add $0x1,%edx - 1de: 83 c0 01 add $0x1,%eax - 1e1: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 1e5: 88 48 ff mov %cl,-0x1(%eax) + 1b9: 83 c2 01 add $0x1,%edx + 1bc: 83 c0 01 add $0x1,%eax + 1bf: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 1c3: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 1e8: 39 c3 cmp %eax,%ebx - 1ea: 75 ef jne 1db + 1c6: 39 c3 cmp %eax,%ebx + 1c8: 75 ef jne 1b9 return vdst; } - 1ec: 89 f0 mov %esi,%eax - 1ee: 5b pop %ebx - 1ef: 5e pop %esi - 1f0: 5d pop %ebp - 1f1: c3 ret + 1ca: 89 f0 mov %esi,%eax + 1cc: 5b pop %ebx + 1cd: 5e pop %esi + 1ce: 5d pop %ebp + 1cf: c3 ret -000001f2 : +000001d0 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 1f2: b8 01 00 00 00 mov $0x1,%eax - 1f7: cd 40 int $0x40 - 1f9: c3 ret + 1d0: b8 01 00 00 00 mov $0x1,%eax + 1d5: cd 40 int $0x40 + 1d7: c3 ret -000001fa : +000001d8 : SYSCALL(exit) - 1fa: b8 02 00 00 00 mov $0x2,%eax - 1ff: cd 40 int $0x40 - 201: c3 ret + 1d8: b8 02 00 00 00 mov $0x2,%eax + 1dd: cd 40 int $0x40 + 1df: c3 ret -00000202 : +000001e0 : SYSCALL(wait) - 202: b8 03 00 00 00 mov $0x3,%eax - 207: cd 40 int $0x40 - 209: c3 ret + 1e0: b8 03 00 00 00 mov $0x3,%eax + 1e5: cd 40 int $0x40 + 1e7: c3 ret -0000020a : +000001e8 : SYSCALL(pipe) - 20a: b8 04 00 00 00 mov $0x4,%eax - 20f: cd 40 int $0x40 - 211: c3 ret + 1e8: b8 04 00 00 00 mov $0x4,%eax + 1ed: cd 40 int $0x40 + 1ef: c3 ret -00000212 : +000001f0 : SYSCALL(read) - 212: b8 05 00 00 00 mov $0x5,%eax - 217: cd 40 int $0x40 - 219: c3 ret + 1f0: b8 05 00 00 00 mov $0x5,%eax + 1f5: cd 40 int $0x40 + 1f7: c3 ret -0000021a : +000001f8 : SYSCALL(write) - 21a: b8 10 00 00 00 mov $0x10,%eax - 21f: cd 40 int $0x40 - 221: c3 ret + 1f8: b8 10 00 00 00 mov $0x10,%eax + 1fd: cd 40 int $0x40 + 1ff: c3 ret -00000222 : +00000200 : SYSCALL(close) - 222: b8 15 00 00 00 mov $0x15,%eax - 227: cd 40 int $0x40 - 229: c3 ret + 200: b8 15 00 00 00 mov $0x15,%eax + 205: cd 40 int $0x40 + 207: c3 ret -0000022a : +00000208 : SYSCALL(kill) - 22a: b8 06 00 00 00 mov $0x6,%eax - 22f: cd 40 int $0x40 - 231: c3 ret + 208: b8 06 00 00 00 mov $0x6,%eax + 20d: cd 40 int $0x40 + 20f: c3 ret -00000232 : +00000210 : SYSCALL(exec) - 232: b8 07 00 00 00 mov $0x7,%eax - 237: cd 40 int $0x40 - 239: c3 ret + 210: b8 07 00 00 00 mov $0x7,%eax + 215: cd 40 int $0x40 + 217: c3 ret -0000023a : +00000218 : SYSCALL(open) - 23a: b8 0f 00 00 00 mov $0xf,%eax - 23f: cd 40 int $0x40 - 241: c3 ret + 218: b8 0f 00 00 00 mov $0xf,%eax + 21d: cd 40 int $0x40 + 21f: c3 ret -00000242 : +00000220 : SYSCALL(mknod) - 242: b8 11 00 00 00 mov $0x11,%eax - 247: cd 40 int $0x40 - 249: c3 ret + 220: b8 11 00 00 00 mov $0x11,%eax + 225: cd 40 int $0x40 + 227: c3 ret -0000024a : +00000228 : SYSCALL(unlink) - 24a: b8 12 00 00 00 mov $0x12,%eax - 24f: cd 40 int $0x40 - 251: c3 ret + 228: b8 12 00 00 00 mov $0x12,%eax + 22d: cd 40 int $0x40 + 22f: c3 ret -00000252 : +00000230 : SYSCALL(fstat) - 252: b8 08 00 00 00 mov $0x8,%eax - 257: cd 40 int $0x40 - 259: c3 ret + 230: b8 08 00 00 00 mov $0x8,%eax + 235: cd 40 int $0x40 + 237: c3 ret -0000025a : +00000238 : SYSCALL(link) - 25a: b8 13 00 00 00 mov $0x13,%eax - 25f: cd 40 int $0x40 - 261: c3 ret + 238: b8 13 00 00 00 mov $0x13,%eax + 23d: cd 40 int $0x40 + 23f: c3 ret -00000262 : +00000240 : SYSCALL(mkdir) - 262: b8 14 00 00 00 mov $0x14,%eax - 267: cd 40 int $0x40 - 269: c3 ret + 240: b8 14 00 00 00 mov $0x14,%eax + 245: cd 40 int $0x40 + 247: c3 ret -0000026a : +00000248 : SYSCALL(chdir) - 26a: b8 09 00 00 00 mov $0x9,%eax - 26f: cd 40 int $0x40 - 271: c3 ret + 248: b8 09 00 00 00 mov $0x9,%eax + 24d: cd 40 int $0x40 + 24f: c3 ret -00000272 : +00000250 : SYSCALL(dup) - 272: b8 0a 00 00 00 mov $0xa,%eax - 277: cd 40 int $0x40 - 279: c3 ret + 250: b8 0a 00 00 00 mov $0xa,%eax + 255: cd 40 int $0x40 + 257: c3 ret -0000027a : +00000258 : SYSCALL(getpid) - 27a: b8 0b 00 00 00 mov $0xb,%eax - 27f: cd 40 int $0x40 - 281: c3 ret + 258: b8 0b 00 00 00 mov $0xb,%eax + 25d: cd 40 int $0x40 + 25f: c3 ret -00000282 : +00000260 : SYSCALL(sbrk) - 282: b8 0c 00 00 00 mov $0xc,%eax - 287: cd 40 int $0x40 - 289: c3 ret + 260: b8 0c 00 00 00 mov $0xc,%eax + 265: cd 40 int $0x40 + 267: c3 ret -0000028a : +00000268 : SYSCALL(sleep) - 28a: b8 0d 00 00 00 mov $0xd,%eax - 28f: cd 40 int $0x40 - 291: c3 ret + 268: b8 0d 00 00 00 mov $0xd,%eax + 26d: cd 40 int $0x40 + 26f: c3 ret -00000292 : +00000270 : SYSCALL(uptime) - 292: b8 0e 00 00 00 mov $0xe,%eax - 297: cd 40 int $0x40 - 299: c3 ret + 270: b8 0e 00 00 00 mov $0xe,%eax + 275: cd 40 int $0x40 + 277: c3 ret -0000029a : +00000278 : SYSCALL(slabtest) - 29a: b8 16 00 00 00 mov $0x16,%eax - 29f: cd 40 int $0x40 - 2a1: c3 ret + 278: b8 16 00 00 00 mov $0x16,%eax + 27d: cd 40 int $0x40 + 27f: c3 ret -000002a2 : +00000280 : SYSCALL(ps) - 2a2: b8 17 00 00 00 mov $0x17,%eax - 2a7: cd 40 int $0x40 - 2a9: c3 ret + 280: b8 17 00 00 00 mov $0x17,%eax + 285: cd 40 int $0x40 + 287: c3 ret -000002aa : +00000288 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 2aa: 55 push %ebp - 2ab: 89 e5 mov %esp,%ebp - 2ad: 57 push %edi - 2ae: 56 push %esi - 2af: 53 push %ebx - 2b0: 83 ec 3c sub $0x3c,%esp - 2b3: 89 45 c4 mov %eax,-0x3c(%ebp) - 2b6: 89 d3 mov %edx,%ebx + 288: 55 push %ebp + 289: 89 e5 mov %esp,%ebp + 28b: 57 push %edi + 28c: 56 push %esi + 28d: 53 push %ebx + 28e: 83 ec 3c sub $0x3c,%esp + 291: 89 45 c4 mov %eax,-0x3c(%ebp) + 294: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 2b8: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 2bc: 74 77 je 335 - 2be: 85 d2 test %edx,%edx - 2c0: 79 73 jns 335 + 296: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 29a: 74 79 je 315 + 29c: 85 d2 test %edx,%edx + 29e: 79 75 jns 315 neg = 1; x = -xx; - 2c2: f7 db neg %ebx + 2a0: 89 d1 mov %edx,%ecx + 2a2: f7 d9 neg %ecx neg = 1; - 2c4: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 2a4: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 2cb: be 00 00 00 00 mov $0x0,%esi + 2ab: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 2d0: 89 f7 mov %esi,%edi - 2d2: 83 c6 01 add $0x1,%esi - 2d5: 89 d8 mov %ebx,%eax - 2d7: ba 00 00 00 00 mov $0x0,%edx - 2dc: f7 f1 div %ecx - 2de: 0f b6 92 60 06 00 00 movzbl 0x660(%edx),%edx - 2e5: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 2b0: 89 df mov %ebx,%edi + 2b2: 83 c3 01 add $0x1,%ebx + 2b5: 89 c8 mov %ecx,%eax + 2b7: ba 00 00 00 00 mov $0x0,%edx + 2bc: f7 f6 div %esi + 2be: 0f b6 92 78 06 00 00 movzbl 0x678(%edx),%edx + 2c5: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 2e9: 89 da mov %ebx,%edx - 2eb: 89 c3 mov %eax,%ebx - 2ed: 39 d1 cmp %edx,%ecx - 2ef: 76 df jbe 2d0 + 2c9: 89 ca mov %ecx,%edx + 2cb: 89 c1 mov %eax,%ecx + 2cd: 39 d6 cmp %edx,%esi + 2cf: 76 df jbe 2b0 if(neg) - 2f1: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 2f5: 74 08 je 2ff + 2d1: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 2d5: 74 08 je 2df buf[i++] = '-'; - 2f7: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 2fc: 8d 77 02 lea 0x2(%edi),%esi + 2d7: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 2dc: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 2ff: 85 f6 test %esi,%esi - 301: 7e 2a jle 32d - 303: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 307: 8d 7d d8 lea -0x28(%ebp),%edi + 2df: 85 db test %ebx,%ebx + 2e1: 7e 2a jle 30d + 2e3: 8d 7d d8 lea -0x28(%ebp),%edi + 2e6: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 30a: 8d 75 d7 lea -0x29(%ebp),%esi + 2ea: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 30d: 0f b6 03 movzbl (%ebx),%eax - 310: 88 45 d7 mov %al,-0x29(%ebp) + 2ed: 0f b6 03 movzbl (%ebx),%eax + 2f0: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 313: 83 ec 04 sub $0x4,%esp - 316: 6a 01 push $0x1 - 318: 56 push %esi - 319: ff 75 c4 pushl -0x3c(%ebp) - 31c: e8 f9 fe ff ff call 21a + 2f3: 83 ec 04 sub $0x4,%esp + 2f6: 6a 01 push $0x1 + 2f8: 56 push %esi + 2f9: ff 75 c4 push -0x3c(%ebp) + 2fc: e8 f7 fe ff ff call 1f8 while(--i >= 0) - 321: 89 d8 mov %ebx,%eax - 323: 83 eb 01 sub $0x1,%ebx - 326: 83 c4 10 add $0x10,%esp - 329: 39 f8 cmp %edi,%eax - 32b: 75 e0 jne 30d + 301: 89 d8 mov %ebx,%eax + 303: 83 eb 01 sub $0x1,%ebx + 306: 83 c4 10 add $0x10,%esp + 309: 39 f8 cmp %edi,%eax + 30b: 75 e0 jne 2ed } - 32d: 8d 65 f4 lea -0xc(%ebp),%esp - 330: 5b pop %ebx - 331: 5e pop %esi - 332: 5f pop %edi - 333: 5d pop %ebp - 334: c3 ret + 30d: 8d 65 f4 lea -0xc(%ebp),%esp + 310: 5b pop %ebx + 311: 5e pop %esi + 312: 5f pop %edi + 313: 5d pop %ebp + 314: c3 ret + x = xx; + 315: 89 d1 mov %edx,%ecx neg = 0; - 335: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 33c: eb 8d jmp 2cb + 317: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 31e: eb 8b jmp 2ab -0000033e : +00000320 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 33e: f3 0f 1e fb endbr32 - 342: 55 push %ebp - 343: 89 e5 mov %esp,%ebp - 345: 57 push %edi - 346: 56 push %esi - 347: 53 push %ebx - 348: 83 ec 2c sub $0x2c,%esp + 320: 55 push %ebp + 321: 89 e5 mov %esp,%ebp + 323: 57 push %edi + 324: 56 push %esi + 325: 53 push %ebx + 326: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 34b: 8b 75 0c mov 0xc(%ebp),%esi - 34e: 0f b6 1e movzbl (%esi),%ebx - 351: 84 db test %bl,%bl - 353: 0f 84 ab 01 00 00 je 504 - 359: 83 c6 01 add $0x1,%esi + 329: 8b 75 0c mov 0xc(%ebp),%esi + 32c: 0f b6 1e movzbl (%esi),%ebx + 32f: 84 db test %bl,%bl + 331: 0f 84 9f 01 00 00 je 4d6 + 337: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 35c: 8d 45 10 lea 0x10(%ebp),%eax - 35f: 89 45 d4 mov %eax,-0x2c(%ebp) + 33a: 8d 45 10 lea 0x10(%ebp),%eax + 33d: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 362: bf 00 00 00 00 mov $0x0,%edi - 367: eb 2d jmp 396 + 340: bf 00 00 00 00 mov $0x0,%edi + 345: eb 2d jmp 374 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 369: 88 5d e7 mov %bl,-0x19(%ebp) + 347: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 36c: 83 ec 04 sub $0x4,%esp - 36f: 6a 01 push $0x1 - 371: 8d 45 e7 lea -0x19(%ebp),%eax - 374: 50 push %eax - 375: ff 75 08 pushl 0x8(%ebp) - 378: e8 9d fe ff ff call 21a + 34a: 83 ec 04 sub $0x4,%esp + 34d: 6a 01 push $0x1 + 34f: 8d 45 e7 lea -0x19(%ebp),%eax + 352: 50 push %eax + 353: ff 75 08 push 0x8(%ebp) + 356: e8 9d fe ff ff call 1f8 putc(fd, c); - 37d: 83 c4 10 add $0x10,%esp - 380: eb 05 jmp 387 + 35b: 83 c4 10 add $0x10,%esp + 35e: eb 05 jmp 365 } } else if(state == '%'){ - 382: 83 ff 25 cmp $0x25,%edi - 385: 74 22 je 3a9 + 360: 83 ff 25 cmp $0x25,%edi + 363: 74 1f je 384 for(i = 0; fmt[i]; i++){ - 387: 83 c6 01 add $0x1,%esi - 38a: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 38e: 84 db test %bl,%bl - 390: 0f 84 6e 01 00 00 je 504 + 365: 83 c6 01 add $0x1,%esi + 368: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 36c: 84 db test %bl,%bl + 36e: 0f 84 62 01 00 00 je 4d6 c = fmt[i] & 0xff; - 396: 0f be d3 movsbl %bl,%edx - 399: 0f b6 c3 movzbl %bl,%eax + 374: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 39c: 85 ff test %edi,%edi - 39e: 75 e2 jne 382 + 377: 85 ff test %edi,%edi + 379: 75 e5 jne 360 if(c == '%'){ - 3a0: 83 f8 25 cmp $0x25,%eax - 3a3: 75 c4 jne 369 + 37b: 83 f8 25 cmp $0x25,%eax + 37e: 75 c7 jne 347 state = '%'; - 3a5: 89 c7 mov %eax,%edi - 3a7: eb de jmp 387 + 380: 89 c7 mov %eax,%edi + 382: eb e1 jmp 365 if(c == 'd'){ - 3a9: 83 f8 64 cmp $0x64,%eax - 3ac: 74 59 je 407 + 384: 83 f8 25 cmp $0x25,%eax + 387: 0f 84 f2 00 00 00 je 47f + 38d: 8d 50 9d lea -0x63(%eax),%edx + 390: 83 fa 15 cmp $0x15,%edx + 393: 0f 87 07 01 00 00 ja 4a0 + 399: 0f 87 01 01 00 00 ja 4a0 + 39f: ff 24 95 20 06 00 00 jmp *0x620(,%edx,4) printint(fd, *ap, 10, 1); + 3a6: 83 ec 0c sub $0xc,%esp + 3a9: 6a 01 push $0x1 + 3ab: b9 0a 00 00 00 mov $0xa,%ecx + 3b0: 8b 7d d4 mov -0x2c(%ebp),%edi + 3b3: 8b 17 mov (%edi),%edx + 3b5: 8b 45 08 mov 0x8(%ebp),%eax + 3b8: e8 cb fe ff ff call 288 ap++; - } else if(c == 'x' || c == 'p'){ - 3ae: 81 e2 f7 00 00 00 and $0xf7,%edx - 3b4: 83 fa 70 cmp $0x70,%edx - 3b7: 74 7a je 433 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 3b9: 83 f8 73 cmp $0x73,%eax - 3bc: 0f 84 9d 00 00 00 je 45f - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 3c2: 83 f8 63 cmp $0x63,%eax - 3c5: 0f 84 ec 00 00 00 je 4b7 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 3cb: 83 f8 25 cmp $0x25,%eax - 3ce: 0f 84 0f 01 00 00 je 4e3 - putc(fd, c); + 3bd: 89 f8 mov %edi,%eax + 3bf: 83 c0 04 add $0x4,%eax + 3c2: 89 45 d4 mov %eax,-0x2c(%ebp) + 3c5: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 3d4: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 3d8: 83 ec 04 sub $0x4,%esp - 3db: 6a 01 push $0x1 - 3dd: 8d 45 e7 lea -0x19(%ebp),%eax - 3e0: 50 push %eax - 3e1: ff 75 08 pushl 0x8(%ebp) - 3e4: e8 31 fe ff ff call 21a putc(fd, c); - 3e9: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 3ec: 83 c4 0c add $0xc,%esp - 3ef: 6a 01 push $0x1 - 3f1: 8d 45 e7 lea -0x19(%ebp),%eax - 3f4: 50 push %eax - 3f5: ff 75 08 pushl 0x8(%ebp) - 3f8: e8 1d fe ff ff call 21a - putc(fd, c); - 3fd: 83 c4 10 add $0x10,%esp } state = 0; - 400: bf 00 00 00 00 mov $0x0,%edi - 405: eb 80 jmp 387 - printint(fd, *ap, 10, 1); - 407: 83 ec 0c sub $0xc,%esp - 40a: 6a 01 push $0x1 - 40c: b9 0a 00 00 00 mov $0xa,%ecx - 411: 8b 7d d4 mov -0x2c(%ebp),%edi - 414: 8b 17 mov (%edi),%edx - 416: 8b 45 08 mov 0x8(%ebp),%eax - 419: e8 8c fe ff ff call 2aa - ap++; - 41e: 89 f8 mov %edi,%eax - 420: 83 c0 04 add $0x4,%eax - 423: 89 45 d4 mov %eax,-0x2c(%ebp) - 426: 83 c4 10 add $0x10,%esp - state = 0; - 429: bf 00 00 00 00 mov $0x0,%edi - 42e: e9 54 ff ff ff jmp 387 + 3c8: bf 00 00 00 00 mov $0x0,%edi + 3cd: eb 96 jmp 365 printint(fd, *ap, 16, 0); - 433: 83 ec 0c sub $0xc,%esp - 436: 6a 00 push $0x0 - 438: b9 10 00 00 00 mov $0x10,%ecx - 43d: 8b 7d d4 mov -0x2c(%ebp),%edi - 440: 8b 17 mov (%edi),%edx - 442: 8b 45 08 mov 0x8(%ebp),%eax - 445: e8 60 fe ff ff call 2aa + 3cf: 83 ec 0c sub $0xc,%esp + 3d2: 6a 00 push $0x0 + 3d4: b9 10 00 00 00 mov $0x10,%ecx + 3d9: 8b 7d d4 mov -0x2c(%ebp),%edi + 3dc: 8b 17 mov (%edi),%edx + 3de: 8b 45 08 mov 0x8(%ebp),%eax + 3e1: e8 a2 fe ff ff call 288 ap++; - 44a: 89 f8 mov %edi,%eax - 44c: 83 c0 04 add $0x4,%eax - 44f: 89 45 d4 mov %eax,-0x2c(%ebp) - 452: 83 c4 10 add $0x10,%esp + 3e6: 89 f8 mov %edi,%eax + 3e8: 83 c0 04 add $0x4,%eax + 3eb: 89 45 d4 mov %eax,-0x2c(%ebp) + 3ee: 83 c4 10 add $0x10,%esp state = 0; - 455: bf 00 00 00 00 mov $0x0,%edi - 45a: e9 28 ff ff ff jmp 387 + 3f1: bf 00 00 00 00 mov $0x0,%edi + 3f6: e9 6a ff ff ff jmp 365 s = (char*)*ap; - 45f: 8b 4d d4 mov -0x2c(%ebp),%ecx - 462: 8b 01 mov (%ecx),%eax + 3fb: 8b 4d d4 mov -0x2c(%ebp),%ecx + 3fe: 8b 01 mov (%ecx),%eax ap++; - 464: 83 c1 04 add $0x4,%ecx - 467: 89 4d d4 mov %ecx,-0x2c(%ebp) + 400: 83 c1 04 add $0x4,%ecx + 403: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 46a: 85 c0 test %eax,%eax - 46c: 74 13 je 481 + 406: 85 c0 test %eax,%eax + 408: 74 13 je 41d s = (char*)*ap; - 46e: 89 c3 mov %eax,%ebx + 40a: 89 c3 mov %eax,%ebx while(*s != 0){ - 470: 0f b6 00 movzbl (%eax),%eax + 40c: 0f b6 00 movzbl (%eax),%eax state = 0; - 473: bf 00 00 00 00 mov $0x0,%edi + 40f: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 478: 84 c0 test %al,%al - 47a: 75 0f jne 48b - 47c: e9 06 ff ff ff jmp 387 + 414: 84 c0 test %al,%al + 416: 75 0f jne 427 + 418: e9 48 ff ff ff jmp 365 s = "(null)"; - 481: bb 58 06 00 00 mov $0x658,%ebx + 41d: bb 18 06 00 00 mov $0x618,%ebx while(*s != 0){ - 486: b8 28 00 00 00 mov $0x28,%eax - 48b: 8b 7d 08 mov 0x8(%ebp),%edi + 422: b8 28 00 00 00 mov $0x28,%eax + 427: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 48e: 88 45 e7 mov %al,-0x19(%ebp) + 42a: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 491: 83 ec 04 sub $0x4,%esp - 494: 6a 01 push $0x1 - 496: 8d 45 e7 lea -0x19(%ebp),%eax - 499: 50 push %eax - 49a: 57 push %edi - 49b: e8 7a fd ff ff call 21a + 42d: 83 ec 04 sub $0x4,%esp + 430: 6a 01 push $0x1 + 432: 8d 45 e7 lea -0x19(%ebp),%eax + 435: 50 push %eax + 436: 57 push %edi + 437: e8 bc fd ff ff call 1f8 s++; - 4a0: 83 c3 01 add $0x1,%ebx + 43c: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 4a3: 0f b6 03 movzbl (%ebx),%eax - 4a6: 83 c4 10 add $0x10,%esp - 4a9: 84 c0 test %al,%al - 4ab: 75 e1 jne 48e + 43f: 0f b6 03 movzbl (%ebx),%eax + 442: 83 c4 10 add $0x10,%esp + 445: 84 c0 test %al,%al + 447: 75 e1 jne 42a state = 0; - 4ad: bf 00 00 00 00 mov $0x0,%edi - 4b2: e9 d0 fe ff ff jmp 387 + 449: bf 00 00 00 00 mov $0x0,%edi + 44e: e9 12 ff ff ff jmp 365 putc(fd, *ap); - 4b7: 8b 7d d4 mov -0x2c(%ebp),%edi - 4ba: 8b 07 mov (%edi),%eax - 4bc: 88 45 e7 mov %al,-0x19(%ebp) + 453: 8b 7d d4 mov -0x2c(%ebp),%edi + 456: 8b 07 mov (%edi),%eax + 458: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4bf: 83 ec 04 sub $0x4,%esp - 4c2: 6a 01 push $0x1 - 4c4: 8d 45 e7 lea -0x19(%ebp),%eax - 4c7: 50 push %eax - 4c8: ff 75 08 pushl 0x8(%ebp) - 4cb: e8 4a fd ff ff call 21a + 45b: 83 ec 04 sub $0x4,%esp + 45e: 6a 01 push $0x1 + 460: 8d 45 e7 lea -0x19(%ebp),%eax + 463: 50 push %eax + 464: ff 75 08 push 0x8(%ebp) + 467: e8 8c fd ff ff call 1f8 ap++; - 4d0: 83 c7 04 add $0x4,%edi - 4d3: 89 7d d4 mov %edi,-0x2c(%ebp) - 4d6: 83 c4 10 add $0x10,%esp + 46c: 83 c7 04 add $0x4,%edi + 46f: 89 7d d4 mov %edi,-0x2c(%ebp) + 472: 83 c4 10 add $0x10,%esp state = 0; - 4d9: bf 00 00 00 00 mov $0x0,%edi - 4de: e9 a4 fe ff ff jmp 387 + 475: bf 00 00 00 00 mov $0x0,%edi + 47a: e9 e6 fe ff ff jmp 365 putc(fd, c); - 4e3: 88 5d e7 mov %bl,-0x19(%ebp) + 47f: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 4e6: 83 ec 04 sub $0x4,%esp - 4e9: 6a 01 push $0x1 - 4eb: 8d 45 e7 lea -0x19(%ebp),%eax - 4ee: 50 push %eax - 4ef: ff 75 08 pushl 0x8(%ebp) - 4f2: e8 23 fd ff ff call 21a - 4f7: 83 c4 10 add $0x10,%esp + 482: 83 ec 04 sub $0x4,%esp + 485: 6a 01 push $0x1 + 487: 8d 45 e7 lea -0x19(%ebp),%eax + 48a: 50 push %eax + 48b: ff 75 08 push 0x8(%ebp) + 48e: e8 65 fd ff ff call 1f8 + 493: 83 c4 10 add $0x10,%esp + state = 0; + 496: bf 00 00 00 00 mov $0x0,%edi + 49b: e9 c5 fe ff ff jmp 365 + putc(fd, '%'); + 4a0: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 4a4: 83 ec 04 sub $0x4,%esp + 4a7: 6a 01 push $0x1 + 4a9: 8d 45 e7 lea -0x19(%ebp),%eax + 4ac: 50 push %eax + 4ad: ff 75 08 push 0x8(%ebp) + 4b0: e8 43 fd ff ff call 1f8 + putc(fd, c); + 4b5: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 4b8: 83 c4 0c add $0xc,%esp + 4bb: 6a 01 push $0x1 + 4bd: 8d 45 e7 lea -0x19(%ebp),%eax + 4c0: 50 push %eax + 4c1: ff 75 08 push 0x8(%ebp) + 4c4: e8 2f fd ff ff call 1f8 + putc(fd, c); + 4c9: 83 c4 10 add $0x10,%esp state = 0; - 4fa: bf 00 00 00 00 mov $0x0,%edi - 4ff: e9 83 fe ff ff jmp 387 + 4cc: bf 00 00 00 00 mov $0x0,%edi + 4d1: e9 8f fe ff ff jmp 365 } } } - 504: 8d 65 f4 lea -0xc(%ebp),%esp - 507: 5b pop %ebx - 508: 5e pop %esi - 509: 5f pop %edi - 50a: 5d pop %ebp - 50b: c3 ret - -0000050c : + 4d6: 8d 65 f4 lea -0xc(%ebp),%esp + 4d9: 5b pop %ebx + 4da: 5e pop %esi + 4db: 5f pop %edi + 4dc: 5d pop %ebp + 4dd: c3 ret + +000004de : static Header base; static Header *freep; void free(void *ap) { - 50c: f3 0f 1e fb endbr32 - 510: 55 push %ebp - 511: 89 e5 mov %esp,%ebp - 513: 57 push %edi - 514: 56 push %esi - 515: 53 push %ebx - 516: 8b 5d 08 mov 0x8(%ebp),%ebx + 4de: 55 push %ebp + 4df: 89 e5 mov %esp,%ebp + 4e1: 57 push %edi + 4e2: 56 push %esi + 4e3: 53 push %ebx + 4e4: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 519: 8d 4b f8 lea -0x8(%ebx),%ecx + 4e7: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 51c: a1 c0 08 00 00 mov 0x8c0,%eax - 521: eb 0c jmp 52f + 4ea: a1 d8 08 00 00 mov 0x8d8,%eax + 4ef: eb 0c jmp 4fd if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 523: 8b 10 mov (%eax),%edx - 525: 39 c2 cmp %eax,%edx - 527: 77 04 ja 52d - 529: 39 ca cmp %ecx,%edx - 52b: 77 10 ja 53d + 4f1: 8b 10 mov (%eax),%edx + 4f3: 39 c2 cmp %eax,%edx + 4f5: 77 04 ja 4fb + 4f7: 39 ca cmp %ecx,%edx + 4f9: 77 10 ja 50b { - 52d: 89 d0 mov %edx,%eax + 4fb: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 52f: 39 c8 cmp %ecx,%eax - 531: 73 f0 jae 523 - 533: 8b 10 mov (%eax),%edx - 535: 39 ca cmp %ecx,%edx - 537: 77 04 ja 53d + 4fd: 39 c8 cmp %ecx,%eax + 4ff: 73 f0 jae 4f1 + 501: 8b 10 mov (%eax),%edx + 503: 39 ca cmp %ecx,%edx + 505: 77 04 ja 50b if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 539: 39 c2 cmp %eax,%edx - 53b: 77 f0 ja 52d + 507: 39 c2 cmp %eax,%edx + 509: 77 f0 ja 4fb break; if(bp + bp->s.size == p->s.ptr){ - 53d: 8b 73 fc mov -0x4(%ebx),%esi - 540: 8b 10 mov (%eax),%edx - 542: 8d 3c f1 lea (%ecx,%esi,8),%edi - 545: 39 fa cmp %edi,%edx - 547: 74 19 je 562 + 50b: 8b 73 fc mov -0x4(%ebx),%esi + 50e: 8b 10 mov (%eax),%edx + 510: 8d 3c f1 lea (%ecx,%esi,8),%edi + 513: 39 fa cmp %edi,%edx + 515: 74 19 je 530 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 517: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 549: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 54c: 8b 50 04 mov 0x4(%eax),%edx - 54f: 8d 34 d0 lea (%eax,%edx,8),%esi - 552: 39 f1 cmp %esi,%ecx - 554: 74 1b je 571 + 51a: 8b 50 04 mov 0x4(%eax),%edx + 51d: 8d 34 d0 lea (%eax,%edx,8),%esi + 520: 39 f1 cmp %esi,%ecx + 522: 74 18 je 53c p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 524: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 556: 89 08 mov %ecx,(%eax) freep = p; - 558: a3 c0 08 00 00 mov %eax,0x8c0 + 526: a3 d8 08 00 00 mov %eax,0x8d8 } - 55d: 5b pop %ebx - 55e: 5e pop %esi - 55f: 5f pop %edi - 560: 5d pop %ebp - 561: c3 ret + 52b: 5b pop %ebx + 52c: 5e pop %esi + 52d: 5f pop %edi + 52e: 5d pop %ebp + 52f: c3 ret bp->s.size += p->s.ptr->s.size; - 562: 03 72 04 add 0x4(%edx),%esi - 565: 89 73 fc mov %esi,-0x4(%ebx) + 530: 03 72 04 add 0x4(%edx),%esi + 533: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 568: 8b 10 mov (%eax),%edx - 56a: 8b 12 mov (%edx),%edx - 56c: 89 53 f8 mov %edx,-0x8(%ebx) - 56f: eb db jmp 54c + 536: 8b 10 mov (%eax),%edx + 538: 8b 12 mov (%edx),%edx + 53a: eb db jmp 517 p->s.size += bp->s.size; - 571: 03 53 fc add -0x4(%ebx),%edx - 574: 89 50 04 mov %edx,0x4(%eax) + 53c: 03 53 fc add -0x4(%ebx),%edx + 53f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 577: 8b 53 f8 mov -0x8(%ebx),%edx - 57a: 89 10 mov %edx,(%eax) - 57c: eb da jmp 558 + 542: 8b 4b f8 mov -0x8(%ebx),%ecx + 545: eb dd jmp 524 -0000057e : +00000547 : return freep; } void* malloc(uint nbytes) { - 57e: f3 0f 1e fb endbr32 - 582: 55 push %ebp - 583: 89 e5 mov %esp,%ebp - 585: 57 push %edi - 586: 56 push %esi - 587: 53 push %ebx - 588: 83 ec 0c sub $0xc,%esp + 547: 55 push %ebp + 548: 89 e5 mov %esp,%ebp + 54a: 57 push %edi + 54b: 56 push %esi + 54c: 53 push %ebx + 54d: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 58b: 8b 45 08 mov 0x8(%ebp),%eax - 58e: 8d 58 07 lea 0x7(%eax),%ebx - 591: c1 eb 03 shr $0x3,%ebx - 594: 83 c3 01 add $0x1,%ebx + 550: 8b 45 08 mov 0x8(%ebp),%eax + 553: 8d 58 07 lea 0x7(%eax),%ebx + 556: c1 eb 03 shr $0x3,%ebx + 559: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 597: 8b 15 c0 08 00 00 mov 0x8c0,%edx - 59d: 85 d2 test %edx,%edx - 59f: 74 20 je 5c1 + 55c: 8b 15 d8 08 00 00 mov 0x8d8,%edx + 562: 85 d2 test %edx,%edx + 564: 74 1c je 582 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5a1: 8b 02 mov (%edx),%eax + 566: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 5a3: 8b 48 04 mov 0x4(%eax),%ecx - 5a6: 39 cb cmp %ecx,%ebx - 5a8: 76 3c jbe 5e6 - 5aa: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 5b0: be 00 10 00 00 mov $0x1000,%esi - 5b5: 0f 43 f3 cmovae %ebx,%esi + 568: 8b 48 04 mov 0x4(%eax),%ecx + 56b: 39 cb cmp %ecx,%ebx + 56d: 76 38 jbe 5a7 + 56f: be 00 10 00 00 mov $0x1000,%esi + 574: 39 f3 cmp %esi,%ebx + 576: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 5b8: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 5bf: eb 72 jmp 633 + 579: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 580: eb 72 jmp 5f4 base.s.ptr = freep = prevp = &base; - 5c1: c7 05 c0 08 00 00 c4 movl $0x8c4,0x8c0 - 5c8: 08 00 00 - 5cb: c7 05 c4 08 00 00 c4 movl $0x8c4,0x8c4 - 5d2: 08 00 00 + 582: c7 05 d8 08 00 00 dc movl $0x8dc,0x8d8 + 589: 08 00 00 + 58c: c7 05 dc 08 00 00 dc movl $0x8dc,0x8dc + 593: 08 00 00 base.s.size = 0; - 5d5: c7 05 c8 08 00 00 00 movl $0x0,0x8c8 - 5dc: 00 00 00 + 596: c7 05 e0 08 00 00 00 movl $0x0,0x8e0 + 59d: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5df: b8 c4 08 00 00 mov $0x8c4,%eax - 5e4: eb c4 jmp 5aa + 5a0: b8 dc 08 00 00 mov $0x8dc,%eax + 5a5: eb c8 jmp 56f if(p->s.size == nunits) - 5e6: 39 cb cmp %ecx,%ebx - 5e8: 74 1e je 608 + 5a7: 39 cb cmp %ecx,%ebx + 5a9: 74 1e je 5c9 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 5ea: 29 d9 sub %ebx,%ecx - 5ec: 89 48 04 mov %ecx,0x4(%eax) + 5ab: 29 d9 sub %ebx,%ecx + 5ad: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 5ef: 8d 04 c8 lea (%eax,%ecx,8),%eax + 5b0: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 5f2: 89 58 04 mov %ebx,0x4(%eax) + 5b3: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 5f5: 89 15 c0 08 00 00 mov %edx,0x8c0 + 5b6: 89 15 d8 08 00 00 mov %edx,0x8d8 return (void*)(p + 1); - 5fb: 8d 50 08 lea 0x8(%eax),%edx + 5bc: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 5fe: 89 d0 mov %edx,%eax - 600: 8d 65 f4 lea -0xc(%ebp),%esp - 603: 5b pop %ebx - 604: 5e pop %esi - 605: 5f pop %edi - 606: 5d pop %ebp - 607: c3 ret + 5bf: 89 d0 mov %edx,%eax + 5c1: 8d 65 f4 lea -0xc(%ebp),%esp + 5c4: 5b pop %ebx + 5c5: 5e pop %esi + 5c6: 5f pop %edi + 5c7: 5d pop %ebp + 5c8: c3 ret prevp->s.ptr = p->s.ptr; - 608: 8b 08 mov (%eax),%ecx - 60a: 89 0a mov %ecx,(%edx) - 60c: eb e7 jmp 5f5 + 5c9: 8b 08 mov (%eax),%ecx + 5cb: 89 0a mov %ecx,(%edx) + 5cd: eb e7 jmp 5b6 hp->s.size = nu; - 60e: 89 70 04 mov %esi,0x4(%eax) + 5cf: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 611: 83 ec 0c sub $0xc,%esp - 614: 83 c0 08 add $0x8,%eax - 617: 50 push %eax - 618: e8 ef fe ff ff call 50c + 5d2: 83 ec 0c sub $0xc,%esp + 5d5: 83 c0 08 add $0x8,%eax + 5d8: 50 push %eax + 5d9: e8 00 ff ff ff call 4de return freep; - 61d: 8b 15 c0 08 00 00 mov 0x8c0,%edx + 5de: 8b 15 d8 08 00 00 mov 0x8d8,%edx if((p = morecore(nunits)) == 0) - 623: 83 c4 10 add $0x10,%esp - 626: 85 d2 test %edx,%edx - 628: 74 d4 je 5fe + 5e4: 83 c4 10 add $0x10,%esp + 5e7: 85 d2 test %edx,%edx + 5e9: 74 d4 je 5bf for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 62a: 8b 02 mov (%edx),%eax + 5eb: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 62c: 8b 48 04 mov 0x4(%eax),%ecx - 62f: 39 d9 cmp %ebx,%ecx - 631: 73 b3 jae 5e6 + 5ed: 8b 48 04 mov 0x4(%eax),%ecx + 5f0: 39 d9 cmp %ebx,%ecx + 5f2: 73 b3 jae 5a7 if(p == freep) - 633: 89 c2 mov %eax,%edx - 635: 39 05 c0 08 00 00 cmp %eax,0x8c0 - 63b: 75 ed jne 62a + 5f4: 89 c2 mov %eax,%edx + 5f6: 39 05 d8 08 00 00 cmp %eax,0x8d8 + 5fc: 75 ed jne 5eb p = sbrk(nu * sizeof(Header)); - 63d: 83 ec 0c sub $0xc,%esp - 640: 57 push %edi - 641: e8 3c fc ff ff call 282 + 5fe: 83 ec 0c sub $0xc,%esp + 601: 57 push %edi + 602: e8 59 fc ff ff call 260 if(p == (char*)-1) - 646: 83 c4 10 add $0x10,%esp - 649: 83 f8 ff cmp $0xffffffff,%eax - 64c: 75 c0 jne 60e + 607: 83 c4 10 add $0x10,%esp + 60a: 83 f8 ff cmp $0xffffffff,%eax + 60d: 75 c0 jne 5cf return 0; - 64e: ba 00 00 00 00 mov $0x0,%edx - 653: eb a9 jmp 5fe + 60f: ba 00 00 00 00 mov $0x0,%edx + 614: eb a9 jmp 5bf diff --git a/src/user/slabtest.d b/src/user/slabtest.d new file mode 100644 index 0000000..6c600c4 --- /dev/null +++ b/src/user/slabtest.d @@ -0,0 +1,2 @@ +user/slabtest.o: user/slabtest.c /usr/include/stdc-predef.h types.h \ + stat.h user.h diff --git a/src/user/slabtest.o b/src/user/slabtest.o new file mode 100644 index 0000000..a503e1f Binary files /dev/null and b/src/user/slabtest.o differ diff --git a/src/user/slabtest.sym b/src/user/slabtest.sym index f9d0fcf..7c466ec 100644 --- a/src/user/slabtest.sym +++ b/src/user/slabtest.sym @@ -1,59 +1,47 @@ -00000000 .text -00000658 .rodata -00000674 .eh_frame -000008c0 .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 slabtest.c 00000000 ulib.c 00000000 printf.c -000002aa printint -00000660 digits.1089 +00000288 printint +00000678 digits.0 00000000 umalloc.c -000008c0 freep -000008c4 base -00000014 strcpy -0000033e printf -000001c1 memmove -00000242 mknod -000002a2 ps -000000df gets -0000027a getpid -0000057e malloc -0000028a sleep -0000020a pipe -0000029a slabtest -0000021a write -00000252 fstat -0000022a kill -0000026a chdir -00000232 exec -00000202 wait -00000212 read -0000024a unlink -000001f2 fork -00000282 sbrk -00000292 uptime -000008c0 __bss_start -00000093 memset +000008d8 freep +000008dc base +00000010 strcpy +00000320 printf +000001a3 memmove +00000220 mknod +00000280 ps +000000cb gets +00000258 getpid +00000547 malloc +00000268 sleep +000001e8 pipe +00000278 slabtest +000001f8 write +00000230 fstat +00000208 kill +00000248 chdir +00000210 exec +000001e0 wait +000001f0 read +00000228 unlink +000001d0 fork +00000260 sbrk +00000270 uptime +000008d8 __bss_start +00000085 memset 00000000 main -0000003a strcmp -00000272 dup -0000013a stat -000008c0 _edata -000008cc _end -0000025a link -000001fa exit -00000182 atoi -00000069 strlen -0000023a open -000000ae strchr -00000262 mkdir -00000222 close -0000050c free +00000034 strcmp +00000250 dup +00000122 stat +000008d8 _edata +000008e4 _end +00000238 link +000001d8 exit +00000166 atoi +0000005f strlen +00000218 open +0000009e strchr +00000240 mkdir +00000200 close +000004de free diff --git a/src/user/stressfs.asm b/src/user/stressfs.asm index 900a187..a7fe8cf 100644 --- a/src/user/stressfs.asm +++ b/src/user/stressfs.asm @@ -11,1136 +11,1105 @@ Disassembly of section .text: int main(int argc, char *argv[]) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 57 push %edi - 12: 56 push %esi - 13: 53 push %ebx - 14: 51 push %ecx - 15: 81 ec 20 02 00 00 sub $0x220,%esp + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 57 push %edi + e: 56 push %esi + f: 53 push %ebx + 10: 51 push %ecx + 11: 81 ec 20 02 00 00 sub $0x220,%esp int fd, i; char path[] = "stressfs0"; - 1b: c7 45 de 73 74 72 65 movl $0x65727473,-0x22(%ebp) - 22: c7 45 e2 73 73 66 73 movl $0x73667373,-0x1e(%ebp) - 29: 66 c7 45 e6 30 00 movw $0x30,-0x1a(%ebp) + 17: c7 45 de 73 74 72 65 movl $0x65727473,-0x22(%ebp) + 1e: c7 45 e2 73 73 66 73 movl $0x73667373,-0x1e(%ebp) + 25: 66 c7 45 e6 30 00 movw $0x30,-0x1a(%ebp) char data[512]; printf(1, "stressfs starting\n"); - 2f: 68 58 07 00 00 push $0x758 - 34: 6a 01 push $0x1 - 36: e8 04 04 00 00 call 43f + 2b: 68 18 07 00 00 push $0x718 + 30: 6a 01 push $0x1 + 32: e8 ea 03 00 00 call 421 memset(data, 'a', sizeof(data)); - 3b: 83 c4 0c add $0xc,%esp - 3e: 68 00 02 00 00 push $0x200 - 43: 6a 61 push $0x61 - 45: 8d 85 de fd ff ff lea -0x222(%ebp),%eax - 4b: 50 push %eax - 4c: e8 43 01 00 00 call 194 - 51: 83 c4 10 add $0x10,%esp + 37: 83 c4 0c add $0xc,%esp + 3a: 68 00 02 00 00 push $0x200 + 3f: 6a 61 push $0x61 + 41: 8d 85 de fd ff ff lea -0x222(%ebp),%eax + 47: 50 push %eax + 48: e8 39 01 00 00 call 186 + 4d: 83 c4 10 add $0x10,%esp for(i = 0; i < 4; i++) - 54: bb 00 00 00 00 mov $0x0,%ebx + 50: bb 00 00 00 00 mov $0x0,%ebx if(fork() > 0) - 59: e8 95 02 00 00 call 2f3 - 5e: 85 c0 test %eax,%eax - 60: 7f 08 jg 6a + 55: e8 77 02 00 00 call 2d1 + 5a: 85 c0 test %eax,%eax + 5c: 7f 08 jg 66 for(i = 0; i < 4; i++) - 62: 83 c3 01 add $0x1,%ebx - 65: 83 fb 04 cmp $0x4,%ebx - 68: 75 ef jne 59 + 5e: 83 c3 01 add $0x1,%ebx + 61: 83 fb 04 cmp $0x4,%ebx + 64: 75 ef jne 55 break; printf(1, "write %d\n", i); - 6a: 83 ec 04 sub $0x4,%esp - 6d: 53 push %ebx - 6e: 68 6b 07 00 00 push $0x76b - 73: 6a 01 push $0x1 - 75: e8 c5 03 00 00 call 43f + 66: 83 ec 04 sub $0x4,%esp + 69: 53 push %ebx + 6a: 68 2b 07 00 00 push $0x72b + 6f: 6a 01 push $0x1 + 71: e8 ab 03 00 00 call 421 path[8] += i; - 7a: 00 5d e6 add %bl,-0x1a(%ebp) + 76: 00 5d e6 add %bl,-0x1a(%ebp) fd = open(path, O_CREATE | O_RDWR); - 7d: 83 c4 08 add $0x8,%esp - 80: 68 02 02 00 00 push $0x202 - 85: 8d 45 de lea -0x22(%ebp),%eax - 88: 50 push %eax - 89: e8 ad 02 00 00 call 33b - 8e: 89 c6 mov %eax,%esi - 90: 83 c4 10 add $0x10,%esp - 93: bb 14 00 00 00 mov $0x14,%ebx + 79: 83 c4 08 add $0x8,%esp + 7c: 68 02 02 00 00 push $0x202 + 81: 8d 45 de lea -0x22(%ebp),%eax + 84: 50 push %eax + 85: e8 8f 02 00 00 call 319 + 8a: 89 c6 mov %eax,%esi + 8c: 83 c4 10 add $0x10,%esp + 8f: bb 14 00 00 00 mov $0x14,%ebx for(i = 0; i < 20; i++) // printf(fd, "%d\n", i); write(fd, data, sizeof(data)); - 98: 8d bd de fd ff ff lea -0x222(%ebp),%edi - 9e: 83 ec 04 sub $0x4,%esp - a1: 68 00 02 00 00 push $0x200 - a6: 57 push %edi - a7: 56 push %esi - a8: e8 6e 02 00 00 call 31b + 94: 8d bd de fd ff ff lea -0x222(%ebp),%edi + 9a: 83 ec 04 sub $0x4,%esp + 9d: 68 00 02 00 00 push $0x200 + a2: 57 push %edi + a3: 56 push %esi + a4: e8 50 02 00 00 call 2f9 for(i = 0; i < 20; i++) - ad: 83 c4 10 add $0x10,%esp - b0: 83 eb 01 sub $0x1,%ebx - b3: 75 e9 jne 9e + a9: 83 c4 10 add $0x10,%esp + ac: 83 eb 01 sub $0x1,%ebx + af: 75 e9 jne 9a close(fd); - b5: 83 ec 0c sub $0xc,%esp - b8: 56 push %esi - b9: e8 65 02 00 00 call 323 + b1: 83 ec 0c sub $0xc,%esp + b4: 56 push %esi + b5: e8 47 02 00 00 call 301 printf(1, "read\n"); - be: 83 c4 08 add $0x8,%esp - c1: 68 75 07 00 00 push $0x775 - c6: 6a 01 push $0x1 - c8: e8 72 03 00 00 call 43f + ba: 83 c4 08 add $0x8,%esp + bd: 68 35 07 00 00 push $0x735 + c2: 6a 01 push $0x1 + c4: e8 58 03 00 00 call 421 fd = open(path, O_RDONLY); - cd: 83 c4 08 add $0x8,%esp - d0: 6a 00 push $0x0 - d2: 8d 45 de lea -0x22(%ebp),%eax - d5: 50 push %eax - d6: e8 60 02 00 00 call 33b - db: 89 c6 mov %eax,%esi - dd: 83 c4 10 add $0x10,%esp - e0: bb 14 00 00 00 mov $0x14,%ebx + c9: 83 c4 08 add $0x8,%esp + cc: 6a 00 push $0x0 + ce: 8d 45 de lea -0x22(%ebp),%eax + d1: 50 push %eax + d2: e8 42 02 00 00 call 319 + d7: 89 c6 mov %eax,%esi + d9: 83 c4 10 add $0x10,%esp + dc: bb 14 00 00 00 mov $0x14,%ebx for (i = 0; i < 20; i++) read(fd, data, sizeof(data)); - e5: 8d bd de fd ff ff lea -0x222(%ebp),%edi - eb: 83 ec 04 sub $0x4,%esp - ee: 68 00 02 00 00 push $0x200 - f3: 57 push %edi - f4: 56 push %esi - f5: e8 19 02 00 00 call 313 + e1: 8d bd de fd ff ff lea -0x222(%ebp),%edi + e7: 83 ec 04 sub $0x4,%esp + ea: 68 00 02 00 00 push $0x200 + ef: 57 push %edi + f0: 56 push %esi + f1: e8 fb 01 00 00 call 2f1 for (i = 0; i < 20; i++) - fa: 83 c4 10 add $0x10,%esp - fd: 83 eb 01 sub $0x1,%ebx - 100: 75 e9 jne eb + f6: 83 c4 10 add $0x10,%esp + f9: 83 eb 01 sub $0x1,%ebx + fc: 75 e9 jne e7 close(fd); - 102: 83 ec 0c sub $0xc,%esp - 105: 56 push %esi - 106: e8 18 02 00 00 call 323 + fe: 83 ec 0c sub $0xc,%esp + 101: 56 push %esi + 102: e8 fa 01 00 00 call 301 wait(); - 10b: e8 f3 01 00 00 call 303 + 107: e8 d5 01 00 00 call 2e1 exit(); - 110: e8 e6 01 00 00 call 2fb + 10c: e8 c8 01 00 00 call 2d9 -00000115 : +00000111 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 115: f3 0f 1e fb endbr32 - 119: 55 push %ebp - 11a: 89 e5 mov %esp,%ebp - 11c: 53 push %ebx - 11d: 8b 4d 08 mov 0x8(%ebp),%ecx - 120: 8b 5d 0c mov 0xc(%ebp),%ebx + 111: 55 push %ebp + 112: 89 e5 mov %esp,%ebp + 114: 53 push %ebx + 115: 8b 4d 08 mov 0x8(%ebp),%ecx + 118: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 123: b8 00 00 00 00 mov $0x0,%eax - 128: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 12c: 88 14 01 mov %dl,(%ecx,%eax,1) - 12f: 83 c0 01 add $0x1,%eax - 132: 84 d2 test %dl,%dl - 134: 75 f2 jne 128 + 11b: b8 00 00 00 00 mov $0x0,%eax + 120: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 124: 88 14 01 mov %dl,(%ecx,%eax,1) + 127: 83 c0 01 add $0x1,%eax + 12a: 84 d2 test %dl,%dl + 12c: 75 f2 jne 120 ; return os; } - 136: 89 c8 mov %ecx,%eax - 138: 5b pop %ebx - 139: 5d pop %ebp - 13a: c3 ret + 12e: 89 c8 mov %ecx,%eax + 130: 8b 5d fc mov -0x4(%ebp),%ebx + 133: c9 leave + 134: c3 ret -0000013b : +00000135 : int strcmp(const char *p, const char *q) { - 13b: f3 0f 1e fb endbr32 - 13f: 55 push %ebp - 140: 89 e5 mov %esp,%ebp - 142: 8b 4d 08 mov 0x8(%ebp),%ecx - 145: 8b 55 0c mov 0xc(%ebp),%edx + 135: 55 push %ebp + 136: 89 e5 mov %esp,%ebp + 138: 8b 4d 08 mov 0x8(%ebp),%ecx + 13b: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 148: 0f b6 01 movzbl (%ecx),%eax - 14b: 84 c0 test %al,%al - 14d: 74 11 je 160 - 14f: 38 02 cmp %al,(%edx) - 151: 75 0d jne 160 + 13e: 0f b6 01 movzbl (%ecx),%eax + 141: 84 c0 test %al,%al + 143: 74 11 je 156 + 145: 38 02 cmp %al,(%edx) + 147: 75 0d jne 156 p++, q++; - 153: 83 c1 01 add $0x1,%ecx - 156: 83 c2 01 add $0x1,%edx + 149: 83 c1 01 add $0x1,%ecx + 14c: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 159: 0f b6 01 movzbl (%ecx),%eax - 15c: 84 c0 test %al,%al - 15e: 75 ef jne 14f + 14f: 0f b6 01 movzbl (%ecx),%eax + 152: 84 c0 test %al,%al + 154: 75 ef jne 145 return (uchar)*p - (uchar)*q; - 160: 0f b6 c0 movzbl %al,%eax - 163: 0f b6 12 movzbl (%edx),%edx - 166: 29 d0 sub %edx,%eax + 156: 0f b6 c0 movzbl %al,%eax + 159: 0f b6 12 movzbl (%edx),%edx + 15c: 29 d0 sub %edx,%eax } - 168: 5d pop %ebp - 169: c3 ret + 15e: 5d pop %ebp + 15f: c3 ret -0000016a : +00000160 : uint strlen(const char *s) { - 16a: f3 0f 1e fb endbr32 - 16e: 55 push %ebp - 16f: 89 e5 mov %esp,%ebp - 171: 8b 55 08 mov 0x8(%ebp),%edx + 160: 55 push %ebp + 161: 89 e5 mov %esp,%ebp + 163: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 174: 80 3a 00 cmpb $0x0,(%edx) - 177: 74 14 je 18d - 179: b8 00 00 00 00 mov $0x0,%eax - 17e: 83 c0 01 add $0x1,%eax - 181: 89 c1 mov %eax,%ecx - 183: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 187: 75 f5 jne 17e + 166: 80 3a 00 cmpb $0x0,(%edx) + 169: 74 14 je 17f + 16b: b8 00 00 00 00 mov $0x0,%eax + 170: 83 c0 01 add $0x1,%eax + 173: 89 c1 mov %eax,%ecx + 175: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 179: 75 f5 jne 170 ; return n; } - 189: 89 c8 mov %ecx,%eax - 18b: 5d pop %ebp - 18c: c3 ret + 17b: 89 c8 mov %ecx,%eax + 17d: 5d pop %ebp + 17e: c3 ret for(n = 0; s[n]; n++) - 18d: b9 00 00 00 00 mov $0x0,%ecx + 17f: b9 00 00 00 00 mov $0x0,%ecx return n; - 192: eb f5 jmp 189 + 184: eb f5 jmp 17b -00000194 : +00000186 : void* memset(void *dst, int c, uint n) { - 194: f3 0f 1e fb endbr32 - 198: 55 push %ebp - 199: 89 e5 mov %esp,%ebp - 19b: 57 push %edi - 19c: 8b 55 08 mov 0x8(%ebp),%edx + 186: 55 push %ebp + 187: 89 e5 mov %esp,%ebp + 189: 57 push %edi + 18a: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 19f: 89 d7 mov %edx,%edi - 1a1: 8b 4d 10 mov 0x10(%ebp),%ecx - 1a4: 8b 45 0c mov 0xc(%ebp),%eax - 1a7: fc cld - 1a8: f3 aa rep stos %al,%es:(%edi) + 18d: 89 d7 mov %edx,%edi + 18f: 8b 4d 10 mov 0x10(%ebp),%ecx + 192: 8b 45 0c mov 0xc(%ebp),%eax + 195: fc cld + 196: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 1aa: 89 d0 mov %edx,%eax - 1ac: 5f pop %edi - 1ad: 5d pop %ebp - 1ae: c3 ret + 198: 89 d0 mov %edx,%eax + 19a: 8b 7d fc mov -0x4(%ebp),%edi + 19d: c9 leave + 19e: c3 ret -000001af : +0000019f : char* strchr(const char *s, char c) { - 1af: f3 0f 1e fb endbr32 - 1b3: 55 push %ebp - 1b4: 89 e5 mov %esp,%ebp - 1b6: 8b 45 08 mov 0x8(%ebp),%eax - 1b9: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 19f: 55 push %ebp + 1a0: 89 e5 mov %esp,%ebp + 1a2: 8b 45 08 mov 0x8(%ebp),%eax + 1a5: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 1bd: 0f b6 10 movzbl (%eax),%edx - 1c0: 84 d2 test %dl,%dl - 1c2: 74 15 je 1d9 + 1a9: 0f b6 10 movzbl (%eax),%edx + 1ac: 84 d2 test %dl,%dl + 1ae: 74 15 je 1c5 if(*s == c) - 1c4: 38 d1 cmp %dl,%cl - 1c6: 74 0f je 1d7 + 1b0: 38 d1 cmp %dl,%cl + 1b2: 74 0f je 1c3 for(; *s; s++) - 1c8: 83 c0 01 add $0x1,%eax - 1cb: 0f b6 10 movzbl (%eax),%edx - 1ce: 84 d2 test %dl,%dl - 1d0: 75 f2 jne 1c4 + 1b4: 83 c0 01 add $0x1,%eax + 1b7: 0f b6 10 movzbl (%eax),%edx + 1ba: 84 d2 test %dl,%dl + 1bc: 75 f2 jne 1b0 return (char*)s; return 0; - 1d2: b8 00 00 00 00 mov $0x0,%eax + 1be: b8 00 00 00 00 mov $0x0,%eax } - 1d7: 5d pop %ebp - 1d8: c3 ret + 1c3: 5d pop %ebp + 1c4: c3 ret return 0; - 1d9: b8 00 00 00 00 mov $0x0,%eax - 1de: eb f7 jmp 1d7 + 1c5: b8 00 00 00 00 mov $0x0,%eax + 1ca: eb f7 jmp 1c3 -000001e0 : +000001cc : char* gets(char *buf, int max) { - 1e0: f3 0f 1e fb endbr32 - 1e4: 55 push %ebp - 1e5: 89 e5 mov %esp,%ebp - 1e7: 57 push %edi - 1e8: 56 push %esi - 1e9: 53 push %ebx - 1ea: 83 ec 2c sub $0x2c,%esp - 1ed: 8b 75 08 mov 0x8(%ebp),%esi + 1cc: 55 push %ebp + 1cd: 89 e5 mov %esp,%ebp + 1cf: 57 push %edi + 1d0: 56 push %esi + 1d1: 53 push %ebx + 1d2: 83 ec 2c sub $0x2c,%esp + 1d5: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 1f0: bb 00 00 00 00 mov $0x0,%ebx + 1d8: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 1f5: 8d 7d e7 lea -0x19(%ebp),%edi + 1dd: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 1f8: 89 5d d4 mov %ebx,-0x2c(%ebp) - 1fb: 83 c3 01 add $0x1,%ebx - 1fe: 3b 5d 0c cmp 0xc(%ebp),%ebx - 201: 7d 27 jge 22a + 1e0: 89 5d d4 mov %ebx,-0x2c(%ebp) + 1e3: 83 c3 01 add $0x1,%ebx + 1e6: 3b 5d 0c cmp 0xc(%ebp),%ebx + 1e9: 7d 27 jge 212 cc = read(0, &c, 1); - 203: 83 ec 04 sub $0x4,%esp - 206: 6a 01 push $0x1 - 208: 57 push %edi - 209: 6a 00 push $0x0 - 20b: e8 03 01 00 00 call 313 + 1eb: 83 ec 04 sub $0x4,%esp + 1ee: 6a 01 push $0x1 + 1f0: 57 push %edi + 1f1: 6a 00 push $0x0 + 1f3: e8 f9 00 00 00 call 2f1 if(cc < 1) - 210: 83 c4 10 add $0x10,%esp - 213: 85 c0 test %eax,%eax - 215: 7e 13 jle 22a + 1f8: 83 c4 10 add $0x10,%esp + 1fb: 85 c0 test %eax,%eax + 1fd: 7e 13 jle 212 break; buf[i++] = c; - 217: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 21b: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 1ff: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 203: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 21f: 3c 0a cmp $0xa,%al - 221: 74 04 je 227 - 223: 3c 0d cmp $0xd,%al - 225: 75 d1 jne 1f8 + 207: 3c 0a cmp $0xa,%al + 209: 74 04 je 20f + 20b: 3c 0d cmp $0xd,%al + 20d: 75 d1 jne 1e0 for(i=0; i+1 < max; ){ - 227: 89 5d d4 mov %ebx,-0x2c(%ebp) + 20f: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 22a: 8b 45 d4 mov -0x2c(%ebp),%eax - 22d: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 212: 8b 45 d4 mov -0x2c(%ebp),%eax + 215: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 231: 89 f0 mov %esi,%eax - 233: 8d 65 f4 lea -0xc(%ebp),%esp - 236: 5b pop %ebx - 237: 5e pop %esi - 238: 5f pop %edi - 239: 5d pop %ebp - 23a: c3 ret + 219: 89 f0 mov %esi,%eax + 21b: 8d 65 f4 lea -0xc(%ebp),%esp + 21e: 5b pop %ebx + 21f: 5e pop %esi + 220: 5f pop %edi + 221: 5d pop %ebp + 222: c3 ret -0000023b : +00000223 : int stat(const char *n, struct stat *st) { - 23b: f3 0f 1e fb endbr32 - 23f: 55 push %ebp - 240: 89 e5 mov %esp,%ebp - 242: 56 push %esi - 243: 53 push %ebx + 223: 55 push %ebp + 224: 89 e5 mov %esp,%ebp + 226: 56 push %esi + 227: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 244: 83 ec 08 sub $0x8,%esp - 247: 6a 00 push $0x0 - 249: ff 75 08 pushl 0x8(%ebp) - 24c: e8 ea 00 00 00 call 33b + 228: 83 ec 08 sub $0x8,%esp + 22b: 6a 00 push $0x0 + 22d: ff 75 08 push 0x8(%ebp) + 230: e8 e4 00 00 00 call 319 if(fd < 0) - 251: 83 c4 10 add $0x10,%esp - 254: 85 c0 test %eax,%eax - 256: 78 24 js 27c - 258: 89 c3 mov %eax,%ebx + 235: 83 c4 10 add $0x10,%esp + 238: 85 c0 test %eax,%eax + 23a: 78 24 js 260 + 23c: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 25a: 83 ec 08 sub $0x8,%esp - 25d: ff 75 0c pushl 0xc(%ebp) - 260: 50 push %eax - 261: e8 ed 00 00 00 call 353 - 266: 89 c6 mov %eax,%esi + 23e: 83 ec 08 sub $0x8,%esp + 241: ff 75 0c push 0xc(%ebp) + 244: 50 push %eax + 245: e8 e7 00 00 00 call 331 + 24a: 89 c6 mov %eax,%esi close(fd); - 268: 89 1c 24 mov %ebx,(%esp) - 26b: e8 b3 00 00 00 call 323 + 24c: 89 1c 24 mov %ebx,(%esp) + 24f: e8 ad 00 00 00 call 301 return r; - 270: 83 c4 10 add $0x10,%esp + 254: 83 c4 10 add $0x10,%esp } - 273: 89 f0 mov %esi,%eax - 275: 8d 65 f8 lea -0x8(%ebp),%esp - 278: 5b pop %ebx - 279: 5e pop %esi - 27a: 5d pop %ebp - 27b: c3 ret + 257: 89 f0 mov %esi,%eax + 259: 8d 65 f8 lea -0x8(%ebp),%esp + 25c: 5b pop %ebx + 25d: 5e pop %esi + 25e: 5d pop %ebp + 25f: c3 ret return -1; - 27c: be ff ff ff ff mov $0xffffffff,%esi - 281: eb f0 jmp 273 + 260: be ff ff ff ff mov $0xffffffff,%esi + 265: eb f0 jmp 257 -00000283 : +00000267 : int atoi(const char *s) { - 283: f3 0f 1e fb endbr32 - 287: 55 push %ebp - 288: 89 e5 mov %esp,%ebp - 28a: 53 push %ebx - 28b: 8b 55 08 mov 0x8(%ebp),%edx + 267: 55 push %ebp + 268: 89 e5 mov %esp,%ebp + 26a: 53 push %ebx + 26b: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 28e: 0f b6 02 movzbl (%edx),%eax - 291: 8d 48 d0 lea -0x30(%eax),%ecx - 294: 80 f9 09 cmp $0x9,%cl - 297: 77 22 ja 2bb + 26e: 0f b6 02 movzbl (%edx),%eax + 271: 8d 48 d0 lea -0x30(%eax),%ecx + 274: 80 f9 09 cmp $0x9,%cl + 277: 77 24 ja 29d n = 0; - 299: b9 00 00 00 00 mov $0x0,%ecx + 279: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 29e: 83 c2 01 add $0x1,%edx - 2a1: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 2a4: 0f be c0 movsbl %al,%eax - 2a7: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 27e: 83 c2 01 add $0x1,%edx + 281: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 284: 0f be c0 movsbl %al,%eax + 287: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 2ab: 0f b6 02 movzbl (%edx),%eax - 2ae: 8d 58 d0 lea -0x30(%eax),%ebx - 2b1: 80 fb 09 cmp $0x9,%bl - 2b4: 76 e8 jbe 29e + 28b: 0f b6 02 movzbl (%edx),%eax + 28e: 8d 58 d0 lea -0x30(%eax),%ebx + 291: 80 fb 09 cmp $0x9,%bl + 294: 76 e8 jbe 27e return n; } - 2b6: 89 c8 mov %ecx,%eax - 2b8: 5b pop %ebx - 2b9: 5d pop %ebp - 2ba: c3 ret + 296: 89 c8 mov %ecx,%eax + 298: 8b 5d fc mov -0x4(%ebp),%ebx + 29b: c9 leave + 29c: c3 ret n = 0; - 2bb: b9 00 00 00 00 mov $0x0,%ecx + 29d: b9 00 00 00 00 mov $0x0,%ecx return n; - 2c0: eb f4 jmp 2b6 + 2a2: eb f2 jmp 296 -000002c2 : +000002a4 : void* memmove(void *vdst, const void *vsrc, int n) { - 2c2: f3 0f 1e fb endbr32 - 2c6: 55 push %ebp - 2c7: 89 e5 mov %esp,%ebp - 2c9: 56 push %esi - 2ca: 53 push %ebx - 2cb: 8b 75 08 mov 0x8(%ebp),%esi - 2ce: 8b 55 0c mov 0xc(%ebp),%edx - 2d1: 8b 5d 10 mov 0x10(%ebp),%ebx + 2a4: 55 push %ebp + 2a5: 89 e5 mov %esp,%ebp + 2a7: 56 push %esi + 2a8: 53 push %ebx + 2a9: 8b 75 08 mov 0x8(%ebp),%esi + 2ac: 8b 55 0c mov 0xc(%ebp),%edx + 2af: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 2d4: 85 db test %ebx,%ebx - 2d6: 7e 15 jle 2ed - 2d8: 01 f3 add %esi,%ebx + 2b2: 85 db test %ebx,%ebx + 2b4: 7e 15 jle 2cb + 2b6: 01 f3 add %esi,%ebx dst = vdst; - 2da: 89 f0 mov %esi,%eax + 2b8: 89 f0 mov %esi,%eax *dst++ = *src++; - 2dc: 83 c2 01 add $0x1,%edx - 2df: 83 c0 01 add $0x1,%eax - 2e2: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 2e6: 88 48 ff mov %cl,-0x1(%eax) + 2ba: 83 c2 01 add $0x1,%edx + 2bd: 83 c0 01 add $0x1,%eax + 2c0: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 2c4: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 2e9: 39 c3 cmp %eax,%ebx - 2eb: 75 ef jne 2dc + 2c7: 39 c3 cmp %eax,%ebx + 2c9: 75 ef jne 2ba return vdst; } - 2ed: 89 f0 mov %esi,%eax - 2ef: 5b pop %ebx - 2f0: 5e pop %esi - 2f1: 5d pop %ebp - 2f2: c3 ret + 2cb: 89 f0 mov %esi,%eax + 2cd: 5b pop %ebx + 2ce: 5e pop %esi + 2cf: 5d pop %ebp + 2d0: c3 ret -000002f3 : +000002d1 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 2f3: b8 01 00 00 00 mov $0x1,%eax - 2f8: cd 40 int $0x40 - 2fa: c3 ret + 2d1: b8 01 00 00 00 mov $0x1,%eax + 2d6: cd 40 int $0x40 + 2d8: c3 ret -000002fb : +000002d9 : SYSCALL(exit) - 2fb: b8 02 00 00 00 mov $0x2,%eax - 300: cd 40 int $0x40 - 302: c3 ret + 2d9: b8 02 00 00 00 mov $0x2,%eax + 2de: cd 40 int $0x40 + 2e0: c3 ret -00000303 : +000002e1 : SYSCALL(wait) - 303: b8 03 00 00 00 mov $0x3,%eax - 308: cd 40 int $0x40 - 30a: c3 ret + 2e1: b8 03 00 00 00 mov $0x3,%eax + 2e6: cd 40 int $0x40 + 2e8: c3 ret -0000030b : +000002e9 : SYSCALL(pipe) - 30b: b8 04 00 00 00 mov $0x4,%eax - 310: cd 40 int $0x40 - 312: c3 ret + 2e9: b8 04 00 00 00 mov $0x4,%eax + 2ee: cd 40 int $0x40 + 2f0: c3 ret -00000313 : +000002f1 : SYSCALL(read) - 313: b8 05 00 00 00 mov $0x5,%eax - 318: cd 40 int $0x40 - 31a: c3 ret + 2f1: b8 05 00 00 00 mov $0x5,%eax + 2f6: cd 40 int $0x40 + 2f8: c3 ret -0000031b : +000002f9 : SYSCALL(write) - 31b: b8 10 00 00 00 mov $0x10,%eax - 320: cd 40 int $0x40 - 322: c3 ret + 2f9: b8 10 00 00 00 mov $0x10,%eax + 2fe: cd 40 int $0x40 + 300: c3 ret -00000323 : +00000301 : SYSCALL(close) - 323: b8 15 00 00 00 mov $0x15,%eax - 328: cd 40 int $0x40 - 32a: c3 ret + 301: b8 15 00 00 00 mov $0x15,%eax + 306: cd 40 int $0x40 + 308: c3 ret -0000032b : +00000309 : SYSCALL(kill) - 32b: b8 06 00 00 00 mov $0x6,%eax - 330: cd 40 int $0x40 - 332: c3 ret + 309: b8 06 00 00 00 mov $0x6,%eax + 30e: cd 40 int $0x40 + 310: c3 ret -00000333 : +00000311 : SYSCALL(exec) - 333: b8 07 00 00 00 mov $0x7,%eax - 338: cd 40 int $0x40 - 33a: c3 ret + 311: b8 07 00 00 00 mov $0x7,%eax + 316: cd 40 int $0x40 + 318: c3 ret -0000033b : +00000319 : SYSCALL(open) - 33b: b8 0f 00 00 00 mov $0xf,%eax - 340: cd 40 int $0x40 - 342: c3 ret + 319: b8 0f 00 00 00 mov $0xf,%eax + 31e: cd 40 int $0x40 + 320: c3 ret -00000343 : +00000321 : SYSCALL(mknod) - 343: b8 11 00 00 00 mov $0x11,%eax - 348: cd 40 int $0x40 - 34a: c3 ret + 321: b8 11 00 00 00 mov $0x11,%eax + 326: cd 40 int $0x40 + 328: c3 ret -0000034b : +00000329 : SYSCALL(unlink) - 34b: b8 12 00 00 00 mov $0x12,%eax - 350: cd 40 int $0x40 - 352: c3 ret + 329: b8 12 00 00 00 mov $0x12,%eax + 32e: cd 40 int $0x40 + 330: c3 ret -00000353 : +00000331 : SYSCALL(fstat) - 353: b8 08 00 00 00 mov $0x8,%eax - 358: cd 40 int $0x40 - 35a: c3 ret + 331: b8 08 00 00 00 mov $0x8,%eax + 336: cd 40 int $0x40 + 338: c3 ret -0000035b : +00000339 : SYSCALL(link) - 35b: b8 13 00 00 00 mov $0x13,%eax - 360: cd 40 int $0x40 - 362: c3 ret + 339: b8 13 00 00 00 mov $0x13,%eax + 33e: cd 40 int $0x40 + 340: c3 ret -00000363 : +00000341 : SYSCALL(mkdir) - 363: b8 14 00 00 00 mov $0x14,%eax - 368: cd 40 int $0x40 - 36a: c3 ret + 341: b8 14 00 00 00 mov $0x14,%eax + 346: cd 40 int $0x40 + 348: c3 ret -0000036b : +00000349 : SYSCALL(chdir) - 36b: b8 09 00 00 00 mov $0x9,%eax - 370: cd 40 int $0x40 - 372: c3 ret + 349: b8 09 00 00 00 mov $0x9,%eax + 34e: cd 40 int $0x40 + 350: c3 ret -00000373 : +00000351 : SYSCALL(dup) - 373: b8 0a 00 00 00 mov $0xa,%eax - 378: cd 40 int $0x40 - 37a: c3 ret + 351: b8 0a 00 00 00 mov $0xa,%eax + 356: cd 40 int $0x40 + 358: c3 ret -0000037b : +00000359 : SYSCALL(getpid) - 37b: b8 0b 00 00 00 mov $0xb,%eax - 380: cd 40 int $0x40 - 382: c3 ret + 359: b8 0b 00 00 00 mov $0xb,%eax + 35e: cd 40 int $0x40 + 360: c3 ret -00000383 : +00000361 : SYSCALL(sbrk) - 383: b8 0c 00 00 00 mov $0xc,%eax - 388: cd 40 int $0x40 - 38a: c3 ret + 361: b8 0c 00 00 00 mov $0xc,%eax + 366: cd 40 int $0x40 + 368: c3 ret -0000038b : +00000369 : SYSCALL(sleep) - 38b: b8 0d 00 00 00 mov $0xd,%eax - 390: cd 40 int $0x40 - 392: c3 ret + 369: b8 0d 00 00 00 mov $0xd,%eax + 36e: cd 40 int $0x40 + 370: c3 ret -00000393 : +00000371 : SYSCALL(uptime) - 393: b8 0e 00 00 00 mov $0xe,%eax - 398: cd 40 int $0x40 - 39a: c3 ret + 371: b8 0e 00 00 00 mov $0xe,%eax + 376: cd 40 int $0x40 + 378: c3 ret -0000039b : +00000379 : SYSCALL(slabtest) - 39b: b8 16 00 00 00 mov $0x16,%eax - 3a0: cd 40 int $0x40 - 3a2: c3 ret + 379: b8 16 00 00 00 mov $0x16,%eax + 37e: cd 40 int $0x40 + 380: c3 ret -000003a3 : +00000381 : SYSCALL(ps) - 3a3: b8 17 00 00 00 mov $0x17,%eax - 3a8: cd 40 int $0x40 - 3aa: c3 ret + 381: b8 17 00 00 00 mov $0x17,%eax + 386: cd 40 int $0x40 + 388: c3 ret -000003ab : +00000389 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 3ab: 55 push %ebp - 3ac: 89 e5 mov %esp,%ebp - 3ae: 57 push %edi - 3af: 56 push %esi - 3b0: 53 push %ebx - 3b1: 83 ec 3c sub $0x3c,%esp - 3b4: 89 45 c4 mov %eax,-0x3c(%ebp) - 3b7: 89 d3 mov %edx,%ebx + 389: 55 push %ebp + 38a: 89 e5 mov %esp,%ebp + 38c: 57 push %edi + 38d: 56 push %esi + 38e: 53 push %ebx + 38f: 83 ec 3c sub $0x3c,%esp + 392: 89 45 c4 mov %eax,-0x3c(%ebp) + 395: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 3b9: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 3bd: 74 77 je 436 - 3bf: 85 d2 test %edx,%edx - 3c1: 79 73 jns 436 + 397: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 39b: 74 79 je 416 + 39d: 85 d2 test %edx,%edx + 39f: 79 75 jns 416 neg = 1; x = -xx; - 3c3: f7 db neg %ebx + 3a1: 89 d1 mov %edx,%ecx + 3a3: f7 d9 neg %ecx neg = 1; - 3c5: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 3a5: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 3cc: be 00 00 00 00 mov $0x0,%esi + 3ac: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 3d1: 89 f7 mov %esi,%edi - 3d3: 83 c6 01 add $0x1,%esi - 3d6: 89 d8 mov %ebx,%eax - 3d8: ba 00 00 00 00 mov $0x0,%edx - 3dd: f7 f1 div %ecx - 3df: 0f b6 92 84 07 00 00 movzbl 0x784(%edx),%edx - 3e6: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 3b1: 89 df mov %ebx,%edi + 3b3: 83 c3 01 add $0x1,%ebx + 3b6: 89 c8 mov %ecx,%eax + 3b8: ba 00 00 00 00 mov $0x0,%edx + 3bd: f7 f6 div %esi + 3bf: 0f b6 92 9c 07 00 00 movzbl 0x79c(%edx),%edx + 3c6: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 3ea: 89 da mov %ebx,%edx - 3ec: 89 c3 mov %eax,%ebx - 3ee: 39 d1 cmp %edx,%ecx - 3f0: 76 df jbe 3d1 + 3ca: 89 ca mov %ecx,%edx + 3cc: 89 c1 mov %eax,%ecx + 3ce: 39 d6 cmp %edx,%esi + 3d0: 76 df jbe 3b1 if(neg) - 3f2: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 3f6: 74 08 je 400 + 3d2: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 3d6: 74 08 je 3e0 buf[i++] = '-'; - 3f8: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 3fd: 8d 77 02 lea 0x2(%edi),%esi + 3d8: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 3dd: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 400: 85 f6 test %esi,%esi - 402: 7e 2a jle 42e - 404: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 408: 8d 7d d8 lea -0x28(%ebp),%edi + 3e0: 85 db test %ebx,%ebx + 3e2: 7e 2a jle 40e + 3e4: 8d 7d d8 lea -0x28(%ebp),%edi + 3e7: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 40b: 8d 75 d7 lea -0x29(%ebp),%esi + 3eb: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 40e: 0f b6 03 movzbl (%ebx),%eax - 411: 88 45 d7 mov %al,-0x29(%ebp) + 3ee: 0f b6 03 movzbl (%ebx),%eax + 3f1: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 414: 83 ec 04 sub $0x4,%esp - 417: 6a 01 push $0x1 - 419: 56 push %esi - 41a: ff 75 c4 pushl -0x3c(%ebp) - 41d: e8 f9 fe ff ff call 31b + 3f4: 83 ec 04 sub $0x4,%esp + 3f7: 6a 01 push $0x1 + 3f9: 56 push %esi + 3fa: ff 75 c4 push -0x3c(%ebp) + 3fd: e8 f7 fe ff ff call 2f9 while(--i >= 0) - 422: 89 d8 mov %ebx,%eax - 424: 83 eb 01 sub $0x1,%ebx - 427: 83 c4 10 add $0x10,%esp - 42a: 39 f8 cmp %edi,%eax - 42c: 75 e0 jne 40e + 402: 89 d8 mov %ebx,%eax + 404: 83 eb 01 sub $0x1,%ebx + 407: 83 c4 10 add $0x10,%esp + 40a: 39 f8 cmp %edi,%eax + 40c: 75 e0 jne 3ee } - 42e: 8d 65 f4 lea -0xc(%ebp),%esp - 431: 5b pop %ebx - 432: 5e pop %esi - 433: 5f pop %edi - 434: 5d pop %ebp - 435: c3 ret + 40e: 8d 65 f4 lea -0xc(%ebp),%esp + 411: 5b pop %ebx + 412: 5e pop %esi + 413: 5f pop %edi + 414: 5d pop %ebp + 415: c3 ret + x = xx; + 416: 89 d1 mov %edx,%ecx neg = 0; - 436: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 43d: eb 8d jmp 3cc + 418: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 41f: eb 8b jmp 3ac -0000043f : +00000421 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 43f: f3 0f 1e fb endbr32 - 443: 55 push %ebp - 444: 89 e5 mov %esp,%ebp - 446: 57 push %edi - 447: 56 push %esi - 448: 53 push %ebx - 449: 83 ec 2c sub $0x2c,%esp + 421: 55 push %ebp + 422: 89 e5 mov %esp,%ebp + 424: 57 push %edi + 425: 56 push %esi + 426: 53 push %ebx + 427: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 44c: 8b 75 0c mov 0xc(%ebp),%esi - 44f: 0f b6 1e movzbl (%esi),%ebx - 452: 84 db test %bl,%bl - 454: 0f 84 ab 01 00 00 je 605 - 45a: 83 c6 01 add $0x1,%esi + 42a: 8b 75 0c mov 0xc(%ebp),%esi + 42d: 0f b6 1e movzbl (%esi),%ebx + 430: 84 db test %bl,%bl + 432: 0f 84 9f 01 00 00 je 5d7 + 438: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 45d: 8d 45 10 lea 0x10(%ebp),%eax - 460: 89 45 d4 mov %eax,-0x2c(%ebp) + 43b: 8d 45 10 lea 0x10(%ebp),%eax + 43e: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 463: bf 00 00 00 00 mov $0x0,%edi - 468: eb 2d jmp 497 + 441: bf 00 00 00 00 mov $0x0,%edi + 446: eb 2d jmp 475 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 46a: 88 5d e7 mov %bl,-0x19(%ebp) + 448: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 46d: 83 ec 04 sub $0x4,%esp - 470: 6a 01 push $0x1 - 472: 8d 45 e7 lea -0x19(%ebp),%eax - 475: 50 push %eax - 476: ff 75 08 pushl 0x8(%ebp) - 479: e8 9d fe ff ff call 31b + 44b: 83 ec 04 sub $0x4,%esp + 44e: 6a 01 push $0x1 + 450: 8d 45 e7 lea -0x19(%ebp),%eax + 453: 50 push %eax + 454: ff 75 08 push 0x8(%ebp) + 457: e8 9d fe ff ff call 2f9 putc(fd, c); - 47e: 83 c4 10 add $0x10,%esp - 481: eb 05 jmp 488 + 45c: 83 c4 10 add $0x10,%esp + 45f: eb 05 jmp 466 } } else if(state == '%'){ - 483: 83 ff 25 cmp $0x25,%edi - 486: 74 22 je 4aa + 461: 83 ff 25 cmp $0x25,%edi + 464: 74 1f je 485 for(i = 0; fmt[i]; i++){ - 488: 83 c6 01 add $0x1,%esi - 48b: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 48f: 84 db test %bl,%bl - 491: 0f 84 6e 01 00 00 je 605 + 466: 83 c6 01 add $0x1,%esi + 469: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 46d: 84 db test %bl,%bl + 46f: 0f 84 62 01 00 00 je 5d7 c = fmt[i] & 0xff; - 497: 0f be d3 movsbl %bl,%edx - 49a: 0f b6 c3 movzbl %bl,%eax + 475: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 49d: 85 ff test %edi,%edi - 49f: 75 e2 jne 483 + 478: 85 ff test %edi,%edi + 47a: 75 e5 jne 461 if(c == '%'){ - 4a1: 83 f8 25 cmp $0x25,%eax - 4a4: 75 c4 jne 46a + 47c: 83 f8 25 cmp $0x25,%eax + 47f: 75 c7 jne 448 state = '%'; - 4a6: 89 c7 mov %eax,%edi - 4a8: eb de jmp 488 + 481: 89 c7 mov %eax,%edi + 483: eb e1 jmp 466 if(c == 'd'){ - 4aa: 83 f8 64 cmp $0x64,%eax - 4ad: 74 59 je 508 + 485: 83 f8 25 cmp $0x25,%eax + 488: 0f 84 f2 00 00 00 je 580 + 48e: 8d 50 9d lea -0x63(%eax),%edx + 491: 83 fa 15 cmp $0x15,%edx + 494: 0f 87 07 01 00 00 ja 5a1 + 49a: 0f 87 01 01 00 00 ja 5a1 + 4a0: ff 24 95 44 07 00 00 jmp *0x744(,%edx,4) printint(fd, *ap, 10, 1); + 4a7: 83 ec 0c sub $0xc,%esp + 4aa: 6a 01 push $0x1 + 4ac: b9 0a 00 00 00 mov $0xa,%ecx + 4b1: 8b 7d d4 mov -0x2c(%ebp),%edi + 4b4: 8b 17 mov (%edi),%edx + 4b6: 8b 45 08 mov 0x8(%ebp),%eax + 4b9: e8 cb fe ff ff call 389 ap++; - } else if(c == 'x' || c == 'p'){ - 4af: 81 e2 f7 00 00 00 and $0xf7,%edx - 4b5: 83 fa 70 cmp $0x70,%edx - 4b8: 74 7a je 534 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 4ba: 83 f8 73 cmp $0x73,%eax - 4bd: 0f 84 9d 00 00 00 je 560 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 4c3: 83 f8 63 cmp $0x63,%eax - 4c6: 0f 84 ec 00 00 00 je 5b8 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 4cc: 83 f8 25 cmp $0x25,%eax - 4cf: 0f 84 0f 01 00 00 je 5e4 - putc(fd, c); + 4be: 89 f8 mov %edi,%eax + 4c0: 83 c0 04 add $0x4,%eax + 4c3: 89 45 d4 mov %eax,-0x2c(%ebp) + 4c6: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 4d5: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 4d9: 83 ec 04 sub $0x4,%esp - 4dc: 6a 01 push $0x1 - 4de: 8d 45 e7 lea -0x19(%ebp),%eax - 4e1: 50 push %eax - 4e2: ff 75 08 pushl 0x8(%ebp) - 4e5: e8 31 fe ff ff call 31b putc(fd, c); - 4ea: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 4ed: 83 c4 0c add $0xc,%esp - 4f0: 6a 01 push $0x1 - 4f2: 8d 45 e7 lea -0x19(%ebp),%eax - 4f5: 50 push %eax - 4f6: ff 75 08 pushl 0x8(%ebp) - 4f9: e8 1d fe ff ff call 31b - putc(fd, c); - 4fe: 83 c4 10 add $0x10,%esp } state = 0; - 501: bf 00 00 00 00 mov $0x0,%edi - 506: eb 80 jmp 488 - printint(fd, *ap, 10, 1); - 508: 83 ec 0c sub $0xc,%esp - 50b: 6a 01 push $0x1 - 50d: b9 0a 00 00 00 mov $0xa,%ecx - 512: 8b 7d d4 mov -0x2c(%ebp),%edi - 515: 8b 17 mov (%edi),%edx - 517: 8b 45 08 mov 0x8(%ebp),%eax - 51a: e8 8c fe ff ff call 3ab - ap++; - 51f: 89 f8 mov %edi,%eax - 521: 83 c0 04 add $0x4,%eax - 524: 89 45 d4 mov %eax,-0x2c(%ebp) - 527: 83 c4 10 add $0x10,%esp - state = 0; - 52a: bf 00 00 00 00 mov $0x0,%edi - 52f: e9 54 ff ff ff jmp 488 + 4c9: bf 00 00 00 00 mov $0x0,%edi + 4ce: eb 96 jmp 466 printint(fd, *ap, 16, 0); - 534: 83 ec 0c sub $0xc,%esp - 537: 6a 00 push $0x0 - 539: b9 10 00 00 00 mov $0x10,%ecx - 53e: 8b 7d d4 mov -0x2c(%ebp),%edi - 541: 8b 17 mov (%edi),%edx - 543: 8b 45 08 mov 0x8(%ebp),%eax - 546: e8 60 fe ff ff call 3ab + 4d0: 83 ec 0c sub $0xc,%esp + 4d3: 6a 00 push $0x0 + 4d5: b9 10 00 00 00 mov $0x10,%ecx + 4da: 8b 7d d4 mov -0x2c(%ebp),%edi + 4dd: 8b 17 mov (%edi),%edx + 4df: 8b 45 08 mov 0x8(%ebp),%eax + 4e2: e8 a2 fe ff ff call 389 ap++; - 54b: 89 f8 mov %edi,%eax - 54d: 83 c0 04 add $0x4,%eax - 550: 89 45 d4 mov %eax,-0x2c(%ebp) - 553: 83 c4 10 add $0x10,%esp + 4e7: 89 f8 mov %edi,%eax + 4e9: 83 c0 04 add $0x4,%eax + 4ec: 89 45 d4 mov %eax,-0x2c(%ebp) + 4ef: 83 c4 10 add $0x10,%esp state = 0; - 556: bf 00 00 00 00 mov $0x0,%edi - 55b: e9 28 ff ff ff jmp 488 + 4f2: bf 00 00 00 00 mov $0x0,%edi + 4f7: e9 6a ff ff ff jmp 466 s = (char*)*ap; - 560: 8b 4d d4 mov -0x2c(%ebp),%ecx - 563: 8b 01 mov (%ecx),%eax + 4fc: 8b 4d d4 mov -0x2c(%ebp),%ecx + 4ff: 8b 01 mov (%ecx),%eax ap++; - 565: 83 c1 04 add $0x4,%ecx - 568: 89 4d d4 mov %ecx,-0x2c(%ebp) + 501: 83 c1 04 add $0x4,%ecx + 504: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 56b: 85 c0 test %eax,%eax - 56d: 74 13 je 582 + 507: 85 c0 test %eax,%eax + 509: 74 13 je 51e s = (char*)*ap; - 56f: 89 c3 mov %eax,%ebx + 50b: 89 c3 mov %eax,%ebx while(*s != 0){ - 571: 0f b6 00 movzbl (%eax),%eax + 50d: 0f b6 00 movzbl (%eax),%eax state = 0; - 574: bf 00 00 00 00 mov $0x0,%edi + 510: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 579: 84 c0 test %al,%al - 57b: 75 0f jne 58c - 57d: e9 06 ff ff ff jmp 488 + 515: 84 c0 test %al,%al + 517: 75 0f jne 528 + 519: e9 48 ff ff ff jmp 466 s = "(null)"; - 582: bb 7b 07 00 00 mov $0x77b,%ebx + 51e: bb 3b 07 00 00 mov $0x73b,%ebx while(*s != 0){ - 587: b8 28 00 00 00 mov $0x28,%eax - 58c: 8b 7d 08 mov 0x8(%ebp),%edi + 523: b8 28 00 00 00 mov $0x28,%eax + 528: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 58f: 88 45 e7 mov %al,-0x19(%ebp) + 52b: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 592: 83 ec 04 sub $0x4,%esp - 595: 6a 01 push $0x1 - 597: 8d 45 e7 lea -0x19(%ebp),%eax - 59a: 50 push %eax - 59b: 57 push %edi - 59c: e8 7a fd ff ff call 31b + 52e: 83 ec 04 sub $0x4,%esp + 531: 6a 01 push $0x1 + 533: 8d 45 e7 lea -0x19(%ebp),%eax + 536: 50 push %eax + 537: 57 push %edi + 538: e8 bc fd ff ff call 2f9 s++; - 5a1: 83 c3 01 add $0x1,%ebx + 53d: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 5a4: 0f b6 03 movzbl (%ebx),%eax - 5a7: 83 c4 10 add $0x10,%esp - 5aa: 84 c0 test %al,%al - 5ac: 75 e1 jne 58f + 540: 0f b6 03 movzbl (%ebx),%eax + 543: 83 c4 10 add $0x10,%esp + 546: 84 c0 test %al,%al + 548: 75 e1 jne 52b state = 0; - 5ae: bf 00 00 00 00 mov $0x0,%edi - 5b3: e9 d0 fe ff ff jmp 488 + 54a: bf 00 00 00 00 mov $0x0,%edi + 54f: e9 12 ff ff ff jmp 466 putc(fd, *ap); - 5b8: 8b 7d d4 mov -0x2c(%ebp),%edi - 5bb: 8b 07 mov (%edi),%eax - 5bd: 88 45 e7 mov %al,-0x19(%ebp) + 554: 8b 7d d4 mov -0x2c(%ebp),%edi + 557: 8b 07 mov (%edi),%eax + 559: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 5c0: 83 ec 04 sub $0x4,%esp - 5c3: 6a 01 push $0x1 - 5c5: 8d 45 e7 lea -0x19(%ebp),%eax - 5c8: 50 push %eax - 5c9: ff 75 08 pushl 0x8(%ebp) - 5cc: e8 4a fd ff ff call 31b + 55c: 83 ec 04 sub $0x4,%esp + 55f: 6a 01 push $0x1 + 561: 8d 45 e7 lea -0x19(%ebp),%eax + 564: 50 push %eax + 565: ff 75 08 push 0x8(%ebp) + 568: e8 8c fd ff ff call 2f9 ap++; - 5d1: 83 c7 04 add $0x4,%edi - 5d4: 89 7d d4 mov %edi,-0x2c(%ebp) - 5d7: 83 c4 10 add $0x10,%esp + 56d: 83 c7 04 add $0x4,%edi + 570: 89 7d d4 mov %edi,-0x2c(%ebp) + 573: 83 c4 10 add $0x10,%esp state = 0; - 5da: bf 00 00 00 00 mov $0x0,%edi - 5df: e9 a4 fe ff ff jmp 488 + 576: bf 00 00 00 00 mov $0x0,%edi + 57b: e9 e6 fe ff ff jmp 466 putc(fd, c); - 5e4: 88 5d e7 mov %bl,-0x19(%ebp) + 580: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 5e7: 83 ec 04 sub $0x4,%esp - 5ea: 6a 01 push $0x1 - 5ec: 8d 45 e7 lea -0x19(%ebp),%eax - 5ef: 50 push %eax - 5f0: ff 75 08 pushl 0x8(%ebp) - 5f3: e8 23 fd ff ff call 31b - 5f8: 83 c4 10 add $0x10,%esp + 583: 83 ec 04 sub $0x4,%esp + 586: 6a 01 push $0x1 + 588: 8d 45 e7 lea -0x19(%ebp),%eax + 58b: 50 push %eax + 58c: ff 75 08 push 0x8(%ebp) + 58f: e8 65 fd ff ff call 2f9 + 594: 83 c4 10 add $0x10,%esp + state = 0; + 597: bf 00 00 00 00 mov $0x0,%edi + 59c: e9 c5 fe ff ff jmp 466 + putc(fd, '%'); + 5a1: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 5a5: 83 ec 04 sub $0x4,%esp + 5a8: 6a 01 push $0x1 + 5aa: 8d 45 e7 lea -0x19(%ebp),%eax + 5ad: 50 push %eax + 5ae: ff 75 08 push 0x8(%ebp) + 5b1: e8 43 fd ff ff call 2f9 + putc(fd, c); + 5b6: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 5b9: 83 c4 0c add $0xc,%esp + 5bc: 6a 01 push $0x1 + 5be: 8d 45 e7 lea -0x19(%ebp),%eax + 5c1: 50 push %eax + 5c2: ff 75 08 push 0x8(%ebp) + 5c5: e8 2f fd ff ff call 2f9 + putc(fd, c); + 5ca: 83 c4 10 add $0x10,%esp state = 0; - 5fb: bf 00 00 00 00 mov $0x0,%edi - 600: e9 83 fe ff ff jmp 488 + 5cd: bf 00 00 00 00 mov $0x0,%edi + 5d2: e9 8f fe ff ff jmp 466 } } } - 605: 8d 65 f4 lea -0xc(%ebp),%esp - 608: 5b pop %ebx - 609: 5e pop %esi - 60a: 5f pop %edi - 60b: 5d pop %ebp - 60c: c3 ret - -0000060d : + 5d7: 8d 65 f4 lea -0xc(%ebp),%esp + 5da: 5b pop %ebx + 5db: 5e pop %esi + 5dc: 5f pop %edi + 5dd: 5d pop %ebp + 5de: c3 ret + +000005df : static Header base; static Header *freep; void free(void *ap) { - 60d: f3 0f 1e fb endbr32 - 611: 55 push %ebp - 612: 89 e5 mov %esp,%ebp - 614: 57 push %edi - 615: 56 push %esi - 616: 53 push %ebx - 617: 8b 5d 08 mov 0x8(%ebp),%ebx + 5df: 55 push %ebp + 5e0: 89 e5 mov %esp,%ebp + 5e2: 57 push %edi + 5e3: 56 push %esi + 5e4: 53 push %ebx + 5e5: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 61a: 8d 4b f8 lea -0x8(%ebx),%ecx + 5e8: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 61d: a1 f8 09 00 00 mov 0x9f8,%eax - 622: eb 0c jmp 630 + 5eb: a1 10 0a 00 00 mov 0xa10,%eax + 5f0: eb 0c jmp 5fe if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 624: 8b 10 mov (%eax),%edx - 626: 39 c2 cmp %eax,%edx - 628: 77 04 ja 62e - 62a: 39 ca cmp %ecx,%edx - 62c: 77 10 ja 63e + 5f2: 8b 10 mov (%eax),%edx + 5f4: 39 c2 cmp %eax,%edx + 5f6: 77 04 ja 5fc + 5f8: 39 ca cmp %ecx,%edx + 5fa: 77 10 ja 60c { - 62e: 89 d0 mov %edx,%eax + 5fc: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 630: 39 c8 cmp %ecx,%eax - 632: 73 f0 jae 624 - 634: 8b 10 mov (%eax),%edx - 636: 39 ca cmp %ecx,%edx - 638: 77 04 ja 63e + 5fe: 39 c8 cmp %ecx,%eax + 600: 73 f0 jae 5f2 + 602: 8b 10 mov (%eax),%edx + 604: 39 ca cmp %ecx,%edx + 606: 77 04 ja 60c if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 63a: 39 c2 cmp %eax,%edx - 63c: 77 f0 ja 62e + 608: 39 c2 cmp %eax,%edx + 60a: 77 f0 ja 5fc break; if(bp + bp->s.size == p->s.ptr){ - 63e: 8b 73 fc mov -0x4(%ebx),%esi - 641: 8b 10 mov (%eax),%edx - 643: 8d 3c f1 lea (%ecx,%esi,8),%edi - 646: 39 fa cmp %edi,%edx - 648: 74 19 je 663 + 60c: 8b 73 fc mov -0x4(%ebx),%esi + 60f: 8b 10 mov (%eax),%edx + 611: 8d 3c f1 lea (%ecx,%esi,8),%edi + 614: 39 fa cmp %edi,%edx + 616: 74 19 je 631 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 618: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 64a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 64d: 8b 50 04 mov 0x4(%eax),%edx - 650: 8d 34 d0 lea (%eax,%edx,8),%esi - 653: 39 f1 cmp %esi,%ecx - 655: 74 1b je 672 + 61b: 8b 50 04 mov 0x4(%eax),%edx + 61e: 8d 34 d0 lea (%eax,%edx,8),%esi + 621: 39 f1 cmp %esi,%ecx + 623: 74 18 je 63d p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 625: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 657: 89 08 mov %ecx,(%eax) freep = p; - 659: a3 f8 09 00 00 mov %eax,0x9f8 + 627: a3 10 0a 00 00 mov %eax,0xa10 } - 65e: 5b pop %ebx - 65f: 5e pop %esi - 660: 5f pop %edi - 661: 5d pop %ebp - 662: c3 ret + 62c: 5b pop %ebx + 62d: 5e pop %esi + 62e: 5f pop %edi + 62f: 5d pop %ebp + 630: c3 ret bp->s.size += p->s.ptr->s.size; - 663: 03 72 04 add 0x4(%edx),%esi - 666: 89 73 fc mov %esi,-0x4(%ebx) + 631: 03 72 04 add 0x4(%edx),%esi + 634: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 669: 8b 10 mov (%eax),%edx - 66b: 8b 12 mov (%edx),%edx - 66d: 89 53 f8 mov %edx,-0x8(%ebx) - 670: eb db jmp 64d + 637: 8b 10 mov (%eax),%edx + 639: 8b 12 mov (%edx),%edx + 63b: eb db jmp 618 p->s.size += bp->s.size; - 672: 03 53 fc add -0x4(%ebx),%edx - 675: 89 50 04 mov %edx,0x4(%eax) + 63d: 03 53 fc add -0x4(%ebx),%edx + 640: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 678: 8b 53 f8 mov -0x8(%ebx),%edx - 67b: 89 10 mov %edx,(%eax) - 67d: eb da jmp 659 + 643: 8b 4b f8 mov -0x8(%ebx),%ecx + 646: eb dd jmp 625 -0000067f : +00000648 : return freep; } void* malloc(uint nbytes) { - 67f: f3 0f 1e fb endbr32 - 683: 55 push %ebp - 684: 89 e5 mov %esp,%ebp - 686: 57 push %edi - 687: 56 push %esi - 688: 53 push %ebx - 689: 83 ec 0c sub $0xc,%esp + 648: 55 push %ebp + 649: 89 e5 mov %esp,%ebp + 64b: 57 push %edi + 64c: 56 push %esi + 64d: 53 push %ebx + 64e: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 68c: 8b 45 08 mov 0x8(%ebp),%eax - 68f: 8d 58 07 lea 0x7(%eax),%ebx - 692: c1 eb 03 shr $0x3,%ebx - 695: 83 c3 01 add $0x1,%ebx + 651: 8b 45 08 mov 0x8(%ebp),%eax + 654: 8d 58 07 lea 0x7(%eax),%ebx + 657: c1 eb 03 shr $0x3,%ebx + 65a: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 698: 8b 15 f8 09 00 00 mov 0x9f8,%edx - 69e: 85 d2 test %edx,%edx - 6a0: 74 20 je 6c2 + 65d: 8b 15 10 0a 00 00 mov 0xa10,%edx + 663: 85 d2 test %edx,%edx + 665: 74 1c je 683 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6a2: 8b 02 mov (%edx),%eax + 667: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 6a4: 8b 48 04 mov 0x4(%eax),%ecx - 6a7: 39 cb cmp %ecx,%ebx - 6a9: 76 3c jbe 6e7 - 6ab: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 6b1: be 00 10 00 00 mov $0x1000,%esi - 6b6: 0f 43 f3 cmovae %ebx,%esi + 669: 8b 48 04 mov 0x4(%eax),%ecx + 66c: 39 cb cmp %ecx,%ebx + 66e: 76 38 jbe 6a8 + 670: be 00 10 00 00 mov $0x1000,%esi + 675: 39 f3 cmp %esi,%ebx + 677: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 6b9: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 6c0: eb 72 jmp 734 + 67a: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 681: eb 72 jmp 6f5 base.s.ptr = freep = prevp = &base; - 6c2: c7 05 f8 09 00 00 fc movl $0x9fc,0x9f8 - 6c9: 09 00 00 - 6cc: c7 05 fc 09 00 00 fc movl $0x9fc,0x9fc - 6d3: 09 00 00 + 683: c7 05 10 0a 00 00 14 movl $0xa14,0xa10 + 68a: 0a 00 00 + 68d: c7 05 14 0a 00 00 14 movl $0xa14,0xa14 + 694: 0a 00 00 base.s.size = 0; - 6d6: c7 05 00 0a 00 00 00 movl $0x0,0xa00 - 6dd: 00 00 00 + 697: c7 05 18 0a 00 00 00 movl $0x0,0xa18 + 69e: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6e0: b8 fc 09 00 00 mov $0x9fc,%eax - 6e5: eb c4 jmp 6ab + 6a1: b8 14 0a 00 00 mov $0xa14,%eax + 6a6: eb c8 jmp 670 if(p->s.size == nunits) - 6e7: 39 cb cmp %ecx,%ebx - 6e9: 74 1e je 709 + 6a8: 39 cb cmp %ecx,%ebx + 6aa: 74 1e je 6ca prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 6eb: 29 d9 sub %ebx,%ecx - 6ed: 89 48 04 mov %ecx,0x4(%eax) + 6ac: 29 d9 sub %ebx,%ecx + 6ae: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 6f0: 8d 04 c8 lea (%eax,%ecx,8),%eax + 6b1: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 6f3: 89 58 04 mov %ebx,0x4(%eax) + 6b4: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 6f6: 89 15 f8 09 00 00 mov %edx,0x9f8 + 6b7: 89 15 10 0a 00 00 mov %edx,0xa10 return (void*)(p + 1); - 6fc: 8d 50 08 lea 0x8(%eax),%edx + 6bd: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 6ff: 89 d0 mov %edx,%eax - 701: 8d 65 f4 lea -0xc(%ebp),%esp - 704: 5b pop %ebx - 705: 5e pop %esi - 706: 5f pop %edi - 707: 5d pop %ebp - 708: c3 ret + 6c0: 89 d0 mov %edx,%eax + 6c2: 8d 65 f4 lea -0xc(%ebp),%esp + 6c5: 5b pop %ebx + 6c6: 5e pop %esi + 6c7: 5f pop %edi + 6c8: 5d pop %ebp + 6c9: c3 ret prevp->s.ptr = p->s.ptr; - 709: 8b 08 mov (%eax),%ecx - 70b: 89 0a mov %ecx,(%edx) - 70d: eb e7 jmp 6f6 + 6ca: 8b 08 mov (%eax),%ecx + 6cc: 89 0a mov %ecx,(%edx) + 6ce: eb e7 jmp 6b7 hp->s.size = nu; - 70f: 89 70 04 mov %esi,0x4(%eax) + 6d0: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 712: 83 ec 0c sub $0xc,%esp - 715: 83 c0 08 add $0x8,%eax - 718: 50 push %eax - 719: e8 ef fe ff ff call 60d + 6d3: 83 ec 0c sub $0xc,%esp + 6d6: 83 c0 08 add $0x8,%eax + 6d9: 50 push %eax + 6da: e8 00 ff ff ff call 5df return freep; - 71e: 8b 15 f8 09 00 00 mov 0x9f8,%edx + 6df: 8b 15 10 0a 00 00 mov 0xa10,%edx if((p = morecore(nunits)) == 0) - 724: 83 c4 10 add $0x10,%esp - 727: 85 d2 test %edx,%edx - 729: 74 d4 je 6ff + 6e5: 83 c4 10 add $0x10,%esp + 6e8: 85 d2 test %edx,%edx + 6ea: 74 d4 je 6c0 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 72b: 8b 02 mov (%edx),%eax + 6ec: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 72d: 8b 48 04 mov 0x4(%eax),%ecx - 730: 39 d9 cmp %ebx,%ecx - 732: 73 b3 jae 6e7 + 6ee: 8b 48 04 mov 0x4(%eax),%ecx + 6f1: 39 d9 cmp %ebx,%ecx + 6f3: 73 b3 jae 6a8 if(p == freep) - 734: 89 c2 mov %eax,%edx - 736: 39 05 f8 09 00 00 cmp %eax,0x9f8 - 73c: 75 ed jne 72b + 6f5: 89 c2 mov %eax,%edx + 6f7: 39 05 10 0a 00 00 cmp %eax,0xa10 + 6fd: 75 ed jne 6ec p = sbrk(nu * sizeof(Header)); - 73e: 83 ec 0c sub $0xc,%esp - 741: 57 push %edi - 742: e8 3c fc ff ff call 383 + 6ff: 83 ec 0c sub $0xc,%esp + 702: 57 push %edi + 703: e8 59 fc ff ff call 361 if(p == (char*)-1) - 747: 83 c4 10 add $0x10,%esp - 74a: 83 f8 ff cmp $0xffffffff,%eax - 74d: 75 c0 jne 70f + 708: 83 c4 10 add $0x10,%esp + 70b: 83 f8 ff cmp $0xffffffff,%eax + 70e: 75 c0 jne 6d0 return 0; - 74f: ba 00 00 00 00 mov $0x0,%edx - 754: eb a9 jmp 6ff + 710: ba 00 00 00 00 mov $0x0,%edx + 715: eb a9 jmp 6c0 diff --git a/src/user/stressfs.d b/src/user/stressfs.d new file mode 100644 index 0000000..e03760e --- /dev/null +++ b/src/user/stressfs.d @@ -0,0 +1,2 @@ +user/stressfs.o: user/stressfs.c /usr/include/stdc-predef.h types.h \ + stat.h user.h fs.h fcntl.h diff --git a/src/user/stressfs.o b/src/user/stressfs.o new file mode 100644 index 0000000..65cc095 Binary files /dev/null and b/src/user/stressfs.o differ diff --git a/src/user/stressfs.sym b/src/user/stressfs.sym index e5889c6..36e5182 100644 --- a/src/user/stressfs.sym +++ b/src/user/stressfs.sym @@ -1,59 +1,47 @@ -00000000 .text -00000758 .rodata -00000798 .eh_frame -000009f8 .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 -000003ab printint -00000784 digits.1089 +00000389 printint +0000079c digits.0 00000000 umalloc.c -000009f8 freep -000009fc base -00000115 strcpy -0000043f printf -000002c2 memmove -00000343 mknod -000003a3 ps -000001e0 gets -0000037b getpid -0000067f malloc -0000038b sleep -0000030b pipe -0000039b slabtest -0000031b write -00000353 fstat -0000032b kill -0000036b chdir -00000333 exec -00000303 wait -00000313 read -0000034b unlink -000002f3 fork -00000383 sbrk -00000393 uptime -000009f8 __bss_start -00000194 memset +00000a10 freep +00000a14 base +00000111 strcpy +00000421 printf +000002a4 memmove +00000321 mknod +00000381 ps +000001cc gets +00000359 getpid +00000648 malloc +00000369 sleep +000002e9 pipe +00000379 slabtest +000002f9 write +00000331 fstat +00000309 kill +00000349 chdir +00000311 exec +000002e1 wait +000002f1 read +00000329 unlink +000002d1 fork +00000361 sbrk +00000371 uptime +00000a10 __bss_start +00000186 memset 00000000 main -0000013b strcmp -00000373 dup -0000023b stat -000009f8 _edata -00000a04 _end -0000035b link -000002fb exit -00000283 atoi -0000016a strlen -0000033b open -000001af strchr -00000363 mkdir -00000323 close -0000060d free +00000135 strcmp +00000351 dup +00000223 stat +00000a10 _edata +00000a1c _end +00000339 link +000002d9 exit +00000267 atoi +00000160 strlen +00000319 open +0000019f strchr +00000341 mkdir +00000301 close +000005df free diff --git a/src/user/usertests.asm b/src/user/usertests.asm index c4fd56e..28838bb 100644 --- a/src/user/usertests.asm +++ b/src/user/usertests.asm @@ -11,7167 +11,7093 @@ int stdout = 1; void iputtest(void) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 83 ec 10 sub $0x10,%esp + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 83 ec 10 sub $0x10,%esp printf(stdout, "iput test\n"); - a: 68 10 3d 00 00 push $0x3d10 - f: ff 35 8c 5c 00 00 pushl 0x5c8c - 15: e8 48 39 00 00 call 3962 + 6: 68 38 3c 00 00 push $0x3c38 + b: ff 35 10 5c 00 00 push 0x5c10 + 11: e8 95 38 00 00 call 38ab if(mkdir("iputdir") < 0){ - 1a: c7 04 24 a3 3c 00 00 movl $0x3ca3,(%esp) - 21: e8 60 38 00 00 call 3886 - 26: 83 c4 10 add $0x10,%esp - 29: 85 c0 test %eax,%eax - 2b: 78 54 js 81 + 16: c7 04 24 cb 3b 00 00 movl $0x3bcb,(%esp) + 1d: e8 a9 37 00 00 call 37cb + 22: 83 c4 10 add $0x10,%esp + 25: 85 c0 test %eax,%eax + 27: 78 54 js 7d printf(stdout, "mkdir failed\n"); exit(); } if(chdir("iputdir") < 0){ - 2d: 83 ec 0c sub $0xc,%esp - 30: 68 a3 3c 00 00 push $0x3ca3 - 35: e8 54 38 00 00 call 388e - 3a: 83 c4 10 add $0x10,%esp - 3d: 85 c0 test %eax,%eax - 3f: 78 58 js 99 + 29: 83 ec 0c sub $0xc,%esp + 2c: 68 cb 3b 00 00 push $0x3bcb + 31: e8 9d 37 00 00 call 37d3 + 36: 83 c4 10 add $0x10,%esp + 39: 85 c0 test %eax,%eax + 3b: 78 58 js 95 printf(stdout, "chdir iputdir failed\n"); exit(); } if(unlink("../iputdir") < 0){ - 41: 83 ec 0c sub $0xc,%esp - 44: 68 a0 3c 00 00 push $0x3ca0 - 49: e8 20 38 00 00 call 386e - 4e: 83 c4 10 add $0x10,%esp - 51: 85 c0 test %eax,%eax - 53: 78 5c js b1 + 3d: 83 ec 0c sub $0xc,%esp + 40: 68 c8 3b 00 00 push $0x3bc8 + 45: e8 69 37 00 00 call 37b3 + 4a: 83 c4 10 add $0x10,%esp + 4d: 85 c0 test %eax,%eax + 4f: 78 5c js ad printf(stdout, "unlink ../iputdir failed\n"); exit(); } if(chdir("/") < 0){ - 55: 83 ec 0c sub $0xc,%esp - 58: 68 c5 3c 00 00 push $0x3cc5 - 5d: e8 2c 38 00 00 call 388e - 62: 83 c4 10 add $0x10,%esp - 65: 85 c0 test %eax,%eax - 67: 78 60 js c9 + 51: 83 ec 0c sub $0xc,%esp + 54: 68 ed 3b 00 00 push $0x3bed + 59: e8 75 37 00 00 call 37d3 + 5e: 83 c4 10 add $0x10,%esp + 61: 85 c0 test %eax,%eax + 63: 78 60 js c5 printf(stdout, "chdir / failed\n"); exit(); } printf(stdout, "iput test ok\n"); - 69: 83 ec 08 sub $0x8,%esp - 6c: 68 48 3d 00 00 push $0x3d48 - 71: ff 35 8c 5c 00 00 pushl 0x5c8c - 77: e8 e6 38 00 00 call 3962 + 65: 83 ec 08 sub $0x8,%esp + 68: 68 70 3c 00 00 push $0x3c70 + 6d: ff 35 10 5c 00 00 push 0x5c10 + 73: e8 33 38 00 00 call 38ab } - 7c: 83 c4 10 add $0x10,%esp - 7f: c9 leave - 80: c3 ret + 78: 83 c4 10 add $0x10,%esp + 7b: c9 leave + 7c: c3 ret printf(stdout, "mkdir failed\n"); - 81: 83 ec 08 sub $0x8,%esp - 84: 68 7c 3c 00 00 push $0x3c7c - 89: ff 35 8c 5c 00 00 pushl 0x5c8c - 8f: e8 ce 38 00 00 call 3962 + 7d: 83 ec 08 sub $0x8,%esp + 80: 68 a4 3b 00 00 push $0x3ba4 + 85: ff 35 10 5c 00 00 push 0x5c10 + 8b: e8 1b 38 00 00 call 38ab exit(); - 94: e8 85 37 00 00 call 381e + 90: e8 ce 36 00 00 call 3763 printf(stdout, "chdir iputdir failed\n"); - 99: 83 ec 08 sub $0x8,%esp - 9c: 68 8a 3c 00 00 push $0x3c8a - a1: ff 35 8c 5c 00 00 pushl 0x5c8c - a7: e8 b6 38 00 00 call 3962 + 95: 83 ec 08 sub $0x8,%esp + 98: 68 b2 3b 00 00 push $0x3bb2 + 9d: ff 35 10 5c 00 00 push 0x5c10 + a3: e8 03 38 00 00 call 38ab exit(); - ac: e8 6d 37 00 00 call 381e + a8: e8 b6 36 00 00 call 3763 printf(stdout, "unlink ../iputdir failed\n"); - b1: 83 ec 08 sub $0x8,%esp - b4: 68 ab 3c 00 00 push $0x3cab - b9: ff 35 8c 5c 00 00 pushl 0x5c8c - bf: e8 9e 38 00 00 call 3962 + ad: 83 ec 08 sub $0x8,%esp + b0: 68 d3 3b 00 00 push $0x3bd3 + b5: ff 35 10 5c 00 00 push 0x5c10 + bb: e8 eb 37 00 00 call 38ab exit(); - c4: e8 55 37 00 00 call 381e + c0: e8 9e 36 00 00 call 3763 printf(stdout, "chdir / failed\n"); - c9: 83 ec 08 sub $0x8,%esp - cc: 68 c7 3c 00 00 push $0x3cc7 - d1: ff 35 8c 5c 00 00 pushl 0x5c8c - d7: e8 86 38 00 00 call 3962 + c5: 83 ec 08 sub $0x8,%esp + c8: 68 ef 3b 00 00 push $0x3bef + cd: ff 35 10 5c 00 00 push 0x5c10 + d3: e8 d3 37 00 00 call 38ab exit(); - dc: e8 3d 37 00 00 call 381e + d8: e8 86 36 00 00 call 3763 -000000e1 : +000000dd : // does exit() call iput(p->cwd) in a transaction? void exitiputtest(void) { - e1: f3 0f 1e fb endbr32 - e5: 55 push %ebp - e6: 89 e5 mov %esp,%ebp - e8: 83 ec 10 sub $0x10,%esp + dd: 55 push %ebp + de: 89 e5 mov %esp,%ebp + e0: 83 ec 10 sub $0x10,%esp int pid; printf(stdout, "exitiput test\n"); - eb: 68 d7 3c 00 00 push $0x3cd7 - f0: ff 35 8c 5c 00 00 pushl 0x5c8c - f6: e8 67 38 00 00 call 3962 + e3: 68 ff 3b 00 00 push $0x3bff + e8: ff 35 10 5c 00 00 push 0x5c10 + ee: e8 b8 37 00 00 call 38ab pid = fork(); - fb: e8 16 37 00 00 call 3816 + f3: e8 63 36 00 00 call 375b if(pid < 0){ - 100: 83 c4 10 add $0x10,%esp - 103: 85 c0 test %eax,%eax - 105: 78 47 js 14e + f8: 83 c4 10 add $0x10,%esp + fb: 85 c0 test %eax,%eax + fd: 78 47 js 146 printf(stdout, "fork failed\n"); exit(); } if(pid == 0){ - 107: 0f 85 a1 00 00 00 jne 1ae + ff: 0f 85 a1 00 00 00 jne 1a6 if(mkdir("iputdir") < 0){ - 10d: 83 ec 0c sub $0xc,%esp - 110: 68 a3 3c 00 00 push $0x3ca3 - 115: e8 6c 37 00 00 call 3886 - 11a: 83 c4 10 add $0x10,%esp - 11d: 85 c0 test %eax,%eax - 11f: 78 45 js 166 + 105: 83 ec 0c sub $0xc,%esp + 108: 68 cb 3b 00 00 push $0x3bcb + 10d: e8 b9 36 00 00 call 37cb + 112: 83 c4 10 add $0x10,%esp + 115: 85 c0 test %eax,%eax + 117: 78 45 js 15e printf(stdout, "mkdir failed\n"); exit(); } if(chdir("iputdir") < 0){ - 121: 83 ec 0c sub $0xc,%esp - 124: 68 a3 3c 00 00 push $0x3ca3 - 129: e8 60 37 00 00 call 388e - 12e: 83 c4 10 add $0x10,%esp - 131: 85 c0 test %eax,%eax - 133: 78 49 js 17e + 119: 83 ec 0c sub $0xc,%esp + 11c: 68 cb 3b 00 00 push $0x3bcb + 121: e8 ad 36 00 00 call 37d3 + 126: 83 c4 10 add $0x10,%esp + 129: 85 c0 test %eax,%eax + 12b: 78 49 js 176 printf(stdout, "child chdir failed\n"); exit(); } if(unlink("../iputdir") < 0){ - 135: 83 ec 0c sub $0xc,%esp - 138: 68 a0 3c 00 00 push $0x3ca0 - 13d: e8 2c 37 00 00 call 386e - 142: 83 c4 10 add $0x10,%esp - 145: 85 c0 test %eax,%eax - 147: 78 4d js 196 + 12d: 83 ec 0c sub $0xc,%esp + 130: 68 c8 3b 00 00 push $0x3bc8 + 135: e8 79 36 00 00 call 37b3 + 13a: 83 c4 10 add $0x10,%esp + 13d: 85 c0 test %eax,%eax + 13f: 78 4d js 18e printf(stdout, "unlink ../iputdir failed\n"); exit(); } exit(); - 149: e8 d0 36 00 00 call 381e + 141: e8 1d 36 00 00 call 3763 printf(stdout, "fork failed\n"); - 14e: 83 ec 08 sub $0x8,%esp - 151: 68 bd 4b 00 00 push $0x4bbd - 156: ff 35 8c 5c 00 00 pushl 0x5c8c - 15c: e8 01 38 00 00 call 3962 + 146: 83 ec 08 sub $0x8,%esp + 149: 68 e5 4a 00 00 push $0x4ae5 + 14e: ff 35 10 5c 00 00 push 0x5c10 + 154: e8 52 37 00 00 call 38ab exit(); - 161: e8 b8 36 00 00 call 381e + 159: e8 05 36 00 00 call 3763 printf(stdout, "mkdir failed\n"); - 166: 83 ec 08 sub $0x8,%esp - 169: 68 7c 3c 00 00 push $0x3c7c - 16e: ff 35 8c 5c 00 00 pushl 0x5c8c - 174: e8 e9 37 00 00 call 3962 + 15e: 83 ec 08 sub $0x8,%esp + 161: 68 a4 3b 00 00 push $0x3ba4 + 166: ff 35 10 5c 00 00 push 0x5c10 + 16c: e8 3a 37 00 00 call 38ab exit(); - 179: e8 a0 36 00 00 call 381e + 171: e8 ed 35 00 00 call 3763 printf(stdout, "child chdir failed\n"); - 17e: 83 ec 08 sub $0x8,%esp - 181: 68 e6 3c 00 00 push $0x3ce6 - 186: ff 35 8c 5c 00 00 pushl 0x5c8c - 18c: e8 d1 37 00 00 call 3962 + 176: 83 ec 08 sub $0x8,%esp + 179: 68 0e 3c 00 00 push $0x3c0e + 17e: ff 35 10 5c 00 00 push 0x5c10 + 184: e8 22 37 00 00 call 38ab exit(); - 191: e8 88 36 00 00 call 381e + 189: e8 d5 35 00 00 call 3763 printf(stdout, "unlink ../iputdir failed\n"); - 196: 83 ec 08 sub $0x8,%esp - 199: 68 ab 3c 00 00 push $0x3cab - 19e: ff 35 8c 5c 00 00 pushl 0x5c8c - 1a4: e8 b9 37 00 00 call 3962 + 18e: 83 ec 08 sub $0x8,%esp + 191: 68 d3 3b 00 00 push $0x3bd3 + 196: ff 35 10 5c 00 00 push 0x5c10 + 19c: e8 0a 37 00 00 call 38ab exit(); - 1a9: e8 70 36 00 00 call 381e + 1a1: e8 bd 35 00 00 call 3763 } wait(); - 1ae: e8 73 36 00 00 call 3826 + 1a6: e8 c0 35 00 00 call 376b printf(stdout, "exitiput test ok\n"); - 1b3: 83 ec 08 sub $0x8,%esp - 1b6: 68 fa 3c 00 00 push $0x3cfa - 1bb: ff 35 8c 5c 00 00 pushl 0x5c8c - 1c1: e8 9c 37 00 00 call 3962 + 1ab: 83 ec 08 sub $0x8,%esp + 1ae: 68 22 3c 00 00 push $0x3c22 + 1b3: ff 35 10 5c 00 00 push 0x5c10 + 1b9: e8 ed 36 00 00 call 38ab } - 1c6: 83 c4 10 add $0x10,%esp - 1c9: c9 leave - 1ca: c3 ret + 1be: 83 c4 10 add $0x10,%esp + 1c1: c9 leave + 1c2: c3 ret -000001cb : +000001c3 : // for(i = 0; i < 10000; i++) // yield(); // } void openiputtest(void) { - 1cb: f3 0f 1e fb endbr32 - 1cf: 55 push %ebp - 1d0: 89 e5 mov %esp,%ebp - 1d2: 83 ec 10 sub $0x10,%esp + 1c3: 55 push %ebp + 1c4: 89 e5 mov %esp,%ebp + 1c6: 83 ec 10 sub $0x10,%esp int pid; printf(stdout, "openiput test\n"); - 1d5: 68 0c 3d 00 00 push $0x3d0c - 1da: ff 35 8c 5c 00 00 pushl 0x5c8c - 1e0: e8 7d 37 00 00 call 3962 + 1c9: 68 34 3c 00 00 push $0x3c34 + 1ce: ff 35 10 5c 00 00 push 0x5c10 + 1d4: e8 d2 36 00 00 call 38ab if(mkdir("oidir") < 0){ - 1e5: c7 04 24 1b 3d 00 00 movl $0x3d1b,(%esp) - 1ec: e8 95 36 00 00 call 3886 - 1f1: 83 c4 10 add $0x10,%esp - 1f4: 85 c0 test %eax,%eax - 1f6: 78 39 js 231 + 1d9: c7 04 24 43 3c 00 00 movl $0x3c43,(%esp) + 1e0: e8 e6 35 00 00 call 37cb + 1e5: 83 c4 10 add $0x10,%esp + 1e8: 85 c0 test %eax,%eax + 1ea: 78 39 js 225 printf(stdout, "mkdir oidir failed\n"); exit(); } pid = fork(); - 1f8: e8 19 36 00 00 call 3816 + 1ec: e8 6a 35 00 00 call 375b if(pid < 0){ - 1fd: 85 c0 test %eax,%eax - 1ff: 78 48 js 249 + 1f1: 85 c0 test %eax,%eax + 1f3: 78 48 js 23d printf(stdout, "fork failed\n"); exit(); } if(pid == 0){ - 201: 75 63 jne 266 + 1f5: 75 63 jne 25a int fd = open("oidir", O_RDWR); - 203: 83 ec 08 sub $0x8,%esp - 206: 6a 02 push $0x2 - 208: 68 1b 3d 00 00 push $0x3d1b - 20d: e8 4c 36 00 00 call 385e + 1f7: 83 ec 08 sub $0x8,%esp + 1fa: 6a 02 push $0x2 + 1fc: 68 43 3c 00 00 push $0x3c43 + 201: e8 9d 35 00 00 call 37a3 if(fd >= 0){ - 212: 83 c4 10 add $0x10,%esp - 215: 85 c0 test %eax,%eax - 217: 78 48 js 261 + 206: 83 c4 10 add $0x10,%esp + 209: 85 c0 test %eax,%eax + 20b: 78 48 js 255 printf(stdout, "open directory for write succeeded\n"); - 219: 83 ec 08 sub $0x8,%esp - 21c: 68 a0 4c 00 00 push $0x4ca0 - 221: ff 35 8c 5c 00 00 pushl 0x5c8c - 227: e8 36 37 00 00 call 3962 + 20d: 83 ec 08 sub $0x8,%esp + 210: 68 c8 4b 00 00 push $0x4bc8 + 215: ff 35 10 5c 00 00 push 0x5c10 + 21b: e8 8b 36 00 00 call 38ab exit(); - 22c: e8 ed 35 00 00 call 381e + 220: e8 3e 35 00 00 call 3763 printf(stdout, "mkdir oidir failed\n"); - 231: 83 ec 08 sub $0x8,%esp - 234: 68 21 3d 00 00 push $0x3d21 - 239: ff 35 8c 5c 00 00 pushl 0x5c8c - 23f: e8 1e 37 00 00 call 3962 + 225: 83 ec 08 sub $0x8,%esp + 228: 68 49 3c 00 00 push $0x3c49 + 22d: ff 35 10 5c 00 00 push 0x5c10 + 233: e8 73 36 00 00 call 38ab exit(); - 244: e8 d5 35 00 00 call 381e + 238: e8 26 35 00 00 call 3763 printf(stdout, "fork failed\n"); - 249: 83 ec 08 sub $0x8,%esp - 24c: 68 bd 4b 00 00 push $0x4bbd - 251: ff 35 8c 5c 00 00 pushl 0x5c8c - 257: e8 06 37 00 00 call 3962 + 23d: 83 ec 08 sub $0x8,%esp + 240: 68 e5 4a 00 00 push $0x4ae5 + 245: ff 35 10 5c 00 00 push 0x5c10 + 24b: e8 5b 36 00 00 call 38ab exit(); - 25c: e8 bd 35 00 00 call 381e + 250: e8 0e 35 00 00 call 3763 } exit(); - 261: e8 b8 35 00 00 call 381e + 255: e8 09 35 00 00 call 3763 } sleep(1); - 266: 83 ec 0c sub $0xc,%esp - 269: 6a 01 push $0x1 - 26b: e8 3e 36 00 00 call 38ae + 25a: 83 ec 0c sub $0xc,%esp + 25d: 6a 01 push $0x1 + 25f: e8 8f 35 00 00 call 37f3 if(unlink("oidir") != 0){ - 270: c7 04 24 1b 3d 00 00 movl $0x3d1b,(%esp) - 277: e8 f2 35 00 00 call 386e - 27c: 83 c4 10 add $0x10,%esp - 27f: 85 c0 test %eax,%eax - 281: 75 1d jne 2a0 + 264: c7 04 24 43 3c 00 00 movl $0x3c43,(%esp) + 26b: e8 43 35 00 00 call 37b3 + 270: 83 c4 10 add $0x10,%esp + 273: 85 c0 test %eax,%eax + 275: 75 1d jne 294 printf(stdout, "unlink failed\n"); exit(); } wait(); - 283: e8 9e 35 00 00 call 3826 + 277: e8 ef 34 00 00 call 376b printf(stdout, "openiput test ok\n"); - 288: 83 ec 08 sub $0x8,%esp - 28b: 68 44 3d 00 00 push $0x3d44 - 290: ff 35 8c 5c 00 00 pushl 0x5c8c - 296: e8 c7 36 00 00 call 3962 + 27c: 83 ec 08 sub $0x8,%esp + 27f: 68 6c 3c 00 00 push $0x3c6c + 284: ff 35 10 5c 00 00 push 0x5c10 + 28a: e8 1c 36 00 00 call 38ab } - 29b: 83 c4 10 add $0x10,%esp - 29e: c9 leave - 29f: c3 ret + 28f: 83 c4 10 add $0x10,%esp + 292: c9 leave + 293: c3 ret printf(stdout, "unlink failed\n"); - 2a0: 83 ec 08 sub $0x8,%esp - 2a3: 68 35 3d 00 00 push $0x3d35 - 2a8: ff 35 8c 5c 00 00 pushl 0x5c8c - 2ae: e8 af 36 00 00 call 3962 + 294: 83 ec 08 sub $0x8,%esp + 297: 68 5d 3c 00 00 push $0x3c5d + 29c: ff 35 10 5c 00 00 push 0x5c10 + 2a2: e8 04 36 00 00 call 38ab exit(); - 2b3: e8 66 35 00 00 call 381e + 2a7: e8 b7 34 00 00 call 3763 -000002b8 : +000002ac : // simple file system tests void opentest(void) { - 2b8: f3 0f 1e fb endbr32 - 2bc: 55 push %ebp - 2bd: 89 e5 mov %esp,%ebp - 2bf: 83 ec 10 sub $0x10,%esp + 2ac: 55 push %ebp + 2ad: 89 e5 mov %esp,%ebp + 2af: 83 ec 10 sub $0x10,%esp int fd; printf(stdout, "open test\n"); - 2c2: 68 56 3d 00 00 push $0x3d56 - 2c7: ff 35 8c 5c 00 00 pushl 0x5c8c - 2cd: e8 90 36 00 00 call 3962 + 2b2: 68 7e 3c 00 00 push $0x3c7e + 2b7: ff 35 10 5c 00 00 push 0x5c10 + 2bd: e8 e9 35 00 00 call 38ab fd = open("echo", 0); - 2d2: 83 c4 08 add $0x8,%esp - 2d5: 6a 00 push $0x0 - 2d7: 68 61 3d 00 00 push $0x3d61 - 2dc: e8 7d 35 00 00 call 385e + 2c2: 83 c4 08 add $0x8,%esp + 2c5: 6a 00 push $0x0 + 2c7: 68 89 3c 00 00 push $0x3c89 + 2cc: e8 d2 34 00 00 call 37a3 if(fd < 0){ - 2e1: 83 c4 10 add $0x10,%esp - 2e4: 85 c0 test %eax,%eax - 2e6: 78 37 js 31f + 2d1: 83 c4 10 add $0x10,%esp + 2d4: 85 c0 test %eax,%eax + 2d6: 78 37 js 30f printf(stdout, "open echo failed!\n"); exit(); } close(fd); - 2e8: 83 ec 0c sub $0xc,%esp - 2eb: 50 push %eax - 2ec: e8 55 35 00 00 call 3846 + 2d8: 83 ec 0c sub $0xc,%esp + 2db: 50 push %eax + 2dc: e8 aa 34 00 00 call 378b fd = open("doesnotexist", 0); - 2f1: 83 c4 08 add $0x8,%esp - 2f4: 6a 00 push $0x0 - 2f6: 68 79 3d 00 00 push $0x3d79 - 2fb: e8 5e 35 00 00 call 385e + 2e1: 83 c4 08 add $0x8,%esp + 2e4: 6a 00 push $0x0 + 2e6: 68 a1 3c 00 00 push $0x3ca1 + 2eb: e8 b3 34 00 00 call 37a3 if(fd >= 0){ - 300: 83 c4 10 add $0x10,%esp - 303: 85 c0 test %eax,%eax - 305: 79 30 jns 337 + 2f0: 83 c4 10 add $0x10,%esp + 2f3: 85 c0 test %eax,%eax + 2f5: 79 30 jns 327 printf(stdout, "open doesnotexist succeeded!\n"); exit(); } printf(stdout, "open test ok\n"); - 307: 83 ec 08 sub $0x8,%esp - 30a: 68 a4 3d 00 00 push $0x3da4 - 30f: ff 35 8c 5c 00 00 pushl 0x5c8c - 315: e8 48 36 00 00 call 3962 + 2f7: 83 ec 08 sub $0x8,%esp + 2fa: 68 cc 3c 00 00 push $0x3ccc + 2ff: ff 35 10 5c 00 00 push 0x5c10 + 305: e8 a1 35 00 00 call 38ab } - 31a: 83 c4 10 add $0x10,%esp - 31d: c9 leave - 31e: c3 ret + 30a: 83 c4 10 add $0x10,%esp + 30d: c9 leave + 30e: c3 ret printf(stdout, "open echo failed!\n"); - 31f: 83 ec 08 sub $0x8,%esp - 322: 68 66 3d 00 00 push $0x3d66 - 327: ff 35 8c 5c 00 00 pushl 0x5c8c - 32d: e8 30 36 00 00 call 3962 + 30f: 83 ec 08 sub $0x8,%esp + 312: 68 8e 3c 00 00 push $0x3c8e + 317: ff 35 10 5c 00 00 push 0x5c10 + 31d: e8 89 35 00 00 call 38ab exit(); - 332: e8 e7 34 00 00 call 381e + 322: e8 3c 34 00 00 call 3763 printf(stdout, "open doesnotexist succeeded!\n"); - 337: 83 ec 08 sub $0x8,%esp - 33a: 68 86 3d 00 00 push $0x3d86 - 33f: ff 35 8c 5c 00 00 pushl 0x5c8c - 345: e8 18 36 00 00 call 3962 + 327: 83 ec 08 sub $0x8,%esp + 32a: 68 ae 3c 00 00 push $0x3cae + 32f: ff 35 10 5c 00 00 push 0x5c10 + 335: e8 71 35 00 00 call 38ab exit(); - 34a: e8 cf 34 00 00 call 381e + 33a: e8 24 34 00 00 call 3763 -0000034f : +0000033f : void writetest(void) { - 34f: f3 0f 1e fb endbr32 - 353: 55 push %ebp - 354: 89 e5 mov %esp,%ebp - 356: 56 push %esi - 357: 53 push %ebx + 33f: 55 push %ebp + 340: 89 e5 mov %esp,%ebp + 342: 56 push %esi + 343: 53 push %ebx int fd; int i; printf(stdout, "small file test\n"); - 358: 83 ec 08 sub $0x8,%esp - 35b: 68 b2 3d 00 00 push $0x3db2 - 360: ff 35 8c 5c 00 00 pushl 0x5c8c - 366: e8 f7 35 00 00 call 3962 + 344: 83 ec 08 sub $0x8,%esp + 347: 68 da 3c 00 00 push $0x3cda + 34c: ff 35 10 5c 00 00 push 0x5c10 + 352: e8 54 35 00 00 call 38ab fd = open("small", O_CREATE|O_RDWR); - 36b: 83 c4 08 add $0x8,%esp - 36e: 68 02 02 00 00 push $0x202 - 373: 68 c3 3d 00 00 push $0x3dc3 - 378: e8 e1 34 00 00 call 385e + 357: 83 c4 08 add $0x8,%esp + 35a: 68 02 02 00 00 push $0x202 + 35f: 68 eb 3c 00 00 push $0x3ceb + 364: e8 3a 34 00 00 call 37a3 if(fd >= 0){ - 37d: 83 c4 10 add $0x10,%esp - 380: 85 c0 test %eax,%eax - 382: 0f 88 17 01 00 00 js 49f - 388: 89 c6 mov %eax,%esi + 369: 83 c4 10 add $0x10,%esp + 36c: 85 c0 test %eax,%eax + 36e: 0f 88 17 01 00 00 js 48b + 374: 89 c6 mov %eax,%esi printf(stdout, "creat small succeeded; ok\n"); - 38a: 83 ec 08 sub $0x8,%esp - 38d: 68 c9 3d 00 00 push $0x3dc9 - 392: ff 35 8c 5c 00 00 pushl 0x5c8c - 398: e8 c5 35 00 00 call 3962 - 39d: 83 c4 10 add $0x10,%esp + 376: 83 ec 08 sub $0x8,%esp + 379: 68 f1 3c 00 00 push $0x3cf1 + 37e: ff 35 10 5c 00 00 push 0x5c10 + 384: e8 22 35 00 00 call 38ab + 389: 83 c4 10 add $0x10,%esp } else { printf(stdout, "error: creat small failed!\n"); exit(); } for(i = 0; i < 100; i++){ - 3a0: bb 00 00 00 00 mov $0x0,%ebx + 38c: bb 00 00 00 00 mov $0x0,%ebx if(write(fd, "aaaaaaaaaa", 10) != 10){ - 3a5: 83 ec 04 sub $0x4,%esp - 3a8: 6a 0a push $0xa - 3aa: 68 00 3e 00 00 push $0x3e00 - 3af: 56 push %esi - 3b0: e8 89 34 00 00 call 383e - 3b5: 83 c4 10 add $0x10,%esp - 3b8: 83 f8 0a cmp $0xa,%eax - 3bb: 0f 85 f6 00 00 00 jne 4b7 + 391: 83 ec 04 sub $0x4,%esp + 394: 6a 0a push $0xa + 396: 68 28 3d 00 00 push $0x3d28 + 39b: 56 push %esi + 39c: e8 e2 33 00 00 call 3783 + 3a1: 83 c4 10 add $0x10,%esp + 3a4: 83 f8 0a cmp $0xa,%eax + 3a7: 0f 85 f6 00 00 00 jne 4a3 printf(stdout, "error: write aa %d new file failed\n", i); exit(); } if(write(fd, "bbbbbbbbbb", 10) != 10){ - 3c1: 83 ec 04 sub $0x4,%esp - 3c4: 6a 0a push $0xa - 3c6: 68 0b 3e 00 00 push $0x3e0b - 3cb: 56 push %esi - 3cc: e8 6d 34 00 00 call 383e - 3d1: 83 c4 10 add $0x10,%esp - 3d4: 83 f8 0a cmp $0xa,%eax - 3d7: 0f 85 f3 00 00 00 jne 4d0 + 3ad: 83 ec 04 sub $0x4,%esp + 3b0: 6a 0a push $0xa + 3b2: 68 33 3d 00 00 push $0x3d33 + 3b7: 56 push %esi + 3b8: e8 c6 33 00 00 call 3783 + 3bd: 83 c4 10 add $0x10,%esp + 3c0: 83 f8 0a cmp $0xa,%eax + 3c3: 0f 85 f3 00 00 00 jne 4bc for(i = 0; i < 100; i++){ - 3dd: 83 c3 01 add $0x1,%ebx - 3e0: 83 fb 64 cmp $0x64,%ebx - 3e3: 75 c0 jne 3a5 + 3c9: 83 c3 01 add $0x1,%ebx + 3cc: 83 fb 64 cmp $0x64,%ebx + 3cf: 75 c0 jne 391 printf(stdout, "error: write bb %d new file failed\n", i); exit(); } } printf(stdout, "writes ok\n"); - 3e5: 83 ec 08 sub $0x8,%esp - 3e8: 68 16 3e 00 00 push $0x3e16 - 3ed: ff 35 8c 5c 00 00 pushl 0x5c8c - 3f3: e8 6a 35 00 00 call 3962 + 3d1: 83 ec 08 sub $0x8,%esp + 3d4: 68 3e 3d 00 00 push $0x3d3e + 3d9: ff 35 10 5c 00 00 push 0x5c10 + 3df: e8 c7 34 00 00 call 38ab close(fd); - 3f8: 89 34 24 mov %esi,(%esp) - 3fb: e8 46 34 00 00 call 3846 + 3e4: 89 34 24 mov %esi,(%esp) + 3e7: e8 9f 33 00 00 call 378b fd = open("small", O_RDONLY); - 400: 83 c4 08 add $0x8,%esp - 403: 6a 00 push $0x0 - 405: 68 c3 3d 00 00 push $0x3dc3 - 40a: e8 4f 34 00 00 call 385e - 40f: 89 c3 mov %eax,%ebx + 3ec: 83 c4 08 add $0x8,%esp + 3ef: 6a 00 push $0x0 + 3f1: 68 eb 3c 00 00 push $0x3ceb + 3f6: e8 a8 33 00 00 call 37a3 + 3fb: 89 c3 mov %eax,%ebx if(fd >= 0){ - 411: 83 c4 10 add $0x10,%esp - 414: 85 c0 test %eax,%eax - 416: 0f 88 cd 00 00 00 js 4e9 + 3fd: 83 c4 10 add $0x10,%esp + 400: 85 c0 test %eax,%eax + 402: 0f 88 cd 00 00 00 js 4d5 printf(stdout, "open small succeeded ok\n"); - 41c: 83 ec 08 sub $0x8,%esp - 41f: 68 21 3e 00 00 push $0x3e21 - 424: ff 35 8c 5c 00 00 pushl 0x5c8c - 42a: e8 33 35 00 00 call 3962 + 408: 83 ec 08 sub $0x8,%esp + 40b: 68 49 3d 00 00 push $0x3d49 + 410: ff 35 10 5c 00 00 push 0x5c10 + 416: e8 90 34 00 00 call 38ab } else { printf(stdout, "error: open small failed!\n"); exit(); } i = read(fd, buf, 2000); - 42f: 83 c4 0c add $0xc,%esp - 432: 68 d0 07 00 00 push $0x7d0 - 437: 68 80 84 00 00 push $0x8480 - 43c: 53 push %ebx - 43d: e8 f4 33 00 00 call 3836 + 41b: 83 c4 0c add $0xc,%esp + 41e: 68 d0 07 00 00 push $0x7d0 + 423: 68 60 83 00 00 push $0x8360 + 428: 53 push %ebx + 429: e8 4d 33 00 00 call 377b if(i == 2000){ - 442: 83 c4 10 add $0x10,%esp - 445: 3d d0 07 00 00 cmp $0x7d0,%eax - 44a: 0f 85 b1 00 00 00 jne 501 + 42e: 83 c4 10 add $0x10,%esp + 431: 3d d0 07 00 00 cmp $0x7d0,%eax + 436: 0f 85 b1 00 00 00 jne 4ed printf(stdout, "read succeeded ok\n"); - 450: 83 ec 08 sub $0x8,%esp - 453: 68 55 3e 00 00 push $0x3e55 - 458: ff 35 8c 5c 00 00 pushl 0x5c8c - 45e: e8 ff 34 00 00 call 3962 + 43c: 83 ec 08 sub $0x8,%esp + 43f: 68 7d 3d 00 00 push $0x3d7d + 444: ff 35 10 5c 00 00 push 0x5c10 + 44a: e8 5c 34 00 00 call 38ab } else { printf(stdout, "read failed\n"); exit(); } close(fd); - 463: 89 1c 24 mov %ebx,(%esp) - 466: e8 db 33 00 00 call 3846 + 44f: 89 1c 24 mov %ebx,(%esp) + 452: e8 34 33 00 00 call 378b if(unlink("small") < 0){ - 46b: c7 04 24 c3 3d 00 00 movl $0x3dc3,(%esp) - 472: e8 f7 33 00 00 call 386e - 477: 83 c4 10 add $0x10,%esp - 47a: 85 c0 test %eax,%eax - 47c: 0f 88 97 00 00 00 js 519 + 457: c7 04 24 eb 3c 00 00 movl $0x3ceb,(%esp) + 45e: e8 50 33 00 00 call 37b3 + 463: 83 c4 10 add $0x10,%esp + 466: 85 c0 test %eax,%eax + 468: 0f 88 97 00 00 00 js 505 printf(stdout, "unlink small failed\n"); exit(); } printf(stdout, "small file test ok\n"); - 482: 83 ec 08 sub $0x8,%esp - 485: 68 7d 3e 00 00 push $0x3e7d - 48a: ff 35 8c 5c 00 00 pushl 0x5c8c - 490: e8 cd 34 00 00 call 3962 + 46e: 83 ec 08 sub $0x8,%esp + 471: 68 a5 3d 00 00 push $0x3da5 + 476: ff 35 10 5c 00 00 push 0x5c10 + 47c: e8 2a 34 00 00 call 38ab } - 495: 83 c4 10 add $0x10,%esp - 498: 8d 65 f8 lea -0x8(%ebp),%esp - 49b: 5b pop %ebx - 49c: 5e pop %esi - 49d: 5d pop %ebp - 49e: c3 ret + 481: 83 c4 10 add $0x10,%esp + 484: 8d 65 f8 lea -0x8(%ebp),%esp + 487: 5b pop %ebx + 488: 5e pop %esi + 489: 5d pop %ebp + 48a: c3 ret printf(stdout, "error: creat small failed!\n"); - 49f: 83 ec 08 sub $0x8,%esp - 4a2: 68 e4 3d 00 00 push $0x3de4 - 4a7: ff 35 8c 5c 00 00 pushl 0x5c8c - 4ad: e8 b0 34 00 00 call 3962 + 48b: 83 ec 08 sub $0x8,%esp + 48e: 68 0c 3d 00 00 push $0x3d0c + 493: ff 35 10 5c 00 00 push 0x5c10 + 499: e8 0d 34 00 00 call 38ab exit(); - 4b2: e8 67 33 00 00 call 381e + 49e: e8 c0 32 00 00 call 3763 printf(stdout, "error: write aa %d new file failed\n", i); - 4b7: 83 ec 04 sub $0x4,%esp - 4ba: 53 push %ebx - 4bb: 68 c4 4c 00 00 push $0x4cc4 - 4c0: ff 35 8c 5c 00 00 pushl 0x5c8c - 4c6: e8 97 34 00 00 call 3962 + 4a3: 83 ec 04 sub $0x4,%esp + 4a6: 53 push %ebx + 4a7: 68 ec 4b 00 00 push $0x4bec + 4ac: ff 35 10 5c 00 00 push 0x5c10 + 4b2: e8 f4 33 00 00 call 38ab exit(); - 4cb: e8 4e 33 00 00 call 381e + 4b7: e8 a7 32 00 00 call 3763 printf(stdout, "error: write bb %d new file failed\n", i); - 4d0: 83 ec 04 sub $0x4,%esp - 4d3: 53 push %ebx - 4d4: 68 e8 4c 00 00 push $0x4ce8 - 4d9: ff 35 8c 5c 00 00 pushl 0x5c8c - 4df: e8 7e 34 00 00 call 3962 + 4bc: 83 ec 04 sub $0x4,%esp + 4bf: 53 push %ebx + 4c0: 68 10 4c 00 00 push $0x4c10 + 4c5: ff 35 10 5c 00 00 push 0x5c10 + 4cb: e8 db 33 00 00 call 38ab exit(); - 4e4: e8 35 33 00 00 call 381e + 4d0: e8 8e 32 00 00 call 3763 printf(stdout, "error: open small failed!\n"); - 4e9: 83 ec 08 sub $0x8,%esp - 4ec: 68 3a 3e 00 00 push $0x3e3a - 4f1: ff 35 8c 5c 00 00 pushl 0x5c8c - 4f7: e8 66 34 00 00 call 3962 + 4d5: 83 ec 08 sub $0x8,%esp + 4d8: 68 62 3d 00 00 push $0x3d62 + 4dd: ff 35 10 5c 00 00 push 0x5c10 + 4e3: e8 c3 33 00 00 call 38ab exit(); - 4fc: e8 1d 33 00 00 call 381e + 4e8: e8 76 32 00 00 call 3763 printf(stdout, "read failed\n"); - 501: 83 ec 08 sub $0x8,%esp - 504: 68 81 41 00 00 push $0x4181 - 509: ff 35 8c 5c 00 00 pushl 0x5c8c - 50f: e8 4e 34 00 00 call 3962 + 4ed: 83 ec 08 sub $0x8,%esp + 4f0: 68 a9 40 00 00 push $0x40a9 + 4f5: ff 35 10 5c 00 00 push 0x5c10 + 4fb: e8 ab 33 00 00 call 38ab exit(); - 514: e8 05 33 00 00 call 381e + 500: e8 5e 32 00 00 call 3763 printf(stdout, "unlink small failed\n"); - 519: 83 ec 08 sub $0x8,%esp - 51c: 68 68 3e 00 00 push $0x3e68 - 521: ff 35 8c 5c 00 00 pushl 0x5c8c - 527: e8 36 34 00 00 call 3962 + 505: 83 ec 08 sub $0x8,%esp + 508: 68 90 3d 00 00 push $0x3d90 + 50d: ff 35 10 5c 00 00 push 0x5c10 + 513: e8 93 33 00 00 call 38ab exit(); - 52c: e8 ed 32 00 00 call 381e + 518: e8 46 32 00 00 call 3763 -00000531 : +0000051d : void writetest1(void) { - 531: f3 0f 1e fb endbr32 - 535: 55 push %ebp - 536: 89 e5 mov %esp,%ebp - 538: 56 push %esi - 539: 53 push %ebx + 51d: 55 push %ebp + 51e: 89 e5 mov %esp,%ebp + 520: 56 push %esi + 521: 53 push %ebx int i, fd, n; printf(stdout, "big files test\n"); - 53a: 83 ec 08 sub $0x8,%esp - 53d: 68 91 3e 00 00 push $0x3e91 - 542: ff 35 8c 5c 00 00 pushl 0x5c8c - 548: e8 15 34 00 00 call 3962 + 522: 83 ec 08 sub $0x8,%esp + 525: 68 b9 3d 00 00 push $0x3db9 + 52a: ff 35 10 5c 00 00 push 0x5c10 + 530: e8 76 33 00 00 call 38ab fd = open("big", O_CREATE|O_RDWR); - 54d: 83 c4 08 add $0x8,%esp - 550: 68 02 02 00 00 push $0x202 - 555: 68 0b 3f 00 00 push $0x3f0b - 55a: e8 ff 32 00 00 call 385e + 535: 83 c4 08 add $0x8,%esp + 538: 68 02 02 00 00 push $0x202 + 53d: 68 33 3e 00 00 push $0x3e33 + 542: e8 5c 32 00 00 call 37a3 if(fd < 0){ - 55f: 83 c4 10 add $0x10,%esp - 562: 85 c0 test %eax,%eax - 564: 0f 88 96 00 00 00 js 600 - 56a: 89 c6 mov %eax,%esi + 547: 83 c4 10 add $0x10,%esp + 54a: 85 c0 test %eax,%eax + 54c: 0f 88 96 00 00 00 js 5e8 + 552: 89 c6 mov %eax,%esi printf(stdout, "error: creat big failed!\n"); exit(); } for(i = 0; i < MAXFILE; i++){ - 56c: bb 00 00 00 00 mov $0x0,%ebx + 554: bb 00 00 00 00 mov $0x0,%ebx ((int*)buf)[0] = i; - 571: 89 1d 80 84 00 00 mov %ebx,0x8480 + 559: 89 1d 60 83 00 00 mov %ebx,0x8360 if(write(fd, buf, 512) != 512){ - 577: 83 ec 04 sub $0x4,%esp - 57a: 68 00 02 00 00 push $0x200 - 57f: 68 80 84 00 00 push $0x8480 - 584: 56 push %esi - 585: e8 b4 32 00 00 call 383e - 58a: 83 c4 10 add $0x10,%esp - 58d: 3d 00 02 00 00 cmp $0x200,%eax - 592: 0f 85 80 00 00 00 jne 618 + 55f: 83 ec 04 sub $0x4,%esp + 562: 68 00 02 00 00 push $0x200 + 567: 68 60 83 00 00 push $0x8360 + 56c: 56 push %esi + 56d: e8 11 32 00 00 call 3783 + 572: 83 c4 10 add $0x10,%esp + 575: 3d 00 02 00 00 cmp $0x200,%eax + 57a: 0f 85 80 00 00 00 jne 600 for(i = 0; i < MAXFILE; i++){ - 598: 83 c3 01 add $0x1,%ebx - 59b: 81 fb 8c 00 00 00 cmp $0x8c,%ebx - 5a1: 75 ce jne 571 + 580: 83 c3 01 add $0x1,%ebx + 583: 81 fb 8c 00 00 00 cmp $0x8c,%ebx + 589: 75 ce jne 559 printf(stdout, "error: write big file failed\n", i); exit(); } } close(fd); - 5a3: 83 ec 0c sub $0xc,%esp - 5a6: 56 push %esi - 5a7: e8 9a 32 00 00 call 3846 + 58b: 83 ec 0c sub $0xc,%esp + 58e: 56 push %esi + 58f: e8 f7 31 00 00 call 378b fd = open("big", O_RDONLY); - 5ac: 83 c4 08 add $0x8,%esp - 5af: 6a 00 push $0x0 - 5b1: 68 0b 3f 00 00 push $0x3f0b - 5b6: e8 a3 32 00 00 call 385e - 5bb: 89 c6 mov %eax,%esi + 594: 83 c4 08 add $0x8,%esp + 597: 6a 00 push $0x0 + 599: 68 33 3e 00 00 push $0x3e33 + 59e: e8 00 32 00 00 call 37a3 + 5a3: 89 c6 mov %eax,%esi if(fd < 0){ - 5bd: 83 c4 10 add $0x10,%esp - 5c0: 85 c0 test %eax,%eax - 5c2: 78 6d js 631 + 5a5: 83 c4 10 add $0x10,%esp + 5a8: 85 c0 test %eax,%eax + 5aa: 78 6d js 619 printf(stdout, "error: open big failed!\n"); exit(); } n = 0; - 5c4: bb 00 00 00 00 mov $0x0,%ebx + 5ac: bb 00 00 00 00 mov $0x0,%ebx for(;;){ i = read(fd, buf, 512); - 5c9: 83 ec 04 sub $0x4,%esp - 5cc: 68 00 02 00 00 push $0x200 - 5d1: 68 80 84 00 00 push $0x8480 - 5d6: 56 push %esi - 5d7: e8 5a 32 00 00 call 3836 + 5b1: 83 ec 04 sub $0x4,%esp + 5b4: 68 00 02 00 00 push $0x200 + 5b9: 68 60 83 00 00 push $0x8360 + 5be: 56 push %esi + 5bf: e8 b7 31 00 00 call 377b if(i == 0){ - 5dc: 83 c4 10 add $0x10,%esp - 5df: 85 c0 test %eax,%eax - 5e1: 74 66 je 649 + 5c4: 83 c4 10 add $0x10,%esp + 5c7: 85 c0 test %eax,%eax + 5c9: 74 66 je 631 if(n == MAXFILE - 1){ printf(stdout, "read only %d blocks from big", n); exit(); } break; } else if(i != 512){ - 5e3: 3d 00 02 00 00 cmp $0x200,%eax - 5e8: 0f 85 b9 00 00 00 jne 6a7 + 5cb: 3d 00 02 00 00 cmp $0x200,%eax + 5d0: 0f 85 b9 00 00 00 jne 68f printf(stdout, "read failed %d\n", i); exit(); } if(((int*)buf)[0] != n){ - 5ee: a1 80 84 00 00 mov 0x8480,%eax - 5f3: 39 d8 cmp %ebx,%eax - 5f5: 0f 85 c5 00 00 00 jne 6c0 + 5d6: a1 60 83 00 00 mov 0x8360,%eax + 5db: 39 d8 cmp %ebx,%eax + 5dd: 0f 85 c5 00 00 00 jne 6a8 printf(stdout, "read content of block %d is %d\n", n, ((int*)buf)[0]); exit(); } n++; - 5fb: 83 c3 01 add $0x1,%ebx + 5e3: 83 c3 01 add $0x1,%ebx i = read(fd, buf, 512); - 5fe: eb c9 jmp 5c9 + 5e6: eb c9 jmp 5b1 printf(stdout, "error: creat big failed!\n"); - 600: 83 ec 08 sub $0x8,%esp - 603: 68 a1 3e 00 00 push $0x3ea1 - 608: ff 35 8c 5c 00 00 pushl 0x5c8c - 60e: e8 4f 33 00 00 call 3962 + 5e8: 83 ec 08 sub $0x8,%esp + 5eb: 68 c9 3d 00 00 push $0x3dc9 + 5f0: ff 35 10 5c 00 00 push 0x5c10 + 5f6: e8 b0 32 00 00 call 38ab exit(); - 613: e8 06 32 00 00 call 381e + 5fb: e8 63 31 00 00 call 3763 printf(stdout, "error: write big file failed\n", i); - 618: 83 ec 04 sub $0x4,%esp - 61b: 53 push %ebx - 61c: 68 bb 3e 00 00 push $0x3ebb - 621: ff 35 8c 5c 00 00 pushl 0x5c8c - 627: e8 36 33 00 00 call 3962 + 600: 83 ec 04 sub $0x4,%esp + 603: 53 push %ebx + 604: 68 e3 3d 00 00 push $0x3de3 + 609: ff 35 10 5c 00 00 push 0x5c10 + 60f: e8 97 32 00 00 call 38ab exit(); - 62c: e8 ed 31 00 00 call 381e + 614: e8 4a 31 00 00 call 3763 printf(stdout, "error: open big failed!\n"); - 631: 83 ec 08 sub $0x8,%esp - 634: 68 d9 3e 00 00 push $0x3ed9 - 639: ff 35 8c 5c 00 00 pushl 0x5c8c - 63f: e8 1e 33 00 00 call 3962 + 619: 83 ec 08 sub $0x8,%esp + 61c: 68 01 3e 00 00 push $0x3e01 + 621: ff 35 10 5c 00 00 push 0x5c10 + 627: e8 7f 32 00 00 call 38ab exit(); - 644: e8 d5 31 00 00 call 381e + 62c: e8 32 31 00 00 call 3763 if(n == MAXFILE - 1){ - 649: 81 fb 8b 00 00 00 cmp $0x8b,%ebx - 64f: 74 39 je 68a + 631: 81 fb 8b 00 00 00 cmp $0x8b,%ebx + 637: 74 39 je 672 } close(fd); - 651: 83 ec 0c sub $0xc,%esp - 654: 56 push %esi - 655: e8 ec 31 00 00 call 3846 + 639: 83 ec 0c sub $0xc,%esp + 63c: 56 push %esi + 63d: e8 49 31 00 00 call 378b if(unlink("big") < 0){ - 65a: c7 04 24 0b 3f 00 00 movl $0x3f0b,(%esp) - 661: e8 08 32 00 00 call 386e - 666: 83 c4 10 add $0x10,%esp - 669: 85 c0 test %eax,%eax - 66b: 78 6a js 6d7 + 642: c7 04 24 33 3e 00 00 movl $0x3e33,(%esp) + 649: e8 65 31 00 00 call 37b3 + 64e: 83 c4 10 add $0x10,%esp + 651: 85 c0 test %eax,%eax + 653: 78 6a js 6bf printf(stdout, "unlink big failed\n"); exit(); } printf(stdout, "big files ok\n"); - 66d: 83 ec 08 sub $0x8,%esp - 670: 68 32 3f 00 00 push $0x3f32 - 675: ff 35 8c 5c 00 00 pushl 0x5c8c - 67b: e8 e2 32 00 00 call 3962 + 655: 83 ec 08 sub $0x8,%esp + 658: 68 5a 3e 00 00 push $0x3e5a + 65d: ff 35 10 5c 00 00 push 0x5c10 + 663: e8 43 32 00 00 call 38ab } - 680: 83 c4 10 add $0x10,%esp - 683: 8d 65 f8 lea -0x8(%ebp),%esp - 686: 5b pop %ebx - 687: 5e pop %esi - 688: 5d pop %ebp - 689: c3 ret + 668: 83 c4 10 add $0x10,%esp + 66b: 8d 65 f8 lea -0x8(%ebp),%esp + 66e: 5b pop %ebx + 66f: 5e pop %esi + 670: 5d pop %ebp + 671: c3 ret printf(stdout, "read only %d blocks from big", n); - 68a: 83 ec 04 sub $0x4,%esp - 68d: 68 8b 00 00 00 push $0x8b - 692: 68 f2 3e 00 00 push $0x3ef2 - 697: ff 35 8c 5c 00 00 pushl 0x5c8c - 69d: e8 c0 32 00 00 call 3962 + 672: 83 ec 04 sub $0x4,%esp + 675: 68 8b 00 00 00 push $0x8b + 67a: 68 1a 3e 00 00 push $0x3e1a + 67f: ff 35 10 5c 00 00 push 0x5c10 + 685: e8 21 32 00 00 call 38ab exit(); - 6a2: e8 77 31 00 00 call 381e + 68a: e8 d4 30 00 00 call 3763 printf(stdout, "read failed %d\n", i); - 6a7: 83 ec 04 sub $0x4,%esp - 6aa: 50 push %eax - 6ab: 68 0f 3f 00 00 push $0x3f0f - 6b0: ff 35 8c 5c 00 00 pushl 0x5c8c - 6b6: e8 a7 32 00 00 call 3962 + 68f: 83 ec 04 sub $0x4,%esp + 692: 50 push %eax + 693: 68 37 3e 00 00 push $0x3e37 + 698: ff 35 10 5c 00 00 push 0x5c10 + 69e: e8 08 32 00 00 call 38ab exit(); - 6bb: e8 5e 31 00 00 call 381e + 6a3: e8 bb 30 00 00 call 3763 printf(stdout, "read content of block %d is %d\n", - 6c0: 50 push %eax - 6c1: 53 push %ebx - 6c2: 68 0c 4d 00 00 push $0x4d0c - 6c7: ff 35 8c 5c 00 00 pushl 0x5c8c - 6cd: e8 90 32 00 00 call 3962 + 6a8: 50 push %eax + 6a9: 53 push %ebx + 6aa: 68 34 4c 00 00 push $0x4c34 + 6af: ff 35 10 5c 00 00 push 0x5c10 + 6b5: e8 f1 31 00 00 call 38ab exit(); - 6d2: e8 47 31 00 00 call 381e + 6ba: e8 a4 30 00 00 call 3763 printf(stdout, "unlink big failed\n"); - 6d7: 83 ec 08 sub $0x8,%esp - 6da: 68 1f 3f 00 00 push $0x3f1f - 6df: ff 35 8c 5c 00 00 pushl 0x5c8c - 6e5: e8 78 32 00 00 call 3962 + 6bf: 83 ec 08 sub $0x8,%esp + 6c2: 68 47 3e 00 00 push $0x3e47 + 6c7: ff 35 10 5c 00 00 push 0x5c10 + 6cd: e8 d9 31 00 00 call 38ab exit(); - 6ea: e8 2f 31 00 00 call 381e + 6d2: e8 8c 30 00 00 call 3763 -000006ef : +000006d7 : void createtest(void) { - 6ef: f3 0f 1e fb endbr32 - 6f3: 55 push %ebp - 6f4: 89 e5 mov %esp,%ebp - 6f6: 53 push %ebx - 6f7: 83 ec 0c sub $0xc,%esp + 6d7: 55 push %ebp + 6d8: 89 e5 mov %esp,%ebp + 6da: 53 push %ebx + 6db: 83 ec 0c sub $0xc,%esp int i, fd; printf(stdout, "many creates, followed by unlink test\n"); - 6fa: 68 2c 4d 00 00 push $0x4d2c - 6ff: ff 35 8c 5c 00 00 pushl 0x5c8c - 705: e8 58 32 00 00 call 3962 + 6de: 68 54 4c 00 00 push $0x4c54 + 6e3: ff 35 10 5c 00 00 push 0x5c10 + 6e9: e8 bd 31 00 00 call 38ab name[0] = 'a'; - 70a: c6 05 80 a4 00 00 61 movb $0x61,0xa480 + 6ee: c6 05 50 83 00 00 61 movb $0x61,0x8350 name[2] = '\0'; - 711: c6 05 82 a4 00 00 00 movb $0x0,0xa482 - 718: 83 c4 10 add $0x10,%esp - 71b: bb 30 00 00 00 mov $0x30,%ebx + 6f5: c6 05 52 83 00 00 00 movb $0x0,0x8352 + 6fc: 83 c4 10 add $0x10,%esp + 6ff: bb 30 00 00 00 mov $0x30,%ebx for(i = 0; i < 52; i++){ name[1] = '0' + i; - 720: 88 1d 81 a4 00 00 mov %bl,0xa481 + 704: 88 1d 51 83 00 00 mov %bl,0x8351 fd = open(name, O_CREATE|O_RDWR); - 726: 83 ec 08 sub $0x8,%esp - 729: 68 02 02 00 00 push $0x202 - 72e: 68 80 a4 00 00 push $0xa480 - 733: e8 26 31 00 00 call 385e + 70a: 83 ec 08 sub $0x8,%esp + 70d: 68 02 02 00 00 push $0x202 + 712: 68 50 83 00 00 push $0x8350 + 717: e8 87 30 00 00 call 37a3 close(fd); - 738: 89 04 24 mov %eax,(%esp) - 73b: e8 06 31 00 00 call 3846 + 71c: 89 04 24 mov %eax,(%esp) + 71f: e8 67 30 00 00 call 378b for(i = 0; i < 52; i++){ - 740: 83 c3 01 add $0x1,%ebx - 743: 83 c4 10 add $0x10,%esp - 746: 80 fb 64 cmp $0x64,%bl - 749: 75 d5 jne 720 + 724: 83 c3 01 add $0x1,%ebx + 727: 83 c4 10 add $0x10,%esp + 72a: 80 fb 64 cmp $0x64,%bl + 72d: 75 d5 jne 704 } name[0] = 'a'; - 74b: c6 05 80 a4 00 00 61 movb $0x61,0xa480 + 72f: c6 05 50 83 00 00 61 movb $0x61,0x8350 name[2] = '\0'; - 752: c6 05 82 a4 00 00 00 movb $0x0,0xa482 - 759: bb 30 00 00 00 mov $0x30,%ebx + 736: c6 05 52 83 00 00 00 movb $0x0,0x8352 + 73d: bb 30 00 00 00 mov $0x30,%ebx for(i = 0; i < 52; i++){ name[1] = '0' + i; - 75e: 88 1d 81 a4 00 00 mov %bl,0xa481 + 742: 88 1d 51 83 00 00 mov %bl,0x8351 unlink(name); - 764: 83 ec 0c sub $0xc,%esp - 767: 68 80 a4 00 00 push $0xa480 - 76c: e8 fd 30 00 00 call 386e + 748: 83 ec 0c sub $0xc,%esp + 74b: 68 50 83 00 00 push $0x8350 + 750: e8 5e 30 00 00 call 37b3 for(i = 0; i < 52; i++){ - 771: 83 c3 01 add $0x1,%ebx - 774: 83 c4 10 add $0x10,%esp - 777: 80 fb 64 cmp $0x64,%bl - 77a: 75 e2 jne 75e + 755: 83 c3 01 add $0x1,%ebx + 758: 83 c4 10 add $0x10,%esp + 75b: 80 fb 64 cmp $0x64,%bl + 75e: 75 e2 jne 742 } printf(stdout, "many creates, followed by unlink; ok\n"); - 77c: 83 ec 08 sub $0x8,%esp - 77f: 68 54 4d 00 00 push $0x4d54 - 784: ff 35 8c 5c 00 00 pushl 0x5c8c - 78a: e8 d3 31 00 00 call 3962 + 760: 83 ec 08 sub $0x8,%esp + 763: 68 7c 4c 00 00 push $0x4c7c + 768: ff 35 10 5c 00 00 push 0x5c10 + 76e: e8 38 31 00 00 call 38ab } - 78f: 83 c4 10 add $0x10,%esp - 792: 8b 5d fc mov -0x4(%ebp),%ebx - 795: c9 leave - 796: c3 ret + 773: 83 c4 10 add $0x10,%esp + 776: 8b 5d fc mov -0x4(%ebp),%ebx + 779: c9 leave + 77a: c3 ret -00000797 : +0000077b : void dirtest(void) { - 797: f3 0f 1e fb endbr32 - 79b: 55 push %ebp - 79c: 89 e5 mov %esp,%ebp - 79e: 83 ec 10 sub $0x10,%esp + 77b: 55 push %ebp + 77c: 89 e5 mov %esp,%ebp + 77e: 83 ec 10 sub $0x10,%esp printf(stdout, "mkdir test\n"); - 7a1: 68 40 3f 00 00 push $0x3f40 - 7a6: ff 35 8c 5c 00 00 pushl 0x5c8c - 7ac: e8 b1 31 00 00 call 3962 + 781: 68 68 3e 00 00 push $0x3e68 + 786: ff 35 10 5c 00 00 push 0x5c10 + 78c: e8 1a 31 00 00 call 38ab if(mkdir("dir0") < 0){ - 7b1: c7 04 24 4c 3f 00 00 movl $0x3f4c,(%esp) - 7b8: e8 c9 30 00 00 call 3886 - 7bd: 83 c4 10 add $0x10,%esp - 7c0: 85 c0 test %eax,%eax - 7c2: 78 54 js 818 + 791: c7 04 24 74 3e 00 00 movl $0x3e74,(%esp) + 798: e8 2e 30 00 00 call 37cb + 79d: 83 c4 10 add $0x10,%esp + 7a0: 85 c0 test %eax,%eax + 7a2: 78 54 js 7f8 printf(stdout, "mkdir failed\n"); exit(); } if(chdir("dir0") < 0){ - 7c4: 83 ec 0c sub $0xc,%esp - 7c7: 68 4c 3f 00 00 push $0x3f4c - 7cc: e8 bd 30 00 00 call 388e - 7d1: 83 c4 10 add $0x10,%esp - 7d4: 85 c0 test %eax,%eax - 7d6: 78 58 js 830 + 7a4: 83 ec 0c sub $0xc,%esp + 7a7: 68 74 3e 00 00 push $0x3e74 + 7ac: e8 22 30 00 00 call 37d3 + 7b1: 83 c4 10 add $0x10,%esp + 7b4: 85 c0 test %eax,%eax + 7b6: 78 58 js 810 printf(stdout, "chdir dir0 failed\n"); exit(); } if(chdir("..") < 0){ - 7d8: 83 ec 0c sub $0xc,%esp - 7db: 68 f1 44 00 00 push $0x44f1 - 7e0: e8 a9 30 00 00 call 388e - 7e5: 83 c4 10 add $0x10,%esp - 7e8: 85 c0 test %eax,%eax - 7ea: 78 5c js 848 + 7b8: 83 ec 0c sub $0xc,%esp + 7bb: 68 19 44 00 00 push $0x4419 + 7c0: e8 0e 30 00 00 call 37d3 + 7c5: 83 c4 10 add $0x10,%esp + 7c8: 85 c0 test %eax,%eax + 7ca: 78 5c js 828 printf(stdout, "chdir .. failed\n"); exit(); } if(unlink("dir0") < 0){ - 7ec: 83 ec 0c sub $0xc,%esp - 7ef: 68 4c 3f 00 00 push $0x3f4c - 7f4: e8 75 30 00 00 call 386e - 7f9: 83 c4 10 add $0x10,%esp - 7fc: 85 c0 test %eax,%eax - 7fe: 78 60 js 860 + 7cc: 83 ec 0c sub $0xc,%esp + 7cf: 68 74 3e 00 00 push $0x3e74 + 7d4: e8 da 2f 00 00 call 37b3 + 7d9: 83 c4 10 add $0x10,%esp + 7dc: 85 c0 test %eax,%eax + 7de: 78 60 js 840 printf(stdout, "unlink dir0 failed\n"); exit(); } printf(stdout, "mkdir test ok\n"); - 800: 83 ec 08 sub $0x8,%esp - 803: 68 89 3f 00 00 push $0x3f89 - 808: ff 35 8c 5c 00 00 pushl 0x5c8c - 80e: e8 4f 31 00 00 call 3962 + 7e0: 83 ec 08 sub $0x8,%esp + 7e3: 68 b1 3e 00 00 push $0x3eb1 + 7e8: ff 35 10 5c 00 00 push 0x5c10 + 7ee: e8 b8 30 00 00 call 38ab } - 813: 83 c4 10 add $0x10,%esp - 816: c9 leave - 817: c3 ret + 7f3: 83 c4 10 add $0x10,%esp + 7f6: c9 leave + 7f7: c3 ret printf(stdout, "mkdir failed\n"); - 818: 83 ec 08 sub $0x8,%esp - 81b: 68 7c 3c 00 00 push $0x3c7c - 820: ff 35 8c 5c 00 00 pushl 0x5c8c - 826: e8 37 31 00 00 call 3962 + 7f8: 83 ec 08 sub $0x8,%esp + 7fb: 68 a4 3b 00 00 push $0x3ba4 + 800: ff 35 10 5c 00 00 push 0x5c10 + 806: e8 a0 30 00 00 call 38ab exit(); - 82b: e8 ee 2f 00 00 call 381e + 80b: e8 53 2f 00 00 call 3763 printf(stdout, "chdir dir0 failed\n"); - 830: 83 ec 08 sub $0x8,%esp - 833: 68 51 3f 00 00 push $0x3f51 - 838: ff 35 8c 5c 00 00 pushl 0x5c8c - 83e: e8 1f 31 00 00 call 3962 + 810: 83 ec 08 sub $0x8,%esp + 813: 68 79 3e 00 00 push $0x3e79 + 818: ff 35 10 5c 00 00 push 0x5c10 + 81e: e8 88 30 00 00 call 38ab exit(); - 843: e8 d6 2f 00 00 call 381e + 823: e8 3b 2f 00 00 call 3763 printf(stdout, "chdir .. failed\n"); - 848: 83 ec 08 sub $0x8,%esp - 84b: 68 64 3f 00 00 push $0x3f64 - 850: ff 35 8c 5c 00 00 pushl 0x5c8c - 856: e8 07 31 00 00 call 3962 + 828: 83 ec 08 sub $0x8,%esp + 82b: 68 8c 3e 00 00 push $0x3e8c + 830: ff 35 10 5c 00 00 push 0x5c10 + 836: e8 70 30 00 00 call 38ab exit(); - 85b: e8 be 2f 00 00 call 381e + 83b: e8 23 2f 00 00 call 3763 printf(stdout, "unlink dir0 failed\n"); - 860: 83 ec 08 sub $0x8,%esp - 863: 68 75 3f 00 00 push $0x3f75 - 868: ff 35 8c 5c 00 00 pushl 0x5c8c - 86e: e8 ef 30 00 00 call 3962 + 840: 83 ec 08 sub $0x8,%esp + 843: 68 9d 3e 00 00 push $0x3e9d + 848: ff 35 10 5c 00 00 push 0x5c10 + 84e: e8 58 30 00 00 call 38ab exit(); - 873: e8 a6 2f 00 00 call 381e + 853: e8 0b 2f 00 00 call 3763 -00000878 : +00000858 : void exectest(void) { - 878: f3 0f 1e fb endbr32 - 87c: 55 push %ebp - 87d: 89 e5 mov %esp,%ebp - 87f: 83 ec 10 sub $0x10,%esp + 858: 55 push %ebp + 859: 89 e5 mov %esp,%ebp + 85b: 83 ec 10 sub $0x10,%esp printf(stdout, "exec test\n"); - 882: 68 98 3f 00 00 push $0x3f98 - 887: ff 35 8c 5c 00 00 pushl 0x5c8c - 88d: e8 d0 30 00 00 call 3962 + 85e: 68 c0 3e 00 00 push $0x3ec0 + 863: ff 35 10 5c 00 00 push 0x5c10 + 869: e8 3d 30 00 00 call 38ab if(exec("echo", echoargv) < 0){ - 892: 83 c4 08 add $0x8,%esp - 895: 68 90 5c 00 00 push $0x5c90 - 89a: 68 61 3d 00 00 push $0x3d61 - 89f: e8 b2 2f 00 00 call 3856 - 8a4: 83 c4 10 add $0x10,%esp - 8a7: 85 c0 test %eax,%eax - 8a9: 78 02 js 8ad + 86e: 83 c4 08 add $0x8,%esp + 871: 68 14 5c 00 00 push $0x5c14 + 876: 68 89 3c 00 00 push $0x3c89 + 87b: e8 1b 2f 00 00 call 379b + 880: 83 c4 10 add $0x10,%esp + 883: 85 c0 test %eax,%eax + 885: 78 02 js 889 printf(stdout, "exec echo failed\n"); exit(); } } - 8ab: c9 leave - 8ac: c3 ret + 887: c9 leave + 888: c3 ret printf(stdout, "exec echo failed\n"); - 8ad: 83 ec 08 sub $0x8,%esp - 8b0: 68 a3 3f 00 00 push $0x3fa3 - 8b5: ff 35 8c 5c 00 00 pushl 0x5c8c - 8bb: e8 a2 30 00 00 call 3962 + 889: 83 ec 08 sub $0x8,%esp + 88c: 68 cb 3e 00 00 push $0x3ecb + 891: ff 35 10 5c 00 00 push 0x5c10 + 897: e8 0f 30 00 00 call 38ab exit(); - 8c0: e8 59 2f 00 00 call 381e + 89c: e8 c2 2e 00 00 call 3763 -000008c5 : +000008a1 : // simple fork and pipe read/write void pipe1(void) { - 8c5: f3 0f 1e fb endbr32 - 8c9: 55 push %ebp - 8ca: 89 e5 mov %esp,%ebp - 8cc: 57 push %edi - 8cd: 56 push %esi - 8ce: 53 push %ebx - 8cf: 83 ec 28 sub $0x28,%esp + 8a1: 55 push %ebp + 8a2: 89 e5 mov %esp,%ebp + 8a4: 57 push %edi + 8a5: 56 push %esi + 8a6: 53 push %ebx + 8a7: 83 ec 28 sub $0x28,%esp int fds[2], pid; int seq, i, n, cc, total; if(pipe(fds) != 0){ - 8d2: 8d 45 e0 lea -0x20(%ebp),%eax - 8d5: 50 push %eax - 8d6: e8 53 2f 00 00 call 382e - 8db: 83 c4 10 add $0x10,%esp - 8de: 85 c0 test %eax,%eax - 8e0: 0f 85 8c 00 00 00 jne 972 - 8e6: 89 c3 mov %eax,%ebx + 8aa: 8d 45 e0 lea -0x20(%ebp),%eax + 8ad: 50 push %eax + 8ae: e8 c0 2e 00 00 call 3773 + 8b3: 83 c4 10 add $0x10,%esp + 8b6: 85 c0 test %eax,%eax + 8b8: 0f 85 8c 00 00 00 jne 94a + 8be: 89 c3 mov %eax,%ebx printf(1, "pipe() failed\n"); exit(); } pid = fork(); - 8e8: e8 29 2f 00 00 call 3816 - 8ed: 89 c6 mov %eax,%esi + 8c0: e8 96 2e 00 00 call 375b + 8c5: 89 c6 mov %eax,%esi seq = 0; if(pid == 0){ - 8ef: 85 c0 test %eax,%eax - 8f1: 0f 84 8f 00 00 00 je 986 + 8c7: 85 c0 test %eax,%eax + 8c9: 0f 84 8f 00 00 00 je 95e printf(1, "pipe1 oops 1\n"); exit(); } } exit(); } else if(pid > 0){ - 8f7: 0f 8e 4f 01 00 00 jle a4c + 8cf: 0f 8e 4f 01 00 00 jle a24 close(fds[1]); - 8fd: 83 ec 0c sub $0xc,%esp - 900: ff 75 e4 pushl -0x1c(%ebp) - 903: e8 3e 2f 00 00 call 3846 + 8d5: 83 ec 0c sub $0xc,%esp + 8d8: ff 75 e4 push -0x1c(%ebp) + 8db: e8 ab 2e 00 00 call 378b total = 0; cc = 1; while((n = read(fds[0], buf, cc)) > 0){ - 908: 83 c4 10 add $0x10,%esp + 8e0: 83 c4 10 add $0x10,%esp total = 0; - 90b: 89 df mov %ebx,%edi + 8e3: 89 df mov %ebx,%edi cc = 1; - 90d: be 01 00 00 00 mov $0x1,%esi + 8e5: be 01 00 00 00 mov $0x1,%esi while((n = read(fds[0], buf, cc)) > 0){ - 912: 83 ec 04 sub $0x4,%esp - 915: 56 push %esi - 916: 68 80 84 00 00 push $0x8480 - 91b: ff 75 e0 pushl -0x20(%ebp) - 91e: e8 13 2f 00 00 call 3836 - 923: 89 c2 mov %eax,%edx - 925: 83 c4 10 add $0x10,%esp - 928: 85 c0 test %eax,%eax - 92a: 0f 8e d8 00 00 00 jle a08 + 8ea: 83 ec 04 sub $0x4,%esp + 8ed: 56 push %esi + 8ee: 68 60 83 00 00 push $0x8360 + 8f3: ff 75 e0 push -0x20(%ebp) + 8f6: e8 80 2e 00 00 call 377b + 8fb: 89 c2 mov %eax,%edx + 8fd: 83 c4 10 add $0x10,%esp + 900: 85 c0 test %eax,%eax + 902: 0f 8e d8 00 00 00 jle 9e0 for(i = 0; i < n; i++){ if((buf[i] & 0xff) != (seq++ & 0xff)){ - 930: 89 d8 mov %ebx,%eax - 932: 32 05 80 84 00 00 xor 0x8480,%al - 938: 0f b6 c0 movzbl %al,%eax - 93b: 85 c0 test %eax,%eax - 93d: 75 19 jne 958 - 93f: 8d 4b 01 lea 0x1(%ebx),%ecx - 942: 8d 1c 01 lea (%ecx,%eax,1),%ebx + 908: 89 d8 mov %ebx,%eax + 90a: 32 05 60 83 00 00 xor 0x8360,%al + 910: 0f b6 c0 movzbl %al,%eax + 913: 85 c0 test %eax,%eax + 915: 75 19 jne 930 + 917: 8d 4b 01 lea 0x1(%ebx),%ecx + 91a: 8d 1c 01 lea (%ecx,%eax,1),%ebx for(i = 0; i < n; i++){ - 945: 83 c0 01 add $0x1,%eax - 948: 39 c2 cmp %eax,%edx - 94a: 0f 84 a1 00 00 00 je 9f1 + 91d: 83 c0 01 add $0x1,%eax + 920: 39 c2 cmp %eax,%edx + 922: 0f 84 a1 00 00 00 je 9c9 if((buf[i] & 0xff) != (seq++ & 0xff)){ - 950: 38 98 80 84 00 00 cmp %bl,0x8480(%eax) - 956: 74 ea je 942 + 928: 38 98 60 83 00 00 cmp %bl,0x8360(%eax) + 92e: 74 ea je 91a printf(1, "pipe1 oops 2\n"); - 958: 83 ec 08 sub $0x8,%esp - 95b: 68 d2 3f 00 00 push $0x3fd2 - 960: 6a 01 push $0x1 - 962: e8 fb 2f 00 00 call 3962 - return; - 967: 83 c4 10 add $0x10,%esp + 930: 83 ec 08 sub $0x8,%esp + 933: 68 fa 3e 00 00 push $0x3efa + 938: 6a 01 push $0x1 + 93a: e8 6c 2f 00 00 call 38ab + 93f: 83 c4 10 add $0x10,%esp } else { printf(1, "fork() failed\n"); exit(); } printf(1, "pipe1 ok\n"); } - 96a: 8d 65 f4 lea -0xc(%ebp),%esp - 96d: 5b pop %ebx - 96e: 5e pop %esi - 96f: 5f pop %edi - 970: 5d pop %ebp - 971: c3 ret + 942: 8d 65 f4 lea -0xc(%ebp),%esp + 945: 5b pop %ebx + 946: 5e pop %esi + 947: 5f pop %edi + 948: 5d pop %ebp + 949: c3 ret printf(1, "pipe() failed\n"); - 972: 83 ec 08 sub $0x8,%esp - 975: 68 b5 3f 00 00 push $0x3fb5 - 97a: 6a 01 push $0x1 - 97c: e8 e1 2f 00 00 call 3962 + 94a: 83 ec 08 sub $0x8,%esp + 94d: 68 dd 3e 00 00 push $0x3edd + 952: 6a 01 push $0x1 + 954: e8 52 2f 00 00 call 38ab exit(); - 981: e8 98 2e 00 00 call 381e + 959: e8 05 2e 00 00 call 3763 close(fds[0]); - 986: 83 ec 0c sub $0xc,%esp - 989: ff 75 e0 pushl -0x20(%ebp) - 98c: e8 b5 2e 00 00 call 3846 - 991: 83 c4 10 add $0x10,%esp + 95e: 83 ec 0c sub $0xc,%esp + 961: ff 75 e0 push -0x20(%ebp) + 964: e8 22 2e 00 00 call 378b + 969: 83 c4 10 add $0x10,%esp seq = 0; - 994: 89 f3 mov %esi,%ebx + 96c: 89 f3 mov %esi,%ebx for(i = 0; i < 1033; i++) - 996: 89 f0 mov %esi,%eax + 96e: 89 f0 mov %esi,%eax buf[i] = seq++; - 998: 8d 14 03 lea (%ebx,%eax,1),%edx - 99b: 88 90 80 84 00 00 mov %dl,0x8480(%eax) + 970: 8d 14 18 lea (%eax,%ebx,1),%edx + 973: 88 90 60 83 00 00 mov %dl,0x8360(%eax) for(i = 0; i < 1033; i++) - 9a1: 83 c0 01 add $0x1,%eax - 9a4: 3d 09 04 00 00 cmp $0x409,%eax - 9a9: 75 ed jne 998 - 9ab: 81 c3 09 04 00 00 add $0x409,%ebx + 979: 83 c0 01 add $0x1,%eax + 97c: 3d 09 04 00 00 cmp $0x409,%eax + 981: 75 ed jne 970 + buf[i] = seq++; + 983: 81 c3 09 04 00 00 add $0x409,%ebx if(write(fds[1], buf, 1033) != 1033){ - 9b1: 83 ec 04 sub $0x4,%esp - 9b4: 68 09 04 00 00 push $0x409 - 9b9: 68 80 84 00 00 push $0x8480 - 9be: ff 75 e4 pushl -0x1c(%ebp) - 9c1: e8 78 2e 00 00 call 383e - 9c6: 83 c4 10 add $0x10,%esp - 9c9: 3d 09 04 00 00 cmp $0x409,%eax - 9ce: 75 0d jne 9dd + 989: 83 ec 04 sub $0x4,%esp + 98c: 68 09 04 00 00 push $0x409 + 991: 68 60 83 00 00 push $0x8360 + 996: ff 75 e4 push -0x1c(%ebp) + 999: e8 e5 2d 00 00 call 3783 + 99e: 83 c4 10 add $0x10,%esp + 9a1: 3d 09 04 00 00 cmp $0x409,%eax + 9a6: 75 0d jne 9b5 for(n = 0; n < 5; n++){ - 9d0: 81 fb 2d 14 00 00 cmp $0x142d,%ebx - 9d6: 75 be jne 996 + 9a8: 81 fb 2d 14 00 00 cmp $0x142d,%ebx + 9ae: 75 be jne 96e exit(); - 9d8: e8 41 2e 00 00 call 381e + 9b0: e8 ae 2d 00 00 call 3763 printf(1, "pipe1 oops 1\n"); - 9dd: 83 ec 08 sub $0x8,%esp - 9e0: 68 c4 3f 00 00 push $0x3fc4 - 9e5: 6a 01 push $0x1 - 9e7: e8 76 2f 00 00 call 3962 + 9b5: 83 ec 08 sub $0x8,%esp + 9b8: 68 ec 3e 00 00 push $0x3eec + 9bd: 6a 01 push $0x1 + 9bf: e8 e7 2e 00 00 call 38ab exit(); - 9ec: e8 2d 2e 00 00 call 381e + 9c4: e8 9a 2d 00 00 call 3763 total += n; - 9f1: 01 c7 add %eax,%edi + 9c9: 01 c7 add %eax,%edi cc = cc * 2; - 9f3: 01 f6 add %esi,%esi + 9cb: 01 f6 add %esi,%esi cc = sizeof(buf); - 9f5: 81 fe 01 20 00 00 cmp $0x2001,%esi - 9fb: b8 00 20 00 00 mov $0x2000,%eax - a00: 0f 43 f0 cmovae %eax,%esi - a03: e9 0a ff ff ff jmp 912 + 9cd: 81 fe 01 20 00 00 cmp $0x2001,%esi + 9d3: b8 00 20 00 00 mov $0x2000,%eax + 9d8: 0f 43 f0 cmovae %eax,%esi + 9db: e9 0a ff ff ff jmp 8ea if(total != 5 * 1033){ - a08: 81 ff 2d 14 00 00 cmp $0x142d,%edi - a0e: 75 27 jne a37 + 9e0: 81 ff 2d 14 00 00 cmp $0x142d,%edi + 9e6: 75 27 jne a0f close(fds[0]); - a10: 83 ec 0c sub $0xc,%esp - a13: ff 75 e0 pushl -0x20(%ebp) - a16: e8 2b 2e 00 00 call 3846 + 9e8: 83 ec 0c sub $0xc,%esp + 9eb: ff 75 e0 push -0x20(%ebp) + 9ee: e8 98 2d 00 00 call 378b wait(); - a1b: e8 06 2e 00 00 call 3826 + 9f3: e8 73 2d 00 00 call 376b printf(1, "pipe1 ok\n"); - a20: 83 c4 08 add $0x8,%esp - a23: 68 f7 3f 00 00 push $0x3ff7 - a28: 6a 01 push $0x1 - a2a: e8 33 2f 00 00 call 3962 - a2f: 83 c4 10 add $0x10,%esp - a32: e9 33 ff ff ff jmp 96a + 9f8: 83 c4 08 add $0x8,%esp + 9fb: 68 1f 3f 00 00 push $0x3f1f + a00: 6a 01 push $0x1 + a02: e8 a4 2e 00 00 call 38ab + a07: 83 c4 10 add $0x10,%esp + a0a: e9 33 ff ff ff jmp 942 printf(1, "pipe1 oops 3 total %d\n", total); - a37: 83 ec 04 sub $0x4,%esp - a3a: 57 push %edi - a3b: 68 e0 3f 00 00 push $0x3fe0 - a40: 6a 01 push $0x1 - a42: e8 1b 2f 00 00 call 3962 + a0f: 83 ec 04 sub $0x4,%esp + a12: 57 push %edi + a13: 68 08 3f 00 00 push $0x3f08 + a18: 6a 01 push $0x1 + a1a: e8 8c 2e 00 00 call 38ab exit(); - a47: e8 d2 2d 00 00 call 381e + a1f: e8 3f 2d 00 00 call 3763 printf(1, "fork() failed\n"); - a4c: 83 ec 08 sub $0x8,%esp - a4f: 68 01 40 00 00 push $0x4001 - a54: 6a 01 push $0x1 - a56: e8 07 2f 00 00 call 3962 + a24: 83 ec 08 sub $0x8,%esp + a27: 68 29 3f 00 00 push $0x3f29 + a2c: 6a 01 push $0x1 + a2e: e8 78 2e 00 00 call 38ab exit(); - a5b: e8 be 2d 00 00 call 381e + a33: e8 2b 2d 00 00 call 3763 -00000a60 : +00000a38 : // meant to be run w/ at most two CPUs void preempt(void) { - a60: f3 0f 1e fb endbr32 - a64: 55 push %ebp - a65: 89 e5 mov %esp,%ebp - a67: 57 push %edi - a68: 56 push %esi - a69: 53 push %ebx - a6a: 83 ec 24 sub $0x24,%esp + a38: 55 push %ebp + a39: 89 e5 mov %esp,%ebp + a3b: 57 push %edi + a3c: 56 push %esi + a3d: 53 push %ebx + a3e: 83 ec 24 sub $0x24,%esp int pid1, pid2, pid3; int pfds[2]; printf(1, "preempt: "); - a6d: 68 10 40 00 00 push $0x4010 - a72: 6a 01 push $0x1 - a74: e8 e9 2e 00 00 call 3962 + a41: 68 38 3f 00 00 push $0x3f38 + a46: 6a 01 push $0x1 + a48: e8 5e 2e 00 00 call 38ab pid1 = fork(); - a79: e8 98 2d 00 00 call 3816 + a4d: e8 09 2d 00 00 call 375b if(pid1 == 0) - a7e: 83 c4 10 add $0x10,%esp - a81: 85 c0 test %eax,%eax - a83: 75 02 jne a87 + a52: 83 c4 10 add $0x10,%esp + a55: 85 c0 test %eax,%eax + a57: 75 02 jne a5b for(;;) - a85: eb fe jmp a85 - a87: 89 c7 mov %eax,%edi + a59: eb fe jmp a59 + a5b: 89 c3 mov %eax,%ebx ; pid2 = fork(); - a89: e8 88 2d 00 00 call 3816 - a8e: 89 c6 mov %eax,%esi + a5d: e8 f9 2c 00 00 call 375b + a62: 89 c6 mov %eax,%esi if(pid2 == 0) - a90: 85 c0 test %eax,%eax - a92: 75 02 jne a96 + a64: 85 c0 test %eax,%eax + a66: 75 02 jne a6a for(;;) - a94: eb fe jmp a94 + a68: eb fe jmp a68 ; pipe(pfds); - a96: 83 ec 0c sub $0xc,%esp - a99: 8d 45 e0 lea -0x20(%ebp),%eax - a9c: 50 push %eax - a9d: e8 8c 2d 00 00 call 382e + a6a: 83 ec 0c sub $0xc,%esp + a6d: 8d 45 e0 lea -0x20(%ebp),%eax + a70: 50 push %eax + a71: e8 fd 2c 00 00 call 3773 pid3 = fork(); - aa2: e8 6f 2d 00 00 call 3816 - aa7: 89 c3 mov %eax,%ebx + a76: e8 e0 2c 00 00 call 375b + a7b: 89 c7 mov %eax,%edi if(pid3 == 0){ - aa9: 83 c4 10 add $0x10,%esp - aac: 85 c0 test %eax,%eax - aae: 75 49 jne af9 + a7d: 83 c4 10 add $0x10,%esp + a80: 85 c0 test %eax,%eax + a82: 75 49 jne acd close(pfds[0]); - ab0: 83 ec 0c sub $0xc,%esp - ab3: ff 75 e0 pushl -0x20(%ebp) - ab6: e8 8b 2d 00 00 call 3846 + a84: 83 ec 0c sub $0xc,%esp + a87: ff 75 e0 push -0x20(%ebp) + a8a: e8 fc 2c 00 00 call 378b if(write(pfds[1], "x", 1) != 1) - abb: 83 c4 0c add $0xc,%esp - abe: 6a 01 push $0x1 - ac0: 68 d5 45 00 00 push $0x45d5 - ac5: ff 75 e4 pushl -0x1c(%ebp) - ac8: e8 71 2d 00 00 call 383e - acd: 83 c4 10 add $0x10,%esp - ad0: 83 f8 01 cmp $0x1,%eax - ad3: 75 10 jne ae5 + a8f: 83 c4 0c add $0xc,%esp + a92: 6a 01 push $0x1 + a94: 68 fd 44 00 00 push $0x44fd + a99: ff 75 e4 push -0x1c(%ebp) + a9c: e8 e2 2c 00 00 call 3783 + aa1: 83 c4 10 add $0x10,%esp + aa4: 83 f8 01 cmp $0x1,%eax + aa7: 75 10 jne ab9 printf(1, "preempt write error"); close(pfds[1]); - ad5: 83 ec 0c sub $0xc,%esp - ad8: ff 75 e4 pushl -0x1c(%ebp) - adb: e8 66 2d 00 00 call 3846 - ae0: 83 c4 10 add $0x10,%esp + aa9: 83 ec 0c sub $0xc,%esp + aac: ff 75 e4 push -0x1c(%ebp) + aaf: e8 d7 2c 00 00 call 378b + ab4: 83 c4 10 add $0x10,%esp for(;;) - ae3: eb fe jmp ae3 + ab7: eb fe jmp ab7 printf(1, "preempt write error"); - ae5: 83 ec 08 sub $0x8,%esp - ae8: 68 1a 40 00 00 push $0x401a - aed: 6a 01 push $0x1 - aef: e8 6e 2e 00 00 call 3962 - af4: 83 c4 10 add $0x10,%esp - af7: eb dc jmp ad5 + ab9: 83 ec 08 sub $0x8,%esp + abc: 68 42 3f 00 00 push $0x3f42 + ac1: 6a 01 push $0x1 + ac3: e8 e3 2d 00 00 call 38ab + ac8: 83 c4 10 add $0x10,%esp + acb: eb dc jmp aa9 ; } close(pfds[1]); - af9: 83 ec 0c sub $0xc,%esp - afc: ff 75 e4 pushl -0x1c(%ebp) - aff: e8 42 2d 00 00 call 3846 + acd: 83 ec 0c sub $0xc,%esp + ad0: ff 75 e4 push -0x1c(%ebp) + ad3: e8 b3 2c 00 00 call 378b if(read(pfds[0], buf, sizeof(buf)) != 1){ - b04: 83 c4 0c add $0xc,%esp - b07: 68 00 20 00 00 push $0x2000 - b0c: 68 80 84 00 00 push $0x8480 - b11: ff 75 e0 pushl -0x20(%ebp) - b14: e8 1d 2d 00 00 call 3836 - b19: 83 c4 10 add $0x10,%esp - b1c: 83 f8 01 cmp $0x1,%eax - b1f: 74 1a je b3b + ad8: 83 c4 0c add $0xc,%esp + adb: 68 00 20 00 00 push $0x2000 + ae0: 68 60 83 00 00 push $0x8360 + ae5: ff 75 e0 push -0x20(%ebp) + ae8: e8 8e 2c 00 00 call 377b + aed: 83 c4 10 add $0x10,%esp + af0: 83 f8 01 cmp $0x1,%eax + af3: 74 1a je b0f printf(1, "preempt read error"); - b21: 83 ec 08 sub $0x8,%esp - b24: 68 2e 40 00 00 push $0x402e - b29: 6a 01 push $0x1 - b2b: e8 32 2e 00 00 call 3962 - return; - b30: 83 c4 10 add $0x10,%esp + af5: 83 ec 08 sub $0x8,%esp + af8: 68 56 3f 00 00 push $0x3f56 + afd: 6a 01 push $0x1 + aff: e8 a7 2d 00 00 call 38ab + b04: 83 c4 10 add $0x10,%esp printf(1, "wait... "); wait(); wait(); wait(); printf(1, "preempt ok\n"); } - b33: 8d 65 f4 lea -0xc(%ebp),%esp - b36: 5b pop %ebx - b37: 5e pop %esi - b38: 5f pop %edi - b39: 5d pop %ebp - b3a: c3 ret + b07: 8d 65 f4 lea -0xc(%ebp),%esp + b0a: 5b pop %ebx + b0b: 5e pop %esi + b0c: 5f pop %edi + b0d: 5d pop %ebp + b0e: c3 ret close(pfds[0]); - b3b: 83 ec 0c sub $0xc,%esp - b3e: ff 75 e0 pushl -0x20(%ebp) - b41: e8 00 2d 00 00 call 3846 + b0f: 83 ec 0c sub $0xc,%esp + b12: ff 75 e0 push -0x20(%ebp) + b15: e8 71 2c 00 00 call 378b printf(1, "kill... "); - b46: 83 c4 08 add $0x8,%esp - b49: 68 41 40 00 00 push $0x4041 - b4e: 6a 01 push $0x1 - b50: e8 0d 2e 00 00 call 3962 + b1a: 83 c4 08 add $0x8,%esp + b1d: 68 69 3f 00 00 push $0x3f69 + b22: 6a 01 push $0x1 + b24: e8 82 2d 00 00 call 38ab kill(pid1); - b55: 89 3c 24 mov %edi,(%esp) - b58: e8 f1 2c 00 00 call 384e + b29: 89 1c 24 mov %ebx,(%esp) + b2c: e8 62 2c 00 00 call 3793 kill(pid2); - b5d: 89 34 24 mov %esi,(%esp) - b60: e8 e9 2c 00 00 call 384e + b31: 89 34 24 mov %esi,(%esp) + b34: e8 5a 2c 00 00 call 3793 kill(pid3); - b65: 89 1c 24 mov %ebx,(%esp) - b68: e8 e1 2c 00 00 call 384e + b39: 89 3c 24 mov %edi,(%esp) + b3c: e8 52 2c 00 00 call 3793 printf(1, "wait... "); - b6d: 83 c4 08 add $0x8,%esp - b70: 68 4a 40 00 00 push $0x404a - b75: 6a 01 push $0x1 - b77: e8 e6 2d 00 00 call 3962 + b41: 83 c4 08 add $0x8,%esp + b44: 68 72 3f 00 00 push $0x3f72 + b49: 6a 01 push $0x1 + b4b: e8 5b 2d 00 00 call 38ab wait(); - b7c: e8 a5 2c 00 00 call 3826 + b50: e8 16 2c 00 00 call 376b wait(); - b81: e8 a0 2c 00 00 call 3826 + b55: e8 11 2c 00 00 call 376b wait(); - b86: e8 9b 2c 00 00 call 3826 + b5a: e8 0c 2c 00 00 call 376b printf(1, "preempt ok\n"); - b8b: 83 c4 08 add $0x8,%esp - b8e: 68 53 40 00 00 push $0x4053 - b93: 6a 01 push $0x1 - b95: e8 c8 2d 00 00 call 3962 - b9a: 83 c4 10 add $0x10,%esp - b9d: eb 94 jmp b33 + b5f: 83 c4 08 add $0x8,%esp + b62: 68 7b 3f 00 00 push $0x3f7b + b67: 6a 01 push $0x1 + b69: e8 3d 2d 00 00 call 38ab + b6e: 83 c4 10 add $0x10,%esp + b71: eb 94 jmp b07 -00000b9f : +00000b73 : // try to find any races between exit and wait void exitwait(void) { - b9f: f3 0f 1e fb endbr32 - ba3: 55 push %ebp - ba4: 89 e5 mov %esp,%ebp - ba6: 56 push %esi - ba7: 53 push %ebx - ba8: be 64 00 00 00 mov $0x64,%esi + b73: 55 push %ebp + b74: 89 e5 mov %esp,%ebp + b76: 56 push %esi + b77: 53 push %ebx + b78: be 64 00 00 00 mov $0x64,%esi int i, pid; for(i = 0; i < 100; i++){ pid = fork(); - bad: e8 64 2c 00 00 call 3816 - bb2: 89 c3 mov %eax,%ebx + b7d: e8 d9 2b 00 00 call 375b + b82: 89 c3 mov %eax,%ebx if(pid < 0){ - bb4: 85 c0 test %eax,%eax - bb6: 78 24 js bdc + b84: 85 c0 test %eax,%eax + b86: 78 24 js bac printf(1, "fork failed\n"); return; } if(pid){ - bb8: 74 4f je c09 + b88: 74 4f je bd9 if(wait() != pid){ - bba: e8 67 2c 00 00 call 3826 - bbf: 39 d8 cmp %ebx,%eax - bc1: 75 32 jne bf5 + b8a: e8 dc 2b 00 00 call 376b + b8f: 39 d8 cmp %ebx,%eax + b91: 75 32 jne bc5 for(i = 0; i < 100; i++){ - bc3: 83 ee 01 sub $0x1,%esi - bc6: 75 e5 jne bad + b93: 83 ee 01 sub $0x1,%esi + b96: 75 e5 jne b7d } } else { exit(); } } printf(1, "exitwait ok\n"); - bc8: 83 ec 08 sub $0x8,%esp - bcb: 68 6f 40 00 00 push $0x406f - bd0: 6a 01 push $0x1 - bd2: e8 8b 2d 00 00 call 3962 - bd7: 83 c4 10 add $0x10,%esp - bda: eb 12 jmp bee + b98: 83 ec 08 sub $0x8,%esp + b9b: 68 97 3f 00 00 push $0x3f97 + ba0: 6a 01 push $0x1 + ba2: e8 04 2d 00 00 call 38ab + ba7: 83 c4 10 add $0x10,%esp + baa: eb 12 jmp bbe printf(1, "fork failed\n"); - bdc: 83 ec 08 sub $0x8,%esp - bdf: 68 bd 4b 00 00 push $0x4bbd - be4: 6a 01 push $0x1 - be6: e8 77 2d 00 00 call 3962 + bac: 83 ec 08 sub $0x8,%esp + baf: 68 e5 4a 00 00 push $0x4ae5 + bb4: 6a 01 push $0x1 + bb6: e8 f0 2c 00 00 call 38ab return; - beb: 83 c4 10 add $0x10,%esp + bbb: 83 c4 10 add $0x10,%esp } - bee: 8d 65 f8 lea -0x8(%ebp),%esp - bf1: 5b pop %ebx - bf2: 5e pop %esi - bf3: 5d pop %ebp - bf4: c3 ret + bbe: 8d 65 f8 lea -0x8(%ebp),%esp + bc1: 5b pop %ebx + bc2: 5e pop %esi + bc3: 5d pop %ebp + bc4: c3 ret printf(1, "wait wrong pid\n"); - bf5: 83 ec 08 sub $0x8,%esp - bf8: 68 5f 40 00 00 push $0x405f - bfd: 6a 01 push $0x1 - bff: e8 5e 2d 00 00 call 3962 + bc5: 83 ec 08 sub $0x8,%esp + bc8: 68 87 3f 00 00 push $0x3f87 + bcd: 6a 01 push $0x1 + bcf: e8 d7 2c 00 00 call 38ab return; - c04: 83 c4 10 add $0x10,%esp - c07: eb e5 jmp bee + bd4: 83 c4 10 add $0x10,%esp + bd7: eb e5 jmp bbe exit(); - c09: e8 10 2c 00 00 call 381e + bd9: e8 85 2b 00 00 call 3763 -00000c0e : +00000bde : void mem(void) { - c0e: f3 0f 1e fb endbr32 - c12: 55 push %ebp - c13: 89 e5 mov %esp,%ebp - c15: 56 push %esi - c16: 53 push %ebx + bde: 55 push %ebp + bdf: 89 e5 mov %esp,%ebp + be1: 56 push %esi + be2: 53 push %ebx void *m1, *m2; int pid, ppid; printf(1, "mem test\n"); - c17: 83 ec 08 sub $0x8,%esp - c1a: 68 7c 40 00 00 push $0x407c - c1f: 6a 01 push $0x1 - c21: e8 3c 2d 00 00 call 3962 + be3: 83 ec 08 sub $0x8,%esp + be6: 68 a4 3f 00 00 push $0x3fa4 + beb: 6a 01 push $0x1 + bed: e8 b9 2c 00 00 call 38ab ppid = getpid(); - c26: e8 73 2c 00 00 call 389e - c2b: 89 c6 mov %eax,%esi + bf2: e8 ec 2b 00 00 call 37e3 + bf7: 89 c6 mov %eax,%esi if((pid = fork()) == 0){ - c2d: e8 e4 2b 00 00 call 3816 - c32: 83 c4 10 add $0x10,%esp + bf9: e8 5d 2b 00 00 call 375b + bfe: 83 c4 10 add $0x10,%esp m1 = 0; - c35: bb 00 00 00 00 mov $0x0,%ebx + c01: bb 00 00 00 00 mov $0x0,%ebx if((pid = fork()) == 0){ - c3a: 85 c0 test %eax,%eax - c3c: 75 7f jne cbd - while((m2 = malloc(10001)) != 0){ - c3e: 83 ec 0c sub $0xc,%esp - c41: 68 11 27 00 00 push $0x2711 - c46: e8 57 2f 00 00 call 3ba2 - c4b: 83 c4 10 add $0x10,%esp - c4e: 85 c0 test %eax,%eax - c50: 74 06 je c58 + c06: 85 c0 test %eax,%eax + c08: 74 10 je c1a + } + free(m1); + printf(1, "mem ok\n"); + exit(); + } else { + wait(); + c0a: e8 5c 2b 00 00 call 376b + } +} + c0f: 8d 65 f8 lea -0x8(%ebp),%esp + c12: 5b pop %ebx + c13: 5e pop %esi + c14: 5d pop %ebp + c15: c3 ret *(char**)m2 = m1; - c52: 89 18 mov %ebx,(%eax) + c16: 89 18 mov %ebx,(%eax) m1 = m2; - c54: 89 c3 mov %eax,%ebx - c56: eb e6 jmp c3e - } + c18: 89 c3 mov %eax,%ebx + while((m2 = malloc(10001)) != 0){ + c1a: 83 ec 0c sub $0xc,%esp + c1d: 68 11 27 00 00 push $0x2711 + c22: e8 ab 2e 00 00 call 3ad2 + c27: 83 c4 10 add $0x10,%esp + c2a: 85 c0 test %eax,%eax + c2c: 75 e8 jne c16 while(m1){ - c58: 85 db test %ebx,%ebx - c5a: 74 14 je c70 + c2e: 85 db test %ebx,%ebx + c30: 74 14 je c46 m2 = *(char**)m1; - c5c: 89 d8 mov %ebx,%eax - c5e: 8b 1b mov (%ebx),%ebx + c32: 89 d8 mov %ebx,%eax + c34: 8b 1b mov (%ebx),%ebx free(m1); - c60: 83 ec 0c sub $0xc,%esp - c63: 50 push %eax - c64: e8 c7 2e 00 00 call 3b30 + c36: 83 ec 0c sub $0xc,%esp + c39: 50 push %eax + c3a: e8 2a 2e 00 00 call 3a69 while(m1){ - c69: 83 c4 10 add $0x10,%esp - c6c: 85 db test %ebx,%ebx - c6e: 75 ec jne c5c - m1 = m2; - } + c3f: 83 c4 10 add $0x10,%esp + c42: 85 db test %ebx,%ebx + c44: 75 ec jne c32 m1 = malloc(1024*20); - c70: 83 ec 0c sub $0xc,%esp - c73: 68 00 50 00 00 push $0x5000 - c78: e8 25 2f 00 00 call 3ba2 + c46: 83 ec 0c sub $0xc,%esp + c49: 68 00 50 00 00 push $0x5000 + c4e: e8 7f 2e 00 00 call 3ad2 if(m1 == 0){ - c7d: 83 c4 10 add $0x10,%esp - c80: 85 c0 test %eax,%eax - c82: 74 1d je ca1 - printf(1, "couldn't allocate mem?!!\n"); - kill(ppid); - exit(); - } + c53: 83 c4 10 add $0x10,%esp + c56: 85 c0 test %eax,%eax + c58: 74 1d je c77 free(m1); - c84: 83 ec 0c sub $0xc,%esp - c87: 50 push %eax - c88: e8 a3 2e 00 00 call 3b30 + c5a: 83 ec 0c sub $0xc,%esp + c5d: 50 push %eax + c5e: e8 06 2e 00 00 call 3a69 printf(1, "mem ok\n"); - c8d: 83 c4 08 add $0x8,%esp - c90: 68 a0 40 00 00 push $0x40a0 - c95: 6a 01 push $0x1 - c97: e8 c6 2c 00 00 call 3962 + c63: 83 c4 08 add $0x8,%esp + c66: 68 c8 3f 00 00 push $0x3fc8 + c6b: 6a 01 push $0x1 + c6d: e8 39 2c 00 00 call 38ab exit(); - c9c: e8 7d 2b 00 00 call 381e + c72: e8 ec 2a 00 00 call 3763 printf(1, "couldn't allocate mem?!!\n"); - ca1: 83 ec 08 sub $0x8,%esp - ca4: 68 86 40 00 00 push $0x4086 - ca9: 6a 01 push $0x1 - cab: e8 b2 2c 00 00 call 3962 + c77: 83 ec 08 sub $0x8,%esp + c7a: 68 ae 3f 00 00 push $0x3fae + c7f: 6a 01 push $0x1 + c81: e8 25 2c 00 00 call 38ab kill(ppid); - cb0: 89 34 24 mov %esi,(%esp) - cb3: e8 96 2b 00 00 call 384e + c86: 89 34 24 mov %esi,(%esp) + c89: e8 05 2b 00 00 call 3793 exit(); - cb8: e8 61 2b 00 00 call 381e - } else { - wait(); - cbd: e8 64 2b 00 00 call 3826 - } -} - cc2: 8d 65 f8 lea -0x8(%ebp),%esp - cc5: 5b pop %ebx - cc6: 5e pop %esi - cc7: 5d pop %ebp - cc8: c3 ret + c8e: e8 d0 2a 00 00 call 3763 -00000cc9 : +00000c93 : // two processes write to the same file descriptor // is the offset shared? does inode locking work? void sharedfd(void) { - cc9: f3 0f 1e fb endbr32 - ccd: 55 push %ebp - cce: 89 e5 mov %esp,%ebp - cd0: 57 push %edi - cd1: 56 push %esi - cd2: 53 push %ebx - cd3: 83 ec 34 sub $0x34,%esp + c93: 55 push %ebp + c94: 89 e5 mov %esp,%ebp + c96: 57 push %edi + c97: 56 push %esi + c98: 53 push %ebx + c99: 83 ec 34 sub $0x34,%esp int fd, pid, i, n, nc, np; char buf[10]; printf(1, "sharedfd test\n"); - cd6: 68 a8 40 00 00 push $0x40a8 - cdb: 6a 01 push $0x1 - cdd: e8 80 2c 00 00 call 3962 + c9c: 68 d0 3f 00 00 push $0x3fd0 + ca1: 6a 01 push $0x1 + ca3: e8 03 2c 00 00 call 38ab unlink("sharedfd"); - ce2: c7 04 24 b7 40 00 00 movl $0x40b7,(%esp) - ce9: e8 80 2b 00 00 call 386e + ca8: c7 04 24 df 3f 00 00 movl $0x3fdf,(%esp) + caf: e8 ff 2a 00 00 call 37b3 fd = open("sharedfd", O_CREATE|O_RDWR); - cee: 83 c4 08 add $0x8,%esp - cf1: 68 02 02 00 00 push $0x202 - cf6: 68 b7 40 00 00 push $0x40b7 - cfb: e8 5e 2b 00 00 call 385e + cb4: 83 c4 08 add $0x8,%esp + cb7: 68 02 02 00 00 push $0x202 + cbc: 68 df 3f 00 00 push $0x3fdf + cc1: e8 dd 2a 00 00 call 37a3 if(fd < 0){ - d00: 83 c4 10 add $0x10,%esp - d03: 85 c0 test %eax,%eax - d05: 78 4a js d51 - d07: 89 c6 mov %eax,%esi + cc6: 83 c4 10 add $0x10,%esp + cc9: 85 c0 test %eax,%eax + ccb: 78 4a js d17 + ccd: 89 c6 mov %eax,%esi printf(1, "fstests: cannot open sharedfd for writing"); return; } pid = fork(); - d09: e8 08 2b 00 00 call 3816 - d0e: 89 45 d4 mov %eax,-0x2c(%ebp) + ccf: e8 87 2a 00 00 call 375b + cd4: 89 45 d4 mov %eax,-0x2c(%ebp) memset(buf, pid==0?'c':'p', sizeof(buf)); - d11: 83 f8 01 cmp $0x1,%eax - d14: 19 c0 sbb %eax,%eax - d16: 83 e0 f3 and $0xfffffff3,%eax - d19: 83 c0 70 add $0x70,%eax - d1c: 83 ec 04 sub $0x4,%esp - d1f: 6a 0a push $0xa - d21: 50 push %eax - d22: 8d 45 de lea -0x22(%ebp),%eax - d25: 50 push %eax - d26: e8 8c 29 00 00 call 36b7 - d2b: 83 c4 10 add $0x10,%esp - d2e: bb e8 03 00 00 mov $0x3e8,%ebx + cd7: 83 f8 01 cmp $0x1,%eax + cda: 19 c0 sbb %eax,%eax + cdc: 83 e0 f3 and $0xfffffff3,%eax + cdf: 83 c0 70 add $0x70,%eax + ce2: 83 ec 04 sub $0x4,%esp + ce5: 6a 0a push $0xa + ce7: 50 push %eax + ce8: 8d 45 de lea -0x22(%ebp),%eax + ceb: 50 push %eax + cec: e8 1f 29 00 00 call 3610 + cf1: 83 c4 10 add $0x10,%esp + cf4: bb e8 03 00 00 mov $0x3e8,%ebx for(i = 0; i < 1000; i++){ if(write(fd, buf, sizeof(buf)) != sizeof(buf)){ - d33: 8d 7d de lea -0x22(%ebp),%edi - d36: 83 ec 04 sub $0x4,%esp - d39: 6a 0a push $0xa - d3b: 57 push %edi - d3c: 56 push %esi - d3d: e8 fc 2a 00 00 call 383e - d42: 83 c4 10 add $0x10,%esp - d45: 83 f8 0a cmp $0xa,%eax - d48: 75 1e jne d68 + cf9: 8d 7d de lea -0x22(%ebp),%edi + cfc: 83 ec 04 sub $0x4,%esp + cff: 6a 0a push $0xa + d01: 57 push %edi + d02: 56 push %esi + d03: e8 7b 2a 00 00 call 3783 + d08: 83 c4 10 add $0x10,%esp + d0b: 83 f8 0a cmp $0xa,%eax + d0e: 75 1e jne d2e for(i = 0; i < 1000; i++){ - d4a: 83 eb 01 sub $0x1,%ebx - d4d: 75 e7 jne d36 - d4f: eb 29 jmp d7a + d10: 83 eb 01 sub $0x1,%ebx + d13: 75 e7 jne cfc + d15: eb 29 jmp d40 printf(1, "fstests: cannot open sharedfd for writing"); - d51: 83 ec 08 sub $0x8,%esp - d54: 68 7c 4d 00 00 push $0x4d7c - d59: 6a 01 push $0x1 - d5b: e8 02 2c 00 00 call 3962 + d17: 83 ec 08 sub $0x8,%esp + d1a: 68 a4 4c 00 00 push $0x4ca4 + d1f: 6a 01 push $0x1 + d21: e8 85 2b 00 00 call 38ab return; - d60: 83 c4 10 add $0x10,%esp - d63: e9 dd 00 00 00 jmp e45 + d26: 83 c4 10 add $0x10,%esp + d29: e9 dd 00 00 00 jmp e0b printf(1, "fstests: write sharedfd failed\n"); - d68: 83 ec 08 sub $0x8,%esp - d6b: 68 a8 4d 00 00 push $0x4da8 - d70: 6a 01 push $0x1 - d72: e8 eb 2b 00 00 call 3962 + d2e: 83 ec 08 sub $0x8,%esp + d31: 68 d0 4c 00 00 push $0x4cd0 + d36: 6a 01 push $0x1 + d38: e8 6e 2b 00 00 call 38ab break; - d77: 83 c4 10 add $0x10,%esp + d3d: 83 c4 10 add $0x10,%esp } } if(pid == 0) - d7a: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) - d7e: 74 51 je dd1 + d40: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) + d44: 74 51 je d97 exit(); else wait(); - d80: e8 a1 2a 00 00 call 3826 + d46: e8 20 2a 00 00 call 376b close(fd); - d85: 83 ec 0c sub $0xc,%esp - d88: 56 push %esi - d89: e8 b8 2a 00 00 call 3846 + d4b: 83 ec 0c sub $0xc,%esp + d4e: 56 push %esi + d4f: e8 37 2a 00 00 call 378b fd = open("sharedfd", 0); - d8e: 83 c4 08 add $0x8,%esp - d91: 6a 00 push $0x0 - d93: 68 b7 40 00 00 push $0x40b7 - d98: e8 c1 2a 00 00 call 385e - d9d: 89 45 d4 mov %eax,-0x2c(%ebp) + d54: 83 c4 08 add $0x8,%esp + d57: 6a 00 push $0x0 + d59: 68 df 3f 00 00 push $0x3fdf + d5e: e8 40 2a 00 00 call 37a3 + d63: 89 45 d4 mov %eax,-0x2c(%ebp) if(fd < 0){ - da0: 83 c4 10 add $0x10,%esp + d66: 83 c4 10 add $0x10,%esp printf(1, "fstests: cannot open sharedfd for reading\n"); return; } nc = np = 0; - da3: bb 00 00 00 00 mov $0x0,%ebx - da8: bf 00 00 00 00 mov $0x0,%edi - dad: 8d 75 e8 lea -0x18(%ebp),%esi + d69: bb 00 00 00 00 mov $0x0,%ebx + d6e: bf 00 00 00 00 mov $0x0,%edi + d73: 8d 75 e8 lea -0x18(%ebp),%esi if(fd < 0){ - db0: 85 c0 test %eax,%eax - db2: 78 22 js dd6 + d76: 85 c0 test %eax,%eax + d78: 78 22 js d9c while((n = read(fd, buf, sizeof(buf))) > 0){ - db4: 83 ec 04 sub $0x4,%esp - db7: 6a 0a push $0xa - db9: 8d 45 de lea -0x22(%ebp),%eax - dbc: 50 push %eax - dbd: ff 75 d4 pushl -0x2c(%ebp) - dc0: e8 71 2a 00 00 call 3836 - dc5: 83 c4 10 add $0x10,%esp - dc8: 85 c0 test %eax,%eax - dca: 7e 3d jle e09 - dcc: 8d 45 de lea -0x22(%ebp),%eax - dcf: eb 2b jmp dfc - exit(); - dd1: e8 48 2a 00 00 call 381e + d7a: 83 ec 04 sub $0x4,%esp + d7d: 6a 0a push $0xa + d7f: 8d 45 de lea -0x22(%ebp),%eax + d82: 50 push %eax + d83: ff 75 d4 push -0x2c(%ebp) + d86: e8 f0 29 00 00 call 377b + d8b: 83 c4 10 add $0x10,%esp + d8e: 85 c0 test %eax,%eax + d90: 7e 3d jle dcf + d92: 8d 45 de lea -0x22(%ebp),%eax + d95: eb 2b jmp dc2 + exit(); + d97: e8 c7 29 00 00 call 3763 printf(1, "fstests: cannot open sharedfd for reading\n"); - dd6: 83 ec 08 sub $0x8,%esp - dd9: 68 c8 4d 00 00 push $0x4dc8 - dde: 6a 01 push $0x1 - de0: e8 7d 2b 00 00 call 3962 + d9c: 83 ec 08 sub $0x8,%esp + d9f: 68 f0 4c 00 00 push $0x4cf0 + da4: 6a 01 push $0x1 + da6: e8 00 2b 00 00 call 38ab return; - de5: 83 c4 10 add $0x10,%esp - de8: eb 5b jmp e45 + dab: 83 c4 10 add $0x10,%esp + dae: eb 5b jmp e0b for(i = 0; i < sizeof(buf); i++){ if(buf[i] == 'c') nc++; if(buf[i] == 'p') np++; - dea: 80 fa 70 cmp $0x70,%dl - ded: 0f 94 c2 sete %dl - df0: 0f b6 d2 movzbl %dl,%edx - df3: 01 d3 add %edx,%ebx + db0: 80 fa 70 cmp $0x70,%dl + db3: 0f 94 c2 sete %dl + db6: 0f b6 d2 movzbl %dl,%edx + db9: 01 d3 add %edx,%ebx for(i = 0; i < sizeof(buf); i++){ - df5: 83 c0 01 add $0x1,%eax - df8: 39 f0 cmp %esi,%eax - dfa: 74 b8 je db4 + dbb: 83 c0 01 add $0x1,%eax + dbe: 39 f0 cmp %esi,%eax + dc0: 74 b8 je d7a if(buf[i] == 'c') - dfc: 0f b6 10 movzbl (%eax),%edx - dff: 80 fa 63 cmp $0x63,%dl - e02: 75 e6 jne dea + dc2: 0f b6 10 movzbl (%eax),%edx + dc5: 80 fa 63 cmp $0x63,%dl + dc8: 75 e6 jne db0 nc++; - e04: 83 c7 01 add $0x1,%edi + dca: 83 c7 01 add $0x1,%edi if(buf[i] == 'p') - e07: eb ec jmp df5 + dcd: eb ec jmp dbb } } close(fd); - e09: 83 ec 0c sub $0xc,%esp - e0c: ff 75 d4 pushl -0x2c(%ebp) - e0f: e8 32 2a 00 00 call 3846 + dcf: 83 ec 0c sub $0xc,%esp + dd2: ff 75 d4 push -0x2c(%ebp) + dd5: e8 b1 29 00 00 call 378b unlink("sharedfd"); - e14: c7 04 24 b7 40 00 00 movl $0x40b7,(%esp) - e1b: e8 4e 2a 00 00 call 386e + dda: c7 04 24 df 3f 00 00 movl $0x3fdf,(%esp) + de1: e8 cd 29 00 00 call 37b3 if(nc == 10000 && np == 10000){ - e20: 83 c4 10 add $0x10,%esp - e23: 81 ff 10 27 00 00 cmp $0x2710,%edi - e29: 75 22 jne e4d - e2b: 81 fb 10 27 00 00 cmp $0x2710,%ebx - e31: 75 1a jne e4d + de6: 83 c4 10 add $0x10,%esp + de9: 81 ff 10 27 00 00 cmp $0x2710,%edi + def: 75 22 jne e13 + df1: 81 fb 10 27 00 00 cmp $0x2710,%ebx + df7: 75 1a jne e13 printf(1, "sharedfd ok\n"); - e33: 83 ec 08 sub $0x8,%esp - e36: 68 c0 40 00 00 push $0x40c0 - e3b: 6a 01 push $0x1 - e3d: e8 20 2b 00 00 call 3962 - e42: 83 c4 10 add $0x10,%esp + df9: 83 ec 08 sub $0x8,%esp + dfc: 68 e8 3f 00 00 push $0x3fe8 + e01: 6a 01 push $0x1 + e03: e8 a3 2a 00 00 call 38ab + e08: 83 c4 10 add $0x10,%esp } else { printf(1, "sharedfd oops %d %d\n", nc, np); exit(); } } - e45: 8d 65 f4 lea -0xc(%ebp),%esp - e48: 5b pop %ebx - e49: 5e pop %esi - e4a: 5f pop %edi - e4b: 5d pop %ebp - e4c: c3 ret + e0b: 8d 65 f4 lea -0xc(%ebp),%esp + e0e: 5b pop %ebx + e0f: 5e pop %esi + e10: 5f pop %edi + e11: 5d pop %ebp + e12: c3 ret printf(1, "sharedfd oops %d %d\n", nc, np); - e4d: 53 push %ebx - e4e: 57 push %edi - e4f: 68 cd 40 00 00 push $0x40cd - e54: 6a 01 push $0x1 - e56: e8 07 2b 00 00 call 3962 + e13: 53 push %ebx + e14: 57 push %edi + e15: 68 f5 3f 00 00 push $0x3ff5 + e1a: 6a 01 push $0x1 + e1c: e8 8a 2a 00 00 call 38ab exit(); - e5b: e8 be 29 00 00 call 381e + e21: e8 3d 29 00 00 call 3763 -00000e60 : +00000e26 : // four processes write different files at the same // time, to test block allocation. void fourfiles(void) { - e60: f3 0f 1e fb endbr32 - e64: 55 push %ebp - e65: 89 e5 mov %esp,%ebp - e67: 57 push %edi - e68: 56 push %esi - e69: 53 push %ebx - e6a: 83 ec 34 sub $0x34,%esp + e26: 55 push %ebp + e27: 89 e5 mov %esp,%ebp + e29: 57 push %edi + e2a: 56 push %esi + e2b: 53 push %ebx + e2c: 83 ec 34 sub $0x34,%esp int fd, pid, i, j, n, total, pi; char *names[] = { "f0", "f1", "f2", "f3" }; - e6d: c7 45 d8 e2 40 00 00 movl $0x40e2,-0x28(%ebp) - e74: c7 45 dc 2b 42 00 00 movl $0x422b,-0x24(%ebp) - e7b: c7 45 e0 2f 42 00 00 movl $0x422f,-0x20(%ebp) - e82: c7 45 e4 e5 40 00 00 movl $0x40e5,-0x1c(%ebp) + e2f: c7 45 d8 0a 40 00 00 movl $0x400a,-0x28(%ebp) + e36: c7 45 dc 53 41 00 00 movl $0x4153,-0x24(%ebp) + e3d: c7 45 e0 57 41 00 00 movl $0x4157,-0x20(%ebp) + e44: c7 45 e4 0d 40 00 00 movl $0x400d,-0x1c(%ebp) char *fname; printf(1, "fourfiles test\n"); - e89: 68 e8 40 00 00 push $0x40e8 - e8e: 6a 01 push $0x1 - e90: e8 cd 2a 00 00 call 3962 - e95: 83 c4 10 add $0x10,%esp + e4b: 68 10 40 00 00 push $0x4010 + e50: 6a 01 push $0x1 + e52: e8 54 2a 00 00 call 38ab + e57: 83 c4 10 add $0x10,%esp for(pi = 0; pi < 4; pi++){ - e98: bb 00 00 00 00 mov $0x0,%ebx + e5a: bb 00 00 00 00 mov $0x0,%ebx fname = names[pi]; - e9d: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi + e5f: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi unlink(fname); - ea1: 83 ec 0c sub $0xc,%esp - ea4: 56 push %esi - ea5: e8 c4 29 00 00 call 386e + e63: 83 ec 0c sub $0xc,%esp + e66: 56 push %esi + e67: e8 47 29 00 00 call 37b3 pid = fork(); - eaa: e8 67 29 00 00 call 3816 + e6c: e8 ea 28 00 00 call 375b if(pid < 0){ - eaf: 83 c4 10 add $0x10,%esp - eb2: 85 c0 test %eax,%eax - eb4: 78 28 js ede + e71: 83 c4 10 add $0x10,%esp + e74: 85 c0 test %eax,%eax + e76: 78 28 js ea0 printf(1, "fork failed\n"); exit(); } if(pid == 0){ - eb6: 74 3a je ef2 + e78: 74 3a je eb4 for(pi = 0; pi < 4; pi++){ - eb8: 83 c3 01 add $0x1,%ebx - ebb: 83 fb 04 cmp $0x4,%ebx - ebe: 75 dd jne e9d + e7a: 83 c3 01 add $0x1,%ebx + e7d: 83 fb 04 cmp $0x4,%ebx + e80: 75 dd jne e5f exit(); } } for(pi = 0; pi < 4; pi++){ wait(); - ec0: e8 61 29 00 00 call 3826 - ec5: e8 5c 29 00 00 call 3826 - eca: e8 57 29 00 00 call 3826 - ecf: e8 52 29 00 00 call 3826 - ed4: bb 30 00 00 00 mov $0x30,%ebx - ed9: e9 0c 01 00 00 jmp fea + e82: e8 e4 28 00 00 call 376b + e87: e8 df 28 00 00 call 376b + e8c: e8 da 28 00 00 call 376b + e91: e8 d5 28 00 00 call 376b + e96: bb 30 00 00 00 mov $0x30,%ebx + e9b: e9 0c 01 00 00 jmp fac printf(1, "fork failed\n"); - ede: 83 ec 08 sub $0x8,%esp - ee1: 68 bd 4b 00 00 push $0x4bbd - ee6: 6a 01 push $0x1 - ee8: e8 75 2a 00 00 call 3962 + ea0: 83 ec 08 sub $0x8,%esp + ea3: 68 e5 4a 00 00 push $0x4ae5 + ea8: 6a 01 push $0x1 + eaa: e8 fc 29 00 00 call 38ab exit(); - eed: e8 2c 29 00 00 call 381e + eaf: e8 af 28 00 00 call 3763 fd = open(fname, O_CREATE | O_RDWR); - ef2: 83 ec 08 sub $0x8,%esp - ef5: 68 02 02 00 00 push $0x202 - efa: 56 push %esi - efb: e8 5e 29 00 00 call 385e - f00: 89 c6 mov %eax,%esi + eb4: 83 ec 08 sub $0x8,%esp + eb7: 68 02 02 00 00 push $0x202 + ebc: 56 push %esi + ebd: e8 e1 28 00 00 call 37a3 + ec2: 89 c6 mov %eax,%esi if(fd < 0){ - f02: 83 c4 10 add $0x10,%esp - f05: 85 c0 test %eax,%eax - f07: 78 45 js f4e + ec4: 83 c4 10 add $0x10,%esp + ec7: 85 c0 test %eax,%eax + ec9: 78 45 js f10 memset(buf, '0'+pi, 512); - f09: 83 ec 04 sub $0x4,%esp - f0c: 68 00 02 00 00 push $0x200 - f11: 83 c3 30 add $0x30,%ebx - f14: 53 push %ebx - f15: 68 80 84 00 00 push $0x8480 - f1a: e8 98 27 00 00 call 36b7 - f1f: 83 c4 10 add $0x10,%esp - f22: bb 0c 00 00 00 mov $0xc,%ebx + ecb: 83 ec 04 sub $0x4,%esp + ece: 68 00 02 00 00 push $0x200 + ed3: 83 c3 30 add $0x30,%ebx + ed6: 53 push %ebx + ed7: 68 60 83 00 00 push $0x8360 + edc: e8 2f 27 00 00 call 3610 + ee1: 83 c4 10 add $0x10,%esp + ee4: bb 0c 00 00 00 mov $0xc,%ebx if((n = write(fd, buf, 500)) != 500){ - f27: 83 ec 04 sub $0x4,%esp - f2a: 68 f4 01 00 00 push $0x1f4 - f2f: 68 80 84 00 00 push $0x8480 - f34: 56 push %esi - f35: e8 04 29 00 00 call 383e - f3a: 83 c4 10 add $0x10,%esp - f3d: 3d f4 01 00 00 cmp $0x1f4,%eax - f42: 75 1e jne f62 + ee9: 83 ec 04 sub $0x4,%esp + eec: 68 f4 01 00 00 push $0x1f4 + ef1: 68 60 83 00 00 push $0x8360 + ef6: 56 push %esi + ef7: e8 87 28 00 00 call 3783 + efc: 83 c4 10 add $0x10,%esp + eff: 3d f4 01 00 00 cmp $0x1f4,%eax + f04: 75 1e jne f24 for(i = 0; i < 12; i++){ - f44: 83 eb 01 sub $0x1,%ebx - f47: 75 de jne f27 + f06: 83 eb 01 sub $0x1,%ebx + f09: 75 de jne ee9 exit(); - f49: e8 d0 28 00 00 call 381e + f0b: e8 53 28 00 00 call 3763 printf(1, "create failed\n"); - f4e: 83 ec 08 sub $0x8,%esp - f51: 68 83 43 00 00 push $0x4383 - f56: 6a 01 push $0x1 - f58: e8 05 2a 00 00 call 3962 + f10: 83 ec 08 sub $0x8,%esp + f13: 68 ab 42 00 00 push $0x42ab + f18: 6a 01 push $0x1 + f1a: e8 8c 29 00 00 call 38ab exit(); - f5d: e8 bc 28 00 00 call 381e + f1f: e8 3f 28 00 00 call 3763 printf(1, "write failed %d\n", n); - f62: 83 ec 04 sub $0x4,%esp - f65: 50 push %eax - f66: 68 f8 40 00 00 push $0x40f8 - f6b: 6a 01 push $0x1 - f6d: e8 f0 29 00 00 call 3962 + f24: 83 ec 04 sub $0x4,%esp + f27: 50 push %eax + f28: 68 20 40 00 00 push $0x4020 + f2d: 6a 01 push $0x1 + f2f: e8 77 29 00 00 call 38ab exit(); - f72: e8 a7 28 00 00 call 381e + f34: e8 2a 28 00 00 call 3763 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){ printf(1, "wrong char\n"); - f77: 83 ec 08 sub $0x8,%esp - f7a: 68 09 41 00 00 push $0x4109 - f7f: 6a 01 push $0x1 - f81: e8 dc 29 00 00 call 3962 + f39: 83 ec 08 sub $0x8,%esp + f3c: 68 31 40 00 00 push $0x4031 + f41: 6a 01 push $0x1 + f43: e8 63 29 00 00 call 38ab exit(); - f86: e8 93 28 00 00 call 381e + f48: e8 16 28 00 00 call 3763 } } total += n; - f8b: 01 d6 add %edx,%esi + f4d: 01 d6 add %edx,%esi while((n = read(fd, buf, sizeof(buf))) > 0){ - f8d: 83 ec 04 sub $0x4,%esp - f90: 68 00 20 00 00 push $0x2000 - f95: 68 80 84 00 00 push $0x8480 - f9a: 57 push %edi - f9b: e8 96 28 00 00 call 3836 - fa0: 83 c4 10 add $0x10,%esp - fa3: 85 c0 test %eax,%eax - fa5: 7e 19 jle fc0 + f4f: 83 ec 04 sub $0x4,%esp + f52: 68 00 20 00 00 push $0x2000 + f57: 68 60 83 00 00 push $0x8360 + f5c: 57 push %edi + f5d: e8 19 28 00 00 call 377b + f62: 83 c4 10 add $0x10,%esp + f65: 85 c0 test %eax,%eax + f67: 7e 19 jle f82 for(j = 0; j < n; j++){ - fa7: ba 00 00 00 00 mov $0x0,%edx + f69: ba 00 00 00 00 mov $0x0,%edx if(buf[j] != '0'+i){ - fac: 0f be 8a 80 84 00 00 movsbl 0x8480(%edx),%ecx - fb3: 39 d9 cmp %ebx,%ecx - fb5: 75 c0 jne f77 + f6e: 0f be 8a 60 83 00 00 movsbl 0x8360(%edx),%ecx + f75: 39 d9 cmp %ebx,%ecx + f77: 75 c0 jne f39 for(j = 0; j < n; j++){ - fb7: 83 c2 01 add $0x1,%edx - fba: 39 d0 cmp %edx,%eax - fbc: 75 ee jne fac - fbe: eb cb jmp f8b + f79: 83 c2 01 add $0x1,%edx + f7c: 39 d0 cmp %edx,%eax + f7e: 75 ee jne f6e + f80: eb cb jmp f4d } close(fd); - fc0: 83 ec 0c sub $0xc,%esp - fc3: 57 push %edi - fc4: e8 7d 28 00 00 call 3846 + f82: 83 ec 0c sub $0xc,%esp + f85: 57 push %edi + f86: e8 00 28 00 00 call 378b if(total != 12*500){ - fc9: 83 c4 10 add $0x10,%esp - fcc: 81 fe 70 17 00 00 cmp $0x1770,%esi - fd2: 75 37 jne 100b + f8b: 83 c4 10 add $0x10,%esp + f8e: 81 fe 70 17 00 00 cmp $0x1770,%esi + f94: 75 37 jne fcd printf(1, "wrong length %d\n", total); exit(); } unlink(fname); - fd4: 83 ec 0c sub $0xc,%esp - fd7: ff 75 d4 pushl -0x2c(%ebp) - fda: e8 8f 28 00 00 call 386e + f96: 83 ec 0c sub $0xc,%esp + f99: ff 75 d4 push -0x2c(%ebp) + f9c: e8 12 28 00 00 call 37b3 for(i = 0; i < 2; i++){ - fdf: 83 c3 01 add $0x1,%ebx - fe2: 83 c4 10 add $0x10,%esp - fe5: 83 fb 32 cmp $0x32,%ebx - fe8: 74 36 je 1020 + fa1: 83 c3 01 add $0x1,%ebx + fa4: 83 c4 10 add $0x10,%esp + fa7: 83 fb 32 cmp $0x32,%ebx + faa: 74 36 je fe2 fname = names[i]; - fea: 8b 84 9d 18 ff ff ff mov -0xe8(%ebp,%ebx,4),%eax - ff1: 89 45 d4 mov %eax,-0x2c(%ebp) + fac: 8b 84 9d 18 ff ff ff mov -0xe8(%ebp,%ebx,4),%eax + fb3: 89 45 d4 mov %eax,-0x2c(%ebp) fd = open(fname, 0); - ff4: 83 ec 08 sub $0x8,%esp - ff7: 6a 00 push $0x0 - ff9: 50 push %eax - ffa: e8 5f 28 00 00 call 385e - fff: 89 c7 mov %eax,%edi + fb6: 83 ec 08 sub $0x8,%esp + fb9: 6a 00 push $0x0 + fbb: 50 push %eax + fbc: e8 e2 27 00 00 call 37a3 + fc1: 89 c7 mov %eax,%edi while((n = read(fd, buf, sizeof(buf))) > 0){ - 1001: 83 c4 10 add $0x10,%esp + fc3: 83 c4 10 add $0x10,%esp total = 0; - 1004: be 00 00 00 00 mov $0x0,%esi + fc6: be 00 00 00 00 mov $0x0,%esi while((n = read(fd, buf, sizeof(buf))) > 0){ - 1009: eb 82 jmp f8d + fcb: eb 82 jmp f4f printf(1, "wrong length %d\n", total); - 100b: 83 ec 04 sub $0x4,%esp - 100e: 56 push %esi - 100f: 68 15 41 00 00 push $0x4115 - 1014: 6a 01 push $0x1 - 1016: e8 47 29 00 00 call 3962 + fcd: 83 ec 04 sub $0x4,%esp + fd0: 56 push %esi + fd1: 68 3d 40 00 00 push $0x403d + fd6: 6a 01 push $0x1 + fd8: e8 ce 28 00 00 call 38ab exit(); - 101b: e8 fe 27 00 00 call 381e + fdd: e8 81 27 00 00 call 3763 } printf(1, "fourfiles ok\n"); - 1020: 83 ec 08 sub $0x8,%esp - 1023: 68 26 41 00 00 push $0x4126 - 1028: 6a 01 push $0x1 - 102a: e8 33 29 00 00 call 3962 + fe2: 83 ec 08 sub $0x8,%esp + fe5: 68 4e 40 00 00 push $0x404e + fea: 6a 01 push $0x1 + fec: e8 ba 28 00 00 call 38ab } - 102f: 83 c4 10 add $0x10,%esp - 1032: 8d 65 f4 lea -0xc(%ebp),%esp - 1035: 5b pop %ebx - 1036: 5e pop %esi - 1037: 5f pop %edi - 1038: 5d pop %ebp - 1039: c3 ret + ff1: 83 c4 10 add $0x10,%esp + ff4: 8d 65 f4 lea -0xc(%ebp),%esp + ff7: 5b pop %ebx + ff8: 5e pop %esi + ff9: 5f pop %edi + ffa: 5d pop %ebp + ffb: c3 ret -0000103a : +00000ffc : // four processes create and delete different files in same directory void createdelete(void) { - 103a: f3 0f 1e fb endbr32 - 103e: 55 push %ebp - 103f: 89 e5 mov %esp,%ebp - 1041: 57 push %edi - 1042: 56 push %esi - 1043: 53 push %ebx - 1044: 83 ec 44 sub $0x44,%esp + ffc: 55 push %ebp + ffd: 89 e5 mov %esp,%ebp + fff: 57 push %edi + 1000: 56 push %esi + 1001: 53 push %ebx + 1002: 83 ec 44 sub $0x44,%esp enum { N = 20 }; int pid, i, fd, pi; char name[32]; printf(1, "createdelete test\n"); - 1047: 68 34 41 00 00 push $0x4134 - 104c: 6a 01 push $0x1 - 104e: e8 0f 29 00 00 call 3962 - 1053: 83 c4 10 add $0x10,%esp + 1005: 68 5c 40 00 00 push $0x405c + 100a: 6a 01 push $0x1 + 100c: e8 9a 28 00 00 call 38ab + 1011: 83 c4 10 add $0x10,%esp for(pi = 0; pi < 4; pi++){ - 1056: be 00 00 00 00 mov $0x0,%esi + 1014: be 00 00 00 00 mov $0x0,%esi pid = fork(); - 105b: e8 b6 27 00 00 call 3816 + 1019: e8 3d 27 00 00 call 375b if(pid < 0){ - 1060: 85 c0 test %eax,%eax - 1062: 78 38 js 109c + 101e: 85 c0 test %eax,%eax + 1020: 78 38 js 105a printf(1, "fork failed\n"); exit(); } if(pid == 0){ - 1064: 74 4a je 10b0 + 1022: 74 4a je 106e for(pi = 0; pi < 4; pi++){ - 1066: 83 c6 01 add $0x1,%esi - 1069: 83 fe 04 cmp $0x4,%esi - 106c: 75 ed jne 105b + 1024: 83 c6 01 add $0x1,%esi + 1027: 83 fe 04 cmp $0x4,%esi + 102a: 75 ed jne 1019 exit(); } } for(pi = 0; pi < 4; pi++){ wait(); - 106e: e8 b3 27 00 00 call 3826 - 1073: e8 ae 27 00 00 call 3826 - 1078: e8 a9 27 00 00 call 3826 - 107d: e8 a4 27 00 00 call 3826 + 102c: e8 3a 27 00 00 call 376b + 1031: e8 35 27 00 00 call 376b + 1036: e8 30 27 00 00 call 376b + 103b: e8 2b 27 00 00 call 376b } name[0] = name[1] = name[2] = 0; - 1082: c6 45 ca 00 movb $0x0,-0x36(%ebp) - 1086: bf 30 00 00 00 mov $0x30,%edi - 108b: c7 45 c4 ff ff ff ff movl $0xffffffff,-0x3c(%ebp) + 1040: c6 45 ca 00 movb $0x0,-0x36(%ebp) + 1044: bf 30 00 00 00 mov $0x30,%edi + 1049: c7 45 c4 ff ff ff ff movl $0xffffffff,-0x3c(%ebp) for(i = 0; i < N; i++){ - 1092: be 00 00 00 00 mov $0x0,%esi - 1097: e9 38 01 00 00 jmp 11d4 + 1050: be 00 00 00 00 mov $0x0,%esi + 1055: e9 38 01 00 00 jmp 1192 printf(1, "fork failed\n"); - 109c: 83 ec 08 sub $0x8,%esp - 109f: 68 bd 4b 00 00 push $0x4bbd - 10a4: 6a 01 push $0x1 - 10a6: e8 b7 28 00 00 call 3962 + 105a: 83 ec 08 sub $0x8,%esp + 105d: 68 e5 4a 00 00 push $0x4ae5 + 1062: 6a 01 push $0x1 + 1064: e8 42 28 00 00 call 38ab exit(); - 10ab: e8 6e 27 00 00 call 381e - 10b0: 89 c3 mov %eax,%ebx + 1069: e8 f5 26 00 00 call 3763 name[0] = 'p' + pi; - 10b2: 8d 46 70 lea 0x70(%esi),%eax - 10b5: 88 45 c8 mov %al,-0x38(%ebp) + 106e: 89 c3 mov %eax,%ebx + 1070: 8d 46 70 lea 0x70(%esi),%eax + 1073: 88 45 c8 mov %al,-0x38(%ebp) name[2] = '\0'; - 10b8: c6 45 ca 00 movb $0x0,-0x36(%ebp) + 1076: c6 45 ca 00 movb $0x0,-0x36(%ebp) fd = open(name, O_CREATE | O_RDWR); - 10bc: 8d 75 c8 lea -0x38(%ebp),%esi - 10bf: eb 1c jmp 10dd + 107a: 8d 75 c8 lea -0x38(%ebp),%esi + 107d: eb 1c jmp 109b printf(1, "create failed\n"); - 10c1: 83 ec 08 sub $0x8,%esp - 10c4: 68 83 43 00 00 push $0x4383 - 10c9: 6a 01 push $0x1 - 10cb: e8 92 28 00 00 call 3962 + 107f: 83 ec 08 sub $0x8,%esp + 1082: 68 ab 42 00 00 push $0x42ab + 1087: 6a 01 push $0x1 + 1089: e8 1d 28 00 00 call 38ab exit(); - 10d0: e8 49 27 00 00 call 381e + 108e: e8 d0 26 00 00 call 3763 for(i = 0; i < N; i++){ - 10d5: 83 c3 01 add $0x1,%ebx - 10d8: 83 fb 14 cmp $0x14,%ebx - 10db: 74 63 je 1140 + 1093: 83 c3 01 add $0x1,%ebx + 1096: 83 fb 14 cmp $0x14,%ebx + 1099: 74 63 je 10fe name[1] = '0' + i; - 10dd: 8d 43 30 lea 0x30(%ebx),%eax - 10e0: 88 45 c9 mov %al,-0x37(%ebp) + 109b: 8d 43 30 lea 0x30(%ebx),%eax + 109e: 88 45 c9 mov %al,-0x37(%ebp) fd = open(name, O_CREATE | O_RDWR); - 10e3: 83 ec 08 sub $0x8,%esp - 10e6: 68 02 02 00 00 push $0x202 - 10eb: 56 push %esi - 10ec: e8 6d 27 00 00 call 385e + 10a1: 83 ec 08 sub $0x8,%esp + 10a4: 68 02 02 00 00 push $0x202 + 10a9: 56 push %esi + 10aa: e8 f4 26 00 00 call 37a3 if(fd < 0){ - 10f1: 83 c4 10 add $0x10,%esp - 10f4: 85 c0 test %eax,%eax - 10f6: 78 c9 js 10c1 + 10af: 83 c4 10 add $0x10,%esp + 10b2: 85 c0 test %eax,%eax + 10b4: 78 c9 js 107f close(fd); - 10f8: 83 ec 0c sub $0xc,%esp - 10fb: 50 push %eax - 10fc: e8 45 27 00 00 call 3846 + 10b6: 83 ec 0c sub $0xc,%esp + 10b9: 50 push %eax + 10ba: e8 cc 26 00 00 call 378b if(i > 0 && (i % 2 ) == 0){ - 1101: 83 c4 10 add $0x10,%esp - 1104: 85 db test %ebx,%ebx - 1106: 7e cd jle 10d5 - 1108: f6 c3 01 test $0x1,%bl - 110b: 75 c8 jne 10d5 + 10bf: 83 c4 10 add $0x10,%esp + 10c2: 85 db test %ebx,%ebx + 10c4: 7e cd jle 1093 + 10c6: f6 c3 01 test $0x1,%bl + 10c9: 75 c8 jne 1093 name[1] = '0' + (i / 2); - 110d: 89 d8 mov %ebx,%eax - 110f: c1 e8 1f shr $0x1f,%eax - 1112: 01 d8 add %ebx,%eax - 1114: d1 f8 sar %eax - 1116: 83 c0 30 add $0x30,%eax - 1119: 88 45 c9 mov %al,-0x37(%ebp) + 10cb: 89 d8 mov %ebx,%eax + 10cd: c1 e8 1f shr $0x1f,%eax + 10d0: 01 d8 add %ebx,%eax + 10d2: d1 f8 sar %eax + 10d4: 83 c0 30 add $0x30,%eax + 10d7: 88 45 c9 mov %al,-0x37(%ebp) if(unlink(name) < 0){ - 111c: 83 ec 0c sub $0xc,%esp - 111f: 56 push %esi - 1120: e8 49 27 00 00 call 386e - 1125: 83 c4 10 add $0x10,%esp - 1128: 85 c0 test %eax,%eax - 112a: 79 a9 jns 10d5 + 10da: 83 ec 0c sub $0xc,%esp + 10dd: 56 push %esi + 10de: e8 d0 26 00 00 call 37b3 + 10e3: 83 c4 10 add $0x10,%esp + 10e6: 85 c0 test %eax,%eax + 10e8: 79 a9 jns 1093 printf(1, "unlink failed\n"); - 112c: 83 ec 08 sub $0x8,%esp - 112f: 68 35 3d 00 00 push $0x3d35 - 1134: 6a 01 push $0x1 - 1136: e8 27 28 00 00 call 3962 + 10ea: 83 ec 08 sub $0x8,%esp + 10ed: 68 5d 3c 00 00 push $0x3c5d + 10f2: 6a 01 push $0x1 + 10f4: e8 b2 27 00 00 call 38ab exit(); - 113b: e8 de 26 00 00 call 381e + 10f9: e8 65 26 00 00 call 3763 exit(); - 1140: e8 d9 26 00 00 call 381e + 10fe: e8 60 26 00 00 call 3763 + 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){ printf(1, "oops createdelete %s didn't exist\n", name); + 1103: 83 ec 04 sub $0x4,%esp + 1106: 8d 45 c8 lea -0x38(%ebp),%eax + 1109: 50 push %eax + 110a: 68 1c 4d 00 00 push $0x4d1c + 110f: 6a 01 push $0x1 + 1111: e8 95 27 00 00 call 38ab exit(); + 1116: e8 48 26 00 00 call 3763 } else if((i >= 1 && i < N/2) && fd >= 0){ - 1145: 85 c0 test %eax,%eax - 1147: 78 06 js 114f - 1149: 83 7d c4 08 cmpl $0x8,-0x3c(%ebp) - 114d: 76 50 jbe 119f printf(1, "oops createdelete %s did exist\n", name); exit(); } if(fd >= 0) - 114f: 85 c0 test %eax,%eax - 1151: 79 64 jns 11b7 + 111b: 85 c0 test %eax,%eax + 111d: 79 56 jns 1175 for(pi = 0; pi < 4; pi++){ - 1153: 83 c3 01 add $0x1,%ebx - 1156: 80 fb 74 cmp $0x74,%bl - 1159: 74 6a je 11c5 + 111f: 83 c3 01 add $0x1,%ebx + 1122: 80 fb 74 cmp $0x74,%bl + 1125: 74 5c je 1183 name[0] = 'p' + pi; - 115b: 88 5d c8 mov %bl,-0x38(%ebp) + 1127: 88 5d c8 mov %bl,-0x38(%ebp) name[1] = '0' + i; - 115e: 89 f8 mov %edi,%eax - 1160: 88 45 c9 mov %al,-0x37(%ebp) + 112a: 89 f8 mov %edi,%eax + 112c: 88 45 c9 mov %al,-0x37(%ebp) fd = open(name, 0); - 1163: 83 ec 08 sub $0x8,%esp - 1166: 6a 00 push $0x0 - 1168: 8d 45 c8 lea -0x38(%ebp),%eax - 116b: 50 push %eax - 116c: e8 ed 26 00 00 call 385e + 112f: 83 ec 08 sub $0x8,%esp + 1132: 6a 00 push $0x0 + 1134: 8d 45 c8 lea -0x38(%ebp),%eax + 1137: 50 push %eax + 1138: e8 66 26 00 00 call 37a3 if((i == 0 || i >= N/2) && fd < 0){ - 1171: 83 c4 10 add $0x10,%esp - 1174: 85 f6 test %esi,%esi - 1176: 0f 94 c1 sete %cl - 1179: 83 fe 09 cmp $0x9,%esi - 117c: 0f 9f c2 setg %dl - 117f: 08 d1 or %dl,%cl - 1181: 74 c2 je 1145 - 1183: 85 c0 test %eax,%eax - 1185: 79 be jns 1145 - printf(1, "oops createdelete %s didn't exist\n", name); - 1187: 83 ec 04 sub $0x4,%esp - 118a: 8d 45 c8 lea -0x38(%ebp),%eax - 118d: 50 push %eax - 118e: 68 f4 4d 00 00 push $0x4df4 - 1193: 6a 01 push $0x1 - 1195: e8 c8 27 00 00 call 3962 - exit(); - 119a: e8 7f 26 00 00 call 381e + 113d: 83 c4 10 add $0x10,%esp + 1140: 85 f6 test %esi,%esi + 1142: 0f 94 c2 sete %dl + 1145: 83 fe 09 cmp $0x9,%esi + 1148: 0f 9f c1 setg %cl + 114b: 08 ca or %cl,%dl + 114d: 74 04 je 1153 + 114f: 85 c0 test %eax,%eax + 1151: 78 b0 js 1103 + } else if((i >= 1 && i < N/2) && fd >= 0){ + 1153: 85 c0 test %eax,%eax + 1155: 78 c4 js 111b + 1157: 83 7d c4 08 cmpl $0x8,-0x3c(%ebp) + 115b: 77 be ja 111b printf(1, "oops createdelete %s did exist\n", name); - 119f: 83 ec 04 sub $0x4,%esp - 11a2: 8d 45 c8 lea -0x38(%ebp),%eax - 11a5: 50 push %eax - 11a6: 68 18 4e 00 00 push $0x4e18 - 11ab: 6a 01 push $0x1 - 11ad: e8 b0 27 00 00 call 3962 + 115d: 83 ec 04 sub $0x4,%esp + 1160: 8d 45 c8 lea -0x38(%ebp),%eax + 1163: 50 push %eax + 1164: 68 40 4d 00 00 push $0x4d40 + 1169: 6a 01 push $0x1 + 116b: e8 3b 27 00 00 call 38ab exit(); - 11b2: e8 67 26 00 00 call 381e + 1170: e8 ee 25 00 00 call 3763 close(fd); - 11b7: 83 ec 0c sub $0xc,%esp - 11ba: 50 push %eax - 11bb: e8 86 26 00 00 call 3846 - 11c0: 83 c4 10 add $0x10,%esp - 11c3: eb 8e jmp 1153 + 1175: 83 ec 0c sub $0xc,%esp + 1178: 50 push %eax + 1179: e8 0d 26 00 00 call 378b + 117e: 83 c4 10 add $0x10,%esp + 1181: eb 9c jmp 111f for(i = 0; i < N; i++){ - 11c5: 83 c6 01 add $0x1,%esi - 11c8: 83 45 c4 01 addl $0x1,-0x3c(%ebp) - 11cc: 83 c7 01 add $0x1,%edi - 11cf: 83 fe 14 cmp $0x14,%esi - 11d2: 74 38 je 120c + 1183: 83 c6 01 add $0x1,%esi + 1186: 83 45 c4 01 addl $0x1,-0x3c(%ebp) + 118a: 83 c7 01 add $0x1,%edi + 118d: 83 fe 14 cmp $0x14,%esi + 1190: 74 38 je 11ca for(pi = 0; pi < 4; pi++){ - 11d4: bb 70 00 00 00 mov $0x70,%ebx - 11d9: eb 80 jmp 115b + 1192: bb 70 00 00 00 mov $0x70,%ebx + 1197: eb 8e jmp 1127 } } for(i = 0; i < N; i++){ - 11db: 83 c6 01 add $0x1,%esi - 11de: 83 c7 01 add $0x1,%edi - 11e1: 89 f0 mov %esi,%eax - 11e3: 3c 84 cmp $0x84,%al - 11e5: 74 31 je 1218 + 1199: 83 c6 01 add $0x1,%esi + 119c: 83 c7 01 add $0x1,%edi + 119f: 89 f0 mov %esi,%eax + 11a1: 3c 84 cmp $0x84,%al + 11a3: 74 31 je 11d6 for(i = 0; i < N; i++){ - 11e7: bb 04 00 00 00 mov $0x4,%ebx + 11a5: bb 04 00 00 00 mov $0x4,%ebx for(pi = 0; pi < 4; pi++){ name[0] = 'p' + i; - 11ec: 89 f0 mov %esi,%eax - 11ee: 88 45 c8 mov %al,-0x38(%ebp) + 11aa: 89 f0 mov %esi,%eax + 11ac: 88 45 c8 mov %al,-0x38(%ebp) name[1] = '0' + i; - 11f1: 89 f8 mov %edi,%eax - 11f3: 88 45 c9 mov %al,-0x37(%ebp) + 11af: 89 f8 mov %edi,%eax + 11b1: 88 45 c9 mov %al,-0x37(%ebp) unlink(name); - 11f6: 83 ec 0c sub $0xc,%esp - 11f9: 8d 45 c8 lea -0x38(%ebp),%eax - 11fc: 50 push %eax - 11fd: e8 6c 26 00 00 call 386e + 11b4: 83 ec 0c sub $0xc,%esp + 11b7: 8d 45 c8 lea -0x38(%ebp),%eax + 11ba: 50 push %eax + 11bb: e8 f3 25 00 00 call 37b3 for(pi = 0; pi < 4; pi++){ - 1202: 83 c4 10 add $0x10,%esp - 1205: 83 eb 01 sub $0x1,%ebx - 1208: 75 e2 jne 11ec - 120a: eb cf jmp 11db - 120c: bf 30 00 00 00 mov $0x30,%edi - 1211: be 70 00 00 00 mov $0x70,%esi - 1216: eb cf jmp 11e7 + 11c0: 83 c4 10 add $0x10,%esp + 11c3: 83 eb 01 sub $0x1,%ebx + 11c6: 75 e2 jne 11aa + 11c8: eb cf jmp 1199 + 11ca: bf 30 00 00 00 mov $0x30,%edi + 11cf: be 70 00 00 00 mov $0x70,%esi + 11d4: eb cf jmp 11a5 } } printf(1, "createdelete ok\n"); - 1218: 83 ec 08 sub $0x8,%esp - 121b: 68 47 41 00 00 push $0x4147 - 1220: 6a 01 push $0x1 - 1222: e8 3b 27 00 00 call 3962 + 11d6: 83 ec 08 sub $0x8,%esp + 11d9: 68 6f 40 00 00 push $0x406f + 11de: 6a 01 push $0x1 + 11e0: e8 c6 26 00 00 call 38ab } - 1227: 83 c4 10 add $0x10,%esp - 122a: 8d 65 f4 lea -0xc(%ebp),%esp - 122d: 5b pop %ebx - 122e: 5e pop %esi - 122f: 5f pop %edi - 1230: 5d pop %ebp - 1231: c3 ret + 11e5: 83 c4 10 add $0x10,%esp + 11e8: 8d 65 f4 lea -0xc(%ebp),%esp + 11eb: 5b pop %ebx + 11ec: 5e pop %esi + 11ed: 5f pop %edi + 11ee: 5d pop %ebp + 11ef: c3 ret -00001232 : +000011f0 : // can I unlink a file and still read it? void unlinkread(void) { - 1232: f3 0f 1e fb endbr32 - 1236: 55 push %ebp - 1237: 89 e5 mov %esp,%ebp - 1239: 56 push %esi - 123a: 53 push %ebx + 11f0: 55 push %ebp + 11f1: 89 e5 mov %esp,%ebp + 11f3: 56 push %esi + 11f4: 53 push %ebx int fd, fd1; printf(1, "unlinkread test\n"); - 123b: 83 ec 08 sub $0x8,%esp - 123e: 68 58 41 00 00 push $0x4158 - 1243: 6a 01 push $0x1 - 1245: e8 18 27 00 00 call 3962 + 11f5: 83 ec 08 sub $0x8,%esp + 11f8: 68 80 40 00 00 push $0x4080 + 11fd: 6a 01 push $0x1 + 11ff: e8 a7 26 00 00 call 38ab fd = open("unlinkread", O_CREATE | O_RDWR); - 124a: 83 c4 08 add $0x8,%esp - 124d: 68 02 02 00 00 push $0x202 - 1252: 68 69 41 00 00 push $0x4169 - 1257: e8 02 26 00 00 call 385e + 1204: 83 c4 08 add $0x8,%esp + 1207: 68 02 02 00 00 push $0x202 + 120c: 68 91 40 00 00 push $0x4091 + 1211: e8 8d 25 00 00 call 37a3 if(fd < 0){ - 125c: 83 c4 10 add $0x10,%esp - 125f: 85 c0 test %eax,%eax - 1261: 0f 88 f0 00 00 00 js 1357 - 1267: 89 c3 mov %eax,%ebx + 1216: 83 c4 10 add $0x10,%esp + 1219: 85 c0 test %eax,%eax + 121b: 0f 88 f0 00 00 00 js 1311 + 1221: 89 c3 mov %eax,%ebx printf(1, "create unlinkread failed\n"); exit(); } write(fd, "hello", 5); - 1269: 83 ec 04 sub $0x4,%esp - 126c: 6a 05 push $0x5 - 126e: 68 8e 41 00 00 push $0x418e - 1273: 50 push %eax - 1274: e8 c5 25 00 00 call 383e + 1223: 83 ec 04 sub $0x4,%esp + 1226: 6a 05 push $0x5 + 1228: 68 b6 40 00 00 push $0x40b6 + 122d: 50 push %eax + 122e: e8 50 25 00 00 call 3783 close(fd); - 1279: 89 1c 24 mov %ebx,(%esp) - 127c: e8 c5 25 00 00 call 3846 + 1233: 89 1c 24 mov %ebx,(%esp) + 1236: e8 50 25 00 00 call 378b fd = open("unlinkread", O_RDWR); - 1281: 83 c4 08 add $0x8,%esp - 1284: 6a 02 push $0x2 - 1286: 68 69 41 00 00 push $0x4169 - 128b: e8 ce 25 00 00 call 385e - 1290: 89 c3 mov %eax,%ebx + 123b: 83 c4 08 add $0x8,%esp + 123e: 6a 02 push $0x2 + 1240: 68 91 40 00 00 push $0x4091 + 1245: e8 59 25 00 00 call 37a3 + 124a: 89 c3 mov %eax,%ebx if(fd < 0){ - 1292: 83 c4 10 add $0x10,%esp - 1295: 85 c0 test %eax,%eax - 1297: 0f 88 ce 00 00 00 js 136b + 124c: 83 c4 10 add $0x10,%esp + 124f: 85 c0 test %eax,%eax + 1251: 0f 88 ce 00 00 00 js 1325 printf(1, "open unlinkread failed\n"); exit(); } if(unlink("unlinkread") != 0){ - 129d: 83 ec 0c sub $0xc,%esp - 12a0: 68 69 41 00 00 push $0x4169 - 12a5: e8 c4 25 00 00 call 386e - 12aa: 83 c4 10 add $0x10,%esp - 12ad: 85 c0 test %eax,%eax - 12af: 0f 85 ca 00 00 00 jne 137f + 1257: 83 ec 0c sub $0xc,%esp + 125a: 68 91 40 00 00 push $0x4091 + 125f: e8 4f 25 00 00 call 37b3 + 1264: 83 c4 10 add $0x10,%esp + 1267: 85 c0 test %eax,%eax + 1269: 0f 85 ca 00 00 00 jne 1339 printf(1, "unlink unlinkread failed\n"); exit(); } fd1 = open("unlinkread", O_CREATE | O_RDWR); - 12b5: 83 ec 08 sub $0x8,%esp - 12b8: 68 02 02 00 00 push $0x202 - 12bd: 68 69 41 00 00 push $0x4169 - 12c2: e8 97 25 00 00 call 385e - 12c7: 89 c6 mov %eax,%esi + 126f: 83 ec 08 sub $0x8,%esp + 1272: 68 02 02 00 00 push $0x202 + 1277: 68 91 40 00 00 push $0x4091 + 127c: e8 22 25 00 00 call 37a3 + 1281: 89 c6 mov %eax,%esi write(fd1, "yyy", 3); - 12c9: 83 c4 0c add $0xc,%esp - 12cc: 6a 03 push $0x3 - 12ce: 68 c6 41 00 00 push $0x41c6 - 12d3: 50 push %eax - 12d4: e8 65 25 00 00 call 383e + 1283: 83 c4 0c add $0xc,%esp + 1286: 6a 03 push $0x3 + 1288: 68 ee 40 00 00 push $0x40ee + 128d: 50 push %eax + 128e: e8 f0 24 00 00 call 3783 close(fd1); - 12d9: 89 34 24 mov %esi,(%esp) - 12dc: e8 65 25 00 00 call 3846 + 1293: 89 34 24 mov %esi,(%esp) + 1296: e8 f0 24 00 00 call 378b if(read(fd, buf, sizeof(buf)) != 5){ - 12e1: 83 c4 0c add $0xc,%esp - 12e4: 68 00 20 00 00 push $0x2000 - 12e9: 68 80 84 00 00 push $0x8480 - 12ee: 53 push %ebx - 12ef: e8 42 25 00 00 call 3836 - 12f4: 83 c4 10 add $0x10,%esp - 12f7: 83 f8 05 cmp $0x5,%eax - 12fa: 0f 85 93 00 00 00 jne 1393 + 129b: 83 c4 0c add $0xc,%esp + 129e: 68 00 20 00 00 push $0x2000 + 12a3: 68 60 83 00 00 push $0x8360 + 12a8: 53 push %ebx + 12a9: e8 cd 24 00 00 call 377b + 12ae: 83 c4 10 add $0x10,%esp + 12b1: 83 f8 05 cmp $0x5,%eax + 12b4: 0f 85 93 00 00 00 jne 134d printf(1, "unlinkread read failed"); exit(); } if(buf[0] != 'h'){ - 1300: 80 3d 80 84 00 00 68 cmpb $0x68,0x8480 - 1307: 0f 85 9a 00 00 00 jne 13a7 + 12ba: 80 3d 60 83 00 00 68 cmpb $0x68,0x8360 + 12c1: 0f 85 9a 00 00 00 jne 1361 printf(1, "unlinkread wrong data\n"); exit(); } if(write(fd, buf, 10) != 10){ - 130d: 83 ec 04 sub $0x4,%esp - 1310: 6a 0a push $0xa - 1312: 68 80 84 00 00 push $0x8480 - 1317: 53 push %ebx - 1318: e8 21 25 00 00 call 383e - 131d: 83 c4 10 add $0x10,%esp - 1320: 83 f8 0a cmp $0xa,%eax - 1323: 0f 85 92 00 00 00 jne 13bb + 12c7: 83 ec 04 sub $0x4,%esp + 12ca: 6a 0a push $0xa + 12cc: 68 60 83 00 00 push $0x8360 + 12d1: 53 push %ebx + 12d2: e8 ac 24 00 00 call 3783 + 12d7: 83 c4 10 add $0x10,%esp + 12da: 83 f8 0a cmp $0xa,%eax + 12dd: 0f 85 92 00 00 00 jne 1375 printf(1, "unlinkread write failed\n"); exit(); } close(fd); - 1329: 83 ec 0c sub $0xc,%esp - 132c: 53 push %ebx - 132d: e8 14 25 00 00 call 3846 + 12e3: 83 ec 0c sub $0xc,%esp + 12e6: 53 push %ebx + 12e7: e8 9f 24 00 00 call 378b unlink("unlinkread"); - 1332: c7 04 24 69 41 00 00 movl $0x4169,(%esp) - 1339: e8 30 25 00 00 call 386e + 12ec: c7 04 24 91 40 00 00 movl $0x4091,(%esp) + 12f3: e8 bb 24 00 00 call 37b3 printf(1, "unlinkread ok\n"); - 133e: 83 c4 08 add $0x8,%esp - 1341: 68 11 42 00 00 push $0x4211 - 1346: 6a 01 push $0x1 - 1348: e8 15 26 00 00 call 3962 + 12f8: 83 c4 08 add $0x8,%esp + 12fb: 68 39 41 00 00 push $0x4139 + 1300: 6a 01 push $0x1 + 1302: e8 a4 25 00 00 call 38ab } - 134d: 83 c4 10 add $0x10,%esp - 1350: 8d 65 f8 lea -0x8(%ebp),%esp - 1353: 5b pop %ebx - 1354: 5e pop %esi - 1355: 5d pop %ebp - 1356: c3 ret + 1307: 83 c4 10 add $0x10,%esp + 130a: 8d 65 f8 lea -0x8(%ebp),%esp + 130d: 5b pop %ebx + 130e: 5e pop %esi + 130f: 5d pop %ebp + 1310: c3 ret printf(1, "create unlinkread failed\n"); - 1357: 83 ec 08 sub $0x8,%esp - 135a: 68 74 41 00 00 push $0x4174 - 135f: 6a 01 push $0x1 - 1361: e8 fc 25 00 00 call 3962 + 1311: 83 ec 08 sub $0x8,%esp + 1314: 68 9c 40 00 00 push $0x409c + 1319: 6a 01 push $0x1 + 131b: e8 8b 25 00 00 call 38ab exit(); - 1366: e8 b3 24 00 00 call 381e + 1320: e8 3e 24 00 00 call 3763 printf(1, "open unlinkread failed\n"); - 136b: 83 ec 08 sub $0x8,%esp - 136e: 68 94 41 00 00 push $0x4194 - 1373: 6a 01 push $0x1 - 1375: e8 e8 25 00 00 call 3962 + 1325: 83 ec 08 sub $0x8,%esp + 1328: 68 bc 40 00 00 push $0x40bc + 132d: 6a 01 push $0x1 + 132f: e8 77 25 00 00 call 38ab exit(); - 137a: e8 9f 24 00 00 call 381e + 1334: e8 2a 24 00 00 call 3763 printf(1, "unlink unlinkread failed\n"); - 137f: 83 ec 08 sub $0x8,%esp - 1382: 68 ac 41 00 00 push $0x41ac - 1387: 6a 01 push $0x1 - 1389: e8 d4 25 00 00 call 3962 + 1339: 83 ec 08 sub $0x8,%esp + 133c: 68 d4 40 00 00 push $0x40d4 + 1341: 6a 01 push $0x1 + 1343: e8 63 25 00 00 call 38ab exit(); - 138e: e8 8b 24 00 00 call 381e + 1348: e8 16 24 00 00 call 3763 printf(1, "unlinkread read failed"); - 1393: 83 ec 08 sub $0x8,%esp - 1396: 68 ca 41 00 00 push $0x41ca - 139b: 6a 01 push $0x1 - 139d: e8 c0 25 00 00 call 3962 + 134d: 83 ec 08 sub $0x8,%esp + 1350: 68 f2 40 00 00 push $0x40f2 + 1355: 6a 01 push $0x1 + 1357: e8 4f 25 00 00 call 38ab exit(); - 13a2: e8 77 24 00 00 call 381e + 135c: e8 02 24 00 00 call 3763 printf(1, "unlinkread wrong data\n"); - 13a7: 83 ec 08 sub $0x8,%esp - 13aa: 68 e1 41 00 00 push $0x41e1 - 13af: 6a 01 push $0x1 - 13b1: e8 ac 25 00 00 call 3962 + 1361: 83 ec 08 sub $0x8,%esp + 1364: 68 09 41 00 00 push $0x4109 + 1369: 6a 01 push $0x1 + 136b: e8 3b 25 00 00 call 38ab exit(); - 13b6: e8 63 24 00 00 call 381e + 1370: e8 ee 23 00 00 call 3763 printf(1, "unlinkread write failed\n"); - 13bb: 83 ec 08 sub $0x8,%esp - 13be: 68 f8 41 00 00 push $0x41f8 - 13c3: 6a 01 push $0x1 - 13c5: e8 98 25 00 00 call 3962 + 1375: 83 ec 08 sub $0x8,%esp + 1378: 68 20 41 00 00 push $0x4120 + 137d: 6a 01 push $0x1 + 137f: e8 27 25 00 00 call 38ab exit(); - 13ca: e8 4f 24 00 00 call 381e + 1384: e8 da 23 00 00 call 3763 -000013cf : +00001389 : void linktest(void) { - 13cf: f3 0f 1e fb endbr32 - 13d3: 55 push %ebp - 13d4: 89 e5 mov %esp,%ebp - 13d6: 53 push %ebx - 13d7: 83 ec 0c sub $0xc,%esp + 1389: 55 push %ebp + 138a: 89 e5 mov %esp,%ebp + 138c: 53 push %ebx + 138d: 83 ec 0c sub $0xc,%esp int fd; printf(1, "linktest\n"); - 13da: 68 20 42 00 00 push $0x4220 - 13df: 6a 01 push $0x1 - 13e1: e8 7c 25 00 00 call 3962 + 1390: 68 48 41 00 00 push $0x4148 + 1395: 6a 01 push $0x1 + 1397: e8 0f 25 00 00 call 38ab unlink("lf1"); - 13e6: c7 04 24 2a 42 00 00 movl $0x422a,(%esp) - 13ed: e8 7c 24 00 00 call 386e + 139c: c7 04 24 52 41 00 00 movl $0x4152,(%esp) + 13a3: e8 0b 24 00 00 call 37b3 unlink("lf2"); - 13f2: c7 04 24 2e 42 00 00 movl $0x422e,(%esp) - 13f9: e8 70 24 00 00 call 386e + 13a8: c7 04 24 56 41 00 00 movl $0x4156,(%esp) + 13af: e8 ff 23 00 00 call 37b3 fd = open("lf1", O_CREATE|O_RDWR); - 13fe: 83 c4 08 add $0x8,%esp - 1401: 68 02 02 00 00 push $0x202 - 1406: 68 2a 42 00 00 push $0x422a - 140b: e8 4e 24 00 00 call 385e + 13b4: 83 c4 08 add $0x8,%esp + 13b7: 68 02 02 00 00 push $0x202 + 13bc: 68 52 41 00 00 push $0x4152 + 13c1: e8 dd 23 00 00 call 37a3 if(fd < 0){ - 1410: 83 c4 10 add $0x10,%esp - 1413: 85 c0 test %eax,%eax - 1415: 0f 88 2a 01 00 00 js 1545 - 141b: 89 c3 mov %eax,%ebx + 13c6: 83 c4 10 add $0x10,%esp + 13c9: 85 c0 test %eax,%eax + 13cb: 0f 88 2a 01 00 00 js 14fb + 13d1: 89 c3 mov %eax,%ebx printf(1, "create lf1 failed\n"); exit(); } if(write(fd, "hello", 5) != 5){ - 141d: 83 ec 04 sub $0x4,%esp - 1420: 6a 05 push $0x5 - 1422: 68 8e 41 00 00 push $0x418e - 1427: 50 push %eax - 1428: e8 11 24 00 00 call 383e - 142d: 83 c4 10 add $0x10,%esp - 1430: 83 f8 05 cmp $0x5,%eax - 1433: 0f 85 20 01 00 00 jne 1559 + 13d3: 83 ec 04 sub $0x4,%esp + 13d6: 6a 05 push $0x5 + 13d8: 68 b6 40 00 00 push $0x40b6 + 13dd: 50 push %eax + 13de: e8 a0 23 00 00 call 3783 + 13e3: 83 c4 10 add $0x10,%esp + 13e6: 83 f8 05 cmp $0x5,%eax + 13e9: 0f 85 20 01 00 00 jne 150f printf(1, "write lf1 failed\n"); exit(); } close(fd); - 1439: 83 ec 0c sub $0xc,%esp - 143c: 53 push %ebx - 143d: e8 04 24 00 00 call 3846 + 13ef: 83 ec 0c sub $0xc,%esp + 13f2: 53 push %ebx + 13f3: e8 93 23 00 00 call 378b if(link("lf1", "lf2") < 0){ - 1442: 83 c4 08 add $0x8,%esp - 1445: 68 2e 42 00 00 push $0x422e - 144a: 68 2a 42 00 00 push $0x422a - 144f: e8 2a 24 00 00 call 387e - 1454: 83 c4 10 add $0x10,%esp - 1457: 85 c0 test %eax,%eax - 1459: 0f 88 0e 01 00 00 js 156d + 13f8: 83 c4 08 add $0x8,%esp + 13fb: 68 56 41 00 00 push $0x4156 + 1400: 68 52 41 00 00 push $0x4152 + 1405: e8 b9 23 00 00 call 37c3 + 140a: 83 c4 10 add $0x10,%esp + 140d: 85 c0 test %eax,%eax + 140f: 0f 88 0e 01 00 00 js 1523 printf(1, "link lf1 lf2 failed\n"); exit(); } unlink("lf1"); - 145f: 83 ec 0c sub $0xc,%esp - 1462: 68 2a 42 00 00 push $0x422a - 1467: e8 02 24 00 00 call 386e + 1415: 83 ec 0c sub $0xc,%esp + 1418: 68 52 41 00 00 push $0x4152 + 141d: e8 91 23 00 00 call 37b3 if(open("lf1", 0) >= 0){ - 146c: 83 c4 08 add $0x8,%esp - 146f: 6a 00 push $0x0 - 1471: 68 2a 42 00 00 push $0x422a - 1476: e8 e3 23 00 00 call 385e - 147b: 83 c4 10 add $0x10,%esp - 147e: 85 c0 test %eax,%eax - 1480: 0f 89 fb 00 00 00 jns 1581 + 1422: 83 c4 08 add $0x8,%esp + 1425: 6a 00 push $0x0 + 1427: 68 52 41 00 00 push $0x4152 + 142c: e8 72 23 00 00 call 37a3 + 1431: 83 c4 10 add $0x10,%esp + 1434: 85 c0 test %eax,%eax + 1436: 0f 89 fb 00 00 00 jns 1537 printf(1, "unlinked lf1 but it is still there!\n"); exit(); } fd = open("lf2", 0); - 1486: 83 ec 08 sub $0x8,%esp - 1489: 6a 00 push $0x0 - 148b: 68 2e 42 00 00 push $0x422e - 1490: e8 c9 23 00 00 call 385e - 1495: 89 c3 mov %eax,%ebx + 143c: 83 ec 08 sub $0x8,%esp + 143f: 6a 00 push $0x0 + 1441: 68 56 41 00 00 push $0x4156 + 1446: e8 58 23 00 00 call 37a3 + 144b: 89 c3 mov %eax,%ebx if(fd < 0){ - 1497: 83 c4 10 add $0x10,%esp - 149a: 85 c0 test %eax,%eax - 149c: 0f 88 f3 00 00 00 js 1595 + 144d: 83 c4 10 add $0x10,%esp + 1450: 85 c0 test %eax,%eax + 1452: 0f 88 f3 00 00 00 js 154b printf(1, "open lf2 failed\n"); exit(); } if(read(fd, buf, sizeof(buf)) != 5){ - 14a2: 83 ec 04 sub $0x4,%esp - 14a5: 68 00 20 00 00 push $0x2000 - 14aa: 68 80 84 00 00 push $0x8480 - 14af: 50 push %eax - 14b0: e8 81 23 00 00 call 3836 - 14b5: 83 c4 10 add $0x10,%esp - 14b8: 83 f8 05 cmp $0x5,%eax - 14bb: 0f 85 e8 00 00 00 jne 15a9 + 1458: 83 ec 04 sub $0x4,%esp + 145b: 68 00 20 00 00 push $0x2000 + 1460: 68 60 83 00 00 push $0x8360 + 1465: 50 push %eax + 1466: e8 10 23 00 00 call 377b + 146b: 83 c4 10 add $0x10,%esp + 146e: 83 f8 05 cmp $0x5,%eax + 1471: 0f 85 e8 00 00 00 jne 155f printf(1, "read lf2 failed\n"); exit(); } close(fd); - 14c1: 83 ec 0c sub $0xc,%esp - 14c4: 53 push %ebx - 14c5: e8 7c 23 00 00 call 3846 + 1477: 83 ec 0c sub $0xc,%esp + 147a: 53 push %ebx + 147b: e8 0b 23 00 00 call 378b if(link("lf2", "lf2") >= 0){ - 14ca: 83 c4 08 add $0x8,%esp - 14cd: 68 2e 42 00 00 push $0x422e - 14d2: 68 2e 42 00 00 push $0x422e - 14d7: e8 a2 23 00 00 call 387e - 14dc: 83 c4 10 add $0x10,%esp - 14df: 85 c0 test %eax,%eax - 14e1: 0f 89 d6 00 00 00 jns 15bd + 1480: 83 c4 08 add $0x8,%esp + 1483: 68 56 41 00 00 push $0x4156 + 1488: 68 56 41 00 00 push $0x4156 + 148d: e8 31 23 00 00 call 37c3 + 1492: 83 c4 10 add $0x10,%esp + 1495: 85 c0 test %eax,%eax + 1497: 0f 89 d6 00 00 00 jns 1573 printf(1, "link lf2 lf2 succeeded! oops\n"); exit(); } unlink("lf2"); - 14e7: 83 ec 0c sub $0xc,%esp - 14ea: 68 2e 42 00 00 push $0x422e - 14ef: e8 7a 23 00 00 call 386e + 149d: 83 ec 0c sub $0xc,%esp + 14a0: 68 56 41 00 00 push $0x4156 + 14a5: e8 09 23 00 00 call 37b3 if(link("lf2", "lf1") >= 0){ - 14f4: 83 c4 08 add $0x8,%esp - 14f7: 68 2a 42 00 00 push $0x422a - 14fc: 68 2e 42 00 00 push $0x422e - 1501: e8 78 23 00 00 call 387e - 1506: 83 c4 10 add $0x10,%esp - 1509: 85 c0 test %eax,%eax - 150b: 0f 89 c0 00 00 00 jns 15d1 + 14aa: 83 c4 08 add $0x8,%esp + 14ad: 68 52 41 00 00 push $0x4152 + 14b2: 68 56 41 00 00 push $0x4156 + 14b7: e8 07 23 00 00 call 37c3 + 14bc: 83 c4 10 add $0x10,%esp + 14bf: 85 c0 test %eax,%eax + 14c1: 0f 89 c0 00 00 00 jns 1587 printf(1, "link non-existant succeeded! oops\n"); exit(); } if(link(".", "lf1") >= 0){ - 1511: 83 ec 08 sub $0x8,%esp - 1514: 68 2a 42 00 00 push $0x422a - 1519: 68 f2 44 00 00 push $0x44f2 - 151e: e8 5b 23 00 00 call 387e - 1523: 83 c4 10 add $0x10,%esp - 1526: 85 c0 test %eax,%eax - 1528: 0f 89 b7 00 00 00 jns 15e5 + 14c7: 83 ec 08 sub $0x8,%esp + 14ca: 68 52 41 00 00 push $0x4152 + 14cf: 68 1a 44 00 00 push $0x441a + 14d4: e8 ea 22 00 00 call 37c3 + 14d9: 83 c4 10 add $0x10,%esp + 14dc: 85 c0 test %eax,%eax + 14de: 0f 89 b7 00 00 00 jns 159b printf(1, "link . lf1 succeeded! oops\n"); exit(); } printf(1, "linktest ok\n"); - 152e: 83 ec 08 sub $0x8,%esp - 1531: 68 c8 42 00 00 push $0x42c8 - 1536: 6a 01 push $0x1 - 1538: e8 25 24 00 00 call 3962 + 14e4: 83 ec 08 sub $0x8,%esp + 14e7: 68 f0 41 00 00 push $0x41f0 + 14ec: 6a 01 push $0x1 + 14ee: e8 b8 23 00 00 call 38ab } - 153d: 83 c4 10 add $0x10,%esp - 1540: 8b 5d fc mov -0x4(%ebp),%ebx - 1543: c9 leave - 1544: c3 ret + 14f3: 83 c4 10 add $0x10,%esp + 14f6: 8b 5d fc mov -0x4(%ebp),%ebx + 14f9: c9 leave + 14fa: c3 ret printf(1, "create lf1 failed\n"); - 1545: 83 ec 08 sub $0x8,%esp - 1548: 68 32 42 00 00 push $0x4232 - 154d: 6a 01 push $0x1 - 154f: e8 0e 24 00 00 call 3962 + 14fb: 83 ec 08 sub $0x8,%esp + 14fe: 68 5a 41 00 00 push $0x415a + 1503: 6a 01 push $0x1 + 1505: e8 a1 23 00 00 call 38ab exit(); - 1554: e8 c5 22 00 00 call 381e + 150a: e8 54 22 00 00 call 3763 printf(1, "write lf1 failed\n"); - 1559: 83 ec 08 sub $0x8,%esp - 155c: 68 45 42 00 00 push $0x4245 - 1561: 6a 01 push $0x1 - 1563: e8 fa 23 00 00 call 3962 + 150f: 83 ec 08 sub $0x8,%esp + 1512: 68 6d 41 00 00 push $0x416d + 1517: 6a 01 push $0x1 + 1519: e8 8d 23 00 00 call 38ab exit(); - 1568: e8 b1 22 00 00 call 381e + 151e: e8 40 22 00 00 call 3763 printf(1, "link lf1 lf2 failed\n"); - 156d: 83 ec 08 sub $0x8,%esp - 1570: 68 57 42 00 00 push $0x4257 - 1575: 6a 01 push $0x1 - 1577: e8 e6 23 00 00 call 3962 + 1523: 83 ec 08 sub $0x8,%esp + 1526: 68 7f 41 00 00 push $0x417f + 152b: 6a 01 push $0x1 + 152d: e8 79 23 00 00 call 38ab exit(); - 157c: e8 9d 22 00 00 call 381e + 1532: e8 2c 22 00 00 call 3763 printf(1, "unlinked lf1 but it is still there!\n"); - 1581: 83 ec 08 sub $0x8,%esp - 1584: 68 38 4e 00 00 push $0x4e38 - 1589: 6a 01 push $0x1 - 158b: e8 d2 23 00 00 call 3962 + 1537: 83 ec 08 sub $0x8,%esp + 153a: 68 60 4d 00 00 push $0x4d60 + 153f: 6a 01 push $0x1 + 1541: e8 65 23 00 00 call 38ab exit(); - 1590: e8 89 22 00 00 call 381e + 1546: e8 18 22 00 00 call 3763 printf(1, "open lf2 failed\n"); - 1595: 83 ec 08 sub $0x8,%esp - 1598: 68 6c 42 00 00 push $0x426c - 159d: 6a 01 push $0x1 - 159f: e8 be 23 00 00 call 3962 + 154b: 83 ec 08 sub $0x8,%esp + 154e: 68 94 41 00 00 push $0x4194 + 1553: 6a 01 push $0x1 + 1555: e8 51 23 00 00 call 38ab exit(); - 15a4: e8 75 22 00 00 call 381e + 155a: e8 04 22 00 00 call 3763 printf(1, "read lf2 failed\n"); - 15a9: 83 ec 08 sub $0x8,%esp - 15ac: 68 7d 42 00 00 push $0x427d - 15b1: 6a 01 push $0x1 - 15b3: e8 aa 23 00 00 call 3962 + 155f: 83 ec 08 sub $0x8,%esp + 1562: 68 a5 41 00 00 push $0x41a5 + 1567: 6a 01 push $0x1 + 1569: e8 3d 23 00 00 call 38ab exit(); - 15b8: e8 61 22 00 00 call 381e + 156e: e8 f0 21 00 00 call 3763 printf(1, "link lf2 lf2 succeeded! oops\n"); - 15bd: 83 ec 08 sub $0x8,%esp - 15c0: 68 8e 42 00 00 push $0x428e - 15c5: 6a 01 push $0x1 - 15c7: e8 96 23 00 00 call 3962 + 1573: 83 ec 08 sub $0x8,%esp + 1576: 68 b6 41 00 00 push $0x41b6 + 157b: 6a 01 push $0x1 + 157d: e8 29 23 00 00 call 38ab exit(); - 15cc: e8 4d 22 00 00 call 381e + 1582: e8 dc 21 00 00 call 3763 printf(1, "link non-existant succeeded! oops\n"); - 15d1: 83 ec 08 sub $0x8,%esp - 15d4: 68 60 4e 00 00 push $0x4e60 - 15d9: 6a 01 push $0x1 - 15db: e8 82 23 00 00 call 3962 + 1587: 83 ec 08 sub $0x8,%esp + 158a: 68 88 4d 00 00 push $0x4d88 + 158f: 6a 01 push $0x1 + 1591: e8 15 23 00 00 call 38ab exit(); - 15e0: e8 39 22 00 00 call 381e + 1596: e8 c8 21 00 00 call 3763 printf(1, "link . lf1 succeeded! oops\n"); - 15e5: 83 ec 08 sub $0x8,%esp - 15e8: 68 ac 42 00 00 push $0x42ac - 15ed: 6a 01 push $0x1 - 15ef: e8 6e 23 00 00 call 3962 + 159b: 83 ec 08 sub $0x8,%esp + 159e: 68 d4 41 00 00 push $0x41d4 + 15a3: 6a 01 push $0x1 + 15a5: e8 01 23 00 00 call 38ab exit(); - 15f4: e8 25 22 00 00 call 381e + 15aa: e8 b4 21 00 00 call 3763 -000015f9 : +000015af : // test concurrent create/link/unlink of the same file void concreate(void) { - 15f9: f3 0f 1e fb endbr32 - 15fd: 55 push %ebp - 15fe: 89 e5 mov %esp,%ebp - 1600: 57 push %edi - 1601: 56 push %esi - 1602: 53 push %ebx - 1603: 83 ec 54 sub $0x54,%esp + 15af: 55 push %ebp + 15b0: 89 e5 mov %esp,%ebp + 15b2: 57 push %edi + 15b3: 56 push %esi + 15b4: 53 push %ebx + 15b5: 83 ec 54 sub $0x54,%esp struct { ushort inum; char name[14]; } de; printf(1, "concreate test\n"); - 1606: 68 d5 42 00 00 push $0x42d5 - 160b: 6a 01 push $0x1 - 160d: e8 50 23 00 00 call 3962 + 15b8: 68 fd 41 00 00 push $0x41fd + 15bd: 6a 01 push $0x1 + 15bf: e8 e7 22 00 00 call 38ab file[0] = 'C'; - 1612: c6 45 e5 43 movb $0x43,-0x1b(%ebp) + 15c4: c6 45 e5 43 movb $0x43,-0x1b(%ebp) file[2] = '\0'; - 1616: c6 45 e7 00 movb $0x0,-0x19(%ebp) - 161a: 83 c4 10 add $0x10,%esp + 15c8: c6 45 e7 00 movb $0x0,-0x19(%ebp) + 15cc: 83 c4 10 add $0x10,%esp for(i = 0; i < 40; i++){ - 161d: bb 00 00 00 00 mov $0x0,%ebx + 15cf: bb 00 00 00 00 mov $0x0,%ebx file[1] = '0' + i; unlink(file); - 1622: 8d 75 e5 lea -0x1b(%ebp),%esi + 15d4: 8d 75 e5 lea -0x1b(%ebp),%esi pid = fork(); if(pid && (i % 3) == 1){ - 1625: bf 56 55 55 55 mov $0x55555556,%edi - 162a: e9 75 02 00 00 jmp 18a4 + 15d7: bf 56 55 55 55 mov $0x55555556,%edi + 15dc: e9 75 02 00 00 jmp 1856 link("C0", file); - 162f: 83 ec 08 sub $0x8,%esp - 1632: 56 push %esi - 1633: 68 e5 42 00 00 push $0x42e5 - 1638: e8 41 22 00 00 call 387e - 163d: 83 c4 10 add $0x10,%esp - 1640: e9 4e 02 00 00 jmp 1893 + 15e1: 83 ec 08 sub $0x8,%esp + 15e4: 56 push %esi + 15e5: 68 0d 42 00 00 push $0x420d + 15ea: e8 d4 21 00 00 call 37c3 + 15ef: 83 c4 10 add $0x10,%esp + 15f2: e9 4e 02 00 00 jmp 1845 } else if(pid == 0 && (i % 5) == 1){ - 1645: ba 67 66 66 66 mov $0x66666667,%edx - 164a: 89 d8 mov %ebx,%eax - 164c: f7 ea imul %edx - 164e: d1 fa sar %edx - 1650: 89 d8 mov %ebx,%eax - 1652: c1 f8 1f sar $0x1f,%eax - 1655: 29 c2 sub %eax,%edx - 1657: 8d 04 92 lea (%edx,%edx,4),%eax - 165a: 29 c3 sub %eax,%ebx - 165c: 83 fb 01 cmp $0x1,%ebx - 165f: 74 34 je 1695 + 15f7: ba 67 66 66 66 mov $0x66666667,%edx + 15fc: 89 d8 mov %ebx,%eax + 15fe: f7 ea imul %edx + 1600: d1 fa sar %edx + 1602: 89 d8 mov %ebx,%eax + 1604: c1 f8 1f sar $0x1f,%eax + 1607: 29 c2 sub %eax,%edx + 1609: 8d 04 92 lea (%edx,%edx,4),%eax + 160c: 29 c3 sub %eax,%ebx + 160e: 83 fb 01 cmp $0x1,%ebx + 1611: 74 34 je 1647 link("C0", file); } else { fd = open(file, O_CREATE | O_RDWR); - 1661: 83 ec 08 sub $0x8,%esp - 1664: 68 02 02 00 00 push $0x202 - 1669: 8d 45 e5 lea -0x1b(%ebp),%eax - 166c: 50 push %eax - 166d: e8 ec 21 00 00 call 385e + 1613: 83 ec 08 sub $0x8,%esp + 1616: 68 02 02 00 00 push $0x202 + 161b: 8d 45 e5 lea -0x1b(%ebp),%eax + 161e: 50 push %eax + 161f: e8 7f 21 00 00 call 37a3 if(fd < 0){ - 1672: 83 c4 10 add $0x10,%esp - 1675: 85 c0 test %eax,%eax - 1677: 0f 89 f9 01 00 00 jns 1876 + 1624: 83 c4 10 add $0x10,%esp + 1627: 85 c0 test %eax,%eax + 1629: 0f 89 f9 01 00 00 jns 1828 printf(1, "concreate create %s failed\n", file); - 167d: 83 ec 04 sub $0x4,%esp - 1680: 8d 45 e5 lea -0x1b(%ebp),%eax - 1683: 50 push %eax - 1684: 68 e8 42 00 00 push $0x42e8 - 1689: 6a 01 push $0x1 - 168b: e8 d2 22 00 00 call 3962 + 162f: 83 ec 04 sub $0x4,%esp + 1632: 8d 45 e5 lea -0x1b(%ebp),%eax + 1635: 50 push %eax + 1636: 68 10 42 00 00 push $0x4210 + 163b: 6a 01 push $0x1 + 163d: e8 69 22 00 00 call 38ab exit(); - 1690: e8 89 21 00 00 call 381e + 1642: e8 1c 21 00 00 call 3763 link("C0", file); - 1695: 83 ec 08 sub $0x8,%esp - 1698: 8d 45 e5 lea -0x1b(%ebp),%eax - 169b: 50 push %eax - 169c: 68 e5 42 00 00 push $0x42e5 - 16a1: e8 d8 21 00 00 call 387e - 16a6: 83 c4 10 add $0x10,%esp + 1647: 83 ec 08 sub $0x8,%esp + 164a: 8d 45 e5 lea -0x1b(%ebp),%eax + 164d: 50 push %eax + 164e: 68 0d 42 00 00 push $0x420d + 1653: e8 6b 21 00 00 call 37c3 + 1658: 83 c4 10 add $0x10,%esp } close(fd); } if(pid == 0) exit(); - 16a9: e8 70 21 00 00 call 381e + 165b: e8 03 21 00 00 call 3763 else wait(); } memset(fa, 0, sizeof(fa)); - 16ae: 83 ec 04 sub $0x4,%esp - 16b1: 6a 28 push $0x28 - 16b3: 6a 00 push $0x0 - 16b5: 8d 45 bd lea -0x43(%ebp),%eax - 16b8: 50 push %eax - 16b9: e8 f9 1f 00 00 call 36b7 + 1660: 83 ec 04 sub $0x4,%esp + 1663: 6a 28 push $0x28 + 1665: 6a 00 push $0x0 + 1667: 8d 45 bd lea -0x43(%ebp),%eax + 166a: 50 push %eax + 166b: e8 a0 1f 00 00 call 3610 fd = open(".", 0); - 16be: 83 c4 08 add $0x8,%esp - 16c1: 6a 00 push $0x0 - 16c3: 68 f2 44 00 00 push $0x44f2 - 16c8: e8 91 21 00 00 call 385e - 16cd: 89 c3 mov %eax,%ebx + 1670: 83 c4 08 add $0x8,%esp + 1673: 6a 00 push $0x0 + 1675: 68 1a 44 00 00 push $0x441a + 167a: e8 24 21 00 00 call 37a3 + 167f: 89 c3 mov %eax,%ebx n = 0; while(read(fd, &de, sizeof(de)) > 0){ - 16cf: 83 c4 10 add $0x10,%esp + 1681: 83 c4 10 add $0x10,%esp n = 0; - 16d2: bf 00 00 00 00 mov $0x0,%edi + 1684: bf 00 00 00 00 mov $0x0,%edi while(read(fd, &de, sizeof(de)) > 0){ - 16d7: 8d 75 ac lea -0x54(%ebp),%esi - 16da: 83 ec 04 sub $0x4,%esp - 16dd: 6a 10 push $0x10 - 16df: 56 push %esi - 16e0: 53 push %ebx - 16e1: e8 50 21 00 00 call 3836 - 16e6: 83 c4 10 add $0x10,%esp - 16e9: 85 c0 test %eax,%eax - 16eb: 7e 60 jle 174d + 1689: 8d 75 ac lea -0x54(%ebp),%esi + 168c: 83 ec 04 sub $0x4,%esp + 168f: 6a 10 push $0x10 + 1691: 56 push %esi + 1692: 53 push %ebx + 1693: e8 e3 20 00 00 call 377b + 1698: 83 c4 10 add $0x10,%esp + 169b: 85 c0 test %eax,%eax + 169d: 7e 60 jle 16ff if(de.inum == 0) - 16ed: 66 83 7d ac 00 cmpw $0x0,-0x54(%ebp) - 16f2: 74 e6 je 16da + 169f: 66 83 7d ac 00 cmpw $0x0,-0x54(%ebp) + 16a4: 74 e6 je 168c continue; if(de.name[0] == 'C' && de.name[2] == '\0'){ - 16f4: 80 7d ae 43 cmpb $0x43,-0x52(%ebp) - 16f8: 75 e0 jne 16da - 16fa: 80 7d b0 00 cmpb $0x0,-0x50(%ebp) - 16fe: 75 da jne 16da + 16a6: 80 7d ae 43 cmpb $0x43,-0x52(%ebp) + 16aa: 75 e0 jne 168c + 16ac: 80 7d b0 00 cmpb $0x0,-0x50(%ebp) + 16b0: 75 da jne 168c i = de.name[1] - '0'; - 1700: 0f be 45 af movsbl -0x51(%ebp),%eax - 1704: 83 e8 30 sub $0x30,%eax + 16b2: 0f be 45 af movsbl -0x51(%ebp),%eax + 16b6: 83 e8 30 sub $0x30,%eax if(i < 0 || i >= sizeof(fa)){ - 1707: 83 f8 27 cmp $0x27,%eax - 170a: 77 11 ja 171d + 16b9: 83 f8 27 cmp $0x27,%eax + 16bc: 77 11 ja 16cf printf(1, "concreate weird file %s\n", de.name); exit(); } if(fa[i]){ - 170c: 80 7c 05 bd 00 cmpb $0x0,-0x43(%ebp,%eax,1) - 1711: 75 22 jne 1735 + 16be: 80 7c 05 bd 00 cmpb $0x0,-0x43(%ebp,%eax,1) + 16c3: 75 22 jne 16e7 printf(1, "concreate duplicate file %s\n", de.name); exit(); } fa[i] = 1; - 1713: c6 44 05 bd 01 movb $0x1,-0x43(%ebp,%eax,1) + 16c5: c6 44 05 bd 01 movb $0x1,-0x43(%ebp,%eax,1) n++; - 1718: 83 c7 01 add $0x1,%edi - 171b: eb bd jmp 16da + 16ca: 83 c7 01 add $0x1,%edi + 16cd: eb bd jmp 168c printf(1, "concreate weird file %s\n", de.name); - 171d: 83 ec 04 sub $0x4,%esp - 1720: 8d 45 ae lea -0x52(%ebp),%eax - 1723: 50 push %eax - 1724: 68 04 43 00 00 push $0x4304 - 1729: 6a 01 push $0x1 - 172b: e8 32 22 00 00 call 3962 + 16cf: 83 ec 04 sub $0x4,%esp + 16d2: 8d 45 ae lea -0x52(%ebp),%eax + 16d5: 50 push %eax + 16d6: 68 2c 42 00 00 push $0x422c + 16db: 6a 01 push $0x1 + 16dd: e8 c9 21 00 00 call 38ab exit(); - 1730: e8 e9 20 00 00 call 381e + 16e2: e8 7c 20 00 00 call 3763 printf(1, "concreate duplicate file %s\n", de.name); - 1735: 83 ec 04 sub $0x4,%esp - 1738: 8d 45 ae lea -0x52(%ebp),%eax - 173b: 50 push %eax - 173c: 68 1d 43 00 00 push $0x431d - 1741: 6a 01 push $0x1 - 1743: e8 1a 22 00 00 call 3962 + 16e7: 83 ec 04 sub $0x4,%esp + 16ea: 8d 45 ae lea -0x52(%ebp),%eax + 16ed: 50 push %eax + 16ee: 68 45 42 00 00 push $0x4245 + 16f3: 6a 01 push $0x1 + 16f5: e8 b1 21 00 00 call 38ab exit(); - 1748: e8 d1 20 00 00 call 381e + 16fa: e8 64 20 00 00 call 3763 } } close(fd); - 174d: 83 ec 0c sub $0xc,%esp - 1750: 53 push %ebx - 1751: e8 f0 20 00 00 call 3846 + 16ff: 83 ec 0c sub $0xc,%esp + 1702: 53 push %ebx + 1703: e8 83 20 00 00 call 378b if(n != 40){ - 1756: 83 c4 10 add $0x10,%esp - 1759: 83 ff 28 cmp $0x28,%edi - 175c: 75 0d jne 176b + 1708: 83 c4 10 add $0x10,%esp + 170b: 83 ff 28 cmp $0x28,%edi + 170e: 75 0d jne 171d printf(1, "concreate not enough files in directory listing\n"); exit(); } for(i = 0; i < 40; i++){ - 175e: bb 00 00 00 00 mov $0x0,%ebx + 1710: bb 00 00 00 00 mov $0x0,%ebx printf(1, "fork failed\n"); exit(); } if(((i % 3) == 0 && pid == 0) || ((i % 3) == 1 && pid != 0)){ close(open(file, 0)); - 1763: 8d 7d e5 lea -0x1b(%ebp),%edi - 1766: e9 88 00 00 00 jmp 17f3 + 1715: 8d 7d e5 lea -0x1b(%ebp),%edi + 1718: e9 88 00 00 00 jmp 17a5 printf(1, "concreate not enough files in directory listing\n"); - 176b: 83 ec 08 sub $0x8,%esp - 176e: 68 84 4e 00 00 push $0x4e84 - 1773: 6a 01 push $0x1 - 1775: e8 e8 21 00 00 call 3962 + 171d: 83 ec 08 sub $0x8,%esp + 1720: 68 ac 4d 00 00 push $0x4dac + 1725: 6a 01 push $0x1 + 1727: e8 7f 21 00 00 call 38ab exit(); - 177a: e8 9f 20 00 00 call 381e + 172c: e8 32 20 00 00 call 3763 printf(1, "fork failed\n"); - 177f: 83 ec 08 sub $0x8,%esp - 1782: 68 bd 4b 00 00 push $0x4bbd - 1787: 6a 01 push $0x1 - 1789: e8 d4 21 00 00 call 3962 + 1731: 83 ec 08 sub $0x8,%esp + 1734: 68 e5 4a 00 00 push $0x4ae5 + 1739: 6a 01 push $0x1 + 173b: e8 6b 21 00 00 call 38ab exit(); - 178e: e8 8b 20 00 00 call 381e + 1740: e8 1e 20 00 00 call 3763 close(open(file, 0)); - 1793: 83 ec 08 sub $0x8,%esp - 1796: 6a 00 push $0x0 - 1798: 57 push %edi - 1799: e8 c0 20 00 00 call 385e - 179e: 89 04 24 mov %eax,(%esp) - 17a1: e8 a0 20 00 00 call 3846 + 1745: 83 ec 08 sub $0x8,%esp + 1748: 6a 00 push $0x0 + 174a: 57 push %edi + 174b: e8 53 20 00 00 call 37a3 + 1750: 89 04 24 mov %eax,(%esp) + 1753: e8 33 20 00 00 call 378b close(open(file, 0)); - 17a6: 83 c4 08 add $0x8,%esp - 17a9: 6a 00 push $0x0 - 17ab: 57 push %edi - 17ac: e8 ad 20 00 00 call 385e - 17b1: 89 04 24 mov %eax,(%esp) - 17b4: e8 8d 20 00 00 call 3846 + 1758: 83 c4 08 add $0x8,%esp + 175b: 6a 00 push $0x0 + 175d: 57 push %edi + 175e: e8 40 20 00 00 call 37a3 + 1763: 89 04 24 mov %eax,(%esp) + 1766: e8 20 20 00 00 call 378b close(open(file, 0)); - 17b9: 83 c4 08 add $0x8,%esp - 17bc: 6a 00 push $0x0 - 17be: 57 push %edi - 17bf: e8 9a 20 00 00 call 385e - 17c4: 89 04 24 mov %eax,(%esp) - 17c7: e8 7a 20 00 00 call 3846 + 176b: 83 c4 08 add $0x8,%esp + 176e: 6a 00 push $0x0 + 1770: 57 push %edi + 1771: e8 2d 20 00 00 call 37a3 + 1776: 89 04 24 mov %eax,(%esp) + 1779: e8 0d 20 00 00 call 378b close(open(file, 0)); - 17cc: 83 c4 08 add $0x8,%esp - 17cf: 6a 00 push $0x0 - 17d1: 57 push %edi - 17d2: e8 87 20 00 00 call 385e - 17d7: 89 04 24 mov %eax,(%esp) - 17da: e8 67 20 00 00 call 3846 - 17df: 83 c4 10 add $0x10,%esp + 177e: 83 c4 08 add $0x8,%esp + 1781: 6a 00 push $0x0 + 1783: 57 push %edi + 1784: e8 1a 20 00 00 call 37a3 + 1789: 89 04 24 mov %eax,(%esp) + 178c: e8 fa 1f 00 00 call 378b + 1791: 83 c4 10 add $0x10,%esp unlink(file); unlink(file); unlink(file); unlink(file); } if(pid == 0) - 17e2: 85 f6 test %esi,%esi - 17e4: 74 74 je 185a + 1794: 85 f6 test %esi,%esi + 1796: 74 74 je 180c exit(); else wait(); - 17e6: e8 3b 20 00 00 call 3826 + 1798: e8 ce 1f 00 00 call 376b for(i = 0; i < 40; i++){ - 17eb: 83 c3 01 add $0x1,%ebx - 17ee: 83 fb 28 cmp $0x28,%ebx - 17f1: 74 6c je 185f + 179d: 83 c3 01 add $0x1,%ebx + 17a0: 83 fb 28 cmp $0x28,%ebx + 17a3: 74 6c je 1811 file[1] = '0' + i; - 17f3: 8d 43 30 lea 0x30(%ebx),%eax - 17f6: 88 45 e6 mov %al,-0x1a(%ebp) + 17a5: 8d 43 30 lea 0x30(%ebx),%eax + 17a8: 88 45 e6 mov %al,-0x1a(%ebp) pid = fork(); - 17f9: e8 18 20 00 00 call 3816 - 17fe: 89 c6 mov %eax,%esi + 17ab: e8 ab 1f 00 00 call 375b + 17b0: 89 c6 mov %eax,%esi if(pid < 0){ - 1800: 85 c0 test %eax,%eax - 1802: 0f 88 77 ff ff ff js 177f + 17b2: 85 c0 test %eax,%eax + 17b4: 0f 88 77 ff ff ff js 1731 if(((i % 3) == 0 && pid == 0) || - 1808: b8 56 55 55 55 mov $0x55555556,%eax - 180d: f7 eb imul %ebx - 180f: 89 d8 mov %ebx,%eax - 1811: c1 f8 1f sar $0x1f,%eax - 1814: 29 c2 sub %eax,%edx - 1816: 8d 04 52 lea (%edx,%edx,2),%eax - 1819: 89 da mov %ebx,%edx - 181b: 29 c2 sub %eax,%edx - 181d: 89 d0 mov %edx,%eax - 181f: 09 f0 or %esi,%eax - 1821: 0f 84 6c ff ff ff je 1793 + 17ba: b8 56 55 55 55 mov $0x55555556,%eax + 17bf: f7 eb imul %ebx + 17c1: 89 d8 mov %ebx,%eax + 17c3: c1 f8 1f sar $0x1f,%eax + 17c6: 29 c2 sub %eax,%edx + 17c8: 8d 04 52 lea (%edx,%edx,2),%eax + 17cb: 89 da mov %ebx,%edx + 17cd: 29 c2 sub %eax,%edx + 17cf: 89 d0 mov %edx,%eax + 17d1: 09 f0 or %esi,%eax + 17d3: 0f 84 6c ff ff ff je 1745 ((i % 3) == 1 && pid != 0)){ - 1827: 85 f6 test %esi,%esi - 1829: 74 09 je 1834 - 182b: 83 fa 01 cmp $0x1,%edx - 182e: 0f 84 5f ff ff ff je 1793 + 17d9: 85 f6 test %esi,%esi + 17db: 74 09 je 17e6 + 17dd: 83 fa 01 cmp $0x1,%edx + 17e0: 0f 84 5f ff ff ff je 1745 unlink(file); - 1834: 83 ec 0c sub $0xc,%esp - 1837: 57 push %edi - 1838: e8 31 20 00 00 call 386e + 17e6: 83 ec 0c sub $0xc,%esp + 17e9: 57 push %edi + 17ea: e8 c4 1f 00 00 call 37b3 unlink(file); - 183d: 89 3c 24 mov %edi,(%esp) - 1840: e8 29 20 00 00 call 386e + 17ef: 89 3c 24 mov %edi,(%esp) + 17f2: e8 bc 1f 00 00 call 37b3 unlink(file); - 1845: 89 3c 24 mov %edi,(%esp) - 1848: e8 21 20 00 00 call 386e + 17f7: 89 3c 24 mov %edi,(%esp) + 17fa: e8 b4 1f 00 00 call 37b3 unlink(file); - 184d: 89 3c 24 mov %edi,(%esp) - 1850: e8 19 20 00 00 call 386e - 1855: 83 c4 10 add $0x10,%esp - 1858: eb 88 jmp 17e2 + 17ff: 89 3c 24 mov %edi,(%esp) + 1802: e8 ac 1f 00 00 call 37b3 + 1807: 83 c4 10 add $0x10,%esp + 180a: eb 88 jmp 1794 exit(); - 185a: e8 bf 1f 00 00 call 381e + 180c: e8 52 1f 00 00 call 3763 } printf(1, "concreate ok\n"); - 185f: 83 ec 08 sub $0x8,%esp - 1862: 68 3a 43 00 00 push $0x433a - 1867: 6a 01 push $0x1 - 1869: e8 f4 20 00 00 call 3962 + 1811: 83 ec 08 sub $0x8,%esp + 1814: 68 62 42 00 00 push $0x4262 + 1819: 6a 01 push $0x1 + 181b: e8 8b 20 00 00 call 38ab } - 186e: 8d 65 f4 lea -0xc(%ebp),%esp - 1871: 5b pop %ebx - 1872: 5e pop %esi - 1873: 5f pop %edi - 1874: 5d pop %ebp - 1875: c3 ret + 1820: 8d 65 f4 lea -0xc(%ebp),%esp + 1823: 5b pop %ebx + 1824: 5e pop %esi + 1825: 5f pop %edi + 1826: 5d pop %ebp + 1827: c3 ret close(fd); - 1876: 83 ec 0c sub $0xc,%esp - 1879: 50 push %eax - 187a: e8 c7 1f 00 00 call 3846 - 187f: 83 c4 10 add $0x10,%esp - 1882: e9 22 fe ff ff jmp 16a9 - 1887: 83 ec 0c sub $0xc,%esp - 188a: 50 push %eax - 188b: e8 b6 1f 00 00 call 3846 - 1890: 83 c4 10 add $0x10,%esp + 1828: 83 ec 0c sub $0xc,%esp + 182b: 50 push %eax + 182c: e8 5a 1f 00 00 call 378b + 1831: 83 c4 10 add $0x10,%esp + 1834: e9 22 fe ff ff jmp 165b + 1839: 83 ec 0c sub $0xc,%esp + 183c: 50 push %eax + 183d: e8 49 1f 00 00 call 378b + 1842: 83 c4 10 add $0x10,%esp wait(); - 1893: e8 8e 1f 00 00 call 3826 + 1845: e8 21 1f 00 00 call 376b for(i = 0; i < 40; i++){ - 1898: 83 c3 01 add $0x1,%ebx - 189b: 83 fb 28 cmp $0x28,%ebx - 189e: 0f 84 0a fe ff ff je 16ae + 184a: 83 c3 01 add $0x1,%ebx + 184d: 83 fb 28 cmp $0x28,%ebx + 1850: 0f 84 0a fe ff ff je 1660 file[1] = '0' + i; - 18a4: 8d 43 30 lea 0x30(%ebx),%eax - 18a7: 88 45 e6 mov %al,-0x1a(%ebp) + 1856: 8d 43 30 lea 0x30(%ebx),%eax + 1859: 88 45 e6 mov %al,-0x1a(%ebp) unlink(file); - 18aa: 83 ec 0c sub $0xc,%esp - 18ad: 56 push %esi - 18ae: e8 bb 1f 00 00 call 386e + 185c: 83 ec 0c sub $0xc,%esp + 185f: 56 push %esi + 1860: e8 4e 1f 00 00 call 37b3 pid = fork(); - 18b3: e8 5e 1f 00 00 call 3816 + 1865: e8 f1 1e 00 00 call 375b if(pid && (i % 3) == 1){ - 18b8: 83 c4 10 add $0x10,%esp - 18bb: 85 c0 test %eax,%eax - 18bd: 0f 84 82 fd ff ff je 1645 - 18c3: 89 d8 mov %ebx,%eax - 18c5: f7 ef imul %edi - 18c7: 89 d8 mov %ebx,%eax - 18c9: c1 f8 1f sar $0x1f,%eax - 18cc: 29 c2 sub %eax,%edx - 18ce: 8d 04 52 lea (%edx,%edx,2),%eax - 18d1: 89 d9 mov %ebx,%ecx - 18d3: 29 c1 sub %eax,%ecx - 18d5: 83 f9 01 cmp $0x1,%ecx - 18d8: 0f 84 51 fd ff ff je 162f + 186a: 83 c4 10 add $0x10,%esp + 186d: 85 c0 test %eax,%eax + 186f: 0f 84 82 fd ff ff je 15f7 + 1875: 89 d8 mov %ebx,%eax + 1877: f7 ef imul %edi + 1879: 89 d8 mov %ebx,%eax + 187b: c1 f8 1f sar $0x1f,%eax + 187e: 29 c2 sub %eax,%edx + 1880: 8d 14 52 lea (%edx,%edx,2),%edx + 1883: 89 d8 mov %ebx,%eax + 1885: 29 d0 sub %edx,%eax + 1887: 83 f8 01 cmp $0x1,%eax + 188a: 0f 84 51 fd ff ff je 15e1 fd = open(file, O_CREATE | O_RDWR); - 18de: 83 ec 08 sub $0x8,%esp - 18e1: 68 02 02 00 00 push $0x202 - 18e6: 56 push %esi - 18e7: e8 72 1f 00 00 call 385e + 1890: 83 ec 08 sub $0x8,%esp + 1893: 68 02 02 00 00 push $0x202 + 1898: 56 push %esi + 1899: e8 05 1f 00 00 call 37a3 if(fd < 0){ - 18ec: 83 c4 10 add $0x10,%esp - 18ef: 85 c0 test %eax,%eax - 18f1: 79 94 jns 1887 - 18f3: e9 85 fd ff ff jmp 167d + 189e: 83 c4 10 add $0x10,%esp + 18a1: 85 c0 test %eax,%eax + 18a3: 79 94 jns 1839 + 18a5: e9 85 fd ff ff jmp 162f -000018f8 : +000018aa : // another concurrent link/unlink/create test, // to look for deadlocks. void linkunlink() { - 18f8: f3 0f 1e fb endbr32 - 18fc: 55 push %ebp - 18fd: 89 e5 mov %esp,%ebp - 18ff: 57 push %edi - 1900: 56 push %esi - 1901: 53 push %ebx - 1902: 83 ec 24 sub $0x24,%esp + 18aa: 55 push %ebp + 18ab: 89 e5 mov %esp,%ebp + 18ad: 57 push %edi + 18ae: 56 push %esi + 18af: 53 push %ebx + 18b0: 83 ec 24 sub $0x24,%esp int pid, i; printf(1, "linkunlink test\n"); - 1905: 68 48 43 00 00 push $0x4348 - 190a: 6a 01 push $0x1 - 190c: e8 51 20 00 00 call 3962 + 18b3: 68 70 42 00 00 push $0x4270 + 18b8: 6a 01 push $0x1 + 18ba: e8 ec 1f 00 00 call 38ab unlink("x"); - 1911: c7 04 24 d5 45 00 00 movl $0x45d5,(%esp) - 1918: e8 51 1f 00 00 call 386e + 18bf: c7 04 24 fd 44 00 00 movl $0x44fd,(%esp) + 18c6: e8 e8 1e 00 00 call 37b3 pid = fork(); - 191d: e8 f4 1e 00 00 call 3816 - 1922: 89 45 e4 mov %eax,-0x1c(%ebp) + 18cb: e8 8b 1e 00 00 call 375b + 18d0: 89 45 e4 mov %eax,-0x1c(%ebp) if(pid < 0){ - 1925: 83 c4 10 add $0x10,%esp - 1928: 85 c0 test %eax,%eax - 192a: 78 18 js 1944 + 18d3: 83 c4 10 add $0x10,%esp + 18d6: 85 c0 test %eax,%eax + 18d8: 78 18 js 18f2 printf(1, "fork failed\n"); exit(); } unsigned int x = (pid ? 1 : 97); - 192c: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp) - 1930: 19 db sbb %ebx,%ebx - 1932: 83 e3 60 and $0x60,%ebx - 1935: 83 c3 01 add $0x1,%ebx - 1938: be 64 00 00 00 mov $0x64,%esi + 18da: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp) + 18de: 19 db sbb %ebx,%ebx + 18e0: 83 e3 60 and $0x60,%ebx + 18e3: 83 c3 01 add $0x1,%ebx + 18e6: be 64 00 00 00 mov $0x64,%esi for(i = 0; i < 100; i++){ x = x * 1103515245 + 12345; if((x % 3) == 0){ - 193d: bf ab aa aa aa mov $0xaaaaaaab,%edi - 1942: eb 48 jmp 198c + 18eb: bf ab aa aa aa mov $0xaaaaaaab,%edi + 18f0: eb 36 jmp 1928 printf(1, "fork failed\n"); - 1944: 83 ec 08 sub $0x8,%esp - 1947: 68 bd 4b 00 00 push $0x4bbd - 194c: 6a 01 push $0x1 - 194e: e8 0f 20 00 00 call 3962 + 18f2: 83 ec 08 sub $0x8,%esp + 18f5: 68 e5 4a 00 00 push $0x4ae5 + 18fa: 6a 01 push $0x1 + 18fc: e8 aa 1f 00 00 call 38ab exit(); - 1953: e8 c6 1e 00 00 call 381e + 1901: e8 5d 1e 00 00 call 3763 close(open("x", O_RDWR | O_CREATE)); - 1958: 83 ec 08 sub $0x8,%esp - 195b: 68 02 02 00 00 push $0x202 - 1960: 68 d5 45 00 00 push $0x45d5 - 1965: e8 f4 1e 00 00 call 385e - 196a: 89 04 24 mov %eax,(%esp) - 196d: e8 d4 1e 00 00 call 3846 - 1972: 83 c4 10 add $0x10,%esp - 1975: eb 10 jmp 1987 - } else if((x % 3) == 1){ - link("cat", "x"); - } else { - unlink("x"); - 1977: 83 ec 0c sub $0xc,%esp - 197a: 68 d5 45 00 00 push $0x45d5 - 197f: e8 ea 1e 00 00 call 386e - 1984: 83 c4 10 add $0x10,%esp + 1906: 83 ec 08 sub $0x8,%esp + 1909: 68 02 02 00 00 push $0x202 + 190e: 68 fd 44 00 00 push $0x44fd + 1913: e8 8b 1e 00 00 call 37a3 + 1918: 89 04 24 mov %eax,(%esp) + 191b: e8 6b 1e 00 00 call 378b + 1920: 83 c4 10 add $0x10,%esp for(i = 0; i < 100; i++){ - 1987: 83 ee 01 sub $0x1,%esi - 198a: 74 3b je 19c7 + 1923: 83 ee 01 sub $0x1,%esi + 1926: 74 4d je 1975 x = x * 1103515245 + 12345; - 198c: 69 db 6d 4e c6 41 imul $0x41c64e6d,%ebx,%ebx - 1992: 81 c3 39 30 00 00 add $0x3039,%ebx + 1928: 69 db 6d 4e c6 41 imul $0x41c64e6d,%ebx,%ebx + 192e: 81 c3 39 30 00 00 add $0x3039,%ebx if((x % 3) == 0){ - 1998: 89 d8 mov %ebx,%eax - 199a: f7 e7 mul %edi - 199c: 89 d0 mov %edx,%eax - 199e: d1 e8 shr %eax - 19a0: 83 e2 fe and $0xfffffffe,%edx - 19a3: 01 c2 add %eax,%edx - 19a5: 89 d8 mov %ebx,%eax - 19a7: 29 d0 sub %edx,%eax - 19a9: 74 ad je 1958 + 1934: 89 d8 mov %ebx,%eax + 1936: f7 e7 mul %edi + 1938: 89 d0 mov %edx,%eax + 193a: d1 e8 shr %eax + 193c: 83 e2 fe and $0xfffffffe,%edx + 193f: 01 c2 add %eax,%edx + 1941: 89 d8 mov %ebx,%eax + 1943: 29 d0 sub %edx,%eax + 1945: 74 bf je 1906 } else if((x % 3) == 1){ - 19ab: 83 f8 01 cmp $0x1,%eax - 19ae: 75 c7 jne 1977 + 1947: 83 f8 01 cmp $0x1,%eax + 194a: 74 12 je 195e + link("cat", "x"); + } else { + unlink("x"); + 194c: 83 ec 0c sub $0xc,%esp + 194f: 68 fd 44 00 00 push $0x44fd + 1954: e8 5a 1e 00 00 call 37b3 + 1959: 83 c4 10 add $0x10,%esp + 195c: eb c5 jmp 1923 link("cat", "x"); - 19b0: 83 ec 08 sub $0x8,%esp - 19b3: 68 d5 45 00 00 push $0x45d5 - 19b8: 68 59 43 00 00 push $0x4359 - 19bd: e8 bc 1e 00 00 call 387e - 19c2: 83 c4 10 add $0x10,%esp - 19c5: eb c0 jmp 1987 + 195e: 83 ec 08 sub $0x8,%esp + 1961: 68 fd 44 00 00 push $0x44fd + 1966: 68 81 42 00 00 push $0x4281 + 196b: e8 53 1e 00 00 call 37c3 + 1970: 83 c4 10 add $0x10,%esp + 1973: eb ae jmp 1923 } } if(pid) - 19c7: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) - 19cb: 74 1c je 19e9 + 1975: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) + 1979: 74 1c je 1997 wait(); - 19cd: e8 54 1e 00 00 call 3826 + 197b: e8 eb 1d 00 00 call 376b else exit(); printf(1, "linkunlink ok\n"); - 19d2: 83 ec 08 sub $0x8,%esp - 19d5: 68 5d 43 00 00 push $0x435d - 19da: 6a 01 push $0x1 - 19dc: e8 81 1f 00 00 call 3962 + 1980: 83 ec 08 sub $0x8,%esp + 1983: 68 85 42 00 00 push $0x4285 + 1988: 6a 01 push $0x1 + 198a: e8 1c 1f 00 00 call 38ab } - 19e1: 8d 65 f4 lea -0xc(%ebp),%esp - 19e4: 5b pop %ebx - 19e5: 5e pop %esi - 19e6: 5f pop %edi - 19e7: 5d pop %ebp - 19e8: c3 ret + 198f: 8d 65 f4 lea -0xc(%ebp),%esp + 1992: 5b pop %ebx + 1993: 5e pop %esi + 1994: 5f pop %edi + 1995: 5d pop %ebp + 1996: c3 ret exit(); - 19e9: e8 30 1e 00 00 call 381e + 1997: e8 c7 1d 00 00 call 3763 -000019ee : +0000199c : // directory that uses indirect blocks void bigdir(void) { - 19ee: f3 0f 1e fb endbr32 - 19f2: 55 push %ebp - 19f3: 89 e5 mov %esp,%ebp - 19f5: 57 push %edi - 19f6: 56 push %esi - 19f7: 53 push %ebx - 19f8: 83 ec 24 sub $0x24,%esp + 199c: 55 push %ebp + 199d: 89 e5 mov %esp,%ebp + 199f: 57 push %edi + 19a0: 56 push %esi + 19a1: 53 push %ebx + 19a2: 83 ec 24 sub $0x24,%esp int i, fd; char name[10]; printf(1, "bigdir test\n"); - 19fb: 68 6c 43 00 00 push $0x436c - 1a00: 6a 01 push $0x1 - 1a02: e8 5b 1f 00 00 call 3962 + 19a5: 68 94 42 00 00 push $0x4294 + 19aa: 6a 01 push $0x1 + 19ac: e8 fa 1e 00 00 call 38ab unlink("bd"); - 1a07: c7 04 24 79 43 00 00 movl $0x4379,(%esp) - 1a0e: e8 5b 1e 00 00 call 386e + 19b1: c7 04 24 a1 42 00 00 movl $0x42a1,(%esp) + 19b8: e8 f6 1d 00 00 call 37b3 fd = open("bd", O_CREATE); - 1a13: 83 c4 08 add $0x8,%esp - 1a16: 68 00 02 00 00 push $0x200 - 1a1b: 68 79 43 00 00 push $0x4379 - 1a20: e8 39 1e 00 00 call 385e + 19bd: 83 c4 08 add $0x8,%esp + 19c0: 68 00 02 00 00 push $0x200 + 19c5: 68 a1 42 00 00 push $0x42a1 + 19ca: e8 d4 1d 00 00 call 37a3 if(fd < 0){ - 1a25: 83 c4 10 add $0x10,%esp - 1a28: 85 c0 test %eax,%eax - 1a2a: 0f 88 e0 00 00 00 js 1b10 + 19cf: 83 c4 10 add $0x10,%esp + 19d2: 85 c0 test %eax,%eax + 19d4: 0f 88 e0 00 00 00 js 1aba printf(1, "bigdir create failed\n"); exit(); } close(fd); - 1a30: 83 ec 0c sub $0xc,%esp - 1a33: 50 push %eax - 1a34: e8 0d 1e 00 00 call 3846 - 1a39: 83 c4 10 add $0x10,%esp + 19da: 83 ec 0c sub $0xc,%esp + 19dd: 50 push %eax + 19de: e8 a8 1d 00 00 call 378b + 19e3: 83 c4 10 add $0x10,%esp for(i = 0; i < 500; i++){ - 1a3c: be 00 00 00 00 mov $0x0,%esi + 19e6: be 00 00 00 00 mov $0x0,%esi name[0] = 'x'; name[1] = '0' + (i / 64); name[2] = '0' + (i % 64); name[3] = '\0'; if(link("bd", name) != 0){ - 1a41: 8d 7d de lea -0x22(%ebp),%edi + 19eb: 8d 7d de lea -0x22(%ebp),%edi name[0] = 'x'; - 1a44: c6 45 de 78 movb $0x78,-0x22(%ebp) + 19ee: c6 45 de 78 movb $0x78,-0x22(%ebp) name[1] = '0' + (i / 64); - 1a48: 8d 46 3f lea 0x3f(%esi),%eax - 1a4b: 85 f6 test %esi,%esi - 1a4d: 0f 49 c6 cmovns %esi,%eax - 1a50: c1 f8 06 sar $0x6,%eax - 1a53: 83 c0 30 add $0x30,%eax - 1a56: 88 45 df mov %al,-0x21(%ebp) + 19f2: 8d 46 3f lea 0x3f(%esi),%eax + 19f5: 85 f6 test %esi,%esi + 19f7: 0f 49 c6 cmovns %esi,%eax + 19fa: c1 f8 06 sar $0x6,%eax + 19fd: 83 c0 30 add $0x30,%eax + 1a00: 88 45 df mov %al,-0x21(%ebp) name[2] = '0' + (i % 64); - 1a59: 89 f2 mov %esi,%edx - 1a5b: c1 fa 1f sar $0x1f,%edx - 1a5e: c1 ea 1a shr $0x1a,%edx - 1a61: 8d 04 16 lea (%esi,%edx,1),%eax - 1a64: 83 e0 3f and $0x3f,%eax - 1a67: 29 d0 sub %edx,%eax - 1a69: 83 c0 30 add $0x30,%eax - 1a6c: 88 45 e0 mov %al,-0x20(%ebp) + 1a03: 89 f2 mov %esi,%edx + 1a05: c1 fa 1f sar $0x1f,%edx + 1a08: c1 ea 1a shr $0x1a,%edx + 1a0b: 8d 04 16 lea (%esi,%edx,1),%eax + 1a0e: 83 e0 3f and $0x3f,%eax + 1a11: 29 d0 sub %edx,%eax + 1a13: 83 c0 30 add $0x30,%eax + 1a16: 88 45 e0 mov %al,-0x20(%ebp) name[3] = '\0'; - 1a6f: c6 45 e1 00 movb $0x0,-0x1f(%ebp) + 1a19: c6 45 e1 00 movb $0x0,-0x1f(%ebp) if(link("bd", name) != 0){ - 1a73: 83 ec 08 sub $0x8,%esp - 1a76: 57 push %edi - 1a77: 68 79 43 00 00 push $0x4379 - 1a7c: e8 fd 1d 00 00 call 387e - 1a81: 89 c3 mov %eax,%ebx - 1a83: 83 c4 10 add $0x10,%esp - 1a86: 85 c0 test %eax,%eax - 1a88: 0f 85 96 00 00 00 jne 1b24 + 1a1d: 83 ec 08 sub $0x8,%esp + 1a20: 57 push %edi + 1a21: 68 a1 42 00 00 push $0x42a1 + 1a26: e8 98 1d 00 00 call 37c3 + 1a2b: 89 c3 mov %eax,%ebx + 1a2d: 83 c4 10 add $0x10,%esp + 1a30: 85 c0 test %eax,%eax + 1a32: 0f 85 96 00 00 00 jne 1ace for(i = 0; i < 500; i++){ - 1a8e: 83 c6 01 add $0x1,%esi - 1a91: 81 fe f4 01 00 00 cmp $0x1f4,%esi - 1a97: 75 ab jne 1a44 + 1a38: 83 c6 01 add $0x1,%esi + 1a3b: 81 fe f4 01 00 00 cmp $0x1f4,%esi + 1a41: 75 ab jne 19ee printf(1, "bigdir link failed\n"); exit(); } } unlink("bd"); - 1a99: 83 ec 0c sub $0xc,%esp - 1a9c: 68 79 43 00 00 push $0x4379 - 1aa1: e8 c8 1d 00 00 call 386e - 1aa6: 83 c4 10 add $0x10,%esp + 1a43: 83 ec 0c sub $0xc,%esp + 1a46: 68 a1 42 00 00 push $0x42a1 + 1a4b: e8 63 1d 00 00 call 37b3 + 1a50: 83 c4 10 add $0x10,%esp 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){ - 1aa9: 8d 75 de lea -0x22(%ebp),%esi + 1a53: 8d 75 de lea -0x22(%ebp),%esi name[0] = 'x'; - 1aac: c6 45 de 78 movb $0x78,-0x22(%ebp) + 1a56: c6 45 de 78 movb $0x78,-0x22(%ebp) name[1] = '0' + (i / 64); - 1ab0: 8d 43 3f lea 0x3f(%ebx),%eax - 1ab3: 85 db test %ebx,%ebx - 1ab5: 0f 49 c3 cmovns %ebx,%eax - 1ab8: c1 f8 06 sar $0x6,%eax - 1abb: 83 c0 30 add $0x30,%eax - 1abe: 88 45 df mov %al,-0x21(%ebp) + 1a5a: 8d 43 3f lea 0x3f(%ebx),%eax + 1a5d: 85 db test %ebx,%ebx + 1a5f: 0f 49 c3 cmovns %ebx,%eax + 1a62: c1 f8 06 sar $0x6,%eax + 1a65: 83 c0 30 add $0x30,%eax + 1a68: 88 45 df mov %al,-0x21(%ebp) name[2] = '0' + (i % 64); - 1ac1: 89 da mov %ebx,%edx - 1ac3: c1 fa 1f sar $0x1f,%edx - 1ac6: c1 ea 1a shr $0x1a,%edx - 1ac9: 8d 04 13 lea (%ebx,%edx,1),%eax - 1acc: 83 e0 3f and $0x3f,%eax - 1acf: 29 d0 sub %edx,%eax - 1ad1: 83 c0 30 add $0x30,%eax - 1ad4: 88 45 e0 mov %al,-0x20(%ebp) + 1a6b: 89 da mov %ebx,%edx + 1a6d: c1 fa 1f sar $0x1f,%edx + 1a70: c1 ea 1a shr $0x1a,%edx + 1a73: 8d 04 13 lea (%ebx,%edx,1),%eax + 1a76: 83 e0 3f and $0x3f,%eax + 1a79: 29 d0 sub %edx,%eax + 1a7b: 83 c0 30 add $0x30,%eax + 1a7e: 88 45 e0 mov %al,-0x20(%ebp) name[3] = '\0'; - 1ad7: c6 45 e1 00 movb $0x0,-0x1f(%ebp) + 1a81: c6 45 e1 00 movb $0x0,-0x1f(%ebp) if(unlink(name) != 0){ - 1adb: 83 ec 0c sub $0xc,%esp - 1ade: 56 push %esi - 1adf: e8 8a 1d 00 00 call 386e - 1ae4: 83 c4 10 add $0x10,%esp - 1ae7: 85 c0 test %eax,%eax - 1ae9: 75 4d jne 1b38 + 1a85: 83 ec 0c sub $0xc,%esp + 1a88: 56 push %esi + 1a89: e8 25 1d 00 00 call 37b3 + 1a8e: 83 c4 10 add $0x10,%esp + 1a91: 85 c0 test %eax,%eax + 1a93: 75 4d jne 1ae2 for(i = 0; i < 500; i++){ - 1aeb: 83 c3 01 add $0x1,%ebx - 1aee: 81 fb f4 01 00 00 cmp $0x1f4,%ebx - 1af4: 75 b6 jne 1aac + 1a95: 83 c3 01 add $0x1,%ebx + 1a98: 81 fb f4 01 00 00 cmp $0x1f4,%ebx + 1a9e: 75 b6 jne 1a56 printf(1, "bigdir unlink failed"); exit(); } } printf(1, "bigdir ok\n"); - 1af6: 83 ec 08 sub $0x8,%esp - 1af9: 68 bb 43 00 00 push $0x43bb - 1afe: 6a 01 push $0x1 - 1b00: e8 5d 1e 00 00 call 3962 + 1aa0: 83 ec 08 sub $0x8,%esp + 1aa3: 68 e3 42 00 00 push $0x42e3 + 1aa8: 6a 01 push $0x1 + 1aaa: e8 fc 1d 00 00 call 38ab } - 1b05: 83 c4 10 add $0x10,%esp - 1b08: 8d 65 f4 lea -0xc(%ebp),%esp - 1b0b: 5b pop %ebx - 1b0c: 5e pop %esi - 1b0d: 5f pop %edi - 1b0e: 5d pop %ebp - 1b0f: c3 ret + 1aaf: 83 c4 10 add $0x10,%esp + 1ab2: 8d 65 f4 lea -0xc(%ebp),%esp + 1ab5: 5b pop %ebx + 1ab6: 5e pop %esi + 1ab7: 5f pop %edi + 1ab8: 5d pop %ebp + 1ab9: c3 ret printf(1, "bigdir create failed\n"); - 1b10: 83 ec 08 sub $0x8,%esp - 1b13: 68 7c 43 00 00 push $0x437c - 1b18: 6a 01 push $0x1 - 1b1a: e8 43 1e 00 00 call 3962 + 1aba: 83 ec 08 sub $0x8,%esp + 1abd: 68 a4 42 00 00 push $0x42a4 + 1ac2: 6a 01 push $0x1 + 1ac4: e8 e2 1d 00 00 call 38ab exit(); - 1b1f: e8 fa 1c 00 00 call 381e + 1ac9: e8 95 1c 00 00 call 3763 printf(1, "bigdir link failed\n"); - 1b24: 83 ec 08 sub $0x8,%esp - 1b27: 68 92 43 00 00 push $0x4392 - 1b2c: 6a 01 push $0x1 - 1b2e: e8 2f 1e 00 00 call 3962 + 1ace: 83 ec 08 sub $0x8,%esp + 1ad1: 68 ba 42 00 00 push $0x42ba + 1ad6: 6a 01 push $0x1 + 1ad8: e8 ce 1d 00 00 call 38ab exit(); - 1b33: e8 e6 1c 00 00 call 381e + 1add: e8 81 1c 00 00 call 3763 printf(1, "bigdir unlink failed"); - 1b38: 83 ec 08 sub $0x8,%esp - 1b3b: 68 a6 43 00 00 push $0x43a6 - 1b40: 6a 01 push $0x1 - 1b42: e8 1b 1e 00 00 call 3962 + 1ae2: 83 ec 08 sub $0x8,%esp + 1ae5: 68 ce 42 00 00 push $0x42ce + 1aea: 6a 01 push $0x1 + 1aec: e8 ba 1d 00 00 call 38ab exit(); - 1b47: e8 d2 1c 00 00 call 381e + 1af1: e8 6d 1c 00 00 call 3763 -00001b4c : +00001af6 : void subdir(void) { - 1b4c: f3 0f 1e fb endbr32 - 1b50: 55 push %ebp - 1b51: 89 e5 mov %esp,%ebp - 1b53: 53 push %ebx - 1b54: 83 ec 0c sub $0xc,%esp + 1af6: 55 push %ebp + 1af7: 89 e5 mov %esp,%ebp + 1af9: 53 push %ebx + 1afa: 83 ec 0c sub $0xc,%esp int fd, cc; printf(1, "subdir test\n"); - 1b57: 68 c6 43 00 00 push $0x43c6 - 1b5c: 6a 01 push $0x1 - 1b5e: e8 ff 1d 00 00 call 3962 + 1afd: 68 ee 42 00 00 push $0x42ee + 1b02: 6a 01 push $0x1 + 1b04: e8 a2 1d 00 00 call 38ab unlink("ff"); - 1b63: c7 04 24 4f 44 00 00 movl $0x444f,(%esp) - 1b6a: e8 ff 1c 00 00 call 386e + 1b09: c7 04 24 77 43 00 00 movl $0x4377,(%esp) + 1b10: e8 9e 1c 00 00 call 37b3 if(mkdir("dd") != 0){ - 1b6f: c7 04 24 ec 44 00 00 movl $0x44ec,(%esp) - 1b76: e8 0b 1d 00 00 call 3886 - 1b7b: 83 c4 10 add $0x10,%esp - 1b7e: 85 c0 test %eax,%eax - 1b80: 0f 85 14 04 00 00 jne 1f9a + 1b15: c7 04 24 14 44 00 00 movl $0x4414,(%esp) + 1b1c: e8 aa 1c 00 00 call 37cb + 1b21: 83 c4 10 add $0x10,%esp + 1b24: 85 c0 test %eax,%eax + 1b26: 0f 85 14 04 00 00 jne 1f40 printf(1, "subdir mkdir dd failed\n"); exit(); } fd = open("dd/ff", O_CREATE | O_RDWR); - 1b86: 83 ec 08 sub $0x8,%esp - 1b89: 68 02 02 00 00 push $0x202 - 1b8e: 68 25 44 00 00 push $0x4425 - 1b93: e8 c6 1c 00 00 call 385e - 1b98: 89 c3 mov %eax,%ebx + 1b2c: 83 ec 08 sub $0x8,%esp + 1b2f: 68 02 02 00 00 push $0x202 + 1b34: 68 4d 43 00 00 push $0x434d + 1b39: e8 65 1c 00 00 call 37a3 + 1b3e: 89 c3 mov %eax,%ebx if(fd < 0){ - 1b9a: 83 c4 10 add $0x10,%esp - 1b9d: 85 c0 test %eax,%eax - 1b9f: 0f 88 09 04 00 00 js 1fae + 1b40: 83 c4 10 add $0x10,%esp + 1b43: 85 c0 test %eax,%eax + 1b45: 0f 88 09 04 00 00 js 1f54 printf(1, "create dd/ff failed\n"); exit(); } write(fd, "ff", 2); - 1ba5: 83 ec 04 sub $0x4,%esp - 1ba8: 6a 02 push $0x2 - 1baa: 68 4f 44 00 00 push $0x444f - 1baf: 50 push %eax - 1bb0: e8 89 1c 00 00 call 383e + 1b4b: 83 ec 04 sub $0x4,%esp + 1b4e: 6a 02 push $0x2 + 1b50: 68 77 43 00 00 push $0x4377 + 1b55: 50 push %eax + 1b56: e8 28 1c 00 00 call 3783 close(fd); - 1bb5: 89 1c 24 mov %ebx,(%esp) - 1bb8: e8 89 1c 00 00 call 3846 + 1b5b: 89 1c 24 mov %ebx,(%esp) + 1b5e: e8 28 1c 00 00 call 378b if(unlink("dd") >= 0){ - 1bbd: c7 04 24 ec 44 00 00 movl $0x44ec,(%esp) - 1bc4: e8 a5 1c 00 00 call 386e - 1bc9: 83 c4 10 add $0x10,%esp - 1bcc: 85 c0 test %eax,%eax - 1bce: 0f 89 ee 03 00 00 jns 1fc2 + 1b63: c7 04 24 14 44 00 00 movl $0x4414,(%esp) + 1b6a: e8 44 1c 00 00 call 37b3 + 1b6f: 83 c4 10 add $0x10,%esp + 1b72: 85 c0 test %eax,%eax + 1b74: 0f 89 ee 03 00 00 jns 1f68 printf(1, "unlink dd (non-empty dir) succeeded!\n"); exit(); } if(mkdir("/dd/dd") != 0){ - 1bd4: 83 ec 0c sub $0xc,%esp - 1bd7: 68 00 44 00 00 push $0x4400 - 1bdc: e8 a5 1c 00 00 call 3886 - 1be1: 83 c4 10 add $0x10,%esp - 1be4: 85 c0 test %eax,%eax - 1be6: 0f 85 ea 03 00 00 jne 1fd6 + 1b7a: 83 ec 0c sub $0xc,%esp + 1b7d: 68 28 43 00 00 push $0x4328 + 1b82: e8 44 1c 00 00 call 37cb + 1b87: 83 c4 10 add $0x10,%esp + 1b8a: 85 c0 test %eax,%eax + 1b8c: 0f 85 ea 03 00 00 jne 1f7c printf(1, "subdir mkdir dd/dd failed\n"); exit(); } fd = open("dd/dd/ff", O_CREATE | O_RDWR); - 1bec: 83 ec 08 sub $0x8,%esp - 1bef: 68 02 02 00 00 push $0x202 - 1bf4: 68 22 44 00 00 push $0x4422 - 1bf9: e8 60 1c 00 00 call 385e - 1bfe: 89 c3 mov %eax,%ebx + 1b92: 83 ec 08 sub $0x8,%esp + 1b95: 68 02 02 00 00 push $0x202 + 1b9a: 68 4a 43 00 00 push $0x434a + 1b9f: e8 ff 1b 00 00 call 37a3 + 1ba4: 89 c3 mov %eax,%ebx if(fd < 0){ - 1c00: 83 c4 10 add $0x10,%esp - 1c03: 85 c0 test %eax,%eax - 1c05: 0f 88 df 03 00 00 js 1fea + 1ba6: 83 c4 10 add $0x10,%esp + 1ba9: 85 c0 test %eax,%eax + 1bab: 0f 88 df 03 00 00 js 1f90 printf(1, "create dd/dd/ff failed\n"); exit(); } write(fd, "FF", 2); - 1c0b: 83 ec 04 sub $0x4,%esp - 1c0e: 6a 02 push $0x2 - 1c10: 68 43 44 00 00 push $0x4443 - 1c15: 50 push %eax - 1c16: e8 23 1c 00 00 call 383e + 1bb1: 83 ec 04 sub $0x4,%esp + 1bb4: 6a 02 push $0x2 + 1bb6: 68 6b 43 00 00 push $0x436b + 1bbb: 50 push %eax + 1bbc: e8 c2 1b 00 00 call 3783 close(fd); - 1c1b: 89 1c 24 mov %ebx,(%esp) - 1c1e: e8 23 1c 00 00 call 3846 + 1bc1: 89 1c 24 mov %ebx,(%esp) + 1bc4: e8 c2 1b 00 00 call 378b fd = open("dd/dd/../ff", 0); - 1c23: 83 c4 08 add $0x8,%esp - 1c26: 6a 00 push $0x0 - 1c28: 68 46 44 00 00 push $0x4446 - 1c2d: e8 2c 1c 00 00 call 385e - 1c32: 89 c3 mov %eax,%ebx + 1bc9: 83 c4 08 add $0x8,%esp + 1bcc: 6a 00 push $0x0 + 1bce: 68 6e 43 00 00 push $0x436e + 1bd3: e8 cb 1b 00 00 call 37a3 + 1bd8: 89 c3 mov %eax,%ebx if(fd < 0){ - 1c34: 83 c4 10 add $0x10,%esp - 1c37: 85 c0 test %eax,%eax - 1c39: 0f 88 bf 03 00 00 js 1ffe + 1bda: 83 c4 10 add $0x10,%esp + 1bdd: 85 c0 test %eax,%eax + 1bdf: 0f 88 bf 03 00 00 js 1fa4 printf(1, "open dd/dd/../ff failed\n"); exit(); } cc = read(fd, buf, sizeof(buf)); - 1c3f: 83 ec 04 sub $0x4,%esp - 1c42: 68 00 20 00 00 push $0x2000 - 1c47: 68 80 84 00 00 push $0x8480 - 1c4c: 50 push %eax - 1c4d: e8 e4 1b 00 00 call 3836 + 1be5: 83 ec 04 sub $0x4,%esp + 1be8: 68 00 20 00 00 push $0x2000 + 1bed: 68 60 83 00 00 push $0x8360 + 1bf2: 50 push %eax + 1bf3: e8 83 1b 00 00 call 377b if(cc != 2 || buf[0] != 'f'){ - 1c52: 83 c4 10 add $0x10,%esp - 1c55: 83 f8 02 cmp $0x2,%eax - 1c58: 0f 85 b4 03 00 00 jne 2012 - 1c5e: 80 3d 80 84 00 00 66 cmpb $0x66,0x8480 - 1c65: 0f 85 a7 03 00 00 jne 2012 + 1bf8: 83 c4 10 add $0x10,%esp + 1bfb: 83 f8 02 cmp $0x2,%eax + 1bfe: 0f 85 b4 03 00 00 jne 1fb8 + 1c04: 80 3d 60 83 00 00 66 cmpb $0x66,0x8360 + 1c0b: 0f 85 a7 03 00 00 jne 1fb8 printf(1, "dd/dd/../ff wrong content\n"); exit(); } close(fd); - 1c6b: 83 ec 0c sub $0xc,%esp - 1c6e: 53 push %ebx - 1c6f: e8 d2 1b 00 00 call 3846 + 1c11: 83 ec 0c sub $0xc,%esp + 1c14: 53 push %ebx + 1c15: e8 71 1b 00 00 call 378b if(link("dd/dd/ff", "dd/dd/ffff") != 0){ - 1c74: 83 c4 08 add $0x8,%esp - 1c77: 68 86 44 00 00 push $0x4486 - 1c7c: 68 22 44 00 00 push $0x4422 - 1c81: e8 f8 1b 00 00 call 387e - 1c86: 83 c4 10 add $0x10,%esp - 1c89: 85 c0 test %eax,%eax - 1c8b: 0f 85 95 03 00 00 jne 2026 + 1c1a: 83 c4 08 add $0x8,%esp + 1c1d: 68 ae 43 00 00 push $0x43ae + 1c22: 68 4a 43 00 00 push $0x434a + 1c27: e8 97 1b 00 00 call 37c3 + 1c2c: 83 c4 10 add $0x10,%esp + 1c2f: 85 c0 test %eax,%eax + 1c31: 0f 85 95 03 00 00 jne 1fcc printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); exit(); } if(unlink("dd/dd/ff") != 0){ - 1c91: 83 ec 0c sub $0xc,%esp - 1c94: 68 22 44 00 00 push $0x4422 - 1c99: e8 d0 1b 00 00 call 386e - 1c9e: 83 c4 10 add $0x10,%esp - 1ca1: 85 c0 test %eax,%eax - 1ca3: 0f 85 91 03 00 00 jne 203a + 1c37: 83 ec 0c sub $0xc,%esp + 1c3a: 68 4a 43 00 00 push $0x434a + 1c3f: e8 6f 1b 00 00 call 37b3 + 1c44: 83 c4 10 add $0x10,%esp + 1c47: 85 c0 test %eax,%eax + 1c49: 0f 85 91 03 00 00 jne 1fe0 printf(1, "unlink dd/dd/ff failed\n"); exit(); } if(open("dd/dd/ff", O_RDONLY) >= 0){ - 1ca9: 83 ec 08 sub $0x8,%esp - 1cac: 6a 00 push $0x0 - 1cae: 68 22 44 00 00 push $0x4422 - 1cb3: e8 a6 1b 00 00 call 385e - 1cb8: 83 c4 10 add $0x10,%esp - 1cbb: 85 c0 test %eax,%eax - 1cbd: 0f 89 8b 03 00 00 jns 204e + 1c4f: 83 ec 08 sub $0x8,%esp + 1c52: 6a 00 push $0x0 + 1c54: 68 4a 43 00 00 push $0x434a + 1c59: e8 45 1b 00 00 call 37a3 + 1c5e: 83 c4 10 add $0x10,%esp + 1c61: 85 c0 test %eax,%eax + 1c63: 0f 89 8b 03 00 00 jns 1ff4 printf(1, "open (unlinked) dd/dd/ff succeeded\n"); exit(); } if(chdir("dd") != 0){ - 1cc3: 83 ec 0c sub $0xc,%esp - 1cc6: 68 ec 44 00 00 push $0x44ec - 1ccb: e8 be 1b 00 00 call 388e - 1cd0: 83 c4 10 add $0x10,%esp - 1cd3: 85 c0 test %eax,%eax - 1cd5: 0f 85 87 03 00 00 jne 2062 + 1c69: 83 ec 0c sub $0xc,%esp + 1c6c: 68 14 44 00 00 push $0x4414 + 1c71: e8 5d 1b 00 00 call 37d3 + 1c76: 83 c4 10 add $0x10,%esp + 1c79: 85 c0 test %eax,%eax + 1c7b: 0f 85 87 03 00 00 jne 2008 printf(1, "chdir dd failed\n"); exit(); } if(chdir("dd/../../dd") != 0){ - 1cdb: 83 ec 0c sub $0xc,%esp - 1cde: 68 ba 44 00 00 push $0x44ba - 1ce3: e8 a6 1b 00 00 call 388e - 1ce8: 83 c4 10 add $0x10,%esp - 1ceb: 85 c0 test %eax,%eax - 1ced: 0f 85 83 03 00 00 jne 2076 + 1c81: 83 ec 0c sub $0xc,%esp + 1c84: 68 e2 43 00 00 push $0x43e2 + 1c89: e8 45 1b 00 00 call 37d3 + 1c8e: 83 c4 10 add $0x10,%esp + 1c91: 85 c0 test %eax,%eax + 1c93: 0f 85 83 03 00 00 jne 201c printf(1, "chdir dd/../../dd failed\n"); exit(); } if(chdir("dd/../../../dd") != 0){ - 1cf3: 83 ec 0c sub $0xc,%esp - 1cf6: 68 e0 44 00 00 push $0x44e0 - 1cfb: e8 8e 1b 00 00 call 388e - 1d00: 83 c4 10 add $0x10,%esp - 1d03: 85 c0 test %eax,%eax - 1d05: 0f 85 7f 03 00 00 jne 208a + 1c99: 83 ec 0c sub $0xc,%esp + 1c9c: 68 08 44 00 00 push $0x4408 + 1ca1: e8 2d 1b 00 00 call 37d3 + 1ca6: 83 c4 10 add $0x10,%esp + 1ca9: 85 c0 test %eax,%eax + 1cab: 0f 85 7f 03 00 00 jne 2030 printf(1, "chdir dd/../../dd failed\n"); exit(); } if(chdir("./..") != 0){ - 1d0b: 83 ec 0c sub $0xc,%esp - 1d0e: 68 ef 44 00 00 push $0x44ef - 1d13: e8 76 1b 00 00 call 388e - 1d18: 83 c4 10 add $0x10,%esp - 1d1b: 85 c0 test %eax,%eax - 1d1d: 0f 85 7b 03 00 00 jne 209e + 1cb1: 83 ec 0c sub $0xc,%esp + 1cb4: 68 17 44 00 00 push $0x4417 + 1cb9: e8 15 1b 00 00 call 37d3 + 1cbe: 83 c4 10 add $0x10,%esp + 1cc1: 85 c0 test %eax,%eax + 1cc3: 0f 85 7b 03 00 00 jne 2044 printf(1, "chdir ./.. failed\n"); exit(); } fd = open("dd/dd/ffff", 0); - 1d23: 83 ec 08 sub $0x8,%esp - 1d26: 6a 00 push $0x0 - 1d28: 68 86 44 00 00 push $0x4486 - 1d2d: e8 2c 1b 00 00 call 385e - 1d32: 89 c3 mov %eax,%ebx + 1cc9: 83 ec 08 sub $0x8,%esp + 1ccc: 6a 00 push $0x0 + 1cce: 68 ae 43 00 00 push $0x43ae + 1cd3: e8 cb 1a 00 00 call 37a3 + 1cd8: 89 c3 mov %eax,%ebx if(fd < 0){ - 1d34: 83 c4 10 add $0x10,%esp - 1d37: 85 c0 test %eax,%eax - 1d39: 0f 88 73 03 00 00 js 20b2 + 1cda: 83 c4 10 add $0x10,%esp + 1cdd: 85 c0 test %eax,%eax + 1cdf: 0f 88 73 03 00 00 js 2058 printf(1, "open dd/dd/ffff failed\n"); exit(); } if(read(fd, buf, sizeof(buf)) != 2){ - 1d3f: 83 ec 04 sub $0x4,%esp - 1d42: 68 00 20 00 00 push $0x2000 - 1d47: 68 80 84 00 00 push $0x8480 - 1d4c: 50 push %eax - 1d4d: e8 e4 1a 00 00 call 3836 - 1d52: 83 c4 10 add $0x10,%esp - 1d55: 83 f8 02 cmp $0x2,%eax - 1d58: 0f 85 68 03 00 00 jne 20c6 + 1ce5: 83 ec 04 sub $0x4,%esp + 1ce8: 68 00 20 00 00 push $0x2000 + 1ced: 68 60 83 00 00 push $0x8360 + 1cf2: 50 push %eax + 1cf3: e8 83 1a 00 00 call 377b + 1cf8: 83 c4 10 add $0x10,%esp + 1cfb: 83 f8 02 cmp $0x2,%eax + 1cfe: 0f 85 68 03 00 00 jne 206c printf(1, "read dd/dd/ffff wrong len\n"); exit(); } close(fd); - 1d5e: 83 ec 0c sub $0xc,%esp - 1d61: 53 push %ebx - 1d62: e8 df 1a 00 00 call 3846 + 1d04: 83 ec 0c sub $0xc,%esp + 1d07: 53 push %ebx + 1d08: e8 7e 1a 00 00 call 378b if(open("dd/dd/ff", O_RDONLY) >= 0){ - 1d67: 83 c4 08 add $0x8,%esp - 1d6a: 6a 00 push $0x0 - 1d6c: 68 22 44 00 00 push $0x4422 - 1d71: e8 e8 1a 00 00 call 385e - 1d76: 83 c4 10 add $0x10,%esp - 1d79: 85 c0 test %eax,%eax - 1d7b: 0f 89 59 03 00 00 jns 20da + 1d0d: 83 c4 08 add $0x8,%esp + 1d10: 6a 00 push $0x0 + 1d12: 68 4a 43 00 00 push $0x434a + 1d17: e8 87 1a 00 00 call 37a3 + 1d1c: 83 c4 10 add $0x10,%esp + 1d1f: 85 c0 test %eax,%eax + 1d21: 0f 89 59 03 00 00 jns 2080 printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); exit(); } if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){ - 1d81: 83 ec 08 sub $0x8,%esp - 1d84: 68 02 02 00 00 push $0x202 - 1d89: 68 3a 45 00 00 push $0x453a - 1d8e: e8 cb 1a 00 00 call 385e - 1d93: 83 c4 10 add $0x10,%esp - 1d96: 85 c0 test %eax,%eax - 1d98: 0f 89 50 03 00 00 jns 20ee + 1d27: 83 ec 08 sub $0x8,%esp + 1d2a: 68 02 02 00 00 push $0x202 + 1d2f: 68 62 44 00 00 push $0x4462 + 1d34: e8 6a 1a 00 00 call 37a3 + 1d39: 83 c4 10 add $0x10,%esp + 1d3c: 85 c0 test %eax,%eax + 1d3e: 0f 89 50 03 00 00 jns 2094 printf(1, "create dd/ff/ff succeeded!\n"); exit(); } if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){ - 1d9e: 83 ec 08 sub $0x8,%esp - 1da1: 68 02 02 00 00 push $0x202 - 1da6: 68 5f 45 00 00 push $0x455f - 1dab: e8 ae 1a 00 00 call 385e - 1db0: 83 c4 10 add $0x10,%esp - 1db3: 85 c0 test %eax,%eax - 1db5: 0f 89 47 03 00 00 jns 2102 + 1d44: 83 ec 08 sub $0x8,%esp + 1d47: 68 02 02 00 00 push $0x202 + 1d4c: 68 87 44 00 00 push $0x4487 + 1d51: e8 4d 1a 00 00 call 37a3 + 1d56: 83 c4 10 add $0x10,%esp + 1d59: 85 c0 test %eax,%eax + 1d5b: 0f 89 47 03 00 00 jns 20a8 printf(1, "create dd/xx/ff succeeded!\n"); exit(); } if(open("dd", O_CREATE) >= 0){ - 1dbb: 83 ec 08 sub $0x8,%esp - 1dbe: 68 00 02 00 00 push $0x200 - 1dc3: 68 ec 44 00 00 push $0x44ec - 1dc8: e8 91 1a 00 00 call 385e - 1dcd: 83 c4 10 add $0x10,%esp - 1dd0: 85 c0 test %eax,%eax - 1dd2: 0f 89 3e 03 00 00 jns 2116 + 1d61: 83 ec 08 sub $0x8,%esp + 1d64: 68 00 02 00 00 push $0x200 + 1d69: 68 14 44 00 00 push $0x4414 + 1d6e: e8 30 1a 00 00 call 37a3 + 1d73: 83 c4 10 add $0x10,%esp + 1d76: 85 c0 test %eax,%eax + 1d78: 0f 89 3e 03 00 00 jns 20bc printf(1, "create dd succeeded!\n"); exit(); } if(open("dd", O_RDWR) >= 0){ - 1dd8: 83 ec 08 sub $0x8,%esp - 1ddb: 6a 02 push $0x2 - 1ddd: 68 ec 44 00 00 push $0x44ec - 1de2: e8 77 1a 00 00 call 385e - 1de7: 83 c4 10 add $0x10,%esp - 1dea: 85 c0 test %eax,%eax - 1dec: 0f 89 38 03 00 00 jns 212a + 1d7e: 83 ec 08 sub $0x8,%esp + 1d81: 6a 02 push $0x2 + 1d83: 68 14 44 00 00 push $0x4414 + 1d88: e8 16 1a 00 00 call 37a3 + 1d8d: 83 c4 10 add $0x10,%esp + 1d90: 85 c0 test %eax,%eax + 1d92: 0f 89 38 03 00 00 jns 20d0 printf(1, "open dd rdwr succeeded!\n"); exit(); } if(open("dd", O_WRONLY) >= 0){ - 1df2: 83 ec 08 sub $0x8,%esp - 1df5: 6a 01 push $0x1 - 1df7: 68 ec 44 00 00 push $0x44ec - 1dfc: e8 5d 1a 00 00 call 385e - 1e01: 83 c4 10 add $0x10,%esp - 1e04: 85 c0 test %eax,%eax - 1e06: 0f 89 32 03 00 00 jns 213e + 1d98: 83 ec 08 sub $0x8,%esp + 1d9b: 6a 01 push $0x1 + 1d9d: 68 14 44 00 00 push $0x4414 + 1da2: e8 fc 19 00 00 call 37a3 + 1da7: 83 c4 10 add $0x10,%esp + 1daa: 85 c0 test %eax,%eax + 1dac: 0f 89 32 03 00 00 jns 20e4 printf(1, "open dd wronly succeeded!\n"); exit(); } if(link("dd/ff/ff", "dd/dd/xx") == 0){ - 1e0c: 83 ec 08 sub $0x8,%esp - 1e0f: 68 ce 45 00 00 push $0x45ce - 1e14: 68 3a 45 00 00 push $0x453a - 1e19: e8 60 1a 00 00 call 387e - 1e1e: 83 c4 10 add $0x10,%esp - 1e21: 85 c0 test %eax,%eax - 1e23: 0f 84 29 03 00 00 je 2152 + 1db2: 83 ec 08 sub $0x8,%esp + 1db5: 68 f6 44 00 00 push $0x44f6 + 1dba: 68 62 44 00 00 push $0x4462 + 1dbf: e8 ff 19 00 00 call 37c3 + 1dc4: 83 c4 10 add $0x10,%esp + 1dc7: 85 c0 test %eax,%eax + 1dc9: 0f 84 29 03 00 00 je 20f8 printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); exit(); } if(link("dd/xx/ff", "dd/dd/xx") == 0){ - 1e29: 83 ec 08 sub $0x8,%esp - 1e2c: 68 ce 45 00 00 push $0x45ce - 1e31: 68 5f 45 00 00 push $0x455f - 1e36: e8 43 1a 00 00 call 387e - 1e3b: 83 c4 10 add $0x10,%esp - 1e3e: 85 c0 test %eax,%eax - 1e40: 0f 84 20 03 00 00 je 2166 + 1dcf: 83 ec 08 sub $0x8,%esp + 1dd2: 68 f6 44 00 00 push $0x44f6 + 1dd7: 68 87 44 00 00 push $0x4487 + 1ddc: e8 e2 19 00 00 call 37c3 + 1de1: 83 c4 10 add $0x10,%esp + 1de4: 85 c0 test %eax,%eax + 1de6: 0f 84 20 03 00 00 je 210c printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); exit(); } if(link("dd/ff", "dd/dd/ffff") == 0){ - 1e46: 83 ec 08 sub $0x8,%esp - 1e49: 68 86 44 00 00 push $0x4486 - 1e4e: 68 25 44 00 00 push $0x4425 - 1e53: e8 26 1a 00 00 call 387e - 1e58: 83 c4 10 add $0x10,%esp - 1e5b: 85 c0 test %eax,%eax - 1e5d: 0f 84 17 03 00 00 je 217a + 1dec: 83 ec 08 sub $0x8,%esp + 1def: 68 ae 43 00 00 push $0x43ae + 1df4: 68 4d 43 00 00 push $0x434d + 1df9: e8 c5 19 00 00 call 37c3 + 1dfe: 83 c4 10 add $0x10,%esp + 1e01: 85 c0 test %eax,%eax + 1e03: 0f 84 17 03 00 00 je 2120 printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); exit(); } if(mkdir("dd/ff/ff") == 0){ - 1e63: 83 ec 0c sub $0xc,%esp - 1e66: 68 3a 45 00 00 push $0x453a - 1e6b: e8 16 1a 00 00 call 3886 - 1e70: 83 c4 10 add $0x10,%esp - 1e73: 85 c0 test %eax,%eax - 1e75: 0f 84 13 03 00 00 je 218e + 1e09: 83 ec 0c sub $0xc,%esp + 1e0c: 68 62 44 00 00 push $0x4462 + 1e11: e8 b5 19 00 00 call 37cb + 1e16: 83 c4 10 add $0x10,%esp + 1e19: 85 c0 test %eax,%eax + 1e1b: 0f 84 13 03 00 00 je 2134 printf(1, "mkdir dd/ff/ff succeeded!\n"); exit(); } if(mkdir("dd/xx/ff") == 0){ - 1e7b: 83 ec 0c sub $0xc,%esp - 1e7e: 68 5f 45 00 00 push $0x455f - 1e83: e8 fe 19 00 00 call 3886 - 1e88: 83 c4 10 add $0x10,%esp - 1e8b: 85 c0 test %eax,%eax - 1e8d: 0f 84 0f 03 00 00 je 21a2 + 1e21: 83 ec 0c sub $0xc,%esp + 1e24: 68 87 44 00 00 push $0x4487 + 1e29: e8 9d 19 00 00 call 37cb + 1e2e: 83 c4 10 add $0x10,%esp + 1e31: 85 c0 test %eax,%eax + 1e33: 0f 84 0f 03 00 00 je 2148 printf(1, "mkdir dd/xx/ff succeeded!\n"); exit(); } if(mkdir("dd/dd/ffff") == 0){ - 1e93: 83 ec 0c sub $0xc,%esp - 1e96: 68 86 44 00 00 push $0x4486 - 1e9b: e8 e6 19 00 00 call 3886 - 1ea0: 83 c4 10 add $0x10,%esp - 1ea3: 85 c0 test %eax,%eax - 1ea5: 0f 84 0b 03 00 00 je 21b6 + 1e39: 83 ec 0c sub $0xc,%esp + 1e3c: 68 ae 43 00 00 push $0x43ae + 1e41: e8 85 19 00 00 call 37cb + 1e46: 83 c4 10 add $0x10,%esp + 1e49: 85 c0 test %eax,%eax + 1e4b: 0f 84 0b 03 00 00 je 215c printf(1, "mkdir dd/dd/ffff succeeded!\n"); exit(); } if(unlink("dd/xx/ff") == 0){ - 1eab: 83 ec 0c sub $0xc,%esp - 1eae: 68 5f 45 00 00 push $0x455f - 1eb3: e8 b6 19 00 00 call 386e - 1eb8: 83 c4 10 add $0x10,%esp - 1ebb: 85 c0 test %eax,%eax - 1ebd: 0f 84 07 03 00 00 je 21ca + 1e51: 83 ec 0c sub $0xc,%esp + 1e54: 68 87 44 00 00 push $0x4487 + 1e59: e8 55 19 00 00 call 37b3 + 1e5e: 83 c4 10 add $0x10,%esp + 1e61: 85 c0 test %eax,%eax + 1e63: 0f 84 07 03 00 00 je 2170 printf(1, "unlink dd/xx/ff succeeded!\n"); exit(); } if(unlink("dd/ff/ff") == 0){ - 1ec3: 83 ec 0c sub $0xc,%esp - 1ec6: 68 3a 45 00 00 push $0x453a - 1ecb: e8 9e 19 00 00 call 386e - 1ed0: 83 c4 10 add $0x10,%esp - 1ed3: 85 c0 test %eax,%eax - 1ed5: 0f 84 03 03 00 00 je 21de + 1e69: 83 ec 0c sub $0xc,%esp + 1e6c: 68 62 44 00 00 push $0x4462 + 1e71: e8 3d 19 00 00 call 37b3 + 1e76: 83 c4 10 add $0x10,%esp + 1e79: 85 c0 test %eax,%eax + 1e7b: 0f 84 03 03 00 00 je 2184 printf(1, "unlink dd/ff/ff succeeded!\n"); exit(); } if(chdir("dd/ff") == 0){ - 1edb: 83 ec 0c sub $0xc,%esp - 1ede: 68 25 44 00 00 push $0x4425 - 1ee3: e8 a6 19 00 00 call 388e - 1ee8: 83 c4 10 add $0x10,%esp - 1eeb: 85 c0 test %eax,%eax - 1eed: 0f 84 ff 02 00 00 je 21f2 + 1e81: 83 ec 0c sub $0xc,%esp + 1e84: 68 4d 43 00 00 push $0x434d + 1e89: e8 45 19 00 00 call 37d3 + 1e8e: 83 c4 10 add $0x10,%esp + 1e91: 85 c0 test %eax,%eax + 1e93: 0f 84 ff 02 00 00 je 2198 printf(1, "chdir dd/ff succeeded!\n"); exit(); } if(chdir("dd/xx") == 0){ - 1ef3: 83 ec 0c sub $0xc,%esp - 1ef6: 68 d1 45 00 00 push $0x45d1 - 1efb: e8 8e 19 00 00 call 388e - 1f00: 83 c4 10 add $0x10,%esp - 1f03: 85 c0 test %eax,%eax - 1f05: 0f 84 fb 02 00 00 je 2206 + 1e99: 83 ec 0c sub $0xc,%esp + 1e9c: 68 f9 44 00 00 push $0x44f9 + 1ea1: e8 2d 19 00 00 call 37d3 + 1ea6: 83 c4 10 add $0x10,%esp + 1ea9: 85 c0 test %eax,%eax + 1eab: 0f 84 fb 02 00 00 je 21ac printf(1, "chdir dd/xx succeeded!\n"); exit(); } if(unlink("dd/dd/ffff") != 0){ - 1f0b: 83 ec 0c sub $0xc,%esp - 1f0e: 68 86 44 00 00 push $0x4486 - 1f13: e8 56 19 00 00 call 386e - 1f18: 83 c4 10 add $0x10,%esp - 1f1b: 85 c0 test %eax,%eax - 1f1d: 0f 85 f7 02 00 00 jne 221a + 1eb1: 83 ec 0c sub $0xc,%esp + 1eb4: 68 ae 43 00 00 push $0x43ae + 1eb9: e8 f5 18 00 00 call 37b3 + 1ebe: 83 c4 10 add $0x10,%esp + 1ec1: 85 c0 test %eax,%eax + 1ec3: 0f 85 f7 02 00 00 jne 21c0 printf(1, "unlink dd/dd/ff failed\n"); exit(); } if(unlink("dd/ff") != 0){ - 1f23: 83 ec 0c sub $0xc,%esp - 1f26: 68 25 44 00 00 push $0x4425 - 1f2b: e8 3e 19 00 00 call 386e - 1f30: 83 c4 10 add $0x10,%esp - 1f33: 85 c0 test %eax,%eax - 1f35: 0f 85 f3 02 00 00 jne 222e + 1ec9: 83 ec 0c sub $0xc,%esp + 1ecc: 68 4d 43 00 00 push $0x434d + 1ed1: e8 dd 18 00 00 call 37b3 + 1ed6: 83 c4 10 add $0x10,%esp + 1ed9: 85 c0 test %eax,%eax + 1edb: 0f 85 f3 02 00 00 jne 21d4 printf(1, "unlink dd/ff failed\n"); exit(); } if(unlink("dd") == 0){ - 1f3b: 83 ec 0c sub $0xc,%esp - 1f3e: 68 ec 44 00 00 push $0x44ec - 1f43: e8 26 19 00 00 call 386e - 1f48: 83 c4 10 add $0x10,%esp - 1f4b: 85 c0 test %eax,%eax - 1f4d: 0f 84 ef 02 00 00 je 2242 + 1ee1: 83 ec 0c sub $0xc,%esp + 1ee4: 68 14 44 00 00 push $0x4414 + 1ee9: e8 c5 18 00 00 call 37b3 + 1eee: 83 c4 10 add $0x10,%esp + 1ef1: 85 c0 test %eax,%eax + 1ef3: 0f 84 ef 02 00 00 je 21e8 printf(1, "unlink non-empty dd succeeded!\n"); exit(); } if(unlink("dd/dd") < 0){ - 1f53: 83 ec 0c sub $0xc,%esp - 1f56: 68 01 44 00 00 push $0x4401 - 1f5b: e8 0e 19 00 00 call 386e - 1f60: 83 c4 10 add $0x10,%esp - 1f63: 85 c0 test %eax,%eax - 1f65: 0f 88 eb 02 00 00 js 2256 + 1ef9: 83 ec 0c sub $0xc,%esp + 1efc: 68 29 43 00 00 push $0x4329 + 1f01: e8 ad 18 00 00 call 37b3 + 1f06: 83 c4 10 add $0x10,%esp + 1f09: 85 c0 test %eax,%eax + 1f0b: 0f 88 eb 02 00 00 js 21fc printf(1, "unlink dd/dd failed\n"); exit(); } if(unlink("dd") < 0){ - 1f6b: 83 ec 0c sub $0xc,%esp - 1f6e: 68 ec 44 00 00 push $0x44ec - 1f73: e8 f6 18 00 00 call 386e - 1f78: 83 c4 10 add $0x10,%esp - 1f7b: 85 c0 test %eax,%eax - 1f7d: 0f 88 e7 02 00 00 js 226a + 1f11: 83 ec 0c sub $0xc,%esp + 1f14: 68 14 44 00 00 push $0x4414 + 1f19: e8 95 18 00 00 call 37b3 + 1f1e: 83 c4 10 add $0x10,%esp + 1f21: 85 c0 test %eax,%eax + 1f23: 0f 88 e7 02 00 00 js 2210 printf(1, "unlink dd failed\n"); exit(); } printf(1, "subdir ok\n"); - 1f83: 83 ec 08 sub $0x8,%esp - 1f86: 68 ce 46 00 00 push $0x46ce - 1f8b: 6a 01 push $0x1 - 1f8d: e8 d0 19 00 00 call 3962 + 1f29: 83 ec 08 sub $0x8,%esp + 1f2c: 68 f6 45 00 00 push $0x45f6 + 1f31: 6a 01 push $0x1 + 1f33: e8 73 19 00 00 call 38ab } - 1f92: 83 c4 10 add $0x10,%esp - 1f95: 8b 5d fc mov -0x4(%ebp),%ebx - 1f98: c9 leave - 1f99: c3 ret + 1f38: 83 c4 10 add $0x10,%esp + 1f3b: 8b 5d fc mov -0x4(%ebp),%ebx + 1f3e: c9 leave + 1f3f: c3 ret printf(1, "subdir mkdir dd failed\n"); - 1f9a: 83 ec 08 sub $0x8,%esp - 1f9d: 68 d3 43 00 00 push $0x43d3 - 1fa2: 6a 01 push $0x1 - 1fa4: e8 b9 19 00 00 call 3962 + 1f40: 83 ec 08 sub $0x8,%esp + 1f43: 68 fb 42 00 00 push $0x42fb + 1f48: 6a 01 push $0x1 + 1f4a: e8 5c 19 00 00 call 38ab exit(); - 1fa9: e8 70 18 00 00 call 381e + 1f4f: e8 0f 18 00 00 call 3763 printf(1, "create dd/ff failed\n"); - 1fae: 83 ec 08 sub $0x8,%esp - 1fb1: 68 eb 43 00 00 push $0x43eb - 1fb6: 6a 01 push $0x1 - 1fb8: e8 a5 19 00 00 call 3962 + 1f54: 83 ec 08 sub $0x8,%esp + 1f57: 68 13 43 00 00 push $0x4313 + 1f5c: 6a 01 push $0x1 + 1f5e: e8 48 19 00 00 call 38ab exit(); - 1fbd: e8 5c 18 00 00 call 381e + 1f63: e8 fb 17 00 00 call 3763 printf(1, "unlink dd (non-empty dir) succeeded!\n"); - 1fc2: 83 ec 08 sub $0x8,%esp - 1fc5: 68 b8 4e 00 00 push $0x4eb8 - 1fca: 6a 01 push $0x1 - 1fcc: e8 91 19 00 00 call 3962 + 1f68: 83 ec 08 sub $0x8,%esp + 1f6b: 68 e0 4d 00 00 push $0x4de0 + 1f70: 6a 01 push $0x1 + 1f72: e8 34 19 00 00 call 38ab exit(); - 1fd1: e8 48 18 00 00 call 381e + 1f77: e8 e7 17 00 00 call 3763 printf(1, "subdir mkdir dd/dd failed\n"); - 1fd6: 83 ec 08 sub $0x8,%esp - 1fd9: 68 07 44 00 00 push $0x4407 - 1fde: 6a 01 push $0x1 - 1fe0: e8 7d 19 00 00 call 3962 + 1f7c: 83 ec 08 sub $0x8,%esp + 1f7f: 68 2f 43 00 00 push $0x432f + 1f84: 6a 01 push $0x1 + 1f86: e8 20 19 00 00 call 38ab exit(); - 1fe5: e8 34 18 00 00 call 381e + 1f8b: e8 d3 17 00 00 call 3763 printf(1, "create dd/dd/ff failed\n"); - 1fea: 83 ec 08 sub $0x8,%esp - 1fed: 68 2b 44 00 00 push $0x442b - 1ff2: 6a 01 push $0x1 - 1ff4: e8 69 19 00 00 call 3962 + 1f90: 83 ec 08 sub $0x8,%esp + 1f93: 68 53 43 00 00 push $0x4353 + 1f98: 6a 01 push $0x1 + 1f9a: e8 0c 19 00 00 call 38ab exit(); - 1ff9: e8 20 18 00 00 call 381e + 1f9f: e8 bf 17 00 00 call 3763 printf(1, "open dd/dd/../ff failed\n"); - 1ffe: 83 ec 08 sub $0x8,%esp - 2001: 68 52 44 00 00 push $0x4452 - 2006: 6a 01 push $0x1 - 2008: e8 55 19 00 00 call 3962 + 1fa4: 83 ec 08 sub $0x8,%esp + 1fa7: 68 7a 43 00 00 push $0x437a + 1fac: 6a 01 push $0x1 + 1fae: e8 f8 18 00 00 call 38ab exit(); - 200d: e8 0c 18 00 00 call 381e + 1fb3: e8 ab 17 00 00 call 3763 printf(1, "dd/dd/../ff wrong content\n"); - 2012: 83 ec 08 sub $0x8,%esp - 2015: 68 6b 44 00 00 push $0x446b - 201a: 6a 01 push $0x1 - 201c: e8 41 19 00 00 call 3962 + 1fb8: 83 ec 08 sub $0x8,%esp + 1fbb: 68 93 43 00 00 push $0x4393 + 1fc0: 6a 01 push $0x1 + 1fc2: e8 e4 18 00 00 call 38ab exit(); - 2021: e8 f8 17 00 00 call 381e + 1fc7: e8 97 17 00 00 call 3763 printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); - 2026: 83 ec 08 sub $0x8,%esp - 2029: 68 e0 4e 00 00 push $0x4ee0 - 202e: 6a 01 push $0x1 - 2030: e8 2d 19 00 00 call 3962 + 1fcc: 83 ec 08 sub $0x8,%esp + 1fcf: 68 08 4e 00 00 push $0x4e08 + 1fd4: 6a 01 push $0x1 + 1fd6: e8 d0 18 00 00 call 38ab exit(); - 2035: e8 e4 17 00 00 call 381e + 1fdb: e8 83 17 00 00 call 3763 printf(1, "unlink dd/dd/ff failed\n"); - 203a: 83 ec 08 sub $0x8,%esp - 203d: 68 91 44 00 00 push $0x4491 - 2042: 6a 01 push $0x1 - 2044: e8 19 19 00 00 call 3962 + 1fe0: 83 ec 08 sub $0x8,%esp + 1fe3: 68 b9 43 00 00 push $0x43b9 + 1fe8: 6a 01 push $0x1 + 1fea: e8 bc 18 00 00 call 38ab exit(); - 2049: e8 d0 17 00 00 call 381e + 1fef: e8 6f 17 00 00 call 3763 printf(1, "open (unlinked) dd/dd/ff succeeded\n"); - 204e: 83 ec 08 sub $0x8,%esp - 2051: 68 04 4f 00 00 push $0x4f04 - 2056: 6a 01 push $0x1 - 2058: e8 05 19 00 00 call 3962 + 1ff4: 83 ec 08 sub $0x8,%esp + 1ff7: 68 2c 4e 00 00 push $0x4e2c + 1ffc: 6a 01 push $0x1 + 1ffe: e8 a8 18 00 00 call 38ab exit(); - 205d: e8 bc 17 00 00 call 381e + 2003: e8 5b 17 00 00 call 3763 printf(1, "chdir dd failed\n"); - 2062: 83 ec 08 sub $0x8,%esp - 2065: 68 a9 44 00 00 push $0x44a9 - 206a: 6a 01 push $0x1 - 206c: e8 f1 18 00 00 call 3962 + 2008: 83 ec 08 sub $0x8,%esp + 200b: 68 d1 43 00 00 push $0x43d1 + 2010: 6a 01 push $0x1 + 2012: e8 94 18 00 00 call 38ab exit(); - 2071: e8 a8 17 00 00 call 381e + 2017: e8 47 17 00 00 call 3763 printf(1, "chdir dd/../../dd failed\n"); - 2076: 83 ec 08 sub $0x8,%esp - 2079: 68 c6 44 00 00 push $0x44c6 - 207e: 6a 01 push $0x1 - 2080: e8 dd 18 00 00 call 3962 + 201c: 83 ec 08 sub $0x8,%esp + 201f: 68 ee 43 00 00 push $0x43ee + 2024: 6a 01 push $0x1 + 2026: e8 80 18 00 00 call 38ab exit(); - 2085: e8 94 17 00 00 call 381e + 202b: e8 33 17 00 00 call 3763 printf(1, "chdir dd/../../dd failed\n"); - 208a: 83 ec 08 sub $0x8,%esp - 208d: 68 c6 44 00 00 push $0x44c6 - 2092: 6a 01 push $0x1 - 2094: e8 c9 18 00 00 call 3962 + 2030: 83 ec 08 sub $0x8,%esp + 2033: 68 ee 43 00 00 push $0x43ee + 2038: 6a 01 push $0x1 + 203a: e8 6c 18 00 00 call 38ab exit(); - 2099: e8 80 17 00 00 call 381e + 203f: e8 1f 17 00 00 call 3763 printf(1, "chdir ./.. failed\n"); - 209e: 83 ec 08 sub $0x8,%esp - 20a1: 68 f4 44 00 00 push $0x44f4 - 20a6: 6a 01 push $0x1 - 20a8: e8 b5 18 00 00 call 3962 + 2044: 83 ec 08 sub $0x8,%esp + 2047: 68 1c 44 00 00 push $0x441c + 204c: 6a 01 push $0x1 + 204e: e8 58 18 00 00 call 38ab exit(); - 20ad: e8 6c 17 00 00 call 381e + 2053: e8 0b 17 00 00 call 3763 printf(1, "open dd/dd/ffff failed\n"); - 20b2: 83 ec 08 sub $0x8,%esp - 20b5: 68 07 45 00 00 push $0x4507 - 20ba: 6a 01 push $0x1 - 20bc: e8 a1 18 00 00 call 3962 + 2058: 83 ec 08 sub $0x8,%esp + 205b: 68 2f 44 00 00 push $0x442f + 2060: 6a 01 push $0x1 + 2062: e8 44 18 00 00 call 38ab exit(); - 20c1: e8 58 17 00 00 call 381e + 2067: e8 f7 16 00 00 call 3763 printf(1, "read dd/dd/ffff wrong len\n"); - 20c6: 83 ec 08 sub $0x8,%esp - 20c9: 68 1f 45 00 00 push $0x451f - 20ce: 6a 01 push $0x1 - 20d0: e8 8d 18 00 00 call 3962 + 206c: 83 ec 08 sub $0x8,%esp + 206f: 68 47 44 00 00 push $0x4447 + 2074: 6a 01 push $0x1 + 2076: e8 30 18 00 00 call 38ab exit(); - 20d5: e8 44 17 00 00 call 381e + 207b: e8 e3 16 00 00 call 3763 printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); - 20da: 83 ec 08 sub $0x8,%esp - 20dd: 68 28 4f 00 00 push $0x4f28 - 20e2: 6a 01 push $0x1 - 20e4: e8 79 18 00 00 call 3962 + 2080: 83 ec 08 sub $0x8,%esp + 2083: 68 50 4e 00 00 push $0x4e50 + 2088: 6a 01 push $0x1 + 208a: e8 1c 18 00 00 call 38ab exit(); - 20e9: e8 30 17 00 00 call 381e + 208f: e8 cf 16 00 00 call 3763 printf(1, "create dd/ff/ff succeeded!\n"); - 20ee: 83 ec 08 sub $0x8,%esp - 20f1: 68 43 45 00 00 push $0x4543 - 20f6: 6a 01 push $0x1 - 20f8: e8 65 18 00 00 call 3962 + 2094: 83 ec 08 sub $0x8,%esp + 2097: 68 6b 44 00 00 push $0x446b + 209c: 6a 01 push $0x1 + 209e: e8 08 18 00 00 call 38ab exit(); - 20fd: e8 1c 17 00 00 call 381e + 20a3: e8 bb 16 00 00 call 3763 printf(1, "create dd/xx/ff succeeded!\n"); - 2102: 83 ec 08 sub $0x8,%esp - 2105: 68 68 45 00 00 push $0x4568 - 210a: 6a 01 push $0x1 - 210c: e8 51 18 00 00 call 3962 + 20a8: 83 ec 08 sub $0x8,%esp + 20ab: 68 90 44 00 00 push $0x4490 + 20b0: 6a 01 push $0x1 + 20b2: e8 f4 17 00 00 call 38ab exit(); - 2111: e8 08 17 00 00 call 381e + 20b7: e8 a7 16 00 00 call 3763 printf(1, "create dd succeeded!\n"); - 2116: 83 ec 08 sub $0x8,%esp - 2119: 68 84 45 00 00 push $0x4584 - 211e: 6a 01 push $0x1 - 2120: e8 3d 18 00 00 call 3962 + 20bc: 83 ec 08 sub $0x8,%esp + 20bf: 68 ac 44 00 00 push $0x44ac + 20c4: 6a 01 push $0x1 + 20c6: e8 e0 17 00 00 call 38ab exit(); - 2125: e8 f4 16 00 00 call 381e + 20cb: e8 93 16 00 00 call 3763 printf(1, "open dd rdwr succeeded!\n"); - 212a: 83 ec 08 sub $0x8,%esp - 212d: 68 9a 45 00 00 push $0x459a - 2132: 6a 01 push $0x1 - 2134: e8 29 18 00 00 call 3962 + 20d0: 83 ec 08 sub $0x8,%esp + 20d3: 68 c2 44 00 00 push $0x44c2 + 20d8: 6a 01 push $0x1 + 20da: e8 cc 17 00 00 call 38ab exit(); - 2139: e8 e0 16 00 00 call 381e + 20df: e8 7f 16 00 00 call 3763 printf(1, "open dd wronly succeeded!\n"); - 213e: 83 ec 08 sub $0x8,%esp - 2141: 68 b3 45 00 00 push $0x45b3 - 2146: 6a 01 push $0x1 - 2148: e8 15 18 00 00 call 3962 + 20e4: 83 ec 08 sub $0x8,%esp + 20e7: 68 db 44 00 00 push $0x44db + 20ec: 6a 01 push $0x1 + 20ee: e8 b8 17 00 00 call 38ab exit(); - 214d: e8 cc 16 00 00 call 381e + 20f3: e8 6b 16 00 00 call 3763 printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); - 2152: 83 ec 08 sub $0x8,%esp - 2155: 68 50 4f 00 00 push $0x4f50 - 215a: 6a 01 push $0x1 - 215c: e8 01 18 00 00 call 3962 + 20f8: 83 ec 08 sub $0x8,%esp + 20fb: 68 78 4e 00 00 push $0x4e78 + 2100: 6a 01 push $0x1 + 2102: e8 a4 17 00 00 call 38ab exit(); - 2161: e8 b8 16 00 00 call 381e + 2107: e8 57 16 00 00 call 3763 printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); - 2166: 83 ec 08 sub $0x8,%esp - 2169: 68 74 4f 00 00 push $0x4f74 - 216e: 6a 01 push $0x1 - 2170: e8 ed 17 00 00 call 3962 + 210c: 83 ec 08 sub $0x8,%esp + 210f: 68 9c 4e 00 00 push $0x4e9c + 2114: 6a 01 push $0x1 + 2116: e8 90 17 00 00 call 38ab exit(); - 2175: e8 a4 16 00 00 call 381e + 211b: e8 43 16 00 00 call 3763 printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); - 217a: 83 ec 08 sub $0x8,%esp - 217d: 68 98 4f 00 00 push $0x4f98 - 2182: 6a 01 push $0x1 - 2184: e8 d9 17 00 00 call 3962 + 2120: 83 ec 08 sub $0x8,%esp + 2123: 68 c0 4e 00 00 push $0x4ec0 + 2128: 6a 01 push $0x1 + 212a: e8 7c 17 00 00 call 38ab exit(); - 2189: e8 90 16 00 00 call 381e + 212f: e8 2f 16 00 00 call 3763 printf(1, "mkdir dd/ff/ff succeeded!\n"); - 218e: 83 ec 08 sub $0x8,%esp - 2191: 68 d7 45 00 00 push $0x45d7 - 2196: 6a 01 push $0x1 - 2198: e8 c5 17 00 00 call 3962 + 2134: 83 ec 08 sub $0x8,%esp + 2137: 68 ff 44 00 00 push $0x44ff + 213c: 6a 01 push $0x1 + 213e: e8 68 17 00 00 call 38ab exit(); - 219d: e8 7c 16 00 00 call 381e + 2143: e8 1b 16 00 00 call 3763 printf(1, "mkdir dd/xx/ff succeeded!\n"); - 21a2: 83 ec 08 sub $0x8,%esp - 21a5: 68 f2 45 00 00 push $0x45f2 - 21aa: 6a 01 push $0x1 - 21ac: e8 b1 17 00 00 call 3962 + 2148: 83 ec 08 sub $0x8,%esp + 214b: 68 1a 45 00 00 push $0x451a + 2150: 6a 01 push $0x1 + 2152: e8 54 17 00 00 call 38ab exit(); - 21b1: e8 68 16 00 00 call 381e + 2157: e8 07 16 00 00 call 3763 printf(1, "mkdir dd/dd/ffff succeeded!\n"); - 21b6: 83 ec 08 sub $0x8,%esp - 21b9: 68 0d 46 00 00 push $0x460d - 21be: 6a 01 push $0x1 - 21c0: e8 9d 17 00 00 call 3962 + 215c: 83 ec 08 sub $0x8,%esp + 215f: 68 35 45 00 00 push $0x4535 + 2164: 6a 01 push $0x1 + 2166: e8 40 17 00 00 call 38ab exit(); - 21c5: e8 54 16 00 00 call 381e + 216b: e8 f3 15 00 00 call 3763 printf(1, "unlink dd/xx/ff succeeded!\n"); - 21ca: 83 ec 08 sub $0x8,%esp - 21cd: 68 2a 46 00 00 push $0x462a - 21d2: 6a 01 push $0x1 - 21d4: e8 89 17 00 00 call 3962 + 2170: 83 ec 08 sub $0x8,%esp + 2173: 68 52 45 00 00 push $0x4552 + 2178: 6a 01 push $0x1 + 217a: e8 2c 17 00 00 call 38ab exit(); - 21d9: e8 40 16 00 00 call 381e + 217f: e8 df 15 00 00 call 3763 printf(1, "unlink dd/ff/ff succeeded!\n"); - 21de: 83 ec 08 sub $0x8,%esp - 21e1: 68 46 46 00 00 push $0x4646 - 21e6: 6a 01 push $0x1 - 21e8: e8 75 17 00 00 call 3962 + 2184: 83 ec 08 sub $0x8,%esp + 2187: 68 6e 45 00 00 push $0x456e + 218c: 6a 01 push $0x1 + 218e: e8 18 17 00 00 call 38ab exit(); - 21ed: e8 2c 16 00 00 call 381e + 2193: e8 cb 15 00 00 call 3763 printf(1, "chdir dd/ff succeeded!\n"); - 21f2: 83 ec 08 sub $0x8,%esp - 21f5: 68 62 46 00 00 push $0x4662 - 21fa: 6a 01 push $0x1 - 21fc: e8 61 17 00 00 call 3962 + 2198: 83 ec 08 sub $0x8,%esp + 219b: 68 8a 45 00 00 push $0x458a + 21a0: 6a 01 push $0x1 + 21a2: e8 04 17 00 00 call 38ab exit(); - 2201: e8 18 16 00 00 call 381e + 21a7: e8 b7 15 00 00 call 3763 printf(1, "chdir dd/xx succeeded!\n"); - 2206: 83 ec 08 sub $0x8,%esp - 2209: 68 7a 46 00 00 push $0x467a - 220e: 6a 01 push $0x1 - 2210: e8 4d 17 00 00 call 3962 + 21ac: 83 ec 08 sub $0x8,%esp + 21af: 68 a2 45 00 00 push $0x45a2 + 21b4: 6a 01 push $0x1 + 21b6: e8 f0 16 00 00 call 38ab exit(); - 2215: e8 04 16 00 00 call 381e + 21bb: e8 a3 15 00 00 call 3763 printf(1, "unlink dd/dd/ff failed\n"); - 221a: 83 ec 08 sub $0x8,%esp - 221d: 68 91 44 00 00 push $0x4491 - 2222: 6a 01 push $0x1 - 2224: e8 39 17 00 00 call 3962 + 21c0: 83 ec 08 sub $0x8,%esp + 21c3: 68 b9 43 00 00 push $0x43b9 + 21c8: 6a 01 push $0x1 + 21ca: e8 dc 16 00 00 call 38ab exit(); - 2229: e8 f0 15 00 00 call 381e + 21cf: e8 8f 15 00 00 call 3763 printf(1, "unlink dd/ff failed\n"); - 222e: 83 ec 08 sub $0x8,%esp - 2231: 68 92 46 00 00 push $0x4692 - 2236: 6a 01 push $0x1 - 2238: e8 25 17 00 00 call 3962 + 21d4: 83 ec 08 sub $0x8,%esp + 21d7: 68 ba 45 00 00 push $0x45ba + 21dc: 6a 01 push $0x1 + 21de: e8 c8 16 00 00 call 38ab exit(); - 223d: e8 dc 15 00 00 call 381e + 21e3: e8 7b 15 00 00 call 3763 printf(1, "unlink non-empty dd succeeded!\n"); - 2242: 83 ec 08 sub $0x8,%esp - 2245: 68 bc 4f 00 00 push $0x4fbc - 224a: 6a 01 push $0x1 - 224c: e8 11 17 00 00 call 3962 + 21e8: 83 ec 08 sub $0x8,%esp + 21eb: 68 e4 4e 00 00 push $0x4ee4 + 21f0: 6a 01 push $0x1 + 21f2: e8 b4 16 00 00 call 38ab exit(); - 2251: e8 c8 15 00 00 call 381e + 21f7: e8 67 15 00 00 call 3763 printf(1, "unlink dd/dd failed\n"); - 2256: 83 ec 08 sub $0x8,%esp - 2259: 68 a7 46 00 00 push $0x46a7 - 225e: 6a 01 push $0x1 - 2260: e8 fd 16 00 00 call 3962 + 21fc: 83 ec 08 sub $0x8,%esp + 21ff: 68 cf 45 00 00 push $0x45cf + 2204: 6a 01 push $0x1 + 2206: e8 a0 16 00 00 call 38ab exit(); - 2265: e8 b4 15 00 00 call 381e + 220b: e8 53 15 00 00 call 3763 printf(1, "unlink dd failed\n"); - 226a: 83 ec 08 sub $0x8,%esp - 226d: 68 bc 46 00 00 push $0x46bc - 2272: 6a 01 push $0x1 - 2274: e8 e9 16 00 00 call 3962 + 2210: 83 ec 08 sub $0x8,%esp + 2213: 68 e4 45 00 00 push $0x45e4 + 2218: 6a 01 push $0x1 + 221a: e8 8c 16 00 00 call 38ab exit(); - 2279: e8 a0 15 00 00 call 381e + 221f: e8 3f 15 00 00 call 3763 -0000227e : +00002224 : // test writes that are larger than the log. void bigwrite(void) { - 227e: f3 0f 1e fb endbr32 - 2282: 55 push %ebp - 2283: 89 e5 mov %esp,%ebp - 2285: 57 push %edi - 2286: 56 push %esi - 2287: 53 push %ebx - 2288: 83 ec 14 sub $0x14,%esp + 2224: 55 push %ebp + 2225: 89 e5 mov %esp,%ebp + 2227: 57 push %edi + 2228: 56 push %esi + 2229: 53 push %ebx + 222a: 83 ec 14 sub $0x14,%esp int fd, sz; printf(1, "bigwrite test\n"); - 228b: 68 d9 46 00 00 push $0x46d9 - 2290: 6a 01 push $0x1 - 2292: e8 cb 16 00 00 call 3962 + 222d: 68 01 46 00 00 push $0x4601 + 2232: 6a 01 push $0x1 + 2234: e8 72 16 00 00 call 38ab unlink("bigwrite"); - 2297: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) - 229e: e8 cb 15 00 00 call 386e - 22a3: 83 c4 10 add $0x10,%esp + 2239: c7 04 24 10 46 00 00 movl $0x4610,(%esp) + 2240: e8 6e 15 00 00 call 37b3 + 2245: 83 c4 10 add $0x10,%esp for(sz = 499; sz < 12*512; sz += 471){ - 22a6: bb f3 01 00 00 mov $0x1f3,%ebx + 2248: bb f3 01 00 00 mov $0x1f3,%ebx fd = open("bigwrite", O_CREATE | O_RDWR); - 22ab: 83 ec 08 sub $0x8,%esp - 22ae: 68 02 02 00 00 push $0x202 - 22b3: 68 e8 46 00 00 push $0x46e8 - 22b8: e8 a1 15 00 00 call 385e - 22bd: 89 c6 mov %eax,%esi + 224d: 83 ec 08 sub $0x8,%esp + 2250: 68 02 02 00 00 push $0x202 + 2255: 68 10 46 00 00 push $0x4610 + 225a: e8 44 15 00 00 call 37a3 + 225f: 89 c6 mov %eax,%esi if(fd < 0){ - 22bf: 83 c4 10 add $0x10,%esp - 22c2: 85 c0 test %eax,%eax - 22c4: 78 6e js 2334 + 2261: 83 c4 10 add $0x10,%esp + 2264: 85 c0 test %eax,%eax + 2266: 78 6e js 22d6 printf(1, "cannot create bigwrite\n"); exit(); } int i; for(i = 0; i < 2; i++){ int cc = write(fd, buf, sz); - 22c6: 83 ec 04 sub $0x4,%esp - 22c9: 53 push %ebx - 22ca: 68 80 84 00 00 push $0x8480 - 22cf: 50 push %eax - 22d0: e8 69 15 00 00 call 383e - 22d5: 89 c7 mov %eax,%edi + 2268: 83 ec 04 sub $0x4,%esp + 226b: 53 push %ebx + 226c: 68 60 83 00 00 push $0x8360 + 2271: 50 push %eax + 2272: e8 0c 15 00 00 call 3783 + 2277: 89 c7 mov %eax,%edi if(cc != sz){ - 22d7: 83 c4 10 add $0x10,%esp - 22da: 39 c3 cmp %eax,%ebx - 22dc: 75 6e jne 234c + 2279: 83 c4 10 add $0x10,%esp + 227c: 39 c3 cmp %eax,%ebx + 227e: 75 6a jne 22ea int cc = write(fd, buf, sz); - 22de: 83 ec 04 sub $0x4,%esp - 22e1: 53 push %ebx - 22e2: 68 80 84 00 00 push $0x8480 - 22e7: 56 push %esi - 22e8: e8 51 15 00 00 call 383e + 2280: 83 ec 04 sub $0x4,%esp + 2283: 53 push %ebx + 2284: 68 60 83 00 00 push $0x8360 + 2289: 56 push %esi + 228a: e8 f4 14 00 00 call 3783 if(cc != sz){ - 22ed: 83 c4 10 add $0x10,%esp - 22f0: 39 d8 cmp %ebx,%eax - 22f2: 75 54 jne 2348 + 228f: 83 c4 10 add $0x10,%esp + 2292: 39 d8 cmp %ebx,%eax + 2294: 75 56 jne 22ec printf(1, "write(%d) ret %d\n", sz, cc); exit(); } } close(fd); - 22f4: 83 ec 0c sub $0xc,%esp - 22f7: 56 push %esi - 22f8: e8 49 15 00 00 call 3846 + 2296: 83 ec 0c sub $0xc,%esp + 2299: 56 push %esi + 229a: e8 ec 14 00 00 call 378b unlink("bigwrite"); - 22fd: c7 04 24 e8 46 00 00 movl $0x46e8,(%esp) - 2304: e8 65 15 00 00 call 386e + 229f: c7 04 24 10 46 00 00 movl $0x4610,(%esp) + 22a6: e8 08 15 00 00 call 37b3 for(sz = 499; sz < 12*512; sz += 471){ - 2309: 81 c3 d7 01 00 00 add $0x1d7,%ebx - 230f: 83 c4 10 add $0x10,%esp - 2312: 81 fb 07 18 00 00 cmp $0x1807,%ebx - 2318: 75 91 jne 22ab + 22ab: 81 c3 d7 01 00 00 add $0x1d7,%ebx + 22b1: 83 c4 10 add $0x10,%esp + 22b4: 81 fb 07 18 00 00 cmp $0x1807,%ebx + 22ba: 75 91 jne 224d } printf(1, "bigwrite ok\n"); - 231a: 83 ec 08 sub $0x8,%esp - 231d: 68 1b 47 00 00 push $0x471b - 2322: 6a 01 push $0x1 - 2324: e8 39 16 00 00 call 3962 + 22bc: 83 ec 08 sub $0x8,%esp + 22bf: 68 43 46 00 00 push $0x4643 + 22c4: 6a 01 push $0x1 + 22c6: e8 e0 15 00 00 call 38ab } - 2329: 83 c4 10 add $0x10,%esp - 232c: 8d 65 f4 lea -0xc(%ebp),%esp - 232f: 5b pop %ebx - 2330: 5e pop %esi - 2331: 5f pop %edi - 2332: 5d pop %ebp - 2333: c3 ret + 22cb: 83 c4 10 add $0x10,%esp + 22ce: 8d 65 f4 lea -0xc(%ebp),%esp + 22d1: 5b pop %ebx + 22d2: 5e pop %esi + 22d3: 5f pop %edi + 22d4: 5d pop %ebp + 22d5: c3 ret printf(1, "cannot create bigwrite\n"); - 2334: 83 ec 08 sub $0x8,%esp - 2337: 68 f1 46 00 00 push $0x46f1 - 233c: 6a 01 push $0x1 - 233e: e8 1f 16 00 00 call 3962 + 22d6: 83 ec 08 sub $0x8,%esp + 22d9: 68 19 46 00 00 push $0x4619 + 22de: 6a 01 push $0x1 + 22e0: e8 c6 15 00 00 call 38ab exit(); - 2343: e8 d6 14 00 00 call 381e - 2348: 89 fb mov %edi,%ebx - int cc = write(fd, buf, sz); - 234a: 89 c7 mov %eax,%edi + 22e5: e8 79 14 00 00 call 3763 + if(cc != sz){ + 22ea: 89 df mov %ebx,%edi printf(1, "write(%d) ret %d\n", sz, cc); - 234c: 57 push %edi - 234d: 53 push %ebx - 234e: 68 09 47 00 00 push $0x4709 - 2353: 6a 01 push $0x1 - 2355: e8 08 16 00 00 call 3962 + 22ec: 50 push %eax + 22ed: 57 push %edi + 22ee: 68 31 46 00 00 push $0x4631 + 22f3: 6a 01 push $0x1 + 22f5: e8 b1 15 00 00 call 38ab exit(); - 235a: e8 bf 14 00 00 call 381e + 22fa: e8 64 14 00 00 call 3763 -0000235f : +000022ff : void bigfile(void) { - 235f: f3 0f 1e fb endbr32 - 2363: 55 push %ebp - 2364: 89 e5 mov %esp,%ebp - 2366: 57 push %edi - 2367: 56 push %esi - 2368: 53 push %ebx - 2369: 83 ec 14 sub $0x14,%esp + 22ff: 55 push %ebp + 2300: 89 e5 mov %esp,%ebp + 2302: 57 push %edi + 2303: 56 push %esi + 2304: 53 push %ebx + 2305: 83 ec 14 sub $0x14,%esp int fd, i, total, cc; printf(1, "bigfile test\n"); - 236c: 68 28 47 00 00 push $0x4728 - 2371: 6a 01 push $0x1 - 2373: e8 ea 15 00 00 call 3962 + 2308: 68 50 46 00 00 push $0x4650 + 230d: 6a 01 push $0x1 + 230f: e8 97 15 00 00 call 38ab unlink("bigfile"); - 2378: c7 04 24 44 47 00 00 movl $0x4744,(%esp) - 237f: e8 ea 14 00 00 call 386e + 2314: c7 04 24 6c 46 00 00 movl $0x466c,(%esp) + 231b: e8 93 14 00 00 call 37b3 fd = open("bigfile", O_CREATE | O_RDWR); - 2384: 83 c4 08 add $0x8,%esp - 2387: 68 02 02 00 00 push $0x202 - 238c: 68 44 47 00 00 push $0x4744 - 2391: e8 c8 14 00 00 call 385e + 2320: 83 c4 08 add $0x8,%esp + 2323: 68 02 02 00 00 push $0x202 + 2328: 68 6c 46 00 00 push $0x466c + 232d: e8 71 14 00 00 call 37a3 if(fd < 0){ - 2396: 83 c4 10 add $0x10,%esp - 2399: 85 c0 test %eax,%eax - 239b: 0f 88 c3 00 00 00 js 2464 - 23a1: 89 c6 mov %eax,%esi + 2332: 83 c4 10 add $0x10,%esp + 2335: 85 c0 test %eax,%eax + 2337: 0f 88 c3 00 00 00 js 2400 + 233d: 89 c6 mov %eax,%esi printf(1, "cannot create bigfile"); exit(); } for(i = 0; i < 20; i++){ - 23a3: bb 00 00 00 00 mov $0x0,%ebx + 233f: bb 00 00 00 00 mov $0x0,%ebx memset(buf, i, 600); - 23a8: 83 ec 04 sub $0x4,%esp - 23ab: 68 58 02 00 00 push $0x258 - 23b0: 53 push %ebx - 23b1: 68 80 84 00 00 push $0x8480 - 23b6: e8 fc 12 00 00 call 36b7 + 2344: 83 ec 04 sub $0x4,%esp + 2347: 68 58 02 00 00 push $0x258 + 234c: 53 push %ebx + 234d: 68 60 83 00 00 push $0x8360 + 2352: e8 b9 12 00 00 call 3610 if(write(fd, buf, 600) != 600){ - 23bb: 83 c4 0c add $0xc,%esp - 23be: 68 58 02 00 00 push $0x258 - 23c3: 68 80 84 00 00 push $0x8480 - 23c8: 56 push %esi - 23c9: e8 70 14 00 00 call 383e - 23ce: 83 c4 10 add $0x10,%esp - 23d1: 3d 58 02 00 00 cmp $0x258,%eax - 23d6: 0f 85 9c 00 00 00 jne 2478 + 2357: 83 c4 0c add $0xc,%esp + 235a: 68 58 02 00 00 push $0x258 + 235f: 68 60 83 00 00 push $0x8360 + 2364: 56 push %esi + 2365: e8 19 14 00 00 call 3783 + 236a: 83 c4 10 add $0x10,%esp + 236d: 3d 58 02 00 00 cmp $0x258,%eax + 2372: 0f 85 9c 00 00 00 jne 2414 for(i = 0; i < 20; i++){ - 23dc: 83 c3 01 add $0x1,%ebx - 23df: 83 fb 14 cmp $0x14,%ebx - 23e2: 75 c4 jne 23a8 + 2378: 83 c3 01 add $0x1,%ebx + 237b: 83 fb 14 cmp $0x14,%ebx + 237e: 75 c4 jne 2344 printf(1, "write bigfile failed\n"); exit(); } } close(fd); - 23e4: 83 ec 0c sub $0xc,%esp - 23e7: 56 push %esi - 23e8: e8 59 14 00 00 call 3846 + 2380: 83 ec 0c sub $0xc,%esp + 2383: 56 push %esi + 2384: e8 02 14 00 00 call 378b fd = open("bigfile", 0); - 23ed: 83 c4 08 add $0x8,%esp - 23f0: 6a 00 push $0x0 - 23f2: 68 44 47 00 00 push $0x4744 - 23f7: e8 62 14 00 00 call 385e - 23fc: 89 c7 mov %eax,%edi + 2389: 83 c4 08 add $0x8,%esp + 238c: 6a 00 push $0x0 + 238e: 68 6c 46 00 00 push $0x466c + 2393: e8 0b 14 00 00 call 37a3 + 2398: 89 c7 mov %eax,%edi if(fd < 0){ - 23fe: 83 c4 10 add $0x10,%esp - 2401: 85 c0 test %eax,%eax - 2403: 0f 88 83 00 00 00 js 248c + 239a: 83 c4 10 add $0x10,%esp + 239d: 85 c0 test %eax,%eax + 239f: 0f 88 83 00 00 00 js 2428 printf(1, "cannot open bigfile\n"); exit(); } total = 0; - 2409: be 00 00 00 00 mov $0x0,%esi + 23a5: be 00 00 00 00 mov $0x0,%esi for(i = 0; ; i++){ - 240e: bb 00 00 00 00 mov $0x0,%ebx + 23aa: bb 00 00 00 00 mov $0x0,%ebx cc = read(fd, buf, 300); - 2413: 83 ec 04 sub $0x4,%esp - 2416: 68 2c 01 00 00 push $0x12c - 241b: 68 80 84 00 00 push $0x8480 - 2420: 57 push %edi - 2421: e8 10 14 00 00 call 3836 + 23af: 83 ec 04 sub $0x4,%esp + 23b2: 68 2c 01 00 00 push $0x12c + 23b7: 68 60 83 00 00 push $0x8360 + 23bc: 57 push %edi + 23bd: e8 b9 13 00 00 call 377b if(cc < 0){ - 2426: 83 c4 10 add $0x10,%esp - 2429: 85 c0 test %eax,%eax - 242b: 78 73 js 24a0 + 23c2: 83 c4 10 add $0x10,%esp + 23c5: 85 c0 test %eax,%eax + 23c7: 78 73 js 243c printf(1, "read bigfile failed\n"); exit(); } if(cc == 0) - 242d: 0f 84 a9 00 00 00 je 24dc + 23c9: 0f 84 a9 00 00 00 je 2478 break; if(cc != 300){ - 2433: 3d 2c 01 00 00 cmp $0x12c,%eax - 2438: 75 7a jne 24b4 + 23cf: 3d 2c 01 00 00 cmp $0x12c,%eax + 23d4: 75 7a jne 2450 printf(1, "short read bigfile\n"); exit(); } if(buf[0] != i/2 || buf[299] != i/2){ - 243a: 89 d8 mov %ebx,%eax - 243c: c1 e8 1f shr $0x1f,%eax - 243f: 01 d8 add %ebx,%eax - 2441: d1 f8 sar %eax - 2443: 0f be 15 80 84 00 00 movsbl 0x8480,%edx - 244a: 39 c2 cmp %eax,%edx - 244c: 75 7a jne 24c8 - 244e: 0f be 15 ab 85 00 00 movsbl 0x85ab,%edx - 2455: 39 d0 cmp %edx,%eax - 2457: 75 6f jne 24c8 + 23d6: 89 d8 mov %ebx,%eax + 23d8: c1 e8 1f shr $0x1f,%eax + 23db: 01 d8 add %ebx,%eax + 23dd: d1 f8 sar %eax + 23df: 0f be 15 60 83 00 00 movsbl 0x8360,%edx + 23e6: 39 c2 cmp %eax,%edx + 23e8: 75 7a jne 2464 + 23ea: 0f be 15 8b 84 00 00 movsbl 0x848b,%edx + 23f1: 39 d0 cmp %edx,%eax + 23f3: 75 6f jne 2464 printf(1, "read bigfile wrong data\n"); exit(); } total += cc; - 2459: 81 c6 2c 01 00 00 add $0x12c,%esi + 23f5: 81 c6 2c 01 00 00 add $0x12c,%esi for(i = 0; ; i++){ - 245f: 83 c3 01 add $0x1,%ebx + 23fb: 83 c3 01 add $0x1,%ebx cc = read(fd, buf, 300); - 2462: eb af jmp 2413 + 23fe: eb af jmp 23af printf(1, "cannot create bigfile"); - 2464: 83 ec 08 sub $0x8,%esp - 2467: 68 36 47 00 00 push $0x4736 - 246c: 6a 01 push $0x1 - 246e: e8 ef 14 00 00 call 3962 + 2400: 83 ec 08 sub $0x8,%esp + 2403: 68 5e 46 00 00 push $0x465e + 2408: 6a 01 push $0x1 + 240a: e8 9c 14 00 00 call 38ab exit(); - 2473: e8 a6 13 00 00 call 381e + 240f: e8 4f 13 00 00 call 3763 printf(1, "write bigfile failed\n"); - 2478: 83 ec 08 sub $0x8,%esp - 247b: 68 4c 47 00 00 push $0x474c - 2480: 6a 01 push $0x1 - 2482: e8 db 14 00 00 call 3962 + 2414: 83 ec 08 sub $0x8,%esp + 2417: 68 74 46 00 00 push $0x4674 + 241c: 6a 01 push $0x1 + 241e: e8 88 14 00 00 call 38ab exit(); - 2487: e8 92 13 00 00 call 381e + 2423: e8 3b 13 00 00 call 3763 printf(1, "cannot open bigfile\n"); - 248c: 83 ec 08 sub $0x8,%esp - 248f: 68 62 47 00 00 push $0x4762 - 2494: 6a 01 push $0x1 - 2496: e8 c7 14 00 00 call 3962 + 2428: 83 ec 08 sub $0x8,%esp + 242b: 68 8a 46 00 00 push $0x468a + 2430: 6a 01 push $0x1 + 2432: e8 74 14 00 00 call 38ab exit(); - 249b: e8 7e 13 00 00 call 381e + 2437: e8 27 13 00 00 call 3763 printf(1, "read bigfile failed\n"); - 24a0: 83 ec 08 sub $0x8,%esp - 24a3: 68 77 47 00 00 push $0x4777 - 24a8: 6a 01 push $0x1 - 24aa: e8 b3 14 00 00 call 3962 + 243c: 83 ec 08 sub $0x8,%esp + 243f: 68 9f 46 00 00 push $0x469f + 2444: 6a 01 push $0x1 + 2446: e8 60 14 00 00 call 38ab exit(); - 24af: e8 6a 13 00 00 call 381e + 244b: e8 13 13 00 00 call 3763 printf(1, "short read bigfile\n"); - 24b4: 83 ec 08 sub $0x8,%esp - 24b7: 68 8c 47 00 00 push $0x478c - 24bc: 6a 01 push $0x1 - 24be: e8 9f 14 00 00 call 3962 + 2450: 83 ec 08 sub $0x8,%esp + 2453: 68 b4 46 00 00 push $0x46b4 + 2458: 6a 01 push $0x1 + 245a: e8 4c 14 00 00 call 38ab exit(); - 24c3: e8 56 13 00 00 call 381e + 245f: e8 ff 12 00 00 call 3763 printf(1, "read bigfile wrong data\n"); - 24c8: 83 ec 08 sub $0x8,%esp - 24cb: 68 a0 47 00 00 push $0x47a0 - 24d0: 6a 01 push $0x1 - 24d2: e8 8b 14 00 00 call 3962 + 2464: 83 ec 08 sub $0x8,%esp + 2467: 68 c8 46 00 00 push $0x46c8 + 246c: 6a 01 push $0x1 + 246e: e8 38 14 00 00 call 38ab exit(); - 24d7: e8 42 13 00 00 call 381e + 2473: e8 eb 12 00 00 call 3763 } close(fd); - 24dc: 83 ec 0c sub $0xc,%esp - 24df: 57 push %edi - 24e0: e8 61 13 00 00 call 3846 + 2478: 83 ec 0c sub $0xc,%esp + 247b: 57 push %edi + 247c: e8 0a 13 00 00 call 378b if(total != 20*600){ - 24e5: 83 c4 10 add $0x10,%esp - 24e8: 81 fe e0 2e 00 00 cmp $0x2ee0,%esi - 24ee: 75 27 jne 2517 + 2481: 83 c4 10 add $0x10,%esp + 2484: 81 fe e0 2e 00 00 cmp $0x2ee0,%esi + 248a: 75 27 jne 24b3 printf(1, "read bigfile wrong total\n"); exit(); } unlink("bigfile"); - 24f0: 83 ec 0c sub $0xc,%esp - 24f3: 68 44 47 00 00 push $0x4744 - 24f8: e8 71 13 00 00 call 386e + 248c: 83 ec 0c sub $0xc,%esp + 248f: 68 6c 46 00 00 push $0x466c + 2494: e8 1a 13 00 00 call 37b3 printf(1, "bigfile test ok\n"); - 24fd: 83 c4 08 add $0x8,%esp - 2500: 68 d3 47 00 00 push $0x47d3 - 2505: 6a 01 push $0x1 - 2507: e8 56 14 00 00 call 3962 + 2499: 83 c4 08 add $0x8,%esp + 249c: 68 fb 46 00 00 push $0x46fb + 24a1: 6a 01 push $0x1 + 24a3: e8 03 14 00 00 call 38ab } - 250c: 83 c4 10 add $0x10,%esp - 250f: 8d 65 f4 lea -0xc(%ebp),%esp - 2512: 5b pop %ebx - 2513: 5e pop %esi - 2514: 5f pop %edi - 2515: 5d pop %ebp - 2516: c3 ret + 24a8: 83 c4 10 add $0x10,%esp + 24ab: 8d 65 f4 lea -0xc(%ebp),%esp + 24ae: 5b pop %ebx + 24af: 5e pop %esi + 24b0: 5f pop %edi + 24b1: 5d pop %ebp + 24b2: c3 ret printf(1, "read bigfile wrong total\n"); - 2517: 83 ec 08 sub $0x8,%esp - 251a: 68 b9 47 00 00 push $0x47b9 - 251f: 6a 01 push $0x1 - 2521: e8 3c 14 00 00 call 3962 + 24b3: 83 ec 08 sub $0x8,%esp + 24b6: 68 e1 46 00 00 push $0x46e1 + 24bb: 6a 01 push $0x1 + 24bd: e8 e9 13 00 00 call 38ab exit(); - 2526: e8 f3 12 00 00 call 381e + 24c2: e8 9c 12 00 00 call 3763 -0000252b : +000024c7 : void fourteen(void) { - 252b: f3 0f 1e fb endbr32 - 252f: 55 push %ebp - 2530: 89 e5 mov %esp,%ebp - 2532: 83 ec 10 sub $0x10,%esp + 24c7: 55 push %ebp + 24c8: 89 e5 mov %esp,%ebp + 24ca: 83 ec 10 sub $0x10,%esp int fd; // DIRSIZ is 14. printf(1, "fourteen test\n"); - 2535: 68 e4 47 00 00 push $0x47e4 - 253a: 6a 01 push $0x1 - 253c: e8 21 14 00 00 call 3962 + 24cd: 68 0c 47 00 00 push $0x470c + 24d2: 6a 01 push $0x1 + 24d4: e8 d2 13 00 00 call 38ab if(mkdir("12345678901234") != 0){ - 2541: c7 04 24 1f 48 00 00 movl $0x481f,(%esp) - 2548: e8 39 13 00 00 call 3886 - 254d: 83 c4 10 add $0x10,%esp - 2550: 85 c0 test %eax,%eax - 2552: 0f 85 9c 00 00 00 jne 25f4 + 24d9: c7 04 24 47 47 00 00 movl $0x4747,(%esp) + 24e0: e8 e6 12 00 00 call 37cb + 24e5: 83 c4 10 add $0x10,%esp + 24e8: 85 c0 test %eax,%eax + 24ea: 0f 85 9c 00 00 00 jne 258c printf(1, "mkdir 12345678901234 failed\n"); exit(); } if(mkdir("12345678901234/123456789012345") != 0){ - 2558: 83 ec 0c sub $0xc,%esp - 255b: 68 dc 4f 00 00 push $0x4fdc - 2560: e8 21 13 00 00 call 3886 - 2565: 83 c4 10 add $0x10,%esp - 2568: 85 c0 test %eax,%eax - 256a: 0f 85 98 00 00 00 jne 2608 + 24f0: 83 ec 0c sub $0xc,%esp + 24f3: 68 04 4f 00 00 push $0x4f04 + 24f8: e8 ce 12 00 00 call 37cb + 24fd: 83 c4 10 add $0x10,%esp + 2500: 85 c0 test %eax,%eax + 2502: 0f 85 98 00 00 00 jne 25a0 printf(1, "mkdir 12345678901234/123456789012345 failed\n"); exit(); } fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); - 2570: 83 ec 08 sub $0x8,%esp - 2573: 68 00 02 00 00 push $0x200 - 2578: 68 2c 50 00 00 push $0x502c - 257d: e8 dc 12 00 00 call 385e + 2508: 83 ec 08 sub $0x8,%esp + 250b: 68 00 02 00 00 push $0x200 + 2510: 68 54 4f 00 00 push $0x4f54 + 2515: e8 89 12 00 00 call 37a3 if(fd < 0){ - 2582: 83 c4 10 add $0x10,%esp - 2585: 85 c0 test %eax,%eax - 2587: 0f 88 8f 00 00 00 js 261c + 251a: 83 c4 10 add $0x10,%esp + 251d: 85 c0 test %eax,%eax + 251f: 0f 88 8f 00 00 00 js 25b4 printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); exit(); } close(fd); - 258d: 83 ec 0c sub $0xc,%esp - 2590: 50 push %eax - 2591: e8 b0 12 00 00 call 3846 + 2525: 83 ec 0c sub $0xc,%esp + 2528: 50 push %eax + 2529: e8 5d 12 00 00 call 378b fd = open("12345678901234/12345678901234/12345678901234", 0); - 2596: 83 c4 08 add $0x8,%esp - 2599: 6a 00 push $0x0 - 259b: 68 9c 50 00 00 push $0x509c - 25a0: e8 b9 12 00 00 call 385e + 252e: 83 c4 08 add $0x8,%esp + 2531: 6a 00 push $0x0 + 2533: 68 c4 4f 00 00 push $0x4fc4 + 2538: e8 66 12 00 00 call 37a3 if(fd < 0){ - 25a5: 83 c4 10 add $0x10,%esp - 25a8: 85 c0 test %eax,%eax - 25aa: 0f 88 80 00 00 00 js 2630 + 253d: 83 c4 10 add $0x10,%esp + 2540: 85 c0 test %eax,%eax + 2542: 0f 88 80 00 00 00 js 25c8 printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); exit(); } close(fd); - 25b0: 83 ec 0c sub $0xc,%esp - 25b3: 50 push %eax - 25b4: e8 8d 12 00 00 call 3846 + 2548: 83 ec 0c sub $0xc,%esp + 254b: 50 push %eax + 254c: e8 3a 12 00 00 call 378b if(mkdir("12345678901234/12345678901234") == 0){ - 25b9: c7 04 24 10 48 00 00 movl $0x4810,(%esp) - 25c0: e8 c1 12 00 00 call 3886 - 25c5: 83 c4 10 add $0x10,%esp - 25c8: 85 c0 test %eax,%eax - 25ca: 74 78 je 2644 + 2551: c7 04 24 38 47 00 00 movl $0x4738,(%esp) + 2558: e8 6e 12 00 00 call 37cb + 255d: 83 c4 10 add $0x10,%esp + 2560: 85 c0 test %eax,%eax + 2562: 74 78 je 25dc printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); exit(); } if(mkdir("123456789012345/12345678901234") == 0){ - 25cc: 83 ec 0c sub $0xc,%esp - 25cf: 68 38 51 00 00 push $0x5138 - 25d4: e8 ad 12 00 00 call 3886 - 25d9: 83 c4 10 add $0x10,%esp - 25dc: 85 c0 test %eax,%eax - 25de: 74 78 je 2658 + 2564: 83 ec 0c sub $0xc,%esp + 2567: 68 60 50 00 00 push $0x5060 + 256c: e8 5a 12 00 00 call 37cb + 2571: 83 c4 10 add $0x10,%esp + 2574: 85 c0 test %eax,%eax + 2576: 74 78 je 25f0 printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); exit(); } printf(1, "fourteen ok\n"); - 25e0: 83 ec 08 sub $0x8,%esp - 25e3: 68 2e 48 00 00 push $0x482e - 25e8: 6a 01 push $0x1 - 25ea: e8 73 13 00 00 call 3962 + 2578: 83 ec 08 sub $0x8,%esp + 257b: 68 56 47 00 00 push $0x4756 + 2580: 6a 01 push $0x1 + 2582: e8 24 13 00 00 call 38ab } - 25ef: 83 c4 10 add $0x10,%esp - 25f2: c9 leave - 25f3: c3 ret + 2587: 83 c4 10 add $0x10,%esp + 258a: c9 leave + 258b: c3 ret printf(1, "mkdir 12345678901234 failed\n"); - 25f4: 83 ec 08 sub $0x8,%esp - 25f7: 68 f3 47 00 00 push $0x47f3 - 25fc: 6a 01 push $0x1 - 25fe: e8 5f 13 00 00 call 3962 + 258c: 83 ec 08 sub $0x8,%esp + 258f: 68 1b 47 00 00 push $0x471b + 2594: 6a 01 push $0x1 + 2596: e8 10 13 00 00 call 38ab exit(); - 2603: e8 16 12 00 00 call 381e + 259b: e8 c3 11 00 00 call 3763 printf(1, "mkdir 12345678901234/123456789012345 failed\n"); - 2608: 83 ec 08 sub $0x8,%esp - 260b: 68 fc 4f 00 00 push $0x4ffc - 2610: 6a 01 push $0x1 - 2612: e8 4b 13 00 00 call 3962 + 25a0: 83 ec 08 sub $0x8,%esp + 25a3: 68 24 4f 00 00 push $0x4f24 + 25a8: 6a 01 push $0x1 + 25aa: e8 fc 12 00 00 call 38ab exit(); - 2617: e8 02 12 00 00 call 381e + 25af: e8 af 11 00 00 call 3763 printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); - 261c: 83 ec 08 sub $0x8,%esp - 261f: 68 5c 50 00 00 push $0x505c - 2624: 6a 01 push $0x1 - 2626: e8 37 13 00 00 call 3962 + 25b4: 83 ec 08 sub $0x8,%esp + 25b7: 68 84 4f 00 00 push $0x4f84 + 25bc: 6a 01 push $0x1 + 25be: e8 e8 12 00 00 call 38ab exit(); - 262b: e8 ee 11 00 00 call 381e + 25c3: e8 9b 11 00 00 call 3763 printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); - 2630: 83 ec 08 sub $0x8,%esp - 2633: 68 cc 50 00 00 push $0x50cc - 2638: 6a 01 push $0x1 - 263a: e8 23 13 00 00 call 3962 + 25c8: 83 ec 08 sub $0x8,%esp + 25cb: 68 f4 4f 00 00 push $0x4ff4 + 25d0: 6a 01 push $0x1 + 25d2: e8 d4 12 00 00 call 38ab exit(); - 263f: e8 da 11 00 00 call 381e + 25d7: e8 87 11 00 00 call 3763 printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); - 2644: 83 ec 08 sub $0x8,%esp - 2647: 68 08 51 00 00 push $0x5108 - 264c: 6a 01 push $0x1 - 264e: e8 0f 13 00 00 call 3962 + 25dc: 83 ec 08 sub $0x8,%esp + 25df: 68 30 50 00 00 push $0x5030 + 25e4: 6a 01 push $0x1 + 25e6: e8 c0 12 00 00 call 38ab exit(); - 2653: e8 c6 11 00 00 call 381e + 25eb: e8 73 11 00 00 call 3763 printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); - 2658: 83 ec 08 sub $0x8,%esp - 265b: 68 58 51 00 00 push $0x5158 - 2660: 6a 01 push $0x1 - 2662: e8 fb 12 00 00 call 3962 + 25f0: 83 ec 08 sub $0x8,%esp + 25f3: 68 80 50 00 00 push $0x5080 + 25f8: 6a 01 push $0x1 + 25fa: e8 ac 12 00 00 call 38ab exit(); - 2667: e8 b2 11 00 00 call 381e + 25ff: e8 5f 11 00 00 call 3763 -0000266c : +00002604 : void rmdot(void) { - 266c: f3 0f 1e fb endbr32 - 2670: 55 push %ebp - 2671: 89 e5 mov %esp,%ebp - 2673: 83 ec 10 sub $0x10,%esp + 2604: 55 push %ebp + 2605: 89 e5 mov %esp,%ebp + 2607: 83 ec 10 sub $0x10,%esp printf(1, "rmdot test\n"); - 2676: 68 3b 48 00 00 push $0x483b - 267b: 6a 01 push $0x1 - 267d: e8 e0 12 00 00 call 3962 + 260a: 68 63 47 00 00 push $0x4763 + 260f: 6a 01 push $0x1 + 2611: e8 95 12 00 00 call 38ab if(mkdir("dots") != 0){ - 2682: c7 04 24 47 48 00 00 movl $0x4847,(%esp) - 2689: e8 f8 11 00 00 call 3886 - 268e: 83 c4 10 add $0x10,%esp - 2691: 85 c0 test %eax,%eax - 2693: 0f 85 bc 00 00 00 jne 2755 + 2616: c7 04 24 6f 47 00 00 movl $0x476f,(%esp) + 261d: e8 a9 11 00 00 call 37cb + 2622: 83 c4 10 add $0x10,%esp + 2625: 85 c0 test %eax,%eax + 2627: 0f 85 bc 00 00 00 jne 26e9 printf(1, "mkdir dots failed\n"); exit(); } if(chdir("dots") != 0){ - 2699: 83 ec 0c sub $0xc,%esp - 269c: 68 47 48 00 00 push $0x4847 - 26a1: e8 e8 11 00 00 call 388e - 26a6: 83 c4 10 add $0x10,%esp - 26a9: 85 c0 test %eax,%eax - 26ab: 0f 85 b8 00 00 00 jne 2769 + 262d: 83 ec 0c sub $0xc,%esp + 2630: 68 6f 47 00 00 push $0x476f + 2635: e8 99 11 00 00 call 37d3 + 263a: 83 c4 10 add $0x10,%esp + 263d: 85 c0 test %eax,%eax + 263f: 0f 85 b8 00 00 00 jne 26fd printf(1, "chdir dots failed\n"); exit(); } if(unlink(".") == 0){ - 26b1: 83 ec 0c sub $0xc,%esp - 26b4: 68 f2 44 00 00 push $0x44f2 - 26b9: e8 b0 11 00 00 call 386e - 26be: 83 c4 10 add $0x10,%esp - 26c1: 85 c0 test %eax,%eax - 26c3: 0f 84 b4 00 00 00 je 277d + 2645: 83 ec 0c sub $0xc,%esp + 2648: 68 1a 44 00 00 push $0x441a + 264d: e8 61 11 00 00 call 37b3 + 2652: 83 c4 10 add $0x10,%esp + 2655: 85 c0 test %eax,%eax + 2657: 0f 84 b4 00 00 00 je 2711 printf(1, "rm . worked!\n"); exit(); } if(unlink("..") == 0){ - 26c9: 83 ec 0c sub $0xc,%esp - 26cc: 68 f1 44 00 00 push $0x44f1 - 26d1: e8 98 11 00 00 call 386e - 26d6: 83 c4 10 add $0x10,%esp - 26d9: 85 c0 test %eax,%eax - 26db: 0f 84 b0 00 00 00 je 2791 + 265d: 83 ec 0c sub $0xc,%esp + 2660: 68 19 44 00 00 push $0x4419 + 2665: e8 49 11 00 00 call 37b3 + 266a: 83 c4 10 add $0x10,%esp + 266d: 85 c0 test %eax,%eax + 266f: 0f 84 b0 00 00 00 je 2725 printf(1, "rm .. worked!\n"); exit(); } if(chdir("/") != 0){ - 26e1: 83 ec 0c sub $0xc,%esp - 26e4: 68 c5 3c 00 00 push $0x3cc5 - 26e9: e8 a0 11 00 00 call 388e - 26ee: 83 c4 10 add $0x10,%esp - 26f1: 85 c0 test %eax,%eax - 26f3: 0f 85 ac 00 00 00 jne 27a5 + 2675: 83 ec 0c sub $0xc,%esp + 2678: 68 ed 3b 00 00 push $0x3bed + 267d: e8 51 11 00 00 call 37d3 + 2682: 83 c4 10 add $0x10,%esp + 2685: 85 c0 test %eax,%eax + 2687: 0f 85 ac 00 00 00 jne 2739 printf(1, "chdir / failed\n"); exit(); } if(unlink("dots/.") == 0){ - 26f9: 83 ec 0c sub $0xc,%esp - 26fc: 68 8f 48 00 00 push $0x488f - 2701: e8 68 11 00 00 call 386e - 2706: 83 c4 10 add $0x10,%esp - 2709: 85 c0 test %eax,%eax - 270b: 0f 84 a8 00 00 00 je 27b9 + 268d: 83 ec 0c sub $0xc,%esp + 2690: 68 b7 47 00 00 push $0x47b7 + 2695: e8 19 11 00 00 call 37b3 + 269a: 83 c4 10 add $0x10,%esp + 269d: 85 c0 test %eax,%eax + 269f: 0f 84 a8 00 00 00 je 274d printf(1, "unlink dots/. worked!\n"); exit(); } if(unlink("dots/..") == 0){ - 2711: 83 ec 0c sub $0xc,%esp - 2714: 68 ad 48 00 00 push $0x48ad - 2719: e8 50 11 00 00 call 386e - 271e: 83 c4 10 add $0x10,%esp - 2721: 85 c0 test %eax,%eax - 2723: 0f 84 a4 00 00 00 je 27cd + 26a5: 83 ec 0c sub $0xc,%esp + 26a8: 68 d5 47 00 00 push $0x47d5 + 26ad: e8 01 11 00 00 call 37b3 + 26b2: 83 c4 10 add $0x10,%esp + 26b5: 85 c0 test %eax,%eax + 26b7: 0f 84 a4 00 00 00 je 2761 printf(1, "unlink dots/.. worked!\n"); exit(); } if(unlink("dots") != 0){ - 2729: 83 ec 0c sub $0xc,%esp - 272c: 68 47 48 00 00 push $0x4847 - 2731: e8 38 11 00 00 call 386e - 2736: 83 c4 10 add $0x10,%esp - 2739: 85 c0 test %eax,%eax - 273b: 0f 85 a0 00 00 00 jne 27e1 + 26bd: 83 ec 0c sub $0xc,%esp + 26c0: 68 6f 47 00 00 push $0x476f + 26c5: e8 e9 10 00 00 call 37b3 + 26ca: 83 c4 10 add $0x10,%esp + 26cd: 85 c0 test %eax,%eax + 26cf: 0f 85 a0 00 00 00 jne 2775 printf(1, "unlink dots failed!\n"); exit(); } printf(1, "rmdot ok\n"); - 2741: 83 ec 08 sub $0x8,%esp - 2744: 68 e2 48 00 00 push $0x48e2 - 2749: 6a 01 push $0x1 - 274b: e8 12 12 00 00 call 3962 + 26d5: 83 ec 08 sub $0x8,%esp + 26d8: 68 0a 48 00 00 push $0x480a + 26dd: 6a 01 push $0x1 + 26df: e8 c7 11 00 00 call 38ab } - 2750: 83 c4 10 add $0x10,%esp - 2753: c9 leave - 2754: c3 ret + 26e4: 83 c4 10 add $0x10,%esp + 26e7: c9 leave + 26e8: c3 ret printf(1, "mkdir dots failed\n"); - 2755: 83 ec 08 sub $0x8,%esp - 2758: 68 4c 48 00 00 push $0x484c - 275d: 6a 01 push $0x1 - 275f: e8 fe 11 00 00 call 3962 + 26e9: 83 ec 08 sub $0x8,%esp + 26ec: 68 74 47 00 00 push $0x4774 + 26f1: 6a 01 push $0x1 + 26f3: e8 b3 11 00 00 call 38ab exit(); - 2764: e8 b5 10 00 00 call 381e + 26f8: e8 66 10 00 00 call 3763 printf(1, "chdir dots failed\n"); - 2769: 83 ec 08 sub $0x8,%esp - 276c: 68 5f 48 00 00 push $0x485f - 2771: 6a 01 push $0x1 - 2773: e8 ea 11 00 00 call 3962 + 26fd: 83 ec 08 sub $0x8,%esp + 2700: 68 87 47 00 00 push $0x4787 + 2705: 6a 01 push $0x1 + 2707: e8 9f 11 00 00 call 38ab exit(); - 2778: e8 a1 10 00 00 call 381e + 270c: e8 52 10 00 00 call 3763 printf(1, "rm . worked!\n"); - 277d: 83 ec 08 sub $0x8,%esp - 2780: 68 72 48 00 00 push $0x4872 - 2785: 6a 01 push $0x1 - 2787: e8 d6 11 00 00 call 3962 + 2711: 83 ec 08 sub $0x8,%esp + 2714: 68 9a 47 00 00 push $0x479a + 2719: 6a 01 push $0x1 + 271b: e8 8b 11 00 00 call 38ab exit(); - 278c: e8 8d 10 00 00 call 381e + 2720: e8 3e 10 00 00 call 3763 printf(1, "rm .. worked!\n"); - 2791: 83 ec 08 sub $0x8,%esp - 2794: 68 80 48 00 00 push $0x4880 - 2799: 6a 01 push $0x1 - 279b: e8 c2 11 00 00 call 3962 + 2725: 83 ec 08 sub $0x8,%esp + 2728: 68 a8 47 00 00 push $0x47a8 + 272d: 6a 01 push $0x1 + 272f: e8 77 11 00 00 call 38ab exit(); - 27a0: e8 79 10 00 00 call 381e + 2734: e8 2a 10 00 00 call 3763 printf(1, "chdir / failed\n"); - 27a5: 83 ec 08 sub $0x8,%esp - 27a8: 68 c7 3c 00 00 push $0x3cc7 - 27ad: 6a 01 push $0x1 - 27af: e8 ae 11 00 00 call 3962 + 2739: 83 ec 08 sub $0x8,%esp + 273c: 68 ef 3b 00 00 push $0x3bef + 2741: 6a 01 push $0x1 + 2743: e8 63 11 00 00 call 38ab exit(); - 27b4: e8 65 10 00 00 call 381e + 2748: e8 16 10 00 00 call 3763 printf(1, "unlink dots/. worked!\n"); - 27b9: 83 ec 08 sub $0x8,%esp - 27bc: 68 96 48 00 00 push $0x4896 - 27c1: 6a 01 push $0x1 - 27c3: e8 9a 11 00 00 call 3962 + 274d: 83 ec 08 sub $0x8,%esp + 2750: 68 be 47 00 00 push $0x47be + 2755: 6a 01 push $0x1 + 2757: e8 4f 11 00 00 call 38ab exit(); - 27c8: e8 51 10 00 00 call 381e + 275c: e8 02 10 00 00 call 3763 printf(1, "unlink dots/.. worked!\n"); - 27cd: 83 ec 08 sub $0x8,%esp - 27d0: 68 b5 48 00 00 push $0x48b5 - 27d5: 6a 01 push $0x1 - 27d7: e8 86 11 00 00 call 3962 + 2761: 83 ec 08 sub $0x8,%esp + 2764: 68 dd 47 00 00 push $0x47dd + 2769: 6a 01 push $0x1 + 276b: e8 3b 11 00 00 call 38ab exit(); - 27dc: e8 3d 10 00 00 call 381e + 2770: e8 ee 0f 00 00 call 3763 printf(1, "unlink dots failed!\n"); - 27e1: 83 ec 08 sub $0x8,%esp - 27e4: 68 cd 48 00 00 push $0x48cd - 27e9: 6a 01 push $0x1 - 27eb: e8 72 11 00 00 call 3962 + 2775: 83 ec 08 sub $0x8,%esp + 2778: 68 f5 47 00 00 push $0x47f5 + 277d: 6a 01 push $0x1 + 277f: e8 27 11 00 00 call 38ab exit(); - 27f0: e8 29 10 00 00 call 381e + 2784: e8 da 0f 00 00 call 3763 -000027f5 : +00002789 : void dirfile(void) { - 27f5: f3 0f 1e fb endbr32 - 27f9: 55 push %ebp - 27fa: 89 e5 mov %esp,%ebp - 27fc: 53 push %ebx - 27fd: 83 ec 0c sub $0xc,%esp + 2789: 55 push %ebp + 278a: 89 e5 mov %esp,%ebp + 278c: 53 push %ebx + 278d: 83 ec 0c sub $0xc,%esp int fd; printf(1, "dir vs file\n"); - 2800: 68 ec 48 00 00 push $0x48ec - 2805: 6a 01 push $0x1 - 2807: e8 56 11 00 00 call 3962 + 2790: 68 14 48 00 00 push $0x4814 + 2795: 6a 01 push $0x1 + 2797: e8 0f 11 00 00 call 38ab fd = open("dirfile", O_CREATE); - 280c: 83 c4 08 add $0x8,%esp - 280f: 68 00 02 00 00 push $0x200 - 2814: 68 f9 48 00 00 push $0x48f9 - 2819: e8 40 10 00 00 call 385e + 279c: 83 c4 08 add $0x8,%esp + 279f: 68 00 02 00 00 push $0x200 + 27a4: 68 21 48 00 00 push $0x4821 + 27a9: e8 f5 0f 00 00 call 37a3 if(fd < 0){ - 281e: 83 c4 10 add $0x10,%esp - 2821: 85 c0 test %eax,%eax - 2823: 0f 88 22 01 00 00 js 294b + 27ae: 83 c4 10 add $0x10,%esp + 27b1: 85 c0 test %eax,%eax + 27b3: 0f 88 22 01 00 00 js 28db printf(1, "create dirfile failed\n"); exit(); } close(fd); - 2829: 83 ec 0c sub $0xc,%esp - 282c: 50 push %eax - 282d: e8 14 10 00 00 call 3846 + 27b9: 83 ec 0c sub $0xc,%esp + 27bc: 50 push %eax + 27bd: e8 c9 0f 00 00 call 378b if(chdir("dirfile") == 0){ - 2832: c7 04 24 f9 48 00 00 movl $0x48f9,(%esp) - 2839: e8 50 10 00 00 call 388e - 283e: 83 c4 10 add $0x10,%esp - 2841: 85 c0 test %eax,%eax - 2843: 0f 84 16 01 00 00 je 295f + 27c2: c7 04 24 21 48 00 00 movl $0x4821,(%esp) + 27c9: e8 05 10 00 00 call 37d3 + 27ce: 83 c4 10 add $0x10,%esp + 27d1: 85 c0 test %eax,%eax + 27d3: 0f 84 16 01 00 00 je 28ef printf(1, "chdir dirfile succeeded!\n"); exit(); } fd = open("dirfile/xx", 0); - 2849: 83 ec 08 sub $0x8,%esp - 284c: 6a 00 push $0x0 - 284e: 68 32 49 00 00 push $0x4932 - 2853: e8 06 10 00 00 call 385e + 27d9: 83 ec 08 sub $0x8,%esp + 27dc: 6a 00 push $0x0 + 27de: 68 5a 48 00 00 push $0x485a + 27e3: e8 bb 0f 00 00 call 37a3 if(fd >= 0){ - 2858: 83 c4 10 add $0x10,%esp - 285b: 85 c0 test %eax,%eax - 285d: 0f 89 10 01 00 00 jns 2973 + 27e8: 83 c4 10 add $0x10,%esp + 27eb: 85 c0 test %eax,%eax + 27ed: 0f 89 10 01 00 00 jns 2903 printf(1, "create dirfile/xx succeeded!\n"); exit(); } fd = open("dirfile/xx", O_CREATE); - 2863: 83 ec 08 sub $0x8,%esp - 2866: 68 00 02 00 00 push $0x200 - 286b: 68 32 49 00 00 push $0x4932 - 2870: e8 e9 0f 00 00 call 385e + 27f3: 83 ec 08 sub $0x8,%esp + 27f6: 68 00 02 00 00 push $0x200 + 27fb: 68 5a 48 00 00 push $0x485a + 2800: e8 9e 0f 00 00 call 37a3 if(fd >= 0){ - 2875: 83 c4 10 add $0x10,%esp - 2878: 85 c0 test %eax,%eax - 287a: 0f 89 07 01 00 00 jns 2987 + 2805: 83 c4 10 add $0x10,%esp + 2808: 85 c0 test %eax,%eax + 280a: 0f 89 07 01 00 00 jns 2917 printf(1, "create dirfile/xx succeeded!\n"); exit(); } if(mkdir("dirfile/xx") == 0){ - 2880: 83 ec 0c sub $0xc,%esp - 2883: 68 32 49 00 00 push $0x4932 - 2888: e8 f9 0f 00 00 call 3886 - 288d: 83 c4 10 add $0x10,%esp - 2890: 85 c0 test %eax,%eax - 2892: 0f 84 03 01 00 00 je 299b + 2810: 83 ec 0c sub $0xc,%esp + 2813: 68 5a 48 00 00 push $0x485a + 2818: e8 ae 0f 00 00 call 37cb + 281d: 83 c4 10 add $0x10,%esp + 2820: 85 c0 test %eax,%eax + 2822: 0f 84 03 01 00 00 je 292b printf(1, "mkdir dirfile/xx succeeded!\n"); exit(); } if(unlink("dirfile/xx") == 0){ - 2898: 83 ec 0c sub $0xc,%esp - 289b: 68 32 49 00 00 push $0x4932 - 28a0: e8 c9 0f 00 00 call 386e - 28a5: 83 c4 10 add $0x10,%esp - 28a8: 85 c0 test %eax,%eax - 28aa: 0f 84 ff 00 00 00 je 29af + 2828: 83 ec 0c sub $0xc,%esp + 282b: 68 5a 48 00 00 push $0x485a + 2830: e8 7e 0f 00 00 call 37b3 + 2835: 83 c4 10 add $0x10,%esp + 2838: 85 c0 test %eax,%eax + 283a: 0f 84 ff 00 00 00 je 293f printf(1, "unlink dirfile/xx succeeded!\n"); exit(); } if(link("README", "dirfile/xx") == 0){ - 28b0: 83 ec 08 sub $0x8,%esp - 28b3: 68 32 49 00 00 push $0x4932 - 28b8: 68 96 49 00 00 push $0x4996 - 28bd: e8 bc 0f 00 00 call 387e - 28c2: 83 c4 10 add $0x10,%esp - 28c5: 85 c0 test %eax,%eax - 28c7: 0f 84 f6 00 00 00 je 29c3 + 2840: 83 ec 08 sub $0x8,%esp + 2843: 68 5a 48 00 00 push $0x485a + 2848: 68 be 48 00 00 push $0x48be + 284d: e8 71 0f 00 00 call 37c3 + 2852: 83 c4 10 add $0x10,%esp + 2855: 85 c0 test %eax,%eax + 2857: 0f 84 f6 00 00 00 je 2953 printf(1, "link to dirfile/xx succeeded!\n"); exit(); } if(unlink("dirfile") != 0){ - 28cd: 83 ec 0c sub $0xc,%esp - 28d0: 68 f9 48 00 00 push $0x48f9 - 28d5: e8 94 0f 00 00 call 386e - 28da: 83 c4 10 add $0x10,%esp - 28dd: 85 c0 test %eax,%eax - 28df: 0f 85 f2 00 00 00 jne 29d7 + 285d: 83 ec 0c sub $0xc,%esp + 2860: 68 21 48 00 00 push $0x4821 + 2865: e8 49 0f 00 00 call 37b3 + 286a: 83 c4 10 add $0x10,%esp + 286d: 85 c0 test %eax,%eax + 286f: 0f 85 f2 00 00 00 jne 2967 printf(1, "unlink dirfile failed!\n"); exit(); } fd = open(".", O_RDWR); - 28e5: 83 ec 08 sub $0x8,%esp - 28e8: 6a 02 push $0x2 - 28ea: 68 f2 44 00 00 push $0x44f2 - 28ef: e8 6a 0f 00 00 call 385e + 2875: 83 ec 08 sub $0x8,%esp + 2878: 6a 02 push $0x2 + 287a: 68 1a 44 00 00 push $0x441a + 287f: e8 1f 0f 00 00 call 37a3 if(fd >= 0){ - 28f4: 83 c4 10 add $0x10,%esp - 28f7: 85 c0 test %eax,%eax - 28f9: 0f 89 ec 00 00 00 jns 29eb + 2884: 83 c4 10 add $0x10,%esp + 2887: 85 c0 test %eax,%eax + 2889: 0f 89 ec 00 00 00 jns 297b printf(1, "open . for writing succeeded!\n"); exit(); } fd = open(".", 0); - 28ff: 83 ec 08 sub $0x8,%esp - 2902: 6a 00 push $0x0 - 2904: 68 f2 44 00 00 push $0x44f2 - 2909: e8 50 0f 00 00 call 385e - 290e: 89 c3 mov %eax,%ebx + 288f: 83 ec 08 sub $0x8,%esp + 2892: 6a 00 push $0x0 + 2894: 68 1a 44 00 00 push $0x441a + 2899: e8 05 0f 00 00 call 37a3 + 289e: 89 c3 mov %eax,%ebx if(write(fd, "x", 1) > 0){ - 2910: 83 c4 0c add $0xc,%esp - 2913: 6a 01 push $0x1 - 2915: 68 d5 45 00 00 push $0x45d5 - 291a: 50 push %eax - 291b: e8 1e 0f 00 00 call 383e - 2920: 83 c4 10 add $0x10,%esp - 2923: 85 c0 test %eax,%eax - 2925: 0f 8f d4 00 00 00 jg 29ff + 28a0: 83 c4 0c add $0xc,%esp + 28a3: 6a 01 push $0x1 + 28a5: 68 fd 44 00 00 push $0x44fd + 28aa: 50 push %eax + 28ab: e8 d3 0e 00 00 call 3783 + 28b0: 83 c4 10 add $0x10,%esp + 28b3: 85 c0 test %eax,%eax + 28b5: 0f 8f d4 00 00 00 jg 298f printf(1, "write . succeeded!\n"); exit(); } close(fd); - 292b: 83 ec 0c sub $0xc,%esp - 292e: 53 push %ebx - 292f: e8 12 0f 00 00 call 3846 + 28bb: 83 ec 0c sub $0xc,%esp + 28be: 53 push %ebx + 28bf: e8 c7 0e 00 00 call 378b printf(1, "dir vs file OK\n"); - 2934: 83 c4 08 add $0x8,%esp - 2937: 68 c9 49 00 00 push $0x49c9 - 293c: 6a 01 push $0x1 - 293e: e8 1f 10 00 00 call 3962 + 28c4: 83 c4 08 add $0x8,%esp + 28c7: 68 f1 48 00 00 push $0x48f1 + 28cc: 6a 01 push $0x1 + 28ce: e8 d8 0f 00 00 call 38ab } - 2943: 83 c4 10 add $0x10,%esp - 2946: 8b 5d fc mov -0x4(%ebp),%ebx - 2949: c9 leave - 294a: c3 ret + 28d3: 83 c4 10 add $0x10,%esp + 28d6: 8b 5d fc mov -0x4(%ebp),%ebx + 28d9: c9 leave + 28da: c3 ret printf(1, "create dirfile failed\n"); - 294b: 83 ec 08 sub $0x8,%esp - 294e: 68 01 49 00 00 push $0x4901 - 2953: 6a 01 push $0x1 - 2955: e8 08 10 00 00 call 3962 + 28db: 83 ec 08 sub $0x8,%esp + 28de: 68 29 48 00 00 push $0x4829 + 28e3: 6a 01 push $0x1 + 28e5: e8 c1 0f 00 00 call 38ab exit(); - 295a: e8 bf 0e 00 00 call 381e + 28ea: e8 74 0e 00 00 call 3763 printf(1, "chdir dirfile succeeded!\n"); - 295f: 83 ec 08 sub $0x8,%esp - 2962: 68 18 49 00 00 push $0x4918 - 2967: 6a 01 push $0x1 - 2969: e8 f4 0f 00 00 call 3962 + 28ef: 83 ec 08 sub $0x8,%esp + 28f2: 68 40 48 00 00 push $0x4840 + 28f7: 6a 01 push $0x1 + 28f9: e8 ad 0f 00 00 call 38ab exit(); - 296e: e8 ab 0e 00 00 call 381e + 28fe: e8 60 0e 00 00 call 3763 printf(1, "create dirfile/xx succeeded!\n"); - 2973: 83 ec 08 sub $0x8,%esp - 2976: 68 3d 49 00 00 push $0x493d - 297b: 6a 01 push $0x1 - 297d: e8 e0 0f 00 00 call 3962 + 2903: 83 ec 08 sub $0x8,%esp + 2906: 68 65 48 00 00 push $0x4865 + 290b: 6a 01 push $0x1 + 290d: e8 99 0f 00 00 call 38ab exit(); - 2982: e8 97 0e 00 00 call 381e + 2912: e8 4c 0e 00 00 call 3763 printf(1, "create dirfile/xx succeeded!\n"); - 2987: 83 ec 08 sub $0x8,%esp - 298a: 68 3d 49 00 00 push $0x493d - 298f: 6a 01 push $0x1 - 2991: e8 cc 0f 00 00 call 3962 + 2917: 83 ec 08 sub $0x8,%esp + 291a: 68 65 48 00 00 push $0x4865 + 291f: 6a 01 push $0x1 + 2921: e8 85 0f 00 00 call 38ab exit(); - 2996: e8 83 0e 00 00 call 381e + 2926: e8 38 0e 00 00 call 3763 printf(1, "mkdir dirfile/xx succeeded!\n"); - 299b: 83 ec 08 sub $0x8,%esp - 299e: 68 5b 49 00 00 push $0x495b - 29a3: 6a 01 push $0x1 - 29a5: e8 b8 0f 00 00 call 3962 + 292b: 83 ec 08 sub $0x8,%esp + 292e: 68 83 48 00 00 push $0x4883 + 2933: 6a 01 push $0x1 + 2935: e8 71 0f 00 00 call 38ab exit(); - 29aa: e8 6f 0e 00 00 call 381e + 293a: e8 24 0e 00 00 call 3763 printf(1, "unlink dirfile/xx succeeded!\n"); - 29af: 83 ec 08 sub $0x8,%esp - 29b2: 68 78 49 00 00 push $0x4978 - 29b7: 6a 01 push $0x1 - 29b9: e8 a4 0f 00 00 call 3962 + 293f: 83 ec 08 sub $0x8,%esp + 2942: 68 a0 48 00 00 push $0x48a0 + 2947: 6a 01 push $0x1 + 2949: e8 5d 0f 00 00 call 38ab exit(); - 29be: e8 5b 0e 00 00 call 381e + 294e: e8 10 0e 00 00 call 3763 printf(1, "link to dirfile/xx succeeded!\n"); - 29c3: 83 ec 08 sub $0x8,%esp - 29c6: 68 8c 51 00 00 push $0x518c - 29cb: 6a 01 push $0x1 - 29cd: e8 90 0f 00 00 call 3962 + 2953: 83 ec 08 sub $0x8,%esp + 2956: 68 b4 50 00 00 push $0x50b4 + 295b: 6a 01 push $0x1 + 295d: e8 49 0f 00 00 call 38ab exit(); - 29d2: e8 47 0e 00 00 call 381e + 2962: e8 fc 0d 00 00 call 3763 printf(1, "unlink dirfile failed!\n"); - 29d7: 83 ec 08 sub $0x8,%esp - 29da: 68 9d 49 00 00 push $0x499d - 29df: 6a 01 push $0x1 - 29e1: e8 7c 0f 00 00 call 3962 + 2967: 83 ec 08 sub $0x8,%esp + 296a: 68 c5 48 00 00 push $0x48c5 + 296f: 6a 01 push $0x1 + 2971: e8 35 0f 00 00 call 38ab exit(); - 29e6: e8 33 0e 00 00 call 381e + 2976: e8 e8 0d 00 00 call 3763 printf(1, "open . for writing succeeded!\n"); - 29eb: 83 ec 08 sub $0x8,%esp - 29ee: 68 ac 51 00 00 push $0x51ac - 29f3: 6a 01 push $0x1 - 29f5: e8 68 0f 00 00 call 3962 + 297b: 83 ec 08 sub $0x8,%esp + 297e: 68 d4 50 00 00 push $0x50d4 + 2983: 6a 01 push $0x1 + 2985: e8 21 0f 00 00 call 38ab exit(); - 29fa: e8 1f 0e 00 00 call 381e + 298a: e8 d4 0d 00 00 call 3763 printf(1, "write . succeeded!\n"); - 29ff: 83 ec 08 sub $0x8,%esp - 2a02: 68 b5 49 00 00 push $0x49b5 - 2a07: 6a 01 push $0x1 - 2a09: e8 54 0f 00 00 call 3962 + 298f: 83 ec 08 sub $0x8,%esp + 2992: 68 dd 48 00 00 push $0x48dd + 2997: 6a 01 push $0x1 + 2999: e8 0d 0f 00 00 call 38ab exit(); - 2a0e: e8 0b 0e 00 00 call 381e + 299e: e8 c0 0d 00 00 call 3763 -00002a13 : +000029a3 : // test that iput() is called at the end of _namei() void iref(void) { - 2a13: f3 0f 1e fb endbr32 - 2a17: 55 push %ebp - 2a18: 89 e5 mov %esp,%ebp - 2a1a: 53 push %ebx - 2a1b: 83 ec 0c sub $0xc,%esp + 29a3: 55 push %ebp + 29a4: 89 e5 mov %esp,%ebp + 29a6: 53 push %ebx + 29a7: 83 ec 0c sub $0xc,%esp int i, fd; printf(1, "empty file name\n"); - 2a1e: 68 d9 49 00 00 push $0x49d9 - 2a23: 6a 01 push $0x1 - 2a25: e8 38 0f 00 00 call 3962 - 2a2a: 83 c4 10 add $0x10,%esp - 2a2d: bb 33 00 00 00 mov $0x33,%ebx - 2a32: eb 4f jmp 2a83 + 29aa: 68 01 49 00 00 push $0x4901 + 29af: 6a 01 push $0x1 + 29b1: e8 f5 0e 00 00 call 38ab + 29b6: 83 c4 10 add $0x10,%esp + 29b9: bb 33 00 00 00 mov $0x33,%ebx + 29be: eb 4f jmp 2a0f // the 50 is NINODE for(i = 0; i < 50 + 1; i++){ if(mkdir("irefd") != 0){ printf(1, "mkdir irefd failed\n"); - 2a34: 83 ec 08 sub $0x8,%esp - 2a37: 68 f0 49 00 00 push $0x49f0 - 2a3c: 6a 01 push $0x1 - 2a3e: e8 1f 0f 00 00 call 3962 + 29c0: 83 ec 08 sub $0x8,%esp + 29c3: 68 18 49 00 00 push $0x4918 + 29c8: 6a 01 push $0x1 + 29ca: e8 dc 0e 00 00 call 38ab exit(); - 2a43: e8 d6 0d 00 00 call 381e + 29cf: e8 8f 0d 00 00 call 3763 } if(chdir("irefd") != 0){ printf(1, "chdir irefd failed\n"); - 2a48: 83 ec 08 sub $0x8,%esp - 2a4b: 68 04 4a 00 00 push $0x4a04 - 2a50: 6a 01 push $0x1 - 2a52: e8 0b 0f 00 00 call 3962 + 29d4: 83 ec 08 sub $0x8,%esp + 29d7: 68 2c 49 00 00 push $0x492c + 29dc: 6a 01 push $0x1 + 29de: e8 c8 0e 00 00 call 38ab exit(); - 2a57: e8 c2 0d 00 00 call 381e + 29e3: e8 7b 0d 00 00 call 3763 mkdir(""); link("README", ""); fd = open("", O_CREATE); if(fd >= 0) close(fd); - 2a5c: 83 ec 0c sub $0xc,%esp - 2a5f: 50 push %eax - 2a60: e8 e1 0d 00 00 call 3846 - 2a65: 83 c4 10 add $0x10,%esp - 2a68: eb 7d jmp 2ae7 + 29e8: 83 ec 0c sub $0xc,%esp + 29eb: 50 push %eax + 29ec: e8 9a 0d 00 00 call 378b + 29f1: 83 c4 10 add $0x10,%esp + 29f4: eb 7d jmp 2a73 fd = open("xx", O_CREATE); if(fd >= 0) close(fd); unlink("xx"); - 2a6a: 83 ec 0c sub $0xc,%esp - 2a6d: 68 d4 45 00 00 push $0x45d4 - 2a72: e8 f7 0d 00 00 call 386e + 29f6: 83 ec 0c sub $0xc,%esp + 29f9: 68 fc 44 00 00 push $0x44fc + 29fe: e8 b0 0d 00 00 call 37b3 for(i = 0; i < 50 + 1; i++){ - 2a77: 83 c4 10 add $0x10,%esp - 2a7a: 83 eb 01 sub $0x1,%ebx - 2a7d: 0f 84 92 00 00 00 je 2b15 + 2a03: 83 c4 10 add $0x10,%esp + 2a06: 83 eb 01 sub $0x1,%ebx + 2a09: 0f 84 92 00 00 00 je 2aa1 if(mkdir("irefd") != 0){ - 2a83: 83 ec 0c sub $0xc,%esp - 2a86: 68 ea 49 00 00 push $0x49ea - 2a8b: e8 f6 0d 00 00 call 3886 - 2a90: 83 c4 10 add $0x10,%esp - 2a93: 85 c0 test %eax,%eax - 2a95: 75 9d jne 2a34 + 2a0f: 83 ec 0c sub $0xc,%esp + 2a12: 68 12 49 00 00 push $0x4912 + 2a17: e8 af 0d 00 00 call 37cb + 2a1c: 83 c4 10 add $0x10,%esp + 2a1f: 85 c0 test %eax,%eax + 2a21: 75 9d jne 29c0 if(chdir("irefd") != 0){ - 2a97: 83 ec 0c sub $0xc,%esp - 2a9a: 68 ea 49 00 00 push $0x49ea - 2a9f: e8 ea 0d 00 00 call 388e - 2aa4: 83 c4 10 add $0x10,%esp - 2aa7: 85 c0 test %eax,%eax - 2aa9: 75 9d jne 2a48 + 2a23: 83 ec 0c sub $0xc,%esp + 2a26: 68 12 49 00 00 push $0x4912 + 2a2b: e8 a3 0d 00 00 call 37d3 + 2a30: 83 c4 10 add $0x10,%esp + 2a33: 85 c0 test %eax,%eax + 2a35: 75 9d jne 29d4 mkdir(""); - 2aab: 83 ec 0c sub $0xc,%esp - 2aae: 68 9f 40 00 00 push $0x409f - 2ab3: e8 ce 0d 00 00 call 3886 + 2a37: 83 ec 0c sub $0xc,%esp + 2a3a: 68 c7 3f 00 00 push $0x3fc7 + 2a3f: e8 87 0d 00 00 call 37cb link("README", ""); - 2ab8: 83 c4 08 add $0x8,%esp - 2abb: 68 9f 40 00 00 push $0x409f - 2ac0: 68 96 49 00 00 push $0x4996 - 2ac5: e8 b4 0d 00 00 call 387e + 2a44: 83 c4 08 add $0x8,%esp + 2a47: 68 c7 3f 00 00 push $0x3fc7 + 2a4c: 68 be 48 00 00 push $0x48be + 2a51: e8 6d 0d 00 00 call 37c3 fd = open("", O_CREATE); - 2aca: 83 c4 08 add $0x8,%esp - 2acd: 68 00 02 00 00 push $0x200 - 2ad2: 68 9f 40 00 00 push $0x409f - 2ad7: e8 82 0d 00 00 call 385e + 2a56: 83 c4 08 add $0x8,%esp + 2a59: 68 00 02 00 00 push $0x200 + 2a5e: 68 c7 3f 00 00 push $0x3fc7 + 2a63: e8 3b 0d 00 00 call 37a3 if(fd >= 0) - 2adc: 83 c4 10 add $0x10,%esp - 2adf: 85 c0 test %eax,%eax - 2ae1: 0f 89 75 ff ff ff jns 2a5c + 2a68: 83 c4 10 add $0x10,%esp + 2a6b: 85 c0 test %eax,%eax + 2a6d: 0f 89 75 ff ff ff jns 29e8 fd = open("xx", O_CREATE); - 2ae7: 83 ec 08 sub $0x8,%esp - 2aea: 68 00 02 00 00 push $0x200 - 2aef: 68 d4 45 00 00 push $0x45d4 - 2af4: e8 65 0d 00 00 call 385e + 2a73: 83 ec 08 sub $0x8,%esp + 2a76: 68 00 02 00 00 push $0x200 + 2a7b: 68 fc 44 00 00 push $0x44fc + 2a80: e8 1e 0d 00 00 call 37a3 if(fd >= 0) - 2af9: 83 c4 10 add $0x10,%esp - 2afc: 85 c0 test %eax,%eax - 2afe: 0f 88 66 ff ff ff js 2a6a + 2a85: 83 c4 10 add $0x10,%esp + 2a88: 85 c0 test %eax,%eax + 2a8a: 0f 88 66 ff ff ff js 29f6 close(fd); - 2b04: 83 ec 0c sub $0xc,%esp - 2b07: 50 push %eax - 2b08: e8 39 0d 00 00 call 3846 - 2b0d: 83 c4 10 add $0x10,%esp - 2b10: e9 55 ff ff ff jmp 2a6a + 2a90: 83 ec 0c sub $0xc,%esp + 2a93: 50 push %eax + 2a94: e8 f2 0c 00 00 call 378b + 2a99: 83 c4 10 add $0x10,%esp + 2a9c: e9 55 ff ff ff jmp 29f6 } chdir("/"); - 2b15: 83 ec 0c sub $0xc,%esp - 2b18: 68 c5 3c 00 00 push $0x3cc5 - 2b1d: e8 6c 0d 00 00 call 388e + 2aa1: 83 ec 0c sub $0xc,%esp + 2aa4: 68 ed 3b 00 00 push $0x3bed + 2aa9: e8 25 0d 00 00 call 37d3 printf(1, "empty file name OK\n"); - 2b22: 83 c4 08 add $0x8,%esp - 2b25: 68 18 4a 00 00 push $0x4a18 - 2b2a: 6a 01 push $0x1 - 2b2c: e8 31 0e 00 00 call 3962 + 2aae: 83 c4 08 add $0x8,%esp + 2ab1: 68 40 49 00 00 push $0x4940 + 2ab6: 6a 01 push $0x1 + 2ab8: e8 ee 0d 00 00 call 38ab } - 2b31: 83 c4 10 add $0x10,%esp - 2b34: 8b 5d fc mov -0x4(%ebp),%ebx - 2b37: c9 leave - 2b38: c3 ret + 2abd: 83 c4 10 add $0x10,%esp + 2ac0: 8b 5d fc mov -0x4(%ebp),%ebx + 2ac3: c9 leave + 2ac4: c3 ret -00002b39 : +00002ac5 : // 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) { - 2b39: f3 0f 1e fb endbr32 - 2b3d: 55 push %ebp - 2b3e: 89 e5 mov %esp,%ebp - 2b40: 53 push %ebx - 2b41: 83 ec 0c sub $0xc,%esp + 2ac5: 55 push %ebp + 2ac6: 89 e5 mov %esp,%ebp + 2ac8: 53 push %ebx + 2ac9: 83 ec 0c sub $0xc,%esp int n, pid; printf(1, "fork test\n"); - 2b44: 68 2c 4a 00 00 push $0x4a2c - 2b49: 6a 01 push $0x1 - 2b4b: e8 12 0e 00 00 call 3962 - 2b50: 83 c4 10 add $0x10,%esp + 2acc: 68 54 49 00 00 push $0x4954 + 2ad1: 6a 01 push $0x1 + 2ad3: e8 d3 0d 00 00 call 38ab + 2ad8: 83 c4 10 add $0x10,%esp for(n=0; n<1000; n++){ - 2b53: bb 00 00 00 00 mov $0x0,%ebx + 2adb: bb 00 00 00 00 mov $0x0,%ebx pid = fork(); - 2b58: e8 b9 0c 00 00 call 3816 + 2ae0: e8 76 0c 00 00 call 375b if(pid < 0) - 2b5d: 85 c0 test %eax,%eax - 2b5f: 78 26 js 2b87 + 2ae5: 85 c0 test %eax,%eax + 2ae7: 78 26 js 2b0f break; if(pid == 0) - 2b61: 74 1f je 2b82 + 2ae9: 74 1f je 2b0a for(n=0; n<1000; n++){ - 2b63: 83 c3 01 add $0x1,%ebx - 2b66: 81 fb e8 03 00 00 cmp $0x3e8,%ebx - 2b6c: 75 ea jne 2b58 + 2aeb: 83 c3 01 add $0x1,%ebx + 2aee: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 2af4: 75 ea jne 2ae0 exit(); } if(n == 1000){ printf(1, "fork claimed to work 1000 times!\n"); - 2b6e: 83 ec 08 sub $0x8,%esp - 2b71: 68 cc 51 00 00 push $0x51cc - 2b76: 6a 01 push $0x1 - 2b78: e8 e5 0d 00 00 call 3962 + 2af6: 83 ec 08 sub $0x8,%esp + 2af9: 68 f4 50 00 00 push $0x50f4 + 2afe: 6a 01 push $0x1 + 2b00: e8 a6 0d 00 00 call 38ab exit(); - 2b7d: e8 9c 0c 00 00 call 381e + 2b05: e8 59 0c 00 00 call 3763 exit(); - 2b82: e8 97 0c 00 00 call 381e + 2b0a: e8 54 0c 00 00 call 3763 if(n == 1000){ - 2b87: 81 fb e8 03 00 00 cmp $0x3e8,%ebx - 2b8d: 74 df je 2b6e + 2b0f: 81 fb e8 03 00 00 cmp $0x3e8,%ebx + 2b15: 74 df je 2af6 } for(; n > 0; n--){ - 2b8f: 85 db test %ebx,%ebx - 2b91: 7e 0e jle 2ba1 + 2b17: 85 db test %ebx,%ebx + 2b19: 7e 0e jle 2b29 if(wait() < 0){ - 2b93: e8 8e 0c 00 00 call 3826 - 2b98: 85 c0 test %eax,%eax - 2b9a: 78 26 js 2bc2 + 2b1b: e8 4b 0c 00 00 call 376b + 2b20: 85 c0 test %eax,%eax + 2b22: 78 26 js 2b4a for(; n > 0; n--){ - 2b9c: 83 eb 01 sub $0x1,%ebx - 2b9f: 75 f2 jne 2b93 + 2b24: 83 eb 01 sub $0x1,%ebx + 2b27: 75 f2 jne 2b1b printf(1, "wait stopped early\n"); exit(); } } if(wait() != -1){ - 2ba1: e8 80 0c 00 00 call 3826 - 2ba6: 83 f8 ff cmp $0xffffffff,%eax - 2ba9: 75 2b jne 2bd6 + 2b29: e8 3d 0c 00 00 call 376b + 2b2e: 83 f8 ff cmp $0xffffffff,%eax + 2b31: 75 2b jne 2b5e printf(1, "wait got too many\n"); exit(); } printf(1, "fork test OK\n"); - 2bab: 83 ec 08 sub $0x8,%esp - 2bae: 68 5e 4a 00 00 push $0x4a5e - 2bb3: 6a 01 push $0x1 - 2bb5: e8 a8 0d 00 00 call 3962 + 2b33: 83 ec 08 sub $0x8,%esp + 2b36: 68 86 49 00 00 push $0x4986 + 2b3b: 6a 01 push $0x1 + 2b3d: e8 69 0d 00 00 call 38ab } - 2bba: 83 c4 10 add $0x10,%esp - 2bbd: 8b 5d fc mov -0x4(%ebp),%ebx - 2bc0: c9 leave - 2bc1: c3 ret + 2b42: 83 c4 10 add $0x10,%esp + 2b45: 8b 5d fc mov -0x4(%ebp),%ebx + 2b48: c9 leave + 2b49: c3 ret printf(1, "wait stopped early\n"); - 2bc2: 83 ec 08 sub $0x8,%esp - 2bc5: 68 37 4a 00 00 push $0x4a37 - 2bca: 6a 01 push $0x1 - 2bcc: e8 91 0d 00 00 call 3962 + 2b4a: 83 ec 08 sub $0x8,%esp + 2b4d: 68 5f 49 00 00 push $0x495f + 2b52: 6a 01 push $0x1 + 2b54: e8 52 0d 00 00 call 38ab exit(); - 2bd1: e8 48 0c 00 00 call 381e + 2b59: e8 05 0c 00 00 call 3763 printf(1, "wait got too many\n"); - 2bd6: 83 ec 08 sub $0x8,%esp - 2bd9: 68 4b 4a 00 00 push $0x4a4b - 2bde: 6a 01 push $0x1 - 2be0: e8 7d 0d 00 00 call 3962 + 2b5e: 83 ec 08 sub $0x8,%esp + 2b61: 68 73 49 00 00 push $0x4973 + 2b66: 6a 01 push $0x1 + 2b68: e8 3e 0d 00 00 call 38ab exit(); - 2be5: e8 34 0c 00 00 call 381e + 2b6d: e8 f1 0b 00 00 call 3763 -00002bea : +00002b72 : void sbrktest(void) { - 2bea: f3 0f 1e fb endbr32 - 2bee: 55 push %ebp - 2bef: 89 e5 mov %esp,%ebp - 2bf1: 57 push %edi - 2bf2: 56 push %esi - 2bf3: 53 push %ebx - 2bf4: 83 ec 64 sub $0x64,%esp + 2b72: 55 push %ebp + 2b73: 89 e5 mov %esp,%ebp + 2b75: 57 push %edi + 2b76: 56 push %esi + 2b77: 53 push %ebx + 2b78: 83 ec 64 sub $0x64,%esp int fds[2], pid, pids[10], ppid; char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; uint amt; printf(stdout, "sbrk test\n"); - 2bf7: 68 6c 4a 00 00 push $0x4a6c - 2bfc: ff 35 8c 5c 00 00 pushl 0x5c8c - 2c02: e8 5b 0d 00 00 call 3962 + 2b7b: 68 94 49 00 00 push $0x4994 + 2b80: ff 35 10 5c 00 00 push 0x5c10 + 2b86: e8 20 0d 00 00 call 38ab oldbrk = sbrk(0); - 2c07: c7 04 24 00 00 00 00 movl $0x0,(%esp) - 2c0e: e8 93 0c 00 00 call 38a6 - 2c13: 89 45 a4 mov %eax,-0x5c(%ebp) + 2b8b: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2b92: e8 54 0c 00 00 call 37eb + 2b97: 89 45 a4 mov %eax,-0x5c(%ebp) // can one sbrk() less than a page? a = sbrk(0); - 2c16: c7 04 24 00 00 00 00 movl $0x0,(%esp) - 2c1d: e8 84 0c 00 00 call 38a6 - 2c22: 89 c3 mov %eax,%ebx - 2c24: 83 c4 10 add $0x10,%esp + 2b9a: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2ba1: e8 45 0c 00 00 call 37eb + 2ba6: 89 c3 mov %eax,%ebx + 2ba8: 83 c4 10 add $0x10,%esp int i; for(i = 0; i < 5000; i++){ - 2c27: be 00 00 00 00 mov $0x0,%esi - 2c2c: eb 02 jmp 2c30 + 2bab: be 00 00 00 00 mov $0x0,%esi + 2bb0: eb 02 jmp 2bb4 if(b != a){ printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); exit(); } *b = 1; a = b + 1; - 2c2e: 89 c3 mov %eax,%ebx + 2bb2: 89 c3 mov %eax,%ebx b = sbrk(1); - 2c30: 83 ec 0c sub $0xc,%esp - 2c33: 6a 01 push $0x1 - 2c35: e8 6c 0c 00 00 call 38a6 + 2bb4: 83 ec 0c sub $0xc,%esp + 2bb7: 6a 01 push $0x1 + 2bb9: e8 2d 0c 00 00 call 37eb if(b != a){ - 2c3a: 83 c4 10 add $0x10,%esp - 2c3d: 39 d8 cmp %ebx,%eax - 2c3f: 0f 85 90 01 00 00 jne 2dd5 + 2bbe: 83 c4 10 add $0x10,%esp + 2bc1: 39 d8 cmp %ebx,%eax + 2bc3: 0f 85 92 01 00 00 jne 2d5b *b = 1; - 2c45: c6 03 01 movb $0x1,(%ebx) + 2bc9: c6 03 01 movb $0x1,(%ebx) a = b + 1; - 2c48: 8d 43 01 lea 0x1(%ebx),%eax + 2bcc: 8d 43 01 lea 0x1(%ebx),%eax for(i = 0; i < 5000; i++){ - 2c4b: 83 c6 01 add $0x1,%esi - 2c4e: 81 fe 88 13 00 00 cmp $0x1388,%esi - 2c54: 75 d8 jne 2c2e + 2bcf: 83 c6 01 add $0x1,%esi + 2bd2: 81 fe 88 13 00 00 cmp $0x1388,%esi + 2bd8: 75 d8 jne 2bb2 } pid = fork(); - 2c56: e8 bb 0b 00 00 call 3816 - 2c5b: 89 c6 mov %eax,%esi + 2bda: e8 7c 0b 00 00 call 375b + 2bdf: 89 c6 mov %eax,%esi if(pid < 0){ - 2c5d: 85 c0 test %eax,%eax - 2c5f: 0f 88 8e 01 00 00 js 2df3 + 2be1: 85 c0 test %eax,%eax + 2be3: 0f 88 90 01 00 00 js 2d79 printf(stdout, "sbrk test fork failed\n"); exit(); } c = sbrk(1); - 2c65: 83 ec 0c sub $0xc,%esp - 2c68: 6a 01 push $0x1 - 2c6a: e8 37 0c 00 00 call 38a6 + 2be9: 83 ec 0c sub $0xc,%esp + 2bec: 6a 01 push $0x1 + 2bee: e8 f8 0b 00 00 call 37eb c = sbrk(1); - 2c6f: c7 04 24 01 00 00 00 movl $0x1,(%esp) - 2c76: e8 2b 0c 00 00 call 38a6 + 2bf3: c7 04 24 01 00 00 00 movl $0x1,(%esp) + 2bfa: e8 ec 0b 00 00 call 37eb if(c != a + 1){ - 2c7b: 83 c3 02 add $0x2,%ebx - 2c7e: 83 c4 10 add $0x10,%esp - 2c81: 39 c3 cmp %eax,%ebx - 2c83: 0f 85 82 01 00 00 jne 2e0b + 2bff: 83 c3 02 add $0x2,%ebx + 2c02: 83 c4 10 add $0x10,%esp + 2c05: 39 c3 cmp %eax,%ebx + 2c07: 0f 85 84 01 00 00 jne 2d91 printf(stdout, "sbrk test failed post-fork\n"); exit(); } if(pid == 0) - 2c89: 85 f6 test %esi,%esi - 2c8b: 0f 84 92 01 00 00 je 2e23 + 2c0d: 85 f6 test %esi,%esi + 2c0f: 0f 84 94 01 00 00 je 2da9 exit(); wait(); - 2c91: e8 90 0b 00 00 call 3826 + 2c15: e8 51 0b 00 00 call 376b // can one grow address space to something big? #define BIG (100*1024*1024) a = sbrk(0); - 2c96: 83 ec 0c sub $0xc,%esp - 2c99: 6a 00 push $0x0 - 2c9b: e8 06 0c 00 00 call 38a6 - 2ca0: 89 c3 mov %eax,%ebx + 2c1a: 83 ec 0c sub $0xc,%esp + 2c1d: 6a 00 push $0x0 + 2c1f: e8 c7 0b 00 00 call 37eb + 2c24: 89 c3 mov %eax,%ebx amt = (BIG) - (uint)a; - 2ca2: b8 00 00 40 06 mov $0x6400000,%eax - 2ca7: 29 d8 sub %ebx,%eax + 2c26: b8 00 00 40 06 mov $0x6400000,%eax + 2c2b: 29 d8 sub %ebx,%eax p = sbrk(amt); - 2ca9: 89 04 24 mov %eax,(%esp) - 2cac: e8 f5 0b 00 00 call 38a6 + 2c2d: 89 04 24 mov %eax,(%esp) + 2c30: e8 b6 0b 00 00 call 37eb if (p != a) { - 2cb1: 83 c4 10 add $0x10,%esp - 2cb4: 39 c3 cmp %eax,%ebx - 2cb6: 0f 85 6c 01 00 00 jne 2e28 + 2c35: 83 c4 10 add $0x10,%esp + 2c38: 39 c3 cmp %eax,%ebx + 2c3a: 0f 85 6e 01 00 00 jne 2dae printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); exit(); } lastaddr = (char*) (BIG-1); *lastaddr = 99; - 2cbc: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff + 2c40: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff // can one de-allocate? a = sbrk(0); - 2cc3: 83 ec 0c sub $0xc,%esp - 2cc6: 6a 00 push $0x0 - 2cc8: e8 d9 0b 00 00 call 38a6 - 2ccd: 89 c3 mov %eax,%ebx + 2c47: 83 ec 0c sub $0xc,%esp + 2c4a: 6a 00 push $0x0 + 2c4c: e8 9a 0b 00 00 call 37eb + 2c51: 89 c3 mov %eax,%ebx c = sbrk(-4096); - 2ccf: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp) - 2cd6: e8 cb 0b 00 00 call 38a6 + 2c53: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp) + 2c5a: e8 8c 0b 00 00 call 37eb if(c == (char*)0xffffffff){ - 2cdb: 83 c4 10 add $0x10,%esp - 2cde: 83 f8 ff cmp $0xffffffff,%eax - 2ce1: 0f 84 59 01 00 00 je 2e40 + 2c5f: 83 c4 10 add $0x10,%esp + 2c62: 83 f8 ff cmp $0xffffffff,%eax + 2c65: 0f 84 5b 01 00 00 je 2dc6 printf(stdout, "sbrk could not deallocate\n"); exit(); } c = sbrk(0); - 2ce7: 83 ec 0c sub $0xc,%esp - 2cea: 6a 00 push $0x0 - 2cec: e8 b5 0b 00 00 call 38a6 + 2c6b: 83 ec 0c sub $0xc,%esp + 2c6e: 6a 00 push $0x0 + 2c70: e8 76 0b 00 00 call 37eb if(c != a - 4096){ - 2cf1: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx - 2cf7: 83 c4 10 add $0x10,%esp - 2cfa: 39 d0 cmp %edx,%eax - 2cfc: 0f 85 56 01 00 00 jne 2e58 + 2c75: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx + 2c7b: 83 c4 10 add $0x10,%esp + 2c7e: 39 d0 cmp %edx,%eax + 2c80: 0f 85 58 01 00 00 jne 2dde printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); exit(); } // can one re-allocate that page? a = sbrk(0); - 2d02: 83 ec 0c sub $0xc,%esp - 2d05: 6a 00 push $0x0 - 2d07: e8 9a 0b 00 00 call 38a6 - 2d0c: 89 c3 mov %eax,%ebx + 2c86: 83 ec 0c sub $0xc,%esp + 2c89: 6a 00 push $0x0 + 2c8b: e8 5b 0b 00 00 call 37eb + 2c90: 89 c3 mov %eax,%ebx c = sbrk(4096); - 2d0e: c7 04 24 00 10 00 00 movl $0x1000,(%esp) - 2d15: e8 8c 0b 00 00 call 38a6 - 2d1a: 89 c6 mov %eax,%esi + 2c92: c7 04 24 00 10 00 00 movl $0x1000,(%esp) + 2c99: e8 4d 0b 00 00 call 37eb + 2c9e: 89 c6 mov %eax,%esi if(c != a || sbrk(0) != a + 4096){ - 2d1c: 83 c4 10 add $0x10,%esp - 2d1f: 39 c3 cmp %eax,%ebx - 2d21: 0f 85 48 01 00 00 jne 2e6f - 2d27: 83 ec 0c sub $0xc,%esp - 2d2a: 6a 00 push $0x0 - 2d2c: e8 75 0b 00 00 call 38a6 - 2d31: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx - 2d37: 83 c4 10 add $0x10,%esp - 2d3a: 39 c2 cmp %eax,%edx - 2d3c: 0f 85 2d 01 00 00 jne 2e6f + 2ca0: 83 c4 10 add $0x10,%esp + 2ca3: 39 c3 cmp %eax,%ebx + 2ca5: 0f 85 4a 01 00 00 jne 2df5 + 2cab: 83 ec 0c sub $0xc,%esp + 2cae: 6a 00 push $0x0 + 2cb0: e8 36 0b 00 00 call 37eb + 2cb5: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx + 2cbb: 83 c4 10 add $0x10,%esp + 2cbe: 39 c2 cmp %eax,%edx + 2cc0: 0f 85 2f 01 00 00 jne 2df5 printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); exit(); } if(*lastaddr == 99){ - 2d42: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff - 2d49: 0f 84 37 01 00 00 je 2e86 + 2cc6: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff + 2ccd: 0f 84 39 01 00 00 je 2e0c // should be zero printf(stdout, "sbrk de-allocation didn't really deallocate\n"); exit(); } a = sbrk(0); - 2d4f: 83 ec 0c sub $0xc,%esp - 2d52: 6a 00 push $0x0 - 2d54: e8 4d 0b 00 00 call 38a6 - 2d59: 89 c3 mov %eax,%ebx + 2cd3: 83 ec 0c sub $0xc,%esp + 2cd6: 6a 00 push $0x0 + 2cd8: e8 0e 0b 00 00 call 37eb + 2cdd: 89 c3 mov %eax,%ebx c = sbrk(-(sbrk(0) - oldbrk)); - 2d5b: c7 04 24 00 00 00 00 movl $0x0,(%esp) - 2d62: e8 3f 0b 00 00 call 38a6 - 2d67: 8b 4d a4 mov -0x5c(%ebp),%ecx - 2d6a: 29 c1 sub %eax,%ecx - 2d6c: 89 0c 24 mov %ecx,(%esp) - 2d6f: e8 32 0b 00 00 call 38a6 + 2cdf: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2ce6: e8 00 0b 00 00 call 37eb + 2ceb: 89 c2 mov %eax,%edx + 2ced: 8b 45 a4 mov -0x5c(%ebp),%eax + 2cf0: 29 d0 sub %edx,%eax + 2cf2: 89 04 24 mov %eax,(%esp) + 2cf5: e8 f1 0a 00 00 call 37eb if(c != a){ - 2d74: 83 c4 10 add $0x10,%esp - 2d77: 39 c3 cmp %eax,%ebx - 2d79: 0f 85 1f 01 00 00 jne 2e9e + 2cfa: 83 c4 10 add $0x10,%esp + 2cfd: 39 c3 cmp %eax,%ebx + 2cff: 0f 85 1f 01 00 00 jne 2e24 printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); exit(); } // can we read the kernel's memory? for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){ - 2d7f: bb 00 00 00 80 mov $0x80000000,%ebx + 2d05: bb 00 00 00 80 mov $0x80000000,%ebx ppid = getpid(); - 2d84: e8 15 0b 00 00 call 389e - 2d89: 89 c6 mov %eax,%esi + 2d0a: e8 d4 0a 00 00 call 37e3 + 2d0f: 89 c6 mov %eax,%esi pid = fork(); - 2d8b: e8 86 0a 00 00 call 3816 + 2d11: e8 45 0a 00 00 call 375b if(pid < 0){ - 2d90: 85 c0 test %eax,%eax - 2d92: 0f 88 1d 01 00 00 js 2eb5 + 2d16: 85 c0 test %eax,%eax + 2d18: 0f 88 1d 01 00 00 js 2e3b printf(stdout, "fork failed\n"); exit(); } if(pid == 0){ - 2d98: 0f 84 2f 01 00 00 je 2ecd + 2d1e: 0f 84 2f 01 00 00 je 2e53 printf(stdout, "oops could read %x = %x\n", a, *a); kill(ppid); exit(); } wait(); - 2d9e: e8 83 0a 00 00 call 3826 + 2d24: e8 42 0a 00 00 call 376b for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){ - 2da3: 81 c3 50 c3 00 00 add $0xc350,%ebx - 2da9: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx - 2daf: 75 d3 jne 2d84 + 2d29: 81 c3 50 c3 00 00 add $0xc350,%ebx + 2d2f: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx + 2d35: 75 d3 jne 2d0a } // if we run the system out of memory, does it clean up the last // failed allocation? if(pipe(fds) != 0){ - 2db1: 83 ec 0c sub $0xc,%esp - 2db4: 8d 45 e0 lea -0x20(%ebp),%eax - 2db7: 50 push %eax - 2db8: e8 71 0a 00 00 call 382e - 2dbd: 83 c4 10 add $0x10,%esp - 2dc0: 85 c0 test %eax,%eax - 2dc2: 0f 85 27 01 00 00 jne 2eef - 2dc8: 8d 5d b8 lea -0x48(%ebp),%ebx - 2dcb: 8d 7d e0 lea -0x20(%ebp),%edi - 2dce: 89 de mov %ebx,%esi - 2dd0: e9 77 01 00 00 jmp 2f4c + 2d37: 83 ec 0c sub $0xc,%esp + 2d3a: 8d 45 e0 lea -0x20(%ebp),%eax + 2d3d: 50 push %eax + 2d3e: e8 30 0a 00 00 call 3773 + 2d43: 83 c4 10 add $0x10,%esp + 2d46: 85 c0 test %eax,%eax + 2d48: 0f 85 27 01 00 00 jne 2e75 + 2d4e: 8d 5d b8 lea -0x48(%ebp),%ebx + 2d51: 8d 7d e0 lea -0x20(%ebp),%edi + 2d54: 89 de mov %ebx,%esi + 2d56: e9 77 01 00 00 jmp 2ed2 printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); - 2dd5: 83 ec 0c sub $0xc,%esp - 2dd8: 50 push %eax - 2dd9: 53 push %ebx - 2dda: 56 push %esi - 2ddb: 68 77 4a 00 00 push $0x4a77 - 2de0: ff 35 8c 5c 00 00 pushl 0x5c8c - 2de6: e8 77 0b 00 00 call 3962 + 2d5b: 83 ec 0c sub $0xc,%esp + 2d5e: 50 push %eax + 2d5f: 53 push %ebx + 2d60: 56 push %esi + 2d61: 68 9f 49 00 00 push $0x499f + 2d66: ff 35 10 5c 00 00 push 0x5c10 + 2d6c: e8 3a 0b 00 00 call 38ab exit(); - 2deb: 83 c4 20 add $0x20,%esp - 2dee: e8 2b 0a 00 00 call 381e + 2d71: 83 c4 20 add $0x20,%esp + 2d74: e8 ea 09 00 00 call 3763 printf(stdout, "sbrk test fork failed\n"); - 2df3: 83 ec 08 sub $0x8,%esp - 2df6: 68 92 4a 00 00 push $0x4a92 - 2dfb: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e01: e8 5c 0b 00 00 call 3962 + 2d79: 83 ec 08 sub $0x8,%esp + 2d7c: 68 ba 49 00 00 push $0x49ba + 2d81: ff 35 10 5c 00 00 push 0x5c10 + 2d87: e8 1f 0b 00 00 call 38ab exit(); - 2e06: e8 13 0a 00 00 call 381e + 2d8c: e8 d2 09 00 00 call 3763 printf(stdout, "sbrk test failed post-fork\n"); - 2e0b: 83 ec 08 sub $0x8,%esp - 2e0e: 68 a9 4a 00 00 push $0x4aa9 - 2e13: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e19: e8 44 0b 00 00 call 3962 + 2d91: 83 ec 08 sub $0x8,%esp + 2d94: 68 d1 49 00 00 push $0x49d1 + 2d99: ff 35 10 5c 00 00 push 0x5c10 + 2d9f: e8 07 0b 00 00 call 38ab exit(); - 2e1e: e8 fb 09 00 00 call 381e + 2da4: e8 ba 09 00 00 call 3763 exit(); - 2e23: e8 f6 09 00 00 call 381e + 2da9: e8 b5 09 00 00 call 3763 printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); - 2e28: 83 ec 08 sub $0x8,%esp - 2e2b: 68 f0 51 00 00 push $0x51f0 - 2e30: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e36: e8 27 0b 00 00 call 3962 + 2dae: 83 ec 08 sub $0x8,%esp + 2db1: 68 18 51 00 00 push $0x5118 + 2db6: ff 35 10 5c 00 00 push 0x5c10 + 2dbc: e8 ea 0a 00 00 call 38ab exit(); - 2e3b: e8 de 09 00 00 call 381e + 2dc1: e8 9d 09 00 00 call 3763 printf(stdout, "sbrk could not deallocate\n"); - 2e40: 83 ec 08 sub $0x8,%esp - 2e43: 68 c5 4a 00 00 push $0x4ac5 - 2e48: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e4e: e8 0f 0b 00 00 call 3962 + 2dc6: 83 ec 08 sub $0x8,%esp + 2dc9: 68 ed 49 00 00 push $0x49ed + 2dce: ff 35 10 5c 00 00 push 0x5c10 + 2dd4: e8 d2 0a 00 00 call 38ab exit(); - 2e53: e8 c6 09 00 00 call 381e + 2dd9: e8 85 09 00 00 call 3763 printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); - 2e58: 50 push %eax - 2e59: 53 push %ebx - 2e5a: 68 30 52 00 00 push $0x5230 - 2e5f: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e65: e8 f8 0a 00 00 call 3962 + 2dde: 50 push %eax + 2ddf: 53 push %ebx + 2de0: 68 58 51 00 00 push $0x5158 + 2de5: ff 35 10 5c 00 00 push 0x5c10 + 2deb: e8 bb 0a 00 00 call 38ab exit(); - 2e6a: e8 af 09 00 00 call 381e + 2df0: e8 6e 09 00 00 call 3763 printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); - 2e6f: 56 push %esi - 2e70: 53 push %ebx - 2e71: 68 68 52 00 00 push $0x5268 - 2e76: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e7c: e8 e1 0a 00 00 call 3962 + 2df5: 56 push %esi + 2df6: 53 push %ebx + 2df7: 68 90 51 00 00 push $0x5190 + 2dfc: ff 35 10 5c 00 00 push 0x5c10 + 2e02: e8 a4 0a 00 00 call 38ab exit(); - 2e81: e8 98 09 00 00 call 381e + 2e07: e8 57 09 00 00 call 3763 printf(stdout, "sbrk de-allocation didn't really deallocate\n"); - 2e86: 83 ec 08 sub $0x8,%esp - 2e89: 68 90 52 00 00 push $0x5290 - 2e8e: ff 35 8c 5c 00 00 pushl 0x5c8c - 2e94: e8 c9 0a 00 00 call 3962 + 2e0c: 83 ec 08 sub $0x8,%esp + 2e0f: 68 b8 51 00 00 push $0x51b8 + 2e14: ff 35 10 5c 00 00 push 0x5c10 + 2e1a: e8 8c 0a 00 00 call 38ab exit(); - 2e99: e8 80 09 00 00 call 381e + 2e1f: e8 3f 09 00 00 call 3763 printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); - 2e9e: 50 push %eax - 2e9f: 53 push %ebx - 2ea0: 68 c0 52 00 00 push $0x52c0 - 2ea5: ff 35 8c 5c 00 00 pushl 0x5c8c - 2eab: e8 b2 0a 00 00 call 3962 + 2e24: 50 push %eax + 2e25: 53 push %ebx + 2e26: 68 e8 51 00 00 push $0x51e8 + 2e2b: ff 35 10 5c 00 00 push 0x5c10 + 2e31: e8 75 0a 00 00 call 38ab exit(); - 2eb0: e8 69 09 00 00 call 381e + 2e36: e8 28 09 00 00 call 3763 printf(stdout, "fork failed\n"); - 2eb5: 83 ec 08 sub $0x8,%esp - 2eb8: 68 bd 4b 00 00 push $0x4bbd - 2ebd: ff 35 8c 5c 00 00 pushl 0x5c8c - 2ec3: e8 9a 0a 00 00 call 3962 + 2e3b: 83 ec 08 sub $0x8,%esp + 2e3e: 68 e5 4a 00 00 push $0x4ae5 + 2e43: ff 35 10 5c 00 00 push 0x5c10 + 2e49: e8 5d 0a 00 00 call 38ab exit(); - 2ec8: e8 51 09 00 00 call 381e + 2e4e: e8 10 09 00 00 call 3763 printf(stdout, "oops could read %x = %x\n", a, *a); - 2ecd: 0f be 03 movsbl (%ebx),%eax - 2ed0: 50 push %eax - 2ed1: 53 push %ebx - 2ed2: 68 e0 4a 00 00 push $0x4ae0 - 2ed7: ff 35 8c 5c 00 00 pushl 0x5c8c - 2edd: e8 80 0a 00 00 call 3962 + 2e53: 0f be 03 movsbl (%ebx),%eax + 2e56: 50 push %eax + 2e57: 53 push %ebx + 2e58: 68 08 4a 00 00 push $0x4a08 + 2e5d: ff 35 10 5c 00 00 push 0x5c10 + 2e63: e8 43 0a 00 00 call 38ab kill(ppid); - 2ee2: 89 34 24 mov %esi,(%esp) - 2ee5: e8 64 09 00 00 call 384e + 2e68: 89 34 24 mov %esi,(%esp) + 2e6b: e8 23 09 00 00 call 3793 exit(); - 2eea: e8 2f 09 00 00 call 381e + 2e70: e8 ee 08 00 00 call 3763 printf(1, "pipe() failed\n"); - 2eef: 83 ec 08 sub $0x8,%esp - 2ef2: 68 b5 3f 00 00 push $0x3fb5 - 2ef7: 6a 01 push $0x1 - 2ef9: e8 64 0a 00 00 call 3962 + 2e75: 83 ec 08 sub $0x8,%esp + 2e78: 68 dd 3e 00 00 push $0x3edd + 2e7d: 6a 01 push $0x1 + 2e7f: e8 27 0a 00 00 call 38ab exit(); - 2efe: e8 1b 09 00 00 call 381e + 2e84: e8 da 08 00 00 call 3763 } 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)); - 2f03: 83 ec 0c sub $0xc,%esp - 2f06: 6a 00 push $0x0 - 2f08: e8 99 09 00 00 call 38a6 - 2f0d: 89 c2 mov %eax,%edx - 2f0f: b8 00 00 40 06 mov $0x6400000,%eax - 2f14: 29 d0 sub %edx,%eax - 2f16: 89 04 24 mov %eax,(%esp) - 2f19: e8 88 09 00 00 call 38a6 + 2e89: 83 ec 0c sub $0xc,%esp + 2e8c: 6a 00 push $0x0 + 2e8e: e8 58 09 00 00 call 37eb + 2e93: 89 c2 mov %eax,%edx + 2e95: b8 00 00 40 06 mov $0x6400000,%eax + 2e9a: 29 d0 sub %edx,%eax + 2e9c: 89 04 24 mov %eax,(%esp) + 2e9f: e8 47 09 00 00 call 37eb write(fds[1], "x", 1); - 2f1e: 83 c4 0c add $0xc,%esp - 2f21: 6a 01 push $0x1 - 2f23: 68 d5 45 00 00 push $0x45d5 - 2f28: ff 75 e4 pushl -0x1c(%ebp) - 2f2b: e8 0e 09 00 00 call 383e - 2f30: 83 c4 10 add $0x10,%esp + 2ea4: 83 c4 0c add $0xc,%esp + 2ea7: 6a 01 push $0x1 + 2ea9: 68 fd 44 00 00 push $0x44fd + 2eae: ff 75 e4 push -0x1c(%ebp) + 2eb1: e8 cd 08 00 00 call 3783 + 2eb6: 83 c4 10 add $0x10,%esp // sit around until killed for(;;) sleep(1000); - 2f33: 83 ec 0c sub $0xc,%esp - 2f36: 68 e8 03 00 00 push $0x3e8 - 2f3b: e8 6e 09 00 00 call 38ae - 2f40: 83 c4 10 add $0x10,%esp - 2f43: eb ee jmp 2f33 + 2eb9: 83 ec 0c sub $0xc,%esp + 2ebc: 68 e8 03 00 00 push $0x3e8 + 2ec1: e8 2d 09 00 00 call 37f3 + 2ec6: 83 c4 10 add $0x10,%esp + 2ec9: eb ee jmp 2eb9 for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ - 2f45: 83 c6 04 add $0x4,%esi - 2f48: 39 fe cmp %edi,%esi - 2f4a: 74 26 je 2f72 + 2ecb: 83 c6 04 add $0x4,%esi + 2ece: 39 fe cmp %edi,%esi + 2ed0: 74 26 je 2ef8 if((pids[i] = fork()) == 0){ - 2f4c: e8 c5 08 00 00 call 3816 - 2f51: 89 06 mov %eax,(%esi) - 2f53: 85 c0 test %eax,%eax - 2f55: 74 ac je 2f03 + 2ed2: e8 84 08 00 00 call 375b + 2ed7: 89 06 mov %eax,(%esi) + 2ed9: 85 c0 test %eax,%eax + 2edb: 74 ac je 2e89 } if(pids[i] != -1) - 2f57: 83 f8 ff cmp $0xffffffff,%eax - 2f5a: 74 e9 je 2f45 + 2edd: 83 f8 ff cmp $0xffffffff,%eax + 2ee0: 74 e9 je 2ecb read(fds[0], &scratch, 1); - 2f5c: 83 ec 04 sub $0x4,%esp - 2f5f: 6a 01 push $0x1 - 2f61: 8d 45 b7 lea -0x49(%ebp),%eax - 2f64: 50 push %eax - 2f65: ff 75 e0 pushl -0x20(%ebp) - 2f68: e8 c9 08 00 00 call 3836 - 2f6d: 83 c4 10 add $0x10,%esp - 2f70: eb d3 jmp 2f45 + 2ee2: 83 ec 04 sub $0x4,%esp + 2ee5: 6a 01 push $0x1 + 2ee7: 8d 45 b7 lea -0x49(%ebp),%eax + 2eea: 50 push %eax + 2eeb: ff 75 e0 push -0x20(%ebp) + 2eee: e8 88 08 00 00 call 377b + 2ef3: 83 c4 10 add $0x10,%esp + 2ef6: eb d3 jmp 2ecb } // if those failed allocations freed up the pages they did allocate, // we'll be able to allocate here c = sbrk(4096); - 2f72: 83 ec 0c sub $0xc,%esp - 2f75: 68 00 10 00 00 push $0x1000 - 2f7a: e8 27 09 00 00 call 38a6 - 2f7f: 89 c6 mov %eax,%esi - 2f81: 83 c4 10 add $0x10,%esp - 2f84: eb 07 jmp 2f8d + 2ef8: 83 ec 0c sub $0xc,%esp + 2efb: 68 00 10 00 00 push $0x1000 + 2f00: e8 e6 08 00 00 call 37eb + 2f05: 89 c6 mov %eax,%esi + 2f07: 83 c4 10 add $0x10,%esp + 2f0a: eb 07 jmp 2f13 for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ - 2f86: 83 c3 04 add $0x4,%ebx - 2f89: 39 fb cmp %edi,%ebx - 2f8b: 74 1a je 2fa7 + 2f0c: 83 c3 04 add $0x4,%ebx + 2f0f: 39 fb cmp %edi,%ebx + 2f11: 74 1a je 2f2d if(pids[i] == -1) - 2f8d: 8b 03 mov (%ebx),%eax - 2f8f: 83 f8 ff cmp $0xffffffff,%eax - 2f92: 74 f2 je 2f86 + 2f13: 8b 03 mov (%ebx),%eax + 2f15: 83 f8 ff cmp $0xffffffff,%eax + 2f18: 74 f2 je 2f0c continue; kill(pids[i]); - 2f94: 83 ec 0c sub $0xc,%esp - 2f97: 50 push %eax - 2f98: e8 b1 08 00 00 call 384e + 2f1a: 83 ec 0c sub $0xc,%esp + 2f1d: 50 push %eax + 2f1e: e8 70 08 00 00 call 3793 wait(); - 2f9d: e8 84 08 00 00 call 3826 - 2fa2: 83 c4 10 add $0x10,%esp - 2fa5: eb df jmp 2f86 + 2f23: e8 43 08 00 00 call 376b + 2f28: 83 c4 10 add $0x10,%esp + 2f2b: eb df jmp 2f0c } if(c == (char*)0xffffffff){ - 2fa7: 83 fe ff cmp $0xffffffff,%esi - 2faa: 74 30 je 2fdc + 2f2d: 83 fe ff cmp $0xffffffff,%esi + 2f30: 74 30 je 2f62 printf(stdout, "failed sbrk leaked memory\n"); exit(); } if(sbrk(0) > oldbrk) - 2fac: 83 ec 0c sub $0xc,%esp - 2faf: 6a 00 push $0x0 - 2fb1: e8 f0 08 00 00 call 38a6 - 2fb6: 83 c4 10 add $0x10,%esp - 2fb9: 39 45 a4 cmp %eax,-0x5c(%ebp) - 2fbc: 72 36 jb 2ff4 + 2f32: 83 ec 0c sub $0xc,%esp + 2f35: 6a 00 push $0x0 + 2f37: e8 af 08 00 00 call 37eb + 2f3c: 83 c4 10 add $0x10,%esp + 2f3f: 39 45 a4 cmp %eax,-0x5c(%ebp) + 2f42: 72 36 jb 2f7a sbrk(-(sbrk(0) - oldbrk)); printf(stdout, "sbrk test OK\n"); - 2fbe: 83 ec 08 sub $0x8,%esp - 2fc1: 68 14 4b 00 00 push $0x4b14 - 2fc6: ff 35 8c 5c 00 00 pushl 0x5c8c - 2fcc: e8 91 09 00 00 call 3962 + 2f44: 83 ec 08 sub $0x8,%esp + 2f47: 68 3c 4a 00 00 push $0x4a3c + 2f4c: ff 35 10 5c 00 00 push 0x5c10 + 2f52: e8 54 09 00 00 call 38ab } - 2fd1: 83 c4 10 add $0x10,%esp - 2fd4: 8d 65 f4 lea -0xc(%ebp),%esp - 2fd7: 5b pop %ebx - 2fd8: 5e pop %esi - 2fd9: 5f pop %edi - 2fda: 5d pop %ebp - 2fdb: c3 ret + 2f57: 83 c4 10 add $0x10,%esp + 2f5a: 8d 65 f4 lea -0xc(%ebp),%esp + 2f5d: 5b pop %ebx + 2f5e: 5e pop %esi + 2f5f: 5f pop %edi + 2f60: 5d pop %ebp + 2f61: c3 ret printf(stdout, "failed sbrk leaked memory\n"); - 2fdc: 83 ec 08 sub $0x8,%esp - 2fdf: 68 f9 4a 00 00 push $0x4af9 - 2fe4: ff 35 8c 5c 00 00 pushl 0x5c8c - 2fea: e8 73 09 00 00 call 3962 + 2f62: 83 ec 08 sub $0x8,%esp + 2f65: 68 21 4a 00 00 push $0x4a21 + 2f6a: ff 35 10 5c 00 00 push 0x5c10 + 2f70: e8 36 09 00 00 call 38ab exit(); - 2fef: e8 2a 08 00 00 call 381e + 2f75: e8 e9 07 00 00 call 3763 sbrk(-(sbrk(0) - oldbrk)); - 2ff4: 83 ec 0c sub $0xc,%esp - 2ff7: 6a 00 push $0x0 - 2ff9: e8 a8 08 00 00 call 38a6 - 2ffe: 8b 4d a4 mov -0x5c(%ebp),%ecx - 3001: 29 c1 sub %eax,%ecx - 3003: 89 0c 24 mov %ecx,(%esp) - 3006: e8 9b 08 00 00 call 38a6 - 300b: 83 c4 10 add $0x10,%esp - 300e: eb ae jmp 2fbe - -00003010 : - -void -validateint(int *p) -{ - 3010: f3 0f 1e fb endbr32 + 2f7a: 83 ec 0c sub $0xc,%esp + 2f7d: 6a 00 push $0x0 + 2f7f: e8 67 08 00 00 call 37eb + 2f84: 89 c2 mov %eax,%edx + 2f86: 8b 45 a4 mov -0x5c(%ebp),%eax + 2f89: 29 d0 sub %edx,%eax + 2f8b: 89 04 24 mov %eax,(%esp) + 2f8e: e8 58 08 00 00 call 37eb + 2f93: 83 c4 10 add $0x10,%esp + 2f96: eb ac jmp 2f44 + +00002f98 : "int %2\n\t" "mov %%ebx, %%esp" : "=a" (res) : "a" (SYS_sleep), "n" (T_SYSCALL), "c" (p) : "ebx"); } - 3014: c3 ret + 2f98: c3 ret -00003015 : +00002f99 : void validatetest(void) { - 3015: f3 0f 1e fb endbr32 - 3019: 55 push %ebp - 301a: 89 e5 mov %esp,%ebp - 301c: 56 push %esi - 301d: 53 push %ebx + 2f99: 55 push %ebp + 2f9a: 89 e5 mov %esp,%ebp + 2f9c: 56 push %esi + 2f9d: 53 push %ebx int hi, pid; uint p; printf(stdout, "validate test\n"); - 301e: 83 ec 08 sub $0x8,%esp - 3021: 68 22 4b 00 00 push $0x4b22 - 3026: ff 35 8c 5c 00 00 pushl 0x5c8c - 302c: e8 31 09 00 00 call 3962 - 3031: 83 c4 10 add $0x10,%esp + 2f9e: 83 ec 08 sub $0x8,%esp + 2fa1: 68 4a 4a 00 00 push $0x4a4a + 2fa6: ff 35 10 5c 00 00 push 0x5c10 + 2fac: e8 fa 08 00 00 call 38ab + 2fb1: 83 c4 10 add $0x10,%esp hi = 1100*1024; for(p = 0; p <= (uint)hi; p += 4096){ - 3034: be 00 00 00 00 mov $0x0,%esi + 2fb4: be 00 00 00 00 mov $0x0,%esi if((pid = fork()) == 0){ - 3039: e8 d8 07 00 00 call 3816 - 303e: 89 c3 mov %eax,%ebx - 3040: 85 c0 test %eax,%eax - 3042: 74 64 je 30a8 + 2fb9: e8 9d 07 00 00 call 375b + 2fbe: 89 c3 mov %eax,%ebx + 2fc0: 85 c0 test %eax,%eax + 2fc2: 74 64 je 3028 // try to crash the kernel by passing in a badly placed integer validateint((int*)p); exit(); } sleep(0); - 3044: 83 ec 0c sub $0xc,%esp - 3047: 6a 00 push $0x0 - 3049: e8 60 08 00 00 call 38ae + 2fc4: 83 ec 0c sub $0xc,%esp + 2fc7: 6a 00 push $0x0 + 2fc9: e8 25 08 00 00 call 37f3 sleep(0); - 304e: c7 04 24 00 00 00 00 movl $0x0,(%esp) - 3055: e8 54 08 00 00 call 38ae + 2fce: c7 04 24 00 00 00 00 movl $0x0,(%esp) + 2fd5: e8 19 08 00 00 call 37f3 kill(pid); - 305a: 89 1c 24 mov %ebx,(%esp) - 305d: e8 ec 07 00 00 call 384e + 2fda: 89 1c 24 mov %ebx,(%esp) + 2fdd: e8 b1 07 00 00 call 3793 wait(); - 3062: e8 bf 07 00 00 call 3826 + 2fe2: e8 84 07 00 00 call 376b // try to crash the kernel by passing in a bad string pointer if(link("nosuchfile", (char*)p) != -1){ - 3067: 83 c4 08 add $0x8,%esp - 306a: 56 push %esi - 306b: 68 31 4b 00 00 push $0x4b31 - 3070: e8 09 08 00 00 call 387e - 3075: 83 c4 10 add $0x10,%esp - 3078: 83 f8 ff cmp $0xffffffff,%eax - 307b: 75 30 jne 30ad + 2fe7: 83 c4 08 add $0x8,%esp + 2fea: 56 push %esi + 2feb: 68 59 4a 00 00 push $0x4a59 + 2ff0: e8 ce 07 00 00 call 37c3 + 2ff5: 83 c4 10 add $0x10,%esp + 2ff8: 83 f8 ff cmp $0xffffffff,%eax + 2ffb: 75 30 jne 302d for(p = 0; p <= (uint)hi; p += 4096){ - 307d: 81 c6 00 10 00 00 add $0x1000,%esi - 3083: 81 fe 00 40 11 00 cmp $0x114000,%esi - 3089: 75 ae jne 3039 + 2ffd: 81 c6 00 10 00 00 add $0x1000,%esi + 3003: 81 fe 00 40 11 00 cmp $0x114000,%esi + 3009: 75 ae jne 2fb9 printf(stdout, "link should not succeed\n"); exit(); } } printf(stdout, "validate ok\n"); - 308b: 83 ec 08 sub $0x8,%esp - 308e: 68 55 4b 00 00 push $0x4b55 - 3093: ff 35 8c 5c 00 00 pushl 0x5c8c - 3099: e8 c4 08 00 00 call 3962 + 300b: 83 ec 08 sub $0x8,%esp + 300e: 68 7d 4a 00 00 push $0x4a7d + 3013: ff 35 10 5c 00 00 push 0x5c10 + 3019: e8 8d 08 00 00 call 38ab } - 309e: 83 c4 10 add $0x10,%esp - 30a1: 8d 65 f8 lea -0x8(%ebp),%esp - 30a4: 5b pop %ebx - 30a5: 5e pop %esi - 30a6: 5d pop %ebp - 30a7: c3 ret + 301e: 83 c4 10 add $0x10,%esp + 3021: 8d 65 f8 lea -0x8(%ebp),%esp + 3024: 5b pop %ebx + 3025: 5e pop %esi + 3026: 5d pop %ebp + 3027: c3 ret exit(); - 30a8: e8 71 07 00 00 call 381e + 3028: e8 36 07 00 00 call 3763 printf(stdout, "link should not succeed\n"); - 30ad: 83 ec 08 sub $0x8,%esp - 30b0: 68 3c 4b 00 00 push $0x4b3c - 30b5: ff 35 8c 5c 00 00 pushl 0x5c8c - 30bb: e8 a2 08 00 00 call 3962 + 302d: 83 ec 08 sub $0x8,%esp + 3030: 68 64 4a 00 00 push $0x4a64 + 3035: ff 35 10 5c 00 00 push 0x5c10 + 303b: e8 6b 08 00 00 call 38ab exit(); - 30c0: e8 59 07 00 00 call 381e + 3040: e8 1e 07 00 00 call 3763 -000030c5 : +00003045 : // does unintialized data start out zero? char uninit[10000]; void bsstest(void) { - 30c5: f3 0f 1e fb endbr32 - 30c9: 55 push %ebp - 30ca: 89 e5 mov %esp,%ebp - 30cc: 83 ec 10 sub $0x10,%esp + 3045: 55 push %ebp + 3046: 89 e5 mov %esp,%ebp + 3048: 83 ec 10 sub $0x10,%esp int i; printf(stdout, "bss test\n"); - 30cf: 68 62 4b 00 00 push $0x4b62 - 30d4: ff 35 8c 5c 00 00 pushl 0x5c8c - 30da: e8 83 08 00 00 call 3962 - 30df: 83 c4 10 add $0x10,%esp + 304b: 68 8a 4a 00 00 push $0x4a8a + 3050: ff 35 10 5c 00 00 push 0x5c10 + 3056: e8 50 08 00 00 call 38ab + 305b: 83 c4 10 add $0x10,%esp for(i = 0; i < sizeof(uninit); i++){ - 30e2: b8 00 00 00 00 mov $0x0,%eax + 305e: b8 00 00 00 00 mov $0x0,%eax if(uninit[i] != '\0'){ - 30e7: 80 b8 60 5d 00 00 00 cmpb $0x0,0x5d60(%eax) - 30ee: 75 22 jne 3112 + 3063: 80 b8 40 5c 00 00 00 cmpb $0x0,0x5c40(%eax) + 306a: 75 22 jne 308e for(i = 0; i < sizeof(uninit); i++){ - 30f0: 83 c0 01 add $0x1,%eax - 30f3: 3d 10 27 00 00 cmp $0x2710,%eax - 30f8: 75 ed jne 30e7 + 306c: 83 c0 01 add $0x1,%eax + 306f: 3d 10 27 00 00 cmp $0x2710,%eax + 3074: 75 ed jne 3063 printf(stdout, "bss test failed\n"); exit(); } } printf(stdout, "bss test ok\n"); - 30fa: 83 ec 08 sub $0x8,%esp - 30fd: 68 7d 4b 00 00 push $0x4b7d - 3102: ff 35 8c 5c 00 00 pushl 0x5c8c - 3108: e8 55 08 00 00 call 3962 + 3076: 83 ec 08 sub $0x8,%esp + 3079: 68 a5 4a 00 00 push $0x4aa5 + 307e: ff 35 10 5c 00 00 push 0x5c10 + 3084: e8 22 08 00 00 call 38ab } - 310d: 83 c4 10 add $0x10,%esp - 3110: c9 leave - 3111: c3 ret + 3089: 83 c4 10 add $0x10,%esp + 308c: c9 leave + 308d: c3 ret printf(stdout, "bss test failed\n"); - 3112: 83 ec 08 sub $0x8,%esp - 3115: 68 6c 4b 00 00 push $0x4b6c - 311a: ff 35 8c 5c 00 00 pushl 0x5c8c - 3120: e8 3d 08 00 00 call 3962 + 308e: 83 ec 08 sub $0x8,%esp + 3091: 68 94 4a 00 00 push $0x4a94 + 3096: ff 35 10 5c 00 00 push 0x5c10 + 309c: e8 0a 08 00 00 call 38ab exit(); - 3125: e8 f4 06 00 00 call 381e + 30a1: e8 bd 06 00 00 call 3763 -0000312a : +000030a6 : // 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) { - 312a: f3 0f 1e fb endbr32 - 312e: 55 push %ebp - 312f: 89 e5 mov %esp,%ebp - 3131: 83 ec 14 sub $0x14,%esp + 30a6: 55 push %ebp + 30a7: 89 e5 mov %esp,%ebp + 30a9: 83 ec 14 sub $0x14,%esp int pid, fd; unlink("bigarg-ok"); - 3134: 68 8a 4b 00 00 push $0x4b8a - 3139: e8 30 07 00 00 call 386e + 30ac: 68 b2 4a 00 00 push $0x4ab2 + 30b1: e8 fd 06 00 00 call 37b3 pid = fork(); - 313e: e8 d3 06 00 00 call 3816 + 30b6: e8 a0 06 00 00 call 375b if(pid == 0){ - 3143: 83 c4 10 add $0x10,%esp - 3146: 85 c0 test %eax,%eax - 3148: 74 3f je 3189 + 30bb: 83 c4 10 add $0x10,%esp + 30be: 85 c0 test %eax,%eax + 30c0: 74 3f je 3101 exec("echo", args); printf(stdout, "bigarg test ok\n"); fd = open("bigarg-ok", O_CREATE); close(fd); exit(); } else if(pid < 0){ - 314a: 0f 88 ad 00 00 00 js 31fd + 30c2: 0f 88 ad 00 00 00 js 3175 printf(stdout, "bigargtest: fork failed\n"); exit(); } wait(); - 3150: e8 d1 06 00 00 call 3826 + 30c8: e8 9e 06 00 00 call 376b fd = open("bigarg-ok", 0); - 3155: 83 ec 08 sub $0x8,%esp - 3158: 6a 00 push $0x0 - 315a: 68 8a 4b 00 00 push $0x4b8a - 315f: e8 fa 06 00 00 call 385e + 30cd: 83 ec 08 sub $0x8,%esp + 30d0: 6a 00 push $0x0 + 30d2: 68 b2 4a 00 00 push $0x4ab2 + 30d7: e8 c7 06 00 00 call 37a3 if(fd < 0){ - 3164: 83 c4 10 add $0x10,%esp - 3167: 85 c0 test %eax,%eax - 3169: 0f 88 a6 00 00 00 js 3215 + 30dc: 83 c4 10 add $0x10,%esp + 30df: 85 c0 test %eax,%eax + 30e1: 0f 88 a6 00 00 00 js 318d printf(stdout, "bigarg test failed!\n"); exit(); } close(fd); - 316f: 83 ec 0c sub $0xc,%esp - 3172: 50 push %eax - 3173: e8 ce 06 00 00 call 3846 + 30e7: 83 ec 0c sub $0xc,%esp + 30ea: 50 push %eax + 30eb: e8 9b 06 00 00 call 378b unlink("bigarg-ok"); - 3178: c7 04 24 8a 4b 00 00 movl $0x4b8a,(%esp) - 317f: e8 ea 06 00 00 call 386e + 30f0: c7 04 24 b2 4a 00 00 movl $0x4ab2,(%esp) + 30f7: e8 b7 06 00 00 call 37b3 } - 3184: 83 c4 10 add $0x10,%esp - 3187: c9 leave - 3188: c3 ret + 30fc: 83 c4 10 add $0x10,%esp + 30ff: c9 leave + 3100: c3 ret args[i] = "bigargs test: failed\n "; - 3189: c7 04 85 c0 5c 00 00 movl $0x52e4,0x5cc0(,%eax,4) - 3190: e4 52 00 00 + 3101: c7 04 85 60 a3 00 00 movl $0x520c,0xa360(,%eax,4) + 3108: 0c 52 00 00 for(i = 0; i < MAXARG-1; i++) - 3194: 83 c0 01 add $0x1,%eax - 3197: 83 f8 1f cmp $0x1f,%eax - 319a: 75 ed jne 3189 + 310c: 83 c0 01 add $0x1,%eax + 310f: 83 f8 1f cmp $0x1f,%eax + 3112: 75 ed jne 3101 args[MAXARG-1] = 0; - 319c: c7 05 3c 5d 00 00 00 movl $0x0,0x5d3c - 31a3: 00 00 00 + 3114: c7 05 dc a3 00 00 00 movl $0x0,0xa3dc + 311b: 00 00 00 printf(stdout, "bigarg test\n"); - 31a6: 83 ec 08 sub $0x8,%esp - 31a9: 68 94 4b 00 00 push $0x4b94 - 31ae: ff 35 8c 5c 00 00 pushl 0x5c8c - 31b4: e8 a9 07 00 00 call 3962 + 311e: 83 ec 08 sub $0x8,%esp + 3121: 68 bc 4a 00 00 push $0x4abc + 3126: ff 35 10 5c 00 00 push 0x5c10 + 312c: e8 7a 07 00 00 call 38ab exec("echo", args); - 31b9: 83 c4 08 add $0x8,%esp - 31bc: 68 c0 5c 00 00 push $0x5cc0 - 31c1: 68 61 3d 00 00 push $0x3d61 - 31c6: e8 8b 06 00 00 call 3856 + 3131: 83 c4 08 add $0x8,%esp + 3134: 68 60 a3 00 00 push $0xa360 + 3139: 68 89 3c 00 00 push $0x3c89 + 313e: e8 58 06 00 00 call 379b printf(stdout, "bigarg test ok\n"); - 31cb: 83 c4 08 add $0x8,%esp - 31ce: 68 a1 4b 00 00 push $0x4ba1 - 31d3: ff 35 8c 5c 00 00 pushl 0x5c8c - 31d9: e8 84 07 00 00 call 3962 + 3143: 83 c4 08 add $0x8,%esp + 3146: 68 c9 4a 00 00 push $0x4ac9 + 314b: ff 35 10 5c 00 00 push 0x5c10 + 3151: e8 55 07 00 00 call 38ab fd = open("bigarg-ok", O_CREATE); - 31de: 83 c4 08 add $0x8,%esp - 31e1: 68 00 02 00 00 push $0x200 - 31e6: 68 8a 4b 00 00 push $0x4b8a - 31eb: e8 6e 06 00 00 call 385e + 3156: 83 c4 08 add $0x8,%esp + 3159: 68 00 02 00 00 push $0x200 + 315e: 68 b2 4a 00 00 push $0x4ab2 + 3163: e8 3b 06 00 00 call 37a3 close(fd); - 31f0: 89 04 24 mov %eax,(%esp) - 31f3: e8 4e 06 00 00 call 3846 + 3168: 89 04 24 mov %eax,(%esp) + 316b: e8 1b 06 00 00 call 378b exit(); - 31f8: e8 21 06 00 00 call 381e + 3170: e8 ee 05 00 00 call 3763 printf(stdout, "bigargtest: fork failed\n"); - 31fd: 83 ec 08 sub $0x8,%esp - 3200: 68 b1 4b 00 00 push $0x4bb1 - 3205: ff 35 8c 5c 00 00 pushl 0x5c8c - 320b: e8 52 07 00 00 call 3962 + 3175: 83 ec 08 sub $0x8,%esp + 3178: 68 d9 4a 00 00 push $0x4ad9 + 317d: ff 35 10 5c 00 00 push 0x5c10 + 3183: e8 23 07 00 00 call 38ab exit(); - 3210: e8 09 06 00 00 call 381e + 3188: e8 d6 05 00 00 call 3763 printf(stdout, "bigarg test failed!\n"); - 3215: 83 ec 08 sub $0x8,%esp - 3218: 68 ca 4b 00 00 push $0x4bca - 321d: ff 35 8c 5c 00 00 pushl 0x5c8c - 3223: e8 3a 07 00 00 call 3962 + 318d: 83 ec 08 sub $0x8,%esp + 3190: 68 f2 4a 00 00 push $0x4af2 + 3195: ff 35 10 5c 00 00 push 0x5c10 + 319b: e8 0b 07 00 00 call 38ab exit(); - 3228: e8 f1 05 00 00 call 381e + 31a0: e8 be 05 00 00 call 3763 -0000322d : +000031a5 : // what happens when the file system runs out of blocks? // answer: balloc panics, so this test is not useful. void fsfull() { - 322d: f3 0f 1e fb endbr32 - 3231: 55 push %ebp - 3232: 89 e5 mov %esp,%ebp - 3234: 57 push %edi - 3235: 56 push %esi - 3236: 53 push %ebx - 3237: 83 ec 54 sub $0x54,%esp + 31a5: 55 push %ebp + 31a6: 89 e5 mov %esp,%ebp + 31a8: 57 push %edi + 31a9: 56 push %esi + 31aa: 53 push %ebx + 31ab: 83 ec 64 sub $0x64,%esp int nfiles; int fsblocks = 0; printf(1, "fsfull test\n"); - 323a: 68 df 4b 00 00 push $0x4bdf - 323f: 6a 01 push $0x1 - 3241: e8 1c 07 00 00 call 3962 - 3246: 83 c4 10 add $0x10,%esp + 31ae: 68 07 4b 00 00 push $0x4b07 + 31b3: 6a 01 push $0x1 + 31b5: e8 f1 06 00 00 call 38ab + 31ba: 83 c4 10 add $0x10,%esp for(nfiles = 0; ; nfiles++){ - 3249: bb 00 00 00 00 mov $0x0,%ebx + 31bd: bb 00 00 00 00 mov $0x0,%ebx char name[64]; name[0] = 'f'; - 324e: c6 45 a8 66 movb $0x66,-0x58(%ebp) + 31c2: c6 45 a8 66 movb $0x66,-0x58(%ebp) name[1] = '0' + nfiles / 1000; - 3252: b8 d3 4d 62 10 mov $0x10624dd3,%eax - 3257: f7 eb imul %ebx - 3259: c1 fa 06 sar $0x6,%edx - 325c: 89 de mov %ebx,%esi - 325e: c1 fe 1f sar $0x1f,%esi - 3261: 29 f2 sub %esi,%edx - 3263: 8d 42 30 lea 0x30(%edx),%eax - 3266: 88 45 a9 mov %al,-0x57(%ebp) + 31c6: b8 d3 4d 62 10 mov $0x10624dd3,%eax + 31cb: f7 eb imul %ebx + 31cd: c1 fa 06 sar $0x6,%edx + 31d0: 89 de mov %ebx,%esi + 31d2: c1 fe 1f sar $0x1f,%esi + 31d5: 29 f2 sub %esi,%edx + 31d7: 8d 42 30 lea 0x30(%edx),%eax + 31da: 88 45 a9 mov %al,-0x57(%ebp) name[2] = '0' + (nfiles % 1000) / 100; - 3269: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx - 326f: 89 d9 mov %ebx,%ecx - 3271: 29 d1 sub %edx,%ecx - 3273: b8 1f 85 eb 51 mov $0x51eb851f,%eax - 3278: f7 e9 imul %ecx - 327a: c1 fa 05 sar $0x5,%edx - 327d: c1 f9 1f sar $0x1f,%ecx - 3280: 29 ca sub %ecx,%edx - 3282: 83 c2 30 add $0x30,%edx - 3285: 88 55 aa mov %dl,-0x56(%ebp) + 31dd: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx + 31e3: 89 d9 mov %ebx,%ecx + 31e5: 29 d1 sub %edx,%ecx + 31e7: b8 1f 85 eb 51 mov $0x51eb851f,%eax + 31ec: f7 e9 imul %ecx + 31ee: c1 fa 05 sar $0x5,%edx + 31f1: c1 f9 1f sar $0x1f,%ecx + 31f4: 29 ca sub %ecx,%edx + 31f6: 83 c2 30 add $0x30,%edx + 31f9: 88 55 aa mov %dl,-0x56(%ebp) name[3] = '0' + (nfiles % 100) / 10; - 3288: b8 1f 85 eb 51 mov $0x51eb851f,%eax - 328d: f7 eb imul %ebx - 328f: c1 fa 05 sar $0x5,%edx - 3292: 29 f2 sub %esi,%edx - 3294: 6b d2 64 imul $0x64,%edx,%edx - 3297: 89 df mov %ebx,%edi - 3299: 29 d7 sub %edx,%edi - 329b: b9 67 66 66 66 mov $0x66666667,%ecx - 32a0: 89 f8 mov %edi,%eax - 32a2: f7 e9 imul %ecx - 32a4: c1 fa 02 sar $0x2,%edx - 32a7: c1 ff 1f sar $0x1f,%edi - 32aa: 29 fa sub %edi,%edx - 32ac: 83 c2 30 add $0x30,%edx - 32af: 88 55 ab mov %dl,-0x55(%ebp) + 31fc: b8 1f 85 eb 51 mov $0x51eb851f,%eax + 3201: f7 eb imul %ebx + 3203: c1 fa 05 sar $0x5,%edx + 3206: 29 f2 sub %esi,%edx + 3208: 6b d2 64 imul $0x64,%edx,%edx + 320b: 89 df mov %ebx,%edi + 320d: 29 d7 sub %edx,%edi + 320f: b9 67 66 66 66 mov $0x66666667,%ecx + 3214: 89 f8 mov %edi,%eax + 3216: f7 e9 imul %ecx + 3218: c1 fa 02 sar $0x2,%edx + 321b: c1 ff 1f sar $0x1f,%edi + 321e: 29 fa sub %edi,%edx + 3220: 83 c2 30 add $0x30,%edx + 3223: 88 55 ab mov %dl,-0x55(%ebp) name[4] = '0' + (nfiles % 10); - 32b2: 89 d8 mov %ebx,%eax - 32b4: f7 e9 imul %ecx - 32b6: c1 fa 02 sar $0x2,%edx - 32b9: 29 f2 sub %esi,%edx - 32bb: 8d 04 92 lea (%edx,%edx,4),%eax - 32be: 01 c0 add %eax,%eax - 32c0: 89 df mov %ebx,%edi - 32c2: 29 c7 sub %eax,%edi - 32c4: 89 f8 mov %edi,%eax - 32c6: 83 c0 30 add $0x30,%eax - 32c9: 88 45 ac mov %al,-0x54(%ebp) + 3226: 89 d8 mov %ebx,%eax + 3228: f7 e9 imul %ecx + 322a: c1 fa 02 sar $0x2,%edx + 322d: 29 f2 sub %esi,%edx + 322f: 8d 14 92 lea (%edx,%edx,4),%edx + 3232: 01 d2 add %edx,%edx + 3234: 89 d8 mov %ebx,%eax + 3236: 29 d0 sub %edx,%eax + 3238: 83 c0 30 add $0x30,%eax + 323b: 88 45 ac mov %al,-0x54(%ebp) name[5] = '\0'; - 32cc: c6 45 ad 00 movb $0x0,-0x53(%ebp) + 323e: c6 45 ad 00 movb $0x0,-0x53(%ebp) printf(1, "writing %s\n", name); - 32d0: 83 ec 04 sub $0x4,%esp - 32d3: 8d 75 a8 lea -0x58(%ebp),%esi - 32d6: 56 push %esi - 32d7: 68 ec 4b 00 00 push $0x4bec - 32dc: 6a 01 push $0x1 - 32de: e8 7f 06 00 00 call 3962 + 3242: 83 ec 04 sub $0x4,%esp + 3245: 8d 75 a8 lea -0x58(%ebp),%esi + 3248: 56 push %esi + 3249: 68 14 4b 00 00 push $0x4b14 + 324e: 6a 01 push $0x1 + 3250: e8 56 06 00 00 call 38ab int fd = open(name, O_CREATE|O_RDWR); - 32e3: 83 c4 08 add $0x8,%esp - 32e6: 68 02 02 00 00 push $0x202 - 32eb: 56 push %esi - 32ec: e8 6d 05 00 00 call 385e - 32f1: 89 c6 mov %eax,%esi + 3255: 83 c4 08 add $0x8,%esp + 3258: 68 02 02 00 00 push $0x202 + 325d: 56 push %esi + 325e: e8 40 05 00 00 call 37a3 + 3263: 89 c6 mov %eax,%esi if(fd < 0){ - 32f3: 83 c4 10 add $0x10,%esp - 32f6: 85 c0 test %eax,%eax - 32f8: 0f 89 d5 00 00 00 jns 33d3 + 3265: 83 c4 10 add $0x10,%esp + 3268: 85 c0 test %eax,%eax + 326a: 0f 89 d6 00 00 00 jns 3346 printf(1, "open %s failed\n", name); - 32fe: 83 ec 04 sub $0x4,%esp - 3301: 8d 45 a8 lea -0x58(%ebp),%eax - 3304: 50 push %eax - 3305: 68 f8 4b 00 00 push $0x4bf8 - 330a: 6a 01 push $0x1 - 330c: e8 51 06 00 00 call 3962 + 3270: 83 ec 04 sub $0x4,%esp + 3273: 8d 45 a8 lea -0x58(%ebp),%eax + 3276: 50 push %eax + 3277: 68 20 4b 00 00 push $0x4b20 + 327c: 6a 01 push $0x1 + 327e: e8 28 06 00 00 call 38ab break; - 3311: 83 c4 10 add $0x10,%esp + 3283: 83 c4 10 add $0x10,%esp close(fd); if(total == 0) break; } while(nfiles >= 0){ - 3314: 85 db test %ebx,%ebx - 3316: 0f 88 9d 00 00 00 js 33b9 + 3286: 85 db test %ebx,%ebx + 3288: 0f 88 9e 00 00 00 js 332c char name[64]; name[0] = 'f'; - 331c: c6 45 a8 66 movb $0x66,-0x58(%ebp) name[1] = '0' + nfiles / 1000; - 3320: b8 d3 4d 62 10 mov $0x10624dd3,%eax - 3325: f7 eb imul %ebx - 3327: c1 fa 06 sar $0x6,%edx - 332a: 89 de mov %ebx,%esi - 332c: c1 fe 1f sar $0x1f,%esi - 332f: 29 f2 sub %esi,%edx - 3331: 8d 42 30 lea 0x30(%edx),%eax - 3334: 88 45 a9 mov %al,-0x57(%ebp) name[2] = '0' + (nfiles % 1000) / 100; - 3337: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx - 333d: 89 d9 mov %ebx,%ecx - 333f: 29 d1 sub %edx,%ecx - 3341: b8 1f 85 eb 51 mov $0x51eb851f,%eax - 3346: f7 e9 imul %ecx - 3348: c1 fa 05 sar $0x5,%edx - 334b: c1 f9 1f sar $0x1f,%ecx - 334e: 29 ca sub %ecx,%edx - 3350: 83 c2 30 add $0x30,%edx - 3353: 88 55 aa mov %dl,-0x56(%ebp) + 328e: bf 1f 85 eb 51 mov $0x51eb851f,%edi + name[0] = 'f'; + 3293: c6 45 a8 66 movb $0x66,-0x58(%ebp) + name[1] = '0' + nfiles / 1000; + 3297: b8 d3 4d 62 10 mov $0x10624dd3,%eax + 329c: f7 eb imul %ebx + 329e: c1 fa 06 sar $0x6,%edx + 32a1: 89 de mov %ebx,%esi + 32a3: c1 fe 1f sar $0x1f,%esi + 32a6: 29 f2 sub %esi,%edx + 32a8: 8d 42 30 lea 0x30(%edx),%eax + 32ab: 88 45 a9 mov %al,-0x57(%ebp) + name[2] = '0' + (nfiles % 1000) / 100; + 32ae: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx + 32b4: 89 d9 mov %ebx,%ecx + 32b6: 29 d1 sub %edx,%ecx + 32b8: 89 c8 mov %ecx,%eax + 32ba: f7 ef imul %edi + 32bc: c1 fa 05 sar $0x5,%edx + 32bf: c1 f9 1f sar $0x1f,%ecx + 32c2: 29 ca sub %ecx,%edx + 32c4: 83 c2 30 add $0x30,%edx + 32c7: 88 55 aa mov %dl,-0x56(%ebp) name[3] = '0' + (nfiles % 100) / 10; - 3356: b8 1f 85 eb 51 mov $0x51eb851f,%eax - 335b: f7 eb imul %ebx - 335d: c1 fa 05 sar $0x5,%edx - 3360: 29 f2 sub %esi,%edx - 3362: 6b d2 64 imul $0x64,%edx,%edx - 3365: 89 df mov %ebx,%edi - 3367: 29 d7 sub %edx,%edi - 3369: b9 67 66 66 66 mov $0x66666667,%ecx - 336e: 89 f8 mov %edi,%eax - 3370: f7 e9 imul %ecx - 3372: c1 fa 02 sar $0x2,%edx - 3375: c1 ff 1f sar $0x1f,%edi - 3378: 29 fa sub %edi,%edx - 337a: 83 c2 30 add $0x30,%edx - 337d: 88 55 ab mov %dl,-0x55(%ebp) + 32ca: 89 d8 mov %ebx,%eax + 32cc: f7 ef imul %edi + 32ce: c1 fa 05 sar $0x5,%edx + 32d1: 89 75 a4 mov %esi,-0x5c(%ebp) + 32d4: 29 f2 sub %esi,%edx + 32d6: 6b d2 64 imul $0x64,%edx,%edx + 32d9: 89 d8 mov %ebx,%eax + 32db: 29 d0 sub %edx,%eax + 32dd: 89 c6 mov %eax,%esi + 32df: b9 67 66 66 66 mov $0x66666667,%ecx + 32e4: f7 e9 imul %ecx + 32e6: c1 fa 02 sar $0x2,%edx + 32e9: c1 fe 1f sar $0x1f,%esi + 32ec: 29 f2 sub %esi,%edx + 32ee: 83 c2 30 add $0x30,%edx + 32f1: 88 55 ab mov %dl,-0x55(%ebp) name[4] = '0' + (nfiles % 10); - 3380: 89 d8 mov %ebx,%eax - 3382: f7 e9 imul %ecx - 3384: c1 fa 02 sar $0x2,%edx - 3387: 29 f2 sub %esi,%edx - 3389: 8d 04 92 lea (%edx,%edx,4),%eax - 338c: 01 c0 add %eax,%eax - 338e: 89 de mov %ebx,%esi - 3390: 29 c6 sub %eax,%esi - 3392: 89 f0 mov %esi,%eax - 3394: 83 c0 30 add $0x30,%eax - 3397: 88 45 ac mov %al,-0x54(%ebp) + 32f4: 89 d8 mov %ebx,%eax + 32f6: f7 e9 imul %ecx + 32f8: c1 fa 02 sar $0x2,%edx + 32fb: 2b 55 a4 sub -0x5c(%ebp),%edx + 32fe: 8d 14 92 lea (%edx,%edx,4),%edx + 3301: 01 d2 add %edx,%edx + 3303: 89 d8 mov %ebx,%eax + 3305: 29 d0 sub %edx,%eax + 3307: 83 c0 30 add $0x30,%eax + 330a: 88 45 ac mov %al,-0x54(%ebp) name[5] = '\0'; - 339a: c6 45 ad 00 movb $0x0,-0x53(%ebp) + 330d: c6 45 ad 00 movb $0x0,-0x53(%ebp) unlink(name); - 339e: 83 ec 0c sub $0xc,%esp - 33a1: 8d 45 a8 lea -0x58(%ebp),%eax - 33a4: 50 push %eax - 33a5: e8 c4 04 00 00 call 386e + 3311: 83 ec 0c sub $0xc,%esp + 3314: 8d 45 a8 lea -0x58(%ebp),%eax + 3317: 50 push %eax + 3318: e8 96 04 00 00 call 37b3 nfiles--; - 33aa: 83 eb 01 sub $0x1,%ebx + 331d: 83 eb 01 sub $0x1,%ebx while(nfiles >= 0){ - 33ad: 83 c4 10 add $0x10,%esp - 33b0: 83 fb ff cmp $0xffffffff,%ebx - 33b3: 0f 85 63 ff ff ff jne 331c + 3320: 83 c4 10 add $0x10,%esp + 3323: 83 fb ff cmp $0xffffffff,%ebx + 3326: 0f 85 67 ff ff ff jne 3293 } printf(1, "fsfull test finished\n"); - 33b9: 83 ec 08 sub $0x8,%esp - 33bc: 68 18 4c 00 00 push $0x4c18 - 33c1: 6a 01 push $0x1 - 33c3: e8 9a 05 00 00 call 3962 + 332c: 83 ec 08 sub $0x8,%esp + 332f: 68 40 4b 00 00 push $0x4b40 + 3334: 6a 01 push $0x1 + 3336: e8 70 05 00 00 call 38ab } - 33c8: 83 c4 10 add $0x10,%esp - 33cb: 8d 65 f4 lea -0xc(%ebp),%esp - 33ce: 5b pop %ebx - 33cf: 5e pop %esi - 33d0: 5f pop %edi - 33d1: 5d pop %ebp - 33d2: c3 ret + 333b: 83 c4 10 add $0x10,%esp + 333e: 8d 65 f4 lea -0xc(%ebp),%esp + 3341: 5b pop %ebx + 3342: 5e pop %esi + 3343: 5f pop %edi + 3344: 5d pop %ebp + 3345: c3 ret int total = 0; - 33d3: bf 00 00 00 00 mov $0x0,%edi + 3346: bf 00 00 00 00 mov $0x0,%edi int cc = write(fd, buf, 512); - 33d8: 83 ec 04 sub $0x4,%esp - 33db: 68 00 02 00 00 push $0x200 - 33e0: 68 80 84 00 00 push $0x8480 - 33e5: 56 push %esi - 33e6: e8 53 04 00 00 call 383e + 334b: 83 ec 04 sub $0x4,%esp + 334e: 68 00 02 00 00 push $0x200 + 3353: 68 60 83 00 00 push $0x8360 + 3358: 56 push %esi + 3359: e8 25 04 00 00 call 3783 if(cc < 512) - 33eb: 83 c4 10 add $0x10,%esp - 33ee: 3d ff 01 00 00 cmp $0x1ff,%eax - 33f3: 7e 04 jle 33f9 + 335e: 83 c4 10 add $0x10,%esp + 3361: 3d ff 01 00 00 cmp $0x1ff,%eax + 3366: 7e 04 jle 336c total += cc; - 33f5: 01 c7 add %eax,%edi + 3368: 01 c7 add %eax,%edi while(1){ - 33f7: eb df jmp 33d8 + 336a: eb df jmp 334b printf(1, "wrote %d bytes\n", total); - 33f9: 83 ec 04 sub $0x4,%esp - 33fc: 57 push %edi - 33fd: 68 08 4c 00 00 push $0x4c08 - 3402: 6a 01 push $0x1 - 3404: e8 59 05 00 00 call 3962 + 336c: 83 ec 04 sub $0x4,%esp + 336f: 57 push %edi + 3370: 68 30 4b 00 00 push $0x4b30 + 3375: 6a 01 push $0x1 + 3377: e8 2f 05 00 00 call 38ab close(fd); - 3409: 89 34 24 mov %esi,(%esp) - 340c: e8 35 04 00 00 call 3846 + 337c: 89 34 24 mov %esi,(%esp) + 337f: e8 07 04 00 00 call 378b if(total == 0) - 3411: 83 c4 10 add $0x10,%esp - 3414: 85 ff test %edi,%edi - 3416: 0f 84 f8 fe ff ff je 3314 + 3384: 83 c4 10 add $0x10,%esp + 3387: 85 ff test %edi,%edi + 3389: 0f 84 f7 fe ff ff je 3286 for(nfiles = 0; ; nfiles++){ - 341c: 83 c3 01 add $0x1,%ebx - 341f: e9 2a fe ff ff jmp 324e + 338f: 83 c3 01 add $0x1,%ebx + 3392: e9 2b fe ff ff jmp 31c2 -00003424 : +00003397 : void uio() { - 3424: f3 0f 1e fb endbr32 - 3428: 55 push %ebp - 3429: 89 e5 mov %esp,%ebp - 342b: 83 ec 10 sub $0x10,%esp + 3397: 55 push %ebp + 3398: 89 e5 mov %esp,%ebp + 339a: 83 ec 10 sub $0x10,%esp ushort port = 0; uchar val = 0; int pid; printf(1, "uio test\n"); - 342e: 68 2e 4c 00 00 push $0x4c2e - 3433: 6a 01 push $0x1 - 3435: e8 28 05 00 00 call 3962 + 339d: 68 56 4b 00 00 push $0x4b56 + 33a2: 6a 01 push $0x1 + 33a4: e8 02 05 00 00 call 38ab pid = fork(); - 343a: e8 d7 03 00 00 call 3816 + 33a9: e8 ad 03 00 00 call 375b if(pid == 0){ - 343f: 83 c4 10 add $0x10,%esp - 3442: 85 c0 test %eax,%eax - 3444: 74 1b je 3461 + 33ae: 83 c4 10 add $0x10,%esp + 33b1: 85 c0 test %eax,%eax + 33b3: 74 1b je 33d0 asm volatile("outb %0,%1"::"a"(val), "d" (port)); port = RTC_DATA; asm volatile("inb %1,%0" : "=a" (val) : "d" (port)); printf(1, "uio: uio succeeded; test FAILED\n"); exit(); } else if(pid < 0){ - 3446: 78 3e js 3486 + 33b5: 78 3e js 33f5 printf (1, "fork failed\n"); exit(); } wait(); - 3448: e8 d9 03 00 00 call 3826 + 33b7: e8 af 03 00 00 call 376b printf(1, "uio test done\n"); - 344d: 83 ec 08 sub $0x8,%esp - 3450: 68 38 4c 00 00 push $0x4c38 - 3455: 6a 01 push $0x1 - 3457: e8 06 05 00 00 call 3962 + 33bc: 83 ec 08 sub $0x8,%esp + 33bf: 68 60 4b 00 00 push $0x4b60 + 33c4: 6a 01 push $0x1 + 33c6: e8 e0 04 00 00 call 38ab } - 345c: 83 c4 10 add $0x10,%esp - 345f: c9 leave - 3460: c3 ret + 33cb: 83 c4 10 add $0x10,%esp + 33ce: c9 leave + 33cf: c3 ret asm volatile("outb %0,%1"::"a"(val), "d" (port)); - 3461: b8 09 00 00 00 mov $0x9,%eax - 3466: ba 70 00 00 00 mov $0x70,%edx - 346b: ee out %al,(%dx) + 33d0: b8 09 00 00 00 mov $0x9,%eax + 33d5: ba 70 00 00 00 mov $0x70,%edx + 33da: ee out %al,(%dx) asm volatile("inb %1,%0" : "=a" (val) : "d" (port)); - 346c: ba 71 00 00 00 mov $0x71,%edx - 3471: ec in (%dx),%al + 33db: ba 71 00 00 00 mov $0x71,%edx + 33e0: ec in (%dx),%al printf(1, "uio: uio succeeded; test FAILED\n"); - 3472: 83 ec 08 sub $0x8,%esp - 3475: 68 c4 53 00 00 push $0x53c4 - 347a: 6a 01 push $0x1 - 347c: e8 e1 04 00 00 call 3962 + 33e1: 83 ec 08 sub $0x8,%esp + 33e4: 68 ec 52 00 00 push $0x52ec + 33e9: 6a 01 push $0x1 + 33eb: e8 bb 04 00 00 call 38ab exit(); - 3481: e8 98 03 00 00 call 381e + 33f0: e8 6e 03 00 00 call 3763 printf (1, "fork failed\n"); - 3486: 83 ec 08 sub $0x8,%esp - 3489: 68 bd 4b 00 00 push $0x4bbd - 348e: 6a 01 push $0x1 - 3490: e8 cd 04 00 00 call 3962 + 33f5: 83 ec 08 sub $0x8,%esp + 33f8: 68 e5 4a 00 00 push $0x4ae5 + 33fd: 6a 01 push $0x1 + 33ff: e8 a7 04 00 00 call 38ab exit(); - 3495: e8 84 03 00 00 call 381e + 3404: e8 5a 03 00 00 call 3763 -0000349a : +00003409 : void argptest() { - 349a: f3 0f 1e fb endbr32 - 349e: 55 push %ebp - 349f: 89 e5 mov %esp,%ebp - 34a1: 53 push %ebx - 34a2: 83 ec 0c sub $0xc,%esp + 3409: 55 push %ebp + 340a: 89 e5 mov %esp,%ebp + 340c: 53 push %ebx + 340d: 83 ec 0c sub $0xc,%esp int fd; fd = open("init", O_RDONLY); - 34a5: 6a 00 push $0x0 - 34a7: 68 47 4c 00 00 push $0x4c47 - 34ac: e8 ad 03 00 00 call 385e + 3410: 6a 00 push $0x0 + 3412: 68 6f 4b 00 00 push $0x4b6f + 3417: e8 87 03 00 00 call 37a3 if (fd < 0) { - 34b1: 83 c4 10 add $0x10,%esp - 34b4: 85 c0 test %eax,%eax - 34b6: 78 3a js 34f2 - 34b8: 89 c3 mov %eax,%ebx + 341c: 83 c4 10 add $0x10,%esp + 341f: 85 c0 test %eax,%eax + 3421: 78 3a js 345d + 3423: 89 c3 mov %eax,%ebx printf(2, "open failed\n"); exit(); } read(fd, sbrk(0) - 1, -1); - 34ba: 83 ec 0c sub $0xc,%esp - 34bd: 6a 00 push $0x0 - 34bf: e8 e2 03 00 00 call 38a6 - 34c4: 83 c4 0c add $0xc,%esp - 34c7: 6a ff push $0xffffffff - 34c9: 83 e8 01 sub $0x1,%eax - 34cc: 50 push %eax - 34cd: 53 push %ebx - 34ce: e8 63 03 00 00 call 3836 + 3425: 83 ec 0c sub $0xc,%esp + 3428: 6a 00 push $0x0 + 342a: e8 bc 03 00 00 call 37eb + 342f: 83 c4 0c add $0xc,%esp + 3432: 6a ff push $0xffffffff + 3434: 83 e8 01 sub $0x1,%eax + 3437: 50 push %eax + 3438: 53 push %ebx + 3439: e8 3d 03 00 00 call 377b close(fd); - 34d3: 89 1c 24 mov %ebx,(%esp) - 34d6: e8 6b 03 00 00 call 3846 + 343e: 89 1c 24 mov %ebx,(%esp) + 3441: e8 45 03 00 00 call 378b printf(1, "arg test passed\n"); - 34db: 83 c4 08 add $0x8,%esp - 34de: 68 59 4c 00 00 push $0x4c59 - 34e3: 6a 01 push $0x1 - 34e5: e8 78 04 00 00 call 3962 + 3446: 83 c4 08 add $0x8,%esp + 3449: 68 81 4b 00 00 push $0x4b81 + 344e: 6a 01 push $0x1 + 3450: e8 56 04 00 00 call 38ab } - 34ea: 83 c4 10 add $0x10,%esp - 34ed: 8b 5d fc mov -0x4(%ebp),%ebx - 34f0: c9 leave - 34f1: c3 ret + 3455: 83 c4 10 add $0x10,%esp + 3458: 8b 5d fc mov -0x4(%ebp),%ebx + 345b: c9 leave + 345c: c3 ret printf(2, "open failed\n"); - 34f2: 83 ec 08 sub $0x8,%esp - 34f5: 68 4c 4c 00 00 push $0x4c4c - 34fa: 6a 02 push $0x2 - 34fc: e8 61 04 00 00 call 3962 + 345d: 83 ec 08 sub $0x8,%esp + 3460: 68 74 4b 00 00 push $0x4b74 + 3465: 6a 02 push $0x2 + 3467: e8 3f 04 00 00 call 38ab exit(); - 3501: e8 18 03 00 00 call 381e + 346c: e8 f2 02 00 00 call 3763 -00003506 : +00003471 : unsigned long randstate = 1; unsigned int rand() { - 3506: f3 0f 1e fb endbr32 randstate = randstate * 1664525 + 1013904223; - 350a: 69 05 88 5c 00 00 0d imul $0x19660d,0x5c88,%eax - 3511: 66 19 00 - 3514: 05 5f f3 6e 3c add $0x3c6ef35f,%eax - 3519: a3 88 5c 00 00 mov %eax,0x5c88 + 3471: 69 05 0c 5c 00 00 0d imul $0x19660d,0x5c0c,%eax + 3478: 66 19 00 + 347b: 05 5f f3 6e 3c add $0x3c6ef35f,%eax + 3480: a3 0c 5c 00 00 mov %eax,0x5c0c return randstate; } - 351e: c3 ret + 3485: c3 ret -0000351f
: +00003486
: int main(int argc, char *argv[]) { - 351f: f3 0f 1e fb endbr32 - 3523: 8d 4c 24 04 lea 0x4(%esp),%ecx - 3527: 83 e4 f0 and $0xfffffff0,%esp - 352a: ff 71 fc pushl -0x4(%ecx) - 352d: 55 push %ebp - 352e: 89 e5 mov %esp,%ebp - 3530: 51 push %ecx - 3531: 83 ec 0c sub $0xc,%esp + 3486: 8d 4c 24 04 lea 0x4(%esp),%ecx + 348a: 83 e4 f0 and $0xfffffff0,%esp + 348d: ff 71 fc push -0x4(%ecx) + 3490: 55 push %ebp + 3491: 89 e5 mov %esp,%ebp + 3493: 51 push %ecx + 3494: 83 ec 0c sub $0xc,%esp printf(1, "usertests starting\n"); - 3534: 68 6a 4c 00 00 push $0x4c6a - 3539: 6a 01 push $0x1 - 353b: e8 22 04 00 00 call 3962 + 3497: 68 92 4b 00 00 push $0x4b92 + 349c: 6a 01 push $0x1 + 349e: e8 08 04 00 00 call 38ab if(open("usertests.ran", 0) >= 0){ - 3540: 83 c4 08 add $0x8,%esp - 3543: 6a 00 push $0x0 - 3545: 68 7e 4c 00 00 push $0x4c7e - 354a: e8 0f 03 00 00 call 385e - 354f: 83 c4 10 add $0x10,%esp - 3552: 85 c0 test %eax,%eax - 3554: 78 14 js 356a + 34a3: 83 c4 08 add $0x8,%esp + 34a6: 6a 00 push $0x0 + 34a8: 68 a6 4b 00 00 push $0x4ba6 + 34ad: e8 f1 02 00 00 call 37a3 + 34b2: 83 c4 10 add $0x10,%esp + 34b5: 85 c0 test %eax,%eax + 34b7: 78 14 js 34cd printf(1, "already ran user tests -- rebuild fs.img\n"); - 3556: 83 ec 08 sub $0x8,%esp - 3559: 68 e8 53 00 00 push $0x53e8 - 355e: 6a 01 push $0x1 - 3560: e8 fd 03 00 00 call 3962 + 34b9: 83 ec 08 sub $0x8,%esp + 34bc: 68 10 53 00 00 push $0x5310 + 34c1: 6a 01 push $0x1 + 34c3: e8 e3 03 00 00 call 38ab exit(); - 3565: e8 b4 02 00 00 call 381e + 34c8: e8 96 02 00 00 call 3763 } close(open("usertests.ran", O_CREATE)); - 356a: 83 ec 08 sub $0x8,%esp - 356d: 68 00 02 00 00 push $0x200 - 3572: 68 7e 4c 00 00 push $0x4c7e - 3577: e8 e2 02 00 00 call 385e - 357c: 89 04 24 mov %eax,(%esp) - 357f: e8 c2 02 00 00 call 3846 + 34cd: 83 ec 08 sub $0x8,%esp + 34d0: 68 00 02 00 00 push $0x200 + 34d5: 68 a6 4b 00 00 push $0x4ba6 + 34da: e8 c4 02 00 00 call 37a3 + 34df: 89 04 24 mov %eax,(%esp) + 34e2: e8 a4 02 00 00 call 378b argptest(); - 3584: e8 11 ff ff ff call 349a + 34e7: e8 1d ff ff ff call 3409 createdelete(); - 3589: e8 ac da ff ff call 103a + 34ec: e8 0b db ff ff call ffc linkunlink(); - 358e: e8 65 e3 ff ff call 18f8 + 34f1: e8 b4 e3 ff ff call 18aa concreate(); - 3593: e8 61 e0 ff ff call 15f9 + 34f6: e8 b4 e0 ff ff call 15af fourfiles(); - 3598: e8 c3 d8 ff ff call e60 + 34fb: e8 26 d9 ff ff call e26 sharedfd(); - 359d: e8 27 d7 ff ff call cc9 + 3500: e8 8e d7 ff ff call c93 bigargtest(); - 35a2: e8 83 fb ff ff call 312a + 3505: e8 9c fb ff ff call 30a6 bigwrite(); - 35a7: e8 d2 ec ff ff call 227e + 350a: e8 15 ed ff ff call 2224 bigargtest(); - 35ac: e8 79 fb ff ff call 312a + 350f: e8 92 fb ff ff call 30a6 bsstest(); - 35b1: e8 0f fb ff ff call 30c5 + 3514: e8 2c fb ff ff call 3045 sbrktest(); - 35b6: e8 2f f6 ff ff call 2bea + 3519: e8 54 f6 ff ff call 2b72 validatetest(); - 35bb: e8 55 fa ff ff call 3015 + 351e: e8 76 fa ff ff call 2f99 opentest(); - 35c0: e8 f3 cc ff ff call 2b8 + 3523: e8 84 cd ff ff call 2ac writetest(); - 35c5: e8 85 cd ff ff call 34f + 3528: e8 12 ce ff ff call 33f writetest1(); - 35ca: e8 62 cf ff ff call 531 + 352d: e8 eb cf ff ff call 51d createtest(); - 35cf: e8 1b d1 ff ff call 6ef + 3532: e8 a0 d1 ff ff call 6d7 openiputtest(); - 35d4: e8 f2 cb ff ff call 1cb + 3537: e8 87 cc ff ff call 1c3 exitiputtest(); - 35d9: e8 03 cb ff ff call e1 + 353c: e8 9c cb ff ff call dd iputtest(); - 35de: e8 1d ca ff ff call 0 + 3541: e8 ba ca ff ff call 0 mem(); - 35e3: e8 26 d6 ff ff call c0e + 3546: e8 93 d6 ff ff call bde pipe1(); - 35e8: e8 d8 d2 ff ff call 8c5 + 354b: e8 51 d3 ff ff call 8a1 preempt(); - 35ed: e8 6e d4 ff ff call a60 + 3550: e8 e3 d4 ff ff call a38 exitwait(); - 35f2: e8 a8 d5 ff ff call b9f + 3555: e8 19 d6 ff ff call b73 rmdot(); - 35f7: e8 70 f0 ff ff call 266c + 355a: e8 a5 f0 ff ff call 2604 fourteen(); - 35fc: e8 2a ef ff ff call 252b + 355f: e8 63 ef ff ff call 24c7 bigfile(); - 3601: e8 59 ed ff ff call 235f + 3564: e8 96 ed ff ff call 22ff subdir(); - 3606: e8 41 e5 ff ff call 1b4c + 3569: e8 88 e5 ff ff call 1af6 linktest(); - 360b: e8 bf dd ff ff call 13cf + 356e: e8 16 de ff ff call 1389 unlinkread(); - 3610: e8 1d dc ff ff call 1232 + 3573: e8 78 dc ff ff call 11f0 dirfile(); - 3615: e8 db f1 ff ff call 27f5 + 3578: e8 0c f2 ff ff call 2789 iref(); - 361a: e8 f4 f3 ff ff call 2a13 + 357d: e8 21 f4 ff ff call 29a3 forktest(); - 361f: e8 15 f5 ff ff call 2b39 + 3582: e8 3e f5 ff ff call 2ac5 bigdir(); // slow - 3624: e8 c5 e3 ff ff call 19ee + 3587: e8 10 e4 ff ff call 199c uio(); - 3629: e8 f6 fd ff ff call 3424 + 358c: e8 06 fe ff ff call 3397 exectest(); - 362e: e8 45 d2 ff ff call 878 + 3591: e8 c2 d2 ff ff call 858 exit(); - 3633: e8 e6 01 00 00 call 381e + 3596: e8 c8 01 00 00 call 3763 -00003638 : +0000359b : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 3638: f3 0f 1e fb endbr32 - 363c: 55 push %ebp - 363d: 89 e5 mov %esp,%ebp - 363f: 53 push %ebx - 3640: 8b 4d 08 mov 0x8(%ebp),%ecx - 3643: 8b 5d 0c mov 0xc(%ebp),%ebx + 359b: 55 push %ebp + 359c: 89 e5 mov %esp,%ebp + 359e: 53 push %ebx + 359f: 8b 4d 08 mov 0x8(%ebp),%ecx + 35a2: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 3646: b8 00 00 00 00 mov $0x0,%eax - 364b: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 364f: 88 14 01 mov %dl,(%ecx,%eax,1) - 3652: 83 c0 01 add $0x1,%eax - 3655: 84 d2 test %dl,%dl - 3657: 75 f2 jne 364b + 35a5: b8 00 00 00 00 mov $0x0,%eax + 35aa: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 35ae: 88 14 01 mov %dl,(%ecx,%eax,1) + 35b1: 83 c0 01 add $0x1,%eax + 35b4: 84 d2 test %dl,%dl + 35b6: 75 f2 jne 35aa ; return os; } - 3659: 89 c8 mov %ecx,%eax - 365b: 5b pop %ebx - 365c: 5d pop %ebp - 365d: c3 ret + 35b8: 89 c8 mov %ecx,%eax + 35ba: 8b 5d fc mov -0x4(%ebp),%ebx + 35bd: c9 leave + 35be: c3 ret -0000365e : +000035bf : int strcmp(const char *p, const char *q) { - 365e: f3 0f 1e fb endbr32 - 3662: 55 push %ebp - 3663: 89 e5 mov %esp,%ebp - 3665: 8b 4d 08 mov 0x8(%ebp),%ecx - 3668: 8b 55 0c mov 0xc(%ebp),%edx + 35bf: 55 push %ebp + 35c0: 89 e5 mov %esp,%ebp + 35c2: 8b 4d 08 mov 0x8(%ebp),%ecx + 35c5: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 366b: 0f b6 01 movzbl (%ecx),%eax - 366e: 84 c0 test %al,%al - 3670: 74 11 je 3683 - 3672: 38 02 cmp %al,(%edx) - 3674: 75 0d jne 3683 + 35c8: 0f b6 01 movzbl (%ecx),%eax + 35cb: 84 c0 test %al,%al + 35cd: 74 11 je 35e0 + 35cf: 38 02 cmp %al,(%edx) + 35d1: 75 0d jne 35e0 p++, q++; - 3676: 83 c1 01 add $0x1,%ecx - 3679: 83 c2 01 add $0x1,%edx + 35d3: 83 c1 01 add $0x1,%ecx + 35d6: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 367c: 0f b6 01 movzbl (%ecx),%eax - 367f: 84 c0 test %al,%al - 3681: 75 ef jne 3672 + 35d9: 0f b6 01 movzbl (%ecx),%eax + 35dc: 84 c0 test %al,%al + 35de: 75 ef jne 35cf return (uchar)*p - (uchar)*q; - 3683: 0f b6 c0 movzbl %al,%eax - 3686: 0f b6 12 movzbl (%edx),%edx - 3689: 29 d0 sub %edx,%eax + 35e0: 0f b6 c0 movzbl %al,%eax + 35e3: 0f b6 12 movzbl (%edx),%edx + 35e6: 29 d0 sub %edx,%eax } - 368b: 5d pop %ebp - 368c: c3 ret + 35e8: 5d pop %ebp + 35e9: c3 ret -0000368d : +000035ea : uint strlen(const char *s) { - 368d: f3 0f 1e fb endbr32 - 3691: 55 push %ebp - 3692: 89 e5 mov %esp,%ebp - 3694: 8b 55 08 mov 0x8(%ebp),%edx + 35ea: 55 push %ebp + 35eb: 89 e5 mov %esp,%ebp + 35ed: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 3697: 80 3a 00 cmpb $0x0,(%edx) - 369a: 74 14 je 36b0 - 369c: b8 00 00 00 00 mov $0x0,%eax - 36a1: 83 c0 01 add $0x1,%eax - 36a4: 89 c1 mov %eax,%ecx - 36a6: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 36aa: 75 f5 jne 36a1 + 35f0: 80 3a 00 cmpb $0x0,(%edx) + 35f3: 74 14 je 3609 + 35f5: b8 00 00 00 00 mov $0x0,%eax + 35fa: 83 c0 01 add $0x1,%eax + 35fd: 89 c1 mov %eax,%ecx + 35ff: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 3603: 75 f5 jne 35fa ; return n; } - 36ac: 89 c8 mov %ecx,%eax - 36ae: 5d pop %ebp - 36af: c3 ret + 3605: 89 c8 mov %ecx,%eax + 3607: 5d pop %ebp + 3608: c3 ret for(n = 0; s[n]; n++) - 36b0: b9 00 00 00 00 mov $0x0,%ecx + 3609: b9 00 00 00 00 mov $0x0,%ecx return n; - 36b5: eb f5 jmp 36ac + 360e: eb f5 jmp 3605 -000036b7 : +00003610 : void* memset(void *dst, int c, uint n) { - 36b7: f3 0f 1e fb endbr32 - 36bb: 55 push %ebp - 36bc: 89 e5 mov %esp,%ebp - 36be: 57 push %edi - 36bf: 8b 55 08 mov 0x8(%ebp),%edx + 3610: 55 push %ebp + 3611: 89 e5 mov %esp,%ebp + 3613: 57 push %edi + 3614: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 36c2: 89 d7 mov %edx,%edi - 36c4: 8b 4d 10 mov 0x10(%ebp),%ecx - 36c7: 8b 45 0c mov 0xc(%ebp),%eax - 36ca: fc cld - 36cb: f3 aa rep stos %al,%es:(%edi) + 3617: 89 d7 mov %edx,%edi + 3619: 8b 4d 10 mov 0x10(%ebp),%ecx + 361c: 8b 45 0c mov 0xc(%ebp),%eax + 361f: fc cld + 3620: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - 36cd: 89 d0 mov %edx,%eax - 36cf: 5f pop %edi - 36d0: 5d pop %ebp - 36d1: c3 ret + 3622: 89 d0 mov %edx,%eax + 3624: 8b 7d fc mov -0x4(%ebp),%edi + 3627: c9 leave + 3628: c3 ret -000036d2 : +00003629 : char* strchr(const char *s, char c) { - 36d2: f3 0f 1e fb endbr32 - 36d6: 55 push %ebp - 36d7: 89 e5 mov %esp,%ebp - 36d9: 8b 45 08 mov 0x8(%ebp),%eax - 36dc: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 3629: 55 push %ebp + 362a: 89 e5 mov %esp,%ebp + 362c: 8b 45 08 mov 0x8(%ebp),%eax + 362f: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 36e0: 0f b6 10 movzbl (%eax),%edx - 36e3: 84 d2 test %dl,%dl - 36e5: 74 15 je 36fc + 3633: 0f b6 10 movzbl (%eax),%edx + 3636: 84 d2 test %dl,%dl + 3638: 74 15 je 364f if(*s == c) - 36e7: 38 d1 cmp %dl,%cl - 36e9: 74 0f je 36fa + 363a: 38 d1 cmp %dl,%cl + 363c: 74 0f je 364d for(; *s; s++) - 36eb: 83 c0 01 add $0x1,%eax - 36ee: 0f b6 10 movzbl (%eax),%edx - 36f1: 84 d2 test %dl,%dl - 36f3: 75 f2 jne 36e7 + 363e: 83 c0 01 add $0x1,%eax + 3641: 0f b6 10 movzbl (%eax),%edx + 3644: 84 d2 test %dl,%dl + 3646: 75 f2 jne 363a return (char*)s; return 0; - 36f5: b8 00 00 00 00 mov $0x0,%eax + 3648: b8 00 00 00 00 mov $0x0,%eax } - 36fa: 5d pop %ebp - 36fb: c3 ret + 364d: 5d pop %ebp + 364e: c3 ret return 0; - 36fc: b8 00 00 00 00 mov $0x0,%eax - 3701: eb f7 jmp 36fa + 364f: b8 00 00 00 00 mov $0x0,%eax + 3654: eb f7 jmp 364d -00003703 : +00003656 : char* gets(char *buf, int max) { - 3703: f3 0f 1e fb endbr32 - 3707: 55 push %ebp - 3708: 89 e5 mov %esp,%ebp - 370a: 57 push %edi - 370b: 56 push %esi - 370c: 53 push %ebx - 370d: 83 ec 2c sub $0x2c,%esp - 3710: 8b 75 08 mov 0x8(%ebp),%esi + 3656: 55 push %ebp + 3657: 89 e5 mov %esp,%ebp + 3659: 57 push %edi + 365a: 56 push %esi + 365b: 53 push %ebx + 365c: 83 ec 2c sub $0x2c,%esp + 365f: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 3713: bb 00 00 00 00 mov $0x0,%ebx + 3662: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 3718: 8d 7d e7 lea -0x19(%ebp),%edi + 3667: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 371b: 89 5d d4 mov %ebx,-0x2c(%ebp) - 371e: 83 c3 01 add $0x1,%ebx - 3721: 3b 5d 0c cmp 0xc(%ebp),%ebx - 3724: 7d 27 jge 374d + 366a: 89 5d d4 mov %ebx,-0x2c(%ebp) + 366d: 83 c3 01 add $0x1,%ebx + 3670: 3b 5d 0c cmp 0xc(%ebp),%ebx + 3673: 7d 27 jge 369c cc = read(0, &c, 1); - 3726: 83 ec 04 sub $0x4,%esp - 3729: 6a 01 push $0x1 - 372b: 57 push %edi - 372c: 6a 00 push $0x0 - 372e: e8 03 01 00 00 call 3836 + 3675: 83 ec 04 sub $0x4,%esp + 3678: 6a 01 push $0x1 + 367a: 57 push %edi + 367b: 6a 00 push $0x0 + 367d: e8 f9 00 00 00 call 377b if(cc < 1) - 3733: 83 c4 10 add $0x10,%esp - 3736: 85 c0 test %eax,%eax - 3738: 7e 13 jle 374d + 3682: 83 c4 10 add $0x10,%esp + 3685: 85 c0 test %eax,%eax + 3687: 7e 13 jle 369c break; buf[i++] = c; - 373a: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 373e: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 3689: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 368d: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 3742: 3c 0a cmp $0xa,%al - 3744: 74 04 je 374a - 3746: 3c 0d cmp $0xd,%al - 3748: 75 d1 jne 371b + 3691: 3c 0a cmp $0xa,%al + 3693: 74 04 je 3699 + 3695: 3c 0d cmp $0xd,%al + 3697: 75 d1 jne 366a for(i=0; i+1 < max; ){ - 374a: 89 5d d4 mov %ebx,-0x2c(%ebp) + 3699: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 374d: 8b 45 d4 mov -0x2c(%ebp),%eax - 3750: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 369c: 8b 45 d4 mov -0x2c(%ebp),%eax + 369f: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 3754: 89 f0 mov %esi,%eax - 3756: 8d 65 f4 lea -0xc(%ebp),%esp - 3759: 5b pop %ebx - 375a: 5e pop %esi - 375b: 5f pop %edi - 375c: 5d pop %ebp - 375d: c3 ret + 36a3: 89 f0 mov %esi,%eax + 36a5: 8d 65 f4 lea -0xc(%ebp),%esp + 36a8: 5b pop %ebx + 36a9: 5e pop %esi + 36aa: 5f pop %edi + 36ab: 5d pop %ebp + 36ac: c3 ret -0000375e : +000036ad : int stat(const char *n, struct stat *st) { - 375e: f3 0f 1e fb endbr32 - 3762: 55 push %ebp - 3763: 89 e5 mov %esp,%ebp - 3765: 56 push %esi - 3766: 53 push %ebx + 36ad: 55 push %ebp + 36ae: 89 e5 mov %esp,%ebp + 36b0: 56 push %esi + 36b1: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 3767: 83 ec 08 sub $0x8,%esp - 376a: 6a 00 push $0x0 - 376c: ff 75 08 pushl 0x8(%ebp) - 376f: e8 ea 00 00 00 call 385e + 36b2: 83 ec 08 sub $0x8,%esp + 36b5: 6a 00 push $0x0 + 36b7: ff 75 08 push 0x8(%ebp) + 36ba: e8 e4 00 00 00 call 37a3 if(fd < 0) - 3774: 83 c4 10 add $0x10,%esp - 3777: 85 c0 test %eax,%eax - 3779: 78 24 js 379f - 377b: 89 c3 mov %eax,%ebx + 36bf: 83 c4 10 add $0x10,%esp + 36c2: 85 c0 test %eax,%eax + 36c4: 78 24 js 36ea + 36c6: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 377d: 83 ec 08 sub $0x8,%esp - 3780: ff 75 0c pushl 0xc(%ebp) - 3783: 50 push %eax - 3784: e8 ed 00 00 00 call 3876 - 3789: 89 c6 mov %eax,%esi + 36c8: 83 ec 08 sub $0x8,%esp + 36cb: ff 75 0c push 0xc(%ebp) + 36ce: 50 push %eax + 36cf: e8 e7 00 00 00 call 37bb + 36d4: 89 c6 mov %eax,%esi close(fd); - 378b: 89 1c 24 mov %ebx,(%esp) - 378e: e8 b3 00 00 00 call 3846 + 36d6: 89 1c 24 mov %ebx,(%esp) + 36d9: e8 ad 00 00 00 call 378b return r; - 3793: 83 c4 10 add $0x10,%esp + 36de: 83 c4 10 add $0x10,%esp } - 3796: 89 f0 mov %esi,%eax - 3798: 8d 65 f8 lea -0x8(%ebp),%esp - 379b: 5b pop %ebx - 379c: 5e pop %esi - 379d: 5d pop %ebp - 379e: c3 ret + 36e1: 89 f0 mov %esi,%eax + 36e3: 8d 65 f8 lea -0x8(%ebp),%esp + 36e6: 5b pop %ebx + 36e7: 5e pop %esi + 36e8: 5d pop %ebp + 36e9: c3 ret return -1; - 379f: be ff ff ff ff mov $0xffffffff,%esi - 37a4: eb f0 jmp 3796 + 36ea: be ff ff ff ff mov $0xffffffff,%esi + 36ef: eb f0 jmp 36e1 -000037a6 : +000036f1 : int atoi(const char *s) { - 37a6: f3 0f 1e fb endbr32 - 37aa: 55 push %ebp - 37ab: 89 e5 mov %esp,%ebp - 37ad: 53 push %ebx - 37ae: 8b 55 08 mov 0x8(%ebp),%edx + 36f1: 55 push %ebp + 36f2: 89 e5 mov %esp,%ebp + 36f4: 53 push %ebx + 36f5: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 37b1: 0f b6 02 movzbl (%edx),%eax - 37b4: 8d 48 d0 lea -0x30(%eax),%ecx - 37b7: 80 f9 09 cmp $0x9,%cl - 37ba: 77 22 ja 37de + 36f8: 0f b6 02 movzbl (%edx),%eax + 36fb: 8d 48 d0 lea -0x30(%eax),%ecx + 36fe: 80 f9 09 cmp $0x9,%cl + 3701: 77 24 ja 3727 n = 0; - 37bc: b9 00 00 00 00 mov $0x0,%ecx + 3703: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 37c1: 83 c2 01 add $0x1,%edx - 37c4: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 37c7: 0f be c0 movsbl %al,%eax - 37ca: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 3708: 83 c2 01 add $0x1,%edx + 370b: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 370e: 0f be c0 movsbl %al,%eax + 3711: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 37ce: 0f b6 02 movzbl (%edx),%eax - 37d1: 8d 58 d0 lea -0x30(%eax),%ebx - 37d4: 80 fb 09 cmp $0x9,%bl - 37d7: 76 e8 jbe 37c1 + 3715: 0f b6 02 movzbl (%edx),%eax + 3718: 8d 58 d0 lea -0x30(%eax),%ebx + 371b: 80 fb 09 cmp $0x9,%bl + 371e: 76 e8 jbe 3708 return n; } - 37d9: 89 c8 mov %ecx,%eax - 37db: 5b pop %ebx - 37dc: 5d pop %ebp - 37dd: c3 ret + 3720: 89 c8 mov %ecx,%eax + 3722: 8b 5d fc mov -0x4(%ebp),%ebx + 3725: c9 leave + 3726: c3 ret n = 0; - 37de: b9 00 00 00 00 mov $0x0,%ecx + 3727: b9 00 00 00 00 mov $0x0,%ecx return n; - 37e3: eb f4 jmp 37d9 + 372c: eb f2 jmp 3720 -000037e5 : +0000372e : void* memmove(void *vdst, const void *vsrc, int n) { - 37e5: f3 0f 1e fb endbr32 - 37e9: 55 push %ebp - 37ea: 89 e5 mov %esp,%ebp - 37ec: 56 push %esi - 37ed: 53 push %ebx - 37ee: 8b 75 08 mov 0x8(%ebp),%esi - 37f1: 8b 55 0c mov 0xc(%ebp),%edx - 37f4: 8b 5d 10 mov 0x10(%ebp),%ebx + 372e: 55 push %ebp + 372f: 89 e5 mov %esp,%ebp + 3731: 56 push %esi + 3732: 53 push %ebx + 3733: 8b 75 08 mov 0x8(%ebp),%esi + 3736: 8b 55 0c mov 0xc(%ebp),%edx + 3739: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 37f7: 85 db test %ebx,%ebx - 37f9: 7e 15 jle 3810 - 37fb: 01 f3 add %esi,%ebx + 373c: 85 db test %ebx,%ebx + 373e: 7e 15 jle 3755 + 3740: 01 f3 add %esi,%ebx dst = vdst; - 37fd: 89 f0 mov %esi,%eax + 3742: 89 f0 mov %esi,%eax *dst++ = *src++; - 37ff: 83 c2 01 add $0x1,%edx - 3802: 83 c0 01 add $0x1,%eax - 3805: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 3809: 88 48 ff mov %cl,-0x1(%eax) + 3744: 83 c2 01 add $0x1,%edx + 3747: 83 c0 01 add $0x1,%eax + 374a: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 374e: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 380c: 39 c3 cmp %eax,%ebx - 380e: 75 ef jne 37ff + 3751: 39 c3 cmp %eax,%ebx + 3753: 75 ef jne 3744 return vdst; } - 3810: 89 f0 mov %esi,%eax - 3812: 5b pop %ebx - 3813: 5e pop %esi - 3814: 5d pop %ebp - 3815: c3 ret + 3755: 89 f0 mov %esi,%eax + 3757: 5b pop %ebx + 3758: 5e pop %esi + 3759: 5d pop %ebp + 375a: c3 ret -00003816 : +0000375b : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 3816: b8 01 00 00 00 mov $0x1,%eax - 381b: cd 40 int $0x40 - 381d: c3 ret + 375b: b8 01 00 00 00 mov $0x1,%eax + 3760: cd 40 int $0x40 + 3762: c3 ret -0000381e : +00003763 : SYSCALL(exit) - 381e: b8 02 00 00 00 mov $0x2,%eax - 3823: cd 40 int $0x40 - 3825: c3 ret + 3763: b8 02 00 00 00 mov $0x2,%eax + 3768: cd 40 int $0x40 + 376a: c3 ret -00003826 : +0000376b : SYSCALL(wait) - 3826: b8 03 00 00 00 mov $0x3,%eax - 382b: cd 40 int $0x40 - 382d: c3 ret + 376b: b8 03 00 00 00 mov $0x3,%eax + 3770: cd 40 int $0x40 + 3772: c3 ret -0000382e : +00003773 : SYSCALL(pipe) - 382e: b8 04 00 00 00 mov $0x4,%eax - 3833: cd 40 int $0x40 - 3835: c3 ret + 3773: b8 04 00 00 00 mov $0x4,%eax + 3778: cd 40 int $0x40 + 377a: c3 ret -00003836 : +0000377b : SYSCALL(read) - 3836: b8 05 00 00 00 mov $0x5,%eax - 383b: cd 40 int $0x40 - 383d: c3 ret + 377b: b8 05 00 00 00 mov $0x5,%eax + 3780: cd 40 int $0x40 + 3782: c3 ret -0000383e : +00003783 : SYSCALL(write) - 383e: b8 10 00 00 00 mov $0x10,%eax - 3843: cd 40 int $0x40 - 3845: c3 ret + 3783: b8 10 00 00 00 mov $0x10,%eax + 3788: cd 40 int $0x40 + 378a: c3 ret -00003846 : +0000378b : SYSCALL(close) - 3846: b8 15 00 00 00 mov $0x15,%eax - 384b: cd 40 int $0x40 - 384d: c3 ret + 378b: b8 15 00 00 00 mov $0x15,%eax + 3790: cd 40 int $0x40 + 3792: c3 ret -0000384e : +00003793 : SYSCALL(kill) - 384e: b8 06 00 00 00 mov $0x6,%eax - 3853: cd 40 int $0x40 - 3855: c3 ret + 3793: b8 06 00 00 00 mov $0x6,%eax + 3798: cd 40 int $0x40 + 379a: c3 ret -00003856 : +0000379b : SYSCALL(exec) - 3856: b8 07 00 00 00 mov $0x7,%eax - 385b: cd 40 int $0x40 - 385d: c3 ret + 379b: b8 07 00 00 00 mov $0x7,%eax + 37a0: cd 40 int $0x40 + 37a2: c3 ret -0000385e : +000037a3 : SYSCALL(open) - 385e: b8 0f 00 00 00 mov $0xf,%eax - 3863: cd 40 int $0x40 - 3865: c3 ret + 37a3: b8 0f 00 00 00 mov $0xf,%eax + 37a8: cd 40 int $0x40 + 37aa: c3 ret -00003866 : +000037ab : SYSCALL(mknod) - 3866: b8 11 00 00 00 mov $0x11,%eax - 386b: cd 40 int $0x40 - 386d: c3 ret + 37ab: b8 11 00 00 00 mov $0x11,%eax + 37b0: cd 40 int $0x40 + 37b2: c3 ret -0000386e : +000037b3 : SYSCALL(unlink) - 386e: b8 12 00 00 00 mov $0x12,%eax - 3873: cd 40 int $0x40 - 3875: c3 ret + 37b3: b8 12 00 00 00 mov $0x12,%eax + 37b8: cd 40 int $0x40 + 37ba: c3 ret -00003876 : +000037bb : SYSCALL(fstat) - 3876: b8 08 00 00 00 mov $0x8,%eax - 387b: cd 40 int $0x40 - 387d: c3 ret + 37bb: b8 08 00 00 00 mov $0x8,%eax + 37c0: cd 40 int $0x40 + 37c2: c3 ret -0000387e : +000037c3 : SYSCALL(link) - 387e: b8 13 00 00 00 mov $0x13,%eax - 3883: cd 40 int $0x40 - 3885: c3 ret + 37c3: b8 13 00 00 00 mov $0x13,%eax + 37c8: cd 40 int $0x40 + 37ca: c3 ret -00003886 : +000037cb : SYSCALL(mkdir) - 3886: b8 14 00 00 00 mov $0x14,%eax - 388b: cd 40 int $0x40 - 388d: c3 ret + 37cb: b8 14 00 00 00 mov $0x14,%eax + 37d0: cd 40 int $0x40 + 37d2: c3 ret -0000388e : +000037d3 : SYSCALL(chdir) - 388e: b8 09 00 00 00 mov $0x9,%eax - 3893: cd 40 int $0x40 - 3895: c3 ret + 37d3: b8 09 00 00 00 mov $0x9,%eax + 37d8: cd 40 int $0x40 + 37da: c3 ret -00003896 : +000037db : SYSCALL(dup) - 3896: b8 0a 00 00 00 mov $0xa,%eax - 389b: cd 40 int $0x40 - 389d: c3 ret + 37db: b8 0a 00 00 00 mov $0xa,%eax + 37e0: cd 40 int $0x40 + 37e2: c3 ret -0000389e : +000037e3 : SYSCALL(getpid) - 389e: b8 0b 00 00 00 mov $0xb,%eax - 38a3: cd 40 int $0x40 - 38a5: c3 ret + 37e3: b8 0b 00 00 00 mov $0xb,%eax + 37e8: cd 40 int $0x40 + 37ea: c3 ret -000038a6 : +000037eb : SYSCALL(sbrk) - 38a6: b8 0c 00 00 00 mov $0xc,%eax - 38ab: cd 40 int $0x40 - 38ad: c3 ret + 37eb: b8 0c 00 00 00 mov $0xc,%eax + 37f0: cd 40 int $0x40 + 37f2: c3 ret -000038ae : +000037f3 : SYSCALL(sleep) - 38ae: b8 0d 00 00 00 mov $0xd,%eax - 38b3: cd 40 int $0x40 - 38b5: c3 ret + 37f3: b8 0d 00 00 00 mov $0xd,%eax + 37f8: cd 40 int $0x40 + 37fa: c3 ret -000038b6 : +000037fb : SYSCALL(uptime) - 38b6: b8 0e 00 00 00 mov $0xe,%eax - 38bb: cd 40 int $0x40 - 38bd: c3 ret + 37fb: b8 0e 00 00 00 mov $0xe,%eax + 3800: cd 40 int $0x40 + 3802: c3 ret -000038be : +00003803 : SYSCALL(slabtest) - 38be: b8 16 00 00 00 mov $0x16,%eax - 38c3: cd 40 int $0x40 - 38c5: c3 ret + 3803: b8 16 00 00 00 mov $0x16,%eax + 3808: cd 40 int $0x40 + 380a: c3 ret -000038c6 : +0000380b : SYSCALL(ps) - 38c6: b8 17 00 00 00 mov $0x17,%eax - 38cb: cd 40 int $0x40 - 38cd: c3 ret + 380b: b8 17 00 00 00 mov $0x17,%eax + 3810: cd 40 int $0x40 + 3812: c3 ret -000038ce : +00003813 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 38ce: 55 push %ebp - 38cf: 89 e5 mov %esp,%ebp - 38d1: 57 push %edi - 38d2: 56 push %esi - 38d3: 53 push %ebx - 38d4: 83 ec 3c sub $0x3c,%esp - 38d7: 89 45 c4 mov %eax,-0x3c(%ebp) - 38da: 89 d3 mov %edx,%ebx + 3813: 55 push %ebp + 3814: 89 e5 mov %esp,%ebp + 3816: 57 push %edi + 3817: 56 push %esi + 3818: 53 push %ebx + 3819: 83 ec 3c sub $0x3c,%esp + 381c: 89 45 c4 mov %eax,-0x3c(%ebp) + 381f: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 38dc: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 38e0: 74 77 je 3959 - 38e2: 85 d2 test %edx,%edx - 38e4: 79 73 jns 3959 + 3821: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 3825: 74 79 je 38a0 + 3827: 85 d2 test %edx,%edx + 3829: 79 75 jns 38a0 neg = 1; x = -xx; - 38e6: f7 db neg %ebx + 382b: 89 d1 mov %edx,%ecx + 382d: f7 d9 neg %ecx neg = 1; - 38e8: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 382f: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 38ef: be 00 00 00 00 mov $0x0,%esi + 3836: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 38f4: 89 f7 mov %esi,%edi - 38f6: 83 c6 01 add $0x1,%esi - 38f9: 89 d8 mov %ebx,%eax - 38fb: ba 00 00 00 00 mov $0x0,%edx - 3900: f7 f1 div %ecx - 3902: 0f b6 92 1c 54 00 00 movzbl 0x541c(%edx),%edx - 3909: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 383b: 89 df mov %ebx,%edi + 383d: 83 c3 01 add $0x1,%ebx + 3840: 89 c8 mov %ecx,%eax + 3842: ba 00 00 00 00 mov $0x0,%edx + 3847: f7 f6 div %esi + 3849: 0f b6 92 9c 53 00 00 movzbl 0x539c(%edx),%edx + 3850: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 390d: 89 da mov %ebx,%edx - 390f: 89 c3 mov %eax,%ebx - 3911: 39 d1 cmp %edx,%ecx - 3913: 76 df jbe 38f4 + 3854: 89 ca mov %ecx,%edx + 3856: 89 c1 mov %eax,%ecx + 3858: 39 d6 cmp %edx,%esi + 385a: 76 df jbe 383b if(neg) - 3915: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 3919: 74 08 je 3923 + 385c: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 3860: 74 08 je 386a buf[i++] = '-'; - 391b: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 3920: 8d 77 02 lea 0x2(%edi),%esi + 3862: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 3867: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 3923: 85 f6 test %esi,%esi - 3925: 7e 2a jle 3951 - 3927: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 392b: 8d 7d d8 lea -0x28(%ebp),%edi + 386a: 85 db test %ebx,%ebx + 386c: 7e 2a jle 3898 + 386e: 8d 7d d8 lea -0x28(%ebp),%edi + 3871: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 392e: 8d 75 d7 lea -0x29(%ebp),%esi + 3875: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 3931: 0f b6 03 movzbl (%ebx),%eax - 3934: 88 45 d7 mov %al,-0x29(%ebp) + 3878: 0f b6 03 movzbl (%ebx),%eax + 387b: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 3937: 83 ec 04 sub $0x4,%esp - 393a: 6a 01 push $0x1 - 393c: 56 push %esi - 393d: ff 75 c4 pushl -0x3c(%ebp) - 3940: e8 f9 fe ff ff call 383e + 387e: 83 ec 04 sub $0x4,%esp + 3881: 6a 01 push $0x1 + 3883: 56 push %esi + 3884: ff 75 c4 push -0x3c(%ebp) + 3887: e8 f7 fe ff ff call 3783 while(--i >= 0) - 3945: 89 d8 mov %ebx,%eax - 3947: 83 eb 01 sub $0x1,%ebx - 394a: 83 c4 10 add $0x10,%esp - 394d: 39 f8 cmp %edi,%eax - 394f: 75 e0 jne 3931 + 388c: 89 d8 mov %ebx,%eax + 388e: 83 eb 01 sub $0x1,%ebx + 3891: 83 c4 10 add $0x10,%esp + 3894: 39 f8 cmp %edi,%eax + 3896: 75 e0 jne 3878 } - 3951: 8d 65 f4 lea -0xc(%ebp),%esp - 3954: 5b pop %ebx - 3955: 5e pop %esi - 3956: 5f pop %edi - 3957: 5d pop %ebp - 3958: c3 ret + 3898: 8d 65 f4 lea -0xc(%ebp),%esp + 389b: 5b pop %ebx + 389c: 5e pop %esi + 389d: 5f pop %edi + 389e: 5d pop %ebp + 389f: c3 ret + x = xx; + 38a0: 89 d1 mov %edx,%ecx neg = 0; - 3959: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 3960: eb 8d jmp 38ef + 38a2: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 38a9: eb 8b jmp 3836 -00003962 : +000038ab : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 3962: f3 0f 1e fb endbr32 - 3966: 55 push %ebp - 3967: 89 e5 mov %esp,%ebp - 3969: 57 push %edi - 396a: 56 push %esi - 396b: 53 push %ebx - 396c: 83 ec 2c sub $0x2c,%esp + 38ab: 55 push %ebp + 38ac: 89 e5 mov %esp,%ebp + 38ae: 57 push %edi + 38af: 56 push %esi + 38b0: 53 push %ebx + 38b1: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 396f: 8b 75 0c mov 0xc(%ebp),%esi - 3972: 0f b6 1e movzbl (%esi),%ebx - 3975: 84 db test %bl,%bl - 3977: 0f 84 ab 01 00 00 je 3b28 - 397d: 83 c6 01 add $0x1,%esi + 38b4: 8b 75 0c mov 0xc(%ebp),%esi + 38b7: 0f b6 1e movzbl (%esi),%ebx + 38ba: 84 db test %bl,%bl + 38bc: 0f 84 9f 01 00 00 je 3a61 + 38c2: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 3980: 8d 45 10 lea 0x10(%ebp),%eax - 3983: 89 45 d4 mov %eax,-0x2c(%ebp) + 38c5: 8d 45 10 lea 0x10(%ebp),%eax + 38c8: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 3986: bf 00 00 00 00 mov $0x0,%edi - 398b: eb 2d jmp 39ba + 38cb: bf 00 00 00 00 mov $0x0,%edi + 38d0: eb 2d jmp 38ff c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 398d: 88 5d e7 mov %bl,-0x19(%ebp) + 38d2: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3990: 83 ec 04 sub $0x4,%esp - 3993: 6a 01 push $0x1 - 3995: 8d 45 e7 lea -0x19(%ebp),%eax - 3998: 50 push %eax - 3999: ff 75 08 pushl 0x8(%ebp) - 399c: e8 9d fe ff ff call 383e + 38d5: 83 ec 04 sub $0x4,%esp + 38d8: 6a 01 push $0x1 + 38da: 8d 45 e7 lea -0x19(%ebp),%eax + 38dd: 50 push %eax + 38de: ff 75 08 push 0x8(%ebp) + 38e1: e8 9d fe ff ff call 3783 putc(fd, c); - 39a1: 83 c4 10 add $0x10,%esp - 39a4: eb 05 jmp 39ab + 38e6: 83 c4 10 add $0x10,%esp + 38e9: eb 05 jmp 38f0 } } else if(state == '%'){ - 39a6: 83 ff 25 cmp $0x25,%edi - 39a9: 74 22 je 39cd + 38eb: 83 ff 25 cmp $0x25,%edi + 38ee: 74 1f je 390f for(i = 0; fmt[i]; i++){ - 39ab: 83 c6 01 add $0x1,%esi - 39ae: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 39b2: 84 db test %bl,%bl - 39b4: 0f 84 6e 01 00 00 je 3b28 + 38f0: 83 c6 01 add $0x1,%esi + 38f3: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 38f7: 84 db test %bl,%bl + 38f9: 0f 84 62 01 00 00 je 3a61 c = fmt[i] & 0xff; - 39ba: 0f be d3 movsbl %bl,%edx - 39bd: 0f b6 c3 movzbl %bl,%eax + 38ff: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 39c0: 85 ff test %edi,%edi - 39c2: 75 e2 jne 39a6 + 3902: 85 ff test %edi,%edi + 3904: 75 e5 jne 38eb if(c == '%'){ - 39c4: 83 f8 25 cmp $0x25,%eax - 39c7: 75 c4 jne 398d + 3906: 83 f8 25 cmp $0x25,%eax + 3909: 75 c7 jne 38d2 state = '%'; - 39c9: 89 c7 mov %eax,%edi - 39cb: eb de jmp 39ab + 390b: 89 c7 mov %eax,%edi + 390d: eb e1 jmp 38f0 if(c == 'd'){ - 39cd: 83 f8 64 cmp $0x64,%eax - 39d0: 74 59 je 3a2b + 390f: 83 f8 25 cmp $0x25,%eax + 3912: 0f 84 f2 00 00 00 je 3a0a + 3918: 8d 50 9d lea -0x63(%eax),%edx + 391b: 83 fa 15 cmp $0x15,%edx + 391e: 0f 87 07 01 00 00 ja 3a2b + 3924: 0f 87 01 01 00 00 ja 3a2b + 392a: ff 24 95 44 53 00 00 jmp *0x5344(,%edx,4) printint(fd, *ap, 10, 1); + 3931: 83 ec 0c sub $0xc,%esp + 3934: 6a 01 push $0x1 + 3936: b9 0a 00 00 00 mov $0xa,%ecx + 393b: 8b 7d d4 mov -0x2c(%ebp),%edi + 393e: 8b 17 mov (%edi),%edx + 3940: 8b 45 08 mov 0x8(%ebp),%eax + 3943: e8 cb fe ff ff call 3813 ap++; - } else if(c == 'x' || c == 'p'){ - 39d2: 81 e2 f7 00 00 00 and $0xf7,%edx - 39d8: 83 fa 70 cmp $0x70,%edx - 39db: 74 7a je 3a57 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 39dd: 83 f8 73 cmp $0x73,%eax - 39e0: 0f 84 9d 00 00 00 je 3a83 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 39e6: 83 f8 63 cmp $0x63,%eax - 39e9: 0f 84 ec 00 00 00 je 3adb - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 39ef: 83 f8 25 cmp $0x25,%eax - 39f2: 0f 84 0f 01 00 00 je 3b07 - putc(fd, c); + 3948: 89 f8 mov %edi,%eax + 394a: 83 c0 04 add $0x4,%eax + 394d: 89 45 d4 mov %eax,-0x2c(%ebp) + 3950: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 39f8: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 39fc: 83 ec 04 sub $0x4,%esp - 39ff: 6a 01 push $0x1 - 3a01: 8d 45 e7 lea -0x19(%ebp),%eax - 3a04: 50 push %eax - 3a05: ff 75 08 pushl 0x8(%ebp) - 3a08: e8 31 fe ff ff call 383e - putc(fd, c); - 3a0d: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 3a10: 83 c4 0c add $0xc,%esp - 3a13: 6a 01 push $0x1 - 3a15: 8d 45 e7 lea -0x19(%ebp),%eax - 3a18: 50 push %eax - 3a19: ff 75 08 pushl 0x8(%ebp) - 3a1c: e8 1d fe ff ff call 383e putc(fd, c); - 3a21: 83 c4 10 add $0x10,%esp } state = 0; - 3a24: bf 00 00 00 00 mov $0x0,%edi - 3a29: eb 80 jmp 39ab - printint(fd, *ap, 10, 1); - 3a2b: 83 ec 0c sub $0xc,%esp - 3a2e: 6a 01 push $0x1 - 3a30: b9 0a 00 00 00 mov $0xa,%ecx - 3a35: 8b 7d d4 mov -0x2c(%ebp),%edi - 3a38: 8b 17 mov (%edi),%edx - 3a3a: 8b 45 08 mov 0x8(%ebp),%eax - 3a3d: e8 8c fe ff ff call 38ce - ap++; - 3a42: 89 f8 mov %edi,%eax - 3a44: 83 c0 04 add $0x4,%eax - 3a47: 89 45 d4 mov %eax,-0x2c(%ebp) - 3a4a: 83 c4 10 add $0x10,%esp - state = 0; - 3a4d: bf 00 00 00 00 mov $0x0,%edi - 3a52: e9 54 ff ff ff jmp 39ab + 3953: bf 00 00 00 00 mov $0x0,%edi + 3958: eb 96 jmp 38f0 printint(fd, *ap, 16, 0); - 3a57: 83 ec 0c sub $0xc,%esp - 3a5a: 6a 00 push $0x0 - 3a5c: b9 10 00 00 00 mov $0x10,%ecx - 3a61: 8b 7d d4 mov -0x2c(%ebp),%edi - 3a64: 8b 17 mov (%edi),%edx - 3a66: 8b 45 08 mov 0x8(%ebp),%eax - 3a69: e8 60 fe ff ff call 38ce + 395a: 83 ec 0c sub $0xc,%esp + 395d: 6a 00 push $0x0 + 395f: b9 10 00 00 00 mov $0x10,%ecx + 3964: 8b 7d d4 mov -0x2c(%ebp),%edi + 3967: 8b 17 mov (%edi),%edx + 3969: 8b 45 08 mov 0x8(%ebp),%eax + 396c: e8 a2 fe ff ff call 3813 ap++; - 3a6e: 89 f8 mov %edi,%eax - 3a70: 83 c0 04 add $0x4,%eax - 3a73: 89 45 d4 mov %eax,-0x2c(%ebp) - 3a76: 83 c4 10 add $0x10,%esp + 3971: 89 f8 mov %edi,%eax + 3973: 83 c0 04 add $0x4,%eax + 3976: 89 45 d4 mov %eax,-0x2c(%ebp) + 3979: 83 c4 10 add $0x10,%esp state = 0; - 3a79: bf 00 00 00 00 mov $0x0,%edi - 3a7e: e9 28 ff ff ff jmp 39ab + 397c: bf 00 00 00 00 mov $0x0,%edi + 3981: e9 6a ff ff ff jmp 38f0 s = (char*)*ap; - 3a83: 8b 4d d4 mov -0x2c(%ebp),%ecx - 3a86: 8b 01 mov (%ecx),%eax + 3986: 8b 4d d4 mov -0x2c(%ebp),%ecx + 3989: 8b 01 mov (%ecx),%eax ap++; - 3a88: 83 c1 04 add $0x4,%ecx - 3a8b: 89 4d d4 mov %ecx,-0x2c(%ebp) + 398b: 83 c1 04 add $0x4,%ecx + 398e: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 3a8e: 85 c0 test %eax,%eax - 3a90: 74 13 je 3aa5 + 3991: 85 c0 test %eax,%eax + 3993: 74 13 je 39a8 s = (char*)*ap; - 3a92: 89 c3 mov %eax,%ebx + 3995: 89 c3 mov %eax,%ebx while(*s != 0){ - 3a94: 0f b6 00 movzbl (%eax),%eax + 3997: 0f b6 00 movzbl (%eax),%eax state = 0; - 3a97: bf 00 00 00 00 mov $0x0,%edi + 399a: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 3a9c: 84 c0 test %al,%al - 3a9e: 75 0f jne 3aaf - 3aa0: e9 06 ff ff ff jmp 39ab + 399f: 84 c0 test %al,%al + 39a1: 75 0f jne 39b2 + 39a3: e9 48 ff ff ff jmp 38f0 s = "(null)"; - 3aa5: bb 12 54 00 00 mov $0x5412,%ebx + 39a8: bb 3a 53 00 00 mov $0x533a,%ebx while(*s != 0){ - 3aaa: b8 28 00 00 00 mov $0x28,%eax - 3aaf: 8b 7d 08 mov 0x8(%ebp),%edi + 39ad: b8 28 00 00 00 mov $0x28,%eax + 39b2: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 3ab2: 88 45 e7 mov %al,-0x19(%ebp) + 39b5: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 3ab5: 83 ec 04 sub $0x4,%esp - 3ab8: 6a 01 push $0x1 - 3aba: 8d 45 e7 lea -0x19(%ebp),%eax - 3abd: 50 push %eax - 3abe: 57 push %edi - 3abf: e8 7a fd ff ff call 383e + 39b8: 83 ec 04 sub $0x4,%esp + 39bb: 6a 01 push $0x1 + 39bd: 8d 45 e7 lea -0x19(%ebp),%eax + 39c0: 50 push %eax + 39c1: 57 push %edi + 39c2: e8 bc fd ff ff call 3783 s++; - 3ac4: 83 c3 01 add $0x1,%ebx + 39c7: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 3ac7: 0f b6 03 movzbl (%ebx),%eax - 3aca: 83 c4 10 add $0x10,%esp - 3acd: 84 c0 test %al,%al - 3acf: 75 e1 jne 3ab2 + 39ca: 0f b6 03 movzbl (%ebx),%eax + 39cd: 83 c4 10 add $0x10,%esp + 39d0: 84 c0 test %al,%al + 39d2: 75 e1 jne 39b5 state = 0; - 3ad1: bf 00 00 00 00 mov $0x0,%edi - 3ad6: e9 d0 fe ff ff jmp 39ab + 39d4: bf 00 00 00 00 mov $0x0,%edi + 39d9: e9 12 ff ff ff jmp 38f0 putc(fd, *ap); - 3adb: 8b 7d d4 mov -0x2c(%ebp),%edi - 3ade: 8b 07 mov (%edi),%eax - 3ae0: 88 45 e7 mov %al,-0x19(%ebp) + 39de: 8b 7d d4 mov -0x2c(%ebp),%edi + 39e1: 8b 07 mov (%edi),%eax + 39e3: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 3ae3: 83 ec 04 sub $0x4,%esp - 3ae6: 6a 01 push $0x1 - 3ae8: 8d 45 e7 lea -0x19(%ebp),%eax - 3aeb: 50 push %eax - 3aec: ff 75 08 pushl 0x8(%ebp) - 3aef: e8 4a fd ff ff call 383e + 39e6: 83 ec 04 sub $0x4,%esp + 39e9: 6a 01 push $0x1 + 39eb: 8d 45 e7 lea -0x19(%ebp),%eax + 39ee: 50 push %eax + 39ef: ff 75 08 push 0x8(%ebp) + 39f2: e8 8c fd ff ff call 3783 ap++; - 3af4: 83 c7 04 add $0x4,%edi - 3af7: 89 7d d4 mov %edi,-0x2c(%ebp) - 3afa: 83 c4 10 add $0x10,%esp + 39f7: 83 c7 04 add $0x4,%edi + 39fa: 89 7d d4 mov %edi,-0x2c(%ebp) + 39fd: 83 c4 10 add $0x10,%esp + state = 0; + 3a00: bf 00 00 00 00 mov $0x0,%edi + 3a05: e9 e6 fe ff ff jmp 38f0 + putc(fd, c); + 3a0a: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 3a0d: 83 ec 04 sub $0x4,%esp + 3a10: 6a 01 push $0x1 + 3a12: 8d 45 e7 lea -0x19(%ebp),%eax + 3a15: 50 push %eax + 3a16: ff 75 08 push 0x8(%ebp) + 3a19: e8 65 fd ff ff call 3783 + 3a1e: 83 c4 10 add $0x10,%esp state = 0; - 3afd: bf 00 00 00 00 mov $0x0,%edi - 3b02: e9 a4 fe ff ff jmp 39ab + 3a21: bf 00 00 00 00 mov $0x0,%edi + 3a26: e9 c5 fe ff ff jmp 38f0 + putc(fd, '%'); + 3a2b: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 3a2f: 83 ec 04 sub $0x4,%esp + 3a32: 6a 01 push $0x1 + 3a34: 8d 45 e7 lea -0x19(%ebp),%eax + 3a37: 50 push %eax + 3a38: ff 75 08 push 0x8(%ebp) + 3a3b: e8 43 fd ff ff call 3783 putc(fd, c); - 3b07: 88 5d e7 mov %bl,-0x19(%ebp) + 3a40: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 3b0a: 83 ec 04 sub $0x4,%esp - 3b0d: 6a 01 push $0x1 - 3b0f: 8d 45 e7 lea -0x19(%ebp),%eax - 3b12: 50 push %eax - 3b13: ff 75 08 pushl 0x8(%ebp) - 3b16: e8 23 fd ff ff call 383e - 3b1b: 83 c4 10 add $0x10,%esp + 3a43: 83 c4 0c add $0xc,%esp + 3a46: 6a 01 push $0x1 + 3a48: 8d 45 e7 lea -0x19(%ebp),%eax + 3a4b: 50 push %eax + 3a4c: ff 75 08 push 0x8(%ebp) + 3a4f: e8 2f fd ff ff call 3783 + putc(fd, c); + 3a54: 83 c4 10 add $0x10,%esp state = 0; - 3b1e: bf 00 00 00 00 mov $0x0,%edi - 3b23: e9 83 fe ff ff jmp 39ab + 3a57: bf 00 00 00 00 mov $0x0,%edi + 3a5c: e9 8f fe ff ff jmp 38f0 } } } - 3b28: 8d 65 f4 lea -0xc(%ebp),%esp - 3b2b: 5b pop %ebx - 3b2c: 5e pop %esi - 3b2d: 5f pop %edi - 3b2e: 5d pop %ebp - 3b2f: c3 ret - -00003b30 : + 3a61: 8d 65 f4 lea -0xc(%ebp),%esp + 3a64: 5b pop %ebx + 3a65: 5e pop %esi + 3a66: 5f pop %edi + 3a67: 5d pop %ebp + 3a68: c3 ret + +00003a69 : static Header base; static Header *freep; void free(void *ap) { - 3b30: f3 0f 1e fb endbr32 - 3b34: 55 push %ebp - 3b35: 89 e5 mov %esp,%ebp - 3b37: 57 push %edi - 3b38: 56 push %esi - 3b39: 53 push %ebx - 3b3a: 8b 5d 08 mov 0x8(%ebp),%ebx + 3a69: 55 push %ebp + 3a6a: 89 e5 mov %esp,%ebp + 3a6c: 57 push %edi + 3a6d: 56 push %esi + 3a6e: 53 push %ebx + 3a6f: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 3b3d: 8d 4b f8 lea -0x8(%ebx),%ecx + 3a72: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 3b40: a1 40 5d 00 00 mov 0x5d40,%eax - 3b45: eb 0c jmp 3b53 + 3a75: a1 e0 a3 00 00 mov 0xa3e0,%eax + 3a7a: eb 0c jmp 3a88 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 3b47: 8b 10 mov (%eax),%edx - 3b49: 39 c2 cmp %eax,%edx - 3b4b: 77 04 ja 3b51 - 3b4d: 39 ca cmp %ecx,%edx - 3b4f: 77 10 ja 3b61 + 3a7c: 8b 10 mov (%eax),%edx + 3a7e: 39 c2 cmp %eax,%edx + 3a80: 77 04 ja 3a86 + 3a82: 39 ca cmp %ecx,%edx + 3a84: 77 10 ja 3a96 { - 3b51: 89 d0 mov %edx,%eax + 3a86: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 3b53: 39 c8 cmp %ecx,%eax - 3b55: 73 f0 jae 3b47 - 3b57: 8b 10 mov (%eax),%edx - 3b59: 39 ca cmp %ecx,%edx - 3b5b: 77 04 ja 3b61 + 3a88: 39 c8 cmp %ecx,%eax + 3a8a: 73 f0 jae 3a7c + 3a8c: 8b 10 mov (%eax),%edx + 3a8e: 39 ca cmp %ecx,%edx + 3a90: 77 04 ja 3a96 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 3b5d: 39 c2 cmp %eax,%edx - 3b5f: 77 f0 ja 3b51 + 3a92: 39 c2 cmp %eax,%edx + 3a94: 77 f0 ja 3a86 break; if(bp + bp->s.size == p->s.ptr){ - 3b61: 8b 73 fc mov -0x4(%ebx),%esi - 3b64: 8b 10 mov (%eax),%edx - 3b66: 8d 3c f1 lea (%ecx,%esi,8),%edi - 3b69: 39 fa cmp %edi,%edx - 3b6b: 74 19 je 3b86 + 3a96: 8b 73 fc mov -0x4(%ebx),%esi + 3a99: 8b 10 mov (%eax),%edx + 3a9b: 8d 3c f1 lea (%ecx,%esi,8),%edi + 3a9e: 39 fa cmp %edi,%edx + 3aa0: 74 19 je 3abb bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 3aa2: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 3b6d: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 3b70: 8b 50 04 mov 0x4(%eax),%edx - 3b73: 8d 34 d0 lea (%eax,%edx,8),%esi - 3b76: 39 f1 cmp %esi,%ecx - 3b78: 74 1b je 3b95 + 3aa5: 8b 50 04 mov 0x4(%eax),%edx + 3aa8: 8d 34 d0 lea (%eax,%edx,8),%esi + 3aab: 39 f1 cmp %esi,%ecx + 3aad: 74 18 je 3ac7 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 3aaf: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 3b7a: 89 08 mov %ecx,(%eax) freep = p; - 3b7c: a3 40 5d 00 00 mov %eax,0x5d40 + 3ab1: a3 e0 a3 00 00 mov %eax,0xa3e0 } - 3b81: 5b pop %ebx - 3b82: 5e pop %esi - 3b83: 5f pop %edi - 3b84: 5d pop %ebp - 3b85: c3 ret + 3ab6: 5b pop %ebx + 3ab7: 5e pop %esi + 3ab8: 5f pop %edi + 3ab9: 5d pop %ebp + 3aba: c3 ret bp->s.size += p->s.ptr->s.size; - 3b86: 03 72 04 add 0x4(%edx),%esi - 3b89: 89 73 fc mov %esi,-0x4(%ebx) + 3abb: 03 72 04 add 0x4(%edx),%esi + 3abe: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 3b8c: 8b 10 mov (%eax),%edx - 3b8e: 8b 12 mov (%edx),%edx - 3b90: 89 53 f8 mov %edx,-0x8(%ebx) - 3b93: eb db jmp 3b70 + 3ac1: 8b 10 mov (%eax),%edx + 3ac3: 8b 12 mov (%edx),%edx + 3ac5: eb db jmp 3aa2 p->s.size += bp->s.size; - 3b95: 03 53 fc add -0x4(%ebx),%edx - 3b98: 89 50 04 mov %edx,0x4(%eax) + 3ac7: 03 53 fc add -0x4(%ebx),%edx + 3aca: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 3b9b: 8b 53 f8 mov -0x8(%ebx),%edx - 3b9e: 89 10 mov %edx,(%eax) - 3ba0: eb da jmp 3b7c + 3acd: 8b 4b f8 mov -0x8(%ebx),%ecx + 3ad0: eb dd jmp 3aaf -00003ba2 : +00003ad2 : return freep; } void* malloc(uint nbytes) { - 3ba2: f3 0f 1e fb endbr32 - 3ba6: 55 push %ebp - 3ba7: 89 e5 mov %esp,%ebp - 3ba9: 57 push %edi - 3baa: 56 push %esi - 3bab: 53 push %ebx - 3bac: 83 ec 0c sub $0xc,%esp + 3ad2: 55 push %ebp + 3ad3: 89 e5 mov %esp,%ebp + 3ad5: 57 push %edi + 3ad6: 56 push %esi + 3ad7: 53 push %ebx + 3ad8: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 3baf: 8b 45 08 mov 0x8(%ebp),%eax - 3bb2: 8d 58 07 lea 0x7(%eax),%ebx - 3bb5: c1 eb 03 shr $0x3,%ebx - 3bb8: 83 c3 01 add $0x1,%ebx + 3adb: 8b 45 08 mov 0x8(%ebp),%eax + 3ade: 8d 58 07 lea 0x7(%eax),%ebx + 3ae1: c1 eb 03 shr $0x3,%ebx + 3ae4: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 3bbb: 8b 15 40 5d 00 00 mov 0x5d40,%edx - 3bc1: 85 d2 test %edx,%edx - 3bc3: 74 20 je 3be5 + 3ae7: 8b 15 e0 a3 00 00 mov 0xa3e0,%edx + 3aed: 85 d2 test %edx,%edx + 3aef: 74 1c je 3b0d base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 3bc5: 8b 02 mov (%edx),%eax + 3af1: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 3bc7: 8b 48 04 mov 0x4(%eax),%ecx - 3bca: 39 cb cmp %ecx,%ebx - 3bcc: 76 3c jbe 3c0a - 3bce: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 3bd4: be 00 10 00 00 mov $0x1000,%esi - 3bd9: 0f 43 f3 cmovae %ebx,%esi + 3af3: 8b 48 04 mov 0x4(%eax),%ecx + 3af6: 39 cb cmp %ecx,%ebx + 3af8: 76 38 jbe 3b32 + 3afa: be 00 10 00 00 mov $0x1000,%esi + 3aff: 39 f3 cmp %esi,%ebx + 3b01: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 3bdc: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 3be3: eb 72 jmp 3c57 + 3b04: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 3b0b: eb 72 jmp 3b7f base.s.ptr = freep = prevp = &base; - 3be5: c7 05 40 5d 00 00 44 movl $0x5d44,0x5d40 - 3bec: 5d 00 00 - 3bef: c7 05 44 5d 00 00 44 movl $0x5d44,0x5d44 - 3bf6: 5d 00 00 + 3b0d: c7 05 e0 a3 00 00 e4 movl $0xa3e4,0xa3e0 + 3b14: a3 00 00 + 3b17: c7 05 e4 a3 00 00 e4 movl $0xa3e4,0xa3e4 + 3b1e: a3 00 00 base.s.size = 0; - 3bf9: c7 05 48 5d 00 00 00 movl $0x0,0x5d48 - 3c00: 00 00 00 + 3b21: c7 05 e8 a3 00 00 00 movl $0x0,0xa3e8 + 3b28: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 3c03: b8 44 5d 00 00 mov $0x5d44,%eax - 3c08: eb c4 jmp 3bce + 3b2b: b8 e4 a3 00 00 mov $0xa3e4,%eax + 3b30: eb c8 jmp 3afa if(p->s.size == nunits) - 3c0a: 39 cb cmp %ecx,%ebx - 3c0c: 74 1e je 3c2c + 3b32: 39 cb cmp %ecx,%ebx + 3b34: 74 1e je 3b54 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 3c0e: 29 d9 sub %ebx,%ecx - 3c10: 89 48 04 mov %ecx,0x4(%eax) + 3b36: 29 d9 sub %ebx,%ecx + 3b38: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 3c13: 8d 04 c8 lea (%eax,%ecx,8),%eax + 3b3b: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 3c16: 89 58 04 mov %ebx,0x4(%eax) + 3b3e: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 3c19: 89 15 40 5d 00 00 mov %edx,0x5d40 + 3b41: 89 15 e0 a3 00 00 mov %edx,0xa3e0 return (void*)(p + 1); - 3c1f: 8d 50 08 lea 0x8(%eax),%edx + 3b47: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 3c22: 89 d0 mov %edx,%eax - 3c24: 8d 65 f4 lea -0xc(%ebp),%esp - 3c27: 5b pop %ebx - 3c28: 5e pop %esi - 3c29: 5f pop %edi - 3c2a: 5d pop %ebp - 3c2b: c3 ret + 3b4a: 89 d0 mov %edx,%eax + 3b4c: 8d 65 f4 lea -0xc(%ebp),%esp + 3b4f: 5b pop %ebx + 3b50: 5e pop %esi + 3b51: 5f pop %edi + 3b52: 5d pop %ebp + 3b53: c3 ret prevp->s.ptr = p->s.ptr; - 3c2c: 8b 08 mov (%eax),%ecx - 3c2e: 89 0a mov %ecx,(%edx) - 3c30: eb e7 jmp 3c19 + 3b54: 8b 08 mov (%eax),%ecx + 3b56: 89 0a mov %ecx,(%edx) + 3b58: eb e7 jmp 3b41 hp->s.size = nu; - 3c32: 89 70 04 mov %esi,0x4(%eax) + 3b5a: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 3c35: 83 ec 0c sub $0xc,%esp - 3c38: 83 c0 08 add $0x8,%eax - 3c3b: 50 push %eax - 3c3c: e8 ef fe ff ff call 3b30 + 3b5d: 83 ec 0c sub $0xc,%esp + 3b60: 83 c0 08 add $0x8,%eax + 3b63: 50 push %eax + 3b64: e8 00 ff ff ff call 3a69 return freep; - 3c41: 8b 15 40 5d 00 00 mov 0x5d40,%edx + 3b69: 8b 15 e0 a3 00 00 mov 0xa3e0,%edx if((p = morecore(nunits)) == 0) - 3c47: 83 c4 10 add $0x10,%esp - 3c4a: 85 d2 test %edx,%edx - 3c4c: 74 d4 je 3c22 + 3b6f: 83 c4 10 add $0x10,%esp + 3b72: 85 d2 test %edx,%edx + 3b74: 74 d4 je 3b4a for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 3c4e: 8b 02 mov (%edx),%eax + 3b76: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 3c50: 8b 48 04 mov 0x4(%eax),%ecx - 3c53: 39 d9 cmp %ebx,%ecx - 3c55: 73 b3 jae 3c0a + 3b78: 8b 48 04 mov 0x4(%eax),%ecx + 3b7b: 39 d9 cmp %ebx,%ecx + 3b7d: 73 b3 jae 3b32 if(p == freep) - 3c57: 89 c2 mov %eax,%edx - 3c59: 39 05 40 5d 00 00 cmp %eax,0x5d40 - 3c5f: 75 ed jne 3c4e + 3b7f: 89 c2 mov %eax,%edx + 3b81: 39 05 e0 a3 00 00 cmp %eax,0xa3e0 + 3b87: 75 ed jne 3b76 p = sbrk(nu * sizeof(Header)); - 3c61: 83 ec 0c sub $0xc,%esp - 3c64: 57 push %edi - 3c65: e8 3c fc ff ff call 38a6 + 3b89: 83 ec 0c sub $0xc,%esp + 3b8c: 57 push %edi + 3b8d: e8 59 fc ff ff call 37eb if(p == (char*)-1) - 3c6a: 83 c4 10 add $0x10,%esp - 3c6d: 83 f8 ff cmp $0xffffffff,%eax - 3c70: 75 c0 jne 3c32 + 3b92: 83 c4 10 add $0x10,%esp + 3b95: 83 f8 ff cmp $0xffffffff,%eax + 3b98: 75 c0 jne 3b5a return 0; - 3c72: ba 00 00 00 00 mov $0x0,%edx - 3c77: eb a9 jmp 3c22 + 3b9a: ba 00 00 00 00 mov $0x0,%edx + 3b9f: eb a9 jmp 3b4a diff --git a/src/user/usertests.d b/src/user/usertests.d new file mode 100644 index 0000000..f665db0 --- /dev/null +++ b/src/user/usertests.d @@ -0,0 +1,2 @@ +user/usertests.o: user/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/src/user/usertests.o b/src/user/usertests.o new file mode 100644 index 0000000..ee3a562 Binary files /dev/null and b/src/user/usertests.o differ diff --git a/src/user/usertests.sym b/src/user/usertests.sym index 746a8ed..6e04240 100644 --- a/src/user/usertests.sym +++ b/src/user/usertests.sym @@ -1,105 +1,92 @@ -00000000 .text -00003c7c .rodata -00005430 .eh_frame -00005c88 .data -00005cc0 .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 -00005cc0 args.1453 +0000a360 args.0 00000000 ulib.c 00000000 printf.c -000038ce printint -0000541c digits.1089 +00003813 printint +0000539c digits.0 00000000 umalloc.c -00005d40 freep -00005d44 base -00003638 strcpy -00000b9f exitwait -00003962 printf -00005c8c stdout -0000312a bigargtest -000037e5 memmove -000001cb openiputtest -00003866 mknod -000038c6 ps -00003703 gets -0000389e getpid -000008c5 pipe1 -00002a13 iref -00003ba2 malloc -000038ae sleep -000000e1 exitiputtest -0000322d fsfull -000019ee bigdir -00002b39 forktest -00000531 writetest1 -0000227e bigwrite -00000cc9 sharedfd -00005c88 randstate -0000382e pipe -000038be slabtest -00005d60 uninit -000027f5 dirfile -0000383e write -000030c5 bsstest -00005c90 echoargv -00003876 fstat -0000384e kill -00003015 validatetest -0000266c rmdot -0000388e chdir -00000878 exectest -00003856 exec -00003826 wait -00003506 rand -00003836 read -00000a60 preempt -0000386e unlink -0000349a argptest -00000c0e mem -00003816 fork -000038a6 sbrk -000038b6 uptime -00005ca4 __bss_start -000036b7 memset -000006ef createtest -0000351f main -0000103a createdelete -0000365e strcmp -0000034f writetest -00003896 dup -00002bea sbrktest -000002b8 opentest -00001b4c subdir -00003424 uio -000013cf linktest -00008480 buf -00000797 dirtest +0000a3e0 freep +0000a3e4 base +0000359b strcpy +00000b73 exitwait +000038ab printf +00005c10 stdout +000030a6 bigargtest +0000372e memmove +000001c3 openiputtest +000037ab mknod +0000380b ps +00003656 gets +000037e3 getpid +000008a1 pipe1 +000029a3 iref +00003ad2 malloc +000037f3 sleep +000000dd exitiputtest +000031a5 fsfull +0000199c bigdir +00002ac5 forktest +0000051d writetest1 +00002224 bigwrite +00000c93 sharedfd +00005c0c randstate +00003773 pipe +00003803 slabtest +00005c40 uninit +00002789 dirfile +00003783 write +00003045 bsstest +00005c14 echoargv +000037bb fstat +00003793 kill +00002f99 validatetest +00002604 rmdot +000037d3 chdir +00000858 exectest +0000379b exec +0000376b wait +00003471 rand +0000377b read +00000a38 preempt +000037b3 unlink +00003409 argptest +00000bde mem +0000375b fork +000037eb sbrk +000037fb uptime +00005c28 __bss_start +00003610 memset +000006d7 createtest +00003486 main +00000ffc createdelete +000035bf strcmp +0000033f writetest +000037db dup +00002b72 sbrktest +000002ac opentest +00001af6 subdir +00003397 uio +00001389 linktest +00008360 buf +0000077b dirtest 00000000 iputtest -0000375e stat -0000235f bigfile -00005ca4 _edata -0000a484 _end -00001232 unlinkread -0000387e link -0000381e exit -000037a6 atoi -000018f8 linkunlink -0000a480 name -0000368d strlen -0000385e open -000036d2 strchr -000015f9 concreate -0000252b fourteen -00003010 validateint -00000e60 fourfiles -00003886 mkdir -00003846 close -00003b30 free +000036ad stat +000022ff bigfile +00005c28 _edata +0000a3ec _end +000011f0 unlinkread +000037c3 link +00003763 exit +000036f1 atoi +000018aa linkunlink +00008350 name +000035ea strlen +000037a3 open +00003629 strchr +000015af concreate +000024c7 fourteen +00002f98 validateint +00000e26 fourfiles +000037cb mkdir +0000378b close +00003a69 free diff --git a/src/user/wc.asm b/src/user/wc.asm index 60ae67f..10f68af 100644 --- a/src/user/wc.asm +++ b/src/user/wc.asm @@ -11,1199 +11,1168 @@ char buf[512]; void wc(int fd, char *name) { - 0: f3 0f 1e fb endbr32 - 4: 55 push %ebp - 5: 89 e5 mov %esp,%ebp - 7: 57 push %edi - 8: 56 push %esi - 9: 53 push %ebx - a: 83 ec 1c sub $0x1c,%esp + 0: 55 push %ebp + 1: 89 e5 mov %esp,%ebp + 3: 57 push %edi + 4: 56 push %esi + 5: 53 push %ebx + 6: 83 ec 1c sub $0x1c,%esp int i, n; int l, w, c, inword; l = w = c = 0; inword = 0; - d: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) + 9: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) l = w = c = 0; - 14: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) - 1b: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) - 22: be 00 00 00 00 mov $0x0,%esi + 10: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) + 17: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) + 1e: bf 00 00 00 00 mov $0x0,%edi while((n = read(fd, buf, sizeof(buf))) > 0){ - 27: eb 4d jmp 76 + 23: eb 4d jmp 72 + for(i=0; i - w++; - 2f: 83 45 e0 01 addl $0x1,-0x20(%ebp) - inword = 1; - 33: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) + 25: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) for(i=0; i + 2c: 83 c3 01 add $0x1,%ebx + 2f: 39 de cmp %ebx,%esi + 31: 74 3c je 6f if(buf[i] == '\n') - 41: 0f b6 83 c0 0a 00 00 movzbl 0xac0(%ebx),%eax + 33: 0f b6 83 c0 0a 00 00 movzbl 0xac0(%ebx),%eax l++; - 48: 3c 0a cmp $0xa,%al - 4a: 0f 94 c2 sete %dl - 4d: 0f b6 d2 movzbl %dl,%edx - 50: 01 d6 add %edx,%esi + 3a: 3c 0a cmp $0xa,%al + 3c: 0f 94 c2 sete %dl + 3f: 0f b6 d2 movzbl %dl,%edx + 42: 01 d7 add %edx,%edi if(strchr(" \r\t\n\v", buf[i])) - 52: 83 ec 08 sub $0x8,%esp - 55: 0f be c0 movsbl %al,%eax - 58: 50 push %eax - 59: 68 b0 07 00 00 push $0x7b0 - 5e: e8 a4 01 00 00 call 207 - 63: 83 c4 10 add $0x10,%esp - 66: 85 c0 test %eax,%eax - 68: 74 bf je 29 - inword = 0; - 6a: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) - 71: eb c7 jmp 3a - 73: 01 5d dc add %ebx,-0x24(%ebp) + 44: 83 ec 08 sub $0x8,%esp + 47: 0f be c0 movsbl %al,%eax + 4a: 50 push %eax + 4b: 68 6c 07 00 00 push $0x76c + 50: e8 9e 01 00 00 call 1f3 + 55: 83 c4 10 add $0x10,%esp + 58: 85 c0 test %eax,%eax + 5a: 75 c9 jne 25 + else if(!inword){ + 5c: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) + 60: 75 ca jne 2c + w++; + 62: 83 45 e0 01 addl $0x1,-0x20(%ebp) + inword = 1; + 66: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) + 6d: eb bd jmp 2c + c++; + 6f: 01 5d dc add %ebx,-0x24(%ebp) while((n = read(fd, buf, sizeof(buf))) > 0){ - 76: 83 ec 04 sub $0x4,%esp - 79: 68 00 02 00 00 push $0x200 - 7e: 68 c0 0a 00 00 push $0xac0 - 83: ff 75 08 pushl 0x8(%ebp) - 86: e8 e0 02 00 00 call 36b - 8b: 89 c7 mov %eax,%edi - 8d: 83 c4 10 add $0x10,%esp - 90: 85 c0 test %eax,%eax - 92: 7e 07 jle 9b + 72: 83 ec 04 sub $0x4,%esp + 75: 68 00 02 00 00 push $0x200 + 7a: 68 c0 0a 00 00 push $0xac0 + 7f: ff 75 08 push 0x8(%ebp) + 82: e8 be 02 00 00 call 345 + 87: 89 c6 mov %eax,%esi + 89: 83 c4 10 add $0x10,%esp + 8c: 85 c0 test %eax,%eax + 8e: 7e 07 jle 97 for(i=0; i + 90: bb 00 00 00 00 mov $0x0,%ebx + 95: eb 9c jmp 33 } } } if(n < 0){ - 9b: 78 24 js c1 + 97: 78 24 js bd printf(1, "wc: read error\n"); exit(); } printf(1, "%d %d %d %s\n", l, w, c, name); - 9d: 83 ec 08 sub $0x8,%esp - a0: ff 75 0c pushl 0xc(%ebp) - a3: ff 75 dc pushl -0x24(%ebp) - a6: ff 75 e0 pushl -0x20(%ebp) - a9: 56 push %esi - aa: 68 c6 07 00 00 push $0x7c6 - af: 6a 01 push $0x1 - b1: e8 e1 03 00 00 call 497 + 99: 83 ec 08 sub $0x8,%esp + 9c: ff 75 0c push 0xc(%ebp) + 9f: ff 75 dc push -0x24(%ebp) + a2: ff 75 e0 push -0x20(%ebp) + a5: 57 push %edi + a6: 68 82 07 00 00 push $0x782 + ab: 6a 01 push $0x1 + ad: e8 c3 03 00 00 call 475 } - b6: 83 c4 20 add $0x20,%esp - b9: 8d 65 f4 lea -0xc(%ebp),%esp - bc: 5b pop %ebx - bd: 5e pop %esi - be: 5f pop %edi - bf: 5d pop %ebp - c0: c3 ret + b2: 83 c4 20 add $0x20,%esp + b5: 8d 65 f4 lea -0xc(%ebp),%esp + b8: 5b pop %ebx + b9: 5e pop %esi + ba: 5f pop %edi + bb: 5d pop %ebp + bc: c3 ret printf(1, "wc: read error\n"); - c1: 83 ec 08 sub $0x8,%esp - c4: 68 b6 07 00 00 push $0x7b6 - c9: 6a 01 push $0x1 - cb: e8 c7 03 00 00 call 497 + bd: 83 ec 08 sub $0x8,%esp + c0: 68 72 07 00 00 push $0x772 + c5: 6a 01 push $0x1 + c7: e8 a9 03 00 00 call 475 exit(); - d0: e8 7e 02 00 00 call 353 + cc: e8 5c 02 00 00 call 32d -000000d5
: +000000d1
: int main(int argc, char *argv[]) { - d5: f3 0f 1e fb endbr32 - d9: 8d 4c 24 04 lea 0x4(%esp),%ecx - dd: 83 e4 f0 and $0xfffffff0,%esp - e0: ff 71 fc pushl -0x4(%ecx) - e3: 55 push %ebp - e4: 89 e5 mov %esp,%ebp - e6: 57 push %edi - e7: 56 push %esi - e8: 53 push %ebx - e9: 51 push %ecx - ea: 83 ec 18 sub $0x18,%esp - ed: 8b 01 mov (%ecx),%eax - ef: 89 45 e4 mov %eax,-0x1c(%ebp) - f2: 8b 71 04 mov 0x4(%ecx),%esi + d1: 8d 4c 24 04 lea 0x4(%esp),%ecx + d5: 83 e4 f0 and $0xfffffff0,%esp + d8: ff 71 fc push -0x4(%ecx) + db: 55 push %ebp + dc: 89 e5 mov %esp,%ebp + de: 57 push %edi + df: 56 push %esi + e0: 53 push %ebx + e1: 51 push %ecx + e2: 83 ec 18 sub $0x18,%esp + e5: 8b 01 mov (%ecx),%eax + e7: 89 45 e4 mov %eax,-0x1c(%ebp) + ea: 8b 71 04 mov 0x4(%ecx),%esi int fd, i; if(argc <= 1){ - f5: 83 c6 04 add $0x4,%esi + ed: 83 c6 04 add $0x4,%esi wc(0, ""); exit(); } for(i = 1; i < argc; i++){ - f8: bf 01 00 00 00 mov $0x1,%edi + f0: bf 01 00 00 00 mov $0x1,%edi if(argc <= 1){ - fd: 83 f8 01 cmp $0x1,%eax - 100: 7e 3e jle 140 + f5: 83 f8 01 cmp $0x1,%eax + f8: 7e 3e jle 138 if((fd = open(argv[i], 0)) < 0){ - 102: 89 75 e0 mov %esi,-0x20(%ebp) - 105: 83 ec 08 sub $0x8,%esp - 108: 6a 00 push $0x0 - 10a: ff 36 pushl (%esi) - 10c: e8 82 02 00 00 call 393 - 111: 89 c3 mov %eax,%ebx - 113: 83 c4 10 add $0x10,%esp - 116: 85 c0 test %eax,%eax - 118: 78 3a js 154 + fa: 89 75 e0 mov %esi,-0x20(%ebp) + fd: 83 ec 08 sub $0x8,%esp + 100: 6a 00 push $0x0 + 102: ff 36 push (%esi) + 104: e8 64 02 00 00 call 36d + 109: 89 c3 mov %eax,%ebx + 10b: 83 c4 10 add $0x10,%esp + 10e: 85 c0 test %eax,%eax + 110: 78 3a js 14c printf(1, "wc: cannot open %s\n", argv[i]); exit(); } wc(fd, argv[i]); - 11a: 83 ec 08 sub $0x8,%esp - 11d: ff 36 pushl (%esi) - 11f: 50 push %eax - 120: e8 db fe ff ff call 0 + 112: 83 ec 08 sub $0x8,%esp + 115: ff 36 push (%esi) + 117: 50 push %eax + 118: e8 e3 fe ff ff call 0 close(fd); - 125: 89 1c 24 mov %ebx,(%esp) - 128: e8 4e 02 00 00 call 37b + 11d: 89 1c 24 mov %ebx,(%esp) + 120: e8 30 02 00 00 call 355 for(i = 1; i < argc; i++){ - 12d: 83 c7 01 add $0x1,%edi - 130: 83 c6 04 add $0x4,%esi - 133: 83 c4 10 add $0x10,%esp - 136: 39 7d e4 cmp %edi,-0x1c(%ebp) - 139: 75 c7 jne 102 + 125: 83 c7 01 add $0x1,%edi + 128: 83 c6 04 add $0x4,%esi + 12b: 83 c4 10 add $0x10,%esp + 12e: 39 7d e4 cmp %edi,-0x1c(%ebp) + 131: 75 c7 jne fa } exit(); - 13b: e8 13 02 00 00 call 353 + 133: e8 f5 01 00 00 call 32d wc(0, ""); - 140: 83 ec 08 sub $0x8,%esp - 143: 68 c5 07 00 00 push $0x7c5 - 148: 6a 00 push $0x0 - 14a: e8 b1 fe ff ff call 0 + 138: 83 ec 08 sub $0x8,%esp + 13b: 68 81 07 00 00 push $0x781 + 140: 6a 00 push $0x0 + 142: e8 b9 fe ff ff call 0 exit(); - 14f: e8 ff 01 00 00 call 353 + 147: e8 e1 01 00 00 call 32d printf(1, "wc: cannot open %s\n", argv[i]); - 154: 83 ec 04 sub $0x4,%esp - 157: 8b 45 e0 mov -0x20(%ebp),%eax - 15a: ff 30 pushl (%eax) - 15c: 68 d3 07 00 00 push $0x7d3 - 161: 6a 01 push $0x1 - 163: e8 2f 03 00 00 call 497 + 14c: 83 ec 04 sub $0x4,%esp + 14f: 8b 45 e0 mov -0x20(%ebp),%eax + 152: ff 30 push (%eax) + 154: 68 8f 07 00 00 push $0x78f + 159: 6a 01 push $0x1 + 15b: e8 15 03 00 00 call 475 exit(); - 168: e8 e6 01 00 00 call 353 + 160: e8 c8 01 00 00 call 32d -0000016d : +00000165 : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 16d: f3 0f 1e fb endbr32 - 171: 55 push %ebp - 172: 89 e5 mov %esp,%ebp - 174: 53 push %ebx - 175: 8b 4d 08 mov 0x8(%ebp),%ecx - 178: 8b 5d 0c mov 0xc(%ebp),%ebx + 165: 55 push %ebp + 166: 89 e5 mov %esp,%ebp + 168: 53 push %ebx + 169: 8b 4d 08 mov 0x8(%ebp),%ecx + 16c: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 17b: b8 00 00 00 00 mov $0x0,%eax - 180: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 184: 88 14 01 mov %dl,(%ecx,%eax,1) - 187: 83 c0 01 add $0x1,%eax - 18a: 84 d2 test %dl,%dl - 18c: 75 f2 jne 180 + 16f: b8 00 00 00 00 mov $0x0,%eax + 174: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 178: 88 14 01 mov %dl,(%ecx,%eax,1) + 17b: 83 c0 01 add $0x1,%eax + 17e: 84 d2 test %dl,%dl + 180: 75 f2 jne 174 ; return os; } - 18e: 89 c8 mov %ecx,%eax - 190: 5b pop %ebx - 191: 5d pop %ebp - 192: c3 ret + 182: 89 c8 mov %ecx,%eax + 184: 8b 5d fc mov -0x4(%ebp),%ebx + 187: c9 leave + 188: c3 ret -00000193 : +00000189 : int strcmp(const char *p, const char *q) { - 193: f3 0f 1e fb endbr32 - 197: 55 push %ebp - 198: 89 e5 mov %esp,%ebp - 19a: 8b 4d 08 mov 0x8(%ebp),%ecx - 19d: 8b 55 0c mov 0xc(%ebp),%edx + 189: 55 push %ebp + 18a: 89 e5 mov %esp,%ebp + 18c: 8b 4d 08 mov 0x8(%ebp),%ecx + 18f: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 1a0: 0f b6 01 movzbl (%ecx),%eax - 1a3: 84 c0 test %al,%al - 1a5: 74 11 je 1b8 - 1a7: 38 02 cmp %al,(%edx) - 1a9: 75 0d jne 1b8 + 192: 0f b6 01 movzbl (%ecx),%eax + 195: 84 c0 test %al,%al + 197: 74 11 je 1aa + 199: 38 02 cmp %al,(%edx) + 19b: 75 0d jne 1aa p++, q++; - 1ab: 83 c1 01 add $0x1,%ecx - 1ae: 83 c2 01 add $0x1,%edx + 19d: 83 c1 01 add $0x1,%ecx + 1a0: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 1b1: 0f b6 01 movzbl (%ecx),%eax - 1b4: 84 c0 test %al,%al - 1b6: 75 ef jne 1a7 + 1a3: 0f b6 01 movzbl (%ecx),%eax + 1a6: 84 c0 test %al,%al + 1a8: 75 ef jne 199 return (uchar)*p - (uchar)*q; - 1b8: 0f b6 c0 movzbl %al,%eax - 1bb: 0f b6 12 movzbl (%edx),%edx - 1be: 29 d0 sub %edx,%eax + 1aa: 0f b6 c0 movzbl %al,%eax + 1ad: 0f b6 12 movzbl (%edx),%edx + 1b0: 29 d0 sub %edx,%eax } - 1c0: 5d pop %ebp - 1c1: c3 ret + 1b2: 5d pop %ebp + 1b3: c3 ret -000001c2 : +000001b4 : uint strlen(const char *s) { - 1c2: f3 0f 1e fb endbr32 - 1c6: 55 push %ebp - 1c7: 89 e5 mov %esp,%ebp - 1c9: 8b 55 08 mov 0x8(%ebp),%edx + 1b4: 55 push %ebp + 1b5: 89 e5 mov %esp,%ebp + 1b7: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 1cc: 80 3a 00 cmpb $0x0,(%edx) - 1cf: 74 14 je 1e5 - 1d1: b8 00 00 00 00 mov $0x0,%eax - 1d6: 83 c0 01 add $0x1,%eax - 1d9: 89 c1 mov %eax,%ecx - 1db: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - 1df: 75 f5 jne 1d6 + 1ba: 80 3a 00 cmpb $0x0,(%edx) + 1bd: 74 14 je 1d3 + 1bf: b8 00 00 00 00 mov $0x0,%eax + 1c4: 83 c0 01 add $0x1,%eax + 1c7: 89 c1 mov %eax,%ecx + 1c9: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 1cd: 75 f5 jne 1c4 ; return n; } - 1e1: 89 c8 mov %ecx,%eax - 1e3: 5d pop %ebp - 1e4: c3 ret + 1cf: 89 c8 mov %ecx,%eax + 1d1: 5d pop %ebp + 1d2: c3 ret for(n = 0; s[n]; n++) - 1e5: b9 00 00 00 00 mov $0x0,%ecx + 1d3: b9 00 00 00 00 mov $0x0,%ecx return n; - 1ea: eb f5 jmp 1e1 + 1d8: eb f5 jmp 1cf -000001ec : +000001da : void* memset(void *dst, int c, uint n) { - 1ec: f3 0f 1e fb endbr32 - 1f0: 55 push %ebp - 1f1: 89 e5 mov %esp,%ebp - 1f3: 57 push %edi - 1f4: 8b 55 08 mov 0x8(%ebp),%edx + 1da: 55 push %ebp + 1db: 89 e5 mov %esp,%ebp + 1dd: 57 push %edi + 1de: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - 1f7: 89 d7 mov %edx,%edi - 1f9: 8b 4d 10 mov 0x10(%ebp),%ecx - 1fc: 8b 45 0c mov 0xc(%ebp),%eax - 1ff: fc cld - 200: f3 aa rep stos %al,%es:(%edi) + 1e1: 89 d7 mov %edx,%edi + 1e3: 8b 4d 10 mov 0x10(%ebp),%ecx + 1e6: 8b 45 0c mov 0xc(%ebp),%eax + 1e9: fc cld + 1ea: 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 + 1ec: 89 d0 mov %edx,%eax + 1ee: 8b 7d fc mov -0x4(%ebp),%edi + 1f1: c9 leave + 1f2: c3 ret -00000207 : +000001f3 : char* strchr(const char *s, char c) { - 207: f3 0f 1e fb endbr32 - 20b: 55 push %ebp - 20c: 89 e5 mov %esp,%ebp - 20e: 8b 45 08 mov 0x8(%ebp),%eax - 211: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + 1f3: 55 push %ebp + 1f4: 89 e5 mov %esp,%ebp + 1f6: 8b 45 08 mov 0x8(%ebp),%eax + 1f9: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - 215: 0f b6 10 movzbl (%eax),%edx - 218: 84 d2 test %dl,%dl - 21a: 74 15 je 231 + 1fd: 0f b6 10 movzbl (%eax),%edx + 200: 84 d2 test %dl,%dl + 202: 74 15 je 219 if(*s == c) - 21c: 38 d1 cmp %dl,%cl - 21e: 74 0f je 22f + 204: 38 d1 cmp %dl,%cl + 206: 74 0f je 217 for(; *s; s++) - 220: 83 c0 01 add $0x1,%eax - 223: 0f b6 10 movzbl (%eax),%edx - 226: 84 d2 test %dl,%dl - 228: 75 f2 jne 21c + 208: 83 c0 01 add $0x1,%eax + 20b: 0f b6 10 movzbl (%eax),%edx + 20e: 84 d2 test %dl,%dl + 210: 75 f2 jne 204 return (char*)s; return 0; - 22a: b8 00 00 00 00 mov $0x0,%eax + 212: b8 00 00 00 00 mov $0x0,%eax } - 22f: 5d pop %ebp - 230: c3 ret + 217: 5d pop %ebp + 218: c3 ret return 0; - 231: b8 00 00 00 00 mov $0x0,%eax - 236: eb f7 jmp 22f + 219: b8 00 00 00 00 mov $0x0,%eax + 21e: eb f7 jmp 217 -00000238 : +00000220 : char* gets(char *buf, int max) { - 238: f3 0f 1e fb endbr32 - 23c: 55 push %ebp - 23d: 89 e5 mov %esp,%ebp - 23f: 57 push %edi - 240: 56 push %esi - 241: 53 push %ebx - 242: 83 ec 2c sub $0x2c,%esp - 245: 8b 75 08 mov 0x8(%ebp),%esi + 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 2c sub $0x2c,%esp + 229: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 248: bb 00 00 00 00 mov $0x0,%ebx + 22c: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 24d: 8d 7d e7 lea -0x19(%ebp),%edi + 231: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 250: 89 5d d4 mov %ebx,-0x2c(%ebp) - 253: 83 c3 01 add $0x1,%ebx - 256: 3b 5d 0c cmp 0xc(%ebp),%ebx - 259: 7d 27 jge 282 + 234: 89 5d d4 mov %ebx,-0x2c(%ebp) + 237: 83 c3 01 add $0x1,%ebx + 23a: 3b 5d 0c cmp 0xc(%ebp),%ebx + 23d: 7d 27 jge 266 cc = read(0, &c, 1); - 25b: 83 ec 04 sub $0x4,%esp - 25e: 6a 01 push $0x1 - 260: 57 push %edi - 261: 6a 00 push $0x0 - 263: e8 03 01 00 00 call 36b + 23f: 83 ec 04 sub $0x4,%esp + 242: 6a 01 push $0x1 + 244: 57 push %edi + 245: 6a 00 push $0x0 + 247: e8 f9 00 00 00 call 345 if(cc < 1) - 268: 83 c4 10 add $0x10,%esp - 26b: 85 c0 test %eax,%eax - 26d: 7e 13 jle 282 + 24c: 83 c4 10 add $0x10,%esp + 24f: 85 c0 test %eax,%eax + 251: 7e 13 jle 266 break; buf[i++] = c; - 26f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 273: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 253: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 257: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 277: 3c 0a cmp $0xa,%al - 279: 74 04 je 27f - 27b: 3c 0d cmp $0xd,%al - 27d: 75 d1 jne 250 + 25b: 3c 0a cmp $0xa,%al + 25d: 74 04 je 263 + 25f: 3c 0d cmp $0xd,%al + 261: 75 d1 jne 234 for(i=0; i+1 < max; ){ - 27f: 89 5d d4 mov %ebx,-0x2c(%ebp) + 263: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 282: 8b 45 d4 mov -0x2c(%ebp),%eax - 285: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 266: 8b 45 d4 mov -0x2c(%ebp),%eax + 269: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 289: 89 f0 mov %esi,%eax - 28b: 8d 65 f4 lea -0xc(%ebp),%esp - 28e: 5b pop %ebx - 28f: 5e pop %esi - 290: 5f pop %edi - 291: 5d pop %ebp - 292: c3 ret + 26d: 89 f0 mov %esi,%eax + 26f: 8d 65 f4 lea -0xc(%ebp),%esp + 272: 5b pop %ebx + 273: 5e pop %esi + 274: 5f pop %edi + 275: 5d pop %ebp + 276: c3 ret -00000293 : +00000277 : int stat(const char *n, struct stat *st) { - 293: f3 0f 1e fb endbr32 - 297: 55 push %ebp - 298: 89 e5 mov %esp,%ebp - 29a: 56 push %esi - 29b: 53 push %ebx + 277: 55 push %ebp + 278: 89 e5 mov %esp,%ebp + 27a: 56 push %esi + 27b: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 29c: 83 ec 08 sub $0x8,%esp - 29f: 6a 00 push $0x0 - 2a1: ff 75 08 pushl 0x8(%ebp) - 2a4: e8 ea 00 00 00 call 393 + 27c: 83 ec 08 sub $0x8,%esp + 27f: 6a 00 push $0x0 + 281: ff 75 08 push 0x8(%ebp) + 284: e8 e4 00 00 00 call 36d if(fd < 0) - 2a9: 83 c4 10 add $0x10,%esp - 2ac: 85 c0 test %eax,%eax - 2ae: 78 24 js 2d4 - 2b0: 89 c3 mov %eax,%ebx + 289: 83 c4 10 add $0x10,%esp + 28c: 85 c0 test %eax,%eax + 28e: 78 24 js 2b4 + 290: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 2b2: 83 ec 08 sub $0x8,%esp - 2b5: ff 75 0c pushl 0xc(%ebp) - 2b8: 50 push %eax - 2b9: e8 ed 00 00 00 call 3ab - 2be: 89 c6 mov %eax,%esi + 292: 83 ec 08 sub $0x8,%esp + 295: ff 75 0c push 0xc(%ebp) + 298: 50 push %eax + 299: e8 e7 00 00 00 call 385 + 29e: 89 c6 mov %eax,%esi close(fd); - 2c0: 89 1c 24 mov %ebx,(%esp) - 2c3: e8 b3 00 00 00 call 37b + 2a0: 89 1c 24 mov %ebx,(%esp) + 2a3: e8 ad 00 00 00 call 355 return r; - 2c8: 83 c4 10 add $0x10,%esp + 2a8: 83 c4 10 add $0x10,%esp } - 2cb: 89 f0 mov %esi,%eax - 2cd: 8d 65 f8 lea -0x8(%ebp),%esp - 2d0: 5b pop %ebx - 2d1: 5e pop %esi - 2d2: 5d pop %ebp - 2d3: c3 ret + 2ab: 89 f0 mov %esi,%eax + 2ad: 8d 65 f8 lea -0x8(%ebp),%esp + 2b0: 5b pop %ebx + 2b1: 5e pop %esi + 2b2: 5d pop %ebp + 2b3: c3 ret return -1; - 2d4: be ff ff ff ff mov $0xffffffff,%esi - 2d9: eb f0 jmp 2cb + 2b4: be ff ff ff ff mov $0xffffffff,%esi + 2b9: eb f0 jmp 2ab -000002db : +000002bb : int atoi(const char *s) { - 2db: f3 0f 1e fb endbr32 - 2df: 55 push %ebp - 2e0: 89 e5 mov %esp,%ebp - 2e2: 53 push %ebx - 2e3: 8b 55 08 mov 0x8(%ebp),%edx + 2bb: 55 push %ebp + 2bc: 89 e5 mov %esp,%ebp + 2be: 53 push %ebx + 2bf: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 2e6: 0f b6 02 movzbl (%edx),%eax - 2e9: 8d 48 d0 lea -0x30(%eax),%ecx - 2ec: 80 f9 09 cmp $0x9,%cl - 2ef: 77 22 ja 313 + 2c2: 0f b6 02 movzbl (%edx),%eax + 2c5: 8d 48 d0 lea -0x30(%eax),%ecx + 2c8: 80 f9 09 cmp $0x9,%cl + 2cb: 77 24 ja 2f1 n = 0; - 2f1: b9 00 00 00 00 mov $0x0,%ecx + 2cd: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 2f6: 83 c2 01 add $0x1,%edx - 2f9: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 2fc: 0f be c0 movsbl %al,%eax - 2ff: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 2d2: 83 c2 01 add $0x1,%edx + 2d5: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 2d8: 0f be c0 movsbl %al,%eax + 2db: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 303: 0f b6 02 movzbl (%edx),%eax - 306: 8d 58 d0 lea -0x30(%eax),%ebx - 309: 80 fb 09 cmp $0x9,%bl - 30c: 76 e8 jbe 2f6 + 2df: 0f b6 02 movzbl (%edx),%eax + 2e2: 8d 58 d0 lea -0x30(%eax),%ebx + 2e5: 80 fb 09 cmp $0x9,%bl + 2e8: 76 e8 jbe 2d2 return n; } - 30e: 89 c8 mov %ecx,%eax - 310: 5b pop %ebx - 311: 5d pop %ebp - 312: c3 ret + 2ea: 89 c8 mov %ecx,%eax + 2ec: 8b 5d fc mov -0x4(%ebp),%ebx + 2ef: c9 leave + 2f0: c3 ret n = 0; - 313: b9 00 00 00 00 mov $0x0,%ecx + 2f1: b9 00 00 00 00 mov $0x0,%ecx return n; - 318: eb f4 jmp 30e + 2f6: eb f2 jmp 2ea -0000031a : +000002f8 : void* memmove(void *vdst, const void *vsrc, int n) { - 31a: f3 0f 1e fb endbr32 - 31e: 55 push %ebp - 31f: 89 e5 mov %esp,%ebp - 321: 56 push %esi - 322: 53 push %ebx - 323: 8b 75 08 mov 0x8(%ebp),%esi - 326: 8b 55 0c mov 0xc(%ebp),%edx - 329: 8b 5d 10 mov 0x10(%ebp),%ebx + 2f8: 55 push %ebp + 2f9: 89 e5 mov %esp,%ebp + 2fb: 56 push %esi + 2fc: 53 push %ebx + 2fd: 8b 75 08 mov 0x8(%ebp),%esi + 300: 8b 55 0c mov 0xc(%ebp),%edx + 303: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 32c: 85 db test %ebx,%ebx - 32e: 7e 15 jle 345 - 330: 01 f3 add %esi,%ebx + 306: 85 db test %ebx,%ebx + 308: 7e 15 jle 31f + 30a: 01 f3 add %esi,%ebx dst = vdst; - 332: 89 f0 mov %esi,%eax + 30c: 89 f0 mov %esi,%eax *dst++ = *src++; - 334: 83 c2 01 add $0x1,%edx - 337: 83 c0 01 add $0x1,%eax - 33a: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 33e: 88 48 ff mov %cl,-0x1(%eax) + 30e: 83 c2 01 add $0x1,%edx + 311: 83 c0 01 add $0x1,%eax + 314: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 318: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 341: 39 c3 cmp %eax,%ebx - 343: 75 ef jne 334 + 31b: 39 c3 cmp %eax,%ebx + 31d: 75 ef jne 30e return vdst; } - 345: 89 f0 mov %esi,%eax - 347: 5b pop %ebx - 348: 5e pop %esi - 349: 5d pop %ebp - 34a: c3 ret + 31f: 89 f0 mov %esi,%eax + 321: 5b pop %ebx + 322: 5e pop %esi + 323: 5d pop %ebp + 324: c3 ret -0000034b : +00000325 : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 34b: b8 01 00 00 00 mov $0x1,%eax - 350: cd 40 int $0x40 - 352: c3 ret + 325: b8 01 00 00 00 mov $0x1,%eax + 32a: cd 40 int $0x40 + 32c: c3 ret -00000353 : +0000032d : SYSCALL(exit) - 353: b8 02 00 00 00 mov $0x2,%eax - 358: cd 40 int $0x40 - 35a: c3 ret + 32d: b8 02 00 00 00 mov $0x2,%eax + 332: cd 40 int $0x40 + 334: c3 ret -0000035b : +00000335 : SYSCALL(wait) - 35b: b8 03 00 00 00 mov $0x3,%eax - 360: cd 40 int $0x40 - 362: c3 ret + 335: b8 03 00 00 00 mov $0x3,%eax + 33a: cd 40 int $0x40 + 33c: c3 ret -00000363 : +0000033d : SYSCALL(pipe) - 363: b8 04 00 00 00 mov $0x4,%eax - 368: cd 40 int $0x40 - 36a: c3 ret + 33d: b8 04 00 00 00 mov $0x4,%eax + 342: cd 40 int $0x40 + 344: c3 ret -0000036b : +00000345 : SYSCALL(read) - 36b: b8 05 00 00 00 mov $0x5,%eax - 370: cd 40 int $0x40 - 372: c3 ret + 345: b8 05 00 00 00 mov $0x5,%eax + 34a: cd 40 int $0x40 + 34c: c3 ret -00000373 : +0000034d : SYSCALL(write) - 373: b8 10 00 00 00 mov $0x10,%eax - 378: cd 40 int $0x40 - 37a: c3 ret + 34d: b8 10 00 00 00 mov $0x10,%eax + 352: cd 40 int $0x40 + 354: c3 ret -0000037b : +00000355 : SYSCALL(close) - 37b: b8 15 00 00 00 mov $0x15,%eax - 380: cd 40 int $0x40 - 382: c3 ret + 355: b8 15 00 00 00 mov $0x15,%eax + 35a: cd 40 int $0x40 + 35c: c3 ret -00000383 : +0000035d : SYSCALL(kill) - 383: b8 06 00 00 00 mov $0x6,%eax - 388: cd 40 int $0x40 - 38a: c3 ret + 35d: b8 06 00 00 00 mov $0x6,%eax + 362: cd 40 int $0x40 + 364: c3 ret -0000038b : +00000365 : SYSCALL(exec) - 38b: b8 07 00 00 00 mov $0x7,%eax - 390: cd 40 int $0x40 - 392: c3 ret + 365: b8 07 00 00 00 mov $0x7,%eax + 36a: cd 40 int $0x40 + 36c: c3 ret -00000393 : +0000036d : SYSCALL(open) - 393: b8 0f 00 00 00 mov $0xf,%eax - 398: cd 40 int $0x40 - 39a: c3 ret + 36d: b8 0f 00 00 00 mov $0xf,%eax + 372: cd 40 int $0x40 + 374: c3 ret -0000039b : +00000375 : SYSCALL(mknod) - 39b: b8 11 00 00 00 mov $0x11,%eax - 3a0: cd 40 int $0x40 - 3a2: c3 ret + 375: b8 11 00 00 00 mov $0x11,%eax + 37a: cd 40 int $0x40 + 37c: c3 ret -000003a3 : +0000037d : SYSCALL(unlink) - 3a3: b8 12 00 00 00 mov $0x12,%eax - 3a8: cd 40 int $0x40 - 3aa: c3 ret + 37d: b8 12 00 00 00 mov $0x12,%eax + 382: cd 40 int $0x40 + 384: c3 ret -000003ab : +00000385 : SYSCALL(fstat) - 3ab: b8 08 00 00 00 mov $0x8,%eax - 3b0: cd 40 int $0x40 - 3b2: c3 ret + 385: b8 08 00 00 00 mov $0x8,%eax + 38a: cd 40 int $0x40 + 38c: c3 ret -000003b3 : +0000038d : SYSCALL(link) - 3b3: b8 13 00 00 00 mov $0x13,%eax - 3b8: cd 40 int $0x40 - 3ba: c3 ret + 38d: b8 13 00 00 00 mov $0x13,%eax + 392: cd 40 int $0x40 + 394: c3 ret -000003bb : +00000395 : SYSCALL(mkdir) - 3bb: b8 14 00 00 00 mov $0x14,%eax - 3c0: cd 40 int $0x40 - 3c2: c3 ret + 395: b8 14 00 00 00 mov $0x14,%eax + 39a: cd 40 int $0x40 + 39c: c3 ret -000003c3 : +0000039d : SYSCALL(chdir) - 3c3: b8 09 00 00 00 mov $0x9,%eax - 3c8: cd 40 int $0x40 - 3ca: c3 ret + 39d: b8 09 00 00 00 mov $0x9,%eax + 3a2: cd 40 int $0x40 + 3a4: c3 ret -000003cb : +000003a5 : SYSCALL(dup) - 3cb: b8 0a 00 00 00 mov $0xa,%eax - 3d0: cd 40 int $0x40 - 3d2: c3 ret + 3a5: b8 0a 00 00 00 mov $0xa,%eax + 3aa: cd 40 int $0x40 + 3ac: c3 ret -000003d3 : +000003ad : SYSCALL(getpid) - 3d3: b8 0b 00 00 00 mov $0xb,%eax - 3d8: cd 40 int $0x40 - 3da: c3 ret + 3ad: b8 0b 00 00 00 mov $0xb,%eax + 3b2: cd 40 int $0x40 + 3b4: c3 ret -000003db : +000003b5 : SYSCALL(sbrk) - 3db: b8 0c 00 00 00 mov $0xc,%eax - 3e0: cd 40 int $0x40 - 3e2: c3 ret + 3b5: b8 0c 00 00 00 mov $0xc,%eax + 3ba: cd 40 int $0x40 + 3bc: c3 ret -000003e3 : +000003bd : SYSCALL(sleep) - 3e3: b8 0d 00 00 00 mov $0xd,%eax - 3e8: cd 40 int $0x40 - 3ea: c3 ret + 3bd: b8 0d 00 00 00 mov $0xd,%eax + 3c2: cd 40 int $0x40 + 3c4: c3 ret -000003eb : +000003c5 : SYSCALL(uptime) - 3eb: b8 0e 00 00 00 mov $0xe,%eax - 3f0: cd 40 int $0x40 - 3f2: c3 ret + 3c5: b8 0e 00 00 00 mov $0xe,%eax + 3ca: cd 40 int $0x40 + 3cc: c3 ret -000003f3 : +000003cd : SYSCALL(slabtest) - 3f3: b8 16 00 00 00 mov $0x16,%eax - 3f8: cd 40 int $0x40 - 3fa: c3 ret + 3cd: b8 16 00 00 00 mov $0x16,%eax + 3d2: cd 40 int $0x40 + 3d4: c3 ret -000003fb : +000003d5 : SYSCALL(ps) - 3fb: b8 17 00 00 00 mov $0x17,%eax - 400: cd 40 int $0x40 - 402: c3 ret + 3d5: b8 17 00 00 00 mov $0x17,%eax + 3da: cd 40 int $0x40 + 3dc: c3 ret -00000403 : +000003dd : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 403: 55 push %ebp - 404: 89 e5 mov %esp,%ebp - 406: 57 push %edi - 407: 56 push %esi - 408: 53 push %ebx - 409: 83 ec 3c sub $0x3c,%esp - 40c: 89 45 c4 mov %eax,-0x3c(%ebp) - 40f: 89 d3 mov %edx,%ebx + 3dd: 55 push %ebp + 3de: 89 e5 mov %esp,%ebp + 3e0: 57 push %edi + 3e1: 56 push %esi + 3e2: 53 push %ebx + 3e3: 83 ec 3c sub $0x3c,%esp + 3e6: 89 45 c4 mov %eax,-0x3c(%ebp) + 3e9: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 411: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 415: 74 77 je 48e - 417: 85 d2 test %edx,%edx - 419: 79 73 jns 48e + 3eb: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 3ef: 74 79 je 46a + 3f1: 85 d2 test %edx,%edx + 3f3: 79 75 jns 46a neg = 1; x = -xx; - 41b: f7 db neg %ebx + 3f5: 89 d1 mov %edx,%ecx + 3f7: f7 d9 neg %ecx neg = 1; - 41d: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 3f9: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 424: be 00 00 00 00 mov $0x0,%esi + 400: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 429: 89 f7 mov %esi,%edi - 42b: 83 c6 01 add $0x1,%esi - 42e: 89 d8 mov %ebx,%eax - 430: ba 00 00 00 00 mov $0x0,%edx - 435: f7 f1 div %ecx - 437: 0f b6 92 f0 07 00 00 movzbl 0x7f0(%edx),%edx - 43e: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 405: 89 df mov %ebx,%edi + 407: 83 c3 01 add $0x1,%ebx + 40a: 89 c8 mov %ecx,%eax + 40c: ba 00 00 00 00 mov $0x0,%edx + 411: f7 f6 div %esi + 413: 0f b6 92 04 08 00 00 movzbl 0x804(%edx),%edx + 41a: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 442: 89 da mov %ebx,%edx - 444: 89 c3 mov %eax,%ebx - 446: 39 d1 cmp %edx,%ecx - 448: 76 df jbe 429 + 41e: 89 ca mov %ecx,%edx + 420: 89 c1 mov %eax,%ecx + 422: 39 d6 cmp %edx,%esi + 424: 76 df jbe 405 if(neg) - 44a: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 44e: 74 08 je 458 + 426: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 42a: 74 08 je 434 buf[i++] = '-'; - 450: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 455: 8d 77 02 lea 0x2(%edi),%esi + 42c: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 431: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 458: 85 f6 test %esi,%esi - 45a: 7e 2a jle 486 - 45c: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 460: 8d 7d d8 lea -0x28(%ebp),%edi + 434: 85 db test %ebx,%ebx + 436: 7e 2a jle 462 + 438: 8d 7d d8 lea -0x28(%ebp),%edi + 43b: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 463: 8d 75 d7 lea -0x29(%ebp),%esi + 43f: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 466: 0f b6 03 movzbl (%ebx),%eax - 469: 88 45 d7 mov %al,-0x29(%ebp) + 442: 0f b6 03 movzbl (%ebx),%eax + 445: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 46c: 83 ec 04 sub $0x4,%esp - 46f: 6a 01 push $0x1 - 471: 56 push %esi - 472: ff 75 c4 pushl -0x3c(%ebp) - 475: e8 f9 fe ff ff call 373 + 448: 83 ec 04 sub $0x4,%esp + 44b: 6a 01 push $0x1 + 44d: 56 push %esi + 44e: ff 75 c4 push -0x3c(%ebp) + 451: e8 f7 fe ff ff call 34d while(--i >= 0) - 47a: 89 d8 mov %ebx,%eax - 47c: 83 eb 01 sub $0x1,%ebx - 47f: 83 c4 10 add $0x10,%esp - 482: 39 f8 cmp %edi,%eax - 484: 75 e0 jne 466 + 456: 89 d8 mov %ebx,%eax + 458: 83 eb 01 sub $0x1,%ebx + 45b: 83 c4 10 add $0x10,%esp + 45e: 39 f8 cmp %edi,%eax + 460: 75 e0 jne 442 } - 486: 8d 65 f4 lea -0xc(%ebp),%esp - 489: 5b pop %ebx - 48a: 5e pop %esi - 48b: 5f pop %edi - 48c: 5d pop %ebp - 48d: c3 ret + 462: 8d 65 f4 lea -0xc(%ebp),%esp + 465: 5b pop %ebx + 466: 5e pop %esi + 467: 5f pop %edi + 468: 5d pop %ebp + 469: c3 ret + x = xx; + 46a: 89 d1 mov %edx,%ecx neg = 0; - 48e: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 495: eb 8d jmp 424 + 46c: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 473: eb 8b jmp 400 -00000497 : +00000475 : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 497: f3 0f 1e fb endbr32 - 49b: 55 push %ebp - 49c: 89 e5 mov %esp,%ebp - 49e: 57 push %edi - 49f: 56 push %esi - 4a0: 53 push %ebx - 4a1: 83 ec 2c sub $0x2c,%esp + 475: 55 push %ebp + 476: 89 e5 mov %esp,%ebp + 478: 57 push %edi + 479: 56 push %esi + 47a: 53 push %ebx + 47b: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 4a4: 8b 75 0c mov 0xc(%ebp),%esi - 4a7: 0f b6 1e movzbl (%esi),%ebx - 4aa: 84 db test %bl,%bl - 4ac: 0f 84 ab 01 00 00 je 65d - 4b2: 83 c6 01 add $0x1,%esi + 47e: 8b 75 0c mov 0xc(%ebp),%esi + 481: 0f b6 1e movzbl (%esi),%ebx + 484: 84 db test %bl,%bl + 486: 0f 84 9f 01 00 00 je 62b + 48c: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 4b5: 8d 45 10 lea 0x10(%ebp),%eax - 4b8: 89 45 d4 mov %eax,-0x2c(%ebp) + 48f: 8d 45 10 lea 0x10(%ebp),%eax + 492: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 4bb: bf 00 00 00 00 mov $0x0,%edi - 4c0: eb 2d jmp 4ef + 495: bf 00 00 00 00 mov $0x0,%edi + 49a: eb 2d jmp 4c9 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 4c2: 88 5d e7 mov %bl,-0x19(%ebp) + 49c: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 4c5: 83 ec 04 sub $0x4,%esp - 4c8: 6a 01 push $0x1 - 4ca: 8d 45 e7 lea -0x19(%ebp),%eax - 4cd: 50 push %eax - 4ce: ff 75 08 pushl 0x8(%ebp) - 4d1: e8 9d fe ff ff call 373 + 49f: 83 ec 04 sub $0x4,%esp + 4a2: 6a 01 push $0x1 + 4a4: 8d 45 e7 lea -0x19(%ebp),%eax + 4a7: 50 push %eax + 4a8: ff 75 08 push 0x8(%ebp) + 4ab: e8 9d fe ff ff call 34d putc(fd, c); - 4d6: 83 c4 10 add $0x10,%esp - 4d9: eb 05 jmp 4e0 + 4b0: 83 c4 10 add $0x10,%esp + 4b3: eb 05 jmp 4ba } } else if(state == '%'){ - 4db: 83 ff 25 cmp $0x25,%edi - 4de: 74 22 je 502 + 4b5: 83 ff 25 cmp $0x25,%edi + 4b8: 74 1f je 4d9 for(i = 0; fmt[i]; i++){ - 4e0: 83 c6 01 add $0x1,%esi - 4e3: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 4e7: 84 db test %bl,%bl - 4e9: 0f 84 6e 01 00 00 je 65d + 4ba: 83 c6 01 add $0x1,%esi + 4bd: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 4c1: 84 db test %bl,%bl + 4c3: 0f 84 62 01 00 00 je 62b c = fmt[i] & 0xff; - 4ef: 0f be d3 movsbl %bl,%edx - 4f2: 0f b6 c3 movzbl %bl,%eax + 4c9: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 4f5: 85 ff test %edi,%edi - 4f7: 75 e2 jne 4db + 4cc: 85 ff test %edi,%edi + 4ce: 75 e5 jne 4b5 if(c == '%'){ - 4f9: 83 f8 25 cmp $0x25,%eax - 4fc: 75 c4 jne 4c2 + 4d0: 83 f8 25 cmp $0x25,%eax + 4d3: 75 c7 jne 49c state = '%'; - 4fe: 89 c7 mov %eax,%edi - 500: eb de jmp 4e0 + 4d5: 89 c7 mov %eax,%edi + 4d7: eb e1 jmp 4ba if(c == 'd'){ - 502: 83 f8 64 cmp $0x64,%eax - 505: 74 59 je 560 + 4d9: 83 f8 25 cmp $0x25,%eax + 4dc: 0f 84 f2 00 00 00 je 5d4 + 4e2: 8d 50 9d lea -0x63(%eax),%edx + 4e5: 83 fa 15 cmp $0x15,%edx + 4e8: 0f 87 07 01 00 00 ja 5f5 + 4ee: 0f 87 01 01 00 00 ja 5f5 + 4f4: ff 24 95 ac 07 00 00 jmp *0x7ac(,%edx,4) printint(fd, *ap, 10, 1); + 4fb: 83 ec 0c sub $0xc,%esp + 4fe: 6a 01 push $0x1 + 500: b9 0a 00 00 00 mov $0xa,%ecx + 505: 8b 7d d4 mov -0x2c(%ebp),%edi + 508: 8b 17 mov (%edi),%edx + 50a: 8b 45 08 mov 0x8(%ebp),%eax + 50d: e8 cb fe ff ff call 3dd ap++; - } else if(c == 'x' || c == 'p'){ - 507: 81 e2 f7 00 00 00 and $0xf7,%edx - 50d: 83 fa 70 cmp $0x70,%edx - 510: 74 7a je 58c - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 512: 83 f8 73 cmp $0x73,%eax - 515: 0f 84 9d 00 00 00 je 5b8 - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 51b: 83 f8 63 cmp $0x63,%eax - 51e: 0f 84 ec 00 00 00 je 610 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 524: 83 f8 25 cmp $0x25,%eax - 527: 0f 84 0f 01 00 00 je 63c - putc(fd, c); + 512: 89 f8 mov %edi,%eax + 514: 83 c0 04 add $0x4,%eax + 517: 89 45 d4 mov %eax,-0x2c(%ebp) + 51a: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 52d: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 531: 83 ec 04 sub $0x4,%esp - 534: 6a 01 push $0x1 - 536: 8d 45 e7 lea -0x19(%ebp),%eax - 539: 50 push %eax - 53a: ff 75 08 pushl 0x8(%ebp) - 53d: e8 31 fe ff ff call 373 - putc(fd, c); - 542: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 545: 83 c4 0c add $0xc,%esp - 548: 6a 01 push $0x1 - 54a: 8d 45 e7 lea -0x19(%ebp),%eax - 54d: 50 push %eax - 54e: ff 75 08 pushl 0x8(%ebp) - 551: e8 1d fe ff ff call 373 putc(fd, c); - 556: 83 c4 10 add $0x10,%esp } state = 0; - 559: bf 00 00 00 00 mov $0x0,%edi - 55e: eb 80 jmp 4e0 - printint(fd, *ap, 10, 1); - 560: 83 ec 0c sub $0xc,%esp - 563: 6a 01 push $0x1 - 565: b9 0a 00 00 00 mov $0xa,%ecx - 56a: 8b 7d d4 mov -0x2c(%ebp),%edi - 56d: 8b 17 mov (%edi),%edx - 56f: 8b 45 08 mov 0x8(%ebp),%eax - 572: e8 8c fe ff ff call 403 - ap++; - 577: 89 f8 mov %edi,%eax - 579: 83 c0 04 add $0x4,%eax - 57c: 89 45 d4 mov %eax,-0x2c(%ebp) - 57f: 83 c4 10 add $0x10,%esp - state = 0; - 582: bf 00 00 00 00 mov $0x0,%edi - 587: e9 54 ff ff ff jmp 4e0 + 51d: bf 00 00 00 00 mov $0x0,%edi + 522: eb 96 jmp 4ba printint(fd, *ap, 16, 0); - 58c: 83 ec 0c sub $0xc,%esp - 58f: 6a 00 push $0x0 - 591: b9 10 00 00 00 mov $0x10,%ecx - 596: 8b 7d d4 mov -0x2c(%ebp),%edi - 599: 8b 17 mov (%edi),%edx - 59b: 8b 45 08 mov 0x8(%ebp),%eax - 59e: e8 60 fe ff ff call 403 + 524: 83 ec 0c sub $0xc,%esp + 527: 6a 00 push $0x0 + 529: b9 10 00 00 00 mov $0x10,%ecx + 52e: 8b 7d d4 mov -0x2c(%ebp),%edi + 531: 8b 17 mov (%edi),%edx + 533: 8b 45 08 mov 0x8(%ebp),%eax + 536: e8 a2 fe ff ff call 3dd ap++; - 5a3: 89 f8 mov %edi,%eax - 5a5: 83 c0 04 add $0x4,%eax - 5a8: 89 45 d4 mov %eax,-0x2c(%ebp) - 5ab: 83 c4 10 add $0x10,%esp + 53b: 89 f8 mov %edi,%eax + 53d: 83 c0 04 add $0x4,%eax + 540: 89 45 d4 mov %eax,-0x2c(%ebp) + 543: 83 c4 10 add $0x10,%esp state = 0; - 5ae: bf 00 00 00 00 mov $0x0,%edi - 5b3: e9 28 ff ff ff jmp 4e0 + 546: bf 00 00 00 00 mov $0x0,%edi + 54b: e9 6a ff ff ff jmp 4ba s = (char*)*ap; - 5b8: 8b 4d d4 mov -0x2c(%ebp),%ecx - 5bb: 8b 01 mov (%ecx),%eax + 550: 8b 4d d4 mov -0x2c(%ebp),%ecx + 553: 8b 01 mov (%ecx),%eax ap++; - 5bd: 83 c1 04 add $0x4,%ecx - 5c0: 89 4d d4 mov %ecx,-0x2c(%ebp) + 555: 83 c1 04 add $0x4,%ecx + 558: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 5c3: 85 c0 test %eax,%eax - 5c5: 74 13 je 5da + 55b: 85 c0 test %eax,%eax + 55d: 74 13 je 572 s = (char*)*ap; - 5c7: 89 c3 mov %eax,%ebx + 55f: 89 c3 mov %eax,%ebx while(*s != 0){ - 5c9: 0f b6 00 movzbl (%eax),%eax + 561: 0f b6 00 movzbl (%eax),%eax state = 0; - 5cc: bf 00 00 00 00 mov $0x0,%edi + 564: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 5d1: 84 c0 test %al,%al - 5d3: 75 0f jne 5e4 - 5d5: e9 06 ff ff ff jmp 4e0 + 569: 84 c0 test %al,%al + 56b: 75 0f jne 57c + 56d: e9 48 ff ff ff jmp 4ba s = "(null)"; - 5da: bb e7 07 00 00 mov $0x7e7,%ebx + 572: bb a3 07 00 00 mov $0x7a3,%ebx while(*s != 0){ - 5df: b8 28 00 00 00 mov $0x28,%eax - 5e4: 8b 7d 08 mov 0x8(%ebp),%edi + 577: b8 28 00 00 00 mov $0x28,%eax + 57c: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 5e7: 88 45 e7 mov %al,-0x19(%ebp) + 57f: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 5ea: 83 ec 04 sub $0x4,%esp - 5ed: 6a 01 push $0x1 - 5ef: 8d 45 e7 lea -0x19(%ebp),%eax - 5f2: 50 push %eax - 5f3: 57 push %edi - 5f4: e8 7a fd ff ff call 373 + 582: 83 ec 04 sub $0x4,%esp + 585: 6a 01 push $0x1 + 587: 8d 45 e7 lea -0x19(%ebp),%eax + 58a: 50 push %eax + 58b: 57 push %edi + 58c: e8 bc fd ff ff call 34d s++; - 5f9: 83 c3 01 add $0x1,%ebx + 591: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 5fc: 0f b6 03 movzbl (%ebx),%eax - 5ff: 83 c4 10 add $0x10,%esp - 602: 84 c0 test %al,%al - 604: 75 e1 jne 5e7 + 594: 0f b6 03 movzbl (%ebx),%eax + 597: 83 c4 10 add $0x10,%esp + 59a: 84 c0 test %al,%al + 59c: 75 e1 jne 57f state = 0; - 606: bf 00 00 00 00 mov $0x0,%edi - 60b: e9 d0 fe ff ff jmp 4e0 + 59e: bf 00 00 00 00 mov $0x0,%edi + 5a3: e9 12 ff ff ff jmp 4ba putc(fd, *ap); - 610: 8b 7d d4 mov -0x2c(%ebp),%edi - 613: 8b 07 mov (%edi),%eax - 615: 88 45 e7 mov %al,-0x19(%ebp) + 5a8: 8b 7d d4 mov -0x2c(%ebp),%edi + 5ab: 8b 07 mov (%edi),%eax + 5ad: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 618: 83 ec 04 sub $0x4,%esp - 61b: 6a 01 push $0x1 - 61d: 8d 45 e7 lea -0x19(%ebp),%eax - 620: 50 push %eax - 621: ff 75 08 pushl 0x8(%ebp) - 624: e8 4a fd ff ff call 373 + 5b0: 83 ec 04 sub $0x4,%esp + 5b3: 6a 01 push $0x1 + 5b5: 8d 45 e7 lea -0x19(%ebp),%eax + 5b8: 50 push %eax + 5b9: ff 75 08 push 0x8(%ebp) + 5bc: e8 8c fd ff ff call 34d ap++; - 629: 83 c7 04 add $0x4,%edi - 62c: 89 7d d4 mov %edi,-0x2c(%ebp) - 62f: 83 c4 10 add $0x10,%esp + 5c1: 83 c7 04 add $0x4,%edi + 5c4: 89 7d d4 mov %edi,-0x2c(%ebp) + 5c7: 83 c4 10 add $0x10,%esp + state = 0; + 5ca: bf 00 00 00 00 mov $0x0,%edi + 5cf: e9 e6 fe ff ff jmp 4ba + putc(fd, c); + 5d4: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 5d7: 83 ec 04 sub $0x4,%esp + 5da: 6a 01 push $0x1 + 5dc: 8d 45 e7 lea -0x19(%ebp),%eax + 5df: 50 push %eax + 5e0: ff 75 08 push 0x8(%ebp) + 5e3: e8 65 fd ff ff call 34d + 5e8: 83 c4 10 add $0x10,%esp state = 0; - 632: bf 00 00 00 00 mov $0x0,%edi - 637: e9 a4 fe ff ff jmp 4e0 + 5eb: bf 00 00 00 00 mov $0x0,%edi + 5f0: e9 c5 fe ff ff jmp 4ba + putc(fd, '%'); + 5f5: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 5f9: 83 ec 04 sub $0x4,%esp + 5fc: 6a 01 push $0x1 + 5fe: 8d 45 e7 lea -0x19(%ebp),%eax + 601: 50 push %eax + 602: ff 75 08 push 0x8(%ebp) + 605: e8 43 fd ff ff call 34d putc(fd, c); - 63c: 88 5d e7 mov %bl,-0x19(%ebp) + 60a: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 63f: 83 ec 04 sub $0x4,%esp - 642: 6a 01 push $0x1 - 644: 8d 45 e7 lea -0x19(%ebp),%eax - 647: 50 push %eax - 648: ff 75 08 pushl 0x8(%ebp) - 64b: e8 23 fd ff ff call 373 - 650: 83 c4 10 add $0x10,%esp + 60d: 83 c4 0c add $0xc,%esp + 610: 6a 01 push $0x1 + 612: 8d 45 e7 lea -0x19(%ebp),%eax + 615: 50 push %eax + 616: ff 75 08 push 0x8(%ebp) + 619: e8 2f fd ff ff call 34d + putc(fd, c); + 61e: 83 c4 10 add $0x10,%esp state = 0; - 653: bf 00 00 00 00 mov $0x0,%edi - 658: e9 83 fe ff ff jmp 4e0 + 621: bf 00 00 00 00 mov $0x0,%edi + 626: e9 8f fe ff ff jmp 4ba } } } - 65d: 8d 65 f4 lea -0xc(%ebp),%esp - 660: 5b pop %ebx - 661: 5e pop %esi - 662: 5f pop %edi - 663: 5d pop %ebp - 664: c3 ret - -00000665 : + 62b: 8d 65 f4 lea -0xc(%ebp),%esp + 62e: 5b pop %ebx + 62f: 5e pop %esi + 630: 5f pop %edi + 631: 5d pop %ebp + 632: c3 ret + +00000633 : static Header base; static Header *freep; void free(void *ap) { - 665: f3 0f 1e fb endbr32 - 669: 55 push %ebp - 66a: 89 e5 mov %esp,%ebp - 66c: 57 push %edi - 66d: 56 push %esi - 66e: 53 push %ebx - 66f: 8b 5d 08 mov 0x8(%ebp),%ebx + 633: 55 push %ebp + 634: 89 e5 mov %esp,%ebp + 636: 57 push %edi + 637: 56 push %esi + 638: 53 push %ebx + 639: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 672: 8d 4b f8 lea -0x8(%ebx),%ecx + 63c: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 675: a1 a0 0a 00 00 mov 0xaa0,%eax - 67a: eb 0c jmp 688 + 63f: a1 c0 0c 00 00 mov 0xcc0,%eax + 644: eb 0c jmp 652 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 67c: 8b 10 mov (%eax),%edx - 67e: 39 c2 cmp %eax,%edx - 680: 77 04 ja 686 - 682: 39 ca cmp %ecx,%edx - 684: 77 10 ja 696 + 646: 8b 10 mov (%eax),%edx + 648: 39 c2 cmp %eax,%edx + 64a: 77 04 ja 650 + 64c: 39 ca cmp %ecx,%edx + 64e: 77 10 ja 660 { - 686: 89 d0 mov %edx,%eax + 650: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 688: 39 c8 cmp %ecx,%eax - 68a: 73 f0 jae 67c - 68c: 8b 10 mov (%eax),%edx - 68e: 39 ca cmp %ecx,%edx - 690: 77 04 ja 696 + 652: 39 c8 cmp %ecx,%eax + 654: 73 f0 jae 646 + 656: 8b 10 mov (%eax),%edx + 658: 39 ca cmp %ecx,%edx + 65a: 77 04 ja 660 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 692: 39 c2 cmp %eax,%edx - 694: 77 f0 ja 686 + 65c: 39 c2 cmp %eax,%edx + 65e: 77 f0 ja 650 break; if(bp + bp->s.size == p->s.ptr){ - 696: 8b 73 fc mov -0x4(%ebx),%esi - 699: 8b 10 mov (%eax),%edx - 69b: 8d 3c f1 lea (%ecx,%esi,8),%edi - 69e: 39 fa cmp %edi,%edx - 6a0: 74 19 je 6bb + 660: 8b 73 fc mov -0x4(%ebx),%esi + 663: 8b 10 mov (%eax),%edx + 665: 8d 3c f1 lea (%ecx,%esi,8),%edi + 668: 39 fa cmp %edi,%edx + 66a: 74 19 je 685 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 66c: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 6a2: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 6a5: 8b 50 04 mov 0x4(%eax),%edx - 6a8: 8d 34 d0 lea (%eax,%edx,8),%esi - 6ab: 39 f1 cmp %esi,%ecx - 6ad: 74 1b je 6ca + 66f: 8b 50 04 mov 0x4(%eax),%edx + 672: 8d 34 d0 lea (%eax,%edx,8),%esi + 675: 39 f1 cmp %esi,%ecx + 677: 74 18 je 691 p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 679: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 6af: 89 08 mov %ecx,(%eax) freep = p; - 6b1: a3 a0 0a 00 00 mov %eax,0xaa0 + 67b: a3 c0 0c 00 00 mov %eax,0xcc0 } - 6b6: 5b pop %ebx - 6b7: 5e pop %esi - 6b8: 5f pop %edi - 6b9: 5d pop %ebp - 6ba: c3 ret + 680: 5b pop %ebx + 681: 5e pop %esi + 682: 5f pop %edi + 683: 5d pop %ebp + 684: c3 ret bp->s.size += p->s.ptr->s.size; - 6bb: 03 72 04 add 0x4(%edx),%esi - 6be: 89 73 fc mov %esi,-0x4(%ebx) + 685: 03 72 04 add 0x4(%edx),%esi + 688: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 6c1: 8b 10 mov (%eax),%edx - 6c3: 8b 12 mov (%edx),%edx - 6c5: 89 53 f8 mov %edx,-0x8(%ebx) - 6c8: eb db jmp 6a5 + 68b: 8b 10 mov (%eax),%edx + 68d: 8b 12 mov (%edx),%edx + 68f: eb db jmp 66c p->s.size += bp->s.size; - 6ca: 03 53 fc add -0x4(%ebx),%edx - 6cd: 89 50 04 mov %edx,0x4(%eax) + 691: 03 53 fc add -0x4(%ebx),%edx + 694: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 6d0: 8b 53 f8 mov -0x8(%ebx),%edx - 6d3: 89 10 mov %edx,(%eax) - 6d5: eb da jmp 6b1 + 697: 8b 4b f8 mov -0x8(%ebx),%ecx + 69a: eb dd jmp 679 -000006d7 : +0000069c : return freep; } void* malloc(uint nbytes) { - 6d7: f3 0f 1e fb endbr32 - 6db: 55 push %ebp - 6dc: 89 e5 mov %esp,%ebp - 6de: 57 push %edi - 6df: 56 push %esi - 6e0: 53 push %ebx - 6e1: 83 ec 0c sub $0xc,%esp + 69c: 55 push %ebp + 69d: 89 e5 mov %esp,%ebp + 69f: 57 push %edi + 6a0: 56 push %esi + 6a1: 53 push %ebx + 6a2: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 6e4: 8b 45 08 mov 0x8(%ebp),%eax - 6e7: 8d 58 07 lea 0x7(%eax),%ebx - 6ea: c1 eb 03 shr $0x3,%ebx - 6ed: 83 c3 01 add $0x1,%ebx + 6a5: 8b 45 08 mov 0x8(%ebp),%eax + 6a8: 8d 58 07 lea 0x7(%eax),%ebx + 6ab: c1 eb 03 shr $0x3,%ebx + 6ae: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 6f0: 8b 15 a0 0a 00 00 mov 0xaa0,%edx - 6f6: 85 d2 test %edx,%edx - 6f8: 74 20 je 71a + 6b1: 8b 15 c0 0c 00 00 mov 0xcc0,%edx + 6b7: 85 d2 test %edx,%edx + 6b9: 74 1c je 6d7 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 6fa: 8b 02 mov (%edx),%eax + 6bb: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 6fc: 8b 48 04 mov 0x4(%eax),%ecx - 6ff: 39 cb cmp %ecx,%ebx - 701: 76 3c jbe 73f - 703: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 709: be 00 10 00 00 mov $0x1000,%esi - 70e: 0f 43 f3 cmovae %ebx,%esi + 6bd: 8b 48 04 mov 0x4(%eax),%ecx + 6c0: 39 cb cmp %ecx,%ebx + 6c2: 76 38 jbe 6fc + 6c4: be 00 10 00 00 mov $0x1000,%esi + 6c9: 39 f3 cmp %esi,%ebx + 6cb: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 711: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 718: eb 72 jmp 78c + 6ce: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 6d5: eb 72 jmp 749 base.s.ptr = freep = prevp = &base; - 71a: c7 05 a0 0a 00 00 a4 movl $0xaa4,0xaa0 - 721: 0a 00 00 - 724: c7 05 a4 0a 00 00 a4 movl $0xaa4,0xaa4 - 72b: 0a 00 00 + 6d7: c7 05 c0 0c 00 00 c4 movl $0xcc4,0xcc0 + 6de: 0c 00 00 + 6e1: c7 05 c4 0c 00 00 c4 movl $0xcc4,0xcc4 + 6e8: 0c 00 00 base.s.size = 0; - 72e: c7 05 a8 0a 00 00 00 movl $0x0,0xaa8 - 735: 00 00 00 + 6eb: c7 05 c8 0c 00 00 00 movl $0x0,0xcc8 + 6f2: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 738: b8 a4 0a 00 00 mov $0xaa4,%eax - 73d: eb c4 jmp 703 + 6f5: b8 c4 0c 00 00 mov $0xcc4,%eax + 6fa: eb c8 jmp 6c4 if(p->s.size == nunits) - 73f: 39 cb cmp %ecx,%ebx - 741: 74 1e je 761 + 6fc: 39 cb cmp %ecx,%ebx + 6fe: 74 1e je 71e prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 743: 29 d9 sub %ebx,%ecx - 745: 89 48 04 mov %ecx,0x4(%eax) + 700: 29 d9 sub %ebx,%ecx + 702: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 748: 8d 04 c8 lea (%eax,%ecx,8),%eax + 705: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 74b: 89 58 04 mov %ebx,0x4(%eax) + 708: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 74e: 89 15 a0 0a 00 00 mov %edx,0xaa0 + 70b: 89 15 c0 0c 00 00 mov %edx,0xcc0 return (void*)(p + 1); - 754: 8d 50 08 lea 0x8(%eax),%edx + 711: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 757: 89 d0 mov %edx,%eax - 759: 8d 65 f4 lea -0xc(%ebp),%esp - 75c: 5b pop %ebx - 75d: 5e pop %esi - 75e: 5f pop %edi - 75f: 5d pop %ebp - 760: c3 ret + 714: 89 d0 mov %edx,%eax + 716: 8d 65 f4 lea -0xc(%ebp),%esp + 719: 5b pop %ebx + 71a: 5e pop %esi + 71b: 5f pop %edi + 71c: 5d pop %ebp + 71d: c3 ret prevp->s.ptr = p->s.ptr; - 761: 8b 08 mov (%eax),%ecx - 763: 89 0a mov %ecx,(%edx) - 765: eb e7 jmp 74e + 71e: 8b 08 mov (%eax),%ecx + 720: 89 0a mov %ecx,(%edx) + 722: eb e7 jmp 70b hp->s.size = nu; - 767: 89 70 04 mov %esi,0x4(%eax) + 724: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 76a: 83 ec 0c sub $0xc,%esp - 76d: 83 c0 08 add $0x8,%eax - 770: 50 push %eax - 771: e8 ef fe ff ff call 665 + 727: 83 ec 0c sub $0xc,%esp + 72a: 83 c0 08 add $0x8,%eax + 72d: 50 push %eax + 72e: e8 00 ff ff ff call 633 return freep; - 776: 8b 15 a0 0a 00 00 mov 0xaa0,%edx + 733: 8b 15 c0 0c 00 00 mov 0xcc0,%edx if((p = morecore(nunits)) == 0) - 77c: 83 c4 10 add $0x10,%esp - 77f: 85 d2 test %edx,%edx - 781: 74 d4 je 757 + 739: 83 c4 10 add $0x10,%esp + 73c: 85 d2 test %edx,%edx + 73e: 74 d4 je 714 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 783: 8b 02 mov (%edx),%eax + 740: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 785: 8b 48 04 mov 0x4(%eax),%ecx - 788: 39 d9 cmp %ebx,%ecx - 78a: 73 b3 jae 73f + 742: 8b 48 04 mov 0x4(%eax),%ecx + 745: 39 d9 cmp %ebx,%ecx + 747: 73 b3 jae 6fc if(p == freep) - 78c: 89 c2 mov %eax,%edx - 78e: 39 05 a0 0a 00 00 cmp %eax,0xaa0 - 794: 75 ed jne 783 + 749: 89 c2 mov %eax,%edx + 74b: 39 05 c0 0c 00 00 cmp %eax,0xcc0 + 751: 75 ed jne 740 p = sbrk(nu * sizeof(Header)); - 796: 83 ec 0c sub $0xc,%esp - 799: 57 push %edi - 79a: e8 3c fc ff ff call 3db + 753: 83 ec 0c sub $0xc,%esp + 756: 57 push %edi + 757: e8 59 fc ff ff call 3b5 if(p == (char*)-1) - 79f: 83 c4 10 add $0x10,%esp - 7a2: 83 f8 ff cmp $0xffffffff,%eax - 7a5: 75 c0 jne 767 + 75c: 83 c4 10 add $0x10,%esp + 75f: 83 f8 ff cmp $0xffffffff,%eax + 762: 75 c0 jne 724 return 0; - 7a7: ba 00 00 00 00 mov $0x0,%edx - 7ac: eb a9 jmp 757 + 764: ba 00 00 00 00 mov $0x0,%edx + 769: eb a9 jmp 714 diff --git a/src/user/wc.d b/src/user/wc.d new file mode 100644 index 0000000..444b2d8 --- /dev/null +++ b/src/user/wc.d @@ -0,0 +1 @@ +user/wc.o: user/wc.c /usr/include/stdc-predef.h types.h stat.h user.h diff --git a/src/user/wc.o b/src/user/wc.o new file mode 100644 index 0000000..9902693 Binary files /dev/null and b/src/user/wc.o differ diff --git a/src/user/wc.sym b/src/user/wc.sym index 5b1ce88..96b538c 100644 --- a/src/user/wc.sym +++ b/src/user/wc.sym @@ -1,61 +1,49 @@ -00000000 .text -000007b0 .rodata -00000804 .eh_frame -00000aa0 .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 -00000403 printint -000007f0 digits.1089 +000003dd printint +00000804 digits.0 00000000 umalloc.c -00000aa0 freep -00000aa4 base -0000016d strcpy -00000497 printf -0000031a memmove -0000039b mknod -000003fb ps -00000238 gets -000003d3 getpid -000006d7 malloc -000003e3 sleep -00000363 pipe -000003f3 slabtest -00000373 write -000003ab fstat -00000383 kill -000003c3 chdir -0000038b exec -0000035b wait -0000036b read -000003a3 unlink +00000cc0 freep +00000cc4 base +00000165 strcpy +00000475 printf +000002f8 memmove +00000375 mknod +000003d5 ps +00000220 gets +000003ad getpid +0000069c malloc +000003bd sleep +0000033d pipe +000003cd slabtest +0000034d write +00000385 fstat +0000035d kill +0000039d chdir +00000365 exec +00000335 wait +00000345 read +0000037d unlink 00000000 wc -0000034b fork -000003db sbrk -000003eb uptime -00000a94 __bss_start -000001ec memset -000000d5 main -00000193 strcmp -000003cb dup +00000325 fork +000003b5 sbrk +000003c5 uptime +00000aa8 __bss_start +000001da memset +000000d1 main +00000189 strcmp +000003a5 dup 00000ac0 buf -00000293 stat -00000a94 _edata -00000cc0 _end -000003b3 link -00000353 exit -000002db atoi -000001c2 strlen -00000393 open -00000207 strchr -000003bb mkdir -0000037b close -00000665 free +00000277 stat +00000aa8 _edata +00000ccc _end +0000038d link +0000032d exit +000002bb atoi +000001b4 strlen +0000036d open +000001f3 strchr +00000395 mkdir +00000355 close +00000633 free diff --git a/src/user/zombie.asm b/src/user/zombie.asm index 7d1f369..0a48613 100644 --- a/src/user/zombie.asm +++ b/src/user/zombie.asm @@ -11,1041 +11,1010 @@ Disassembly of section .text: int main(void) { - 0: f3 0f 1e fb endbr32 - 4: 8d 4c 24 04 lea 0x4(%esp),%ecx - 8: 83 e4 f0 and $0xfffffff0,%esp - b: ff 71 fc pushl -0x4(%ecx) - e: 55 push %ebp - f: 89 e5 mov %esp,%ebp - 11: 51 push %ecx - 12: 83 ec 04 sub $0x4,%esp + 0: 8d 4c 24 04 lea 0x4(%esp),%ecx + 4: 83 e4 f0 and $0xfffffff0,%esp + 7: ff 71 fc push -0x4(%ecx) + a: 55 push %ebp + b: 89 e5 mov %esp,%ebp + d: 51 push %ecx + e: 83 ec 04 sub $0x4,%esp if(fork() > 0) - 15: e8 f6 01 00 00 call 210 - 1a: 85 c0 test %eax,%eax - 1c: 7f 05 jg 23 + 11: e8 d8 01 00 00 call 1ee + 16: 85 c0 test %eax,%eax + 18: 7f 05 jg 1f sleep(5); // Let child exit before parent. exit(); - 1e: e8 f5 01 00 00 call 218 + 1a: e8 d7 01 00 00 call 1f6 sleep(5); // Let child exit before parent. - 23: 83 ec 0c sub $0xc,%esp - 26: 6a 05 push $0x5 - 28: e8 7b 02 00 00 call 2a8 - 2d: 83 c4 10 add $0x10,%esp - 30: eb ec jmp 1e + 1f: 83 ec 0c sub $0xc,%esp + 22: 6a 05 push $0x5 + 24: e8 5d 02 00 00 call 286 + 29: 83 c4 10 add $0x10,%esp + 2c: eb ec jmp 1a -00000032 : +0000002e : #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { - 32: f3 0f 1e fb endbr32 - 36: 55 push %ebp - 37: 89 e5 mov %esp,%ebp - 39: 53 push %ebx - 3a: 8b 4d 08 mov 0x8(%ebp),%ecx - 3d: 8b 5d 0c mov 0xc(%ebp),%ebx + 2e: 55 push %ebp + 2f: 89 e5 mov %esp,%ebp + 31: 53 push %ebx + 32: 8b 4d 08 mov 0x8(%ebp),%ecx + 35: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) - 40: b8 00 00 00 00 mov $0x0,%eax - 45: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx - 49: 88 14 01 mov %dl,(%ecx,%eax,1) - 4c: 83 c0 01 add $0x1,%eax - 4f: 84 d2 test %dl,%dl - 51: 75 f2 jne 45 + 38: b8 00 00 00 00 mov $0x0,%eax + 3d: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx + 41: 88 14 01 mov %dl,(%ecx,%eax,1) + 44: 83 c0 01 add $0x1,%eax + 47: 84 d2 test %dl,%dl + 49: 75 f2 jne 3d ; return os; } - 53: 89 c8 mov %ecx,%eax - 55: 5b pop %ebx - 56: 5d pop %ebp - 57: c3 ret + 4b: 89 c8 mov %ecx,%eax + 4d: 8b 5d fc mov -0x4(%ebp),%ebx + 50: c9 leave + 51: c3 ret -00000058 : +00000052 : int strcmp(const char *p, const char *q) { - 58: f3 0f 1e fb endbr32 - 5c: 55 push %ebp - 5d: 89 e5 mov %esp,%ebp - 5f: 8b 4d 08 mov 0x8(%ebp),%ecx - 62: 8b 55 0c mov 0xc(%ebp),%edx + 52: 55 push %ebp + 53: 89 e5 mov %esp,%ebp + 55: 8b 4d 08 mov 0x8(%ebp),%ecx + 58: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) - 65: 0f b6 01 movzbl (%ecx),%eax - 68: 84 c0 test %al,%al - 6a: 74 11 je 7d - 6c: 38 02 cmp %al,(%edx) - 6e: 75 0d jne 7d + 5b: 0f b6 01 movzbl (%ecx),%eax + 5e: 84 c0 test %al,%al + 60: 74 11 je 73 + 62: 38 02 cmp %al,(%edx) + 64: 75 0d jne 73 p++, q++; - 70: 83 c1 01 add $0x1,%ecx - 73: 83 c2 01 add $0x1,%edx + 66: 83 c1 01 add $0x1,%ecx + 69: 83 c2 01 add $0x1,%edx while(*p && *p == *q) - 76: 0f b6 01 movzbl (%ecx),%eax - 79: 84 c0 test %al,%al - 7b: 75 ef jne 6c + 6c: 0f b6 01 movzbl (%ecx),%eax + 6f: 84 c0 test %al,%al + 71: 75 ef jne 62 return (uchar)*p - (uchar)*q; - 7d: 0f b6 c0 movzbl %al,%eax - 80: 0f b6 12 movzbl (%edx),%edx - 83: 29 d0 sub %edx,%eax + 73: 0f b6 c0 movzbl %al,%eax + 76: 0f b6 12 movzbl (%edx),%edx + 79: 29 d0 sub %edx,%eax } - 85: 5d pop %ebp - 86: c3 ret + 7b: 5d pop %ebp + 7c: c3 ret -00000087 : +0000007d : uint strlen(const char *s) { - 87: f3 0f 1e fb endbr32 - 8b: 55 push %ebp - 8c: 89 e5 mov %esp,%ebp - 8e: 8b 55 08 mov 0x8(%ebp),%edx + 7d: 55 push %ebp + 7e: 89 e5 mov %esp,%ebp + 80: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) - 91: 80 3a 00 cmpb $0x0,(%edx) - 94: 74 14 je aa - 96: b8 00 00 00 00 mov $0x0,%eax - 9b: 83 c0 01 add $0x1,%eax - 9e: 89 c1 mov %eax,%ecx - a0: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) - a4: 75 f5 jne 9b + 83: 80 3a 00 cmpb $0x0,(%edx) + 86: 74 14 je 9c + 88: b8 00 00 00 00 mov $0x0,%eax + 8d: 83 c0 01 add $0x1,%eax + 90: 89 c1 mov %eax,%ecx + 92: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) + 96: 75 f5 jne 8d ; return n; } - a6: 89 c8 mov %ecx,%eax - a8: 5d pop %ebp - a9: c3 ret + 98: 89 c8 mov %ecx,%eax + 9a: 5d pop %ebp + 9b: c3 ret for(n = 0; s[n]; n++) - aa: b9 00 00 00 00 mov $0x0,%ecx + 9c: b9 00 00 00 00 mov $0x0,%ecx return n; - af: eb f5 jmp a6 + a1: eb f5 jmp 98 -000000b1 : +000000a3 : void* memset(void *dst, int c, uint n) { - b1: f3 0f 1e fb endbr32 - b5: 55 push %ebp - b6: 89 e5 mov %esp,%ebp - b8: 57 push %edi - b9: 8b 55 08 mov 0x8(%ebp),%edx + a3: 55 push %ebp + a4: 89 e5 mov %esp,%ebp + a6: 57 push %edi + a7: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : - bc: 89 d7 mov %edx,%edi - be: 8b 4d 10 mov 0x10(%ebp),%ecx - c1: 8b 45 0c mov 0xc(%ebp),%eax - c4: fc cld - c5: f3 aa rep stos %al,%es:(%edi) + aa: 89 d7 mov %edx,%edi + ac: 8b 4d 10 mov 0x10(%ebp),%ecx + af: 8b 45 0c mov 0xc(%ebp),%eax + b2: fc cld + b3: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } - c7: 89 d0 mov %edx,%eax - c9: 5f pop %edi - ca: 5d pop %ebp - cb: c3 ret + b5: 89 d0 mov %edx,%eax + b7: 8b 7d fc mov -0x4(%ebp),%edi + ba: c9 leave + bb: c3 ret -000000cc : +000000bc : char* strchr(const char *s, char c) { - cc: f3 0f 1e fb endbr32 - d0: 55 push %ebp - d1: 89 e5 mov %esp,%ebp - d3: 8b 45 08 mov 0x8(%ebp),%eax - d6: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx + bc: 55 push %ebp + bd: 89 e5 mov %esp,%ebp + bf: 8b 45 08 mov 0x8(%ebp),%eax + c2: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) - da: 0f b6 10 movzbl (%eax),%edx - dd: 84 d2 test %dl,%dl - df: 74 15 je f6 + c6: 0f b6 10 movzbl (%eax),%edx + c9: 84 d2 test %dl,%dl + cb: 74 15 je e2 if(*s == c) - e1: 38 d1 cmp %dl,%cl - e3: 74 0f je f4 + cd: 38 d1 cmp %dl,%cl + cf: 74 0f je e0 for(; *s; s++) - e5: 83 c0 01 add $0x1,%eax - e8: 0f b6 10 movzbl (%eax),%edx - eb: 84 d2 test %dl,%dl - ed: 75 f2 jne e1 + d1: 83 c0 01 add $0x1,%eax + d4: 0f b6 10 movzbl (%eax),%edx + d7: 84 d2 test %dl,%dl + d9: 75 f2 jne cd return (char*)s; return 0; - ef: b8 00 00 00 00 mov $0x0,%eax + db: b8 00 00 00 00 mov $0x0,%eax } - f4: 5d pop %ebp - f5: c3 ret + e0: 5d pop %ebp + e1: c3 ret return 0; - f6: b8 00 00 00 00 mov $0x0,%eax - fb: eb f7 jmp f4 + e2: b8 00 00 00 00 mov $0x0,%eax + e7: eb f7 jmp e0 -000000fd : +000000e9 : char* gets(char *buf, int max) { - fd: f3 0f 1e fb endbr32 - 101: 55 push %ebp - 102: 89 e5 mov %esp,%ebp - 104: 57 push %edi - 105: 56 push %esi - 106: 53 push %ebx - 107: 83 ec 2c sub $0x2c,%esp - 10a: 8b 75 08 mov 0x8(%ebp),%esi + e9: 55 push %ebp + ea: 89 e5 mov %esp,%ebp + ec: 57 push %edi + ed: 56 push %esi + ee: 53 push %ebx + ef: 83 ec 2c sub $0x2c,%esp + f2: 8b 75 08 mov 0x8(%ebp),%esi int i, cc; char c; for(i=0; i+1 < max; ){ - 10d: bb 00 00 00 00 mov $0x0,%ebx + f5: bb 00 00 00 00 mov $0x0,%ebx cc = read(0, &c, 1); - 112: 8d 7d e7 lea -0x19(%ebp),%edi + fa: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ - 115: 89 5d d4 mov %ebx,-0x2c(%ebp) - 118: 83 c3 01 add $0x1,%ebx - 11b: 3b 5d 0c cmp 0xc(%ebp),%ebx - 11e: 7d 27 jge 147 + fd: 89 5d d4 mov %ebx,-0x2c(%ebp) + 100: 83 c3 01 add $0x1,%ebx + 103: 3b 5d 0c cmp 0xc(%ebp),%ebx + 106: 7d 27 jge 12f cc = read(0, &c, 1); - 120: 83 ec 04 sub $0x4,%esp - 123: 6a 01 push $0x1 - 125: 57 push %edi - 126: 6a 00 push $0x0 - 128: e8 03 01 00 00 call 230 + 108: 83 ec 04 sub $0x4,%esp + 10b: 6a 01 push $0x1 + 10d: 57 push %edi + 10e: 6a 00 push $0x0 + 110: e8 f9 00 00 00 call 20e if(cc < 1) - 12d: 83 c4 10 add $0x10,%esp - 130: 85 c0 test %eax,%eax - 132: 7e 13 jle 147 + 115: 83 c4 10 add $0x10,%esp + 118: 85 c0 test %eax,%eax + 11a: 7e 13 jle 12f break; buf[i++] = c; - 134: 0f b6 45 e7 movzbl -0x19(%ebp),%eax - 138: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) + 11c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax + 120: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1) if(c == '\n' || c == '\r') - 13c: 3c 0a cmp $0xa,%al - 13e: 74 04 je 144 - 140: 3c 0d cmp $0xd,%al - 142: 75 d1 jne 115 + 124: 3c 0a cmp $0xa,%al + 126: 74 04 je 12c + 128: 3c 0d cmp $0xd,%al + 12a: 75 d1 jne fd for(i=0; i+1 < max; ){ - 144: 89 5d d4 mov %ebx,-0x2c(%ebp) + 12c: 89 5d d4 mov %ebx,-0x2c(%ebp) break; } buf[i] = '\0'; - 147: 8b 45 d4 mov -0x2c(%ebp),%eax - 14a: c6 04 06 00 movb $0x0,(%esi,%eax,1) + 12f: 8b 45 d4 mov -0x2c(%ebp),%eax + 132: c6 04 06 00 movb $0x0,(%esi,%eax,1) return buf; } - 14e: 89 f0 mov %esi,%eax - 150: 8d 65 f4 lea -0xc(%ebp),%esp - 153: 5b pop %ebx - 154: 5e pop %esi - 155: 5f pop %edi - 156: 5d pop %ebp - 157: c3 ret + 136: 89 f0 mov %esi,%eax + 138: 8d 65 f4 lea -0xc(%ebp),%esp + 13b: 5b pop %ebx + 13c: 5e pop %esi + 13d: 5f pop %edi + 13e: 5d pop %ebp + 13f: c3 ret -00000158 : +00000140 : int stat(const char *n, struct stat *st) { - 158: f3 0f 1e fb endbr32 - 15c: 55 push %ebp - 15d: 89 e5 mov %esp,%ebp - 15f: 56 push %esi - 160: 53 push %ebx + 140: 55 push %ebp + 141: 89 e5 mov %esp,%ebp + 143: 56 push %esi + 144: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); - 161: 83 ec 08 sub $0x8,%esp - 164: 6a 00 push $0x0 - 166: ff 75 08 pushl 0x8(%ebp) - 169: e8 ea 00 00 00 call 258 + 145: 83 ec 08 sub $0x8,%esp + 148: 6a 00 push $0x0 + 14a: ff 75 08 push 0x8(%ebp) + 14d: e8 e4 00 00 00 call 236 if(fd < 0) - 16e: 83 c4 10 add $0x10,%esp - 171: 85 c0 test %eax,%eax - 173: 78 24 js 199 - 175: 89 c3 mov %eax,%ebx + 152: 83 c4 10 add $0x10,%esp + 155: 85 c0 test %eax,%eax + 157: 78 24 js 17d + 159: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); - 177: 83 ec 08 sub $0x8,%esp - 17a: ff 75 0c pushl 0xc(%ebp) - 17d: 50 push %eax - 17e: e8 ed 00 00 00 call 270 - 183: 89 c6 mov %eax,%esi + 15b: 83 ec 08 sub $0x8,%esp + 15e: ff 75 0c push 0xc(%ebp) + 161: 50 push %eax + 162: e8 e7 00 00 00 call 24e + 167: 89 c6 mov %eax,%esi close(fd); - 185: 89 1c 24 mov %ebx,(%esp) - 188: e8 b3 00 00 00 call 240 + 169: 89 1c 24 mov %ebx,(%esp) + 16c: e8 ad 00 00 00 call 21e return r; - 18d: 83 c4 10 add $0x10,%esp + 171: 83 c4 10 add $0x10,%esp } - 190: 89 f0 mov %esi,%eax - 192: 8d 65 f8 lea -0x8(%ebp),%esp - 195: 5b pop %ebx - 196: 5e pop %esi - 197: 5d pop %ebp - 198: c3 ret + 174: 89 f0 mov %esi,%eax + 176: 8d 65 f8 lea -0x8(%ebp),%esp + 179: 5b pop %ebx + 17a: 5e pop %esi + 17b: 5d pop %ebp + 17c: c3 ret return -1; - 199: be ff ff ff ff mov $0xffffffff,%esi - 19e: eb f0 jmp 190 + 17d: be ff ff ff ff mov $0xffffffff,%esi + 182: eb f0 jmp 174 -000001a0 : +00000184 : int atoi(const char *s) { - 1a0: f3 0f 1e fb endbr32 - 1a4: 55 push %ebp - 1a5: 89 e5 mov %esp,%ebp - 1a7: 53 push %ebx - 1a8: 8b 55 08 mov 0x8(%ebp),%edx + 184: 55 push %ebp + 185: 89 e5 mov %esp,%ebp + 187: 53 push %ebx + 188: 8b 55 08 mov 0x8(%ebp),%edx int n; n = 0; while('0' <= *s && *s <= '9') - 1ab: 0f b6 02 movzbl (%edx),%eax - 1ae: 8d 48 d0 lea -0x30(%eax),%ecx - 1b1: 80 f9 09 cmp $0x9,%cl - 1b4: 77 22 ja 1d8 + 18b: 0f b6 02 movzbl (%edx),%eax + 18e: 8d 48 d0 lea -0x30(%eax),%ecx + 191: 80 f9 09 cmp $0x9,%cl + 194: 77 24 ja 1ba n = 0; - 1b6: b9 00 00 00 00 mov $0x0,%ecx + 196: b9 00 00 00 00 mov $0x0,%ecx n = n*10 + *s++ - '0'; - 1bb: 83 c2 01 add $0x1,%edx - 1be: 8d 0c 89 lea (%ecx,%ecx,4),%ecx - 1c1: 0f be c0 movsbl %al,%eax - 1c4: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx + 19b: 83 c2 01 add $0x1,%edx + 19e: 8d 0c 89 lea (%ecx,%ecx,4),%ecx + 1a1: 0f be c0 movsbl %al,%eax + 1a4: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx while('0' <= *s && *s <= '9') - 1c8: 0f b6 02 movzbl (%edx),%eax - 1cb: 8d 58 d0 lea -0x30(%eax),%ebx - 1ce: 80 fb 09 cmp $0x9,%bl - 1d1: 76 e8 jbe 1bb + 1a8: 0f b6 02 movzbl (%edx),%eax + 1ab: 8d 58 d0 lea -0x30(%eax),%ebx + 1ae: 80 fb 09 cmp $0x9,%bl + 1b1: 76 e8 jbe 19b return n; } - 1d3: 89 c8 mov %ecx,%eax - 1d5: 5b pop %ebx - 1d6: 5d pop %ebp - 1d7: c3 ret + 1b3: 89 c8 mov %ecx,%eax + 1b5: 8b 5d fc mov -0x4(%ebp),%ebx + 1b8: c9 leave + 1b9: c3 ret n = 0; - 1d8: b9 00 00 00 00 mov $0x0,%ecx + 1ba: b9 00 00 00 00 mov $0x0,%ecx return n; - 1dd: eb f4 jmp 1d3 + 1bf: eb f2 jmp 1b3 -000001df : +000001c1 : void* memmove(void *vdst, const void *vsrc, int n) { - 1df: f3 0f 1e fb endbr32 - 1e3: 55 push %ebp - 1e4: 89 e5 mov %esp,%ebp - 1e6: 56 push %esi - 1e7: 53 push %ebx - 1e8: 8b 75 08 mov 0x8(%ebp),%esi - 1eb: 8b 55 0c mov 0xc(%ebp),%edx - 1ee: 8b 5d 10 mov 0x10(%ebp),%ebx + 1c1: 55 push %ebp + 1c2: 89 e5 mov %esp,%ebp + 1c4: 56 push %esi + 1c5: 53 push %ebx + 1c6: 8b 75 08 mov 0x8(%ebp),%esi + 1c9: 8b 55 0c mov 0xc(%ebp),%edx + 1cc: 8b 5d 10 mov 0x10(%ebp),%ebx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) - 1f1: 85 db test %ebx,%ebx - 1f3: 7e 15 jle 20a - 1f5: 01 f3 add %esi,%ebx + 1cf: 85 db test %ebx,%ebx + 1d1: 7e 15 jle 1e8 + 1d3: 01 f3 add %esi,%ebx dst = vdst; - 1f7: 89 f0 mov %esi,%eax + 1d5: 89 f0 mov %esi,%eax *dst++ = *src++; - 1f9: 83 c2 01 add $0x1,%edx - 1fc: 83 c0 01 add $0x1,%eax - 1ff: 0f b6 4a ff movzbl -0x1(%edx),%ecx - 203: 88 48 ff mov %cl,-0x1(%eax) + 1d7: 83 c2 01 add $0x1,%edx + 1da: 83 c0 01 add $0x1,%eax + 1dd: 0f b6 4a ff movzbl -0x1(%edx),%ecx + 1e1: 88 48 ff mov %cl,-0x1(%eax) while(n-- > 0) - 206: 39 c3 cmp %eax,%ebx - 208: 75 ef jne 1f9 + 1e4: 39 c3 cmp %eax,%ebx + 1e6: 75 ef jne 1d7 return vdst; } - 20a: 89 f0 mov %esi,%eax - 20c: 5b pop %ebx - 20d: 5e pop %esi - 20e: 5d pop %ebp - 20f: c3 ret + 1e8: 89 f0 mov %esi,%eax + 1ea: 5b pop %ebx + 1eb: 5e pop %esi + 1ec: 5d pop %ebp + 1ed: c3 ret -00000210 : +000001ee : name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) - 210: b8 01 00 00 00 mov $0x1,%eax - 215: cd 40 int $0x40 - 217: c3 ret + 1ee: b8 01 00 00 00 mov $0x1,%eax + 1f3: cd 40 int $0x40 + 1f5: c3 ret -00000218 : +000001f6 : SYSCALL(exit) - 218: b8 02 00 00 00 mov $0x2,%eax - 21d: cd 40 int $0x40 - 21f: c3 ret + 1f6: b8 02 00 00 00 mov $0x2,%eax + 1fb: cd 40 int $0x40 + 1fd: c3 ret -00000220 : +000001fe : SYSCALL(wait) - 220: b8 03 00 00 00 mov $0x3,%eax - 225: cd 40 int $0x40 - 227: c3 ret + 1fe: b8 03 00 00 00 mov $0x3,%eax + 203: cd 40 int $0x40 + 205: c3 ret -00000228 : +00000206 : SYSCALL(pipe) - 228: b8 04 00 00 00 mov $0x4,%eax - 22d: cd 40 int $0x40 - 22f: c3 ret + 206: b8 04 00 00 00 mov $0x4,%eax + 20b: cd 40 int $0x40 + 20d: c3 ret -00000230 : +0000020e : SYSCALL(read) - 230: b8 05 00 00 00 mov $0x5,%eax - 235: cd 40 int $0x40 - 237: c3 ret + 20e: b8 05 00 00 00 mov $0x5,%eax + 213: cd 40 int $0x40 + 215: c3 ret -00000238 : +00000216 : SYSCALL(write) - 238: b8 10 00 00 00 mov $0x10,%eax - 23d: cd 40 int $0x40 - 23f: c3 ret + 216: b8 10 00 00 00 mov $0x10,%eax + 21b: cd 40 int $0x40 + 21d: c3 ret -00000240 : +0000021e : SYSCALL(close) - 240: b8 15 00 00 00 mov $0x15,%eax - 245: cd 40 int $0x40 - 247: c3 ret + 21e: b8 15 00 00 00 mov $0x15,%eax + 223: cd 40 int $0x40 + 225: c3 ret -00000248 : +00000226 : SYSCALL(kill) - 248: b8 06 00 00 00 mov $0x6,%eax - 24d: cd 40 int $0x40 - 24f: c3 ret + 226: b8 06 00 00 00 mov $0x6,%eax + 22b: cd 40 int $0x40 + 22d: c3 ret -00000250 : +0000022e : SYSCALL(exec) - 250: b8 07 00 00 00 mov $0x7,%eax - 255: cd 40 int $0x40 - 257: c3 ret + 22e: b8 07 00 00 00 mov $0x7,%eax + 233: cd 40 int $0x40 + 235: c3 ret -00000258 : +00000236 : SYSCALL(open) - 258: b8 0f 00 00 00 mov $0xf,%eax - 25d: cd 40 int $0x40 - 25f: c3 ret + 236: b8 0f 00 00 00 mov $0xf,%eax + 23b: cd 40 int $0x40 + 23d: c3 ret -00000260 : +0000023e : SYSCALL(mknod) - 260: b8 11 00 00 00 mov $0x11,%eax - 265: cd 40 int $0x40 - 267: c3 ret + 23e: b8 11 00 00 00 mov $0x11,%eax + 243: cd 40 int $0x40 + 245: c3 ret -00000268 : +00000246 : SYSCALL(unlink) - 268: b8 12 00 00 00 mov $0x12,%eax - 26d: cd 40 int $0x40 - 26f: c3 ret + 246: b8 12 00 00 00 mov $0x12,%eax + 24b: cd 40 int $0x40 + 24d: c3 ret -00000270 : +0000024e : SYSCALL(fstat) - 270: b8 08 00 00 00 mov $0x8,%eax - 275: cd 40 int $0x40 - 277: c3 ret + 24e: b8 08 00 00 00 mov $0x8,%eax + 253: cd 40 int $0x40 + 255: c3 ret -00000278 : +00000256 : SYSCALL(link) - 278: b8 13 00 00 00 mov $0x13,%eax - 27d: cd 40 int $0x40 - 27f: c3 ret + 256: b8 13 00 00 00 mov $0x13,%eax + 25b: cd 40 int $0x40 + 25d: c3 ret -00000280 : +0000025e : SYSCALL(mkdir) - 280: b8 14 00 00 00 mov $0x14,%eax - 285: cd 40 int $0x40 - 287: c3 ret + 25e: b8 14 00 00 00 mov $0x14,%eax + 263: cd 40 int $0x40 + 265: c3 ret -00000288 : +00000266 : SYSCALL(chdir) - 288: b8 09 00 00 00 mov $0x9,%eax - 28d: cd 40 int $0x40 - 28f: c3 ret + 266: b8 09 00 00 00 mov $0x9,%eax + 26b: cd 40 int $0x40 + 26d: c3 ret -00000290 : +0000026e : SYSCALL(dup) - 290: b8 0a 00 00 00 mov $0xa,%eax - 295: cd 40 int $0x40 - 297: c3 ret + 26e: b8 0a 00 00 00 mov $0xa,%eax + 273: cd 40 int $0x40 + 275: c3 ret -00000298 : +00000276 : SYSCALL(getpid) - 298: b8 0b 00 00 00 mov $0xb,%eax - 29d: cd 40 int $0x40 - 29f: c3 ret + 276: b8 0b 00 00 00 mov $0xb,%eax + 27b: cd 40 int $0x40 + 27d: c3 ret -000002a0 : +0000027e : SYSCALL(sbrk) - 2a0: b8 0c 00 00 00 mov $0xc,%eax - 2a5: cd 40 int $0x40 - 2a7: c3 ret + 27e: b8 0c 00 00 00 mov $0xc,%eax + 283: cd 40 int $0x40 + 285: c3 ret -000002a8 : +00000286 : SYSCALL(sleep) - 2a8: b8 0d 00 00 00 mov $0xd,%eax - 2ad: cd 40 int $0x40 - 2af: c3 ret + 286: b8 0d 00 00 00 mov $0xd,%eax + 28b: cd 40 int $0x40 + 28d: c3 ret -000002b0 : +0000028e : SYSCALL(uptime) - 2b0: b8 0e 00 00 00 mov $0xe,%eax - 2b5: cd 40 int $0x40 - 2b7: c3 ret + 28e: b8 0e 00 00 00 mov $0xe,%eax + 293: cd 40 int $0x40 + 295: c3 ret -000002b8 : +00000296 : SYSCALL(slabtest) - 2b8: b8 16 00 00 00 mov $0x16,%eax - 2bd: cd 40 int $0x40 - 2bf: c3 ret + 296: b8 16 00 00 00 mov $0x16,%eax + 29b: cd 40 int $0x40 + 29d: c3 ret -000002c0 : +0000029e : SYSCALL(ps) - 2c0: b8 17 00 00 00 mov $0x17,%eax - 2c5: cd 40 int $0x40 - 2c7: c3 ret + 29e: b8 17 00 00 00 mov $0x17,%eax + 2a3: cd 40 int $0x40 + 2a5: c3 ret -000002c8 : +000002a6 : write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { - 2c8: 55 push %ebp - 2c9: 89 e5 mov %esp,%ebp - 2cb: 57 push %edi - 2cc: 56 push %esi - 2cd: 53 push %ebx - 2ce: 83 ec 3c sub $0x3c,%esp - 2d1: 89 45 c4 mov %eax,-0x3c(%ebp) - 2d4: 89 d3 mov %edx,%ebx + 2a6: 55 push %ebp + 2a7: 89 e5 mov %esp,%ebp + 2a9: 57 push %edi + 2aa: 56 push %esi + 2ab: 53 push %ebx + 2ac: 83 ec 3c sub $0x3c,%esp + 2af: 89 45 c4 mov %eax,-0x3c(%ebp) + 2b2: 89 ce mov %ecx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ - 2d6: 83 7d 08 00 cmpl $0x0,0x8(%ebp) - 2da: 74 77 je 353 - 2dc: 85 d2 test %edx,%edx - 2de: 79 73 jns 353 + 2b4: 83 7d 08 00 cmpl $0x0,0x8(%ebp) + 2b8: 74 79 je 333 + 2ba: 85 d2 test %edx,%edx + 2bc: 79 75 jns 333 neg = 1; x = -xx; - 2e0: f7 db neg %ebx + 2be: 89 d1 mov %edx,%ecx + 2c0: f7 d9 neg %ecx neg = 1; - 2e2: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) + 2c2: c7 45 c0 01 00 00 00 movl $0x1,-0x40(%ebp) } else { x = xx; } i = 0; - 2e9: be 00 00 00 00 mov $0x0,%esi + 2c9: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; - 2ee: 89 f7 mov %esi,%edi - 2f0: 83 c6 01 add $0x1,%esi - 2f3: 89 d8 mov %ebx,%eax - 2f5: ba 00 00 00 00 mov $0x0,%edx - 2fa: f7 f1 div %ecx - 2fc: 0f b6 92 7c 06 00 00 movzbl 0x67c(%edx),%edx - 303: 88 54 35 d7 mov %dl,-0x29(%ebp,%esi,1) + 2ce: 89 df mov %ebx,%edi + 2d0: 83 c3 01 add $0x1,%ebx + 2d3: 89 c8 mov %ecx,%eax + 2d5: ba 00 00 00 00 mov $0x0,%edx + 2da: f7 f6 div %esi + 2dc: 0f b6 92 94 06 00 00 movzbl 0x694(%edx),%edx + 2e3: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) }while((x /= base) != 0); - 307: 89 da mov %ebx,%edx - 309: 89 c3 mov %eax,%ebx - 30b: 39 d1 cmp %edx,%ecx - 30d: 76 df jbe 2ee + 2e7: 89 ca mov %ecx,%edx + 2e9: 89 c1 mov %eax,%ecx + 2eb: 39 d6 cmp %edx,%esi + 2ed: 76 df jbe 2ce if(neg) - 30f: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) - 313: 74 08 je 31d + 2ef: 83 7d c0 00 cmpl $0x0,-0x40(%ebp) + 2f3: 74 08 je 2fd buf[i++] = '-'; - 315: c6 44 35 d8 2d movb $0x2d,-0x28(%ebp,%esi,1) - 31a: 8d 77 02 lea 0x2(%edi),%esi + 2f5: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) + 2fa: 8d 5f 02 lea 0x2(%edi),%ebx while(--i >= 0) - 31d: 85 f6 test %esi,%esi - 31f: 7e 2a jle 34b - 321: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx - 325: 8d 7d d8 lea -0x28(%ebp),%edi + 2fd: 85 db test %ebx,%ebx + 2ff: 7e 2a jle 32b + 301: 8d 7d d8 lea -0x28(%ebp),%edi + 304: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx write(fd, &c, 1); - 328: 8d 75 d7 lea -0x29(%ebp),%esi + 308: 8d 75 d7 lea -0x29(%ebp),%esi putc(fd, buf[i]); - 32b: 0f b6 03 movzbl (%ebx),%eax - 32e: 88 45 d7 mov %al,-0x29(%ebp) + 30b: 0f b6 03 movzbl (%ebx),%eax + 30e: 88 45 d7 mov %al,-0x29(%ebp) write(fd, &c, 1); - 331: 83 ec 04 sub $0x4,%esp - 334: 6a 01 push $0x1 - 336: 56 push %esi - 337: ff 75 c4 pushl -0x3c(%ebp) - 33a: e8 f9 fe ff ff call 238 + 311: 83 ec 04 sub $0x4,%esp + 314: 6a 01 push $0x1 + 316: 56 push %esi + 317: ff 75 c4 push -0x3c(%ebp) + 31a: e8 f7 fe ff ff call 216 while(--i >= 0) - 33f: 89 d8 mov %ebx,%eax - 341: 83 eb 01 sub $0x1,%ebx - 344: 83 c4 10 add $0x10,%esp - 347: 39 f8 cmp %edi,%eax - 349: 75 e0 jne 32b + 31f: 89 d8 mov %ebx,%eax + 321: 83 eb 01 sub $0x1,%ebx + 324: 83 c4 10 add $0x10,%esp + 327: 39 f8 cmp %edi,%eax + 329: 75 e0 jne 30b } - 34b: 8d 65 f4 lea -0xc(%ebp),%esp - 34e: 5b pop %ebx - 34f: 5e pop %esi - 350: 5f pop %edi - 351: 5d pop %ebp - 352: c3 ret + 32b: 8d 65 f4 lea -0xc(%ebp),%esp + 32e: 5b pop %ebx + 32f: 5e pop %esi + 330: 5f pop %edi + 331: 5d pop %ebp + 332: c3 ret + x = xx; + 333: 89 d1 mov %edx,%ecx neg = 0; - 353: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) - 35a: eb 8d jmp 2e9 + 335: c7 45 c0 00 00 00 00 movl $0x0,-0x40(%ebp) + 33c: eb 8b jmp 2c9 -0000035c : +0000033e : // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { - 35c: f3 0f 1e fb endbr32 - 360: 55 push %ebp - 361: 89 e5 mov %esp,%ebp - 363: 57 push %edi - 364: 56 push %esi - 365: 53 push %ebx - 366: 83 ec 2c sub $0x2c,%esp + 33e: 55 push %ebp + 33f: 89 e5 mov %esp,%ebp + 341: 57 push %edi + 342: 56 push %esi + 343: 53 push %ebx + 344: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ - 369: 8b 75 0c mov 0xc(%ebp),%esi - 36c: 0f b6 1e movzbl (%esi),%ebx - 36f: 84 db test %bl,%bl - 371: 0f 84 ab 01 00 00 je 522 - 377: 83 c6 01 add $0x1,%esi + 347: 8b 75 0c mov 0xc(%ebp),%esi + 34a: 0f b6 1e movzbl (%esi),%ebx + 34d: 84 db test %bl,%bl + 34f: 0f 84 9f 01 00 00 je 4f4 + 355: 83 c6 01 add $0x1,%esi ap = (uint*)(void*)&fmt + 1; - 37a: 8d 45 10 lea 0x10(%ebp),%eax - 37d: 89 45 d4 mov %eax,-0x2c(%ebp) + 358: 8d 45 10 lea 0x10(%ebp),%eax + 35b: 89 45 d4 mov %eax,-0x2c(%ebp) state = 0; - 380: bf 00 00 00 00 mov $0x0,%edi - 385: eb 2d jmp 3b4 + 35e: bf 00 00 00 00 mov $0x0,%edi + 363: eb 2d jmp 392 c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); - 387: 88 5d e7 mov %bl,-0x19(%ebp) + 365: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 38a: 83 ec 04 sub $0x4,%esp - 38d: 6a 01 push $0x1 - 38f: 8d 45 e7 lea -0x19(%ebp),%eax - 392: 50 push %eax - 393: ff 75 08 pushl 0x8(%ebp) - 396: e8 9d fe ff ff call 238 + 368: 83 ec 04 sub $0x4,%esp + 36b: 6a 01 push $0x1 + 36d: 8d 45 e7 lea -0x19(%ebp),%eax + 370: 50 push %eax + 371: ff 75 08 push 0x8(%ebp) + 374: e8 9d fe ff ff call 216 putc(fd, c); - 39b: 83 c4 10 add $0x10,%esp - 39e: eb 05 jmp 3a5 + 379: 83 c4 10 add $0x10,%esp + 37c: eb 05 jmp 383 } } else if(state == '%'){ - 3a0: 83 ff 25 cmp $0x25,%edi - 3a3: 74 22 je 3c7 + 37e: 83 ff 25 cmp $0x25,%edi + 381: 74 1f je 3a2 for(i = 0; fmt[i]; i++){ - 3a5: 83 c6 01 add $0x1,%esi - 3a8: 0f b6 5e ff movzbl -0x1(%esi),%ebx - 3ac: 84 db test %bl,%bl - 3ae: 0f 84 6e 01 00 00 je 522 + 383: 83 c6 01 add $0x1,%esi + 386: 0f b6 5e ff movzbl -0x1(%esi),%ebx + 38a: 84 db test %bl,%bl + 38c: 0f 84 62 01 00 00 je 4f4 c = fmt[i] & 0xff; - 3b4: 0f be d3 movsbl %bl,%edx - 3b7: 0f b6 c3 movzbl %bl,%eax + 392: 0f b6 c3 movzbl %bl,%eax if(state == 0){ - 3ba: 85 ff test %edi,%edi - 3bc: 75 e2 jne 3a0 + 395: 85 ff test %edi,%edi + 397: 75 e5 jne 37e if(c == '%'){ - 3be: 83 f8 25 cmp $0x25,%eax - 3c1: 75 c4 jne 387 + 399: 83 f8 25 cmp $0x25,%eax + 39c: 75 c7 jne 365 state = '%'; - 3c3: 89 c7 mov %eax,%edi - 3c5: eb de jmp 3a5 + 39e: 89 c7 mov %eax,%edi + 3a0: eb e1 jmp 383 if(c == 'd'){ - 3c7: 83 f8 64 cmp $0x64,%eax - 3ca: 74 59 je 425 + 3a2: 83 f8 25 cmp $0x25,%eax + 3a5: 0f 84 f2 00 00 00 je 49d + 3ab: 8d 50 9d lea -0x63(%eax),%edx + 3ae: 83 fa 15 cmp $0x15,%edx + 3b1: 0f 87 07 01 00 00 ja 4be + 3b7: 0f 87 01 01 00 00 ja 4be + 3bd: ff 24 95 3c 06 00 00 jmp *0x63c(,%edx,4) printint(fd, *ap, 10, 1); + 3c4: 83 ec 0c sub $0xc,%esp + 3c7: 6a 01 push $0x1 + 3c9: b9 0a 00 00 00 mov $0xa,%ecx + 3ce: 8b 7d d4 mov -0x2c(%ebp),%edi + 3d1: 8b 17 mov (%edi),%edx + 3d3: 8b 45 08 mov 0x8(%ebp),%eax + 3d6: e8 cb fe ff ff call 2a6 ap++; - } else if(c == 'x' || c == 'p'){ - 3cc: 81 e2 f7 00 00 00 and $0xf7,%edx - 3d2: 83 fa 70 cmp $0x70,%edx - 3d5: 74 7a je 451 - printint(fd, *ap, 16, 0); - ap++; - } else if(c == 's'){ - 3d7: 83 f8 73 cmp $0x73,%eax - 3da: 0f 84 9d 00 00 00 je 47d - s = "(null)"; - while(*s != 0){ - putc(fd, *s); - s++; - } - } else if(c == 'c'){ - 3e0: 83 f8 63 cmp $0x63,%eax - 3e3: 0f 84 ec 00 00 00 je 4d5 - putc(fd, *ap); - ap++; - } else if(c == '%'){ - 3e9: 83 f8 25 cmp $0x25,%eax - 3ec: 0f 84 0f 01 00 00 je 501 - putc(fd, c); + 3db: 89 f8 mov %edi,%eax + 3dd: 83 c0 04 add $0x4,%eax + 3e0: 89 45 d4 mov %eax,-0x2c(%ebp) + 3e3: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); - 3f2: c6 45 e7 25 movb $0x25,-0x19(%ebp) - write(fd, &c, 1); - 3f6: 83 ec 04 sub $0x4,%esp - 3f9: 6a 01 push $0x1 - 3fb: 8d 45 e7 lea -0x19(%ebp),%eax - 3fe: 50 push %eax - 3ff: ff 75 08 pushl 0x8(%ebp) - 402: e8 31 fe ff ff call 238 putc(fd, c); - 407: 88 5d e7 mov %bl,-0x19(%ebp) - write(fd, &c, 1); - 40a: 83 c4 0c add $0xc,%esp - 40d: 6a 01 push $0x1 - 40f: 8d 45 e7 lea -0x19(%ebp),%eax - 412: 50 push %eax - 413: ff 75 08 pushl 0x8(%ebp) - 416: e8 1d fe ff ff call 238 - putc(fd, c); - 41b: 83 c4 10 add $0x10,%esp } state = 0; - 41e: bf 00 00 00 00 mov $0x0,%edi - 423: eb 80 jmp 3a5 - printint(fd, *ap, 10, 1); - 425: 83 ec 0c sub $0xc,%esp - 428: 6a 01 push $0x1 - 42a: b9 0a 00 00 00 mov $0xa,%ecx - 42f: 8b 7d d4 mov -0x2c(%ebp),%edi - 432: 8b 17 mov (%edi),%edx - 434: 8b 45 08 mov 0x8(%ebp),%eax - 437: e8 8c fe ff ff call 2c8 - ap++; - 43c: 89 f8 mov %edi,%eax - 43e: 83 c0 04 add $0x4,%eax - 441: 89 45 d4 mov %eax,-0x2c(%ebp) - 444: 83 c4 10 add $0x10,%esp - state = 0; - 447: bf 00 00 00 00 mov $0x0,%edi - 44c: e9 54 ff ff ff jmp 3a5 + 3e6: bf 00 00 00 00 mov $0x0,%edi + 3eb: eb 96 jmp 383 printint(fd, *ap, 16, 0); - 451: 83 ec 0c sub $0xc,%esp - 454: 6a 00 push $0x0 - 456: b9 10 00 00 00 mov $0x10,%ecx - 45b: 8b 7d d4 mov -0x2c(%ebp),%edi - 45e: 8b 17 mov (%edi),%edx - 460: 8b 45 08 mov 0x8(%ebp),%eax - 463: e8 60 fe ff ff call 2c8 + 3ed: 83 ec 0c sub $0xc,%esp + 3f0: 6a 00 push $0x0 + 3f2: b9 10 00 00 00 mov $0x10,%ecx + 3f7: 8b 7d d4 mov -0x2c(%ebp),%edi + 3fa: 8b 17 mov (%edi),%edx + 3fc: 8b 45 08 mov 0x8(%ebp),%eax + 3ff: e8 a2 fe ff ff call 2a6 ap++; - 468: 89 f8 mov %edi,%eax - 46a: 83 c0 04 add $0x4,%eax - 46d: 89 45 d4 mov %eax,-0x2c(%ebp) - 470: 83 c4 10 add $0x10,%esp + 404: 89 f8 mov %edi,%eax + 406: 83 c0 04 add $0x4,%eax + 409: 89 45 d4 mov %eax,-0x2c(%ebp) + 40c: 83 c4 10 add $0x10,%esp state = 0; - 473: bf 00 00 00 00 mov $0x0,%edi - 478: e9 28 ff ff ff jmp 3a5 + 40f: bf 00 00 00 00 mov $0x0,%edi + 414: e9 6a ff ff ff jmp 383 s = (char*)*ap; - 47d: 8b 4d d4 mov -0x2c(%ebp),%ecx - 480: 8b 01 mov (%ecx),%eax + 419: 8b 4d d4 mov -0x2c(%ebp),%ecx + 41c: 8b 01 mov (%ecx),%eax ap++; - 482: 83 c1 04 add $0x4,%ecx - 485: 89 4d d4 mov %ecx,-0x2c(%ebp) + 41e: 83 c1 04 add $0x4,%ecx + 421: 89 4d d4 mov %ecx,-0x2c(%ebp) if(s == 0) - 488: 85 c0 test %eax,%eax - 48a: 74 13 je 49f + 424: 85 c0 test %eax,%eax + 426: 74 13 je 43b s = (char*)*ap; - 48c: 89 c3 mov %eax,%ebx + 428: 89 c3 mov %eax,%ebx while(*s != 0){ - 48e: 0f b6 00 movzbl (%eax),%eax + 42a: 0f b6 00 movzbl (%eax),%eax state = 0; - 491: bf 00 00 00 00 mov $0x0,%edi + 42d: bf 00 00 00 00 mov $0x0,%edi while(*s != 0){ - 496: 84 c0 test %al,%al - 498: 75 0f jne 4a9 - 49a: e9 06 ff ff ff jmp 3a5 + 432: 84 c0 test %al,%al + 434: 75 0f jne 445 + 436: e9 48 ff ff ff jmp 383 s = "(null)"; - 49f: bb 74 06 00 00 mov $0x674,%ebx + 43b: bb 34 06 00 00 mov $0x634,%ebx while(*s != 0){ - 4a4: b8 28 00 00 00 mov $0x28,%eax - 4a9: 8b 7d 08 mov 0x8(%ebp),%edi + 440: b8 28 00 00 00 mov $0x28,%eax + 445: 8b 7d 08 mov 0x8(%ebp),%edi putc(fd, *s); - 4ac: 88 45 e7 mov %al,-0x19(%ebp) + 448: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4af: 83 ec 04 sub $0x4,%esp - 4b2: 6a 01 push $0x1 - 4b4: 8d 45 e7 lea -0x19(%ebp),%eax - 4b7: 50 push %eax - 4b8: 57 push %edi - 4b9: e8 7a fd ff ff call 238 + 44b: 83 ec 04 sub $0x4,%esp + 44e: 6a 01 push $0x1 + 450: 8d 45 e7 lea -0x19(%ebp),%eax + 453: 50 push %eax + 454: 57 push %edi + 455: e8 bc fd ff ff call 216 s++; - 4be: 83 c3 01 add $0x1,%ebx + 45a: 83 c3 01 add $0x1,%ebx while(*s != 0){ - 4c1: 0f b6 03 movzbl (%ebx),%eax - 4c4: 83 c4 10 add $0x10,%esp - 4c7: 84 c0 test %al,%al - 4c9: 75 e1 jne 4ac + 45d: 0f b6 03 movzbl (%ebx),%eax + 460: 83 c4 10 add $0x10,%esp + 463: 84 c0 test %al,%al + 465: 75 e1 jne 448 state = 0; - 4cb: bf 00 00 00 00 mov $0x0,%edi - 4d0: e9 d0 fe ff ff jmp 3a5 + 467: bf 00 00 00 00 mov $0x0,%edi + 46c: e9 12 ff ff ff jmp 383 putc(fd, *ap); - 4d5: 8b 7d d4 mov -0x2c(%ebp),%edi - 4d8: 8b 07 mov (%edi),%eax - 4da: 88 45 e7 mov %al,-0x19(%ebp) + 471: 8b 7d d4 mov -0x2c(%ebp),%edi + 474: 8b 07 mov (%edi),%eax + 476: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); - 4dd: 83 ec 04 sub $0x4,%esp - 4e0: 6a 01 push $0x1 - 4e2: 8d 45 e7 lea -0x19(%ebp),%eax - 4e5: 50 push %eax - 4e6: ff 75 08 pushl 0x8(%ebp) - 4e9: e8 4a fd ff ff call 238 + 479: 83 ec 04 sub $0x4,%esp + 47c: 6a 01 push $0x1 + 47e: 8d 45 e7 lea -0x19(%ebp),%eax + 481: 50 push %eax + 482: ff 75 08 push 0x8(%ebp) + 485: e8 8c fd ff ff call 216 ap++; - 4ee: 83 c7 04 add $0x4,%edi - 4f1: 89 7d d4 mov %edi,-0x2c(%ebp) - 4f4: 83 c4 10 add $0x10,%esp + 48a: 83 c7 04 add $0x4,%edi + 48d: 89 7d d4 mov %edi,-0x2c(%ebp) + 490: 83 c4 10 add $0x10,%esp state = 0; - 4f7: bf 00 00 00 00 mov $0x0,%edi - 4fc: e9 a4 fe ff ff jmp 3a5 + 493: bf 00 00 00 00 mov $0x0,%edi + 498: e9 e6 fe ff ff jmp 383 putc(fd, c); - 501: 88 5d e7 mov %bl,-0x19(%ebp) + 49d: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); - 504: 83 ec 04 sub $0x4,%esp - 507: 6a 01 push $0x1 - 509: 8d 45 e7 lea -0x19(%ebp),%eax - 50c: 50 push %eax - 50d: ff 75 08 pushl 0x8(%ebp) - 510: e8 23 fd ff ff call 238 - 515: 83 c4 10 add $0x10,%esp + 4a0: 83 ec 04 sub $0x4,%esp + 4a3: 6a 01 push $0x1 + 4a5: 8d 45 e7 lea -0x19(%ebp),%eax + 4a8: 50 push %eax + 4a9: ff 75 08 push 0x8(%ebp) + 4ac: e8 65 fd ff ff call 216 + 4b1: 83 c4 10 add $0x10,%esp + state = 0; + 4b4: bf 00 00 00 00 mov $0x0,%edi + 4b9: e9 c5 fe ff ff jmp 383 + putc(fd, '%'); + 4be: c6 45 e7 25 movb $0x25,-0x19(%ebp) + write(fd, &c, 1); + 4c2: 83 ec 04 sub $0x4,%esp + 4c5: 6a 01 push $0x1 + 4c7: 8d 45 e7 lea -0x19(%ebp),%eax + 4ca: 50 push %eax + 4cb: ff 75 08 push 0x8(%ebp) + 4ce: e8 43 fd ff ff call 216 + putc(fd, c); + 4d3: 88 5d e7 mov %bl,-0x19(%ebp) + write(fd, &c, 1); + 4d6: 83 c4 0c add $0xc,%esp + 4d9: 6a 01 push $0x1 + 4db: 8d 45 e7 lea -0x19(%ebp),%eax + 4de: 50 push %eax + 4df: ff 75 08 push 0x8(%ebp) + 4e2: e8 2f fd ff ff call 216 + putc(fd, c); + 4e7: 83 c4 10 add $0x10,%esp state = 0; - 518: bf 00 00 00 00 mov $0x0,%edi - 51d: e9 83 fe ff ff jmp 3a5 + 4ea: bf 00 00 00 00 mov $0x0,%edi + 4ef: e9 8f fe ff ff jmp 383 } } } - 522: 8d 65 f4 lea -0xc(%ebp),%esp - 525: 5b pop %ebx - 526: 5e pop %esi - 527: 5f pop %edi - 528: 5d pop %ebp - 529: c3 ret - -0000052a : + 4f4: 8d 65 f4 lea -0xc(%ebp),%esp + 4f7: 5b pop %ebx + 4f8: 5e pop %esi + 4f9: 5f pop %edi + 4fa: 5d pop %ebp + 4fb: c3 ret + +000004fc : static Header base; static Header *freep; void free(void *ap) { - 52a: f3 0f 1e fb endbr32 - 52e: 55 push %ebp - 52f: 89 e5 mov %esp,%ebp - 531: 57 push %edi - 532: 56 push %esi - 533: 53 push %ebx - 534: 8b 5d 08 mov 0x8(%ebp),%ebx + 4fc: 55 push %ebp + 4fd: 89 e5 mov %esp,%ebp + 4ff: 57 push %edi + 500: 56 push %esi + 501: 53 push %ebx + 502: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; - 537: 8d 4b f8 lea -0x8(%ebx),%ecx + 505: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 53a: a1 e4 08 00 00 mov 0x8e4,%eax - 53f: eb 0c jmp 54d + 508: a1 fc 08 00 00 mov 0x8fc,%eax + 50d: eb 0c jmp 51b if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 541: 8b 10 mov (%eax),%edx - 543: 39 c2 cmp %eax,%edx - 545: 77 04 ja 54b - 547: 39 ca cmp %ecx,%edx - 549: 77 10 ja 55b + 50f: 8b 10 mov (%eax),%edx + 511: 39 c2 cmp %eax,%edx + 513: 77 04 ja 519 + 515: 39 ca cmp %ecx,%edx + 517: 77 10 ja 529 { - 54b: 89 d0 mov %edx,%eax + 519: 89 d0 mov %edx,%eax for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) - 54d: 39 c8 cmp %ecx,%eax - 54f: 73 f0 jae 541 - 551: 8b 10 mov (%eax),%edx - 553: 39 ca cmp %ecx,%edx - 555: 77 04 ja 55b + 51b: 39 c8 cmp %ecx,%eax + 51d: 73 f0 jae 50f + 51f: 8b 10 mov (%eax),%edx + 521: 39 ca cmp %ecx,%edx + 523: 77 04 ja 529 if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) - 557: 39 c2 cmp %eax,%edx - 559: 77 f0 ja 54b + 525: 39 c2 cmp %eax,%edx + 527: 77 f0 ja 519 break; if(bp + bp->s.size == p->s.ptr){ - 55b: 8b 73 fc mov -0x4(%ebx),%esi - 55e: 8b 10 mov (%eax),%edx - 560: 8d 3c f1 lea (%ecx,%esi,8),%edi - 563: 39 fa cmp %edi,%edx - 565: 74 19 je 580 + 529: 8b 73 fc mov -0x4(%ebx),%esi + 52c: 8b 10 mov (%eax),%edx + 52e: 8d 3c f1 lea (%ecx,%esi,8),%edi + 531: 39 fa cmp %edi,%edx + 533: 74 19 je 54e bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; + 535: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; - 567: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ - 56a: 8b 50 04 mov 0x4(%eax),%edx - 56d: 8d 34 d0 lea (%eax,%edx,8),%esi - 570: 39 f1 cmp %esi,%ecx - 572: 74 1b je 58f + 538: 8b 50 04 mov 0x4(%eax),%edx + 53b: 8d 34 d0 lea (%eax,%edx,8),%esi + 53e: 39 f1 cmp %esi,%ecx + 540: 74 18 je 55a p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; + 542: 89 08 mov %ecx,(%eax) } else p->s.ptr = bp; - 574: 89 08 mov %ecx,(%eax) freep = p; - 576: a3 e4 08 00 00 mov %eax,0x8e4 + 544: a3 fc 08 00 00 mov %eax,0x8fc } - 57b: 5b pop %ebx - 57c: 5e pop %esi - 57d: 5f pop %edi - 57e: 5d pop %ebp - 57f: c3 ret + 549: 5b pop %ebx + 54a: 5e pop %esi + 54b: 5f pop %edi + 54c: 5d pop %ebp + 54d: c3 ret bp->s.size += p->s.ptr->s.size; - 580: 03 72 04 add 0x4(%edx),%esi - 583: 89 73 fc mov %esi,-0x4(%ebx) + 54e: 03 72 04 add 0x4(%edx),%esi + 551: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; - 586: 8b 10 mov (%eax),%edx - 588: 8b 12 mov (%edx),%edx - 58a: 89 53 f8 mov %edx,-0x8(%ebx) - 58d: eb db jmp 56a + 554: 8b 10 mov (%eax),%edx + 556: 8b 12 mov (%edx),%edx + 558: eb db jmp 535 p->s.size += bp->s.size; - 58f: 03 53 fc add -0x4(%ebx),%edx - 592: 89 50 04 mov %edx,0x4(%eax) + 55a: 03 53 fc add -0x4(%ebx),%edx + 55d: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; - 595: 8b 53 f8 mov -0x8(%ebx),%edx - 598: 89 10 mov %edx,(%eax) - 59a: eb da jmp 576 + 560: 8b 4b f8 mov -0x8(%ebx),%ecx + 563: eb dd jmp 542 -0000059c : +00000565 : return freep; } void* malloc(uint nbytes) { - 59c: f3 0f 1e fb endbr32 - 5a0: 55 push %ebp - 5a1: 89 e5 mov %esp,%ebp - 5a3: 57 push %edi - 5a4: 56 push %esi - 5a5: 53 push %ebx - 5a6: 83 ec 0c sub $0xc,%esp + 565: 55 push %ebp + 566: 89 e5 mov %esp,%ebp + 568: 57 push %edi + 569: 56 push %esi + 56a: 53 push %ebx + 56b: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; - 5a9: 8b 45 08 mov 0x8(%ebp),%eax - 5ac: 8d 58 07 lea 0x7(%eax),%ebx - 5af: c1 eb 03 shr $0x3,%ebx - 5b2: 83 c3 01 add $0x1,%ebx + 56e: 8b 45 08 mov 0x8(%ebp),%eax + 571: 8d 58 07 lea 0x7(%eax),%ebx + 574: c1 eb 03 shr $0x3,%ebx + 577: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ - 5b5: 8b 15 e4 08 00 00 mov 0x8e4,%edx - 5bb: 85 d2 test %edx,%edx - 5bd: 74 20 je 5df + 57a: 8b 15 fc 08 00 00 mov 0x8fc,%edx + 580: 85 d2 test %edx,%edx + 582: 74 1c je 5a0 base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5bf: 8b 02 mov (%edx),%eax + 584: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 5c1: 8b 48 04 mov 0x4(%eax),%ecx - 5c4: 39 cb cmp %ecx,%ebx - 5c6: 76 3c jbe 604 - 5c8: 81 fb 00 10 00 00 cmp $0x1000,%ebx - 5ce: be 00 10 00 00 mov $0x1000,%esi - 5d3: 0f 43 f3 cmovae %ebx,%esi + 586: 8b 48 04 mov 0x4(%eax),%ecx + 589: 39 cb cmp %ecx,%ebx + 58b: 76 38 jbe 5c5 + 58d: be 00 10 00 00 mov $0x1000,%esi + 592: 39 f3 cmp %esi,%ebx + 594: 0f 43 f3 cmovae %ebx,%esi p = sbrk(nu * sizeof(Header)); - 5d6: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi - 5dd: eb 72 jmp 651 + 597: 8d 3c f5 00 00 00 00 lea 0x0(,%esi,8),%edi + 59e: eb 72 jmp 612 base.s.ptr = freep = prevp = &base; - 5df: c7 05 e4 08 00 00 e8 movl $0x8e8,0x8e4 - 5e6: 08 00 00 - 5e9: c7 05 e8 08 00 00 e8 movl $0x8e8,0x8e8 - 5f0: 08 00 00 + 5a0: c7 05 fc 08 00 00 00 movl $0x900,0x8fc + 5a7: 09 00 00 + 5aa: c7 05 00 09 00 00 00 movl $0x900,0x900 + 5b1: 09 00 00 base.s.size = 0; - 5f3: c7 05 ec 08 00 00 00 movl $0x0,0x8ec - 5fa: 00 00 00 + 5b4: c7 05 04 09 00 00 00 movl $0x0,0x904 + 5bb: 00 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 5fd: b8 e8 08 00 00 mov $0x8e8,%eax - 602: eb c4 jmp 5c8 + 5be: b8 00 09 00 00 mov $0x900,%eax + 5c3: eb c8 jmp 58d if(p->s.size == nunits) - 604: 39 cb cmp %ecx,%ebx - 606: 74 1e je 626 + 5c5: 39 cb cmp %ecx,%ebx + 5c7: 74 1e je 5e7 prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; - 608: 29 d9 sub %ebx,%ecx - 60a: 89 48 04 mov %ecx,0x4(%eax) + 5c9: 29 d9 sub %ebx,%ecx + 5cb: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; - 60d: 8d 04 c8 lea (%eax,%ecx,8),%eax + 5ce: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; - 610: 89 58 04 mov %ebx,0x4(%eax) + 5d1: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; - 613: 89 15 e4 08 00 00 mov %edx,0x8e4 + 5d4: 89 15 fc 08 00 00 mov %edx,0x8fc return (void*)(p + 1); - 619: 8d 50 08 lea 0x8(%eax),%edx + 5da: 8d 50 08 lea 0x8(%eax),%edx } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } - 61c: 89 d0 mov %edx,%eax - 61e: 8d 65 f4 lea -0xc(%ebp),%esp - 621: 5b pop %ebx - 622: 5e pop %esi - 623: 5f pop %edi - 624: 5d pop %ebp - 625: c3 ret + 5dd: 89 d0 mov %edx,%eax + 5df: 8d 65 f4 lea -0xc(%ebp),%esp + 5e2: 5b pop %ebx + 5e3: 5e pop %esi + 5e4: 5f pop %edi + 5e5: 5d pop %ebp + 5e6: c3 ret prevp->s.ptr = p->s.ptr; - 626: 8b 08 mov (%eax),%ecx - 628: 89 0a mov %ecx,(%edx) - 62a: eb e7 jmp 613 + 5e7: 8b 08 mov (%eax),%ecx + 5e9: 89 0a mov %ecx,(%edx) + 5eb: eb e7 jmp 5d4 hp->s.size = nu; - 62c: 89 70 04 mov %esi,0x4(%eax) + 5ed: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); - 62f: 83 ec 0c sub $0xc,%esp - 632: 83 c0 08 add $0x8,%eax - 635: 50 push %eax - 636: e8 ef fe ff ff call 52a + 5f0: 83 ec 0c sub $0xc,%esp + 5f3: 83 c0 08 add $0x8,%eax + 5f6: 50 push %eax + 5f7: e8 00 ff ff ff call 4fc return freep; - 63b: 8b 15 e4 08 00 00 mov 0x8e4,%edx + 5fc: 8b 15 fc 08 00 00 mov 0x8fc,%edx if((p = morecore(nunits)) == 0) - 641: 83 c4 10 add $0x10,%esp - 644: 85 d2 test %edx,%edx - 646: 74 d4 je 61c + 602: 83 c4 10 add $0x10,%esp + 605: 85 d2 test %edx,%edx + 607: 74 d4 je 5dd for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ - 648: 8b 02 mov (%edx),%eax + 609: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ - 64a: 8b 48 04 mov 0x4(%eax),%ecx - 64d: 39 d9 cmp %ebx,%ecx - 64f: 73 b3 jae 604 + 60b: 8b 48 04 mov 0x4(%eax),%ecx + 60e: 39 d9 cmp %ebx,%ecx + 610: 73 b3 jae 5c5 if(p == freep) - 651: 89 c2 mov %eax,%edx - 653: 39 05 e4 08 00 00 cmp %eax,0x8e4 - 659: 75 ed jne 648 + 612: 89 c2 mov %eax,%edx + 614: 39 05 fc 08 00 00 cmp %eax,0x8fc + 61a: 75 ed jne 609 p = sbrk(nu * sizeof(Header)); - 65b: 83 ec 0c sub $0xc,%esp - 65e: 57 push %edi - 65f: e8 3c fc ff ff call 2a0 + 61c: 83 ec 0c sub $0xc,%esp + 61f: 57 push %edi + 620: e8 59 fc ff ff call 27e if(p == (char*)-1) - 664: 83 c4 10 add $0x10,%esp - 667: 83 f8 ff cmp $0xffffffff,%eax - 66a: 75 c0 jne 62c + 625: 83 c4 10 add $0x10,%esp + 628: 83 f8 ff cmp $0xffffffff,%eax + 62b: 75 c0 jne 5ed return 0; - 66c: ba 00 00 00 00 mov $0x0,%edx - 671: eb a9 jmp 61c + 62d: ba 00 00 00 00 mov $0x0,%edx + 632: eb a9 jmp 5dd diff --git a/src/user/zombie.d b/src/user/zombie.d new file mode 100644 index 0000000..b838adc --- /dev/null +++ b/src/user/zombie.d @@ -0,0 +1,2 @@ +user/zombie.o: user/zombie.c /usr/include/stdc-predef.h types.h stat.h \ + user.h diff --git a/src/user/zombie.o b/src/user/zombie.o new file mode 100644 index 0000000..5f558c5 Binary files /dev/null and b/src/user/zombie.o differ diff --git a/src/user/zombie.sym b/src/user/zombie.sym index b74c733..54ece80 100644 --- a/src/user/zombie.sym +++ b/src/user/zombie.sym @@ -1,59 +1,47 @@ -00000000 .text -00000674 .rodata -00000690 .eh_frame -000008e4 .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 -000002c8 printint -0000067c digits.1089 +000002a6 printint +00000694 digits.0 00000000 umalloc.c -000008e4 freep -000008e8 base -00000032 strcpy -0000035c printf -000001df memmove -00000260 mknod -000002c0 ps -000000fd gets -00000298 getpid -0000059c malloc -000002a8 sleep -00000228 pipe -000002b8 slabtest -00000238 write -00000270 fstat -00000248 kill -00000288 chdir -00000250 exec -00000220 wait -00000230 read -00000268 unlink -00000210 fork -000002a0 sbrk -000002b0 uptime -000008e4 __bss_start -000000b1 memset +000008fc freep +00000900 base +0000002e strcpy +0000033e printf +000001c1 memmove +0000023e mknod +0000029e ps +000000e9 gets +00000276 getpid +00000565 malloc +00000286 sleep +00000206 pipe +00000296 slabtest +00000216 write +0000024e fstat +00000226 kill +00000266 chdir +0000022e exec +000001fe wait +0000020e read +00000246 unlink +000001ee fork +0000027e sbrk +0000028e uptime +000008fc __bss_start +000000a3 memset 00000000 main -00000058 strcmp -00000290 dup -00000158 stat -000008e4 _edata -000008f0 _end -00000278 link -00000218 exit -000001a0 atoi -00000087 strlen -00000258 open -000000cc strchr -00000280 mkdir -00000240 close -0000052a free +00000052 strcmp +0000026e dup +00000140 stat +000008fc _edata +00000908 _end +00000256 link +000001f6 exit +00000184 atoi +0000007d strlen +00000236 open +000000bc strchr +0000025e mkdir +0000021e close +000004fc free diff --git a/src/usys.o b/src/usys.o new file mode 100644 index 0000000..43e5120 Binary files /dev/null and b/src/usys.o differ diff --git a/src/vectors.o b/src/vectors.o new file mode 100644 index 0000000..39b1252 Binary files /dev/null and b/src/vectors.o differ diff --git a/src/vm.d b/src/vm.d new file mode 100644 index 0000000..51631b1 --- /dev/null +++ b/src/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/src/vm.o b/src/vm.o new file mode 100644 index 0000000..99e9ad2 Binary files /dev/null and b/src/vm.o differ diff --git a/src/xv6.img b/src/xv6.img index 8c17ac4..65da001 100644 Binary files a/src/xv6.img and b/src/xv6.img differ