text
stringlengths
1
1.05M
bits 64 default rel %use altreg section .text bar equ 0xcc ;; Each instruction group separated by blank should encode identially ;; k_mov kreg size_suffix size_name gpr big_gpr %macro k_mov 5 kmov%2 %1,[foo] kmov %1,%3 [foo] kmov %3 [foo],%1 kmov%2 [foo],%1 kmov %3 [foo],%1 kmov [foo],%3 %1 kmov %3 [foo],%1 kmov%2 %1,%1 kmov %3 %1,%1 kmov %1,%3 %1 kmov%2 %1,%4 kmov%2 %1,%5 kmov %1,%4 kmov %3 %1,%4 kmov %3 %1,%5 kmov %1,%3 %4 %ifidni %4,%5 kmov %1,%5 %endif kmov%2 %5,%1 %ifidni %4,%5 kmov %5,%1 %endif kmov %5,%3 %1 %endmacro %pragma list options +bempf ;; k_rr op kreg size_suffix size_name %macro k_rr 4 %1%3 %2,%2 %1 %4 %2,%2 %1 %2,%4 %2 %endmacro ;; k_rri op kreg size_suffix size_name %macro k_rrr 4 %1%3 %2,%2,%2 %1 %4 %2,%2,%2 %1 %2,%4 %2,%2 %1 %2,%2,%4 %2 %endmacro ;; k_rri op kreg size_suffix size_name %macro k_rri 4 %1%3 %2,%2,bar %1 %4 %2,%2,bar %1 %2,%4 %2,bar %endmacro %define size_b byte %define size_w word %define size_d dword %define size_q qword %define gpr_b b %define gpr_w w %define gpr_d d %define gpr_q %define bgpr_b d %define bgpr_w d %define bgpr_d d %define bgpr_q ;; k_test size_suffix regno %macro k_test 2 k_mov k%2,%1,size_%1,%[r %+ %2 %+ gpr_%1],%[r %+ %2 %+ bgpr_%1] k_rrr kadd,k%2,%1,size_%1 k_rrr kand,k%2,%1,size_%1 k_rrr kandn,k%2,%1,size_%1 k_rrr kand,k%2,%1,size_%1 k_rr knot,k%2,%1,size_%1 k_rrr kor,k%2,%1,size_%1 k_rr kortest,k%2,%1,size_%1 k_rri kshiftl,k%2,%1,size_%1 k_rri kshiftr,k%2,%1,size_%1 k_rr ktest,k%2,%1,size_%1 k_rrr kxnor,k%2,%1,size_%1 k_rrr kxor,k%2,%1,size_%1 %endmacro %assign nreg 0 %define kreg k %+ nreg %rep 8 k_test b,nreg k_test w,nreg k_test d,nreg k_test q,nreg kunpckbw kreg,kreg,kreg kunpck word kreg,kreg,kreg kunpck kreg,byte kreg,kreg kunpck kreg,kreg,byte kreg kunpck word kreg,byte kreg,kreg kunpck word kreg,kreg,byte kreg kunpckwd kreg,kreg,kreg kunpck dword kreg,kreg,kreg kunpck kreg,word kreg,kreg kunpck kreg,kreg,word kreg kunpck dword kreg,word kreg,kreg kunpck dword kreg,kreg,word kreg kunpckdq kreg,kreg,kreg kunpck qword kreg,kreg,kreg kunpck kreg,dword kreg,kreg kunpck kreg,kreg,dword kreg kunpck qword kreg,dword kreg,kreg kunpck qword kreg,kreg,dword kreg %assign nreg nreg+1 %endrep section .bss foo resq 1
//Push constant @3030 D=A @SP A=M M=D @SP M=M+1 //Pop Pointer from THIS @SP M=M-1 @SP D=A @THIS AD=D+A @R13 M=D @SP A=M D=M @R13 A=M M=D //Push constant @3040 D=A @SP A=M M=D @SP M=M+1 //Pop Pointer from THAT @SP M=M-1 @SP D=A @THAT AD=D+A @R13 M=D @SP A=M D=M @R13 A=M M=D //Push constant @32 D=A @SP A=M M=D @SP M=M+1 //Pop This @THIS D=M @2 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D //Push constant @46 D=A @SP A=M M=D @SP M=M+1 //Pop That @THAT D=M @6 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D //Push Pointer from THIS @SP D=A @THIS AD=D+A D=M @SP A=M M=D @SP M=M+1 //Push Pointer from THAT @SP D=A @THAT AD=D+A D=M @SP A=M M=D @SP M=M+1 //Add Command @SP M=M-1 @SP A=M D=M @SP M=M-1 @SP A=M A=M D=D+A @SP A=M M=D @SP M=M+1 //Push This @THIS D=M @2 A=A+D D=M @SP A=M M=D @SP M=M+1 //Sub Command @SP M=M-1 @SP A=M D=M @SP M=M-1 @SP A=M A=M D=A-D @SP A=M M=D @SP M=M+1 //Push That @THAT D=M @6 A=A+D D=M @SP A=M M=D @SP M=M+1 //Add Command @SP M=M-1 @SP A=M D=M @SP M=M-1 @SP A=M A=M D=D+A @SP A=M M=D @SP M=M+1
MODULE sscanf SECTION code_clib PUBLIC sscanf EXTERN asm_scanf EXTERN scanf_ungetc EXTERN scanf_getc EXTERN __sgoioblk ; sccz80 version ;void sscanf(char *buf, char *fmt,...) ;{ ; asm_scanf(fp, sccz80_delta, *ct,ct-1); ;} sscanf: ld l,a ld h,0 add hl,hl add hl,sp ;&buf push ix ;save callers ld c,(hl) ;buf inc hl ld b,(hl) dec hl dec hl ;&fmt+1 ex de,hl ;de=&fmy+1 ld hl,1+2+128 ;h=ungetc, l=_IOREAD|_IOSTRING|_IOUSE push hl ; push bc ;buf ld hl,0 add hl,sp push hl ;fp ld bc,1 ;sccz80 push bc ex de,hl ;hl=&fmt+1 ld b,(hl) ;fmt dec hl ld c,(hl) push bc dec hl dec hl push hl ;&ap call asm_scanf pop bc pop bc pop bc pop bc pop bc pop bc pop ix ret
// OptFrame - Optimization Framework // Copyright (C) 2009-2015 // http://optframe.sourceforge.net/ // // This file is part of the OptFrame optimization framework. This framework // is free software; you can redistribute it and/or modify it under the // terms of the GNU Lesser General Public License v3 as published by the // Free Software Foundation. // This framework is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License v3 for more details. // You should have received a copy of the GNU Lesser General Public License v3 // along with this library; see the file COPYING. If not, write to the Free // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. #ifndef OPTFRAME_GENERAL_CROSSOVER_HPP_ #define OPTFRAME_GENERAL_CROSSOVER_HPP_ #include <vector> #include "../../Solution.hpp" #include "../../Evaluation.hpp" #include "EA.h" #ifndef _OPTFRAME_DBG_CROSSOVER_ # ifdef OPTFRAME_DEBUG # define _OPTFRAME_DBG_CROSSOVER_ # else # define _OPTFRAME_DBG_CROSSOVER_ while(false) # endif /* OPTFRAME_DEBUG */ #endif /* _OPTFRAME_DBG_CROSSOVER_ */ namespace optframe { template<XSolution S, XEvaluation XEv = Evaluation<>, XESolution XES = pair<S, XEv>> class Crossover: public Component, public EA { public: virtual ~Crossover() { } virtual pair<S*, S*> cross(const S&, const S&) = 0; virtual bool compatible(string s) { return (s == idComponent()) || (Component::compatible(s)); } static string idComponent() { stringstream ss; ss << Component::idComponent() << ":" << EA::family() << ":Crossover"; return ss.str(); } virtual string id() const { return idComponent(); } }; //temporary fix for the true basic genetic algorithm! I will revisit this in the future to perform a proper naming convention template<XSolution S, XEvaluation XEv = Evaluation<>, XESolution XES = pair<S, XEv>> class SimpleCrossover { protected: using Individual = S; //using Chromossome = R; using Fitness = XEv*; //nullptr means there's no evaluation using VPopulation = std::vector< pair<Individual, Fitness> >; public: SimpleCrossover() = default; virtual ~SimpleCrossover() = default; virtual VPopulation cross(const std::vector<Individual*>& parents) = 0; }; /**********************/ /* CROSSOVER EXAMPLES */ /**********************/ //receives two parents to return offspring with user programmed operator template<XSolution S, XEvaluation XEv = Evaluation<>, XESolution XES = pair<S, XEv>> class TwoParentsCrossover : public SimpleCrossover<S, XEv> { protected: using Individual = S; //using Chromossome = R; using Fitness = XEv*; //nullptr means there's no evaluation using VPopulation = std::vector< std::pair<Individual, Fitness> >; public: TwoParentsCrossover() = default; virtual ~TwoParentsCrossover() = default; virtual VPopulation cross(const Individual& parent1, const Individual& parent2) = 0; virtual VPopulation cross(const std::vector<Individual*>& parents){ assert(parents.size() == 2); assert(parents[0] != nullptr); assert(parents[1] != nullptr); return cross(*parents[0], *parents[1]); } }; } #endif /*OPTFRAME_GENERAL_CROSSOVER_HPP_*/
// Copyright (c) 2017, The Superior Project // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its contributors may be // used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Parts of this file are originally copyright (c) 2013-2017 The Monero Project // // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developersParts of this file are originally copyright (c) 2012-2013 The Cryptonote developers #include "gtest/gtest.h" #include "common/util.h" TEST(vercmp, empty) { ASSERT_TRUE(tools::vercmp("", "") == 0); } TEST(vercmp, empty0) { ASSERT_TRUE(tools::vercmp("", "0") == 0); } TEST(vercmp, empty1) { ASSERT_TRUE(tools::vercmp("0", "") == 0); } TEST(vercmp, zero_zero) { ASSERT_TRUE(tools::vercmp("0", "0") == 0); } TEST(vercmp, one_one) { ASSERT_TRUE(tools::vercmp("1", "1") == 0); } TEST(vercmp, one_two) { ASSERT_TRUE(tools::vercmp("1", "2") < 0); } TEST(vercmp, two_one) { ASSERT_TRUE(tools::vercmp("2", "1") > 0); } TEST(vercmp, ten_nine) { ASSERT_TRUE(tools::vercmp("10", "9") > 0); } TEST(vercmp, one_dot_ten_one_dot_nine) { ASSERT_TRUE(tools::vercmp("1.10", "1.9") > 0); } TEST(vercmp, one_one_dot_nine) { ASSERT_TRUE(tools::vercmp("1", "1.9") < 0); } TEST(vercmp, to_master) { ASSERT_TRUE(tools::vercmp("1.0", "1.0-master") < 0); } TEST(vercmp, from_master) { ASSERT_TRUE(tools::vercmp("1.0-master", "1.1") < 0); }
.align 2 npc_cmdNop: add r6,0x1 mov r15,r14 .align 2 npc_withinActiveTime: push r14 // Get current timestamp ldr r0,=0x806FA59 mov r14,r15 bx r0 // Check in specific area mov r2,r10 ldr r2,[r2,0x40] ldrb r1,[r2,0x4] @@checkComps1: cmp r1,0xB1 bne @@checkComps2 ldrb r1,[r2,0x5] cmp r1,0x0 beq @@checkElecStoveComp cmp r1,0x5 beq @@checkBrokenRadioComp cmp r1,0xF beq @@checkFridgeComp b @@checkTimeNormal @@checkElecStoveComp: ldrb r1,[r5,0x10] // Check NPC ID cmp r1,0x5 blt @@checkTimeNormal cmp r1,0x9 bgt @@checkTimeNormal b @@checkTimeEverydayTournament @@checkBrokenRadioComp: @@checkFridgeComp: ldrb r1,[r5,0x10] // Check NPC ID cmp r1,0x2 blt @@checkTimeNormal cmp r1,0x6 bgt @@checkTimeNormal b @@checkTimeEverydayTournament @@checkComps2: cmp r1,0xB2 bne @@checkTimeNormal ldrb r1,[r2,0x5] cmp r1,0x7 bne @@checkTimeNormal @@checkPipeOrganComp: ldrb r1,[r5,0x10] // Check NPC ID cmp r1,0x4 blt @@checkTimeNormal cmp r1,0x8 bgt @@checkTimeNormal @@checkTimeEverydayTournament: // Check all time ranges for Everyday Tournament lsr r0,r0,0x8 cmp r0,0x9 // 9:00 blt @@false cmp r0,0xA // 10:00 blt @@true cmp r0,0xD // 13:00 blt @@false cmp r0,0xE // 14:00 blt @@true cmp r0,0x10 // 16:00 blt @@false cmp r0,0x11 // 17:00 blt @@true cmp r0,0x14 // 20:00 blt @@false cmp r0,0x15 // 21:00 blt @@true b @@false @@checkTimeNormal: // Check if before jack in time mov r2,r5 add r2,0x90 ldrh r1,[r2] cmp r0,r1 blt @@false // Check if after jack out time ldrh r1,[r2,0x2] mov r3,0x0 mvn r3,r3 lsr r3,r3,0x10 cmp r1,r3 beq @@true // Jack out time not set cmp r0,r1 bge @@false @@true: mov r0,0x1 pop r15 @@false: mov r0,0x0 pop r15 .align 2 npc_timeConditionalJumpTrue: // Set jack in and jack out times mov r4,r5 add r4,0x90 ldrb r0,[r6,0x2] // jack in minute ldrb r1,[r6,0x3] // jack in hour strb r0,[r4] strb r1,[r4,0x1] ldrb r0,[r6,0x4] // jack out minute ldrb r1,[r6,0x5] // jack out hour // Increment minute by 1 add r0,0x1 cmp r0,0x3C blt @@setJackOutTime mov r0,0x0 add r1,0x1 @@setJackOutTime: strb r0,[r4,0x2] strb r1,[r4,0x3] // Do the jump add r0,r6,0x6 ldr r1,=0x806FDCF mov r14,r15 bx r1 mov r6,r0 // Set jack in marker ldrb r0,[r4,0x9] // Check already jacked out or already attempted a jack in cmp r0,0x1 bne @@end // Change jack in marker mov r1,0x2 // perform jack in at command 0x45 strb r1,[r4,0x9] @@end: pop r15 .align 2 npc_timeConditionalJumpFalse: // Check if next command clears the NPC ldrb r0,[r6,0xA] cmp r0,0x3 bne @@checkNotTimeConditionalJump // Instead of clearing, reset the NPC bl npc_resetNPC // Set already jacked out marker mov r1,0x99 mov r0,0x1 strb r0,[r5,r1] // Return 4 levels up add sp,0xC pop r15 @@checkNotTimeConditionalJump: // Check if next command is another time-conditional jump cmp r0,0x44 beq @@end // Set jack out time to start of range mov r2,r5 add r2,0x90 ldrb r0,[r6,0x2] ldrb r1,[r6,0x3] strb r0,[r2,0x2] strb r1,[r2,0x3] @@end: add r6,0xA pop r15 .align 2 npc_waitPlayerRadius: push r14 // Check jack in marker mov r2,r5 add r2,0x90 ldrb r0,[r2,0x9] mov r1,0x0 strb r1,[r2,0x9] cmp r0,0x2 bne @@normal // Start jack in mov r0,0xC strh r0,[r5,0x8] mov r0,0x0 strb r0,[r5,0xA] mov r0,0x17 ldr r1,[r5,0x60] str r1,[r2,0x4] orr r1,r0 str r1,[r5,0x60] ldrb r0,[r5] str r0,[r2,0x8] mov r1,0x2 bic r0,r1 strb r0,[r5] // Deactivate NPC ldr r0,=0x806FCD5 mov r14,r15 bx r0 b @@end @@normal: ldr r7,=0x806FA75 mov r14,r15 bx r7 @@end: pop r15 .align 2 npc_startJackOut: push r0-r7,r14 ldrb r0,[r5,0x8] cmp r0,0xC // Waiting for jack in beq @@end // Start the jack out mov r0,0x10 strh r0,[r5,0x8] mov r0,0x0 ldr r1,=0x806F649 bx r1 @@end: pop r0-r7,r15 .align 2 npc_setJackIn: strb r0,[r7] // Set jack in marker mov r2,0x99 ldrb r1,[r5,r2] mov r0,0x1 strb r0,[r5,r2] push r1 // Check should be jacked in ldr r0,=0x806F5D3 mov r14,r15 bx r0 // ne = past jackin time, eq = before jackin time pop r0 beq @@setJackIn // Check already jacked out or already attempted a jack in cmp r0,0x1 // already attempted jack in beq @@setJackIn cmp r0,0x2 // pending jack in bne @@return @@setJackIn: ldr r0,=0x806F585 bx r0 @@return: ldr r0,=0x806F5A9 bx r0 .align 2 npc_clearAfterJackOut: bl npc_resetNPC // Return 4 levels up add sp,0xC pop r15 .align 2 npc_waitJackOut: push r14 // Check animation finished ldr r0,=0x8002797 mov r14,r15 bx r0 mov r1,0x80 tst r1,r0 beq @@end // Check if this is after jack out time ldr r0,=0x806F605 mov r14,r15 bx r0 beq @@free // Unset jack in flag ldrb r0,[r5,0x3] ldr r1,=0x1EA0 add r0,r0,r1 ldr r1,=0x8028753 mov r14,r15 bx r1 // Unset jack out flag ldrb r0,[r5,0x3] ldr r1,=0x1EC0 add r0,r0,r1 ldr r1,=0x8028753 mov r14,r15 bx r1 // Reset NPC bl npc_resetNPC // Set already jacked out marker mov r1,0x99 mov r0,0x1 strb r0,[r5,r1] b @@end @@free: // Free NPC ldr r0,=0x8003B87 mov r14,r15 bx r0 @@end: pop r15 .align 2 // r0 = 0 // r1 = NPC index // r2 = NPC script npc_resetNPC: ldrb r1,[r5,0x10] mov r2,r10 ldr r2,[r2,0x40] ldr r2,[r2,0x34] lsl r0,r1,0x2 ldr r2,[r2,r0] mov r0,0x0 push r0-r2,r14 // Fill with 0x7E mov r0,0x4 add r0,r0,r5 mov r1,0x9C mov r2,0x7E ldr r3,=0x8000991 mov r14,r15 bx r3 pop r0-r2 // Activate NPC strb r0,[r5,0x1] // Set NPC index strb r1,[r5,0x10] // Set NPC script str r2,[r5,0x60] // Initialize vars mov r0,0x0 str r0,[r5,0x8] str r0,[r5,0x54] str r0,[r5,0x5C] strb r0,[r5,0x1F] mov r1,r5 add r1,0x80 str r0,[r1] str r0,[r1,0xC] // Set jacked out marker mov r0,0x1 strb r0,[r1,0x19] @@end: pop r15 .pool .align 4 npc_internet3: .dw 0x8057968 // NPC00 .dw 0x80579E9 // NPC01 .dw 0x8057A1D // NPC02 .dw 0x8057AB5 // NPC03 .dw 0x8057B03 // NPC04 .dw npc_internet3_npc05 // NPC05 .dw npc_internet3_npc06 // NPC06 .dw npc_internet3_npc07 // NPC07 .dw 0x8057BD6 // NPC08 .dw 0x8057C07 // NPC09 .dw 0x8057CCF // NPC10 .dw 0x8057D2C // NPC11 .dw 0x8057D8E // NPC12 .dw 0x8057DF3 // NPC13 .dw npc_internet3_npc14 // NPC14 .dw 0x8057E3C // NPC15 .dw 0x8057E44 // NPC16 .dw 0x8057E4C // NPC17 .dw 0x8057E54 // NPC18 .dw 0x8057E5C // NPC19 .dw 0x8057A84 // Unused NPC 3 // .dw 0x8057C88 // Unused NPC 5 (no text) .dw 0x8057CB1 // Unused NPC 6 // .dw 0x8057CF8 // Unused NPC 7 (no text) .dw 0x00000FF npc_internet3_npc05: // Jump if world time range .db 0x44,0x04, 00,06, 59,17 .dw 0x8057A38 // Unused NPC 1 // Jump .db 0x02 .dw 0x8057B3F // Old NPC05 npc_internet3_npc06: // Jump if world time range .db 0x44,0x04, 00,06, 59,17 .dw 0x8057A5E // Unused NPC 2 // Jump .db 0x02 .dw 0x8057B66 // Old NPC06 npc_internet3_npc07: // Jump if world time range .db 0x44,0x04, 00,18, 59,29 .dw 0x8057D0E // Jump .db 0x02 .dw 0x8057B8D // Old NPC07 npc_internet3_npc14: // Jump if weekday range .db 0x3F,0x0C, 1,5 .dw 0x8057E0E // Jump .db 0x02 .dw 0x8057B19 // Unused NPC 4
bits 16 ; glb intptr_t : int ; glb uintptr_t : unsigned ; glb intmax_t : int ; glb uintmax_t : unsigned ; glb int8_t : signed char ; glb int_least8_t : signed char ; glb int_fast8_t : signed char ; glb uint8_t : unsigned char ; glb uint_least8_t : unsigned char ; glb uint_fast8_t : unsigned char ; glb int16_t : short ; glb int_least16_t : short ; glb int_fast16_t : short ; glb uint16_t : unsigned short ; glb uint_least16_t : unsigned short ; glb uint_fast16_t : unsigned short ; glb int32_t : int ; glb int_least32_t : int ; glb int_fast32_t : int ; glb uint32_t : unsigned ; glb uint_least32_t : unsigned ; glb uint_fast32_t : unsigned ; glb imaxdiv_t : struct <something> ; glb bool_t : int ; glb pointer_t : * unsigned char ; glb funcion_t : * ( ; prm <something> : * void ; ) * void ; glb manejador_t : * (void) void ; glb rti_t : * (void) void ; glb isr_t : * (void) void ; glb handler_t : * (void) void ; glb retardarThread_t : * (void) int ; glb ptrTVI_t : * * (void) void ; glb modoSO1_t : int ; glb lh_t : struct <something> ; glb address_t : struct <something> ; glb uPtrAdr_t : union <something> ; glb pid_t : int ; glb tid_t : int ; glb uid_t : int ; glb gid_t : int ; glb pindx_t : int ; glb tindx_t : int ; glb df_t : int ; glb dfs_t : int ; glb rindx_t : int ; glb pos_t : struct <something> ; RPN'ized expression: "50 " ; Expanded expression: "50 " ; Expression value: 50 ; RPN'ized expression: "80 " ; Expanded expression: "80 " ; Expression value: 80 ; glb pantalla_t : union <something> ; glb tamPantalla : ( ; prm numFilas : unsigned char ; ) unsigned short ; glb pantallazo : ( ; prm pantalla : * union <something> ; prm numFilas : unsigned short ; prm car : char ; prm atr : char ; prm esqSupDeF : unsigned char ; prm esqSupDeC : unsigned char ; prm esqInfIzF : unsigned char ; prm esqInfIzC : unsigned char ; ) void ; glb borrarPantalla : ( ; prm pantalla : * union <something> ; prm numFilas : unsigned short ; ) void ; glb borrarCPantalla : ( ; prm pantalla : * union <something> ; prm numFilas : unsigned short ; ) void ; glb copiarPantalla : ( ; prm p1 : * union <something> ; prm p2 : * union <something> ; prm numFilas : unsigned short ; ) void ; glb copiarCPantalla : ( ; prm p1 : * union <something> ; prm p2 : * union <something> ; prm numFilas : unsigned short ; ) void ; glb scrollPantalla : ( ; prm pantalla : * union <something> ; prm numFilas : unsigned short ; ) void ; glb scrollCPantalla : ( ; prm pantalla : * union <something> ; prm numFilas : unsigned short ; ) void ; glb tipoOrdenador : (void) unsigned char ; glb rebootLegacy : (void) void ; glb tipoTeclado : (void) unsigned char ; glb leerTeclaBIOS : (void) unsigned short ; glb leerTeclaExtBIOS : (void) unsigned short ; glb teclaListaBIOS : (void) unsigned short ; glb leerTeclaListaBDA : (void) unsigned short ; glb teclaListaBDA : (void) unsigned short ; glb printCarBIOS : ( ; prm car : char ; ) int ; glb printCarPagBIOS : ( ; prm car : char ; prm pag : unsigned char ; ) int ; glb printCarAtrPagBIOS : ( ; prm car : char ; prm atr : unsigned char ; prm pag : unsigned char ; ) int ; glb printLnBIOS : (void) int ; glb printStrBIOS : ( ; prm str : * char ; ) int ; glb printStrHastaBIOS : ( ; prm str : * char ; prm n : unsigned short ; prm lleno : int ; ) int ; glb printDecBIOS : ( ; prm num : unsigned short ; prm l : unsigned short ; ) int ; glb printLDecBIOS : ( ; prm num : unsigned ; prm l : unsigned short ; ) int ; glb printIntBIOS : ( ; prm num : short ; prm l : unsigned short ; ) int ; glb printLIntBIOS : ( ; prm num : int ; prm l : unsigned short ; ) int ; glb printHexBIOS : ( ; prm num : unsigned short ; prm l : unsigned short ; ) int ; glb printLHexBIOS : ( ; prm num : unsigned ; prm l : unsigned short ; ) int ; glb printBinBIOS : ( ; prm num : unsigned short ; prm l : unsigned short ; ) int ; glb printLBinBIOS : ( ; prm num : unsigned ; prm l : unsigned short ; ) int ; glb printPtrBIOS : ( ; prm ptr : * unsigned char ; ) int ; glb printByteBIOS : ( ; prm b : unsigned char ; ) int ; glb printWordBIOS : ( ; prm w : unsigned short ; ) int ; glb printCadBIOS : ( ; prm cad : * char ; ) int ; glb esperarTicsBIOS : ( ; prm tics : unsigned short ; ) void ; glb modoDeVideo : (void) unsigned char ; glb establecerModoDeVideo : ( ; prm modo : unsigned char ; ) void ; glb paginaActiva : (void) unsigned char ; glb establecerPaginaActiva : ( ; prm num : unsigned char ; ) void ; glb numPagsVideo : (void) unsigned char ; glb scrollPagBDA : ( ; prm numLineas : unsigned char ; prm pag : unsigned char ; ) void ; glb scrollPagBIOS : ( ; prm numLineas : unsigned char ; prm pag : unsigned char ; ) void ; glb scrollBIOS : ( ; prm numLineas : unsigned char ; ) void ; glb goToXYPag : ( ; prm fila : unsigned char ; prm columna : unsigned char ; prm pag : unsigned char ; ) void ; glb goToXYBIOS : ( ; prm fila : unsigned char ; prm columna : unsigned char ; ) void ; glb setCursorBIOS : ( ; prm linea1 : unsigned char ; prm linea2 : unsigned char ; ) void ; glb ocultaCursorBIOS : (void) void ; glb readXYPagBIOS : ( ; prm fila : * unsigned char ; prm columna : * unsigned char ; prm linea1 : * unsigned char ; prm linea2 : * unsigned char ; prm pag : unsigned char ; ) void ; glb readXYBIOS : ( ; prm fila : * unsigned char ; prm columna : * unsigned char ; prm linea1 : * unsigned char ; prm linea2 : * unsigned char ; ) void ; glb memBIOS : (void) unsigned short ; glb enviarBIOS : ( ; prm car : char ; ) void ; glb recibirBIOS : (void) char ; glb hayApmBIOS : ( ; prm version : * unsigned short ; ) int ; glb connectApmBIOS : (void) int ; glb disconnectApmBIOS : (void) int ; glb cpuIdleBIOS : (void) void ; glb cpuBusyBIOS : (void) void ; glb HWLIST_t : unsigned short ; glb KBDFLAGS_t : unsigned short ; glb KBDSTATUS_t : unsigned short ; glb VIDEOCONTROL_t : unsigned char ; glb DRECSTATUS_t : unsigned char ; glb DMOTORSTATUS_t : unsigned char ; glb FDOPSTATUS_t : unsigned char ; glb VIDEOSWITCHES_t : unsigned char ; glb VGAOPTIONS_t : unsigned char ; glb VIDEOSAVETBL_t : struct <something> ; RPN'ized expression: "4 " ; Expanded expression: "4 " ; Expression value: 4 ; RPN'ized expression: "25 " ; Expanded expression: "25 " ; Expression value: 25 ; RPN'ized expression: "20 " ; Expanded expression: "20 " ; Expression value: 20 ; RPN'ized expression: "9 " ; Expanded expression: "9 " ; Expression value: 9 ; glb VIDEOPARAM_t : struct <something> ; RPN'ized expression: "256 " ; Expanded expression: "256 " ; Expression value: 256 ; RPN'ized expression: "4 " ; Expanded expression: "4 " ; Expression value: 4 ; RPN'ized expression: "3 " ; Expanded expression: "3 " ; Expression value: 3 ; RPN'ized expression: "16 " ; Expanded expression: "16 " ; Expression value: 16 ; RPN'ized expression: "7 " ; Expanded expression: "7 " ; Expression value: 7 ; RPN'ized expression: "8 " ; Expanded expression: "8 " ; Expression value: 8 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "5 " ; Expanded expression: "5 " ; Expression value: 5 ; RPN'ized expression: "2 " ; Expanded expression: "2 " ; Expression value: 2 ; RPN'ized expression: "3 " ; Expanded expression: "3 " ; Expression value: 3 ; RPN'ized expression: "4 " ; Expanded expression: "4 " ; Expression value: 4 ; RPN'ized expression: "11 " ; Expanded expression: "11 " ; Expression value: 11 ; RPN'ized expression: "7 " ; Expanded expression: "7 " ; Expression value: 7 ; RPN'ized expression: "68 " ; Expanded expression: "68 " ; Expression value: 68 ; RPN'ized expression: "16 " ; Expanded expression: "16 " ; Expression value: 16 ; glb BIOSAREA_t : struct <something> ; glb ptrBiosArea : * struct <something> ; glb ptrFechaBios : * unsigned char ; glb ptrPant : * union <something> section .bss alignb 4 _ptrPant: resb 4 ; glb cursorOriginalF : unsigned char section .bss _cursorOriginalF: resb 1 ; glb cursorOriginalC : unsigned char section .bss _cursorOriginalC: resb 1 ; glb lineaOriginal1 : unsigned char section .bss _lineaOriginal1: resb 1 ; glb lineaOriginal2 : unsigned char section .bss _lineaOriginal2: resb 1 ; glb VIDEO_mode : unsigned char section .bss _VIDEO_mode: resb 1 ; glb copiaDeLaPantallaOriginal : * union <something> section .bss alignb 4 _copiaDeLaPantallaOriginal: resb 4 ; glb segMemVideo : unsigned short section .bss alignb 4 _segMemVideo: resb 2 ; glb salvarPantallaInicial : (void) void section .text global _salvarPantallaInicial _salvarPantallaInicial: push ebp movzx ebp, sp sub sp, 8 ; loc F : (@-4): unsigned char ; loc C : (@-8): unsigned char ; RPN'ized expression: "( lineaOriginal2 &u , lineaOriginal1 &u , cursorOriginalC &u , cursorOriginalF &u readXYBIOS ) " ; Expanded expression: " lineaOriginal2 lineaOriginal1 cursorOriginalC cursorOriginalF readXYBIOS ()16 " ; Fused expression: "( lineaOriginal2 , lineaOriginal1 , cursorOriginalC , cursorOriginalF , readXYBIOS )16 " section .relod dd L3 section .text db 0x66, 0x68 L3: dd _lineaOriginal2 section .relod dd L4 section .text db 0x66, 0x68 L4: dd _lineaOriginal1 section .relod dd L5 section .text db 0x66, 0x68 L5: dd _cursorOriginalC section .relod dd L6 section .text db 0x66, 0x68 L6: dd _cursorOriginalF db 0x9A section .relot dd L7 section .text L7: dd _readXYBIOS sub sp, -16 ; RPN'ized expression: "VIDEO_mode ptrBiosArea VIDEO_mode -> *u = " ; Expanded expression: "VIDEO_mode ptrBiosArea *(4) 1097 + *(1) =(1) " ; Fused expression: "VIDEO_mode push-ax ptrBiosArea + *ax 1097 =(153) **sp *ax " section .relod dd L8 section .text db 0x66, 0xB8 L8: dd _VIDEO_mode push eax section .relod dd L9 section .text db 0x66, 0xB8 L9: dd _ptrBiosArea mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov eax, [si] add eax, 1097 mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov al, [si] movzx eax, al pop ebx mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movzx eax, al ; if ; RPN'ized expression: "VIDEO_mode 7 != " ; Expanded expression: "VIDEO_mode *(1) 7 != " ; Fused expression: "VIDEO_mode != *ax 7 IF! " section .relod dd L12 section .text db 0x66, 0xB8 L12: dd _VIDEO_mode mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov al, [si] movzx eax, al cmp eax, 7 je L10 ; RPN'ized expression: "segMemVideo 47104 = " ; Expanded expression: "segMemVideo 47104 =(2) " ; Fused expression: "segMemVideo =(172) *ax 47104 " section .relod dd L13 section .text db 0x66, 0xB8 L13: dd _segMemVideo mov ebx, eax mov eax, 47104 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], ax movzx eax, ax jmp L11 L10: ; else ; RPN'ized expression: "segMemVideo 45056 = " ; Expanded expression: "segMemVideo 45056 =(2) " ; Fused expression: "segMemVideo =(172) *ax 45056 " section .relod dd L14 section .text db 0x66, 0xB8 L14: dd _segMemVideo mov ebx, eax mov eax, 45056 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], ax movzx eax, ax L11: ; loc <something> : * union <something> ; RPN'ized expression: "ptrPant segMemVideo 4 << (something15) = " ; Expanded expression: "ptrPant segMemVideo *(2) 4 << =(4) " ; Fused expression: "ptrPant push-ax segMemVideo << *ax 4 =(204) **sp ax " section .relod dd L16 section .text db 0x66, 0xB8 L16: dd _ptrPant push eax section .relod dd L17 section .text db 0x66, 0xB8 L17: dd _segMemVideo mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov ax, [si] movzx eax, ax shl eax, 4 pop ebx mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; loc <something> : * union <something> ; RPN'ized expression: "copiaDeLaPantallaOriginal ptrPant t -> *u 50 + *u 0 + *u &u (something18) = " ; Expanded expression: "copiaDeLaPantallaOriginal ptrPant *(4) 8000 + =(4) " ; Fused expression: "copiaDeLaPantallaOriginal push-ax ptrPant + *ax 8000 =(204) **sp ax " section .relod dd L19 section .text db 0x66, 0xB8 L19: dd _copiaDeLaPantallaOriginal push eax section .relod dd L20 section .text db 0x66, 0xB8 L20: dd _ptrPant mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov eax, [si] add eax, 8000 pop ebx mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], eax ; RPN'ized expression: "( 50 , copiaDeLaPantallaOriginal , ptrPant copiarPantalla ) " ; Expanded expression: " 50 copiaDeLaPantallaOriginal *(4) ptrPant *(4) copiarPantalla ()12 " ; Fused expression: "( 50 , copiaDeLaPantallaOriginal *(4) ax , ptrPant *(4) ax , copiarPantalla )12 " push dword 50 section .relod dd L21 section .text db 0x66, 0xB8 L21: dd _copiaDeLaPantallaOriginal mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 push dword [si] section .relod dd L22 section .text db 0x66, 0xB8 L22: dd _ptrPant mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 push dword [si] db 0x9A section .relot dd L23 section .text L23: dd _copiarPantalla sub sp, -12 ; for ; RPN'ized expression: "F 0 = " ; Expanded expression: "(@-4) 0 =(1) " ; Fused expression: "=(156) *(@-4) 0 " mov eax, 0 mov [bp-4], al movzx eax, al L24: ; RPN'ized expression: "F 50 < " ; Expanded expression: "(@-4) *(1) 50 < " ; Fused expression: "< *(@-4) 50 IF! " mov al, [bp-4] movzx eax, al cmp eax, 50 jge L27 ; RPN'ized expression: "F ++p " ; Expanded expression: "(@-4) ++p(1) " ; for ; RPN'ized expression: "C 0 = " ; Expanded expression: "(@-8) 0 =(1) " ; Fused expression: "=(156) *(@-8) 0 " mov eax, 0 mov [bp-8], al movzx eax, al L28: ; RPN'ized expression: "C 80 < " ; Expanded expression: "(@-8) *(1) 80 < " ; Fused expression: "< *(@-8) 80 IF! " mov al, [bp-8] movzx eax, al cmp eax, 80 jge L31 ; RPN'ized expression: "C ++p " ; Expanded expression: "(@-8) ++p(1) " ; RPN'ized expression: "ptrPant t -> *u F + *u C + *u &u atr -> *u 7 = " ; Expanded expression: "ptrPant *(4) 0 + (@-4) *(1) 160 * + (@-8) *(1) 2 * + 1 + 7 =(1) " ; Fused expression: "ptrPant + *ax 0 push-ax * *(@-4) 160 + *sp ax push-ax * *(@-8) 2 + *sp ax + ax 1 =(156) *ax 7 " section .relod dd L32 section .text db 0x66, 0xB8 L32: dd _ptrPant mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov eax, [si] push eax mov al, [bp-4] movzx eax, al imul eax, eax, 160 mov ecx, eax pop eax add eax, ecx push eax mov al, [bp-8] movzx eax, al imul eax, eax, 2 mov ecx, eax pop eax add eax, ecx inc eax mov ebx, eax mov eax, 7 mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov [si], al movzx eax, al L29: ; Fused expression: "++p(1) *(@-8) " mov al, [bp-8] movzx eax, al inc byte [bp-8] jmp L28 L31: L25: ; Fused expression: "++p(1) *(@-4) " mov al, [bp-4] movzx eax, al inc byte [bp-4] jmp L24 L27: L1: db 0x66 leave retf L33: section .fxnsz noalloc dd L33 - _salvarPantallaInicial ; glb restaurarPantallaInicial : (void) void section .text global _restaurarPantallaInicial _restaurarPantallaInicial: push ebp movzx ebp, sp ;sub sp, 0 ; RPN'ized expression: "( 50 , ptrPant , copiaDeLaPantallaOriginal copiarPantalla ) " ; Expanded expression: " 50 ptrPant *(4) copiaDeLaPantallaOriginal *(4) copiarPantalla ()12 " ; Fused expression: "( 50 , ptrPant *(4) ax , copiaDeLaPantallaOriginal *(4) ax , copiarPantalla )12 " push dword 50 section .relod dd L36 section .text db 0x66, 0xB8 L36: dd _ptrPant mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 push dword [si] section .relod dd L37 section .text db 0x66, 0xB8 L37: dd _copiaDeLaPantallaOriginal mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 push dword [si] db 0x9A section .relot dd L38 section .text L38: dd _copiarPantalla sub sp, -12 ; RPN'ized expression: "( cursorOriginalC , cursorOriginalF goToXYBIOS ) " ; Expanded expression: " cursorOriginalC *(1) cursorOriginalF *(1) goToXYBIOS ()8 " ; Fused expression: "( cursorOriginalC *(1) ax , cursorOriginalF *(1) ax , goToXYBIOS )8 " section .relod dd L39 section .text db 0x66, 0xB8 L39: dd _cursorOriginalC mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov al, [si] movzx eax, al push eax section .relod dd L40 section .text db 0x66, 0xB8 L40: dd _cursorOriginalF mov ebx, eax mov esi, ebx ror esi, 4 mov ds, si shr esi, 28 mov al, [si] movzx eax, al push eax db 0x9A section .relot dd L41 section .text L41: dd _goToXYBIOS sub sp, -8 L34: db 0x66 leave retf L42: section .fxnsz dd L42 - _restaurarPantallaInicial extern _readXYBIOS extern _ptrBiosArea extern _copiarPantalla extern _goToXYBIOS ; Syntax/declaration table/stack: ; Bytes used: 5160/40960 ; Macro table: ; Macro __SMALLER_C__ = `0x0100` ; Macro __SMALLER_C_32__ = `` ; Macro __HUGE__ = `` ; Macro __SMALLER_C_SCHAR__ = `` ; Bytes used: 74/5120 ; Identifier table: ; Ident __floatsisf ; Ident __floatunsisf ; Ident __fixsfsi ; Ident __fixunssfsi ; Ident __addsf3 ; Ident __subsf3 ; Ident __negsf2 ; Ident __mulsf3 ; Ident __divsf3 ; Ident __lesf2 ; Ident __gesf2 ; Ident intptr_t ; Ident uintptr_t ; Ident intmax_t ; Ident uintmax_t ; Ident int8_t ; Ident int_least8_t ; Ident int_fast8_t ; Ident uint8_t ; Ident uint_least8_t ; Ident uint_fast8_t ; Ident int16_t ; Ident int_least16_t ; Ident int_fast16_t ; Ident uint16_t ; Ident uint_least16_t ; Ident uint_fast16_t ; Ident int32_t ; Ident int_least32_t ; Ident int_fast32_t ; Ident uint32_t ; Ident uint_least32_t ; Ident uint_fast32_t ; Ident <something> ; Ident quot ; Ident rem ; Ident imaxdiv_t ; Ident FALSE ; Ident TRUE ; Ident bool_t ; Ident pointer_t ; Ident funcion_t ; Ident manejador_t ; Ident rti_t ; Ident isr_t ; Ident handler_t ; Ident retardarThread_t ; Ident ptrTVI_t ; Ident modoSO1_Bin ; Ident modoSO1_Exe ; Ident modoSO1_Bs ; Ident modoSO1_t ; Ident lo ; Ident hi ; Ident lh_t ; Ident offset ; Ident segment ; Ident address_t ; Ident ptr ; Ident adr ; Ident uPtrAdr_t ; Ident pid_t ; Ident tid_t ; Ident uid_t ; Ident gid_t ; Ident pindx_t ; Ident tindx_t ; Ident df_t ; Ident dfs_t ; Ident rindx_t ; Ident car ; Ident atr ; Ident pos_t ; Ident t ; Ident pantalla_t ; Ident tamPantalla ; Ident numFilas ; Ident pantallazo ; Ident pantalla ; Ident esqSupDeF ; Ident esqSupDeC ; Ident esqInfIzF ; Ident esqInfIzC ; Ident borrarPantalla ; Ident borrarCPantalla ; Ident copiarPantalla ; Ident p1 ; Ident p2 ; Ident copiarCPantalla ; Ident scrollPantalla ; Ident scrollCPantalla ; Ident tipoOrdenador ; Ident rebootLegacy ; Ident tipoTeclado ; Ident leerTeclaBIOS ; Ident leerTeclaExtBIOS ; Ident teclaListaBIOS ; Ident leerTeclaListaBDA ; Ident teclaListaBDA ; Ident printCarBIOS ; Ident printCarPagBIOS ; Ident pag ; Ident printCarAtrPagBIOS ; Ident printLnBIOS ; Ident printStrBIOS ; Ident str ; Ident printStrHastaBIOS ; Ident n ; Ident lleno ; Ident printDecBIOS ; Ident num ; Ident l ; Ident printLDecBIOS ; Ident printIntBIOS ; Ident printLIntBIOS ; Ident printHexBIOS ; Ident printLHexBIOS ; Ident printBinBIOS ; Ident printLBinBIOS ; Ident printPtrBIOS ; Ident printByteBIOS ; Ident b ; Ident printWordBIOS ; Ident w ; Ident printCadBIOS ; Ident cad ; Ident esperarTicsBIOS ; Ident tics ; Ident modoDeVideo ; Ident establecerModoDeVideo ; Ident modo ; Ident paginaActiva ; Ident establecerPaginaActiva ; Ident numPagsVideo ; Ident scrollPagBDA ; Ident numLineas ; Ident scrollPagBIOS ; Ident scrollBIOS ; Ident goToXYPag ; Ident fila ; Ident columna ; Ident goToXYBIOS ; Ident setCursorBIOS ; Ident linea1 ; Ident linea2 ; Ident ocultaCursorBIOS ; Ident readXYPagBIOS ; Ident readXYBIOS ; Ident memBIOS ; Ident enviarBIOS ; Ident recibirBIOS ; Ident hayApmBIOS ; Ident version ; Ident connectApmBIOS ; Ident disconnectApmBIOS ; Ident cpuIdleBIOS ; Ident cpuBusyBIOS ; Ident HWLIST_t ; Ident KBDFLAGS_t ; Ident KBDSTATUS_t ; Ident VIDEOCONTROL_t ; Ident DRECSTATUS_t ; Ident DMOTORSTATUS_t ; Ident FDOPSTATUS_t ; Ident VIDEOSWITCHES_t ; Ident VGAOPTIONS_t ; Ident VIDEO_paramtbl ; Ident VIDEO_dynsavearea ; Ident VIDEO_text_charset ; Ident VIDEO_graph_charset ; Ident VIDEO_savetbl2 ; Ident VIDEOSAVETBL_t ; Ident VPARAM_width ; Ident VPARAM_height ; Ident VPARAM_hchar ; Ident VPARAM_pagesize ; Ident VPARAM_SEQC ; Ident VPARAM_MISC ; Ident VPARAM_CRTC ; Ident VPARAM_ATC ; Ident VPARAM_GRC ; Ident VIDEOPARAM_t ; Ident IVT ; Ident COM_base ; Ident LPT_base ; Ident XBDA_seg ; Ident HW_list ; Ident relleno1 ; Ident basemem_K ; Ident relleno2 ; Ident KBD_flags ; Ident relleno3 ; Ident KBD_bufhead ; Ident KBD_buftail ; Ident KBD_buffer ; Ident dRecStatus ; Ident dMotorStatus ; Ident motorShutoffCounter ; Ident fdOpStatus ; Ident relleno4 ; Ident VIDEO_mode ; Ident VIDEO_width ; Ident VIDEO_pagesize ; Ident VIDEO_pageoff ; Ident CURSOR_pos ; Ident CURSOR_shape ; Ident VIDEO_pagActiva ; Ident CRTC_base ; Ident CRT_MODE ; Ident CRT_PALETTE ; Ident relleno5 ; Ident BIOS_timer ; Ident BIOS_overflow ; Ident BIOS_ctrlbreak ; Ident BIOS_POSTreset ; Ident relleno6 ; Ident BIOS_HD_cnt ; Ident relleno7 ; Ident LPT_timeout ; Ident BIOS_4B_flags ; Ident COM_timeout ; Ident KBD_start ; Ident KBD_end1 ; Ident VIDEO_lastrow ; Ident VIDEO_hchar ; Ident VIDEO_control ; Ident VIDEO_switches ; Ident VGA_options ; Ident VGA_DCC_index ; Ident relleno8 ; Ident KBD_status ; Ident TIMER_waitflag ; Ident TIMER_waitmks ; Ident TIMER_active ; Ident relleno9 ; Ident VIDEO_ptrtable ; Ident relleno10 ; Ident IAC ; Ident BIOSAREA_t ; Ident ptrBiosArea ; Ident ptrFechaBios ; Ident ptrPant ; Ident cursorOriginalF ; Ident cursorOriginalC ; Ident lineaOriginal1 ; Ident lineaOriginal2 ; Ident copiaDeLaPantallaOriginal ; Ident segMemVideo ; Ident salvarPantallaInicial ; Ident restaurarPantallaInicial ; Bytes used: 3050/16384 ; Next label number: 43 ; Compilation succeeded.
#include "../../common/CLog.h" #include "../uo_files/CUOTerrainInfo.h" #include "../CWorld.h" #include "CChar.h" #include <cmath> bool CChar::CanSeeLOS( const CPointMap &ptDst, CPointMap *pptBlock, int iMaxDist, word wFlags, bool bCombatCheck ) const { ADDTOCALLSTACK("CChar::CanSeeLOS"); // WARNING: CanSeeLOS is an expensive function (lot of calculations but most importantly it has to read the UO files, and file I/O is slow). if ( (m_pPlayer && (g_Cfg.m_iAdvancedLos & ADVANCEDLOS_PLAYER)) || (m_pNPC && (g_Cfg.m_iAdvancedLos & ADVANCEDLOS_NPC)) ) return CanSeeLOS_New(ptDst, pptBlock, iMaxDist, wFlags); // Max distance of iMaxDist // Line of sight check // NOTE: if not blocked. pptBlock is undefined. // 3D LOS later - real LOS, i.e. we can't shoot through the floor, but can shoot through the hole in it if ( !bCombatCheck && IsPriv(PRIV_GM) ) // If i'm checking the LOS during a combat, i don't want to shoot through the walls even if i'm a GM return true; CPointMap ptSrc = GetTopPoint(); int iDist = ptSrc.GetDist(ptDst); if ( iDist > iMaxDist ) { blocked: if ( pptBlock ) *pptBlock = ptSrc; return false; // blocked } // Walk towards the object. If any spot is too far above our heads then we can not see what's behind it. int iDistTry = 0; while ( --iDist >= 0 ) { DIR_TYPE dir = ptSrc.GetDir(ptDst); dword dwBlockFlags; if ( dir % 2 && !IsSetEF(EF_NoDiagonalCheckLOS) ) // test only diagonal dirs { CPointMap ptTest = ptSrc; DIR_TYPE dirTest1 = (DIR_TYPE)(dir - 1); // get 1st ortogonal DIR_TYPE dirTest2 = (DIR_TYPE)(dir + 1); // get 2nd ortogonal if ( dirTest2 == DIR_QTY ) // roll over dirTest2 = DIR_N; ptTest.Move(dirTest1); dwBlockFlags = CAN_C_SWIM|CAN_C_WALK|CAN_C_FLY; char z = g_World.GetHeightPoint2(ptTest, dwBlockFlags, true); short zDiff = (short)(abs(z - ptTest.m_z)); if ( (zDiff > PLAYER_HEIGHT) || (dwBlockFlags & (CAN_I_BLOCK|CAN_I_DOOR)) ) // blocked { ptTest = ptSrc; ptTest.Move(dirTest2); { dwBlockFlags = CAN_C_SWIM|CAN_C_WALK|CAN_C_FLY; z = g_World.GetHeightPoint2(ptTest, dwBlockFlags, true); zDiff = (short)(abs(z - ptTest.m_z)); if ( zDiff > PLAYER_HEIGHT ) goto blocked; if ( dwBlockFlags & (CAN_I_BLOCK|CAN_I_DOOR) ) { ptSrc = ptTest; goto blocked; } } } ptTest.m_z = z; } if ( iDist ) { ptSrc.Move(dir); // NOTE: The dir is very coarse and can change slightly. dwBlockFlags = CAN_C_SWIM|CAN_C_WALK|CAN_C_FLY; char z = g_World.GetHeightPoint2(ptSrc, dwBlockFlags, true); short zDiff = (short)(abs(z - ptSrc.m_z)); if ( (zDiff > PLAYER_HEIGHT) || (dwBlockFlags & (CAN_I_BLOCK|CAN_I_DOOR)) || (iDistTry > iMaxDist) ) goto blocked; ptSrc.m_z = z; ++iDistTry; } } if ( abs(ptSrc.m_z - ptDst.m_z) >= 20 ) return false; return true; // made it all the way to the object with no obstructions. } // a - gradient < x < b + gradient #define BETWEENPOINT(coord, coordt, coords) ( (coord > ((float)minimum(coordt, coords) - 0.5)) && (coord < ((float)maximum(coordt, coords) + 0.5)) ) #define APPROX(num) ( (float)((num - floor(num)) > 0.5) ? ceil(num) : floor(num) ) //#define CALCITEMHEIGHT(num) num + ((pItemDef->GetTFlags() & 0x400)? pItemDef->GetHeight() / 2 : pItemDef->GetHeight()) #define WARNLOS(_x_) if ( g_Cfg.m_iDebugFlags & DEBUGF_LOS ) { g_Log.EventWarn _x_; } bool CChar::CanSeeLOS_New_Failed( CPointMap *pptBlock, const CPointMap &ptNow ) const { ADDTOCALLSTACK("CChar::CanSeeLOS_New_Failed"); if ( pptBlock ) *pptBlock = ptNow; return false; } bool CChar::CanSeeLOS_New( const CPointMap &ptDst, CPointMap *pptBlock, int iMaxDist, word flags, bool bCombatCheck ) const { ADDTOCALLSTACK("CChar::CanSeeLOS_New"); // WARNING: CanSeeLOS is an expensive function (lot of calculations but most importantly it has to read the UO files, and file I/O is slow). if ( !bCombatCheck && IsPriv(PRIV_GM) ) // If i'm checking the LOS during a combat, i don't want to shoot through the walls even if i'm a GM { WARNLOS(("GM Pass\n")); return true; } CPointMap ptSrc = GetTopPoint(); CPointMap ptNow(ptSrc); if ( ptSrc.m_map != ptDst.m_map ) // Different map return this->CanSeeLOS_New_Failed(pptBlock, ptNow); if ( ptSrc == ptDst ) // Same point ^^ return true; short iTotalZ = ptSrc.m_z + GetHeightMount(true); ptSrc.m_z = (char)minimum(iTotalZ, UO_SIZE_Z); //true - substract one from the height because of eyes height WARNLOS(("Total Z: %d\n", ptSrc.m_z)); int dx, dy, dz; dx = ptDst.m_x - ptSrc.m_x; dy = ptDst.m_y - ptSrc.m_y; dz = ptDst.m_z - ptSrc.m_z; float dist2d, dist3d; dist2d = sqrt((float)(dx*dx + dy*dy)); if ( dz ) dist3d = sqrt((float)(dist2d*dist2d + dz*dz)); else dist3d = dist2d; if ( APPROX(dist2d) > (float)iMaxDist ) { WARNLOS(("( APPROX(dist2d)(%f) > ((double)iMaxDist)(%f) ) --> NOLOS\n", APPROX(dist2d), (float)iMaxDist)); return CanSeeLOS_New_Failed(pptBlock, ptNow); } float dFactorX, dFactorY, dFactorZ; dFactorX = dx / dist3d; dFactorY = dy / dist3d; dFactorZ = dz / dist3d; float nPx, nPy, nPz; nPx = ptSrc.m_x; nPy = ptSrc.m_y; nPz = ptSrc.m_z; std::vector<CPointMap> path; for (;;) { if ( BETWEENPOINT(nPx, ptDst.m_x, ptSrc.m_x) && BETWEENPOINT(nPy, ptDst.m_y, ptSrc.m_y) && BETWEENPOINT(nPz, ptDst.m_z, ptSrc.m_z) ) { dx = (int)APPROX(nPx); dy = (int)APPROX(nPy); dz = (int)APPROX(nPz); // Add point to vector if ( !path.empty() ) { CPointMap ptEnd = path[path.size() - 1]; if ( ptEnd.m_x != dx || ptEnd.m_y != dy || ptEnd.m_z != dz ) path.emplace_back((word)dx, (word)dy, (char)dz, ptSrc.m_map); } else { path.emplace_back((word)dx, (word)dy, (char)dz, ptSrc.m_map); } WARNLOS(("PATH X:%d Y:%d Z:%d\n", dx, dy, dz)); nPx += dFactorX; nPy += dFactorY; nPz += dFactorZ; } else break; } if ( !path.empty() ) { if ( path[path.size() - 1] != ptDst ) path.emplace_back(ptDst.m_x, ptDst.m_y, ptDst.m_z, ptDst.m_map); } else { path.clear(); return CanSeeLOS_New_Failed(pptBlock, ptNow); } WARNLOS(("Path calculated %" PRIuSIZE_T "\n", path.size())); // Ok now we should loop through all the points and checking for maptile, staticx, items, multis. // If something is in the way and it has the wrong flags LOS return false const CServerMapBlock *pBlock = nullptr; // Block of the map (for statics) const CUOStaticItemRec *pStatic = nullptr; // Statics iterator (based on SphereMapBlock) const CSphereMulti *pMulti = nullptr; // Multi Def (multi check) const CUOMultiItemRec_HS *pMultiItem = nullptr; // Multi item iterator CRegion *pRegion = nullptr; // Nulti regions CRegionLinks rlinks; // Links to multi regions CItem *pItem = nullptr; CItemBase *pItemDef = nullptr; CItemBaseDupe *pDupeDef = nullptr; uint64 qwTFlags = 0; height_t Height = 0; word terrainid = 0; bool bPath = true; bool bNullTerrain = false; CRegion *pSrcRegion = ptSrc.GetRegion(REGION_TYPE_AREA|REGION_TYPE_ROOM|REGION_TYPE_MULTI); CRegion *pNowRegion = nullptr; int lp_x = 0, lp_y = 0; short min_z = 0, max_z = 0; for (uint i = 0, pathSize = uint(path.size()); i < pathSize; lp_x = ptNow.m_x, lp_y = ptNow.m_y, pItemDef = nullptr, pStatic = nullptr, pMulti = nullptr, pMultiItem = nullptr, min_z = 0, max_z = 0, ++i ) { ptNow = path[i]; WARNLOS(("---------------------------------------------\n")); WARNLOS(("Point %d,%d,%d \n", ptNow.m_x, ptNow.m_y, ptNow.m_z)); pNowRegion = ptNow.GetRegion(REGION_TYPE_AREA|REGION_TYPE_ROOM|REGION_TYPE_MULTI); if ( (flags & LOS_NO_OTHER_REGION) && (pSrcRegion != pNowRegion) ) { WARNLOS(("flags & 0200 and path is leaving my region - BLOCK\n")); bPath = false; break; } if ( (flags & LOS_NC_MULTI) && ptNow.GetRegion(REGION_TYPE_MULTI) && (ptNow.GetRegion(REGION_TYPE_MULTI) != ptSrc.GetRegion(REGION_TYPE_MULTI)) ) { WARNLOS(("flags & 0400 and path is crossing another multi - BLOCK\n")); bPath = false; break; } if ( (lp_x != ptNow.m_x) || (lp_y != ptNow.m_y) ) { WARNLOS(("\tLoading new map block.\n")); pBlock = g_World.GetMapBlock(ptNow); } if ( !pBlock ) // something is wrong { WARNLOS(("GetMapBlock Failed\n")); bPath = false; break; } if ( !(flags & LOS_NB_TERRAIN) ) { if ( !((flags & LOS_NB_LOCAL_TERRAIN) && (pSrcRegion == pNowRegion)) ) { // ------ MapX.mul Check ---------- terrainid = pBlock->GetTerrain(UO_BLOCK_OFFSET(ptNow.m_x), UO_BLOCK_OFFSET(ptNow.m_y))->m_wTerrainIndex; WARNLOS(("Terrain %d\n", terrainid)); if ( (flags & LOS_FISHING) && (ptSrc.GetDist(ptNow) >= 2) && (g_World.GetTerrainItemType(terrainid) != IT_WATER) && (g_World.GetTerrainItemType(terrainid) != IT_NORMAL) ) { WARNLOS(("Terrain %d blocked - flags & LOS_FISHING, distance >= 2 and type of pItemDef is not IT_WATER\n", terrainid)); WARNLOS(("ptSrc: %d,%d,%d; ptNow: %d,%d,%d; terrainid: %d; terrainid type: %d\n", ptSrc.m_x, ptSrc.m_y, ptSrc.m_z, ptNow.m_x, ptNow.m_y, ptNow.m_z, terrainid, g_World.GetTerrainItemType(terrainid))); bPath = false; break; } //#define MAPTILEMIN minimum(minimum(minimum(pBlock->GetTerrain(0,0)->m_z, pBlock->GetTerrain(0,1)->m_z), pBlock->GetTerrain(1,0)->m_z), pBlock->GetTerrain(1,1)->m_z) //#define MAPTILEMAX maximum(maximum(maximum(pBlock->GetTerrain(0,0)->m_z, pBlock->GetTerrain(0,1)->m_z), pBlock->GetTerrain(1,0)->m_z), pBlock->GetTerrain(1,1)->m_z); //#define MAPTILEZ pBlock->GetTerrain(UO_BLOCK_OFFSET(ptNow.m_x), UO_BLOCK_OFFSET(ptNow.m_y))->m_z; if ( (terrainid != TERRAIN_HOLE) && (terrainid != 475) ) { if ( terrainid < 430 || terrainid > 437 ) { /*this stuff should do some checking for surrounding items: aaa aXa aaa min_z is determined as a minimum of all a/X terrain, where X is ptNow */ byte pos_x = UO_BLOCK_OFFSET(ptNow.m_x) > 1 ? UO_BLOCK_OFFSET(ptNow.m_x - 1) : 0; byte pos_y = UO_BLOCK_OFFSET(ptNow.m_y) > 1 ? UO_BLOCK_OFFSET(ptNow.m_y - 1) : 0; const byte defx = UO_BLOCK_OFFSET(ptNow.m_x); const byte defy = UO_BLOCK_OFFSET(ptNow.m_y); min_z = pBlock->GetTerrain(pos_x, pos_y)->m_z; max_z = pBlock->GetTerrain(defx, defy)->m_z; for ( byte posy = pos_y; (abs(defx - UO_BLOCK_OFFSET(pos_x)) <= 1 && pos_x <= 7); ++pos_x ) { for ( pos_y = posy; (abs(defy - UO_BLOCK_OFFSET(pos_y)) <= 1 && pos_y <= 7); ++pos_y ) { char terrain_z = pBlock->GetTerrain(pos_x, pos_y)->m_z; min_z = minimum(min_z, terrain_z); } } //min_z = MAPTILEZ; //max_z = MAPTILEZ; WARNLOS(("Terrain %d - m:%d M:%d\n", terrainid, min_z, max_z)); if ( CUOMapMeter::IsTerrainNull(terrainid) ) bNullTerrain = true; //what if there are some items on that hole? if ( (min_z <= ptNow.m_z && max_z >= ptNow.m_z) && (ptNow.m_x != ptDst.m_x || ptNow.m_y != ptDst.m_y || min_z > ptDst.m_z || max_z < ptDst.m_z) ) { WARNLOS(("Terrain %d - m:%d M:%d - block\n", terrainid, min_z, max_z)); bPath = false; break; } CUOTerrainInfo land(terrainid); if ( (land.m_flags & UFLAG1_WATER) && (flags & LOS_NC_WATER) ) bNullTerrain = true; } } //#undef MAPTILEMIN //#undef MAPTILEMAX //#undef MAPTILEZ } } // ------ StaticsX.mul Check -------- if ( !(flags & LOS_NB_STATIC) ) { if ( !((flags & LOS_NB_LOCAL_STATIC) && (pSrcRegion == pNowRegion)) ) { uint uiStaticMaxQty = pBlock->m_Statics.GetStaticQty(); for ( uint s = 0; s < uiStaticMaxQty; pStatic = nullptr, pItemDef = nullptr, ++s ) { pStatic = pBlock->m_Statics.GetStatic(s); if ( (pStatic->m_x + pBlock->m_x != ptNow.m_x) || (pStatic->m_y + pBlock->m_y != ptNow.m_y) ) continue; //Fix for Stacked items blocking view if ( (pStatic->m_x == ptDst.m_x) && (pStatic->m_y == ptDst.m_y) && (pStatic->m_z >= GetTopZ()) && (pStatic->m_z <= ptSrc.m_z) ) continue; pItemDef = CItemBase::FindItemBase(pStatic->GetDispID()); qwTFlags = 0; Height = 0; bNullTerrain = false; if ( !pItemDef ) { WARNLOS(("STATIC - Cannot get pItemDef for item (0%x)\n", pStatic->GetDispID())); } else { if (pItemDef->Can(CAN_I_BLOCKLOS)) { WARNLOS(("pStatic blocked by CAN_I_BLOCKLOS")); bPath = false; break; } if ( (flags & LOS_FISHING) && (ptSrc.GetDist(ptNow) >= 2) && (pItemDef->GetType() != IT_WATER) && ( pItemDef->Can(CAN_I_DOOR | CAN_I_PLATFORM | CAN_I_BLOCK | CAN_I_CLIMB | CAN_I_FIRE | CAN_I_ROOF | CAN_I_BLOCKLOS | CAN_I_BLOCKLOS_HEIGHT)) ) { WARNLOS(("pStatic blocked - flags & 0800, distance >= 2 and type of pItemDef is not IT_WATER\n")); bPath = false; break; } qwTFlags = pItemDef->GetTFlags(); Height = pItemDef->GetHeight(); if ( pItemDef->GetID() != pStatic->GetDispID() ) //not a parent item { WARNLOS(("Not a parent item (STATIC)\n")); pDupeDef = CItemBaseDupe::GetDupeRef((ITEMID_TYPE)(pStatic->GetDispID())); if ( !pDupeDef ) { g_Log.EventDebug("AdvancedLoS: Failed to get non-parent reference (static) (DispID 0%x) (X: %d Y: %d Z: %hhd M: %hhu)\n", pStatic->GetDispID(), ptNow.m_x, ptNow.m_y, pStatic->m_z, ptNow.m_map); } else { qwTFlags = pDupeDef->GetTFlags(); Height = pDupeDef->GetHeight(); } } else { WARNLOS(("Parent item (STATIC)\n")); } Height = (qwTFlags & UFLAG2_CLIMBABLE) ? Height / 2 : Height; if ( ((qwTFlags & (UFLAG1_WALL|UFLAG1_BLOCK|UFLAG2_PLATFORM)) || (pItemDef->Can(CAN_I_BLOCKLOS_HEIGHT))) && !((qwTFlags & UFLAG2_WINDOW) && (flags & LOS_NB_WINDOWS)) ) { WARNLOS(("pStatic %0x %d,%d,%d - %d\n", pStatic->GetDispID(), pStatic->m_x, pStatic->m_y, pStatic->m_z, Height)); min_z = pStatic->m_z; max_z = minimum(Height + min_z, UO_SIZE_Z); WARNLOS(("qwTFlags(0%x)\n", qwTFlags)); WARNLOS(("pStatic %0x Z check: %d,%d (Now: %d) (Dest: %d).\n", pStatic->GetDispID(), min_z, max_z, ptNow.m_z, ptDst.m_z)); if ( (min_z <= ptNow.m_z) && (max_z >= ptNow.m_z) ) { if ( ptNow.m_x != ptDst.m_x || ptNow.m_y != ptDst.m_y || min_z > ptDst.m_z || max_z < ptDst.m_z ) { WARNLOS(("pStatic blocked - m:%d M:%d\n", min_z, max_z)); bPath = false; break; } } } } } } } if ( !bPath ) break; // --------- In game items ---------- if ( !(flags & LOS_NB_DYNAMIC) ) { if ( !((flags & LOS_NB_LOCAL_DYNAMIC) && (pSrcRegion == pNowRegion)) ) { CWorldSearch AreaItems(ptNow, 0); for (;;) { pItem = AreaItems.GetItem(); if ( !pItem ) break; if ( pItem->GetUnkPoint().m_x != ptNow.m_x || pItem->GetUnkPoint().m_y != ptNow.m_y ) continue; if ( !CanSeeItem(pItem) ) continue; //Fix for Stacked items blocking view if ( (pItem->GetUnkPoint().m_x == ptDst.m_x) && (pItem->GetUnkPoint().m_y == ptDst.m_y) && (pItem->GetUnkPoint().m_z >= GetTopZ()) && (pItem->GetUnkPoint().m_z <= ptSrc.m_z) ) continue; pItemDef = static_cast<CItemBase*>(pItem->Base_GetDef()); qwTFlags = 0; Height = 0; bNullTerrain = false; if ( !pItemDef ) { WARNLOS(("DYNAMIC - Cannot get pItemDef for item (0%x)\n", pItem->GetDispID())); } else { if (pItem->Can(CAN_I_BLOCKLOS)) { WARNLOS(("pItem blocked by CAN_I_BLOCKLOS")); bPath = false; break; } if ( (flags & LOS_FISHING) && (ptSrc.GetDist(ptNow) >= 2) && (pItem->GetType() != IT_WATER) && ( pItem->Can(CAN_I_DOOR | CAN_I_PLATFORM | CAN_I_BLOCK | CAN_I_CLIMB | CAN_I_FIRE | CAN_I_ROOF | CAN_I_BLOCKLOS | CAN_I_BLOCKLOS_HEIGHT) ) ) { WARNLOS(("pItem blocked - flags & 0800, distance >= 2 and type of pItemDef is not IT_WATER\n")); bPath = false; break; //return CanSeeLOS_New_Failed(pptBlock, ptNow); } qwTFlags = pItemDef->GetTFlags(); Height = pItemDef->GetHeight(); if ( pItemDef->GetID() != pItem->GetDispID() ) //not a parent item { WARNLOS(("Not a parent item (DYNAMIC)\n")); pDupeDef = CItemBaseDupe::GetDupeRef((ITEMID_TYPE)(pItem->GetDispID())); if ( !pDupeDef ) { // Not an error: i have changed the DISPID of the item. CItemBase* pParentDef = CItemBase::FindItemBase(pItem->GetDispID()); if (pParentDef) { qwTFlags = pParentDef->GetTFlags(); Height = pParentDef->GetHeight(); } else g_Log.EventDebug("AdvancedLoS: Failed to get reference (dynamic): non-dupe, baseless dispid (DispID 0%x) (X: %d Y: %d Z: %hhd M: %hhu)\n", pItem->GetDispID(), ptNow.m_x, ptNow.m_y, pItem->GetUnkZ(), ptNow.m_map); } else { // It's a dupe item qwTFlags = pDupeDef->GetTFlags(); Height = pDupeDef->GetHeight(); } } else { WARNLOS(("Parent item (DYNAMIC)\n")); } Height = (qwTFlags & UFLAG2_CLIMBABLE) ? Height / 2 : Height; if ( ((qwTFlags & (UFLAG1_WALL|UFLAG1_BLOCK|UFLAG2_PLATFORM)) || pItem->Can(CAN_I_BLOCKLOS_HEIGHT)) && !((qwTFlags & UFLAG2_WINDOW) && (flags & LOS_NB_WINDOWS)) ) { WARNLOS(("pItem %0x(%0x) %d,%d,%d - %d\n", (dword)pItem->GetUID(), pItem->GetDispID(), pItem->GetUnkPoint().m_x, pItem->GetUnkPoint().m_y, pItem->GetUnkPoint().m_z, Height)); min_z = pItem->GetUnkPoint().m_z; max_z = minimum(Height + min_z, UO_SIZE_Z); WARNLOS(("qwTFlags(0%x)\n", qwTFlags)); WARNLOS(("pItem %0x(%0x) Z check: %d,%d (Now: %d) (Dest: %d).\n", (dword)pItem->GetUID(), pItem->GetDispID(), min_z, max_z, ptNow.m_z, ptDst.m_z)); if ( min_z <= ptNow.m_z && max_z >= ptNow.m_z ) { if ( ptNow.m_x != ptDst.m_x || ptNow.m_y != ptDst.m_y || min_z > ptDst.m_z || max_z < ptDst.m_z ) { WARNLOS(("pItem blocked - m:%d M:%d\n", min_z, max_z)); bPath = false; break; } } } } } } } if ( !bPath ) break; // ----------- Multis --------------- if ( !(flags & LOS_NB_MULTI) ) { if ( !((flags & LOS_NB_LOCAL_MULTI) && (pSrcRegion == pNowRegion)) ) { size_t iQtyr = ptNow.GetRegions(REGION_TYPE_MULTI, &rlinks); if ( iQtyr > 0 ) { for ( size_t ii = 0; ii < iQtyr; pMulti = nullptr, ++ii, pItem = nullptr, pRegion = nullptr ) { pRegion = rlinks[ii]; if ( pRegion ) pItem = pRegion->GetResourceID().ItemFindFromResource(); if ( !pItem ) continue; pMulti = g_Cfg.GetMultiItemDefs(pItem); if ( !pMulti ) continue; uint iQty = pMulti->GetItemCount(); for ( uint iii = 0; iii < iQty; pItemDef = nullptr, pMultiItem = nullptr, ++iii ) { pMultiItem = pMulti->GetItem(iii); if ( !pMultiItem ) break; if ( !pMultiItem->m_visible ) continue; if ( (pMultiItem->m_dx + pItem->GetTopPoint().m_x != ptNow.m_x) || (pMultiItem->m_dy + pItem->GetTopPoint().m_y != ptNow.m_y) ) continue; pItemDef = CItemBase::FindItemBase(pMultiItem->GetDispID()); qwTFlags = 0; Height = 0; bNullTerrain = false; if ( !pItemDef ) { WARNLOS(("MULTI - Cannot get pItemDef for item (0%x)\n", pMultiItem->GetDispID())); } else { if (pItemDef->Can(CAN_I_BLOCKLOS)) { WARNLOS(("pMultiItem blocked by CAN_I_BLOCKLOS")); bPath = false; break; } if ( (flags & LOS_FISHING) && (ptSrc.GetDist(ptNow) >= 2) && (pItemDef->GetType() != IT_WATER) && ( pItemDef->Can(CAN_I_DOOR | CAN_I_PLATFORM | CAN_I_BLOCK | CAN_I_CLIMB | CAN_I_FIRE | CAN_I_ROOF | CAN_I_BLOCKLOS | CAN_I_BLOCKLOS_HEIGHT) ) ) { WARNLOS(("pMultiItem blocked - flags & 0800, distance >= 2 and type of pItemDef is not IT_WATER\n")); bPath = false; break; //return CanSeeLOS_New_Failed(pptBlock, ptNow); } qwTFlags = pItemDef->GetTFlags(); Height = pItemDef->GetHeight(); if ( pItemDef->GetID() != pMultiItem->GetDispID() ) //not a parent item { WARNLOS(("Not a parent item (MULTI)\n")); pDupeDef = CItemBaseDupe::GetDupeRef((ITEMID_TYPE)(pMultiItem->GetDispID())); if ( !pDupeDef ) { g_Log.EventDebug("AdvancedLoS: Failed to get non-parent reference (multi) (DispID 0%x) (X: %d Y: %d Z: %hhd M: %hhu)\n", pMultiItem->GetDispID(), ptNow.m_x, ptNow.m_y, pMultiItem->m_dz + pItem->GetTopPoint().m_z, ptNow.m_map); } else { qwTFlags = pDupeDef->GetTFlags(); Height = pDupeDef->GetHeight(); } } else { WARNLOS(("Parent item (MULTI)\n")); } Height = (qwTFlags & UFLAG2_CLIMBABLE) ? Height / 2 : Height; if ( ((qwTFlags & (UFLAG1_WALL|UFLAG1_BLOCK|UFLAG2_PLATFORM) || pItemDef->Can(CAN_I_BLOCKLOS_HEIGHT))) && !((qwTFlags & UFLAG2_WINDOW) && (flags & LOS_NB_WINDOWS)) ) { WARNLOS(("pMultiItem %0x %d,%d,%d - %d\n", pMultiItem->GetDispID(), pMultiItem->m_dx, pMultiItem->m_dy, pMultiItem->m_dz, Height)); min_z = (char)(pMultiItem->m_dz) + pItem->GetTopPoint().m_z; max_z = minimum(Height + min_z, UO_SIZE_Z); WARNLOS(("qwTFlags(0%x)\n", qwTFlags)); if ( min_z <= ptNow.m_z && max_z >= ptNow.m_z ) { if ( ptNow.m_x != ptDst.m_x || ptNow.m_y != ptDst.m_y || min_z > ptDst.m_z || max_z < ptDst.m_z ) { WARNLOS(("pMultiItem blocked - m:%d M:%d\n", min_z, max_z)); bPath = false; break; } } } } } if ( !bPath ) break; } } } } if ( bNullTerrain ) bPath = false; if ( !bPath ) break; } path.clear(); if ( !bPath ) return CanSeeLOS_New_Failed(pptBlock, ptNow); return true; } #undef WARNLOS #undef APPROX #undef BETWEENPOINT //#undef CALCITEMHEIGHT bool CChar::CanSeeLOS( const CObjBaseTemplate *pObj, word wFlags, bool bCombatCheck ) const { ADDTOCALLSTACK("CChar::CanSeeLOS"); // WARNING: CanSeeLOS is an expensive function (lot of calculations but most importantly it has to read the UO files, and file I/O is slow). if ( !CanSee(pObj) ) return false; pObj = pObj->GetTopLevelObj(); if ( !pObj ) return false; if ( (m_pPlayer && (g_Cfg.m_iAdvancedLos & ADVANCEDLOS_PLAYER)) || (m_pNPC && (g_Cfg.m_iAdvancedLos & ADVANCEDLOS_NPC)) ) { CPointMap pt = pObj->GetTopPoint(); const CChar *pChar = dynamic_cast<const CChar*>(pObj); if ( pChar ) { short iTotalZ = pt.m_z + pChar->GetHeightMount(true); pt.m_z = (char)minimum(iTotalZ, UO_SIZE_Z); } return CanSeeLOS_New(pt, nullptr, pObj->GetVisualRange(), wFlags, bCombatCheck); } else return CanSeeLOS(pObj->GetTopPoint(), nullptr, pObj->GetVisualRange(), wFlags, bCombatCheck); }
/* * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION * SPDX-License-Identifier: Apache-2.0 */ //-------------------------------------------------------------------- #include "nvpsystem.hpp" #define GLFW_INCLUDE_NONE #include <GLFW/glfw3.h> #ifdef NVP_SUPPORTS_SOCKETS #include "socketSampleMessages.h" #endif #include <algorithm> static bool s_sysInit = false; static void cb_errorfun(int, const char* str) { LOGE(str); LOGE("\n"); } //--------------------------------------------------------------------------- // Message pump void NVPSystem::pollEvents() { #ifdef NVP_SUPPORTS_SOCKETS // check the stack of messages from remote connection, first processRemoteMessages(); #endif glfwPollEvents(); } void NVPSystem::waitEvents() { glfwWaitEvents(); } void NVPSystem::postTiming(float ms, int fps, const char* details) { #ifdef NVP_SUPPORTS_SOCKETS ::postTiming(ms, fps, details); #endif } double NVPSystem::getTime() { return glfwGetTime(); } void NVPSystem::init(const char* projectName) { std::string logfile = std::string("log_") + std::string(projectName) + std::string(".txt"); nvprintSetLogFileName(logfile.c_str()); int result = glfwInit(); if(!result) { LOGE("could not init glfw\n"); exit(-1); } glfwSetErrorCallback(cb_errorfun); //initNSight(); #ifdef NVP_SUPPORTS_SOCKETS // // Socket init if needed // startSocketServer(/*port*/ 1056); #endif s_sysInit = true; platformInit(); } void NVPSystem::deinit() { platformDeinit(); glfwTerminate(); } bool NVPSystem::isInited() { return s_sysInit; }
;=============================================================================== ; Copyright 2015-2021 Intel Corporation ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Rijndael Cipher function ; ; Content: ; EncryptECB_RIJ128pipe_AES_NI() ; ; %include "asmdefs.inc" %include "ia_32e.inc" %include "ia_32e_regs.inc" %include "pcpvariant.inc" %if (_AES_NI_ENABLING_ == _FEATURE_ON_) || (_AES_NI_ENABLING_ == _FEATURE_TICKTOCK_) %if (_IPP32E >= _IPP32E_Y8) segment .text align=IPP_ALIGN_FACTOR ;*************************************************************** ;* Purpose: pipelined RIJ128 ECB encryption ;* ;* void EncryptECB_RIJ128pipe_AES_NI(const Ipp32u* inpBlk, ;* Ipp32u* outBlk, ;* int nr, ;* const Ipp32u* pRKey, ;* int len) ;*************************************************************** ;; ;; Lib = Y8 ;; ;; Caller = ippsAESEncryptECB ;; align IPP_ALIGN_FACTOR IPPASM EncryptECB_RIJ128pipe_AES_NI,PUBLIC %assign LOCAL_FRAME 0 USES_GPR rsi,rdi USES_XMM COMP_ABI 5 ;; rdi: pInpBlk: DWORD, ; input blocks address ;; rsi: pOutBlk: DWORD, ; output blocks address ;; rdx: nr: DWORD, ; number of rounds ;; rcx pKey: DWORD ; key material address ;; r8d length: DWORD ; length (bytes) %xdefine SC (4) %assign BLKS_PER_LOOP (4) %assign BYTES_PER_BLK (16) %assign BYTES_PER_LOOP (BYTES_PER_BLK*BLKS_PER_LOOP) movsxd r8, r8d sub r8, BYTES_PER_LOOP jl .short_input ;; ;; pipelined processing ;; align IPP_ALIGN_FACTOR .blks_loop: movdqa xmm4, oword [rcx] mov r9, rcx ; set pointer to the key material movdqu xmm0, oword [rdi+0*16] ; get input blocks movdqu xmm1, oword [rdi+1*16] movdqu xmm2, oword [rdi+2*16] movdqu xmm3, oword [rdi+3*16] add rdi, BYTES_PER_LOOP pxor xmm0, xmm4 ; whitening pxor xmm1, xmm4 pxor xmm2, xmm4 pxor xmm3, xmm4 movdqa xmm4, oword [r9+16] add r9, 16 mov r10, rdx ; counter depending on key length sub r10, 1 align IPP_ALIGN_FACTOR .cipher_loop: aesenc xmm0, xmm4 ; regular round aesenc xmm1, xmm4 aesenc xmm2, xmm4 aesenc xmm3, xmm4 movdqa xmm4, oword [r9+16] add r9, 16 dec r10 jnz .cipher_loop aesenclast xmm0, xmm4 ; irregular round movdqu oword [rsi+0*16], xmm0 ; store output blocks aesenclast xmm1, xmm4 movdqu oword [rsi+1*16], xmm1 aesenclast xmm2, xmm4 movdqu oword [rsi+2*16], xmm2 aesenclast xmm3, xmm4 movdqu oword [rsi+3*16], xmm3 add rsi, BYTES_PER_LOOP sub r8, BYTES_PER_LOOP jge .blks_loop ;; ;; block-by-block processing ;; .short_input: add r8, BYTES_PER_LOOP jz .quit ; get actual address of key material: pRKeys += (nr-9) * SC lea rax,[rdx*4] lea r9, [rcx+rax*4-9*(SC)*4] ; AES-128 round keys align IPP_ALIGN_FACTOR .single_blk_loop: movdqu xmm0, oword [rdi] ; get input block add rdi, BYTES_PER_BLK pxor xmm0, oword [rcx] ; whitening cmp rdx,12 ; switch according to number of rounds jl .key_128_s jz .key_192_s .key_256_s: aesenc xmm0,oword [r9-4*4*SC] aesenc xmm0,oword [r9-3*4*SC] .key_192_s: aesenc xmm0,oword [r9-2*4*SC] aesenc xmm0,oword [r9-1*4*SC] .key_128_s: aesenc xmm0,oword [r9+0*4*SC] aesenc xmm0,oword [r9+1*4*SC] aesenc xmm0,oword [r9+2*4*SC] aesenc xmm0,oword [r9+3*4*SC] aesenc xmm0,oword [r9+4*4*SC] aesenc xmm0,oword [r9+5*4*SC] aesenc xmm0,oword [r9+6*4*SC] aesenc xmm0,oword [r9+7*4*SC] aesenc xmm0,oword [r9+8*4*SC] aesenclast xmm0,oword [r9+9*4*SC] movdqu oword [rsi], xmm0 ; save output block add rsi, BYTES_PER_BLK sub r8, BYTES_PER_BLK jnz .single_blk_loop .quit: pxor xmm4, xmm4 REST_XMM REST_GPR ret ENDFUNC EncryptECB_RIJ128pipe_AES_NI %endif %endif ;; _AES_NI_ENABLING_
setrepeat 2 frame 0, 04 frame 1, 04 frame 2, 04 dorepeat 1 endanim
SECTION code_fp_math48 PUBLIC am48_dconst_1 EXTERN mm48__ac1 ; set AC = 1 ; ; uses : bc, de, hl defc am48_dconst_1 = mm48__ac1
; A020331: Numbers whose base-3 representation is the juxtaposition of two identical strings. ; 4,8,30,40,50,60,70,80,252,280,308,336,364,392,420,448,476,504,532,560,588,616,644,672,700,728,2214,2296,2378,2460,2542,2624,2706,2788,2870,2952,3034,3116,3198,3280,3362,3444,3526,3608,3690,3772,3854,3936,4018 mov $2,$0 add $0,1 mov $1,$0 lpb $0,1 add $0,3 div $0,3 sub $0,1 mul $1,3 lpe add $1,1 add $1,$2
//===============================================================================================// /*! * \file MeshBoneData.cpp * \author Loïc Corenthy * \version 1.0 */ //===============================================================================================// #include "MeshBoneData.hpp" #include "Exceptions.hpp" #include "Transform.hpp" using std::string; using std::vector; using miniGL::MeshBoneData; using miniGL::Exceptions; using miniGL::Transform; using miniGL::VertexBoneData; void MeshBoneData::boneTransform(const aiScene * pScene, float pTime, std::vector<mat4f> & pTransforms) { mat4f lIdentity(1.0f); float lTickPerSeconds = static_cast<float>(pScene->mAnimations[0]->mTicksPerSecond != 0.0 ? pScene->mAnimations[0]->mTicksPerSecond : 25.0f); float lTimeInTicks = pTime * lTickPerSeconds; float lAnimationTime = fmod(lTimeInTicks, static_cast<float>(pScene->mAnimations[0]->mDuration)); _readNodeHierarchy(pScene, lAnimationTime, pScene->mRootNode, lIdentity); pTransforms.resize(mBoneCount); for (unsigned int i = 0; i < mBoneCount; ++i) pTransforms[i] = mBoneInfo[i].finalTransformation; } void MeshBoneData::loadBones(unsigned int pMeshEntryBaseVertex, const aiMesh* pMesh, vector<VertexBoneData<4>> & pBones) { for (unsigned int i = 0; i < pMesh->mNumBones; ++i) { unsigned int lBoneIndex = 0; string lBoneName(pMesh->mBones[i]->mName.data); if (mBoneMapping.find(lBoneName) == mBoneMapping.end()) { // Allocate an index for a new bone lBoneIndex = mBoneCount; mBoneCount++; BoneInfo lBoneInfo; mBoneInfo.push_back(lBoneInfo); // Copy bone matrix to bone info mBoneInfo[lBoneIndex].boneOffset = _convertMatrix(pMesh->mBones[i]->mOffsetMatrix); mBoneMapping[lBoneName] = lBoneIndex; } else lBoneIndex = mBoneMapping[lBoneName]; for (unsigned int j = 0; j < pMesh->mBones[i]->mNumWeights; ++j) { const unsigned int lVertexID = pMeshEntryBaseVertex + pMesh->mBones[i]->mWeights[j].mVertexId; const float lWeight = pMesh->mBones[i]->mWeights[j].mWeight; pBones[lVertexID].addBoneData(lBoneIndex, lWeight); } } } unsigned int MeshBoneData::boneCount(void) const noexcept { return mBoneCount; } void MeshBoneData::globalInverseTransform(const aiMatrix4x4 & pTransform) { mGlobalInverseTransform = _convertMatrix(pTransform); mGlobalInverseTransform.inverse(); } aiVector3D MeshBoneData::_interpolatedScaling(float pAnimationTime, const aiNodeAnim * pNodeAnim) { // At least 2 values are necessary to interpolate if (pNodeAnim->mNumScalingKeys == 1) { return pNodeAnim->mScalingKeys[0].mValue; } else { unsigned int lScalingIndex = _findScaling(pAnimationTime, pNodeAnim); const unsigned int lNextScalingIndex = lScalingIndex + 1; assert(lNextScalingIndex < pNodeAnim->mNumScalingKeys); auto lDeltaTime = static_cast<float>(pNodeAnim->mScalingKeys[lNextScalingIndex].mTime - pNodeAnim->mScalingKeys[lScalingIndex].mTime); float lFactor = (pAnimationTime - static_cast<float>(pNodeAnim->mScalingKeys[lScalingIndex].mTime)) / lDeltaTime; assert(0.0f <= lFactor && lFactor <= 1.0f); const aiVector3D & lStart = pNodeAnim->mScalingKeys[lScalingIndex].mValue; const aiVector3D & lEnd = pNodeAnim->mScalingKeys[lNextScalingIndex].mValue; return lStart + lFactor * (lEnd - lStart); } } aiQuaternion MeshBoneData::_interpolatedRotation(float pAnimationTime, const aiNodeAnim * pNodeAnim) { // At least 2 values are necessary to interpolate if (pNodeAnim->mNumRotationKeys == 1) { return pNodeAnim->mRotationKeys[0].mValue; } else { unsigned int lRotationIndex = _findRotation(pAnimationTime, pNodeAnim); const unsigned int lNextRotationIndex = lRotationIndex + 1; assert(lNextRotationIndex < pNodeAnim->mNumRotationKeys); auto lDeltaTime = static_cast<float>(pNodeAnim->mRotationKeys[lNextRotationIndex].mTime - pNodeAnim->mRotationKeys[lRotationIndex].mTime); float lFactor = (pAnimationTime - static_cast<float>(pNodeAnim->mRotationKeys[lRotationIndex].mTime)) / lDeltaTime; assert(0.0f <= lFactor && lFactor <= 1.0f); const aiQuaternion & lStart = pNodeAnim->mRotationKeys[lRotationIndex].mValue; const aiQuaternion & lEnd = pNodeAnim->mRotationKeys[lNextRotationIndex].mValue; aiQuaternion lRes; aiQuaternion::Interpolate(lRes, lStart, lEnd, lFactor); return lRes.Normalize(); } } aiVector3D MeshBoneData::_interpolatedPosition(float pAnimationTime, const aiNodeAnim * pNodeAnim) { // At least 2 values are necessary to interpolate if (pNodeAnim->mNumPositionKeys == 1) { return pNodeAnim->mPositionKeys[0].mValue; } else { unsigned int lPositionIndex = _findPosition(pAnimationTime, pNodeAnim); const unsigned int lNextPositionIndex = lPositionIndex + 1; assert(lNextPositionIndex < pNodeAnim->mNumPositionKeys); auto lDeltaTime = static_cast<float>(pNodeAnim->mPositionKeys[lNextPositionIndex].mTime - pNodeAnim->mPositionKeys[lPositionIndex].mTime); float lFactor = (pAnimationTime - static_cast<float>(pNodeAnim->mPositionKeys[lPositionIndex].mTime)) / lDeltaTime; assert(0.0f <= lFactor && lFactor <= 1.0f); const aiVector3D & lStart = pNodeAnim->mPositionKeys[lPositionIndex].mValue; const aiVector3D & lEnd = pNodeAnim->mPositionKeys[lNextPositionIndex].mValue; return lStart + lFactor * (lEnd - lStart); } } unsigned int MeshBoneData::_findScaling(float pAnimationTime, const aiNodeAnim * pNodeAnim) { if (pNodeAnim->mNumScalingKeys <= 0) throw Exceptions("No scaling keys found for animation", __FILE__, __LINE__); for (unsigned int i = 0; i < pNodeAnim->mNumScalingKeys - 1; ++i) { if (pAnimationTime < static_cast<float>(pNodeAnim->mScalingKeys[i + 1].mTime)) return i; } throw Exceptions("Unable to find node scaling for current animation", __FILE__, __LINE__); return 0; } unsigned int MeshBoneData::_findRotation(float pAnimationTime, const aiNodeAnim * pNodeAnim) { if (pNodeAnim->mNumRotationKeys <= 0) throw Exceptions("No rotation keys found for animation", __FILE__, __LINE__); for (unsigned int i = 0; i < pNodeAnim->mNumRotationKeys - 1; ++i) { if (pAnimationTime < static_cast<float>(pNodeAnim->mRotationKeys[i + 1].mTime)) return i; } throw Exceptions("Unable to find node rotation for current animation", __FILE__, __LINE__); return 0; } unsigned int MeshBoneData::_findPosition(float pAnimationTime, const aiNodeAnim * pNodeAnim) { for (unsigned int i = 0; i < pNodeAnim->mNumPositionKeys - 1; ++i) { if (pAnimationTime < static_cast<float>(pNodeAnim->mPositionKeys[i + 1].mTime)) return i; } throw Exceptions("Unable to find node position for current animation", __FILE__, __LINE__); return 0; } const aiNodeAnim* MeshBoneData::_findNodeAnim(const aiAnimation* pAnimation, const std::string & pNodeName) { for (unsigned int i = 0; i < pAnimation->mNumChannels; ++i) { const aiNodeAnim* rNodeAnim = pAnimation->mChannels[i]; if (string(rNodeAnim->mNodeName.data) == pNodeName) return rNodeAnim; } return nullptr; } void MeshBoneData::_readNodeHierarchy(const aiScene * pScene, float pAnimationTime, const aiNode* pNode, const mat4f & pParentTransform) { string lNodeName(pNode->mName.data); const aiAnimation * rAnimation = pScene->mAnimations[0]; mat4f lNodeTransformation = _convertMatrix(pNode->mTransformation); const aiNodeAnim* rNodeAnim = _findNodeAnim(rAnimation, lNodeName); if (rNodeAnim) { Transform lTransform; // Interpolate scaling and generate scaling transformation matrix aiVector3D lScaling = _interpolatedScaling(pAnimationTime, rNodeAnim); lTransform.scaling(lScaling.x, lScaling.y, lScaling.z); // Interpolate rotation and generate rotation transformation matrix aiQuaternion lRotationQ = _interpolatedRotation(pAnimationTime, rNodeAnim); auto lTmpRotation = lRotationQ.GetMatrix(); mat4f lRotationMatrix(1.0f); lRotationMatrix(0,0) = lTmpRotation.a1; lRotationMatrix(0,1) = lTmpRotation.a2; lRotationMatrix(0,2) = lTmpRotation.a3; lRotationMatrix(1,0) = lTmpRotation.b1; lRotationMatrix(1,1) = lTmpRotation.b2; lRotationMatrix(1,2) = lTmpRotation.b3; lRotationMatrix(2,0) = lTmpRotation.c1; lRotationMatrix(2,1) = lTmpRotation.c2; lRotationMatrix(2,2) = lTmpRotation.c3; lTransform.rotation(lRotationMatrix); // Interpolate translation and generate translation transformation matrix aiVector3D lTranslation = _interpolatedPosition(pAnimationTime, rNodeAnim); lTransform.translation(lTranslation.x, lTranslation.y, lTranslation.z); // Combine all the transformations lNodeTransformation = lTransform.final(); } mat4f lGlobalTransformation = pParentTransform * lNodeTransformation; if (mBoneMapping.find(lNodeName) != mBoneMapping.end()) { unsigned int lBoneIndex = mBoneMapping[lNodeName]; mBoneInfo[lBoneIndex].finalTransformation = mGlobalInverseTransform * lGlobalTransformation * mBoneInfo[lBoneIndex].boneOffset; } for (unsigned int i = 0; i < pNode->mNumChildren; ++i) _readNodeHierarchy(pScene, pAnimationTime, pNode->mChildren[i], lGlobalTransformation); } mat4f MeshBoneData::_convertMatrix(const aiMatrix4x4 & pMat) const { mat4f lRes; lRes(0,0) = pMat.a1; lRes(0,1) = pMat.a2; lRes(0,2) = pMat.a3; lRes(0,3) = pMat.a4; lRes(1,0) = pMat.b1; lRes(1,1) = pMat.b2; lRes(1,2) = pMat.b3; lRes(1,3) = pMat.b4; lRes(2,0) = pMat.c1; lRes(2,1) = pMat.c2; lRes(2,2) = pMat.c3; lRes(2,3) = pMat.c4; lRes(3,0) = pMat.d1; lRes(3,1) = pMat.d2; lRes(3,2) = pMat.d3; lRes(3,3) = pMat.d4; return lRes; }
/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_SEQUENCE_VIEW_10022005_0620) #define FUSION_SEQUENCE_VIEW_10022005_0620 #include <boost/fusion/view/filter_view.hpp> #include <boost/fusion/view/iterator_range.hpp> #include <boost/fusion/view/joint_view.hpp> #include <boost/fusion/view/nview.hpp> #include <boost/fusion/view/single_view.hpp> #include <boost/fusion/view/reverse_view.hpp> #include <boost/fusion/view/transform_view.hpp> #include <boost/fusion/view/zip_view.hpp> #endif
; A054868: Sum of bits of sum of bits of n: a(n) = wt(wt(n)). ; 0,1,1,1,1,1,1,2,1,1,1,2,1,2,2,1,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,2,2,1 seq $0,120 ; 1's-counting sequence: number of 1's in binary expansion of n (or the binary weight of n). seq $0,120 ; 1's-counting sequence: number of 1's in binary expansion of n (or the binary weight of n).
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2014-2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #include "frc/Preferences.h" // NOLINT(build/include_order) #include <cstdio> #include <fstream> #include <networktables/NetworkTableInstance.h> #include <ntcore.h> #include "frc/Timer.h" #include "gtest/gtest.h" using namespace frc; static const char* kFileName = "networktables.ini"; static const double kSaveTime = 1.2; /** * If we write a new networktables.ini with some sample values, test that * we get those same values back using the Preference class. */ TEST(PreferencesTest, ReadPreferencesFromFile) { auto inst = nt::NetworkTableInstance::GetDefault(); inst.StopServer(); std::remove(kFileName); std::ofstream preferencesFile(kFileName); preferencesFile << "[NetworkTables Storage 3.0]" << std::endl; preferencesFile << "string \"/Preferences/testFileGetString\"=\"Hello, preferences file\"" << std::endl; preferencesFile << "double \"/Preferences/testFileGetInt\"=1" << std::endl; preferencesFile << "double \"/Preferences/testFileGetDouble\"=0.5" << std::endl; preferencesFile << "double \"/Preferences/testFileGetFloat\"=0.25" << std::endl; preferencesFile << "boolean \"/Preferences/testFileGetBoolean\"=true" << std::endl; preferencesFile << "double \"/Preferences/testFileGetLong\"=1000000000000000000" << std::endl; preferencesFile.close(); inst.StartServer(); Preferences* preferences = Preferences::GetInstance(); EXPECT_EQ("Hello, preferences file", preferences->GetString("testFileGetString")); EXPECT_EQ(1, preferences->GetInt("testFileGetInt")); EXPECT_FLOAT_EQ(0.5, preferences->GetDouble("testFileGetDouble")); EXPECT_FLOAT_EQ(0.25f, preferences->GetFloat("testFileGetFloat")); EXPECT_TRUE(preferences->GetBoolean("testFileGetBoolean")); EXPECT_EQ(1000000000000000000ll, preferences->GetLong("testFileGetLong")); } /** * If we set some values using the Preferences class, test that they show up * in networktables.ini */ TEST(PreferencesTest, WritePreferencesToFile) { auto inst = nt::NetworkTableInstance::GetDefault(); inst.StartServer(); Preferences* preferences = Preferences::GetInstance(); preferences->Remove("testFileGetString"); preferences->Remove("testFileGetInt"); preferences->Remove("testFileGetDouble"); preferences->Remove("testFileGetFloat"); preferences->Remove("testFileGetBoolean"); preferences->Remove("testFileGetLong"); Wait(kSaveTime); preferences->PutString("testFilePutString", "Hello, preferences file"); preferences->PutInt("testFilePutInt", 1); preferences->PutDouble("testFilePutDouble", 0.5); preferences->PutFloat("testFilePutFloat", 0.25f); preferences->PutBoolean("testFilePutBoolean", true); preferences->PutLong("testFilePutLong", 1000000000000000000ll); Wait(kSaveTime); static char const* kExpectedFileContents[] = { "[NetworkTables Storage 3.0]", "string \"/Preferences/.type\"=\"RobotPreferences\"", "boolean \"/Preferences/testFilePutBoolean\"=true", "double \"/Preferences/testFilePutDouble\"=0.5", "double \"/Preferences/testFilePutFloat\"=0.25", "double \"/Preferences/testFilePutInt\"=1", "double \"/Preferences/testFilePutLong\"=1e+18", "string \"/Preferences/testFilePutString\"=\"Hello, preferences file\""}; std::ifstream preferencesFile(kFileName); for (auto& kExpectedFileContent : kExpectedFileContents) { ASSERT_FALSE(preferencesFile.eof()) << "Preferences file prematurely reached EOF"; std::string line; std::getline(preferencesFile, line); ASSERT_EQ(kExpectedFileContent, line) << "A line in networktables.ini was not correct"; } }
; A097701: Expansion of 1/((1-x)^2*(1-x^2)^2*(1-x^3)). ; 1,2,5,9,16,25,39,56,80,109,147,192,249,315,396,489,600,726,874,1040,1232,1446,1690,1960,2265,2600,2975,3385,3840,4335,4881,5472,6120,6819,7581,8400,9289,10241,11270,12369,13552,14812,16164,17600,19136 mov $18,$0 mov $20,$0 add $20,1 lpb $20,1 clr $0,18 mov $0,$18 sub $20,1 sub $0,$20 mov $15,$0 mov $17,$0 add $17,1 lpb $17,1 mov $0,$15 sub $17,1 sub $0,$17 add $0,4 mov $4,$0 lpb $4,1 add $1,2 trn $1,$0 sub $0,3 sub $4,2 lpe add $16,$1 lpe add $19,$16 lpe mov $1,$19
; A305991: Expansion of (1-27*x)^(1/9). ; Submitted by Christian Krause ; 1,-3,-36,-612,-11934,-250614,-5513508,-125235396,-2911722957,-68910776649,-1653858639576,-40143659706072,-983519662798764,-24285370135261788,-603664914790793016,-15091622869769825400,-379177024602966863175,-9568643738510163782475,-242405641375590815822700,-6162206567600545475913900,-157136267473813909635804450,-4018198839687527117829856650,-103012006617443877020729052300,-2646960691778666579097863909100,-68159237813300664411769995659325,-1758508335583157141823665888010585 mov $1,1 mov $3,$0 mov $0,-4 mov $4,1 lpb $3 add $0,1 mul $1,$3 mul $1,$0 add $0,26 add $2,$4 div $1,$2 sub $3,1 add $4,2 lpe mov $0,$1
.include "defines.inc" .include "global.inc" .segment "BANK1" ; end of string is important!!! ; else, textprinter loops forever ; strings should be multiples of 28 characters (excluding line feed)! ; ____________________________<-- up till here!! string_test: .byte "sphinx of dark black quartz," .byte "judge my vows...", char_LF, char_LF .byte "the quick brown fox did jump" .byte "over the lazy dog...", char_LF .byte char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF, char_LF .byte "squeak <:3 )~", char_LF .byte "line feed test...", char_LF .byte "curveball :P", char_EOS copyright_info: .byte "v.0.0.1", char_LF .byte "(C) SATELLITE & STARDUST ", char_SNS_LOGO, char_EOS credits: .byte "Initial Template:", char_LF .byte " yoeynsf", char_LF, char_LF .byte "Programming:", char_LF .byte " Persune", char_LF, char_LF .byte "Programming help:", char_LF .byte " yoeynsf, Kasumi, studsX, " .byte "Fiskbit, Pino, zeta0134, " .byte "jroweboy, & many, many more " .byte "others...:P", char_LF, char_LF .byte "Lots of thanks for you who " .byte "helped me through each tiny " .byte "step in this, I am eternally" .byte "grateful!!" .byte char_EOS eternal_gratitude: .byte "Jekuthiel, yoeynsf, Fiskbit," .byte "lidnariq, Kasumi, Pinobatch," .byte "studsX, Lockster, plgDavid, " .byte "Grievre, Iyatemu, BlueMario," .byte "jroweboy, zeta0134, and also" .byte "the entire NESDev community." .byte char_LF, char_LF .byte "I am very grateful for all " .byte "your help. I hope to return " .byte "the favor one day, when I am" .byte "much more able than I am now" .byte char_EOS testline: .byte "Hello, NROM!" .byte char_EOS lorem_ipsum: .byte "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee.", char_EOS
_cp: file format elf32-i386 Disassembly of section .text: 00000000 <main>: void ls(char *path); char* fmtname(char *path); int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -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 b8 01 00 00 sub $0x1b8,%esp if (argc !=3) 17: 83 39 03 cmpl $0x3,(%ecx) { 1a: 8b 59 04 mov 0x4(%ecx),%ebx if (argc !=3) 1d: 74 13 je 32 <main+0x32> { printf(1, "please input the command as [cp src_file dest_file]\n"); 1f: 50 push %eax 20: 50 push %eax 21: 68 18 0c 00 00 push $0xc18 26: 6a 01 push $0x1 28: e8 e3 07 00 00 call 810 <printf> exit(); 2d: e8 80 06 00 00 call 6b2 <exit> } int fd_src = open(argv[1], O_RDONLY); 32: 50 push %eax 33: 50 push %eax 34: 6a 00 push $0x0 36: ff 73 04 pushl 0x4(%ebx) 39: e8 b4 06 00 00 call 6f2 <open> if (fd_src == -1) 3e: 83 c4 10 add $0x10,%esp 41: 83 f8 ff cmp $0xffffffff,%eax int fd_src = open(argv[1], O_RDONLY); 44: 89 c6 mov %eax,%esi if (fd_src == -1) 46: 0f 84 1f 01 00 00 je 16b <main+0x16b> printf(1, "open source file failed\n"); exit(); } struct stat st; fstat(fd_src, &st); 4c: 8d 85 54 fe ff ff lea -0x1ac(%ebp),%eax 52: 57 push %edi 53: 57 push %edi 54: 50 push %eax 55: 56 push %esi 56: e8 af 06 00 00 call 70a <fstat> if (st.type == T_DIR) 5b: 83 c4 10 add $0x10,%esp 5e: 66 83 bd 54 fe ff ff cmpw $0x1,-0x1ac(%ebp) 65: 01 66: 0f 84 c7 00 00 00 je 133 <main+0x133> ls(argv[1]); printf(1, "the program can't open the file in that directory after list them.\n"); printf(1, "So, I'm sorry that you have to copy them one by one.\n"); exit(); } char com[128] = {}; 6c: 8d bd 68 fe ff ff lea -0x198(%ebp),%edi 72: 31 c0 xor %eax,%eax 74: b9 20 00 00 00 mov $0x20,%ecx 79: f3 ab rep stos %eax,%es:(%edi) strcpy(com, argv[2]); 7b: 57 push %edi 7c: 57 push %edi 7d: 8d bd 68 fe ff ff lea -0x198(%ebp),%edi 83: ff 73 08 pushl 0x8(%ebx) 86: 57 push %edi 87: e8 d4 03 00 00 call 460 <strcpy> int len1 = strlen(argv[1]); 8c: 58 pop %eax 8d: ff 73 04 pushl 0x4(%ebx) 90: e8 4b 04 00 00 call 4e0 <strlen> 95: 89 85 44 fe ff ff mov %eax,-0x1bc(%ebp) int len2 = strlen(argv[2]); 9b: 58 pop %eax 9c: ff 73 08 pushl 0x8(%ebx) 9f: e8 3c 04 00 00 call 4e0 <strlen> if (argv[2][len2-1] == '/') a4: 8b 53 08 mov 0x8(%ebx),%edx a7: 83 c4 10 add $0x10,%esp aa: 80 7c 02 ff 2f cmpb $0x2f,-0x1(%edx,%eax,1) af: 0f 84 c9 00 00 00 je 17e <main+0x17e> if (argv[1][i] == '/') break; i++; strcpy(&com[len2], &argv[1][i]); } int fd_dest = open(com, O_WRONLY|O_CREATE); b5: 51 push %ecx b6: 51 push %ecx b7: 68 01 02 00 00 push $0x201 bc: 57 push %edi bd: e8 30 06 00 00 call 6f2 <open> if (fd_dest == -1) c2: 83 c4 10 add $0x10,%esp int fd_dest = open(com, O_WRONLY|O_CREATE); c5: 89 85 44 fe ff ff mov %eax,-0x1bc(%ebp) if (fd_dest == -1) cb: 83 c0 01 add $0x1,%eax ce: 0f 84 dc 00 00 00 je 1b0 <main+0x1b0> { printf(1, "create dest file failed\n"); exit(); } char buf[BUF_SIZE] = {}; d4: 8d 9d e8 fe ff ff lea -0x118(%ebp),%ebx da: b9 40 00 00 00 mov $0x40,%ecx df: 31 c0 xor %eax,%eax e1: 89 df mov %ebx,%edi e3: f3 ab rep stos %eax,%es:(%edi) int len = 0; while((len = read(fd_src, buf, BUF_SIZE)) > 0) e5: eb 1c jmp 103 <main+0x103> e7: 89 f6 mov %esi,%esi e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi write(fd_dest, buf, len); f0: 83 ec 04 sub $0x4,%esp f3: 50 push %eax f4: 53 push %ebx f5: ff b5 44 fe ff ff pushl -0x1bc(%ebp) fb: e8 d2 05 00 00 call 6d2 <write> 100: 83 c4 10 add $0x10,%esp while((len = read(fd_src, buf, BUF_SIZE)) > 0) 103: 83 ec 04 sub $0x4,%esp 106: 68 00 01 00 00 push $0x100 10b: 53 push %ebx 10c: 56 push %esi 10d: e8 b8 05 00 00 call 6ca <read> 112: 83 c4 10 add $0x10,%esp 115: 85 c0 test %eax,%eax 117: 7f d7 jg f0 <main+0xf0> close(fd_src); 119: 83 ec 0c sub $0xc,%esp 11c: 56 push %esi 11d: e8 b8 05 00 00 call 6da <close> close(fd_dest); 122: 58 pop %eax 123: ff b5 44 fe ff ff pushl -0x1bc(%ebp) 129: e8 ac 05 00 00 call 6da <close> exit(); 12e: e8 7f 05 00 00 call 6b2 <exit> printf(1, "source file is a directory, the files in that directory is:\n"); 133: 50 push %eax 134: 50 push %eax 135: 68 50 0c 00 00 push $0xc50 13a: 6a 01 push $0x1 13c: e8 cf 06 00 00 call 810 <printf> ls(argv[1]); 141: 58 pop %eax 142: ff 73 04 pushl 0x4(%ebx) 145: e8 26 01 00 00 call 270 <ls> printf(1, "the program can't open the file in that directory after list them.\n"); 14a: 58 pop %eax 14b: 5a pop %edx 14c: 68 90 0c 00 00 push $0xc90 151: 6a 01 push $0x1 153: e8 b8 06 00 00 call 810 <printf> printf(1, "So, I'm sorry that you have to copy them one by one.\n"); 158: 59 pop %ecx 159: 5b pop %ebx 15a: 68 d4 0c 00 00 push $0xcd4 15f: 6a 01 push $0x1 161: e8 aa 06 00 00 call 810 <printf> exit(); 166: e8 47 05 00 00 call 6b2 <exit> printf(1, "open source file failed\n"); 16b: 50 push %eax 16c: 50 push %eax 16d: 68 97 0b 00 00 push $0xb97 172: 6a 01 push $0x1 174: e8 97 06 00 00 call 810 <printf> exit(); 179: e8 34 05 00 00 call 6b2 <exit> int i = len1 - 1; 17e: 8b 95 44 fe ff ff mov -0x1bc(%ebp),%edx 184: 8b 5b 04 mov 0x4(%ebx),%ebx 187: 83 ea 01 sub $0x1,%edx for (; i >= 0; i--) 18a: eb 09 jmp 195 <main+0x195> if (argv[1][i] == '/') 18c: 80 3c 13 2f cmpb $0x2f,(%ebx,%edx,1) 190: 74 07 je 199 <main+0x199> for (; i >= 0; i--) 192: 83 ea 01 sub $0x1,%edx 195: 85 d2 test %edx,%edx 197: 79 f3 jns 18c <main+0x18c> strcpy(&com[len2], &argv[1][i]); 199: 8d 54 13 01 lea 0x1(%ebx,%edx,1),%edx 19d: 01 f8 add %edi,%eax 19f: 51 push %ecx 1a0: 51 push %ecx 1a1: 52 push %edx 1a2: 50 push %eax 1a3: e8 b8 02 00 00 call 460 <strcpy> 1a8: 83 c4 10 add $0x10,%esp 1ab: e9 05 ff ff ff jmp b5 <main+0xb5> printf(1, "create dest file failed\n"); 1b0: 52 push %edx 1b1: 52 push %edx 1b2: 68 b0 0b 00 00 push $0xbb0 1b7: 6a 01 push $0x1 1b9: e8 52 06 00 00 call 810 <printf> exit(); 1be: e8 ef 04 00 00 call 6b2 <exit> 1c3: 66 90 xchg %ax,%ax 1c5: 66 90 xchg %ax,%ax 1c7: 66 90 xchg %ax,%ax 1c9: 66 90 xchg %ax,%ax 1cb: 66 90 xchg %ax,%ax 1cd: 66 90 xchg %ax,%ax 1cf: 90 nop 000001d0 <fmtname>: } char* fmtname(char *path) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 56 push %esi 1d4: 53 push %ebx 1d5: 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--) 1d8: 83 ec 0c sub $0xc,%esp 1db: 53 push %ebx 1dc: e8 ff 02 00 00 call 4e0 <strlen> 1e1: 83 c4 10 add $0x10,%esp 1e4: 01 d8 add %ebx,%eax 1e6: 73 0f jae 1f7 <fmtname+0x27> 1e8: eb 12 jmp 1fc <fmtname+0x2c> 1ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1f0: 83 e8 01 sub $0x1,%eax 1f3: 39 c3 cmp %eax,%ebx 1f5: 77 05 ja 1fc <fmtname+0x2c> 1f7: 80 38 2f cmpb $0x2f,(%eax) 1fa: 75 f4 jne 1f0 <fmtname+0x20> ; p++; 1fc: 8d 58 01 lea 0x1(%eax),%ebx // Return blank-padded name. if(strlen(p) >= DIRSIZ) 1ff: 83 ec 0c sub $0xc,%esp 202: 53 push %ebx 203: e8 d8 02 00 00 call 4e0 <strlen> 208: 83 c4 10 add $0x10,%esp 20b: 83 f8 0d cmp $0xd,%eax 20e: 77 4a ja 25a <fmtname+0x8a> return p; memmove(buf, p, strlen(p)); 210: 83 ec 0c sub $0xc,%esp 213: 53 push %ebx 214: e8 c7 02 00 00 call 4e0 <strlen> 219: 83 c4 0c add $0xc,%esp 21c: 50 push %eax 21d: 53 push %ebx 21e: 68 38 10 00 00 push $0x1038 223: e8 58 04 00 00 call 680 <memmove> memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); 228: 89 1c 24 mov %ebx,(%esp) 22b: e8 b0 02 00 00 call 4e0 <strlen> 230: 89 1c 24 mov %ebx,(%esp) 233: 89 c6 mov %eax,%esi return buf; 235: bb 38 10 00 00 mov $0x1038,%ebx memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); 23a: e8 a1 02 00 00 call 4e0 <strlen> 23f: ba 0e 00 00 00 mov $0xe,%edx 244: 83 c4 0c add $0xc,%esp 247: 05 38 10 00 00 add $0x1038,%eax 24c: 29 f2 sub %esi,%edx 24e: 52 push %edx 24f: 6a 20 push $0x20 251: 50 push %eax 252: e8 b9 02 00 00 call 510 <memset> return buf; 257: 83 c4 10 add $0x10,%esp } 25a: 8d 65 f8 lea -0x8(%ebp),%esp 25d: 89 d8 mov %ebx,%eax 25f: 5b pop %ebx 260: 5e pop %esi 261: 5d pop %ebp 262: c3 ret 263: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000270 <ls>: void ls(char *path) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 57 push %edi 274: 56 push %esi 275: 53 push %ebx 276: 81 ec 54 02 00 00 sub $0x254,%esp 27c: 8b 7d 08 mov 0x8(%ebp),%edi char buf[512], *p; int fd; struct dirent de; struct stat st; if((fd = open(path, 0)) < 0) 27f: 6a 00 push $0x0 281: 57 push %edi 282: e8 6b 04 00 00 call 6f2 <open> 287: 83 c4 10 add $0x10,%esp 28a: 85 c0 test %eax,%eax 28c: 78 4a js 2d8 <ls+0x68> { printf(2, "cannot open %s\n", path); return; } if(fstat(fd, &st) < 0) 28e: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi 294: 83 ec 08 sub $0x8,%esp 297: 89 c3 mov %eax,%ebx 299: 56 push %esi 29a: 50 push %eax 29b: e8 6a 04 00 00 call 70a <fstat> 2a0: 83 c4 10 add $0x10,%esp 2a3: 85 c0 test %eax,%eax 2a5: 0f 88 a5 00 00 00 js 350 <ls+0xe0> printf(2, "cannot stat %s\n", path); close(fd); return; } switch(st.type) 2ab: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax 2b2: 66 83 f8 01 cmp $0x1,%ax 2b6: 74 68 je 320 <ls+0xb0> 2b8: 66 83 f8 02 cmp $0x2,%ax 2bc: 74 3a je 2f8 <ls+0x88> } printf(1, "name = %s, type = directory, size = %d\n", fmtname(buf), st.size); } break; } close(fd); 2be: 83 ec 0c sub $0xc,%esp 2c1: 53 push %ebx 2c2: e8 13 04 00 00 call 6da <close> 2c7: 83 c4 10 add $0x10,%esp } 2ca: 8d 65 f4 lea -0xc(%ebp),%esp 2cd: 5b pop %ebx 2ce: 5e pop %esi 2cf: 5f pop %edi 2d0: 5d pop %ebp 2d1: c3 ret 2d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printf(2, "cannot open %s\n", path); 2d8: 83 ec 04 sub $0x4,%esp 2db: 57 push %edi 2dc: 68 68 0b 00 00 push $0xb68 2e1: 6a 02 push $0x2 2e3: e8 28 05 00 00 call 810 <printf> return; 2e8: 83 c4 10 add $0x10,%esp } 2eb: 8d 65 f4 lea -0xc(%ebp),%esp 2ee: 5b pop %ebx 2ef: 5e pop %esi 2f0: 5f pop %edi 2f1: 5d pop %ebp 2f2: c3 ret 2f3: 90 nop 2f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "name = %s, type = file, size = %d\n", fmtname(path), st.size); 2f8: 83 ec 0c sub $0xc,%esp 2fb: 8b b5 e4 fd ff ff mov -0x21c(%ebp),%esi 301: 57 push %edi 302: e8 c9 fe ff ff call 1d0 <fmtname> 307: 56 push %esi 308: 50 push %eax 309: 68 cc 0b 00 00 push $0xbcc 30e: 6a 01 push $0x1 310: e8 fb 04 00 00 call 810 <printf> break; 315: 83 c4 20 add $0x20,%esp 318: eb a4 jmp 2be <ls+0x4e> 31a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf) 320: 83 ec 0c sub $0xc,%esp 323: 57 push %edi 324: e8 b7 01 00 00 call 4e0 <strlen> 329: 83 c0 10 add $0x10,%eax 32c: 83 c4 10 add $0x10,%esp 32f: 3d 00 02 00 00 cmp $0x200,%eax 334: 76 42 jbe 378 <ls+0x108> printf(1, "path too long\n"); 336: 83 ec 08 sub $0x8,%esp 339: 68 88 0b 00 00 push $0xb88 33e: 6a 01 push $0x1 340: e8 cb 04 00 00 call 810 <printf> break; 345: 83 c4 10 add $0x10,%esp 348: e9 71 ff ff ff jmp 2be <ls+0x4e> 34d: 8d 76 00 lea 0x0(%esi),%esi printf(2, "cannot stat %s\n", path); 350: 83 ec 04 sub $0x4,%esp 353: 57 push %edi 354: 68 78 0b 00 00 push $0xb78 359: 6a 02 push $0x2 35b: e8 b0 04 00 00 call 810 <printf> close(fd); 360: 89 1c 24 mov %ebx,(%esp) 363: e8 72 03 00 00 call 6da <close> return; 368: 83 c4 10 add $0x10,%esp } 36b: 8d 65 f4 lea -0xc(%ebp),%esp 36e: 5b pop %ebx 36f: 5e pop %esi 370: 5f pop %edi 371: 5d pop %ebp 372: c3 ret 373: 90 nop 374: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi strcpy(buf, path); 378: 83 ec 08 sub $0x8,%esp 37b: 57 push %edi 37c: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi 382: 57 push %edi 383: e8 d8 00 00 00 call 460 <strcpy> p = buf+strlen(buf); 388: 89 3c 24 mov %edi,(%esp) 38b: e8 50 01 00 00 call 4e0 <strlen> 390: 01 f8 add %edi,%eax while(read(fd, &de, sizeof(de)) == sizeof(de)) 392: 83 c4 10 add $0x10,%esp *p++ = '/'; 395: 8d 48 01 lea 0x1(%eax),%ecx p = buf+strlen(buf); 398: 89 85 b0 fd ff ff mov %eax,-0x250(%ebp) *p++ = '/'; 39e: c6 00 2f movb $0x2f,(%eax) 3a1: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp) 3a7: 89 f6 mov %esi,%esi 3a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi while(read(fd, &de, sizeof(de)) == sizeof(de)) 3b0: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax 3b6: 83 ec 04 sub $0x4,%esp 3b9: 6a 10 push $0x10 3bb: 50 push %eax 3bc: 53 push %ebx 3bd: e8 08 03 00 00 call 6ca <read> 3c2: 83 c4 10 add $0x10,%esp 3c5: 83 f8 10 cmp $0x10,%eax 3c8: 0f 85 f0 fe ff ff jne 2be <ls+0x4e> if(de.inum == 0) 3ce: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp) 3d5: 00 3d6: 74 d8 je 3b0 <ls+0x140> memmove(p, de.name, DIRSIZ); 3d8: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax 3de: 83 ec 04 sub $0x4,%esp 3e1: 6a 0e push $0xe 3e3: 50 push %eax 3e4: ff b5 ac fd ff ff pushl -0x254(%ebp) 3ea: e8 91 02 00 00 call 680 <memmove> p[DIRSIZ] = 0; 3ef: 8b 85 b0 fd ff ff mov -0x250(%ebp),%eax 3f5: c6 40 0f 00 movb $0x0,0xf(%eax) if(stat(buf, &st) < 0) 3f9: 58 pop %eax 3fa: 5a pop %edx 3fb: 56 push %esi 3fc: 57 push %edi 3fd: e8 ee 01 00 00 call 5f0 <stat> 402: 83 c4 10 add $0x10,%esp 405: 85 c0 test %eax,%eax 407: 78 37 js 440 <ls+0x1d0> printf(1, "name = %s, type = directory, size = %d\n", fmtname(buf), st.size); 409: 83 ec 0c sub $0xc,%esp 40c: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx 412: 57 push %edi 413: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp) 419: e8 b2 fd ff ff call 1d0 <fmtname> 41e: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx 424: 52 push %edx 425: 50 push %eax 426: 68 f0 0b 00 00 push $0xbf0 42b: 6a 01 push $0x1 42d: e8 de 03 00 00 call 810 <printf> 432: 83 c4 20 add $0x20,%esp 435: e9 76 ff ff ff jmp 3b0 <ls+0x140> 43a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printf(1, "cannot stat %s\n", buf); 440: 83 ec 04 sub $0x4,%esp 443: 57 push %edi 444: 68 78 0b 00 00 push $0xb78 449: 6a 01 push $0x1 44b: e8 c0 03 00 00 call 810 <printf> continue; 450: 83 c4 10 add $0x10,%esp 453: e9 58 ff ff ff jmp 3b0 <ls+0x140> 458: 66 90 xchg %ax,%ax 45a: 66 90 xchg %ax,%ax 45c: 66 90 xchg %ax,%ax 45e: 66 90 xchg %ax,%ax 00000460 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 460: 55 push %ebp 461: 89 e5 mov %esp,%ebp 463: 53 push %ebx 464: 8b 45 08 mov 0x8(%ebp),%eax 467: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 46a: 89 c2 mov %eax,%edx 46c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 470: 83 c1 01 add $0x1,%ecx 473: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 477: 83 c2 01 add $0x1,%edx 47a: 84 db test %bl,%bl 47c: 88 5a ff mov %bl,-0x1(%edx) 47f: 75 ef jne 470 <strcpy+0x10> ; return os; } 481: 5b pop %ebx 482: 5d pop %ebp 483: c3 ret 484: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 48a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000490 <strcmp>: int strcmp(const char *p, const char *q) { 490: 55 push %ebp 491: 89 e5 mov %esp,%ebp 493: 53 push %ebx 494: 8b 55 08 mov 0x8(%ebp),%edx 497: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 49a: 0f b6 02 movzbl (%edx),%eax 49d: 0f b6 19 movzbl (%ecx),%ebx 4a0: 84 c0 test %al,%al 4a2: 75 1c jne 4c0 <strcmp+0x30> 4a4: eb 2a jmp 4d0 <strcmp+0x40> 4a6: 8d 76 00 lea 0x0(%esi),%esi 4a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 4b0: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 4b3: 0f b6 02 movzbl (%edx),%eax p++, q++; 4b6: 83 c1 01 add $0x1,%ecx 4b9: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 4bc: 84 c0 test %al,%al 4be: 74 10 je 4d0 <strcmp+0x40> 4c0: 38 d8 cmp %bl,%al 4c2: 74 ec je 4b0 <strcmp+0x20> return (uchar)*p - (uchar)*q; 4c4: 29 d8 sub %ebx,%eax } 4c6: 5b pop %ebx 4c7: 5d pop %ebp 4c8: c3 ret 4c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 4d0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 4d2: 29 d8 sub %ebx,%eax } 4d4: 5b pop %ebx 4d5: 5d pop %ebp 4d6: c3 ret 4d7: 89 f6 mov %esi,%esi 4d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000004e0 <strlen>: uint strlen(char *s) { 4e0: 55 push %ebp 4e1: 89 e5 mov %esp,%ebp 4e3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 4e6: 80 39 00 cmpb $0x0,(%ecx) 4e9: 74 15 je 500 <strlen+0x20> 4eb: 31 d2 xor %edx,%edx 4ed: 8d 76 00 lea 0x0(%esi),%esi 4f0: 83 c2 01 add $0x1,%edx 4f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 4f7: 89 d0 mov %edx,%eax 4f9: 75 f5 jne 4f0 <strlen+0x10> ; return n; } 4fb: 5d pop %ebp 4fc: c3 ret 4fd: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 500: 31 c0 xor %eax,%eax } 502: 5d pop %ebp 503: c3 ret 504: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 50a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000510 <memset>: void* memset(void *dst, int c, uint n) { 510: 55 push %ebp 511: 89 e5 mov %esp,%ebp 513: 57 push %edi 514: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 517: 8b 4d 10 mov 0x10(%ebp),%ecx 51a: 8b 45 0c mov 0xc(%ebp),%eax 51d: 89 d7 mov %edx,%edi 51f: fc cld 520: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 522: 89 d0 mov %edx,%eax 524: 5f pop %edi 525: 5d pop %ebp 526: c3 ret 527: 89 f6 mov %esi,%esi 529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000530 <strchr>: char* strchr(const char *s, char c) { 530: 55 push %ebp 531: 89 e5 mov %esp,%ebp 533: 53 push %ebx 534: 8b 45 08 mov 0x8(%ebp),%eax 537: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 53a: 0f b6 10 movzbl (%eax),%edx 53d: 84 d2 test %dl,%dl 53f: 74 1d je 55e <strchr+0x2e> if(*s == c) 541: 38 d3 cmp %dl,%bl 543: 89 d9 mov %ebx,%ecx 545: 75 0d jne 554 <strchr+0x24> 547: eb 17 jmp 560 <strchr+0x30> 549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 550: 38 ca cmp %cl,%dl 552: 74 0c je 560 <strchr+0x30> for(; *s; s++) 554: 83 c0 01 add $0x1,%eax 557: 0f b6 10 movzbl (%eax),%edx 55a: 84 d2 test %dl,%dl 55c: 75 f2 jne 550 <strchr+0x20> return (char*)s; return 0; 55e: 31 c0 xor %eax,%eax } 560: 5b pop %ebx 561: 5d pop %ebp 562: c3 ret 563: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000570 <gets>: char* gets(char *buf, int max) { 570: 55 push %ebp 571: 89 e5 mov %esp,%ebp 573: 57 push %edi 574: 56 push %esi 575: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 576: 31 f6 xor %esi,%esi 578: 89 f3 mov %esi,%ebx { 57a: 83 ec 1c sub $0x1c,%esp 57d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 580: eb 2f jmp 5b1 <gets+0x41> 582: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 588: 8d 45 e7 lea -0x19(%ebp),%eax 58b: 83 ec 04 sub $0x4,%esp 58e: 6a 01 push $0x1 590: 50 push %eax 591: 6a 00 push $0x0 593: e8 32 01 00 00 call 6ca <read> if(cc < 1) 598: 83 c4 10 add $0x10,%esp 59b: 85 c0 test %eax,%eax 59d: 7e 1c jle 5bb <gets+0x4b> break; buf[i++] = c; 59f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 5a3: 83 c7 01 add $0x1,%edi 5a6: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 5a9: 3c 0a cmp $0xa,%al 5ab: 74 23 je 5d0 <gets+0x60> 5ad: 3c 0d cmp $0xd,%al 5af: 74 1f je 5d0 <gets+0x60> for(i=0; i+1 < max; ){ 5b1: 83 c3 01 add $0x1,%ebx 5b4: 3b 5d 0c cmp 0xc(%ebp),%ebx 5b7: 89 fe mov %edi,%esi 5b9: 7c cd jl 588 <gets+0x18> 5bb: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 5bd: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 5c0: c6 03 00 movb $0x0,(%ebx) } 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 5cb: 90 nop 5cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 5d0: 8b 75 08 mov 0x8(%ebp),%esi 5d3: 8b 45 08 mov 0x8(%ebp),%eax 5d6: 01 de add %ebx,%esi 5d8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 5da: c6 03 00 movb $0x0,(%ebx) } 5dd: 8d 65 f4 lea -0xc(%ebp),%esp 5e0: 5b pop %ebx 5e1: 5e pop %esi 5e2: 5f pop %edi 5e3: 5d pop %ebp 5e4: c3 ret 5e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 5e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000005f0 <stat>: int stat(char *n, struct stat *st) { 5f0: 55 push %ebp 5f1: 89 e5 mov %esp,%ebp 5f3: 56 push %esi 5f4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 5f5: 83 ec 08 sub $0x8,%esp 5f8: 6a 00 push $0x0 5fa: ff 75 08 pushl 0x8(%ebp) 5fd: e8 f0 00 00 00 call 6f2 <open> if(fd < 0) 602: 83 c4 10 add $0x10,%esp 605: 85 c0 test %eax,%eax 607: 78 27 js 630 <stat+0x40> return -1; r = fstat(fd, st); 609: 83 ec 08 sub $0x8,%esp 60c: ff 75 0c pushl 0xc(%ebp) 60f: 89 c3 mov %eax,%ebx 611: 50 push %eax 612: e8 f3 00 00 00 call 70a <fstat> close(fd); 617: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 61a: 89 c6 mov %eax,%esi close(fd); 61c: e8 b9 00 00 00 call 6da <close> return r; 621: 83 c4 10 add $0x10,%esp } 624: 8d 65 f8 lea -0x8(%ebp),%esp 627: 89 f0 mov %esi,%eax 629: 5b pop %ebx 62a: 5e pop %esi 62b: 5d pop %ebp 62c: c3 ret 62d: 8d 76 00 lea 0x0(%esi),%esi return -1; 630: be ff ff ff ff mov $0xffffffff,%esi 635: eb ed jmp 624 <stat+0x34> 637: 89 f6 mov %esi,%esi 639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000640 <atoi>: int atoi(const char *s) { 640: 55 push %ebp 641: 89 e5 mov %esp,%ebp 643: 53 push %ebx 644: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 647: 0f be 11 movsbl (%ecx),%edx 64a: 8d 42 d0 lea -0x30(%edx),%eax 64d: 3c 09 cmp $0x9,%al n = 0; 64f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 654: 77 1f ja 675 <atoi+0x35> 656: 8d 76 00 lea 0x0(%esi),%esi 659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 660: 8d 04 80 lea (%eax,%eax,4),%eax 663: 83 c1 01 add $0x1,%ecx 666: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 66a: 0f be 11 movsbl (%ecx),%edx 66d: 8d 5a d0 lea -0x30(%edx),%ebx 670: 80 fb 09 cmp $0x9,%bl 673: 76 eb jbe 660 <atoi+0x20> return n; } 675: 5b pop %ebx 676: 5d pop %ebp 677: c3 ret 678: 90 nop 679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000680 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 680: 55 push %ebp 681: 89 e5 mov %esp,%ebp 683: 56 push %esi 684: 53 push %ebx 685: 8b 5d 10 mov 0x10(%ebp),%ebx 688: 8b 45 08 mov 0x8(%ebp),%eax 68b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 68e: 85 db test %ebx,%ebx 690: 7e 14 jle 6a6 <memmove+0x26> 692: 31 d2 xor %edx,%edx 694: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 698: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 69c: 88 0c 10 mov %cl,(%eax,%edx,1) 69f: 83 c2 01 add $0x1,%edx while(n-- > 0) 6a2: 39 d3 cmp %edx,%ebx 6a4: 75 f2 jne 698 <memmove+0x18> return vdst; } 6a6: 5b pop %ebx 6a7: 5e pop %esi 6a8: 5d pop %ebp 6a9: c3 ret 000006aa <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 6aa: b8 01 00 00 00 mov $0x1,%eax 6af: cd 40 int $0x40 6b1: c3 ret 000006b2 <exit>: SYSCALL(exit) 6b2: b8 02 00 00 00 mov $0x2,%eax 6b7: cd 40 int $0x40 6b9: c3 ret 000006ba <wait>: SYSCALL(wait) 6ba: b8 03 00 00 00 mov $0x3,%eax 6bf: cd 40 int $0x40 6c1: c3 ret 000006c2 <pipe>: SYSCALL(pipe) 6c2: b8 04 00 00 00 mov $0x4,%eax 6c7: cd 40 int $0x40 6c9: c3 ret 000006ca <read>: SYSCALL(read) 6ca: b8 05 00 00 00 mov $0x5,%eax 6cf: cd 40 int $0x40 6d1: c3 ret 000006d2 <write>: SYSCALL(write) 6d2: b8 10 00 00 00 mov $0x10,%eax 6d7: cd 40 int $0x40 6d9: c3 ret 000006da <close>: SYSCALL(close) 6da: b8 15 00 00 00 mov $0x15,%eax 6df: cd 40 int $0x40 6e1: c3 ret 000006e2 <kill>: SYSCALL(kill) 6e2: b8 06 00 00 00 mov $0x6,%eax 6e7: cd 40 int $0x40 6e9: c3 ret 000006ea <exec>: SYSCALL(exec) 6ea: b8 07 00 00 00 mov $0x7,%eax 6ef: cd 40 int $0x40 6f1: c3 ret 000006f2 <open>: SYSCALL(open) 6f2: b8 0f 00 00 00 mov $0xf,%eax 6f7: cd 40 int $0x40 6f9: c3 ret 000006fa <mknod>: SYSCALL(mknod) 6fa: b8 11 00 00 00 mov $0x11,%eax 6ff: cd 40 int $0x40 701: c3 ret 00000702 <unlink>: SYSCALL(unlink) 702: b8 12 00 00 00 mov $0x12,%eax 707: cd 40 int $0x40 709: c3 ret 0000070a <fstat>: SYSCALL(fstat) 70a: b8 08 00 00 00 mov $0x8,%eax 70f: cd 40 int $0x40 711: c3 ret 00000712 <link>: SYSCALL(link) 712: b8 13 00 00 00 mov $0x13,%eax 717: cd 40 int $0x40 719: c3 ret 0000071a <mkdir>: SYSCALL(mkdir) 71a: b8 14 00 00 00 mov $0x14,%eax 71f: cd 40 int $0x40 721: c3 ret 00000722 <chdir>: SYSCALL(chdir) 722: b8 09 00 00 00 mov $0x9,%eax 727: cd 40 int $0x40 729: c3 ret 0000072a <dup>: SYSCALL(dup) 72a: b8 0a 00 00 00 mov $0xa,%eax 72f: cd 40 int $0x40 731: c3 ret 00000732 <getpid>: SYSCALL(getpid) 732: b8 0b 00 00 00 mov $0xb,%eax 737: cd 40 int $0x40 739: c3 ret 0000073a <sbrk>: SYSCALL(sbrk) 73a: b8 0c 00 00 00 mov $0xc,%eax 73f: cd 40 int $0x40 741: c3 ret 00000742 <sleep>: SYSCALL(sleep) 742: b8 0d 00 00 00 mov $0xd,%eax 747: cd 40 int $0x40 749: c3 ret 0000074a <uptime>: SYSCALL(uptime) 74a: b8 0e 00 00 00 mov $0xe,%eax 74f: cd 40 int $0x40 751: c3 ret 00000752 <date>: SYSCALL(date) 752: b8 16 00 00 00 mov $0x16,%eax 757: cd 40 int $0x40 759: c3 ret 0000075a <getcwd>: SYSCALL(getcwd) 75a: b8 17 00 00 00 mov $0x17,%eax 75f: cd 40 int $0x40 761: c3 ret 00000762 <halt>: SYSCALL(halt) 762: b8 18 00 00 00 mov $0x18,%eax 767: cd 40 int $0x40 769: c3 ret 76a: 66 90 xchg %ax,%ax 76c: 66 90 xchg %ax,%ax 76e: 66 90 xchg %ax,%ax 00000770 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 770: 55 push %ebp 771: 89 e5 mov %esp,%ebp 773: 57 push %edi 774: 56 push %esi 775: 53 push %ebx 776: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 779: 85 d2 test %edx,%edx { 77b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 77e: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 780: 79 76 jns 7f8 <printint+0x88> 782: f6 45 08 01 testb $0x1,0x8(%ebp) 786: 74 70 je 7f8 <printint+0x88> x = -xx; 788: f7 d8 neg %eax neg = 1; 78a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 791: 31 f6 xor %esi,%esi 793: 8d 5d d7 lea -0x29(%ebp),%ebx 796: eb 0a jmp 7a2 <printint+0x32> 798: 90 nop 799: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 7a0: 89 fe mov %edi,%esi 7a2: 31 d2 xor %edx,%edx 7a4: 8d 7e 01 lea 0x1(%esi),%edi 7a7: f7 f1 div %ecx 7a9: 0f b6 92 14 0d 00 00 movzbl 0xd14(%edx),%edx }while((x /= base) != 0); 7b0: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 7b2: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 7b5: 75 e9 jne 7a0 <printint+0x30> if(neg) 7b7: 8b 45 c4 mov -0x3c(%ebp),%eax 7ba: 85 c0 test %eax,%eax 7bc: 74 08 je 7c6 <printint+0x56> buf[i++] = '-'; 7be: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 7c3: 8d 7e 02 lea 0x2(%esi),%edi 7c6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 7ca: 8b 7d c0 mov -0x40(%ebp),%edi 7cd: 8d 76 00 lea 0x0(%esi),%esi 7d0: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 7d3: 83 ec 04 sub $0x4,%esp 7d6: 83 ee 01 sub $0x1,%esi 7d9: 6a 01 push $0x1 7db: 53 push %ebx 7dc: 57 push %edi 7dd: 88 45 d7 mov %al,-0x29(%ebp) 7e0: e8 ed fe ff ff call 6d2 <write> while(--i >= 0) 7e5: 83 c4 10 add $0x10,%esp 7e8: 39 de cmp %ebx,%esi 7ea: 75 e4 jne 7d0 <printint+0x60> putc(fd, buf[i]); } 7ec: 8d 65 f4 lea -0xc(%ebp),%esp 7ef: 5b pop %ebx 7f0: 5e pop %esi 7f1: 5f pop %edi 7f2: 5d pop %ebp 7f3: c3 ret 7f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 7f8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 7ff: eb 90 jmp 791 <printint+0x21> 801: eb 0d jmp 810 <printf> 803: 90 nop 804: 90 nop 805: 90 nop 806: 90 nop 807: 90 nop 808: 90 nop 809: 90 nop 80a: 90 nop 80b: 90 nop 80c: 90 nop 80d: 90 nop 80e: 90 nop 80f: 90 nop 00000810 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 810: 55 push %ebp 811: 89 e5 mov %esp,%ebp 813: 57 push %edi 814: 56 push %esi 815: 53 push %ebx 816: 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++){ 819: 8b 75 0c mov 0xc(%ebp),%esi 81c: 0f b6 1e movzbl (%esi),%ebx 81f: 84 db test %bl,%bl 821: 0f 84 b3 00 00 00 je 8da <printf+0xca> ap = (uint*)(void*)&fmt + 1; 827: 8d 45 10 lea 0x10(%ebp),%eax 82a: 83 c6 01 add $0x1,%esi state = 0; 82d: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 82f: 89 45 d4 mov %eax,-0x2c(%ebp) 832: eb 2f jmp 863 <printf+0x53> 834: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 838: 83 f8 25 cmp $0x25,%eax 83b: 0f 84 a7 00 00 00 je 8e8 <printf+0xd8> write(fd, &c, 1); 841: 8d 45 e2 lea -0x1e(%ebp),%eax 844: 83 ec 04 sub $0x4,%esp 847: 88 5d e2 mov %bl,-0x1e(%ebp) 84a: 6a 01 push $0x1 84c: 50 push %eax 84d: ff 75 08 pushl 0x8(%ebp) 850: e8 7d fe ff ff call 6d2 <write> 855: 83 c4 10 add $0x10,%esp 858: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 85b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 85f: 84 db test %bl,%bl 861: 74 77 je 8da <printf+0xca> if(state == 0){ 863: 85 ff test %edi,%edi c = fmt[i] & 0xff; 865: 0f be cb movsbl %bl,%ecx 868: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 86b: 74 cb je 838 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 86d: 83 ff 25 cmp $0x25,%edi 870: 75 e6 jne 858 <printf+0x48> if(c == 'd'){ 872: 83 f8 64 cmp $0x64,%eax 875: 0f 84 05 01 00 00 je 980 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 87b: 81 e1 f7 00 00 00 and $0xf7,%ecx 881: 83 f9 70 cmp $0x70,%ecx 884: 74 72 je 8f8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 886: 83 f8 73 cmp $0x73,%eax 889: 0f 84 99 00 00 00 je 928 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 88f: 83 f8 63 cmp $0x63,%eax 892: 0f 84 08 01 00 00 je 9a0 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 898: 83 f8 25 cmp $0x25,%eax 89b: 0f 84 ef 00 00 00 je 990 <printf+0x180> write(fd, &c, 1); 8a1: 8d 45 e7 lea -0x19(%ebp),%eax 8a4: 83 ec 04 sub $0x4,%esp 8a7: c6 45 e7 25 movb $0x25,-0x19(%ebp) 8ab: 6a 01 push $0x1 8ad: 50 push %eax 8ae: ff 75 08 pushl 0x8(%ebp) 8b1: e8 1c fe ff ff call 6d2 <write> 8b6: 83 c4 0c add $0xc,%esp 8b9: 8d 45 e6 lea -0x1a(%ebp),%eax 8bc: 88 5d e6 mov %bl,-0x1a(%ebp) 8bf: 6a 01 push $0x1 8c1: 50 push %eax 8c2: ff 75 08 pushl 0x8(%ebp) 8c5: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 8c8: 31 ff xor %edi,%edi write(fd, &c, 1); 8ca: e8 03 fe ff ff call 6d2 <write> for(i = 0; fmt[i]; i++){ 8cf: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 8d3: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 8d6: 84 db test %bl,%bl 8d8: 75 89 jne 863 <printf+0x53> } } } 8da: 8d 65 f4 lea -0xc(%ebp),%esp 8dd: 5b pop %ebx 8de: 5e pop %esi 8df: 5f pop %edi 8e0: 5d pop %ebp 8e1: c3 ret 8e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 8e8: bf 25 00 00 00 mov $0x25,%edi 8ed: e9 66 ff ff ff jmp 858 <printf+0x48> 8f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 8f8: 83 ec 0c sub $0xc,%esp 8fb: b9 10 00 00 00 mov $0x10,%ecx 900: 6a 00 push $0x0 902: 8b 7d d4 mov -0x2c(%ebp),%edi 905: 8b 45 08 mov 0x8(%ebp),%eax 908: 8b 17 mov (%edi),%edx 90a: e8 61 fe ff ff call 770 <printint> ap++; 90f: 89 f8 mov %edi,%eax 911: 83 c4 10 add $0x10,%esp state = 0; 914: 31 ff xor %edi,%edi ap++; 916: 83 c0 04 add $0x4,%eax 919: 89 45 d4 mov %eax,-0x2c(%ebp) 91c: e9 37 ff ff ff jmp 858 <printf+0x48> 921: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 928: 8b 45 d4 mov -0x2c(%ebp),%eax 92b: 8b 08 mov (%eax),%ecx ap++; 92d: 83 c0 04 add $0x4,%eax 930: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 933: 85 c9 test %ecx,%ecx 935: 0f 84 8e 00 00 00 je 9c9 <printf+0x1b9> while(*s != 0){ 93b: 0f b6 01 movzbl (%ecx),%eax state = 0; 93e: 31 ff xor %edi,%edi s = (char*)*ap; 940: 89 cb mov %ecx,%ebx while(*s != 0){ 942: 84 c0 test %al,%al 944: 0f 84 0e ff ff ff je 858 <printf+0x48> 94a: 89 75 d0 mov %esi,-0x30(%ebp) 94d: 89 de mov %ebx,%esi 94f: 8b 5d 08 mov 0x8(%ebp),%ebx 952: 8d 7d e3 lea -0x1d(%ebp),%edi 955: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 958: 83 ec 04 sub $0x4,%esp s++; 95b: 83 c6 01 add $0x1,%esi 95e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 961: 6a 01 push $0x1 963: 57 push %edi 964: 53 push %ebx 965: e8 68 fd ff ff call 6d2 <write> while(*s != 0){ 96a: 0f b6 06 movzbl (%esi),%eax 96d: 83 c4 10 add $0x10,%esp 970: 84 c0 test %al,%al 972: 75 e4 jne 958 <printf+0x148> 974: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 977: 31 ff xor %edi,%edi 979: e9 da fe ff ff jmp 858 <printf+0x48> 97e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 980: 83 ec 0c sub $0xc,%esp 983: b9 0a 00 00 00 mov $0xa,%ecx 988: 6a 01 push $0x1 98a: e9 73 ff ff ff jmp 902 <printf+0xf2> 98f: 90 nop write(fd, &c, 1); 990: 83 ec 04 sub $0x4,%esp 993: 88 5d e5 mov %bl,-0x1b(%ebp) 996: 8d 45 e5 lea -0x1b(%ebp),%eax 999: 6a 01 push $0x1 99b: e9 21 ff ff ff jmp 8c1 <printf+0xb1> putc(fd, *ap); 9a0: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 9a3: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 9a6: 8b 07 mov (%edi),%eax write(fd, &c, 1); 9a8: 6a 01 push $0x1 ap++; 9aa: 83 c7 04 add $0x4,%edi putc(fd, *ap); 9ad: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 9b0: 8d 45 e4 lea -0x1c(%ebp),%eax 9b3: 50 push %eax 9b4: ff 75 08 pushl 0x8(%ebp) 9b7: e8 16 fd ff ff call 6d2 <write> ap++; 9bc: 89 7d d4 mov %edi,-0x2c(%ebp) 9bf: 83 c4 10 add $0x10,%esp state = 0; 9c2: 31 ff xor %edi,%edi 9c4: e9 8f fe ff ff jmp 858 <printf+0x48> s = "(null)"; 9c9: bb 0c 0d 00 00 mov $0xd0c,%ebx while(*s != 0){ 9ce: b8 28 00 00 00 mov $0x28,%eax 9d3: e9 72 ff ff ff jmp 94a <printf+0x13a> 9d8: 66 90 xchg %ax,%ax 9da: 66 90 xchg %ax,%ax 9dc: 66 90 xchg %ax,%ax 9de: 66 90 xchg %ax,%ax 000009e0 <free>: static Header base; static Header *freep; void free(void *ap) { 9e0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 9e1: a1 48 10 00 00 mov 0x1048,%eax { 9e6: 89 e5 mov %esp,%ebp 9e8: 57 push %edi 9e9: 56 push %esi 9ea: 53 push %ebx 9eb: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 9ee: 8d 4b f8 lea -0x8(%ebx),%ecx 9f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 9f8: 39 c8 cmp %ecx,%eax 9fa: 8b 10 mov (%eax),%edx 9fc: 73 32 jae a30 <free+0x50> 9fe: 39 d1 cmp %edx,%ecx a00: 72 04 jb a06 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) a02: 39 d0 cmp %edx,%eax a04: 72 32 jb a38 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ a06: 8b 73 fc mov -0x4(%ebx),%esi a09: 8d 3c f1 lea (%ecx,%esi,8),%edi a0c: 39 fa cmp %edi,%edx a0e: 74 30 je a40 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; a10: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ a13: 8b 50 04 mov 0x4(%eax),%edx a16: 8d 34 d0 lea (%eax,%edx,8),%esi a19: 39 f1 cmp %esi,%ecx a1b: 74 3a je a57 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; a1d: 89 08 mov %ecx,(%eax) freep = p; a1f: a3 48 10 00 00 mov %eax,0x1048 } a24: 5b pop %ebx a25: 5e pop %esi a26: 5f pop %edi a27: 5d pop %ebp a28: c3 ret a29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) a30: 39 d0 cmp %edx,%eax a32: 72 04 jb a38 <free+0x58> a34: 39 d1 cmp %edx,%ecx a36: 72 ce jb a06 <free+0x26> { a38: 89 d0 mov %edx,%eax a3a: eb bc jmp 9f8 <free+0x18> a3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; a40: 03 72 04 add 0x4(%edx),%esi a43: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; a46: 8b 10 mov (%eax),%edx a48: 8b 12 mov (%edx),%edx a4a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ a4d: 8b 50 04 mov 0x4(%eax),%edx a50: 8d 34 d0 lea (%eax,%edx,8),%esi a53: 39 f1 cmp %esi,%ecx a55: 75 c6 jne a1d <free+0x3d> p->s.size += bp->s.size; a57: 03 53 fc add -0x4(%ebx),%edx freep = p; a5a: a3 48 10 00 00 mov %eax,0x1048 p->s.size += bp->s.size; a5f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; a62: 8b 53 f8 mov -0x8(%ebx),%edx a65: 89 10 mov %edx,(%eax) } a67: 5b pop %ebx a68: 5e pop %esi a69: 5f pop %edi a6a: 5d pop %ebp a6b: c3 ret a6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000a70 <malloc>: return freep; } void* malloc(uint nbytes) { a70: 55 push %ebp a71: 89 e5 mov %esp,%ebp a73: 57 push %edi a74: 56 push %esi a75: 53 push %ebx a76: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; a79: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ a7c: 8b 15 48 10 00 00 mov 0x1048,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; a82: 8d 78 07 lea 0x7(%eax),%edi a85: c1 ef 03 shr $0x3,%edi a88: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ a8b: 85 d2 test %edx,%edx a8d: 0f 84 9d 00 00 00 je b30 <malloc+0xc0> a93: 8b 02 mov (%edx),%eax a95: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ a98: 39 cf cmp %ecx,%edi a9a: 76 6c jbe b08 <malloc+0x98> a9c: 81 ff 00 10 00 00 cmp $0x1000,%edi aa2: bb 00 10 00 00 mov $0x1000,%ebx aa7: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); aaa: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi ab1: eb 0e jmp ac1 <malloc+0x51> ab3: 90 nop ab4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ ab8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ aba: 8b 48 04 mov 0x4(%eax),%ecx abd: 39 f9 cmp %edi,%ecx abf: 73 47 jae b08 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) ac1: 39 05 48 10 00 00 cmp %eax,0x1048 ac7: 89 c2 mov %eax,%edx ac9: 75 ed jne ab8 <malloc+0x48> p = sbrk(nu * sizeof(Header)); acb: 83 ec 0c sub $0xc,%esp ace: 56 push %esi acf: e8 66 fc ff ff call 73a <sbrk> if(p == (char*)-1) ad4: 83 c4 10 add $0x10,%esp ad7: 83 f8 ff cmp $0xffffffff,%eax ada: 74 1c je af8 <malloc+0x88> hp->s.size = nu; adc: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); adf: 83 ec 0c sub $0xc,%esp ae2: 83 c0 08 add $0x8,%eax ae5: 50 push %eax ae6: e8 f5 fe ff ff call 9e0 <free> return freep; aeb: 8b 15 48 10 00 00 mov 0x1048,%edx if((p = morecore(nunits)) == 0) af1: 83 c4 10 add $0x10,%esp af4: 85 d2 test %edx,%edx af6: 75 c0 jne ab8 <malloc+0x48> return 0; } } af8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; afb: 31 c0 xor %eax,%eax } afd: 5b pop %ebx afe: 5e pop %esi aff: 5f pop %edi b00: 5d pop %ebp b01: c3 ret b02: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) b08: 39 cf cmp %ecx,%edi b0a: 74 54 je b60 <malloc+0xf0> p->s.size -= nunits; b0c: 29 f9 sub %edi,%ecx b0e: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; b11: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; b14: 89 78 04 mov %edi,0x4(%eax) freep = prevp; b17: 89 15 48 10 00 00 mov %edx,0x1048 } b1d: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); b20: 83 c0 08 add $0x8,%eax } b23: 5b pop %ebx b24: 5e pop %esi b25: 5f pop %edi b26: 5d pop %ebp b27: c3 ret b28: 90 nop b29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; b30: c7 05 48 10 00 00 4c movl $0x104c,0x1048 b37: 10 00 00 b3a: c7 05 4c 10 00 00 4c movl $0x104c,0x104c b41: 10 00 00 base.s.size = 0; b44: b8 4c 10 00 00 mov $0x104c,%eax b49: c7 05 50 10 00 00 00 movl $0x0,0x1050 b50: 00 00 00 b53: e9 44 ff ff ff jmp a9c <malloc+0x2c> b58: 90 nop b59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; b60: 8b 08 mov (%eax),%ecx b62: 89 0a mov %ecx,(%edx) b64: eb b1 jmp b17 <malloc+0xa7>
.import source "64spec.asm" .import source "64core/memory.asm" .import source "64core/math.asm" sfspec: :init_spec() :describe("assert_bytes_not_equal") :it("fails when comparing empty arrays") :assert_bytes_not_equal 0: a: b: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine :it("fails when comparing arrays with same elements") :assert_bytes_not_equal 1: a: b: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine :it("passes if arrays have different values") :assert_bytes_not_equal 2: a: b :it("can compare 256-element arrays") :assert_bytes_not_equal 256: ascending1: ascending2: _64SPEC.assertion_failed_subroutine: _64SPEC.assertion_passed_subroutine :it("passes if any element is different"); { .var bytes_count = 256*2 +47 :poke ascending1+bytes_count: #23 :poke ascending2+bytes_count: #32 { loop: :inc16 dec_value :inc16 inc_value :cmp_eq16 dec_value: #[ascending2 + bytes_count] beq end .label dec_value = * + 1 dec ascending2 - 1 :assert_bytes_not_equal bytes_count: ascending1: ascending2 ldx pos .label inc_value = * + 1 inc ascending2 - 1, X jmp loop end: } :poke ascending1+bytes_count: #256 :poke ascending2+bytes_count: #256 } :finish_spec() .pc = * "Data" .byte 23 a: .byte 5 .byte 24 b: .byte 5 .byte 25 pos: .word 0 .byte 26 ascending1: .fill 3*256, i .byte 27 ascending2: .fill 3*256, i .byte 28
; TI83+ Graylib interrupt ;--------------------------------------------------------------------------- ; ; Ported by Stefano Bodrato - Mar 2000 ; ; Recoded -because of strange problems- by Henk Poley - July 2001 ; Based upon vnGrey, a Venus greyscale library (Ti83). ; ; $Id: gray83p.asm,v 1.6 2015-01-21 07:05:00 stefano Exp $ ; INCLUDE "target/ti83p/classic/int83p.asm" ; Put interrupt loader here IF TI83PLUSAPP ; Statvars is already zeroed ELSE ; HL = $8A8C inc hl ; We need to intialize variables ld (hl),0 ; by ourself. ENDIF jp jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- IntProcStart: push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ; exit_interrupt: in a,(3) ; check vbl int and @00000010 ; jr z,exit_interrupt2 ; ld hl,intcount ; int counter res 7,(hl) ; inc (hl) ; ld a,(hl) ; dec a ; 1 jr z,Display_pic1 ; dec a ; 2 jr z,Display_pic2 ; ld (hl),0 ; reset counter exit_interrupt2: ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; in a,(3) ; check on interrupt status rra ; ld a,0 ; adc a,9 ; out (3),a ; ld a,$0B ; out (3),a ; ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; int_fix: pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt Display_pic1: ld hl,(graybit1) ; jr DisplayPicture ; Display_pic2: ld hl,(graybit2) ; DisplayPicture: ld a,$80 ; fastCopy routine out ($10),a ; (Joe Wingbermuehle) ld a,$20 ; ld c,a ; ld de,755 ; add hl,de ; fastCopyAgain: ld b,64 ; inc c ; ld de,-(12*64)+1 ; out ($10),a ; add hl,de ; ld de,10 ; fastCopyLoop: add hl,de ; inc hl ; inc hl ; inc de ; ld a,(hl) ; out ($11),a ; dec de ; djnz fastCopyLoop ; ld a,c ; cp $2B+1 ; jr nz,fastCopyAgain ; jr exit_interrupt2 ; IntProcEnd: IF !TI83PLUSAPP PUBLIC graybit1 PUBLIC graybit2 defc intcount = $8A8D ; 1 byte needed graybit1: defw plotSScreen graybit2: defw appBackUpScreen ENDIF jump_over: ; Memory usage in statvars: ; --------------------------------------------------------------- ; $8A3A / $8A89 - 80 bytes - free (or used by z88dk app) ; $8A8A / $8A8C - 3 bytes - JP IntProcStart ; $8A8D - 1 byte - intcount <-- ; $8A8E / $8AFF - 114 bytes - free (some bytes used by z88dk app) ; $8B00 / $8C00 - 256 bytes - IV table ; $8C01 / $8C4D - 77 bytes - free ; ---------------------------------------------------------------
.global s_prepare_buffers s_prepare_buffers: push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x15f12, %rsi lea addresses_normal_ht+0xd92, %rdi nop nop nop xor $64341, %rbp mov $60, %rcx rep movsb nop nop nop and $37317, %rsi pop %rsi pop %rdi pop %rcx pop %rbp ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rbx push %rcx push %rdx push %rsi // Store lea addresses_US+0x8f12, %r11 nop and %rdx, %rdx movb $0x51, (%r11) nop nop nop xor $32015, %rcx // Store lea addresses_A+0x18a18, %r8 nop cmp %r11, %r11 mov $0x5152535455565758, %rbx movq %rbx, (%r8) nop nop nop nop nop and $25752, %r8 // Store lea addresses_WC+0x1b8dc, %r11 clflush (%r11) nop nop nop add %r8, %r8 movl $0x51525354, (%r11) nop nop nop nop nop cmp %rdx, %rdx // Store mov $0x7fd9250000000012, %r8 nop nop nop nop nop sub %rcx, %rcx mov $0x5152535455565758, %rdx movq %rdx, %xmm6 movups %xmm6, (%r8) and $46915, %r11 // Store lea addresses_normal+0x1f012, %rdx and %r12, %r12 mov $0x5152535455565758, %r11 movq %r11, (%rdx) nop nop nop add %r11, %r11 // Store lea addresses_WT+0x1208a, %r12 nop nop nop nop xor $29137, %rcx mov $0x5152535455565758, %rbx movq %rbx, %xmm4 movups %xmm4, (%r12) cmp $11858, %r12 // Store lea addresses_WT+0x4812, %r11 clflush (%r11) nop dec %r12 mov $0x5152535455565758, %rdx movq %rdx, (%r11) nop nop dec %r8 // Faulty Load lea addresses_A+0x1c812, %r11 nop nop and $56204, %r8 mov (%r11), %dx lea oracles, %rbx and $0xff, %rdx shlq $12, %rdx mov (%rbx,%rdx,1), %rdx pop %rsi pop %rdx pop %rcx pop %rbx pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 11}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}} {'58': 441} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
// Copyright (C) 2018-2019 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include <map> #include <memory> #include <string> #include <vector> #include <functional> #include <utils/ocv_common.hpp> #include <inference_engine.hpp> /** * @brief Base class of config for network */ struct CnnConfig { explicit CnnConfig(const std::string& path_to_model) : path_to_model(path_to_model) {} /** @brief Path to model description */ std::string path_to_model; /** @brief Maximal size of batch */ int max_batch_size{1}; }; /** * @brief Base class of network */ class CnnBase { public: using Config = CnnConfig; /** * @brief Constructor */ CnnBase(const Config& config, const InferenceEngine::Core & ie, const std::string & deviceName); /** * @brief Descructor */ virtual ~CnnBase() {} /** * @brief Loads network */ void Load(); /** * @brief Prints performance report */ void PrintPerformanceCounts(std::string fullDeviceName) const; protected: /** * @brief Run network * * @param frame Input image * @param results_fetcher Callback to fetch inference results */ void Infer(const cv::Mat& frame, const std::function<void(const InferenceEngine::BlobMap&, size_t)>& results_fetcher) const; /** * @brief Run network in batch mode * * @param frames Vector of input images * @param results_fetcher Callback to fetch inference results */ void InferBatch(const std::vector<cv::Mat>& frames, const std::function<void(const InferenceEngine::BlobMap&, size_t)>& results_fetcher) const; /** @brief Config */ Config config_; /** @brief Inference Engine instance */ InferenceEngine::Core ie_; /** @brief Inference Engine device */ std::string deviceName_; /** @brief Net outputs info */ InferenceEngine::OutputsDataMap outInfo_; /** @brief IE network */ InferenceEngine::ExecutableNetwork executable_network_; /** @brief IE InferRequest */ mutable InferenceEngine::InferRequest infer_request_; /** @brief Pointer to the pre-allocated input blob */ mutable InferenceEngine::Blob::Ptr input_blob_; /** @brief Map of output blobs */ InferenceEngine::BlobMap outputs_; }; class VectorCNN : public CnnBase { public: VectorCNN(const CnnConfig& config, const InferenceEngine::Core & ie, const std::string & deviceName); void Compute(const cv::Mat& image, cv::Mat* vector, cv::Size outp_shape = cv::Size()) const; void Compute(const std::vector<cv::Mat>& images, std::vector<cv::Mat>* vectors, cv::Size outp_shape = cv::Size()) const; int size() const { return result_size_; } private: int result_size_; ///< Length of result };
#include "qrcodedialog.h" #include "ui_qrcodedialog.h" #include "bitcoinunits.h" #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" #include <QPixmap> #include <QUrl> #include <qrencode.h> QRCodeDialog::QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent) : QDialog(parent), ui(new Ui::QRCodeDialog), model(0), address(addr) { ui->setupUi(this); setWindowTitle(QString("%1").arg(address)); ui->chkReqPayment->setVisible(enableReq); ui->lblAmount->setVisible(enableReq); ui->lnReqAmount->setVisible(enableReq); ui->lnLabel->setText(label); ui->btnSaveAs->setEnabled(false); genCode(); } QRCodeDialog::~QRCodeDialog() { delete ui; } void QRCodeDialog::setModel(OptionsModel *model) { this->model = model; if (model) connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); } void QRCodeDialog::genCode() { QString uri = getURI(); if (uri != "") { ui->lblQRCode->setText(""); QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); if (!code) { ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); return; } myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); myImage.fill(0xffffff); unsigned char *p = code->data; for (int y = 0; y < code->width; y++) { for (int x = 0; x < code->width; x++) { myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff)); p++; } } QRcode_free(code); ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300)); ui->outUri->setPlainText(uri); } } QString QRCodeDialog::getURI() { QString ret = QString("maxocoin:%1").arg(address); int paramCount = 0; ui->outUri->clear(); if (ui->chkReqPayment->isChecked()) { if (ui->lnReqAmount->validate()) { // even if we allow a non BTC unit input in lnReqAmount, we generate the URI with BTC as unit (as defined in BIP21) ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, ui->lnReqAmount->value())); paramCount++; } else { ui->btnSaveAs->setEnabled(false); ui->lblQRCode->setText(tr("The entered amount is invalid, please check.")); return QString(""); } } if (!ui->lnLabel->text().isEmpty()) { QString lbl(QUrl::toPercentEncoding(ui->lnLabel->text())); ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl); paramCount++; } if (!ui->lnMessage->text().isEmpty()) { QString msg(QUrl::toPercentEncoding(ui->lnMessage->text())); ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); paramCount++; } // limit URI length to prevent a DoS against the QR-Code dialog if (ret.length() > MAX_URI_LENGTH) { ui->btnSaveAs->setEnabled(false); ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message.")); return QString(""); } ui->btnSaveAs->setEnabled(true); return ret; } void QRCodeDialog::on_lnReqAmount_textChanged() { genCode(); } void QRCodeDialog::on_lnLabel_textChanged() { genCode(); } void QRCodeDialog::on_lnMessage_textChanged() { genCode(); } void QRCodeDialog::on_btnSaveAs_clicked() { QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Images (*.png)")); if (!fn.isEmpty()) myImage.scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE).save(fn); } void QRCodeDialog::on_chkReqPayment_toggled(bool fChecked) { if (!fChecked) // if chkReqPayment is not active, don't display lnReqAmount as invalid ui->lnReqAmount->setValid(true); genCode(); } void QRCodeDialog::updateDisplayUnit() { if (model) { // Update lnReqAmount with the current unit ui->lnReqAmount->setDisplayUnit(model->getDisplayUnit()); } }
// Copyright (c) 2011-2015 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcconsole.h" #include "ui_debugwindow.h" #include "bantablemodel.h" #include "clientmodel.h" #include "guiutil.h" #include "platformstyle.h" #include "bantablemodel.h" #include "chainparams.h" #include "rpcserver.h" #include "rpcclient.h" #include "util.h" #include <openssl/crypto.h> #include <univalue.h> #ifdef ENABLE_WALLET #include <db_cxx.h> #endif #include <QDir> #include <QKeyEvent> #include <QMenu> #include <QScrollBar> #include <QSignalMapper> #include <QThread> #include <QTime> #include <QTimer> #include <QStringList> #if QT_VERSION < 0x050000 #include <QUrl> #endif // TODO: add a scrollback limit, as there is currently none // TODO: make it possible to filter out categories (esp debug messages when implemented) // TODO: receive errors and debug messages through ClientModel const int CONSOLE_HISTORY = 50; const QSize ICON_SIZE(24, 24); const int INITIAL_TRAFFIC_GRAPH_MINS = 30; // Repair parameters const QString SALVAGEWALLET("-salvagewallet"); const QString RESCAN("-rescan"); const QString ZAPTXES1("-zapwallettxes=1"); const QString ZAPTXES2("-zapwallettxes=2"); const QString UPGRADEWALLET("-upgradewallet"); const QString REINDEX("-reindex"); const struct { const char *url; const char *source; } ICON_MAPPING[] = { {"cmd-request", "tx_input"}, {"cmd-reply", "tx_output"}, {"cmd-error", "tx_output"}, {"misc", "tx_inout"}, {NULL, NULL} }; /* Object for executing console RPC commands in a separate thread. */ class RPCExecutor : public QObject { Q_OBJECT public Q_SLOTS: void request(const QString &command); Q_SIGNALS: void reply(int category, const QString &command); }; /** Class for handling RPC timers * (used for e.g. re-locking the wallet after a timeout) */ class QtRPCTimerBase: public QObject, public RPCTimerBase { Q_OBJECT public: QtRPCTimerBase(boost::function<void(void)>& func, int64_t millis): func(func) { timer.setSingleShot(true); connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); timer.start(millis); } ~QtRPCTimerBase() {} private Q_SLOTS: void timeout() { func(); } private: QTimer timer; boost::function<void(void)> func; }; class QtRPCTimerInterface: public RPCTimerInterface { public: ~QtRPCTimerInterface() {} const char *Name() { return "Qt"; } RPCTimerBase* NewTimer(boost::function<void(void)>& func, int64_t millis) { return new QtRPCTimerBase(func, millis); } }; #include "rpcconsole.moc" /** * Split shell command line into a list of arguments. Aims to emulate \c bash and friends. * * - Arguments are delimited with whitespace * - Extra whitespace at the beginning and end and between arguments will be ignored * - Text can be "double" or 'single' quoted * - The backslash \c \ is used as escape character * - Outside quotes, any character can be escaped * - Within double quotes, only escape \c " and backslashes before a \c " or another backslash * - Within single quotes, no escaping is possible and no special interpretation takes place * * @param[out] args Parsed arguments will be appended to this list * @param[in] strCommand Command line to split */ bool parseCommandLine(std::vector<std::string> &args, const std::string &strCommand) { enum CmdParseState { STATE_EATING_SPACES, STATE_ARGUMENT, STATE_SINGLEQUOTED, STATE_DOUBLEQUOTED, STATE_ESCAPE_OUTER, STATE_ESCAPE_DOUBLEQUOTED } state = STATE_EATING_SPACES; std::string curarg; Q_FOREACH(char ch, strCommand) { switch(state) { case STATE_ARGUMENT: // In or after argument case STATE_EATING_SPACES: // Handle runs of whitespace switch(ch) { case '"': state = STATE_DOUBLEQUOTED; break; case '\'': state = STATE_SINGLEQUOTED; break; case '\\': state = STATE_ESCAPE_OUTER; break; case ' ': case '\n': case '\t': if(state == STATE_ARGUMENT) // Space ends argument { args.push_back(curarg); curarg.clear(); } state = STATE_EATING_SPACES; break; default: curarg += ch; state = STATE_ARGUMENT; } break; case STATE_SINGLEQUOTED: // Single-quoted string switch(ch) { case '\'': state = STATE_ARGUMENT; break; default: curarg += ch; } break; case STATE_DOUBLEQUOTED: // Double-quoted string switch(ch) { case '"': state = STATE_ARGUMENT; break; case '\\': state = STATE_ESCAPE_DOUBLEQUOTED; break; default: curarg += ch; } break; case STATE_ESCAPE_OUTER: // '\' outside quotes curarg += ch; state = STATE_ARGUMENT; break; case STATE_ESCAPE_DOUBLEQUOTED: // '\' in double-quoted text if(ch != '"' && ch != '\\') curarg += '\\'; // keep '\' for everything but the quote and '\' itself curarg += ch; state = STATE_DOUBLEQUOTED; break; } } switch(state) // final state { case STATE_EATING_SPACES: return true; case STATE_ARGUMENT: args.push_back(curarg); return true; default: // ERROR to end in one of the other states return false; } } void RPCExecutor::request(const QString &command) { std::vector<std::string> args; if(!parseCommandLine(args, command.toStdString())) { Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \"")); return; } if(args.empty()) return; // Nothing to do try { std::string strPrint; // Convert argument list to JSON objects in method-dependent way, // and pass it along with the method name to the dispatcher. UniValue result = tableRPC.execute( args[0], RPCConvertValues(args[0], std::vector<std::string>(args.begin() + 1, args.end()))); // Format result reply if (result.isNull()) strPrint = ""; else if (result.isStr()) strPrint = result.get_str(); else strPrint = result.write(2); Q_EMIT reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint)); } catch (UniValue& objError) { try // Nice formatting for standard-format error { int code = find_value(objError, "code").get_int(); std::string message = find_value(objError, "message").get_str(); Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")"); } catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message { // Show raw JSON object Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(objError.write())); } } catch (const std::exception& e) { Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what())); } } RPCConsole::RPCConsole(const PlatformStyle *platformStyle, QWidget *parent) : QWidget(parent), ui(new Ui::RPCConsole), clientModel(0), historyPtr(0), cachedNodeid(-1), platformStyle(platformStyle), peersTableContextMenu(0), banTableContextMenu(0) { ui->setupUi(this); GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this); QString theme = GUIUtil::getThemeName(); if (platformStyle->getImagesOnButtons()) { ui->openDebugLogfileButton->setIcon(QIcon(":/icons/" + theme + "/export")); } // Needed on Mac also ui->clearButton->setIcon(QIcon(":/icons/" + theme + "/remove")); // Install event filter for up and down arrow ui->lineEdit->installEventFilter(this); ui->messagesWidget->installEventFilter(this); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear())); // Wallet Repair Buttons // connect(ui->btn_salvagewallet, SIGNAL(clicked()), this, SLOT(walletSalvage())); // Disable salvage option in GUI, it's way too powerful and can lead to funds loss ui->btn_salvagewallet->setEnabled(false); connect(ui->btn_rescan, SIGNAL(clicked()), this, SLOT(walletRescan())); connect(ui->btn_zapwallettxes1, SIGNAL(clicked()), this, SLOT(walletZaptxes1())); connect(ui->btn_zapwallettxes2, SIGNAL(clicked()), this, SLOT(walletZaptxes2())); connect(ui->btn_upgradewallet, SIGNAL(clicked()), this, SLOT(walletUpgrade())); connect(ui->btn_reindex, SIGNAL(clicked()), this, SLOT(walletReindex())); // set library version labels #ifdef ENABLE_WALLET ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0)); std::string walletPath = GetDataDir().string(); walletPath += QDir::separator().toLatin1() + GetArg("-wallet", "wallet.dat"); ui->wallet_path->setText(QString::fromStdString(walletPath)); #else ui->label_berkeleyDBVersion->hide(); ui->berkeleyDBVersion->hide(); #endif // Register RPC timer interface rpcTimerInterface = new QtRPCTimerInterface(); RPCRegisterTimerInterface(rpcTimerInterface); startExecutor(); setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS); ui->peerHeading->setText(tr("Select a peer to view detailed information.")); clear(); } RPCConsole::~RPCConsole() { GUIUtil::saveWindowGeometry("nRPCConsoleWindow", this); Q_EMIT stopExecutor(); RPCUnregisterTimerInterface(rpcTimerInterface); delete rpcTimerInterface; delete ui; } bool RPCConsole::eventFilter(QObject* obj, QEvent *event) { if(event->type() == QEvent::KeyPress) // Special key handling { QKeyEvent *keyevt = static_cast<QKeyEvent*>(event); int key = keyevt->key(); Qt::KeyboardModifiers mod = keyevt->modifiers(); switch(key) { case Qt::Key_Up: if(obj == ui->lineEdit) { browseHistory(-1); return true; } break; case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break; case Qt::Key_PageUp: /* pass paging keys to messages widget */ case Qt::Key_PageDown: if(obj == ui->lineEdit) { QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt)); return true; } break; case Qt::Key_Return: case Qt::Key_Enter: // forward these events to lineEdit if(obj == autoCompleter->popup()) { QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); return true; } break; default: // Typing in messages widget brings focus to line edit, and redirects key there // Exclude most combinations and keys that emit no text, except paste shortcuts if(obj == ui->messagesWidget && ( (!mod && !keyevt->text().isEmpty() && key != Qt::Key_Tab) || ((mod & Qt::ControlModifier) && key == Qt::Key_V) || ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert))) { ui->lineEdit->setFocus(); QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); return true; } } } return QWidget::eventFilter(obj, event); } void RPCConsole::setClientModel(ClientModel *model) { clientModel = model; ui->trafficGraph->setClientModel(model); if (model && clientModel->getPeerTableModel() && clientModel->getBanTableModel()) { // Keep up to date with client setNumConnections(model->getNumConnections()); connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getVerificationProgress(NULL)); connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double)), this, SLOT(setNumBlocks(int,QDateTime,double))); setMasternodeCount(model->getMasternodeCountString()); connect(model, SIGNAL(strMasternodesChanged(QString)), this, SLOT(setMasternodeCount(QString))); updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent()); connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t))); // set up peer table ui->peerWidget->setModel(model->getPeerTableModel()); ui->peerWidget->verticalHeader()->hide(); ui->peerWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->peerWidget->setSelectionMode(QAbstractItemView::SingleSelection); ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu); ui->peerWidget->setColumnWidth(PeerTableModel::Address, ADDRESS_COLUMN_WIDTH); ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH); ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH); ui->peerWidget->horizontalHeader()->setStretchLastSection(true); // create peer table context menu actions QAction* disconnectAction = new QAction(tr("&Disconnect Node"), this); QAction* banAction1h = new QAction(tr("Ban Node for") + " " + tr("1 &hour"), this); QAction* banAction24h = new QAction(tr("Ban Node for") + " " + tr("1 &day"), this); QAction* banAction7d = new QAction(tr("Ban Node for") + " " + tr("1 &week"), this); QAction* banAction365d = new QAction(tr("Ban Node for") + " " + tr("1 &year"), this); // create peer table context menu peersTableContextMenu = new QMenu(); peersTableContextMenu->addAction(disconnectAction); peersTableContextMenu->addAction(banAction1h); peersTableContextMenu->addAction(banAction24h); peersTableContextMenu->addAction(banAction7d); peersTableContextMenu->addAction(banAction365d); // Add a signal mapping to allow dynamic context menu arguments. // We need to use int (instead of int64_t), because signal mapper only supports // int or objects, which is okay because max bantime (1 year) is < int_max. QSignalMapper* signalMapper = new QSignalMapper(this); signalMapper->setMapping(banAction1h, 60*60); signalMapper->setMapping(banAction24h, 60*60*24); signalMapper->setMapping(banAction7d, 60*60*24*7); signalMapper->setMapping(banAction365d, 60*60*24*365); connect(banAction1h, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(banAction24h, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(banAction7d, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(banAction365d, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(banSelectedNode(int))); // peer table context menu signals connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&))); connect(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode())); // peer table signal handling - update peer details when selecting new node connect(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &))); // peer table signal handling - update peer details when new nodes are added to the model connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged())); // set up ban table ui->banlistWidget->setModel(model->getBanTableModel()); ui->banlistWidget->verticalHeader()->hide(); ui->banlistWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection); ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu); ui->banlistWidget->setColumnWidth(BanTableModel::Address, BANSUBNET_COLUMN_WIDTH); ui->banlistWidget->setColumnWidth(BanTableModel::Bantime, BANTIME_COLUMN_WIDTH); ui->banlistWidget->horizontalHeader()->setStretchLastSection(true); // create ban table context menu action QAction* unbanAction = new QAction(tr("&Unban Node"), this); // create ban table context menu banTableContextMenu = new QMenu(); banTableContextMenu->addAction(unbanAction); // ban table context menu signals connect(ui->banlistWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showBanTableContextMenu(const QPoint&))); connect(unbanAction, SIGNAL(triggered()), this, SLOT(unbanSelectedNode())); // ban table signal handling - clear peer details when clicking a peer in the ban table connect(ui->banlistWidget, SIGNAL(clicked(const QModelIndex&)), this, SLOT(clearSelectedNode())); // ban table signal handling - ensure ban table is shown or hidden (if empty) connect(model->getBanTableModel(), SIGNAL(layoutChanged()), this, SLOT(showOrHideBanTableIfRequired())); showOrHideBanTableIfRequired(); // Provide initial values ui->clientVersion->setText(model->formatFullVersion()); ui->clientUserAgent->setText(model->formatSubVersion()); ui->clientName->setText(model->clientName()); ui->buildDate->setText(model->formatBuildDate()); ui->startupTime->setText(model->formatClientStartupTime()); ui->networkName->setText(QString::fromStdString(Params().NetworkIDString())); //Setup autocomplete and attach it QStringList wordList; std::vector<std::string> commandList = tableRPC.listCommands(); for (size_t i = 0; i < commandList.size(); ++i) { wordList << commandList[i].c_str(); } autoCompleter = new QCompleter(wordList, this); ui->lineEdit->setCompleter(autoCompleter); autoCompleter->popup()->installEventFilter(this); } } static QString categoryClass(int category) { switch(category) { case RPCConsole::CMD_REQUEST: return "cmd-request"; break; case RPCConsole::CMD_REPLY: return "cmd-reply"; break; case RPCConsole::CMD_ERROR: return "cmd-error"; break; default: return "misc"; } } /** Restart wallet with "-salvagewallet" */ void RPCConsole::walletSalvage() { buildParameterlist(SALVAGEWALLET); } /** Restart wallet with "-rescan" */ void RPCConsole::walletRescan() { buildParameterlist(RESCAN); } /** Restart wallet with "-zapwallettxes=1" */ void RPCConsole::walletZaptxes1() { buildParameterlist(ZAPTXES1); } /** Restart wallet with "-zapwallettxes=2" */ void RPCConsole::walletZaptxes2() { buildParameterlist(ZAPTXES2); } /** Restart wallet with "-upgradewallet" */ void RPCConsole::walletUpgrade() { buildParameterlist(UPGRADEWALLET); } /** Restart wallet with "-reindex" */ void RPCConsole::walletReindex() { buildParameterlist(REINDEX); } /** Build command-line parameter list for restart */ void RPCConsole::buildParameterlist(QString arg) { // Get command-line arguments and remove the application name QStringList args = QApplication::arguments(); args.removeFirst(); // Remove existing repair-options args.removeAll(SALVAGEWALLET); args.removeAll(RESCAN); args.removeAll(ZAPTXES1); args.removeAll(ZAPTXES2); args.removeAll(UPGRADEWALLET); args.removeAll(REINDEX); // Append repair parameter to command line. args.append(arg); // Send command-line arguments to BitcoinGUI::handleRestart() Q_EMIT handleRestart(args); } void RPCConsole::clear() { ui->messagesWidget->clear(); history.clear(); historyPtr = 0; ui->lineEdit->clear(); ui->lineEdit->setFocus(); // Add smoothly scaled icon images. // (when using width/height on an img, Qt uses nearest instead of linear interpolation) QString iconPath = ":/icons/" + GUIUtil::getThemeName() + "/"; QString iconName = ""; for(int i=0; ICON_MAPPING[i].url; ++i) { iconName = ICON_MAPPING[i].source; ui->messagesWidget->document()->addResource( QTextDocument::ImageResource, QUrl(ICON_MAPPING[i].url), QImage(iconPath + iconName).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } // Set default style sheet QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont()); // Try to make fixed font adequately large on different OS #ifdef WIN32 QString ptSize = QString("%1pt").arg(QFontInfo(QFont()).pointSize() * 10 / 8); #else QString ptSize = QString("%1pt").arg(QFontInfo(QFont()).pointSize() * 8.5 / 9); #endif ui->messagesWidget->document()->setDefaultStyleSheet( QString( "table { }" "td.time { color: #808080; padding-top: 3px; } " "td.message { font-family: %1; font-size: %2; white-space:pre-wrap; } " "td.cmd-request { color: #006060; } " "td.cmd-error { color: red; } " "b { color: #006060; } " ).arg(fixedFontInfo.family(), ptSize) ); message(CMD_REPLY, (tr("Welcome to the Terracoin Core RPC console.") + "<br>" + tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" + tr("Type <b>help</b> for an overview of available commands.")), true); } void RPCConsole::keyPressEvent(QKeyEvent *event) { if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape) { close(); } } void RPCConsole::message(int category, const QString &message, bool html) { QTime time = QTime::currentTime(); QString timeString = time.toString(); QString out; out += "<table><tr><td class=\"time\" width=\"65\">" + timeString + "</td>"; out += "<td class=\"icon\" width=\"32\"><img src=\"" + categoryClass(category) + "\"></td>"; out += "<td class=\"message " + categoryClass(category) + "\" valign=\"middle\">"; if(html) out += message; else out += GUIUtil::HtmlEscape(message, false); out += "</td></tr></table>"; ui->messagesWidget->append(out); } void RPCConsole::setNumConnections(int count) { if (!clientModel) return; QString connections = QString::number(count) + " ("; connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / "; connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")"; ui->numberOfConnections->setText(connections); } void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress) { ui->numberOfBlocks->setText(QString::number(count)); ui->lastBlockTime->setText(blockDate.toString()); } void RPCConsole::setMasternodeCount(const QString &strMasternodes) { ui->masternodeCount->setText(strMasternodes); } void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage) { ui->mempoolNumberTxs->setText(QString::number(numberOfTxs)); if (dynUsage < 1000000) ui->mempoolSize->setText(QString::number(dynUsage/1000.0, 'f', 2) + " KB"); else ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB"); } void RPCConsole::on_lineEdit_returnPressed() { QString cmd = ui->lineEdit->text(); ui->lineEdit->clear(); if(!cmd.isEmpty()) { message(CMD_REQUEST, cmd); Q_EMIT cmdRequest(cmd); // Remove command, if already in history history.removeOne(cmd); // Append command to history history.append(cmd); // Enforce maximum history size while(history.size() > CONSOLE_HISTORY) history.removeFirst(); // Set pointer to end of history historyPtr = history.size(); // Scroll console view to end scrollToEnd(); } } void RPCConsole::browseHistory(int offset) { historyPtr += offset; if(historyPtr < 0) historyPtr = 0; if(historyPtr > history.size()) historyPtr = history.size(); QString cmd; if(historyPtr < history.size()) cmd = history.at(historyPtr); ui->lineEdit->setText(cmd); } void RPCConsole::startExecutor() { QThread *thread = new QThread; RPCExecutor *executor = new RPCExecutor(); executor->moveToThread(thread); // Replies from executor object must go to this object connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString))); // Requests from this object must go to executor connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString))); // On stopExecutor signal // - queue executor for deletion (in execution thread) // - quit the Qt event loop in the execution thread connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater())); connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit())); // Queue the thread for deletion (in this thread) when it is finished connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. thread->start(); } void RPCConsole::on_tabWidget_currentChanged(int index) { if (ui->tabWidget->widget(index) == ui->tab_console) ui->lineEdit->setFocus(); else if (ui->tabWidget->widget(index) != ui->tab_peers) clearSelectedNode(); } void RPCConsole::on_openDebugLogfileButton_clicked() { GUIUtil::openDebugLogfile(); } void RPCConsole::scrollToEnd() { QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar(); scrollbar->setValue(scrollbar->maximum()); } void RPCConsole::on_sldGraphRange_valueChanged(int value) { const int multiplier = 5; // each position on the slider represents 5 min int mins = value * multiplier; setTrafficGraphRange(mins); } QString RPCConsole::FormatBytes(quint64 bytes) { if(bytes < 1024) return QString(tr("%1 B")).arg(bytes); if(bytes < 1024 * 1024) return QString(tr("%1 KB")).arg(bytes / 1024); if(bytes < 1024 * 1024 * 1024) return QString(tr("%1 MB")).arg(bytes / 1024 / 1024); return QString(tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); } void RPCConsole::setTrafficGraphRange(int mins) { ui->trafficGraph->setGraphRangeMins(mins); ui->lblGraphRange->setText(GUIUtil::formatDurationStr(mins * 60)); } void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut) { ui->lblBytesIn->setText(FormatBytes(totalBytesIn)); ui->lblBytesOut->setText(FormatBytes(totalBytesOut)); } void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected) { Q_UNUSED(deselected); if (!clientModel || !clientModel->getPeerTableModel() || selected.indexes().isEmpty()) return; const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected.indexes().first().row()); if (stats) updateNodeDetail(stats); } void RPCConsole::peerLayoutChanged() { if (!clientModel || !clientModel->getPeerTableModel()) return; const CNodeCombinedStats *stats = NULL; bool fUnselect = false; bool fReselect = false; if (cachedNodeid == -1) // no node selected yet return; // find the currently selected row int selectedRow = -1; QModelIndexList selectedModelIndex = ui->peerWidget->selectionModel()->selectedIndexes(); if (!selectedModelIndex.isEmpty()) { selectedRow = selectedModelIndex.first().row(); } // check if our detail node has a row in the table (it may not necessarily // be at selectedRow since its position can change after a layout change) int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeid); if (detailNodeRow < 0) { // detail node disappeared from table (node disconnected) fUnselect = true; } else { if (detailNodeRow != selectedRow) { // detail node moved position fUnselect = true; fReselect = true; } // get fresh stats on the detail node. stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow); } if (fUnselect && selectedRow >= 0) { clearSelectedNode(); } if (fReselect) { ui->peerWidget->selectRow(detailNodeRow); } if (stats) updateNodeDetail(stats); } void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats) { // Update cached nodeid cachedNodeid = stats->nodeStats.nodeid; // update the detail ui with latest node information QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " "); peerAddrDetails += tr("(node id: %1)").arg(QString::number(stats->nodeStats.nodeid)); if (!stats->nodeStats.addrLocal.empty()) peerAddrDetails += "<br />" + tr("via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal)); ui->peerHeading->setText(peerAddrDetails); ui->peerServices->setText(GUIUtil::formatServicesStr(stats->nodeStats.nServices)); ui->peerLastSend->setText(stats->nodeStats.nLastSend ? GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nLastSend) : tr("never")); ui->peerLastRecv->setText(stats->nodeStats.nLastRecv ? GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nLastRecv) : tr("never")); ui->peerBytesSent->setText(FormatBytes(stats->nodeStats.nSendBytes)); ui->peerBytesRecv->setText(FormatBytes(stats->nodeStats.nRecvBytes)); ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nTimeConnected)); ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime)); ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingWait)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion))); ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound")); ui->peerHeight->setText(QString("%1").arg(QString::number(stats->nodeStats.nStartingHeight))); ui->peerWhitelisted->setText(stats->nodeStats.fWhitelisted ? tr("Yes") : tr("No")); // This check fails for example if the lock was busy and // nodeStateStats couldn't be fetched. if (stats->fNodeStateStatsAvailable) { // Ban score is init to 0 ui->peerBanScore->setText(QString("%1").arg(stats->nodeStateStats.nMisbehavior)); // Sync height is init to -1 if (stats->nodeStateStats.nSyncHeight > -1) ui->peerSyncHeight->setText(QString("%1").arg(stats->nodeStateStats.nSyncHeight)); else ui->peerSyncHeight->setText(tr("Unknown")); // Common height is init to -1 if (stats->nodeStateStats.nCommonHeight > -1) ui->peerCommonHeight->setText(QString("%1").arg(stats->nodeStateStats.nCommonHeight)); else ui->peerCommonHeight->setText(tr("Unknown")); } ui->detailWidget->show(); } void RPCConsole::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); } void RPCConsole::showEvent(QShowEvent *event) { QWidget::showEvent(event); if (!clientModel || !clientModel->getPeerTableModel()) return; // start PeerTableModel auto refresh clientModel->getPeerTableModel()->startAutoRefresh(); } void RPCConsole::hideEvent(QHideEvent *event) { QWidget::hideEvent(event); if (!clientModel || !clientModel->getPeerTableModel()) return; // stop PeerTableModel auto refresh clientModel->getPeerTableModel()->stopAutoRefresh(); } void RPCConsole::showPeersTableContextMenu(const QPoint& point) { QModelIndex index = ui->peerWidget->indexAt(point); if (index.isValid()) peersTableContextMenu->exec(QCursor::pos()); } void RPCConsole::showBanTableContextMenu(const QPoint& point) { QModelIndex index = ui->banlistWidget->indexAt(point); if (index.isValid()) banTableContextMenu->exec(QCursor::pos()); } void RPCConsole::disconnectSelectedNode() { // Get currently selected peer address QString strNode = GUIUtil::getEntryData(ui->peerWidget, 0, PeerTableModel::Address); // Find the node, disconnect it and clear the selected node if (CNode *bannedNode = FindNode(strNode.toStdString())) { bannedNode->fDisconnect = true; clearSelectedNode(); } } void RPCConsole::banSelectedNode(int bantime) { if (!clientModel) return; // Get currently selected peer address QString strNode = GUIUtil::getEntryData(ui->peerWidget, 0, PeerTableModel::Address); // Find possible nodes, ban it and clear the selected node if (CNode *bannedNode = FindNode(strNode.toStdString())) { std::string nStr = strNode.toStdString(); std::string addr; int port = 0; SplitHostPort(nStr, port, addr); CNode::Ban(CNetAddr(addr), BanReasonManuallyAdded, bantime); bannedNode->fDisconnect = true; DumpBanlist(); clearSelectedNode(); clientModel->getBanTableModel()->refresh(); } } void RPCConsole::unbanSelectedNode() { if (!clientModel) return; // Get currently selected ban address QString strNode = GUIUtil::getEntryData(ui->banlistWidget, 0, BanTableModel::Address); CSubNet possibleSubnet(strNode.toStdString()); if (possibleSubnet.IsValid()) { CNode::Unban(possibleSubnet); DumpBanlist(); clientModel->getBanTableModel()->refresh(); } } void RPCConsole::clearSelectedNode() { ui->peerWidget->selectionModel()->clearSelection(); cachedNodeid = -1; ui->detailWidget->hide(); ui->peerHeading->setText(tr("Select a peer to view detailed information.")); } void RPCConsole::showOrHideBanTableIfRequired() { if (!clientModel) return; bool visible = clientModel->getBanTableModel()->shouldShow(); ui->banlistWidget->setVisible(visible); ui->banHeading->setVisible(visible); } void RPCConsole::setTabFocus(enum TabTypes tabType) { ui->tabWidget->setCurrentIndex(tabType); }
; Inicialização para VM leaw $Main.main, %A jmp nop ; 0 - Declarando função Main.main Main.main: ; 1 - PUSH constant 15 leaw $15,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 2 - PUSH constant 5 leaw $5,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 3 - chamada de funcao div leaw $div.ret.1,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) leaw $LCL,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) leaw $ARG,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) leaw $THIS,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) leaw $THAT,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) leaw $7,%A movw %A,%D leaw $SP,%A movw (%A),%A subw %A,%D,%D leaw $ARG,%A movw %D,(%A) leaw $SP,%A movw (%A),%D leaw $LCL,%A movw %D,(%A) leaw $div,%A jmp nop div.ret.1: ; 4 - POP temp 1 leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $6,%A movw %D,(%A) ; End ; 5 - Declarando função div div: leaw $0,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) leaw $0,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 6 - PUSH constant 0 leaw $0,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 7 - POP local 0 leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) leaw $0,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%D leaw $R15,%A movw %D,(%A) leaw $SP,%A movw (%A),%A movw (%A),%D leaw $R15,%A movw (%A),%A movw %D,(%A) ; 8 - PUSH argument 0 leaw $0,%A movw %A,%D leaw $ARG,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 9 - POP local 1 leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) leaw $1,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%D leaw $R15,%A movw %D,(%A) leaw $SP,%A movw (%A),%A movw (%A),%D leaw $R15,%A movw (%A),%A movw %D,(%A) ; Label (marcador) dawdwad.div.loop: ; 10 - PUSH local 1 leaw $1,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 11 - PUSH argument 1 leaw $1,%A movw %A,%D leaw $ARG,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 12 - LT leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D leaw $LTdawdwad0,%A jl %D nop leaw $SP,%A subw (%A),$1,%A movw $0,(%A) leaw $LT2dawdwad0,%A jmp nop LTdawdwad0: leaw $SP,%A subw (%A),$1,%A movw $-1,(%A) LT2dawdwad0: ; 13 - Goto Condicional leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $dawdwad.div.end,%A jne %D nop ; 14 - PUSH local 0 leaw $0,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 15 - PUSH constant 1 leaw $1,%A movw %A,%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 16 - ADD leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A addw (%A),%D,%D movw %D,(%A) ; 17 - POP local 0 leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) leaw $0,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%D leaw $R15,%A movw %D,(%A) leaw $SP,%A movw (%A),%A movw (%A),%D leaw $R15,%A movw (%A),%A movw %D,(%A) ; 18 - PUSH local 1 leaw $1,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 19 - PUSH argument 1 leaw $1,%A movw %A,%D leaw $ARG,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 20 - SUB leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw (%A),%A movw (%A),%D leaw $SP,%A subw (%A),$1,%A subw (%A),%D,%D movw %D,(%A) ; 21 - POP local 1 leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) leaw $1,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%D leaw $R15,%A movw %D,(%A) leaw $SP,%A movw (%A),%A movw (%A),%D leaw $R15,%A movw (%A),%A movw %D,(%A) ; 22 - Goto Incondicional leaw $dawdwad.div.loop,%A jmp nop ; Label (marcador) dawdwad.div.end: ; 23 - PUSH local 0 leaw $0,%A movw %A,%D leaw $LCL,%A addw (%A),%D,%A movw (%A),%D leaw $SP,%A movw (%A),%A movw %D,(%A) leaw $SP,%A movw (%A),%D incw %D movw %D,(%A) ; 24 - Retorno de função ; Retorno de função leaw $LCL,%A movw (%A),%D leaw $R13,%A movw %D,(%A) leaw $5,%A subw %D,%A,%A movw (%A),%D leaw $R14,%A movw %D,(%A) leaw $ARG,%A movw (%A),%D leaw $R15,%A movw %D,(%A) leaw $SP,%A movw (%A),%D decw %D movw %D,(%A) movw %D,%A movw (%A),%D leaw $R15,%A movw (%A),%A movw %D,(%A) leaw $ARG,%A movw (%A),%D leaw $SP,%A addw %D,$1,(%A) leaw $R13,%A subw (%A),$1,%D movw %D,(%A) movw %D,%A movw (%A),%D leaw $THAT,%A movw %D,(%A) leaw $R13,%A subw (%A),$1,%D movw %D,(%A) movw %D,%A movw (%A),%D leaw $THIS,%A movw %D,(%A) leaw $R13,%A subw (%A),$1,%D movw %D,(%A) movw %D,%A movw (%A),%D leaw $ARG,%A movw %D,(%A) leaw $R13,%A subw (%A),$1,%D movw %D,(%A) movw %D,%A movw (%A),%D leaw $LCL,%A movw %D,(%A) leaw $R14,%A movw (%A),%A jmp nop ; End
; A203572: Period length 12: 0, 1, 2, 3, 4, 5, 0, 5, 4, 3, 2, 1 repeated. ; 0,1,2,3,4,5,0,5,4,3,2,1,0,1,2,3,4,5,0,5,4,3,2,1,0,1,2,3,4,5,0,5,4,3,2,1,0,1,2,3,4,5,0,5,4,3,2,1,0,1,2,3,4,5,0,5,4,3,2,1,0 lpb $0,1 add $1,$0 mod $0,6 sub $0,$1 add $1,$0 lpe
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__delete_int_calloc_33.cpp Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete.label.xml Template File: sources-sinks-33.tmpl.cpp */ /* * @description * CWE: 762 Mismatched Memory Management Routines * BadSource: calloc Allocate data using calloc() * GoodSource: Allocate data using new * Sinks: * GoodSink: Deallocate data using free() * BadSink : Deallocate data using delete * Flow Variant: 33 Data flow: use of a C++ reference to data within the same function * * */ #include "std_testcase.h" namespace CWE762_Mismatched_Memory_Management_Routines__delete_int_calloc_33 { #ifndef OMITBAD void bad() { int * data; int * &data_ref = data; /* Initialize data*/ data = NULL; /* POTENTIAL FLAW: Allocate memory with a function that requires free() to free the memory */ data = (int *)calloc(100, sizeof(int)); { int * data = data_ref; /* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may * require a call to free() to deallocate the memory */ delete data; } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { int * data; int * &data_ref = data; /* Initialize data*/ data = NULL; /* FIX: Allocate memory from the heap using new */ data = new int; { int * data = data_ref; /* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may * require a call to free() to deallocate the memory */ delete data; } } /* goodB2G() uses the BadSource with the GoodSink */ static void goodB2G() { int * data; int * &data_ref = data; /* Initialize data*/ data = NULL; /* POTENTIAL FLAW: Allocate memory with a function that requires free() to free the memory */ data = (int *)calloc(100, sizeof(int)); { int * data = data_ref; /* FIX: Deallocate the memory using free() */ free(data); } } void good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ } // close namespace /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE762_Mismatched_Memory_Management_Routines__delete_int_calloc_33; // so that we can use good and bad easily int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
Name: zel_enmy3.asm Type: file Size: 334927 Last-Modified: '2016-05-13T04:20:48Z' SHA-1: 703F853C1C2FBF4546737D8815F31B5353C869C4 Description: null
// Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2015-2017 The PIVX developers // Copyright (c) 2021 The Retrex developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "activemasternode.h" #include "db.h" #include "init.h" #include "main.h" #include "masternode-budget.h" #include "masternode-payments.h" #include "masternodeconfig.h" #include "masternodeman.h" #include "rpcserver.h" #include "utilmoneystr.h" #include "mnLadderizedCollateral.h" #include <univalue.h> #include <boost/tokenizer.hpp> #include <fstream> void SendMoney(const CTxDestination& address, CAmount nValue, CWalletTx& wtxNew, AvailableCoinsType coin_type = ALL_COINS) { // Check amount if (nValue <= 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount"); if (nValue > pwalletMain->GetBalance()) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds"); string strError; if (pwalletMain->IsLocked()) { strError = "Error: Wallet locked, unable to create transaction!"; LogPrintf("SendMoney() : %s", strError); throw JSONRPCError(RPC_WALLET_ERROR, strError); } // Parse Retrex address CScript scriptPubKey = GetScriptForDestination(address); // Create and send the transaction CReserveKey reservekey(pwalletMain); CAmount nFeeRequired; if (!pwalletMain->CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired, strError, NULL, coin_type)) { if (nValue + nFeeRequired > pwalletMain->GetBalance()) strError = strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired)); LogPrintf("SendMoney() : %s\n", strError); throw JSONRPCError(RPC_WALLET_ERROR, strError); } if (!pwalletMain->CommitTransaction(wtxNew, reservekey)) throw JSONRPCError(RPC_WALLET_ERROR, "Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); } UniValue obfuscation(const UniValue& params, bool fHelp) { throw runtime_error("Obfuscation is not supported any more. Use Zerocoin\n"); if (fHelp || params.size() == 0) throw runtime_error( "obfuscation <retrexaddress> <amount>\n" "retrexaddress, reset, or auto (AutoDenominate)" "<amount> is a real and will be rounded to the next 0.1" + HelpRequiringPassphrase()); if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); if (params[0].get_str() == "auto") { if (fMasterNode) return "ObfuScation is not supported from masternodes"; return "DoAutomaticDenominating " + (obfuScationPool.DoAutomaticDenominating() ? "successful" : ("failed: " + obfuScationPool.GetStatus())); } if (params[0].get_str() == "reset") { obfuScationPool.Reset(); return "successfully reset obfuscation"; } if (params.size() != 2) throw runtime_error( "obfuscation <retrexaddress> <amount>\n" "retrexaddress, denominate, or auto (AutoDenominate)" "<amount> is a real and will be rounded to the next 0.1" + HelpRequiringPassphrase()); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Retrex address"); // Amount CAmount nAmount = AmountFromValue(params[1]); // Wallet comments CWalletTx wtx; // string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx, ONLY_DENOMINATED); SendMoney(address.Get(), nAmount, wtx, ONLY_DENOMINATED); // if (strError != "") // throw JSONRPCError(RPC_WALLET_ERROR, strError); return wtx.GetHash().GetHex(); } UniValue getpoolinfo(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getpoolinfo\n" "\nReturns anonymous pool-related information\n" "\nResult:\n" "{\n" " \"current\": \"addr\", (string) Retrex address of current masternode\n" " \"state\": xxxx, (string) unknown\n" " \"entries\": xxxx, (numeric) Number of entries\n" " \"accepted\": xxxx, (numeric) Number of entries accepted\n" "}\n" "\nExamples:\n" + HelpExampleCli("getpoolinfo", "") + HelpExampleRpc("getpoolinfo", "")); UniValue obj(UniValue::VOBJ); obj.push_back(Pair("current_masternode", mnodeman.GetCurrentMasterNode()->addr.ToString())); obj.push_back(Pair("state", obfuScationPool.GetState())); obj.push_back(Pair("entries", obfuScationPool.GetEntriesCount())); obj.push_back(Pair("entries_accepted", obfuScationPool.GetCountEntriesAccepted())); return obj; } // This command is retained for backwards compatibility, but is depreciated. // Future removal of this command is planned to keep things clean. UniValue masternode(const UniValue& params, bool fHelp) { string strCommand; if (params.size() >= 1) strCommand = params[0].get_str(); if (fHelp || (strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "start-all" && strCommand != "start-missing" && strCommand != "start-disabled" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce" && strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect" && strCommand != "outputs" && strCommand != "status" && strCommand != "calcscore")) throw runtime_error( "masternode \"command\"...\n" "\nSet of commands to execute masternode related actions\n" "This command is depreciated, please see individual command documentation for future reference\n\n" "\nArguments:\n" "1. \"command\" (string or set of strings, required) The command to execute\n" "\nAvailable commands:\n" " count - Print count information of all known masternodes\n" " current - Print info on current masternode winner\n" " debug - Print masternode status\n" " genkey - Generate new masternodeprivkey\n" " outputs - Print masternode compatible outputs\n" " start - Start masternode configured in retrex.conf\n" " start-alias - Start single masternode by assigned alias configured in masternode.conf\n" " start-<mode> - Start masternodes configured in masternode.conf (<mode>: 'all', 'missing', 'disabled')\n" " status - Print masternode status information\n" " list - Print list of all known masternodes (see masternodelist for more info)\n" " list-conf - Print masternode.conf in JSON format\n" " winners - Print list of masternode winners\n"); if (strCommand == "list") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return listmasternodes(newParams, fHelp); } if (strCommand == "connect") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return masternodeconnect(newParams, fHelp); } if (strCommand == "count") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return getmasternodecount(newParams, fHelp); } if (strCommand == "current") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return masternodecurrent(newParams, fHelp); } if (strCommand == "debug") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return masternodedebug(newParams, fHelp); } if (strCommand == "start" || strCommand == "start-alias" || strCommand == "start-many" || strCommand == "start-all" || strCommand == "start-missing" || strCommand == "start-disabled") { return startmasternode(params, fHelp); } if (strCommand == "genkey") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return createmasternodekey(newParams, fHelp); } if (strCommand == "list-conf") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return listmasternodeconf(newParams, fHelp); } if (strCommand == "outputs") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return getmasternodeoutputs(newParams, fHelp); } if (strCommand == "status") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return getmasternodestatus(newParams, fHelp); } if (strCommand == "winners") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return getmasternodewinners(newParams, fHelp); } if (strCommand == "calcscore") { UniValue newParams(UniValue::VARR); // forward params but skip command for (unsigned int i = 1; i < params.size(); i++) { newParams.push_back(params[i]); } return getmasternodescores(newParams, fHelp); } return NullUniValue; } UniValue listmasternodes(const UniValue& params, bool fHelp) { std::string strFilter = ""; if (params.size() == 1) strFilter = params[0].get_str(); if (fHelp || (params.size() > 1)) throw runtime_error( "listmasternodes ( \"filter\" )\n" "\nGet a ranked list of masternodes\n" "\nArguments:\n" "1. \"filter\" (string, optional) Filter search text. Partial match by txhash, status, or addr.\n" "\nResult:\n" "[\n" " {\n" " \"rank\": n, (numeric) Masternode Rank (or 0 if not enabled)\n" " \"txhash\": \"hash\", (string) Collateral transaction hash\n" " \"outidx\": n, (numeric) Collateral transaction output index\n" " \"status\": s, (string) Status (ENABLED/EXPIRED/REMOVE/etc)\n" " \"addr\": \"addr\", (string) Masternode Retrex address\n" " \"version\": v, (numeric) Masternode protocol version\n" " \"lastseen\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last seen\n" " \"activetime\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) masternode has been active\n" " \"lastpaid\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) masternode was last paid\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("masternodelist", "") + HelpExampleRpc("masternodelist", "")); UniValue ret(UniValue::VARR); int nHeight; { LOCK(cs_main); CBlockIndex* pindex = chainActive.Tip(); if(!pindex) return 0; nHeight = pindex->nHeight; } std::vector<pair<int, CMasternode> > vMasternodeRanks = mnodeman.GetMasternodeRanks(nHeight); BOOST_FOREACH (PAIRTYPE(int, CMasternode) & s, vMasternodeRanks) { UniValue obj(UniValue::VOBJ); std::string strVin = s.second.vin.prevout.ToStringShort(); std::string strTxHash = s.second.vin.prevout.hash.ToString(); uint32_t oIdx = s.second.vin.prevout.n; CMasternode* mn = mnodeman.Find(s.second.vin); if (mn != NULL) { if (strFilter != "" && strTxHash.find(strFilter) == string::npos && mn->Status().find(strFilter) == string::npos && CBitcoinAddress(mn->pubKeyCollateralAddress.GetID()).ToString().find(strFilter) == string::npos) continue; std::string strStatus = mn->Status(); std::string strHost; int port; SplitHostPort(mn->addr.ToString(), port, strHost); CNetAddr node = CNetAddr(strHost, false); std::string strNetwork = GetNetworkName(node.GetNetwork()); obj.push_back(Pair("rank", (strStatus == "ENABLED" ? s.first : 0))); obj.push_back(Pair("network", strNetwork)); obj.push_back(Pair("txhash", strTxHash)); obj.push_back(Pair("outidx", (uint64_t)oIdx)); obj.push_back(Pair("status", strStatus)); obj.push_back(Pair("addr", CBitcoinAddress(mn->pubKeyCollateralAddress.GetID()).ToString())); obj.push_back(Pair("version", mn->protocolVersion)); obj.push_back(Pair("lastseen", (int64_t)mn->lastPing.sigTime)); obj.push_back(Pair("activetime", (int64_t)(mn->lastPing.sigTime - mn->sigTime))); obj.push_back(Pair("lastpaid", (int64_t)mn->GetLastPaid())); ret.push_back(obj); } } return ret; } UniValue masternodeconnect(const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "masternodeconnect \"address\"\n" "\nAttempts to connect to specified masternode address\n" "\nArguments:\n" "1. \"address\" (string, required) IP or net address to connect to\n" "\nExamples:\n" + HelpExampleCli("masternodeconnect", "\"192.168.0.6:37521\"") + HelpExampleRpc("masternodeconnect", "\"192.168.0.6:37521\"")); std::string strAddress = params[0].get_str(); CService addr = CService(strAddress); CNode* pnode = ConnectNode((CAddress)addr, NULL, false); if (pnode) { pnode->Release(); return NullUniValue; } else { throw runtime_error("error connecting\n"); } } UniValue getmasternodecount (const UniValue& params, bool fHelp) { if (fHelp || (params.size() > 0)) throw runtime_error( "getmasternodecount\n" "\nGet masternode count values\n" "\nResult:\n" "{\n" " \"total\": n, (numeric) Total masternodes\n" " \"stable\": n, (numeric) Stable count\n" " \"obfcompat\": n, (numeric) Obfuscation Compatible\n" " \"enabled\": n, (numeric) Enabled masternodes\n" " \"inqueue\": n (numeric) Masternodes in queue\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmasternodecount", "") + HelpExampleRpc("getmasternodecount", "")); UniValue obj(UniValue::VOBJ); int nCount = 0; int ipv4 = 0, ipv6 = 0, onion = 0; if (chainActive.Tip()) mnodeman.GetNextMasternodeInQueueForPayment(chainActive.Tip()->nHeight, true, nCount); mnodeman.CountNetworks(ActiveProtocol(), ipv4, ipv6, onion); obj.push_back(Pair("total", mnodeman.size())); obj.push_back(Pair("stable", mnodeman.stable_size())); obj.push_back(Pair("obfcompat", mnodeman.CountEnabled(ActiveProtocol()))); obj.push_back(Pair("enabled", mnodeman.CountEnabled())); obj.push_back(Pair("inqueue", nCount)); obj.push_back(Pair("ipv4", ipv4)); obj.push_back(Pair("ipv6", ipv6)); obj.push_back(Pair("onion", onion)); return obj; } UniValue masternodecurrent (const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 0)) throw runtime_error( "masternodecurrent\n" "\nGet current masternode winner\n" "\nResult:\n" "{\n" " \"protocol\": xxxx, (numeric) Protocol version\n" " \"txhash\": \"xxxx\", (string) Collateral transaction hash\n" " \"pubkey\": \"xxxx\", (string) MN Public key\n" " \"lastseen\": xxx, (numeric) Time since epoch of last seen\n" " \"activeseconds\": xxx, (numeric) Seconds MN has been active\n" "}\n" "\nExamples:\n" + HelpExampleCli("masternodecurrent", "") + HelpExampleRpc("masternodecurrent", "")); CMasternode* winner = mnodeman.GetCurrentMasterNode(1); if (winner) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("protocol", (int64_t)winner->protocolVersion)); obj.push_back(Pair("txhash", winner->vin.prevout.hash.ToString())); obj.push_back(Pair("pubkey", CBitcoinAddress(winner->pubKeyCollateralAddress.GetID()).ToString())); obj.push_back(Pair("lastseen", (winner->lastPing == CMasternodePing()) ? winner->sigTime : (int64_t)winner->lastPing.sigTime)); obj.push_back(Pair("activeseconds", (winner->lastPing == CMasternodePing()) ? 0 : (int64_t)(winner->lastPing.sigTime - winner->sigTime))); return obj; } throw runtime_error("unknown"); } UniValue masternodedebug (const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 0)) throw runtime_error( "masternodedebug\n" "\nPrint masternode status\n" "\nResult:\n" "\"status\" (string) Masternode status message\n" "\nExamples:\n" + HelpExampleCli("masternodedebug", "") + HelpExampleRpc("masternodedebug", "")); if (activeMasternode.status != ACTIVE_MASTERNODE_INITIAL || !masternodeSync.IsSynced()) return activeMasternode.GetStatus(); CTxIn vin = CTxIn(); CPubKey pubkey = CScript(); CKey key; if (!activeMasternode.GetMasterNodeVin(vin, pubkey, key)) throw runtime_error("Missing masternode input, please look at the documentation for instructions on masternode creation\n"); else return activeMasternode.GetStatus(); } UniValue startmasternode (const UniValue& params, bool fHelp) { std::string strCommand; if (params.size() >= 1) { strCommand = params[0].get_str(); // Backwards compatibility with legacy 'masternode' super-command forwarder if (strCommand == "start") strCommand = "local"; if (strCommand == "start-alias") strCommand = "alias"; if (strCommand == "start-all") strCommand = "all"; if (strCommand == "start-many") strCommand = "many"; if (strCommand == "start-missing") strCommand = "missing"; if (strCommand == "start-disabled") strCommand = "disabled"; } if (fHelp || params.size() < 2 || params.size() > 3 || (params.size() == 2 && (strCommand != "local" && strCommand != "all" && strCommand != "many" && strCommand != "missing" && strCommand != "disabled")) || (params.size() == 3 && strCommand != "alias")) throw runtime_error( "startmasternode \"local|all|many|missing|disabled|alias\" lockwallet ( \"alias\" )\n" "\nAttempts to start one or more masternode(s)\n" "\nArguments:\n" "1. set (string, required) Specify which set of masternode(s) to start.\n" "2. lockwallet (boolean, required) Lock wallet after completion.\n" "3. alias (string) Masternode alias. Required if using 'alias' as the set.\n" "\nResult: (for 'local' set):\n" "\"status\" (string) Masternode status message\n" "\nResult: (for other sets):\n" "{\n" " \"overall\": \"xxxx\", (string) Overall status message\n" " \"detail\": [\n" " {\n" " \"node\": \"xxxx\", (string) Node name or alias\n" " \"result\": \"xxxx\", (string) 'success' or 'failed'\n" " \"error\": \"xxxx\" (string) Error message, if failed\n" " }\n" " ,...\n" " ]\n" "}\n" "\nExamples:\n" + HelpExampleCli("startmasternode", "\"alias\" \"0\" \"my_mn\"") + HelpExampleRpc("startmasternode", "\"alias\" \"0\" \"my_mn\"")); bool fLock = (params[1].get_str() == "true" ? true : false); if (strCommand == "local") { if (!fMasterNode) throw runtime_error("you must set masternode=1 in the configuration\n"); if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); if (activeMasternode.status != ACTIVE_MASTERNODE_STARTED) { activeMasternode.status = ACTIVE_MASTERNODE_INITIAL; // TODO: consider better way activeMasternode.ManageStatus(); if (fLock) pwalletMain->Lock(); } return activeMasternode.GetStatus(); } if (strCommand == "all" || strCommand == "many" || strCommand == "missing" || strCommand == "disabled") { if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); if ((strCommand == "missing" || strCommand == "disabled") && (masternodeSync.RequestedMasternodeAssets <= MASTERNODE_SYNC_LIST || masternodeSync.RequestedMasternodeAssets == MASTERNODE_SYNC_FAILED)) { throw runtime_error("You can't use this command until masternode list is synced\n"); } std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries; mnEntries = masternodeConfig.getEntries(); int successful = 0; int failed = 0; UniValue resultsObj(UniValue::VARR); BOOST_FOREACH (CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) { std::string errorMessage; int nIndex; if(!mne.castOutputIndex(nIndex)) continue; CTxIn vin = CTxIn(uint256(mne.getTxHash()), uint32_t(nIndex)); CMasternode* pmn = mnodeman.Find(vin); if (pmn != NULL) { if (strCommand == "missing") continue; if (strCommand == "disabled" && pmn->IsEnabled()) continue; } bool result = activeMasternode.Register(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), errorMessage); UniValue statusObj(UniValue::VOBJ); statusObj.push_back(Pair("alias", mne.getAlias())); statusObj.push_back(Pair("result", result ? "success" : "failed")); if (result) { successful++; statusObj.push_back(Pair("error", "")); } else { failed++; statusObj.push_back(Pair("error", errorMessage)); } resultsObj.push_back(statusObj); } if (fLock) pwalletMain->Lock(); UniValue returnObj(UniValue::VOBJ); returnObj.push_back(Pair("overall", strprintf("Successfully started %d masternodes, failed to start %d, total %d", successful, failed, successful + failed))); returnObj.push_back(Pair("detail", resultsObj)); return returnObj; } if (strCommand == "alias") { std::string alias = params[2].get_str(); if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); bool found = false; int successful = 0; int failed = 0; UniValue resultsObj(UniValue::VARR); UniValue statusObj(UniValue::VOBJ); statusObj.push_back(Pair("alias", alias)); BOOST_FOREACH (CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) { if (mne.getAlias() == alias) { found = true; std::string errorMessage; bool result = activeMasternode.Register(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), errorMessage); statusObj.push_back(Pair("result", result ? "successful" : "failed")); if (result) { successful++; statusObj.push_back(Pair("error", "")); } else { failed++; statusObj.push_back(Pair("error", errorMessage)); } break; } } if (!found) { failed++; statusObj.push_back(Pair("result", "failed")); statusObj.push_back(Pair("error", "could not find alias in config. Verify with list-conf.")); } resultsObj.push_back(statusObj); if (fLock) pwalletMain->Lock(); UniValue returnObj(UniValue::VOBJ); returnObj.push_back(Pair("overall", strprintf("Successfully started %d masternodes, failed to start %d, total %d", successful, failed, successful + failed))); returnObj.push_back(Pair("detail", resultsObj)); return returnObj; } return NullUniValue; } UniValue createmasternodekey (const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 0)) throw runtime_error( "createmasternodekey\n" "\nCreate a new masternode private key\n" "\nResult:\n" "\"key\" (string) Masternode private key\n" "\nExamples:\n" + HelpExampleCli("createmasternodekey", "") + HelpExampleRpc("createmasternodekey", "")); CKey secret; secret.MakeNewKey(false); return CBitcoinSecret(secret).ToString(); } UniValue getmasternodeoutputs (const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 0)) throw runtime_error( "getmasternodeoutputs\n" "\nPrint all masternode transaction outputs\n" "\nResult:\n" "[\n" " {\n" " \"txhash\": \"xxxx\", (string) output transaction hash\n" " \"outputidx\": n (numeric) output index number\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("getmasternodeoutputs", "") + HelpExampleRpc("getmasternodeoutputs", "")); // Find possible candidates vector<COutput> possibleCoins = activeMasternode.SelectCoinsMasternode(); UniValue ret(UniValue::VARR); BOOST_FOREACH (COutput& out, possibleCoins) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("txhash", out.tx->GetHash().ToString())); obj.push_back(Pair("outputidx", out.i)); ret.push_back(obj); } return ret; } UniValue listmasternodeconf (const UniValue& params, bool fHelp) { std::string strFilter = ""; if (params.size() == 1) strFilter = params[0].get_str(); if (fHelp || (params.size() > 1)) throw runtime_error( "listmasternodeconf ( \"filter\" )\n" "\nPrint masternode.conf in JSON format\n" "\nArguments:\n" "1. \"filter\" (string, optional) Filter search text. Partial match on alias, address, txHash, or status.\n" "\nResult:\n" "[\n" " {\n" " \"alias\": \"xxxx\", (string) masternode alias\n" " \"address\": \"xxxx\", (string) masternode IP address\n" " \"privateKey\": \"xxxx\", (string) masternode private key\n" " \"txHash\": \"xxxx\", (string) transaction hash\n" " \"outputIndex\": n, (numeric) transaction output index\n" " \"status\": \"xxxx\" (string) masternode status\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("listmasternodeconf", "") + HelpExampleRpc("listmasternodeconf", "")); std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries; mnEntries = masternodeConfig.getEntries(); UniValue ret(UniValue::VARR); BOOST_FOREACH (CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) { int nIndex; if(!mne.castOutputIndex(nIndex)) continue; CTxIn vin = CTxIn(uint256(mne.getTxHash()), uint32_t(nIndex)); CMasternode* pmn = mnodeman.Find(vin); std::string strStatus = pmn ? pmn->Status() : "MISSING"; if (strFilter != "" && mne.getAlias().find(strFilter) == string::npos && mne.getIp().find(strFilter) == string::npos && mne.getTxHash().find(strFilter) == string::npos && strStatus.find(strFilter) == string::npos) continue; UniValue mnObj(UniValue::VOBJ); mnObj.push_back(Pair("alias", mne.getAlias())); mnObj.push_back(Pair("address", mne.getIp())); mnObj.push_back(Pair("privateKey", mne.getPrivKey())); mnObj.push_back(Pair("txHash", mne.getTxHash())); mnObj.push_back(Pair("outputIndex", mne.getOutputIndex())); mnObj.push_back(Pair("status", strStatus)); ret.push_back(mnObj); } return ret; } UniValue getmasternodestatus (const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 0)) throw runtime_error( "getmasternodestatus\n" "\nPrint masternode status\n" "\nResult:\n" "{\n" " \"txhash\": \"xxxx\", (string) Collateral transaction hash\n" " \"outputidx\": n, (numeric) Collateral transaction output index number\n" " \"netaddr\": \"xxxx\", (string) Masternode network address\n" " \"addr\": \"xxxx\", (string) Retrex address for masternode payments\n" " \"status\": \"xxxx\", (string) Masternode status\n" " \"message\": \"xxxx\" (string) Masternode status message\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmasternodestatus", "") + HelpExampleRpc("getmasternodestatus", "")); if (!fMasterNode) throw runtime_error("This is not a masternode"); CMasternode* pmn = mnodeman.Find(activeMasternode.vin); if (pmn) { UniValue mnObj(UniValue::VOBJ); mnObj.push_back(Pair("txhash", activeMasternode.vin.prevout.hash.ToString())); mnObj.push_back(Pair("outputidx", (uint64_t)activeMasternode.vin.prevout.n)); mnObj.push_back(Pair("netaddr", activeMasternode.service.ToString())); mnObj.push_back(Pair("addr", CBitcoinAddress(pmn->pubKeyCollateralAddress.GetID()).ToString())); mnObj.push_back(Pair("status", activeMasternode.status)); mnObj.push_back(Pair("message", activeMasternode.GetStatus())); return mnObj; } throw runtime_error("Masternode not found in the list of available masternodes. Current status: " + activeMasternode.GetStatus()); } UniValue getmasternodewinners (const UniValue& params, bool fHelp) { if (fHelp || params.size() > 3) throw runtime_error( "getmasternodewinners ( blocks \"filter\" )\n" "\nPrint the masternode winners for the last n blocks\n" "\nArguments:\n" "1. blocks (numeric, optional) Number of previous blocks to show (default: 10)\n" "2. filter (string, optional) Search filter matching MN address\n" "\nResult (single winner):\n" "[\n" " {\n" " \"nHeight\": n, (numeric) block height\n" " \"winner\": {\n" " \"address\": \"xxxx\", (string) Retrex MN Address\n" " \"nVotes\": n, (numeric) Number of votes for winner\n" " }\n" " }\n" " ,...\n" "]\n" "\nResult (multiple winners):\n" "[\n" " {\n" " \"nHeight\": n, (numeric) block height\n" " \"winner\": [\n" " {\n" " \"address\": \"xxxx\", (string) Retrex MN Address\n" " \"nVotes\": n, (numeric) Number of votes for winner\n" " }\n" " ,...\n" " ]\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("getmasternodewinners", "") + HelpExampleRpc("getmasternodewinners", "")); int nHeight; { LOCK(cs_main); CBlockIndex* pindex = chainActive.Tip(); if(!pindex) return 0; nHeight = pindex->nHeight; } int nLast = 10; std::string strFilter = ""; if (params.size() >= 1) nLast = atoi(params[0].get_str()); if (params.size() == 2) strFilter = params[1].get_str(); UniValue ret(UniValue::VARR); for (int i = nHeight - nLast; i < nHeight + 20; i++) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("nHeight", i)); std::string strPayment = GetRequiredPaymentsString(i); if (strFilter != "" && strPayment.find(strFilter) == std::string::npos) continue; if (strPayment.find(',') != std::string::npos) { UniValue winner(UniValue::VARR); boost::char_separator<char> sep(","); boost::tokenizer< boost::char_separator<char> > tokens(strPayment, sep); BOOST_FOREACH (const string& t, tokens) { UniValue addr(UniValue::VOBJ); std::size_t pos = t.find(":"); std::string strAddress = t.substr(0,pos); uint64_t nVotes = atoi(t.substr(pos+1)); addr.push_back(Pair("address", strAddress)); addr.push_back(Pair("nVotes", nVotes)); winner.push_back(addr); } obj.push_back(Pair("winner", winner)); } else if (strPayment.find("Unknown") == std::string::npos) { UniValue winner(UniValue::VOBJ); std::size_t pos = strPayment.find(":"); std::string strAddress = strPayment.substr(0,pos); uint64_t nVotes = atoi(strPayment.substr(pos+1)); winner.push_back(Pair("address", strAddress)); winner.push_back(Pair("nVotes", nVotes)); obj.push_back(Pair("winner", winner)); } else { UniValue winner(UniValue::VOBJ); winner.push_back(Pair("address", strPayment)); winner.push_back(Pair("nVotes", 0)); obj.push_back(Pair("winner", winner)); } ret.push_back(obj); } return ret; } UniValue getmasternodescores (const UniValue& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getmasternodescores ( blocks )\n" "\nPrint list of winning masternode by score\n" "\nArguments:\n" "1. blocks (numeric, optional) Show the last n blocks (default 10)\n" "\nResult:\n" "{\n" " xxxx: \"xxxx\" (numeric : string) Block height : Masternode hash\n" " ,...\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmasternodescores", "") + HelpExampleRpc("getmasternodescores", "")); int nLast = 10; if (params.size() == 1) { try { nLast = std::stoi(params[0].get_str()); } catch (const boost::bad_lexical_cast &) { throw runtime_error("Exception on param 2"); } } UniValue obj(UniValue::VOBJ); std::vector<CMasternode> vMasternodes = mnodeman.GetFullMasternodeVector(); for (int nHeight = chainActive.Tip()->nHeight - nLast; nHeight < chainActive.Tip()->nHeight + 20; nHeight++) { uint256 nHigh = 0; CMasternode* pBestMasternode = NULL; BOOST_FOREACH (CMasternode& mn, vMasternodes) { uint256 n = mn.CalculateScore(1, nHeight - 100); if (n > nHigh) { nHigh = n; pBestMasternode = &mn; } } if (pBestMasternode) obj.push_back(Pair(strprintf("%d", nHeight), pBestMasternode->vin.prevout.hash.ToString().c_str())); } return obj; }
//===--- BlobGen.cpp - Blob Generator ---------------------------*- C++ -*-===// // // This source file is part of the DCL open source project // // Copyright (c) 2022 Li Yu-Long and the DCL project authors // Licensed under Apache 2.0 License // // See https://github.com/dcl-project/dcl/LICENSE.txt for license information // See https://github.com/dcl-project/dcl/graphs/contributors for the list of // DCL project authors // //===----------------------------------------------------------------------===// #include <dcl/BlobGen/BlobGen.h> namespace dcl::BlobGen { const char * getPathv( const char ** sourceFilePaths, size_t sourceFileCount, dcl::Platform::Triple triple, dcl::Driver::Suite compilerSuite, va_list compilerArgs); std::vector<std::string> getAllTriples() { return {}; } std::vector<std::string> getAllCompilerSuites() { return {}; } const char * getPath( const char * sourceFilePath, dcl::Platform::Triple triple, dcl::Driver::Suite compilerSuite, ...) { va_list compilerArgs; va_start(compilerArgs, compilerSuite); const char * path = getPathv(&sourceFilePath, 1, triple, compilerSuite, compilerArgs); va_end(compilerArgs); return path; } const char * getPath( const char ** sourceFilePaths, size_t sourceFileCount, dcl::Platform::Triple triple, dcl::Driver::Suite compilerSuite, ...) { va_list compilerArgs; va_start(compilerArgs, compilerSuite); const char * path = getPathv( sourceFilePaths, sourceFileCount, triple, compilerSuite, compilerArgs); va_end(compilerArgs); return path; } const char * getPathv( const char ** sourceFilePaths, size_t sourceFileCount, dcl::Platform::Triple triple, dcl::Driver::Suite compilerSuite, va_list compilerArgs) { return nullptr; } } // namespace dcl::BlobGen
; A171462: Number of hands a bartender needs to have in order to win at the blind bartender's problem with n glasses in a cycle. ; 0,1,2,2,4,4,6,4,6,8,10,8,12,12,12,8,16,12,18,16,18,20,22,16,20,24,18,24,28,24,30,16,30,32,30,24,36,36,36,32,40,36,42,40,36,44,46,32,42,40,48,48,52,36,50,48,54,56,58,48,60,60,54,32,60,60,66,64,66,60,70,48,72,72,60,72,70,72,78,64,54,80,82,72,80,84,84,80,88,72,84,88,90,92,90,64,96,84,90,80 mov $1,$0 seq $1,52126 ; a(1) = 1; for n>1, a(n)=n/(largest prime dividing n). sub $1,1 sub $0,$1
; set toggle item include win1_mac_oli include win1_keys_wman section utility xdef xwm_stgl ;+++ ; set toggle item ; ; Entry Exit ; d1 loose item numer ; a2 wman vector ; a3 toggle list ; a4 wwork ;--- xwm_stgl subr a0/a1 move.l a3,a0 add.l (a0),a0 push d1 moveq #1,d1 xjsr ut_arinf ; get address of first item pop d1 move.w 4(a3),d0 ; get current item subq.w #1,d0 mulu d0,d2 lea (a0,d2.l),a1 jsr wm.stlob(a2) subend end
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x1c833, %rsi lea addresses_A_ht+0x6b97, %rdi nop nop nop nop nop xor $11210, %r12 mov $23, %rcx rep movsl nop nop and $30497, %rax lea addresses_D_ht+0x1d0d3, %rbp nop inc %r15 movups (%rbp), %xmm1 vpextrq $1, %xmm1, %rdi nop nop nop nop nop sub %rdi, %rdi lea addresses_UC_ht+0x122b3, %rcx clflush (%rcx) nop nop nop nop xor %rax, %rax movups (%rcx), %xmm0 vpextrq $0, %xmm0, %r12 nop and %rcx, %rcx lea addresses_WT_ht+0x1bff3, %rax clflush (%rax) nop nop nop nop nop cmp $64286, %rbp mov (%rax), %edi nop nop sub $5377, %r12 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r9 push %rax push %rdx // Faulty Load lea addresses_PSE+0x16ab3, %r9 nop nop nop add %rax, %rax mov (%r9), %r15d lea oracles, %rax and $0xff, %r15 shlq $12, %r15 mov (%rax,%r15,1), %r15 pop %rdx pop %rax pop %r9 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
#include "Skybox.h" float HEIGHT = 0.1f; Skybox::Skybox() { } Skybox::~Skybox() { } void Skybox::init() { for (int i = 0; i < 6; ++i) { textures[i] = 0; glGenTextures(1, &(textures[i])); // I can't believe constructing a string is such a show std::string filename = "assets/skybox-"; filename.push_back(i + '0'); filename += ".jpg"; const char *wholeFilename = filename.c_str(); textures[i] = SOIL_load_OGL_texture( wholeFilename, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); if (textures[i] == 0) { std::cout << "Texture was not properly loaded.\n"; } glBindTexture(GL_TEXTURE_2D, textures[i]); } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } void Skybox::render() { // Store the current matrix glPushMatrix(); // Enable/disable features glPushAttrib(GL_ENABLE_BIT); glEnable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glDisable(GL_BLEND); // Always render the skybox in fill mode glPolygonMode(GL_FRONT, GL_FILL); // Set all vertices to blue, for funsies glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Render the front quad glBindTexture(GL_TEXTURE_2D, textures[5]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, -5.0f ); glEnd(); // Render the left quad glBindTexture(GL_TEXTURE_2D, textures[1]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, 5.0f ); glEnd(); // Render the back quad glBindTexture(GL_TEXTURE_2D, textures[4]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(0, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, 5.0f ); glEnd(); // Render the right quad glBindTexture(GL_TEXTURE_2D, textures[0]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(0, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, -5.0f ); glEnd(); // Render the top quad glBindTexture(GL_TEXTURE_2D, textures[2]); glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 0); glVertex3f( -5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, -5.0f ); glEnd(); // Render the bottom quad glBindTexture(GL_TEXTURE_2D, textures[3]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 1); glVertex3f( -5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, -5.0f ); glEnd(); // Restore enable bits and matrix glPopAttrib(); glPopMatrix(); glDisable(GL_TEXTURE_2D); } void Skybox::renderReflection() { // Store the current matrix glPushMatrix(); glScalef(1.0f, -1.0f, 1.0f); // Enable/disable features glPushAttrib(GL_ENABLE_BIT); glEnable(GL_TEXTURE_2D); // glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glDisable(GL_BLEND); // Always render the skybox in fill mode glPolygonMode(GL_FRONT, GL_FILL); // Set all vertices to white glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Render the front quad glBindTexture(GL_TEXTURE_2D, textures[5]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, -5.0f ); glEnd(); // Render the left quad glBindTexture(GL_TEXTURE_2D, textures[1]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, 5.0f ); glEnd(); // Render the back quad glBindTexture(GL_TEXTURE_2D, textures[4]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(0, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, 5.0f ); glEnd(); // Render the right quad glBindTexture(GL_TEXTURE_2D, textures[0]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(1, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(0, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, -5.0f ); glEnd(); // Render the top quad glBindTexture(GL_TEXTURE_2D, textures[2]); glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex3f( -5.0f, 5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 0); glVertex3f( -5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, 5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, 5.0f + HEIGHT, -5.0f ); glEnd(); // Render the bottom quad glBindTexture(GL_TEXTURE_2D, textures[3]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f( -5.0f, -5.0f + HEIGHT, -5.0f ); glTexCoord2f(0, 1); glVertex3f( -5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 1); glVertex3f( 5.0f, -5.0f + HEIGHT, 5.0f ); glTexCoord2f(1, 0); glVertex3f( 5.0f, -5.0f + HEIGHT, -5.0f ); glEnd(); // Restore enable bits and matrix glPopAttrib(); glPopMatrix(); glDisable(GL_TEXTURE_2D); }
.global s_prepare_buffers s_prepare_buffers: push %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1813f, %rbp nop nop nop nop nop xor $42200, %rcx mov (%rbp), %r9w nop nop xor %r9, %r9 lea addresses_normal_ht+0xf8d7, %r8 nop nop and %rdx, %rdx vmovups (%r8), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %rax nop nop nop nop nop add %r8, %r8 lea addresses_D_ht+0x95d7, %rsi lea addresses_normal_ht+0x2197, %rdi nop nop nop nop nop dec %r8 mov $93, %rcx rep movsb nop and %rdx, %rdx lea addresses_normal_ht+0x17dff, %rsi lea addresses_WT_ht+0x3b37, %rdi and $39056, %rax mov $77, %rcx rep movsq nop nop nop nop add $54570, %rsi lea addresses_D_ht+0x10b17, %r8 xor %rcx, %rcx mov (%r8), %ax nop nop xor %rax, %rax lea addresses_D_ht+0x18b65, %rsi sub %r8, %r8 mov (%rsi), %r9w nop cmp $975, %rbp lea addresses_normal_ht+0x112d7, %rsi xor $45879, %rdx movb $0x61, (%rsi) nop and %rdi, %rdi lea addresses_WT_ht+0x1bad7, %rsi lea addresses_WT_ht+0x1e8c7, %rdi clflush (%rsi) clflush (%rdi) nop inc %rbp mov $36, %rcx rep movsl and $7516, %r8 lea addresses_D_ht+0x4b77, %rsi lea addresses_D_ht+0x2fc7, %rdi nop nop nop nop nop dec %rax mov $125, %rcx rep movsl nop nop nop nop nop dec %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r9 push %rcx push %rdi push %rsi // Load lea addresses_D+0x6f57, %rdi nop nop dec %rcx movb (%rdi), %r15b nop nop add $47050, %rdi // Store mov $0x7ff, %rcx nop nop nop nop nop and %rdi, %rdi movl $0x51525354, (%rcx) nop add $11812, %r11 // Store lea addresses_UC+0x3ed7, %rdi xor $55934, %r15 movl $0x51525354, (%rdi) add $20191, %rdi // Load lea addresses_normal+0x7ed7, %r9 dec %r11 mov (%r9), %edi add $46836, %r9 // Store mov $0x5ae5740000000ad7, %r9 nop nop nop nop nop cmp $4786, %r11 movw $0x5152, (%r9) nop xor $12139, %r11 // Store lea addresses_RW+0x1421c, %r11 nop nop sub %r12, %r12 mov $0x5152535455565758, %r9 movq %r9, %xmm0 vmovntdq %ymm0, (%r11) nop nop nop nop nop cmp %rcx, %rcx // Store mov $0x2d3b3000000005d7, %rdi nop nop xor $61064, %rcx mov $0x5152535455565758, %r12 movq %r12, %xmm7 movups %xmm7, (%rdi) nop sub %rsi, %rsi // Faulty Load lea addresses_D+0xa2d7, %rcx nop dec %rsi movups (%rcx), %xmm0 vpextrq $0, %xmm0, %rdi lea oracles, %rcx and $0xff, %rdi shlq $12, %rdi mov (%rcx,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %r9 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'36': 12186} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
#include "prometheus/summary.h" #include <gtest/gtest.h> #include <cmath> #include <limits> #include <memory> #include <thread> namespace prometheus { namespace { TEST(SummaryTest, initialize_with_zero) { Summary summary{Summary::Quantiles{}}; auto metric = summary.Collect(); auto s = metric.summary; EXPECT_EQ(s.sample_count, 0U); EXPECT_EQ(s.sample_sum, 0); } TEST(SummaryTest, sample_count) { Summary summary{Summary::Quantiles{{0.5, 0.05}}}; summary.Observe(0); summary.Observe(200); auto metric = summary.Collect(); auto s = metric.summary; EXPECT_EQ(s.sample_count, 2U); } TEST(SummaryTest, sample_sum) { Summary summary{Summary::Quantiles{{0.5, 0.05}}}; summary.Observe(0); summary.Observe(1); summary.Observe(101); auto metric = summary.Collect(); auto s = metric.summary; EXPECT_EQ(s.sample_sum, 102); } TEST(SummaryTest, quantile_size) { Summary summary{Summary::Quantiles{{0.5, 0.05}, {0.90, 0.01}}}; auto metric = summary.Collect(); auto s = metric.summary; EXPECT_EQ(s.quantile.size(), 2U); } TEST(SummaryTest, quantile_bounds) { Summary summary{Summary::Quantiles{{0.5, 0.05}, {0.90, 0.01}, {0.99, 0.001}}}; auto metric = summary.Collect(); auto s = metric.summary; ASSERT_EQ(s.quantile.size(), 3U); EXPECT_DOUBLE_EQ(s.quantile.at(0).quantile, 0.5); EXPECT_DOUBLE_EQ(s.quantile.at(1).quantile, 0.9); EXPECT_DOUBLE_EQ(s.quantile.at(2).quantile, 0.99); } TEST(SummaryTest, quantile_values) { static const int SAMPLES = 1000000; Summary summary{Summary::Quantiles{{0.5, 0.05}, {0.9, 0.01}, {0.99, 0.001}}}; for (int i = 1; i <= SAMPLES; ++i) summary.Observe(i); auto metric = summary.Collect(); auto s = metric.summary; ASSERT_EQ(s.quantile.size(), 3U); EXPECT_NEAR(s.quantile.at(0).value, 0.5 * SAMPLES, 0.05 * SAMPLES); EXPECT_NEAR(s.quantile.at(1).value, 0.9 * SAMPLES, 0.01 * SAMPLES); EXPECT_NEAR(s.quantile.at(2).value, 0.99 * SAMPLES, 0.001 * SAMPLES); } TEST(SummaryTest, max_age) { Summary summary{Summary::Quantiles{{0.99, 0.001}}, std::chrono::seconds(1), 2}; summary.Observe(8.0); static const auto test_value = [&summary](double ref) { auto metric = summary.Collect(); auto s = metric.summary; ASSERT_EQ(s.quantile.size(), 1U); if (std::isnan(ref)) EXPECT_TRUE(std::isnan(s.quantile.at(0).value)); else EXPECT_DOUBLE_EQ(s.quantile.at(0).value, ref); }; test_value(8.0); std::this_thread::sleep_for(std::chrono::milliseconds(600)); test_value(8.0); std::this_thread::sleep_for(std::chrono::milliseconds(600)); test_value(std::numeric_limits<double>::quiet_NaN()); } } // namespace } // namespace prometheus
; Z88 Small C+ Run time Library ; l_gint variant to be used sometimes by the peephole optimizer ; SECTION code_crt0_sccz80 PUBLIC l_gintspsp .l_gintspsp add hl,sp inc hl inc hl IF EZ80 defb 0xed, 0x27 ;ld hl,(hl) ELSE ld a,(hl) inc hl ld h,(hl) ld l,a ENDIF ex (sp),hl jp (hl)
// not // get top of stack @SP A=M-1 // not M=!M
PrintCardKeyText: ld hl, SilphCoMapList ld a, [wCurMap] ld b, a .silphCoMapListLoop ld a, [hli] cp $ff ret z cp b jr nz, .silphCoMapListLoop ; does not check for tile in front of player. This might be buggy ;predef GetTileAndCoordsInFrontOfPlayer ld a, [wTileInFrontOfPlayer] cp $18 jr z, .cardKeyDoorInFrontOfPlayer cp $24 jr z, .cardKeyDoorInFrontOfPlayer ld b, a ld a, [wCurMap] cp SILPH_CO_11F ret nz ld a, b cp $5e ret nz .cardKeyDoorInFrontOfPlayer ld b, CARD_KEY call IsItemInBag jr z, .noCardKey xor a ld [wPlayerMovingDirection], a tx_pre_id CardKeySuccessText ld [hSpriteIndexOrTextID], a call PrintPredefTextID call GetCoordsInFrontOfPlayer srl d ld a, d ld b, a ld [wCardKeyDoorY], a srl e ld a, e ld c, a ld [wCardKeyDoorX], a ld a, [wCurMap] cp SILPH_CO_11F jr nz, .notSilphCo11F ld a, $3 jr .replaceCardKeyDoorTileBlock .notSilphCo11F ld a, $e .replaceCardKeyDoorTileBlock ld [wNewTileBlockID], a predef ReplaceTileBlock ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, SFX_GO_INSIDE jp PlaySound .noCardKey tx_pre_id CardKeyFailText ld [hSpriteIndexOrTextID], a jp PrintPredefTextID SilphCoMapList: db SILPH_CO_2F db SILPH_CO_3F db SILPH_CO_4F db SILPH_CO_5F db SILPH_CO_6F db SILPH_CO_7F db SILPH_CO_8F db SILPH_CO_9F db SILPH_CO_10F db SILPH_CO_11F db $FF CardKeySuccessText: TX_FAR _CardKeySuccessText1 TX_SFX_ITEM TX_FAR _CardKeySuccessText2 db "@" CardKeyFailText: TX_FAR _CardKeyFailText db "@" ; d = Y ; e = X GetCoordsInFrontOfPlayer: ld a, [wYCoord] ld d, a ld a, [wXCoord] ld e, a ld a, [wPlayerFacingDirection] ; player's sprite facing direction and a jr nz, .notFacingDown ; facing down inc d ret .notFacingDown cp SPRITE_FACING_UP jr nz, .notFacingUp ; facing up dec d ret .notFacingUp cp SPRITE_FACING_LEFT jr nz, .notFacingLeft ; facing left dec e ret .notFacingLeft ; facing right inc e ret
kernel: file format elf32-i386 Disassembly of section .text: 80100000 <multiboot_header>: 80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh 80100006: 00 00 add %al,(%eax) 80100008: fe 4f 52 decb 0x52(%edi) 8010000b: e4 0f in $0xf,%al 8010000c <entry>: # Entering xv6 on boot processor, with paging off. .globl entry entry: # Turn on page size extension for 4Mbyte pages movl %cr4, %eax 8010000c: 0f 20 e0 mov %cr4,%eax orl $(CR4_PSE), %eax 8010000f: 83 c8 10 or $0x10,%eax movl %eax, %cr4 80100012: 0f 22 e0 mov %eax,%cr4 # Set page directory movl $(V2P_WO(entrypgdir)), %eax 80100015: b8 00 a0 10 00 mov $0x10a000,%eax movl %eax, %cr3 8010001a: 0f 22 d8 mov %eax,%cr3 # Turn on paging. movl %cr0, %eax 8010001d: 0f 20 c0 mov %cr0,%eax orl $(CR0_PG|CR0_WP), %eax 80100020: 0d 00 00 01 80 or $0x80010000,%eax movl %eax, %cr0 80100025: 0f 22 c0 mov %eax,%cr0 # Set up the stack pointer. movl $(stack + KSTACKSIZE), %esp 80100028: bc 70 c6 10 80 mov $0x8010c670,%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 85 37 10 80 mov $0x80103785,%eax jmp *%eax 80100032: ff e0 jmp *%eax 80100034 <binit>: struct buf head; } bcache; void binit(void) { 80100034: 55 push %ebp 80100035: 89 e5 mov %esp,%ebp 80100037: 83 ec 18 sub $0x18,%esp struct buf *b; initlock(&bcache.lock, "bcache"); 8010003a: 83 ec 08 sub $0x8,%esp 8010003d: 68 c4 84 10 80 push $0x801084c4 80100042: 68 80 c6 10 80 push $0x8010c680 80100047: e8 81 4e 00 00 call 80104ecd <initlock> 8010004c: 83 c4 10 add $0x10,%esp //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; 8010004f: c7 05 90 05 11 80 84 movl $0x80110584,0x80110590 80100056: 05 11 80 bcache.head.next = &bcache.head; 80100059: c7 05 94 05 11 80 84 movl $0x80110584,0x80110594 80100060: 05 11 80 for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80100063: c7 45 f4 b4 c6 10 80 movl $0x8010c6b4,-0xc(%ebp) 8010006a: eb 3a jmp 801000a6 <binit+0x72> b->next = bcache.head.next; 8010006c: 8b 15 94 05 11 80 mov 0x80110594,%edx 80100072: 8b 45 f4 mov -0xc(%ebp),%eax 80100075: 89 50 10 mov %edx,0x10(%eax) b->prev = &bcache.head; 80100078: 8b 45 f4 mov -0xc(%ebp),%eax 8010007b: c7 40 0c 84 05 11 80 movl $0x80110584,0xc(%eax) b->dev = -1; 80100082: 8b 45 f4 mov -0xc(%ebp),%eax 80100085: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax) bcache.head.next->prev = b; 8010008c: a1 94 05 11 80 mov 0x80110594,%eax 80100091: 8b 55 f4 mov -0xc(%ebp),%edx 80100094: 89 50 0c mov %edx,0xc(%eax) bcache.head.next = b; 80100097: 8b 45 f4 mov -0xc(%ebp),%eax 8010009a: a3 94 05 11 80 mov %eax,0x80110594 //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 8010009f: 81 45 f4 18 02 00 00 addl $0x218,-0xc(%ebp) 801000a6: 81 7d f4 84 05 11 80 cmpl $0x80110584,-0xc(%ebp) 801000ad: 72 bd jb 8010006c <binit+0x38> b->prev = &bcache.head; b->dev = -1; bcache.head.next->prev = b; bcache.head.next = b; } } 801000af: c9 leave 801000b0: c3 ret 801000b1 <bget>: // Look through buffer cache for sector on device dev. // If not found, allocate a buffer. // In either case, return B_BUSY buffer. static struct buf* bget(uint dev, uint sector) { 801000b1: 55 push %ebp 801000b2: 89 e5 mov %esp,%ebp 801000b4: 83 ec 18 sub $0x18,%esp struct buf *b; acquire(&bcache.lock); 801000b7: 83 ec 0c sub $0xc,%esp 801000ba: 68 80 c6 10 80 push $0x8010c680 801000bf: e8 2a 4e 00 00 call 80104eee <acquire> 801000c4: 83 c4 10 add $0x10,%esp loop: // Is the sector already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 801000c7: a1 94 05 11 80 mov 0x80110594,%eax 801000cc: 89 45 f4 mov %eax,-0xc(%ebp) 801000cf: eb 67 jmp 80100138 <bget+0x87> if(b->dev == dev && b->sector == sector){ 801000d1: 8b 45 f4 mov -0xc(%ebp),%eax 801000d4: 8b 40 04 mov 0x4(%eax),%eax 801000d7: 3b 45 08 cmp 0x8(%ebp),%eax 801000da: 75 53 jne 8010012f <bget+0x7e> 801000dc: 8b 45 f4 mov -0xc(%ebp),%eax 801000df: 8b 40 08 mov 0x8(%eax),%eax 801000e2: 3b 45 0c cmp 0xc(%ebp),%eax 801000e5: 75 48 jne 8010012f <bget+0x7e> if(!(b->flags & B_BUSY)){ 801000e7: 8b 45 f4 mov -0xc(%ebp),%eax 801000ea: 8b 00 mov (%eax),%eax 801000ec: 83 e0 01 and $0x1,%eax 801000ef: 85 c0 test %eax,%eax 801000f1: 75 27 jne 8010011a <bget+0x69> b->flags |= B_BUSY; 801000f3: 8b 45 f4 mov -0xc(%ebp),%eax 801000f6: 8b 00 mov (%eax),%eax 801000f8: 83 c8 01 or $0x1,%eax 801000fb: 89 c2 mov %eax,%edx 801000fd: 8b 45 f4 mov -0xc(%ebp),%eax 80100100: 89 10 mov %edx,(%eax) release(&bcache.lock); 80100102: 83 ec 0c sub $0xc,%esp 80100105: 68 80 c6 10 80 push $0x8010c680 8010010a: e8 45 4e 00 00 call 80104f54 <release> 8010010f: 83 c4 10 add $0x10,%esp return b; 80100112: 8b 45 f4 mov -0xc(%ebp),%eax 80100115: e9 98 00 00 00 jmp 801001b2 <bget+0x101> } sleep(b, &bcache.lock); 8010011a: 83 ec 08 sub $0x8,%esp 8010011d: 68 80 c6 10 80 push $0x8010c680 80100122: ff 75 f4 pushl -0xc(%ebp) 80100125: e8 cb 4a 00 00 call 80104bf5 <sleep> 8010012a: 83 c4 10 add $0x10,%esp goto loop; 8010012d: eb 98 jmp 801000c7 <bget+0x16> acquire(&bcache.lock); loop: // Is the sector already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 8010012f: 8b 45 f4 mov -0xc(%ebp),%eax 80100132: 8b 40 10 mov 0x10(%eax),%eax 80100135: 89 45 f4 mov %eax,-0xc(%ebp) 80100138: 81 7d f4 84 05 11 80 cmpl $0x80110584,-0xc(%ebp) 8010013f: 75 90 jne 801000d1 <bget+0x20> } // Not cached; recycle some non-busy and clean buffer. // "clean" because B_DIRTY and !B_BUSY means log.c // hasn't yet committed the changes to the buffer. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100141: a1 90 05 11 80 mov 0x80110590,%eax 80100146: 89 45 f4 mov %eax,-0xc(%ebp) 80100149: eb 51 jmp 8010019c <bget+0xeb> if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){ 8010014b: 8b 45 f4 mov -0xc(%ebp),%eax 8010014e: 8b 00 mov (%eax),%eax 80100150: 83 e0 01 and $0x1,%eax 80100153: 85 c0 test %eax,%eax 80100155: 75 3c jne 80100193 <bget+0xe2> 80100157: 8b 45 f4 mov -0xc(%ebp),%eax 8010015a: 8b 00 mov (%eax),%eax 8010015c: 83 e0 04 and $0x4,%eax 8010015f: 85 c0 test %eax,%eax 80100161: 75 30 jne 80100193 <bget+0xe2> b->dev = dev; 80100163: 8b 45 f4 mov -0xc(%ebp),%eax 80100166: 8b 55 08 mov 0x8(%ebp),%edx 80100169: 89 50 04 mov %edx,0x4(%eax) b->sector = sector; 8010016c: 8b 45 f4 mov -0xc(%ebp),%eax 8010016f: 8b 55 0c mov 0xc(%ebp),%edx 80100172: 89 50 08 mov %edx,0x8(%eax) b->flags = B_BUSY; 80100175: 8b 45 f4 mov -0xc(%ebp),%eax 80100178: c7 00 01 00 00 00 movl $0x1,(%eax) release(&bcache.lock); 8010017e: 83 ec 0c sub $0xc,%esp 80100181: 68 80 c6 10 80 push $0x8010c680 80100186: e8 c9 4d 00 00 call 80104f54 <release> 8010018b: 83 c4 10 add $0x10,%esp return b; 8010018e: 8b 45 f4 mov -0xc(%ebp),%eax 80100191: eb 1f jmp 801001b2 <bget+0x101> } // Not cached; recycle some non-busy and clean buffer. // "clean" because B_DIRTY and !B_BUSY means log.c // hasn't yet committed the changes to the buffer. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100193: 8b 45 f4 mov -0xc(%ebp),%eax 80100196: 8b 40 0c mov 0xc(%eax),%eax 80100199: 89 45 f4 mov %eax,-0xc(%ebp) 8010019c: 81 7d f4 84 05 11 80 cmpl $0x80110584,-0xc(%ebp) 801001a3: 75 a6 jne 8010014b <bget+0x9a> b->flags = B_BUSY; release(&bcache.lock); return b; } } panic("bget: no buffers"); 801001a5: 83 ec 0c sub $0xc,%esp 801001a8: 68 cb 84 10 80 push $0x801084cb 801001ad: e8 aa 03 00 00 call 8010055c <panic> } 801001b2: c9 leave 801001b3: c3 ret 801001b4 <bread>: // Return a B_BUSY buf with the contents of the indicated disk sector. struct buf* bread(uint dev, uint sector) { 801001b4: 55 push %ebp 801001b5: 89 e5 mov %esp,%ebp 801001b7: 83 ec 18 sub $0x18,%esp struct buf *b; b = bget(dev, sector); 801001ba: 83 ec 08 sub $0x8,%esp 801001bd: ff 75 0c pushl 0xc(%ebp) 801001c0: ff 75 08 pushl 0x8(%ebp) 801001c3: e8 e9 fe ff ff call 801000b1 <bget> 801001c8: 83 c4 10 add $0x10,%esp 801001cb: 89 45 f4 mov %eax,-0xc(%ebp) if(!(b->flags & B_VALID)) 801001ce: 8b 45 f4 mov -0xc(%ebp),%eax 801001d1: 8b 00 mov (%eax),%eax 801001d3: 83 e0 02 and $0x2,%eax 801001d6: 85 c0 test %eax,%eax 801001d8: 75 0e jne 801001e8 <bread+0x34> iderw(b); 801001da: 83 ec 0c sub $0xc,%esp 801001dd: ff 75 f4 pushl -0xc(%ebp) 801001e0: e8 50 26 00 00 call 80102835 <iderw> 801001e5: 83 c4 10 add $0x10,%esp return b; 801001e8: 8b 45 f4 mov -0xc(%ebp),%eax } 801001eb: c9 leave 801001ec: c3 ret 801001ed <bwrite>: // Write b's contents to disk. Must be B_BUSY. void bwrite(struct buf *b) { 801001ed: 55 push %ebp 801001ee: 89 e5 mov %esp,%ebp 801001f0: 83 ec 08 sub $0x8,%esp if((b->flags & B_BUSY) == 0) 801001f3: 8b 45 08 mov 0x8(%ebp),%eax 801001f6: 8b 00 mov (%eax),%eax 801001f8: 83 e0 01 and $0x1,%eax 801001fb: 85 c0 test %eax,%eax 801001fd: 75 0d jne 8010020c <bwrite+0x1f> panic("bwrite"); 801001ff: 83 ec 0c sub $0xc,%esp 80100202: 68 dc 84 10 80 push $0x801084dc 80100207: e8 50 03 00 00 call 8010055c <panic> b->flags |= B_DIRTY; 8010020c: 8b 45 08 mov 0x8(%ebp),%eax 8010020f: 8b 00 mov (%eax),%eax 80100211: 83 c8 04 or $0x4,%eax 80100214: 89 c2 mov %eax,%edx 80100216: 8b 45 08 mov 0x8(%ebp),%eax 80100219: 89 10 mov %edx,(%eax) iderw(b); 8010021b: 83 ec 0c sub $0xc,%esp 8010021e: ff 75 08 pushl 0x8(%ebp) 80100221: e8 0f 26 00 00 call 80102835 <iderw> 80100226: 83 c4 10 add $0x10,%esp } 80100229: c9 leave 8010022a: c3 ret 8010022b <brelse>: // Release a B_BUSY buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 8010022b: 55 push %ebp 8010022c: 89 e5 mov %esp,%ebp 8010022e: 83 ec 08 sub $0x8,%esp if((b->flags & B_BUSY) == 0) 80100231: 8b 45 08 mov 0x8(%ebp),%eax 80100234: 8b 00 mov (%eax),%eax 80100236: 83 e0 01 and $0x1,%eax 80100239: 85 c0 test %eax,%eax 8010023b: 75 0d jne 8010024a <brelse+0x1f> panic("brelse"); 8010023d: 83 ec 0c sub $0xc,%esp 80100240: 68 e3 84 10 80 push $0x801084e3 80100245: e8 12 03 00 00 call 8010055c <panic> acquire(&bcache.lock); 8010024a: 83 ec 0c sub $0xc,%esp 8010024d: 68 80 c6 10 80 push $0x8010c680 80100252: e8 97 4c 00 00 call 80104eee <acquire> 80100257: 83 c4 10 add $0x10,%esp b->next->prev = b->prev; 8010025a: 8b 45 08 mov 0x8(%ebp),%eax 8010025d: 8b 40 10 mov 0x10(%eax),%eax 80100260: 8b 55 08 mov 0x8(%ebp),%edx 80100263: 8b 52 0c mov 0xc(%edx),%edx 80100266: 89 50 0c mov %edx,0xc(%eax) b->prev->next = b->next; 80100269: 8b 45 08 mov 0x8(%ebp),%eax 8010026c: 8b 40 0c mov 0xc(%eax),%eax 8010026f: 8b 55 08 mov 0x8(%ebp),%edx 80100272: 8b 52 10 mov 0x10(%edx),%edx 80100275: 89 50 10 mov %edx,0x10(%eax) b->next = bcache.head.next; 80100278: 8b 15 94 05 11 80 mov 0x80110594,%edx 8010027e: 8b 45 08 mov 0x8(%ebp),%eax 80100281: 89 50 10 mov %edx,0x10(%eax) b->prev = &bcache.head; 80100284: 8b 45 08 mov 0x8(%ebp),%eax 80100287: c7 40 0c 84 05 11 80 movl $0x80110584,0xc(%eax) bcache.head.next->prev = b; 8010028e: a1 94 05 11 80 mov 0x80110594,%eax 80100293: 8b 55 08 mov 0x8(%ebp),%edx 80100296: 89 50 0c mov %edx,0xc(%eax) bcache.head.next = b; 80100299: 8b 45 08 mov 0x8(%ebp),%eax 8010029c: a3 94 05 11 80 mov %eax,0x80110594 b->flags &= ~B_BUSY; 801002a1: 8b 45 08 mov 0x8(%ebp),%eax 801002a4: 8b 00 mov (%eax),%eax 801002a6: 83 e0 fe and $0xfffffffe,%eax 801002a9: 89 c2 mov %eax,%edx 801002ab: 8b 45 08 mov 0x8(%ebp),%eax 801002ae: 89 10 mov %edx,(%eax) wakeup(b); 801002b0: 83 ec 0c sub $0xc,%esp 801002b3: ff 75 08 pushl 0x8(%ebp) 801002b6: e8 26 4a 00 00 call 80104ce1 <wakeup> 801002bb: 83 c4 10 add $0x10,%esp release(&bcache.lock); 801002be: 83 ec 0c sub $0xc,%esp 801002c1: 68 80 c6 10 80 push $0x8010c680 801002c6: e8 89 4c 00 00 call 80104f54 <release> 801002cb: 83 c4 10 add $0x10,%esp } 801002ce: c9 leave 801002cf: c3 ret 801002d0 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801002d0: 55 push %ebp 801002d1: 89 e5 mov %esp,%ebp 801002d3: 83 ec 14 sub $0x14,%esp 801002d6: 8b 45 08 mov 0x8(%ebp),%eax 801002d9: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801002dd: 0f b7 45 ec movzwl -0x14(%ebp),%eax 801002e1: 89 c2 mov %eax,%edx 801002e3: ec in (%dx),%al 801002e4: 88 45 ff mov %al,-0x1(%ebp) return data; 801002e7: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 801002eb: c9 leave 801002ec: c3 ret 801002ed <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801002ed: 55 push %ebp 801002ee: 89 e5 mov %esp,%ebp 801002f0: 83 ec 08 sub $0x8,%esp 801002f3: 8b 55 08 mov 0x8(%ebp),%edx 801002f6: 8b 45 0c mov 0xc(%ebp),%eax 801002f9: 66 89 55 fc mov %dx,-0x4(%ebp) 801002fd: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80100300: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80100304: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80100308: ee out %al,(%dx) } 80100309: c9 leave 8010030a: c3 ret 8010030b <cli>: asm volatile("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { 8010030b: 55 push %ebp 8010030c: 89 e5 mov %esp,%ebp asm volatile("cli"); 8010030e: fa cli } 8010030f: 5d pop %ebp 80100310: c3 ret 80100311 <printint>: int locking; } cons; static void printint(int xx, int base, int sign) { 80100311: 55 push %ebp 80100312: 89 e5 mov %esp,%ebp 80100314: 53 push %ebx 80100315: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789abcdef"; char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 80100318: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010031c: 74 1c je 8010033a <printint+0x29> 8010031e: 8b 45 08 mov 0x8(%ebp),%eax 80100321: c1 e8 1f shr $0x1f,%eax 80100324: 0f b6 c0 movzbl %al,%eax 80100327: 89 45 10 mov %eax,0x10(%ebp) 8010032a: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010032e: 74 0a je 8010033a <printint+0x29> x = -xx; 80100330: 8b 45 08 mov 0x8(%ebp),%eax 80100333: f7 d8 neg %eax 80100335: 89 45 f0 mov %eax,-0x10(%ebp) 80100338: eb 06 jmp 80100340 <printint+0x2f> else x = xx; 8010033a: 8b 45 08 mov 0x8(%ebp),%eax 8010033d: 89 45 f0 mov %eax,-0x10(%ebp) i = 0; 80100340: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 80100347: 8b 4d f4 mov -0xc(%ebp),%ecx 8010034a: 8d 41 01 lea 0x1(%ecx),%eax 8010034d: 89 45 f4 mov %eax,-0xc(%ebp) 80100350: 8b 5d 0c mov 0xc(%ebp),%ebx 80100353: 8b 45 f0 mov -0x10(%ebp),%eax 80100356: ba 00 00 00 00 mov $0x0,%edx 8010035b: f7 f3 div %ebx 8010035d: 89 d0 mov %edx,%eax 8010035f: 0f b6 80 04 90 10 80 movzbl -0x7fef6ffc(%eax),%eax 80100366: 88 44 0d e0 mov %al,-0x20(%ebp,%ecx,1) }while((x /= base) != 0); 8010036a: 8b 5d 0c mov 0xc(%ebp),%ebx 8010036d: 8b 45 f0 mov -0x10(%ebp),%eax 80100370: ba 00 00 00 00 mov $0x0,%edx 80100375: f7 f3 div %ebx 80100377: 89 45 f0 mov %eax,-0x10(%ebp) 8010037a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010037e: 75 c7 jne 80100347 <printint+0x36> if(sign) 80100380: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100384: 74 0e je 80100394 <printint+0x83> buf[i++] = '-'; 80100386: 8b 45 f4 mov -0xc(%ebp),%eax 80100389: 8d 50 01 lea 0x1(%eax),%edx 8010038c: 89 55 f4 mov %edx,-0xc(%ebp) 8010038f: c6 44 05 e0 2d movb $0x2d,-0x20(%ebp,%eax,1) while(--i >= 0) 80100394: eb 1a jmp 801003b0 <printint+0x9f> consputc(buf[i]); 80100396: 8d 55 e0 lea -0x20(%ebp),%edx 80100399: 8b 45 f4 mov -0xc(%ebp),%eax 8010039c: 01 d0 add %edx,%eax 8010039e: 0f b6 00 movzbl (%eax),%eax 801003a1: 0f be c0 movsbl %al,%eax 801003a4: 83 ec 0c sub $0xc,%esp 801003a7: 50 push %eax 801003a8: e8 be 03 00 00 call 8010076b <consputc> 801003ad: 83 c4 10 add $0x10,%esp }while((x /= base) != 0); if(sign) buf[i++] = '-'; while(--i >= 0) 801003b0: 83 6d f4 01 subl $0x1,-0xc(%ebp) 801003b4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801003b8: 79 dc jns 80100396 <printint+0x85> consputc(buf[i]); } 801003ba: 8b 5d fc mov -0x4(%ebp),%ebx 801003bd: c9 leave 801003be: c3 ret 801003bf <cprintf>: //PAGEBREAK: 50 // Print to the console. only understands %d, %x, %p, %s. void cprintf(char *fmt, ...) { 801003bf: 55 push %ebp 801003c0: 89 e5 mov %esp,%ebp 801003c2: 83 ec 28 sub $0x28,%esp int i, c, locking; uint *argp; char *s; locking = cons.locking; 801003c5: a1 14 b6 10 80 mov 0x8010b614,%eax 801003ca: 89 45 e8 mov %eax,-0x18(%ebp) if(locking) 801003cd: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 801003d1: 74 10 je 801003e3 <cprintf+0x24> acquire(&cons.lock); 801003d3: 83 ec 0c sub $0xc,%esp 801003d6: 68 e0 b5 10 80 push $0x8010b5e0 801003db: e8 0e 4b 00 00 call 80104eee <acquire> 801003e0: 83 c4 10 add $0x10,%esp if (fmt == 0) 801003e3: 8b 45 08 mov 0x8(%ebp),%eax 801003e6: 85 c0 test %eax,%eax 801003e8: 75 0d jne 801003f7 <cprintf+0x38> panic("null fmt"); 801003ea: 83 ec 0c sub $0xc,%esp 801003ed: 68 ea 84 10 80 push $0x801084ea 801003f2: e8 65 01 00 00 call 8010055c <panic> argp = (uint*)(void*)(&fmt + 1); 801003f7: 8d 45 0c lea 0xc(%ebp),%eax 801003fa: 89 45 f0 mov %eax,-0x10(%ebp) for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801003fd: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80100404: e9 1b 01 00 00 jmp 80100524 <cprintf+0x165> if(c != '%'){ 80100409: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 8010040d: 74 13 je 80100422 <cprintf+0x63> consputc(c); 8010040f: 83 ec 0c sub $0xc,%esp 80100412: ff 75 e4 pushl -0x1c(%ebp) 80100415: e8 51 03 00 00 call 8010076b <consputc> 8010041a: 83 c4 10 add $0x10,%esp continue; 8010041d: e9 fe 00 00 00 jmp 80100520 <cprintf+0x161> } c = fmt[++i] & 0xff; 80100422: 8b 55 08 mov 0x8(%ebp),%edx 80100425: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100429: 8b 45 f4 mov -0xc(%ebp),%eax 8010042c: 01 d0 add %edx,%eax 8010042e: 0f b6 00 movzbl (%eax),%eax 80100431: 0f be c0 movsbl %al,%eax 80100434: 25 ff 00 00 00 and $0xff,%eax 80100439: 89 45 e4 mov %eax,-0x1c(%ebp) if(c == 0) 8010043c: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80100440: 75 05 jne 80100447 <cprintf+0x88> break; 80100442: e9 fd 00 00 00 jmp 80100544 <cprintf+0x185> switch(c){ 80100447: 8b 45 e4 mov -0x1c(%ebp),%eax 8010044a: 83 f8 70 cmp $0x70,%eax 8010044d: 74 47 je 80100496 <cprintf+0xd7> 8010044f: 83 f8 70 cmp $0x70,%eax 80100452: 7f 13 jg 80100467 <cprintf+0xa8> 80100454: 83 f8 25 cmp $0x25,%eax 80100457: 0f 84 98 00 00 00 je 801004f5 <cprintf+0x136> 8010045d: 83 f8 64 cmp $0x64,%eax 80100460: 74 14 je 80100476 <cprintf+0xb7> 80100462: e9 9d 00 00 00 jmp 80100504 <cprintf+0x145> 80100467: 83 f8 73 cmp $0x73,%eax 8010046a: 74 47 je 801004b3 <cprintf+0xf4> 8010046c: 83 f8 78 cmp $0x78,%eax 8010046f: 74 25 je 80100496 <cprintf+0xd7> 80100471: e9 8e 00 00 00 jmp 80100504 <cprintf+0x145> case 'd': printint(*argp++, 10, 1); 80100476: 8b 45 f0 mov -0x10(%ebp),%eax 80100479: 8d 50 04 lea 0x4(%eax),%edx 8010047c: 89 55 f0 mov %edx,-0x10(%ebp) 8010047f: 8b 00 mov (%eax),%eax 80100481: 83 ec 04 sub $0x4,%esp 80100484: 6a 01 push $0x1 80100486: 6a 0a push $0xa 80100488: 50 push %eax 80100489: e8 83 fe ff ff call 80100311 <printint> 8010048e: 83 c4 10 add $0x10,%esp break; 80100491: e9 8a 00 00 00 jmp 80100520 <cprintf+0x161> case 'x': case 'p': printint(*argp++, 16, 0); 80100496: 8b 45 f0 mov -0x10(%ebp),%eax 80100499: 8d 50 04 lea 0x4(%eax),%edx 8010049c: 89 55 f0 mov %edx,-0x10(%ebp) 8010049f: 8b 00 mov (%eax),%eax 801004a1: 83 ec 04 sub $0x4,%esp 801004a4: 6a 00 push $0x0 801004a6: 6a 10 push $0x10 801004a8: 50 push %eax 801004a9: e8 63 fe ff ff call 80100311 <printint> 801004ae: 83 c4 10 add $0x10,%esp break; 801004b1: eb 6d jmp 80100520 <cprintf+0x161> case 's': if((s = (char*)*argp++) == 0) 801004b3: 8b 45 f0 mov -0x10(%ebp),%eax 801004b6: 8d 50 04 lea 0x4(%eax),%edx 801004b9: 89 55 f0 mov %edx,-0x10(%ebp) 801004bc: 8b 00 mov (%eax),%eax 801004be: 89 45 ec mov %eax,-0x14(%ebp) 801004c1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801004c5: 75 07 jne 801004ce <cprintf+0x10f> s = "(null)"; 801004c7: c7 45 ec f3 84 10 80 movl $0x801084f3,-0x14(%ebp) for(; *s; s++) 801004ce: eb 19 jmp 801004e9 <cprintf+0x12a> consputc(*s); 801004d0: 8b 45 ec mov -0x14(%ebp),%eax 801004d3: 0f b6 00 movzbl (%eax),%eax 801004d6: 0f be c0 movsbl %al,%eax 801004d9: 83 ec 0c sub $0xc,%esp 801004dc: 50 push %eax 801004dd: e8 89 02 00 00 call 8010076b <consputc> 801004e2: 83 c4 10 add $0x10,%esp printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) s = "(null)"; for(; *s; s++) 801004e5: 83 45 ec 01 addl $0x1,-0x14(%ebp) 801004e9: 8b 45 ec mov -0x14(%ebp),%eax 801004ec: 0f b6 00 movzbl (%eax),%eax 801004ef: 84 c0 test %al,%al 801004f1: 75 dd jne 801004d0 <cprintf+0x111> consputc(*s); break; 801004f3: eb 2b jmp 80100520 <cprintf+0x161> case '%': consputc('%'); 801004f5: 83 ec 0c sub $0xc,%esp 801004f8: 6a 25 push $0x25 801004fa: e8 6c 02 00 00 call 8010076b <consputc> 801004ff: 83 c4 10 add $0x10,%esp break; 80100502: eb 1c jmp 80100520 <cprintf+0x161> default: // Print unknown % sequence to draw attention. consputc('%'); 80100504: 83 ec 0c sub $0xc,%esp 80100507: 6a 25 push $0x25 80100509: e8 5d 02 00 00 call 8010076b <consputc> 8010050e: 83 c4 10 add $0x10,%esp consputc(c); 80100511: 83 ec 0c sub $0xc,%esp 80100514: ff 75 e4 pushl -0x1c(%ebp) 80100517: e8 4f 02 00 00 call 8010076b <consputc> 8010051c: 83 c4 10 add $0x10,%esp break; 8010051f: 90 nop if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 80100520: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100524: 8b 55 08 mov 0x8(%ebp),%edx 80100527: 8b 45 f4 mov -0xc(%ebp),%eax 8010052a: 01 d0 add %edx,%eax 8010052c: 0f b6 00 movzbl (%eax),%eax 8010052f: 0f be c0 movsbl %al,%eax 80100532: 25 ff 00 00 00 and $0xff,%eax 80100537: 89 45 e4 mov %eax,-0x1c(%ebp) 8010053a: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 8010053e: 0f 85 c5 fe ff ff jne 80100409 <cprintf+0x4a> consputc(c); break; } } if(locking) 80100544: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80100548: 74 10 je 8010055a <cprintf+0x19b> release(&cons.lock); 8010054a: 83 ec 0c sub $0xc,%esp 8010054d: 68 e0 b5 10 80 push $0x8010b5e0 80100552: e8 fd 49 00 00 call 80104f54 <release> 80100557: 83 c4 10 add $0x10,%esp } 8010055a: c9 leave 8010055b: c3 ret 8010055c <panic>: void panic(char *s) { 8010055c: 55 push %ebp 8010055d: 89 e5 mov %esp,%ebp 8010055f: 83 ec 38 sub $0x38,%esp int i; uint pcs[10]; cli(); 80100562: e8 a4 fd ff ff call 8010030b <cli> cons.locking = 0; 80100567: c7 05 14 b6 10 80 00 movl $0x0,0x8010b614 8010056e: 00 00 00 cprintf("cpu%d: panic: ", cpu->id); 80100571: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80100577: 0f b6 00 movzbl (%eax),%eax 8010057a: 0f b6 c0 movzbl %al,%eax 8010057d: 83 ec 08 sub $0x8,%esp 80100580: 50 push %eax 80100581: 68 fa 84 10 80 push $0x801084fa 80100586: e8 34 fe ff ff call 801003bf <cprintf> 8010058b: 83 c4 10 add $0x10,%esp cprintf(s); 8010058e: 8b 45 08 mov 0x8(%ebp),%eax 80100591: 83 ec 0c sub $0xc,%esp 80100594: 50 push %eax 80100595: e8 25 fe ff ff call 801003bf <cprintf> 8010059a: 83 c4 10 add $0x10,%esp cprintf("\n"); 8010059d: 83 ec 0c sub $0xc,%esp 801005a0: 68 09 85 10 80 push $0x80108509 801005a5: e8 15 fe ff ff call 801003bf <cprintf> 801005aa: 83 c4 10 add $0x10,%esp getcallerpcs(&s, pcs); 801005ad: 83 ec 08 sub $0x8,%esp 801005b0: 8d 45 cc lea -0x34(%ebp),%eax 801005b3: 50 push %eax 801005b4: 8d 45 08 lea 0x8(%ebp),%eax 801005b7: 50 push %eax 801005b8: e8 e8 49 00 00 call 80104fa5 <getcallerpcs> 801005bd: 83 c4 10 add $0x10,%esp for(i=0; i<10; i++) 801005c0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801005c7: eb 1c jmp 801005e5 <panic+0x89> cprintf(" %p", pcs[i]); 801005c9: 8b 45 f4 mov -0xc(%ebp),%eax 801005cc: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax 801005d0: 83 ec 08 sub $0x8,%esp 801005d3: 50 push %eax 801005d4: 68 0b 85 10 80 push $0x8010850b 801005d9: e8 e1 fd ff ff call 801003bf <cprintf> 801005de: 83 c4 10 add $0x10,%esp cons.locking = 0; cprintf("cpu%d: panic: ", cpu->id); cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); for(i=0; i<10; i++) 801005e1: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801005e5: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 801005e9: 7e de jle 801005c9 <panic+0x6d> cprintf(" %p", pcs[i]); panicked = 1; // freeze other CPU 801005eb: c7 05 c0 b5 10 80 01 movl $0x1,0x8010b5c0 801005f2: 00 00 00 for(;;) ; 801005f5: eb fe jmp 801005f5 <panic+0x99> 801005f7 <cgaputc>: #define CRTPORT 0x3d4 static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory static void cgaputc(int c) { 801005f7: 55 push %ebp 801005f8: 89 e5 mov %esp,%ebp 801005fa: 83 ec 18 sub $0x18,%esp int pos; // Cursor position: col + 80*row. outb(CRTPORT, 14); 801005fd: 6a 0e push $0xe 801005ff: 68 d4 03 00 00 push $0x3d4 80100604: e8 e4 fc ff ff call 801002ed <outb> 80100609: 83 c4 08 add $0x8,%esp pos = inb(CRTPORT+1) << 8; 8010060c: 68 d5 03 00 00 push $0x3d5 80100611: e8 ba fc ff ff call 801002d0 <inb> 80100616: 83 c4 04 add $0x4,%esp 80100619: 0f b6 c0 movzbl %al,%eax 8010061c: c1 e0 08 shl $0x8,%eax 8010061f: 89 45 f4 mov %eax,-0xc(%ebp) outb(CRTPORT, 15); 80100622: 6a 0f push $0xf 80100624: 68 d4 03 00 00 push $0x3d4 80100629: e8 bf fc ff ff call 801002ed <outb> 8010062e: 83 c4 08 add $0x8,%esp pos |= inb(CRTPORT+1); 80100631: 68 d5 03 00 00 push $0x3d5 80100636: e8 95 fc ff ff call 801002d0 <inb> 8010063b: 83 c4 04 add $0x4,%esp 8010063e: 0f b6 c0 movzbl %al,%eax 80100641: 09 45 f4 or %eax,-0xc(%ebp) if(c == '\n') 80100644: 83 7d 08 0a cmpl $0xa,0x8(%ebp) 80100648: 75 30 jne 8010067a <cgaputc+0x83> pos += 80 - pos%80; 8010064a: 8b 4d f4 mov -0xc(%ebp),%ecx 8010064d: ba 67 66 66 66 mov $0x66666667,%edx 80100652: 89 c8 mov %ecx,%eax 80100654: f7 ea imul %edx 80100656: c1 fa 05 sar $0x5,%edx 80100659: 89 c8 mov %ecx,%eax 8010065b: c1 f8 1f sar $0x1f,%eax 8010065e: 29 c2 sub %eax,%edx 80100660: 89 d0 mov %edx,%eax 80100662: c1 e0 02 shl $0x2,%eax 80100665: 01 d0 add %edx,%eax 80100667: c1 e0 04 shl $0x4,%eax 8010066a: 29 c1 sub %eax,%ecx 8010066c: 89 ca mov %ecx,%edx 8010066e: b8 50 00 00 00 mov $0x50,%eax 80100673: 29 d0 sub %edx,%eax 80100675: 01 45 f4 add %eax,-0xc(%ebp) 80100678: eb 34 jmp 801006ae <cgaputc+0xb7> else if(c == BACKSPACE){ 8010067a: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp) 80100681: 75 0c jne 8010068f <cgaputc+0x98> if(pos > 0) --pos; 80100683: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80100687: 7e 25 jle 801006ae <cgaputc+0xb7> 80100689: 83 6d f4 01 subl $0x1,-0xc(%ebp) 8010068d: eb 1f jmp 801006ae <cgaputc+0xb7> } else crt[pos++] = (c&0xff) | 0x0700; // black on white 8010068f: 8b 0d 00 90 10 80 mov 0x80109000,%ecx 80100695: 8b 45 f4 mov -0xc(%ebp),%eax 80100698: 8d 50 01 lea 0x1(%eax),%edx 8010069b: 89 55 f4 mov %edx,-0xc(%ebp) 8010069e: 01 c0 add %eax,%eax 801006a0: 01 c8 add %ecx,%eax 801006a2: 8b 55 08 mov 0x8(%ebp),%edx 801006a5: 0f b6 d2 movzbl %dl,%edx 801006a8: 80 ce 07 or $0x7,%dh 801006ab: 66 89 10 mov %dx,(%eax) if((pos/80) >= 24){ // Scroll up. 801006ae: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp) 801006b5: 7e 4c jle 80100703 <cgaputc+0x10c> memmove(crt, crt+80, sizeof(crt[0])*23*80); 801006b7: a1 00 90 10 80 mov 0x80109000,%eax 801006bc: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx 801006c2: a1 00 90 10 80 mov 0x80109000,%eax 801006c7: 83 ec 04 sub $0x4,%esp 801006ca: 68 60 0e 00 00 push $0xe60 801006cf: 52 push %edx 801006d0: 50 push %eax 801006d1: e8 33 4b 00 00 call 80105209 <memmove> 801006d6: 83 c4 10 add $0x10,%esp pos -= 80; 801006d9: 83 6d f4 50 subl $0x50,-0xc(%ebp) memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 801006dd: b8 80 07 00 00 mov $0x780,%eax 801006e2: 2b 45 f4 sub -0xc(%ebp),%eax 801006e5: 8d 14 00 lea (%eax,%eax,1),%edx 801006e8: a1 00 90 10 80 mov 0x80109000,%eax 801006ed: 8b 4d f4 mov -0xc(%ebp),%ecx 801006f0: 01 c9 add %ecx,%ecx 801006f2: 01 c8 add %ecx,%eax 801006f4: 83 ec 04 sub $0x4,%esp 801006f7: 52 push %edx 801006f8: 6a 00 push $0x0 801006fa: 50 push %eax 801006fb: e8 4a 4a 00 00 call 8010514a <memset> 80100700: 83 c4 10 add $0x10,%esp } outb(CRTPORT, 14); 80100703: 83 ec 08 sub $0x8,%esp 80100706: 6a 0e push $0xe 80100708: 68 d4 03 00 00 push $0x3d4 8010070d: e8 db fb ff ff call 801002ed <outb> 80100712: 83 c4 10 add $0x10,%esp outb(CRTPORT+1, pos>>8); 80100715: 8b 45 f4 mov -0xc(%ebp),%eax 80100718: c1 f8 08 sar $0x8,%eax 8010071b: 0f b6 c0 movzbl %al,%eax 8010071e: 83 ec 08 sub $0x8,%esp 80100721: 50 push %eax 80100722: 68 d5 03 00 00 push $0x3d5 80100727: e8 c1 fb ff ff call 801002ed <outb> 8010072c: 83 c4 10 add $0x10,%esp outb(CRTPORT, 15); 8010072f: 83 ec 08 sub $0x8,%esp 80100732: 6a 0f push $0xf 80100734: 68 d4 03 00 00 push $0x3d4 80100739: e8 af fb ff ff call 801002ed <outb> 8010073e: 83 c4 10 add $0x10,%esp outb(CRTPORT+1, pos); 80100741: 8b 45 f4 mov -0xc(%ebp),%eax 80100744: 0f b6 c0 movzbl %al,%eax 80100747: 83 ec 08 sub $0x8,%esp 8010074a: 50 push %eax 8010074b: 68 d5 03 00 00 push $0x3d5 80100750: e8 98 fb ff ff call 801002ed <outb> 80100755: 83 c4 10 add $0x10,%esp crt[pos] = ' ' | 0x0700; 80100758: a1 00 90 10 80 mov 0x80109000,%eax 8010075d: 8b 55 f4 mov -0xc(%ebp),%edx 80100760: 01 d2 add %edx,%edx 80100762: 01 d0 add %edx,%eax 80100764: 66 c7 00 20 07 movw $0x720,(%eax) } 80100769: c9 leave 8010076a: c3 ret 8010076b <consputc>: void consputc(int c) { 8010076b: 55 push %ebp 8010076c: 89 e5 mov %esp,%ebp 8010076e: 83 ec 08 sub $0x8,%esp if(panicked){ 80100771: a1 c0 b5 10 80 mov 0x8010b5c0,%eax 80100776: 85 c0 test %eax,%eax 80100778: 74 07 je 80100781 <consputc+0x16> cli(); 8010077a: e8 8c fb ff ff call 8010030b <cli> for(;;) ; 8010077f: eb fe jmp 8010077f <consputc+0x14> } if(c == BACKSPACE){ 80100781: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp) 80100788: 75 29 jne 801007b3 <consputc+0x48> uartputc('\b'); uartputc(' '); uartputc('\b'); 8010078a: 83 ec 0c sub $0xc,%esp 8010078d: 6a 08 push $0x8 8010078f: e8 c4 63 00 00 call 80106b58 <uartputc> 80100794: 83 c4 10 add $0x10,%esp 80100797: 83 ec 0c sub $0xc,%esp 8010079a: 6a 20 push $0x20 8010079c: e8 b7 63 00 00 call 80106b58 <uartputc> 801007a1: 83 c4 10 add $0x10,%esp 801007a4: 83 ec 0c sub $0xc,%esp 801007a7: 6a 08 push $0x8 801007a9: e8 aa 63 00 00 call 80106b58 <uartputc> 801007ae: 83 c4 10 add $0x10,%esp 801007b1: eb 0e jmp 801007c1 <consputc+0x56> } else uartputc(c); 801007b3: 83 ec 0c sub $0xc,%esp 801007b6: ff 75 08 pushl 0x8(%ebp) 801007b9: e8 9a 63 00 00 call 80106b58 <uartputc> 801007be: 83 c4 10 add $0x10,%esp cgaputc(c); 801007c1: 83 ec 0c sub $0xc,%esp 801007c4: ff 75 08 pushl 0x8(%ebp) 801007c7: e8 2b fe ff ff call 801005f7 <cgaputc> 801007cc: 83 c4 10 add $0x10,%esp } 801007cf: c9 leave 801007d0: c3 ret 801007d1 <consoleintr>: #define C(x) ((x)-'@') // Control-x void consoleintr(int (*getc)(void)) { 801007d1: 55 push %ebp 801007d2: 89 e5 mov %esp,%ebp 801007d4: 83 ec 18 sub $0x18,%esp int c; acquire(&input.lock); 801007d7: 83 ec 0c sub $0xc,%esp 801007da: 68 c0 07 11 80 push $0x801107c0 801007df: e8 0a 47 00 00 call 80104eee <acquire> 801007e4: 83 c4 10 add $0x10,%esp while((c = getc()) >= 0){ 801007e7: e9 3a 01 00 00 jmp 80100926 <consoleintr+0x155> switch(c){ 801007ec: 8b 45 f4 mov -0xc(%ebp),%eax 801007ef: 83 f8 10 cmp $0x10,%eax 801007f2: 74 1e je 80100812 <consoleintr+0x41> 801007f4: 83 f8 10 cmp $0x10,%eax 801007f7: 7f 0a jg 80100803 <consoleintr+0x32> 801007f9: 83 f8 08 cmp $0x8,%eax 801007fc: 74 65 je 80100863 <consoleintr+0x92> 801007fe: e9 91 00 00 00 jmp 80100894 <consoleintr+0xc3> 80100803: 83 f8 15 cmp $0x15,%eax 80100806: 74 31 je 80100839 <consoleintr+0x68> 80100808: 83 f8 7f cmp $0x7f,%eax 8010080b: 74 56 je 80100863 <consoleintr+0x92> 8010080d: e9 82 00 00 00 jmp 80100894 <consoleintr+0xc3> case C('P'): // Process listing. procdump(); 80100812: e8 87 45 00 00 call 80104d9e <procdump> break; 80100817: e9 0a 01 00 00 jmp 80100926 <consoleintr+0x155> case C('U'): // Kill line. while(input.e != input.w && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; 8010081c: a1 7c 08 11 80 mov 0x8011087c,%eax 80100821: 83 e8 01 sub $0x1,%eax 80100824: a3 7c 08 11 80 mov %eax,0x8011087c consputc(BACKSPACE); 80100829: 83 ec 0c sub $0xc,%esp 8010082c: 68 00 01 00 00 push $0x100 80100831: e8 35 ff ff ff call 8010076b <consputc> 80100836: 83 c4 10 add $0x10,%esp switch(c){ case C('P'): // Process listing. procdump(); break; case C('U'): // Kill line. while(input.e != input.w && 80100839: 8b 15 7c 08 11 80 mov 0x8011087c,%edx 8010083f: a1 78 08 11 80 mov 0x80110878,%eax 80100844: 39 c2 cmp %eax,%edx 80100846: 74 16 je 8010085e <consoleintr+0x8d> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ 80100848: a1 7c 08 11 80 mov 0x8011087c,%eax 8010084d: 83 e8 01 sub $0x1,%eax 80100850: 83 e0 7f and $0x7f,%eax 80100853: 0f b6 80 f4 07 11 80 movzbl -0x7feef80c(%eax),%eax switch(c){ case C('P'): // Process listing. procdump(); break; case C('U'): // Kill line. while(input.e != input.w && 8010085a: 3c 0a cmp $0xa,%al 8010085c: 75 be jne 8010081c <consoleintr+0x4b> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; consputc(BACKSPACE); } break; 8010085e: e9 c3 00 00 00 jmp 80100926 <consoleintr+0x155> case C('H'): case '\x7f': // Backspace if(input.e != input.w){ 80100863: 8b 15 7c 08 11 80 mov 0x8011087c,%edx 80100869: a1 78 08 11 80 mov 0x80110878,%eax 8010086e: 39 c2 cmp %eax,%edx 80100870: 74 1d je 8010088f <consoleintr+0xbe> input.e--; 80100872: a1 7c 08 11 80 mov 0x8011087c,%eax 80100877: 83 e8 01 sub $0x1,%eax 8010087a: a3 7c 08 11 80 mov %eax,0x8011087c consputc(BACKSPACE); 8010087f: 83 ec 0c sub $0xc,%esp 80100882: 68 00 01 00 00 push $0x100 80100887: e8 df fe ff ff call 8010076b <consputc> 8010088c: 83 c4 10 add $0x10,%esp } break; 8010088f: e9 92 00 00 00 jmp 80100926 <consoleintr+0x155> default: if(c != 0 && input.e-input.r < INPUT_BUF){ 80100894: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80100898: 0f 84 87 00 00 00 je 80100925 <consoleintr+0x154> 8010089e: 8b 15 7c 08 11 80 mov 0x8011087c,%edx 801008a4: a1 74 08 11 80 mov 0x80110874,%eax 801008a9: 29 c2 sub %eax,%edx 801008ab: 89 d0 mov %edx,%eax 801008ad: 83 f8 7f cmp $0x7f,%eax 801008b0: 77 73 ja 80100925 <consoleintr+0x154> c = (c == '\r') ? '\n' : c; 801008b2: 83 7d f4 0d cmpl $0xd,-0xc(%ebp) 801008b6: 74 05 je 801008bd <consoleintr+0xec> 801008b8: 8b 45 f4 mov -0xc(%ebp),%eax 801008bb: eb 05 jmp 801008c2 <consoleintr+0xf1> 801008bd: b8 0a 00 00 00 mov $0xa,%eax 801008c2: 89 45 f4 mov %eax,-0xc(%ebp) input.buf[input.e++ % INPUT_BUF] = c; 801008c5: a1 7c 08 11 80 mov 0x8011087c,%eax 801008ca: 8d 50 01 lea 0x1(%eax),%edx 801008cd: 89 15 7c 08 11 80 mov %edx,0x8011087c 801008d3: 83 e0 7f and $0x7f,%eax 801008d6: 8b 55 f4 mov -0xc(%ebp),%edx 801008d9: 88 90 f4 07 11 80 mov %dl,-0x7feef80c(%eax) consputc(c); 801008df: 83 ec 0c sub $0xc,%esp 801008e2: ff 75 f4 pushl -0xc(%ebp) 801008e5: e8 81 fe ff ff call 8010076b <consputc> 801008ea: 83 c4 10 add $0x10,%esp if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 801008ed: 83 7d f4 0a cmpl $0xa,-0xc(%ebp) 801008f1: 74 18 je 8010090b <consoleintr+0x13a> 801008f3: 83 7d f4 04 cmpl $0x4,-0xc(%ebp) 801008f7: 74 12 je 8010090b <consoleintr+0x13a> 801008f9: a1 7c 08 11 80 mov 0x8011087c,%eax 801008fe: 8b 15 74 08 11 80 mov 0x80110874,%edx 80100904: 83 ea 80 sub $0xffffff80,%edx 80100907: 39 d0 cmp %edx,%eax 80100909: 75 1a jne 80100925 <consoleintr+0x154> input.w = input.e; 8010090b: a1 7c 08 11 80 mov 0x8011087c,%eax 80100910: a3 78 08 11 80 mov %eax,0x80110878 wakeup(&input.r); 80100915: 83 ec 0c sub $0xc,%esp 80100918: 68 74 08 11 80 push $0x80110874 8010091d: e8 bf 43 00 00 call 80104ce1 <wakeup> 80100922: 83 c4 10 add $0x10,%esp } } break; 80100925: 90 nop consoleintr(int (*getc)(void)) { int c; acquire(&input.lock); while((c = getc()) >= 0){ 80100926: 8b 45 08 mov 0x8(%ebp),%eax 80100929: ff d0 call *%eax 8010092b: 89 45 f4 mov %eax,-0xc(%ebp) 8010092e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80100932: 0f 89 b4 fe ff ff jns 801007ec <consoleintr+0x1b> } } break; } } release(&input.lock); 80100938: 83 ec 0c sub $0xc,%esp 8010093b: 68 c0 07 11 80 push $0x801107c0 80100940: e8 0f 46 00 00 call 80104f54 <release> 80100945: 83 c4 10 add $0x10,%esp } 80100948: c9 leave 80100949: c3 ret 8010094a <consoleread>: int consoleread(struct inode *ip, char *dst, int n) { 8010094a: 55 push %ebp 8010094b: 89 e5 mov %esp,%ebp 8010094d: 83 ec 18 sub $0x18,%esp uint target; int c; iunlock(ip); 80100950: 83 ec 0c sub $0xc,%esp 80100953: ff 75 08 pushl 0x8(%ebp) 80100956: e8 d8 10 00 00 call 80101a33 <iunlock> 8010095b: 83 c4 10 add $0x10,%esp target = n; 8010095e: 8b 45 10 mov 0x10(%ebp),%eax 80100961: 89 45 f4 mov %eax,-0xc(%ebp) acquire(&input.lock); 80100964: 83 ec 0c sub $0xc,%esp 80100967: 68 c0 07 11 80 push $0x801107c0 8010096c: e8 7d 45 00 00 call 80104eee <acquire> 80100971: 83 c4 10 add $0x10,%esp while(n > 0){ 80100974: e9 b2 00 00 00 jmp 80100a2b <consoleread+0xe1> while(input.r == input.w){ 80100979: eb 4a jmp 801009c5 <consoleread+0x7b> if(proc->killed){ 8010097b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100981: 8b 40 24 mov 0x24(%eax),%eax 80100984: 85 c0 test %eax,%eax 80100986: 74 28 je 801009b0 <consoleread+0x66> release(&input.lock); 80100988: 83 ec 0c sub $0xc,%esp 8010098b: 68 c0 07 11 80 push $0x801107c0 80100990: e8 bf 45 00 00 call 80104f54 <release> 80100995: 83 c4 10 add $0x10,%esp ilock(ip); 80100998: 83 ec 0c sub $0xc,%esp 8010099b: ff 75 08 pushl 0x8(%ebp) 8010099e: e8 39 0f 00 00 call 801018dc <ilock> 801009a3: 83 c4 10 add $0x10,%esp return -1; 801009a6: b8 ff ff ff ff mov $0xffffffff,%eax 801009ab: e9 ad 00 00 00 jmp 80100a5d <consoleread+0x113> } sleep(&input.r, &input.lock); 801009b0: 83 ec 08 sub $0x8,%esp 801009b3: 68 c0 07 11 80 push $0x801107c0 801009b8: 68 74 08 11 80 push $0x80110874 801009bd: e8 33 42 00 00 call 80104bf5 <sleep> 801009c2: 83 c4 10 add $0x10,%esp iunlock(ip); target = n; acquire(&input.lock); while(n > 0){ while(input.r == input.w){ 801009c5: 8b 15 74 08 11 80 mov 0x80110874,%edx 801009cb: a1 78 08 11 80 mov 0x80110878,%eax 801009d0: 39 c2 cmp %eax,%edx 801009d2: 74 a7 je 8010097b <consoleread+0x31> ilock(ip); return -1; } sleep(&input.r, &input.lock); } c = input.buf[input.r++ % INPUT_BUF]; 801009d4: a1 74 08 11 80 mov 0x80110874,%eax 801009d9: 8d 50 01 lea 0x1(%eax),%edx 801009dc: 89 15 74 08 11 80 mov %edx,0x80110874 801009e2: 83 e0 7f and $0x7f,%eax 801009e5: 0f b6 80 f4 07 11 80 movzbl -0x7feef80c(%eax),%eax 801009ec: 0f be c0 movsbl %al,%eax 801009ef: 89 45 f0 mov %eax,-0x10(%ebp) if(c == C('D')){ // EOF 801009f2: 83 7d f0 04 cmpl $0x4,-0x10(%ebp) 801009f6: 75 19 jne 80100a11 <consoleread+0xc7> if(n < target){ 801009f8: 8b 45 10 mov 0x10(%ebp),%eax 801009fb: 3b 45 f4 cmp -0xc(%ebp),%eax 801009fe: 73 0f jae 80100a0f <consoleread+0xc5> // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; 80100a00: a1 74 08 11 80 mov 0x80110874,%eax 80100a05: 83 e8 01 sub $0x1,%eax 80100a08: a3 74 08 11 80 mov %eax,0x80110874 } break; 80100a0d: eb 26 jmp 80100a35 <consoleread+0xeb> 80100a0f: eb 24 jmp 80100a35 <consoleread+0xeb> } *dst++ = c; 80100a11: 8b 45 0c mov 0xc(%ebp),%eax 80100a14: 8d 50 01 lea 0x1(%eax),%edx 80100a17: 89 55 0c mov %edx,0xc(%ebp) 80100a1a: 8b 55 f0 mov -0x10(%ebp),%edx 80100a1d: 88 10 mov %dl,(%eax) --n; 80100a1f: 83 6d 10 01 subl $0x1,0x10(%ebp) if(c == '\n') 80100a23: 83 7d f0 0a cmpl $0xa,-0x10(%ebp) 80100a27: 75 02 jne 80100a2b <consoleread+0xe1> break; 80100a29: eb 0a jmp 80100a35 <consoleread+0xeb> int c; iunlock(ip); target = n; acquire(&input.lock); while(n > 0){ 80100a2b: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100a2f: 0f 8f 44 ff ff ff jg 80100979 <consoleread+0x2f> *dst++ = c; --n; if(c == '\n') break; } release(&input.lock); 80100a35: 83 ec 0c sub $0xc,%esp 80100a38: 68 c0 07 11 80 push $0x801107c0 80100a3d: e8 12 45 00 00 call 80104f54 <release> 80100a42: 83 c4 10 add $0x10,%esp ilock(ip); 80100a45: 83 ec 0c sub $0xc,%esp 80100a48: ff 75 08 pushl 0x8(%ebp) 80100a4b: e8 8c 0e 00 00 call 801018dc <ilock> 80100a50: 83 c4 10 add $0x10,%esp return target - n; 80100a53: 8b 45 10 mov 0x10(%ebp),%eax 80100a56: 8b 55 f4 mov -0xc(%ebp),%edx 80100a59: 29 c2 sub %eax,%edx 80100a5b: 89 d0 mov %edx,%eax } 80100a5d: c9 leave 80100a5e: c3 ret 80100a5f <consolewrite>: int consolewrite(struct inode *ip, char *buf, int n) { 80100a5f: 55 push %ebp 80100a60: 89 e5 mov %esp,%ebp 80100a62: 83 ec 18 sub $0x18,%esp int i; iunlock(ip); 80100a65: 83 ec 0c sub $0xc,%esp 80100a68: ff 75 08 pushl 0x8(%ebp) 80100a6b: e8 c3 0f 00 00 call 80101a33 <iunlock> 80100a70: 83 c4 10 add $0x10,%esp acquire(&cons.lock); 80100a73: 83 ec 0c sub $0xc,%esp 80100a76: 68 e0 b5 10 80 push $0x8010b5e0 80100a7b: e8 6e 44 00 00 call 80104eee <acquire> 80100a80: 83 c4 10 add $0x10,%esp for(i = 0; i < n; i++) 80100a83: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80100a8a: eb 21 jmp 80100aad <consolewrite+0x4e> consputc(buf[i] & 0xff); 80100a8c: 8b 55 f4 mov -0xc(%ebp),%edx 80100a8f: 8b 45 0c mov 0xc(%ebp),%eax 80100a92: 01 d0 add %edx,%eax 80100a94: 0f b6 00 movzbl (%eax),%eax 80100a97: 0f be c0 movsbl %al,%eax 80100a9a: 0f b6 c0 movzbl %al,%eax 80100a9d: 83 ec 0c sub $0xc,%esp 80100aa0: 50 push %eax 80100aa1: e8 c5 fc ff ff call 8010076b <consputc> 80100aa6: 83 c4 10 add $0x10,%esp { int i; iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++) 80100aa9: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100aad: 8b 45 f4 mov -0xc(%ebp),%eax 80100ab0: 3b 45 10 cmp 0x10(%ebp),%eax 80100ab3: 7c d7 jl 80100a8c <consolewrite+0x2d> consputc(buf[i] & 0xff); release(&cons.lock); 80100ab5: 83 ec 0c sub $0xc,%esp 80100ab8: 68 e0 b5 10 80 push $0x8010b5e0 80100abd: e8 92 44 00 00 call 80104f54 <release> 80100ac2: 83 c4 10 add $0x10,%esp ilock(ip); 80100ac5: 83 ec 0c sub $0xc,%esp 80100ac8: ff 75 08 pushl 0x8(%ebp) 80100acb: e8 0c 0e 00 00 call 801018dc <ilock> 80100ad0: 83 c4 10 add $0x10,%esp return n; 80100ad3: 8b 45 10 mov 0x10(%ebp),%eax } 80100ad6: c9 leave 80100ad7: c3 ret 80100ad8 <consoleinit>: void consoleinit(void) { 80100ad8: 55 push %ebp 80100ad9: 89 e5 mov %esp,%ebp 80100adb: 83 ec 08 sub $0x8,%esp initlock(&cons.lock, "console"); 80100ade: 83 ec 08 sub $0x8,%esp 80100ae1: 68 0f 85 10 80 push $0x8010850f 80100ae6: 68 e0 b5 10 80 push $0x8010b5e0 80100aeb: e8 dd 43 00 00 call 80104ecd <initlock> 80100af0: 83 c4 10 add $0x10,%esp initlock(&input.lock, "input"); 80100af3: 83 ec 08 sub $0x8,%esp 80100af6: 68 17 85 10 80 push $0x80108517 80100afb: 68 c0 07 11 80 push $0x801107c0 80100b00: e8 c8 43 00 00 call 80104ecd <initlock> 80100b05: 83 c4 10 add $0x10,%esp devsw[CONSOLE].write = consolewrite; 80100b08: c7 05 4c 12 11 80 5f movl $0x80100a5f,0x8011124c 80100b0f: 0a 10 80 devsw[CONSOLE].read = consoleread; 80100b12: c7 05 48 12 11 80 4a movl $0x8010094a,0x80111248 80100b19: 09 10 80 cons.locking = 1; 80100b1c: c7 05 14 b6 10 80 01 movl $0x1,0x8010b614 80100b23: 00 00 00 picenable(IRQ_KBD); 80100b26: 83 ec 0c sub $0xc,%esp 80100b29: 6a 01 push $0x1 80100b2b: e8 ef 32 00 00 call 80103e1f <picenable> 80100b30: 83 c4 10 add $0x10,%esp ioapicenable(IRQ_KBD, 0); 80100b33: 83 ec 08 sub $0x8,%esp 80100b36: 6a 00 push $0x0 80100b38: 6a 01 push $0x1 80100b3a: e8 bf 1e 00 00 call 801029fe <ioapicenable> 80100b3f: 83 c4 10 add $0x10,%esp } 80100b42: c9 leave 80100b43: c3 ret 80100b44 <exec>: #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { 80100b44: 55 push %ebp 80100b45: 89 e5 mov %esp,%ebp 80100b47: 81 ec 18 01 00 00 sub $0x118,%esp struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; begin_op(); 80100b4d: e8 14 29 00 00 call 80103466 <begin_op> if((ip = namei(path)) == 0){ 80100b52: 83 ec 0c sub $0xc,%esp 80100b55: ff 75 08 pushl 0x8(%ebp) 80100b58: e8 34 19 00 00 call 80102491 <namei> 80100b5d: 83 c4 10 add $0x10,%esp 80100b60: 89 45 d8 mov %eax,-0x28(%ebp) 80100b63: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80100b67: 75 0f jne 80100b78 <exec+0x34> end_op(); 80100b69: e8 86 29 00 00 call 801034f4 <end_op> return -1; 80100b6e: b8 ff ff ff ff mov $0xffffffff,%eax 80100b73: e9 b9 03 00 00 jmp 80100f31 <exec+0x3ed> } ilock(ip); 80100b78: 83 ec 0c sub $0xc,%esp 80100b7b: ff 75 d8 pushl -0x28(%ebp) 80100b7e: e8 59 0d 00 00 call 801018dc <ilock> 80100b83: 83 c4 10 add $0x10,%esp pgdir = 0; 80100b86: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) 80100b8d: 6a 34 push $0x34 80100b8f: 6a 00 push $0x0 80100b91: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax 80100b97: 50 push %eax 80100b98: ff 75 d8 pushl -0x28(%ebp) 80100b9b: e8 9e 12 00 00 call 80101e3e <readi> 80100ba0: 83 c4 10 add $0x10,%esp 80100ba3: 83 f8 33 cmp $0x33,%eax 80100ba6: 77 05 ja 80100bad <exec+0x69> goto bad; 80100ba8: e9 52 03 00 00 jmp 80100eff <exec+0x3bb> if(elf.magic != ELF_MAGIC) 80100bad: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80100bb3: 3d 7f 45 4c 46 cmp $0x464c457f,%eax 80100bb8: 74 05 je 80100bbf <exec+0x7b> goto bad; 80100bba: e9 40 03 00 00 jmp 80100eff <exec+0x3bb> if((pgdir = setupkvm()) == 0) 80100bbf: e8 e4 70 00 00 call 80107ca8 <setupkvm> 80100bc4: 89 45 d4 mov %eax,-0x2c(%ebp) 80100bc7: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 80100bcb: 75 05 jne 80100bd2 <exec+0x8e> goto bad; 80100bcd: e9 2d 03 00 00 jmp 80100eff <exec+0x3bb> // Load program into memory. sz = 0; 80100bd2: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100bd9: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 80100be0: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax 80100be6: 89 45 e8 mov %eax,-0x18(%ebp) 80100be9: e9 ae 00 00 00 jmp 80100c9c <exec+0x158> if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) 80100bee: 8b 45 e8 mov -0x18(%ebp),%eax 80100bf1: 6a 20 push $0x20 80100bf3: 50 push %eax 80100bf4: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax 80100bfa: 50 push %eax 80100bfb: ff 75 d8 pushl -0x28(%ebp) 80100bfe: e8 3b 12 00 00 call 80101e3e <readi> 80100c03: 83 c4 10 add $0x10,%esp 80100c06: 83 f8 20 cmp $0x20,%eax 80100c09: 74 05 je 80100c10 <exec+0xcc> goto bad; 80100c0b: e9 ef 02 00 00 jmp 80100eff <exec+0x3bb> if(ph.type != ELF_PROG_LOAD) 80100c10: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100c16: 83 f8 01 cmp $0x1,%eax 80100c19: 74 02 je 80100c1d <exec+0xd9> continue; 80100c1b: eb 72 jmp 80100c8f <exec+0x14b> if(ph.memsz < ph.filesz) 80100c1d: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx 80100c23: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax 80100c29: 39 c2 cmp %eax,%edx 80100c2b: 73 05 jae 80100c32 <exec+0xee> goto bad; 80100c2d: e9 cd 02 00 00 jmp 80100eff <exec+0x3bb> if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) 80100c32: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx 80100c38: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax 80100c3e: 01 d0 add %edx,%eax 80100c40: 83 ec 04 sub $0x4,%esp 80100c43: 50 push %eax 80100c44: ff 75 e0 pushl -0x20(%ebp) 80100c47: ff 75 d4 pushl -0x2c(%ebp) 80100c4a: e8 fc 73 00 00 call 8010804b <allocuvm> 80100c4f: 83 c4 10 add $0x10,%esp 80100c52: 89 45 e0 mov %eax,-0x20(%ebp) 80100c55: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80100c59: 75 05 jne 80100c60 <exec+0x11c> goto bad; 80100c5b: e9 9f 02 00 00 jmp 80100eff <exec+0x3bb> if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) 80100c60: 8b 95 fc fe ff ff mov -0x104(%ebp),%edx 80100c66: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax 80100c6c: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx 80100c72: 83 ec 0c sub $0xc,%esp 80100c75: 52 push %edx 80100c76: 50 push %eax 80100c77: ff 75 d8 pushl -0x28(%ebp) 80100c7a: 51 push %ecx 80100c7b: ff 75 d4 pushl -0x2c(%ebp) 80100c7e: e8 f1 72 00 00 call 80107f74 <loaduvm> 80100c83: 83 c4 20 add $0x20,%esp 80100c86: 85 c0 test %eax,%eax 80100c88: 79 05 jns 80100c8f <exec+0x14b> goto bad; 80100c8a: e9 70 02 00 00 jmp 80100eff <exec+0x3bb> if((pgdir = setupkvm()) == 0) goto bad; // Load program into memory. sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100c8f: 83 45 ec 01 addl $0x1,-0x14(%ebp) 80100c93: 8b 45 e8 mov -0x18(%ebp),%eax 80100c96: 83 c0 20 add $0x20,%eax 80100c99: 89 45 e8 mov %eax,-0x18(%ebp) 80100c9c: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax 80100ca3: 0f b7 c0 movzwl %ax,%eax 80100ca6: 3b 45 ec cmp -0x14(%ebp),%eax 80100ca9: 0f 8f 3f ff ff ff jg 80100bee <exec+0xaa> if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; } iunlockput(ip); 80100caf: 83 ec 0c sub $0xc,%esp 80100cb2: ff 75 d8 pushl -0x28(%ebp) 80100cb5: e8 d9 0e 00 00 call 80101b93 <iunlockput> 80100cba: 83 c4 10 add $0x10,%esp end_op(); 80100cbd: e8 32 28 00 00 call 801034f4 <end_op> ip = 0; 80100cc2: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp) // Allocate two pages at the next page boundary. // Make the first inaccessible. Use the second as the user stack. sz = PGROUNDUP(sz); 80100cc9: 8b 45 e0 mov -0x20(%ebp),%eax 80100ccc: 05 ff 0f 00 00 add $0xfff,%eax 80100cd1: 25 00 f0 ff ff and $0xfffff000,%eax 80100cd6: 89 45 e0 mov %eax,-0x20(%ebp) if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 80100cd9: 8b 45 e0 mov -0x20(%ebp),%eax 80100cdc: 05 00 20 00 00 add $0x2000,%eax 80100ce1: 83 ec 04 sub $0x4,%esp 80100ce4: 50 push %eax 80100ce5: ff 75 e0 pushl -0x20(%ebp) 80100ce8: ff 75 d4 pushl -0x2c(%ebp) 80100ceb: e8 5b 73 00 00 call 8010804b <allocuvm> 80100cf0: 83 c4 10 add $0x10,%esp 80100cf3: 89 45 e0 mov %eax,-0x20(%ebp) 80100cf6: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80100cfa: 75 05 jne 80100d01 <exec+0x1bd> goto bad; 80100cfc: e9 fe 01 00 00 jmp 80100eff <exec+0x3bb> clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100d01: 8b 45 e0 mov -0x20(%ebp),%eax 80100d04: 2d 00 20 00 00 sub $0x2000,%eax 80100d09: 83 ec 08 sub $0x8,%esp 80100d0c: 50 push %eax 80100d0d: ff 75 d4 pushl -0x2c(%ebp) 80100d10: e8 5b 75 00 00 call 80108270 <clearpteu> 80100d15: 83 c4 10 add $0x10,%esp sp = sz; 80100d18: 8b 45 e0 mov -0x20(%ebp),%eax 80100d1b: 89 45 dc mov %eax,-0x24(%ebp) // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100d1e: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80100d25: e9 98 00 00 00 jmp 80100dc2 <exec+0x27e> if(argc >= MAXARG) 80100d2a: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp) 80100d2e: 76 05 jbe 80100d35 <exec+0x1f1> goto bad; 80100d30: e9 ca 01 00 00 jmp 80100eff <exec+0x3bb> sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100d35: 8b 45 e4 mov -0x1c(%ebp),%eax 80100d38: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100d3f: 8b 45 0c mov 0xc(%ebp),%eax 80100d42: 01 d0 add %edx,%eax 80100d44: 8b 00 mov (%eax),%eax 80100d46: 83 ec 0c sub $0xc,%esp 80100d49: 50 push %eax 80100d4a: e8 4a 46 00 00 call 80105399 <strlen> 80100d4f: 83 c4 10 add $0x10,%esp 80100d52: 89 c2 mov %eax,%edx 80100d54: 8b 45 dc mov -0x24(%ebp),%eax 80100d57: 29 d0 sub %edx,%eax 80100d59: 83 e8 01 sub $0x1,%eax 80100d5c: 83 e0 fc and $0xfffffffc,%eax 80100d5f: 89 45 dc mov %eax,-0x24(%ebp) if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100d62: 8b 45 e4 mov -0x1c(%ebp),%eax 80100d65: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100d6c: 8b 45 0c mov 0xc(%ebp),%eax 80100d6f: 01 d0 add %edx,%eax 80100d71: 8b 00 mov (%eax),%eax 80100d73: 83 ec 0c sub $0xc,%esp 80100d76: 50 push %eax 80100d77: e8 1d 46 00 00 call 80105399 <strlen> 80100d7c: 83 c4 10 add $0x10,%esp 80100d7f: 83 c0 01 add $0x1,%eax 80100d82: 89 c1 mov %eax,%ecx 80100d84: 8b 45 e4 mov -0x1c(%ebp),%eax 80100d87: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100d8e: 8b 45 0c mov 0xc(%ebp),%eax 80100d91: 01 d0 add %edx,%eax 80100d93: 8b 00 mov (%eax),%eax 80100d95: 51 push %ecx 80100d96: 50 push %eax 80100d97: ff 75 dc pushl -0x24(%ebp) 80100d9a: ff 75 d4 pushl -0x2c(%ebp) 80100d9d: e8 84 76 00 00 call 80108426 <copyout> 80100da2: 83 c4 10 add $0x10,%esp 80100da5: 85 c0 test %eax,%eax 80100da7: 79 05 jns 80100dae <exec+0x26a> goto bad; 80100da9: e9 51 01 00 00 jmp 80100eff <exec+0x3bb> ustack[3+argc] = sp; 80100dae: 8b 45 e4 mov -0x1c(%ebp),%eax 80100db1: 8d 50 03 lea 0x3(%eax),%edx 80100db4: 8b 45 dc mov -0x24(%ebp),%eax 80100db7: 89 84 95 40 ff ff ff mov %eax,-0xc0(%ebp,%edx,4) goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100dbe: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 80100dc2: 8b 45 e4 mov -0x1c(%ebp),%eax 80100dc5: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100dcc: 8b 45 0c mov 0xc(%ebp),%eax 80100dcf: 01 d0 add %edx,%eax 80100dd1: 8b 00 mov (%eax),%eax 80100dd3: 85 c0 test %eax,%eax 80100dd5: 0f 85 4f ff ff ff jne 80100d2a <exec+0x1e6> sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; } ustack[3+argc] = 0; 80100ddb: 8b 45 e4 mov -0x1c(%ebp),%eax 80100dde: 83 c0 03 add $0x3,%eax 80100de1: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4) 80100de8: 00 00 00 00 ustack[0] = 0xffffffff; // fake return PC 80100dec: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp) 80100df3: ff ff ff ustack[1] = argc; 80100df6: 8b 45 e4 mov -0x1c(%ebp),%eax 80100df9: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp) ustack[2] = sp - (argc+1)*4; // argv pointer 80100dff: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e02: 83 c0 01 add $0x1,%eax 80100e05: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100e0c: 8b 45 dc mov -0x24(%ebp),%eax 80100e0f: 29 d0 sub %edx,%eax 80100e11: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp) sp -= (3+argc+1) * 4; 80100e17: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e1a: 83 c0 04 add $0x4,%eax 80100e1d: c1 e0 02 shl $0x2,%eax 80100e20: 29 45 dc sub %eax,-0x24(%ebp) if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100e23: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e26: 83 c0 04 add $0x4,%eax 80100e29: c1 e0 02 shl $0x2,%eax 80100e2c: 50 push %eax 80100e2d: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax 80100e33: 50 push %eax 80100e34: ff 75 dc pushl -0x24(%ebp) 80100e37: ff 75 d4 pushl -0x2c(%ebp) 80100e3a: e8 e7 75 00 00 call 80108426 <copyout> 80100e3f: 83 c4 10 add $0x10,%esp 80100e42: 85 c0 test %eax,%eax 80100e44: 79 05 jns 80100e4b <exec+0x307> goto bad; 80100e46: e9 b4 00 00 00 jmp 80100eff <exec+0x3bb> // Save program name for debugging. for(last=s=path; *s; s++) 80100e4b: 8b 45 08 mov 0x8(%ebp),%eax 80100e4e: 89 45 f4 mov %eax,-0xc(%ebp) 80100e51: 8b 45 f4 mov -0xc(%ebp),%eax 80100e54: 89 45 f0 mov %eax,-0x10(%ebp) 80100e57: eb 17 jmp 80100e70 <exec+0x32c> if(*s == '/') 80100e59: 8b 45 f4 mov -0xc(%ebp),%eax 80100e5c: 0f b6 00 movzbl (%eax),%eax 80100e5f: 3c 2f cmp $0x2f,%al 80100e61: 75 09 jne 80100e6c <exec+0x328> last = s+1; 80100e63: 8b 45 f4 mov -0xc(%ebp),%eax 80100e66: 83 c0 01 add $0x1,%eax 80100e69: 89 45 f0 mov %eax,-0x10(%ebp) sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 80100e6c: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100e70: 8b 45 f4 mov -0xc(%ebp),%eax 80100e73: 0f b6 00 movzbl (%eax),%eax 80100e76: 84 c0 test %al,%al 80100e78: 75 df jne 80100e59 <exec+0x315> if(*s == '/') last = s+1; safestrcpy(proc->name, last, sizeof(proc->name)); 80100e7a: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100e80: 83 c0 6c add $0x6c,%eax 80100e83: 83 ec 04 sub $0x4,%esp 80100e86: 6a 10 push $0x10 80100e88: ff 75 f0 pushl -0x10(%ebp) 80100e8b: 50 push %eax 80100e8c: e8 be 44 00 00 call 8010534f <safestrcpy> 80100e91: 83 c4 10 add $0x10,%esp // Commit to the user image. oldpgdir = proc->pgdir; 80100e94: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100e9a: 8b 40 04 mov 0x4(%eax),%eax 80100e9d: 89 45 d0 mov %eax,-0x30(%ebp) proc->pgdir = pgdir; 80100ea0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ea6: 8b 55 d4 mov -0x2c(%ebp),%edx 80100ea9: 89 50 04 mov %edx,0x4(%eax) proc->sz = sz; 80100eac: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100eb2: 8b 55 e0 mov -0x20(%ebp),%edx 80100eb5: 89 10 mov %edx,(%eax) proc->tf->eip = elf.entry; // main 80100eb7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ebd: 8b 40 18 mov 0x18(%eax),%eax 80100ec0: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx 80100ec6: 89 50 38 mov %edx,0x38(%eax) proc->tf->esp = sp; 80100ec9: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ecf: 8b 40 18 mov 0x18(%eax),%eax 80100ed2: 8b 55 dc mov -0x24(%ebp),%edx 80100ed5: 89 50 44 mov %edx,0x44(%eax) switchuvm(proc); 80100ed8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ede: 83 ec 0c sub $0xc,%esp 80100ee1: 50 push %eax 80100ee2: e8 a6 6e 00 00 call 80107d8d <switchuvm> 80100ee7: 83 c4 10 add $0x10,%esp freevm(oldpgdir); 80100eea: 83 ec 0c sub $0xc,%esp 80100eed: ff 75 d0 pushl -0x30(%ebp) 80100ef0: e8 dc 72 00 00 call 801081d1 <freevm> 80100ef5: 83 c4 10 add $0x10,%esp return 0; 80100ef8: b8 00 00 00 00 mov $0x0,%eax 80100efd: eb 32 jmp 80100f31 <exec+0x3ed> bad: if(pgdir) 80100eff: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 80100f03: 74 0e je 80100f13 <exec+0x3cf> freevm(pgdir); 80100f05: 83 ec 0c sub $0xc,%esp 80100f08: ff 75 d4 pushl -0x2c(%ebp) 80100f0b: e8 c1 72 00 00 call 801081d1 <freevm> 80100f10: 83 c4 10 add $0x10,%esp if(ip){ 80100f13: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80100f17: 74 13 je 80100f2c <exec+0x3e8> iunlockput(ip); 80100f19: 83 ec 0c sub $0xc,%esp 80100f1c: ff 75 d8 pushl -0x28(%ebp) 80100f1f: e8 6f 0c 00 00 call 80101b93 <iunlockput> 80100f24: 83 c4 10 add $0x10,%esp end_op(); 80100f27: e8 c8 25 00 00 call 801034f4 <end_op> } return -1; 80100f2c: b8 ff ff ff ff mov $0xffffffff,%eax } 80100f31: c9 leave 80100f32: c3 ret 80100f33 <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 80100f33: 55 push %ebp 80100f34: 89 e5 mov %esp,%ebp 80100f36: 83 ec 08 sub $0x8,%esp initlock(&ftable.lock, "ftable"); 80100f39: 83 ec 08 sub $0x8,%esp 80100f3c: 68 1d 85 10 80 push $0x8010851d 80100f41: 68 80 08 11 80 push $0x80110880 80100f46: e8 82 3f 00 00 call 80104ecd <initlock> 80100f4b: 83 c4 10 add $0x10,%esp } 80100f4e: c9 leave 80100f4f: c3 ret 80100f50 <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 80100f50: 55 push %ebp 80100f51: 89 e5 mov %esp,%ebp 80100f53: 83 ec 18 sub $0x18,%esp struct file *f; acquire(&ftable.lock); 80100f56: 83 ec 0c sub $0xc,%esp 80100f59: 68 80 08 11 80 push $0x80110880 80100f5e: e8 8b 3f 00 00 call 80104eee <acquire> 80100f63: 83 c4 10 add $0x10,%esp for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100f66: c7 45 f4 b4 08 11 80 movl $0x801108b4,-0xc(%ebp) 80100f6d: eb 2d jmp 80100f9c <filealloc+0x4c> if(f->ref == 0){ 80100f6f: 8b 45 f4 mov -0xc(%ebp),%eax 80100f72: 8b 40 04 mov 0x4(%eax),%eax 80100f75: 85 c0 test %eax,%eax 80100f77: 75 1f jne 80100f98 <filealloc+0x48> f->ref = 1; 80100f79: 8b 45 f4 mov -0xc(%ebp),%eax 80100f7c: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax) release(&ftable.lock); 80100f83: 83 ec 0c sub $0xc,%esp 80100f86: 68 80 08 11 80 push $0x80110880 80100f8b: e8 c4 3f 00 00 call 80104f54 <release> 80100f90: 83 c4 10 add $0x10,%esp return f; 80100f93: 8b 45 f4 mov -0xc(%ebp),%eax 80100f96: eb 22 jmp 80100fba <filealloc+0x6a> filealloc(void) { struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100f98: 83 45 f4 18 addl $0x18,-0xc(%ebp) 80100f9c: 81 7d f4 14 12 11 80 cmpl $0x80111214,-0xc(%ebp) 80100fa3: 72 ca jb 80100f6f <filealloc+0x1f> f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 80100fa5: 83 ec 0c sub $0xc,%esp 80100fa8: 68 80 08 11 80 push $0x80110880 80100fad: e8 a2 3f 00 00 call 80104f54 <release> 80100fb2: 83 c4 10 add $0x10,%esp return 0; 80100fb5: b8 00 00 00 00 mov $0x0,%eax } 80100fba: c9 leave 80100fbb: c3 ret 80100fbc <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 80100fbc: 55 push %ebp 80100fbd: 89 e5 mov %esp,%ebp 80100fbf: 83 ec 08 sub $0x8,%esp acquire(&ftable.lock); 80100fc2: 83 ec 0c sub $0xc,%esp 80100fc5: 68 80 08 11 80 push $0x80110880 80100fca: e8 1f 3f 00 00 call 80104eee <acquire> 80100fcf: 83 c4 10 add $0x10,%esp if(f->ref < 1) 80100fd2: 8b 45 08 mov 0x8(%ebp),%eax 80100fd5: 8b 40 04 mov 0x4(%eax),%eax 80100fd8: 85 c0 test %eax,%eax 80100fda: 7f 0d jg 80100fe9 <filedup+0x2d> panic("filedup"); 80100fdc: 83 ec 0c sub $0xc,%esp 80100fdf: 68 24 85 10 80 push $0x80108524 80100fe4: e8 73 f5 ff ff call 8010055c <panic> f->ref++; 80100fe9: 8b 45 08 mov 0x8(%ebp),%eax 80100fec: 8b 40 04 mov 0x4(%eax),%eax 80100fef: 8d 50 01 lea 0x1(%eax),%edx 80100ff2: 8b 45 08 mov 0x8(%ebp),%eax 80100ff5: 89 50 04 mov %edx,0x4(%eax) release(&ftable.lock); 80100ff8: 83 ec 0c sub $0xc,%esp 80100ffb: 68 80 08 11 80 push $0x80110880 80101000: e8 4f 3f 00 00 call 80104f54 <release> 80101005: 83 c4 10 add $0x10,%esp return f; 80101008: 8b 45 08 mov 0x8(%ebp),%eax } 8010100b: c9 leave 8010100c: c3 ret 8010100d <fileclose>: // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 8010100d: 55 push %ebp 8010100e: 89 e5 mov %esp,%ebp 80101010: 83 ec 28 sub $0x28,%esp struct file ff; acquire(&ftable.lock); 80101013: 83 ec 0c sub $0xc,%esp 80101016: 68 80 08 11 80 push $0x80110880 8010101b: e8 ce 3e 00 00 call 80104eee <acquire> 80101020: 83 c4 10 add $0x10,%esp if(f->ref < 1) 80101023: 8b 45 08 mov 0x8(%ebp),%eax 80101026: 8b 40 04 mov 0x4(%eax),%eax 80101029: 85 c0 test %eax,%eax 8010102b: 7f 0d jg 8010103a <fileclose+0x2d> panic("fileclose"); 8010102d: 83 ec 0c sub $0xc,%esp 80101030: 68 2c 85 10 80 push $0x8010852c 80101035: e8 22 f5 ff ff call 8010055c <panic> if(--f->ref > 0){ 8010103a: 8b 45 08 mov 0x8(%ebp),%eax 8010103d: 8b 40 04 mov 0x4(%eax),%eax 80101040: 8d 50 ff lea -0x1(%eax),%edx 80101043: 8b 45 08 mov 0x8(%ebp),%eax 80101046: 89 50 04 mov %edx,0x4(%eax) 80101049: 8b 45 08 mov 0x8(%ebp),%eax 8010104c: 8b 40 04 mov 0x4(%eax),%eax 8010104f: 85 c0 test %eax,%eax 80101051: 7e 15 jle 80101068 <fileclose+0x5b> release(&ftable.lock); 80101053: 83 ec 0c sub $0xc,%esp 80101056: 68 80 08 11 80 push $0x80110880 8010105b: e8 f4 3e 00 00 call 80104f54 <release> 80101060: 83 c4 10 add $0x10,%esp 80101063: e9 8b 00 00 00 jmp 801010f3 <fileclose+0xe6> return; } ff = *f; 80101068: 8b 45 08 mov 0x8(%ebp),%eax 8010106b: 8b 10 mov (%eax),%edx 8010106d: 89 55 e0 mov %edx,-0x20(%ebp) 80101070: 8b 50 04 mov 0x4(%eax),%edx 80101073: 89 55 e4 mov %edx,-0x1c(%ebp) 80101076: 8b 50 08 mov 0x8(%eax),%edx 80101079: 89 55 e8 mov %edx,-0x18(%ebp) 8010107c: 8b 50 0c mov 0xc(%eax),%edx 8010107f: 89 55 ec mov %edx,-0x14(%ebp) 80101082: 8b 50 10 mov 0x10(%eax),%edx 80101085: 89 55 f0 mov %edx,-0x10(%ebp) 80101088: 8b 40 14 mov 0x14(%eax),%eax 8010108b: 89 45 f4 mov %eax,-0xc(%ebp) f->ref = 0; 8010108e: 8b 45 08 mov 0x8(%ebp),%eax 80101091: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) f->type = FD_NONE; 80101098: 8b 45 08 mov 0x8(%ebp),%eax 8010109b: c7 00 00 00 00 00 movl $0x0,(%eax) release(&ftable.lock); 801010a1: 83 ec 0c sub $0xc,%esp 801010a4: 68 80 08 11 80 push $0x80110880 801010a9: e8 a6 3e 00 00 call 80104f54 <release> 801010ae: 83 c4 10 add $0x10,%esp if(ff.type == FD_PIPE) 801010b1: 8b 45 e0 mov -0x20(%ebp),%eax 801010b4: 83 f8 01 cmp $0x1,%eax 801010b7: 75 19 jne 801010d2 <fileclose+0xc5> pipeclose(ff.pipe, ff.writable); 801010b9: 0f b6 45 e9 movzbl -0x17(%ebp),%eax 801010bd: 0f be d0 movsbl %al,%edx 801010c0: 8b 45 ec mov -0x14(%ebp),%eax 801010c3: 83 ec 08 sub $0x8,%esp 801010c6: 52 push %edx 801010c7: 50 push %eax 801010c8: e8 b9 2f 00 00 call 80104086 <pipeclose> 801010cd: 83 c4 10 add $0x10,%esp 801010d0: eb 21 jmp 801010f3 <fileclose+0xe6> else if(ff.type == FD_INODE){ 801010d2: 8b 45 e0 mov -0x20(%ebp),%eax 801010d5: 83 f8 02 cmp $0x2,%eax 801010d8: 75 19 jne 801010f3 <fileclose+0xe6> begin_op(); 801010da: e8 87 23 00 00 call 80103466 <begin_op> iput(ff.ip); 801010df: 8b 45 f0 mov -0x10(%ebp),%eax 801010e2: 83 ec 0c sub $0xc,%esp 801010e5: 50 push %eax 801010e6: e8 b9 09 00 00 call 80101aa4 <iput> 801010eb: 83 c4 10 add $0x10,%esp end_op(); 801010ee: e8 01 24 00 00 call 801034f4 <end_op> } } 801010f3: c9 leave 801010f4: c3 ret 801010f5 <filestat>: // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 801010f5: 55 push %ebp 801010f6: 89 e5 mov %esp,%ebp 801010f8: 83 ec 08 sub $0x8,%esp if(f->type == FD_INODE){ 801010fb: 8b 45 08 mov 0x8(%ebp),%eax 801010fe: 8b 00 mov (%eax),%eax 80101100: 83 f8 02 cmp $0x2,%eax 80101103: 75 40 jne 80101145 <filestat+0x50> ilock(f->ip); 80101105: 8b 45 08 mov 0x8(%ebp),%eax 80101108: 8b 40 10 mov 0x10(%eax),%eax 8010110b: 83 ec 0c sub $0xc,%esp 8010110e: 50 push %eax 8010110f: e8 c8 07 00 00 call 801018dc <ilock> 80101114: 83 c4 10 add $0x10,%esp stati(f->ip, st); 80101117: 8b 45 08 mov 0x8(%ebp),%eax 8010111a: 8b 40 10 mov 0x10(%eax),%eax 8010111d: 83 ec 08 sub $0x8,%esp 80101120: ff 75 0c pushl 0xc(%ebp) 80101123: 50 push %eax 80101124: e8 d0 0c 00 00 call 80101df9 <stati> 80101129: 83 c4 10 add $0x10,%esp iunlock(f->ip); 8010112c: 8b 45 08 mov 0x8(%ebp),%eax 8010112f: 8b 40 10 mov 0x10(%eax),%eax 80101132: 83 ec 0c sub $0xc,%esp 80101135: 50 push %eax 80101136: e8 f8 08 00 00 call 80101a33 <iunlock> 8010113b: 83 c4 10 add $0x10,%esp return 0; 8010113e: b8 00 00 00 00 mov $0x0,%eax 80101143: eb 05 jmp 8010114a <filestat+0x55> } return -1; 80101145: b8 ff ff ff ff mov $0xffffffff,%eax } 8010114a: c9 leave 8010114b: c3 ret 8010114c <fileread>: // Read from file f. int fileread(struct file *f, char *addr, int n) { 8010114c: 55 push %ebp 8010114d: 89 e5 mov %esp,%ebp 8010114f: 83 ec 18 sub $0x18,%esp int r; if(f->readable == 0) 80101152: 8b 45 08 mov 0x8(%ebp),%eax 80101155: 0f b6 40 08 movzbl 0x8(%eax),%eax 80101159: 84 c0 test %al,%al 8010115b: 75 0a jne 80101167 <fileread+0x1b> return -1; 8010115d: b8 ff ff ff ff mov $0xffffffff,%eax 80101162: e9 9b 00 00 00 jmp 80101202 <fileread+0xb6> if(f->type == FD_PIPE) 80101167: 8b 45 08 mov 0x8(%ebp),%eax 8010116a: 8b 00 mov (%eax),%eax 8010116c: 83 f8 01 cmp $0x1,%eax 8010116f: 75 1a jne 8010118b <fileread+0x3f> return piperead(f->pipe, addr, n); 80101171: 8b 45 08 mov 0x8(%ebp),%eax 80101174: 8b 40 0c mov 0xc(%eax),%eax 80101177: 83 ec 04 sub $0x4,%esp 8010117a: ff 75 10 pushl 0x10(%ebp) 8010117d: ff 75 0c pushl 0xc(%ebp) 80101180: 50 push %eax 80101181: e8 ad 30 00 00 call 80104233 <piperead> 80101186: 83 c4 10 add $0x10,%esp 80101189: eb 77 jmp 80101202 <fileread+0xb6> if(f->type == FD_INODE){ 8010118b: 8b 45 08 mov 0x8(%ebp),%eax 8010118e: 8b 00 mov (%eax),%eax 80101190: 83 f8 02 cmp $0x2,%eax 80101193: 75 60 jne 801011f5 <fileread+0xa9> ilock(f->ip); 80101195: 8b 45 08 mov 0x8(%ebp),%eax 80101198: 8b 40 10 mov 0x10(%eax),%eax 8010119b: 83 ec 0c sub $0xc,%esp 8010119e: 50 push %eax 8010119f: e8 38 07 00 00 call 801018dc <ilock> 801011a4: 83 c4 10 add $0x10,%esp if((r = readi(f->ip, addr, f->off, n)) > 0) 801011a7: 8b 4d 10 mov 0x10(%ebp),%ecx 801011aa: 8b 45 08 mov 0x8(%ebp),%eax 801011ad: 8b 50 14 mov 0x14(%eax),%edx 801011b0: 8b 45 08 mov 0x8(%ebp),%eax 801011b3: 8b 40 10 mov 0x10(%eax),%eax 801011b6: 51 push %ecx 801011b7: 52 push %edx 801011b8: ff 75 0c pushl 0xc(%ebp) 801011bb: 50 push %eax 801011bc: e8 7d 0c 00 00 call 80101e3e <readi> 801011c1: 83 c4 10 add $0x10,%esp 801011c4: 89 45 f4 mov %eax,-0xc(%ebp) 801011c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801011cb: 7e 11 jle 801011de <fileread+0x92> f->off += r; 801011cd: 8b 45 08 mov 0x8(%ebp),%eax 801011d0: 8b 50 14 mov 0x14(%eax),%edx 801011d3: 8b 45 f4 mov -0xc(%ebp),%eax 801011d6: 01 c2 add %eax,%edx 801011d8: 8b 45 08 mov 0x8(%ebp),%eax 801011db: 89 50 14 mov %edx,0x14(%eax) iunlock(f->ip); 801011de: 8b 45 08 mov 0x8(%ebp),%eax 801011e1: 8b 40 10 mov 0x10(%eax),%eax 801011e4: 83 ec 0c sub $0xc,%esp 801011e7: 50 push %eax 801011e8: e8 46 08 00 00 call 80101a33 <iunlock> 801011ed: 83 c4 10 add $0x10,%esp return r; 801011f0: 8b 45 f4 mov -0xc(%ebp),%eax 801011f3: eb 0d jmp 80101202 <fileread+0xb6> } panic("fileread"); 801011f5: 83 ec 0c sub $0xc,%esp 801011f8: 68 36 85 10 80 push $0x80108536 801011fd: e8 5a f3 ff ff call 8010055c <panic> } 80101202: c9 leave 80101203: c3 ret 80101204 <filewrite>: //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80101204: 55 push %ebp 80101205: 89 e5 mov %esp,%ebp 80101207: 53 push %ebx 80101208: 83 ec 14 sub $0x14,%esp int r; if(f->writable == 0) 8010120b: 8b 45 08 mov 0x8(%ebp),%eax 8010120e: 0f b6 40 09 movzbl 0x9(%eax),%eax 80101212: 84 c0 test %al,%al 80101214: 75 0a jne 80101220 <filewrite+0x1c> return -1; 80101216: b8 ff ff ff ff mov $0xffffffff,%eax 8010121b: e9 1a 01 00 00 jmp 8010133a <filewrite+0x136> if(f->type == FD_PIPE) 80101220: 8b 45 08 mov 0x8(%ebp),%eax 80101223: 8b 00 mov (%eax),%eax 80101225: 83 f8 01 cmp $0x1,%eax 80101228: 75 1d jne 80101247 <filewrite+0x43> return pipewrite(f->pipe, addr, n); 8010122a: 8b 45 08 mov 0x8(%ebp),%eax 8010122d: 8b 40 0c mov 0xc(%eax),%eax 80101230: 83 ec 04 sub $0x4,%esp 80101233: ff 75 10 pushl 0x10(%ebp) 80101236: ff 75 0c pushl 0xc(%ebp) 80101239: 50 push %eax 8010123a: e8 f0 2e 00 00 call 8010412f <pipewrite> 8010123f: 83 c4 10 add $0x10,%esp 80101242: e9 f3 00 00 00 jmp 8010133a <filewrite+0x136> if(f->type == FD_INODE){ 80101247: 8b 45 08 mov 0x8(%ebp),%eax 8010124a: 8b 00 mov (%eax),%eax 8010124c: 83 f8 02 cmp $0x2,%eax 8010124f: 0f 85 d8 00 00 00 jne 8010132d <filewrite+0x129> // the maximum log transaction size, including // i-node, indirect block, allocation blocks, // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((LOGSIZE-1-1-2) / 2) * 512; 80101255: c7 45 ec 00 1a 00 00 movl $0x1a00,-0x14(%ebp) int i = 0; 8010125c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while(i < n){ 80101263: e9 a5 00 00 00 jmp 8010130d <filewrite+0x109> int n1 = n - i; 80101268: 8b 45 10 mov 0x10(%ebp),%eax 8010126b: 2b 45 f4 sub -0xc(%ebp),%eax 8010126e: 89 45 f0 mov %eax,-0x10(%ebp) if(n1 > max) 80101271: 8b 45 f0 mov -0x10(%ebp),%eax 80101274: 3b 45 ec cmp -0x14(%ebp),%eax 80101277: 7e 06 jle 8010127f <filewrite+0x7b> n1 = max; 80101279: 8b 45 ec mov -0x14(%ebp),%eax 8010127c: 89 45 f0 mov %eax,-0x10(%ebp) begin_op(); 8010127f: e8 e2 21 00 00 call 80103466 <begin_op> ilock(f->ip); 80101284: 8b 45 08 mov 0x8(%ebp),%eax 80101287: 8b 40 10 mov 0x10(%eax),%eax 8010128a: 83 ec 0c sub $0xc,%esp 8010128d: 50 push %eax 8010128e: e8 49 06 00 00 call 801018dc <ilock> 80101293: 83 c4 10 add $0x10,%esp if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) 80101296: 8b 4d f0 mov -0x10(%ebp),%ecx 80101299: 8b 45 08 mov 0x8(%ebp),%eax 8010129c: 8b 50 14 mov 0x14(%eax),%edx 8010129f: 8b 5d f4 mov -0xc(%ebp),%ebx 801012a2: 8b 45 0c mov 0xc(%ebp),%eax 801012a5: 01 c3 add %eax,%ebx 801012a7: 8b 45 08 mov 0x8(%ebp),%eax 801012aa: 8b 40 10 mov 0x10(%eax),%eax 801012ad: 51 push %ecx 801012ae: 52 push %edx 801012af: 53 push %ebx 801012b0: 50 push %eax 801012b1: e8 e2 0c 00 00 call 80101f98 <writei> 801012b6: 83 c4 10 add $0x10,%esp 801012b9: 89 45 e8 mov %eax,-0x18(%ebp) 801012bc: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 801012c0: 7e 11 jle 801012d3 <filewrite+0xcf> f->off += r; 801012c2: 8b 45 08 mov 0x8(%ebp),%eax 801012c5: 8b 50 14 mov 0x14(%eax),%edx 801012c8: 8b 45 e8 mov -0x18(%ebp),%eax 801012cb: 01 c2 add %eax,%edx 801012cd: 8b 45 08 mov 0x8(%ebp),%eax 801012d0: 89 50 14 mov %edx,0x14(%eax) iunlock(f->ip); 801012d3: 8b 45 08 mov 0x8(%ebp),%eax 801012d6: 8b 40 10 mov 0x10(%eax),%eax 801012d9: 83 ec 0c sub $0xc,%esp 801012dc: 50 push %eax 801012dd: e8 51 07 00 00 call 80101a33 <iunlock> 801012e2: 83 c4 10 add $0x10,%esp end_op(); 801012e5: e8 0a 22 00 00 call 801034f4 <end_op> if(r < 0) 801012ea: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 801012ee: 79 02 jns 801012f2 <filewrite+0xee> break; 801012f0: eb 27 jmp 80101319 <filewrite+0x115> if(r != n1) 801012f2: 8b 45 e8 mov -0x18(%ebp),%eax 801012f5: 3b 45 f0 cmp -0x10(%ebp),%eax 801012f8: 74 0d je 80101307 <filewrite+0x103> panic("short filewrite"); 801012fa: 83 ec 0c sub $0xc,%esp 801012fd: 68 3f 85 10 80 push $0x8010853f 80101302: e8 55 f2 ff ff call 8010055c <panic> i += r; 80101307: 8b 45 e8 mov -0x18(%ebp),%eax 8010130a: 01 45 f4 add %eax,-0xc(%ebp) // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((LOGSIZE-1-1-2) / 2) * 512; int i = 0; while(i < n){ 8010130d: 8b 45 f4 mov -0xc(%ebp),%eax 80101310: 3b 45 10 cmp 0x10(%ebp),%eax 80101313: 0f 8c 4f ff ff ff jl 80101268 <filewrite+0x64> break; if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 80101319: 8b 45 f4 mov -0xc(%ebp),%eax 8010131c: 3b 45 10 cmp 0x10(%ebp),%eax 8010131f: 75 05 jne 80101326 <filewrite+0x122> 80101321: 8b 45 10 mov 0x10(%ebp),%eax 80101324: eb 14 jmp 8010133a <filewrite+0x136> 80101326: b8 ff ff ff ff mov $0xffffffff,%eax 8010132b: eb 0d jmp 8010133a <filewrite+0x136> } panic("filewrite"); 8010132d: 83 ec 0c sub $0xc,%esp 80101330: 68 4f 85 10 80 push $0x8010854f 80101335: e8 22 f2 ff ff call 8010055c <panic> } 8010133a: 8b 5d fc mov -0x4(%ebp),%ebx 8010133d: c9 leave 8010133e: c3 ret 8010133f <readsb>: static void itrunc(struct inode*); // Read the super block. void readsb(int dev, struct superblock *sb) { 8010133f: 55 push %ebp 80101340: 89 e5 mov %esp,%ebp 80101342: 83 ec 18 sub $0x18,%esp struct buf *bp; bp = bread(dev, 1); 80101345: 8b 45 08 mov 0x8(%ebp),%eax 80101348: 83 ec 08 sub $0x8,%esp 8010134b: 6a 01 push $0x1 8010134d: 50 push %eax 8010134e: e8 61 ee ff ff call 801001b4 <bread> 80101353: 83 c4 10 add $0x10,%esp 80101356: 89 45 f4 mov %eax,-0xc(%ebp) memmove(sb, bp->data, sizeof(*sb)); 80101359: 8b 45 f4 mov -0xc(%ebp),%eax 8010135c: 83 c0 18 add $0x18,%eax 8010135f: 83 ec 04 sub $0x4,%esp 80101362: 6a 10 push $0x10 80101364: 50 push %eax 80101365: ff 75 0c pushl 0xc(%ebp) 80101368: e8 9c 3e 00 00 call 80105209 <memmove> 8010136d: 83 c4 10 add $0x10,%esp brelse(bp); 80101370: 83 ec 0c sub $0xc,%esp 80101373: ff 75 f4 pushl -0xc(%ebp) 80101376: e8 b0 ee ff ff call 8010022b <brelse> 8010137b: 83 c4 10 add $0x10,%esp } 8010137e: c9 leave 8010137f: c3 ret 80101380 <bzero>: // Zero a block. static void bzero(int dev, int bno) { 80101380: 55 push %ebp 80101381: 89 e5 mov %esp,%ebp 80101383: 83 ec 18 sub $0x18,%esp struct buf *bp; bp = bread(dev, bno); 80101386: 8b 55 0c mov 0xc(%ebp),%edx 80101389: 8b 45 08 mov 0x8(%ebp),%eax 8010138c: 83 ec 08 sub $0x8,%esp 8010138f: 52 push %edx 80101390: 50 push %eax 80101391: e8 1e ee ff ff call 801001b4 <bread> 80101396: 83 c4 10 add $0x10,%esp 80101399: 89 45 f4 mov %eax,-0xc(%ebp) memset(bp->data, 0, BSIZE); 8010139c: 8b 45 f4 mov -0xc(%ebp),%eax 8010139f: 83 c0 18 add $0x18,%eax 801013a2: 83 ec 04 sub $0x4,%esp 801013a5: 68 00 02 00 00 push $0x200 801013aa: 6a 00 push $0x0 801013ac: 50 push %eax 801013ad: e8 98 3d 00 00 call 8010514a <memset> 801013b2: 83 c4 10 add $0x10,%esp log_write(bp); 801013b5: 83 ec 0c sub $0xc,%esp 801013b8: ff 75 f4 pushl -0xc(%ebp) 801013bb: e8 dd 22 00 00 call 8010369d <log_write> 801013c0: 83 c4 10 add $0x10,%esp brelse(bp); 801013c3: 83 ec 0c sub $0xc,%esp 801013c6: ff 75 f4 pushl -0xc(%ebp) 801013c9: e8 5d ee ff ff call 8010022b <brelse> 801013ce: 83 c4 10 add $0x10,%esp } 801013d1: c9 leave 801013d2: c3 ret 801013d3 <balloc>: // Blocks. // Allocate a zeroed disk block. static uint balloc(uint dev) { 801013d3: 55 push %ebp 801013d4: 89 e5 mov %esp,%ebp 801013d6: 83 ec 28 sub $0x28,%esp int b, bi, m; struct buf *bp; struct superblock sb; bp = 0; 801013d9: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) readsb(dev, &sb); 801013e0: 8b 45 08 mov 0x8(%ebp),%eax 801013e3: 83 ec 08 sub $0x8,%esp 801013e6: 8d 55 d8 lea -0x28(%ebp),%edx 801013e9: 52 push %edx 801013ea: 50 push %eax 801013eb: e8 4f ff ff ff call 8010133f <readsb> 801013f0: 83 c4 10 add $0x10,%esp for(b = 0; b < sb.size; b += BPB){ 801013f3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801013fa: e9 15 01 00 00 jmp 80101514 <balloc+0x141> bp = bread(dev, BBLOCK(b, sb.ninodes)); 801013ff: 8b 45 f4 mov -0xc(%ebp),%eax 80101402: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx 80101408: 85 c0 test %eax,%eax 8010140a: 0f 48 c2 cmovs %edx,%eax 8010140d: c1 f8 0c sar $0xc,%eax 80101410: 89 c2 mov %eax,%edx 80101412: 8b 45 e0 mov -0x20(%ebp),%eax 80101415: c1 e8 03 shr $0x3,%eax 80101418: 01 d0 add %edx,%eax 8010141a: 83 c0 03 add $0x3,%eax 8010141d: 83 ec 08 sub $0x8,%esp 80101420: 50 push %eax 80101421: ff 75 08 pushl 0x8(%ebp) 80101424: e8 8b ed ff ff call 801001b4 <bread> 80101429: 83 c4 10 add $0x10,%esp 8010142c: 89 45 ec mov %eax,-0x14(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 8010142f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80101436: e9 a6 00 00 00 jmp 801014e1 <balloc+0x10e> m = 1 << (bi % 8); 8010143b: 8b 45 f0 mov -0x10(%ebp),%eax 8010143e: 99 cltd 8010143f: c1 ea 1d shr $0x1d,%edx 80101442: 01 d0 add %edx,%eax 80101444: 83 e0 07 and $0x7,%eax 80101447: 29 d0 sub %edx,%eax 80101449: ba 01 00 00 00 mov $0x1,%edx 8010144e: 89 c1 mov %eax,%ecx 80101450: d3 e2 shl %cl,%edx 80101452: 89 d0 mov %edx,%eax 80101454: 89 45 e8 mov %eax,-0x18(%ebp) if((bp->data[bi/8] & m) == 0){ // Is block free? 80101457: 8b 45 f0 mov -0x10(%ebp),%eax 8010145a: 8d 50 07 lea 0x7(%eax),%edx 8010145d: 85 c0 test %eax,%eax 8010145f: 0f 48 c2 cmovs %edx,%eax 80101462: c1 f8 03 sar $0x3,%eax 80101465: 89 c2 mov %eax,%edx 80101467: 8b 45 ec mov -0x14(%ebp),%eax 8010146a: 0f b6 44 10 18 movzbl 0x18(%eax,%edx,1),%eax 8010146f: 0f b6 c0 movzbl %al,%eax 80101472: 23 45 e8 and -0x18(%ebp),%eax 80101475: 85 c0 test %eax,%eax 80101477: 75 64 jne 801014dd <balloc+0x10a> bp->data[bi/8] |= m; // Mark block in use. 80101479: 8b 45 f0 mov -0x10(%ebp),%eax 8010147c: 8d 50 07 lea 0x7(%eax),%edx 8010147f: 85 c0 test %eax,%eax 80101481: 0f 48 c2 cmovs %edx,%eax 80101484: c1 f8 03 sar $0x3,%eax 80101487: 8b 55 ec mov -0x14(%ebp),%edx 8010148a: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx 8010148f: 89 d1 mov %edx,%ecx 80101491: 8b 55 e8 mov -0x18(%ebp),%edx 80101494: 09 ca or %ecx,%edx 80101496: 89 d1 mov %edx,%ecx 80101498: 8b 55 ec mov -0x14(%ebp),%edx 8010149b: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1) log_write(bp); 8010149f: 83 ec 0c sub $0xc,%esp 801014a2: ff 75 ec pushl -0x14(%ebp) 801014a5: e8 f3 21 00 00 call 8010369d <log_write> 801014aa: 83 c4 10 add $0x10,%esp brelse(bp); 801014ad: 83 ec 0c sub $0xc,%esp 801014b0: ff 75 ec pushl -0x14(%ebp) 801014b3: e8 73 ed ff ff call 8010022b <brelse> 801014b8: 83 c4 10 add $0x10,%esp bzero(dev, b + bi); 801014bb: 8b 55 f4 mov -0xc(%ebp),%edx 801014be: 8b 45 f0 mov -0x10(%ebp),%eax 801014c1: 01 c2 add %eax,%edx 801014c3: 8b 45 08 mov 0x8(%ebp),%eax 801014c6: 83 ec 08 sub $0x8,%esp 801014c9: 52 push %edx 801014ca: 50 push %eax 801014cb: e8 b0 fe ff ff call 80101380 <bzero> 801014d0: 83 c4 10 add $0x10,%esp return b + bi; 801014d3: 8b 55 f4 mov -0xc(%ebp),%edx 801014d6: 8b 45 f0 mov -0x10(%ebp),%eax 801014d9: 01 d0 add %edx,%eax 801014db: eb 52 jmp 8010152f <balloc+0x15c> bp = 0; readsb(dev, &sb); for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb.ninodes)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 801014dd: 83 45 f0 01 addl $0x1,-0x10(%ebp) 801014e1: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp) 801014e8: 7f 15 jg 801014ff <balloc+0x12c> 801014ea: 8b 55 f4 mov -0xc(%ebp),%edx 801014ed: 8b 45 f0 mov -0x10(%ebp),%eax 801014f0: 01 d0 add %edx,%eax 801014f2: 89 c2 mov %eax,%edx 801014f4: 8b 45 d8 mov -0x28(%ebp),%eax 801014f7: 39 c2 cmp %eax,%edx 801014f9: 0f 82 3c ff ff ff jb 8010143b <balloc+0x68> brelse(bp); bzero(dev, b + bi); return b + bi; } } brelse(bp); 801014ff: 83 ec 0c sub $0xc,%esp 80101502: ff 75 ec pushl -0x14(%ebp) 80101505: e8 21 ed ff ff call 8010022b <brelse> 8010150a: 83 c4 10 add $0x10,%esp struct buf *bp; struct superblock sb; bp = 0; readsb(dev, &sb); for(b = 0; b < sb.size; b += BPB){ 8010150d: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80101514: 8b 55 f4 mov -0xc(%ebp),%edx 80101517: 8b 45 d8 mov -0x28(%ebp),%eax 8010151a: 39 c2 cmp %eax,%edx 8010151c: 0f 82 dd fe ff ff jb 801013ff <balloc+0x2c> return b + bi; } } brelse(bp); } panic("balloc: out of blocks"); 80101522: 83 ec 0c sub $0xc,%esp 80101525: 68 59 85 10 80 push $0x80108559 8010152a: e8 2d f0 ff ff call 8010055c <panic> } 8010152f: c9 leave 80101530: c3 ret 80101531 <bfree>: // Free a disk block. static void bfree(int dev, uint b) { 80101531: 55 push %ebp 80101532: 89 e5 mov %esp,%ebp 80101534: 83 ec 28 sub $0x28,%esp struct buf *bp; struct superblock sb; int bi, m; readsb(dev, &sb); 80101537: 83 ec 08 sub $0x8,%esp 8010153a: 8d 45 dc lea -0x24(%ebp),%eax 8010153d: 50 push %eax 8010153e: ff 75 08 pushl 0x8(%ebp) 80101541: e8 f9 fd ff ff call 8010133f <readsb> 80101546: 83 c4 10 add $0x10,%esp bp = bread(dev, BBLOCK(b, sb.ninodes)); 80101549: 8b 45 0c mov 0xc(%ebp),%eax 8010154c: c1 e8 0c shr $0xc,%eax 8010154f: 89 c2 mov %eax,%edx 80101551: 8b 45 e4 mov -0x1c(%ebp),%eax 80101554: c1 e8 03 shr $0x3,%eax 80101557: 01 d0 add %edx,%eax 80101559: 8d 50 03 lea 0x3(%eax),%edx 8010155c: 8b 45 08 mov 0x8(%ebp),%eax 8010155f: 83 ec 08 sub $0x8,%esp 80101562: 52 push %edx 80101563: 50 push %eax 80101564: e8 4b ec ff ff call 801001b4 <bread> 80101569: 83 c4 10 add $0x10,%esp 8010156c: 89 45 f4 mov %eax,-0xc(%ebp) bi = b % BPB; 8010156f: 8b 45 0c mov 0xc(%ebp),%eax 80101572: 25 ff 0f 00 00 and $0xfff,%eax 80101577: 89 45 f0 mov %eax,-0x10(%ebp) m = 1 << (bi % 8); 8010157a: 8b 45 f0 mov -0x10(%ebp),%eax 8010157d: 99 cltd 8010157e: c1 ea 1d shr $0x1d,%edx 80101581: 01 d0 add %edx,%eax 80101583: 83 e0 07 and $0x7,%eax 80101586: 29 d0 sub %edx,%eax 80101588: ba 01 00 00 00 mov $0x1,%edx 8010158d: 89 c1 mov %eax,%ecx 8010158f: d3 e2 shl %cl,%edx 80101591: 89 d0 mov %edx,%eax 80101593: 89 45 ec mov %eax,-0x14(%ebp) if((bp->data[bi/8] & m) == 0) 80101596: 8b 45 f0 mov -0x10(%ebp),%eax 80101599: 8d 50 07 lea 0x7(%eax),%edx 8010159c: 85 c0 test %eax,%eax 8010159e: 0f 48 c2 cmovs %edx,%eax 801015a1: c1 f8 03 sar $0x3,%eax 801015a4: 89 c2 mov %eax,%edx 801015a6: 8b 45 f4 mov -0xc(%ebp),%eax 801015a9: 0f b6 44 10 18 movzbl 0x18(%eax,%edx,1),%eax 801015ae: 0f b6 c0 movzbl %al,%eax 801015b1: 23 45 ec and -0x14(%ebp),%eax 801015b4: 85 c0 test %eax,%eax 801015b6: 75 0d jne 801015c5 <bfree+0x94> panic("freeing free block"); 801015b8: 83 ec 0c sub $0xc,%esp 801015bb: 68 6f 85 10 80 push $0x8010856f 801015c0: e8 97 ef ff ff call 8010055c <panic> bp->data[bi/8] &= ~m; 801015c5: 8b 45 f0 mov -0x10(%ebp),%eax 801015c8: 8d 50 07 lea 0x7(%eax),%edx 801015cb: 85 c0 test %eax,%eax 801015cd: 0f 48 c2 cmovs %edx,%eax 801015d0: c1 f8 03 sar $0x3,%eax 801015d3: 8b 55 f4 mov -0xc(%ebp),%edx 801015d6: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx 801015db: 89 d1 mov %edx,%ecx 801015dd: 8b 55 ec mov -0x14(%ebp),%edx 801015e0: f7 d2 not %edx 801015e2: 21 ca and %ecx,%edx 801015e4: 89 d1 mov %edx,%ecx 801015e6: 8b 55 f4 mov -0xc(%ebp),%edx 801015e9: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1) log_write(bp); 801015ed: 83 ec 0c sub $0xc,%esp 801015f0: ff 75 f4 pushl -0xc(%ebp) 801015f3: e8 a5 20 00 00 call 8010369d <log_write> 801015f8: 83 c4 10 add $0x10,%esp brelse(bp); 801015fb: 83 ec 0c sub $0xc,%esp 801015fe: ff 75 f4 pushl -0xc(%ebp) 80101601: e8 25 ec ff ff call 8010022b <brelse> 80101606: 83 c4 10 add $0x10,%esp } 80101609: c9 leave 8010160a: c3 ret 8010160b <iinit>: struct inode inode[NINODE]; } icache; void iinit(void) { 8010160b: 55 push %ebp 8010160c: 89 e5 mov %esp,%ebp 8010160e: 83 ec 08 sub $0x8,%esp initlock(&icache.lock, "icache"); 80101611: 83 ec 08 sub $0x8,%esp 80101614: 68 82 85 10 80 push $0x80108582 80101619: 68 c0 12 11 80 push $0x801112c0 8010161e: e8 aa 38 00 00 call 80104ecd <initlock> 80101623: 83 c4 10 add $0x10,%esp } 80101626: c9 leave 80101627: c3 ret 80101628 <ialloc>: //PAGEBREAK! // Allocate a new inode with the given type on device dev. // A free inode has a type of zero. struct inode* ialloc(uint dev, short type) { 80101628: 55 push %ebp 80101629: 89 e5 mov %esp,%ebp 8010162b: 83 ec 38 sub $0x38,%esp 8010162e: 8b 45 0c mov 0xc(%ebp),%eax 80101631: 66 89 45 d4 mov %ax,-0x2c(%ebp) int inum; struct buf *bp; struct dinode *dip; struct superblock sb; readsb(dev, &sb); 80101635: 8b 45 08 mov 0x8(%ebp),%eax 80101638: 83 ec 08 sub $0x8,%esp 8010163b: 8d 55 dc lea -0x24(%ebp),%edx 8010163e: 52 push %edx 8010163f: 50 push %eax 80101640: e8 fa fc ff ff call 8010133f <readsb> 80101645: 83 c4 10 add $0x10,%esp for(inum = 1; inum < sb.ninodes; inum++){ 80101648: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 8010164f: e9 98 00 00 00 jmp 801016ec <ialloc+0xc4> bp = bread(dev, IBLOCK(inum)); 80101654: 8b 45 f4 mov -0xc(%ebp),%eax 80101657: c1 e8 03 shr $0x3,%eax 8010165a: 83 c0 02 add $0x2,%eax 8010165d: 83 ec 08 sub $0x8,%esp 80101660: 50 push %eax 80101661: ff 75 08 pushl 0x8(%ebp) 80101664: e8 4b eb ff ff call 801001b4 <bread> 80101669: 83 c4 10 add $0x10,%esp 8010166c: 89 45 f0 mov %eax,-0x10(%ebp) dip = (struct dinode*)bp->data + inum%IPB; 8010166f: 8b 45 f0 mov -0x10(%ebp),%eax 80101672: 8d 50 18 lea 0x18(%eax),%edx 80101675: 8b 45 f4 mov -0xc(%ebp),%eax 80101678: 83 e0 07 and $0x7,%eax 8010167b: c1 e0 06 shl $0x6,%eax 8010167e: 01 d0 add %edx,%eax 80101680: 89 45 ec mov %eax,-0x14(%ebp) if(dip->type == 0){ // a free inode 80101683: 8b 45 ec mov -0x14(%ebp),%eax 80101686: 0f b7 00 movzwl (%eax),%eax 80101689: 66 85 c0 test %ax,%ax 8010168c: 75 4c jne 801016da <ialloc+0xb2> memset(dip, 0, sizeof(*dip)); 8010168e: 83 ec 04 sub $0x4,%esp 80101691: 6a 40 push $0x40 80101693: 6a 00 push $0x0 80101695: ff 75 ec pushl -0x14(%ebp) 80101698: e8 ad 3a 00 00 call 8010514a <memset> 8010169d: 83 c4 10 add $0x10,%esp dip->type = type; 801016a0: 8b 45 ec mov -0x14(%ebp),%eax 801016a3: 0f b7 55 d4 movzwl -0x2c(%ebp),%edx 801016a7: 66 89 10 mov %dx,(%eax) log_write(bp); // mark it allocated on the disk 801016aa: 83 ec 0c sub $0xc,%esp 801016ad: ff 75 f0 pushl -0x10(%ebp) 801016b0: e8 e8 1f 00 00 call 8010369d <log_write> 801016b5: 83 c4 10 add $0x10,%esp brelse(bp); 801016b8: 83 ec 0c sub $0xc,%esp 801016bb: ff 75 f0 pushl -0x10(%ebp) 801016be: e8 68 eb ff ff call 8010022b <brelse> 801016c3: 83 c4 10 add $0x10,%esp return iget(dev, inum); 801016c6: 8b 45 f4 mov -0xc(%ebp),%eax 801016c9: 83 ec 08 sub $0x8,%esp 801016cc: 50 push %eax 801016cd: ff 75 08 pushl 0x8(%ebp) 801016d0: e8 ee 00 00 00 call 801017c3 <iget> 801016d5: 83 c4 10 add $0x10,%esp 801016d8: eb 2d jmp 80101707 <ialloc+0xdf> } brelse(bp); 801016da: 83 ec 0c sub $0xc,%esp 801016dd: ff 75 f0 pushl -0x10(%ebp) 801016e0: e8 46 eb ff ff call 8010022b <brelse> 801016e5: 83 c4 10 add $0x10,%esp struct dinode *dip; struct superblock sb; readsb(dev, &sb); for(inum = 1; inum < sb.ninodes; inum++){ 801016e8: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801016ec: 8b 55 f4 mov -0xc(%ebp),%edx 801016ef: 8b 45 e4 mov -0x1c(%ebp),%eax 801016f2: 39 c2 cmp %eax,%edx 801016f4: 0f 82 5a ff ff ff jb 80101654 <ialloc+0x2c> brelse(bp); return iget(dev, inum); } brelse(bp); } panic("ialloc: no inodes"); 801016fa: 83 ec 0c sub $0xc,%esp 801016fd: 68 89 85 10 80 push $0x80108589 80101702: e8 55 ee ff ff call 8010055c <panic> } 80101707: c9 leave 80101708: c3 ret 80101709 <iupdate>: // Copy a modified in-memory inode to disk. void iupdate(struct inode *ip) { 80101709: 55 push %ebp 8010170a: 89 e5 mov %esp,%ebp 8010170c: 83 ec 18 sub $0x18,%esp struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum)); 8010170f: 8b 45 08 mov 0x8(%ebp),%eax 80101712: 8b 40 04 mov 0x4(%eax),%eax 80101715: c1 e8 03 shr $0x3,%eax 80101718: 8d 50 02 lea 0x2(%eax),%edx 8010171b: 8b 45 08 mov 0x8(%ebp),%eax 8010171e: 8b 00 mov (%eax),%eax 80101720: 83 ec 08 sub $0x8,%esp 80101723: 52 push %edx 80101724: 50 push %eax 80101725: e8 8a ea ff ff call 801001b4 <bread> 8010172a: 83 c4 10 add $0x10,%esp 8010172d: 89 45 f4 mov %eax,-0xc(%ebp) dip = (struct dinode*)bp->data + ip->inum%IPB; 80101730: 8b 45 f4 mov -0xc(%ebp),%eax 80101733: 8d 50 18 lea 0x18(%eax),%edx 80101736: 8b 45 08 mov 0x8(%ebp),%eax 80101739: 8b 40 04 mov 0x4(%eax),%eax 8010173c: 83 e0 07 and $0x7,%eax 8010173f: c1 e0 06 shl $0x6,%eax 80101742: 01 d0 add %edx,%eax 80101744: 89 45 f0 mov %eax,-0x10(%ebp) dip->type = ip->type; 80101747: 8b 45 08 mov 0x8(%ebp),%eax 8010174a: 0f b7 50 10 movzwl 0x10(%eax),%edx 8010174e: 8b 45 f0 mov -0x10(%ebp),%eax 80101751: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 80101754: 8b 45 08 mov 0x8(%ebp),%eax 80101757: 0f b7 50 12 movzwl 0x12(%eax),%edx 8010175b: 8b 45 f0 mov -0x10(%ebp),%eax 8010175e: 66 89 50 02 mov %dx,0x2(%eax) dip->minor = ip->minor; 80101762: 8b 45 08 mov 0x8(%ebp),%eax 80101765: 0f b7 50 14 movzwl 0x14(%eax),%edx 80101769: 8b 45 f0 mov -0x10(%ebp),%eax 8010176c: 66 89 50 04 mov %dx,0x4(%eax) dip->nlink = ip->nlink; 80101770: 8b 45 08 mov 0x8(%ebp),%eax 80101773: 0f b7 50 16 movzwl 0x16(%eax),%edx 80101777: 8b 45 f0 mov -0x10(%ebp),%eax 8010177a: 66 89 50 06 mov %dx,0x6(%eax) dip->size = ip->size; 8010177e: 8b 45 08 mov 0x8(%ebp),%eax 80101781: 8b 50 18 mov 0x18(%eax),%edx 80101784: 8b 45 f0 mov -0x10(%ebp),%eax 80101787: 89 50 08 mov %edx,0x8(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 8010178a: 8b 45 08 mov 0x8(%ebp),%eax 8010178d: 8d 50 1c lea 0x1c(%eax),%edx 80101790: 8b 45 f0 mov -0x10(%ebp),%eax 80101793: 83 c0 0c add $0xc,%eax 80101796: 83 ec 04 sub $0x4,%esp 80101799: 6a 34 push $0x34 8010179b: 52 push %edx 8010179c: 50 push %eax 8010179d: e8 67 3a 00 00 call 80105209 <memmove> 801017a2: 83 c4 10 add $0x10,%esp log_write(bp); 801017a5: 83 ec 0c sub $0xc,%esp 801017a8: ff 75 f4 pushl -0xc(%ebp) 801017ab: e8 ed 1e 00 00 call 8010369d <log_write> 801017b0: 83 c4 10 add $0x10,%esp brelse(bp); 801017b3: 83 ec 0c sub $0xc,%esp 801017b6: ff 75 f4 pushl -0xc(%ebp) 801017b9: e8 6d ea ff ff call 8010022b <brelse> 801017be: 83 c4 10 add $0x10,%esp } 801017c1: c9 leave 801017c2: c3 ret 801017c3 <iget>: // Find the inode with number inum on device dev // and return the in-memory copy. Does not lock // the inode and does not read it from disk. static struct inode* iget(uint dev, uint inum) { 801017c3: 55 push %ebp 801017c4: 89 e5 mov %esp,%ebp 801017c6: 83 ec 18 sub $0x18,%esp struct inode *ip, *empty; acquire(&icache.lock); 801017c9: 83 ec 0c sub $0xc,%esp 801017cc: 68 c0 12 11 80 push $0x801112c0 801017d1: e8 18 37 00 00 call 80104eee <acquire> 801017d6: 83 c4 10 add $0x10,%esp // Is the inode already cached? empty = 0; 801017d9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 801017e0: c7 45 f4 f4 12 11 80 movl $0x801112f4,-0xc(%ebp) 801017e7: eb 5d jmp 80101846 <iget+0x83> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 801017e9: 8b 45 f4 mov -0xc(%ebp),%eax 801017ec: 8b 40 08 mov 0x8(%eax),%eax 801017ef: 85 c0 test %eax,%eax 801017f1: 7e 39 jle 8010182c <iget+0x69> 801017f3: 8b 45 f4 mov -0xc(%ebp),%eax 801017f6: 8b 00 mov (%eax),%eax 801017f8: 3b 45 08 cmp 0x8(%ebp),%eax 801017fb: 75 2f jne 8010182c <iget+0x69> 801017fd: 8b 45 f4 mov -0xc(%ebp),%eax 80101800: 8b 40 04 mov 0x4(%eax),%eax 80101803: 3b 45 0c cmp 0xc(%ebp),%eax 80101806: 75 24 jne 8010182c <iget+0x69> ip->ref++; 80101808: 8b 45 f4 mov -0xc(%ebp),%eax 8010180b: 8b 40 08 mov 0x8(%eax),%eax 8010180e: 8d 50 01 lea 0x1(%eax),%edx 80101811: 8b 45 f4 mov -0xc(%ebp),%eax 80101814: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 80101817: 83 ec 0c sub $0xc,%esp 8010181a: 68 c0 12 11 80 push $0x801112c0 8010181f: e8 30 37 00 00 call 80104f54 <release> 80101824: 83 c4 10 add $0x10,%esp return ip; 80101827: 8b 45 f4 mov -0xc(%ebp),%eax 8010182a: eb 74 jmp 801018a0 <iget+0xdd> } if(empty == 0 && ip->ref == 0) // Remember empty slot. 8010182c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80101830: 75 10 jne 80101842 <iget+0x7f> 80101832: 8b 45 f4 mov -0xc(%ebp),%eax 80101835: 8b 40 08 mov 0x8(%eax),%eax 80101838: 85 c0 test %eax,%eax 8010183a: 75 06 jne 80101842 <iget+0x7f> empty = ip; 8010183c: 8b 45 f4 mov -0xc(%ebp),%eax 8010183f: 89 45 f0 mov %eax,-0x10(%ebp) acquire(&icache.lock); // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80101842: 83 45 f4 50 addl $0x50,-0xc(%ebp) 80101846: 81 7d f4 94 22 11 80 cmpl $0x80112294,-0xc(%ebp) 8010184d: 72 9a jb 801017e9 <iget+0x26> if(empty == 0 && ip->ref == 0) // Remember empty slot. empty = ip; } // Recycle an inode cache entry. if(empty == 0) 8010184f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80101853: 75 0d jne 80101862 <iget+0x9f> panic("iget: no inodes"); 80101855: 83 ec 0c sub $0xc,%esp 80101858: 68 9b 85 10 80 push $0x8010859b 8010185d: e8 fa ec ff ff call 8010055c <panic> ip = empty; 80101862: 8b 45 f0 mov -0x10(%ebp),%eax 80101865: 89 45 f4 mov %eax,-0xc(%ebp) ip->dev = dev; 80101868: 8b 45 f4 mov -0xc(%ebp),%eax 8010186b: 8b 55 08 mov 0x8(%ebp),%edx 8010186e: 89 10 mov %edx,(%eax) ip->inum = inum; 80101870: 8b 45 f4 mov -0xc(%ebp),%eax 80101873: 8b 55 0c mov 0xc(%ebp),%edx 80101876: 89 50 04 mov %edx,0x4(%eax) ip->ref = 1; 80101879: 8b 45 f4 mov -0xc(%ebp),%eax 8010187c: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax) ip->flags = 0; 80101883: 8b 45 f4 mov -0xc(%ebp),%eax 80101886: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) release(&icache.lock); 8010188d: 83 ec 0c sub $0xc,%esp 80101890: 68 c0 12 11 80 push $0x801112c0 80101895: e8 ba 36 00 00 call 80104f54 <release> 8010189a: 83 c4 10 add $0x10,%esp return ip; 8010189d: 8b 45 f4 mov -0xc(%ebp),%eax } 801018a0: c9 leave 801018a1: c3 ret 801018a2 <idup>: // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { 801018a2: 55 push %ebp 801018a3: 89 e5 mov %esp,%ebp 801018a5: 83 ec 08 sub $0x8,%esp acquire(&icache.lock); 801018a8: 83 ec 0c sub $0xc,%esp 801018ab: 68 c0 12 11 80 push $0x801112c0 801018b0: e8 39 36 00 00 call 80104eee <acquire> 801018b5: 83 c4 10 add $0x10,%esp ip->ref++; 801018b8: 8b 45 08 mov 0x8(%ebp),%eax 801018bb: 8b 40 08 mov 0x8(%eax),%eax 801018be: 8d 50 01 lea 0x1(%eax),%edx 801018c1: 8b 45 08 mov 0x8(%ebp),%eax 801018c4: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 801018c7: 83 ec 0c sub $0xc,%esp 801018ca: 68 c0 12 11 80 push $0x801112c0 801018cf: e8 80 36 00 00 call 80104f54 <release> 801018d4: 83 c4 10 add $0x10,%esp return ip; 801018d7: 8b 45 08 mov 0x8(%ebp),%eax } 801018da: c9 leave 801018db: c3 ret 801018dc <ilock>: // Lock the given inode. // Reads the inode from disk if necessary. void ilock(struct inode *ip) { 801018dc: 55 push %ebp 801018dd: 89 e5 mov %esp,%ebp 801018df: 83 ec 18 sub $0x18,%esp struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) 801018e2: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801018e6: 74 0a je 801018f2 <ilock+0x16> 801018e8: 8b 45 08 mov 0x8(%ebp),%eax 801018eb: 8b 40 08 mov 0x8(%eax),%eax 801018ee: 85 c0 test %eax,%eax 801018f0: 7f 0d jg 801018ff <ilock+0x23> panic("ilock"); 801018f2: 83 ec 0c sub $0xc,%esp 801018f5: 68 ab 85 10 80 push $0x801085ab 801018fa: e8 5d ec ff ff call 8010055c <panic> acquire(&icache.lock); 801018ff: 83 ec 0c sub $0xc,%esp 80101902: 68 c0 12 11 80 push $0x801112c0 80101907: e8 e2 35 00 00 call 80104eee <acquire> 8010190c: 83 c4 10 add $0x10,%esp while(ip->flags & I_BUSY) 8010190f: eb 13 jmp 80101924 <ilock+0x48> sleep(ip, &icache.lock); 80101911: 83 ec 08 sub $0x8,%esp 80101914: 68 c0 12 11 80 push $0x801112c0 80101919: ff 75 08 pushl 0x8(%ebp) 8010191c: e8 d4 32 00 00 call 80104bf5 <sleep> 80101921: 83 c4 10 add $0x10,%esp if(ip == 0 || ip->ref < 1) panic("ilock"); acquire(&icache.lock); while(ip->flags & I_BUSY) 80101924: 8b 45 08 mov 0x8(%ebp),%eax 80101927: 8b 40 0c mov 0xc(%eax),%eax 8010192a: 83 e0 01 and $0x1,%eax 8010192d: 85 c0 test %eax,%eax 8010192f: 75 e0 jne 80101911 <ilock+0x35> sleep(ip, &icache.lock); ip->flags |= I_BUSY; 80101931: 8b 45 08 mov 0x8(%ebp),%eax 80101934: 8b 40 0c mov 0xc(%eax),%eax 80101937: 83 c8 01 or $0x1,%eax 8010193a: 89 c2 mov %eax,%edx 8010193c: 8b 45 08 mov 0x8(%ebp),%eax 8010193f: 89 50 0c mov %edx,0xc(%eax) release(&icache.lock); 80101942: 83 ec 0c sub $0xc,%esp 80101945: 68 c0 12 11 80 push $0x801112c0 8010194a: e8 05 36 00 00 call 80104f54 <release> 8010194f: 83 c4 10 add $0x10,%esp if(!(ip->flags & I_VALID)){ 80101952: 8b 45 08 mov 0x8(%ebp),%eax 80101955: 8b 40 0c mov 0xc(%eax),%eax 80101958: 83 e0 02 and $0x2,%eax 8010195b: 85 c0 test %eax,%eax 8010195d: 0f 85 ce 00 00 00 jne 80101a31 <ilock+0x155> bp = bread(ip->dev, IBLOCK(ip->inum)); 80101963: 8b 45 08 mov 0x8(%ebp),%eax 80101966: 8b 40 04 mov 0x4(%eax),%eax 80101969: c1 e8 03 shr $0x3,%eax 8010196c: 8d 50 02 lea 0x2(%eax),%edx 8010196f: 8b 45 08 mov 0x8(%ebp),%eax 80101972: 8b 00 mov (%eax),%eax 80101974: 83 ec 08 sub $0x8,%esp 80101977: 52 push %edx 80101978: 50 push %eax 80101979: e8 36 e8 ff ff call 801001b4 <bread> 8010197e: 83 c4 10 add $0x10,%esp 80101981: 89 45 f4 mov %eax,-0xc(%ebp) dip = (struct dinode*)bp->data + ip->inum%IPB; 80101984: 8b 45 f4 mov -0xc(%ebp),%eax 80101987: 8d 50 18 lea 0x18(%eax),%edx 8010198a: 8b 45 08 mov 0x8(%ebp),%eax 8010198d: 8b 40 04 mov 0x4(%eax),%eax 80101990: 83 e0 07 and $0x7,%eax 80101993: c1 e0 06 shl $0x6,%eax 80101996: 01 d0 add %edx,%eax 80101998: 89 45 f0 mov %eax,-0x10(%ebp) ip->type = dip->type; 8010199b: 8b 45 f0 mov -0x10(%ebp),%eax 8010199e: 0f b7 10 movzwl (%eax),%edx 801019a1: 8b 45 08 mov 0x8(%ebp),%eax 801019a4: 66 89 50 10 mov %dx,0x10(%eax) ip->major = dip->major; 801019a8: 8b 45 f0 mov -0x10(%ebp),%eax 801019ab: 0f b7 50 02 movzwl 0x2(%eax),%edx 801019af: 8b 45 08 mov 0x8(%ebp),%eax 801019b2: 66 89 50 12 mov %dx,0x12(%eax) ip->minor = dip->minor; 801019b6: 8b 45 f0 mov -0x10(%ebp),%eax 801019b9: 0f b7 50 04 movzwl 0x4(%eax),%edx 801019bd: 8b 45 08 mov 0x8(%ebp),%eax 801019c0: 66 89 50 14 mov %dx,0x14(%eax) ip->nlink = dip->nlink; 801019c4: 8b 45 f0 mov -0x10(%ebp),%eax 801019c7: 0f b7 50 06 movzwl 0x6(%eax),%edx 801019cb: 8b 45 08 mov 0x8(%ebp),%eax 801019ce: 66 89 50 16 mov %dx,0x16(%eax) ip->size = dip->size; 801019d2: 8b 45 f0 mov -0x10(%ebp),%eax 801019d5: 8b 50 08 mov 0x8(%eax),%edx 801019d8: 8b 45 08 mov 0x8(%ebp),%eax 801019db: 89 50 18 mov %edx,0x18(%eax) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801019de: 8b 45 f0 mov -0x10(%ebp),%eax 801019e1: 8d 50 0c lea 0xc(%eax),%edx 801019e4: 8b 45 08 mov 0x8(%ebp),%eax 801019e7: 83 c0 1c add $0x1c,%eax 801019ea: 83 ec 04 sub $0x4,%esp 801019ed: 6a 34 push $0x34 801019ef: 52 push %edx 801019f0: 50 push %eax 801019f1: e8 13 38 00 00 call 80105209 <memmove> 801019f6: 83 c4 10 add $0x10,%esp brelse(bp); 801019f9: 83 ec 0c sub $0xc,%esp 801019fc: ff 75 f4 pushl -0xc(%ebp) 801019ff: e8 27 e8 ff ff call 8010022b <brelse> 80101a04: 83 c4 10 add $0x10,%esp ip->flags |= I_VALID; 80101a07: 8b 45 08 mov 0x8(%ebp),%eax 80101a0a: 8b 40 0c mov 0xc(%eax),%eax 80101a0d: 83 c8 02 or $0x2,%eax 80101a10: 89 c2 mov %eax,%edx 80101a12: 8b 45 08 mov 0x8(%ebp),%eax 80101a15: 89 50 0c mov %edx,0xc(%eax) if(ip->type == 0) 80101a18: 8b 45 08 mov 0x8(%ebp),%eax 80101a1b: 0f b7 40 10 movzwl 0x10(%eax),%eax 80101a1f: 66 85 c0 test %ax,%ax 80101a22: 75 0d jne 80101a31 <ilock+0x155> panic("ilock: no type"); 80101a24: 83 ec 0c sub $0xc,%esp 80101a27: 68 b1 85 10 80 push $0x801085b1 80101a2c: e8 2b eb ff ff call 8010055c <panic> } } 80101a31: c9 leave 80101a32: c3 ret 80101a33 <iunlock>: // Unlock the given inode. void iunlock(struct inode *ip) { 80101a33: 55 push %ebp 80101a34: 89 e5 mov %esp,%ebp 80101a36: 83 ec 08 sub $0x8,%esp if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1) 80101a39: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80101a3d: 74 17 je 80101a56 <iunlock+0x23> 80101a3f: 8b 45 08 mov 0x8(%ebp),%eax 80101a42: 8b 40 0c mov 0xc(%eax),%eax 80101a45: 83 e0 01 and $0x1,%eax 80101a48: 85 c0 test %eax,%eax 80101a4a: 74 0a je 80101a56 <iunlock+0x23> 80101a4c: 8b 45 08 mov 0x8(%ebp),%eax 80101a4f: 8b 40 08 mov 0x8(%eax),%eax 80101a52: 85 c0 test %eax,%eax 80101a54: 7f 0d jg 80101a63 <iunlock+0x30> panic("iunlock"); 80101a56: 83 ec 0c sub $0xc,%esp 80101a59: 68 c0 85 10 80 push $0x801085c0 80101a5e: e8 f9 ea ff ff call 8010055c <panic> acquire(&icache.lock); 80101a63: 83 ec 0c sub $0xc,%esp 80101a66: 68 c0 12 11 80 push $0x801112c0 80101a6b: e8 7e 34 00 00 call 80104eee <acquire> 80101a70: 83 c4 10 add $0x10,%esp ip->flags &= ~I_BUSY; 80101a73: 8b 45 08 mov 0x8(%ebp),%eax 80101a76: 8b 40 0c mov 0xc(%eax),%eax 80101a79: 83 e0 fe and $0xfffffffe,%eax 80101a7c: 89 c2 mov %eax,%edx 80101a7e: 8b 45 08 mov 0x8(%ebp),%eax 80101a81: 89 50 0c mov %edx,0xc(%eax) wakeup(ip); 80101a84: 83 ec 0c sub $0xc,%esp 80101a87: ff 75 08 pushl 0x8(%ebp) 80101a8a: e8 52 32 00 00 call 80104ce1 <wakeup> 80101a8f: 83 c4 10 add $0x10,%esp release(&icache.lock); 80101a92: 83 ec 0c sub $0xc,%esp 80101a95: 68 c0 12 11 80 push $0x801112c0 80101a9a: e8 b5 34 00 00 call 80104f54 <release> 80101a9f: 83 c4 10 add $0x10,%esp } 80101aa2: c9 leave 80101aa3: c3 ret 80101aa4 <iput>: // to it, free the inode (and its content) on disk. // All calls to iput() must be inside a transaction in // case it has to free the inode. void iput(struct inode *ip) { 80101aa4: 55 push %ebp 80101aa5: 89 e5 mov %esp,%ebp 80101aa7: 83 ec 08 sub $0x8,%esp acquire(&icache.lock); 80101aaa: 83 ec 0c sub $0xc,%esp 80101aad: 68 c0 12 11 80 push $0x801112c0 80101ab2: e8 37 34 00 00 call 80104eee <acquire> 80101ab7: 83 c4 10 add $0x10,%esp if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){ 80101aba: 8b 45 08 mov 0x8(%ebp),%eax 80101abd: 8b 40 08 mov 0x8(%eax),%eax 80101ac0: 83 f8 01 cmp $0x1,%eax 80101ac3: 0f 85 a9 00 00 00 jne 80101b72 <iput+0xce> 80101ac9: 8b 45 08 mov 0x8(%ebp),%eax 80101acc: 8b 40 0c mov 0xc(%eax),%eax 80101acf: 83 e0 02 and $0x2,%eax 80101ad2: 85 c0 test %eax,%eax 80101ad4: 0f 84 98 00 00 00 je 80101b72 <iput+0xce> 80101ada: 8b 45 08 mov 0x8(%ebp),%eax 80101add: 0f b7 40 16 movzwl 0x16(%eax),%eax 80101ae1: 66 85 c0 test %ax,%ax 80101ae4: 0f 85 88 00 00 00 jne 80101b72 <iput+0xce> // inode has no links and no other references: truncate and free. if(ip->flags & I_BUSY) 80101aea: 8b 45 08 mov 0x8(%ebp),%eax 80101aed: 8b 40 0c mov 0xc(%eax),%eax 80101af0: 83 e0 01 and $0x1,%eax 80101af3: 85 c0 test %eax,%eax 80101af5: 74 0d je 80101b04 <iput+0x60> panic("iput busy"); 80101af7: 83 ec 0c sub $0xc,%esp 80101afa: 68 c8 85 10 80 push $0x801085c8 80101aff: e8 58 ea ff ff call 8010055c <panic> ip->flags |= I_BUSY; 80101b04: 8b 45 08 mov 0x8(%ebp),%eax 80101b07: 8b 40 0c mov 0xc(%eax),%eax 80101b0a: 83 c8 01 or $0x1,%eax 80101b0d: 89 c2 mov %eax,%edx 80101b0f: 8b 45 08 mov 0x8(%ebp),%eax 80101b12: 89 50 0c mov %edx,0xc(%eax) release(&icache.lock); 80101b15: 83 ec 0c sub $0xc,%esp 80101b18: 68 c0 12 11 80 push $0x801112c0 80101b1d: e8 32 34 00 00 call 80104f54 <release> 80101b22: 83 c4 10 add $0x10,%esp itrunc(ip); 80101b25: 83 ec 0c sub $0xc,%esp 80101b28: ff 75 08 pushl 0x8(%ebp) 80101b2b: e8 a6 01 00 00 call 80101cd6 <itrunc> 80101b30: 83 c4 10 add $0x10,%esp ip->type = 0; 80101b33: 8b 45 08 mov 0x8(%ebp),%eax 80101b36: 66 c7 40 10 00 00 movw $0x0,0x10(%eax) iupdate(ip); 80101b3c: 83 ec 0c sub $0xc,%esp 80101b3f: ff 75 08 pushl 0x8(%ebp) 80101b42: e8 c2 fb ff ff call 80101709 <iupdate> 80101b47: 83 c4 10 add $0x10,%esp acquire(&icache.lock); 80101b4a: 83 ec 0c sub $0xc,%esp 80101b4d: 68 c0 12 11 80 push $0x801112c0 80101b52: e8 97 33 00 00 call 80104eee <acquire> 80101b57: 83 c4 10 add $0x10,%esp ip->flags = 0; 80101b5a: 8b 45 08 mov 0x8(%ebp),%eax 80101b5d: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) wakeup(ip); 80101b64: 83 ec 0c sub $0xc,%esp 80101b67: ff 75 08 pushl 0x8(%ebp) 80101b6a: e8 72 31 00 00 call 80104ce1 <wakeup> 80101b6f: 83 c4 10 add $0x10,%esp } ip->ref--; 80101b72: 8b 45 08 mov 0x8(%ebp),%eax 80101b75: 8b 40 08 mov 0x8(%eax),%eax 80101b78: 8d 50 ff lea -0x1(%eax),%edx 80101b7b: 8b 45 08 mov 0x8(%ebp),%eax 80101b7e: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 80101b81: 83 ec 0c sub $0xc,%esp 80101b84: 68 c0 12 11 80 push $0x801112c0 80101b89: e8 c6 33 00 00 call 80104f54 <release> 80101b8e: 83 c4 10 add $0x10,%esp } 80101b91: c9 leave 80101b92: c3 ret 80101b93 <iunlockput>: // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { 80101b93: 55 push %ebp 80101b94: 89 e5 mov %esp,%ebp 80101b96: 83 ec 08 sub $0x8,%esp iunlock(ip); 80101b99: 83 ec 0c sub $0xc,%esp 80101b9c: ff 75 08 pushl 0x8(%ebp) 80101b9f: e8 8f fe ff ff call 80101a33 <iunlock> 80101ba4: 83 c4 10 add $0x10,%esp iput(ip); 80101ba7: 83 ec 0c sub $0xc,%esp 80101baa: ff 75 08 pushl 0x8(%ebp) 80101bad: e8 f2 fe ff ff call 80101aa4 <iput> 80101bb2: 83 c4 10 add $0x10,%esp } 80101bb5: c9 leave 80101bb6: c3 ret 80101bb7 <bmap>: // Return the disk block address of the nth block in inode ip. // If there is no such block, bmap allocates one. static uint bmap(struct inode *ip, uint bn) { 80101bb7: 55 push %ebp 80101bb8: 89 e5 mov %esp,%ebp 80101bba: 53 push %ebx 80101bbb: 83 ec 14 sub $0x14,%esp uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 80101bbe: 83 7d 0c 0b cmpl $0xb,0xc(%ebp) 80101bc2: 77 42 ja 80101c06 <bmap+0x4f> if((addr = ip->addrs[bn]) == 0) 80101bc4: 8b 45 08 mov 0x8(%ebp),%eax 80101bc7: 8b 55 0c mov 0xc(%ebp),%edx 80101bca: 83 c2 04 add $0x4,%edx 80101bcd: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 80101bd1: 89 45 f4 mov %eax,-0xc(%ebp) 80101bd4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80101bd8: 75 24 jne 80101bfe <bmap+0x47> ip->addrs[bn] = addr = balloc(ip->dev); 80101bda: 8b 45 08 mov 0x8(%ebp),%eax 80101bdd: 8b 00 mov (%eax),%eax 80101bdf: 83 ec 0c sub $0xc,%esp 80101be2: 50 push %eax 80101be3: e8 eb f7 ff ff call 801013d3 <balloc> 80101be8: 83 c4 10 add $0x10,%esp 80101beb: 89 45 f4 mov %eax,-0xc(%ebp) 80101bee: 8b 45 08 mov 0x8(%ebp),%eax 80101bf1: 8b 55 0c mov 0xc(%ebp),%edx 80101bf4: 8d 4a 04 lea 0x4(%edx),%ecx 80101bf7: 8b 55 f4 mov -0xc(%ebp),%edx 80101bfa: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4) return addr; 80101bfe: 8b 45 f4 mov -0xc(%ebp),%eax 80101c01: e9 cb 00 00 00 jmp 80101cd1 <bmap+0x11a> } bn -= NDIRECT; 80101c06: 83 6d 0c 0c subl $0xc,0xc(%ebp) if(bn < NINDIRECT){ 80101c0a: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp) 80101c0e: 0f 87 b0 00 00 00 ja 80101cc4 <bmap+0x10d> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80101c14: 8b 45 08 mov 0x8(%ebp),%eax 80101c17: 8b 40 4c mov 0x4c(%eax),%eax 80101c1a: 89 45 f4 mov %eax,-0xc(%ebp) 80101c1d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80101c21: 75 1d jne 80101c40 <bmap+0x89> ip->addrs[NDIRECT] = addr = balloc(ip->dev); 80101c23: 8b 45 08 mov 0x8(%ebp),%eax 80101c26: 8b 00 mov (%eax),%eax 80101c28: 83 ec 0c sub $0xc,%esp 80101c2b: 50 push %eax 80101c2c: e8 a2 f7 ff ff call 801013d3 <balloc> 80101c31: 83 c4 10 add $0x10,%esp 80101c34: 89 45 f4 mov %eax,-0xc(%ebp) 80101c37: 8b 45 08 mov 0x8(%ebp),%eax 80101c3a: 8b 55 f4 mov -0xc(%ebp),%edx 80101c3d: 89 50 4c mov %edx,0x4c(%eax) bp = bread(ip->dev, addr); 80101c40: 8b 45 08 mov 0x8(%ebp),%eax 80101c43: 8b 00 mov (%eax),%eax 80101c45: 83 ec 08 sub $0x8,%esp 80101c48: ff 75 f4 pushl -0xc(%ebp) 80101c4b: 50 push %eax 80101c4c: e8 63 e5 ff ff call 801001b4 <bread> 80101c51: 83 c4 10 add $0x10,%esp 80101c54: 89 45 f0 mov %eax,-0x10(%ebp) a = (uint*)bp->data; 80101c57: 8b 45 f0 mov -0x10(%ebp),%eax 80101c5a: 83 c0 18 add $0x18,%eax 80101c5d: 89 45 ec mov %eax,-0x14(%ebp) if((addr = a[bn]) == 0){ 80101c60: 8b 45 0c mov 0xc(%ebp),%eax 80101c63: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101c6a: 8b 45 ec mov -0x14(%ebp),%eax 80101c6d: 01 d0 add %edx,%eax 80101c6f: 8b 00 mov (%eax),%eax 80101c71: 89 45 f4 mov %eax,-0xc(%ebp) 80101c74: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80101c78: 75 37 jne 80101cb1 <bmap+0xfa> a[bn] = addr = balloc(ip->dev); 80101c7a: 8b 45 0c mov 0xc(%ebp),%eax 80101c7d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101c84: 8b 45 ec mov -0x14(%ebp),%eax 80101c87: 8d 1c 02 lea (%edx,%eax,1),%ebx 80101c8a: 8b 45 08 mov 0x8(%ebp),%eax 80101c8d: 8b 00 mov (%eax),%eax 80101c8f: 83 ec 0c sub $0xc,%esp 80101c92: 50 push %eax 80101c93: e8 3b f7 ff ff call 801013d3 <balloc> 80101c98: 83 c4 10 add $0x10,%esp 80101c9b: 89 45 f4 mov %eax,-0xc(%ebp) 80101c9e: 8b 45 f4 mov -0xc(%ebp),%eax 80101ca1: 89 03 mov %eax,(%ebx) log_write(bp); 80101ca3: 83 ec 0c sub $0xc,%esp 80101ca6: ff 75 f0 pushl -0x10(%ebp) 80101ca9: e8 ef 19 00 00 call 8010369d <log_write> 80101cae: 83 c4 10 add $0x10,%esp } brelse(bp); 80101cb1: 83 ec 0c sub $0xc,%esp 80101cb4: ff 75 f0 pushl -0x10(%ebp) 80101cb7: e8 6f e5 ff ff call 8010022b <brelse> 80101cbc: 83 c4 10 add $0x10,%esp return addr; 80101cbf: 8b 45 f4 mov -0xc(%ebp),%eax 80101cc2: eb 0d jmp 80101cd1 <bmap+0x11a> } panic("bmap: out of range"); 80101cc4: 83 ec 0c sub $0xc,%esp 80101cc7: 68 d2 85 10 80 push $0x801085d2 80101ccc: e8 8b e8 ff ff call 8010055c <panic> } 80101cd1: 8b 5d fc mov -0x4(%ebp),%ebx 80101cd4: c9 leave 80101cd5: c3 ret 80101cd6 <itrunc>: // to it (no directory entries referring to it) // and has no in-memory reference to it (is // not an open file or current directory). static void itrunc(struct inode *ip) { 80101cd6: 55 push %ebp 80101cd7: 89 e5 mov %esp,%ebp 80101cd9: 83 ec 18 sub $0x18,%esp int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101cdc: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80101ce3: eb 45 jmp 80101d2a <itrunc+0x54> if(ip->addrs[i]){ 80101ce5: 8b 45 08 mov 0x8(%ebp),%eax 80101ce8: 8b 55 f4 mov -0xc(%ebp),%edx 80101ceb: 83 c2 04 add $0x4,%edx 80101cee: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 80101cf2: 85 c0 test %eax,%eax 80101cf4: 74 30 je 80101d26 <itrunc+0x50> bfree(ip->dev, ip->addrs[i]); 80101cf6: 8b 45 08 mov 0x8(%ebp),%eax 80101cf9: 8b 55 f4 mov -0xc(%ebp),%edx 80101cfc: 83 c2 04 add $0x4,%edx 80101cff: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 80101d03: 8b 55 08 mov 0x8(%ebp),%edx 80101d06: 8b 12 mov (%edx),%edx 80101d08: 83 ec 08 sub $0x8,%esp 80101d0b: 50 push %eax 80101d0c: 52 push %edx 80101d0d: e8 1f f8 ff ff call 80101531 <bfree> 80101d12: 83 c4 10 add $0x10,%esp ip->addrs[i] = 0; 80101d15: 8b 45 08 mov 0x8(%ebp),%eax 80101d18: 8b 55 f4 mov -0xc(%ebp),%edx 80101d1b: 83 c2 04 add $0x4,%edx 80101d1e: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4) 80101d25: 00 { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101d26: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80101d2a: 83 7d f4 0b cmpl $0xb,-0xc(%ebp) 80101d2e: 7e b5 jle 80101ce5 <itrunc+0xf> bfree(ip->dev, ip->addrs[i]); ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ 80101d30: 8b 45 08 mov 0x8(%ebp),%eax 80101d33: 8b 40 4c mov 0x4c(%eax),%eax 80101d36: 85 c0 test %eax,%eax 80101d38: 0f 84 a1 00 00 00 je 80101ddf <itrunc+0x109> bp = bread(ip->dev, ip->addrs[NDIRECT]); 80101d3e: 8b 45 08 mov 0x8(%ebp),%eax 80101d41: 8b 50 4c mov 0x4c(%eax),%edx 80101d44: 8b 45 08 mov 0x8(%ebp),%eax 80101d47: 8b 00 mov (%eax),%eax 80101d49: 83 ec 08 sub $0x8,%esp 80101d4c: 52 push %edx 80101d4d: 50 push %eax 80101d4e: e8 61 e4 ff ff call 801001b4 <bread> 80101d53: 83 c4 10 add $0x10,%esp 80101d56: 89 45 ec mov %eax,-0x14(%ebp) a = (uint*)bp->data; 80101d59: 8b 45 ec mov -0x14(%ebp),%eax 80101d5c: 83 c0 18 add $0x18,%eax 80101d5f: 89 45 e8 mov %eax,-0x18(%ebp) for(j = 0; j < NINDIRECT; j++){ 80101d62: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80101d69: eb 3c jmp 80101da7 <itrunc+0xd1> if(a[j]) 80101d6b: 8b 45 f0 mov -0x10(%ebp),%eax 80101d6e: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101d75: 8b 45 e8 mov -0x18(%ebp),%eax 80101d78: 01 d0 add %edx,%eax 80101d7a: 8b 00 mov (%eax),%eax 80101d7c: 85 c0 test %eax,%eax 80101d7e: 74 23 je 80101da3 <itrunc+0xcd> bfree(ip->dev, a[j]); 80101d80: 8b 45 f0 mov -0x10(%ebp),%eax 80101d83: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101d8a: 8b 45 e8 mov -0x18(%ebp),%eax 80101d8d: 01 d0 add %edx,%eax 80101d8f: 8b 00 mov (%eax),%eax 80101d91: 8b 55 08 mov 0x8(%ebp),%edx 80101d94: 8b 12 mov (%edx),%edx 80101d96: 83 ec 08 sub $0x8,%esp 80101d99: 50 push %eax 80101d9a: 52 push %edx 80101d9b: e8 91 f7 ff ff call 80101531 <bfree> 80101da0: 83 c4 10 add $0x10,%esp } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); a = (uint*)bp->data; for(j = 0; j < NINDIRECT; j++){ 80101da3: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80101da7: 8b 45 f0 mov -0x10(%ebp),%eax 80101daa: 83 f8 7f cmp $0x7f,%eax 80101dad: 76 bc jbe 80101d6b <itrunc+0x95> if(a[j]) bfree(ip->dev, a[j]); } brelse(bp); 80101daf: 83 ec 0c sub $0xc,%esp 80101db2: ff 75 ec pushl -0x14(%ebp) 80101db5: e8 71 e4 ff ff call 8010022b <brelse> 80101dba: 83 c4 10 add $0x10,%esp bfree(ip->dev, ip->addrs[NDIRECT]); 80101dbd: 8b 45 08 mov 0x8(%ebp),%eax 80101dc0: 8b 40 4c mov 0x4c(%eax),%eax 80101dc3: 8b 55 08 mov 0x8(%ebp),%edx 80101dc6: 8b 12 mov (%edx),%edx 80101dc8: 83 ec 08 sub $0x8,%esp 80101dcb: 50 push %eax 80101dcc: 52 push %edx 80101dcd: e8 5f f7 ff ff call 80101531 <bfree> 80101dd2: 83 c4 10 add $0x10,%esp ip->addrs[NDIRECT] = 0; 80101dd5: 8b 45 08 mov 0x8(%ebp),%eax 80101dd8: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax) } ip->size = 0; 80101ddf: 8b 45 08 mov 0x8(%ebp),%eax 80101de2: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax) iupdate(ip); 80101de9: 83 ec 0c sub $0xc,%esp 80101dec: ff 75 08 pushl 0x8(%ebp) 80101def: e8 15 f9 ff ff call 80101709 <iupdate> 80101df4: 83 c4 10 add $0x10,%esp } 80101df7: c9 leave 80101df8: c3 ret 80101df9 <stati>: // Copy stat information from inode. void stati(struct inode *ip, struct stat *st) { 80101df9: 55 push %ebp 80101dfa: 89 e5 mov %esp,%ebp st->dev = ip->dev; 80101dfc: 8b 45 08 mov 0x8(%ebp),%eax 80101dff: 8b 00 mov (%eax),%eax 80101e01: 89 c2 mov %eax,%edx 80101e03: 8b 45 0c mov 0xc(%ebp),%eax 80101e06: 89 50 04 mov %edx,0x4(%eax) st->ino = ip->inum; 80101e09: 8b 45 08 mov 0x8(%ebp),%eax 80101e0c: 8b 50 04 mov 0x4(%eax),%edx 80101e0f: 8b 45 0c mov 0xc(%ebp),%eax 80101e12: 89 50 08 mov %edx,0x8(%eax) st->type = ip->type; 80101e15: 8b 45 08 mov 0x8(%ebp),%eax 80101e18: 0f b7 50 10 movzwl 0x10(%eax),%edx 80101e1c: 8b 45 0c mov 0xc(%ebp),%eax 80101e1f: 66 89 10 mov %dx,(%eax) st->nlink = ip->nlink; 80101e22: 8b 45 08 mov 0x8(%ebp),%eax 80101e25: 0f b7 50 16 movzwl 0x16(%eax),%edx 80101e29: 8b 45 0c mov 0xc(%ebp),%eax 80101e2c: 66 89 50 0c mov %dx,0xc(%eax) st->size = ip->size; 80101e30: 8b 45 08 mov 0x8(%ebp),%eax 80101e33: 8b 50 18 mov 0x18(%eax),%edx 80101e36: 8b 45 0c mov 0xc(%ebp),%eax 80101e39: 89 50 10 mov %edx,0x10(%eax) } 80101e3c: 5d pop %ebp 80101e3d: c3 ret 80101e3e <readi>: //PAGEBREAK! // Read data from inode. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101e3e: 55 push %ebp 80101e3f: 89 e5 mov %esp,%ebp 80101e41: 83 ec 18 sub $0x18,%esp uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101e44: 8b 45 08 mov 0x8(%ebp),%eax 80101e47: 0f b7 40 10 movzwl 0x10(%eax),%eax 80101e4b: 66 83 f8 03 cmp $0x3,%ax 80101e4f: 75 5c jne 80101ead <readi+0x6f> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) 80101e51: 8b 45 08 mov 0x8(%ebp),%eax 80101e54: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101e58: 66 85 c0 test %ax,%ax 80101e5b: 78 20 js 80101e7d <readi+0x3f> 80101e5d: 8b 45 08 mov 0x8(%ebp),%eax 80101e60: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101e64: 66 83 f8 09 cmp $0x9,%ax 80101e68: 7f 13 jg 80101e7d <readi+0x3f> 80101e6a: 8b 45 08 mov 0x8(%ebp),%eax 80101e6d: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101e71: 98 cwtl 80101e72: 8b 04 c5 40 12 11 80 mov -0x7feeedc0(,%eax,8),%eax 80101e79: 85 c0 test %eax,%eax 80101e7b: 75 0a jne 80101e87 <readi+0x49> return -1; 80101e7d: b8 ff ff ff ff mov $0xffffffff,%eax 80101e82: e9 0f 01 00 00 jmp 80101f96 <readi+0x158> return devsw[ip->major].read(ip, dst, n); 80101e87: 8b 45 08 mov 0x8(%ebp),%eax 80101e8a: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101e8e: 98 cwtl 80101e8f: 8b 04 c5 40 12 11 80 mov -0x7feeedc0(,%eax,8),%eax 80101e96: 8b 55 14 mov 0x14(%ebp),%edx 80101e99: 83 ec 04 sub $0x4,%esp 80101e9c: 52 push %edx 80101e9d: ff 75 0c pushl 0xc(%ebp) 80101ea0: ff 75 08 pushl 0x8(%ebp) 80101ea3: ff d0 call *%eax 80101ea5: 83 c4 10 add $0x10,%esp 80101ea8: e9 e9 00 00 00 jmp 80101f96 <readi+0x158> } if(off > ip->size || off + n < off) 80101ead: 8b 45 08 mov 0x8(%ebp),%eax 80101eb0: 8b 40 18 mov 0x18(%eax),%eax 80101eb3: 3b 45 10 cmp 0x10(%ebp),%eax 80101eb6: 72 0d jb 80101ec5 <readi+0x87> 80101eb8: 8b 55 10 mov 0x10(%ebp),%edx 80101ebb: 8b 45 14 mov 0x14(%ebp),%eax 80101ebe: 01 d0 add %edx,%eax 80101ec0: 3b 45 10 cmp 0x10(%ebp),%eax 80101ec3: 73 0a jae 80101ecf <readi+0x91> return -1; 80101ec5: b8 ff ff ff ff mov $0xffffffff,%eax 80101eca: e9 c7 00 00 00 jmp 80101f96 <readi+0x158> if(off + n > ip->size) 80101ecf: 8b 55 10 mov 0x10(%ebp),%edx 80101ed2: 8b 45 14 mov 0x14(%ebp),%eax 80101ed5: 01 c2 add %eax,%edx 80101ed7: 8b 45 08 mov 0x8(%ebp),%eax 80101eda: 8b 40 18 mov 0x18(%eax),%eax 80101edd: 39 c2 cmp %eax,%edx 80101edf: 76 0c jbe 80101eed <readi+0xaf> n = ip->size - off; 80101ee1: 8b 45 08 mov 0x8(%ebp),%eax 80101ee4: 8b 40 18 mov 0x18(%eax),%eax 80101ee7: 2b 45 10 sub 0x10(%ebp),%eax 80101eea: 89 45 14 mov %eax,0x14(%ebp) for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101eed: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80101ef4: e9 8e 00 00 00 jmp 80101f87 <readi+0x149> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101ef9: 8b 45 10 mov 0x10(%ebp),%eax 80101efc: c1 e8 09 shr $0x9,%eax 80101eff: 83 ec 08 sub $0x8,%esp 80101f02: 50 push %eax 80101f03: ff 75 08 pushl 0x8(%ebp) 80101f06: e8 ac fc ff ff call 80101bb7 <bmap> 80101f0b: 83 c4 10 add $0x10,%esp 80101f0e: 89 c2 mov %eax,%edx 80101f10: 8b 45 08 mov 0x8(%ebp),%eax 80101f13: 8b 00 mov (%eax),%eax 80101f15: 83 ec 08 sub $0x8,%esp 80101f18: 52 push %edx 80101f19: 50 push %eax 80101f1a: e8 95 e2 ff ff call 801001b4 <bread> 80101f1f: 83 c4 10 add $0x10,%esp 80101f22: 89 45 f0 mov %eax,-0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 80101f25: 8b 45 10 mov 0x10(%ebp),%eax 80101f28: 25 ff 01 00 00 and $0x1ff,%eax 80101f2d: ba 00 02 00 00 mov $0x200,%edx 80101f32: 29 c2 sub %eax,%edx 80101f34: 8b 45 14 mov 0x14(%ebp),%eax 80101f37: 2b 45 f4 sub -0xc(%ebp),%eax 80101f3a: 39 c2 cmp %eax,%edx 80101f3c: 0f 46 c2 cmovbe %edx,%eax 80101f3f: 89 45 ec mov %eax,-0x14(%ebp) memmove(dst, bp->data + off%BSIZE, m); 80101f42: 8b 45 10 mov 0x10(%ebp),%eax 80101f45: 25 ff 01 00 00 and $0x1ff,%eax 80101f4a: 8d 50 10 lea 0x10(%eax),%edx 80101f4d: 8b 45 f0 mov -0x10(%ebp),%eax 80101f50: 01 d0 add %edx,%eax 80101f52: 83 c0 08 add $0x8,%eax 80101f55: 83 ec 04 sub $0x4,%esp 80101f58: ff 75 ec pushl -0x14(%ebp) 80101f5b: 50 push %eax 80101f5c: ff 75 0c pushl 0xc(%ebp) 80101f5f: e8 a5 32 00 00 call 80105209 <memmove> 80101f64: 83 c4 10 add $0x10,%esp brelse(bp); 80101f67: 83 ec 0c sub $0xc,%esp 80101f6a: ff 75 f0 pushl -0x10(%ebp) 80101f6d: e8 b9 e2 ff ff call 8010022b <brelse> 80101f72: 83 c4 10 add $0x10,%esp if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101f75: 8b 45 ec mov -0x14(%ebp),%eax 80101f78: 01 45 f4 add %eax,-0xc(%ebp) 80101f7b: 8b 45 ec mov -0x14(%ebp),%eax 80101f7e: 01 45 10 add %eax,0x10(%ebp) 80101f81: 8b 45 ec mov -0x14(%ebp),%eax 80101f84: 01 45 0c add %eax,0xc(%ebp) 80101f87: 8b 45 f4 mov -0xc(%ebp),%eax 80101f8a: 3b 45 14 cmp 0x14(%ebp),%eax 80101f8d: 0f 82 66 ff ff ff jb 80101ef9 <readi+0xbb> bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); brelse(bp); } return n; 80101f93: 8b 45 14 mov 0x14(%ebp),%eax } 80101f96: c9 leave 80101f97: c3 ret 80101f98 <writei>: // PAGEBREAK! // Write data to inode. int writei(struct inode *ip, char *src, uint off, uint n) { 80101f98: 55 push %ebp 80101f99: 89 e5 mov %esp,%ebp 80101f9b: 83 ec 18 sub $0x18,%esp uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101f9e: 8b 45 08 mov 0x8(%ebp),%eax 80101fa1: 0f b7 40 10 movzwl 0x10(%eax),%eax 80101fa5: 66 83 f8 03 cmp $0x3,%ax 80101fa9: 75 5c jne 80102007 <writei+0x6f> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) 80101fab: 8b 45 08 mov 0x8(%ebp),%eax 80101fae: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101fb2: 66 85 c0 test %ax,%ax 80101fb5: 78 20 js 80101fd7 <writei+0x3f> 80101fb7: 8b 45 08 mov 0x8(%ebp),%eax 80101fba: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101fbe: 66 83 f8 09 cmp $0x9,%ax 80101fc2: 7f 13 jg 80101fd7 <writei+0x3f> 80101fc4: 8b 45 08 mov 0x8(%ebp),%eax 80101fc7: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101fcb: 98 cwtl 80101fcc: 8b 04 c5 44 12 11 80 mov -0x7feeedbc(,%eax,8),%eax 80101fd3: 85 c0 test %eax,%eax 80101fd5: 75 0a jne 80101fe1 <writei+0x49> return -1; 80101fd7: b8 ff ff ff ff mov $0xffffffff,%eax 80101fdc: e9 40 01 00 00 jmp 80102121 <writei+0x189> return devsw[ip->major].write(ip, src, n); 80101fe1: 8b 45 08 mov 0x8(%ebp),%eax 80101fe4: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101fe8: 98 cwtl 80101fe9: 8b 04 c5 44 12 11 80 mov -0x7feeedbc(,%eax,8),%eax 80101ff0: 8b 55 14 mov 0x14(%ebp),%edx 80101ff3: 83 ec 04 sub $0x4,%esp 80101ff6: 52 push %edx 80101ff7: ff 75 0c pushl 0xc(%ebp) 80101ffa: ff 75 08 pushl 0x8(%ebp) 80101ffd: ff d0 call *%eax 80101fff: 83 c4 10 add $0x10,%esp 80102002: e9 1a 01 00 00 jmp 80102121 <writei+0x189> } if(off > ip->size || off + n < off) 80102007: 8b 45 08 mov 0x8(%ebp),%eax 8010200a: 8b 40 18 mov 0x18(%eax),%eax 8010200d: 3b 45 10 cmp 0x10(%ebp),%eax 80102010: 72 0d jb 8010201f <writei+0x87> 80102012: 8b 55 10 mov 0x10(%ebp),%edx 80102015: 8b 45 14 mov 0x14(%ebp),%eax 80102018: 01 d0 add %edx,%eax 8010201a: 3b 45 10 cmp 0x10(%ebp),%eax 8010201d: 73 0a jae 80102029 <writei+0x91> return -1; 8010201f: b8 ff ff ff ff mov $0xffffffff,%eax 80102024: e9 f8 00 00 00 jmp 80102121 <writei+0x189> if(off + n > MAXFILE*BSIZE) 80102029: 8b 55 10 mov 0x10(%ebp),%edx 8010202c: 8b 45 14 mov 0x14(%ebp),%eax 8010202f: 01 d0 add %edx,%eax 80102031: 3d 00 18 01 00 cmp $0x11800,%eax 80102036: 76 0a jbe 80102042 <writei+0xaa> return -1; 80102038: b8 ff ff ff ff mov $0xffffffff,%eax 8010203d: e9 df 00 00 00 jmp 80102121 <writei+0x189> for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80102042: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102049: e9 9c 00 00 00 jmp 801020ea <writei+0x152> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 8010204e: 8b 45 10 mov 0x10(%ebp),%eax 80102051: c1 e8 09 shr $0x9,%eax 80102054: 83 ec 08 sub $0x8,%esp 80102057: 50 push %eax 80102058: ff 75 08 pushl 0x8(%ebp) 8010205b: e8 57 fb ff ff call 80101bb7 <bmap> 80102060: 83 c4 10 add $0x10,%esp 80102063: 89 c2 mov %eax,%edx 80102065: 8b 45 08 mov 0x8(%ebp),%eax 80102068: 8b 00 mov (%eax),%eax 8010206a: 83 ec 08 sub $0x8,%esp 8010206d: 52 push %edx 8010206e: 50 push %eax 8010206f: e8 40 e1 ff ff call 801001b4 <bread> 80102074: 83 c4 10 add $0x10,%esp 80102077: 89 45 f0 mov %eax,-0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 8010207a: 8b 45 10 mov 0x10(%ebp),%eax 8010207d: 25 ff 01 00 00 and $0x1ff,%eax 80102082: ba 00 02 00 00 mov $0x200,%edx 80102087: 29 c2 sub %eax,%edx 80102089: 8b 45 14 mov 0x14(%ebp),%eax 8010208c: 2b 45 f4 sub -0xc(%ebp),%eax 8010208f: 39 c2 cmp %eax,%edx 80102091: 0f 46 c2 cmovbe %edx,%eax 80102094: 89 45 ec mov %eax,-0x14(%ebp) memmove(bp->data + off%BSIZE, src, m); 80102097: 8b 45 10 mov 0x10(%ebp),%eax 8010209a: 25 ff 01 00 00 and $0x1ff,%eax 8010209f: 8d 50 10 lea 0x10(%eax),%edx 801020a2: 8b 45 f0 mov -0x10(%ebp),%eax 801020a5: 01 d0 add %edx,%eax 801020a7: 83 c0 08 add $0x8,%eax 801020aa: 83 ec 04 sub $0x4,%esp 801020ad: ff 75 ec pushl -0x14(%ebp) 801020b0: ff 75 0c pushl 0xc(%ebp) 801020b3: 50 push %eax 801020b4: e8 50 31 00 00 call 80105209 <memmove> 801020b9: 83 c4 10 add $0x10,%esp log_write(bp); 801020bc: 83 ec 0c sub $0xc,%esp 801020bf: ff 75 f0 pushl -0x10(%ebp) 801020c2: e8 d6 15 00 00 call 8010369d <log_write> 801020c7: 83 c4 10 add $0x10,%esp brelse(bp); 801020ca: 83 ec 0c sub $0xc,%esp 801020cd: ff 75 f0 pushl -0x10(%ebp) 801020d0: e8 56 e1 ff ff call 8010022b <brelse> 801020d5: 83 c4 10 add $0x10,%esp if(off > ip->size || off + n < off) return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 801020d8: 8b 45 ec mov -0x14(%ebp),%eax 801020db: 01 45 f4 add %eax,-0xc(%ebp) 801020de: 8b 45 ec mov -0x14(%ebp),%eax 801020e1: 01 45 10 add %eax,0x10(%ebp) 801020e4: 8b 45 ec mov -0x14(%ebp),%eax 801020e7: 01 45 0c add %eax,0xc(%ebp) 801020ea: 8b 45 f4 mov -0xc(%ebp),%eax 801020ed: 3b 45 14 cmp 0x14(%ebp),%eax 801020f0: 0f 82 58 ff ff ff jb 8010204e <writei+0xb6> memmove(bp->data + off%BSIZE, src, m); log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ 801020f6: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 801020fa: 74 22 je 8010211e <writei+0x186> 801020fc: 8b 45 08 mov 0x8(%ebp),%eax 801020ff: 8b 40 18 mov 0x18(%eax),%eax 80102102: 3b 45 10 cmp 0x10(%ebp),%eax 80102105: 73 17 jae 8010211e <writei+0x186> ip->size = off; 80102107: 8b 45 08 mov 0x8(%ebp),%eax 8010210a: 8b 55 10 mov 0x10(%ebp),%edx 8010210d: 89 50 18 mov %edx,0x18(%eax) iupdate(ip); 80102110: 83 ec 0c sub $0xc,%esp 80102113: ff 75 08 pushl 0x8(%ebp) 80102116: e8 ee f5 ff ff call 80101709 <iupdate> 8010211b: 83 c4 10 add $0x10,%esp } return n; 8010211e: 8b 45 14 mov 0x14(%ebp),%eax } 80102121: c9 leave 80102122: c3 ret 80102123 <namecmp>: //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { 80102123: 55 push %ebp 80102124: 89 e5 mov %esp,%ebp 80102126: 83 ec 08 sub $0x8,%esp return strncmp(s, t, DIRSIZ); 80102129: 83 ec 04 sub $0x4,%esp 8010212c: 6a 0e push $0xe 8010212e: ff 75 0c pushl 0xc(%ebp) 80102131: ff 75 08 pushl 0x8(%ebp) 80102134: e8 68 31 00 00 call 801052a1 <strncmp> 80102139: 83 c4 10 add $0x10,%esp } 8010213c: c9 leave 8010213d: c3 ret 8010213e <dirlookup>: // Look for a directory entry in a directory. // If found, set *poff to byte offset of entry. struct inode* dirlookup(struct inode *dp, char *name, uint *poff) { 8010213e: 55 push %ebp 8010213f: 89 e5 mov %esp,%ebp 80102141: 83 ec 28 sub $0x28,%esp uint off, inum; struct dirent de; if(dp->type != T_DIR) 80102144: 8b 45 08 mov 0x8(%ebp),%eax 80102147: 0f b7 40 10 movzwl 0x10(%eax),%eax 8010214b: 66 83 f8 01 cmp $0x1,%ax 8010214f: 74 0d je 8010215e <dirlookup+0x20> panic("dirlookup not DIR"); 80102151: 83 ec 0c sub $0xc,%esp 80102154: 68 e5 85 10 80 push $0x801085e5 80102159: e8 fe e3 ff ff call 8010055c <panic> for(off = 0; off < dp->size; off += sizeof(de)){ 8010215e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102165: eb 7c jmp 801021e3 <dirlookup+0xa5> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80102167: 6a 10 push $0x10 80102169: ff 75 f4 pushl -0xc(%ebp) 8010216c: 8d 45 e0 lea -0x20(%ebp),%eax 8010216f: 50 push %eax 80102170: ff 75 08 pushl 0x8(%ebp) 80102173: e8 c6 fc ff ff call 80101e3e <readi> 80102178: 83 c4 10 add $0x10,%esp 8010217b: 83 f8 10 cmp $0x10,%eax 8010217e: 74 0d je 8010218d <dirlookup+0x4f> panic("dirlink read"); 80102180: 83 ec 0c sub $0xc,%esp 80102183: 68 f7 85 10 80 push $0x801085f7 80102188: e8 cf e3 ff ff call 8010055c <panic> if(de.inum == 0) 8010218d: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 80102191: 66 85 c0 test %ax,%ax 80102194: 75 02 jne 80102198 <dirlookup+0x5a> continue; 80102196: eb 47 jmp 801021df <dirlookup+0xa1> if(namecmp(name, de.name) == 0){ 80102198: 83 ec 08 sub $0x8,%esp 8010219b: 8d 45 e0 lea -0x20(%ebp),%eax 8010219e: 83 c0 02 add $0x2,%eax 801021a1: 50 push %eax 801021a2: ff 75 0c pushl 0xc(%ebp) 801021a5: e8 79 ff ff ff call 80102123 <namecmp> 801021aa: 83 c4 10 add $0x10,%esp 801021ad: 85 c0 test %eax,%eax 801021af: 75 2e jne 801021df <dirlookup+0xa1> // entry matches path element if(poff) 801021b1: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801021b5: 74 08 je 801021bf <dirlookup+0x81> *poff = off; 801021b7: 8b 45 10 mov 0x10(%ebp),%eax 801021ba: 8b 55 f4 mov -0xc(%ebp),%edx 801021bd: 89 10 mov %edx,(%eax) inum = de.inum; 801021bf: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 801021c3: 0f b7 c0 movzwl %ax,%eax 801021c6: 89 45 f0 mov %eax,-0x10(%ebp) return iget(dp->dev, inum); 801021c9: 8b 45 08 mov 0x8(%ebp),%eax 801021cc: 8b 00 mov (%eax),%eax 801021ce: 83 ec 08 sub $0x8,%esp 801021d1: ff 75 f0 pushl -0x10(%ebp) 801021d4: 50 push %eax 801021d5: e8 e9 f5 ff ff call 801017c3 <iget> 801021da: 83 c4 10 add $0x10,%esp 801021dd: eb 18 jmp 801021f7 <dirlookup+0xb9> struct dirent de; if(dp->type != T_DIR) panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 801021df: 83 45 f4 10 addl $0x10,-0xc(%ebp) 801021e3: 8b 45 08 mov 0x8(%ebp),%eax 801021e6: 8b 40 18 mov 0x18(%eax),%eax 801021e9: 3b 45 f4 cmp -0xc(%ebp),%eax 801021ec: 0f 87 75 ff ff ff ja 80102167 <dirlookup+0x29> inum = de.inum; return iget(dp->dev, inum); } } return 0; 801021f2: b8 00 00 00 00 mov $0x0,%eax } 801021f7: c9 leave 801021f8: c3 ret 801021f9 <dirlink>: // Write a new directory entry (name, inum) into the directory dp. int dirlink(struct inode *dp, char *name, uint inum) { 801021f9: 55 push %ebp 801021fa: 89 e5 mov %esp,%ebp 801021fc: 83 ec 28 sub $0x28,%esp int off; struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ 801021ff: 83 ec 04 sub $0x4,%esp 80102202: 6a 00 push $0x0 80102204: ff 75 0c pushl 0xc(%ebp) 80102207: ff 75 08 pushl 0x8(%ebp) 8010220a: e8 2f ff ff ff call 8010213e <dirlookup> 8010220f: 83 c4 10 add $0x10,%esp 80102212: 89 45 f0 mov %eax,-0x10(%ebp) 80102215: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102219: 74 18 je 80102233 <dirlink+0x3a> iput(ip); 8010221b: 83 ec 0c sub $0xc,%esp 8010221e: ff 75 f0 pushl -0x10(%ebp) 80102221: e8 7e f8 ff ff call 80101aa4 <iput> 80102226: 83 c4 10 add $0x10,%esp return -1; 80102229: b8 ff ff ff ff mov $0xffffffff,%eax 8010222e: e9 9b 00 00 00 jmp 801022ce <dirlink+0xd5> } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 80102233: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010223a: eb 3b jmp 80102277 <dirlink+0x7e> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 8010223c: 8b 45 f4 mov -0xc(%ebp),%eax 8010223f: 6a 10 push $0x10 80102241: 50 push %eax 80102242: 8d 45 e0 lea -0x20(%ebp),%eax 80102245: 50 push %eax 80102246: ff 75 08 pushl 0x8(%ebp) 80102249: e8 f0 fb ff ff call 80101e3e <readi> 8010224e: 83 c4 10 add $0x10,%esp 80102251: 83 f8 10 cmp $0x10,%eax 80102254: 74 0d je 80102263 <dirlink+0x6a> panic("dirlink read"); 80102256: 83 ec 0c sub $0xc,%esp 80102259: 68 f7 85 10 80 push $0x801085f7 8010225e: e8 f9 e2 ff ff call 8010055c <panic> if(de.inum == 0) 80102263: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 80102267: 66 85 c0 test %ax,%ax 8010226a: 75 02 jne 8010226e <dirlink+0x75> break; 8010226c: eb 16 jmp 80102284 <dirlink+0x8b> iput(ip); return -1; } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 8010226e: 8b 45 f4 mov -0xc(%ebp),%eax 80102271: 83 c0 10 add $0x10,%eax 80102274: 89 45 f4 mov %eax,-0xc(%ebp) 80102277: 8b 55 f4 mov -0xc(%ebp),%edx 8010227a: 8b 45 08 mov 0x8(%ebp),%eax 8010227d: 8b 40 18 mov 0x18(%eax),%eax 80102280: 39 c2 cmp %eax,%edx 80102282: 72 b8 jb 8010223c <dirlink+0x43> panic("dirlink read"); if(de.inum == 0) break; } strncpy(de.name, name, DIRSIZ); 80102284: 83 ec 04 sub $0x4,%esp 80102287: 6a 0e push $0xe 80102289: ff 75 0c pushl 0xc(%ebp) 8010228c: 8d 45 e0 lea -0x20(%ebp),%eax 8010228f: 83 c0 02 add $0x2,%eax 80102292: 50 push %eax 80102293: e8 5f 30 00 00 call 801052f7 <strncpy> 80102298: 83 c4 10 add $0x10,%esp de.inum = inum; 8010229b: 8b 45 10 mov 0x10(%ebp),%eax 8010229e: 66 89 45 e0 mov %ax,-0x20(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 801022a2: 8b 45 f4 mov -0xc(%ebp),%eax 801022a5: 6a 10 push $0x10 801022a7: 50 push %eax 801022a8: 8d 45 e0 lea -0x20(%ebp),%eax 801022ab: 50 push %eax 801022ac: ff 75 08 pushl 0x8(%ebp) 801022af: e8 e4 fc ff ff call 80101f98 <writei> 801022b4: 83 c4 10 add $0x10,%esp 801022b7: 83 f8 10 cmp $0x10,%eax 801022ba: 74 0d je 801022c9 <dirlink+0xd0> panic("dirlink"); 801022bc: 83 ec 0c sub $0xc,%esp 801022bf: 68 04 86 10 80 push $0x80108604 801022c4: e8 93 e2 ff ff call 8010055c <panic> return 0; 801022c9: b8 00 00 00 00 mov $0x0,%eax } 801022ce: c9 leave 801022cf: c3 ret 801022d0 <skipelem>: // skipelem("a", name) = "", setting name = "a" // skipelem("", name) = skipelem("////", name) = 0 // static char* skipelem(char *path, char *name) { 801022d0: 55 push %ebp 801022d1: 89 e5 mov %esp,%ebp 801022d3: 83 ec 18 sub $0x18,%esp char *s; int len; while(*path == '/') 801022d6: eb 04 jmp 801022dc <skipelem+0xc> path++; 801022d8: 83 45 08 01 addl $0x1,0x8(%ebp) skipelem(char *path, char *name) { char *s; int len; while(*path == '/') 801022dc: 8b 45 08 mov 0x8(%ebp),%eax 801022df: 0f b6 00 movzbl (%eax),%eax 801022e2: 3c 2f cmp $0x2f,%al 801022e4: 74 f2 je 801022d8 <skipelem+0x8> path++; if(*path == 0) 801022e6: 8b 45 08 mov 0x8(%ebp),%eax 801022e9: 0f b6 00 movzbl (%eax),%eax 801022ec: 84 c0 test %al,%al 801022ee: 75 07 jne 801022f7 <skipelem+0x27> return 0; 801022f0: b8 00 00 00 00 mov $0x0,%eax 801022f5: eb 7b jmp 80102372 <skipelem+0xa2> s = path; 801022f7: 8b 45 08 mov 0x8(%ebp),%eax 801022fa: 89 45 f4 mov %eax,-0xc(%ebp) while(*path != '/' && *path != 0) 801022fd: eb 04 jmp 80102303 <skipelem+0x33> path++; 801022ff: 83 45 08 01 addl $0x1,0x8(%ebp) while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80102303: 8b 45 08 mov 0x8(%ebp),%eax 80102306: 0f b6 00 movzbl (%eax),%eax 80102309: 3c 2f cmp $0x2f,%al 8010230b: 74 0a je 80102317 <skipelem+0x47> 8010230d: 8b 45 08 mov 0x8(%ebp),%eax 80102310: 0f b6 00 movzbl (%eax),%eax 80102313: 84 c0 test %al,%al 80102315: 75 e8 jne 801022ff <skipelem+0x2f> path++; len = path - s; 80102317: 8b 55 08 mov 0x8(%ebp),%edx 8010231a: 8b 45 f4 mov -0xc(%ebp),%eax 8010231d: 29 c2 sub %eax,%edx 8010231f: 89 d0 mov %edx,%eax 80102321: 89 45 f0 mov %eax,-0x10(%ebp) if(len >= DIRSIZ) 80102324: 83 7d f0 0d cmpl $0xd,-0x10(%ebp) 80102328: 7e 15 jle 8010233f <skipelem+0x6f> memmove(name, s, DIRSIZ); 8010232a: 83 ec 04 sub $0x4,%esp 8010232d: 6a 0e push $0xe 8010232f: ff 75 f4 pushl -0xc(%ebp) 80102332: ff 75 0c pushl 0xc(%ebp) 80102335: e8 cf 2e 00 00 call 80105209 <memmove> 8010233a: 83 c4 10 add $0x10,%esp 8010233d: eb 20 jmp 8010235f <skipelem+0x8f> else { memmove(name, s, len); 8010233f: 8b 45 f0 mov -0x10(%ebp),%eax 80102342: 83 ec 04 sub $0x4,%esp 80102345: 50 push %eax 80102346: ff 75 f4 pushl -0xc(%ebp) 80102349: ff 75 0c pushl 0xc(%ebp) 8010234c: e8 b8 2e 00 00 call 80105209 <memmove> 80102351: 83 c4 10 add $0x10,%esp name[len] = 0; 80102354: 8b 55 f0 mov -0x10(%ebp),%edx 80102357: 8b 45 0c mov 0xc(%ebp),%eax 8010235a: 01 d0 add %edx,%eax 8010235c: c6 00 00 movb $0x0,(%eax) } while(*path == '/') 8010235f: eb 04 jmp 80102365 <skipelem+0x95> path++; 80102361: 83 45 08 01 addl $0x1,0x8(%ebp) memmove(name, s, DIRSIZ); else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80102365: 8b 45 08 mov 0x8(%ebp),%eax 80102368: 0f b6 00 movzbl (%eax),%eax 8010236b: 3c 2f cmp $0x2f,%al 8010236d: 74 f2 je 80102361 <skipelem+0x91> path++; return path; 8010236f: 8b 45 08 mov 0x8(%ebp),%eax } 80102372: c9 leave 80102373: c3 ret 80102374 <namex>: // If parent != 0, return the inode for the parent and copy the final // path element into name, which must have room for DIRSIZ bytes. // Must be called inside a transaction since it calls iput(). static struct inode* namex(char *path, int nameiparent, char *name) { 80102374: 55 push %ebp 80102375: 89 e5 mov %esp,%ebp 80102377: 83 ec 18 sub $0x18,%esp struct inode *ip, *next; if(*path == '/') 8010237a: 8b 45 08 mov 0x8(%ebp),%eax 8010237d: 0f b6 00 movzbl (%eax),%eax 80102380: 3c 2f cmp $0x2f,%al 80102382: 75 14 jne 80102398 <namex+0x24> ip = iget(ROOTDEV, ROOTINO); 80102384: 83 ec 08 sub $0x8,%esp 80102387: 6a 01 push $0x1 80102389: 6a 01 push $0x1 8010238b: e8 33 f4 ff ff call 801017c3 <iget> 80102390: 83 c4 10 add $0x10,%esp 80102393: 89 45 f4 mov %eax,-0xc(%ebp) 80102396: eb 18 jmp 801023b0 <namex+0x3c> else ip = idup(proc->cwd); 80102398: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010239e: 8b 40 68 mov 0x68(%eax),%eax 801023a1: 83 ec 0c sub $0xc,%esp 801023a4: 50 push %eax 801023a5: e8 f8 f4 ff ff call 801018a2 <idup> 801023aa: 83 c4 10 add $0x10,%esp 801023ad: 89 45 f4 mov %eax,-0xc(%ebp) while((path = skipelem(path, name)) != 0){ 801023b0: e9 9e 00 00 00 jmp 80102453 <namex+0xdf> ilock(ip); 801023b5: 83 ec 0c sub $0xc,%esp 801023b8: ff 75 f4 pushl -0xc(%ebp) 801023bb: e8 1c f5 ff ff call 801018dc <ilock> 801023c0: 83 c4 10 add $0x10,%esp if(ip->type != T_DIR){ 801023c3: 8b 45 f4 mov -0xc(%ebp),%eax 801023c6: 0f b7 40 10 movzwl 0x10(%eax),%eax 801023ca: 66 83 f8 01 cmp $0x1,%ax 801023ce: 74 18 je 801023e8 <namex+0x74> iunlockput(ip); 801023d0: 83 ec 0c sub $0xc,%esp 801023d3: ff 75 f4 pushl -0xc(%ebp) 801023d6: e8 b8 f7 ff ff call 80101b93 <iunlockput> 801023db: 83 c4 10 add $0x10,%esp return 0; 801023de: b8 00 00 00 00 mov $0x0,%eax 801023e3: e9 a7 00 00 00 jmp 8010248f <namex+0x11b> } if(nameiparent && *path == '\0'){ 801023e8: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 801023ec: 74 20 je 8010240e <namex+0x9a> 801023ee: 8b 45 08 mov 0x8(%ebp),%eax 801023f1: 0f b6 00 movzbl (%eax),%eax 801023f4: 84 c0 test %al,%al 801023f6: 75 16 jne 8010240e <namex+0x9a> // Stop one level early. iunlock(ip); 801023f8: 83 ec 0c sub $0xc,%esp 801023fb: ff 75 f4 pushl -0xc(%ebp) 801023fe: e8 30 f6 ff ff call 80101a33 <iunlock> 80102403: 83 c4 10 add $0x10,%esp return ip; 80102406: 8b 45 f4 mov -0xc(%ebp),%eax 80102409: e9 81 00 00 00 jmp 8010248f <namex+0x11b> } if((next = dirlookup(ip, name, 0)) == 0){ 8010240e: 83 ec 04 sub $0x4,%esp 80102411: 6a 00 push $0x0 80102413: ff 75 10 pushl 0x10(%ebp) 80102416: ff 75 f4 pushl -0xc(%ebp) 80102419: e8 20 fd ff ff call 8010213e <dirlookup> 8010241e: 83 c4 10 add $0x10,%esp 80102421: 89 45 f0 mov %eax,-0x10(%ebp) 80102424: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102428: 75 15 jne 8010243f <namex+0xcb> iunlockput(ip); 8010242a: 83 ec 0c sub $0xc,%esp 8010242d: ff 75 f4 pushl -0xc(%ebp) 80102430: e8 5e f7 ff ff call 80101b93 <iunlockput> 80102435: 83 c4 10 add $0x10,%esp return 0; 80102438: b8 00 00 00 00 mov $0x0,%eax 8010243d: eb 50 jmp 8010248f <namex+0x11b> } iunlockput(ip); 8010243f: 83 ec 0c sub $0xc,%esp 80102442: ff 75 f4 pushl -0xc(%ebp) 80102445: e8 49 f7 ff ff call 80101b93 <iunlockput> 8010244a: 83 c4 10 add $0x10,%esp ip = next; 8010244d: 8b 45 f0 mov -0x10(%ebp),%eax 80102450: 89 45 f4 mov %eax,-0xc(%ebp) if(*path == '/') ip = iget(ROOTDEV, ROOTINO); else ip = idup(proc->cwd); while((path = skipelem(path, name)) != 0){ 80102453: 83 ec 08 sub $0x8,%esp 80102456: ff 75 10 pushl 0x10(%ebp) 80102459: ff 75 08 pushl 0x8(%ebp) 8010245c: e8 6f fe ff ff call 801022d0 <skipelem> 80102461: 83 c4 10 add $0x10,%esp 80102464: 89 45 08 mov %eax,0x8(%ebp) 80102467: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 8010246b: 0f 85 44 ff ff ff jne 801023b5 <namex+0x41> return 0; } iunlockput(ip); ip = next; } if(nameiparent){ 80102471: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80102475: 74 15 je 8010248c <namex+0x118> iput(ip); 80102477: 83 ec 0c sub $0xc,%esp 8010247a: ff 75 f4 pushl -0xc(%ebp) 8010247d: e8 22 f6 ff ff call 80101aa4 <iput> 80102482: 83 c4 10 add $0x10,%esp return 0; 80102485: b8 00 00 00 00 mov $0x0,%eax 8010248a: eb 03 jmp 8010248f <namex+0x11b> } return ip; 8010248c: 8b 45 f4 mov -0xc(%ebp),%eax } 8010248f: c9 leave 80102490: c3 ret 80102491 <namei>: struct inode* namei(char *path) { 80102491: 55 push %ebp 80102492: 89 e5 mov %esp,%ebp 80102494: 83 ec 18 sub $0x18,%esp char name[DIRSIZ]; return namex(path, 0, name); 80102497: 83 ec 04 sub $0x4,%esp 8010249a: 8d 45 ea lea -0x16(%ebp),%eax 8010249d: 50 push %eax 8010249e: 6a 00 push $0x0 801024a0: ff 75 08 pushl 0x8(%ebp) 801024a3: e8 cc fe ff ff call 80102374 <namex> 801024a8: 83 c4 10 add $0x10,%esp } 801024ab: c9 leave 801024ac: c3 ret 801024ad <nameiparent>: struct inode* nameiparent(char *path, char *name) { 801024ad: 55 push %ebp 801024ae: 89 e5 mov %esp,%ebp 801024b0: 83 ec 08 sub $0x8,%esp return namex(path, 1, name); 801024b3: 83 ec 04 sub $0x4,%esp 801024b6: ff 75 0c pushl 0xc(%ebp) 801024b9: 6a 01 push $0x1 801024bb: ff 75 08 pushl 0x8(%ebp) 801024be: e8 b1 fe ff ff call 80102374 <namex> 801024c3: 83 c4 10 add $0x10,%esp } 801024c6: c9 leave 801024c7: c3 ret 801024c8 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801024c8: 55 push %ebp 801024c9: 89 e5 mov %esp,%ebp 801024cb: 83 ec 14 sub $0x14,%esp 801024ce: 8b 45 08 mov 0x8(%ebp),%eax 801024d1: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801024d5: 0f b7 45 ec movzwl -0x14(%ebp),%eax 801024d9: 89 c2 mov %eax,%edx 801024db: ec in (%dx),%al 801024dc: 88 45 ff mov %al,-0x1(%ebp) return data; 801024df: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 801024e3: c9 leave 801024e4: c3 ret 801024e5 <insl>: static inline void insl(int port, void *addr, int cnt) { 801024e5: 55 push %ebp 801024e6: 89 e5 mov %esp,%ebp 801024e8: 57 push %edi 801024e9: 53 push %ebx asm volatile("cld; rep insl" : 801024ea: 8b 55 08 mov 0x8(%ebp),%edx 801024ed: 8b 4d 0c mov 0xc(%ebp),%ecx 801024f0: 8b 45 10 mov 0x10(%ebp),%eax 801024f3: 89 cb mov %ecx,%ebx 801024f5: 89 df mov %ebx,%edi 801024f7: 89 c1 mov %eax,%ecx 801024f9: fc cld 801024fa: f3 6d rep insl (%dx),%es:(%edi) 801024fc: 89 c8 mov %ecx,%eax 801024fe: 89 fb mov %edi,%ebx 80102500: 89 5d 0c mov %ebx,0xc(%ebp) 80102503: 89 45 10 mov %eax,0x10(%ebp) "=D" (addr), "=c" (cnt) : "d" (port), "0" (addr), "1" (cnt) : "memory", "cc"); } 80102506: 5b pop %ebx 80102507: 5f pop %edi 80102508: 5d pop %ebp 80102509: c3 ret 8010250a <outb>: static inline void outb(ushort port, uchar data) { 8010250a: 55 push %ebp 8010250b: 89 e5 mov %esp,%ebp 8010250d: 83 ec 08 sub $0x8,%esp 80102510: 8b 55 08 mov 0x8(%ebp),%edx 80102513: 8b 45 0c mov 0xc(%ebp),%eax 80102516: 66 89 55 fc mov %dx,-0x4(%ebp) 8010251a: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010251d: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80102521: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80102525: ee out %al,(%dx) } 80102526: c9 leave 80102527: c3 ret 80102528 <outsl>: asm volatile("out %0,%1" : : "a" (data), "d" (port)); } static inline void outsl(int port, const void *addr, int cnt) { 80102528: 55 push %ebp 80102529: 89 e5 mov %esp,%ebp 8010252b: 56 push %esi 8010252c: 53 push %ebx asm volatile("cld; rep outsl" : 8010252d: 8b 55 08 mov 0x8(%ebp),%edx 80102530: 8b 4d 0c mov 0xc(%ebp),%ecx 80102533: 8b 45 10 mov 0x10(%ebp),%eax 80102536: 89 cb mov %ecx,%ebx 80102538: 89 de mov %ebx,%esi 8010253a: 89 c1 mov %eax,%ecx 8010253c: fc cld 8010253d: f3 6f rep outsl %ds:(%esi),(%dx) 8010253f: 89 c8 mov %ecx,%eax 80102541: 89 f3 mov %esi,%ebx 80102543: 89 5d 0c mov %ebx,0xc(%ebp) 80102546: 89 45 10 mov %eax,0x10(%ebp) "=S" (addr), "=c" (cnt) : "d" (port), "0" (addr), "1" (cnt) : "cc"); } 80102549: 5b pop %ebx 8010254a: 5e pop %esi 8010254b: 5d pop %ebp 8010254c: c3 ret 8010254d <idewait>: static void idestart(struct buf*); // Wait for IDE disk to become ready. static int idewait(int checkerr) { 8010254d: 55 push %ebp 8010254e: 89 e5 mov %esp,%ebp 80102550: 83 ec 10 sub $0x10,%esp int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80102553: 90 nop 80102554: 68 f7 01 00 00 push $0x1f7 80102559: e8 6a ff ff ff call 801024c8 <inb> 8010255e: 83 c4 04 add $0x4,%esp 80102561: 0f b6 c0 movzbl %al,%eax 80102564: 89 45 fc mov %eax,-0x4(%ebp) 80102567: 8b 45 fc mov -0x4(%ebp),%eax 8010256a: 25 c0 00 00 00 and $0xc0,%eax 8010256f: 83 f8 40 cmp $0x40,%eax 80102572: 75 e0 jne 80102554 <idewait+0x7> ; if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) 80102574: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80102578: 74 11 je 8010258b <idewait+0x3e> 8010257a: 8b 45 fc mov -0x4(%ebp),%eax 8010257d: 83 e0 21 and $0x21,%eax 80102580: 85 c0 test %eax,%eax 80102582: 74 07 je 8010258b <idewait+0x3e> return -1; 80102584: b8 ff ff ff ff mov $0xffffffff,%eax 80102589: eb 05 jmp 80102590 <idewait+0x43> return 0; 8010258b: b8 00 00 00 00 mov $0x0,%eax } 80102590: c9 leave 80102591: c3 ret 80102592 <ideinit>: void ideinit(void) { 80102592: 55 push %ebp 80102593: 89 e5 mov %esp,%ebp 80102595: 83 ec 18 sub $0x18,%esp int i; initlock(&idelock, "ide"); 80102598: 83 ec 08 sub $0x8,%esp 8010259b: 68 0c 86 10 80 push $0x8010860c 801025a0: 68 20 b6 10 80 push $0x8010b620 801025a5: e8 23 29 00 00 call 80104ecd <initlock> 801025aa: 83 c4 10 add $0x10,%esp picenable(IRQ_IDE); 801025ad: 83 ec 0c sub $0xc,%esp 801025b0: 6a 0e push $0xe 801025b2: e8 68 18 00 00 call 80103e1f <picenable> 801025b7: 83 c4 10 add $0x10,%esp ioapicenable(IRQ_IDE, ncpu - 1); 801025ba: a1 20 2a 11 80 mov 0x80112a20,%eax 801025bf: 83 e8 01 sub $0x1,%eax 801025c2: 83 ec 08 sub $0x8,%esp 801025c5: 50 push %eax 801025c6: 6a 0e push $0xe 801025c8: e8 31 04 00 00 call 801029fe <ioapicenable> 801025cd: 83 c4 10 add $0x10,%esp idewait(0); 801025d0: 83 ec 0c sub $0xc,%esp 801025d3: 6a 00 push $0x0 801025d5: e8 73 ff ff ff call 8010254d <idewait> 801025da: 83 c4 10 add $0x10,%esp // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); 801025dd: 83 ec 08 sub $0x8,%esp 801025e0: 68 f0 00 00 00 push $0xf0 801025e5: 68 f6 01 00 00 push $0x1f6 801025ea: e8 1b ff ff ff call 8010250a <outb> 801025ef: 83 c4 10 add $0x10,%esp for(i=0; i<1000; i++){ 801025f2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801025f9: eb 24 jmp 8010261f <ideinit+0x8d> if(inb(0x1f7) != 0){ 801025fb: 83 ec 0c sub $0xc,%esp 801025fe: 68 f7 01 00 00 push $0x1f7 80102603: e8 c0 fe ff ff call 801024c8 <inb> 80102608: 83 c4 10 add $0x10,%esp 8010260b: 84 c0 test %al,%al 8010260d: 74 0c je 8010261b <ideinit+0x89> havedisk1 = 1; 8010260f: c7 05 58 b6 10 80 01 movl $0x1,0x8010b658 80102616: 00 00 00 break; 80102619: eb 0d jmp 80102628 <ideinit+0x96> ioapicenable(IRQ_IDE, ncpu - 1); idewait(0); // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); for(i=0; i<1000; i++){ 8010261b: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010261f: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp) 80102626: 7e d3 jle 801025fb <ideinit+0x69> break; } } // Switch back to disk 0. outb(0x1f6, 0xe0 | (0<<4)); 80102628: 83 ec 08 sub $0x8,%esp 8010262b: 68 e0 00 00 00 push $0xe0 80102630: 68 f6 01 00 00 push $0x1f6 80102635: e8 d0 fe ff ff call 8010250a <outb> 8010263a: 83 c4 10 add $0x10,%esp } 8010263d: c9 leave 8010263e: c3 ret 8010263f <idestart>: // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 8010263f: 55 push %ebp 80102640: 89 e5 mov %esp,%ebp 80102642: 83 ec 08 sub $0x8,%esp if(b == 0) 80102645: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80102649: 75 0d jne 80102658 <idestart+0x19> panic("idestart"); 8010264b: 83 ec 0c sub $0xc,%esp 8010264e: 68 10 86 10 80 push $0x80108610 80102653: e8 04 df ff ff call 8010055c <panic> idewait(0); 80102658: 83 ec 0c sub $0xc,%esp 8010265b: 6a 00 push $0x0 8010265d: e8 eb fe ff ff call 8010254d <idewait> 80102662: 83 c4 10 add $0x10,%esp outb(0x3f6, 0); // generate interrupt 80102665: 83 ec 08 sub $0x8,%esp 80102668: 6a 00 push $0x0 8010266a: 68 f6 03 00 00 push $0x3f6 8010266f: e8 96 fe ff ff call 8010250a <outb> 80102674: 83 c4 10 add $0x10,%esp outb(0x1f2, 1); // number of sectors 80102677: 83 ec 08 sub $0x8,%esp 8010267a: 6a 01 push $0x1 8010267c: 68 f2 01 00 00 push $0x1f2 80102681: e8 84 fe ff ff call 8010250a <outb> 80102686: 83 c4 10 add $0x10,%esp outb(0x1f3, b->sector & 0xff); 80102689: 8b 45 08 mov 0x8(%ebp),%eax 8010268c: 8b 40 08 mov 0x8(%eax),%eax 8010268f: 0f b6 c0 movzbl %al,%eax 80102692: 83 ec 08 sub $0x8,%esp 80102695: 50 push %eax 80102696: 68 f3 01 00 00 push $0x1f3 8010269b: e8 6a fe ff ff call 8010250a <outb> 801026a0: 83 c4 10 add $0x10,%esp outb(0x1f4, (b->sector >> 8) & 0xff); 801026a3: 8b 45 08 mov 0x8(%ebp),%eax 801026a6: 8b 40 08 mov 0x8(%eax),%eax 801026a9: c1 e8 08 shr $0x8,%eax 801026ac: 0f b6 c0 movzbl %al,%eax 801026af: 83 ec 08 sub $0x8,%esp 801026b2: 50 push %eax 801026b3: 68 f4 01 00 00 push $0x1f4 801026b8: e8 4d fe ff ff call 8010250a <outb> 801026bd: 83 c4 10 add $0x10,%esp outb(0x1f5, (b->sector >> 16) & 0xff); 801026c0: 8b 45 08 mov 0x8(%ebp),%eax 801026c3: 8b 40 08 mov 0x8(%eax),%eax 801026c6: c1 e8 10 shr $0x10,%eax 801026c9: 0f b6 c0 movzbl %al,%eax 801026cc: 83 ec 08 sub $0x8,%esp 801026cf: 50 push %eax 801026d0: 68 f5 01 00 00 push $0x1f5 801026d5: e8 30 fe ff ff call 8010250a <outb> 801026da: 83 c4 10 add $0x10,%esp outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f)); 801026dd: 8b 45 08 mov 0x8(%ebp),%eax 801026e0: 8b 40 04 mov 0x4(%eax),%eax 801026e3: 83 e0 01 and $0x1,%eax 801026e6: c1 e0 04 shl $0x4,%eax 801026e9: 89 c2 mov %eax,%edx 801026eb: 8b 45 08 mov 0x8(%ebp),%eax 801026ee: 8b 40 08 mov 0x8(%eax),%eax 801026f1: c1 e8 18 shr $0x18,%eax 801026f4: 83 e0 0f and $0xf,%eax 801026f7: 09 d0 or %edx,%eax 801026f9: 83 c8 e0 or $0xffffffe0,%eax 801026fc: 0f b6 c0 movzbl %al,%eax 801026ff: 83 ec 08 sub $0x8,%esp 80102702: 50 push %eax 80102703: 68 f6 01 00 00 push $0x1f6 80102708: e8 fd fd ff ff call 8010250a <outb> 8010270d: 83 c4 10 add $0x10,%esp if(b->flags & B_DIRTY){ 80102710: 8b 45 08 mov 0x8(%ebp),%eax 80102713: 8b 00 mov (%eax),%eax 80102715: 83 e0 04 and $0x4,%eax 80102718: 85 c0 test %eax,%eax 8010271a: 74 30 je 8010274c <idestart+0x10d> outb(0x1f7, IDE_CMD_WRITE); 8010271c: 83 ec 08 sub $0x8,%esp 8010271f: 6a 30 push $0x30 80102721: 68 f7 01 00 00 push $0x1f7 80102726: e8 df fd ff ff call 8010250a <outb> 8010272b: 83 c4 10 add $0x10,%esp outsl(0x1f0, b->data, 512/4); 8010272e: 8b 45 08 mov 0x8(%ebp),%eax 80102731: 83 c0 18 add $0x18,%eax 80102734: 83 ec 04 sub $0x4,%esp 80102737: 68 80 00 00 00 push $0x80 8010273c: 50 push %eax 8010273d: 68 f0 01 00 00 push $0x1f0 80102742: e8 e1 fd ff ff call 80102528 <outsl> 80102747: 83 c4 10 add $0x10,%esp 8010274a: eb 12 jmp 8010275e <idestart+0x11f> } else { outb(0x1f7, IDE_CMD_READ); 8010274c: 83 ec 08 sub $0x8,%esp 8010274f: 6a 20 push $0x20 80102751: 68 f7 01 00 00 push $0x1f7 80102756: e8 af fd ff ff call 8010250a <outb> 8010275b: 83 c4 10 add $0x10,%esp } } 8010275e: c9 leave 8010275f: c3 ret 80102760 <ideintr>: // Interrupt handler. void ideintr(void) { 80102760: 55 push %ebp 80102761: 89 e5 mov %esp,%ebp 80102763: 83 ec 18 sub $0x18,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 80102766: 83 ec 0c sub $0xc,%esp 80102769: 68 20 b6 10 80 push $0x8010b620 8010276e: e8 7b 27 00 00 call 80104eee <acquire> 80102773: 83 c4 10 add $0x10,%esp if((b = idequeue) == 0){ 80102776: a1 54 b6 10 80 mov 0x8010b654,%eax 8010277b: 89 45 f4 mov %eax,-0xc(%ebp) 8010277e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102782: 75 15 jne 80102799 <ideintr+0x39> release(&idelock); 80102784: 83 ec 0c sub $0xc,%esp 80102787: 68 20 b6 10 80 push $0x8010b620 8010278c: e8 c3 27 00 00 call 80104f54 <release> 80102791: 83 c4 10 add $0x10,%esp // cprintf("spurious IDE interrupt\n"); return; 80102794: e9 9a 00 00 00 jmp 80102833 <ideintr+0xd3> } idequeue = b->qnext; 80102799: 8b 45 f4 mov -0xc(%ebp),%eax 8010279c: 8b 40 14 mov 0x14(%eax),%eax 8010279f: a3 54 b6 10 80 mov %eax,0x8010b654 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) 801027a4: 8b 45 f4 mov -0xc(%ebp),%eax 801027a7: 8b 00 mov (%eax),%eax 801027a9: 83 e0 04 and $0x4,%eax 801027ac: 85 c0 test %eax,%eax 801027ae: 75 2d jne 801027dd <ideintr+0x7d> 801027b0: 83 ec 0c sub $0xc,%esp 801027b3: 6a 01 push $0x1 801027b5: e8 93 fd ff ff call 8010254d <idewait> 801027ba: 83 c4 10 add $0x10,%esp 801027bd: 85 c0 test %eax,%eax 801027bf: 78 1c js 801027dd <ideintr+0x7d> insl(0x1f0, b->data, 512/4); 801027c1: 8b 45 f4 mov -0xc(%ebp),%eax 801027c4: 83 c0 18 add $0x18,%eax 801027c7: 83 ec 04 sub $0x4,%esp 801027ca: 68 80 00 00 00 push $0x80 801027cf: 50 push %eax 801027d0: 68 f0 01 00 00 push $0x1f0 801027d5: e8 0b fd ff ff call 801024e5 <insl> 801027da: 83 c4 10 add $0x10,%esp // Wake process waiting for this buf. b->flags |= B_VALID; 801027dd: 8b 45 f4 mov -0xc(%ebp),%eax 801027e0: 8b 00 mov (%eax),%eax 801027e2: 83 c8 02 or $0x2,%eax 801027e5: 89 c2 mov %eax,%edx 801027e7: 8b 45 f4 mov -0xc(%ebp),%eax 801027ea: 89 10 mov %edx,(%eax) b->flags &= ~B_DIRTY; 801027ec: 8b 45 f4 mov -0xc(%ebp),%eax 801027ef: 8b 00 mov (%eax),%eax 801027f1: 83 e0 fb and $0xfffffffb,%eax 801027f4: 89 c2 mov %eax,%edx 801027f6: 8b 45 f4 mov -0xc(%ebp),%eax 801027f9: 89 10 mov %edx,(%eax) wakeup(b); 801027fb: 83 ec 0c sub $0xc,%esp 801027fe: ff 75 f4 pushl -0xc(%ebp) 80102801: e8 db 24 00 00 call 80104ce1 <wakeup> 80102806: 83 c4 10 add $0x10,%esp // Start disk on next buf in queue. if(idequeue != 0) 80102809: a1 54 b6 10 80 mov 0x8010b654,%eax 8010280e: 85 c0 test %eax,%eax 80102810: 74 11 je 80102823 <ideintr+0xc3> idestart(idequeue); 80102812: a1 54 b6 10 80 mov 0x8010b654,%eax 80102817: 83 ec 0c sub $0xc,%esp 8010281a: 50 push %eax 8010281b: e8 1f fe ff ff call 8010263f <idestart> 80102820: 83 c4 10 add $0x10,%esp release(&idelock); 80102823: 83 ec 0c sub $0xc,%esp 80102826: 68 20 b6 10 80 push $0x8010b620 8010282b: e8 24 27 00 00 call 80104f54 <release> 80102830: 83 c4 10 add $0x10,%esp } 80102833: c9 leave 80102834: c3 ret 80102835 <iderw>: // Sync buf with disk. // If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID. // Else if B_VALID is not set, read buf from disk, set B_VALID. void iderw(struct buf *b) { 80102835: 55 push %ebp 80102836: 89 e5 mov %esp,%ebp 80102838: 83 ec 18 sub $0x18,%esp struct buf **pp; if(!(b->flags & B_BUSY)) 8010283b: 8b 45 08 mov 0x8(%ebp),%eax 8010283e: 8b 00 mov (%eax),%eax 80102840: 83 e0 01 and $0x1,%eax 80102843: 85 c0 test %eax,%eax 80102845: 75 0d jne 80102854 <iderw+0x1f> panic("iderw: buf not busy"); 80102847: 83 ec 0c sub $0xc,%esp 8010284a: 68 19 86 10 80 push $0x80108619 8010284f: e8 08 dd ff ff call 8010055c <panic> if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) 80102854: 8b 45 08 mov 0x8(%ebp),%eax 80102857: 8b 00 mov (%eax),%eax 80102859: 83 e0 06 and $0x6,%eax 8010285c: 83 f8 02 cmp $0x2,%eax 8010285f: 75 0d jne 8010286e <iderw+0x39> panic("iderw: nothing to do"); 80102861: 83 ec 0c sub $0xc,%esp 80102864: 68 2d 86 10 80 push $0x8010862d 80102869: e8 ee dc ff ff call 8010055c <panic> if(b->dev != 0 && !havedisk1) 8010286e: 8b 45 08 mov 0x8(%ebp),%eax 80102871: 8b 40 04 mov 0x4(%eax),%eax 80102874: 85 c0 test %eax,%eax 80102876: 74 16 je 8010288e <iderw+0x59> 80102878: a1 58 b6 10 80 mov 0x8010b658,%eax 8010287d: 85 c0 test %eax,%eax 8010287f: 75 0d jne 8010288e <iderw+0x59> panic("iderw: ide disk 1 not present"); 80102881: 83 ec 0c sub $0xc,%esp 80102884: 68 42 86 10 80 push $0x80108642 80102889: e8 ce dc ff ff call 8010055c <panic> acquire(&idelock); //DOC:acquire-lock 8010288e: 83 ec 0c sub $0xc,%esp 80102891: 68 20 b6 10 80 push $0x8010b620 80102896: e8 53 26 00 00 call 80104eee <acquire> 8010289b: 83 c4 10 add $0x10,%esp // Append b to idequeue. b->qnext = 0; 8010289e: 8b 45 08 mov 0x8(%ebp),%eax 801028a1: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801028a8: c7 45 f4 54 b6 10 80 movl $0x8010b654,-0xc(%ebp) 801028af: eb 0b jmp 801028bc <iderw+0x87> 801028b1: 8b 45 f4 mov -0xc(%ebp),%eax 801028b4: 8b 00 mov (%eax),%eax 801028b6: 83 c0 14 add $0x14,%eax 801028b9: 89 45 f4 mov %eax,-0xc(%ebp) 801028bc: 8b 45 f4 mov -0xc(%ebp),%eax 801028bf: 8b 00 mov (%eax),%eax 801028c1: 85 c0 test %eax,%eax 801028c3: 75 ec jne 801028b1 <iderw+0x7c> ; *pp = b; 801028c5: 8b 45 f4 mov -0xc(%ebp),%eax 801028c8: 8b 55 08 mov 0x8(%ebp),%edx 801028cb: 89 10 mov %edx,(%eax) // Start disk if necessary. if(idequeue == b) 801028cd: a1 54 b6 10 80 mov 0x8010b654,%eax 801028d2: 3b 45 08 cmp 0x8(%ebp),%eax 801028d5: 75 0e jne 801028e5 <iderw+0xb0> idestart(b); 801028d7: 83 ec 0c sub $0xc,%esp 801028da: ff 75 08 pushl 0x8(%ebp) 801028dd: e8 5d fd ff ff call 8010263f <idestart> 801028e2: 83 c4 10 add $0x10,%esp // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 801028e5: eb 13 jmp 801028fa <iderw+0xc5> sleep(b, &idelock); 801028e7: 83 ec 08 sub $0x8,%esp 801028ea: 68 20 b6 10 80 push $0x8010b620 801028ef: ff 75 08 pushl 0x8(%ebp) 801028f2: e8 fe 22 00 00 call 80104bf5 <sleep> 801028f7: 83 c4 10 add $0x10,%esp // Start disk if necessary. if(idequeue == b) idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 801028fa: 8b 45 08 mov 0x8(%ebp),%eax 801028fd: 8b 00 mov (%eax),%eax 801028ff: 83 e0 06 and $0x6,%eax 80102902: 83 f8 02 cmp $0x2,%eax 80102905: 75 e0 jne 801028e7 <iderw+0xb2> sleep(b, &idelock); } release(&idelock); 80102907: 83 ec 0c sub $0xc,%esp 8010290a: 68 20 b6 10 80 push $0x8010b620 8010290f: e8 40 26 00 00 call 80104f54 <release> 80102914: 83 c4 10 add $0x10,%esp } 80102917: c9 leave 80102918: c3 ret 80102919 <ioapicread>: uint data; }; static uint ioapicread(int reg) { 80102919: 55 push %ebp 8010291a: 89 e5 mov %esp,%ebp ioapic->reg = reg; 8010291c: a1 94 22 11 80 mov 0x80112294,%eax 80102921: 8b 55 08 mov 0x8(%ebp),%edx 80102924: 89 10 mov %edx,(%eax) return ioapic->data; 80102926: a1 94 22 11 80 mov 0x80112294,%eax 8010292b: 8b 40 10 mov 0x10(%eax),%eax } 8010292e: 5d pop %ebp 8010292f: c3 ret 80102930 <ioapicwrite>: static void ioapicwrite(int reg, uint data) { 80102930: 55 push %ebp 80102931: 89 e5 mov %esp,%ebp ioapic->reg = reg; 80102933: a1 94 22 11 80 mov 0x80112294,%eax 80102938: 8b 55 08 mov 0x8(%ebp),%edx 8010293b: 89 10 mov %edx,(%eax) ioapic->data = data; 8010293d: a1 94 22 11 80 mov 0x80112294,%eax 80102942: 8b 55 0c mov 0xc(%ebp),%edx 80102945: 89 50 10 mov %edx,0x10(%eax) } 80102948: 5d pop %ebp 80102949: c3 ret 8010294a <ioapicinit>: void ioapicinit(void) { 8010294a: 55 push %ebp 8010294b: 89 e5 mov %esp,%ebp 8010294d: 83 ec 18 sub $0x18,%esp int i, id, maxintr; if(!ismp) 80102950: a1 04 24 11 80 mov 0x80112404,%eax 80102955: 85 c0 test %eax,%eax 80102957: 75 05 jne 8010295e <ioapicinit+0x14> return; 80102959: e9 9e 00 00 00 jmp 801029fc <ioapicinit+0xb2> ioapic = (volatile struct ioapic*)IOAPIC; 8010295e: c7 05 94 22 11 80 00 movl $0xfec00000,0x80112294 80102965: 00 c0 fe maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 80102968: 6a 01 push $0x1 8010296a: e8 aa ff ff ff call 80102919 <ioapicread> 8010296f: 83 c4 04 add $0x4,%esp 80102972: c1 e8 10 shr $0x10,%eax 80102975: 25 ff 00 00 00 and $0xff,%eax 8010297a: 89 45 f0 mov %eax,-0x10(%ebp) id = ioapicread(REG_ID) >> 24; 8010297d: 6a 00 push $0x0 8010297f: e8 95 ff ff ff call 80102919 <ioapicread> 80102984: 83 c4 04 add $0x4,%esp 80102987: c1 e8 18 shr $0x18,%eax 8010298a: 89 45 ec mov %eax,-0x14(%ebp) if(id != ioapicid) 8010298d: 0f b6 05 00 24 11 80 movzbl 0x80112400,%eax 80102994: 0f b6 c0 movzbl %al,%eax 80102997: 3b 45 ec cmp -0x14(%ebp),%eax 8010299a: 74 10 je 801029ac <ioapicinit+0x62> cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 8010299c: 83 ec 0c sub $0xc,%esp 8010299f: 68 60 86 10 80 push $0x80108660 801029a4: e8 16 da ff ff call 801003bf <cprintf> 801029a9: 83 c4 10 add $0x10,%esp // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801029ac: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801029b3: eb 3f jmp 801029f4 <ioapicinit+0xaa> ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 801029b5: 8b 45 f4 mov -0xc(%ebp),%eax 801029b8: 83 c0 20 add $0x20,%eax 801029bb: 0d 00 00 01 00 or $0x10000,%eax 801029c0: 89 c2 mov %eax,%edx 801029c2: 8b 45 f4 mov -0xc(%ebp),%eax 801029c5: 83 c0 08 add $0x8,%eax 801029c8: 01 c0 add %eax,%eax 801029ca: 83 ec 08 sub $0x8,%esp 801029cd: 52 push %edx 801029ce: 50 push %eax 801029cf: e8 5c ff ff ff call 80102930 <ioapicwrite> 801029d4: 83 c4 10 add $0x10,%esp ioapicwrite(REG_TABLE+2*i+1, 0); 801029d7: 8b 45 f4 mov -0xc(%ebp),%eax 801029da: 83 c0 08 add $0x8,%eax 801029dd: 01 c0 add %eax,%eax 801029df: 83 c0 01 add $0x1,%eax 801029e2: 83 ec 08 sub $0x8,%esp 801029e5: 6a 00 push $0x0 801029e7: 50 push %eax 801029e8: e8 43 ff ff ff call 80102930 <ioapicwrite> 801029ed: 83 c4 10 add $0x10,%esp if(id != ioapicid) cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801029f0: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801029f4: 8b 45 f4 mov -0xc(%ebp),%eax 801029f7: 3b 45 f0 cmp -0x10(%ebp),%eax 801029fa: 7e b9 jle 801029b5 <ioapicinit+0x6b> ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); ioapicwrite(REG_TABLE+2*i+1, 0); } } 801029fc: c9 leave 801029fd: c3 ret 801029fe <ioapicenable>: void ioapicenable(int irq, int cpunum) { 801029fe: 55 push %ebp 801029ff: 89 e5 mov %esp,%ebp if(!ismp) 80102a01: a1 04 24 11 80 mov 0x80112404,%eax 80102a06: 85 c0 test %eax,%eax 80102a08: 75 02 jne 80102a0c <ioapicenable+0xe> return; 80102a0a: eb 37 jmp 80102a43 <ioapicenable+0x45> // 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); 80102a0c: 8b 45 08 mov 0x8(%ebp),%eax 80102a0f: 83 c0 20 add $0x20,%eax 80102a12: 89 c2 mov %eax,%edx 80102a14: 8b 45 08 mov 0x8(%ebp),%eax 80102a17: 83 c0 08 add $0x8,%eax 80102a1a: 01 c0 add %eax,%eax 80102a1c: 52 push %edx 80102a1d: 50 push %eax 80102a1e: e8 0d ff ff ff call 80102930 <ioapicwrite> 80102a23: 83 c4 08 add $0x8,%esp ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 80102a26: 8b 45 0c mov 0xc(%ebp),%eax 80102a29: c1 e0 18 shl $0x18,%eax 80102a2c: 89 c2 mov %eax,%edx 80102a2e: 8b 45 08 mov 0x8(%ebp),%eax 80102a31: 83 c0 08 add $0x8,%eax 80102a34: 01 c0 add %eax,%eax 80102a36: 83 c0 01 add $0x1,%eax 80102a39: 52 push %edx 80102a3a: 50 push %eax 80102a3b: e8 f0 fe ff ff call 80102930 <ioapicwrite> 80102a40: 83 c4 08 add $0x8,%esp } 80102a43: c9 leave 80102a44: c3 ret 80102a45 <v2p>: #define KERNBASE 0x80000000 // First kernel virtual address #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked #ifndef __ASSEMBLER__ static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; } 80102a45: 55 push %ebp 80102a46: 89 e5 mov %esp,%ebp 80102a48: 8b 45 08 mov 0x8(%ebp),%eax 80102a4b: 05 00 00 00 80 add $0x80000000,%eax 80102a50: 5d pop %ebp 80102a51: c3 ret 80102a52 <kinit1>: // the pages mapped by entrypgdir on free list. // 2. main() calls kinit2() with the rest of the physical pages // after installing a full page table that maps them on all cores. void kinit1(void *vstart, void *vend) { 80102a52: 55 push %ebp 80102a53: 89 e5 mov %esp,%ebp 80102a55: 83 ec 08 sub $0x8,%esp initlock(&kmem.lock, "kmem"); 80102a58: 83 ec 08 sub $0x8,%esp 80102a5b: 68 92 86 10 80 push $0x80108692 80102a60: 68 a0 22 11 80 push $0x801122a0 80102a65: e8 63 24 00 00 call 80104ecd <initlock> 80102a6a: 83 c4 10 add $0x10,%esp kmem.use_lock = 0; 80102a6d: c7 05 d4 22 11 80 00 movl $0x0,0x801122d4 80102a74: 00 00 00 freerange(vstart, vend); 80102a77: 83 ec 08 sub $0x8,%esp 80102a7a: ff 75 0c pushl 0xc(%ebp) 80102a7d: ff 75 08 pushl 0x8(%ebp) 80102a80: e8 28 00 00 00 call 80102aad <freerange> 80102a85: 83 c4 10 add $0x10,%esp } 80102a88: c9 leave 80102a89: c3 ret 80102a8a <kinit2>: void kinit2(void *vstart, void *vend) { 80102a8a: 55 push %ebp 80102a8b: 89 e5 mov %esp,%ebp 80102a8d: 83 ec 08 sub $0x8,%esp freerange(vstart, vend); 80102a90: 83 ec 08 sub $0x8,%esp 80102a93: ff 75 0c pushl 0xc(%ebp) 80102a96: ff 75 08 pushl 0x8(%ebp) 80102a99: e8 0f 00 00 00 call 80102aad <freerange> 80102a9e: 83 c4 10 add $0x10,%esp kmem.use_lock = 1; 80102aa1: c7 05 d4 22 11 80 01 movl $0x1,0x801122d4 80102aa8: 00 00 00 } 80102aab: c9 leave 80102aac: c3 ret 80102aad <freerange>: void freerange(void *vstart, void *vend) { 80102aad: 55 push %ebp 80102aae: 89 e5 mov %esp,%ebp 80102ab0: 83 ec 18 sub $0x18,%esp char *p; p = (char*)PGROUNDUP((uint)vstart); 80102ab3: 8b 45 08 mov 0x8(%ebp),%eax 80102ab6: 05 ff 0f 00 00 add $0xfff,%eax 80102abb: 25 00 f0 ff ff and $0xfffff000,%eax 80102ac0: 89 45 f4 mov %eax,-0xc(%ebp) for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102ac3: eb 15 jmp 80102ada <freerange+0x2d> kfree(p); 80102ac5: 83 ec 0c sub $0xc,%esp 80102ac8: ff 75 f4 pushl -0xc(%ebp) 80102acb: e8 19 00 00 00 call 80102ae9 <kfree> 80102ad0: 83 c4 10 add $0x10,%esp void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102ad3: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80102ada: 8b 45 f4 mov -0xc(%ebp),%eax 80102add: 05 00 10 00 00 add $0x1000,%eax 80102ae2: 3b 45 0c cmp 0xc(%ebp),%eax 80102ae5: 76 de jbe 80102ac5 <freerange+0x18> kfree(p); } 80102ae7: c9 leave 80102ae8: c3 ret 80102ae9 <kfree>: // which normally should have been returned by a // call to kalloc(). (The exception is when // initializing the allocator; see kinit above.) void kfree(char *v) { 80102ae9: 55 push %ebp 80102aea: 89 e5 mov %esp,%ebp 80102aec: 83 ec 18 sub $0x18,%esp struct run *r; if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP) 80102aef: 8b 45 08 mov 0x8(%ebp),%eax 80102af2: 25 ff 0f 00 00 and $0xfff,%eax 80102af7: 85 c0 test %eax,%eax 80102af9: 75 1b jne 80102b16 <kfree+0x2d> 80102afb: 81 7d 08 1c 54 11 80 cmpl $0x8011541c,0x8(%ebp) 80102b02: 72 12 jb 80102b16 <kfree+0x2d> 80102b04: ff 75 08 pushl 0x8(%ebp) 80102b07: e8 39 ff ff ff call 80102a45 <v2p> 80102b0c: 83 c4 04 add $0x4,%esp 80102b0f: 3d ff ff ff 0d cmp $0xdffffff,%eax 80102b14: 76 0d jbe 80102b23 <kfree+0x3a> panic("kfree"); 80102b16: 83 ec 0c sub $0xc,%esp 80102b19: 68 97 86 10 80 push $0x80108697 80102b1e: e8 39 da ff ff call 8010055c <panic> // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 80102b23: 83 ec 04 sub $0x4,%esp 80102b26: 68 00 10 00 00 push $0x1000 80102b2b: 6a 01 push $0x1 80102b2d: ff 75 08 pushl 0x8(%ebp) 80102b30: e8 15 26 00 00 call 8010514a <memset> 80102b35: 83 c4 10 add $0x10,%esp if(kmem.use_lock) 80102b38: a1 d4 22 11 80 mov 0x801122d4,%eax 80102b3d: 85 c0 test %eax,%eax 80102b3f: 74 10 je 80102b51 <kfree+0x68> acquire(&kmem.lock); 80102b41: 83 ec 0c sub $0xc,%esp 80102b44: 68 a0 22 11 80 push $0x801122a0 80102b49: e8 a0 23 00 00 call 80104eee <acquire> 80102b4e: 83 c4 10 add $0x10,%esp r = (struct run*)v; 80102b51: 8b 45 08 mov 0x8(%ebp),%eax 80102b54: 89 45 f4 mov %eax,-0xc(%ebp) r->next = kmem.freelist; 80102b57: 8b 15 d8 22 11 80 mov 0x801122d8,%edx 80102b5d: 8b 45 f4 mov -0xc(%ebp),%eax 80102b60: 89 10 mov %edx,(%eax) kmem.freelist = r; 80102b62: 8b 45 f4 mov -0xc(%ebp),%eax 80102b65: a3 d8 22 11 80 mov %eax,0x801122d8 if(kmem.use_lock) 80102b6a: a1 d4 22 11 80 mov 0x801122d4,%eax 80102b6f: 85 c0 test %eax,%eax 80102b71: 74 10 je 80102b83 <kfree+0x9a> release(&kmem.lock); 80102b73: 83 ec 0c sub $0xc,%esp 80102b76: 68 a0 22 11 80 push $0x801122a0 80102b7b: e8 d4 23 00 00 call 80104f54 <release> 80102b80: 83 c4 10 add $0x10,%esp } 80102b83: c9 leave 80102b84: c3 ret 80102b85 <kalloc>: // Allocate one 4096-byte page of physical memory. // Returns a pointer that the kernel can use. // Returns 0 if the memory cannot be allocated. char* kalloc(void) { 80102b85: 55 push %ebp 80102b86: 89 e5 mov %esp,%ebp 80102b88: 83 ec 18 sub $0x18,%esp struct run *r; if(kmem.use_lock) 80102b8b: a1 d4 22 11 80 mov 0x801122d4,%eax 80102b90: 85 c0 test %eax,%eax 80102b92: 74 10 je 80102ba4 <kalloc+0x1f> acquire(&kmem.lock); 80102b94: 83 ec 0c sub $0xc,%esp 80102b97: 68 a0 22 11 80 push $0x801122a0 80102b9c: e8 4d 23 00 00 call 80104eee <acquire> 80102ba1: 83 c4 10 add $0x10,%esp r = kmem.freelist; 80102ba4: a1 d8 22 11 80 mov 0x801122d8,%eax 80102ba9: 89 45 f4 mov %eax,-0xc(%ebp) if(r) 80102bac: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102bb0: 74 0a je 80102bbc <kalloc+0x37> kmem.freelist = r->next; 80102bb2: 8b 45 f4 mov -0xc(%ebp),%eax 80102bb5: 8b 00 mov (%eax),%eax 80102bb7: a3 d8 22 11 80 mov %eax,0x801122d8 if(kmem.use_lock) 80102bbc: a1 d4 22 11 80 mov 0x801122d4,%eax 80102bc1: 85 c0 test %eax,%eax 80102bc3: 74 10 je 80102bd5 <kalloc+0x50> release(&kmem.lock); 80102bc5: 83 ec 0c sub $0xc,%esp 80102bc8: 68 a0 22 11 80 push $0x801122a0 80102bcd: e8 82 23 00 00 call 80104f54 <release> 80102bd2: 83 c4 10 add $0x10,%esp return (char*)r; 80102bd5: 8b 45 f4 mov -0xc(%ebp),%eax } 80102bd8: c9 leave 80102bd9: c3 ret 80102bda <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80102bda: 55 push %ebp 80102bdb: 89 e5 mov %esp,%ebp 80102bdd: 83 ec 14 sub $0x14,%esp 80102be0: 8b 45 08 mov 0x8(%ebp),%eax 80102be3: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102be7: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80102beb: 89 c2 mov %eax,%edx 80102bed: ec in (%dx),%al 80102bee: 88 45 ff mov %al,-0x1(%ebp) return data; 80102bf1: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80102bf5: c9 leave 80102bf6: c3 ret 80102bf7 <kbdgetc>: #include "defs.h" #include "kbd.h" int kbdgetc(void) { 80102bf7: 55 push %ebp 80102bf8: 89 e5 mov %esp,%ebp 80102bfa: 83 ec 10 sub $0x10,%esp static uchar *charcode[4] = { normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); 80102bfd: 6a 64 push $0x64 80102bff: e8 d6 ff ff ff call 80102bda <inb> 80102c04: 83 c4 04 add $0x4,%esp 80102c07: 0f b6 c0 movzbl %al,%eax 80102c0a: 89 45 f4 mov %eax,-0xc(%ebp) if((st & KBS_DIB) == 0) 80102c0d: 8b 45 f4 mov -0xc(%ebp),%eax 80102c10: 83 e0 01 and $0x1,%eax 80102c13: 85 c0 test %eax,%eax 80102c15: 75 0a jne 80102c21 <kbdgetc+0x2a> return -1; 80102c17: b8 ff ff ff ff mov $0xffffffff,%eax 80102c1c: e9 23 01 00 00 jmp 80102d44 <kbdgetc+0x14d> data = inb(KBDATAP); 80102c21: 6a 60 push $0x60 80102c23: e8 b2 ff ff ff call 80102bda <inb> 80102c28: 83 c4 04 add $0x4,%esp 80102c2b: 0f b6 c0 movzbl %al,%eax 80102c2e: 89 45 fc mov %eax,-0x4(%ebp) if(data == 0xE0){ 80102c31: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp) 80102c38: 75 17 jne 80102c51 <kbdgetc+0x5a> shift |= E0ESC; 80102c3a: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102c3f: 83 c8 40 or $0x40,%eax 80102c42: a3 5c b6 10 80 mov %eax,0x8010b65c return 0; 80102c47: b8 00 00 00 00 mov $0x0,%eax 80102c4c: e9 f3 00 00 00 jmp 80102d44 <kbdgetc+0x14d> } else if(data & 0x80){ 80102c51: 8b 45 fc mov -0x4(%ebp),%eax 80102c54: 25 80 00 00 00 and $0x80,%eax 80102c59: 85 c0 test %eax,%eax 80102c5b: 74 45 je 80102ca2 <kbdgetc+0xab> // Key released data = (shift & E0ESC ? data : data & 0x7F); 80102c5d: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102c62: 83 e0 40 and $0x40,%eax 80102c65: 85 c0 test %eax,%eax 80102c67: 75 08 jne 80102c71 <kbdgetc+0x7a> 80102c69: 8b 45 fc mov -0x4(%ebp),%eax 80102c6c: 83 e0 7f and $0x7f,%eax 80102c6f: eb 03 jmp 80102c74 <kbdgetc+0x7d> 80102c71: 8b 45 fc mov -0x4(%ebp),%eax 80102c74: 89 45 fc mov %eax,-0x4(%ebp) shift &= ~(shiftcode[data] | E0ESC); 80102c77: 8b 45 fc mov -0x4(%ebp),%eax 80102c7a: 05 40 90 10 80 add $0x80109040,%eax 80102c7f: 0f b6 00 movzbl (%eax),%eax 80102c82: 83 c8 40 or $0x40,%eax 80102c85: 0f b6 c0 movzbl %al,%eax 80102c88: f7 d0 not %eax 80102c8a: 89 c2 mov %eax,%edx 80102c8c: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102c91: 21 d0 and %edx,%eax 80102c93: a3 5c b6 10 80 mov %eax,0x8010b65c return 0; 80102c98: b8 00 00 00 00 mov $0x0,%eax 80102c9d: e9 a2 00 00 00 jmp 80102d44 <kbdgetc+0x14d> } else if(shift & E0ESC){ 80102ca2: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102ca7: 83 e0 40 and $0x40,%eax 80102caa: 85 c0 test %eax,%eax 80102cac: 74 14 je 80102cc2 <kbdgetc+0xcb> // Last character was an E0 escape; or with 0x80 data |= 0x80; 80102cae: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp) shift &= ~E0ESC; 80102cb5: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102cba: 83 e0 bf and $0xffffffbf,%eax 80102cbd: a3 5c b6 10 80 mov %eax,0x8010b65c } shift |= shiftcode[data]; 80102cc2: 8b 45 fc mov -0x4(%ebp),%eax 80102cc5: 05 40 90 10 80 add $0x80109040,%eax 80102cca: 0f b6 00 movzbl (%eax),%eax 80102ccd: 0f b6 d0 movzbl %al,%edx 80102cd0: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102cd5: 09 d0 or %edx,%eax 80102cd7: a3 5c b6 10 80 mov %eax,0x8010b65c shift ^= togglecode[data]; 80102cdc: 8b 45 fc mov -0x4(%ebp),%eax 80102cdf: 05 40 91 10 80 add $0x80109140,%eax 80102ce4: 0f b6 00 movzbl (%eax),%eax 80102ce7: 0f b6 d0 movzbl %al,%edx 80102cea: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102cef: 31 d0 xor %edx,%eax 80102cf1: a3 5c b6 10 80 mov %eax,0x8010b65c c = charcode[shift & (CTL | SHIFT)][data]; 80102cf6: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102cfb: 83 e0 03 and $0x3,%eax 80102cfe: 8b 14 85 40 95 10 80 mov -0x7fef6ac0(,%eax,4),%edx 80102d05: 8b 45 fc mov -0x4(%ebp),%eax 80102d08: 01 d0 add %edx,%eax 80102d0a: 0f b6 00 movzbl (%eax),%eax 80102d0d: 0f b6 c0 movzbl %al,%eax 80102d10: 89 45 f8 mov %eax,-0x8(%ebp) if(shift & CAPSLOCK){ 80102d13: a1 5c b6 10 80 mov 0x8010b65c,%eax 80102d18: 83 e0 08 and $0x8,%eax 80102d1b: 85 c0 test %eax,%eax 80102d1d: 74 22 je 80102d41 <kbdgetc+0x14a> if('a' <= c && c <= 'z') 80102d1f: 83 7d f8 60 cmpl $0x60,-0x8(%ebp) 80102d23: 76 0c jbe 80102d31 <kbdgetc+0x13a> 80102d25: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp) 80102d29: 77 06 ja 80102d31 <kbdgetc+0x13a> c += 'A' - 'a'; 80102d2b: 83 6d f8 20 subl $0x20,-0x8(%ebp) 80102d2f: eb 10 jmp 80102d41 <kbdgetc+0x14a> else if('A' <= c && c <= 'Z') 80102d31: 83 7d f8 40 cmpl $0x40,-0x8(%ebp) 80102d35: 76 0a jbe 80102d41 <kbdgetc+0x14a> 80102d37: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp) 80102d3b: 77 04 ja 80102d41 <kbdgetc+0x14a> c += 'a' - 'A'; 80102d3d: 83 45 f8 20 addl $0x20,-0x8(%ebp) } return c; 80102d41: 8b 45 f8 mov -0x8(%ebp),%eax } 80102d44: c9 leave 80102d45: c3 ret 80102d46 <kbdintr>: void kbdintr(void) { 80102d46: 55 push %ebp 80102d47: 89 e5 mov %esp,%ebp 80102d49: 83 ec 08 sub $0x8,%esp consoleintr(kbdgetc); 80102d4c: 83 ec 0c sub $0xc,%esp 80102d4f: 68 f7 2b 10 80 push $0x80102bf7 80102d54: e8 78 da ff ff call 801007d1 <consoleintr> 80102d59: 83 c4 10 add $0x10,%esp } 80102d5c: c9 leave 80102d5d: c3 ret 80102d5e <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80102d5e: 55 push %ebp 80102d5f: 89 e5 mov %esp,%ebp 80102d61: 83 ec 14 sub $0x14,%esp 80102d64: 8b 45 08 mov 0x8(%ebp),%eax 80102d67: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102d6b: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80102d6f: 89 c2 mov %eax,%edx 80102d71: ec in (%dx),%al 80102d72: 88 45 ff mov %al,-0x1(%ebp) return data; 80102d75: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80102d79: c9 leave 80102d7a: c3 ret 80102d7b <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80102d7b: 55 push %ebp 80102d7c: 89 e5 mov %esp,%ebp 80102d7e: 83 ec 08 sub $0x8,%esp 80102d81: 8b 55 08 mov 0x8(%ebp),%edx 80102d84: 8b 45 0c mov 0xc(%ebp),%eax 80102d87: 66 89 55 fc mov %dx,-0x4(%ebp) 80102d8b: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102d8e: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80102d92: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80102d96: ee out %al,(%dx) } 80102d97: c9 leave 80102d98: c3 ret 80102d99 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80102d99: 55 push %ebp 80102d9a: 89 e5 mov %esp,%ebp 80102d9c: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80102d9f: 9c pushf 80102da0: 58 pop %eax 80102da1: 89 45 fc mov %eax,-0x4(%ebp) return eflags; 80102da4: 8b 45 fc mov -0x4(%ebp),%eax } 80102da7: c9 leave 80102da8: c3 ret 80102da9 <lapicw>: volatile uint *lapic; // Initialized in mp.c static void lapicw(int index, int value) { 80102da9: 55 push %ebp 80102daa: 89 e5 mov %esp,%ebp lapic[index] = value; 80102dac: a1 dc 22 11 80 mov 0x801122dc,%eax 80102db1: 8b 55 08 mov 0x8(%ebp),%edx 80102db4: c1 e2 02 shl $0x2,%edx 80102db7: 01 c2 add %eax,%edx 80102db9: 8b 45 0c mov 0xc(%ebp),%eax 80102dbc: 89 02 mov %eax,(%edx) lapic[ID]; // wait for write to finish, by reading 80102dbe: a1 dc 22 11 80 mov 0x801122dc,%eax 80102dc3: 83 c0 20 add $0x20,%eax 80102dc6: 8b 00 mov (%eax),%eax } 80102dc8: 5d pop %ebp 80102dc9: c3 ret 80102dca <lapicinit>: //PAGEBREAK! void lapicinit(void) { 80102dca: 55 push %ebp 80102dcb: 89 e5 mov %esp,%ebp if(!lapic) 80102dcd: a1 dc 22 11 80 mov 0x801122dc,%eax 80102dd2: 85 c0 test %eax,%eax 80102dd4: 75 05 jne 80102ddb <lapicinit+0x11> return; 80102dd6: e9 09 01 00 00 jmp 80102ee4 <lapicinit+0x11a> // Enable local APIC; set spurious interrupt vector. lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS)); 80102ddb: 68 3f 01 00 00 push $0x13f 80102de0: 6a 3c push $0x3c 80102de2: e8 c2 ff ff ff call 80102da9 <lapicw> 80102de7: 83 c4 08 add $0x8,%esp // The timer repeatedly counts down at bus frequency // from lapic[TICR] and then issues an interrupt. // If xv6 cared more about precise timekeeping, // TICR would be calibrated using an external time source. lapicw(TDCR, X1); 80102dea: 6a 0b push $0xb 80102dec: 68 f8 00 00 00 push $0xf8 80102df1: e8 b3 ff ff ff call 80102da9 <lapicw> 80102df6: 83 c4 08 add $0x8,%esp lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER)); 80102df9: 68 20 00 02 00 push $0x20020 80102dfe: 68 c8 00 00 00 push $0xc8 80102e03: e8 a1 ff ff ff call 80102da9 <lapicw> 80102e08: 83 c4 08 add $0x8,%esp lapicw(TICR, 10000000); 80102e0b: 68 80 96 98 00 push $0x989680 80102e10: 68 e0 00 00 00 push $0xe0 80102e15: e8 8f ff ff ff call 80102da9 <lapicw> 80102e1a: 83 c4 08 add $0x8,%esp // Disable logical interrupt lines. lapicw(LINT0, MASKED); 80102e1d: 68 00 00 01 00 push $0x10000 80102e22: 68 d4 00 00 00 push $0xd4 80102e27: e8 7d ff ff ff call 80102da9 <lapicw> 80102e2c: 83 c4 08 add $0x8,%esp lapicw(LINT1, MASKED); 80102e2f: 68 00 00 01 00 push $0x10000 80102e34: 68 d8 00 00 00 push $0xd8 80102e39: e8 6b ff ff ff call 80102da9 <lapicw> 80102e3e: 83 c4 08 add $0x8,%esp // Disable performance counter overflow interrupts // on machines that provide that interrupt entry. if(((lapic[VER]>>16) & 0xFF) >= 4) 80102e41: a1 dc 22 11 80 mov 0x801122dc,%eax 80102e46: 83 c0 30 add $0x30,%eax 80102e49: 8b 00 mov (%eax),%eax 80102e4b: c1 e8 10 shr $0x10,%eax 80102e4e: 0f b6 c0 movzbl %al,%eax 80102e51: 83 f8 03 cmp $0x3,%eax 80102e54: 76 12 jbe 80102e68 <lapicinit+0x9e> lapicw(PCINT, MASKED); 80102e56: 68 00 00 01 00 push $0x10000 80102e5b: 68 d0 00 00 00 push $0xd0 80102e60: e8 44 ff ff ff call 80102da9 <lapicw> 80102e65: 83 c4 08 add $0x8,%esp // Map error interrupt to IRQ_ERROR. lapicw(ERROR, T_IRQ0 + IRQ_ERROR); 80102e68: 6a 33 push $0x33 80102e6a: 68 dc 00 00 00 push $0xdc 80102e6f: e8 35 ff ff ff call 80102da9 <lapicw> 80102e74: 83 c4 08 add $0x8,%esp // Clear error status register (requires back-to-back writes). lapicw(ESR, 0); 80102e77: 6a 00 push $0x0 80102e79: 68 a0 00 00 00 push $0xa0 80102e7e: e8 26 ff ff ff call 80102da9 <lapicw> 80102e83: 83 c4 08 add $0x8,%esp lapicw(ESR, 0); 80102e86: 6a 00 push $0x0 80102e88: 68 a0 00 00 00 push $0xa0 80102e8d: e8 17 ff ff ff call 80102da9 <lapicw> 80102e92: 83 c4 08 add $0x8,%esp // Ack any outstanding interrupts. lapicw(EOI, 0); 80102e95: 6a 00 push $0x0 80102e97: 6a 2c push $0x2c 80102e99: e8 0b ff ff ff call 80102da9 <lapicw> 80102e9e: 83 c4 08 add $0x8,%esp // Send an Init Level De-Assert to synchronise arbitration ID's. lapicw(ICRHI, 0); 80102ea1: 6a 00 push $0x0 80102ea3: 68 c4 00 00 00 push $0xc4 80102ea8: e8 fc fe ff ff call 80102da9 <lapicw> 80102ead: 83 c4 08 add $0x8,%esp lapicw(ICRLO, BCAST | INIT | LEVEL); 80102eb0: 68 00 85 08 00 push $0x88500 80102eb5: 68 c0 00 00 00 push $0xc0 80102eba: e8 ea fe ff ff call 80102da9 <lapicw> 80102ebf: 83 c4 08 add $0x8,%esp while(lapic[ICRLO] & DELIVS) 80102ec2: 90 nop 80102ec3: a1 dc 22 11 80 mov 0x801122dc,%eax 80102ec8: 05 00 03 00 00 add $0x300,%eax 80102ecd: 8b 00 mov (%eax),%eax 80102ecf: 25 00 10 00 00 and $0x1000,%eax 80102ed4: 85 c0 test %eax,%eax 80102ed6: 75 eb jne 80102ec3 <lapicinit+0xf9> ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); 80102ed8: 6a 00 push $0x0 80102eda: 6a 20 push $0x20 80102edc: e8 c8 fe ff ff call 80102da9 <lapicw> 80102ee1: 83 c4 08 add $0x8,%esp } 80102ee4: c9 leave 80102ee5: c3 ret 80102ee6 <cpunum>: int cpunum(void) { 80102ee6: 55 push %ebp 80102ee7: 89 e5 mov %esp,%ebp 80102ee9: 83 ec 08 sub $0x8,%esp // Cannot call cpu when interrupts are enabled: // result not guaranteed to last long enough to be used! // Would prefer to panic but even printing is chancy here: // almost everything, including cprintf and panic, calls cpu, // often indirectly through acquire and release. if(readeflags()&FL_IF){ 80102eec: e8 a8 fe ff ff call 80102d99 <readeflags> 80102ef1: 25 00 02 00 00 and $0x200,%eax 80102ef6: 85 c0 test %eax,%eax 80102ef8: 74 26 je 80102f20 <cpunum+0x3a> static int n; if(n++ == 0) 80102efa: a1 60 b6 10 80 mov 0x8010b660,%eax 80102eff: 8d 50 01 lea 0x1(%eax),%edx 80102f02: 89 15 60 b6 10 80 mov %edx,0x8010b660 80102f08: 85 c0 test %eax,%eax 80102f0a: 75 14 jne 80102f20 <cpunum+0x3a> cprintf("cpu called from %x with interrupts enabled\n", 80102f0c: 8b 45 04 mov 0x4(%ebp),%eax 80102f0f: 83 ec 08 sub $0x8,%esp 80102f12: 50 push %eax 80102f13: 68 a0 86 10 80 push $0x801086a0 80102f18: e8 a2 d4 ff ff call 801003bf <cprintf> 80102f1d: 83 c4 10 add $0x10,%esp __builtin_return_address(0)); } if(lapic) 80102f20: a1 dc 22 11 80 mov 0x801122dc,%eax 80102f25: 85 c0 test %eax,%eax 80102f27: 74 0f je 80102f38 <cpunum+0x52> return lapic[ID]>>24; 80102f29: a1 dc 22 11 80 mov 0x801122dc,%eax 80102f2e: 83 c0 20 add $0x20,%eax 80102f31: 8b 00 mov (%eax),%eax 80102f33: c1 e8 18 shr $0x18,%eax 80102f36: eb 05 jmp 80102f3d <cpunum+0x57> return 0; 80102f38: b8 00 00 00 00 mov $0x0,%eax } 80102f3d: c9 leave 80102f3e: c3 ret 80102f3f <lapiceoi>: // Acknowledge interrupt. void lapiceoi(void) { 80102f3f: 55 push %ebp 80102f40: 89 e5 mov %esp,%ebp if(lapic) 80102f42: a1 dc 22 11 80 mov 0x801122dc,%eax 80102f47: 85 c0 test %eax,%eax 80102f49: 74 0c je 80102f57 <lapiceoi+0x18> lapicw(EOI, 0); 80102f4b: 6a 00 push $0x0 80102f4d: 6a 2c push $0x2c 80102f4f: e8 55 fe ff ff call 80102da9 <lapicw> 80102f54: 83 c4 08 add $0x8,%esp } 80102f57: c9 leave 80102f58: c3 ret 80102f59 <microdelay>: // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { 80102f59: 55 push %ebp 80102f5a: 89 e5 mov %esp,%ebp } 80102f5c: 5d pop %ebp 80102f5d: c3 ret 80102f5e <lapicstartap>: // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 80102f5e: 55 push %ebp 80102f5f: 89 e5 mov %esp,%ebp 80102f61: 83 ec 14 sub $0x14,%esp 80102f64: 8b 45 08 mov 0x8(%ebp),%eax 80102f67: 88 45 ec mov %al,-0x14(%ebp) ushort *wrv; // "The BSP must initialize CMOS shutdown code to 0AH // and the warm reset vector (DWORD based at 40:67) to point at // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code 80102f6a: 6a 0f push $0xf 80102f6c: 6a 70 push $0x70 80102f6e: e8 08 fe ff ff call 80102d7b <outb> 80102f73: 83 c4 08 add $0x8,%esp outb(CMOS_PORT+1, 0x0A); 80102f76: 6a 0a push $0xa 80102f78: 6a 71 push $0x71 80102f7a: e8 fc fd ff ff call 80102d7b <outb> 80102f7f: 83 c4 08 add $0x8,%esp wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector 80102f82: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp) wrv[0] = 0; 80102f89: 8b 45 f8 mov -0x8(%ebp),%eax 80102f8c: 66 c7 00 00 00 movw $0x0,(%eax) wrv[1] = addr >> 4; 80102f91: 8b 45 f8 mov -0x8(%ebp),%eax 80102f94: 83 c0 02 add $0x2,%eax 80102f97: 8b 55 0c mov 0xc(%ebp),%edx 80102f9a: c1 ea 04 shr $0x4,%edx 80102f9d: 66 89 10 mov %dx,(%eax) // "Universal startup algorithm." // Send INIT (level-triggered) interrupt to reset other CPU. lapicw(ICRHI, apicid<<24); 80102fa0: 0f b6 45 ec movzbl -0x14(%ebp),%eax 80102fa4: c1 e0 18 shl $0x18,%eax 80102fa7: 50 push %eax 80102fa8: 68 c4 00 00 00 push $0xc4 80102fad: e8 f7 fd ff ff call 80102da9 <lapicw> 80102fb2: 83 c4 08 add $0x8,%esp lapicw(ICRLO, INIT | LEVEL | ASSERT); 80102fb5: 68 00 c5 00 00 push $0xc500 80102fba: 68 c0 00 00 00 push $0xc0 80102fbf: e8 e5 fd ff ff call 80102da9 <lapicw> 80102fc4: 83 c4 08 add $0x8,%esp microdelay(200); 80102fc7: 68 c8 00 00 00 push $0xc8 80102fcc: e8 88 ff ff ff call 80102f59 <microdelay> 80102fd1: 83 c4 04 add $0x4,%esp lapicw(ICRLO, INIT | LEVEL); 80102fd4: 68 00 85 00 00 push $0x8500 80102fd9: 68 c0 00 00 00 push $0xc0 80102fde: e8 c6 fd ff ff call 80102da9 <lapicw> 80102fe3: 83 c4 08 add $0x8,%esp microdelay(100); // should be 10ms, but too slow in Bochs! 80102fe6: 6a 64 push $0x64 80102fe8: e8 6c ff ff ff call 80102f59 <microdelay> 80102fed: 83 c4 04 add $0x4,%esp // Send startup IPI (twice!) to enter code. // Regular hardware is supposed to only accept a STARTUP // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ 80102ff0: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80102ff7: eb 3d jmp 80103036 <lapicstartap+0xd8> lapicw(ICRHI, apicid<<24); 80102ff9: 0f b6 45 ec movzbl -0x14(%ebp),%eax 80102ffd: c1 e0 18 shl $0x18,%eax 80103000: 50 push %eax 80103001: 68 c4 00 00 00 push $0xc4 80103006: e8 9e fd ff ff call 80102da9 <lapicw> 8010300b: 83 c4 08 add $0x8,%esp lapicw(ICRLO, STARTUP | (addr>>12)); 8010300e: 8b 45 0c mov 0xc(%ebp),%eax 80103011: c1 e8 0c shr $0xc,%eax 80103014: 80 cc 06 or $0x6,%ah 80103017: 50 push %eax 80103018: 68 c0 00 00 00 push $0xc0 8010301d: e8 87 fd ff ff call 80102da9 <lapicw> 80103022: 83 c4 08 add $0x8,%esp microdelay(200); 80103025: 68 c8 00 00 00 push $0xc8 8010302a: e8 2a ff ff ff call 80102f59 <microdelay> 8010302f: 83 c4 04 add $0x4,%esp // Send startup IPI (twice!) to enter code. // Regular hardware is supposed to only accept a STARTUP // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ 80103032: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80103036: 83 7d fc 01 cmpl $0x1,-0x4(%ebp) 8010303a: 7e bd jle 80102ff9 <lapicstartap+0x9b> lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); microdelay(200); } } 8010303c: c9 leave 8010303d: c3 ret 8010303e <cmos_read>: #define DAY 0x07 #define MONTH 0x08 #define YEAR 0x09 static uint cmos_read(uint reg) { 8010303e: 55 push %ebp 8010303f: 89 e5 mov %esp,%ebp outb(CMOS_PORT, reg); 80103041: 8b 45 08 mov 0x8(%ebp),%eax 80103044: 0f b6 c0 movzbl %al,%eax 80103047: 50 push %eax 80103048: 6a 70 push $0x70 8010304a: e8 2c fd ff ff call 80102d7b <outb> 8010304f: 83 c4 08 add $0x8,%esp microdelay(200); 80103052: 68 c8 00 00 00 push $0xc8 80103057: e8 fd fe ff ff call 80102f59 <microdelay> 8010305c: 83 c4 04 add $0x4,%esp return inb(CMOS_RETURN); 8010305f: 6a 71 push $0x71 80103061: e8 f8 fc ff ff call 80102d5e <inb> 80103066: 83 c4 04 add $0x4,%esp 80103069: 0f b6 c0 movzbl %al,%eax } 8010306c: c9 leave 8010306d: c3 ret 8010306e <fill_rtcdate>: static void fill_rtcdate(struct rtcdate *r) { 8010306e: 55 push %ebp 8010306f: 89 e5 mov %esp,%ebp r->second = cmos_read(SECS); 80103071: 6a 00 push $0x0 80103073: e8 c6 ff ff ff call 8010303e <cmos_read> 80103078: 83 c4 04 add $0x4,%esp 8010307b: 89 c2 mov %eax,%edx 8010307d: 8b 45 08 mov 0x8(%ebp),%eax 80103080: 89 10 mov %edx,(%eax) r->minute = cmos_read(MINS); 80103082: 6a 02 push $0x2 80103084: e8 b5 ff ff ff call 8010303e <cmos_read> 80103089: 83 c4 04 add $0x4,%esp 8010308c: 89 c2 mov %eax,%edx 8010308e: 8b 45 08 mov 0x8(%ebp),%eax 80103091: 89 50 04 mov %edx,0x4(%eax) r->hour = cmos_read(HOURS); 80103094: 6a 04 push $0x4 80103096: e8 a3 ff ff ff call 8010303e <cmos_read> 8010309b: 83 c4 04 add $0x4,%esp 8010309e: 89 c2 mov %eax,%edx 801030a0: 8b 45 08 mov 0x8(%ebp),%eax 801030a3: 89 50 08 mov %edx,0x8(%eax) r->day = cmos_read(DAY); 801030a6: 6a 07 push $0x7 801030a8: e8 91 ff ff ff call 8010303e <cmos_read> 801030ad: 83 c4 04 add $0x4,%esp 801030b0: 89 c2 mov %eax,%edx 801030b2: 8b 45 08 mov 0x8(%ebp),%eax 801030b5: 89 50 0c mov %edx,0xc(%eax) r->month = cmos_read(MONTH); 801030b8: 6a 08 push $0x8 801030ba: e8 7f ff ff ff call 8010303e <cmos_read> 801030bf: 83 c4 04 add $0x4,%esp 801030c2: 89 c2 mov %eax,%edx 801030c4: 8b 45 08 mov 0x8(%ebp),%eax 801030c7: 89 50 10 mov %edx,0x10(%eax) r->year = cmos_read(YEAR); 801030ca: 6a 09 push $0x9 801030cc: e8 6d ff ff ff call 8010303e <cmos_read> 801030d1: 83 c4 04 add $0x4,%esp 801030d4: 89 c2 mov %eax,%edx 801030d6: 8b 45 08 mov 0x8(%ebp),%eax 801030d9: 89 50 14 mov %edx,0x14(%eax) } 801030dc: c9 leave 801030dd: c3 ret 801030de <cmostime>: // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 801030de: 55 push %ebp 801030df: 89 e5 mov %esp,%ebp 801030e1: 83 ec 48 sub $0x48,%esp struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); 801030e4: 6a 0b push $0xb 801030e6: e8 53 ff ff ff call 8010303e <cmos_read> 801030eb: 83 c4 04 add $0x4,%esp 801030ee: 89 45 f4 mov %eax,-0xc(%ebp) bcd = (sb & (1 << 2)) == 0; 801030f1: 8b 45 f4 mov -0xc(%ebp),%eax 801030f4: 83 e0 04 and $0x4,%eax 801030f7: 85 c0 test %eax,%eax 801030f9: 0f 94 c0 sete %al 801030fc: 0f b6 c0 movzbl %al,%eax 801030ff: 89 45 f0 mov %eax,-0x10(%ebp) // make sure CMOS doesn't modify time while we read it for (;;) { fill_rtcdate(&t1); 80103102: 8d 45 d8 lea -0x28(%ebp),%eax 80103105: 50 push %eax 80103106: e8 63 ff ff ff call 8010306e <fill_rtcdate> 8010310b: 83 c4 04 add $0x4,%esp if (cmos_read(CMOS_STATA) & CMOS_UIP) 8010310e: 6a 0a push $0xa 80103110: e8 29 ff ff ff call 8010303e <cmos_read> 80103115: 83 c4 04 add $0x4,%esp 80103118: 25 80 00 00 00 and $0x80,%eax 8010311d: 85 c0 test %eax,%eax 8010311f: 74 02 je 80103123 <cmostime+0x45> continue; 80103121: eb 32 jmp 80103155 <cmostime+0x77> fill_rtcdate(&t2); 80103123: 8d 45 c0 lea -0x40(%ebp),%eax 80103126: 50 push %eax 80103127: e8 42 ff ff ff call 8010306e <fill_rtcdate> 8010312c: 83 c4 04 add $0x4,%esp if (memcmp(&t1, &t2, sizeof(t1)) == 0) 8010312f: 83 ec 04 sub $0x4,%esp 80103132: 6a 18 push $0x18 80103134: 8d 45 c0 lea -0x40(%ebp),%eax 80103137: 50 push %eax 80103138: 8d 45 d8 lea -0x28(%ebp),%eax 8010313b: 50 push %eax 8010313c: e8 70 20 00 00 call 801051b1 <memcmp> 80103141: 83 c4 10 add $0x10,%esp 80103144: 85 c0 test %eax,%eax 80103146: 75 0d jne 80103155 <cmostime+0x77> break; 80103148: 90 nop } // convert if (bcd) { 80103149: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010314d: 0f 84 b8 00 00 00 je 8010320b <cmostime+0x12d> 80103153: eb 02 jmp 80103157 <cmostime+0x79> if (cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) break; } 80103155: eb ab jmp 80103102 <cmostime+0x24> // convert if (bcd) { #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 80103157: 8b 45 d8 mov -0x28(%ebp),%eax 8010315a: c1 e8 04 shr $0x4,%eax 8010315d: 89 c2 mov %eax,%edx 8010315f: 89 d0 mov %edx,%eax 80103161: c1 e0 02 shl $0x2,%eax 80103164: 01 d0 add %edx,%eax 80103166: 01 c0 add %eax,%eax 80103168: 89 c2 mov %eax,%edx 8010316a: 8b 45 d8 mov -0x28(%ebp),%eax 8010316d: 83 e0 0f and $0xf,%eax 80103170: 01 d0 add %edx,%eax 80103172: 89 45 d8 mov %eax,-0x28(%ebp) CONV(minute); 80103175: 8b 45 dc mov -0x24(%ebp),%eax 80103178: c1 e8 04 shr $0x4,%eax 8010317b: 89 c2 mov %eax,%edx 8010317d: 89 d0 mov %edx,%eax 8010317f: c1 e0 02 shl $0x2,%eax 80103182: 01 d0 add %edx,%eax 80103184: 01 c0 add %eax,%eax 80103186: 89 c2 mov %eax,%edx 80103188: 8b 45 dc mov -0x24(%ebp),%eax 8010318b: 83 e0 0f and $0xf,%eax 8010318e: 01 d0 add %edx,%eax 80103190: 89 45 dc mov %eax,-0x24(%ebp) CONV(hour ); 80103193: 8b 45 e0 mov -0x20(%ebp),%eax 80103196: c1 e8 04 shr $0x4,%eax 80103199: 89 c2 mov %eax,%edx 8010319b: 89 d0 mov %edx,%eax 8010319d: c1 e0 02 shl $0x2,%eax 801031a0: 01 d0 add %edx,%eax 801031a2: 01 c0 add %eax,%eax 801031a4: 89 c2 mov %eax,%edx 801031a6: 8b 45 e0 mov -0x20(%ebp),%eax 801031a9: 83 e0 0f and $0xf,%eax 801031ac: 01 d0 add %edx,%eax 801031ae: 89 45 e0 mov %eax,-0x20(%ebp) CONV(day ); 801031b1: 8b 45 e4 mov -0x1c(%ebp),%eax 801031b4: c1 e8 04 shr $0x4,%eax 801031b7: 89 c2 mov %eax,%edx 801031b9: 89 d0 mov %edx,%eax 801031bb: c1 e0 02 shl $0x2,%eax 801031be: 01 d0 add %edx,%eax 801031c0: 01 c0 add %eax,%eax 801031c2: 89 c2 mov %eax,%edx 801031c4: 8b 45 e4 mov -0x1c(%ebp),%eax 801031c7: 83 e0 0f and $0xf,%eax 801031ca: 01 d0 add %edx,%eax 801031cc: 89 45 e4 mov %eax,-0x1c(%ebp) CONV(month ); 801031cf: 8b 45 e8 mov -0x18(%ebp),%eax 801031d2: c1 e8 04 shr $0x4,%eax 801031d5: 89 c2 mov %eax,%edx 801031d7: 89 d0 mov %edx,%eax 801031d9: c1 e0 02 shl $0x2,%eax 801031dc: 01 d0 add %edx,%eax 801031de: 01 c0 add %eax,%eax 801031e0: 89 c2 mov %eax,%edx 801031e2: 8b 45 e8 mov -0x18(%ebp),%eax 801031e5: 83 e0 0f and $0xf,%eax 801031e8: 01 d0 add %edx,%eax 801031ea: 89 45 e8 mov %eax,-0x18(%ebp) CONV(year ); 801031ed: 8b 45 ec mov -0x14(%ebp),%eax 801031f0: c1 e8 04 shr $0x4,%eax 801031f3: 89 c2 mov %eax,%edx 801031f5: 89 d0 mov %edx,%eax 801031f7: c1 e0 02 shl $0x2,%eax 801031fa: 01 d0 add %edx,%eax 801031fc: 01 c0 add %eax,%eax 801031fe: 89 c2 mov %eax,%edx 80103200: 8b 45 ec mov -0x14(%ebp),%eax 80103203: 83 e0 0f and $0xf,%eax 80103206: 01 d0 add %edx,%eax 80103208: 89 45 ec mov %eax,-0x14(%ebp) #undef CONV } *r = t1; 8010320b: 8b 45 08 mov 0x8(%ebp),%eax 8010320e: 8b 55 d8 mov -0x28(%ebp),%edx 80103211: 89 10 mov %edx,(%eax) 80103213: 8b 55 dc mov -0x24(%ebp),%edx 80103216: 89 50 04 mov %edx,0x4(%eax) 80103219: 8b 55 e0 mov -0x20(%ebp),%edx 8010321c: 89 50 08 mov %edx,0x8(%eax) 8010321f: 8b 55 e4 mov -0x1c(%ebp),%edx 80103222: 89 50 0c mov %edx,0xc(%eax) 80103225: 8b 55 e8 mov -0x18(%ebp),%edx 80103228: 89 50 10 mov %edx,0x10(%eax) 8010322b: 8b 55 ec mov -0x14(%ebp),%edx 8010322e: 89 50 14 mov %edx,0x14(%eax) r->year += 2000; 80103231: 8b 45 08 mov 0x8(%ebp),%eax 80103234: 8b 40 14 mov 0x14(%eax),%eax 80103237: 8d 90 d0 07 00 00 lea 0x7d0(%eax),%edx 8010323d: 8b 45 08 mov 0x8(%ebp),%eax 80103240: 89 50 14 mov %edx,0x14(%eax) } 80103243: c9 leave 80103244: c3 ret 80103245 <initlog>: static void recover_from_log(void); static void commit(); void initlog(void) { 80103245: 55 push %ebp 80103246: 89 e5 mov %esp,%ebp 80103248: 83 ec 18 sub $0x18,%esp if (sizeof(struct logheader) >= BSIZE) panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); 8010324b: 83 ec 08 sub $0x8,%esp 8010324e: 68 cc 86 10 80 push $0x801086cc 80103253: 68 00 23 11 80 push $0x80112300 80103258: e8 70 1c 00 00 call 80104ecd <initlock> 8010325d: 83 c4 10 add $0x10,%esp readsb(ROOTDEV, &sb); 80103260: 83 ec 08 sub $0x8,%esp 80103263: 8d 45 e8 lea -0x18(%ebp),%eax 80103266: 50 push %eax 80103267: 6a 01 push $0x1 80103269: e8 d1 e0 ff ff call 8010133f <readsb> 8010326e: 83 c4 10 add $0x10,%esp log.start = sb.size - sb.nlog; 80103271: 8b 55 e8 mov -0x18(%ebp),%edx 80103274: 8b 45 f4 mov -0xc(%ebp),%eax 80103277: 29 c2 sub %eax,%edx 80103279: 89 d0 mov %edx,%eax 8010327b: a3 34 23 11 80 mov %eax,0x80112334 log.size = sb.nlog; 80103280: 8b 45 f4 mov -0xc(%ebp),%eax 80103283: a3 38 23 11 80 mov %eax,0x80112338 log.dev = ROOTDEV; 80103288: c7 05 44 23 11 80 01 movl $0x1,0x80112344 8010328f: 00 00 00 recover_from_log(); 80103292: e8 ae 01 00 00 call 80103445 <recover_from_log> } 80103297: c9 leave 80103298: c3 ret 80103299 <install_trans>: // Copy committed blocks from log to their home location static void install_trans(void) { 80103299: 55 push %ebp 8010329a: 89 e5 mov %esp,%ebp 8010329c: 83 ec 18 sub $0x18,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 8010329f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801032a6: e9 95 00 00 00 jmp 80103340 <install_trans+0xa7> struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 801032ab: 8b 15 34 23 11 80 mov 0x80112334,%edx 801032b1: 8b 45 f4 mov -0xc(%ebp),%eax 801032b4: 01 d0 add %edx,%eax 801032b6: 83 c0 01 add $0x1,%eax 801032b9: 89 c2 mov %eax,%edx 801032bb: a1 44 23 11 80 mov 0x80112344,%eax 801032c0: 83 ec 08 sub $0x8,%esp 801032c3: 52 push %edx 801032c4: 50 push %eax 801032c5: e8 ea ce ff ff call 801001b4 <bread> 801032ca: 83 c4 10 add $0x10,%esp 801032cd: 89 45 f0 mov %eax,-0x10(%ebp) struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst 801032d0: 8b 45 f4 mov -0xc(%ebp),%eax 801032d3: 83 c0 10 add $0x10,%eax 801032d6: 8b 04 85 0c 23 11 80 mov -0x7feedcf4(,%eax,4),%eax 801032dd: 89 c2 mov %eax,%edx 801032df: a1 44 23 11 80 mov 0x80112344,%eax 801032e4: 83 ec 08 sub $0x8,%esp 801032e7: 52 push %edx 801032e8: 50 push %eax 801032e9: e8 c6 ce ff ff call 801001b4 <bread> 801032ee: 83 c4 10 add $0x10,%esp 801032f1: 89 45 ec mov %eax,-0x14(%ebp) memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 801032f4: 8b 45 f0 mov -0x10(%ebp),%eax 801032f7: 8d 50 18 lea 0x18(%eax),%edx 801032fa: 8b 45 ec mov -0x14(%ebp),%eax 801032fd: 83 c0 18 add $0x18,%eax 80103300: 83 ec 04 sub $0x4,%esp 80103303: 68 00 02 00 00 push $0x200 80103308: 52 push %edx 80103309: 50 push %eax 8010330a: e8 fa 1e 00 00 call 80105209 <memmove> 8010330f: 83 c4 10 add $0x10,%esp bwrite(dbuf); // write dst to disk 80103312: 83 ec 0c sub $0xc,%esp 80103315: ff 75 ec pushl -0x14(%ebp) 80103318: e8 d0 ce ff ff call 801001ed <bwrite> 8010331d: 83 c4 10 add $0x10,%esp brelse(lbuf); 80103320: 83 ec 0c sub $0xc,%esp 80103323: ff 75 f0 pushl -0x10(%ebp) 80103326: e8 00 cf ff ff call 8010022b <brelse> 8010332b: 83 c4 10 add $0x10,%esp brelse(dbuf); 8010332e: 83 ec 0c sub $0xc,%esp 80103331: ff 75 ec pushl -0x14(%ebp) 80103334: e8 f2 ce ff ff call 8010022b <brelse> 80103339: 83 c4 10 add $0x10,%esp static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 8010333c: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103340: a1 48 23 11 80 mov 0x80112348,%eax 80103345: 3b 45 f4 cmp -0xc(%ebp),%eax 80103348: 0f 8f 5d ff ff ff jg 801032ab <install_trans+0x12> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst bwrite(dbuf); // write dst to disk brelse(lbuf); brelse(dbuf); } } 8010334e: c9 leave 8010334f: c3 ret 80103350 <read_head>: // Read the log header from disk into the in-memory log header static void read_head(void) { 80103350: 55 push %ebp 80103351: 89 e5 mov %esp,%ebp 80103353: 83 ec 18 sub $0x18,%esp struct buf *buf = bread(log.dev, log.start); 80103356: a1 34 23 11 80 mov 0x80112334,%eax 8010335b: 89 c2 mov %eax,%edx 8010335d: a1 44 23 11 80 mov 0x80112344,%eax 80103362: 83 ec 08 sub $0x8,%esp 80103365: 52 push %edx 80103366: 50 push %eax 80103367: e8 48 ce ff ff call 801001b4 <bread> 8010336c: 83 c4 10 add $0x10,%esp 8010336f: 89 45 f0 mov %eax,-0x10(%ebp) struct logheader *lh = (struct logheader *) (buf->data); 80103372: 8b 45 f0 mov -0x10(%ebp),%eax 80103375: 83 c0 18 add $0x18,%eax 80103378: 89 45 ec mov %eax,-0x14(%ebp) int i; log.lh.n = lh->n; 8010337b: 8b 45 ec mov -0x14(%ebp),%eax 8010337e: 8b 00 mov (%eax),%eax 80103380: a3 48 23 11 80 mov %eax,0x80112348 for (i = 0; i < log.lh.n; i++) { 80103385: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010338c: eb 1b jmp 801033a9 <read_head+0x59> log.lh.sector[i] = lh->sector[i]; 8010338e: 8b 45 ec mov -0x14(%ebp),%eax 80103391: 8b 55 f4 mov -0xc(%ebp),%edx 80103394: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax 80103398: 8b 55 f4 mov -0xc(%ebp),%edx 8010339b: 83 c2 10 add $0x10,%edx 8010339e: 89 04 95 0c 23 11 80 mov %eax,-0x7feedcf4(,%edx,4) { struct buf *buf = bread(log.dev, log.start); struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; for (i = 0; i < log.lh.n; i++) { 801033a5: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801033a9: a1 48 23 11 80 mov 0x80112348,%eax 801033ae: 3b 45 f4 cmp -0xc(%ebp),%eax 801033b1: 7f db jg 8010338e <read_head+0x3e> log.lh.sector[i] = lh->sector[i]; } brelse(buf); 801033b3: 83 ec 0c sub $0xc,%esp 801033b6: ff 75 f0 pushl -0x10(%ebp) 801033b9: e8 6d ce ff ff call 8010022b <brelse> 801033be: 83 c4 10 add $0x10,%esp } 801033c1: c9 leave 801033c2: c3 ret 801033c3 <write_head>: // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { 801033c3: 55 push %ebp 801033c4: 89 e5 mov %esp,%ebp 801033c6: 83 ec 18 sub $0x18,%esp struct buf *buf = bread(log.dev, log.start); 801033c9: a1 34 23 11 80 mov 0x80112334,%eax 801033ce: 89 c2 mov %eax,%edx 801033d0: a1 44 23 11 80 mov 0x80112344,%eax 801033d5: 83 ec 08 sub $0x8,%esp 801033d8: 52 push %edx 801033d9: 50 push %eax 801033da: e8 d5 cd ff ff call 801001b4 <bread> 801033df: 83 c4 10 add $0x10,%esp 801033e2: 89 45 f0 mov %eax,-0x10(%ebp) struct logheader *hb = (struct logheader *) (buf->data); 801033e5: 8b 45 f0 mov -0x10(%ebp),%eax 801033e8: 83 c0 18 add $0x18,%eax 801033eb: 89 45 ec mov %eax,-0x14(%ebp) int i; hb->n = log.lh.n; 801033ee: 8b 15 48 23 11 80 mov 0x80112348,%edx 801033f4: 8b 45 ec mov -0x14(%ebp),%eax 801033f7: 89 10 mov %edx,(%eax) for (i = 0; i < log.lh.n; i++) { 801033f9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103400: eb 1b jmp 8010341d <write_head+0x5a> hb->sector[i] = log.lh.sector[i]; 80103402: 8b 45 f4 mov -0xc(%ebp),%eax 80103405: 83 c0 10 add $0x10,%eax 80103408: 8b 0c 85 0c 23 11 80 mov -0x7feedcf4(,%eax,4),%ecx 8010340f: 8b 45 ec mov -0x14(%ebp),%eax 80103412: 8b 55 f4 mov -0xc(%ebp),%edx 80103415: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4) { struct buf *buf = bread(log.dev, log.start); struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; for (i = 0; i < log.lh.n; i++) { 80103419: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010341d: a1 48 23 11 80 mov 0x80112348,%eax 80103422: 3b 45 f4 cmp -0xc(%ebp),%eax 80103425: 7f db jg 80103402 <write_head+0x3f> hb->sector[i] = log.lh.sector[i]; } bwrite(buf); 80103427: 83 ec 0c sub $0xc,%esp 8010342a: ff 75 f0 pushl -0x10(%ebp) 8010342d: e8 bb cd ff ff call 801001ed <bwrite> 80103432: 83 c4 10 add $0x10,%esp brelse(buf); 80103435: 83 ec 0c sub $0xc,%esp 80103438: ff 75 f0 pushl -0x10(%ebp) 8010343b: e8 eb cd ff ff call 8010022b <brelse> 80103440: 83 c4 10 add $0x10,%esp } 80103443: c9 leave 80103444: c3 ret 80103445 <recover_from_log>: static void recover_from_log(void) { 80103445: 55 push %ebp 80103446: 89 e5 mov %esp,%ebp 80103448: 83 ec 08 sub $0x8,%esp read_head(); 8010344b: e8 00 ff ff ff call 80103350 <read_head> install_trans(); // if committed, copy from log to disk 80103450: e8 44 fe ff ff call 80103299 <install_trans> log.lh.n = 0; 80103455: c7 05 48 23 11 80 00 movl $0x0,0x80112348 8010345c: 00 00 00 write_head(); // clear the log 8010345f: e8 5f ff ff ff call 801033c3 <write_head> } 80103464: c9 leave 80103465: c3 ret 80103466 <begin_op>: // called at the start of each FS system call. void begin_op(void) { 80103466: 55 push %ebp 80103467: 89 e5 mov %esp,%ebp 80103469: 83 ec 08 sub $0x8,%esp acquire(&log.lock); 8010346c: 83 ec 0c sub $0xc,%esp 8010346f: 68 00 23 11 80 push $0x80112300 80103474: e8 75 1a 00 00 call 80104eee <acquire> 80103479: 83 c4 10 add $0x10,%esp while(1){ if(log.committing){ 8010347c: a1 40 23 11 80 mov 0x80112340,%eax 80103481: 85 c0 test %eax,%eax 80103483: 74 17 je 8010349c <begin_op+0x36> sleep(&log, &log.lock); 80103485: 83 ec 08 sub $0x8,%esp 80103488: 68 00 23 11 80 push $0x80112300 8010348d: 68 00 23 11 80 push $0x80112300 80103492: e8 5e 17 00 00 call 80104bf5 <sleep> 80103497: 83 c4 10 add $0x10,%esp 8010349a: eb 54 jmp 801034f0 <begin_op+0x8a> } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 8010349c: 8b 0d 48 23 11 80 mov 0x80112348,%ecx 801034a2: a1 3c 23 11 80 mov 0x8011233c,%eax 801034a7: 8d 50 01 lea 0x1(%eax),%edx 801034aa: 89 d0 mov %edx,%eax 801034ac: c1 e0 02 shl $0x2,%eax 801034af: 01 d0 add %edx,%eax 801034b1: 01 c0 add %eax,%eax 801034b3: 01 c8 add %ecx,%eax 801034b5: 83 f8 1e cmp $0x1e,%eax 801034b8: 7e 17 jle 801034d1 <begin_op+0x6b> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); 801034ba: 83 ec 08 sub $0x8,%esp 801034bd: 68 00 23 11 80 push $0x80112300 801034c2: 68 00 23 11 80 push $0x80112300 801034c7: e8 29 17 00 00 call 80104bf5 <sleep> 801034cc: 83 c4 10 add $0x10,%esp 801034cf: eb 1f jmp 801034f0 <begin_op+0x8a> } else { log.outstanding += 1; 801034d1: a1 3c 23 11 80 mov 0x8011233c,%eax 801034d6: 83 c0 01 add $0x1,%eax 801034d9: a3 3c 23 11 80 mov %eax,0x8011233c release(&log.lock); 801034de: 83 ec 0c sub $0xc,%esp 801034e1: 68 00 23 11 80 push $0x80112300 801034e6: e8 69 1a 00 00 call 80104f54 <release> 801034eb: 83 c4 10 add $0x10,%esp break; 801034ee: eb 02 jmp 801034f2 <begin_op+0x8c> } } 801034f0: eb 8a jmp 8010347c <begin_op+0x16> } 801034f2: c9 leave 801034f3: c3 ret 801034f4 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 801034f4: 55 push %ebp 801034f5: 89 e5 mov %esp,%ebp 801034f7: 83 ec 18 sub $0x18,%esp int do_commit = 0; 801034fa: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) acquire(&log.lock); 80103501: 83 ec 0c sub $0xc,%esp 80103504: 68 00 23 11 80 push $0x80112300 80103509: e8 e0 19 00 00 call 80104eee <acquire> 8010350e: 83 c4 10 add $0x10,%esp log.outstanding -= 1; 80103511: a1 3c 23 11 80 mov 0x8011233c,%eax 80103516: 83 e8 01 sub $0x1,%eax 80103519: a3 3c 23 11 80 mov %eax,0x8011233c if(log.committing) 8010351e: a1 40 23 11 80 mov 0x80112340,%eax 80103523: 85 c0 test %eax,%eax 80103525: 74 0d je 80103534 <end_op+0x40> panic("log.committing"); 80103527: 83 ec 0c sub $0xc,%esp 8010352a: 68 d0 86 10 80 push $0x801086d0 8010352f: e8 28 d0 ff ff call 8010055c <panic> if(log.outstanding == 0){ 80103534: a1 3c 23 11 80 mov 0x8011233c,%eax 80103539: 85 c0 test %eax,%eax 8010353b: 75 13 jne 80103550 <end_op+0x5c> do_commit = 1; 8010353d: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) log.committing = 1; 80103544: c7 05 40 23 11 80 01 movl $0x1,0x80112340 8010354b: 00 00 00 8010354e: eb 10 jmp 80103560 <end_op+0x6c> } else { // begin_op() may be waiting for log space. wakeup(&log); 80103550: 83 ec 0c sub $0xc,%esp 80103553: 68 00 23 11 80 push $0x80112300 80103558: e8 84 17 00 00 call 80104ce1 <wakeup> 8010355d: 83 c4 10 add $0x10,%esp } release(&log.lock); 80103560: 83 ec 0c sub $0xc,%esp 80103563: 68 00 23 11 80 push $0x80112300 80103568: e8 e7 19 00 00 call 80104f54 <release> 8010356d: 83 c4 10 add $0x10,%esp if(do_commit){ 80103570: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80103574: 74 3f je 801035b5 <end_op+0xc1> // call commit w/o holding locks, since not allowed // to sleep with locks. commit(); 80103576: e8 f3 00 00 00 call 8010366e <commit> acquire(&log.lock); 8010357b: 83 ec 0c sub $0xc,%esp 8010357e: 68 00 23 11 80 push $0x80112300 80103583: e8 66 19 00 00 call 80104eee <acquire> 80103588: 83 c4 10 add $0x10,%esp log.committing = 0; 8010358b: c7 05 40 23 11 80 00 movl $0x0,0x80112340 80103592: 00 00 00 wakeup(&log); 80103595: 83 ec 0c sub $0xc,%esp 80103598: 68 00 23 11 80 push $0x80112300 8010359d: e8 3f 17 00 00 call 80104ce1 <wakeup> 801035a2: 83 c4 10 add $0x10,%esp release(&log.lock); 801035a5: 83 ec 0c sub $0xc,%esp 801035a8: 68 00 23 11 80 push $0x80112300 801035ad: e8 a2 19 00 00 call 80104f54 <release> 801035b2: 83 c4 10 add $0x10,%esp } } 801035b5: c9 leave 801035b6: c3 ret 801035b7 <write_log>: // Copy modified blocks from cache to log. static void write_log(void) { 801035b7: 55 push %ebp 801035b8: 89 e5 mov %esp,%ebp 801035ba: 83 ec 18 sub $0x18,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 801035bd: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801035c4: e9 95 00 00 00 jmp 8010365e <write_log+0xa7> struct buf *to = bread(log.dev, log.start+tail+1); // log block 801035c9: 8b 15 34 23 11 80 mov 0x80112334,%edx 801035cf: 8b 45 f4 mov -0xc(%ebp),%eax 801035d2: 01 d0 add %edx,%eax 801035d4: 83 c0 01 add $0x1,%eax 801035d7: 89 c2 mov %eax,%edx 801035d9: a1 44 23 11 80 mov 0x80112344,%eax 801035de: 83 ec 08 sub $0x8,%esp 801035e1: 52 push %edx 801035e2: 50 push %eax 801035e3: e8 cc cb ff ff call 801001b4 <bread> 801035e8: 83 c4 10 add $0x10,%esp 801035eb: 89 45 f0 mov %eax,-0x10(%ebp) struct buf *from = bread(log.dev, log.lh.sector[tail]); // cache block 801035ee: 8b 45 f4 mov -0xc(%ebp),%eax 801035f1: 83 c0 10 add $0x10,%eax 801035f4: 8b 04 85 0c 23 11 80 mov -0x7feedcf4(,%eax,4),%eax 801035fb: 89 c2 mov %eax,%edx 801035fd: a1 44 23 11 80 mov 0x80112344,%eax 80103602: 83 ec 08 sub $0x8,%esp 80103605: 52 push %edx 80103606: 50 push %eax 80103607: e8 a8 cb ff ff call 801001b4 <bread> 8010360c: 83 c4 10 add $0x10,%esp 8010360f: 89 45 ec mov %eax,-0x14(%ebp) memmove(to->data, from->data, BSIZE); 80103612: 8b 45 ec mov -0x14(%ebp),%eax 80103615: 8d 50 18 lea 0x18(%eax),%edx 80103618: 8b 45 f0 mov -0x10(%ebp),%eax 8010361b: 83 c0 18 add $0x18,%eax 8010361e: 83 ec 04 sub $0x4,%esp 80103621: 68 00 02 00 00 push $0x200 80103626: 52 push %edx 80103627: 50 push %eax 80103628: e8 dc 1b 00 00 call 80105209 <memmove> 8010362d: 83 c4 10 add $0x10,%esp bwrite(to); // write the log 80103630: 83 ec 0c sub $0xc,%esp 80103633: ff 75 f0 pushl -0x10(%ebp) 80103636: e8 b2 cb ff ff call 801001ed <bwrite> 8010363b: 83 c4 10 add $0x10,%esp brelse(from); 8010363e: 83 ec 0c sub $0xc,%esp 80103641: ff 75 ec pushl -0x14(%ebp) 80103644: e8 e2 cb ff ff call 8010022b <brelse> 80103649: 83 c4 10 add $0x10,%esp brelse(to); 8010364c: 83 ec 0c sub $0xc,%esp 8010364f: ff 75 f0 pushl -0x10(%ebp) 80103652: e8 d4 cb ff ff call 8010022b <brelse> 80103657: 83 c4 10 add $0x10,%esp static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 8010365a: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010365e: a1 48 23 11 80 mov 0x80112348,%eax 80103663: 3b 45 f4 cmp -0xc(%ebp),%eax 80103666: 0f 8f 5d ff ff ff jg 801035c9 <write_log+0x12> memmove(to->data, from->data, BSIZE); bwrite(to); // write the log brelse(from); brelse(to); } } 8010366c: c9 leave 8010366d: c3 ret 8010366e <commit>: static void commit() { 8010366e: 55 push %ebp 8010366f: 89 e5 mov %esp,%ebp 80103671: 83 ec 08 sub $0x8,%esp if (log.lh.n > 0) { 80103674: a1 48 23 11 80 mov 0x80112348,%eax 80103679: 85 c0 test %eax,%eax 8010367b: 7e 1e jle 8010369b <commit+0x2d> write_log(); // Write modified blocks from cache to log 8010367d: e8 35 ff ff ff call 801035b7 <write_log> write_head(); // Write header to disk -- the real commit 80103682: e8 3c fd ff ff call 801033c3 <write_head> install_trans(); // Now install writes to home locations 80103687: e8 0d fc ff ff call 80103299 <install_trans> log.lh.n = 0; 8010368c: c7 05 48 23 11 80 00 movl $0x0,0x80112348 80103693: 00 00 00 write_head(); // Erase the transaction from the log 80103696: e8 28 fd ff ff call 801033c3 <write_head> } } 8010369b: c9 leave 8010369c: c3 ret 8010369d <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 8010369d: 55 push %ebp 8010369e: 89 e5 mov %esp,%ebp 801036a0: 83 ec 18 sub $0x18,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 801036a3: a1 48 23 11 80 mov 0x80112348,%eax 801036a8: 83 f8 1d cmp $0x1d,%eax 801036ab: 7f 12 jg 801036bf <log_write+0x22> 801036ad: a1 48 23 11 80 mov 0x80112348,%eax 801036b2: 8b 15 38 23 11 80 mov 0x80112338,%edx 801036b8: 83 ea 01 sub $0x1,%edx 801036bb: 39 d0 cmp %edx,%eax 801036bd: 7c 0d jl 801036cc <log_write+0x2f> panic("too big a transaction"); 801036bf: 83 ec 0c sub $0xc,%esp 801036c2: 68 df 86 10 80 push $0x801086df 801036c7: e8 90 ce ff ff call 8010055c <panic> if (log.outstanding < 1) 801036cc: a1 3c 23 11 80 mov 0x8011233c,%eax 801036d1: 85 c0 test %eax,%eax 801036d3: 7f 0d jg 801036e2 <log_write+0x45> panic("log_write outside of trans"); 801036d5: 83 ec 0c sub $0xc,%esp 801036d8: 68 f5 86 10 80 push $0x801086f5 801036dd: e8 7a ce ff ff call 8010055c <panic> for (i = 0; i < log.lh.n; i++) { 801036e2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801036e9: eb 1f jmp 8010370a <log_write+0x6d> if (log.lh.sector[i] == b->sector) // log absorbtion 801036eb: 8b 45 f4 mov -0xc(%ebp),%eax 801036ee: 83 c0 10 add $0x10,%eax 801036f1: 8b 04 85 0c 23 11 80 mov -0x7feedcf4(,%eax,4),%eax 801036f8: 89 c2 mov %eax,%edx 801036fa: 8b 45 08 mov 0x8(%ebp),%eax 801036fd: 8b 40 08 mov 0x8(%eax),%eax 80103700: 39 c2 cmp %eax,%edx 80103702: 75 02 jne 80103706 <log_write+0x69> break; 80103704: eb 0e jmp 80103714 <log_write+0x77> if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) panic("too big a transaction"); if (log.outstanding < 1) panic("log_write outside of trans"); for (i = 0; i < log.lh.n; i++) { 80103706: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010370a: a1 48 23 11 80 mov 0x80112348,%eax 8010370f: 3b 45 f4 cmp -0xc(%ebp),%eax 80103712: 7f d7 jg 801036eb <log_write+0x4e> if (log.lh.sector[i] == b->sector) // log absorbtion break; } log.lh.sector[i] = b->sector; 80103714: 8b 45 08 mov 0x8(%ebp),%eax 80103717: 8b 40 08 mov 0x8(%eax),%eax 8010371a: 89 c2 mov %eax,%edx 8010371c: 8b 45 f4 mov -0xc(%ebp),%eax 8010371f: 83 c0 10 add $0x10,%eax 80103722: 89 14 85 0c 23 11 80 mov %edx,-0x7feedcf4(,%eax,4) if (i == log.lh.n) 80103729: a1 48 23 11 80 mov 0x80112348,%eax 8010372e: 3b 45 f4 cmp -0xc(%ebp),%eax 80103731: 75 0d jne 80103740 <log_write+0xa3> log.lh.n++; 80103733: a1 48 23 11 80 mov 0x80112348,%eax 80103738: 83 c0 01 add $0x1,%eax 8010373b: a3 48 23 11 80 mov %eax,0x80112348 b->flags |= B_DIRTY; // prevent eviction 80103740: 8b 45 08 mov 0x8(%ebp),%eax 80103743: 8b 00 mov (%eax),%eax 80103745: 83 c8 04 or $0x4,%eax 80103748: 89 c2 mov %eax,%edx 8010374a: 8b 45 08 mov 0x8(%ebp),%eax 8010374d: 89 10 mov %edx,(%eax) } 8010374f: c9 leave 80103750: c3 ret 80103751 <v2p>: 80103751: 55 push %ebp 80103752: 89 e5 mov %esp,%ebp 80103754: 8b 45 08 mov 0x8(%ebp),%eax 80103757: 05 00 00 00 80 add $0x80000000,%eax 8010375c: 5d pop %ebp 8010375d: c3 ret 8010375e <p2v>: static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } 8010375e: 55 push %ebp 8010375f: 89 e5 mov %esp,%ebp 80103761: 8b 45 08 mov 0x8(%ebp),%eax 80103764: 05 00 00 00 80 add $0x80000000,%eax 80103769: 5d pop %ebp 8010376a: c3 ret 8010376b <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 8010376b: 55 push %ebp 8010376c: 89 e5 mov %esp,%ebp 8010376e: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80103771: 8b 55 08 mov 0x8(%ebp),%edx 80103774: 8b 45 0c mov 0xc(%ebp),%eax 80103777: 8b 4d 08 mov 0x8(%ebp),%ecx 8010377a: f0 87 02 lock xchg %eax,(%edx) 8010377d: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80103780: 8b 45 fc mov -0x4(%ebp),%eax } 80103783: c9 leave 80103784: c3 ret 80103785 <main>: // Bootstrap processor starts running C code here. // Allocate a real stack and switch to it, first // doing some setup required for memory allocator to work. int main(void) { 80103785: 8d 4c 24 04 lea 0x4(%esp),%ecx 80103789: 83 e4 f0 and $0xfffffff0,%esp 8010378c: ff 71 fc pushl -0x4(%ecx) 8010378f: 55 push %ebp 80103790: 89 e5 mov %esp,%ebp 80103792: 51 push %ecx 80103793: 83 ec 04 sub $0x4,%esp kinit1(end, P2V(4*1024*1024)); // phys page allocator 80103796: 83 ec 08 sub $0x8,%esp 80103799: 68 00 00 40 80 push $0x80400000 8010379e: 68 1c 54 11 80 push $0x8011541c 801037a3: e8 aa f2 ff ff call 80102a52 <kinit1> 801037a8: 83 c4 10 add $0x10,%esp kvmalloc(); // kernel page table 801037ab: e8 aa 45 00 00 call 80107d5a <kvmalloc> mpinit(); // collect info about this machine 801037b0: e8 45 04 00 00 call 80103bfa <mpinit> lapicinit(); 801037b5: e8 10 f6 ff ff call 80102dca <lapicinit> seginit(); // set up segments 801037ba: e8 43 3f 00 00 call 80107702 <seginit> cprintf("\ncpu%d: starting xv6\n\n", cpu->id); 801037bf: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801037c5: 0f b6 00 movzbl (%eax),%eax 801037c8: 0f b6 c0 movzbl %al,%eax 801037cb: 83 ec 08 sub $0x8,%esp 801037ce: 50 push %eax 801037cf: 68 10 87 10 80 push $0x80108710 801037d4: e8 e6 cb ff ff call 801003bf <cprintf> 801037d9: 83 c4 10 add $0x10,%esp picinit(); // interrupt controller 801037dc: e8 6a 06 00 00 call 80103e4b <picinit> ioapicinit(); // another interrupt controller 801037e1: e8 64 f1 ff ff call 8010294a <ioapicinit> consoleinit(); // I/O devices & their interrupts 801037e6: e8 ed d2 ff ff call 80100ad8 <consoleinit> uartinit(); // serial port 801037eb: e8 75 32 00 00 call 80106a65 <uartinit> pinit(); // process table 801037f0: e8 55 0b 00 00 call 8010434a <pinit> tvinit(); // trap vectors 801037f5: e8 3a 2e 00 00 call 80106634 <tvinit> binit(); // buffer cache 801037fa: e8 35 c8 ff ff call 80100034 <binit> fileinit(); // file table 801037ff: e8 2f d7 ff ff call 80100f33 <fileinit> iinit(); // inode cache 80103804: e8 02 de ff ff call 8010160b <iinit> ideinit(); // disk 80103809: e8 84 ed ff ff call 80102592 <ideinit> if(!ismp) 8010380e: a1 04 24 11 80 mov 0x80112404,%eax 80103813: 85 c0 test %eax,%eax 80103815: 75 05 jne 8010381c <main+0x97> timerinit(); // uniprocessor timer 80103817: e8 77 2d 00 00 call 80106593 <timerinit> startothers(); // start other processors 8010381c: e8 7f 00 00 00 call 801038a0 <startothers> kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() 80103821: 83 ec 08 sub $0x8,%esp 80103824: 68 00 00 00 8e push $0x8e000000 80103829: 68 00 00 40 80 push $0x80400000 8010382e: e8 57 f2 ff ff call 80102a8a <kinit2> 80103833: 83 c4 10 add $0x10,%esp userinit(); // first user process 80103836: e8 3e 0c 00 00 call 80104479 <userinit> // Finish setting up this processor in mpmain. mpmain(); 8010383b: e8 1a 00 00 00 call 8010385a <mpmain> 80103840 <mpenter>: } // Other CPUs jump here from entryother.S. static void mpenter(void) { 80103840: 55 push %ebp 80103841: 89 e5 mov %esp,%ebp 80103843: 83 ec 08 sub $0x8,%esp switchkvm(); 80103846: e8 26 45 00 00 call 80107d71 <switchkvm> seginit(); 8010384b: e8 b2 3e 00 00 call 80107702 <seginit> lapicinit(); 80103850: e8 75 f5 ff ff call 80102dca <lapicinit> mpmain(); 80103855: e8 00 00 00 00 call 8010385a <mpmain> 8010385a <mpmain>: } // Common CPU setup code. static void mpmain(void) { 8010385a: 55 push %ebp 8010385b: 89 e5 mov %esp,%ebp 8010385d: 83 ec 08 sub $0x8,%esp cprintf("cpu%d: starting\n", cpu->id); 80103860: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80103866: 0f b6 00 movzbl (%eax),%eax 80103869: 0f b6 c0 movzbl %al,%eax 8010386c: 83 ec 08 sub $0x8,%esp 8010386f: 50 push %eax 80103870: 68 27 87 10 80 push $0x80108727 80103875: e8 45 cb ff ff call 801003bf <cprintf> 8010387a: 83 c4 10 add $0x10,%esp idtinit(); // load idt register 8010387d: e8 27 2f 00 00 call 801067a9 <idtinit> xchg(&cpu->started, 1); // tell startothers() we're up 80103882: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80103888: 05 a8 00 00 00 add $0xa8,%eax 8010388d: 83 ec 08 sub $0x8,%esp 80103890: 6a 01 push $0x1 80103892: 50 push %eax 80103893: e8 d3 fe ff ff call 8010376b <xchg> 80103898: 83 c4 10 add $0x10,%esp scheduler(); // start running processes 8010389b: e8 89 11 00 00 call 80104a29 <scheduler> 801038a0 <startothers>: pde_t entrypgdir[]; // For entry.S // Start the non-boot (AP) processors. static void startothers(void) { 801038a0: 55 push %ebp 801038a1: 89 e5 mov %esp,%ebp 801038a3: 53 push %ebx 801038a4: 83 ec 14 sub $0x14,%esp char *stack; // Write entry code to unused memory at 0x7000. // The linker has placed the image of entryother.S in // _binary_entryother_start. code = p2v(0x7000); 801038a7: 68 00 70 00 00 push $0x7000 801038ac: e8 ad fe ff ff call 8010375e <p2v> 801038b1: 83 c4 04 add $0x4,%esp 801038b4: 89 45 f0 mov %eax,-0x10(%ebp) memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); 801038b7: b8 8a 00 00 00 mov $0x8a,%eax 801038bc: 83 ec 04 sub $0x4,%esp 801038bf: 50 push %eax 801038c0: 68 2c b5 10 80 push $0x8010b52c 801038c5: ff 75 f0 pushl -0x10(%ebp) 801038c8: e8 3c 19 00 00 call 80105209 <memmove> 801038cd: 83 c4 10 add $0x10,%esp for(c = cpus; c < cpus+ncpu; c++){ 801038d0: c7 45 f4 40 24 11 80 movl $0x80112440,-0xc(%ebp) 801038d7: e9 8f 00 00 00 jmp 8010396b <startothers+0xcb> if(c == cpus+cpunum()) // We've started already. 801038dc: e8 05 f6 ff ff call 80102ee6 <cpunum> 801038e1: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 801038e7: 05 40 24 11 80 add $0x80112440,%eax 801038ec: 3b 45 f4 cmp -0xc(%ebp),%eax 801038ef: 75 02 jne 801038f3 <startothers+0x53> continue; 801038f1: eb 71 jmp 80103964 <startothers+0xc4> // 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(); 801038f3: e8 8d f2 ff ff call 80102b85 <kalloc> 801038f8: 89 45 ec mov %eax,-0x14(%ebp) *(void**)(code-4) = stack + KSTACKSIZE; 801038fb: 8b 45 f0 mov -0x10(%ebp),%eax 801038fe: 83 e8 04 sub $0x4,%eax 80103901: 8b 55 ec mov -0x14(%ebp),%edx 80103904: 81 c2 00 10 00 00 add $0x1000,%edx 8010390a: 89 10 mov %edx,(%eax) *(void**)(code-8) = mpenter; 8010390c: 8b 45 f0 mov -0x10(%ebp),%eax 8010390f: 83 e8 08 sub $0x8,%eax 80103912: c7 00 40 38 10 80 movl $0x80103840,(%eax) *(int**)(code-12) = (void *) v2p(entrypgdir); 80103918: 8b 45 f0 mov -0x10(%ebp),%eax 8010391b: 8d 58 f4 lea -0xc(%eax),%ebx 8010391e: 83 ec 0c sub $0xc,%esp 80103921: 68 00 a0 10 80 push $0x8010a000 80103926: e8 26 fe ff ff call 80103751 <v2p> 8010392b: 83 c4 10 add $0x10,%esp 8010392e: 89 03 mov %eax,(%ebx) lapicstartap(c->id, v2p(code)); 80103930: 83 ec 0c sub $0xc,%esp 80103933: ff 75 f0 pushl -0x10(%ebp) 80103936: e8 16 fe ff ff call 80103751 <v2p> 8010393b: 83 c4 10 add $0x10,%esp 8010393e: 89 c2 mov %eax,%edx 80103940: 8b 45 f4 mov -0xc(%ebp),%eax 80103943: 0f b6 00 movzbl (%eax),%eax 80103946: 0f b6 c0 movzbl %al,%eax 80103949: 83 ec 08 sub $0x8,%esp 8010394c: 52 push %edx 8010394d: 50 push %eax 8010394e: e8 0b f6 ff ff call 80102f5e <lapicstartap> 80103953: 83 c4 10 add $0x10,%esp // wait for cpu to finish mpmain() while(c->started == 0) 80103956: 90 nop 80103957: 8b 45 f4 mov -0xc(%ebp),%eax 8010395a: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 80103960: 85 c0 test %eax,%eax 80103962: 74 f3 je 80103957 <startothers+0xb7> // The linker has placed the image of entryother.S in // _binary_entryother_start. code = p2v(0x7000); memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); for(c = cpus; c < cpus+ncpu; c++){ 80103964: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp) 8010396b: a1 20 2a 11 80 mov 0x80112a20,%eax 80103970: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80103976: 05 40 24 11 80 add $0x80112440,%eax 8010397b: 3b 45 f4 cmp -0xc(%ebp),%eax 8010397e: 0f 87 58 ff ff ff ja 801038dc <startothers+0x3c> // wait for cpu to finish mpmain() while(c->started == 0) ; } } 80103984: 8b 5d fc mov -0x4(%ebp),%ebx 80103987: c9 leave 80103988: c3 ret 80103989 <p2v>: 80103989: 55 push %ebp 8010398a: 89 e5 mov %esp,%ebp 8010398c: 8b 45 08 mov 0x8(%ebp),%eax 8010398f: 05 00 00 00 80 add $0x80000000,%eax 80103994: 5d pop %ebp 80103995: c3 ret 80103996 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80103996: 55 push %ebp 80103997: 89 e5 mov %esp,%ebp 80103999: 83 ec 14 sub $0x14,%esp 8010399c: 8b 45 08 mov 0x8(%ebp),%eax 8010399f: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801039a3: 0f b7 45 ec movzwl -0x14(%ebp),%eax 801039a7: 89 c2 mov %eax,%edx 801039a9: ec in (%dx),%al 801039aa: 88 45 ff mov %al,-0x1(%ebp) return data; 801039ad: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 801039b1: c9 leave 801039b2: c3 ret 801039b3 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801039b3: 55 push %ebp 801039b4: 89 e5 mov %esp,%ebp 801039b6: 83 ec 08 sub $0x8,%esp 801039b9: 8b 55 08 mov 0x8(%ebp),%edx 801039bc: 8b 45 0c mov 0xc(%ebp),%eax 801039bf: 66 89 55 fc mov %dx,-0x4(%ebp) 801039c3: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801039c6: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 801039ca: 0f b7 55 fc movzwl -0x4(%ebp),%edx 801039ce: ee out %al,(%dx) } 801039cf: c9 leave 801039d0: c3 ret 801039d1 <mpbcpu>: int ncpu; uchar ioapicid; int mpbcpu(void) { 801039d1: 55 push %ebp 801039d2: 89 e5 mov %esp,%ebp return bcpu-cpus; 801039d4: a1 64 b6 10 80 mov 0x8010b664,%eax 801039d9: 89 c2 mov %eax,%edx 801039db: b8 40 24 11 80 mov $0x80112440,%eax 801039e0: 29 c2 sub %eax,%edx 801039e2: 89 d0 mov %edx,%eax 801039e4: c1 f8 02 sar $0x2,%eax 801039e7: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax } 801039ed: 5d pop %ebp 801039ee: c3 ret 801039ef <sum>: static uchar sum(uchar *addr, int len) { 801039ef: 55 push %ebp 801039f0: 89 e5 mov %esp,%ebp 801039f2: 83 ec 10 sub $0x10,%esp int i, sum; sum = 0; 801039f5: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) for(i=0; i<len; i++) 801039fc: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80103a03: eb 15 jmp 80103a1a <sum+0x2b> sum += addr[i]; 80103a05: 8b 55 fc mov -0x4(%ebp),%edx 80103a08: 8b 45 08 mov 0x8(%ebp),%eax 80103a0b: 01 d0 add %edx,%eax 80103a0d: 0f b6 00 movzbl (%eax),%eax 80103a10: 0f b6 c0 movzbl %al,%eax 80103a13: 01 45 f8 add %eax,-0x8(%ebp) sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80103a16: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80103a1a: 8b 45 fc mov -0x4(%ebp),%eax 80103a1d: 3b 45 0c cmp 0xc(%ebp),%eax 80103a20: 7c e3 jl 80103a05 <sum+0x16> sum += addr[i]; return sum; 80103a22: 8b 45 f8 mov -0x8(%ebp),%eax } 80103a25: c9 leave 80103a26: c3 ret 80103a27 <mpsearch1>: // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80103a27: 55 push %ebp 80103a28: 89 e5 mov %esp,%ebp 80103a2a: 83 ec 18 sub $0x18,%esp uchar *e, *p, *addr; addr = p2v(a); 80103a2d: ff 75 08 pushl 0x8(%ebp) 80103a30: e8 54 ff ff ff call 80103989 <p2v> 80103a35: 83 c4 04 add $0x4,%esp 80103a38: 89 45 f0 mov %eax,-0x10(%ebp) e = addr+len; 80103a3b: 8b 55 0c mov 0xc(%ebp),%edx 80103a3e: 8b 45 f0 mov -0x10(%ebp),%eax 80103a41: 01 d0 add %edx,%eax 80103a43: 89 45 ec mov %eax,-0x14(%ebp) for(p = addr; p < e; p += sizeof(struct mp)) 80103a46: 8b 45 f0 mov -0x10(%ebp),%eax 80103a49: 89 45 f4 mov %eax,-0xc(%ebp) 80103a4c: eb 36 jmp 80103a84 <mpsearch1+0x5d> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80103a4e: 83 ec 04 sub $0x4,%esp 80103a51: 6a 04 push $0x4 80103a53: 68 38 87 10 80 push $0x80108738 80103a58: ff 75 f4 pushl -0xc(%ebp) 80103a5b: e8 51 17 00 00 call 801051b1 <memcmp> 80103a60: 83 c4 10 add $0x10,%esp 80103a63: 85 c0 test %eax,%eax 80103a65: 75 19 jne 80103a80 <mpsearch1+0x59> 80103a67: 83 ec 08 sub $0x8,%esp 80103a6a: 6a 10 push $0x10 80103a6c: ff 75 f4 pushl -0xc(%ebp) 80103a6f: e8 7b ff ff ff call 801039ef <sum> 80103a74: 83 c4 10 add $0x10,%esp 80103a77: 84 c0 test %al,%al 80103a79: 75 05 jne 80103a80 <mpsearch1+0x59> return (struct mp*)p; 80103a7b: 8b 45 f4 mov -0xc(%ebp),%eax 80103a7e: eb 11 jmp 80103a91 <mpsearch1+0x6a> { uchar *e, *p, *addr; addr = p2v(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 80103a80: 83 45 f4 10 addl $0x10,-0xc(%ebp) 80103a84: 8b 45 f4 mov -0xc(%ebp),%eax 80103a87: 3b 45 ec cmp -0x14(%ebp),%eax 80103a8a: 72 c2 jb 80103a4e <mpsearch1+0x27> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; 80103a8c: b8 00 00 00 00 mov $0x0,%eax } 80103a91: c9 leave 80103a92: c3 ret 80103a93 <mpsearch>: // 1) in the first KB of the EBDA; // 2) in the last KB of system base memory; // 3) in the BIOS ROM between 0xE0000 and 0xFFFFF. static struct mp* mpsearch(void) { 80103a93: 55 push %ebp 80103a94: 89 e5 mov %esp,%ebp 80103a96: 83 ec 18 sub $0x18,%esp uchar *bda; uint p; struct mp *mp; bda = (uchar *) P2V(0x400); 80103a99: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp) if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ 80103aa0: 8b 45 f4 mov -0xc(%ebp),%eax 80103aa3: 83 c0 0f add $0xf,%eax 80103aa6: 0f b6 00 movzbl (%eax),%eax 80103aa9: 0f b6 c0 movzbl %al,%eax 80103aac: c1 e0 08 shl $0x8,%eax 80103aaf: 89 c2 mov %eax,%edx 80103ab1: 8b 45 f4 mov -0xc(%ebp),%eax 80103ab4: 83 c0 0e add $0xe,%eax 80103ab7: 0f b6 00 movzbl (%eax),%eax 80103aba: 0f b6 c0 movzbl %al,%eax 80103abd: 09 d0 or %edx,%eax 80103abf: c1 e0 04 shl $0x4,%eax 80103ac2: 89 45 f0 mov %eax,-0x10(%ebp) 80103ac5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80103ac9: 74 21 je 80103aec <mpsearch+0x59> if((mp = mpsearch1(p, 1024))) 80103acb: 83 ec 08 sub $0x8,%esp 80103ace: 68 00 04 00 00 push $0x400 80103ad3: ff 75 f0 pushl -0x10(%ebp) 80103ad6: e8 4c ff ff ff call 80103a27 <mpsearch1> 80103adb: 83 c4 10 add $0x10,%esp 80103ade: 89 45 ec mov %eax,-0x14(%ebp) 80103ae1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80103ae5: 74 51 je 80103b38 <mpsearch+0xa5> return mp; 80103ae7: 8b 45 ec mov -0x14(%ebp),%eax 80103aea: eb 61 jmp 80103b4d <mpsearch+0xba> } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; 80103aec: 8b 45 f4 mov -0xc(%ebp),%eax 80103aef: 83 c0 14 add $0x14,%eax 80103af2: 0f b6 00 movzbl (%eax),%eax 80103af5: 0f b6 c0 movzbl %al,%eax 80103af8: c1 e0 08 shl $0x8,%eax 80103afb: 89 c2 mov %eax,%edx 80103afd: 8b 45 f4 mov -0xc(%ebp),%eax 80103b00: 83 c0 13 add $0x13,%eax 80103b03: 0f b6 00 movzbl (%eax),%eax 80103b06: 0f b6 c0 movzbl %al,%eax 80103b09: 09 d0 or %edx,%eax 80103b0b: c1 e0 0a shl $0xa,%eax 80103b0e: 89 45 f0 mov %eax,-0x10(%ebp) if((mp = mpsearch1(p-1024, 1024))) 80103b11: 8b 45 f0 mov -0x10(%ebp),%eax 80103b14: 2d 00 04 00 00 sub $0x400,%eax 80103b19: 83 ec 08 sub $0x8,%esp 80103b1c: 68 00 04 00 00 push $0x400 80103b21: 50 push %eax 80103b22: e8 00 ff ff ff call 80103a27 <mpsearch1> 80103b27: 83 c4 10 add $0x10,%esp 80103b2a: 89 45 ec mov %eax,-0x14(%ebp) 80103b2d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80103b31: 74 05 je 80103b38 <mpsearch+0xa5> return mp; 80103b33: 8b 45 ec mov -0x14(%ebp),%eax 80103b36: eb 15 jmp 80103b4d <mpsearch+0xba> } return mpsearch1(0xF0000, 0x10000); 80103b38: 83 ec 08 sub $0x8,%esp 80103b3b: 68 00 00 01 00 push $0x10000 80103b40: 68 00 00 0f 00 push $0xf0000 80103b45: e8 dd fe ff ff call 80103a27 <mpsearch1> 80103b4a: 83 c4 10 add $0x10,%esp } 80103b4d: c9 leave 80103b4e: c3 ret 80103b4f <mpconfig>: // Check for correct signature, calculate the checksum and, // if correct, check the version. // To do: check extended table checksum. static struct mpconf* mpconfig(struct mp **pmp) { 80103b4f: 55 push %ebp 80103b50: 89 e5 mov %esp,%ebp 80103b52: 83 ec 18 sub $0x18,%esp struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103b55: e8 39 ff ff ff call 80103a93 <mpsearch> 80103b5a: 89 45 f4 mov %eax,-0xc(%ebp) 80103b5d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80103b61: 74 0a je 80103b6d <mpconfig+0x1e> 80103b63: 8b 45 f4 mov -0xc(%ebp),%eax 80103b66: 8b 40 04 mov 0x4(%eax),%eax 80103b69: 85 c0 test %eax,%eax 80103b6b: 75 0a jne 80103b77 <mpconfig+0x28> return 0; 80103b6d: b8 00 00 00 00 mov $0x0,%eax 80103b72: e9 81 00 00 00 jmp 80103bf8 <mpconfig+0xa9> conf = (struct mpconf*) p2v((uint) mp->physaddr); 80103b77: 8b 45 f4 mov -0xc(%ebp),%eax 80103b7a: 8b 40 04 mov 0x4(%eax),%eax 80103b7d: 83 ec 0c sub $0xc,%esp 80103b80: 50 push %eax 80103b81: e8 03 fe ff ff call 80103989 <p2v> 80103b86: 83 c4 10 add $0x10,%esp 80103b89: 89 45 f0 mov %eax,-0x10(%ebp) if(memcmp(conf, "PCMP", 4) != 0) 80103b8c: 83 ec 04 sub $0x4,%esp 80103b8f: 6a 04 push $0x4 80103b91: 68 3d 87 10 80 push $0x8010873d 80103b96: ff 75 f0 pushl -0x10(%ebp) 80103b99: e8 13 16 00 00 call 801051b1 <memcmp> 80103b9e: 83 c4 10 add $0x10,%esp 80103ba1: 85 c0 test %eax,%eax 80103ba3: 74 07 je 80103bac <mpconfig+0x5d> return 0; 80103ba5: b8 00 00 00 00 mov $0x0,%eax 80103baa: eb 4c jmp 80103bf8 <mpconfig+0xa9> if(conf->version != 1 && conf->version != 4) 80103bac: 8b 45 f0 mov -0x10(%ebp),%eax 80103baf: 0f b6 40 06 movzbl 0x6(%eax),%eax 80103bb3: 3c 01 cmp $0x1,%al 80103bb5: 74 12 je 80103bc9 <mpconfig+0x7a> 80103bb7: 8b 45 f0 mov -0x10(%ebp),%eax 80103bba: 0f b6 40 06 movzbl 0x6(%eax),%eax 80103bbe: 3c 04 cmp $0x4,%al 80103bc0: 74 07 je 80103bc9 <mpconfig+0x7a> return 0; 80103bc2: b8 00 00 00 00 mov $0x0,%eax 80103bc7: eb 2f jmp 80103bf8 <mpconfig+0xa9> if(sum((uchar*)conf, conf->length) != 0) 80103bc9: 8b 45 f0 mov -0x10(%ebp),%eax 80103bcc: 0f b7 40 04 movzwl 0x4(%eax),%eax 80103bd0: 0f b7 c0 movzwl %ax,%eax 80103bd3: 83 ec 08 sub $0x8,%esp 80103bd6: 50 push %eax 80103bd7: ff 75 f0 pushl -0x10(%ebp) 80103bda: e8 10 fe ff ff call 801039ef <sum> 80103bdf: 83 c4 10 add $0x10,%esp 80103be2: 84 c0 test %al,%al 80103be4: 74 07 je 80103bed <mpconfig+0x9e> return 0; 80103be6: b8 00 00 00 00 mov $0x0,%eax 80103beb: eb 0b jmp 80103bf8 <mpconfig+0xa9> *pmp = mp; 80103bed: 8b 45 08 mov 0x8(%ebp),%eax 80103bf0: 8b 55 f4 mov -0xc(%ebp),%edx 80103bf3: 89 10 mov %edx,(%eax) return conf; 80103bf5: 8b 45 f0 mov -0x10(%ebp),%eax } 80103bf8: c9 leave 80103bf9: c3 ret 80103bfa <mpinit>: void mpinit(void) { 80103bfa: 55 push %ebp 80103bfb: 89 e5 mov %esp,%ebp 80103bfd: 83 ec 28 sub $0x28,%esp struct mp *mp; struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; bcpu = &cpus[0]; 80103c00: c7 05 64 b6 10 80 40 movl $0x80112440,0x8010b664 80103c07: 24 11 80 if((conf = mpconfig(&mp)) == 0) 80103c0a: 83 ec 0c sub $0xc,%esp 80103c0d: 8d 45 e0 lea -0x20(%ebp),%eax 80103c10: 50 push %eax 80103c11: e8 39 ff ff ff call 80103b4f <mpconfig> 80103c16: 83 c4 10 add $0x10,%esp 80103c19: 89 45 f0 mov %eax,-0x10(%ebp) 80103c1c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80103c20: 75 05 jne 80103c27 <mpinit+0x2d> return; 80103c22: e9 94 01 00 00 jmp 80103dbb <mpinit+0x1c1> ismp = 1; 80103c27: c7 05 04 24 11 80 01 movl $0x1,0x80112404 80103c2e: 00 00 00 lapic = (uint*)conf->lapicaddr; 80103c31: 8b 45 f0 mov -0x10(%ebp),%eax 80103c34: 8b 40 24 mov 0x24(%eax),%eax 80103c37: a3 dc 22 11 80 mov %eax,0x801122dc for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 80103c3c: 8b 45 f0 mov -0x10(%ebp),%eax 80103c3f: 83 c0 2c add $0x2c,%eax 80103c42: 89 45 f4 mov %eax,-0xc(%ebp) 80103c45: 8b 45 f0 mov -0x10(%ebp),%eax 80103c48: 0f b7 40 04 movzwl 0x4(%eax),%eax 80103c4c: 0f b7 d0 movzwl %ax,%edx 80103c4f: 8b 45 f0 mov -0x10(%ebp),%eax 80103c52: 01 d0 add %edx,%eax 80103c54: 89 45 ec mov %eax,-0x14(%ebp) 80103c57: e9 f2 00 00 00 jmp 80103d4e <mpinit+0x154> switch(*p){ 80103c5c: 8b 45 f4 mov -0xc(%ebp),%eax 80103c5f: 0f b6 00 movzbl (%eax),%eax 80103c62: 0f b6 c0 movzbl %al,%eax 80103c65: 83 f8 04 cmp $0x4,%eax 80103c68: 0f 87 bc 00 00 00 ja 80103d2a <mpinit+0x130> 80103c6e: 8b 04 85 80 87 10 80 mov -0x7fef7880(,%eax,4),%eax 80103c75: ff e0 jmp *%eax case MPPROC: proc = (struct mpproc*)p; 80103c77: 8b 45 f4 mov -0xc(%ebp),%eax 80103c7a: 89 45 e8 mov %eax,-0x18(%ebp) if(ncpu != proc->apicid){ 80103c7d: 8b 45 e8 mov -0x18(%ebp),%eax 80103c80: 0f b6 40 01 movzbl 0x1(%eax),%eax 80103c84: 0f b6 d0 movzbl %al,%edx 80103c87: a1 20 2a 11 80 mov 0x80112a20,%eax 80103c8c: 39 c2 cmp %eax,%edx 80103c8e: 74 2b je 80103cbb <mpinit+0xc1> cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid); 80103c90: 8b 45 e8 mov -0x18(%ebp),%eax 80103c93: 0f b6 40 01 movzbl 0x1(%eax),%eax 80103c97: 0f b6 d0 movzbl %al,%edx 80103c9a: a1 20 2a 11 80 mov 0x80112a20,%eax 80103c9f: 83 ec 04 sub $0x4,%esp 80103ca2: 52 push %edx 80103ca3: 50 push %eax 80103ca4: 68 42 87 10 80 push $0x80108742 80103ca9: e8 11 c7 ff ff call 801003bf <cprintf> 80103cae: 83 c4 10 add $0x10,%esp ismp = 0; 80103cb1: c7 05 04 24 11 80 00 movl $0x0,0x80112404 80103cb8: 00 00 00 } if(proc->flags & MPBOOT) 80103cbb: 8b 45 e8 mov -0x18(%ebp),%eax 80103cbe: 0f b6 40 03 movzbl 0x3(%eax),%eax 80103cc2: 0f b6 c0 movzbl %al,%eax 80103cc5: 83 e0 02 and $0x2,%eax 80103cc8: 85 c0 test %eax,%eax 80103cca: 74 15 je 80103ce1 <mpinit+0xe7> bcpu = &cpus[ncpu]; 80103ccc: a1 20 2a 11 80 mov 0x80112a20,%eax 80103cd1: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80103cd7: 05 40 24 11 80 add $0x80112440,%eax 80103cdc: a3 64 b6 10 80 mov %eax,0x8010b664 cpus[ncpu].id = ncpu; 80103ce1: a1 20 2a 11 80 mov 0x80112a20,%eax 80103ce6: 8b 15 20 2a 11 80 mov 0x80112a20,%edx 80103cec: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80103cf2: 05 40 24 11 80 add $0x80112440,%eax 80103cf7: 88 10 mov %dl,(%eax) ncpu++; 80103cf9: a1 20 2a 11 80 mov 0x80112a20,%eax 80103cfe: 83 c0 01 add $0x1,%eax 80103d01: a3 20 2a 11 80 mov %eax,0x80112a20 p += sizeof(struct mpproc); 80103d06: 83 45 f4 14 addl $0x14,-0xc(%ebp) continue; 80103d0a: eb 42 jmp 80103d4e <mpinit+0x154> case MPIOAPIC: ioapic = (struct mpioapic*)p; 80103d0c: 8b 45 f4 mov -0xc(%ebp),%eax 80103d0f: 89 45 e4 mov %eax,-0x1c(%ebp) ioapicid = ioapic->apicno; 80103d12: 8b 45 e4 mov -0x1c(%ebp),%eax 80103d15: 0f b6 40 01 movzbl 0x1(%eax),%eax 80103d19: a2 00 24 11 80 mov %al,0x80112400 p += sizeof(struct mpioapic); 80103d1e: 83 45 f4 08 addl $0x8,-0xc(%ebp) continue; 80103d22: eb 2a jmp 80103d4e <mpinit+0x154> case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 80103d24: 83 45 f4 08 addl $0x8,-0xc(%ebp) continue; 80103d28: eb 24 jmp 80103d4e <mpinit+0x154> default: cprintf("mpinit: unknown config type %x\n", *p); 80103d2a: 8b 45 f4 mov -0xc(%ebp),%eax 80103d2d: 0f b6 00 movzbl (%eax),%eax 80103d30: 0f b6 c0 movzbl %al,%eax 80103d33: 83 ec 08 sub $0x8,%esp 80103d36: 50 push %eax 80103d37: 68 60 87 10 80 push $0x80108760 80103d3c: e8 7e c6 ff ff call 801003bf <cprintf> 80103d41: 83 c4 10 add $0x10,%esp ismp = 0; 80103d44: c7 05 04 24 11 80 00 movl $0x0,0x80112404 80103d4b: 00 00 00 bcpu = &cpus[0]; if((conf = mpconfig(&mp)) == 0) return; ismp = 1; lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 80103d4e: 8b 45 f4 mov -0xc(%ebp),%eax 80103d51: 3b 45 ec cmp -0x14(%ebp),%eax 80103d54: 0f 82 02 ff ff ff jb 80103c5c <mpinit+0x62> default: cprintf("mpinit: unknown config type %x\n", *p); ismp = 0; } } if(!ismp){ 80103d5a: a1 04 24 11 80 mov 0x80112404,%eax 80103d5f: 85 c0 test %eax,%eax 80103d61: 75 1d jne 80103d80 <mpinit+0x186> // Didn't like what we found; fall back to no MP. ncpu = 1; 80103d63: c7 05 20 2a 11 80 01 movl $0x1,0x80112a20 80103d6a: 00 00 00 lapic = 0; 80103d6d: c7 05 dc 22 11 80 00 movl $0x0,0x801122dc 80103d74: 00 00 00 ioapicid = 0; 80103d77: c6 05 00 24 11 80 00 movb $0x0,0x80112400 return; 80103d7e: eb 3b jmp 80103dbb <mpinit+0x1c1> } if(mp->imcrp){ 80103d80: 8b 45 e0 mov -0x20(%ebp),%eax 80103d83: 0f b6 40 0c movzbl 0xc(%eax),%eax 80103d87: 84 c0 test %al,%al 80103d89: 74 30 je 80103dbb <mpinit+0x1c1> // Bochs doesn't support IMCR, so this doesn't run on Bochs. // But it would on real hardware. outb(0x22, 0x70); // Select IMCR 80103d8b: 83 ec 08 sub $0x8,%esp 80103d8e: 6a 70 push $0x70 80103d90: 6a 22 push $0x22 80103d92: e8 1c fc ff ff call 801039b3 <outb> 80103d97: 83 c4 10 add $0x10,%esp outb(0x23, inb(0x23) | 1); // Mask external interrupts. 80103d9a: 83 ec 0c sub $0xc,%esp 80103d9d: 6a 23 push $0x23 80103d9f: e8 f2 fb ff ff call 80103996 <inb> 80103da4: 83 c4 10 add $0x10,%esp 80103da7: 83 c8 01 or $0x1,%eax 80103daa: 0f b6 c0 movzbl %al,%eax 80103dad: 83 ec 08 sub $0x8,%esp 80103db0: 50 push %eax 80103db1: 6a 23 push $0x23 80103db3: e8 fb fb ff ff call 801039b3 <outb> 80103db8: 83 c4 10 add $0x10,%esp } } 80103dbb: c9 leave 80103dbc: c3 ret 80103dbd <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80103dbd: 55 push %ebp 80103dbe: 89 e5 mov %esp,%ebp 80103dc0: 83 ec 08 sub $0x8,%esp 80103dc3: 8b 55 08 mov 0x8(%ebp),%edx 80103dc6: 8b 45 0c mov 0xc(%ebp),%eax 80103dc9: 66 89 55 fc mov %dx,-0x4(%ebp) 80103dcd: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103dd0: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80103dd4: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80103dd8: ee out %al,(%dx) } 80103dd9: c9 leave 80103dda: c3 ret 80103ddb <picsetmask>: // Initial IRQ mask has interrupt 2 enabled (for slave 8259A). static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE); static void picsetmask(ushort mask) { 80103ddb: 55 push %ebp 80103ddc: 89 e5 mov %esp,%ebp 80103dde: 83 ec 04 sub $0x4,%esp 80103de1: 8b 45 08 mov 0x8(%ebp),%eax 80103de4: 66 89 45 fc mov %ax,-0x4(%ebp) irqmask = mask; 80103de8: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80103dec: 66 a3 00 b0 10 80 mov %ax,0x8010b000 outb(IO_PIC1+1, mask); 80103df2: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80103df6: 0f b6 c0 movzbl %al,%eax 80103df9: 50 push %eax 80103dfa: 6a 21 push $0x21 80103dfc: e8 bc ff ff ff call 80103dbd <outb> 80103e01: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, mask >> 8); 80103e04: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80103e08: 66 c1 e8 08 shr $0x8,%ax 80103e0c: 0f b6 c0 movzbl %al,%eax 80103e0f: 50 push %eax 80103e10: 68 a1 00 00 00 push $0xa1 80103e15: e8 a3 ff ff ff call 80103dbd <outb> 80103e1a: 83 c4 08 add $0x8,%esp } 80103e1d: c9 leave 80103e1e: c3 ret 80103e1f <picenable>: void picenable(int irq) { 80103e1f: 55 push %ebp 80103e20: 89 e5 mov %esp,%ebp picsetmask(irqmask & ~(1<<irq)); 80103e22: 8b 45 08 mov 0x8(%ebp),%eax 80103e25: ba 01 00 00 00 mov $0x1,%edx 80103e2a: 89 c1 mov %eax,%ecx 80103e2c: d3 e2 shl %cl,%edx 80103e2e: 89 d0 mov %edx,%eax 80103e30: f7 d0 not %eax 80103e32: 89 c2 mov %eax,%edx 80103e34: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax 80103e3b: 21 d0 and %edx,%eax 80103e3d: 0f b7 c0 movzwl %ax,%eax 80103e40: 50 push %eax 80103e41: e8 95 ff ff ff call 80103ddb <picsetmask> 80103e46: 83 c4 04 add $0x4,%esp } 80103e49: c9 leave 80103e4a: c3 ret 80103e4b <picinit>: // Initialize the 8259A interrupt controllers. void picinit(void) { 80103e4b: 55 push %ebp 80103e4c: 89 e5 mov %esp,%ebp // mask all interrupts outb(IO_PIC1+1, 0xFF); 80103e4e: 68 ff 00 00 00 push $0xff 80103e53: 6a 21 push $0x21 80103e55: e8 63 ff ff ff call 80103dbd <outb> 80103e5a: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, 0xFF); 80103e5d: 68 ff 00 00 00 push $0xff 80103e62: 68 a1 00 00 00 push $0xa1 80103e67: e8 51 ff ff ff call 80103dbd <outb> 80103e6c: 83 c4 08 add $0x8,%esp // ICW1: 0001g0hi // g: 0 = edge triggering, 1 = level triggering // h: 0 = cascaded PICs, 1 = master only // i: 0 = no ICW4, 1 = ICW4 required outb(IO_PIC1, 0x11); 80103e6f: 6a 11 push $0x11 80103e71: 6a 20 push $0x20 80103e73: e8 45 ff ff ff call 80103dbd <outb> 80103e78: 83 c4 08 add $0x8,%esp // ICW2: Vector offset outb(IO_PIC1+1, T_IRQ0); 80103e7b: 6a 20 push $0x20 80103e7d: 6a 21 push $0x21 80103e7f: e8 39 ff ff ff call 80103dbd <outb> 80103e84: 83 c4 08 add $0x8,%esp // ICW3: (master PIC) bit mask of IR lines connected to slaves // (slave PIC) 3-bit # of slave's connection to master outb(IO_PIC1+1, 1<<IRQ_SLAVE); 80103e87: 6a 04 push $0x4 80103e89: 6a 21 push $0x21 80103e8b: e8 2d ff ff ff call 80103dbd <outb> 80103e90: 83 c4 08 add $0x8,%esp // m: 0 = slave PIC, 1 = master PIC // (ignored when b is 0, as the master/slave role // can be hardwired). // a: 1 = Automatic EOI mode // p: 0 = MCS-80/85 mode, 1 = intel x86 mode outb(IO_PIC1+1, 0x3); 80103e93: 6a 03 push $0x3 80103e95: 6a 21 push $0x21 80103e97: e8 21 ff ff ff call 80103dbd <outb> 80103e9c: 83 c4 08 add $0x8,%esp // Set up slave (8259A-2) outb(IO_PIC2, 0x11); // ICW1 80103e9f: 6a 11 push $0x11 80103ea1: 68 a0 00 00 00 push $0xa0 80103ea6: e8 12 ff ff ff call 80103dbd <outb> 80103eab: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2 80103eae: 6a 28 push $0x28 80103eb0: 68 a1 00 00 00 push $0xa1 80103eb5: e8 03 ff ff ff call 80103dbd <outb> 80103eba: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, IRQ_SLAVE); // ICW3 80103ebd: 6a 02 push $0x2 80103ebf: 68 a1 00 00 00 push $0xa1 80103ec4: e8 f4 fe ff ff call 80103dbd <outb> 80103ec9: 83 c4 08 add $0x8,%esp // NB Automatic EOI mode doesn't tend to work on the slave. // Linux source code says it's "to be investigated". outb(IO_PIC2+1, 0x3); // ICW4 80103ecc: 6a 03 push $0x3 80103ece: 68 a1 00 00 00 push $0xa1 80103ed3: e8 e5 fe ff ff call 80103dbd <outb> 80103ed8: 83 c4 08 add $0x8,%esp // OCW3: 0ef01prs // ef: 0x = NOP, 10 = clear specific mask, 11 = set specific mask // p: 0 = no polling, 1 = polling mode // rs: 0x = NOP, 10 = read IRR, 11 = read ISR outb(IO_PIC1, 0x68); // clear specific mask 80103edb: 6a 68 push $0x68 80103edd: 6a 20 push $0x20 80103edf: e8 d9 fe ff ff call 80103dbd <outb> 80103ee4: 83 c4 08 add $0x8,%esp outb(IO_PIC1, 0x0a); // read IRR by default 80103ee7: 6a 0a push $0xa 80103ee9: 6a 20 push $0x20 80103eeb: e8 cd fe ff ff call 80103dbd <outb> 80103ef0: 83 c4 08 add $0x8,%esp outb(IO_PIC2, 0x68); // OCW3 80103ef3: 6a 68 push $0x68 80103ef5: 68 a0 00 00 00 push $0xa0 80103efa: e8 be fe ff ff call 80103dbd <outb> 80103eff: 83 c4 08 add $0x8,%esp outb(IO_PIC2, 0x0a); // OCW3 80103f02: 6a 0a push $0xa 80103f04: 68 a0 00 00 00 push $0xa0 80103f09: e8 af fe ff ff call 80103dbd <outb> 80103f0e: 83 c4 08 add $0x8,%esp if(irqmask != 0xFFFF) 80103f11: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax 80103f18: 66 83 f8 ff cmp $0xffff,%ax 80103f1c: 74 13 je 80103f31 <picinit+0xe6> picsetmask(irqmask); 80103f1e: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax 80103f25: 0f b7 c0 movzwl %ax,%eax 80103f28: 50 push %eax 80103f29: e8 ad fe ff ff call 80103ddb <picsetmask> 80103f2e: 83 c4 04 add $0x4,%esp } 80103f31: c9 leave 80103f32: c3 ret 80103f33 <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 80103f33: 55 push %ebp 80103f34: 89 e5 mov %esp,%ebp 80103f36: 83 ec 18 sub $0x18,%esp struct pipe *p; p = 0; 80103f39: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) *f0 = *f1 = 0; 80103f40: 8b 45 0c mov 0xc(%ebp),%eax 80103f43: c7 00 00 00 00 00 movl $0x0,(%eax) 80103f49: 8b 45 0c mov 0xc(%ebp),%eax 80103f4c: 8b 10 mov (%eax),%edx 80103f4e: 8b 45 08 mov 0x8(%ebp),%eax 80103f51: 89 10 mov %edx,(%eax) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 80103f53: e8 f8 cf ff ff call 80100f50 <filealloc> 80103f58: 89 c2 mov %eax,%edx 80103f5a: 8b 45 08 mov 0x8(%ebp),%eax 80103f5d: 89 10 mov %edx,(%eax) 80103f5f: 8b 45 08 mov 0x8(%ebp),%eax 80103f62: 8b 00 mov (%eax),%eax 80103f64: 85 c0 test %eax,%eax 80103f66: 0f 84 cb 00 00 00 je 80104037 <pipealloc+0x104> 80103f6c: e8 df cf ff ff call 80100f50 <filealloc> 80103f71: 89 c2 mov %eax,%edx 80103f73: 8b 45 0c mov 0xc(%ebp),%eax 80103f76: 89 10 mov %edx,(%eax) 80103f78: 8b 45 0c mov 0xc(%ebp),%eax 80103f7b: 8b 00 mov (%eax),%eax 80103f7d: 85 c0 test %eax,%eax 80103f7f: 0f 84 b2 00 00 00 je 80104037 <pipealloc+0x104> goto bad; if((p = (struct pipe*)kalloc()) == 0) 80103f85: e8 fb eb ff ff call 80102b85 <kalloc> 80103f8a: 89 45 f4 mov %eax,-0xc(%ebp) 80103f8d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80103f91: 75 05 jne 80103f98 <pipealloc+0x65> goto bad; 80103f93: e9 9f 00 00 00 jmp 80104037 <pipealloc+0x104> p->readopen = 1; 80103f98: 8b 45 f4 mov -0xc(%ebp),%eax 80103f9b: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 80103fa2: 00 00 00 p->writeopen = 1; 80103fa5: 8b 45 f4 mov -0xc(%ebp),%eax 80103fa8: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 80103faf: 00 00 00 p->nwrite = 0; 80103fb2: 8b 45 f4 mov -0xc(%ebp),%eax 80103fb5: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 80103fbc: 00 00 00 p->nread = 0; 80103fbf: 8b 45 f4 mov -0xc(%ebp),%eax 80103fc2: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 80103fc9: 00 00 00 initlock(&p->lock, "pipe"); 80103fcc: 8b 45 f4 mov -0xc(%ebp),%eax 80103fcf: 83 ec 08 sub $0x8,%esp 80103fd2: 68 94 87 10 80 push $0x80108794 80103fd7: 50 push %eax 80103fd8: e8 f0 0e 00 00 call 80104ecd <initlock> 80103fdd: 83 c4 10 add $0x10,%esp (*f0)->type = FD_PIPE; 80103fe0: 8b 45 08 mov 0x8(%ebp),%eax 80103fe3: 8b 00 mov (%eax),%eax 80103fe5: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 80103feb: 8b 45 08 mov 0x8(%ebp),%eax 80103fee: 8b 00 mov (%eax),%eax 80103ff0: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 80103ff4: 8b 45 08 mov 0x8(%ebp),%eax 80103ff7: 8b 00 mov (%eax),%eax 80103ff9: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80103ffd: 8b 45 08 mov 0x8(%ebp),%eax 80104000: 8b 00 mov (%eax),%eax 80104002: 8b 55 f4 mov -0xc(%ebp),%edx 80104005: 89 50 0c mov %edx,0xc(%eax) (*f1)->type = FD_PIPE; 80104008: 8b 45 0c mov 0xc(%ebp),%eax 8010400b: 8b 00 mov (%eax),%eax 8010400d: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80104013: 8b 45 0c mov 0xc(%ebp),%eax 80104016: 8b 00 mov (%eax),%eax 80104018: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 8010401c: 8b 45 0c mov 0xc(%ebp),%eax 8010401f: 8b 00 mov (%eax),%eax 80104021: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 80104025: 8b 45 0c mov 0xc(%ebp),%eax 80104028: 8b 00 mov (%eax),%eax 8010402a: 8b 55 f4 mov -0xc(%ebp),%edx 8010402d: 89 50 0c mov %edx,0xc(%eax) return 0; 80104030: b8 00 00 00 00 mov $0x0,%eax 80104035: eb 4d jmp 80104084 <pipealloc+0x151> //PAGEBREAK: 20 bad: if(p) 80104037: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010403b: 74 0e je 8010404b <pipealloc+0x118> kfree((char*)p); 8010403d: 83 ec 0c sub $0xc,%esp 80104040: ff 75 f4 pushl -0xc(%ebp) 80104043: e8 a1 ea ff ff call 80102ae9 <kfree> 80104048: 83 c4 10 add $0x10,%esp if(*f0) 8010404b: 8b 45 08 mov 0x8(%ebp),%eax 8010404e: 8b 00 mov (%eax),%eax 80104050: 85 c0 test %eax,%eax 80104052: 74 11 je 80104065 <pipealloc+0x132> fileclose(*f0); 80104054: 8b 45 08 mov 0x8(%ebp),%eax 80104057: 8b 00 mov (%eax),%eax 80104059: 83 ec 0c sub $0xc,%esp 8010405c: 50 push %eax 8010405d: e8 ab cf ff ff call 8010100d <fileclose> 80104062: 83 c4 10 add $0x10,%esp if(*f1) 80104065: 8b 45 0c mov 0xc(%ebp),%eax 80104068: 8b 00 mov (%eax),%eax 8010406a: 85 c0 test %eax,%eax 8010406c: 74 11 je 8010407f <pipealloc+0x14c> fileclose(*f1); 8010406e: 8b 45 0c mov 0xc(%ebp),%eax 80104071: 8b 00 mov (%eax),%eax 80104073: 83 ec 0c sub $0xc,%esp 80104076: 50 push %eax 80104077: e8 91 cf ff ff call 8010100d <fileclose> 8010407c: 83 c4 10 add $0x10,%esp return -1; 8010407f: b8 ff ff ff ff mov $0xffffffff,%eax } 80104084: c9 leave 80104085: c3 ret 80104086 <pipeclose>: void pipeclose(struct pipe *p, int writable) { 80104086: 55 push %ebp 80104087: 89 e5 mov %esp,%ebp 80104089: 83 ec 08 sub $0x8,%esp acquire(&p->lock); 8010408c: 8b 45 08 mov 0x8(%ebp),%eax 8010408f: 83 ec 0c sub $0xc,%esp 80104092: 50 push %eax 80104093: e8 56 0e 00 00 call 80104eee <acquire> 80104098: 83 c4 10 add $0x10,%esp if(writable){ 8010409b: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 8010409f: 74 23 je 801040c4 <pipeclose+0x3e> p->writeopen = 0; 801040a1: 8b 45 08 mov 0x8(%ebp),%eax 801040a4: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax) 801040ab: 00 00 00 wakeup(&p->nread); 801040ae: 8b 45 08 mov 0x8(%ebp),%eax 801040b1: 05 34 02 00 00 add $0x234,%eax 801040b6: 83 ec 0c sub $0xc,%esp 801040b9: 50 push %eax 801040ba: e8 22 0c 00 00 call 80104ce1 <wakeup> 801040bf: 83 c4 10 add $0x10,%esp 801040c2: eb 21 jmp 801040e5 <pipeclose+0x5f> } else { p->readopen = 0; 801040c4: 8b 45 08 mov 0x8(%ebp),%eax 801040c7: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax) 801040ce: 00 00 00 wakeup(&p->nwrite); 801040d1: 8b 45 08 mov 0x8(%ebp),%eax 801040d4: 05 38 02 00 00 add $0x238,%eax 801040d9: 83 ec 0c sub $0xc,%esp 801040dc: 50 push %eax 801040dd: e8 ff 0b 00 00 call 80104ce1 <wakeup> 801040e2: 83 c4 10 add $0x10,%esp } if(p->readopen == 0 && p->writeopen == 0){ 801040e5: 8b 45 08 mov 0x8(%ebp),%eax 801040e8: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax 801040ee: 85 c0 test %eax,%eax 801040f0: 75 2c jne 8010411e <pipeclose+0x98> 801040f2: 8b 45 08 mov 0x8(%ebp),%eax 801040f5: 8b 80 40 02 00 00 mov 0x240(%eax),%eax 801040fb: 85 c0 test %eax,%eax 801040fd: 75 1f jne 8010411e <pipeclose+0x98> release(&p->lock); 801040ff: 8b 45 08 mov 0x8(%ebp),%eax 80104102: 83 ec 0c sub $0xc,%esp 80104105: 50 push %eax 80104106: e8 49 0e 00 00 call 80104f54 <release> 8010410b: 83 c4 10 add $0x10,%esp kfree((char*)p); 8010410e: 83 ec 0c sub $0xc,%esp 80104111: ff 75 08 pushl 0x8(%ebp) 80104114: e8 d0 e9 ff ff call 80102ae9 <kfree> 80104119: 83 c4 10 add $0x10,%esp 8010411c: eb 0f jmp 8010412d <pipeclose+0xa7> } else release(&p->lock); 8010411e: 8b 45 08 mov 0x8(%ebp),%eax 80104121: 83 ec 0c sub $0xc,%esp 80104124: 50 push %eax 80104125: e8 2a 0e 00 00 call 80104f54 <release> 8010412a: 83 c4 10 add $0x10,%esp } 8010412d: c9 leave 8010412e: c3 ret 8010412f <pipewrite>: //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { 8010412f: 55 push %ebp 80104130: 89 e5 mov %esp,%ebp 80104132: 83 ec 18 sub $0x18,%esp int i; acquire(&p->lock); 80104135: 8b 45 08 mov 0x8(%ebp),%eax 80104138: 83 ec 0c sub $0xc,%esp 8010413b: 50 push %eax 8010413c: e8 ad 0d 00 00 call 80104eee <acquire> 80104141: 83 c4 10 add $0x10,%esp for(i = 0; i < n; i++){ 80104144: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010414b: e9 af 00 00 00 jmp 801041ff <pipewrite+0xd0> while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 80104150: eb 60 jmp 801041b2 <pipewrite+0x83> if(p->readopen == 0 || proc->killed){ 80104152: 8b 45 08 mov 0x8(%ebp),%eax 80104155: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax 8010415b: 85 c0 test %eax,%eax 8010415d: 74 0d je 8010416c <pipewrite+0x3d> 8010415f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104165: 8b 40 24 mov 0x24(%eax),%eax 80104168: 85 c0 test %eax,%eax 8010416a: 74 19 je 80104185 <pipewrite+0x56> release(&p->lock); 8010416c: 8b 45 08 mov 0x8(%ebp),%eax 8010416f: 83 ec 0c sub $0xc,%esp 80104172: 50 push %eax 80104173: e8 dc 0d 00 00 call 80104f54 <release> 80104178: 83 c4 10 add $0x10,%esp return -1; 8010417b: b8 ff ff ff ff mov $0xffffffff,%eax 80104180: e9 ac 00 00 00 jmp 80104231 <pipewrite+0x102> } wakeup(&p->nread); 80104185: 8b 45 08 mov 0x8(%ebp),%eax 80104188: 05 34 02 00 00 add $0x234,%eax 8010418d: 83 ec 0c sub $0xc,%esp 80104190: 50 push %eax 80104191: e8 4b 0b 00 00 call 80104ce1 <wakeup> 80104196: 83 c4 10 add $0x10,%esp sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 80104199: 8b 45 08 mov 0x8(%ebp),%eax 8010419c: 8b 55 08 mov 0x8(%ebp),%edx 8010419f: 81 c2 38 02 00 00 add $0x238,%edx 801041a5: 83 ec 08 sub $0x8,%esp 801041a8: 50 push %eax 801041a9: 52 push %edx 801041aa: e8 46 0a 00 00 call 80104bf5 <sleep> 801041af: 83 c4 10 add $0x10,%esp { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 801041b2: 8b 45 08 mov 0x8(%ebp),%eax 801041b5: 8b 90 38 02 00 00 mov 0x238(%eax),%edx 801041bb: 8b 45 08 mov 0x8(%ebp),%eax 801041be: 8b 80 34 02 00 00 mov 0x234(%eax),%eax 801041c4: 05 00 02 00 00 add $0x200,%eax 801041c9: 39 c2 cmp %eax,%edx 801041cb: 74 85 je 80104152 <pipewrite+0x23> return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 801041cd: 8b 45 08 mov 0x8(%ebp),%eax 801041d0: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 801041d6: 8d 48 01 lea 0x1(%eax),%ecx 801041d9: 8b 55 08 mov 0x8(%ebp),%edx 801041dc: 89 8a 38 02 00 00 mov %ecx,0x238(%edx) 801041e2: 25 ff 01 00 00 and $0x1ff,%eax 801041e7: 89 c1 mov %eax,%ecx 801041e9: 8b 55 f4 mov -0xc(%ebp),%edx 801041ec: 8b 45 0c mov 0xc(%ebp),%eax 801041ef: 01 d0 add %edx,%eax 801041f1: 0f b6 10 movzbl (%eax),%edx 801041f4: 8b 45 08 mov 0x8(%ebp),%eax 801041f7: 88 54 08 34 mov %dl,0x34(%eax,%ecx,1) pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 801041fb: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801041ff: 8b 45 f4 mov -0xc(%ebp),%eax 80104202: 3b 45 10 cmp 0x10(%ebp),%eax 80104205: 0f 8c 45 ff ff ff jl 80104150 <pipewrite+0x21> wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 8010420b: 8b 45 08 mov 0x8(%ebp),%eax 8010420e: 05 34 02 00 00 add $0x234,%eax 80104213: 83 ec 0c sub $0xc,%esp 80104216: 50 push %eax 80104217: e8 c5 0a 00 00 call 80104ce1 <wakeup> 8010421c: 83 c4 10 add $0x10,%esp release(&p->lock); 8010421f: 8b 45 08 mov 0x8(%ebp),%eax 80104222: 83 ec 0c sub $0xc,%esp 80104225: 50 push %eax 80104226: e8 29 0d 00 00 call 80104f54 <release> 8010422b: 83 c4 10 add $0x10,%esp return n; 8010422e: 8b 45 10 mov 0x10(%ebp),%eax } 80104231: c9 leave 80104232: c3 ret 80104233 <piperead>: int piperead(struct pipe *p, char *addr, int n) { 80104233: 55 push %ebp 80104234: 89 e5 mov %esp,%ebp 80104236: 53 push %ebx 80104237: 83 ec 14 sub $0x14,%esp int i; acquire(&p->lock); 8010423a: 8b 45 08 mov 0x8(%ebp),%eax 8010423d: 83 ec 0c sub $0xc,%esp 80104240: 50 push %eax 80104241: e8 a8 0c 00 00 call 80104eee <acquire> 80104246: 83 c4 10 add $0x10,%esp while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 80104249: eb 3f jmp 8010428a <piperead+0x57> if(proc->killed){ 8010424b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104251: 8b 40 24 mov 0x24(%eax),%eax 80104254: 85 c0 test %eax,%eax 80104256: 74 19 je 80104271 <piperead+0x3e> release(&p->lock); 80104258: 8b 45 08 mov 0x8(%ebp),%eax 8010425b: 83 ec 0c sub $0xc,%esp 8010425e: 50 push %eax 8010425f: e8 f0 0c 00 00 call 80104f54 <release> 80104264: 83 c4 10 add $0x10,%esp return -1; 80104267: b8 ff ff ff ff mov $0xffffffff,%eax 8010426c: e9 be 00 00 00 jmp 8010432f <piperead+0xfc> } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 80104271: 8b 45 08 mov 0x8(%ebp),%eax 80104274: 8b 55 08 mov 0x8(%ebp),%edx 80104277: 81 c2 34 02 00 00 add $0x234,%edx 8010427d: 83 ec 08 sub $0x8,%esp 80104280: 50 push %eax 80104281: 52 push %edx 80104282: e8 6e 09 00 00 call 80104bf5 <sleep> 80104287: 83 c4 10 add $0x10,%esp piperead(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 8010428a: 8b 45 08 mov 0x8(%ebp),%eax 8010428d: 8b 90 34 02 00 00 mov 0x234(%eax),%edx 80104293: 8b 45 08 mov 0x8(%ebp),%eax 80104296: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 8010429c: 39 c2 cmp %eax,%edx 8010429e: 75 0d jne 801042ad <piperead+0x7a> 801042a0: 8b 45 08 mov 0x8(%ebp),%eax 801042a3: 8b 80 40 02 00 00 mov 0x240(%eax),%eax 801042a9: 85 c0 test %eax,%eax 801042ab: 75 9e jne 8010424b <piperead+0x18> release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 801042ad: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801042b4: eb 4b jmp 80104301 <piperead+0xce> if(p->nread == p->nwrite) 801042b6: 8b 45 08 mov 0x8(%ebp),%eax 801042b9: 8b 90 34 02 00 00 mov 0x234(%eax),%edx 801042bf: 8b 45 08 mov 0x8(%ebp),%eax 801042c2: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 801042c8: 39 c2 cmp %eax,%edx 801042ca: 75 02 jne 801042ce <piperead+0x9b> break; 801042cc: eb 3b jmp 80104309 <piperead+0xd6> addr[i] = p->data[p->nread++ % PIPESIZE]; 801042ce: 8b 55 f4 mov -0xc(%ebp),%edx 801042d1: 8b 45 0c mov 0xc(%ebp),%eax 801042d4: 8d 1c 02 lea (%edx,%eax,1),%ebx 801042d7: 8b 45 08 mov 0x8(%ebp),%eax 801042da: 8b 80 34 02 00 00 mov 0x234(%eax),%eax 801042e0: 8d 48 01 lea 0x1(%eax),%ecx 801042e3: 8b 55 08 mov 0x8(%ebp),%edx 801042e6: 89 8a 34 02 00 00 mov %ecx,0x234(%edx) 801042ec: 25 ff 01 00 00 and $0x1ff,%eax 801042f1: 89 c2 mov %eax,%edx 801042f3: 8b 45 08 mov 0x8(%ebp),%eax 801042f6: 0f b6 44 10 34 movzbl 0x34(%eax,%edx,1),%eax 801042fb: 88 03 mov %al,(%ebx) release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 801042fd: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80104301: 8b 45 f4 mov -0xc(%ebp),%eax 80104304: 3b 45 10 cmp 0x10(%ebp),%eax 80104307: 7c ad jl 801042b6 <piperead+0x83> if(p->nread == p->nwrite) break; addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup 80104309: 8b 45 08 mov 0x8(%ebp),%eax 8010430c: 05 38 02 00 00 add $0x238,%eax 80104311: 83 ec 0c sub $0xc,%esp 80104314: 50 push %eax 80104315: e8 c7 09 00 00 call 80104ce1 <wakeup> 8010431a: 83 c4 10 add $0x10,%esp release(&p->lock); 8010431d: 8b 45 08 mov 0x8(%ebp),%eax 80104320: 83 ec 0c sub $0xc,%esp 80104323: 50 push %eax 80104324: e8 2b 0c 00 00 call 80104f54 <release> 80104329: 83 c4 10 add $0x10,%esp return i; 8010432c: 8b 45 f4 mov -0xc(%ebp),%eax } 8010432f: 8b 5d fc mov -0x4(%ebp),%ebx 80104332: c9 leave 80104333: c3 ret 80104334 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80104334: 55 push %ebp 80104335: 89 e5 mov %esp,%ebp 80104337: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 8010433a: 9c pushf 8010433b: 58 pop %eax 8010433c: 89 45 fc mov %eax,-0x4(%ebp) return eflags; 8010433f: 8b 45 fc mov -0x4(%ebp),%eax } 80104342: c9 leave 80104343: c3 ret 80104344 <sti>: asm volatile("cli"); } static inline void sti(void) { 80104344: 55 push %ebp 80104345: 89 e5 mov %esp,%ebp asm volatile("sti"); 80104347: fb sti } 80104348: 5d pop %ebp 80104349: c3 ret 8010434a <pinit>: static void wakeup1(void *chan); void pinit(void) { 8010434a: 55 push %ebp 8010434b: 89 e5 mov %esp,%ebp 8010434d: 83 ec 08 sub $0x8,%esp initlock(&ptable.lock, "ptable"); 80104350: 83 ec 08 sub $0x8,%esp 80104353: 68 99 87 10 80 push $0x80108799 80104358: 68 40 2a 11 80 push $0x80112a40 8010435d: e8 6b 0b 00 00 call 80104ecd <initlock> 80104362: 83 c4 10 add $0x10,%esp } 80104365: c9 leave 80104366: c3 ret 80104367 <allocproc>: // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 80104367: 55 push %ebp 80104368: 89 e5 mov %esp,%ebp 8010436a: 83 ec 18 sub $0x18,%esp struct proc *p; char *sp; acquire(&ptable.lock); 8010436d: 83 ec 0c sub $0xc,%esp 80104370: 68 40 2a 11 80 push $0x80112a40 80104375: e8 74 0b 00 00 call 80104eee <acquire> 8010437a: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 8010437d: c7 45 f4 74 2a 11 80 movl $0x80112a74,-0xc(%ebp) 80104384: eb 59 jmp 801043df <allocproc+0x78> if(p->state == UNUSED) 80104386: 8b 45 f4 mov -0xc(%ebp),%eax 80104389: 8b 40 0c mov 0xc(%eax),%eax 8010438c: 85 c0 test %eax,%eax 8010438e: 75 48 jne 801043d8 <allocproc+0x71> goto found; 80104390: 90 nop release(&ptable.lock); return 0; found: p->state = EMBRYO; 80104391: 8b 45 f4 mov -0xc(%ebp),%eax 80104394: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax) p->pid = nextpid++; 8010439b: a1 04 b0 10 80 mov 0x8010b004,%eax 801043a0: 8d 50 01 lea 0x1(%eax),%edx 801043a3: 89 15 04 b0 10 80 mov %edx,0x8010b004 801043a9: 8b 55 f4 mov -0xc(%ebp),%edx 801043ac: 89 42 10 mov %eax,0x10(%edx) release(&ptable.lock); 801043af: 83 ec 0c sub $0xc,%esp 801043b2: 68 40 2a 11 80 push $0x80112a40 801043b7: e8 98 0b 00 00 call 80104f54 <release> 801043bc: 83 c4 10 add $0x10,%esp // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ 801043bf: e8 c1 e7 ff ff call 80102b85 <kalloc> 801043c4: 89 c2 mov %eax,%edx 801043c6: 8b 45 f4 mov -0xc(%ebp),%eax 801043c9: 89 50 08 mov %edx,0x8(%eax) 801043cc: 8b 45 f4 mov -0xc(%ebp),%eax 801043cf: 8b 40 08 mov 0x8(%eax),%eax 801043d2: 85 c0 test %eax,%eax 801043d4: 75 3a jne 80104410 <allocproc+0xa9> 801043d6: eb 27 jmp 801043ff <allocproc+0x98> { struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801043d8: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp) 801043df: 81 7d f4 74 4b 11 80 cmpl $0x80114b74,-0xc(%ebp) 801043e6: 72 9e jb 80104386 <allocproc+0x1f> if(p->state == UNUSED) goto found; release(&ptable.lock); 801043e8: 83 ec 0c sub $0xc,%esp 801043eb: 68 40 2a 11 80 push $0x80112a40 801043f0: e8 5f 0b 00 00 call 80104f54 <release> 801043f5: 83 c4 10 add $0x10,%esp return 0; 801043f8: b8 00 00 00 00 mov $0x0,%eax 801043fd: eb 78 jmp 80104477 <allocproc+0x110> p->pid = nextpid++; release(&ptable.lock); // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ p->state = UNUSED; 801043ff: 8b 45 f4 mov -0xc(%ebp),%eax 80104402: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return 0; 80104409: b8 00 00 00 00 mov $0x0,%eax 8010440e: eb 67 jmp 80104477 <allocproc+0x110> } sp = p->kstack + KSTACKSIZE; 80104410: 8b 45 f4 mov -0xc(%ebp),%eax 80104413: 8b 40 08 mov 0x8(%eax),%eax 80104416: 05 00 10 00 00 add $0x1000,%eax 8010441b: 89 45 f0 mov %eax,-0x10(%ebp) // Leave room for trap frame. sp -= sizeof *p->tf; 8010441e: 83 6d f0 4c subl $0x4c,-0x10(%ebp) p->tf = (struct trapframe*)sp; 80104422: 8b 45 f4 mov -0xc(%ebp),%eax 80104425: 8b 55 f0 mov -0x10(%ebp),%edx 80104428: 89 50 18 mov %edx,0x18(%eax) // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; 8010442b: 83 6d f0 04 subl $0x4,-0x10(%ebp) *(uint*)sp = (uint)trapret; 8010442f: ba ef 65 10 80 mov $0x801065ef,%edx 80104434: 8b 45 f0 mov -0x10(%ebp),%eax 80104437: 89 10 mov %edx,(%eax) sp -= sizeof *p->context; 80104439: 83 6d f0 14 subl $0x14,-0x10(%ebp) p->context = (struct context*)sp; 8010443d: 8b 45 f4 mov -0xc(%ebp),%eax 80104440: 8b 55 f0 mov -0x10(%ebp),%edx 80104443: 89 50 1c mov %edx,0x1c(%eax) memset(p->context, 0, sizeof *p->context); 80104446: 8b 45 f4 mov -0xc(%ebp),%eax 80104449: 8b 40 1c mov 0x1c(%eax),%eax 8010444c: 83 ec 04 sub $0x4,%esp 8010444f: 6a 14 push $0x14 80104451: 6a 00 push $0x0 80104453: 50 push %eax 80104454: e8 f1 0c 00 00 call 8010514a <memset> 80104459: 83 c4 10 add $0x10,%esp p->context->eip = (uint)forkret; 8010445c: 8b 45 f4 mov -0xc(%ebp),%eax 8010445f: 8b 40 1c mov 0x1c(%eax),%eax 80104462: ba c5 4b 10 80 mov $0x80104bc5,%edx 80104467: 89 50 10 mov %edx,0x10(%eax) p->traceFlag = 0; 8010446a: 8b 45 f4 mov -0xc(%ebp),%eax 8010446d: c7 40 7c 00 00 00 00 movl $0x0,0x7c(%eax) return p; 80104474: 8b 45 f4 mov -0xc(%ebp),%eax } 80104477: c9 leave 80104478: c3 ret 80104479 <userinit>: //PAGEBREAK: 32 // Set up first user process. void userinit(void) { 80104479: 55 push %ebp 8010447a: 89 e5 mov %esp,%ebp 8010447c: 83 ec 18 sub $0x18,%esp struct proc *p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); 8010447f: e8 e3 fe ff ff call 80104367 <allocproc> 80104484: 89 45 f4 mov %eax,-0xc(%ebp) initproc = p; 80104487: 8b 45 f4 mov -0xc(%ebp),%eax 8010448a: a3 68 b6 10 80 mov %eax,0x8010b668 if((p->pgdir = setupkvm()) == 0) 8010448f: e8 14 38 00 00 call 80107ca8 <setupkvm> 80104494: 89 c2 mov %eax,%edx 80104496: 8b 45 f4 mov -0xc(%ebp),%eax 80104499: 89 50 04 mov %edx,0x4(%eax) 8010449c: 8b 45 f4 mov -0xc(%ebp),%eax 8010449f: 8b 40 04 mov 0x4(%eax),%eax 801044a2: 85 c0 test %eax,%eax 801044a4: 75 0d jne 801044b3 <userinit+0x3a> panic("userinit: out of memory?"); 801044a6: 83 ec 0c sub $0xc,%esp 801044a9: 68 a0 87 10 80 push $0x801087a0 801044ae: e8 a9 c0 ff ff call 8010055c <panic> inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 801044b3: ba 2c 00 00 00 mov $0x2c,%edx 801044b8: 8b 45 f4 mov -0xc(%ebp),%eax 801044bb: 8b 40 04 mov 0x4(%eax),%eax 801044be: 83 ec 04 sub $0x4,%esp 801044c1: 52 push %edx 801044c2: 68 00 b5 10 80 push $0x8010b500 801044c7: 50 push %eax 801044c8: e8 32 3a 00 00 call 80107eff <inituvm> 801044cd: 83 c4 10 add $0x10,%esp p->sz = PGSIZE; 801044d0: 8b 45 f4 mov -0xc(%ebp),%eax 801044d3: c7 00 00 10 00 00 movl $0x1000,(%eax) memset(p->tf, 0, sizeof(*p->tf)); 801044d9: 8b 45 f4 mov -0xc(%ebp),%eax 801044dc: 8b 40 18 mov 0x18(%eax),%eax 801044df: 83 ec 04 sub $0x4,%esp 801044e2: 6a 4c push $0x4c 801044e4: 6a 00 push $0x0 801044e6: 50 push %eax 801044e7: e8 5e 0c 00 00 call 8010514a <memset> 801044ec: 83 c4 10 add $0x10,%esp p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 801044ef: 8b 45 f4 mov -0xc(%ebp),%eax 801044f2: 8b 40 18 mov 0x18(%eax),%eax 801044f5: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 801044fb: 8b 45 f4 mov -0xc(%ebp),%eax 801044fe: 8b 40 18 mov 0x18(%eax),%eax 80104501: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax) p->tf->es = p->tf->ds; 80104507: 8b 45 f4 mov -0xc(%ebp),%eax 8010450a: 8b 40 18 mov 0x18(%eax),%eax 8010450d: 8b 55 f4 mov -0xc(%ebp),%edx 80104510: 8b 52 18 mov 0x18(%edx),%edx 80104513: 0f b7 52 2c movzwl 0x2c(%edx),%edx 80104517: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 8010451b: 8b 45 f4 mov -0xc(%ebp),%eax 8010451e: 8b 40 18 mov 0x18(%eax),%eax 80104521: 8b 55 f4 mov -0xc(%ebp),%edx 80104524: 8b 52 18 mov 0x18(%edx),%edx 80104527: 0f b7 52 2c movzwl 0x2c(%edx),%edx 8010452b: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 8010452f: 8b 45 f4 mov -0xc(%ebp),%eax 80104532: 8b 40 18 mov 0x18(%eax),%eax 80104535: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 8010453c: 8b 45 f4 mov -0xc(%ebp),%eax 8010453f: 8b 40 18 mov 0x18(%eax),%eax 80104542: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80104549: 8b 45 f4 mov -0xc(%ebp),%eax 8010454c: 8b 40 18 mov 0x18(%eax),%eax 8010454f: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80104556: 8b 45 f4 mov -0xc(%ebp),%eax 80104559: 83 c0 6c add $0x6c,%eax 8010455c: 83 ec 04 sub $0x4,%esp 8010455f: 6a 10 push $0x10 80104561: 68 b9 87 10 80 push $0x801087b9 80104566: 50 push %eax 80104567: e8 e3 0d 00 00 call 8010534f <safestrcpy> 8010456c: 83 c4 10 add $0x10,%esp p->cwd = namei("/"); 8010456f: 83 ec 0c sub $0xc,%esp 80104572: 68 c2 87 10 80 push $0x801087c2 80104577: e8 15 df ff ff call 80102491 <namei> 8010457c: 83 c4 10 add $0x10,%esp 8010457f: 89 c2 mov %eax,%edx 80104581: 8b 45 f4 mov -0xc(%ebp),%eax 80104584: 89 50 68 mov %edx,0x68(%eax) p->state = RUNNABLE; 80104587: 8b 45 f4 mov -0xc(%ebp),%eax 8010458a: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) } 80104591: c9 leave 80104592: c3 ret 80104593 <growproc>: // Grow current process's memory by n bytes. // Return 0 on success, -1 on failure. int growproc(int n) { 80104593: 55 push %ebp 80104594: 89 e5 mov %esp,%ebp 80104596: 83 ec 18 sub $0x18,%esp uint sz; sz = proc->sz; 80104599: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010459f: 8b 00 mov (%eax),%eax 801045a1: 89 45 f4 mov %eax,-0xc(%ebp) if(n > 0){ 801045a4: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801045a8: 7e 31 jle 801045db <growproc+0x48> if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0) 801045aa: 8b 55 08 mov 0x8(%ebp),%edx 801045ad: 8b 45 f4 mov -0xc(%ebp),%eax 801045b0: 01 c2 add %eax,%edx 801045b2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801045b8: 8b 40 04 mov 0x4(%eax),%eax 801045bb: 83 ec 04 sub $0x4,%esp 801045be: 52 push %edx 801045bf: ff 75 f4 pushl -0xc(%ebp) 801045c2: 50 push %eax 801045c3: e8 83 3a 00 00 call 8010804b <allocuvm> 801045c8: 83 c4 10 add $0x10,%esp 801045cb: 89 45 f4 mov %eax,-0xc(%ebp) 801045ce: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801045d2: 75 3e jne 80104612 <growproc+0x7f> return -1; 801045d4: b8 ff ff ff ff mov $0xffffffff,%eax 801045d9: eb 59 jmp 80104634 <growproc+0xa1> } else if(n < 0){ 801045db: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801045df: 79 31 jns 80104612 <growproc+0x7f> if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0) 801045e1: 8b 55 08 mov 0x8(%ebp),%edx 801045e4: 8b 45 f4 mov -0xc(%ebp),%eax 801045e7: 01 c2 add %eax,%edx 801045e9: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801045ef: 8b 40 04 mov 0x4(%eax),%eax 801045f2: 83 ec 04 sub $0x4,%esp 801045f5: 52 push %edx 801045f6: ff 75 f4 pushl -0xc(%ebp) 801045f9: 50 push %eax 801045fa: e8 15 3b 00 00 call 80108114 <deallocuvm> 801045ff: 83 c4 10 add $0x10,%esp 80104602: 89 45 f4 mov %eax,-0xc(%ebp) 80104605: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80104609: 75 07 jne 80104612 <growproc+0x7f> return -1; 8010460b: b8 ff ff ff ff mov $0xffffffff,%eax 80104610: eb 22 jmp 80104634 <growproc+0xa1> } proc->sz = sz; 80104612: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104618: 8b 55 f4 mov -0xc(%ebp),%edx 8010461b: 89 10 mov %edx,(%eax) switchuvm(proc); 8010461d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104623: 83 ec 0c sub $0xc,%esp 80104626: 50 push %eax 80104627: e8 61 37 00 00 call 80107d8d <switchuvm> 8010462c: 83 c4 10 add $0x10,%esp return 0; 8010462f: b8 00 00 00 00 mov $0x0,%eax } 80104634: c9 leave 80104635: c3 ret 80104636 <fork>: // Create a new process copying p as the parent. // Sets up stack to return as if from system call. // Caller must set state of returned proc to RUNNABLE. int fork(void) { 80104636: 55 push %ebp 80104637: 89 e5 mov %esp,%ebp 80104639: 57 push %edi 8010463a: 56 push %esi 8010463b: 53 push %ebx 8010463c: 83 ec 1c sub $0x1c,%esp int i, pid; struct proc *np; // Allocate process. if((np = allocproc()) == 0) 8010463f: e8 23 fd ff ff call 80104367 <allocproc> 80104644: 89 45 e0 mov %eax,-0x20(%ebp) 80104647: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 8010464b: 75 0a jne 80104657 <fork+0x21> return -1; 8010464d: b8 ff ff ff ff mov $0xffffffff,%eax 80104652: e9 68 01 00 00 jmp 801047bf <fork+0x189> // Copy process state from p. if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){ 80104657: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010465d: 8b 10 mov (%eax),%edx 8010465f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104665: 8b 40 04 mov 0x4(%eax),%eax 80104668: 83 ec 08 sub $0x8,%esp 8010466b: 52 push %edx 8010466c: 50 push %eax 8010466d: e8 3e 3c 00 00 call 801082b0 <copyuvm> 80104672: 83 c4 10 add $0x10,%esp 80104675: 89 c2 mov %eax,%edx 80104677: 8b 45 e0 mov -0x20(%ebp),%eax 8010467a: 89 50 04 mov %edx,0x4(%eax) 8010467d: 8b 45 e0 mov -0x20(%ebp),%eax 80104680: 8b 40 04 mov 0x4(%eax),%eax 80104683: 85 c0 test %eax,%eax 80104685: 75 30 jne 801046b7 <fork+0x81> kfree(np->kstack); 80104687: 8b 45 e0 mov -0x20(%ebp),%eax 8010468a: 8b 40 08 mov 0x8(%eax),%eax 8010468d: 83 ec 0c sub $0xc,%esp 80104690: 50 push %eax 80104691: e8 53 e4 ff ff call 80102ae9 <kfree> 80104696: 83 c4 10 add $0x10,%esp np->kstack = 0; 80104699: 8b 45 e0 mov -0x20(%ebp),%eax 8010469c: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) np->state = UNUSED; 801046a3: 8b 45 e0 mov -0x20(%ebp),%eax 801046a6: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return -1; 801046ad: b8 ff ff ff ff mov $0xffffffff,%eax 801046b2: e9 08 01 00 00 jmp 801047bf <fork+0x189> } np->sz = proc->sz; 801046b7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801046bd: 8b 10 mov (%eax),%edx 801046bf: 8b 45 e0 mov -0x20(%ebp),%eax 801046c2: 89 10 mov %edx,(%eax) np->parent = proc; 801046c4: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 801046cb: 8b 45 e0 mov -0x20(%ebp),%eax 801046ce: 89 50 14 mov %edx,0x14(%eax) *np->tf = *proc->tf; 801046d1: 8b 45 e0 mov -0x20(%ebp),%eax 801046d4: 8b 50 18 mov 0x18(%eax),%edx 801046d7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801046dd: 8b 40 18 mov 0x18(%eax),%eax 801046e0: 89 c3 mov %eax,%ebx 801046e2: b8 13 00 00 00 mov $0x13,%eax 801046e7: 89 d7 mov %edx,%edi 801046e9: 89 de mov %ebx,%esi 801046eb: 89 c1 mov %eax,%ecx 801046ed: f3 a5 rep movsl %ds:(%esi),%es:(%edi) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; 801046ef: 8b 45 e0 mov -0x20(%ebp),%eax 801046f2: 8b 40 18 mov 0x18(%eax),%eax 801046f5: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) 801046fc: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80104703: eb 43 jmp 80104748 <fork+0x112> if(proc->ofile[i]) 80104705: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010470b: 8b 55 e4 mov -0x1c(%ebp),%edx 8010470e: 83 c2 08 add $0x8,%edx 80104711: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104715: 85 c0 test %eax,%eax 80104717: 74 2b je 80104744 <fork+0x10e> np->ofile[i] = filedup(proc->ofile[i]); 80104719: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010471f: 8b 55 e4 mov -0x1c(%ebp),%edx 80104722: 83 c2 08 add $0x8,%edx 80104725: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104729: 83 ec 0c sub $0xc,%esp 8010472c: 50 push %eax 8010472d: e8 8a c8 ff ff call 80100fbc <filedup> 80104732: 83 c4 10 add $0x10,%esp 80104735: 89 c1 mov %eax,%ecx 80104737: 8b 45 e0 mov -0x20(%ebp),%eax 8010473a: 8b 55 e4 mov -0x1c(%ebp),%edx 8010473d: 83 c2 08 add $0x8,%edx 80104740: 89 4c 90 08 mov %ecx,0x8(%eax,%edx,4) *np->tf = *proc->tf; // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 80104744: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 80104748: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp) 8010474c: 7e b7 jle 80104705 <fork+0xcf> if(proc->ofile[i]) np->ofile[i] = filedup(proc->ofile[i]); np->cwd = idup(proc->cwd); 8010474e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104754: 8b 40 68 mov 0x68(%eax),%eax 80104757: 83 ec 0c sub $0xc,%esp 8010475a: 50 push %eax 8010475b: e8 42 d1 ff ff call 801018a2 <idup> 80104760: 83 c4 10 add $0x10,%esp 80104763: 89 c2 mov %eax,%edx 80104765: 8b 45 e0 mov -0x20(%ebp),%eax 80104768: 89 50 68 mov %edx,0x68(%eax) safestrcpy(np->name, proc->name, sizeof(proc->name)); 8010476b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104771: 8d 50 6c lea 0x6c(%eax),%edx 80104774: 8b 45 e0 mov -0x20(%ebp),%eax 80104777: 83 c0 6c add $0x6c,%eax 8010477a: 83 ec 04 sub $0x4,%esp 8010477d: 6a 10 push $0x10 8010477f: 52 push %edx 80104780: 50 push %eax 80104781: e8 c9 0b 00 00 call 8010534f <safestrcpy> 80104786: 83 c4 10 add $0x10,%esp pid = np->pid; 80104789: 8b 45 e0 mov -0x20(%ebp),%eax 8010478c: 8b 40 10 mov 0x10(%eax),%eax 8010478f: 89 45 dc mov %eax,-0x24(%ebp) // lock to force the compiler to emit the np->state write last. acquire(&ptable.lock); 80104792: 83 ec 0c sub $0xc,%esp 80104795: 68 40 2a 11 80 push $0x80112a40 8010479a: e8 4f 07 00 00 call 80104eee <acquire> 8010479f: 83 c4 10 add $0x10,%esp np->state = RUNNABLE; 801047a2: 8b 45 e0 mov -0x20(%ebp),%eax 801047a5: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 801047ac: 83 ec 0c sub $0xc,%esp 801047af: 68 40 2a 11 80 push $0x80112a40 801047b4: e8 9b 07 00 00 call 80104f54 <release> 801047b9: 83 c4 10 add $0x10,%esp return pid; 801047bc: 8b 45 dc mov -0x24(%ebp),%eax } 801047bf: 8d 65 f4 lea -0xc(%ebp),%esp 801047c2: 5b pop %ebx 801047c3: 5e pop %esi 801047c4: 5f pop %edi 801047c5: 5d pop %ebp 801047c6: c3 ret 801047c7 <exit>: // Exit the current process. Does not return. // An exited process remains in the zombie state // until its parent calls wait() to find out it exited. void exit(void) { 801047c7: 55 push %ebp 801047c8: 89 e5 mov %esp,%ebp 801047ca: 83 ec 18 sub $0x18,%esp struct proc *p; int fd; if(proc == initproc) 801047cd: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 801047d4: a1 68 b6 10 80 mov 0x8010b668,%eax 801047d9: 39 c2 cmp %eax,%edx 801047db: 75 0d jne 801047ea <exit+0x23> panic("init exiting"); 801047dd: 83 ec 0c sub $0xc,%esp 801047e0: 68 c4 87 10 80 push $0x801087c4 801047e5: e8 72 bd ff ff call 8010055c <panic> // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 801047ea: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 801047f1: eb 48 jmp 8010483b <exit+0x74> if(proc->ofile[fd]){ 801047f3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801047f9: 8b 55 f0 mov -0x10(%ebp),%edx 801047fc: 83 c2 08 add $0x8,%edx 801047ff: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104803: 85 c0 test %eax,%eax 80104805: 74 30 je 80104837 <exit+0x70> fileclose(proc->ofile[fd]); 80104807: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010480d: 8b 55 f0 mov -0x10(%ebp),%edx 80104810: 83 c2 08 add $0x8,%edx 80104813: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104817: 83 ec 0c sub $0xc,%esp 8010481a: 50 push %eax 8010481b: e8 ed c7 ff ff call 8010100d <fileclose> 80104820: 83 c4 10 add $0x10,%esp proc->ofile[fd] = 0; 80104823: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104829: 8b 55 f0 mov -0x10(%ebp),%edx 8010482c: 83 c2 08 add $0x8,%edx 8010482f: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 80104836: 00 if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 80104837: 83 45 f0 01 addl $0x1,-0x10(%ebp) 8010483b: 83 7d f0 0f cmpl $0xf,-0x10(%ebp) 8010483f: 7e b2 jle 801047f3 <exit+0x2c> fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } begin_op(); 80104841: e8 20 ec ff ff call 80103466 <begin_op> iput(proc->cwd); 80104846: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010484c: 8b 40 68 mov 0x68(%eax),%eax 8010484f: 83 ec 0c sub $0xc,%esp 80104852: 50 push %eax 80104853: e8 4c d2 ff ff call 80101aa4 <iput> 80104858: 83 c4 10 add $0x10,%esp end_op(); 8010485b: e8 94 ec ff ff call 801034f4 <end_op> proc->cwd = 0; 80104860: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104866: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax) acquire(&ptable.lock); 8010486d: 83 ec 0c sub $0xc,%esp 80104870: 68 40 2a 11 80 push $0x80112a40 80104875: e8 74 06 00 00 call 80104eee <acquire> 8010487a: 83 c4 10 add $0x10,%esp // Parent might be sleeping in wait(). wakeup1(proc->parent); 8010487d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104883: 8b 40 14 mov 0x14(%eax),%eax 80104886: 83 ec 0c sub $0xc,%esp 80104889: 50 push %eax 8010488a: e8 11 04 00 00 call 80104ca0 <wakeup1> 8010488f: 83 c4 10 add $0x10,%esp // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104892: c7 45 f4 74 2a 11 80 movl $0x80112a74,-0xc(%ebp) 80104899: eb 3f jmp 801048da <exit+0x113> if(p->parent == proc){ 8010489b: 8b 45 f4 mov -0xc(%ebp),%eax 8010489e: 8b 50 14 mov 0x14(%eax),%edx 801048a1: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801048a7: 39 c2 cmp %eax,%edx 801048a9: 75 28 jne 801048d3 <exit+0x10c> p->parent = initproc; 801048ab: 8b 15 68 b6 10 80 mov 0x8010b668,%edx 801048b1: 8b 45 f4 mov -0xc(%ebp),%eax 801048b4: 89 50 14 mov %edx,0x14(%eax) if(p->state == ZOMBIE) 801048b7: 8b 45 f4 mov -0xc(%ebp),%eax 801048ba: 8b 40 0c mov 0xc(%eax),%eax 801048bd: 83 f8 05 cmp $0x5,%eax 801048c0: 75 11 jne 801048d3 <exit+0x10c> wakeup1(initproc); 801048c2: a1 68 b6 10 80 mov 0x8010b668,%eax 801048c7: 83 ec 0c sub $0xc,%esp 801048ca: 50 push %eax 801048cb: e8 d0 03 00 00 call 80104ca0 <wakeup1> 801048d0: 83 c4 10 add $0x10,%esp // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801048d3: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp) 801048da: 81 7d f4 74 4b 11 80 cmpl $0x80114b74,-0xc(%ebp) 801048e1: 72 b8 jb 8010489b <exit+0xd4> wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; 801048e3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801048e9: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) sched(); 801048f0: e8 db 01 00 00 call 80104ad0 <sched> panic("zombie exit"); 801048f5: 83 ec 0c sub $0xc,%esp 801048f8: 68 d1 87 10 80 push $0x801087d1 801048fd: e8 5a bc ff ff call 8010055c <panic> 80104902 <wait>: // Wait for a child process to exit and return its pid. // Return -1 if this process has no children. int wait(void) { 80104902: 55 push %ebp 80104903: 89 e5 mov %esp,%ebp 80104905: 83 ec 18 sub $0x18,%esp struct proc *p; int havekids, pid; acquire(&ptable.lock); 80104908: 83 ec 0c sub $0xc,%esp 8010490b: 68 40 2a 11 80 push $0x80112a40 80104910: e8 d9 05 00 00 call 80104eee <acquire> 80104915: 83 c4 10 add $0x10,%esp for(;;){ // Scan through table looking for zombie children. havekids = 0; 80104918: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 8010491f: c7 45 f4 74 2a 11 80 movl $0x80112a74,-0xc(%ebp) 80104926: e9 a9 00 00 00 jmp 801049d4 <wait+0xd2> if(p->parent != proc) 8010492b: 8b 45 f4 mov -0xc(%ebp),%eax 8010492e: 8b 50 14 mov 0x14(%eax),%edx 80104931: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104937: 39 c2 cmp %eax,%edx 80104939: 74 05 je 80104940 <wait+0x3e> continue; 8010493b: e9 8d 00 00 00 jmp 801049cd <wait+0xcb> havekids = 1; 80104940: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) if(p->state == ZOMBIE){ 80104947: 8b 45 f4 mov -0xc(%ebp),%eax 8010494a: 8b 40 0c mov 0xc(%eax),%eax 8010494d: 83 f8 05 cmp $0x5,%eax 80104950: 75 7b jne 801049cd <wait+0xcb> // Found one. pid = p->pid; 80104952: 8b 45 f4 mov -0xc(%ebp),%eax 80104955: 8b 40 10 mov 0x10(%eax),%eax 80104958: 89 45 ec mov %eax,-0x14(%ebp) kfree(p->kstack); 8010495b: 8b 45 f4 mov -0xc(%ebp),%eax 8010495e: 8b 40 08 mov 0x8(%eax),%eax 80104961: 83 ec 0c sub $0xc,%esp 80104964: 50 push %eax 80104965: e8 7f e1 ff ff call 80102ae9 <kfree> 8010496a: 83 c4 10 add $0x10,%esp p->kstack = 0; 8010496d: 8b 45 f4 mov -0xc(%ebp),%eax 80104970: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) freevm(p->pgdir); 80104977: 8b 45 f4 mov -0xc(%ebp),%eax 8010497a: 8b 40 04 mov 0x4(%eax),%eax 8010497d: 83 ec 0c sub $0xc,%esp 80104980: 50 push %eax 80104981: e8 4b 38 00 00 call 801081d1 <freevm> 80104986: 83 c4 10 add $0x10,%esp p->state = UNUSED; 80104989: 8b 45 f4 mov -0xc(%ebp),%eax 8010498c: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) p->pid = 0; 80104993: 8b 45 f4 mov -0xc(%ebp),%eax 80104996: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax) p->parent = 0; 8010499d: 8b 45 f4 mov -0xc(%ebp),%eax 801049a0: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->name[0] = 0; 801049a7: 8b 45 f4 mov -0xc(%ebp),%eax 801049aa: c6 40 6c 00 movb $0x0,0x6c(%eax) p->killed = 0; 801049ae: 8b 45 f4 mov -0xc(%ebp),%eax 801049b1: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax) release(&ptable.lock); 801049b8: 83 ec 0c sub $0xc,%esp 801049bb: 68 40 2a 11 80 push $0x80112a40 801049c0: e8 8f 05 00 00 call 80104f54 <release> 801049c5: 83 c4 10 add $0x10,%esp return pid; 801049c8: 8b 45 ec mov -0x14(%ebp),%eax 801049cb: eb 5a jmp 80104a27 <wait+0x125> acquire(&ptable.lock); for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801049cd: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp) 801049d4: 81 7d f4 74 4b 11 80 cmpl $0x80114b74,-0xc(%ebp) 801049db: 0f 82 4a ff ff ff jb 8010492b <wait+0x29> return pid; } } // No point waiting if we don't have any children. if(!havekids || proc->killed){ 801049e1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801049e5: 74 0d je 801049f4 <wait+0xf2> 801049e7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801049ed: 8b 40 24 mov 0x24(%eax),%eax 801049f0: 85 c0 test %eax,%eax 801049f2: 74 17 je 80104a0b <wait+0x109> release(&ptable.lock); 801049f4: 83 ec 0c sub $0xc,%esp 801049f7: 68 40 2a 11 80 push $0x80112a40 801049fc: e8 53 05 00 00 call 80104f54 <release> 80104a01: 83 c4 10 add $0x10,%esp return -1; 80104a04: b8 ff ff ff ff mov $0xffffffff,%eax 80104a09: eb 1c jmp 80104a27 <wait+0x125> } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(proc, &ptable.lock); //DOC: wait-sleep 80104a0b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104a11: 83 ec 08 sub $0x8,%esp 80104a14: 68 40 2a 11 80 push $0x80112a40 80104a19: 50 push %eax 80104a1a: e8 d6 01 00 00 call 80104bf5 <sleep> 80104a1f: 83 c4 10 add $0x10,%esp } 80104a22: e9 f1 fe ff ff jmp 80104918 <wait+0x16> } 80104a27: c9 leave 80104a28: c3 ret 80104a29 <scheduler>: // - swtch to start running that process // - eventually that process transfers control // via swtch back to the scheduler. void scheduler(void) { 80104a29: 55 push %ebp 80104a2a: 89 e5 mov %esp,%ebp 80104a2c: 83 ec 18 sub $0x18,%esp struct proc *p; for(;;){ // Enable interrupts on this processor. sti(); 80104a2f: e8 10 f9 ff ff call 80104344 <sti> // Loop over process table looking for process to run. acquire(&ptable.lock); 80104a34: 83 ec 0c sub $0xc,%esp 80104a37: 68 40 2a 11 80 push $0x80112a40 80104a3c: e8 ad 04 00 00 call 80104eee <acquire> 80104a41: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104a44: c7 45 f4 74 2a 11 80 movl $0x80112a74,-0xc(%ebp) 80104a4b: eb 65 jmp 80104ab2 <scheduler+0x89> if(p->state != RUNNABLE) 80104a4d: 8b 45 f4 mov -0xc(%ebp),%eax 80104a50: 8b 40 0c mov 0xc(%eax),%eax 80104a53: 83 f8 03 cmp $0x3,%eax 80104a56: 74 02 je 80104a5a <scheduler+0x31> continue; 80104a58: eb 51 jmp 80104aab <scheduler+0x82> // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. proc = p; 80104a5a: 8b 45 f4 mov -0xc(%ebp),%eax 80104a5d: 65 a3 04 00 00 00 mov %eax,%gs:0x4 switchuvm(p); 80104a63: 83 ec 0c sub $0xc,%esp 80104a66: ff 75 f4 pushl -0xc(%ebp) 80104a69: e8 1f 33 00 00 call 80107d8d <switchuvm> 80104a6e: 83 c4 10 add $0x10,%esp p->state = RUNNING; 80104a71: 8b 45 f4 mov -0xc(%ebp),%eax 80104a74: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax) swtch(&cpu->scheduler, proc->context); 80104a7b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104a81: 8b 40 1c mov 0x1c(%eax),%eax 80104a84: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80104a8b: 83 c2 04 add $0x4,%edx 80104a8e: 83 ec 08 sub $0x8,%esp 80104a91: 50 push %eax 80104a92: 52 push %edx 80104a93: e8 28 09 00 00 call 801053c0 <swtch> 80104a98: 83 c4 10 add $0x10,%esp switchkvm(); 80104a9b: e8 d1 32 00 00 call 80107d71 <switchkvm> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; 80104aa0: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 80104aa7: 00 00 00 00 // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104aab: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp) 80104ab2: 81 7d f4 74 4b 11 80 cmpl $0x80114b74,-0xc(%ebp) 80104ab9: 72 92 jb 80104a4d <scheduler+0x24> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; } release(&ptable.lock); 80104abb: 83 ec 0c sub $0xc,%esp 80104abe: 68 40 2a 11 80 push $0x80112a40 80104ac3: e8 8c 04 00 00 call 80104f54 <release> 80104ac8: 83 c4 10 add $0x10,%esp } 80104acb: e9 5f ff ff ff jmp 80104a2f <scheduler+0x6> 80104ad0 <sched>: // Enter scheduler. Must hold only ptable.lock // and have changed proc->state. void sched(void) { 80104ad0: 55 push %ebp 80104ad1: 89 e5 mov %esp,%ebp 80104ad3: 83 ec 18 sub $0x18,%esp int intena; if(!holding(&ptable.lock)) 80104ad6: 83 ec 0c sub $0xc,%esp 80104ad9: 68 40 2a 11 80 push $0x80112a40 80104ade: e8 3b 05 00 00 call 8010501e <holding> 80104ae3: 83 c4 10 add $0x10,%esp 80104ae6: 85 c0 test %eax,%eax 80104ae8: 75 0d jne 80104af7 <sched+0x27> panic("sched ptable.lock"); 80104aea: 83 ec 0c sub $0xc,%esp 80104aed: 68 dd 87 10 80 push $0x801087dd 80104af2: e8 65 ba ff ff call 8010055c <panic> if(cpu->ncli != 1) 80104af7: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104afd: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 80104b03: 83 f8 01 cmp $0x1,%eax 80104b06: 74 0d je 80104b15 <sched+0x45> panic("sched locks"); 80104b08: 83 ec 0c sub $0xc,%esp 80104b0b: 68 ef 87 10 80 push $0x801087ef 80104b10: e8 47 ba ff ff call 8010055c <panic> if(proc->state == RUNNING) 80104b15: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b1b: 8b 40 0c mov 0xc(%eax),%eax 80104b1e: 83 f8 04 cmp $0x4,%eax 80104b21: 75 0d jne 80104b30 <sched+0x60> panic("sched running"); 80104b23: 83 ec 0c sub $0xc,%esp 80104b26: 68 fb 87 10 80 push $0x801087fb 80104b2b: e8 2c ba ff ff call 8010055c <panic> if(readeflags()&FL_IF) 80104b30: e8 ff f7 ff ff call 80104334 <readeflags> 80104b35: 25 00 02 00 00 and $0x200,%eax 80104b3a: 85 c0 test %eax,%eax 80104b3c: 74 0d je 80104b4b <sched+0x7b> panic("sched interruptible"); 80104b3e: 83 ec 0c sub $0xc,%esp 80104b41: 68 09 88 10 80 push $0x80108809 80104b46: e8 11 ba ff ff call 8010055c <panic> intena = cpu->intena; 80104b4b: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104b51: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax 80104b57: 89 45 f4 mov %eax,-0xc(%ebp) swtch(&proc->context, cpu->scheduler); 80104b5a: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104b60: 8b 40 04 mov 0x4(%eax),%eax 80104b63: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80104b6a: 83 c2 1c add $0x1c,%edx 80104b6d: 83 ec 08 sub $0x8,%esp 80104b70: 50 push %eax 80104b71: 52 push %edx 80104b72: e8 49 08 00 00 call 801053c0 <swtch> 80104b77: 83 c4 10 add $0x10,%esp cpu->intena = intena; 80104b7a: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104b80: 8b 55 f4 mov -0xc(%ebp),%edx 80104b83: 89 90 b0 00 00 00 mov %edx,0xb0(%eax) } 80104b89: c9 leave 80104b8a: c3 ret 80104b8b <yield>: // Give up the CPU for one scheduling round. void yield(void) { 80104b8b: 55 push %ebp 80104b8c: 89 e5 mov %esp,%ebp 80104b8e: 83 ec 08 sub $0x8,%esp acquire(&ptable.lock); //DOC: yieldlock 80104b91: 83 ec 0c sub $0xc,%esp 80104b94: 68 40 2a 11 80 push $0x80112a40 80104b99: e8 50 03 00 00 call 80104eee <acquire> 80104b9e: 83 c4 10 add $0x10,%esp proc->state = RUNNABLE; 80104ba1: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104ba7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) sched(); 80104bae: e8 1d ff ff ff call 80104ad0 <sched> release(&ptable.lock); 80104bb3: 83 ec 0c sub $0xc,%esp 80104bb6: 68 40 2a 11 80 push $0x80112a40 80104bbb: e8 94 03 00 00 call 80104f54 <release> 80104bc0: 83 c4 10 add $0x10,%esp } 80104bc3: c9 leave 80104bc4: c3 ret 80104bc5 <forkret>: // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 80104bc5: 55 push %ebp 80104bc6: 89 e5 mov %esp,%ebp 80104bc8: 83 ec 08 sub $0x8,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 80104bcb: 83 ec 0c sub $0xc,%esp 80104bce: 68 40 2a 11 80 push $0x80112a40 80104bd3: e8 7c 03 00 00 call 80104f54 <release> 80104bd8: 83 c4 10 add $0x10,%esp if (first) { 80104bdb: a1 08 b0 10 80 mov 0x8010b008,%eax 80104be0: 85 c0 test %eax,%eax 80104be2: 74 0f je 80104bf3 <forkret+0x2e> // Some initialization functions must be run in the context // of a regular process (e.g., they call sleep), and thus cannot // be run from main(). first = 0; 80104be4: c7 05 08 b0 10 80 00 movl $0x0,0x8010b008 80104beb: 00 00 00 initlog(); 80104bee: e8 52 e6 ff ff call 80103245 <initlog> } // Return to "caller", actually trapret (see allocproc). } 80104bf3: c9 leave 80104bf4: c3 ret 80104bf5 <sleep>: // Atomically release lock and sleep on chan. // Reacquires lock when awakened. void sleep(void *chan, struct spinlock *lk) { 80104bf5: 55 push %ebp 80104bf6: 89 e5 mov %esp,%ebp 80104bf8: 83 ec 08 sub $0x8,%esp if(proc == 0) 80104bfb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c01: 85 c0 test %eax,%eax 80104c03: 75 0d jne 80104c12 <sleep+0x1d> panic("sleep"); 80104c05: 83 ec 0c sub $0xc,%esp 80104c08: 68 1d 88 10 80 push $0x8010881d 80104c0d: e8 4a b9 ff ff call 8010055c <panic> if(lk == 0) 80104c12: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80104c16: 75 0d jne 80104c25 <sleep+0x30> panic("sleep without lk"); 80104c18: 83 ec 0c sub $0xc,%esp 80104c1b: 68 23 88 10 80 push $0x80108823 80104c20: e8 37 b9 ff ff call 8010055c <panic> // change p->state and then call sched. // Once we hold ptable.lock, we can be // guaranteed that we won't miss any wakeup // (wakeup runs with ptable.lock locked), // so it's okay to release lk. if(lk != &ptable.lock){ //DOC: sleeplock0 80104c25: 81 7d 0c 40 2a 11 80 cmpl $0x80112a40,0xc(%ebp) 80104c2c: 74 1e je 80104c4c <sleep+0x57> acquire(&ptable.lock); //DOC: sleeplock1 80104c2e: 83 ec 0c sub $0xc,%esp 80104c31: 68 40 2a 11 80 push $0x80112a40 80104c36: e8 b3 02 00 00 call 80104eee <acquire> 80104c3b: 83 c4 10 add $0x10,%esp release(lk); 80104c3e: 83 ec 0c sub $0xc,%esp 80104c41: ff 75 0c pushl 0xc(%ebp) 80104c44: e8 0b 03 00 00 call 80104f54 <release> 80104c49: 83 c4 10 add $0x10,%esp } // Go to sleep. proc->chan = chan; 80104c4c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c52: 8b 55 08 mov 0x8(%ebp),%edx 80104c55: 89 50 20 mov %edx,0x20(%eax) proc->state = SLEEPING; 80104c58: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c5e: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax) sched(); 80104c65: e8 66 fe ff ff call 80104ad0 <sched> // Tidy up. proc->chan = 0; 80104c6a: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c70: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 80104c77: 81 7d 0c 40 2a 11 80 cmpl $0x80112a40,0xc(%ebp) 80104c7e: 74 1e je 80104c9e <sleep+0xa9> release(&ptable.lock); 80104c80: 83 ec 0c sub $0xc,%esp 80104c83: 68 40 2a 11 80 push $0x80112a40 80104c88: e8 c7 02 00 00 call 80104f54 <release> 80104c8d: 83 c4 10 add $0x10,%esp acquire(lk); 80104c90: 83 ec 0c sub $0xc,%esp 80104c93: ff 75 0c pushl 0xc(%ebp) 80104c96: e8 53 02 00 00 call 80104eee <acquire> 80104c9b: 83 c4 10 add $0x10,%esp } } 80104c9e: c9 leave 80104c9f: c3 ret 80104ca0 <wakeup1>: //PAGEBREAK! // Wake up all processes sleeping on chan. // The ptable lock must be held. static void wakeup1(void *chan) { 80104ca0: 55 push %ebp 80104ca1: 89 e5 mov %esp,%ebp 80104ca3: 83 ec 10 sub $0x10,%esp struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104ca6: c7 45 fc 74 2a 11 80 movl $0x80112a74,-0x4(%ebp) 80104cad: eb 27 jmp 80104cd6 <wakeup1+0x36> if(p->state == SLEEPING && p->chan == chan) 80104caf: 8b 45 fc mov -0x4(%ebp),%eax 80104cb2: 8b 40 0c mov 0xc(%eax),%eax 80104cb5: 83 f8 02 cmp $0x2,%eax 80104cb8: 75 15 jne 80104ccf <wakeup1+0x2f> 80104cba: 8b 45 fc mov -0x4(%ebp),%eax 80104cbd: 8b 40 20 mov 0x20(%eax),%eax 80104cc0: 3b 45 08 cmp 0x8(%ebp),%eax 80104cc3: 75 0a jne 80104ccf <wakeup1+0x2f> p->state = RUNNABLE; 80104cc5: 8b 45 fc mov -0x4(%ebp),%eax 80104cc8: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104ccf: 81 45 fc 84 00 00 00 addl $0x84,-0x4(%ebp) 80104cd6: 81 7d fc 74 4b 11 80 cmpl $0x80114b74,-0x4(%ebp) 80104cdd: 72 d0 jb 80104caf <wakeup1+0xf> if(p->state == SLEEPING && p->chan == chan) p->state = RUNNABLE; } 80104cdf: c9 leave 80104ce0: c3 ret 80104ce1 <wakeup>: // Wake up all processes sleeping on chan. void wakeup(void *chan) { 80104ce1: 55 push %ebp 80104ce2: 89 e5 mov %esp,%ebp 80104ce4: 83 ec 08 sub $0x8,%esp acquire(&ptable.lock); 80104ce7: 83 ec 0c sub $0xc,%esp 80104cea: 68 40 2a 11 80 push $0x80112a40 80104cef: e8 fa 01 00 00 call 80104eee <acquire> 80104cf4: 83 c4 10 add $0x10,%esp wakeup1(chan); 80104cf7: 83 ec 0c sub $0xc,%esp 80104cfa: ff 75 08 pushl 0x8(%ebp) 80104cfd: e8 9e ff ff ff call 80104ca0 <wakeup1> 80104d02: 83 c4 10 add $0x10,%esp release(&ptable.lock); 80104d05: 83 ec 0c sub $0xc,%esp 80104d08: 68 40 2a 11 80 push $0x80112a40 80104d0d: e8 42 02 00 00 call 80104f54 <release> 80104d12: 83 c4 10 add $0x10,%esp } 80104d15: c9 leave 80104d16: c3 ret 80104d17 <kill>: // Kill the process with the given pid. // Process won't exit until it returns // to user space (see trap in trap.c). int kill(int pid) { 80104d17: 55 push %ebp 80104d18: 89 e5 mov %esp,%ebp 80104d1a: 83 ec 18 sub $0x18,%esp struct proc *p; acquire(&ptable.lock); 80104d1d: 83 ec 0c sub $0xc,%esp 80104d20: 68 40 2a 11 80 push $0x80112a40 80104d25: e8 c4 01 00 00 call 80104eee <acquire> 80104d2a: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104d2d: c7 45 f4 74 2a 11 80 movl $0x80112a74,-0xc(%ebp) 80104d34: eb 48 jmp 80104d7e <kill+0x67> if(p->pid == pid){ 80104d36: 8b 45 f4 mov -0xc(%ebp),%eax 80104d39: 8b 40 10 mov 0x10(%eax),%eax 80104d3c: 3b 45 08 cmp 0x8(%ebp),%eax 80104d3f: 75 36 jne 80104d77 <kill+0x60> p->killed = 1; 80104d41: 8b 45 f4 mov -0xc(%ebp),%eax 80104d44: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) // Wake process from sleep if necessary. if(p->state == SLEEPING) 80104d4b: 8b 45 f4 mov -0xc(%ebp),%eax 80104d4e: 8b 40 0c mov 0xc(%eax),%eax 80104d51: 83 f8 02 cmp $0x2,%eax 80104d54: 75 0a jne 80104d60 <kill+0x49> p->state = RUNNABLE; 80104d56: 8b 45 f4 mov -0xc(%ebp),%eax 80104d59: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 80104d60: 83 ec 0c sub $0xc,%esp 80104d63: 68 40 2a 11 80 push $0x80112a40 80104d68: e8 e7 01 00 00 call 80104f54 <release> 80104d6d: 83 c4 10 add $0x10,%esp return 0; 80104d70: b8 00 00 00 00 mov $0x0,%eax 80104d75: eb 25 jmp 80104d9c <kill+0x85> kill(int pid) { struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104d77: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp) 80104d7e: 81 7d f4 74 4b 11 80 cmpl $0x80114b74,-0xc(%ebp) 80104d85: 72 af jb 80104d36 <kill+0x1f> p->state = RUNNABLE; release(&ptable.lock); return 0; } } release(&ptable.lock); 80104d87: 83 ec 0c sub $0xc,%esp 80104d8a: 68 40 2a 11 80 push $0x80112a40 80104d8f: e8 c0 01 00 00 call 80104f54 <release> 80104d94: 83 c4 10 add $0x10,%esp return -1; 80104d97: b8 ff ff ff ff mov $0xffffffff,%eax } 80104d9c: c9 leave 80104d9d: c3 ret 80104d9e <procdump>: // Print a process listing to console. For debugging. // Runs when user types ^P on console. // No lock to avoid wedging a stuck machine further. void procdump(void) { 80104d9e: 55 push %ebp 80104d9f: 89 e5 mov %esp,%ebp 80104da1: 83 ec 48 sub $0x48,%esp int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104da4: c7 45 f0 74 2a 11 80 movl $0x80112a74,-0x10(%ebp) 80104dab: e9 d8 00 00 00 jmp 80104e88 <procdump+0xea> if(p->state == UNUSED) 80104db0: 8b 45 f0 mov -0x10(%ebp),%eax 80104db3: 8b 40 0c mov 0xc(%eax),%eax 80104db6: 85 c0 test %eax,%eax 80104db8: 75 05 jne 80104dbf <procdump+0x21> continue; 80104dba: e9 c2 00 00 00 jmp 80104e81 <procdump+0xe3> if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 80104dbf: 8b 45 f0 mov -0x10(%ebp),%eax 80104dc2: 8b 40 0c mov 0xc(%eax),%eax 80104dc5: 83 f8 05 cmp $0x5,%eax 80104dc8: 77 23 ja 80104ded <procdump+0x4f> 80104dca: 8b 45 f0 mov -0x10(%ebp),%eax 80104dcd: 8b 40 0c mov 0xc(%eax),%eax 80104dd0: 8b 04 85 0c b0 10 80 mov -0x7fef4ff4(,%eax,4),%eax 80104dd7: 85 c0 test %eax,%eax 80104dd9: 74 12 je 80104ded <procdump+0x4f> state = states[p->state]; 80104ddb: 8b 45 f0 mov -0x10(%ebp),%eax 80104dde: 8b 40 0c mov 0xc(%eax),%eax 80104de1: 8b 04 85 0c b0 10 80 mov -0x7fef4ff4(,%eax,4),%eax 80104de8: 89 45 ec mov %eax,-0x14(%ebp) 80104deb: eb 07 jmp 80104df4 <procdump+0x56> else state = "???"; 80104ded: c7 45 ec 34 88 10 80 movl $0x80108834,-0x14(%ebp) cprintf("%d %s %s", p->pid, state, p->name); 80104df4: 8b 45 f0 mov -0x10(%ebp),%eax 80104df7: 8d 50 6c lea 0x6c(%eax),%edx 80104dfa: 8b 45 f0 mov -0x10(%ebp),%eax 80104dfd: 8b 40 10 mov 0x10(%eax),%eax 80104e00: 52 push %edx 80104e01: ff 75 ec pushl -0x14(%ebp) 80104e04: 50 push %eax 80104e05: 68 38 88 10 80 push $0x80108838 80104e0a: e8 b0 b5 ff ff call 801003bf <cprintf> 80104e0f: 83 c4 10 add $0x10,%esp if(p->state == SLEEPING){ 80104e12: 8b 45 f0 mov -0x10(%ebp),%eax 80104e15: 8b 40 0c mov 0xc(%eax),%eax 80104e18: 83 f8 02 cmp $0x2,%eax 80104e1b: 75 54 jne 80104e71 <procdump+0xd3> getcallerpcs((uint*)p->context->ebp+2, pc); 80104e1d: 8b 45 f0 mov -0x10(%ebp),%eax 80104e20: 8b 40 1c mov 0x1c(%eax),%eax 80104e23: 8b 40 0c mov 0xc(%eax),%eax 80104e26: 83 c0 08 add $0x8,%eax 80104e29: 89 c2 mov %eax,%edx 80104e2b: 83 ec 08 sub $0x8,%esp 80104e2e: 8d 45 c4 lea -0x3c(%ebp),%eax 80104e31: 50 push %eax 80104e32: 52 push %edx 80104e33: e8 6d 01 00 00 call 80104fa5 <getcallerpcs> 80104e38: 83 c4 10 add $0x10,%esp for(i=0; i<10 && pc[i] != 0; i++) 80104e3b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80104e42: eb 1c jmp 80104e60 <procdump+0xc2> cprintf(" %p", pc[i]); 80104e44: 8b 45 f4 mov -0xc(%ebp),%eax 80104e47: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax 80104e4b: 83 ec 08 sub $0x8,%esp 80104e4e: 50 push %eax 80104e4f: 68 41 88 10 80 push $0x80108841 80104e54: e8 66 b5 ff ff call 801003bf <cprintf> 80104e59: 83 c4 10 add $0x10,%esp else state = "???"; cprintf("%d %s %s", p->pid, state, p->name); if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) 80104e5c: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80104e60: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 80104e64: 7f 0b jg 80104e71 <procdump+0xd3> 80104e66: 8b 45 f4 mov -0xc(%ebp),%eax 80104e69: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax 80104e6d: 85 c0 test %eax,%eax 80104e6f: 75 d3 jne 80104e44 <procdump+0xa6> cprintf(" %p", pc[i]); } cprintf("\n"); 80104e71: 83 ec 0c sub $0xc,%esp 80104e74: 68 45 88 10 80 push $0x80108845 80104e79: e8 41 b5 ff ff call 801003bf <cprintf> 80104e7e: 83 c4 10 add $0x10,%esp int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104e81: 81 45 f0 84 00 00 00 addl $0x84,-0x10(%ebp) 80104e88: 81 7d f0 74 4b 11 80 cmpl $0x80114b74,-0x10(%ebp) 80104e8f: 0f 82 1b ff ff ff jb 80104db0 <procdump+0x12> for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); } } 80104e95: c9 leave 80104e96: c3 ret 80104e97 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80104e97: 55 push %ebp 80104e98: 89 e5 mov %esp,%ebp 80104e9a: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80104e9d: 9c pushf 80104e9e: 58 pop %eax 80104e9f: 89 45 fc mov %eax,-0x4(%ebp) return eflags; 80104ea2: 8b 45 fc mov -0x4(%ebp),%eax } 80104ea5: c9 leave 80104ea6: c3 ret 80104ea7 <cli>: asm volatile("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { 80104ea7: 55 push %ebp 80104ea8: 89 e5 mov %esp,%ebp asm volatile("cli"); 80104eaa: fa cli } 80104eab: 5d pop %ebp 80104eac: c3 ret 80104ead <sti>: static inline void sti(void) { 80104ead: 55 push %ebp 80104eae: 89 e5 mov %esp,%ebp asm volatile("sti"); 80104eb0: fb sti } 80104eb1: 5d pop %ebp 80104eb2: c3 ret 80104eb3 <xchg>: static inline uint xchg(volatile uint *addr, uint newval) { 80104eb3: 55 push %ebp 80104eb4: 89 e5 mov %esp,%ebp 80104eb6: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80104eb9: 8b 55 08 mov 0x8(%ebp),%edx 80104ebc: 8b 45 0c mov 0xc(%ebp),%eax 80104ebf: 8b 4d 08 mov 0x8(%ebp),%ecx 80104ec2: f0 87 02 lock xchg %eax,(%edx) 80104ec5: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80104ec8: 8b 45 fc mov -0x4(%ebp),%eax } 80104ecb: c9 leave 80104ecc: c3 ret 80104ecd <initlock>: #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 80104ecd: 55 push %ebp 80104ece: 89 e5 mov %esp,%ebp lk->name = name; 80104ed0: 8b 45 08 mov 0x8(%ebp),%eax 80104ed3: 8b 55 0c mov 0xc(%ebp),%edx 80104ed6: 89 50 04 mov %edx,0x4(%eax) lk->locked = 0; 80104ed9: 8b 45 08 mov 0x8(%ebp),%eax 80104edc: c7 00 00 00 00 00 movl $0x0,(%eax) lk->cpu = 0; 80104ee2: 8b 45 08 mov 0x8(%ebp),%eax 80104ee5: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 80104eec: 5d pop %ebp 80104eed: c3 ret 80104eee <acquire>: // Loops (spins) until the lock is acquired. // Holding a lock for a long time may cause // other CPUs to waste time spinning to acquire it. void acquire(struct spinlock *lk) { 80104eee: 55 push %ebp 80104eef: 89 e5 mov %esp,%ebp 80104ef1: 83 ec 08 sub $0x8,%esp pushcli(); // disable interrupts to avoid deadlock. 80104ef4: e8 4f 01 00 00 call 80105048 <pushcli> if(holding(lk)) 80104ef9: 8b 45 08 mov 0x8(%ebp),%eax 80104efc: 83 ec 0c sub $0xc,%esp 80104eff: 50 push %eax 80104f00: e8 19 01 00 00 call 8010501e <holding> 80104f05: 83 c4 10 add $0x10,%esp 80104f08: 85 c0 test %eax,%eax 80104f0a: 74 0d je 80104f19 <acquire+0x2b> panic("acquire"); 80104f0c: 83 ec 0c sub $0xc,%esp 80104f0f: 68 71 88 10 80 push $0x80108871 80104f14: e8 43 b6 ff ff call 8010055c <panic> // The xchg is atomic. // It also serializes, so that reads after acquire are not // reordered before it. while(xchg(&lk->locked, 1) != 0) 80104f19: 90 nop 80104f1a: 8b 45 08 mov 0x8(%ebp),%eax 80104f1d: 83 ec 08 sub $0x8,%esp 80104f20: 6a 01 push $0x1 80104f22: 50 push %eax 80104f23: e8 8b ff ff ff call 80104eb3 <xchg> 80104f28: 83 c4 10 add $0x10,%esp 80104f2b: 85 c0 test %eax,%eax 80104f2d: 75 eb jne 80104f1a <acquire+0x2c> ; // Record info about lock acquisition for debugging. lk->cpu = cpu; 80104f2f: 8b 45 08 mov 0x8(%ebp),%eax 80104f32: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80104f39: 89 50 08 mov %edx,0x8(%eax) getcallerpcs(&lk, lk->pcs); 80104f3c: 8b 45 08 mov 0x8(%ebp),%eax 80104f3f: 83 c0 0c add $0xc,%eax 80104f42: 83 ec 08 sub $0x8,%esp 80104f45: 50 push %eax 80104f46: 8d 45 08 lea 0x8(%ebp),%eax 80104f49: 50 push %eax 80104f4a: e8 56 00 00 00 call 80104fa5 <getcallerpcs> 80104f4f: 83 c4 10 add $0x10,%esp } 80104f52: c9 leave 80104f53: c3 ret 80104f54 <release>: // Release the lock. void release(struct spinlock *lk) { 80104f54: 55 push %ebp 80104f55: 89 e5 mov %esp,%ebp 80104f57: 83 ec 08 sub $0x8,%esp if(!holding(lk)) 80104f5a: 83 ec 0c sub $0xc,%esp 80104f5d: ff 75 08 pushl 0x8(%ebp) 80104f60: e8 b9 00 00 00 call 8010501e <holding> 80104f65: 83 c4 10 add $0x10,%esp 80104f68: 85 c0 test %eax,%eax 80104f6a: 75 0d jne 80104f79 <release+0x25> panic("release"); 80104f6c: 83 ec 0c sub $0xc,%esp 80104f6f: 68 79 88 10 80 push $0x80108879 80104f74: e8 e3 b5 ff ff call 8010055c <panic> lk->pcs[0] = 0; 80104f79: 8b 45 08 mov 0x8(%ebp),%eax 80104f7c: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) lk->cpu = 0; 80104f83: 8b 45 08 mov 0x8(%ebp),%eax 80104f86: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) // But the 2007 Intel 64 Architecture Memory Ordering White // Paper says that Intel 64 and IA-32 will not move a load // after a store. So lock->locked = 0 would work here. // The xchg being asm volatile ensures gcc emits it after // the above assignments (and after the critical section). xchg(&lk->locked, 0); 80104f8d: 8b 45 08 mov 0x8(%ebp),%eax 80104f90: 83 ec 08 sub $0x8,%esp 80104f93: 6a 00 push $0x0 80104f95: 50 push %eax 80104f96: e8 18 ff ff ff call 80104eb3 <xchg> 80104f9b: 83 c4 10 add $0x10,%esp popcli(); 80104f9e: e8 e9 00 00 00 call 8010508c <popcli> } 80104fa3: c9 leave 80104fa4: c3 ret 80104fa5 <getcallerpcs>: // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104fa5: 55 push %ebp 80104fa6: 89 e5 mov %esp,%ebp 80104fa8: 83 ec 10 sub $0x10,%esp uint *ebp; int i; ebp = (uint*)v - 2; 80104fab: 8b 45 08 mov 0x8(%ebp),%eax 80104fae: 83 e8 08 sub $0x8,%eax 80104fb1: 89 45 fc mov %eax,-0x4(%ebp) for(i = 0; i < 10; i++){ 80104fb4: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) 80104fbb: eb 38 jmp 80104ff5 <getcallerpcs+0x50> if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 80104fbd: 83 7d fc 00 cmpl $0x0,-0x4(%ebp) 80104fc1: 74 38 je 80104ffb <getcallerpcs+0x56> 80104fc3: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp) 80104fca: 76 2f jbe 80104ffb <getcallerpcs+0x56> 80104fcc: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp) 80104fd0: 74 29 je 80104ffb <getcallerpcs+0x56> break; pcs[i] = ebp[1]; // saved %eip 80104fd2: 8b 45 f8 mov -0x8(%ebp),%eax 80104fd5: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80104fdc: 8b 45 0c mov 0xc(%ebp),%eax 80104fdf: 01 c2 add %eax,%edx 80104fe1: 8b 45 fc mov -0x4(%ebp),%eax 80104fe4: 8b 40 04 mov 0x4(%eax),%eax 80104fe7: 89 02 mov %eax,(%edx) ebp = (uint*)ebp[0]; // saved %ebp 80104fe9: 8b 45 fc mov -0x4(%ebp),%eax 80104fec: 8b 00 mov (%eax),%eax 80104fee: 89 45 fc mov %eax,-0x4(%ebp) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80104ff1: 83 45 f8 01 addl $0x1,-0x8(%ebp) 80104ff5: 83 7d f8 09 cmpl $0x9,-0x8(%ebp) 80104ff9: 7e c2 jle 80104fbd <getcallerpcs+0x18> if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) 80104ffb: eb 19 jmp 80105016 <getcallerpcs+0x71> pcs[i] = 0; 80104ffd: 8b 45 f8 mov -0x8(%ebp),%eax 80105000: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80105007: 8b 45 0c mov 0xc(%ebp),%eax 8010500a: 01 d0 add %edx,%eax 8010500c: c7 00 00 00 00 00 movl $0x0,(%eax) if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) 80105012: 83 45 f8 01 addl $0x1,-0x8(%ebp) 80105016: 83 7d f8 09 cmpl $0x9,-0x8(%ebp) 8010501a: 7e e1 jle 80104ffd <getcallerpcs+0x58> pcs[i] = 0; } 8010501c: c9 leave 8010501d: c3 ret 8010501e <holding>: // Check whether this cpu is holding the lock. int holding(struct spinlock *lock) { 8010501e: 55 push %ebp 8010501f: 89 e5 mov %esp,%ebp return lock->locked && lock->cpu == cpu; 80105021: 8b 45 08 mov 0x8(%ebp),%eax 80105024: 8b 00 mov (%eax),%eax 80105026: 85 c0 test %eax,%eax 80105028: 74 17 je 80105041 <holding+0x23> 8010502a: 8b 45 08 mov 0x8(%ebp),%eax 8010502d: 8b 50 08 mov 0x8(%eax),%edx 80105030: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105036: 39 c2 cmp %eax,%edx 80105038: 75 07 jne 80105041 <holding+0x23> 8010503a: b8 01 00 00 00 mov $0x1,%eax 8010503f: eb 05 jmp 80105046 <holding+0x28> 80105041: b8 00 00 00 00 mov $0x0,%eax } 80105046: 5d pop %ebp 80105047: c3 ret 80105048 <pushcli>: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 80105048: 55 push %ebp 80105049: 89 e5 mov %esp,%ebp 8010504b: 83 ec 10 sub $0x10,%esp int eflags; eflags = readeflags(); 8010504e: e8 44 fe ff ff call 80104e97 <readeflags> 80105053: 89 45 fc mov %eax,-0x4(%ebp) cli(); 80105056: e8 4c fe ff ff call 80104ea7 <cli> if(cpu->ncli++ == 0) 8010505b: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80105062: 8b 82 ac 00 00 00 mov 0xac(%edx),%eax 80105068: 8d 48 01 lea 0x1(%eax),%ecx 8010506b: 89 8a ac 00 00 00 mov %ecx,0xac(%edx) 80105071: 85 c0 test %eax,%eax 80105073: 75 15 jne 8010508a <pushcli+0x42> cpu->intena = eflags & FL_IF; 80105075: 65 a1 00 00 00 00 mov %gs:0x0,%eax 8010507b: 8b 55 fc mov -0x4(%ebp),%edx 8010507e: 81 e2 00 02 00 00 and $0x200,%edx 80105084: 89 90 b0 00 00 00 mov %edx,0xb0(%eax) } 8010508a: c9 leave 8010508b: c3 ret 8010508c <popcli>: void popcli(void) { 8010508c: 55 push %ebp 8010508d: 89 e5 mov %esp,%ebp 8010508f: 83 ec 08 sub $0x8,%esp if(readeflags()&FL_IF) 80105092: e8 00 fe ff ff call 80104e97 <readeflags> 80105097: 25 00 02 00 00 and $0x200,%eax 8010509c: 85 c0 test %eax,%eax 8010509e: 74 0d je 801050ad <popcli+0x21> panic("popcli - interruptible"); 801050a0: 83 ec 0c sub $0xc,%esp 801050a3: 68 81 88 10 80 push $0x80108881 801050a8: e8 af b4 ff ff call 8010055c <panic> if(--cpu->ncli < 0) 801050ad: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801050b3: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx 801050b9: 83 ea 01 sub $0x1,%edx 801050bc: 89 90 ac 00 00 00 mov %edx,0xac(%eax) 801050c2: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 801050c8: 85 c0 test %eax,%eax 801050ca: 79 0d jns 801050d9 <popcli+0x4d> panic("popcli"); 801050cc: 83 ec 0c sub $0xc,%esp 801050cf: 68 98 88 10 80 push $0x80108898 801050d4: e8 83 b4 ff ff call 8010055c <panic> if(cpu->ncli == 0 && cpu->intena) 801050d9: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801050df: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 801050e5: 85 c0 test %eax,%eax 801050e7: 75 15 jne 801050fe <popcli+0x72> 801050e9: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801050ef: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax 801050f5: 85 c0 test %eax,%eax 801050f7: 74 05 je 801050fe <popcli+0x72> sti(); 801050f9: e8 af fd ff ff call 80104ead <sti> } 801050fe: c9 leave 801050ff: c3 ret 80105100 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 80105100: 55 push %ebp 80105101: 89 e5 mov %esp,%ebp 80105103: 57 push %edi 80105104: 53 push %ebx asm volatile("cld; rep stosb" : 80105105: 8b 4d 08 mov 0x8(%ebp),%ecx 80105108: 8b 55 10 mov 0x10(%ebp),%edx 8010510b: 8b 45 0c mov 0xc(%ebp),%eax 8010510e: 89 cb mov %ecx,%ebx 80105110: 89 df mov %ebx,%edi 80105112: 89 d1 mov %edx,%ecx 80105114: fc cld 80105115: f3 aa rep stos %al,%es:(%edi) 80105117: 89 ca mov %ecx,%edx 80105119: 89 fb mov %edi,%ebx 8010511b: 89 5d 08 mov %ebx,0x8(%ebp) 8010511e: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 80105121: 5b pop %ebx 80105122: 5f pop %edi 80105123: 5d pop %ebp 80105124: c3 ret 80105125 <stosl>: static inline void stosl(void *addr, int data, int cnt) { 80105125: 55 push %ebp 80105126: 89 e5 mov %esp,%ebp 80105128: 57 push %edi 80105129: 53 push %ebx asm volatile("cld; rep stosl" : 8010512a: 8b 4d 08 mov 0x8(%ebp),%ecx 8010512d: 8b 55 10 mov 0x10(%ebp),%edx 80105130: 8b 45 0c mov 0xc(%ebp),%eax 80105133: 89 cb mov %ecx,%ebx 80105135: 89 df mov %ebx,%edi 80105137: 89 d1 mov %edx,%ecx 80105139: fc cld 8010513a: f3 ab rep stos %eax,%es:(%edi) 8010513c: 89 ca mov %ecx,%edx 8010513e: 89 fb mov %edi,%ebx 80105140: 89 5d 08 mov %ebx,0x8(%ebp) 80105143: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 80105146: 5b pop %ebx 80105147: 5f pop %edi 80105148: 5d pop %ebp 80105149: c3 ret 8010514a <memset>: #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 8010514a: 55 push %ebp 8010514b: 89 e5 mov %esp,%ebp if ((int)dst%4 == 0 && n%4 == 0){ 8010514d: 8b 45 08 mov 0x8(%ebp),%eax 80105150: 83 e0 03 and $0x3,%eax 80105153: 85 c0 test %eax,%eax 80105155: 75 43 jne 8010519a <memset+0x50> 80105157: 8b 45 10 mov 0x10(%ebp),%eax 8010515a: 83 e0 03 and $0x3,%eax 8010515d: 85 c0 test %eax,%eax 8010515f: 75 39 jne 8010519a <memset+0x50> c &= 0xFF; 80105161: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp) stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); 80105168: 8b 45 10 mov 0x10(%ebp),%eax 8010516b: c1 e8 02 shr $0x2,%eax 8010516e: 89 c1 mov %eax,%ecx 80105170: 8b 45 0c mov 0xc(%ebp),%eax 80105173: c1 e0 18 shl $0x18,%eax 80105176: 89 c2 mov %eax,%edx 80105178: 8b 45 0c mov 0xc(%ebp),%eax 8010517b: c1 e0 10 shl $0x10,%eax 8010517e: 09 c2 or %eax,%edx 80105180: 8b 45 0c mov 0xc(%ebp),%eax 80105183: c1 e0 08 shl $0x8,%eax 80105186: 09 d0 or %edx,%eax 80105188: 0b 45 0c or 0xc(%ebp),%eax 8010518b: 51 push %ecx 8010518c: 50 push %eax 8010518d: ff 75 08 pushl 0x8(%ebp) 80105190: e8 90 ff ff ff call 80105125 <stosl> 80105195: 83 c4 0c add $0xc,%esp 80105198: eb 12 jmp 801051ac <memset+0x62> } else stosb(dst, c, n); 8010519a: 8b 45 10 mov 0x10(%ebp),%eax 8010519d: 50 push %eax 8010519e: ff 75 0c pushl 0xc(%ebp) 801051a1: ff 75 08 pushl 0x8(%ebp) 801051a4: e8 57 ff ff ff call 80105100 <stosb> 801051a9: 83 c4 0c add $0xc,%esp return dst; 801051ac: 8b 45 08 mov 0x8(%ebp),%eax } 801051af: c9 leave 801051b0: c3 ret 801051b1 <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 801051b1: 55 push %ebp 801051b2: 89 e5 mov %esp,%ebp 801051b4: 83 ec 10 sub $0x10,%esp const uchar *s1, *s2; s1 = v1; 801051b7: 8b 45 08 mov 0x8(%ebp),%eax 801051ba: 89 45 fc mov %eax,-0x4(%ebp) s2 = v2; 801051bd: 8b 45 0c mov 0xc(%ebp),%eax 801051c0: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0){ 801051c3: eb 30 jmp 801051f5 <memcmp+0x44> if(*s1 != *s2) 801051c5: 8b 45 fc mov -0x4(%ebp),%eax 801051c8: 0f b6 10 movzbl (%eax),%edx 801051cb: 8b 45 f8 mov -0x8(%ebp),%eax 801051ce: 0f b6 00 movzbl (%eax),%eax 801051d1: 38 c2 cmp %al,%dl 801051d3: 74 18 je 801051ed <memcmp+0x3c> return *s1 - *s2; 801051d5: 8b 45 fc mov -0x4(%ebp),%eax 801051d8: 0f b6 00 movzbl (%eax),%eax 801051db: 0f b6 d0 movzbl %al,%edx 801051de: 8b 45 f8 mov -0x8(%ebp),%eax 801051e1: 0f b6 00 movzbl (%eax),%eax 801051e4: 0f b6 c0 movzbl %al,%eax 801051e7: 29 c2 sub %eax,%edx 801051e9: 89 d0 mov %edx,%eax 801051eb: eb 1a jmp 80105207 <memcmp+0x56> s1++, s2++; 801051ed: 83 45 fc 01 addl $0x1,-0x4(%ebp) 801051f1: 83 45 f8 01 addl $0x1,-0x8(%ebp) { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 801051f5: 8b 45 10 mov 0x10(%ebp),%eax 801051f8: 8d 50 ff lea -0x1(%eax),%edx 801051fb: 89 55 10 mov %edx,0x10(%ebp) 801051fe: 85 c0 test %eax,%eax 80105200: 75 c3 jne 801051c5 <memcmp+0x14> if(*s1 != *s2) return *s1 - *s2; s1++, s2++; } return 0; 80105202: b8 00 00 00 00 mov $0x0,%eax } 80105207: c9 leave 80105208: c3 ret 80105209 <memmove>: void* memmove(void *dst, const void *src, uint n) { 80105209: 55 push %ebp 8010520a: 89 e5 mov %esp,%ebp 8010520c: 83 ec 10 sub $0x10,%esp const char *s; char *d; s = src; 8010520f: 8b 45 0c mov 0xc(%ebp),%eax 80105212: 89 45 fc mov %eax,-0x4(%ebp) d = dst; 80105215: 8b 45 08 mov 0x8(%ebp),%eax 80105218: 89 45 f8 mov %eax,-0x8(%ebp) if(s < d && s + n > d){ 8010521b: 8b 45 fc mov -0x4(%ebp),%eax 8010521e: 3b 45 f8 cmp -0x8(%ebp),%eax 80105221: 73 3d jae 80105260 <memmove+0x57> 80105223: 8b 55 fc mov -0x4(%ebp),%edx 80105226: 8b 45 10 mov 0x10(%ebp),%eax 80105229: 01 d0 add %edx,%eax 8010522b: 3b 45 f8 cmp -0x8(%ebp),%eax 8010522e: 76 30 jbe 80105260 <memmove+0x57> s += n; 80105230: 8b 45 10 mov 0x10(%ebp),%eax 80105233: 01 45 fc add %eax,-0x4(%ebp) d += n; 80105236: 8b 45 10 mov 0x10(%ebp),%eax 80105239: 01 45 f8 add %eax,-0x8(%ebp) while(n-- > 0) 8010523c: eb 13 jmp 80105251 <memmove+0x48> *--d = *--s; 8010523e: 83 6d f8 01 subl $0x1,-0x8(%ebp) 80105242: 83 6d fc 01 subl $0x1,-0x4(%ebp) 80105246: 8b 45 fc mov -0x4(%ebp),%eax 80105249: 0f b6 10 movzbl (%eax),%edx 8010524c: 8b 45 f8 mov -0x8(%ebp),%eax 8010524f: 88 10 mov %dl,(%eax) s = src; d = dst; if(s < d && s + n > d){ s += n; d += n; while(n-- > 0) 80105251: 8b 45 10 mov 0x10(%ebp),%eax 80105254: 8d 50 ff lea -0x1(%eax),%edx 80105257: 89 55 10 mov %edx,0x10(%ebp) 8010525a: 85 c0 test %eax,%eax 8010525c: 75 e0 jne 8010523e <memmove+0x35> const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 8010525e: eb 26 jmp 80105286 <memmove+0x7d> s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80105260: eb 17 jmp 80105279 <memmove+0x70> *d++ = *s++; 80105262: 8b 45 f8 mov -0x8(%ebp),%eax 80105265: 8d 50 01 lea 0x1(%eax),%edx 80105268: 89 55 f8 mov %edx,-0x8(%ebp) 8010526b: 8b 55 fc mov -0x4(%ebp),%edx 8010526e: 8d 4a 01 lea 0x1(%edx),%ecx 80105271: 89 4d fc mov %ecx,-0x4(%ebp) 80105274: 0f b6 12 movzbl (%edx),%edx 80105277: 88 10 mov %dl,(%eax) s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80105279: 8b 45 10 mov 0x10(%ebp),%eax 8010527c: 8d 50 ff lea -0x1(%eax),%edx 8010527f: 89 55 10 mov %edx,0x10(%ebp) 80105282: 85 c0 test %eax,%eax 80105284: 75 dc jne 80105262 <memmove+0x59> *d++ = *s++; return dst; 80105286: 8b 45 08 mov 0x8(%ebp),%eax } 80105289: c9 leave 8010528a: c3 ret 8010528b <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 8010528b: 55 push %ebp 8010528c: 89 e5 mov %esp,%ebp return memmove(dst, src, n); 8010528e: ff 75 10 pushl 0x10(%ebp) 80105291: ff 75 0c pushl 0xc(%ebp) 80105294: ff 75 08 pushl 0x8(%ebp) 80105297: e8 6d ff ff ff call 80105209 <memmove> 8010529c: 83 c4 0c add $0xc,%esp } 8010529f: c9 leave 801052a0: c3 ret 801052a1 <strncmp>: int strncmp(const char *p, const char *q, uint n) { 801052a1: 55 push %ebp 801052a2: 89 e5 mov %esp,%ebp while(n > 0 && *p && *p == *q) 801052a4: eb 0c jmp 801052b2 <strncmp+0x11> n--, p++, q++; 801052a6: 83 6d 10 01 subl $0x1,0x10(%ebp) 801052aa: 83 45 08 01 addl $0x1,0x8(%ebp) 801052ae: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 801052b2: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801052b6: 74 1a je 801052d2 <strncmp+0x31> 801052b8: 8b 45 08 mov 0x8(%ebp),%eax 801052bb: 0f b6 00 movzbl (%eax),%eax 801052be: 84 c0 test %al,%al 801052c0: 74 10 je 801052d2 <strncmp+0x31> 801052c2: 8b 45 08 mov 0x8(%ebp),%eax 801052c5: 0f b6 10 movzbl (%eax),%edx 801052c8: 8b 45 0c mov 0xc(%ebp),%eax 801052cb: 0f b6 00 movzbl (%eax),%eax 801052ce: 38 c2 cmp %al,%dl 801052d0: 74 d4 je 801052a6 <strncmp+0x5> n--, p++, q++; if(n == 0) 801052d2: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801052d6: 75 07 jne 801052df <strncmp+0x3e> return 0; 801052d8: b8 00 00 00 00 mov $0x0,%eax 801052dd: eb 16 jmp 801052f5 <strncmp+0x54> return (uchar)*p - (uchar)*q; 801052df: 8b 45 08 mov 0x8(%ebp),%eax 801052e2: 0f b6 00 movzbl (%eax),%eax 801052e5: 0f b6 d0 movzbl %al,%edx 801052e8: 8b 45 0c mov 0xc(%ebp),%eax 801052eb: 0f b6 00 movzbl (%eax),%eax 801052ee: 0f b6 c0 movzbl %al,%eax 801052f1: 29 c2 sub %eax,%edx 801052f3: 89 d0 mov %edx,%eax } 801052f5: 5d pop %ebp 801052f6: c3 ret 801052f7 <strncpy>: char* strncpy(char *s, const char *t, int n) { 801052f7: 55 push %ebp 801052f8: 89 e5 mov %esp,%ebp 801052fa: 83 ec 10 sub $0x10,%esp char *os; os = s; 801052fd: 8b 45 08 mov 0x8(%ebp),%eax 80105300: 89 45 fc mov %eax,-0x4(%ebp) while(n-- > 0 && (*s++ = *t++) != 0) 80105303: 90 nop 80105304: 8b 45 10 mov 0x10(%ebp),%eax 80105307: 8d 50 ff lea -0x1(%eax),%edx 8010530a: 89 55 10 mov %edx,0x10(%ebp) 8010530d: 85 c0 test %eax,%eax 8010530f: 7e 1e jle 8010532f <strncpy+0x38> 80105311: 8b 45 08 mov 0x8(%ebp),%eax 80105314: 8d 50 01 lea 0x1(%eax),%edx 80105317: 89 55 08 mov %edx,0x8(%ebp) 8010531a: 8b 55 0c mov 0xc(%ebp),%edx 8010531d: 8d 4a 01 lea 0x1(%edx),%ecx 80105320: 89 4d 0c mov %ecx,0xc(%ebp) 80105323: 0f b6 12 movzbl (%edx),%edx 80105326: 88 10 mov %dl,(%eax) 80105328: 0f b6 00 movzbl (%eax),%eax 8010532b: 84 c0 test %al,%al 8010532d: 75 d5 jne 80105304 <strncpy+0xd> ; while(n-- > 0) 8010532f: eb 0c jmp 8010533d <strncpy+0x46> *s++ = 0; 80105331: 8b 45 08 mov 0x8(%ebp),%eax 80105334: 8d 50 01 lea 0x1(%eax),%edx 80105337: 89 55 08 mov %edx,0x8(%ebp) 8010533a: c6 00 00 movb $0x0,(%eax) char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) 8010533d: 8b 45 10 mov 0x10(%ebp),%eax 80105340: 8d 50 ff lea -0x1(%eax),%edx 80105343: 89 55 10 mov %edx,0x10(%ebp) 80105346: 85 c0 test %eax,%eax 80105348: 7f e7 jg 80105331 <strncpy+0x3a> *s++ = 0; return os; 8010534a: 8b 45 fc mov -0x4(%ebp),%eax } 8010534d: c9 leave 8010534e: c3 ret 8010534f <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 8010534f: 55 push %ebp 80105350: 89 e5 mov %esp,%ebp 80105352: 83 ec 10 sub $0x10,%esp char *os; os = s; 80105355: 8b 45 08 mov 0x8(%ebp),%eax 80105358: 89 45 fc mov %eax,-0x4(%ebp) if(n <= 0) 8010535b: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010535f: 7f 05 jg 80105366 <safestrcpy+0x17> return os; 80105361: 8b 45 fc mov -0x4(%ebp),%eax 80105364: eb 31 jmp 80105397 <safestrcpy+0x48> while(--n > 0 && (*s++ = *t++) != 0) 80105366: 83 6d 10 01 subl $0x1,0x10(%ebp) 8010536a: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010536e: 7e 1e jle 8010538e <safestrcpy+0x3f> 80105370: 8b 45 08 mov 0x8(%ebp),%eax 80105373: 8d 50 01 lea 0x1(%eax),%edx 80105376: 89 55 08 mov %edx,0x8(%ebp) 80105379: 8b 55 0c mov 0xc(%ebp),%edx 8010537c: 8d 4a 01 lea 0x1(%edx),%ecx 8010537f: 89 4d 0c mov %ecx,0xc(%ebp) 80105382: 0f b6 12 movzbl (%edx),%edx 80105385: 88 10 mov %dl,(%eax) 80105387: 0f b6 00 movzbl (%eax),%eax 8010538a: 84 c0 test %al,%al 8010538c: 75 d8 jne 80105366 <safestrcpy+0x17> ; *s = 0; 8010538e: 8b 45 08 mov 0x8(%ebp),%eax 80105391: c6 00 00 movb $0x0,(%eax) return os; 80105394: 8b 45 fc mov -0x4(%ebp),%eax } 80105397: c9 leave 80105398: c3 ret 80105399 <strlen>: int strlen(const char *s) { 80105399: 55 push %ebp 8010539a: 89 e5 mov %esp,%ebp 8010539c: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 8010539f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 801053a6: eb 04 jmp 801053ac <strlen+0x13> 801053a8: 83 45 fc 01 addl $0x1,-0x4(%ebp) 801053ac: 8b 55 fc mov -0x4(%ebp),%edx 801053af: 8b 45 08 mov 0x8(%ebp),%eax 801053b2: 01 d0 add %edx,%eax 801053b4: 0f b6 00 movzbl (%eax),%eax 801053b7: 84 c0 test %al,%al 801053b9: 75 ed jne 801053a8 <strlen+0xf> ; return n; 801053bb: 8b 45 fc mov -0x4(%ebp),%eax } 801053be: c9 leave 801053bf: c3 ret 801053c0 <swtch>: # Save current register context in old # and then load register context from new. .globl swtch swtch: movl 4(%esp), %eax 801053c0: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 801053c4: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-save registers pushl %ebp 801053c8: 55 push %ebp pushl %ebx 801053c9: 53 push %ebx pushl %esi 801053ca: 56 push %esi pushl %edi 801053cb: 57 push %edi # Switch stacks movl %esp, (%eax) 801053cc: 89 20 mov %esp,(%eax) movl %edx, %esp 801053ce: 89 d4 mov %edx,%esp # Load new callee-save registers popl %edi 801053d0: 5f pop %edi popl %esi 801053d1: 5e pop %esi popl %ebx 801053d2: 5b pop %ebx popl %ebp 801053d3: 5d pop %ebp ret 801053d4: c3 ret 801053d5 <fetchint>: // to a saved program counter, and then the first argument. // Fetch the int at addr from the current process. int fetchint(uint addr, int *ip) { 801053d5: 55 push %ebp 801053d6: 89 e5 mov %esp,%ebp if(addr >= proc->sz || addr+4 > proc->sz) 801053d8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801053de: 8b 00 mov (%eax),%eax 801053e0: 3b 45 08 cmp 0x8(%ebp),%eax 801053e3: 76 12 jbe 801053f7 <fetchint+0x22> 801053e5: 8b 45 08 mov 0x8(%ebp),%eax 801053e8: 8d 50 04 lea 0x4(%eax),%edx 801053eb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801053f1: 8b 00 mov (%eax),%eax 801053f3: 39 c2 cmp %eax,%edx 801053f5: 76 07 jbe 801053fe <fetchint+0x29> return -1; 801053f7: b8 ff ff ff ff mov $0xffffffff,%eax 801053fc: eb 0f jmp 8010540d <fetchint+0x38> *ip = *(int*)(addr); 801053fe: 8b 45 08 mov 0x8(%ebp),%eax 80105401: 8b 10 mov (%eax),%edx 80105403: 8b 45 0c mov 0xc(%ebp),%eax 80105406: 89 10 mov %edx,(%eax) return 0; 80105408: b8 00 00 00 00 mov $0x0,%eax } 8010540d: 5d pop %ebp 8010540e: c3 ret 8010540f <fetchstr>: // Fetch the nul-terminated string at addr from the current process. // Doesn't actually copy the string - just sets *pp to point at it. // Returns length of string, not including nul. int fetchstr(uint addr, char **pp) { 8010540f: 55 push %ebp 80105410: 89 e5 mov %esp,%ebp 80105412: 83 ec 10 sub $0x10,%esp char *s, *ep; if(addr >= proc->sz) 80105415: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010541b: 8b 00 mov (%eax),%eax 8010541d: 3b 45 08 cmp 0x8(%ebp),%eax 80105420: 77 07 ja 80105429 <fetchstr+0x1a> return -1; 80105422: b8 ff ff ff ff mov $0xffffffff,%eax 80105427: eb 46 jmp 8010546f <fetchstr+0x60> *pp = (char*)addr; 80105429: 8b 55 08 mov 0x8(%ebp),%edx 8010542c: 8b 45 0c mov 0xc(%ebp),%eax 8010542f: 89 10 mov %edx,(%eax) ep = (char*)proc->sz; 80105431: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105437: 8b 00 mov (%eax),%eax 80105439: 89 45 f8 mov %eax,-0x8(%ebp) for(s = *pp; s < ep; s++) 8010543c: 8b 45 0c mov 0xc(%ebp),%eax 8010543f: 8b 00 mov (%eax),%eax 80105441: 89 45 fc mov %eax,-0x4(%ebp) 80105444: eb 1c jmp 80105462 <fetchstr+0x53> if(*s == 0) 80105446: 8b 45 fc mov -0x4(%ebp),%eax 80105449: 0f b6 00 movzbl (%eax),%eax 8010544c: 84 c0 test %al,%al 8010544e: 75 0e jne 8010545e <fetchstr+0x4f> return s - *pp; 80105450: 8b 55 fc mov -0x4(%ebp),%edx 80105453: 8b 45 0c mov 0xc(%ebp),%eax 80105456: 8b 00 mov (%eax),%eax 80105458: 29 c2 sub %eax,%edx 8010545a: 89 d0 mov %edx,%eax 8010545c: eb 11 jmp 8010546f <fetchstr+0x60> if(addr >= proc->sz) return -1; *pp = (char*)addr; ep = (char*)proc->sz; for(s = *pp; s < ep; s++) 8010545e: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80105462: 8b 45 fc mov -0x4(%ebp),%eax 80105465: 3b 45 f8 cmp -0x8(%ebp),%eax 80105468: 72 dc jb 80105446 <fetchstr+0x37> if(*s == 0) return s - *pp; return -1; 8010546a: b8 ff ff ff ff mov $0xffffffff,%eax } 8010546f: c9 leave 80105470: c3 ret 80105471 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80105471: 55 push %ebp 80105472: 89 e5 mov %esp,%ebp return fetchint(proc->tf->esp + 4 + 4*n, ip); 80105474: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010547a: 8b 40 18 mov 0x18(%eax),%eax 8010547d: 8b 40 44 mov 0x44(%eax),%eax 80105480: 8b 55 08 mov 0x8(%ebp),%edx 80105483: c1 e2 02 shl $0x2,%edx 80105486: 01 d0 add %edx,%eax 80105488: 83 c0 04 add $0x4,%eax 8010548b: ff 75 0c pushl 0xc(%ebp) 8010548e: 50 push %eax 8010548f: e8 41 ff ff ff call 801053d5 <fetchint> 80105494: 83 c4 08 add $0x8,%esp } 80105497: c9 leave 80105498: c3 ret 80105499 <argptr>: // Fetch the nth word-sized system call argument as a pointer // to a block of memory of size n bytes. Check that the pointer // lies within the process address space. int argptr(int n, char **pp, int size) { 80105499: 55 push %ebp 8010549a: 89 e5 mov %esp,%ebp 8010549c: 83 ec 10 sub $0x10,%esp int i; if(argint(n, &i) < 0) 8010549f: 8d 45 fc lea -0x4(%ebp),%eax 801054a2: 50 push %eax 801054a3: ff 75 08 pushl 0x8(%ebp) 801054a6: e8 c6 ff ff ff call 80105471 <argint> 801054ab: 83 c4 08 add $0x8,%esp 801054ae: 85 c0 test %eax,%eax 801054b0: 79 07 jns 801054b9 <argptr+0x20> return -1; 801054b2: b8 ff ff ff ff mov $0xffffffff,%eax 801054b7: eb 3d jmp 801054f6 <argptr+0x5d> if((uint)i >= proc->sz || (uint)i+size > proc->sz) 801054b9: 8b 45 fc mov -0x4(%ebp),%eax 801054bc: 89 c2 mov %eax,%edx 801054be: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801054c4: 8b 00 mov (%eax),%eax 801054c6: 39 c2 cmp %eax,%edx 801054c8: 73 16 jae 801054e0 <argptr+0x47> 801054ca: 8b 45 fc mov -0x4(%ebp),%eax 801054cd: 89 c2 mov %eax,%edx 801054cf: 8b 45 10 mov 0x10(%ebp),%eax 801054d2: 01 c2 add %eax,%edx 801054d4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801054da: 8b 00 mov (%eax),%eax 801054dc: 39 c2 cmp %eax,%edx 801054de: 76 07 jbe 801054e7 <argptr+0x4e> return -1; 801054e0: b8 ff ff ff ff mov $0xffffffff,%eax 801054e5: eb 0f jmp 801054f6 <argptr+0x5d> *pp = (char*)i; 801054e7: 8b 45 fc mov -0x4(%ebp),%eax 801054ea: 89 c2 mov %eax,%edx 801054ec: 8b 45 0c mov 0xc(%ebp),%eax 801054ef: 89 10 mov %edx,(%eax) return 0; 801054f1: b8 00 00 00 00 mov $0x0,%eax } 801054f6: c9 leave 801054f7: c3 ret 801054f8 <argstr>: // Check that the pointer is valid and the string is nul-terminated. // (There is no shared writable memory, so the string can't change // between this check and being used by the kernel.) int argstr(int n, char **pp) { 801054f8: 55 push %ebp 801054f9: 89 e5 mov %esp,%ebp 801054fb: 83 ec 10 sub $0x10,%esp int addr; if(argint(n, &addr) < 0) 801054fe: 8d 45 fc lea -0x4(%ebp),%eax 80105501: 50 push %eax 80105502: ff 75 08 pushl 0x8(%ebp) 80105505: e8 67 ff ff ff call 80105471 <argint> 8010550a: 83 c4 08 add $0x8,%esp 8010550d: 85 c0 test %eax,%eax 8010550f: 79 07 jns 80105518 <argstr+0x20> return -1; 80105511: b8 ff ff ff ff mov $0xffffffff,%eax 80105516: eb 0f jmp 80105527 <argstr+0x2f> return fetchstr(addr, pp); 80105518: 8b 45 fc mov -0x4(%ebp),%eax 8010551b: ff 75 0c pushl 0xc(%ebp) 8010551e: 50 push %eax 8010551f: e8 eb fe ff ff call 8010540f <fetchstr> 80105524: 83 c4 08 add $0x8,%esp } 80105527: c9 leave 80105528: c3 ret 80105529 <syscall>: [SYS_trace] sys_trace, }; void syscall(void) { 80105529: 55 push %ebp 8010552a: 89 e5 mov %esp,%ebp 8010552c: 53 push %ebx 8010552d: 83 ec 14 sub $0x14,%esp int num; num = proc->tf->eax; 80105530: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105536: 8b 40 18 mov 0x18(%eax),%eax 80105539: 8b 40 1c mov 0x1c(%eax),%eax 8010553c: 89 45 f4 mov %eax,-0xc(%ebp) if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 8010553f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105543: 7e 77 jle 801055bc <syscall+0x93> 80105545: 8b 45 f4 mov -0xc(%ebp),%eax 80105548: 83 f8 16 cmp $0x16,%eax 8010554b: 77 6f ja 801055bc <syscall+0x93> 8010554d: 8b 45 f4 mov -0xc(%ebp),%eax 80105550: 8b 04 85 40 b0 10 80 mov -0x7fef4fc0(,%eax,4),%eax 80105557: 85 c0 test %eax,%eax 80105559: 74 61 je 801055bc <syscall+0x93> if(proc->traceFlag == true){ 8010555b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105561: 8b 40 7c mov 0x7c(%eax),%eax 80105564: 83 f8 01 cmp $0x1,%eax 80105567: 75 39 jne 801055a2 <syscall+0x79> proc->totalSysCall = proc->totalSysCall +1; 80105569: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010556f: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80105576: 8b 92 80 00 00 00 mov 0x80(%edx),%edx 8010557c: 83 c2 01 add $0x1,%edx 8010557f: 89 90 80 00 00 00 mov %edx,0x80(%eax) cprintf("\npid %d invoked call %d\n", proc->pid, num); 80105585: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010558b: 8b 40 10 mov 0x10(%eax),%eax 8010558e: 83 ec 04 sub $0x4,%esp 80105591: ff 75 f4 pushl -0xc(%ebp) 80105594: 50 push %eax 80105595: 68 9f 88 10 80 push $0x8010889f 8010559a: e8 20 ae ff ff call 801003bf <cprintf> 8010559f: 83 c4 10 add $0x10,%esp } proc->tf->eax = syscalls[num](); 801055a2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801055a8: 8b 58 18 mov 0x18(%eax),%ebx 801055ab: 8b 45 f4 mov -0xc(%ebp),%eax 801055ae: 8b 04 85 40 b0 10 80 mov -0x7fef4fc0(,%eax,4),%eax 801055b5: ff d0 call *%eax 801055b7: 89 43 1c mov %eax,0x1c(%ebx) 801055ba: eb 34 jmp 801055f0 <syscall+0xc7> } else { cprintf("%d %s: unknown sys call %d\n", proc->pid, proc->name, num); 801055bc: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801055c2: 8d 50 6c lea 0x6c(%eax),%edx 801055c5: 65 a1 04 00 00 00 mov %gs:0x4,%eax proc->totalSysCall = proc->totalSysCall +1; cprintf("\npid %d invoked call %d\n", proc->pid, num); } proc->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", 801055cb: 8b 40 10 mov 0x10(%eax),%eax 801055ce: ff 75 f4 pushl -0xc(%ebp) 801055d1: 52 push %edx 801055d2: 50 push %eax 801055d3: 68 b8 88 10 80 push $0x801088b8 801055d8: e8 e2 ad ff ff call 801003bf <cprintf> 801055dd: 83 c4 10 add $0x10,%esp proc->pid, proc->name, num); proc->tf->eax = -1; 801055e0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801055e6: 8b 40 18 mov 0x18(%eax),%eax 801055e9: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } } 801055f0: 8b 5d fc mov -0x4(%ebp),%ebx 801055f3: c9 leave 801055f4: c3 ret 801055f5 <argfd>: // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) { 801055f5: 55 push %ebp 801055f6: 89 e5 mov %esp,%ebp 801055f8: 83 ec 18 sub $0x18,%esp int fd; struct file *f; if(argint(n, &fd) < 0) 801055fb: 83 ec 08 sub $0x8,%esp 801055fe: 8d 45 f0 lea -0x10(%ebp),%eax 80105601: 50 push %eax 80105602: ff 75 08 pushl 0x8(%ebp) 80105605: e8 67 fe ff ff call 80105471 <argint> 8010560a: 83 c4 10 add $0x10,%esp 8010560d: 85 c0 test %eax,%eax 8010560f: 79 07 jns 80105618 <argfd+0x23> return -1; 80105611: b8 ff ff ff ff mov $0xffffffff,%eax 80105616: eb 50 jmp 80105668 <argfd+0x73> if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0) 80105618: 8b 45 f0 mov -0x10(%ebp),%eax 8010561b: 85 c0 test %eax,%eax 8010561d: 78 21 js 80105640 <argfd+0x4b> 8010561f: 8b 45 f0 mov -0x10(%ebp),%eax 80105622: 83 f8 0f cmp $0xf,%eax 80105625: 7f 19 jg 80105640 <argfd+0x4b> 80105627: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010562d: 8b 55 f0 mov -0x10(%ebp),%edx 80105630: 83 c2 08 add $0x8,%edx 80105633: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105637: 89 45 f4 mov %eax,-0xc(%ebp) 8010563a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010563e: 75 07 jne 80105647 <argfd+0x52> return -1; 80105640: b8 ff ff ff ff mov $0xffffffff,%eax 80105645: eb 21 jmp 80105668 <argfd+0x73> if(pfd) 80105647: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 8010564b: 74 08 je 80105655 <argfd+0x60> *pfd = fd; 8010564d: 8b 55 f0 mov -0x10(%ebp),%edx 80105650: 8b 45 0c mov 0xc(%ebp),%eax 80105653: 89 10 mov %edx,(%eax) if(pf) 80105655: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105659: 74 08 je 80105663 <argfd+0x6e> *pf = f; 8010565b: 8b 45 10 mov 0x10(%ebp),%eax 8010565e: 8b 55 f4 mov -0xc(%ebp),%edx 80105661: 89 10 mov %edx,(%eax) return 0; 80105663: b8 00 00 00 00 mov $0x0,%eax } 80105668: c9 leave 80105669: c3 ret 8010566a <fdalloc>: // Allocate a file descriptor for the given file. // Takes over file reference from caller on success. static int fdalloc(struct file *f) { 8010566a: 55 push %ebp 8010566b: 89 e5 mov %esp,%ebp 8010566d: 83 ec 10 sub $0x10,%esp int fd; for(fd = 0; fd < NOFILE; fd++){ 80105670: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80105677: eb 30 jmp 801056a9 <fdalloc+0x3f> if(proc->ofile[fd] == 0){ 80105679: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010567f: 8b 55 fc mov -0x4(%ebp),%edx 80105682: 83 c2 08 add $0x8,%edx 80105685: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105689: 85 c0 test %eax,%eax 8010568b: 75 18 jne 801056a5 <fdalloc+0x3b> proc->ofile[fd] = f; 8010568d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105693: 8b 55 fc mov -0x4(%ebp),%edx 80105696: 8d 4a 08 lea 0x8(%edx),%ecx 80105699: 8b 55 08 mov 0x8(%ebp),%edx 8010569c: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4) return fd; 801056a0: 8b 45 fc mov -0x4(%ebp),%eax 801056a3: eb 0f jmp 801056b4 <fdalloc+0x4a> static int fdalloc(struct file *f) { int fd; for(fd = 0; fd < NOFILE; fd++){ 801056a5: 83 45 fc 01 addl $0x1,-0x4(%ebp) 801056a9: 83 7d fc 0f cmpl $0xf,-0x4(%ebp) 801056ad: 7e ca jle 80105679 <fdalloc+0xf> if(proc->ofile[fd] == 0){ proc->ofile[fd] = f; return fd; } } return -1; 801056af: b8 ff ff ff ff mov $0xffffffff,%eax } 801056b4: c9 leave 801056b5: c3 ret 801056b6 <sys_dup>: int sys_dup(void) { 801056b6: 55 push %ebp 801056b7: 89 e5 mov %esp,%ebp 801056b9: 83 ec 18 sub $0x18,%esp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 801056bc: 83 ec 04 sub $0x4,%esp 801056bf: 8d 45 f0 lea -0x10(%ebp),%eax 801056c2: 50 push %eax 801056c3: 6a 00 push $0x0 801056c5: 6a 00 push $0x0 801056c7: e8 29 ff ff ff call 801055f5 <argfd> 801056cc: 83 c4 10 add $0x10,%esp 801056cf: 85 c0 test %eax,%eax 801056d1: 79 07 jns 801056da <sys_dup+0x24> return -1; 801056d3: b8 ff ff ff ff mov $0xffffffff,%eax 801056d8: eb 31 jmp 8010570b <sys_dup+0x55> if((fd=fdalloc(f)) < 0) 801056da: 8b 45 f0 mov -0x10(%ebp),%eax 801056dd: 83 ec 0c sub $0xc,%esp 801056e0: 50 push %eax 801056e1: e8 84 ff ff ff call 8010566a <fdalloc> 801056e6: 83 c4 10 add $0x10,%esp 801056e9: 89 45 f4 mov %eax,-0xc(%ebp) 801056ec: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801056f0: 79 07 jns 801056f9 <sys_dup+0x43> return -1; 801056f2: b8 ff ff ff ff mov $0xffffffff,%eax 801056f7: eb 12 jmp 8010570b <sys_dup+0x55> filedup(f); 801056f9: 8b 45 f0 mov -0x10(%ebp),%eax 801056fc: 83 ec 0c sub $0xc,%esp 801056ff: 50 push %eax 80105700: e8 b7 b8 ff ff call 80100fbc <filedup> 80105705: 83 c4 10 add $0x10,%esp return fd; 80105708: 8b 45 f4 mov -0xc(%ebp),%eax } 8010570b: c9 leave 8010570c: c3 ret 8010570d <sys_read>: int sys_read(void) { 8010570d: 55 push %ebp 8010570e: 89 e5 mov %esp,%ebp 80105710: 83 ec 18 sub $0x18,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80105713: 83 ec 04 sub $0x4,%esp 80105716: 8d 45 f4 lea -0xc(%ebp),%eax 80105719: 50 push %eax 8010571a: 6a 00 push $0x0 8010571c: 6a 00 push $0x0 8010571e: e8 d2 fe ff ff call 801055f5 <argfd> 80105723: 83 c4 10 add $0x10,%esp 80105726: 85 c0 test %eax,%eax 80105728: 78 2e js 80105758 <sys_read+0x4b> 8010572a: 83 ec 08 sub $0x8,%esp 8010572d: 8d 45 f0 lea -0x10(%ebp),%eax 80105730: 50 push %eax 80105731: 6a 02 push $0x2 80105733: e8 39 fd ff ff call 80105471 <argint> 80105738: 83 c4 10 add $0x10,%esp 8010573b: 85 c0 test %eax,%eax 8010573d: 78 19 js 80105758 <sys_read+0x4b> 8010573f: 8b 45 f0 mov -0x10(%ebp),%eax 80105742: 83 ec 04 sub $0x4,%esp 80105745: 50 push %eax 80105746: 8d 45 ec lea -0x14(%ebp),%eax 80105749: 50 push %eax 8010574a: 6a 01 push $0x1 8010574c: e8 48 fd ff ff call 80105499 <argptr> 80105751: 83 c4 10 add $0x10,%esp 80105754: 85 c0 test %eax,%eax 80105756: 79 07 jns 8010575f <sys_read+0x52> return -1; 80105758: b8 ff ff ff ff mov $0xffffffff,%eax 8010575d: eb 17 jmp 80105776 <sys_read+0x69> return fileread(f, p, n); 8010575f: 8b 4d f0 mov -0x10(%ebp),%ecx 80105762: 8b 55 ec mov -0x14(%ebp),%edx 80105765: 8b 45 f4 mov -0xc(%ebp),%eax 80105768: 83 ec 04 sub $0x4,%esp 8010576b: 51 push %ecx 8010576c: 52 push %edx 8010576d: 50 push %eax 8010576e: e8 d9 b9 ff ff call 8010114c <fileread> 80105773: 83 c4 10 add $0x10,%esp } 80105776: c9 leave 80105777: c3 ret 80105778 <sys_write>: int sys_write(void) { 80105778: 55 push %ebp 80105779: 89 e5 mov %esp,%ebp 8010577b: 83 ec 18 sub $0x18,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 8010577e: 83 ec 04 sub $0x4,%esp 80105781: 8d 45 f4 lea -0xc(%ebp),%eax 80105784: 50 push %eax 80105785: 6a 00 push $0x0 80105787: 6a 00 push $0x0 80105789: e8 67 fe ff ff call 801055f5 <argfd> 8010578e: 83 c4 10 add $0x10,%esp 80105791: 85 c0 test %eax,%eax 80105793: 78 2e js 801057c3 <sys_write+0x4b> 80105795: 83 ec 08 sub $0x8,%esp 80105798: 8d 45 f0 lea -0x10(%ebp),%eax 8010579b: 50 push %eax 8010579c: 6a 02 push $0x2 8010579e: e8 ce fc ff ff call 80105471 <argint> 801057a3: 83 c4 10 add $0x10,%esp 801057a6: 85 c0 test %eax,%eax 801057a8: 78 19 js 801057c3 <sys_write+0x4b> 801057aa: 8b 45 f0 mov -0x10(%ebp),%eax 801057ad: 83 ec 04 sub $0x4,%esp 801057b0: 50 push %eax 801057b1: 8d 45 ec lea -0x14(%ebp),%eax 801057b4: 50 push %eax 801057b5: 6a 01 push $0x1 801057b7: e8 dd fc ff ff call 80105499 <argptr> 801057bc: 83 c4 10 add $0x10,%esp 801057bf: 85 c0 test %eax,%eax 801057c1: 79 07 jns 801057ca <sys_write+0x52> return -1; 801057c3: b8 ff ff ff ff mov $0xffffffff,%eax 801057c8: eb 17 jmp 801057e1 <sys_write+0x69> return filewrite(f, p, n); 801057ca: 8b 4d f0 mov -0x10(%ebp),%ecx 801057cd: 8b 55 ec mov -0x14(%ebp),%edx 801057d0: 8b 45 f4 mov -0xc(%ebp),%eax 801057d3: 83 ec 04 sub $0x4,%esp 801057d6: 51 push %ecx 801057d7: 52 push %edx 801057d8: 50 push %eax 801057d9: e8 26 ba ff ff call 80101204 <filewrite> 801057de: 83 c4 10 add $0x10,%esp } 801057e1: c9 leave 801057e2: c3 ret 801057e3 <sys_close>: int sys_close(void) { 801057e3: 55 push %ebp 801057e4: 89 e5 mov %esp,%ebp 801057e6: 83 ec 18 sub $0x18,%esp int fd; struct file *f; if(argfd(0, &fd, &f) < 0) 801057e9: 83 ec 04 sub $0x4,%esp 801057ec: 8d 45 f0 lea -0x10(%ebp),%eax 801057ef: 50 push %eax 801057f0: 8d 45 f4 lea -0xc(%ebp),%eax 801057f3: 50 push %eax 801057f4: 6a 00 push $0x0 801057f6: e8 fa fd ff ff call 801055f5 <argfd> 801057fb: 83 c4 10 add $0x10,%esp 801057fe: 85 c0 test %eax,%eax 80105800: 79 07 jns 80105809 <sys_close+0x26> return -1; 80105802: b8 ff ff ff ff mov $0xffffffff,%eax 80105807: eb 28 jmp 80105831 <sys_close+0x4e> proc->ofile[fd] = 0; 80105809: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010580f: 8b 55 f4 mov -0xc(%ebp),%edx 80105812: 83 c2 08 add $0x8,%edx 80105815: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 8010581c: 00 fileclose(f); 8010581d: 8b 45 f0 mov -0x10(%ebp),%eax 80105820: 83 ec 0c sub $0xc,%esp 80105823: 50 push %eax 80105824: e8 e4 b7 ff ff call 8010100d <fileclose> 80105829: 83 c4 10 add $0x10,%esp return 0; 8010582c: b8 00 00 00 00 mov $0x0,%eax } 80105831: c9 leave 80105832: c3 ret 80105833 <sys_fstat>: int sys_fstat(void) { 80105833: 55 push %ebp 80105834: 89 e5 mov %esp,%ebp 80105836: 83 ec 18 sub $0x18,%esp struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80105839: 83 ec 04 sub $0x4,%esp 8010583c: 8d 45 f4 lea -0xc(%ebp),%eax 8010583f: 50 push %eax 80105840: 6a 00 push $0x0 80105842: 6a 00 push $0x0 80105844: e8 ac fd ff ff call 801055f5 <argfd> 80105849: 83 c4 10 add $0x10,%esp 8010584c: 85 c0 test %eax,%eax 8010584e: 78 17 js 80105867 <sys_fstat+0x34> 80105850: 83 ec 04 sub $0x4,%esp 80105853: 6a 14 push $0x14 80105855: 8d 45 f0 lea -0x10(%ebp),%eax 80105858: 50 push %eax 80105859: 6a 01 push $0x1 8010585b: e8 39 fc ff ff call 80105499 <argptr> 80105860: 83 c4 10 add $0x10,%esp 80105863: 85 c0 test %eax,%eax 80105865: 79 07 jns 8010586e <sys_fstat+0x3b> return -1; 80105867: b8 ff ff ff ff mov $0xffffffff,%eax 8010586c: eb 13 jmp 80105881 <sys_fstat+0x4e> return filestat(f, st); 8010586e: 8b 55 f0 mov -0x10(%ebp),%edx 80105871: 8b 45 f4 mov -0xc(%ebp),%eax 80105874: 83 ec 08 sub $0x8,%esp 80105877: 52 push %edx 80105878: 50 push %eax 80105879: e8 77 b8 ff ff call 801010f5 <filestat> 8010587e: 83 c4 10 add $0x10,%esp } 80105881: c9 leave 80105882: c3 ret 80105883 <sys_link>: // Create the path new as a link to the same inode as old. int sys_link(void) { 80105883: 55 push %ebp 80105884: 89 e5 mov %esp,%ebp 80105886: 83 ec 28 sub $0x28,%esp char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80105889: 83 ec 08 sub $0x8,%esp 8010588c: 8d 45 d8 lea -0x28(%ebp),%eax 8010588f: 50 push %eax 80105890: 6a 00 push $0x0 80105892: e8 61 fc ff ff call 801054f8 <argstr> 80105897: 83 c4 10 add $0x10,%esp 8010589a: 85 c0 test %eax,%eax 8010589c: 78 15 js 801058b3 <sys_link+0x30> 8010589e: 83 ec 08 sub $0x8,%esp 801058a1: 8d 45 dc lea -0x24(%ebp),%eax 801058a4: 50 push %eax 801058a5: 6a 01 push $0x1 801058a7: e8 4c fc ff ff call 801054f8 <argstr> 801058ac: 83 c4 10 add $0x10,%esp 801058af: 85 c0 test %eax,%eax 801058b1: 79 0a jns 801058bd <sys_link+0x3a> return -1; 801058b3: b8 ff ff ff ff mov $0xffffffff,%eax 801058b8: e9 69 01 00 00 jmp 80105a26 <sys_link+0x1a3> begin_op(); 801058bd: e8 a4 db ff ff call 80103466 <begin_op> if((ip = namei(old)) == 0){ 801058c2: 8b 45 d8 mov -0x28(%ebp),%eax 801058c5: 83 ec 0c sub $0xc,%esp 801058c8: 50 push %eax 801058c9: e8 c3 cb ff ff call 80102491 <namei> 801058ce: 83 c4 10 add $0x10,%esp 801058d1: 89 45 f4 mov %eax,-0xc(%ebp) 801058d4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801058d8: 75 0f jne 801058e9 <sys_link+0x66> end_op(); 801058da: e8 15 dc ff ff call 801034f4 <end_op> return -1; 801058df: b8 ff ff ff ff mov $0xffffffff,%eax 801058e4: e9 3d 01 00 00 jmp 80105a26 <sys_link+0x1a3> } ilock(ip); 801058e9: 83 ec 0c sub $0xc,%esp 801058ec: ff 75 f4 pushl -0xc(%ebp) 801058ef: e8 e8 bf ff ff call 801018dc <ilock> 801058f4: 83 c4 10 add $0x10,%esp if(ip->type == T_DIR){ 801058f7: 8b 45 f4 mov -0xc(%ebp),%eax 801058fa: 0f b7 40 10 movzwl 0x10(%eax),%eax 801058fe: 66 83 f8 01 cmp $0x1,%ax 80105902: 75 1d jne 80105921 <sys_link+0x9e> iunlockput(ip); 80105904: 83 ec 0c sub $0xc,%esp 80105907: ff 75 f4 pushl -0xc(%ebp) 8010590a: e8 84 c2 ff ff call 80101b93 <iunlockput> 8010590f: 83 c4 10 add $0x10,%esp end_op(); 80105912: e8 dd db ff ff call 801034f4 <end_op> return -1; 80105917: b8 ff ff ff ff mov $0xffffffff,%eax 8010591c: e9 05 01 00 00 jmp 80105a26 <sys_link+0x1a3> } ip->nlink++; 80105921: 8b 45 f4 mov -0xc(%ebp),%eax 80105924: 0f b7 40 16 movzwl 0x16(%eax),%eax 80105928: 83 c0 01 add $0x1,%eax 8010592b: 89 c2 mov %eax,%edx 8010592d: 8b 45 f4 mov -0xc(%ebp),%eax 80105930: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 80105934: 83 ec 0c sub $0xc,%esp 80105937: ff 75 f4 pushl -0xc(%ebp) 8010593a: e8 ca bd ff ff call 80101709 <iupdate> 8010593f: 83 c4 10 add $0x10,%esp iunlock(ip); 80105942: 83 ec 0c sub $0xc,%esp 80105945: ff 75 f4 pushl -0xc(%ebp) 80105948: e8 e6 c0 ff ff call 80101a33 <iunlock> 8010594d: 83 c4 10 add $0x10,%esp if((dp = nameiparent(new, name)) == 0) 80105950: 8b 45 dc mov -0x24(%ebp),%eax 80105953: 83 ec 08 sub $0x8,%esp 80105956: 8d 55 e2 lea -0x1e(%ebp),%edx 80105959: 52 push %edx 8010595a: 50 push %eax 8010595b: e8 4d cb ff ff call 801024ad <nameiparent> 80105960: 83 c4 10 add $0x10,%esp 80105963: 89 45 f0 mov %eax,-0x10(%ebp) 80105966: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010596a: 75 02 jne 8010596e <sys_link+0xeb> goto bad; 8010596c: eb 71 jmp 801059df <sys_link+0x15c> ilock(dp); 8010596e: 83 ec 0c sub $0xc,%esp 80105971: ff 75 f0 pushl -0x10(%ebp) 80105974: e8 63 bf ff ff call 801018dc <ilock> 80105979: 83 c4 10 add $0x10,%esp if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 8010597c: 8b 45 f0 mov -0x10(%ebp),%eax 8010597f: 8b 10 mov (%eax),%edx 80105981: 8b 45 f4 mov -0xc(%ebp),%eax 80105984: 8b 00 mov (%eax),%eax 80105986: 39 c2 cmp %eax,%edx 80105988: 75 1d jne 801059a7 <sys_link+0x124> 8010598a: 8b 45 f4 mov -0xc(%ebp),%eax 8010598d: 8b 40 04 mov 0x4(%eax),%eax 80105990: 83 ec 04 sub $0x4,%esp 80105993: 50 push %eax 80105994: 8d 45 e2 lea -0x1e(%ebp),%eax 80105997: 50 push %eax 80105998: ff 75 f0 pushl -0x10(%ebp) 8010599b: e8 59 c8 ff ff call 801021f9 <dirlink> 801059a0: 83 c4 10 add $0x10,%esp 801059a3: 85 c0 test %eax,%eax 801059a5: 79 10 jns 801059b7 <sys_link+0x134> iunlockput(dp); 801059a7: 83 ec 0c sub $0xc,%esp 801059aa: ff 75 f0 pushl -0x10(%ebp) 801059ad: e8 e1 c1 ff ff call 80101b93 <iunlockput> 801059b2: 83 c4 10 add $0x10,%esp goto bad; 801059b5: eb 28 jmp 801059df <sys_link+0x15c> } iunlockput(dp); 801059b7: 83 ec 0c sub $0xc,%esp 801059ba: ff 75 f0 pushl -0x10(%ebp) 801059bd: e8 d1 c1 ff ff call 80101b93 <iunlockput> 801059c2: 83 c4 10 add $0x10,%esp iput(ip); 801059c5: 83 ec 0c sub $0xc,%esp 801059c8: ff 75 f4 pushl -0xc(%ebp) 801059cb: e8 d4 c0 ff ff call 80101aa4 <iput> 801059d0: 83 c4 10 add $0x10,%esp end_op(); 801059d3: e8 1c db ff ff call 801034f4 <end_op> return 0; 801059d8: b8 00 00 00 00 mov $0x0,%eax 801059dd: eb 47 jmp 80105a26 <sys_link+0x1a3> bad: ilock(ip); 801059df: 83 ec 0c sub $0xc,%esp 801059e2: ff 75 f4 pushl -0xc(%ebp) 801059e5: e8 f2 be ff ff call 801018dc <ilock> 801059ea: 83 c4 10 add $0x10,%esp ip->nlink--; 801059ed: 8b 45 f4 mov -0xc(%ebp),%eax 801059f0: 0f b7 40 16 movzwl 0x16(%eax),%eax 801059f4: 83 e8 01 sub $0x1,%eax 801059f7: 89 c2 mov %eax,%edx 801059f9: 8b 45 f4 mov -0xc(%ebp),%eax 801059fc: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 80105a00: 83 ec 0c sub $0xc,%esp 80105a03: ff 75 f4 pushl -0xc(%ebp) 80105a06: e8 fe bc ff ff call 80101709 <iupdate> 80105a0b: 83 c4 10 add $0x10,%esp iunlockput(ip); 80105a0e: 83 ec 0c sub $0xc,%esp 80105a11: ff 75 f4 pushl -0xc(%ebp) 80105a14: e8 7a c1 ff ff call 80101b93 <iunlockput> 80105a19: 83 c4 10 add $0x10,%esp end_op(); 80105a1c: e8 d3 da ff ff call 801034f4 <end_op> return -1; 80105a21: b8 ff ff ff ff mov $0xffffffff,%eax } 80105a26: c9 leave 80105a27: c3 ret 80105a28 <isdirempty>: // Is the directory dp empty except for "." and ".." ? static int isdirempty(struct inode *dp) { 80105a28: 55 push %ebp 80105a29: 89 e5 mov %esp,%ebp 80105a2b: 83 ec 28 sub $0x28,%esp int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 80105a2e: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp) 80105a35: eb 40 jmp 80105a77 <isdirempty+0x4f> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80105a37: 8b 45 f4 mov -0xc(%ebp),%eax 80105a3a: 6a 10 push $0x10 80105a3c: 50 push %eax 80105a3d: 8d 45 e4 lea -0x1c(%ebp),%eax 80105a40: 50 push %eax 80105a41: ff 75 08 pushl 0x8(%ebp) 80105a44: e8 f5 c3 ff ff call 80101e3e <readi> 80105a49: 83 c4 10 add $0x10,%esp 80105a4c: 83 f8 10 cmp $0x10,%eax 80105a4f: 74 0d je 80105a5e <isdirempty+0x36> panic("isdirempty: readi"); 80105a51: 83 ec 0c sub $0xc,%esp 80105a54: 68 d4 88 10 80 push $0x801088d4 80105a59: e8 fe aa ff ff call 8010055c <panic> if(de.inum != 0) 80105a5e: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 80105a62: 66 85 c0 test %ax,%ax 80105a65: 74 07 je 80105a6e <isdirempty+0x46> return 0; 80105a67: b8 00 00 00 00 mov $0x0,%eax 80105a6c: eb 1b jmp 80105a89 <isdirempty+0x61> isdirempty(struct inode *dp) { int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 80105a6e: 8b 45 f4 mov -0xc(%ebp),%eax 80105a71: 83 c0 10 add $0x10,%eax 80105a74: 89 45 f4 mov %eax,-0xc(%ebp) 80105a77: 8b 55 f4 mov -0xc(%ebp),%edx 80105a7a: 8b 45 08 mov 0x8(%ebp),%eax 80105a7d: 8b 40 18 mov 0x18(%eax),%eax 80105a80: 39 c2 cmp %eax,%edx 80105a82: 72 b3 jb 80105a37 <isdirempty+0xf> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("isdirempty: readi"); if(de.inum != 0) return 0; } return 1; 80105a84: b8 01 00 00 00 mov $0x1,%eax } 80105a89: c9 leave 80105a8a: c3 ret 80105a8b <sys_unlink>: //PAGEBREAK! int sys_unlink(void) { 80105a8b: 55 push %ebp 80105a8c: 89 e5 mov %esp,%ebp 80105a8e: 83 ec 38 sub $0x38,%esp struct inode *ip, *dp; struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) 80105a91: 83 ec 08 sub $0x8,%esp 80105a94: 8d 45 cc lea -0x34(%ebp),%eax 80105a97: 50 push %eax 80105a98: 6a 00 push $0x0 80105a9a: e8 59 fa ff ff call 801054f8 <argstr> 80105a9f: 83 c4 10 add $0x10,%esp 80105aa2: 85 c0 test %eax,%eax 80105aa4: 79 0a jns 80105ab0 <sys_unlink+0x25> return -1; 80105aa6: b8 ff ff ff ff mov $0xffffffff,%eax 80105aab: e9 bc 01 00 00 jmp 80105c6c <sys_unlink+0x1e1> begin_op(); 80105ab0: e8 b1 d9 ff ff call 80103466 <begin_op> if((dp = nameiparent(path, name)) == 0){ 80105ab5: 8b 45 cc mov -0x34(%ebp),%eax 80105ab8: 83 ec 08 sub $0x8,%esp 80105abb: 8d 55 d2 lea -0x2e(%ebp),%edx 80105abe: 52 push %edx 80105abf: 50 push %eax 80105ac0: e8 e8 c9 ff ff call 801024ad <nameiparent> 80105ac5: 83 c4 10 add $0x10,%esp 80105ac8: 89 45 f4 mov %eax,-0xc(%ebp) 80105acb: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105acf: 75 0f jne 80105ae0 <sys_unlink+0x55> end_op(); 80105ad1: e8 1e da ff ff call 801034f4 <end_op> return -1; 80105ad6: b8 ff ff ff ff mov $0xffffffff,%eax 80105adb: e9 8c 01 00 00 jmp 80105c6c <sys_unlink+0x1e1> } ilock(dp); 80105ae0: 83 ec 0c sub $0xc,%esp 80105ae3: ff 75 f4 pushl -0xc(%ebp) 80105ae6: e8 f1 bd ff ff call 801018dc <ilock> 80105aeb: 83 c4 10 add $0x10,%esp // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 80105aee: 83 ec 08 sub $0x8,%esp 80105af1: 68 e6 88 10 80 push $0x801088e6 80105af6: 8d 45 d2 lea -0x2e(%ebp),%eax 80105af9: 50 push %eax 80105afa: e8 24 c6 ff ff call 80102123 <namecmp> 80105aff: 83 c4 10 add $0x10,%esp 80105b02: 85 c0 test %eax,%eax 80105b04: 0f 84 4a 01 00 00 je 80105c54 <sys_unlink+0x1c9> 80105b0a: 83 ec 08 sub $0x8,%esp 80105b0d: 68 e8 88 10 80 push $0x801088e8 80105b12: 8d 45 d2 lea -0x2e(%ebp),%eax 80105b15: 50 push %eax 80105b16: e8 08 c6 ff ff call 80102123 <namecmp> 80105b1b: 83 c4 10 add $0x10,%esp 80105b1e: 85 c0 test %eax,%eax 80105b20: 0f 84 2e 01 00 00 je 80105c54 <sys_unlink+0x1c9> goto bad; if((ip = dirlookup(dp, name, &off)) == 0) 80105b26: 83 ec 04 sub $0x4,%esp 80105b29: 8d 45 c8 lea -0x38(%ebp),%eax 80105b2c: 50 push %eax 80105b2d: 8d 45 d2 lea -0x2e(%ebp),%eax 80105b30: 50 push %eax 80105b31: ff 75 f4 pushl -0xc(%ebp) 80105b34: e8 05 c6 ff ff call 8010213e <dirlookup> 80105b39: 83 c4 10 add $0x10,%esp 80105b3c: 89 45 f0 mov %eax,-0x10(%ebp) 80105b3f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105b43: 75 05 jne 80105b4a <sys_unlink+0xbf> goto bad; 80105b45: e9 0a 01 00 00 jmp 80105c54 <sys_unlink+0x1c9> ilock(ip); 80105b4a: 83 ec 0c sub $0xc,%esp 80105b4d: ff 75 f0 pushl -0x10(%ebp) 80105b50: e8 87 bd ff ff call 801018dc <ilock> 80105b55: 83 c4 10 add $0x10,%esp if(ip->nlink < 1) 80105b58: 8b 45 f0 mov -0x10(%ebp),%eax 80105b5b: 0f b7 40 16 movzwl 0x16(%eax),%eax 80105b5f: 66 85 c0 test %ax,%ax 80105b62: 7f 0d jg 80105b71 <sys_unlink+0xe6> panic("unlink: nlink < 1"); 80105b64: 83 ec 0c sub $0xc,%esp 80105b67: 68 eb 88 10 80 push $0x801088eb 80105b6c: e8 eb a9 ff ff call 8010055c <panic> if(ip->type == T_DIR && !isdirempty(ip)){ 80105b71: 8b 45 f0 mov -0x10(%ebp),%eax 80105b74: 0f b7 40 10 movzwl 0x10(%eax),%eax 80105b78: 66 83 f8 01 cmp $0x1,%ax 80105b7c: 75 25 jne 80105ba3 <sys_unlink+0x118> 80105b7e: 83 ec 0c sub $0xc,%esp 80105b81: ff 75 f0 pushl -0x10(%ebp) 80105b84: e8 9f fe ff ff call 80105a28 <isdirempty> 80105b89: 83 c4 10 add $0x10,%esp 80105b8c: 85 c0 test %eax,%eax 80105b8e: 75 13 jne 80105ba3 <sys_unlink+0x118> iunlockput(ip); 80105b90: 83 ec 0c sub $0xc,%esp 80105b93: ff 75 f0 pushl -0x10(%ebp) 80105b96: e8 f8 bf ff ff call 80101b93 <iunlockput> 80105b9b: 83 c4 10 add $0x10,%esp goto bad; 80105b9e: e9 b1 00 00 00 jmp 80105c54 <sys_unlink+0x1c9> } memset(&de, 0, sizeof(de)); 80105ba3: 83 ec 04 sub $0x4,%esp 80105ba6: 6a 10 push $0x10 80105ba8: 6a 00 push $0x0 80105baa: 8d 45 e0 lea -0x20(%ebp),%eax 80105bad: 50 push %eax 80105bae: e8 97 f5 ff ff call 8010514a <memset> 80105bb3: 83 c4 10 add $0x10,%esp if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80105bb6: 8b 45 c8 mov -0x38(%ebp),%eax 80105bb9: 6a 10 push $0x10 80105bbb: 50 push %eax 80105bbc: 8d 45 e0 lea -0x20(%ebp),%eax 80105bbf: 50 push %eax 80105bc0: ff 75 f4 pushl -0xc(%ebp) 80105bc3: e8 d0 c3 ff ff call 80101f98 <writei> 80105bc8: 83 c4 10 add $0x10,%esp 80105bcb: 83 f8 10 cmp $0x10,%eax 80105bce: 74 0d je 80105bdd <sys_unlink+0x152> panic("unlink: writei"); 80105bd0: 83 ec 0c sub $0xc,%esp 80105bd3: 68 fd 88 10 80 push $0x801088fd 80105bd8: e8 7f a9 ff ff call 8010055c <panic> if(ip->type == T_DIR){ 80105bdd: 8b 45 f0 mov -0x10(%ebp),%eax 80105be0: 0f b7 40 10 movzwl 0x10(%eax),%eax 80105be4: 66 83 f8 01 cmp $0x1,%ax 80105be8: 75 21 jne 80105c0b <sys_unlink+0x180> dp->nlink--; 80105bea: 8b 45 f4 mov -0xc(%ebp),%eax 80105bed: 0f b7 40 16 movzwl 0x16(%eax),%eax 80105bf1: 83 e8 01 sub $0x1,%eax 80105bf4: 89 c2 mov %eax,%edx 80105bf6: 8b 45 f4 mov -0xc(%ebp),%eax 80105bf9: 66 89 50 16 mov %dx,0x16(%eax) iupdate(dp); 80105bfd: 83 ec 0c sub $0xc,%esp 80105c00: ff 75 f4 pushl -0xc(%ebp) 80105c03: e8 01 bb ff ff call 80101709 <iupdate> 80105c08: 83 c4 10 add $0x10,%esp } iunlockput(dp); 80105c0b: 83 ec 0c sub $0xc,%esp 80105c0e: ff 75 f4 pushl -0xc(%ebp) 80105c11: e8 7d bf ff ff call 80101b93 <iunlockput> 80105c16: 83 c4 10 add $0x10,%esp ip->nlink--; 80105c19: 8b 45 f0 mov -0x10(%ebp),%eax 80105c1c: 0f b7 40 16 movzwl 0x16(%eax),%eax 80105c20: 83 e8 01 sub $0x1,%eax 80105c23: 89 c2 mov %eax,%edx 80105c25: 8b 45 f0 mov -0x10(%ebp),%eax 80105c28: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 80105c2c: 83 ec 0c sub $0xc,%esp 80105c2f: ff 75 f0 pushl -0x10(%ebp) 80105c32: e8 d2 ba ff ff call 80101709 <iupdate> 80105c37: 83 c4 10 add $0x10,%esp iunlockput(ip); 80105c3a: 83 ec 0c sub $0xc,%esp 80105c3d: ff 75 f0 pushl -0x10(%ebp) 80105c40: e8 4e bf ff ff call 80101b93 <iunlockput> 80105c45: 83 c4 10 add $0x10,%esp end_op(); 80105c48: e8 a7 d8 ff ff call 801034f4 <end_op> return 0; 80105c4d: b8 00 00 00 00 mov $0x0,%eax 80105c52: eb 18 jmp 80105c6c <sys_unlink+0x1e1> bad: iunlockput(dp); 80105c54: 83 ec 0c sub $0xc,%esp 80105c57: ff 75 f4 pushl -0xc(%ebp) 80105c5a: e8 34 bf ff ff call 80101b93 <iunlockput> 80105c5f: 83 c4 10 add $0x10,%esp end_op(); 80105c62: e8 8d d8 ff ff call 801034f4 <end_op> return -1; 80105c67: b8 ff ff ff ff mov $0xffffffff,%eax } 80105c6c: c9 leave 80105c6d: c3 ret 80105c6e <create>: static struct inode* create(char *path, short type, short major, short minor) { 80105c6e: 55 push %ebp 80105c6f: 89 e5 mov %esp,%ebp 80105c71: 83 ec 38 sub $0x38,%esp 80105c74: 8b 4d 0c mov 0xc(%ebp),%ecx 80105c77: 8b 55 10 mov 0x10(%ebp),%edx 80105c7a: 8b 45 14 mov 0x14(%ebp),%eax 80105c7d: 66 89 4d d4 mov %cx,-0x2c(%ebp) 80105c81: 66 89 55 d0 mov %dx,-0x30(%ebp) 80105c85: 66 89 45 cc mov %ax,-0x34(%ebp) uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 80105c89: 83 ec 08 sub $0x8,%esp 80105c8c: 8d 45 de lea -0x22(%ebp),%eax 80105c8f: 50 push %eax 80105c90: ff 75 08 pushl 0x8(%ebp) 80105c93: e8 15 c8 ff ff call 801024ad <nameiparent> 80105c98: 83 c4 10 add $0x10,%esp 80105c9b: 89 45 f4 mov %eax,-0xc(%ebp) 80105c9e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105ca2: 75 0a jne 80105cae <create+0x40> return 0; 80105ca4: b8 00 00 00 00 mov $0x0,%eax 80105ca9: e9 90 01 00 00 jmp 80105e3e <create+0x1d0> ilock(dp); 80105cae: 83 ec 0c sub $0xc,%esp 80105cb1: ff 75 f4 pushl -0xc(%ebp) 80105cb4: e8 23 bc ff ff call 801018dc <ilock> 80105cb9: 83 c4 10 add $0x10,%esp if((ip = dirlookup(dp, name, &off)) != 0){ 80105cbc: 83 ec 04 sub $0x4,%esp 80105cbf: 8d 45 ec lea -0x14(%ebp),%eax 80105cc2: 50 push %eax 80105cc3: 8d 45 de lea -0x22(%ebp),%eax 80105cc6: 50 push %eax 80105cc7: ff 75 f4 pushl -0xc(%ebp) 80105cca: e8 6f c4 ff ff call 8010213e <dirlookup> 80105ccf: 83 c4 10 add $0x10,%esp 80105cd2: 89 45 f0 mov %eax,-0x10(%ebp) 80105cd5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105cd9: 74 50 je 80105d2b <create+0xbd> iunlockput(dp); 80105cdb: 83 ec 0c sub $0xc,%esp 80105cde: ff 75 f4 pushl -0xc(%ebp) 80105ce1: e8 ad be ff ff call 80101b93 <iunlockput> 80105ce6: 83 c4 10 add $0x10,%esp ilock(ip); 80105ce9: 83 ec 0c sub $0xc,%esp 80105cec: ff 75 f0 pushl -0x10(%ebp) 80105cef: e8 e8 bb ff ff call 801018dc <ilock> 80105cf4: 83 c4 10 add $0x10,%esp if(type == T_FILE && ip->type == T_FILE) 80105cf7: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) 80105cfc: 75 15 jne 80105d13 <create+0xa5> 80105cfe: 8b 45 f0 mov -0x10(%ebp),%eax 80105d01: 0f b7 40 10 movzwl 0x10(%eax),%eax 80105d05: 66 83 f8 02 cmp $0x2,%ax 80105d09: 75 08 jne 80105d13 <create+0xa5> return ip; 80105d0b: 8b 45 f0 mov -0x10(%ebp),%eax 80105d0e: e9 2b 01 00 00 jmp 80105e3e <create+0x1d0> iunlockput(ip); 80105d13: 83 ec 0c sub $0xc,%esp 80105d16: ff 75 f0 pushl -0x10(%ebp) 80105d19: e8 75 be ff ff call 80101b93 <iunlockput> 80105d1e: 83 c4 10 add $0x10,%esp return 0; 80105d21: b8 00 00 00 00 mov $0x0,%eax 80105d26: e9 13 01 00 00 jmp 80105e3e <create+0x1d0> } if((ip = ialloc(dp->dev, type)) == 0) 80105d2b: 0f bf 55 d4 movswl -0x2c(%ebp),%edx 80105d2f: 8b 45 f4 mov -0xc(%ebp),%eax 80105d32: 8b 00 mov (%eax),%eax 80105d34: 83 ec 08 sub $0x8,%esp 80105d37: 52 push %edx 80105d38: 50 push %eax 80105d39: e8 ea b8 ff ff call 80101628 <ialloc> 80105d3e: 83 c4 10 add $0x10,%esp 80105d41: 89 45 f0 mov %eax,-0x10(%ebp) 80105d44: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105d48: 75 0d jne 80105d57 <create+0xe9> panic("create: ialloc"); 80105d4a: 83 ec 0c sub $0xc,%esp 80105d4d: 68 0c 89 10 80 push $0x8010890c 80105d52: e8 05 a8 ff ff call 8010055c <panic> ilock(ip); 80105d57: 83 ec 0c sub $0xc,%esp 80105d5a: ff 75 f0 pushl -0x10(%ebp) 80105d5d: e8 7a bb ff ff call 801018dc <ilock> 80105d62: 83 c4 10 add $0x10,%esp ip->major = major; 80105d65: 8b 45 f0 mov -0x10(%ebp),%eax 80105d68: 0f b7 55 d0 movzwl -0x30(%ebp),%edx 80105d6c: 66 89 50 12 mov %dx,0x12(%eax) ip->minor = minor; 80105d70: 8b 45 f0 mov -0x10(%ebp),%eax 80105d73: 0f b7 55 cc movzwl -0x34(%ebp),%edx 80105d77: 66 89 50 14 mov %dx,0x14(%eax) ip->nlink = 1; 80105d7b: 8b 45 f0 mov -0x10(%ebp),%eax 80105d7e: 66 c7 40 16 01 00 movw $0x1,0x16(%eax) iupdate(ip); 80105d84: 83 ec 0c sub $0xc,%esp 80105d87: ff 75 f0 pushl -0x10(%ebp) 80105d8a: e8 7a b9 ff ff call 80101709 <iupdate> 80105d8f: 83 c4 10 add $0x10,%esp if(type == T_DIR){ // Create . and .. entries. 80105d92: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) 80105d97: 75 6a jne 80105e03 <create+0x195> dp->nlink++; // for ".." 80105d99: 8b 45 f4 mov -0xc(%ebp),%eax 80105d9c: 0f b7 40 16 movzwl 0x16(%eax),%eax 80105da0: 83 c0 01 add $0x1,%eax 80105da3: 89 c2 mov %eax,%edx 80105da5: 8b 45 f4 mov -0xc(%ebp),%eax 80105da8: 66 89 50 16 mov %dx,0x16(%eax) iupdate(dp); 80105dac: 83 ec 0c sub $0xc,%esp 80105daf: ff 75 f4 pushl -0xc(%ebp) 80105db2: e8 52 b9 ff ff call 80101709 <iupdate> 80105db7: 83 c4 10 add $0x10,%esp // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 80105dba: 8b 45 f0 mov -0x10(%ebp),%eax 80105dbd: 8b 40 04 mov 0x4(%eax),%eax 80105dc0: 83 ec 04 sub $0x4,%esp 80105dc3: 50 push %eax 80105dc4: 68 e6 88 10 80 push $0x801088e6 80105dc9: ff 75 f0 pushl -0x10(%ebp) 80105dcc: e8 28 c4 ff ff call 801021f9 <dirlink> 80105dd1: 83 c4 10 add $0x10,%esp 80105dd4: 85 c0 test %eax,%eax 80105dd6: 78 1e js 80105df6 <create+0x188> 80105dd8: 8b 45 f4 mov -0xc(%ebp),%eax 80105ddb: 8b 40 04 mov 0x4(%eax),%eax 80105dde: 83 ec 04 sub $0x4,%esp 80105de1: 50 push %eax 80105de2: 68 e8 88 10 80 push $0x801088e8 80105de7: ff 75 f0 pushl -0x10(%ebp) 80105dea: e8 0a c4 ff ff call 801021f9 <dirlink> 80105def: 83 c4 10 add $0x10,%esp 80105df2: 85 c0 test %eax,%eax 80105df4: 79 0d jns 80105e03 <create+0x195> panic("create dots"); 80105df6: 83 ec 0c sub $0xc,%esp 80105df9: 68 1b 89 10 80 push $0x8010891b 80105dfe: e8 59 a7 ff ff call 8010055c <panic> } if(dirlink(dp, name, ip->inum) < 0) 80105e03: 8b 45 f0 mov -0x10(%ebp),%eax 80105e06: 8b 40 04 mov 0x4(%eax),%eax 80105e09: 83 ec 04 sub $0x4,%esp 80105e0c: 50 push %eax 80105e0d: 8d 45 de lea -0x22(%ebp),%eax 80105e10: 50 push %eax 80105e11: ff 75 f4 pushl -0xc(%ebp) 80105e14: e8 e0 c3 ff ff call 801021f9 <dirlink> 80105e19: 83 c4 10 add $0x10,%esp 80105e1c: 85 c0 test %eax,%eax 80105e1e: 79 0d jns 80105e2d <create+0x1bf> panic("create: dirlink"); 80105e20: 83 ec 0c sub $0xc,%esp 80105e23: 68 27 89 10 80 push $0x80108927 80105e28: e8 2f a7 ff ff call 8010055c <panic> iunlockput(dp); 80105e2d: 83 ec 0c sub $0xc,%esp 80105e30: ff 75 f4 pushl -0xc(%ebp) 80105e33: e8 5b bd ff ff call 80101b93 <iunlockput> 80105e38: 83 c4 10 add $0x10,%esp return ip; 80105e3b: 8b 45 f0 mov -0x10(%ebp),%eax } 80105e3e: c9 leave 80105e3f: c3 ret 80105e40 <sys_open>: int sys_open(void) { 80105e40: 55 push %ebp 80105e41: 89 e5 mov %esp,%ebp 80105e43: 83 ec 28 sub $0x28,%esp char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 80105e46: 83 ec 08 sub $0x8,%esp 80105e49: 8d 45 e8 lea -0x18(%ebp),%eax 80105e4c: 50 push %eax 80105e4d: 6a 00 push $0x0 80105e4f: e8 a4 f6 ff ff call 801054f8 <argstr> 80105e54: 83 c4 10 add $0x10,%esp 80105e57: 85 c0 test %eax,%eax 80105e59: 78 15 js 80105e70 <sys_open+0x30> 80105e5b: 83 ec 08 sub $0x8,%esp 80105e5e: 8d 45 e4 lea -0x1c(%ebp),%eax 80105e61: 50 push %eax 80105e62: 6a 01 push $0x1 80105e64: e8 08 f6 ff ff call 80105471 <argint> 80105e69: 83 c4 10 add $0x10,%esp 80105e6c: 85 c0 test %eax,%eax 80105e6e: 79 0a jns 80105e7a <sys_open+0x3a> return -1; 80105e70: b8 ff ff ff ff mov $0xffffffff,%eax 80105e75: e9 61 01 00 00 jmp 80105fdb <sys_open+0x19b> begin_op(); 80105e7a: e8 e7 d5 ff ff call 80103466 <begin_op> if(omode & O_CREATE){ 80105e7f: 8b 45 e4 mov -0x1c(%ebp),%eax 80105e82: 25 00 02 00 00 and $0x200,%eax 80105e87: 85 c0 test %eax,%eax 80105e89: 74 2a je 80105eb5 <sys_open+0x75> ip = create(path, T_FILE, 0, 0); 80105e8b: 8b 45 e8 mov -0x18(%ebp),%eax 80105e8e: 6a 00 push $0x0 80105e90: 6a 00 push $0x0 80105e92: 6a 02 push $0x2 80105e94: 50 push %eax 80105e95: e8 d4 fd ff ff call 80105c6e <create> 80105e9a: 83 c4 10 add $0x10,%esp 80105e9d: 89 45 f4 mov %eax,-0xc(%ebp) if(ip == 0){ 80105ea0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105ea4: 75 75 jne 80105f1b <sys_open+0xdb> end_op(); 80105ea6: e8 49 d6 ff ff call 801034f4 <end_op> return -1; 80105eab: b8 ff ff ff ff mov $0xffffffff,%eax 80105eb0: e9 26 01 00 00 jmp 80105fdb <sys_open+0x19b> } } else { if((ip = namei(path)) == 0){ 80105eb5: 8b 45 e8 mov -0x18(%ebp),%eax 80105eb8: 83 ec 0c sub $0xc,%esp 80105ebb: 50 push %eax 80105ebc: e8 d0 c5 ff ff call 80102491 <namei> 80105ec1: 83 c4 10 add $0x10,%esp 80105ec4: 89 45 f4 mov %eax,-0xc(%ebp) 80105ec7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105ecb: 75 0f jne 80105edc <sys_open+0x9c> end_op(); 80105ecd: e8 22 d6 ff ff call 801034f4 <end_op> return -1; 80105ed2: b8 ff ff ff ff mov $0xffffffff,%eax 80105ed7: e9 ff 00 00 00 jmp 80105fdb <sys_open+0x19b> } ilock(ip); 80105edc: 83 ec 0c sub $0xc,%esp 80105edf: ff 75 f4 pushl -0xc(%ebp) 80105ee2: e8 f5 b9 ff ff call 801018dc <ilock> 80105ee7: 83 c4 10 add $0x10,%esp if(ip->type == T_DIR && omode != O_RDONLY){ 80105eea: 8b 45 f4 mov -0xc(%ebp),%eax 80105eed: 0f b7 40 10 movzwl 0x10(%eax),%eax 80105ef1: 66 83 f8 01 cmp $0x1,%ax 80105ef5: 75 24 jne 80105f1b <sys_open+0xdb> 80105ef7: 8b 45 e4 mov -0x1c(%ebp),%eax 80105efa: 85 c0 test %eax,%eax 80105efc: 74 1d je 80105f1b <sys_open+0xdb> iunlockput(ip); 80105efe: 83 ec 0c sub $0xc,%esp 80105f01: ff 75 f4 pushl -0xc(%ebp) 80105f04: e8 8a bc ff ff call 80101b93 <iunlockput> 80105f09: 83 c4 10 add $0x10,%esp end_op(); 80105f0c: e8 e3 d5 ff ff call 801034f4 <end_op> return -1; 80105f11: b8 ff ff ff ff mov $0xffffffff,%eax 80105f16: e9 c0 00 00 00 jmp 80105fdb <sys_open+0x19b> } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 80105f1b: e8 30 b0 ff ff call 80100f50 <filealloc> 80105f20: 89 45 f0 mov %eax,-0x10(%ebp) 80105f23: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105f27: 74 17 je 80105f40 <sys_open+0x100> 80105f29: 83 ec 0c sub $0xc,%esp 80105f2c: ff 75 f0 pushl -0x10(%ebp) 80105f2f: e8 36 f7 ff ff call 8010566a <fdalloc> 80105f34: 83 c4 10 add $0x10,%esp 80105f37: 89 45 ec mov %eax,-0x14(%ebp) 80105f3a: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80105f3e: 79 2e jns 80105f6e <sys_open+0x12e> if(f) 80105f40: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105f44: 74 0e je 80105f54 <sys_open+0x114> fileclose(f); 80105f46: 83 ec 0c sub $0xc,%esp 80105f49: ff 75 f0 pushl -0x10(%ebp) 80105f4c: e8 bc b0 ff ff call 8010100d <fileclose> 80105f51: 83 c4 10 add $0x10,%esp iunlockput(ip); 80105f54: 83 ec 0c sub $0xc,%esp 80105f57: ff 75 f4 pushl -0xc(%ebp) 80105f5a: e8 34 bc ff ff call 80101b93 <iunlockput> 80105f5f: 83 c4 10 add $0x10,%esp end_op(); 80105f62: e8 8d d5 ff ff call 801034f4 <end_op> return -1; 80105f67: b8 ff ff ff ff mov $0xffffffff,%eax 80105f6c: eb 6d jmp 80105fdb <sys_open+0x19b> } iunlock(ip); 80105f6e: 83 ec 0c sub $0xc,%esp 80105f71: ff 75 f4 pushl -0xc(%ebp) 80105f74: e8 ba ba ff ff call 80101a33 <iunlock> 80105f79: 83 c4 10 add $0x10,%esp end_op(); 80105f7c: e8 73 d5 ff ff call 801034f4 <end_op> f->type = FD_INODE; 80105f81: 8b 45 f0 mov -0x10(%ebp),%eax 80105f84: c7 00 02 00 00 00 movl $0x2,(%eax) f->ip = ip; 80105f8a: 8b 45 f0 mov -0x10(%ebp),%eax 80105f8d: 8b 55 f4 mov -0xc(%ebp),%edx 80105f90: 89 50 10 mov %edx,0x10(%eax) f->off = 0; 80105f93: 8b 45 f0 mov -0x10(%ebp),%eax 80105f96: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) f->readable = !(omode & O_WRONLY); 80105f9d: 8b 45 e4 mov -0x1c(%ebp),%eax 80105fa0: 83 e0 01 and $0x1,%eax 80105fa3: 85 c0 test %eax,%eax 80105fa5: 0f 94 c0 sete %al 80105fa8: 89 c2 mov %eax,%edx 80105faa: 8b 45 f0 mov -0x10(%ebp),%eax 80105fad: 88 50 08 mov %dl,0x8(%eax) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80105fb0: 8b 45 e4 mov -0x1c(%ebp),%eax 80105fb3: 83 e0 01 and $0x1,%eax 80105fb6: 85 c0 test %eax,%eax 80105fb8: 75 0a jne 80105fc4 <sys_open+0x184> 80105fba: 8b 45 e4 mov -0x1c(%ebp),%eax 80105fbd: 83 e0 02 and $0x2,%eax 80105fc0: 85 c0 test %eax,%eax 80105fc2: 74 07 je 80105fcb <sys_open+0x18b> 80105fc4: b8 01 00 00 00 mov $0x1,%eax 80105fc9: eb 05 jmp 80105fd0 <sys_open+0x190> 80105fcb: b8 00 00 00 00 mov $0x0,%eax 80105fd0: 89 c2 mov %eax,%edx 80105fd2: 8b 45 f0 mov -0x10(%ebp),%eax 80105fd5: 88 50 09 mov %dl,0x9(%eax) return fd; 80105fd8: 8b 45 ec mov -0x14(%ebp),%eax } 80105fdb: c9 leave 80105fdc: c3 ret 80105fdd <sys_mkdir>: int sys_mkdir(void) { 80105fdd: 55 push %ebp 80105fde: 89 e5 mov %esp,%ebp 80105fe0: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 80105fe3: e8 7e d4 ff ff call 80103466 <begin_op> if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 80105fe8: 83 ec 08 sub $0x8,%esp 80105feb: 8d 45 f0 lea -0x10(%ebp),%eax 80105fee: 50 push %eax 80105fef: 6a 00 push $0x0 80105ff1: e8 02 f5 ff ff call 801054f8 <argstr> 80105ff6: 83 c4 10 add $0x10,%esp 80105ff9: 85 c0 test %eax,%eax 80105ffb: 78 1b js 80106018 <sys_mkdir+0x3b> 80105ffd: 8b 45 f0 mov -0x10(%ebp),%eax 80106000: 6a 00 push $0x0 80106002: 6a 00 push $0x0 80106004: 6a 01 push $0x1 80106006: 50 push %eax 80106007: e8 62 fc ff ff call 80105c6e <create> 8010600c: 83 c4 10 add $0x10,%esp 8010600f: 89 45 f4 mov %eax,-0xc(%ebp) 80106012: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106016: 75 0c jne 80106024 <sys_mkdir+0x47> end_op(); 80106018: e8 d7 d4 ff ff call 801034f4 <end_op> return -1; 8010601d: b8 ff ff ff ff mov $0xffffffff,%eax 80106022: eb 18 jmp 8010603c <sys_mkdir+0x5f> } iunlockput(ip); 80106024: 83 ec 0c sub $0xc,%esp 80106027: ff 75 f4 pushl -0xc(%ebp) 8010602a: e8 64 bb ff ff call 80101b93 <iunlockput> 8010602f: 83 c4 10 add $0x10,%esp end_op(); 80106032: e8 bd d4 ff ff call 801034f4 <end_op> return 0; 80106037: b8 00 00 00 00 mov $0x0,%eax } 8010603c: c9 leave 8010603d: c3 ret 8010603e <sys_mknod>: int sys_mknod(void) { 8010603e: 55 push %ebp 8010603f: 89 e5 mov %esp,%ebp 80106041: 83 ec 28 sub $0x28,%esp struct inode *ip; char *path; int len; int major, minor; begin_op(); 80106044: e8 1d d4 ff ff call 80103466 <begin_op> if((len=argstr(0, &path)) < 0 || 80106049: 83 ec 08 sub $0x8,%esp 8010604c: 8d 45 ec lea -0x14(%ebp),%eax 8010604f: 50 push %eax 80106050: 6a 00 push $0x0 80106052: e8 a1 f4 ff ff call 801054f8 <argstr> 80106057: 83 c4 10 add $0x10,%esp 8010605a: 89 45 f4 mov %eax,-0xc(%ebp) 8010605d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106061: 78 4f js 801060b2 <sys_mknod+0x74> argint(1, &major) < 0 || 80106063: 83 ec 08 sub $0x8,%esp 80106066: 8d 45 e8 lea -0x18(%ebp),%eax 80106069: 50 push %eax 8010606a: 6a 01 push $0x1 8010606c: e8 00 f4 ff ff call 80105471 <argint> 80106071: 83 c4 10 add $0x10,%esp char *path; int len; int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || 80106074: 85 c0 test %eax,%eax 80106076: 78 3a js 801060b2 <sys_mknod+0x74> argint(1, &major) < 0 || argint(2, &minor) < 0 || 80106078: 83 ec 08 sub $0x8,%esp 8010607b: 8d 45 e4 lea -0x1c(%ebp),%eax 8010607e: 50 push %eax 8010607f: 6a 02 push $0x2 80106081: e8 eb f3 ff ff call 80105471 <argint> 80106086: 83 c4 10 add $0x10,%esp int len; int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || argint(1, &major) < 0 || 80106089: 85 c0 test %eax,%eax 8010608b: 78 25 js 801060b2 <sys_mknod+0x74> argint(2, &minor) < 0 || (ip = create(path, T_DEV, major, minor)) == 0){ 8010608d: 8b 45 e4 mov -0x1c(%ebp),%eax 80106090: 0f bf c8 movswl %ax,%ecx 80106093: 8b 45 e8 mov -0x18(%ebp),%eax 80106096: 0f bf d0 movswl %ax,%edx 80106099: 8b 45 ec mov -0x14(%ebp),%eax int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || argint(1, &major) < 0 || argint(2, &minor) < 0 || 8010609c: 51 push %ecx 8010609d: 52 push %edx 8010609e: 6a 03 push $0x3 801060a0: 50 push %eax 801060a1: e8 c8 fb ff ff call 80105c6e <create> 801060a6: 83 c4 10 add $0x10,%esp 801060a9: 89 45 f0 mov %eax,-0x10(%ebp) 801060ac: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801060b0: 75 0c jne 801060be <sys_mknod+0x80> (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); 801060b2: e8 3d d4 ff ff call 801034f4 <end_op> return -1; 801060b7: b8 ff ff ff ff mov $0xffffffff,%eax 801060bc: eb 18 jmp 801060d6 <sys_mknod+0x98> } iunlockput(ip); 801060be: 83 ec 0c sub $0xc,%esp 801060c1: ff 75 f0 pushl -0x10(%ebp) 801060c4: e8 ca ba ff ff call 80101b93 <iunlockput> 801060c9: 83 c4 10 add $0x10,%esp end_op(); 801060cc: e8 23 d4 ff ff call 801034f4 <end_op> return 0; 801060d1: b8 00 00 00 00 mov $0x0,%eax } 801060d6: c9 leave 801060d7: c3 ret 801060d8 <sys_chdir>: int sys_chdir(void) { 801060d8: 55 push %ebp 801060d9: 89 e5 mov %esp,%ebp 801060db: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 801060de: e8 83 d3 ff ff call 80103466 <begin_op> if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ 801060e3: 83 ec 08 sub $0x8,%esp 801060e6: 8d 45 f0 lea -0x10(%ebp),%eax 801060e9: 50 push %eax 801060ea: 6a 00 push $0x0 801060ec: e8 07 f4 ff ff call 801054f8 <argstr> 801060f1: 83 c4 10 add $0x10,%esp 801060f4: 85 c0 test %eax,%eax 801060f6: 78 18 js 80106110 <sys_chdir+0x38> 801060f8: 8b 45 f0 mov -0x10(%ebp),%eax 801060fb: 83 ec 0c sub $0xc,%esp 801060fe: 50 push %eax 801060ff: e8 8d c3 ff ff call 80102491 <namei> 80106104: 83 c4 10 add $0x10,%esp 80106107: 89 45 f4 mov %eax,-0xc(%ebp) 8010610a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010610e: 75 0c jne 8010611c <sys_chdir+0x44> end_op(); 80106110: e8 df d3 ff ff call 801034f4 <end_op> return -1; 80106115: b8 ff ff ff ff mov $0xffffffff,%eax 8010611a: eb 6e jmp 8010618a <sys_chdir+0xb2> } ilock(ip); 8010611c: 83 ec 0c sub $0xc,%esp 8010611f: ff 75 f4 pushl -0xc(%ebp) 80106122: e8 b5 b7 ff ff call 801018dc <ilock> 80106127: 83 c4 10 add $0x10,%esp if(ip->type != T_DIR){ 8010612a: 8b 45 f4 mov -0xc(%ebp),%eax 8010612d: 0f b7 40 10 movzwl 0x10(%eax),%eax 80106131: 66 83 f8 01 cmp $0x1,%ax 80106135: 74 1a je 80106151 <sys_chdir+0x79> iunlockput(ip); 80106137: 83 ec 0c sub $0xc,%esp 8010613a: ff 75 f4 pushl -0xc(%ebp) 8010613d: e8 51 ba ff ff call 80101b93 <iunlockput> 80106142: 83 c4 10 add $0x10,%esp end_op(); 80106145: e8 aa d3 ff ff call 801034f4 <end_op> return -1; 8010614a: b8 ff ff ff ff mov $0xffffffff,%eax 8010614f: eb 39 jmp 8010618a <sys_chdir+0xb2> } iunlock(ip); 80106151: 83 ec 0c sub $0xc,%esp 80106154: ff 75 f4 pushl -0xc(%ebp) 80106157: e8 d7 b8 ff ff call 80101a33 <iunlock> 8010615c: 83 c4 10 add $0x10,%esp iput(proc->cwd); 8010615f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106165: 8b 40 68 mov 0x68(%eax),%eax 80106168: 83 ec 0c sub $0xc,%esp 8010616b: 50 push %eax 8010616c: e8 33 b9 ff ff call 80101aa4 <iput> 80106171: 83 c4 10 add $0x10,%esp end_op(); 80106174: e8 7b d3 ff ff call 801034f4 <end_op> proc->cwd = ip; 80106179: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010617f: 8b 55 f4 mov -0xc(%ebp),%edx 80106182: 89 50 68 mov %edx,0x68(%eax) return 0; 80106185: b8 00 00 00 00 mov $0x0,%eax } 8010618a: c9 leave 8010618b: c3 ret 8010618c <sys_exec>: int sys_exec(void) { 8010618c: 55 push %ebp 8010618d: 89 e5 mov %esp,%ebp 8010618f: 81 ec 98 00 00 00 sub $0x98,%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 80106195: 83 ec 08 sub $0x8,%esp 80106198: 8d 45 f0 lea -0x10(%ebp),%eax 8010619b: 50 push %eax 8010619c: 6a 00 push $0x0 8010619e: e8 55 f3 ff ff call 801054f8 <argstr> 801061a3: 83 c4 10 add $0x10,%esp 801061a6: 85 c0 test %eax,%eax 801061a8: 78 18 js 801061c2 <sys_exec+0x36> 801061aa: 83 ec 08 sub $0x8,%esp 801061ad: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax 801061b3: 50 push %eax 801061b4: 6a 01 push $0x1 801061b6: e8 b6 f2 ff ff call 80105471 <argint> 801061bb: 83 c4 10 add $0x10,%esp 801061be: 85 c0 test %eax,%eax 801061c0: 79 0a jns 801061cc <sys_exec+0x40> return -1; 801061c2: b8 ff ff ff ff mov $0xffffffff,%eax 801061c7: e9 c6 00 00 00 jmp 80106292 <sys_exec+0x106> } memset(argv, 0, sizeof(argv)); 801061cc: 83 ec 04 sub $0x4,%esp 801061cf: 68 80 00 00 00 push $0x80 801061d4: 6a 00 push $0x0 801061d6: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax 801061dc: 50 push %eax 801061dd: e8 68 ef ff ff call 8010514a <memset> 801061e2: 83 c4 10 add $0x10,%esp for(i=0;; i++){ 801061e5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if(i >= NELEM(argv)) 801061ec: 8b 45 f4 mov -0xc(%ebp),%eax 801061ef: 83 f8 1f cmp $0x1f,%eax 801061f2: 76 0a jbe 801061fe <sys_exec+0x72> return -1; 801061f4: b8 ff ff ff ff mov $0xffffffff,%eax 801061f9: e9 94 00 00 00 jmp 80106292 <sys_exec+0x106> if(fetchint(uargv+4*i, (int*)&uarg) < 0) 801061fe: 8b 45 f4 mov -0xc(%ebp),%eax 80106201: c1 e0 02 shl $0x2,%eax 80106204: 89 c2 mov %eax,%edx 80106206: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax 8010620c: 01 c2 add %eax,%edx 8010620e: 83 ec 08 sub $0x8,%esp 80106211: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax 80106217: 50 push %eax 80106218: 52 push %edx 80106219: e8 b7 f1 ff ff call 801053d5 <fetchint> 8010621e: 83 c4 10 add $0x10,%esp 80106221: 85 c0 test %eax,%eax 80106223: 79 07 jns 8010622c <sys_exec+0xa0> return -1; 80106225: b8 ff ff ff ff mov $0xffffffff,%eax 8010622a: eb 66 jmp 80106292 <sys_exec+0x106> if(uarg == 0){ 8010622c: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax 80106232: 85 c0 test %eax,%eax 80106234: 75 27 jne 8010625d <sys_exec+0xd1> argv[i] = 0; 80106236: 8b 45 f4 mov -0xc(%ebp),%eax 80106239: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4) 80106240: 00 00 00 00 break; 80106244: 90 nop } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 80106245: 8b 45 f0 mov -0x10(%ebp),%eax 80106248: 83 ec 08 sub $0x8,%esp 8010624b: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx 80106251: 52 push %edx 80106252: 50 push %eax 80106253: e8 ec a8 ff ff call 80100b44 <exec> 80106258: 83 c4 10 add $0x10,%esp 8010625b: eb 35 jmp 80106292 <sys_exec+0x106> return -1; if(uarg == 0){ argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) 8010625d: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax 80106263: 8b 55 f4 mov -0xc(%ebp),%edx 80106266: c1 e2 02 shl $0x2,%edx 80106269: 01 c2 add %eax,%edx 8010626b: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax 80106271: 83 ec 08 sub $0x8,%esp 80106274: 52 push %edx 80106275: 50 push %eax 80106276: e8 94 f1 ff ff call 8010540f <fetchstr> 8010627b: 83 c4 10 add $0x10,%esp 8010627e: 85 c0 test %eax,%eax 80106280: 79 07 jns 80106289 <sys_exec+0xfd> return -1; 80106282: b8 ff ff ff ff mov $0xffffffff,%eax 80106287: eb 09 jmp 80106292 <sys_exec+0x106> if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); for(i=0;; i++){ 80106289: 83 45 f4 01 addl $0x1,-0xc(%ebp) argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } 8010628d: e9 5a ff ff ff jmp 801061ec <sys_exec+0x60> return exec(path, argv); } 80106292: c9 leave 80106293: c3 ret 80106294 <sys_pipe>: int sys_pipe(void) { 80106294: 55 push %ebp 80106295: 89 e5 mov %esp,%ebp 80106297: 83 ec 28 sub $0x28,%esp int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 8010629a: 83 ec 04 sub $0x4,%esp 8010629d: 6a 08 push $0x8 8010629f: 8d 45 ec lea -0x14(%ebp),%eax 801062a2: 50 push %eax 801062a3: 6a 00 push $0x0 801062a5: e8 ef f1 ff ff call 80105499 <argptr> 801062aa: 83 c4 10 add $0x10,%esp 801062ad: 85 c0 test %eax,%eax 801062af: 79 0a jns 801062bb <sys_pipe+0x27> return -1; 801062b1: b8 ff ff ff ff mov $0xffffffff,%eax 801062b6: e9 af 00 00 00 jmp 8010636a <sys_pipe+0xd6> if(pipealloc(&rf, &wf) < 0) 801062bb: 83 ec 08 sub $0x8,%esp 801062be: 8d 45 e4 lea -0x1c(%ebp),%eax 801062c1: 50 push %eax 801062c2: 8d 45 e8 lea -0x18(%ebp),%eax 801062c5: 50 push %eax 801062c6: e8 68 dc ff ff call 80103f33 <pipealloc> 801062cb: 83 c4 10 add $0x10,%esp 801062ce: 85 c0 test %eax,%eax 801062d0: 79 0a jns 801062dc <sys_pipe+0x48> return -1; 801062d2: b8 ff ff ff ff mov $0xffffffff,%eax 801062d7: e9 8e 00 00 00 jmp 8010636a <sys_pipe+0xd6> fd0 = -1; 801062dc: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp) if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 801062e3: 8b 45 e8 mov -0x18(%ebp),%eax 801062e6: 83 ec 0c sub $0xc,%esp 801062e9: 50 push %eax 801062ea: e8 7b f3 ff ff call 8010566a <fdalloc> 801062ef: 83 c4 10 add $0x10,%esp 801062f2: 89 45 f4 mov %eax,-0xc(%ebp) 801062f5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801062f9: 78 18 js 80106313 <sys_pipe+0x7f> 801062fb: 8b 45 e4 mov -0x1c(%ebp),%eax 801062fe: 83 ec 0c sub $0xc,%esp 80106301: 50 push %eax 80106302: e8 63 f3 ff ff call 8010566a <fdalloc> 80106307: 83 c4 10 add $0x10,%esp 8010630a: 89 45 f0 mov %eax,-0x10(%ebp) 8010630d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106311: 79 3f jns 80106352 <sys_pipe+0xbe> if(fd0 >= 0) 80106313: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106317: 78 14 js 8010632d <sys_pipe+0x99> proc->ofile[fd0] = 0; 80106319: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010631f: 8b 55 f4 mov -0xc(%ebp),%edx 80106322: 83 c2 08 add $0x8,%edx 80106325: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 8010632c: 00 fileclose(rf); 8010632d: 8b 45 e8 mov -0x18(%ebp),%eax 80106330: 83 ec 0c sub $0xc,%esp 80106333: 50 push %eax 80106334: e8 d4 ac ff ff call 8010100d <fileclose> 80106339: 83 c4 10 add $0x10,%esp fileclose(wf); 8010633c: 8b 45 e4 mov -0x1c(%ebp),%eax 8010633f: 83 ec 0c sub $0xc,%esp 80106342: 50 push %eax 80106343: e8 c5 ac ff ff call 8010100d <fileclose> 80106348: 83 c4 10 add $0x10,%esp return -1; 8010634b: b8 ff ff ff ff mov $0xffffffff,%eax 80106350: eb 18 jmp 8010636a <sys_pipe+0xd6> } fd[0] = fd0; 80106352: 8b 45 ec mov -0x14(%ebp),%eax 80106355: 8b 55 f4 mov -0xc(%ebp),%edx 80106358: 89 10 mov %edx,(%eax) fd[1] = fd1; 8010635a: 8b 45 ec mov -0x14(%ebp),%eax 8010635d: 8d 50 04 lea 0x4(%eax),%edx 80106360: 8b 45 f0 mov -0x10(%ebp),%eax 80106363: 89 02 mov %eax,(%edx) return 0; 80106365: b8 00 00 00 00 mov $0x0,%eax } 8010636a: c9 leave 8010636b: c3 ret 8010636c <sys_fork>: #include "mmu.h" #include "proc.h" int sys_fork(void) { 8010636c: 55 push %ebp 8010636d: 89 e5 mov %esp,%ebp 8010636f: 83 ec 08 sub $0x8,%esp return fork(); 80106372: e8 bf e2 ff ff call 80104636 <fork> } 80106377: c9 leave 80106378: c3 ret 80106379 <sys_exit>: int sys_exit(void) { 80106379: 55 push %ebp 8010637a: 89 e5 mov %esp,%ebp 8010637c: 83 ec 08 sub $0x8,%esp exit(); 8010637f: e8 43 e4 ff ff call 801047c7 <exit> return 0; // not reached 80106384: b8 00 00 00 00 mov $0x0,%eax } 80106389: c9 leave 8010638a: c3 ret 8010638b <sys_wait>: int sys_wait(void) { 8010638b: 55 push %ebp 8010638c: 89 e5 mov %esp,%ebp 8010638e: 83 ec 08 sub $0x8,%esp return wait(); 80106391: e8 6c e5 ff ff call 80104902 <wait> } 80106396: c9 leave 80106397: c3 ret 80106398 <sys_kill>: int sys_kill(void) { 80106398: 55 push %ebp 80106399: 89 e5 mov %esp,%ebp 8010639b: 83 ec 18 sub $0x18,%esp int pid; if(argint(0, &pid) < 0) 8010639e: 83 ec 08 sub $0x8,%esp 801063a1: 8d 45 f4 lea -0xc(%ebp),%eax 801063a4: 50 push %eax 801063a5: 6a 00 push $0x0 801063a7: e8 c5 f0 ff ff call 80105471 <argint> 801063ac: 83 c4 10 add $0x10,%esp 801063af: 85 c0 test %eax,%eax 801063b1: 79 07 jns 801063ba <sys_kill+0x22> return -1; 801063b3: b8 ff ff ff ff mov $0xffffffff,%eax 801063b8: eb 0f jmp 801063c9 <sys_kill+0x31> return kill(pid); 801063ba: 8b 45 f4 mov -0xc(%ebp),%eax 801063bd: 83 ec 0c sub $0xc,%esp 801063c0: 50 push %eax 801063c1: e8 51 e9 ff ff call 80104d17 <kill> 801063c6: 83 c4 10 add $0x10,%esp } 801063c9: c9 leave 801063ca: c3 ret 801063cb <sys_getpid>: int sys_getpid(void) { 801063cb: 55 push %ebp 801063cc: 89 e5 mov %esp,%ebp return proc->pid; 801063ce: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801063d4: 8b 40 10 mov 0x10(%eax),%eax } 801063d7: 5d pop %ebp 801063d8: c3 ret 801063d9 <sys_sbrk>: int sys_sbrk(void) { 801063d9: 55 push %ebp 801063da: 89 e5 mov %esp,%ebp 801063dc: 83 ec 18 sub $0x18,%esp int addr; int n; if(argint(0, &n) < 0) 801063df: 83 ec 08 sub $0x8,%esp 801063e2: 8d 45 f0 lea -0x10(%ebp),%eax 801063e5: 50 push %eax 801063e6: 6a 00 push $0x0 801063e8: e8 84 f0 ff ff call 80105471 <argint> 801063ed: 83 c4 10 add $0x10,%esp 801063f0: 85 c0 test %eax,%eax 801063f2: 79 07 jns 801063fb <sys_sbrk+0x22> return -1; 801063f4: b8 ff ff ff ff mov $0xffffffff,%eax 801063f9: eb 28 jmp 80106423 <sys_sbrk+0x4a> addr = proc->sz; 801063fb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106401: 8b 00 mov (%eax),%eax 80106403: 89 45 f4 mov %eax,-0xc(%ebp) if(growproc(n) < 0) 80106406: 8b 45 f0 mov -0x10(%ebp),%eax 80106409: 83 ec 0c sub $0xc,%esp 8010640c: 50 push %eax 8010640d: e8 81 e1 ff ff call 80104593 <growproc> 80106412: 83 c4 10 add $0x10,%esp 80106415: 85 c0 test %eax,%eax 80106417: 79 07 jns 80106420 <sys_sbrk+0x47> return -1; 80106419: b8 ff ff ff ff mov $0xffffffff,%eax 8010641e: eb 03 jmp 80106423 <sys_sbrk+0x4a> return addr; 80106420: 8b 45 f4 mov -0xc(%ebp),%eax } 80106423: c9 leave 80106424: c3 ret 80106425 <sys_sleep>: int sys_sleep(void) { 80106425: 55 push %ebp 80106426: 89 e5 mov %esp,%ebp 80106428: 83 ec 18 sub $0x18,%esp int n; uint ticks0; if(argint(0, &n) < 0) 8010642b: 83 ec 08 sub $0x8,%esp 8010642e: 8d 45 f0 lea -0x10(%ebp),%eax 80106431: 50 push %eax 80106432: 6a 00 push $0x0 80106434: e8 38 f0 ff ff call 80105471 <argint> 80106439: 83 c4 10 add $0x10,%esp 8010643c: 85 c0 test %eax,%eax 8010643e: 79 07 jns 80106447 <sys_sleep+0x22> return -1; 80106440: b8 ff ff ff ff mov $0xffffffff,%eax 80106445: eb 77 jmp 801064be <sys_sleep+0x99> acquire(&tickslock); 80106447: 83 ec 0c sub $0xc,%esp 8010644a: 68 80 4b 11 80 push $0x80114b80 8010644f: e8 9a ea ff ff call 80104eee <acquire> 80106454: 83 c4 10 add $0x10,%esp ticks0 = ticks; 80106457: a1 c0 53 11 80 mov 0x801153c0,%eax 8010645c: 89 45 f4 mov %eax,-0xc(%ebp) while(ticks - ticks0 < n){ 8010645f: eb 39 jmp 8010649a <sys_sleep+0x75> if(proc->killed){ 80106461: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106467: 8b 40 24 mov 0x24(%eax),%eax 8010646a: 85 c0 test %eax,%eax 8010646c: 74 17 je 80106485 <sys_sleep+0x60> release(&tickslock); 8010646e: 83 ec 0c sub $0xc,%esp 80106471: 68 80 4b 11 80 push $0x80114b80 80106476: e8 d9 ea ff ff call 80104f54 <release> 8010647b: 83 c4 10 add $0x10,%esp return -1; 8010647e: b8 ff ff ff ff mov $0xffffffff,%eax 80106483: eb 39 jmp 801064be <sys_sleep+0x99> } sleep(&ticks, &tickslock); 80106485: 83 ec 08 sub $0x8,%esp 80106488: 68 80 4b 11 80 push $0x80114b80 8010648d: 68 c0 53 11 80 push $0x801153c0 80106492: e8 5e e7 ff ff call 80104bf5 <sleep> 80106497: 83 c4 10 add $0x10,%esp if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; while(ticks - ticks0 < n){ 8010649a: a1 c0 53 11 80 mov 0x801153c0,%eax 8010649f: 2b 45 f4 sub -0xc(%ebp),%eax 801064a2: 8b 55 f0 mov -0x10(%ebp),%edx 801064a5: 39 d0 cmp %edx,%eax 801064a7: 72 b8 jb 80106461 <sys_sleep+0x3c> release(&tickslock); return -1; } sleep(&ticks, &tickslock); } release(&tickslock); 801064a9: 83 ec 0c sub $0xc,%esp 801064ac: 68 80 4b 11 80 push $0x80114b80 801064b1: e8 9e ea ff ff call 80104f54 <release> 801064b6: 83 c4 10 add $0x10,%esp return 0; 801064b9: b8 00 00 00 00 mov $0x0,%eax } 801064be: c9 leave 801064bf: c3 ret 801064c0 <sys_uptime>: // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 801064c0: 55 push %ebp 801064c1: 89 e5 mov %esp,%ebp 801064c3: 83 ec 18 sub $0x18,%esp uint xticks; acquire(&tickslock); 801064c6: 83 ec 0c sub $0xc,%esp 801064c9: 68 80 4b 11 80 push $0x80114b80 801064ce: e8 1b ea ff ff call 80104eee <acquire> 801064d3: 83 c4 10 add $0x10,%esp xticks = ticks; 801064d6: a1 c0 53 11 80 mov 0x801153c0,%eax 801064db: 89 45 f4 mov %eax,-0xc(%ebp) release(&tickslock); 801064de: 83 ec 0c sub $0xc,%esp 801064e1: 68 80 4b 11 80 push $0x80114b80 801064e6: e8 69 ea ff ff call 80104f54 <release> 801064eb: 83 c4 10 add $0x10,%esp return xticks; 801064ee: 8b 45 f4 mov -0xc(%ebp),%eax } 801064f1: c9 leave 801064f2: c3 ret 801064f3 <sys_trace>: int sys_trace(int x){ 801064f3: 55 push %ebp 801064f4: 89 e5 mov %esp,%ebp 801064f6: 83 ec 18 sub $0x18,%esp cprintf("\ncalling trace\n"); 801064f9: 83 ec 0c sub $0xc,%esp 801064fc: 68 37 89 10 80 push $0x80108937 80106501: e8 b9 9e ff ff call 801003bf <cprintf> 80106506: 83 c4 10 add $0x10,%esp cprintf("caller pid is %d", proc->pid); 80106509: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010650f: 8b 40 10 mov 0x10(%eax),%eax 80106512: 83 ec 08 sub $0x8,%esp 80106515: 50 push %eax 80106516: 68 47 89 10 80 push $0x80108947 8010651b: e8 9f 9e ff ff call 801003bf <cprintf> 80106520: 83 c4 10 add $0x10,%esp if(x != 0){ 80106523: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80106527: 74 1b je 80106544 <sys_trace+0x51> proc->traceFlag = true; 80106529: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010652f: c7 40 7c 01 00 00 00 movl $0x1,0x7c(%eax) int temp = proc->totalSysCall; proc->totalSysCall = 0; return temp; } return proc->totalSysCall; 80106536: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010653c: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80106542: eb 2f jmp 80106573 <sys_trace+0x80> cprintf("caller pid is %d", proc->pid); if(x != 0){ proc->traceFlag = true; }else{ proc->traceFlag = false; 80106544: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010654a: c7 40 7c 00 00 00 00 movl $0x0,0x7c(%eax) int temp = proc->totalSysCall; 80106551: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106557: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 8010655d: 89 45 f4 mov %eax,-0xc(%ebp) proc->totalSysCall = 0; 80106560: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106566: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 8010656d: 00 00 00 return temp; 80106570: 8b 45 f4 mov -0xc(%ebp),%eax } return proc->totalSysCall; } 80106573: c9 leave 80106574: c3 ret 80106575 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80106575: 55 push %ebp 80106576: 89 e5 mov %esp,%ebp 80106578: 83 ec 08 sub $0x8,%esp 8010657b: 8b 55 08 mov 0x8(%ebp),%edx 8010657e: 8b 45 0c mov 0xc(%ebp),%eax 80106581: 66 89 55 fc mov %dx,-0x4(%ebp) 80106585: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80106588: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 8010658c: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80106590: ee out %al,(%dx) } 80106591: c9 leave 80106592: c3 ret 80106593 <timerinit>: #define TIMER_RATEGEN 0x04 // mode 2, rate generator #define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first void timerinit(void) { 80106593: 55 push %ebp 80106594: 89 e5 mov %esp,%ebp 80106596: 83 ec 08 sub $0x8,%esp // Interrupt 100 times/sec. outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); 80106599: 6a 34 push $0x34 8010659b: 6a 43 push $0x43 8010659d: e8 d3 ff ff ff call 80106575 <outb> 801065a2: 83 c4 08 add $0x8,%esp outb(IO_TIMER1, TIMER_DIV(100) % 256); 801065a5: 68 9c 00 00 00 push $0x9c 801065aa: 6a 40 push $0x40 801065ac: e8 c4 ff ff ff call 80106575 <outb> 801065b1: 83 c4 08 add $0x8,%esp outb(IO_TIMER1, TIMER_DIV(100) / 256); 801065b4: 6a 2e push $0x2e 801065b6: 6a 40 push $0x40 801065b8: e8 b8 ff ff ff call 80106575 <outb> 801065bd: 83 c4 08 add $0x8,%esp picenable(IRQ_TIMER); 801065c0: 83 ec 0c sub $0xc,%esp 801065c3: 6a 00 push $0x0 801065c5: e8 55 d8 ff ff call 80103e1f <picenable> 801065ca: 83 c4 10 add $0x10,%esp } 801065cd: c9 leave 801065ce: c3 ret 801065cf <alltraps>: # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 801065cf: 1e push %ds pushl %es 801065d0: 06 push %es pushl %fs 801065d1: 0f a0 push %fs pushl %gs 801065d3: 0f a8 push %gs pushal 801065d5: 60 pusha # Set up data and per-cpu segments. movw $(SEG_KDATA<<3), %ax 801065d6: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 801065da: 8e d8 mov %eax,%ds movw %ax, %es 801065dc: 8e c0 mov %eax,%es movw $(SEG_KCPU<<3), %ax 801065de: 66 b8 18 00 mov $0x18,%ax movw %ax, %fs 801065e2: 8e e0 mov %eax,%fs movw %ax, %gs 801065e4: 8e e8 mov %eax,%gs # Call trap(tf), where tf=%esp pushl %esp 801065e6: 54 push %esp call trap 801065e7: e8 d4 01 00 00 call 801067c0 <trap> addl $4, %esp 801065ec: 83 c4 04 add $0x4,%esp 801065ef <trapret>: # Return falls through to trapret... .globl trapret trapret: popal 801065ef: 61 popa popl %gs 801065f0: 0f a9 pop %gs popl %fs 801065f2: 0f a1 pop %fs popl %es 801065f4: 07 pop %es popl %ds 801065f5: 1f pop %ds addl $0x8, %esp # trapno and errcode 801065f6: 83 c4 08 add $0x8,%esp iret 801065f9: cf iret 801065fa <lidt>: struct gatedesc; static inline void lidt(struct gatedesc *p, int size) { 801065fa: 55 push %ebp 801065fb: 89 e5 mov %esp,%ebp 801065fd: 83 ec 10 sub $0x10,%esp volatile ushort pd[3]; pd[0] = size-1; 80106600: 8b 45 0c mov 0xc(%ebp),%eax 80106603: 83 e8 01 sub $0x1,%eax 80106606: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 8010660a: 8b 45 08 mov 0x8(%ebp),%eax 8010660d: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80106611: 8b 45 08 mov 0x8(%ebp),%eax 80106614: c1 e8 10 shr $0x10,%eax 80106617: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); 8010661b: 8d 45 fa lea -0x6(%ebp),%eax 8010661e: 0f 01 18 lidtl (%eax) } 80106621: c9 leave 80106622: c3 ret 80106623 <rcr2>: return result; } static inline uint rcr2(void) { 80106623: 55 push %ebp 80106624: 89 e5 mov %esp,%ebp 80106626: 83 ec 10 sub $0x10,%esp uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); 80106629: 0f 20 d0 mov %cr2,%eax 8010662c: 89 45 fc mov %eax,-0x4(%ebp) return val; 8010662f: 8b 45 fc mov -0x4(%ebp),%eax } 80106632: c9 leave 80106633: c3 ret 80106634 <tvinit>: struct spinlock tickslock; uint ticks; void tvinit(void) { 80106634: 55 push %ebp 80106635: 89 e5 mov %esp,%ebp 80106637: 83 ec 18 sub $0x18,%esp int i; for(i = 0; i < 256; i++) 8010663a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80106641: e9 c3 00 00 00 jmp 80106709 <tvinit+0xd5> SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); 80106646: 8b 45 f4 mov -0xc(%ebp),%eax 80106649: 8b 04 85 9c b0 10 80 mov -0x7fef4f64(,%eax,4),%eax 80106650: 89 c2 mov %eax,%edx 80106652: 8b 45 f4 mov -0xc(%ebp),%eax 80106655: 66 89 14 c5 c0 4b 11 mov %dx,-0x7feeb440(,%eax,8) 8010665c: 80 8010665d: 8b 45 f4 mov -0xc(%ebp),%eax 80106660: 66 c7 04 c5 c2 4b 11 movw $0x8,-0x7feeb43e(,%eax,8) 80106667: 80 08 00 8010666a: 8b 45 f4 mov -0xc(%ebp),%eax 8010666d: 0f b6 14 c5 c4 4b 11 movzbl -0x7feeb43c(,%eax,8),%edx 80106674: 80 80106675: 83 e2 e0 and $0xffffffe0,%edx 80106678: 88 14 c5 c4 4b 11 80 mov %dl,-0x7feeb43c(,%eax,8) 8010667f: 8b 45 f4 mov -0xc(%ebp),%eax 80106682: 0f b6 14 c5 c4 4b 11 movzbl -0x7feeb43c(,%eax,8),%edx 80106689: 80 8010668a: 83 e2 1f and $0x1f,%edx 8010668d: 88 14 c5 c4 4b 11 80 mov %dl,-0x7feeb43c(,%eax,8) 80106694: 8b 45 f4 mov -0xc(%ebp),%eax 80106697: 0f b6 14 c5 c5 4b 11 movzbl -0x7feeb43b(,%eax,8),%edx 8010669e: 80 8010669f: 83 e2 f0 and $0xfffffff0,%edx 801066a2: 83 ca 0e or $0xe,%edx 801066a5: 88 14 c5 c5 4b 11 80 mov %dl,-0x7feeb43b(,%eax,8) 801066ac: 8b 45 f4 mov -0xc(%ebp),%eax 801066af: 0f b6 14 c5 c5 4b 11 movzbl -0x7feeb43b(,%eax,8),%edx 801066b6: 80 801066b7: 83 e2 ef and $0xffffffef,%edx 801066ba: 88 14 c5 c5 4b 11 80 mov %dl,-0x7feeb43b(,%eax,8) 801066c1: 8b 45 f4 mov -0xc(%ebp),%eax 801066c4: 0f b6 14 c5 c5 4b 11 movzbl -0x7feeb43b(,%eax,8),%edx 801066cb: 80 801066cc: 83 e2 9f and $0xffffff9f,%edx 801066cf: 88 14 c5 c5 4b 11 80 mov %dl,-0x7feeb43b(,%eax,8) 801066d6: 8b 45 f4 mov -0xc(%ebp),%eax 801066d9: 0f b6 14 c5 c5 4b 11 movzbl -0x7feeb43b(,%eax,8),%edx 801066e0: 80 801066e1: 83 ca 80 or $0xffffff80,%edx 801066e4: 88 14 c5 c5 4b 11 80 mov %dl,-0x7feeb43b(,%eax,8) 801066eb: 8b 45 f4 mov -0xc(%ebp),%eax 801066ee: 8b 04 85 9c b0 10 80 mov -0x7fef4f64(,%eax,4),%eax 801066f5: c1 e8 10 shr $0x10,%eax 801066f8: 89 c2 mov %eax,%edx 801066fa: 8b 45 f4 mov -0xc(%ebp),%eax 801066fd: 66 89 14 c5 c6 4b 11 mov %dx,-0x7feeb43a(,%eax,8) 80106704: 80 void tvinit(void) { int i; for(i = 0; i < 256; i++) 80106705: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80106709: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp) 80106710: 0f 8e 30 ff ff ff jle 80106646 <tvinit+0x12> SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 80106716: a1 9c b1 10 80 mov 0x8010b19c,%eax 8010671b: 66 a3 c0 4d 11 80 mov %ax,0x80114dc0 80106721: 66 c7 05 c2 4d 11 80 movw $0x8,0x80114dc2 80106728: 08 00 8010672a: 0f b6 05 c4 4d 11 80 movzbl 0x80114dc4,%eax 80106731: 83 e0 e0 and $0xffffffe0,%eax 80106734: a2 c4 4d 11 80 mov %al,0x80114dc4 80106739: 0f b6 05 c4 4d 11 80 movzbl 0x80114dc4,%eax 80106740: 83 e0 1f and $0x1f,%eax 80106743: a2 c4 4d 11 80 mov %al,0x80114dc4 80106748: 0f b6 05 c5 4d 11 80 movzbl 0x80114dc5,%eax 8010674f: 83 c8 0f or $0xf,%eax 80106752: a2 c5 4d 11 80 mov %al,0x80114dc5 80106757: 0f b6 05 c5 4d 11 80 movzbl 0x80114dc5,%eax 8010675e: 83 e0 ef and $0xffffffef,%eax 80106761: a2 c5 4d 11 80 mov %al,0x80114dc5 80106766: 0f b6 05 c5 4d 11 80 movzbl 0x80114dc5,%eax 8010676d: 83 c8 60 or $0x60,%eax 80106770: a2 c5 4d 11 80 mov %al,0x80114dc5 80106775: 0f b6 05 c5 4d 11 80 movzbl 0x80114dc5,%eax 8010677c: 83 c8 80 or $0xffffff80,%eax 8010677f: a2 c5 4d 11 80 mov %al,0x80114dc5 80106784: a1 9c b1 10 80 mov 0x8010b19c,%eax 80106789: c1 e8 10 shr $0x10,%eax 8010678c: 66 a3 c6 4d 11 80 mov %ax,0x80114dc6 initlock(&tickslock, "time"); 80106792: 83 ec 08 sub $0x8,%esp 80106795: 68 58 89 10 80 push $0x80108958 8010679a: 68 80 4b 11 80 push $0x80114b80 8010679f: e8 29 e7 ff ff call 80104ecd <initlock> 801067a4: 83 c4 10 add $0x10,%esp } 801067a7: c9 leave 801067a8: c3 ret 801067a9 <idtinit>: void idtinit(void) { 801067a9: 55 push %ebp 801067aa: 89 e5 mov %esp,%ebp lidt(idt, sizeof(idt)); 801067ac: 68 00 08 00 00 push $0x800 801067b1: 68 c0 4b 11 80 push $0x80114bc0 801067b6: e8 3f fe ff ff call 801065fa <lidt> 801067bb: 83 c4 08 add $0x8,%esp } 801067be: c9 leave 801067bf: c3 ret 801067c0 <trap>: //PAGEBREAK: 41 void trap(struct trapframe *tf) { 801067c0: 55 push %ebp 801067c1: 89 e5 mov %esp,%ebp 801067c3: 57 push %edi 801067c4: 56 push %esi 801067c5: 53 push %ebx 801067c6: 83 ec 1c sub $0x1c,%esp if(tf->trapno == T_SYSCALL){ 801067c9: 8b 45 08 mov 0x8(%ebp),%eax 801067cc: 8b 40 30 mov 0x30(%eax),%eax 801067cf: 83 f8 40 cmp $0x40,%eax 801067d2: 75 3f jne 80106813 <trap+0x53> if(proc->killed) 801067d4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801067da: 8b 40 24 mov 0x24(%eax),%eax 801067dd: 85 c0 test %eax,%eax 801067df: 74 05 je 801067e6 <trap+0x26> exit(); 801067e1: e8 e1 df ff ff call 801047c7 <exit> proc->tf = tf; 801067e6: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801067ec: 8b 55 08 mov 0x8(%ebp),%edx 801067ef: 89 50 18 mov %edx,0x18(%eax) syscall(); 801067f2: e8 32 ed ff ff call 80105529 <syscall> if(proc->killed) 801067f7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801067fd: 8b 40 24 mov 0x24(%eax),%eax 80106800: 85 c0 test %eax,%eax 80106802: 74 0a je 8010680e <trap+0x4e> exit(); 80106804: e8 be df ff ff call 801047c7 <exit> return; 80106809: e9 14 02 00 00 jmp 80106a22 <trap+0x262> 8010680e: e9 0f 02 00 00 jmp 80106a22 <trap+0x262> } switch(tf->trapno){ 80106813: 8b 45 08 mov 0x8(%ebp),%eax 80106816: 8b 40 30 mov 0x30(%eax),%eax 80106819: 83 e8 20 sub $0x20,%eax 8010681c: 83 f8 1f cmp $0x1f,%eax 8010681f: 0f 87 c0 00 00 00 ja 801068e5 <trap+0x125> 80106825: 8b 04 85 00 8a 10 80 mov -0x7fef7600(,%eax,4),%eax 8010682c: ff e0 jmp *%eax case T_IRQ0 + IRQ_TIMER: if(cpu->id == 0){ 8010682e: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80106834: 0f b6 00 movzbl (%eax),%eax 80106837: 84 c0 test %al,%al 80106839: 75 3d jne 80106878 <trap+0xb8> acquire(&tickslock); 8010683b: 83 ec 0c sub $0xc,%esp 8010683e: 68 80 4b 11 80 push $0x80114b80 80106843: e8 a6 e6 ff ff call 80104eee <acquire> 80106848: 83 c4 10 add $0x10,%esp ticks++; 8010684b: a1 c0 53 11 80 mov 0x801153c0,%eax 80106850: 83 c0 01 add $0x1,%eax 80106853: a3 c0 53 11 80 mov %eax,0x801153c0 wakeup(&ticks); 80106858: 83 ec 0c sub $0xc,%esp 8010685b: 68 c0 53 11 80 push $0x801153c0 80106860: e8 7c e4 ff ff call 80104ce1 <wakeup> 80106865: 83 c4 10 add $0x10,%esp release(&tickslock); 80106868: 83 ec 0c sub $0xc,%esp 8010686b: 68 80 4b 11 80 push $0x80114b80 80106870: e8 df e6 ff ff call 80104f54 <release> 80106875: 83 c4 10 add $0x10,%esp } lapiceoi(); 80106878: e8 c2 c6 ff ff call 80102f3f <lapiceoi> break; 8010687d: e9 1c 01 00 00 jmp 8010699e <trap+0x1de> case T_IRQ0 + IRQ_IDE: ideintr(); 80106882: e8 d9 be ff ff call 80102760 <ideintr> lapiceoi(); 80106887: e8 b3 c6 ff ff call 80102f3f <lapiceoi> break; 8010688c: e9 0d 01 00 00 jmp 8010699e <trap+0x1de> case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; case T_IRQ0 + IRQ_KBD: kbdintr(); 80106891: e8 b0 c4 ff ff call 80102d46 <kbdintr> lapiceoi(); 80106896: e8 a4 c6 ff ff call 80102f3f <lapiceoi> break; 8010689b: e9 fe 00 00 00 jmp 8010699e <trap+0x1de> case T_IRQ0 + IRQ_COM1: uartintr(); 801068a0: e8 5a 03 00 00 call 80106bff <uartintr> lapiceoi(); 801068a5: e8 95 c6 ff ff call 80102f3f <lapiceoi> break; 801068aa: e9 ef 00 00 00 jmp 8010699e <trap+0x1de> case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 801068af: 8b 45 08 mov 0x8(%ebp),%eax 801068b2: 8b 48 38 mov 0x38(%eax),%ecx cpu->id, tf->cs, tf->eip); 801068b5: 8b 45 08 mov 0x8(%ebp),%eax 801068b8: 0f b7 40 3c movzwl 0x3c(%eax),%eax uartintr(); lapiceoi(); break; case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 801068bc: 0f b7 d0 movzwl %ax,%edx cpu->id, tf->cs, tf->eip); 801068bf: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801068c5: 0f b6 00 movzbl (%eax),%eax uartintr(); lapiceoi(); break; case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 801068c8: 0f b6 c0 movzbl %al,%eax 801068cb: 51 push %ecx 801068cc: 52 push %edx 801068cd: 50 push %eax 801068ce: 68 60 89 10 80 push $0x80108960 801068d3: e8 e7 9a ff ff call 801003bf <cprintf> 801068d8: 83 c4 10 add $0x10,%esp cpu->id, tf->cs, tf->eip); lapiceoi(); 801068db: e8 5f c6 ff ff call 80102f3f <lapiceoi> break; 801068e0: e9 b9 00 00 00 jmp 8010699e <trap+0x1de> //PAGEBREAK: 13 default: if(proc == 0 || (tf->cs&3) == 0){ 801068e5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801068eb: 85 c0 test %eax,%eax 801068ed: 74 11 je 80106900 <trap+0x140> 801068ef: 8b 45 08 mov 0x8(%ebp),%eax 801068f2: 0f b7 40 3c movzwl 0x3c(%eax),%eax 801068f6: 0f b7 c0 movzwl %ax,%eax 801068f9: 83 e0 03 and $0x3,%eax 801068fc: 85 c0 test %eax,%eax 801068fe: 75 40 jne 80106940 <trap+0x180> // In kernel, it must be our mistake. cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 80106900: e8 1e fd ff ff call 80106623 <rcr2> 80106905: 89 c3 mov %eax,%ebx 80106907: 8b 45 08 mov 0x8(%ebp),%eax 8010690a: 8b 48 38 mov 0x38(%eax),%ecx tf->trapno, cpu->id, tf->eip, rcr2()); 8010690d: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80106913: 0f b6 00 movzbl (%eax),%eax //PAGEBREAK: 13 default: if(proc == 0 || (tf->cs&3) == 0){ // In kernel, it must be our mistake. cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 80106916: 0f b6 d0 movzbl %al,%edx 80106919: 8b 45 08 mov 0x8(%ebp),%eax 8010691c: 8b 40 30 mov 0x30(%eax),%eax 8010691f: 83 ec 0c sub $0xc,%esp 80106922: 53 push %ebx 80106923: 51 push %ecx 80106924: 52 push %edx 80106925: 50 push %eax 80106926: 68 84 89 10 80 push $0x80108984 8010692b: e8 8f 9a ff ff call 801003bf <cprintf> 80106930: 83 c4 20 add $0x20,%esp tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); 80106933: 83 ec 0c sub $0xc,%esp 80106936: 68 b6 89 10 80 push $0x801089b6 8010693b: e8 1c 9c ff ff call 8010055c <panic> } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80106940: e8 de fc ff ff call 80106623 <rcr2> 80106945: 89 45 e4 mov %eax,-0x1c(%ebp) 80106948: 8b 45 08 mov 0x8(%ebp),%eax 8010694b: 8b 70 38 mov 0x38(%eax),%esi "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 8010694e: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80106954: 0f b6 00 movzbl (%eax),%eax cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80106957: 0f b6 d8 movzbl %al,%ebx 8010695a: 8b 45 08 mov 0x8(%ebp),%eax 8010695d: 8b 48 34 mov 0x34(%eax),%ecx 80106960: 8b 45 08 mov 0x8(%ebp),%eax 80106963: 8b 50 30 mov 0x30(%eax),%edx "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 80106966: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010696c: 8d 78 6c lea 0x6c(%eax),%edi 8010696f: 65 a1 04 00 00 00 mov %gs:0x4,%eax cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80106975: 8b 40 10 mov 0x10(%eax),%eax 80106978: ff 75 e4 pushl -0x1c(%ebp) 8010697b: 56 push %esi 8010697c: 53 push %ebx 8010697d: 51 push %ecx 8010697e: 52 push %edx 8010697f: 57 push %edi 80106980: 50 push %eax 80106981: 68 bc 89 10 80 push $0x801089bc 80106986: e8 34 9a ff ff call 801003bf <cprintf> 8010698b: 83 c4 20 add $0x20,%esp "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, rcr2()); proc->killed = 1; 8010698e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106994: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) 8010699b: eb 01 jmp 8010699e <trap+0x1de> ideintr(); lapiceoi(); break; case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; 8010699d: 90 nop } // Force process exit if it has been killed and is in user space. // (If it is still executing in the kernel, let it keep running // until it gets to the regular system call return.) if(proc && proc->killed && (tf->cs&3) == DPL_USER) 8010699e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801069a4: 85 c0 test %eax,%eax 801069a6: 74 24 je 801069cc <trap+0x20c> 801069a8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801069ae: 8b 40 24 mov 0x24(%eax),%eax 801069b1: 85 c0 test %eax,%eax 801069b3: 74 17 je 801069cc <trap+0x20c> 801069b5: 8b 45 08 mov 0x8(%ebp),%eax 801069b8: 0f b7 40 3c movzwl 0x3c(%eax),%eax 801069bc: 0f b7 c0 movzwl %ax,%eax 801069bf: 83 e0 03 and $0x3,%eax 801069c2: 83 f8 03 cmp $0x3,%eax 801069c5: 75 05 jne 801069cc <trap+0x20c> exit(); 801069c7: e8 fb dd ff ff call 801047c7 <exit> // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER) 801069cc: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801069d2: 85 c0 test %eax,%eax 801069d4: 74 1e je 801069f4 <trap+0x234> 801069d6: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801069dc: 8b 40 0c mov 0xc(%eax),%eax 801069df: 83 f8 04 cmp $0x4,%eax 801069e2: 75 10 jne 801069f4 <trap+0x234> 801069e4: 8b 45 08 mov 0x8(%ebp),%eax 801069e7: 8b 40 30 mov 0x30(%eax),%eax 801069ea: 83 f8 20 cmp $0x20,%eax 801069ed: 75 05 jne 801069f4 <trap+0x234> yield(); 801069ef: e8 97 e1 ff ff call 80104b8b <yield> // Check if the process has been killed since we yielded if(proc && proc->killed && (tf->cs&3) == DPL_USER) 801069f4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801069fa: 85 c0 test %eax,%eax 801069fc: 74 24 je 80106a22 <trap+0x262> 801069fe: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106a04: 8b 40 24 mov 0x24(%eax),%eax 80106a07: 85 c0 test %eax,%eax 80106a09: 74 17 je 80106a22 <trap+0x262> 80106a0b: 8b 45 08 mov 0x8(%ebp),%eax 80106a0e: 0f b7 40 3c movzwl 0x3c(%eax),%eax 80106a12: 0f b7 c0 movzwl %ax,%eax 80106a15: 83 e0 03 and $0x3,%eax 80106a18: 83 f8 03 cmp $0x3,%eax 80106a1b: 75 05 jne 80106a22 <trap+0x262> exit(); 80106a1d: e8 a5 dd ff ff call 801047c7 <exit> } 80106a22: 8d 65 f4 lea -0xc(%ebp),%esp 80106a25: 5b pop %ebx 80106a26: 5e pop %esi 80106a27: 5f pop %edi 80106a28: 5d pop %ebp 80106a29: c3 ret 80106a2a <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80106a2a: 55 push %ebp 80106a2b: 89 e5 mov %esp,%ebp 80106a2d: 83 ec 14 sub $0x14,%esp 80106a30: 8b 45 08 mov 0x8(%ebp),%eax 80106a33: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80106a37: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80106a3b: 89 c2 mov %eax,%edx 80106a3d: ec in (%dx),%al 80106a3e: 88 45 ff mov %al,-0x1(%ebp) return data; 80106a41: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80106a45: c9 leave 80106a46: c3 ret 80106a47 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80106a47: 55 push %ebp 80106a48: 89 e5 mov %esp,%ebp 80106a4a: 83 ec 08 sub $0x8,%esp 80106a4d: 8b 55 08 mov 0x8(%ebp),%edx 80106a50: 8b 45 0c mov 0xc(%ebp),%eax 80106a53: 66 89 55 fc mov %dx,-0x4(%ebp) 80106a57: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80106a5a: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80106a5e: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80106a62: ee out %al,(%dx) } 80106a63: c9 leave 80106a64: c3 ret 80106a65 <uartinit>: static int uart; // is there a uart? void uartinit(void) { 80106a65: 55 push %ebp 80106a66: 89 e5 mov %esp,%ebp 80106a68: 83 ec 18 sub $0x18,%esp char *p; // Turn off the FIFO outb(COM1+2, 0); 80106a6b: 6a 00 push $0x0 80106a6d: 68 fa 03 00 00 push $0x3fa 80106a72: e8 d0 ff ff ff call 80106a47 <outb> 80106a77: 83 c4 08 add $0x8,%esp // 9600 baud, 8 data bits, 1 stop bit, parity off. outb(COM1+3, 0x80); // Unlock divisor 80106a7a: 68 80 00 00 00 push $0x80 80106a7f: 68 fb 03 00 00 push $0x3fb 80106a84: e8 be ff ff ff call 80106a47 <outb> 80106a89: 83 c4 08 add $0x8,%esp outb(COM1+0, 115200/9600); 80106a8c: 6a 0c push $0xc 80106a8e: 68 f8 03 00 00 push $0x3f8 80106a93: e8 af ff ff ff call 80106a47 <outb> 80106a98: 83 c4 08 add $0x8,%esp outb(COM1+1, 0); 80106a9b: 6a 00 push $0x0 80106a9d: 68 f9 03 00 00 push $0x3f9 80106aa2: e8 a0 ff ff ff call 80106a47 <outb> 80106aa7: 83 c4 08 add $0x8,%esp outb(COM1+3, 0x03); // Lock divisor, 8 data bits. 80106aaa: 6a 03 push $0x3 80106aac: 68 fb 03 00 00 push $0x3fb 80106ab1: e8 91 ff ff ff call 80106a47 <outb> 80106ab6: 83 c4 08 add $0x8,%esp outb(COM1+4, 0); 80106ab9: 6a 00 push $0x0 80106abb: 68 fc 03 00 00 push $0x3fc 80106ac0: e8 82 ff ff ff call 80106a47 <outb> 80106ac5: 83 c4 08 add $0x8,%esp outb(COM1+1, 0x01); // Enable receive interrupts. 80106ac8: 6a 01 push $0x1 80106aca: 68 f9 03 00 00 push $0x3f9 80106acf: e8 73 ff ff ff call 80106a47 <outb> 80106ad4: 83 c4 08 add $0x8,%esp // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) 80106ad7: 68 fd 03 00 00 push $0x3fd 80106adc: e8 49 ff ff ff call 80106a2a <inb> 80106ae1: 83 c4 04 add $0x4,%esp 80106ae4: 3c ff cmp $0xff,%al 80106ae6: 75 02 jne 80106aea <uartinit+0x85> return; 80106ae8: eb 6c jmp 80106b56 <uartinit+0xf1> uart = 1; 80106aea: c7 05 6c b6 10 80 01 movl $0x1,0x8010b66c 80106af1: 00 00 00 // Acknowledge pre-existing interrupt conditions; // enable interrupts. inb(COM1+2); 80106af4: 68 fa 03 00 00 push $0x3fa 80106af9: e8 2c ff ff ff call 80106a2a <inb> 80106afe: 83 c4 04 add $0x4,%esp inb(COM1+0); 80106b01: 68 f8 03 00 00 push $0x3f8 80106b06: e8 1f ff ff ff call 80106a2a <inb> 80106b0b: 83 c4 04 add $0x4,%esp picenable(IRQ_COM1); 80106b0e: 83 ec 0c sub $0xc,%esp 80106b11: 6a 04 push $0x4 80106b13: e8 07 d3 ff ff call 80103e1f <picenable> 80106b18: 83 c4 10 add $0x10,%esp ioapicenable(IRQ_COM1, 0); 80106b1b: 83 ec 08 sub $0x8,%esp 80106b1e: 6a 00 push $0x0 80106b20: 6a 04 push $0x4 80106b22: e8 d7 be ff ff call 801029fe <ioapicenable> 80106b27: 83 c4 10 add $0x10,%esp // Announce that we're here. for(p="xv6...\n"; *p; p++) 80106b2a: c7 45 f4 80 8a 10 80 movl $0x80108a80,-0xc(%ebp) 80106b31: eb 19 jmp 80106b4c <uartinit+0xe7> uartputc(*p); 80106b33: 8b 45 f4 mov -0xc(%ebp),%eax 80106b36: 0f b6 00 movzbl (%eax),%eax 80106b39: 0f be c0 movsbl %al,%eax 80106b3c: 83 ec 0c sub $0xc,%esp 80106b3f: 50 push %eax 80106b40: e8 13 00 00 00 call 80106b58 <uartputc> 80106b45: 83 c4 10 add $0x10,%esp inb(COM1+0); picenable(IRQ_COM1); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) 80106b48: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80106b4c: 8b 45 f4 mov -0xc(%ebp),%eax 80106b4f: 0f b6 00 movzbl (%eax),%eax 80106b52: 84 c0 test %al,%al 80106b54: 75 dd jne 80106b33 <uartinit+0xce> uartputc(*p); } 80106b56: c9 leave 80106b57: c3 ret 80106b58 <uartputc>: void uartputc(int c) { 80106b58: 55 push %ebp 80106b59: 89 e5 mov %esp,%ebp 80106b5b: 83 ec 18 sub $0x18,%esp int i; if(!uart) 80106b5e: a1 6c b6 10 80 mov 0x8010b66c,%eax 80106b63: 85 c0 test %eax,%eax 80106b65: 75 02 jne 80106b69 <uartputc+0x11> return; 80106b67: eb 51 jmp 80106bba <uartputc+0x62> for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 80106b69: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80106b70: eb 11 jmp 80106b83 <uartputc+0x2b> microdelay(10); 80106b72: 83 ec 0c sub $0xc,%esp 80106b75: 6a 0a push $0xa 80106b77: e8 dd c3 ff ff call 80102f59 <microdelay> 80106b7c: 83 c4 10 add $0x10,%esp { int i; if(!uart) return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 80106b7f: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80106b83: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp) 80106b87: 7f 1a jg 80106ba3 <uartputc+0x4b> 80106b89: 83 ec 0c sub $0xc,%esp 80106b8c: 68 fd 03 00 00 push $0x3fd 80106b91: e8 94 fe ff ff call 80106a2a <inb> 80106b96: 83 c4 10 add $0x10,%esp 80106b99: 0f b6 c0 movzbl %al,%eax 80106b9c: 83 e0 20 and $0x20,%eax 80106b9f: 85 c0 test %eax,%eax 80106ba1: 74 cf je 80106b72 <uartputc+0x1a> microdelay(10); outb(COM1+0, c); 80106ba3: 8b 45 08 mov 0x8(%ebp),%eax 80106ba6: 0f b6 c0 movzbl %al,%eax 80106ba9: 83 ec 08 sub $0x8,%esp 80106bac: 50 push %eax 80106bad: 68 f8 03 00 00 push $0x3f8 80106bb2: e8 90 fe ff ff call 80106a47 <outb> 80106bb7: 83 c4 10 add $0x10,%esp } 80106bba: c9 leave 80106bbb: c3 ret 80106bbc <uartgetc>: static int uartgetc(void) { 80106bbc: 55 push %ebp 80106bbd: 89 e5 mov %esp,%ebp if(!uart) 80106bbf: a1 6c b6 10 80 mov 0x8010b66c,%eax 80106bc4: 85 c0 test %eax,%eax 80106bc6: 75 07 jne 80106bcf <uartgetc+0x13> return -1; 80106bc8: b8 ff ff ff ff mov $0xffffffff,%eax 80106bcd: eb 2e jmp 80106bfd <uartgetc+0x41> if(!(inb(COM1+5) & 0x01)) 80106bcf: 68 fd 03 00 00 push $0x3fd 80106bd4: e8 51 fe ff ff call 80106a2a <inb> 80106bd9: 83 c4 04 add $0x4,%esp 80106bdc: 0f b6 c0 movzbl %al,%eax 80106bdf: 83 e0 01 and $0x1,%eax 80106be2: 85 c0 test %eax,%eax 80106be4: 75 07 jne 80106bed <uartgetc+0x31> return -1; 80106be6: b8 ff ff ff ff mov $0xffffffff,%eax 80106beb: eb 10 jmp 80106bfd <uartgetc+0x41> return inb(COM1+0); 80106bed: 68 f8 03 00 00 push $0x3f8 80106bf2: e8 33 fe ff ff call 80106a2a <inb> 80106bf7: 83 c4 04 add $0x4,%esp 80106bfa: 0f b6 c0 movzbl %al,%eax } 80106bfd: c9 leave 80106bfe: c3 ret 80106bff <uartintr>: void uartintr(void) { 80106bff: 55 push %ebp 80106c00: 89 e5 mov %esp,%ebp 80106c02: 83 ec 08 sub $0x8,%esp consoleintr(uartgetc); 80106c05: 83 ec 0c sub $0xc,%esp 80106c08: 68 bc 6b 10 80 push $0x80106bbc 80106c0d: e8 bf 9b ff ff call 801007d1 <consoleintr> 80106c12: 83 c4 10 add $0x10,%esp } 80106c15: c9 leave 80106c16: c3 ret 80106c17 <vector0>: # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 80106c17: 6a 00 push $0x0 pushl $0 80106c19: 6a 00 push $0x0 jmp alltraps 80106c1b: e9 af f9 ff ff jmp 801065cf <alltraps> 80106c20 <vector1>: .globl vector1 vector1: pushl $0 80106c20: 6a 00 push $0x0 pushl $1 80106c22: 6a 01 push $0x1 jmp alltraps 80106c24: e9 a6 f9 ff ff jmp 801065cf <alltraps> 80106c29 <vector2>: .globl vector2 vector2: pushl $0 80106c29: 6a 00 push $0x0 pushl $2 80106c2b: 6a 02 push $0x2 jmp alltraps 80106c2d: e9 9d f9 ff ff jmp 801065cf <alltraps> 80106c32 <vector3>: .globl vector3 vector3: pushl $0 80106c32: 6a 00 push $0x0 pushl $3 80106c34: 6a 03 push $0x3 jmp alltraps 80106c36: e9 94 f9 ff ff jmp 801065cf <alltraps> 80106c3b <vector4>: .globl vector4 vector4: pushl $0 80106c3b: 6a 00 push $0x0 pushl $4 80106c3d: 6a 04 push $0x4 jmp alltraps 80106c3f: e9 8b f9 ff ff jmp 801065cf <alltraps> 80106c44 <vector5>: .globl vector5 vector5: pushl $0 80106c44: 6a 00 push $0x0 pushl $5 80106c46: 6a 05 push $0x5 jmp alltraps 80106c48: e9 82 f9 ff ff jmp 801065cf <alltraps> 80106c4d <vector6>: .globl vector6 vector6: pushl $0 80106c4d: 6a 00 push $0x0 pushl $6 80106c4f: 6a 06 push $0x6 jmp alltraps 80106c51: e9 79 f9 ff ff jmp 801065cf <alltraps> 80106c56 <vector7>: .globl vector7 vector7: pushl $0 80106c56: 6a 00 push $0x0 pushl $7 80106c58: 6a 07 push $0x7 jmp alltraps 80106c5a: e9 70 f9 ff ff jmp 801065cf <alltraps> 80106c5f <vector8>: .globl vector8 vector8: pushl $8 80106c5f: 6a 08 push $0x8 jmp alltraps 80106c61: e9 69 f9 ff ff jmp 801065cf <alltraps> 80106c66 <vector9>: .globl vector9 vector9: pushl $0 80106c66: 6a 00 push $0x0 pushl $9 80106c68: 6a 09 push $0x9 jmp alltraps 80106c6a: e9 60 f9 ff ff jmp 801065cf <alltraps> 80106c6f <vector10>: .globl vector10 vector10: pushl $10 80106c6f: 6a 0a push $0xa jmp alltraps 80106c71: e9 59 f9 ff ff jmp 801065cf <alltraps> 80106c76 <vector11>: .globl vector11 vector11: pushl $11 80106c76: 6a 0b push $0xb jmp alltraps 80106c78: e9 52 f9 ff ff jmp 801065cf <alltraps> 80106c7d <vector12>: .globl vector12 vector12: pushl $12 80106c7d: 6a 0c push $0xc jmp alltraps 80106c7f: e9 4b f9 ff ff jmp 801065cf <alltraps> 80106c84 <vector13>: .globl vector13 vector13: pushl $13 80106c84: 6a 0d push $0xd jmp alltraps 80106c86: e9 44 f9 ff ff jmp 801065cf <alltraps> 80106c8b <vector14>: .globl vector14 vector14: pushl $14 80106c8b: 6a 0e push $0xe jmp alltraps 80106c8d: e9 3d f9 ff ff jmp 801065cf <alltraps> 80106c92 <vector15>: .globl vector15 vector15: pushl $0 80106c92: 6a 00 push $0x0 pushl $15 80106c94: 6a 0f push $0xf jmp alltraps 80106c96: e9 34 f9 ff ff jmp 801065cf <alltraps> 80106c9b <vector16>: .globl vector16 vector16: pushl $0 80106c9b: 6a 00 push $0x0 pushl $16 80106c9d: 6a 10 push $0x10 jmp alltraps 80106c9f: e9 2b f9 ff ff jmp 801065cf <alltraps> 80106ca4 <vector17>: .globl vector17 vector17: pushl $17 80106ca4: 6a 11 push $0x11 jmp alltraps 80106ca6: e9 24 f9 ff ff jmp 801065cf <alltraps> 80106cab <vector18>: .globl vector18 vector18: pushl $0 80106cab: 6a 00 push $0x0 pushl $18 80106cad: 6a 12 push $0x12 jmp alltraps 80106caf: e9 1b f9 ff ff jmp 801065cf <alltraps> 80106cb4 <vector19>: .globl vector19 vector19: pushl $0 80106cb4: 6a 00 push $0x0 pushl $19 80106cb6: 6a 13 push $0x13 jmp alltraps 80106cb8: e9 12 f9 ff ff jmp 801065cf <alltraps> 80106cbd <vector20>: .globl vector20 vector20: pushl $0 80106cbd: 6a 00 push $0x0 pushl $20 80106cbf: 6a 14 push $0x14 jmp alltraps 80106cc1: e9 09 f9 ff ff jmp 801065cf <alltraps> 80106cc6 <vector21>: .globl vector21 vector21: pushl $0 80106cc6: 6a 00 push $0x0 pushl $21 80106cc8: 6a 15 push $0x15 jmp alltraps 80106cca: e9 00 f9 ff ff jmp 801065cf <alltraps> 80106ccf <vector22>: .globl vector22 vector22: pushl $0 80106ccf: 6a 00 push $0x0 pushl $22 80106cd1: 6a 16 push $0x16 jmp alltraps 80106cd3: e9 f7 f8 ff ff jmp 801065cf <alltraps> 80106cd8 <vector23>: .globl vector23 vector23: pushl $0 80106cd8: 6a 00 push $0x0 pushl $23 80106cda: 6a 17 push $0x17 jmp alltraps 80106cdc: e9 ee f8 ff ff jmp 801065cf <alltraps> 80106ce1 <vector24>: .globl vector24 vector24: pushl $0 80106ce1: 6a 00 push $0x0 pushl $24 80106ce3: 6a 18 push $0x18 jmp alltraps 80106ce5: e9 e5 f8 ff ff jmp 801065cf <alltraps> 80106cea <vector25>: .globl vector25 vector25: pushl $0 80106cea: 6a 00 push $0x0 pushl $25 80106cec: 6a 19 push $0x19 jmp alltraps 80106cee: e9 dc f8 ff ff jmp 801065cf <alltraps> 80106cf3 <vector26>: .globl vector26 vector26: pushl $0 80106cf3: 6a 00 push $0x0 pushl $26 80106cf5: 6a 1a push $0x1a jmp alltraps 80106cf7: e9 d3 f8 ff ff jmp 801065cf <alltraps> 80106cfc <vector27>: .globl vector27 vector27: pushl $0 80106cfc: 6a 00 push $0x0 pushl $27 80106cfe: 6a 1b push $0x1b jmp alltraps 80106d00: e9 ca f8 ff ff jmp 801065cf <alltraps> 80106d05 <vector28>: .globl vector28 vector28: pushl $0 80106d05: 6a 00 push $0x0 pushl $28 80106d07: 6a 1c push $0x1c jmp alltraps 80106d09: e9 c1 f8 ff ff jmp 801065cf <alltraps> 80106d0e <vector29>: .globl vector29 vector29: pushl $0 80106d0e: 6a 00 push $0x0 pushl $29 80106d10: 6a 1d push $0x1d jmp alltraps 80106d12: e9 b8 f8 ff ff jmp 801065cf <alltraps> 80106d17 <vector30>: .globl vector30 vector30: pushl $0 80106d17: 6a 00 push $0x0 pushl $30 80106d19: 6a 1e push $0x1e jmp alltraps 80106d1b: e9 af f8 ff ff jmp 801065cf <alltraps> 80106d20 <vector31>: .globl vector31 vector31: pushl $0 80106d20: 6a 00 push $0x0 pushl $31 80106d22: 6a 1f push $0x1f jmp alltraps 80106d24: e9 a6 f8 ff ff jmp 801065cf <alltraps> 80106d29 <vector32>: .globl vector32 vector32: pushl $0 80106d29: 6a 00 push $0x0 pushl $32 80106d2b: 6a 20 push $0x20 jmp alltraps 80106d2d: e9 9d f8 ff ff jmp 801065cf <alltraps> 80106d32 <vector33>: .globl vector33 vector33: pushl $0 80106d32: 6a 00 push $0x0 pushl $33 80106d34: 6a 21 push $0x21 jmp alltraps 80106d36: e9 94 f8 ff ff jmp 801065cf <alltraps> 80106d3b <vector34>: .globl vector34 vector34: pushl $0 80106d3b: 6a 00 push $0x0 pushl $34 80106d3d: 6a 22 push $0x22 jmp alltraps 80106d3f: e9 8b f8 ff ff jmp 801065cf <alltraps> 80106d44 <vector35>: .globl vector35 vector35: pushl $0 80106d44: 6a 00 push $0x0 pushl $35 80106d46: 6a 23 push $0x23 jmp alltraps 80106d48: e9 82 f8 ff ff jmp 801065cf <alltraps> 80106d4d <vector36>: .globl vector36 vector36: pushl $0 80106d4d: 6a 00 push $0x0 pushl $36 80106d4f: 6a 24 push $0x24 jmp alltraps 80106d51: e9 79 f8 ff ff jmp 801065cf <alltraps> 80106d56 <vector37>: .globl vector37 vector37: pushl $0 80106d56: 6a 00 push $0x0 pushl $37 80106d58: 6a 25 push $0x25 jmp alltraps 80106d5a: e9 70 f8 ff ff jmp 801065cf <alltraps> 80106d5f <vector38>: .globl vector38 vector38: pushl $0 80106d5f: 6a 00 push $0x0 pushl $38 80106d61: 6a 26 push $0x26 jmp alltraps 80106d63: e9 67 f8 ff ff jmp 801065cf <alltraps> 80106d68 <vector39>: .globl vector39 vector39: pushl $0 80106d68: 6a 00 push $0x0 pushl $39 80106d6a: 6a 27 push $0x27 jmp alltraps 80106d6c: e9 5e f8 ff ff jmp 801065cf <alltraps> 80106d71 <vector40>: .globl vector40 vector40: pushl $0 80106d71: 6a 00 push $0x0 pushl $40 80106d73: 6a 28 push $0x28 jmp alltraps 80106d75: e9 55 f8 ff ff jmp 801065cf <alltraps> 80106d7a <vector41>: .globl vector41 vector41: pushl $0 80106d7a: 6a 00 push $0x0 pushl $41 80106d7c: 6a 29 push $0x29 jmp alltraps 80106d7e: e9 4c f8 ff ff jmp 801065cf <alltraps> 80106d83 <vector42>: .globl vector42 vector42: pushl $0 80106d83: 6a 00 push $0x0 pushl $42 80106d85: 6a 2a push $0x2a jmp alltraps 80106d87: e9 43 f8 ff ff jmp 801065cf <alltraps> 80106d8c <vector43>: .globl vector43 vector43: pushl $0 80106d8c: 6a 00 push $0x0 pushl $43 80106d8e: 6a 2b push $0x2b jmp alltraps 80106d90: e9 3a f8 ff ff jmp 801065cf <alltraps> 80106d95 <vector44>: .globl vector44 vector44: pushl $0 80106d95: 6a 00 push $0x0 pushl $44 80106d97: 6a 2c push $0x2c jmp alltraps 80106d99: e9 31 f8 ff ff jmp 801065cf <alltraps> 80106d9e <vector45>: .globl vector45 vector45: pushl $0 80106d9e: 6a 00 push $0x0 pushl $45 80106da0: 6a 2d push $0x2d jmp alltraps 80106da2: e9 28 f8 ff ff jmp 801065cf <alltraps> 80106da7 <vector46>: .globl vector46 vector46: pushl $0 80106da7: 6a 00 push $0x0 pushl $46 80106da9: 6a 2e push $0x2e jmp alltraps 80106dab: e9 1f f8 ff ff jmp 801065cf <alltraps> 80106db0 <vector47>: .globl vector47 vector47: pushl $0 80106db0: 6a 00 push $0x0 pushl $47 80106db2: 6a 2f push $0x2f jmp alltraps 80106db4: e9 16 f8 ff ff jmp 801065cf <alltraps> 80106db9 <vector48>: .globl vector48 vector48: pushl $0 80106db9: 6a 00 push $0x0 pushl $48 80106dbb: 6a 30 push $0x30 jmp alltraps 80106dbd: e9 0d f8 ff ff jmp 801065cf <alltraps> 80106dc2 <vector49>: .globl vector49 vector49: pushl $0 80106dc2: 6a 00 push $0x0 pushl $49 80106dc4: 6a 31 push $0x31 jmp alltraps 80106dc6: e9 04 f8 ff ff jmp 801065cf <alltraps> 80106dcb <vector50>: .globl vector50 vector50: pushl $0 80106dcb: 6a 00 push $0x0 pushl $50 80106dcd: 6a 32 push $0x32 jmp alltraps 80106dcf: e9 fb f7 ff ff jmp 801065cf <alltraps> 80106dd4 <vector51>: .globl vector51 vector51: pushl $0 80106dd4: 6a 00 push $0x0 pushl $51 80106dd6: 6a 33 push $0x33 jmp alltraps 80106dd8: e9 f2 f7 ff ff jmp 801065cf <alltraps> 80106ddd <vector52>: .globl vector52 vector52: pushl $0 80106ddd: 6a 00 push $0x0 pushl $52 80106ddf: 6a 34 push $0x34 jmp alltraps 80106de1: e9 e9 f7 ff ff jmp 801065cf <alltraps> 80106de6 <vector53>: .globl vector53 vector53: pushl $0 80106de6: 6a 00 push $0x0 pushl $53 80106de8: 6a 35 push $0x35 jmp alltraps 80106dea: e9 e0 f7 ff ff jmp 801065cf <alltraps> 80106def <vector54>: .globl vector54 vector54: pushl $0 80106def: 6a 00 push $0x0 pushl $54 80106df1: 6a 36 push $0x36 jmp alltraps 80106df3: e9 d7 f7 ff ff jmp 801065cf <alltraps> 80106df8 <vector55>: .globl vector55 vector55: pushl $0 80106df8: 6a 00 push $0x0 pushl $55 80106dfa: 6a 37 push $0x37 jmp alltraps 80106dfc: e9 ce f7 ff ff jmp 801065cf <alltraps> 80106e01 <vector56>: .globl vector56 vector56: pushl $0 80106e01: 6a 00 push $0x0 pushl $56 80106e03: 6a 38 push $0x38 jmp alltraps 80106e05: e9 c5 f7 ff ff jmp 801065cf <alltraps> 80106e0a <vector57>: .globl vector57 vector57: pushl $0 80106e0a: 6a 00 push $0x0 pushl $57 80106e0c: 6a 39 push $0x39 jmp alltraps 80106e0e: e9 bc f7 ff ff jmp 801065cf <alltraps> 80106e13 <vector58>: .globl vector58 vector58: pushl $0 80106e13: 6a 00 push $0x0 pushl $58 80106e15: 6a 3a push $0x3a jmp alltraps 80106e17: e9 b3 f7 ff ff jmp 801065cf <alltraps> 80106e1c <vector59>: .globl vector59 vector59: pushl $0 80106e1c: 6a 00 push $0x0 pushl $59 80106e1e: 6a 3b push $0x3b jmp alltraps 80106e20: e9 aa f7 ff ff jmp 801065cf <alltraps> 80106e25 <vector60>: .globl vector60 vector60: pushl $0 80106e25: 6a 00 push $0x0 pushl $60 80106e27: 6a 3c push $0x3c jmp alltraps 80106e29: e9 a1 f7 ff ff jmp 801065cf <alltraps> 80106e2e <vector61>: .globl vector61 vector61: pushl $0 80106e2e: 6a 00 push $0x0 pushl $61 80106e30: 6a 3d push $0x3d jmp alltraps 80106e32: e9 98 f7 ff ff jmp 801065cf <alltraps> 80106e37 <vector62>: .globl vector62 vector62: pushl $0 80106e37: 6a 00 push $0x0 pushl $62 80106e39: 6a 3e push $0x3e jmp alltraps 80106e3b: e9 8f f7 ff ff jmp 801065cf <alltraps> 80106e40 <vector63>: .globl vector63 vector63: pushl $0 80106e40: 6a 00 push $0x0 pushl $63 80106e42: 6a 3f push $0x3f jmp alltraps 80106e44: e9 86 f7 ff ff jmp 801065cf <alltraps> 80106e49 <vector64>: .globl vector64 vector64: pushl $0 80106e49: 6a 00 push $0x0 pushl $64 80106e4b: 6a 40 push $0x40 jmp alltraps 80106e4d: e9 7d f7 ff ff jmp 801065cf <alltraps> 80106e52 <vector65>: .globl vector65 vector65: pushl $0 80106e52: 6a 00 push $0x0 pushl $65 80106e54: 6a 41 push $0x41 jmp alltraps 80106e56: e9 74 f7 ff ff jmp 801065cf <alltraps> 80106e5b <vector66>: .globl vector66 vector66: pushl $0 80106e5b: 6a 00 push $0x0 pushl $66 80106e5d: 6a 42 push $0x42 jmp alltraps 80106e5f: e9 6b f7 ff ff jmp 801065cf <alltraps> 80106e64 <vector67>: .globl vector67 vector67: pushl $0 80106e64: 6a 00 push $0x0 pushl $67 80106e66: 6a 43 push $0x43 jmp alltraps 80106e68: e9 62 f7 ff ff jmp 801065cf <alltraps> 80106e6d <vector68>: .globl vector68 vector68: pushl $0 80106e6d: 6a 00 push $0x0 pushl $68 80106e6f: 6a 44 push $0x44 jmp alltraps 80106e71: e9 59 f7 ff ff jmp 801065cf <alltraps> 80106e76 <vector69>: .globl vector69 vector69: pushl $0 80106e76: 6a 00 push $0x0 pushl $69 80106e78: 6a 45 push $0x45 jmp alltraps 80106e7a: e9 50 f7 ff ff jmp 801065cf <alltraps> 80106e7f <vector70>: .globl vector70 vector70: pushl $0 80106e7f: 6a 00 push $0x0 pushl $70 80106e81: 6a 46 push $0x46 jmp alltraps 80106e83: e9 47 f7 ff ff jmp 801065cf <alltraps> 80106e88 <vector71>: .globl vector71 vector71: pushl $0 80106e88: 6a 00 push $0x0 pushl $71 80106e8a: 6a 47 push $0x47 jmp alltraps 80106e8c: e9 3e f7 ff ff jmp 801065cf <alltraps> 80106e91 <vector72>: .globl vector72 vector72: pushl $0 80106e91: 6a 00 push $0x0 pushl $72 80106e93: 6a 48 push $0x48 jmp alltraps 80106e95: e9 35 f7 ff ff jmp 801065cf <alltraps> 80106e9a <vector73>: .globl vector73 vector73: pushl $0 80106e9a: 6a 00 push $0x0 pushl $73 80106e9c: 6a 49 push $0x49 jmp alltraps 80106e9e: e9 2c f7 ff ff jmp 801065cf <alltraps> 80106ea3 <vector74>: .globl vector74 vector74: pushl $0 80106ea3: 6a 00 push $0x0 pushl $74 80106ea5: 6a 4a push $0x4a jmp alltraps 80106ea7: e9 23 f7 ff ff jmp 801065cf <alltraps> 80106eac <vector75>: .globl vector75 vector75: pushl $0 80106eac: 6a 00 push $0x0 pushl $75 80106eae: 6a 4b push $0x4b jmp alltraps 80106eb0: e9 1a f7 ff ff jmp 801065cf <alltraps> 80106eb5 <vector76>: .globl vector76 vector76: pushl $0 80106eb5: 6a 00 push $0x0 pushl $76 80106eb7: 6a 4c push $0x4c jmp alltraps 80106eb9: e9 11 f7 ff ff jmp 801065cf <alltraps> 80106ebe <vector77>: .globl vector77 vector77: pushl $0 80106ebe: 6a 00 push $0x0 pushl $77 80106ec0: 6a 4d push $0x4d jmp alltraps 80106ec2: e9 08 f7 ff ff jmp 801065cf <alltraps> 80106ec7 <vector78>: .globl vector78 vector78: pushl $0 80106ec7: 6a 00 push $0x0 pushl $78 80106ec9: 6a 4e push $0x4e jmp alltraps 80106ecb: e9 ff f6 ff ff jmp 801065cf <alltraps> 80106ed0 <vector79>: .globl vector79 vector79: pushl $0 80106ed0: 6a 00 push $0x0 pushl $79 80106ed2: 6a 4f push $0x4f jmp alltraps 80106ed4: e9 f6 f6 ff ff jmp 801065cf <alltraps> 80106ed9 <vector80>: .globl vector80 vector80: pushl $0 80106ed9: 6a 00 push $0x0 pushl $80 80106edb: 6a 50 push $0x50 jmp alltraps 80106edd: e9 ed f6 ff ff jmp 801065cf <alltraps> 80106ee2 <vector81>: .globl vector81 vector81: pushl $0 80106ee2: 6a 00 push $0x0 pushl $81 80106ee4: 6a 51 push $0x51 jmp alltraps 80106ee6: e9 e4 f6 ff ff jmp 801065cf <alltraps> 80106eeb <vector82>: .globl vector82 vector82: pushl $0 80106eeb: 6a 00 push $0x0 pushl $82 80106eed: 6a 52 push $0x52 jmp alltraps 80106eef: e9 db f6 ff ff jmp 801065cf <alltraps> 80106ef4 <vector83>: .globl vector83 vector83: pushl $0 80106ef4: 6a 00 push $0x0 pushl $83 80106ef6: 6a 53 push $0x53 jmp alltraps 80106ef8: e9 d2 f6 ff ff jmp 801065cf <alltraps> 80106efd <vector84>: .globl vector84 vector84: pushl $0 80106efd: 6a 00 push $0x0 pushl $84 80106eff: 6a 54 push $0x54 jmp alltraps 80106f01: e9 c9 f6 ff ff jmp 801065cf <alltraps> 80106f06 <vector85>: .globl vector85 vector85: pushl $0 80106f06: 6a 00 push $0x0 pushl $85 80106f08: 6a 55 push $0x55 jmp alltraps 80106f0a: e9 c0 f6 ff ff jmp 801065cf <alltraps> 80106f0f <vector86>: .globl vector86 vector86: pushl $0 80106f0f: 6a 00 push $0x0 pushl $86 80106f11: 6a 56 push $0x56 jmp alltraps 80106f13: e9 b7 f6 ff ff jmp 801065cf <alltraps> 80106f18 <vector87>: .globl vector87 vector87: pushl $0 80106f18: 6a 00 push $0x0 pushl $87 80106f1a: 6a 57 push $0x57 jmp alltraps 80106f1c: e9 ae f6 ff ff jmp 801065cf <alltraps> 80106f21 <vector88>: .globl vector88 vector88: pushl $0 80106f21: 6a 00 push $0x0 pushl $88 80106f23: 6a 58 push $0x58 jmp alltraps 80106f25: e9 a5 f6 ff ff jmp 801065cf <alltraps> 80106f2a <vector89>: .globl vector89 vector89: pushl $0 80106f2a: 6a 00 push $0x0 pushl $89 80106f2c: 6a 59 push $0x59 jmp alltraps 80106f2e: e9 9c f6 ff ff jmp 801065cf <alltraps> 80106f33 <vector90>: .globl vector90 vector90: pushl $0 80106f33: 6a 00 push $0x0 pushl $90 80106f35: 6a 5a push $0x5a jmp alltraps 80106f37: e9 93 f6 ff ff jmp 801065cf <alltraps> 80106f3c <vector91>: .globl vector91 vector91: pushl $0 80106f3c: 6a 00 push $0x0 pushl $91 80106f3e: 6a 5b push $0x5b jmp alltraps 80106f40: e9 8a f6 ff ff jmp 801065cf <alltraps> 80106f45 <vector92>: .globl vector92 vector92: pushl $0 80106f45: 6a 00 push $0x0 pushl $92 80106f47: 6a 5c push $0x5c jmp alltraps 80106f49: e9 81 f6 ff ff jmp 801065cf <alltraps> 80106f4e <vector93>: .globl vector93 vector93: pushl $0 80106f4e: 6a 00 push $0x0 pushl $93 80106f50: 6a 5d push $0x5d jmp alltraps 80106f52: e9 78 f6 ff ff jmp 801065cf <alltraps> 80106f57 <vector94>: .globl vector94 vector94: pushl $0 80106f57: 6a 00 push $0x0 pushl $94 80106f59: 6a 5e push $0x5e jmp alltraps 80106f5b: e9 6f f6 ff ff jmp 801065cf <alltraps> 80106f60 <vector95>: .globl vector95 vector95: pushl $0 80106f60: 6a 00 push $0x0 pushl $95 80106f62: 6a 5f push $0x5f jmp alltraps 80106f64: e9 66 f6 ff ff jmp 801065cf <alltraps> 80106f69 <vector96>: .globl vector96 vector96: pushl $0 80106f69: 6a 00 push $0x0 pushl $96 80106f6b: 6a 60 push $0x60 jmp alltraps 80106f6d: e9 5d f6 ff ff jmp 801065cf <alltraps> 80106f72 <vector97>: .globl vector97 vector97: pushl $0 80106f72: 6a 00 push $0x0 pushl $97 80106f74: 6a 61 push $0x61 jmp alltraps 80106f76: e9 54 f6 ff ff jmp 801065cf <alltraps> 80106f7b <vector98>: .globl vector98 vector98: pushl $0 80106f7b: 6a 00 push $0x0 pushl $98 80106f7d: 6a 62 push $0x62 jmp alltraps 80106f7f: e9 4b f6 ff ff jmp 801065cf <alltraps> 80106f84 <vector99>: .globl vector99 vector99: pushl $0 80106f84: 6a 00 push $0x0 pushl $99 80106f86: 6a 63 push $0x63 jmp alltraps 80106f88: e9 42 f6 ff ff jmp 801065cf <alltraps> 80106f8d <vector100>: .globl vector100 vector100: pushl $0 80106f8d: 6a 00 push $0x0 pushl $100 80106f8f: 6a 64 push $0x64 jmp alltraps 80106f91: e9 39 f6 ff ff jmp 801065cf <alltraps> 80106f96 <vector101>: .globl vector101 vector101: pushl $0 80106f96: 6a 00 push $0x0 pushl $101 80106f98: 6a 65 push $0x65 jmp alltraps 80106f9a: e9 30 f6 ff ff jmp 801065cf <alltraps> 80106f9f <vector102>: .globl vector102 vector102: pushl $0 80106f9f: 6a 00 push $0x0 pushl $102 80106fa1: 6a 66 push $0x66 jmp alltraps 80106fa3: e9 27 f6 ff ff jmp 801065cf <alltraps> 80106fa8 <vector103>: .globl vector103 vector103: pushl $0 80106fa8: 6a 00 push $0x0 pushl $103 80106faa: 6a 67 push $0x67 jmp alltraps 80106fac: e9 1e f6 ff ff jmp 801065cf <alltraps> 80106fb1 <vector104>: .globl vector104 vector104: pushl $0 80106fb1: 6a 00 push $0x0 pushl $104 80106fb3: 6a 68 push $0x68 jmp alltraps 80106fb5: e9 15 f6 ff ff jmp 801065cf <alltraps> 80106fba <vector105>: .globl vector105 vector105: pushl $0 80106fba: 6a 00 push $0x0 pushl $105 80106fbc: 6a 69 push $0x69 jmp alltraps 80106fbe: e9 0c f6 ff ff jmp 801065cf <alltraps> 80106fc3 <vector106>: .globl vector106 vector106: pushl $0 80106fc3: 6a 00 push $0x0 pushl $106 80106fc5: 6a 6a push $0x6a jmp alltraps 80106fc7: e9 03 f6 ff ff jmp 801065cf <alltraps> 80106fcc <vector107>: .globl vector107 vector107: pushl $0 80106fcc: 6a 00 push $0x0 pushl $107 80106fce: 6a 6b push $0x6b jmp alltraps 80106fd0: e9 fa f5 ff ff jmp 801065cf <alltraps> 80106fd5 <vector108>: .globl vector108 vector108: pushl $0 80106fd5: 6a 00 push $0x0 pushl $108 80106fd7: 6a 6c push $0x6c jmp alltraps 80106fd9: e9 f1 f5 ff ff jmp 801065cf <alltraps> 80106fde <vector109>: .globl vector109 vector109: pushl $0 80106fde: 6a 00 push $0x0 pushl $109 80106fe0: 6a 6d push $0x6d jmp alltraps 80106fe2: e9 e8 f5 ff ff jmp 801065cf <alltraps> 80106fe7 <vector110>: .globl vector110 vector110: pushl $0 80106fe7: 6a 00 push $0x0 pushl $110 80106fe9: 6a 6e push $0x6e jmp alltraps 80106feb: e9 df f5 ff ff jmp 801065cf <alltraps> 80106ff0 <vector111>: .globl vector111 vector111: pushl $0 80106ff0: 6a 00 push $0x0 pushl $111 80106ff2: 6a 6f push $0x6f jmp alltraps 80106ff4: e9 d6 f5 ff ff jmp 801065cf <alltraps> 80106ff9 <vector112>: .globl vector112 vector112: pushl $0 80106ff9: 6a 00 push $0x0 pushl $112 80106ffb: 6a 70 push $0x70 jmp alltraps 80106ffd: e9 cd f5 ff ff jmp 801065cf <alltraps> 80107002 <vector113>: .globl vector113 vector113: pushl $0 80107002: 6a 00 push $0x0 pushl $113 80107004: 6a 71 push $0x71 jmp alltraps 80107006: e9 c4 f5 ff ff jmp 801065cf <alltraps> 8010700b <vector114>: .globl vector114 vector114: pushl $0 8010700b: 6a 00 push $0x0 pushl $114 8010700d: 6a 72 push $0x72 jmp alltraps 8010700f: e9 bb f5 ff ff jmp 801065cf <alltraps> 80107014 <vector115>: .globl vector115 vector115: pushl $0 80107014: 6a 00 push $0x0 pushl $115 80107016: 6a 73 push $0x73 jmp alltraps 80107018: e9 b2 f5 ff ff jmp 801065cf <alltraps> 8010701d <vector116>: .globl vector116 vector116: pushl $0 8010701d: 6a 00 push $0x0 pushl $116 8010701f: 6a 74 push $0x74 jmp alltraps 80107021: e9 a9 f5 ff ff jmp 801065cf <alltraps> 80107026 <vector117>: .globl vector117 vector117: pushl $0 80107026: 6a 00 push $0x0 pushl $117 80107028: 6a 75 push $0x75 jmp alltraps 8010702a: e9 a0 f5 ff ff jmp 801065cf <alltraps> 8010702f <vector118>: .globl vector118 vector118: pushl $0 8010702f: 6a 00 push $0x0 pushl $118 80107031: 6a 76 push $0x76 jmp alltraps 80107033: e9 97 f5 ff ff jmp 801065cf <alltraps> 80107038 <vector119>: .globl vector119 vector119: pushl $0 80107038: 6a 00 push $0x0 pushl $119 8010703a: 6a 77 push $0x77 jmp alltraps 8010703c: e9 8e f5 ff ff jmp 801065cf <alltraps> 80107041 <vector120>: .globl vector120 vector120: pushl $0 80107041: 6a 00 push $0x0 pushl $120 80107043: 6a 78 push $0x78 jmp alltraps 80107045: e9 85 f5 ff ff jmp 801065cf <alltraps> 8010704a <vector121>: .globl vector121 vector121: pushl $0 8010704a: 6a 00 push $0x0 pushl $121 8010704c: 6a 79 push $0x79 jmp alltraps 8010704e: e9 7c f5 ff ff jmp 801065cf <alltraps> 80107053 <vector122>: .globl vector122 vector122: pushl $0 80107053: 6a 00 push $0x0 pushl $122 80107055: 6a 7a push $0x7a jmp alltraps 80107057: e9 73 f5 ff ff jmp 801065cf <alltraps> 8010705c <vector123>: .globl vector123 vector123: pushl $0 8010705c: 6a 00 push $0x0 pushl $123 8010705e: 6a 7b push $0x7b jmp alltraps 80107060: e9 6a f5 ff ff jmp 801065cf <alltraps> 80107065 <vector124>: .globl vector124 vector124: pushl $0 80107065: 6a 00 push $0x0 pushl $124 80107067: 6a 7c push $0x7c jmp alltraps 80107069: e9 61 f5 ff ff jmp 801065cf <alltraps> 8010706e <vector125>: .globl vector125 vector125: pushl $0 8010706e: 6a 00 push $0x0 pushl $125 80107070: 6a 7d push $0x7d jmp alltraps 80107072: e9 58 f5 ff ff jmp 801065cf <alltraps> 80107077 <vector126>: .globl vector126 vector126: pushl $0 80107077: 6a 00 push $0x0 pushl $126 80107079: 6a 7e push $0x7e jmp alltraps 8010707b: e9 4f f5 ff ff jmp 801065cf <alltraps> 80107080 <vector127>: .globl vector127 vector127: pushl $0 80107080: 6a 00 push $0x0 pushl $127 80107082: 6a 7f push $0x7f jmp alltraps 80107084: e9 46 f5 ff ff jmp 801065cf <alltraps> 80107089 <vector128>: .globl vector128 vector128: pushl $0 80107089: 6a 00 push $0x0 pushl $128 8010708b: 68 80 00 00 00 push $0x80 jmp alltraps 80107090: e9 3a f5 ff ff jmp 801065cf <alltraps> 80107095 <vector129>: .globl vector129 vector129: pushl $0 80107095: 6a 00 push $0x0 pushl $129 80107097: 68 81 00 00 00 push $0x81 jmp alltraps 8010709c: e9 2e f5 ff ff jmp 801065cf <alltraps> 801070a1 <vector130>: .globl vector130 vector130: pushl $0 801070a1: 6a 00 push $0x0 pushl $130 801070a3: 68 82 00 00 00 push $0x82 jmp alltraps 801070a8: e9 22 f5 ff ff jmp 801065cf <alltraps> 801070ad <vector131>: .globl vector131 vector131: pushl $0 801070ad: 6a 00 push $0x0 pushl $131 801070af: 68 83 00 00 00 push $0x83 jmp alltraps 801070b4: e9 16 f5 ff ff jmp 801065cf <alltraps> 801070b9 <vector132>: .globl vector132 vector132: pushl $0 801070b9: 6a 00 push $0x0 pushl $132 801070bb: 68 84 00 00 00 push $0x84 jmp alltraps 801070c0: e9 0a f5 ff ff jmp 801065cf <alltraps> 801070c5 <vector133>: .globl vector133 vector133: pushl $0 801070c5: 6a 00 push $0x0 pushl $133 801070c7: 68 85 00 00 00 push $0x85 jmp alltraps 801070cc: e9 fe f4 ff ff jmp 801065cf <alltraps> 801070d1 <vector134>: .globl vector134 vector134: pushl $0 801070d1: 6a 00 push $0x0 pushl $134 801070d3: 68 86 00 00 00 push $0x86 jmp alltraps 801070d8: e9 f2 f4 ff ff jmp 801065cf <alltraps> 801070dd <vector135>: .globl vector135 vector135: pushl $0 801070dd: 6a 00 push $0x0 pushl $135 801070df: 68 87 00 00 00 push $0x87 jmp alltraps 801070e4: e9 e6 f4 ff ff jmp 801065cf <alltraps> 801070e9 <vector136>: .globl vector136 vector136: pushl $0 801070e9: 6a 00 push $0x0 pushl $136 801070eb: 68 88 00 00 00 push $0x88 jmp alltraps 801070f0: e9 da f4 ff ff jmp 801065cf <alltraps> 801070f5 <vector137>: .globl vector137 vector137: pushl $0 801070f5: 6a 00 push $0x0 pushl $137 801070f7: 68 89 00 00 00 push $0x89 jmp alltraps 801070fc: e9 ce f4 ff ff jmp 801065cf <alltraps> 80107101 <vector138>: .globl vector138 vector138: pushl $0 80107101: 6a 00 push $0x0 pushl $138 80107103: 68 8a 00 00 00 push $0x8a jmp alltraps 80107108: e9 c2 f4 ff ff jmp 801065cf <alltraps> 8010710d <vector139>: .globl vector139 vector139: pushl $0 8010710d: 6a 00 push $0x0 pushl $139 8010710f: 68 8b 00 00 00 push $0x8b jmp alltraps 80107114: e9 b6 f4 ff ff jmp 801065cf <alltraps> 80107119 <vector140>: .globl vector140 vector140: pushl $0 80107119: 6a 00 push $0x0 pushl $140 8010711b: 68 8c 00 00 00 push $0x8c jmp alltraps 80107120: e9 aa f4 ff ff jmp 801065cf <alltraps> 80107125 <vector141>: .globl vector141 vector141: pushl $0 80107125: 6a 00 push $0x0 pushl $141 80107127: 68 8d 00 00 00 push $0x8d jmp alltraps 8010712c: e9 9e f4 ff ff jmp 801065cf <alltraps> 80107131 <vector142>: .globl vector142 vector142: pushl $0 80107131: 6a 00 push $0x0 pushl $142 80107133: 68 8e 00 00 00 push $0x8e jmp alltraps 80107138: e9 92 f4 ff ff jmp 801065cf <alltraps> 8010713d <vector143>: .globl vector143 vector143: pushl $0 8010713d: 6a 00 push $0x0 pushl $143 8010713f: 68 8f 00 00 00 push $0x8f jmp alltraps 80107144: e9 86 f4 ff ff jmp 801065cf <alltraps> 80107149 <vector144>: .globl vector144 vector144: pushl $0 80107149: 6a 00 push $0x0 pushl $144 8010714b: 68 90 00 00 00 push $0x90 jmp alltraps 80107150: e9 7a f4 ff ff jmp 801065cf <alltraps> 80107155 <vector145>: .globl vector145 vector145: pushl $0 80107155: 6a 00 push $0x0 pushl $145 80107157: 68 91 00 00 00 push $0x91 jmp alltraps 8010715c: e9 6e f4 ff ff jmp 801065cf <alltraps> 80107161 <vector146>: .globl vector146 vector146: pushl $0 80107161: 6a 00 push $0x0 pushl $146 80107163: 68 92 00 00 00 push $0x92 jmp alltraps 80107168: e9 62 f4 ff ff jmp 801065cf <alltraps> 8010716d <vector147>: .globl vector147 vector147: pushl $0 8010716d: 6a 00 push $0x0 pushl $147 8010716f: 68 93 00 00 00 push $0x93 jmp alltraps 80107174: e9 56 f4 ff ff jmp 801065cf <alltraps> 80107179 <vector148>: .globl vector148 vector148: pushl $0 80107179: 6a 00 push $0x0 pushl $148 8010717b: 68 94 00 00 00 push $0x94 jmp alltraps 80107180: e9 4a f4 ff ff jmp 801065cf <alltraps> 80107185 <vector149>: .globl vector149 vector149: pushl $0 80107185: 6a 00 push $0x0 pushl $149 80107187: 68 95 00 00 00 push $0x95 jmp alltraps 8010718c: e9 3e f4 ff ff jmp 801065cf <alltraps> 80107191 <vector150>: .globl vector150 vector150: pushl $0 80107191: 6a 00 push $0x0 pushl $150 80107193: 68 96 00 00 00 push $0x96 jmp alltraps 80107198: e9 32 f4 ff ff jmp 801065cf <alltraps> 8010719d <vector151>: .globl vector151 vector151: pushl $0 8010719d: 6a 00 push $0x0 pushl $151 8010719f: 68 97 00 00 00 push $0x97 jmp alltraps 801071a4: e9 26 f4 ff ff jmp 801065cf <alltraps> 801071a9 <vector152>: .globl vector152 vector152: pushl $0 801071a9: 6a 00 push $0x0 pushl $152 801071ab: 68 98 00 00 00 push $0x98 jmp alltraps 801071b0: e9 1a f4 ff ff jmp 801065cf <alltraps> 801071b5 <vector153>: .globl vector153 vector153: pushl $0 801071b5: 6a 00 push $0x0 pushl $153 801071b7: 68 99 00 00 00 push $0x99 jmp alltraps 801071bc: e9 0e f4 ff ff jmp 801065cf <alltraps> 801071c1 <vector154>: .globl vector154 vector154: pushl $0 801071c1: 6a 00 push $0x0 pushl $154 801071c3: 68 9a 00 00 00 push $0x9a jmp alltraps 801071c8: e9 02 f4 ff ff jmp 801065cf <alltraps> 801071cd <vector155>: .globl vector155 vector155: pushl $0 801071cd: 6a 00 push $0x0 pushl $155 801071cf: 68 9b 00 00 00 push $0x9b jmp alltraps 801071d4: e9 f6 f3 ff ff jmp 801065cf <alltraps> 801071d9 <vector156>: .globl vector156 vector156: pushl $0 801071d9: 6a 00 push $0x0 pushl $156 801071db: 68 9c 00 00 00 push $0x9c jmp alltraps 801071e0: e9 ea f3 ff ff jmp 801065cf <alltraps> 801071e5 <vector157>: .globl vector157 vector157: pushl $0 801071e5: 6a 00 push $0x0 pushl $157 801071e7: 68 9d 00 00 00 push $0x9d jmp alltraps 801071ec: e9 de f3 ff ff jmp 801065cf <alltraps> 801071f1 <vector158>: .globl vector158 vector158: pushl $0 801071f1: 6a 00 push $0x0 pushl $158 801071f3: 68 9e 00 00 00 push $0x9e jmp alltraps 801071f8: e9 d2 f3 ff ff jmp 801065cf <alltraps> 801071fd <vector159>: .globl vector159 vector159: pushl $0 801071fd: 6a 00 push $0x0 pushl $159 801071ff: 68 9f 00 00 00 push $0x9f jmp alltraps 80107204: e9 c6 f3 ff ff jmp 801065cf <alltraps> 80107209 <vector160>: .globl vector160 vector160: pushl $0 80107209: 6a 00 push $0x0 pushl $160 8010720b: 68 a0 00 00 00 push $0xa0 jmp alltraps 80107210: e9 ba f3 ff ff jmp 801065cf <alltraps> 80107215 <vector161>: .globl vector161 vector161: pushl $0 80107215: 6a 00 push $0x0 pushl $161 80107217: 68 a1 00 00 00 push $0xa1 jmp alltraps 8010721c: e9 ae f3 ff ff jmp 801065cf <alltraps> 80107221 <vector162>: .globl vector162 vector162: pushl $0 80107221: 6a 00 push $0x0 pushl $162 80107223: 68 a2 00 00 00 push $0xa2 jmp alltraps 80107228: e9 a2 f3 ff ff jmp 801065cf <alltraps> 8010722d <vector163>: .globl vector163 vector163: pushl $0 8010722d: 6a 00 push $0x0 pushl $163 8010722f: 68 a3 00 00 00 push $0xa3 jmp alltraps 80107234: e9 96 f3 ff ff jmp 801065cf <alltraps> 80107239 <vector164>: .globl vector164 vector164: pushl $0 80107239: 6a 00 push $0x0 pushl $164 8010723b: 68 a4 00 00 00 push $0xa4 jmp alltraps 80107240: e9 8a f3 ff ff jmp 801065cf <alltraps> 80107245 <vector165>: .globl vector165 vector165: pushl $0 80107245: 6a 00 push $0x0 pushl $165 80107247: 68 a5 00 00 00 push $0xa5 jmp alltraps 8010724c: e9 7e f3 ff ff jmp 801065cf <alltraps> 80107251 <vector166>: .globl vector166 vector166: pushl $0 80107251: 6a 00 push $0x0 pushl $166 80107253: 68 a6 00 00 00 push $0xa6 jmp alltraps 80107258: e9 72 f3 ff ff jmp 801065cf <alltraps> 8010725d <vector167>: .globl vector167 vector167: pushl $0 8010725d: 6a 00 push $0x0 pushl $167 8010725f: 68 a7 00 00 00 push $0xa7 jmp alltraps 80107264: e9 66 f3 ff ff jmp 801065cf <alltraps> 80107269 <vector168>: .globl vector168 vector168: pushl $0 80107269: 6a 00 push $0x0 pushl $168 8010726b: 68 a8 00 00 00 push $0xa8 jmp alltraps 80107270: e9 5a f3 ff ff jmp 801065cf <alltraps> 80107275 <vector169>: .globl vector169 vector169: pushl $0 80107275: 6a 00 push $0x0 pushl $169 80107277: 68 a9 00 00 00 push $0xa9 jmp alltraps 8010727c: e9 4e f3 ff ff jmp 801065cf <alltraps> 80107281 <vector170>: .globl vector170 vector170: pushl $0 80107281: 6a 00 push $0x0 pushl $170 80107283: 68 aa 00 00 00 push $0xaa jmp alltraps 80107288: e9 42 f3 ff ff jmp 801065cf <alltraps> 8010728d <vector171>: .globl vector171 vector171: pushl $0 8010728d: 6a 00 push $0x0 pushl $171 8010728f: 68 ab 00 00 00 push $0xab jmp alltraps 80107294: e9 36 f3 ff ff jmp 801065cf <alltraps> 80107299 <vector172>: .globl vector172 vector172: pushl $0 80107299: 6a 00 push $0x0 pushl $172 8010729b: 68 ac 00 00 00 push $0xac jmp alltraps 801072a0: e9 2a f3 ff ff jmp 801065cf <alltraps> 801072a5 <vector173>: .globl vector173 vector173: pushl $0 801072a5: 6a 00 push $0x0 pushl $173 801072a7: 68 ad 00 00 00 push $0xad jmp alltraps 801072ac: e9 1e f3 ff ff jmp 801065cf <alltraps> 801072b1 <vector174>: .globl vector174 vector174: pushl $0 801072b1: 6a 00 push $0x0 pushl $174 801072b3: 68 ae 00 00 00 push $0xae jmp alltraps 801072b8: e9 12 f3 ff ff jmp 801065cf <alltraps> 801072bd <vector175>: .globl vector175 vector175: pushl $0 801072bd: 6a 00 push $0x0 pushl $175 801072bf: 68 af 00 00 00 push $0xaf jmp alltraps 801072c4: e9 06 f3 ff ff jmp 801065cf <alltraps> 801072c9 <vector176>: .globl vector176 vector176: pushl $0 801072c9: 6a 00 push $0x0 pushl $176 801072cb: 68 b0 00 00 00 push $0xb0 jmp alltraps 801072d0: e9 fa f2 ff ff jmp 801065cf <alltraps> 801072d5 <vector177>: .globl vector177 vector177: pushl $0 801072d5: 6a 00 push $0x0 pushl $177 801072d7: 68 b1 00 00 00 push $0xb1 jmp alltraps 801072dc: e9 ee f2 ff ff jmp 801065cf <alltraps> 801072e1 <vector178>: .globl vector178 vector178: pushl $0 801072e1: 6a 00 push $0x0 pushl $178 801072e3: 68 b2 00 00 00 push $0xb2 jmp alltraps 801072e8: e9 e2 f2 ff ff jmp 801065cf <alltraps> 801072ed <vector179>: .globl vector179 vector179: pushl $0 801072ed: 6a 00 push $0x0 pushl $179 801072ef: 68 b3 00 00 00 push $0xb3 jmp alltraps 801072f4: e9 d6 f2 ff ff jmp 801065cf <alltraps> 801072f9 <vector180>: .globl vector180 vector180: pushl $0 801072f9: 6a 00 push $0x0 pushl $180 801072fb: 68 b4 00 00 00 push $0xb4 jmp alltraps 80107300: e9 ca f2 ff ff jmp 801065cf <alltraps> 80107305 <vector181>: .globl vector181 vector181: pushl $0 80107305: 6a 00 push $0x0 pushl $181 80107307: 68 b5 00 00 00 push $0xb5 jmp alltraps 8010730c: e9 be f2 ff ff jmp 801065cf <alltraps> 80107311 <vector182>: .globl vector182 vector182: pushl $0 80107311: 6a 00 push $0x0 pushl $182 80107313: 68 b6 00 00 00 push $0xb6 jmp alltraps 80107318: e9 b2 f2 ff ff jmp 801065cf <alltraps> 8010731d <vector183>: .globl vector183 vector183: pushl $0 8010731d: 6a 00 push $0x0 pushl $183 8010731f: 68 b7 00 00 00 push $0xb7 jmp alltraps 80107324: e9 a6 f2 ff ff jmp 801065cf <alltraps> 80107329 <vector184>: .globl vector184 vector184: pushl $0 80107329: 6a 00 push $0x0 pushl $184 8010732b: 68 b8 00 00 00 push $0xb8 jmp alltraps 80107330: e9 9a f2 ff ff jmp 801065cf <alltraps> 80107335 <vector185>: .globl vector185 vector185: pushl $0 80107335: 6a 00 push $0x0 pushl $185 80107337: 68 b9 00 00 00 push $0xb9 jmp alltraps 8010733c: e9 8e f2 ff ff jmp 801065cf <alltraps> 80107341 <vector186>: .globl vector186 vector186: pushl $0 80107341: 6a 00 push $0x0 pushl $186 80107343: 68 ba 00 00 00 push $0xba jmp alltraps 80107348: e9 82 f2 ff ff jmp 801065cf <alltraps> 8010734d <vector187>: .globl vector187 vector187: pushl $0 8010734d: 6a 00 push $0x0 pushl $187 8010734f: 68 bb 00 00 00 push $0xbb jmp alltraps 80107354: e9 76 f2 ff ff jmp 801065cf <alltraps> 80107359 <vector188>: .globl vector188 vector188: pushl $0 80107359: 6a 00 push $0x0 pushl $188 8010735b: 68 bc 00 00 00 push $0xbc jmp alltraps 80107360: e9 6a f2 ff ff jmp 801065cf <alltraps> 80107365 <vector189>: .globl vector189 vector189: pushl $0 80107365: 6a 00 push $0x0 pushl $189 80107367: 68 bd 00 00 00 push $0xbd jmp alltraps 8010736c: e9 5e f2 ff ff jmp 801065cf <alltraps> 80107371 <vector190>: .globl vector190 vector190: pushl $0 80107371: 6a 00 push $0x0 pushl $190 80107373: 68 be 00 00 00 push $0xbe jmp alltraps 80107378: e9 52 f2 ff ff jmp 801065cf <alltraps> 8010737d <vector191>: .globl vector191 vector191: pushl $0 8010737d: 6a 00 push $0x0 pushl $191 8010737f: 68 bf 00 00 00 push $0xbf jmp alltraps 80107384: e9 46 f2 ff ff jmp 801065cf <alltraps> 80107389 <vector192>: .globl vector192 vector192: pushl $0 80107389: 6a 00 push $0x0 pushl $192 8010738b: 68 c0 00 00 00 push $0xc0 jmp alltraps 80107390: e9 3a f2 ff ff jmp 801065cf <alltraps> 80107395 <vector193>: .globl vector193 vector193: pushl $0 80107395: 6a 00 push $0x0 pushl $193 80107397: 68 c1 00 00 00 push $0xc1 jmp alltraps 8010739c: e9 2e f2 ff ff jmp 801065cf <alltraps> 801073a1 <vector194>: .globl vector194 vector194: pushl $0 801073a1: 6a 00 push $0x0 pushl $194 801073a3: 68 c2 00 00 00 push $0xc2 jmp alltraps 801073a8: e9 22 f2 ff ff jmp 801065cf <alltraps> 801073ad <vector195>: .globl vector195 vector195: pushl $0 801073ad: 6a 00 push $0x0 pushl $195 801073af: 68 c3 00 00 00 push $0xc3 jmp alltraps 801073b4: e9 16 f2 ff ff jmp 801065cf <alltraps> 801073b9 <vector196>: .globl vector196 vector196: pushl $0 801073b9: 6a 00 push $0x0 pushl $196 801073bb: 68 c4 00 00 00 push $0xc4 jmp alltraps 801073c0: e9 0a f2 ff ff jmp 801065cf <alltraps> 801073c5 <vector197>: .globl vector197 vector197: pushl $0 801073c5: 6a 00 push $0x0 pushl $197 801073c7: 68 c5 00 00 00 push $0xc5 jmp alltraps 801073cc: e9 fe f1 ff ff jmp 801065cf <alltraps> 801073d1 <vector198>: .globl vector198 vector198: pushl $0 801073d1: 6a 00 push $0x0 pushl $198 801073d3: 68 c6 00 00 00 push $0xc6 jmp alltraps 801073d8: e9 f2 f1 ff ff jmp 801065cf <alltraps> 801073dd <vector199>: .globl vector199 vector199: pushl $0 801073dd: 6a 00 push $0x0 pushl $199 801073df: 68 c7 00 00 00 push $0xc7 jmp alltraps 801073e4: e9 e6 f1 ff ff jmp 801065cf <alltraps> 801073e9 <vector200>: .globl vector200 vector200: pushl $0 801073e9: 6a 00 push $0x0 pushl $200 801073eb: 68 c8 00 00 00 push $0xc8 jmp alltraps 801073f0: e9 da f1 ff ff jmp 801065cf <alltraps> 801073f5 <vector201>: .globl vector201 vector201: pushl $0 801073f5: 6a 00 push $0x0 pushl $201 801073f7: 68 c9 00 00 00 push $0xc9 jmp alltraps 801073fc: e9 ce f1 ff ff jmp 801065cf <alltraps> 80107401 <vector202>: .globl vector202 vector202: pushl $0 80107401: 6a 00 push $0x0 pushl $202 80107403: 68 ca 00 00 00 push $0xca jmp alltraps 80107408: e9 c2 f1 ff ff jmp 801065cf <alltraps> 8010740d <vector203>: .globl vector203 vector203: pushl $0 8010740d: 6a 00 push $0x0 pushl $203 8010740f: 68 cb 00 00 00 push $0xcb jmp alltraps 80107414: e9 b6 f1 ff ff jmp 801065cf <alltraps> 80107419 <vector204>: .globl vector204 vector204: pushl $0 80107419: 6a 00 push $0x0 pushl $204 8010741b: 68 cc 00 00 00 push $0xcc jmp alltraps 80107420: e9 aa f1 ff ff jmp 801065cf <alltraps> 80107425 <vector205>: .globl vector205 vector205: pushl $0 80107425: 6a 00 push $0x0 pushl $205 80107427: 68 cd 00 00 00 push $0xcd jmp alltraps 8010742c: e9 9e f1 ff ff jmp 801065cf <alltraps> 80107431 <vector206>: .globl vector206 vector206: pushl $0 80107431: 6a 00 push $0x0 pushl $206 80107433: 68 ce 00 00 00 push $0xce jmp alltraps 80107438: e9 92 f1 ff ff jmp 801065cf <alltraps> 8010743d <vector207>: .globl vector207 vector207: pushl $0 8010743d: 6a 00 push $0x0 pushl $207 8010743f: 68 cf 00 00 00 push $0xcf jmp alltraps 80107444: e9 86 f1 ff ff jmp 801065cf <alltraps> 80107449 <vector208>: .globl vector208 vector208: pushl $0 80107449: 6a 00 push $0x0 pushl $208 8010744b: 68 d0 00 00 00 push $0xd0 jmp alltraps 80107450: e9 7a f1 ff ff jmp 801065cf <alltraps> 80107455 <vector209>: .globl vector209 vector209: pushl $0 80107455: 6a 00 push $0x0 pushl $209 80107457: 68 d1 00 00 00 push $0xd1 jmp alltraps 8010745c: e9 6e f1 ff ff jmp 801065cf <alltraps> 80107461 <vector210>: .globl vector210 vector210: pushl $0 80107461: 6a 00 push $0x0 pushl $210 80107463: 68 d2 00 00 00 push $0xd2 jmp alltraps 80107468: e9 62 f1 ff ff jmp 801065cf <alltraps> 8010746d <vector211>: .globl vector211 vector211: pushl $0 8010746d: 6a 00 push $0x0 pushl $211 8010746f: 68 d3 00 00 00 push $0xd3 jmp alltraps 80107474: e9 56 f1 ff ff jmp 801065cf <alltraps> 80107479 <vector212>: .globl vector212 vector212: pushl $0 80107479: 6a 00 push $0x0 pushl $212 8010747b: 68 d4 00 00 00 push $0xd4 jmp alltraps 80107480: e9 4a f1 ff ff jmp 801065cf <alltraps> 80107485 <vector213>: .globl vector213 vector213: pushl $0 80107485: 6a 00 push $0x0 pushl $213 80107487: 68 d5 00 00 00 push $0xd5 jmp alltraps 8010748c: e9 3e f1 ff ff jmp 801065cf <alltraps> 80107491 <vector214>: .globl vector214 vector214: pushl $0 80107491: 6a 00 push $0x0 pushl $214 80107493: 68 d6 00 00 00 push $0xd6 jmp alltraps 80107498: e9 32 f1 ff ff jmp 801065cf <alltraps> 8010749d <vector215>: .globl vector215 vector215: pushl $0 8010749d: 6a 00 push $0x0 pushl $215 8010749f: 68 d7 00 00 00 push $0xd7 jmp alltraps 801074a4: e9 26 f1 ff ff jmp 801065cf <alltraps> 801074a9 <vector216>: .globl vector216 vector216: pushl $0 801074a9: 6a 00 push $0x0 pushl $216 801074ab: 68 d8 00 00 00 push $0xd8 jmp alltraps 801074b0: e9 1a f1 ff ff jmp 801065cf <alltraps> 801074b5 <vector217>: .globl vector217 vector217: pushl $0 801074b5: 6a 00 push $0x0 pushl $217 801074b7: 68 d9 00 00 00 push $0xd9 jmp alltraps 801074bc: e9 0e f1 ff ff jmp 801065cf <alltraps> 801074c1 <vector218>: .globl vector218 vector218: pushl $0 801074c1: 6a 00 push $0x0 pushl $218 801074c3: 68 da 00 00 00 push $0xda jmp alltraps 801074c8: e9 02 f1 ff ff jmp 801065cf <alltraps> 801074cd <vector219>: .globl vector219 vector219: pushl $0 801074cd: 6a 00 push $0x0 pushl $219 801074cf: 68 db 00 00 00 push $0xdb jmp alltraps 801074d4: e9 f6 f0 ff ff jmp 801065cf <alltraps> 801074d9 <vector220>: .globl vector220 vector220: pushl $0 801074d9: 6a 00 push $0x0 pushl $220 801074db: 68 dc 00 00 00 push $0xdc jmp alltraps 801074e0: e9 ea f0 ff ff jmp 801065cf <alltraps> 801074e5 <vector221>: .globl vector221 vector221: pushl $0 801074e5: 6a 00 push $0x0 pushl $221 801074e7: 68 dd 00 00 00 push $0xdd jmp alltraps 801074ec: e9 de f0 ff ff jmp 801065cf <alltraps> 801074f1 <vector222>: .globl vector222 vector222: pushl $0 801074f1: 6a 00 push $0x0 pushl $222 801074f3: 68 de 00 00 00 push $0xde jmp alltraps 801074f8: e9 d2 f0 ff ff jmp 801065cf <alltraps> 801074fd <vector223>: .globl vector223 vector223: pushl $0 801074fd: 6a 00 push $0x0 pushl $223 801074ff: 68 df 00 00 00 push $0xdf jmp alltraps 80107504: e9 c6 f0 ff ff jmp 801065cf <alltraps> 80107509 <vector224>: .globl vector224 vector224: pushl $0 80107509: 6a 00 push $0x0 pushl $224 8010750b: 68 e0 00 00 00 push $0xe0 jmp alltraps 80107510: e9 ba f0 ff ff jmp 801065cf <alltraps> 80107515 <vector225>: .globl vector225 vector225: pushl $0 80107515: 6a 00 push $0x0 pushl $225 80107517: 68 e1 00 00 00 push $0xe1 jmp alltraps 8010751c: e9 ae f0 ff ff jmp 801065cf <alltraps> 80107521 <vector226>: .globl vector226 vector226: pushl $0 80107521: 6a 00 push $0x0 pushl $226 80107523: 68 e2 00 00 00 push $0xe2 jmp alltraps 80107528: e9 a2 f0 ff ff jmp 801065cf <alltraps> 8010752d <vector227>: .globl vector227 vector227: pushl $0 8010752d: 6a 00 push $0x0 pushl $227 8010752f: 68 e3 00 00 00 push $0xe3 jmp alltraps 80107534: e9 96 f0 ff ff jmp 801065cf <alltraps> 80107539 <vector228>: .globl vector228 vector228: pushl $0 80107539: 6a 00 push $0x0 pushl $228 8010753b: 68 e4 00 00 00 push $0xe4 jmp alltraps 80107540: e9 8a f0 ff ff jmp 801065cf <alltraps> 80107545 <vector229>: .globl vector229 vector229: pushl $0 80107545: 6a 00 push $0x0 pushl $229 80107547: 68 e5 00 00 00 push $0xe5 jmp alltraps 8010754c: e9 7e f0 ff ff jmp 801065cf <alltraps> 80107551 <vector230>: .globl vector230 vector230: pushl $0 80107551: 6a 00 push $0x0 pushl $230 80107553: 68 e6 00 00 00 push $0xe6 jmp alltraps 80107558: e9 72 f0 ff ff jmp 801065cf <alltraps> 8010755d <vector231>: .globl vector231 vector231: pushl $0 8010755d: 6a 00 push $0x0 pushl $231 8010755f: 68 e7 00 00 00 push $0xe7 jmp alltraps 80107564: e9 66 f0 ff ff jmp 801065cf <alltraps> 80107569 <vector232>: .globl vector232 vector232: pushl $0 80107569: 6a 00 push $0x0 pushl $232 8010756b: 68 e8 00 00 00 push $0xe8 jmp alltraps 80107570: e9 5a f0 ff ff jmp 801065cf <alltraps> 80107575 <vector233>: .globl vector233 vector233: pushl $0 80107575: 6a 00 push $0x0 pushl $233 80107577: 68 e9 00 00 00 push $0xe9 jmp alltraps 8010757c: e9 4e f0 ff ff jmp 801065cf <alltraps> 80107581 <vector234>: .globl vector234 vector234: pushl $0 80107581: 6a 00 push $0x0 pushl $234 80107583: 68 ea 00 00 00 push $0xea jmp alltraps 80107588: e9 42 f0 ff ff jmp 801065cf <alltraps> 8010758d <vector235>: .globl vector235 vector235: pushl $0 8010758d: 6a 00 push $0x0 pushl $235 8010758f: 68 eb 00 00 00 push $0xeb jmp alltraps 80107594: e9 36 f0 ff ff jmp 801065cf <alltraps> 80107599 <vector236>: .globl vector236 vector236: pushl $0 80107599: 6a 00 push $0x0 pushl $236 8010759b: 68 ec 00 00 00 push $0xec jmp alltraps 801075a0: e9 2a f0 ff ff jmp 801065cf <alltraps> 801075a5 <vector237>: .globl vector237 vector237: pushl $0 801075a5: 6a 00 push $0x0 pushl $237 801075a7: 68 ed 00 00 00 push $0xed jmp alltraps 801075ac: e9 1e f0 ff ff jmp 801065cf <alltraps> 801075b1 <vector238>: .globl vector238 vector238: pushl $0 801075b1: 6a 00 push $0x0 pushl $238 801075b3: 68 ee 00 00 00 push $0xee jmp alltraps 801075b8: e9 12 f0 ff ff jmp 801065cf <alltraps> 801075bd <vector239>: .globl vector239 vector239: pushl $0 801075bd: 6a 00 push $0x0 pushl $239 801075bf: 68 ef 00 00 00 push $0xef jmp alltraps 801075c4: e9 06 f0 ff ff jmp 801065cf <alltraps> 801075c9 <vector240>: .globl vector240 vector240: pushl $0 801075c9: 6a 00 push $0x0 pushl $240 801075cb: 68 f0 00 00 00 push $0xf0 jmp alltraps 801075d0: e9 fa ef ff ff jmp 801065cf <alltraps> 801075d5 <vector241>: .globl vector241 vector241: pushl $0 801075d5: 6a 00 push $0x0 pushl $241 801075d7: 68 f1 00 00 00 push $0xf1 jmp alltraps 801075dc: e9 ee ef ff ff jmp 801065cf <alltraps> 801075e1 <vector242>: .globl vector242 vector242: pushl $0 801075e1: 6a 00 push $0x0 pushl $242 801075e3: 68 f2 00 00 00 push $0xf2 jmp alltraps 801075e8: e9 e2 ef ff ff jmp 801065cf <alltraps> 801075ed <vector243>: .globl vector243 vector243: pushl $0 801075ed: 6a 00 push $0x0 pushl $243 801075ef: 68 f3 00 00 00 push $0xf3 jmp alltraps 801075f4: e9 d6 ef ff ff jmp 801065cf <alltraps> 801075f9 <vector244>: .globl vector244 vector244: pushl $0 801075f9: 6a 00 push $0x0 pushl $244 801075fb: 68 f4 00 00 00 push $0xf4 jmp alltraps 80107600: e9 ca ef ff ff jmp 801065cf <alltraps> 80107605 <vector245>: .globl vector245 vector245: pushl $0 80107605: 6a 00 push $0x0 pushl $245 80107607: 68 f5 00 00 00 push $0xf5 jmp alltraps 8010760c: e9 be ef ff ff jmp 801065cf <alltraps> 80107611 <vector246>: .globl vector246 vector246: pushl $0 80107611: 6a 00 push $0x0 pushl $246 80107613: 68 f6 00 00 00 push $0xf6 jmp alltraps 80107618: e9 b2 ef ff ff jmp 801065cf <alltraps> 8010761d <vector247>: .globl vector247 vector247: pushl $0 8010761d: 6a 00 push $0x0 pushl $247 8010761f: 68 f7 00 00 00 push $0xf7 jmp alltraps 80107624: e9 a6 ef ff ff jmp 801065cf <alltraps> 80107629 <vector248>: .globl vector248 vector248: pushl $0 80107629: 6a 00 push $0x0 pushl $248 8010762b: 68 f8 00 00 00 push $0xf8 jmp alltraps 80107630: e9 9a ef ff ff jmp 801065cf <alltraps> 80107635 <vector249>: .globl vector249 vector249: pushl $0 80107635: 6a 00 push $0x0 pushl $249 80107637: 68 f9 00 00 00 push $0xf9 jmp alltraps 8010763c: e9 8e ef ff ff jmp 801065cf <alltraps> 80107641 <vector250>: .globl vector250 vector250: pushl $0 80107641: 6a 00 push $0x0 pushl $250 80107643: 68 fa 00 00 00 push $0xfa jmp alltraps 80107648: e9 82 ef ff ff jmp 801065cf <alltraps> 8010764d <vector251>: .globl vector251 vector251: pushl $0 8010764d: 6a 00 push $0x0 pushl $251 8010764f: 68 fb 00 00 00 push $0xfb jmp alltraps 80107654: e9 76 ef ff ff jmp 801065cf <alltraps> 80107659 <vector252>: .globl vector252 vector252: pushl $0 80107659: 6a 00 push $0x0 pushl $252 8010765b: 68 fc 00 00 00 push $0xfc jmp alltraps 80107660: e9 6a ef ff ff jmp 801065cf <alltraps> 80107665 <vector253>: .globl vector253 vector253: pushl $0 80107665: 6a 00 push $0x0 pushl $253 80107667: 68 fd 00 00 00 push $0xfd jmp alltraps 8010766c: e9 5e ef ff ff jmp 801065cf <alltraps> 80107671 <vector254>: .globl vector254 vector254: pushl $0 80107671: 6a 00 push $0x0 pushl $254 80107673: 68 fe 00 00 00 push $0xfe jmp alltraps 80107678: e9 52 ef ff ff jmp 801065cf <alltraps> 8010767d <vector255>: .globl vector255 vector255: pushl $0 8010767d: 6a 00 push $0x0 pushl $255 8010767f: 68 ff 00 00 00 push $0xff jmp alltraps 80107684: e9 46 ef ff ff jmp 801065cf <alltraps> 80107689 <lgdt>: struct segdesc; static inline void lgdt(struct segdesc *p, int size) { 80107689: 55 push %ebp 8010768a: 89 e5 mov %esp,%ebp 8010768c: 83 ec 10 sub $0x10,%esp volatile ushort pd[3]; pd[0] = size-1; 8010768f: 8b 45 0c mov 0xc(%ebp),%eax 80107692: 83 e8 01 sub $0x1,%eax 80107695: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 80107699: 8b 45 08 mov 0x8(%ebp),%eax 8010769c: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 801076a0: 8b 45 08 mov 0x8(%ebp),%eax 801076a3: c1 e8 10 shr $0x10,%eax 801076a6: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); 801076aa: 8d 45 fa lea -0x6(%ebp),%eax 801076ad: 0f 01 10 lgdtl (%eax) } 801076b0: c9 leave 801076b1: c3 ret 801076b2 <ltr>: asm volatile("lidt (%0)" : : "r" (pd)); } static inline void ltr(ushort sel) { 801076b2: 55 push %ebp 801076b3: 89 e5 mov %esp,%ebp 801076b5: 83 ec 04 sub $0x4,%esp 801076b8: 8b 45 08 mov 0x8(%ebp),%eax 801076bb: 66 89 45 fc mov %ax,-0x4(%ebp) asm volatile("ltr %0" : : "r" (sel)); 801076bf: 0f b7 45 fc movzwl -0x4(%ebp),%eax 801076c3: 0f 00 d8 ltr %ax } 801076c6: c9 leave 801076c7: c3 ret 801076c8 <loadgs>: return eflags; } static inline void loadgs(ushort v) { 801076c8: 55 push %ebp 801076c9: 89 e5 mov %esp,%ebp 801076cb: 83 ec 04 sub $0x4,%esp 801076ce: 8b 45 08 mov 0x8(%ebp),%eax 801076d1: 66 89 45 fc mov %ax,-0x4(%ebp) asm volatile("movw %0, %%gs" : : "r" (v)); 801076d5: 0f b7 45 fc movzwl -0x4(%ebp),%eax 801076d9: 8e e8 mov %eax,%gs } 801076db: c9 leave 801076dc: c3 ret 801076dd <lcr3>: return val; } static inline void lcr3(uint val) { 801076dd: 55 push %ebp 801076de: 89 e5 mov %esp,%ebp asm volatile("movl %0,%%cr3" : : "r" (val)); 801076e0: 8b 45 08 mov 0x8(%ebp),%eax 801076e3: 0f 22 d8 mov %eax,%cr3 } 801076e6: 5d pop %ebp 801076e7: c3 ret 801076e8 <v2p>: #define KERNBASE 0x80000000 // First kernel virtual address #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked #ifndef __ASSEMBLER__ static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; } 801076e8: 55 push %ebp 801076e9: 89 e5 mov %esp,%ebp 801076eb: 8b 45 08 mov 0x8(%ebp),%eax 801076ee: 05 00 00 00 80 add $0x80000000,%eax 801076f3: 5d pop %ebp 801076f4: c3 ret 801076f5 <p2v>: static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } 801076f5: 55 push %ebp 801076f6: 89 e5 mov %esp,%ebp 801076f8: 8b 45 08 mov 0x8(%ebp),%eax 801076fb: 05 00 00 00 80 add $0x80000000,%eax 80107700: 5d pop %ebp 80107701: c3 ret 80107702 <seginit>: // Set up CPU's kernel segment descriptors. // Run once on entry on each CPU. void seginit(void) { 80107702: 55 push %ebp 80107703: 89 e5 mov %esp,%ebp 80107705: 53 push %ebx 80107706: 83 ec 14 sub $0x14,%esp // Map "logical" addresses to virtual addresses using identity map. // Cannot share a CODE descriptor for both kernel and user // because it would have to have DPL_USR, but the CPU forbids // an interrupt from CPL=0 to DPL=3. c = &cpus[cpunum()]; 80107709: e8 d8 b7 ff ff call 80102ee6 <cpunum> 8010770e: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80107714: 05 40 24 11 80 add $0x80112440,%eax 80107719: 89 45 f4 mov %eax,-0xc(%ebp) c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 8010771c: 8b 45 f4 mov -0xc(%ebp),%eax 8010771f: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax) 80107725: 8b 45 f4 mov -0xc(%ebp),%eax 80107728: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax) 8010772e: 8b 45 f4 mov -0xc(%ebp),%eax 80107731: c6 40 7c 00 movb $0x0,0x7c(%eax) 80107735: 8b 45 f4 mov -0xc(%ebp),%eax 80107738: 0f b6 50 7d movzbl 0x7d(%eax),%edx 8010773c: 83 e2 f0 and $0xfffffff0,%edx 8010773f: 83 ca 0a or $0xa,%edx 80107742: 88 50 7d mov %dl,0x7d(%eax) 80107745: 8b 45 f4 mov -0xc(%ebp),%eax 80107748: 0f b6 50 7d movzbl 0x7d(%eax),%edx 8010774c: 83 ca 10 or $0x10,%edx 8010774f: 88 50 7d mov %dl,0x7d(%eax) 80107752: 8b 45 f4 mov -0xc(%ebp),%eax 80107755: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80107759: 83 e2 9f and $0xffffff9f,%edx 8010775c: 88 50 7d mov %dl,0x7d(%eax) 8010775f: 8b 45 f4 mov -0xc(%ebp),%eax 80107762: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80107766: 83 ca 80 or $0xffffff80,%edx 80107769: 88 50 7d mov %dl,0x7d(%eax) 8010776c: 8b 45 f4 mov -0xc(%ebp),%eax 8010776f: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107773: 83 ca 0f or $0xf,%edx 80107776: 88 50 7e mov %dl,0x7e(%eax) 80107779: 8b 45 f4 mov -0xc(%ebp),%eax 8010777c: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107780: 83 e2 ef and $0xffffffef,%edx 80107783: 88 50 7e mov %dl,0x7e(%eax) 80107786: 8b 45 f4 mov -0xc(%ebp),%eax 80107789: 0f b6 50 7e movzbl 0x7e(%eax),%edx 8010778d: 83 e2 df and $0xffffffdf,%edx 80107790: 88 50 7e mov %dl,0x7e(%eax) 80107793: 8b 45 f4 mov -0xc(%ebp),%eax 80107796: 0f b6 50 7e movzbl 0x7e(%eax),%edx 8010779a: 83 ca 40 or $0x40,%edx 8010779d: 88 50 7e mov %dl,0x7e(%eax) 801077a0: 8b 45 f4 mov -0xc(%ebp),%eax 801077a3: 0f b6 50 7e movzbl 0x7e(%eax),%edx 801077a7: 83 ca 80 or $0xffffff80,%edx 801077aa: 88 50 7e mov %dl,0x7e(%eax) 801077ad: 8b 45 f4 mov -0xc(%ebp),%eax 801077b0: c6 40 7f 00 movb $0x0,0x7f(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 801077b4: 8b 45 f4 mov -0xc(%ebp),%eax 801077b7: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax) 801077be: ff ff 801077c0: 8b 45 f4 mov -0xc(%ebp),%eax 801077c3: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax) 801077ca: 00 00 801077cc: 8b 45 f4 mov -0xc(%ebp),%eax 801077cf: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax) 801077d6: 8b 45 f4 mov -0xc(%ebp),%eax 801077d9: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 801077e0: 83 e2 f0 and $0xfffffff0,%edx 801077e3: 83 ca 02 or $0x2,%edx 801077e6: 88 90 85 00 00 00 mov %dl,0x85(%eax) 801077ec: 8b 45 f4 mov -0xc(%ebp),%eax 801077ef: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 801077f6: 83 ca 10 or $0x10,%edx 801077f9: 88 90 85 00 00 00 mov %dl,0x85(%eax) 801077ff: 8b 45 f4 mov -0xc(%ebp),%eax 80107802: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 80107809: 83 e2 9f and $0xffffff9f,%edx 8010780c: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80107812: 8b 45 f4 mov -0xc(%ebp),%eax 80107815: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 8010781c: 83 ca 80 or $0xffffff80,%edx 8010781f: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80107825: 8b 45 f4 mov -0xc(%ebp),%eax 80107828: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 8010782f: 83 ca 0f or $0xf,%edx 80107832: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107838: 8b 45 f4 mov -0xc(%ebp),%eax 8010783b: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107842: 83 e2 ef and $0xffffffef,%edx 80107845: 88 90 86 00 00 00 mov %dl,0x86(%eax) 8010784b: 8b 45 f4 mov -0xc(%ebp),%eax 8010784e: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107855: 83 e2 df and $0xffffffdf,%edx 80107858: 88 90 86 00 00 00 mov %dl,0x86(%eax) 8010785e: 8b 45 f4 mov -0xc(%ebp),%eax 80107861: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107868: 83 ca 40 or $0x40,%edx 8010786b: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107871: 8b 45 f4 mov -0xc(%ebp),%eax 80107874: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 8010787b: 83 ca 80 or $0xffffff80,%edx 8010787e: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107884: 8b 45 f4 mov -0xc(%ebp),%eax 80107887: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 8010788e: 8b 45 f4 mov -0xc(%ebp),%eax 80107891: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax) 80107898: ff ff 8010789a: 8b 45 f4 mov -0xc(%ebp),%eax 8010789d: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax) 801078a4: 00 00 801078a6: 8b 45 f4 mov -0xc(%ebp),%eax 801078a9: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax) 801078b0: 8b 45 f4 mov -0xc(%ebp),%eax 801078b3: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 801078ba: 83 e2 f0 and $0xfffffff0,%edx 801078bd: 83 ca 0a or $0xa,%edx 801078c0: 88 90 95 00 00 00 mov %dl,0x95(%eax) 801078c6: 8b 45 f4 mov -0xc(%ebp),%eax 801078c9: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 801078d0: 83 ca 10 or $0x10,%edx 801078d3: 88 90 95 00 00 00 mov %dl,0x95(%eax) 801078d9: 8b 45 f4 mov -0xc(%ebp),%eax 801078dc: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 801078e3: 83 ca 60 or $0x60,%edx 801078e6: 88 90 95 00 00 00 mov %dl,0x95(%eax) 801078ec: 8b 45 f4 mov -0xc(%ebp),%eax 801078ef: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 801078f6: 83 ca 80 or $0xffffff80,%edx 801078f9: 88 90 95 00 00 00 mov %dl,0x95(%eax) 801078ff: 8b 45 f4 mov -0xc(%ebp),%eax 80107902: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 80107909: 83 ca 0f or $0xf,%edx 8010790c: 88 90 96 00 00 00 mov %dl,0x96(%eax) 80107912: 8b 45 f4 mov -0xc(%ebp),%eax 80107915: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 8010791c: 83 e2 ef and $0xffffffef,%edx 8010791f: 88 90 96 00 00 00 mov %dl,0x96(%eax) 80107925: 8b 45 f4 mov -0xc(%ebp),%eax 80107928: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 8010792f: 83 e2 df and $0xffffffdf,%edx 80107932: 88 90 96 00 00 00 mov %dl,0x96(%eax) 80107938: 8b 45 f4 mov -0xc(%ebp),%eax 8010793b: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 80107942: 83 ca 40 or $0x40,%edx 80107945: 88 90 96 00 00 00 mov %dl,0x96(%eax) 8010794b: 8b 45 f4 mov -0xc(%ebp),%eax 8010794e: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 80107955: 83 ca 80 or $0xffffff80,%edx 80107958: 88 90 96 00 00 00 mov %dl,0x96(%eax) 8010795e: 8b 45 f4 mov -0xc(%ebp),%eax 80107961: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 80107968: 8b 45 f4 mov -0xc(%ebp),%eax 8010796b: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax) 80107972: ff ff 80107974: 8b 45 f4 mov -0xc(%ebp),%eax 80107977: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax) 8010797e: 00 00 80107980: 8b 45 f4 mov -0xc(%ebp),%eax 80107983: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax) 8010798a: 8b 45 f4 mov -0xc(%ebp),%eax 8010798d: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 80107994: 83 e2 f0 and $0xfffffff0,%edx 80107997: 83 ca 02 or $0x2,%edx 8010799a: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 801079a0: 8b 45 f4 mov -0xc(%ebp),%eax 801079a3: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 801079aa: 83 ca 10 or $0x10,%edx 801079ad: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 801079b3: 8b 45 f4 mov -0xc(%ebp),%eax 801079b6: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 801079bd: 83 ca 60 or $0x60,%edx 801079c0: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 801079c6: 8b 45 f4 mov -0xc(%ebp),%eax 801079c9: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 801079d0: 83 ca 80 or $0xffffff80,%edx 801079d3: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 801079d9: 8b 45 f4 mov -0xc(%ebp),%eax 801079dc: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 801079e3: 83 ca 0f or $0xf,%edx 801079e6: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801079ec: 8b 45 f4 mov -0xc(%ebp),%eax 801079ef: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 801079f6: 83 e2 ef and $0xffffffef,%edx 801079f9: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801079ff: 8b 45 f4 mov -0xc(%ebp),%eax 80107a02: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80107a09: 83 e2 df and $0xffffffdf,%edx 80107a0c: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 80107a12: 8b 45 f4 mov -0xc(%ebp),%eax 80107a15: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80107a1c: 83 ca 40 or $0x40,%edx 80107a1f: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 80107a25: 8b 45 f4 mov -0xc(%ebp),%eax 80107a28: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80107a2f: 83 ca 80 or $0xffffff80,%edx 80107a32: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 80107a38: 8b 45 f4 mov -0xc(%ebp),%eax 80107a3b: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax) // Map cpu, and curproc c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0); 80107a42: 8b 45 f4 mov -0xc(%ebp),%eax 80107a45: 05 b4 00 00 00 add $0xb4,%eax 80107a4a: 89 c3 mov %eax,%ebx 80107a4c: 8b 45 f4 mov -0xc(%ebp),%eax 80107a4f: 05 b4 00 00 00 add $0xb4,%eax 80107a54: c1 e8 10 shr $0x10,%eax 80107a57: 89 c2 mov %eax,%edx 80107a59: 8b 45 f4 mov -0xc(%ebp),%eax 80107a5c: 05 b4 00 00 00 add $0xb4,%eax 80107a61: c1 e8 18 shr $0x18,%eax 80107a64: 89 c1 mov %eax,%ecx 80107a66: 8b 45 f4 mov -0xc(%ebp),%eax 80107a69: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax) 80107a70: 00 00 80107a72: 8b 45 f4 mov -0xc(%ebp),%eax 80107a75: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax) 80107a7c: 8b 45 f4 mov -0xc(%ebp),%eax 80107a7f: 88 90 8c 00 00 00 mov %dl,0x8c(%eax) 80107a85: 8b 45 f4 mov -0xc(%ebp),%eax 80107a88: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 80107a8f: 83 e2 f0 and $0xfffffff0,%edx 80107a92: 83 ca 02 or $0x2,%edx 80107a95: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 80107a9b: 8b 45 f4 mov -0xc(%ebp),%eax 80107a9e: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 80107aa5: 83 ca 10 or $0x10,%edx 80107aa8: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 80107aae: 8b 45 f4 mov -0xc(%ebp),%eax 80107ab1: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 80107ab8: 83 e2 9f and $0xffffff9f,%edx 80107abb: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 80107ac1: 8b 45 f4 mov -0xc(%ebp),%eax 80107ac4: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 80107acb: 83 ca 80 or $0xffffff80,%edx 80107ace: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 80107ad4: 8b 45 f4 mov -0xc(%ebp),%eax 80107ad7: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80107ade: 83 e2 f0 and $0xfffffff0,%edx 80107ae1: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80107ae7: 8b 45 f4 mov -0xc(%ebp),%eax 80107aea: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80107af1: 83 e2 ef and $0xffffffef,%edx 80107af4: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80107afa: 8b 45 f4 mov -0xc(%ebp),%eax 80107afd: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80107b04: 83 e2 df and $0xffffffdf,%edx 80107b07: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80107b0d: 8b 45 f4 mov -0xc(%ebp),%eax 80107b10: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80107b17: 83 ca 40 or $0x40,%edx 80107b1a: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80107b20: 8b 45 f4 mov -0xc(%ebp),%eax 80107b23: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80107b2a: 83 ca 80 or $0xffffff80,%edx 80107b2d: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80107b33: 8b 45 f4 mov -0xc(%ebp),%eax 80107b36: 88 88 8f 00 00 00 mov %cl,0x8f(%eax) lgdt(c->gdt, sizeof(c->gdt)); 80107b3c: 8b 45 f4 mov -0xc(%ebp),%eax 80107b3f: 83 c0 70 add $0x70,%eax 80107b42: 83 ec 08 sub $0x8,%esp 80107b45: 6a 38 push $0x38 80107b47: 50 push %eax 80107b48: e8 3c fb ff ff call 80107689 <lgdt> 80107b4d: 83 c4 10 add $0x10,%esp loadgs(SEG_KCPU << 3); 80107b50: 83 ec 0c sub $0xc,%esp 80107b53: 6a 18 push $0x18 80107b55: e8 6e fb ff ff call 801076c8 <loadgs> 80107b5a: 83 c4 10 add $0x10,%esp // Initialize cpu-local storage. cpu = c; 80107b5d: 8b 45 f4 mov -0xc(%ebp),%eax 80107b60: 65 a3 00 00 00 00 mov %eax,%gs:0x0 proc = 0; 80107b66: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 80107b6d: 00 00 00 00 } 80107b71: 8b 5d fc mov -0x4(%ebp),%ebx 80107b74: c9 leave 80107b75: c3 ret 80107b76 <walkpgdir>: // Return the address of the PTE in page table pgdir // that corresponds to virtual address va. If alloc!=0, // create any required page table pages. static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc) { 80107b76: 55 push %ebp 80107b77: 89 e5 mov %esp,%ebp 80107b79: 83 ec 18 sub $0x18,%esp pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 80107b7c: 8b 45 0c mov 0xc(%ebp),%eax 80107b7f: c1 e8 16 shr $0x16,%eax 80107b82: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80107b89: 8b 45 08 mov 0x8(%ebp),%eax 80107b8c: 01 d0 add %edx,%eax 80107b8e: 89 45 f0 mov %eax,-0x10(%ebp) if(*pde & PTE_P){ 80107b91: 8b 45 f0 mov -0x10(%ebp),%eax 80107b94: 8b 00 mov (%eax),%eax 80107b96: 83 e0 01 and $0x1,%eax 80107b99: 85 c0 test %eax,%eax 80107b9b: 74 18 je 80107bb5 <walkpgdir+0x3f> pgtab = (pte_t*)p2v(PTE_ADDR(*pde)); 80107b9d: 8b 45 f0 mov -0x10(%ebp),%eax 80107ba0: 8b 00 mov (%eax),%eax 80107ba2: 25 00 f0 ff ff and $0xfffff000,%eax 80107ba7: 50 push %eax 80107ba8: e8 48 fb ff ff call 801076f5 <p2v> 80107bad: 83 c4 04 add $0x4,%esp 80107bb0: 89 45 f4 mov %eax,-0xc(%ebp) 80107bb3: eb 48 jmp 80107bfd <walkpgdir+0x87> } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 80107bb5: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80107bb9: 74 0e je 80107bc9 <walkpgdir+0x53> 80107bbb: e8 c5 af ff ff call 80102b85 <kalloc> 80107bc0: 89 45 f4 mov %eax,-0xc(%ebp) 80107bc3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80107bc7: 75 07 jne 80107bd0 <walkpgdir+0x5a> return 0; 80107bc9: b8 00 00 00 00 mov $0x0,%eax 80107bce: eb 44 jmp 80107c14 <walkpgdir+0x9e> // Make sure all those PTE_P bits are zero. memset(pgtab, 0, PGSIZE); 80107bd0: 83 ec 04 sub $0x4,%esp 80107bd3: 68 00 10 00 00 push $0x1000 80107bd8: 6a 00 push $0x0 80107bda: ff 75 f4 pushl -0xc(%ebp) 80107bdd: e8 68 d5 ff ff call 8010514a <memset> 80107be2: 83 c4 10 add $0x10,%esp // 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; 80107be5: 83 ec 0c sub $0xc,%esp 80107be8: ff 75 f4 pushl -0xc(%ebp) 80107beb: e8 f8 fa ff ff call 801076e8 <v2p> 80107bf0: 83 c4 10 add $0x10,%esp 80107bf3: 83 c8 07 or $0x7,%eax 80107bf6: 89 c2 mov %eax,%edx 80107bf8: 8b 45 f0 mov -0x10(%ebp),%eax 80107bfb: 89 10 mov %edx,(%eax) } return &pgtab[PTX(va)]; 80107bfd: 8b 45 0c mov 0xc(%ebp),%eax 80107c00: c1 e8 0c shr $0xc,%eax 80107c03: 25 ff 03 00 00 and $0x3ff,%eax 80107c08: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80107c0f: 8b 45 f4 mov -0xc(%ebp),%eax 80107c12: 01 d0 add %edx,%eax } 80107c14: c9 leave 80107c15: c3 ret 80107c16 <mappages>: // Create PTEs for virtual addresses starting at va that refer to // physical addresses starting at pa. va and size might not // be page-aligned. static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 80107c16: 55 push %ebp 80107c17: 89 e5 mov %esp,%ebp 80107c19: 83 ec 18 sub $0x18,%esp char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); 80107c1c: 8b 45 0c mov 0xc(%ebp),%eax 80107c1f: 25 00 f0 ff ff and $0xfffff000,%eax 80107c24: 89 45 f4 mov %eax,-0xc(%ebp) last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80107c27: 8b 55 0c mov 0xc(%ebp),%edx 80107c2a: 8b 45 10 mov 0x10(%ebp),%eax 80107c2d: 01 d0 add %edx,%eax 80107c2f: 83 e8 01 sub $0x1,%eax 80107c32: 25 00 f0 ff ff and $0xfffff000,%eax 80107c37: 89 45 f0 mov %eax,-0x10(%ebp) for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) 80107c3a: 83 ec 04 sub $0x4,%esp 80107c3d: 6a 01 push $0x1 80107c3f: ff 75 f4 pushl -0xc(%ebp) 80107c42: ff 75 08 pushl 0x8(%ebp) 80107c45: e8 2c ff ff ff call 80107b76 <walkpgdir> 80107c4a: 83 c4 10 add $0x10,%esp 80107c4d: 89 45 ec mov %eax,-0x14(%ebp) 80107c50: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80107c54: 75 07 jne 80107c5d <mappages+0x47> return -1; 80107c56: b8 ff ff ff ff mov $0xffffffff,%eax 80107c5b: eb 49 jmp 80107ca6 <mappages+0x90> if(*pte & PTE_P) 80107c5d: 8b 45 ec mov -0x14(%ebp),%eax 80107c60: 8b 00 mov (%eax),%eax 80107c62: 83 e0 01 and $0x1,%eax 80107c65: 85 c0 test %eax,%eax 80107c67: 74 0d je 80107c76 <mappages+0x60> panic("remap"); 80107c69: 83 ec 0c sub $0xc,%esp 80107c6c: 68 88 8a 10 80 push $0x80108a88 80107c71: e8 e6 88 ff ff call 8010055c <panic> *pte = pa | perm | PTE_P; 80107c76: 8b 45 18 mov 0x18(%ebp),%eax 80107c79: 0b 45 14 or 0x14(%ebp),%eax 80107c7c: 83 c8 01 or $0x1,%eax 80107c7f: 89 c2 mov %eax,%edx 80107c81: 8b 45 ec mov -0x14(%ebp),%eax 80107c84: 89 10 mov %edx,(%eax) if(a == last) 80107c86: 8b 45 f4 mov -0xc(%ebp),%eax 80107c89: 3b 45 f0 cmp -0x10(%ebp),%eax 80107c8c: 75 08 jne 80107c96 <mappages+0x80> break; 80107c8e: 90 nop a += PGSIZE; pa += PGSIZE; } return 0; 80107c8f: b8 00 00 00 00 mov $0x0,%eax 80107c94: eb 10 jmp 80107ca6 <mappages+0x90> if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; if(a == last) break; a += PGSIZE; 80107c96: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) pa += PGSIZE; 80107c9d: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp) } 80107ca4: eb 94 jmp 80107c3a <mappages+0x24> return 0; } 80107ca6: c9 leave 80107ca7: c3 ret 80107ca8 <setupkvm>: }; // Set up kernel part of a page table. pde_t* setupkvm(void) { 80107ca8: 55 push %ebp 80107ca9: 89 e5 mov %esp,%ebp 80107cab: 53 push %ebx 80107cac: 83 ec 14 sub $0x14,%esp pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) 80107caf: e8 d1 ae ff ff call 80102b85 <kalloc> 80107cb4: 89 45 f0 mov %eax,-0x10(%ebp) 80107cb7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80107cbb: 75 0a jne 80107cc7 <setupkvm+0x1f> return 0; 80107cbd: b8 00 00 00 00 mov $0x0,%eax 80107cc2: e9 8e 00 00 00 jmp 80107d55 <setupkvm+0xad> memset(pgdir, 0, PGSIZE); 80107cc7: 83 ec 04 sub $0x4,%esp 80107cca: 68 00 10 00 00 push $0x1000 80107ccf: 6a 00 push $0x0 80107cd1: ff 75 f0 pushl -0x10(%ebp) 80107cd4: e8 71 d4 ff ff call 8010514a <memset> 80107cd9: 83 c4 10 add $0x10,%esp if (p2v(PHYSTOP) > (void*)DEVSPACE) 80107cdc: 83 ec 0c sub $0xc,%esp 80107cdf: 68 00 00 00 0e push $0xe000000 80107ce4: e8 0c fa ff ff call 801076f5 <p2v> 80107ce9: 83 c4 10 add $0x10,%esp 80107cec: 3d 00 00 00 fe cmp $0xfe000000,%eax 80107cf1: 76 0d jbe 80107d00 <setupkvm+0x58> panic("PHYSTOP too high"); 80107cf3: 83 ec 0c sub $0xc,%esp 80107cf6: 68 8e 8a 10 80 push $0x80108a8e 80107cfb: e8 5c 88 ff ff call 8010055c <panic> for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80107d00: c7 45 f4 c0 b4 10 80 movl $0x8010b4c0,-0xc(%ebp) 80107d07: eb 40 jmp 80107d49 <setupkvm+0xa1> if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 80107d09: 8b 45 f4 mov -0xc(%ebp),%eax 80107d0c: 8b 48 0c mov 0xc(%eax),%ecx 80107d0f: 8b 45 f4 mov -0xc(%ebp),%eax 80107d12: 8b 50 04 mov 0x4(%eax),%edx 80107d15: 8b 45 f4 mov -0xc(%ebp),%eax 80107d18: 8b 58 08 mov 0x8(%eax),%ebx 80107d1b: 8b 45 f4 mov -0xc(%ebp),%eax 80107d1e: 8b 40 04 mov 0x4(%eax),%eax 80107d21: 29 c3 sub %eax,%ebx 80107d23: 8b 45 f4 mov -0xc(%ebp),%eax 80107d26: 8b 00 mov (%eax),%eax 80107d28: 83 ec 0c sub $0xc,%esp 80107d2b: 51 push %ecx 80107d2c: 52 push %edx 80107d2d: 53 push %ebx 80107d2e: 50 push %eax 80107d2f: ff 75 f0 pushl -0x10(%ebp) 80107d32: e8 df fe ff ff call 80107c16 <mappages> 80107d37: 83 c4 20 add $0x20,%esp 80107d3a: 85 c0 test %eax,%eax 80107d3c: 79 07 jns 80107d45 <setupkvm+0x9d> (uint)k->phys_start, k->perm) < 0) return 0; 80107d3e: b8 00 00 00 00 mov $0x0,%eax 80107d43: eb 10 jmp 80107d55 <setupkvm+0xad> if((pgdir = (pde_t*)kalloc()) == 0) return 0; memset(pgdir, 0, PGSIZE); if (p2v(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80107d45: 83 45 f4 10 addl $0x10,-0xc(%ebp) 80107d49: 81 7d f4 00 b5 10 80 cmpl $0x8010b500,-0xc(%ebp) 80107d50: 72 b7 jb 80107d09 <setupkvm+0x61> if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) return 0; return pgdir; 80107d52: 8b 45 f0 mov -0x10(%ebp),%eax } 80107d55: 8b 5d fc mov -0x4(%ebp),%ebx 80107d58: c9 leave 80107d59: c3 ret 80107d5a <kvmalloc>: // Allocate one page table for the machine for the kernel address // space for scheduler processes. void kvmalloc(void) { 80107d5a: 55 push %ebp 80107d5b: 89 e5 mov %esp,%ebp 80107d5d: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 80107d60: e8 43 ff ff ff call 80107ca8 <setupkvm> 80107d65: a3 18 54 11 80 mov %eax,0x80115418 switchkvm(); 80107d6a: e8 02 00 00 00 call 80107d71 <switchkvm> } 80107d6f: c9 leave 80107d70: c3 ret 80107d71 <switchkvm>: // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { 80107d71: 55 push %ebp 80107d72: 89 e5 mov %esp,%ebp lcr3(v2p(kpgdir)); // switch to the kernel page table 80107d74: a1 18 54 11 80 mov 0x80115418,%eax 80107d79: 50 push %eax 80107d7a: e8 69 f9 ff ff call 801076e8 <v2p> 80107d7f: 83 c4 04 add $0x4,%esp 80107d82: 50 push %eax 80107d83: e8 55 f9 ff ff call 801076dd <lcr3> 80107d88: 83 c4 04 add $0x4,%esp } 80107d8b: c9 leave 80107d8c: c3 ret 80107d8d <switchuvm>: // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { 80107d8d: 55 push %ebp 80107d8e: 89 e5 mov %esp,%ebp 80107d90: 56 push %esi 80107d91: 53 push %ebx pushcli(); 80107d92: e8 b1 d2 ff ff call 80105048 <pushcli> cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0); 80107d97: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80107d9d: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80107da4: 83 c2 08 add $0x8,%edx 80107da7: 89 d6 mov %edx,%esi 80107da9: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80107db0: 83 c2 08 add $0x8,%edx 80107db3: c1 ea 10 shr $0x10,%edx 80107db6: 89 d3 mov %edx,%ebx 80107db8: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80107dbf: 83 c2 08 add $0x8,%edx 80107dc2: c1 ea 18 shr $0x18,%edx 80107dc5: 89 d1 mov %edx,%ecx 80107dc7: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax) 80107dce: 67 00 80107dd0: 66 89 b0 a2 00 00 00 mov %si,0xa2(%eax) 80107dd7: 88 98 a4 00 00 00 mov %bl,0xa4(%eax) 80107ddd: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80107de4: 83 e2 f0 and $0xfffffff0,%edx 80107de7: 83 ca 09 or $0x9,%edx 80107dea: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80107df0: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80107df7: 83 ca 10 or $0x10,%edx 80107dfa: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80107e00: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80107e07: 83 e2 9f and $0xffffff9f,%edx 80107e0a: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80107e10: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80107e17: 83 ca 80 or $0xffffff80,%edx 80107e1a: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80107e20: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 80107e27: 83 e2 f0 and $0xfffffff0,%edx 80107e2a: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 80107e30: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 80107e37: 83 e2 ef and $0xffffffef,%edx 80107e3a: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 80107e40: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 80107e47: 83 e2 df and $0xffffffdf,%edx 80107e4a: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 80107e50: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 80107e57: 83 ca 40 or $0x40,%edx 80107e5a: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 80107e60: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 80107e67: 83 e2 7f and $0x7f,%edx 80107e6a: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 80107e70: 88 88 a7 00 00 00 mov %cl,0xa7(%eax) cpu->gdt[SEG_TSS].s = 0; 80107e76: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80107e7c: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80107e83: 83 e2 ef and $0xffffffef,%edx 80107e86: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) cpu->ts.ss0 = SEG_KDATA << 3; 80107e8c: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80107e92: 66 c7 40 10 10 00 movw $0x10,0x10(%eax) cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE; 80107e98: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80107e9e: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80107ea5: 8b 52 08 mov 0x8(%edx),%edx 80107ea8: 81 c2 00 10 00 00 add $0x1000,%edx 80107eae: 89 50 0c mov %edx,0xc(%eax) ltr(SEG_TSS << 3); 80107eb1: 83 ec 0c sub $0xc,%esp 80107eb4: 6a 30 push $0x30 80107eb6: e8 f7 f7 ff ff call 801076b2 <ltr> 80107ebb: 83 c4 10 add $0x10,%esp if(p->pgdir == 0) 80107ebe: 8b 45 08 mov 0x8(%ebp),%eax 80107ec1: 8b 40 04 mov 0x4(%eax),%eax 80107ec4: 85 c0 test %eax,%eax 80107ec6: 75 0d jne 80107ed5 <switchuvm+0x148> panic("switchuvm: no pgdir"); 80107ec8: 83 ec 0c sub $0xc,%esp 80107ecb: 68 9f 8a 10 80 push $0x80108a9f 80107ed0: e8 87 86 ff ff call 8010055c <panic> lcr3(v2p(p->pgdir)); // switch to new address space 80107ed5: 8b 45 08 mov 0x8(%ebp),%eax 80107ed8: 8b 40 04 mov 0x4(%eax),%eax 80107edb: 83 ec 0c sub $0xc,%esp 80107ede: 50 push %eax 80107edf: e8 04 f8 ff ff call 801076e8 <v2p> 80107ee4: 83 c4 10 add $0x10,%esp 80107ee7: 83 ec 0c sub $0xc,%esp 80107eea: 50 push %eax 80107eeb: e8 ed f7 ff ff call 801076dd <lcr3> 80107ef0: 83 c4 10 add $0x10,%esp popcli(); 80107ef3: e8 94 d1 ff ff call 8010508c <popcli> } 80107ef8: 8d 65 f8 lea -0x8(%ebp),%esp 80107efb: 5b pop %ebx 80107efc: 5e pop %esi 80107efd: 5d pop %ebp 80107efe: c3 ret 80107eff <inituvm>: // Load the initcode into address 0 of pgdir. // sz must be less than a page. void inituvm(pde_t *pgdir, char *init, uint sz) { 80107eff: 55 push %ebp 80107f00: 89 e5 mov %esp,%ebp 80107f02: 83 ec 18 sub $0x18,%esp char *mem; if(sz >= PGSIZE) 80107f05: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp) 80107f0c: 76 0d jbe 80107f1b <inituvm+0x1c> panic("inituvm: more than a page"); 80107f0e: 83 ec 0c sub $0xc,%esp 80107f11: 68 b3 8a 10 80 push $0x80108ab3 80107f16: e8 41 86 ff ff call 8010055c <panic> mem = kalloc(); 80107f1b: e8 65 ac ff ff call 80102b85 <kalloc> 80107f20: 89 45 f4 mov %eax,-0xc(%ebp) memset(mem, 0, PGSIZE); 80107f23: 83 ec 04 sub $0x4,%esp 80107f26: 68 00 10 00 00 push $0x1000 80107f2b: 6a 00 push $0x0 80107f2d: ff 75 f4 pushl -0xc(%ebp) 80107f30: e8 15 d2 ff ff call 8010514a <memset> 80107f35: 83 c4 10 add $0x10,%esp mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U); 80107f38: 83 ec 0c sub $0xc,%esp 80107f3b: ff 75 f4 pushl -0xc(%ebp) 80107f3e: e8 a5 f7 ff ff call 801076e8 <v2p> 80107f43: 83 c4 10 add $0x10,%esp 80107f46: 83 ec 0c sub $0xc,%esp 80107f49: 6a 06 push $0x6 80107f4b: 50 push %eax 80107f4c: 68 00 10 00 00 push $0x1000 80107f51: 6a 00 push $0x0 80107f53: ff 75 08 pushl 0x8(%ebp) 80107f56: e8 bb fc ff ff call 80107c16 <mappages> 80107f5b: 83 c4 20 add $0x20,%esp memmove(mem, init, sz); 80107f5e: 83 ec 04 sub $0x4,%esp 80107f61: ff 75 10 pushl 0x10(%ebp) 80107f64: ff 75 0c pushl 0xc(%ebp) 80107f67: ff 75 f4 pushl -0xc(%ebp) 80107f6a: e8 9a d2 ff ff call 80105209 <memmove> 80107f6f: 83 c4 10 add $0x10,%esp } 80107f72: c9 leave 80107f73: c3 ret 80107f74 <loaduvm>: // Load a program segment into pgdir. addr must be page-aligned // and the pages from addr to addr+sz must already be mapped. int loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz) { 80107f74: 55 push %ebp 80107f75: 89 e5 mov %esp,%ebp 80107f77: 53 push %ebx 80107f78: 83 ec 14 sub $0x14,%esp uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) 80107f7b: 8b 45 0c mov 0xc(%ebp),%eax 80107f7e: 25 ff 0f 00 00 and $0xfff,%eax 80107f83: 85 c0 test %eax,%eax 80107f85: 74 0d je 80107f94 <loaduvm+0x20> panic("loaduvm: addr must be page aligned"); 80107f87: 83 ec 0c sub $0xc,%esp 80107f8a: 68 d0 8a 10 80 push $0x80108ad0 80107f8f: e8 c8 85 ff ff call 8010055c <panic> for(i = 0; i < sz; i += PGSIZE){ 80107f94: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80107f9b: e9 95 00 00 00 jmp 80108035 <loaduvm+0xc1> if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 80107fa0: 8b 55 0c mov 0xc(%ebp),%edx 80107fa3: 8b 45 f4 mov -0xc(%ebp),%eax 80107fa6: 01 d0 add %edx,%eax 80107fa8: 83 ec 04 sub $0x4,%esp 80107fab: 6a 00 push $0x0 80107fad: 50 push %eax 80107fae: ff 75 08 pushl 0x8(%ebp) 80107fb1: e8 c0 fb ff ff call 80107b76 <walkpgdir> 80107fb6: 83 c4 10 add $0x10,%esp 80107fb9: 89 45 ec mov %eax,-0x14(%ebp) 80107fbc: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80107fc0: 75 0d jne 80107fcf <loaduvm+0x5b> panic("loaduvm: address should exist"); 80107fc2: 83 ec 0c sub $0xc,%esp 80107fc5: 68 f3 8a 10 80 push $0x80108af3 80107fca: e8 8d 85 ff ff call 8010055c <panic> pa = PTE_ADDR(*pte); 80107fcf: 8b 45 ec mov -0x14(%ebp),%eax 80107fd2: 8b 00 mov (%eax),%eax 80107fd4: 25 00 f0 ff ff and $0xfffff000,%eax 80107fd9: 89 45 e8 mov %eax,-0x18(%ebp) if(sz - i < PGSIZE) 80107fdc: 8b 45 18 mov 0x18(%ebp),%eax 80107fdf: 2b 45 f4 sub -0xc(%ebp),%eax 80107fe2: 3d ff 0f 00 00 cmp $0xfff,%eax 80107fe7: 77 0b ja 80107ff4 <loaduvm+0x80> n = sz - i; 80107fe9: 8b 45 18 mov 0x18(%ebp),%eax 80107fec: 2b 45 f4 sub -0xc(%ebp),%eax 80107fef: 89 45 f0 mov %eax,-0x10(%ebp) 80107ff2: eb 07 jmp 80107ffb <loaduvm+0x87> else n = PGSIZE; 80107ff4: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp) if(readi(ip, p2v(pa), offset+i, n) != n) 80107ffb: 8b 55 14 mov 0x14(%ebp),%edx 80107ffe: 8b 45 f4 mov -0xc(%ebp),%eax 80108001: 8d 1c 02 lea (%edx,%eax,1),%ebx 80108004: 83 ec 0c sub $0xc,%esp 80108007: ff 75 e8 pushl -0x18(%ebp) 8010800a: e8 e6 f6 ff ff call 801076f5 <p2v> 8010800f: 83 c4 10 add $0x10,%esp 80108012: ff 75 f0 pushl -0x10(%ebp) 80108015: 53 push %ebx 80108016: 50 push %eax 80108017: ff 75 10 pushl 0x10(%ebp) 8010801a: e8 1f 9e ff ff call 80101e3e <readi> 8010801f: 83 c4 10 add $0x10,%esp 80108022: 3b 45 f0 cmp -0x10(%ebp),%eax 80108025: 74 07 je 8010802e <loaduvm+0xba> return -1; 80108027: b8 ff ff ff ff mov $0xffffffff,%eax 8010802c: eb 18 jmp 80108046 <loaduvm+0xd2> uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ 8010802e: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108035: 8b 45 f4 mov -0xc(%ebp),%eax 80108038: 3b 45 18 cmp 0x18(%ebp),%eax 8010803b: 0f 82 5f ff ff ff jb 80107fa0 <loaduvm+0x2c> else n = PGSIZE; if(readi(ip, p2v(pa), offset+i, n) != n) return -1; } return 0; 80108041: b8 00 00 00 00 mov $0x0,%eax } 80108046: 8b 5d fc mov -0x4(%ebp),%ebx 80108049: c9 leave 8010804a: c3 ret 8010804b <allocuvm>: // Allocate page tables and physical memory to grow process from oldsz to // newsz, which need not be page aligned. Returns new size or 0 on error. int allocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 8010804b: 55 push %ebp 8010804c: 89 e5 mov %esp,%ebp 8010804e: 83 ec 18 sub $0x18,%esp char *mem; uint a; if(newsz >= KERNBASE) 80108051: 8b 45 10 mov 0x10(%ebp),%eax 80108054: 85 c0 test %eax,%eax 80108056: 79 0a jns 80108062 <allocuvm+0x17> return 0; 80108058: b8 00 00 00 00 mov $0x0,%eax 8010805d: e9 b0 00 00 00 jmp 80108112 <allocuvm+0xc7> if(newsz < oldsz) 80108062: 8b 45 10 mov 0x10(%ebp),%eax 80108065: 3b 45 0c cmp 0xc(%ebp),%eax 80108068: 73 08 jae 80108072 <allocuvm+0x27> return oldsz; 8010806a: 8b 45 0c mov 0xc(%ebp),%eax 8010806d: e9 a0 00 00 00 jmp 80108112 <allocuvm+0xc7> a = PGROUNDUP(oldsz); 80108072: 8b 45 0c mov 0xc(%ebp),%eax 80108075: 05 ff 0f 00 00 add $0xfff,%eax 8010807a: 25 00 f0 ff ff and $0xfffff000,%eax 8010807f: 89 45 f4 mov %eax,-0xc(%ebp) for(; a < newsz; a += PGSIZE){ 80108082: eb 7f jmp 80108103 <allocuvm+0xb8> mem = kalloc(); 80108084: e8 fc aa ff ff call 80102b85 <kalloc> 80108089: 89 45 f0 mov %eax,-0x10(%ebp) if(mem == 0){ 8010808c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80108090: 75 2b jne 801080bd <allocuvm+0x72> cprintf("allocuvm out of memory\n"); 80108092: 83 ec 0c sub $0xc,%esp 80108095: 68 11 8b 10 80 push $0x80108b11 8010809a: e8 20 83 ff ff call 801003bf <cprintf> 8010809f: 83 c4 10 add $0x10,%esp deallocuvm(pgdir, newsz, oldsz); 801080a2: 83 ec 04 sub $0x4,%esp 801080a5: ff 75 0c pushl 0xc(%ebp) 801080a8: ff 75 10 pushl 0x10(%ebp) 801080ab: ff 75 08 pushl 0x8(%ebp) 801080ae: e8 61 00 00 00 call 80108114 <deallocuvm> 801080b3: 83 c4 10 add $0x10,%esp return 0; 801080b6: b8 00 00 00 00 mov $0x0,%eax 801080bb: eb 55 jmp 80108112 <allocuvm+0xc7> } memset(mem, 0, PGSIZE); 801080bd: 83 ec 04 sub $0x4,%esp 801080c0: 68 00 10 00 00 push $0x1000 801080c5: 6a 00 push $0x0 801080c7: ff 75 f0 pushl -0x10(%ebp) 801080ca: e8 7b d0 ff ff call 8010514a <memset> 801080cf: 83 c4 10 add $0x10,%esp mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U); 801080d2: 83 ec 0c sub $0xc,%esp 801080d5: ff 75 f0 pushl -0x10(%ebp) 801080d8: e8 0b f6 ff ff call 801076e8 <v2p> 801080dd: 83 c4 10 add $0x10,%esp 801080e0: 89 c2 mov %eax,%edx 801080e2: 8b 45 f4 mov -0xc(%ebp),%eax 801080e5: 83 ec 0c sub $0xc,%esp 801080e8: 6a 06 push $0x6 801080ea: 52 push %edx 801080eb: 68 00 10 00 00 push $0x1000 801080f0: 50 push %eax 801080f1: ff 75 08 pushl 0x8(%ebp) 801080f4: e8 1d fb ff ff call 80107c16 <mappages> 801080f9: 83 c4 20 add $0x20,%esp return 0; if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ 801080fc: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108103: 8b 45 f4 mov -0xc(%ebp),%eax 80108106: 3b 45 10 cmp 0x10(%ebp),%eax 80108109: 0f 82 75 ff ff ff jb 80108084 <allocuvm+0x39> return 0; } memset(mem, 0, PGSIZE); mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U); } return newsz; 8010810f: 8b 45 10 mov 0x10(%ebp),%eax } 80108112: c9 leave 80108113: c3 ret 80108114 <deallocuvm>: // newsz. oldsz and newsz need not be page-aligned, nor does newsz // need to be less than oldsz. oldsz can be larger than the actual // process size. Returns the new process size. int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80108114: 55 push %ebp 80108115: 89 e5 mov %esp,%ebp 80108117: 83 ec 18 sub $0x18,%esp pte_t *pte; uint a, pa; if(newsz >= oldsz) 8010811a: 8b 45 10 mov 0x10(%ebp),%eax 8010811d: 3b 45 0c cmp 0xc(%ebp),%eax 80108120: 72 08 jb 8010812a <deallocuvm+0x16> return oldsz; 80108122: 8b 45 0c mov 0xc(%ebp),%eax 80108125: e9 a5 00 00 00 jmp 801081cf <deallocuvm+0xbb> a = PGROUNDUP(newsz); 8010812a: 8b 45 10 mov 0x10(%ebp),%eax 8010812d: 05 ff 0f 00 00 add $0xfff,%eax 80108132: 25 00 f0 ff ff and $0xfffff000,%eax 80108137: 89 45 f4 mov %eax,-0xc(%ebp) for(; a < oldsz; a += PGSIZE){ 8010813a: e9 81 00 00 00 jmp 801081c0 <deallocuvm+0xac> pte = walkpgdir(pgdir, (char*)a, 0); 8010813f: 8b 45 f4 mov -0xc(%ebp),%eax 80108142: 83 ec 04 sub $0x4,%esp 80108145: 6a 00 push $0x0 80108147: 50 push %eax 80108148: ff 75 08 pushl 0x8(%ebp) 8010814b: e8 26 fa ff ff call 80107b76 <walkpgdir> 80108150: 83 c4 10 add $0x10,%esp 80108153: 89 45 f0 mov %eax,-0x10(%ebp) if(!pte) 80108156: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010815a: 75 09 jne 80108165 <deallocuvm+0x51> a += (NPTENTRIES - 1) * PGSIZE; 8010815c: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp) 80108163: eb 54 jmp 801081b9 <deallocuvm+0xa5> else if((*pte & PTE_P) != 0){ 80108165: 8b 45 f0 mov -0x10(%ebp),%eax 80108168: 8b 00 mov (%eax),%eax 8010816a: 83 e0 01 and $0x1,%eax 8010816d: 85 c0 test %eax,%eax 8010816f: 74 48 je 801081b9 <deallocuvm+0xa5> pa = PTE_ADDR(*pte); 80108171: 8b 45 f0 mov -0x10(%ebp),%eax 80108174: 8b 00 mov (%eax),%eax 80108176: 25 00 f0 ff ff and $0xfffff000,%eax 8010817b: 89 45 ec mov %eax,-0x14(%ebp) if(pa == 0) 8010817e: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80108182: 75 0d jne 80108191 <deallocuvm+0x7d> panic("kfree"); 80108184: 83 ec 0c sub $0xc,%esp 80108187: 68 29 8b 10 80 push $0x80108b29 8010818c: e8 cb 83 ff ff call 8010055c <panic> char *v = p2v(pa); 80108191: 83 ec 0c sub $0xc,%esp 80108194: ff 75 ec pushl -0x14(%ebp) 80108197: e8 59 f5 ff ff call 801076f5 <p2v> 8010819c: 83 c4 10 add $0x10,%esp 8010819f: 89 45 e8 mov %eax,-0x18(%ebp) kfree(v); 801081a2: 83 ec 0c sub $0xc,%esp 801081a5: ff 75 e8 pushl -0x18(%ebp) 801081a8: e8 3c a9 ff ff call 80102ae9 <kfree> 801081ad: 83 c4 10 add $0x10,%esp *pte = 0; 801081b0: 8b 45 f0 mov -0x10(%ebp),%eax 801081b3: c7 00 00 00 00 00 movl $0x0,(%eax) if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 801081b9: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 801081c0: 8b 45 f4 mov -0xc(%ebp),%eax 801081c3: 3b 45 0c cmp 0xc(%ebp),%eax 801081c6: 0f 82 73 ff ff ff jb 8010813f <deallocuvm+0x2b> char *v = p2v(pa); kfree(v); *pte = 0; } } return newsz; 801081cc: 8b 45 10 mov 0x10(%ebp),%eax } 801081cf: c9 leave 801081d0: c3 ret 801081d1 <freevm>: // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 801081d1: 55 push %ebp 801081d2: 89 e5 mov %esp,%ebp 801081d4: 83 ec 18 sub $0x18,%esp uint i; if(pgdir == 0) 801081d7: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801081db: 75 0d jne 801081ea <freevm+0x19> panic("freevm: no pgdir"); 801081dd: 83 ec 0c sub $0xc,%esp 801081e0: 68 2f 8b 10 80 push $0x80108b2f 801081e5: e8 72 83 ff ff call 8010055c <panic> deallocuvm(pgdir, KERNBASE, 0); 801081ea: 83 ec 04 sub $0x4,%esp 801081ed: 6a 00 push $0x0 801081ef: 68 00 00 00 80 push $0x80000000 801081f4: ff 75 08 pushl 0x8(%ebp) 801081f7: e8 18 ff ff ff call 80108114 <deallocuvm> 801081fc: 83 c4 10 add $0x10,%esp for(i = 0; i < NPDENTRIES; i++){ 801081ff: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80108206: eb 4f jmp 80108257 <freevm+0x86> if(pgdir[i] & PTE_P){ 80108208: 8b 45 f4 mov -0xc(%ebp),%eax 8010820b: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80108212: 8b 45 08 mov 0x8(%ebp),%eax 80108215: 01 d0 add %edx,%eax 80108217: 8b 00 mov (%eax),%eax 80108219: 83 e0 01 and $0x1,%eax 8010821c: 85 c0 test %eax,%eax 8010821e: 74 33 je 80108253 <freevm+0x82> char * v = p2v(PTE_ADDR(pgdir[i])); 80108220: 8b 45 f4 mov -0xc(%ebp),%eax 80108223: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 8010822a: 8b 45 08 mov 0x8(%ebp),%eax 8010822d: 01 d0 add %edx,%eax 8010822f: 8b 00 mov (%eax),%eax 80108231: 25 00 f0 ff ff and $0xfffff000,%eax 80108236: 83 ec 0c sub $0xc,%esp 80108239: 50 push %eax 8010823a: e8 b6 f4 ff ff call 801076f5 <p2v> 8010823f: 83 c4 10 add $0x10,%esp 80108242: 89 45 f0 mov %eax,-0x10(%ebp) kfree(v); 80108245: 83 ec 0c sub $0xc,%esp 80108248: ff 75 f0 pushl -0x10(%ebp) 8010824b: e8 99 a8 ff ff call 80102ae9 <kfree> 80108250: 83 c4 10 add $0x10,%esp uint i; if(pgdir == 0) panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 80108253: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80108257: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp) 8010825e: 76 a8 jbe 80108208 <freevm+0x37> if(pgdir[i] & PTE_P){ char * v = p2v(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 80108260: 83 ec 0c sub $0xc,%esp 80108263: ff 75 08 pushl 0x8(%ebp) 80108266: e8 7e a8 ff ff call 80102ae9 <kfree> 8010826b: 83 c4 10 add $0x10,%esp } 8010826e: c9 leave 8010826f: c3 ret 80108270 <clearpteu>: // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80108270: 55 push %ebp 80108271: 89 e5 mov %esp,%ebp 80108273: 83 ec 18 sub $0x18,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80108276: 83 ec 04 sub $0x4,%esp 80108279: 6a 00 push $0x0 8010827b: ff 75 0c pushl 0xc(%ebp) 8010827e: ff 75 08 pushl 0x8(%ebp) 80108281: e8 f0 f8 ff ff call 80107b76 <walkpgdir> 80108286: 83 c4 10 add $0x10,%esp 80108289: 89 45 f4 mov %eax,-0xc(%ebp) if(pte == 0) 8010828c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80108290: 75 0d jne 8010829f <clearpteu+0x2f> panic("clearpteu"); 80108292: 83 ec 0c sub $0xc,%esp 80108295: 68 40 8b 10 80 push $0x80108b40 8010829a: e8 bd 82 ff ff call 8010055c <panic> *pte &= ~PTE_U; 8010829f: 8b 45 f4 mov -0xc(%ebp),%eax 801082a2: 8b 00 mov (%eax),%eax 801082a4: 83 e0 fb and $0xfffffffb,%eax 801082a7: 89 c2 mov %eax,%edx 801082a9: 8b 45 f4 mov -0xc(%ebp),%eax 801082ac: 89 10 mov %edx,(%eax) } 801082ae: c9 leave 801082af: c3 ret 801082b0 <copyuvm>: // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 801082b0: 55 push %ebp 801082b1: 89 e5 mov %esp,%ebp 801082b3: 53 push %ebx 801082b4: 83 ec 24 sub $0x24,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) 801082b7: e8 ec f9 ff ff call 80107ca8 <setupkvm> 801082bc: 89 45 f0 mov %eax,-0x10(%ebp) 801082bf: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801082c3: 75 0a jne 801082cf <copyuvm+0x1f> return 0; 801082c5: b8 00 00 00 00 mov $0x0,%eax 801082ca: e9 f8 00 00 00 jmp 801083c7 <copyuvm+0x117> for(i = 0; i < sz; i += PGSIZE){ 801082cf: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801082d6: e9 c8 00 00 00 jmp 801083a3 <copyuvm+0xf3> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) 801082db: 8b 45 f4 mov -0xc(%ebp),%eax 801082de: 83 ec 04 sub $0x4,%esp 801082e1: 6a 00 push $0x0 801082e3: 50 push %eax 801082e4: ff 75 08 pushl 0x8(%ebp) 801082e7: e8 8a f8 ff ff call 80107b76 <walkpgdir> 801082ec: 83 c4 10 add $0x10,%esp 801082ef: 89 45 ec mov %eax,-0x14(%ebp) 801082f2: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801082f6: 75 0d jne 80108305 <copyuvm+0x55> panic("copyuvm: pte should exist"); 801082f8: 83 ec 0c sub $0xc,%esp 801082fb: 68 4a 8b 10 80 push $0x80108b4a 80108300: e8 57 82 ff ff call 8010055c <panic> if(!(*pte & PTE_P)) 80108305: 8b 45 ec mov -0x14(%ebp),%eax 80108308: 8b 00 mov (%eax),%eax 8010830a: 83 e0 01 and $0x1,%eax 8010830d: 85 c0 test %eax,%eax 8010830f: 75 0d jne 8010831e <copyuvm+0x6e> panic("copyuvm: page not present"); 80108311: 83 ec 0c sub $0xc,%esp 80108314: 68 64 8b 10 80 push $0x80108b64 80108319: e8 3e 82 ff ff call 8010055c <panic> pa = PTE_ADDR(*pte); 8010831e: 8b 45 ec mov -0x14(%ebp),%eax 80108321: 8b 00 mov (%eax),%eax 80108323: 25 00 f0 ff ff and $0xfffff000,%eax 80108328: 89 45 e8 mov %eax,-0x18(%ebp) flags = PTE_FLAGS(*pte); 8010832b: 8b 45 ec mov -0x14(%ebp),%eax 8010832e: 8b 00 mov (%eax),%eax 80108330: 25 ff 0f 00 00 and $0xfff,%eax 80108335: 89 45 e4 mov %eax,-0x1c(%ebp) if((mem = kalloc()) == 0) 80108338: e8 48 a8 ff ff call 80102b85 <kalloc> 8010833d: 89 45 e0 mov %eax,-0x20(%ebp) 80108340: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80108344: 75 02 jne 80108348 <copyuvm+0x98> goto bad; 80108346: eb 6c jmp 801083b4 <copyuvm+0x104> memmove(mem, (char*)p2v(pa), PGSIZE); 80108348: 83 ec 0c sub $0xc,%esp 8010834b: ff 75 e8 pushl -0x18(%ebp) 8010834e: e8 a2 f3 ff ff call 801076f5 <p2v> 80108353: 83 c4 10 add $0x10,%esp 80108356: 83 ec 04 sub $0x4,%esp 80108359: 68 00 10 00 00 push $0x1000 8010835e: 50 push %eax 8010835f: ff 75 e0 pushl -0x20(%ebp) 80108362: e8 a2 ce ff ff call 80105209 <memmove> 80108367: 83 c4 10 add $0x10,%esp if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) 8010836a: 8b 5d e4 mov -0x1c(%ebp),%ebx 8010836d: 83 ec 0c sub $0xc,%esp 80108370: ff 75 e0 pushl -0x20(%ebp) 80108373: e8 70 f3 ff ff call 801076e8 <v2p> 80108378: 83 c4 10 add $0x10,%esp 8010837b: 89 c2 mov %eax,%edx 8010837d: 8b 45 f4 mov -0xc(%ebp),%eax 80108380: 83 ec 0c sub $0xc,%esp 80108383: 53 push %ebx 80108384: 52 push %edx 80108385: 68 00 10 00 00 push $0x1000 8010838a: 50 push %eax 8010838b: ff 75 f0 pushl -0x10(%ebp) 8010838e: e8 83 f8 ff ff call 80107c16 <mappages> 80108393: 83 c4 20 add $0x20,%esp 80108396: 85 c0 test %eax,%eax 80108398: 79 02 jns 8010839c <copyuvm+0xec> goto bad; 8010839a: eb 18 jmp 801083b4 <copyuvm+0x104> uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ 8010839c: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 801083a3: 8b 45 f4 mov -0xc(%ebp),%eax 801083a6: 3b 45 0c cmp 0xc(%ebp),%eax 801083a9: 0f 82 2c ff ff ff jb 801082db <copyuvm+0x2b> goto bad; memmove(mem, (char*)p2v(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) goto bad; } return d; 801083af: 8b 45 f0 mov -0x10(%ebp),%eax 801083b2: eb 13 jmp 801083c7 <copyuvm+0x117> bad: freevm(d); 801083b4: 83 ec 0c sub $0xc,%esp 801083b7: ff 75 f0 pushl -0x10(%ebp) 801083ba: e8 12 fe ff ff call 801081d1 <freevm> 801083bf: 83 c4 10 add $0x10,%esp return 0; 801083c2: b8 00 00 00 00 mov $0x0,%eax } 801083c7: 8b 5d fc mov -0x4(%ebp),%ebx 801083ca: c9 leave 801083cb: c3 ret 801083cc <uva2ka>: //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 801083cc: 55 push %ebp 801083cd: 89 e5 mov %esp,%ebp 801083cf: 83 ec 18 sub $0x18,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 801083d2: 83 ec 04 sub $0x4,%esp 801083d5: 6a 00 push $0x0 801083d7: ff 75 0c pushl 0xc(%ebp) 801083da: ff 75 08 pushl 0x8(%ebp) 801083dd: e8 94 f7 ff ff call 80107b76 <walkpgdir> 801083e2: 83 c4 10 add $0x10,%esp 801083e5: 89 45 f4 mov %eax,-0xc(%ebp) if((*pte & PTE_P) == 0) 801083e8: 8b 45 f4 mov -0xc(%ebp),%eax 801083eb: 8b 00 mov (%eax),%eax 801083ed: 83 e0 01 and $0x1,%eax 801083f0: 85 c0 test %eax,%eax 801083f2: 75 07 jne 801083fb <uva2ka+0x2f> return 0; 801083f4: b8 00 00 00 00 mov $0x0,%eax 801083f9: eb 29 jmp 80108424 <uva2ka+0x58> if((*pte & PTE_U) == 0) 801083fb: 8b 45 f4 mov -0xc(%ebp),%eax 801083fe: 8b 00 mov (%eax),%eax 80108400: 83 e0 04 and $0x4,%eax 80108403: 85 c0 test %eax,%eax 80108405: 75 07 jne 8010840e <uva2ka+0x42> return 0; 80108407: b8 00 00 00 00 mov $0x0,%eax 8010840c: eb 16 jmp 80108424 <uva2ka+0x58> return (char*)p2v(PTE_ADDR(*pte)); 8010840e: 8b 45 f4 mov -0xc(%ebp),%eax 80108411: 8b 00 mov (%eax),%eax 80108413: 25 00 f0 ff ff and $0xfffff000,%eax 80108418: 83 ec 0c sub $0xc,%esp 8010841b: 50 push %eax 8010841c: e8 d4 f2 ff ff call 801076f5 <p2v> 80108421: 83 c4 10 add $0x10,%esp } 80108424: c9 leave 80108425: c3 ret 80108426 <copyout>: // Copy len bytes from p to user address va in page table pgdir. // Most useful when pgdir is not the current page table. // uva2ka ensures this only works for PTE_U pages. int copyout(pde_t *pgdir, uint va, void *p, uint len) { 80108426: 55 push %ebp 80108427: 89 e5 mov %esp,%ebp 80108429: 83 ec 18 sub $0x18,%esp char *buf, *pa0; uint n, va0; buf = (char*)p; 8010842c: 8b 45 10 mov 0x10(%ebp),%eax 8010842f: 89 45 f4 mov %eax,-0xc(%ebp) while(len > 0){ 80108432: eb 7f jmp 801084b3 <copyout+0x8d> va0 = (uint)PGROUNDDOWN(va); 80108434: 8b 45 0c mov 0xc(%ebp),%eax 80108437: 25 00 f0 ff ff and $0xfffff000,%eax 8010843c: 89 45 ec mov %eax,-0x14(%ebp) pa0 = uva2ka(pgdir, (char*)va0); 8010843f: 8b 45 ec mov -0x14(%ebp),%eax 80108442: 83 ec 08 sub $0x8,%esp 80108445: 50 push %eax 80108446: ff 75 08 pushl 0x8(%ebp) 80108449: e8 7e ff ff ff call 801083cc <uva2ka> 8010844e: 83 c4 10 add $0x10,%esp 80108451: 89 45 e8 mov %eax,-0x18(%ebp) if(pa0 == 0) 80108454: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80108458: 75 07 jne 80108461 <copyout+0x3b> return -1; 8010845a: b8 ff ff ff ff mov $0xffffffff,%eax 8010845f: eb 61 jmp 801084c2 <copyout+0x9c> n = PGSIZE - (va - va0); 80108461: 8b 45 ec mov -0x14(%ebp),%eax 80108464: 2b 45 0c sub 0xc(%ebp),%eax 80108467: 05 00 10 00 00 add $0x1000,%eax 8010846c: 89 45 f0 mov %eax,-0x10(%ebp) if(n > len) 8010846f: 8b 45 f0 mov -0x10(%ebp),%eax 80108472: 3b 45 14 cmp 0x14(%ebp),%eax 80108475: 76 06 jbe 8010847d <copyout+0x57> n = len; 80108477: 8b 45 14 mov 0x14(%ebp),%eax 8010847a: 89 45 f0 mov %eax,-0x10(%ebp) memmove(pa0 + (va - va0), buf, n); 8010847d: 8b 45 0c mov 0xc(%ebp),%eax 80108480: 2b 45 ec sub -0x14(%ebp),%eax 80108483: 89 c2 mov %eax,%edx 80108485: 8b 45 e8 mov -0x18(%ebp),%eax 80108488: 01 d0 add %edx,%eax 8010848a: 83 ec 04 sub $0x4,%esp 8010848d: ff 75 f0 pushl -0x10(%ebp) 80108490: ff 75 f4 pushl -0xc(%ebp) 80108493: 50 push %eax 80108494: e8 70 cd ff ff call 80105209 <memmove> 80108499: 83 c4 10 add $0x10,%esp len -= n; 8010849c: 8b 45 f0 mov -0x10(%ebp),%eax 8010849f: 29 45 14 sub %eax,0x14(%ebp) buf += n; 801084a2: 8b 45 f0 mov -0x10(%ebp),%eax 801084a5: 01 45 f4 add %eax,-0xc(%ebp) va = va0 + PGSIZE; 801084a8: 8b 45 ec mov -0x14(%ebp),%eax 801084ab: 05 00 10 00 00 add $0x1000,%eax 801084b0: 89 45 0c mov %eax,0xc(%ebp) { char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 801084b3: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 801084b7: 0f 85 77 ff ff ff jne 80108434 <copyout+0xe> memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; } return 0; 801084bd: b8 00 00 00 00 mov $0x0,%eax } 801084c2: c9 leave 801084c3: c3 ret
<% from pwnlib.shellcraft import arm, common %> <% from pwnlib.util.misc import align %> <%page args="in_fd=None, size=255, allocate_stack=True" /> <%docstring> Reads to the stack. You can optioanlly shave a few bytes not allocating the stack space. Args: in_fd (imm/reg) = STDIN_FILENO size (int/str) = 255 allocate_stack(bool) = True </%docstring> %if allocate_stack: sub sp, ${align(4, int(size))} %endif mov r0, ${in_fd} mov r2, ${size} mov r1, sp svc SYS_read
.program: ji i4 noop DATA_SECTION_OFFSET[0..32] DATA_SECTION_OFFSET[32..64] lw $ds $is 1 add $$ds $$ds $is bhei $r0 move $r1 $r0 ; return value from inline asm ret $r1 .data:
; A078709: Integer part of the mean subinterval length in the partition of [0,n] by the divisors of n. ; 1,1,1,1,2,1,3,2,3,2,5,2,6,3,3,3,8,3,9,3,5,5,11,3,8,6,6,4,14,3,15,5,8,8,8,4,18,9,9,5,20,5,21,7,7,11,23,4,16,8,12,8,26,6,13,7,14,14,29,5,30,15,10,9,16,8,33,11,17,8,35,6,36,18,12,12,19,9,39,8,16,20,41,7,21,21,21,11,44,7,22,15,23,23,23,8,48,16,16,11 mov $1,$0 add $0,1 seq $1,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. div $0,$1
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 80 .text@150 lbegin: ld a, ff ldff(45), a ld b, 96 call lwaitly_b ld a, 40 ldff(41), a ld a, 02 ldff(ff), a xor a, a ldff(0f), a ei ld a, b inc a inc a ldff(45), a ld c, 0f .text@1000 lstatint: ld a, 08 ldff(41), a xor a, a ldff(c), a .text@1116 ldff a, (c) jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a ld bc, 7a00 ld hl, 8000 ld d, 00 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles pop af ld b, a srl a srl a srl a srl a ld(9800), a ld a, b and a, 0f ld(9801), a ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f 00 00 08 08 22 22 41 41 7f 7f 41 41 41 41 41 41 00 00 7e 7e 41 41 41 41 7e 7e 41 41 41 41 7e 7e 00 00 3e 3e 41 41 40 40 40 40 40 40 41 41 3e 3e 00 00 7e 7e 41 41 41 41 41 41 41 41 41 41 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 40 40
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %rbp push %rbx push %rcx push %rsi // Store lea addresses_UC+0xd3d0, %rbp nop nop nop nop xor $22104, %r15 mov $0x5152535455565758, %rbx movq %rbx, %xmm6 vmovups %ymm6, (%rbp) nop nop cmp %r10, %r10 // Store lea addresses_US+0x603a, %rbp xor %r10, %r10 movb $0x51, (%rbp) xor %rbp, %rbp // Store lea addresses_WC+0x1a9d0, %r15 nop nop nop cmp %rsi, %rsi mov $0x5152535455565758, %r10 movq %r10, %xmm4 movups %xmm4, (%r15) cmp %r15, %r15 // Store lea addresses_PSE+0x17dd0, %rbp cmp $59190, %r11 movl $0x51525354, (%rbp) nop nop nop and $27264, %r11 // Faulty Load lea addresses_WC+0x1a9d0, %r15 nop xor %r10, %r10 mov (%r15), %cx lea oracles, %rsi and $0xff, %rcx shlq $12, %rcx mov (%rsi,%rcx,1), %rcx pop %rsi pop %rcx pop %rbx pop %rbp pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_US', 'AVXalign': False, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'58': 2} 58 58 */
; =============================================================== ; May 2017 ; =============================================================== ; ; void *tshc_cy2aaddr(uchar row) ; ; Character y coordinate to attribute address. ; ; =============================================================== SECTION code_clib SECTION code_arch PUBLIC asm_tshc_cy2aaddr asm_tshc_cy2aaddr: ; enter : l = valid character y coordinate ; ; exit : hl = attribute address of character coordinate row = y, x = 0 ; ; uses : af, hl ld a,l and $18 or $60 ld h,a ld a,l rrca rrca rrca and $e0 ld l,a ret
page 49,132 TITLE exMathOp - I2 Math Operators ;*** ;exmathop.asm - executors for math operators and functions ; ; Copyright <C> 1986, Microsoft Corporation ; ;Purpose: ; ; This module includes: ; - the I2 calculator functions. ; - interface to the mathpack for all mathpack resident functions. ; ; ;**************************************************************************** .8087 .xlist include version.inc EXMATHOP_ASM = ON IncludeOnce architec IncludeOnce executor IncludeOnce exint IncludeOnce opcontrl IncludeOnce opintrsc IncludeOnce opaftqb4 IncludeOnce rtinterp IncludeOnce context IncludeOnce qbimsgs IncludeOnce extort IncludeOnce ssint .list assumes cs, CODE assumes es, NOTHING assumes ss, DATA PREC53 MACRO ;NOOP if NOT FV_PREC53 ENDM PREC64 MACRO ;NOOP if NOT FV_PREC53 ENDM extrn B$CMI4:far extrn __aFlmul:far sBegin CODE ;=============================================================================== subttl I2 Math Support page MakeExe exAddI2,opAdd pop ax mov bx,sp add DGROUP:[bx],ax jo MulI2OVF DispMac MakeExe exSubI2,opSub pop ax ;Right hand arg mov bx,sp sub DGROUP:[bx],ax jo MulI2OVF DispMac MakeExe exMulI2,opMul pop cx pop ax imul cx jo MulI2OVF push ax DispMac MulI2OVF: FnAbsI2OVF: UMiI2OVF: jmp exMathErrOVF MakeExe exIdvI2,opIdv pop cx ;Right hand arg pop ax ;Left hand arg cwd jcxz IdvI2DV0 idiv cx push ax DispMac exMod0: IdvI2DV0: jmp exMathErrDV0 MakeExe exUMiI2,opUMi mov bx,sp neg word ptr DGROUP:[bx] jo UMiI2OVF DispMac MakeExe exModI2,opMod pop cx pop ax cwd jcxz exMod0 idiv cx push dx exModDisp: DispMac MakeExe exModI4,opMod pop ax pop bx pop cx pop dx push bx push ax push dx push cx ;MS Math(?) CALLRT B$RMI4,DispMovDxAx ;MOD function MakeExe exIDvI4,opIDv pop ax pop bx pop cx pop dx push bx push ax push dx push cx ;MS Math(?) CALLRT B$DVI4,DispMovDxAx MakeExe exFnAbsI2,opFnAbs pop ax cwd xor ax,dx sub ax,dx jo FnAbsI2OVF push ax DispMac MakeExe exStCaseEQI2,opStCaseEQ SkipExHeader MakeExe exStCaseI2,opStCase SkipExHeader MakeExe exEQI2,opEQ pop ax pop cx xor bx,bx cmp ax,cx jnz @F dec bx @@: push bx DispMac MakeExe exStCaseNEI2,opStCaseNE SkipExHeader MakeExe exNEI2,opNE pop ax pop cx xor bx,bx cmp ax,cx jz @F dec bx @@: push bx DispMac MakeExe exStCaseLEI2,opStCaseLE SkipExHeader MakeExe exLEI2,opLE pop cx ;Right arg pop ax ;Left arg xor bx,bx cmp ax,cx jg @F dec bx @@: push bx DispMac MakeExe exStCaseGEI2,opStCaseGE SkipExHeader MakeExe exGEI2,opGE pop cx ;Right arg pop ax ;Left arg xor bx,bx cmp ax,cx jl @F dec bx @@: push bx DispMac MakeExe exStCaseGTI2,opStCaseGT SkipExHeader MakeExe exGTI2,opGT pop cx ;Right arg pop ax ;Left arg xor bx,bx cmp ax,cx jle @F dec bx @@: push bx DispMac MakeExe exStCaseLTI2,opStCaseLT SkipExHeader MakeExe exLTI2,opLT pop cx ;Right arg pop ax ;Left arg xor bx,bx cmp ax,cx jge @F dec bx @@: push bx DispMac MakeExe exNotI2,opNot mov bx,sp not word ptr DGROUP:[bx] DispMac MakeExe exAndI2,opAnd pop ax pop cx and ax,cx push ax DispMac MakeExe exOrI2,opOr pop ax mov bx,sp or DGROUP:[bx],ax DispMac MakeExe exXorI2,opXor pop ax mov bx,sp xor DGROUP:[bx],ax DispMac MakeExe exEqvI2,opEqv pop ax ;Right operand pop cx ;Left operand xor ax,cx not ax push ax DispMac MakeExe exImpI2,opImp pop ax ;Right hand arg pop cx ;Left hand arg not cx or ax,cx push ax DispMac MakeExe exFnIntInt,opFnInt SkipExHeader MakeExe exFnFixInt,opFnFix DispMac MakeExe exFnSgnI2,opFnSgn xor ax,ax ;Assume 0 pop bx or bx,bx jz PushAxDisp js SgnSgn inc ax jmp short PushAxDisp SgnSgn: dec ax jmp short PushAxDisp ;=============================================================================== subttl I4 Math Support page MakeExe exAddI4,opAdd pop ax pop dx mov bx,sp add DGROUP:[bx],ax adc DGROUP:[bx+2],dx jo SubI4OVF DispMac MakeExe exSubI4,opSub pop ax pop dx mov bx,sp sub DGROUP:[bx],ax sbb DGROUP:[bx+2],dx jo SubI4OVF DispMac SubI4OVF: FnAbsI4OVF: UMiI4OVF: jmp exMathErrOVF MakeExe exMulI4,opMul call __aFlmul ;Perform the multiply jb SubI4OVF ;Declare overflows push dx push ax DispMac MakeExe exFnSgnI4,opFnSgn pop ax pop dx or ax,dx ;Test for zero jz PushAxDisp ;Result = 0 shl dx,1 ;PSW.C sbb ax,ax ;PSW.NZ indicates input was neg jnz PushAxDisp ; so return -1 inc ax ;Must have been positive jmp short PushAxDisp MakeExe exFnAbsI4,opFnAbs pop ax pop dx or dx,dx jns PushDxAxDisp not ax not dx add ax,1 adc dx,0 jo FnAbsI4OVF PushDxAxDisp: push dx PushAxDisp: push ax DispMac MakeExe exNotI4,opNot mov bx,sp not word ptr DGROUP:[bx] not word ptr DGROUP:[bx+2] DispMac MakeExe exUMiI4,opUMi pop ax pop dx not ax not dx add ax,1 adc dx,0 jo UMiI4OVF jmp short PushDxAxDisp MakeExe exAndI4,opAnd pop ax pop dx mov bx,sp and DGROUP:[bx],ax and DGROUP:[bx+2],dx DispMac MakeExe exOrI4,opOr pop ax pop dx mov bx,sp or DGROUP:[bx],ax or DGROUP:[bx+2],dx DispMac MakeExe exXorI4,opXor pop ax pop dx mov bx,sp xor DGROUP:[bx],ax xor DGROUP:[bx+2],dx DispMac MakeExe exEqvI4,opEqv pop ax pop dx pop cx pop bx xor ax,cx not ax xor dx,bx not dx jmp short PushDxAxDisp MakeExe exImpI4,opImp pop ax pop dx ;Right hand arg pop cx pop bx ;Left hand arg not cx not bx or ax,cx or dx,bx jmp short PushDxAxDisp ;*** ;CompareI4 - I4 signed comparison routine ;Purpose: ; Signed compare of two I4 numbers. ; ;Inputs: ; ParmD Left left hand argument ; ParmD Right right hand argument ; ;Function: ; Set Carry and Zero flags based on input arguments. ; Left > Right Zero clear and carry clear ; Left < Right Zero clear and carry set ; Left = Right Zero set ; ; Note: These are the flag conventions used by ; unsigned jumps, NOT signed jumps. ; ;Outputs: ; Zero and carry flags have result (set up for signed jmp) ;*************************************************************************** Public CompareI4 CompareI4: pop ax ;Near push cs ; to far push ax ; return address jmp B$CMI4 ;Perform and return to caller MakeExe exStCaseLTI4,opStCaseLT SkipExHeader MakeExe exLTI4,opLT call CompareI4 jb I4TrueDisp jmp short I4FalseDisp MakeExe exStCaseLEI4,opStCaseLE SkipExHeader MakeExe exLEI4,opLE call CompareI4 ja I4FalseDisp jmp short I4TrueDisp MakeExe exStCaseGEI4,opStCaseGE SkipExHeader MakeExe exGEI4,opGE call CompareI4 jae I4TrueDisp jmp short I4FalseDisp MakeExe exStCaseGTI4,opStCaseGT SkipExHeader MakeExe exGTI4,opGT call CompareI4 ja I4TrueDisp jmp short I4FalseDisp MakeExe exStCaseEQI4,opStCaseEQ SkipExHeader MakeExe exStCaseI4,opStCase SkipExHeader MakeExe exEQI4,opEQ call CompareI4 jz I4TrueDisp I4FalseDisp: PUSHI AX,FALSE DispMac MakeExe exStCaseNEI4,opStCaseNE SkipExHeader MakeExe exNEI4,opNE call CompareI4 jz I4FalseDisp I4TrueDisp: PUSHI AX,<NOT FALSE> DispMac ;=============================================================================== subttl R8 math Support page MovAxDisp MACRO RtEnt if LOW (P&RtEnt+1) mov ax,P&RtEnt+1 else mov ax,(HIGH P&RtEnt)+100h endif ENDM ;Rewritten with [21] MakeExe exAddR8,opAdd PREC53 fadd PREC64 DispMac MakeExe exSubR8,opSub PREC53 fsub PREC64 DispMac MakeExe exMulR8,opMul PREC53 fmul PREC64 DispMac MakeExe exDivR8,opDiv PREC53 fdiv PREC64 DispMac MakeExe exPwrR8,opPwr call CheckCONST ;Declare error if in CONST fxch ;Reverse order for runtime MovAxDisp B$POW8 ;Runtime entrypoint jmp short DispR8 ;Go do rt call, and exit subttl R8 Math Support - Single argument executors page MakeExe exFnSin,opFnSin MovAxDisp B$SIN8 DispR8: call ExToRtCall ;Perform the function in ax DispMac ;End of [21] MakeExe exFnCos,opFnCos MovAxDisp B$COS8 jmp DispR8 MakeExe exFnTan,opFnTan MovAxDisp B$TAN8 jmp DispR8 MakeExe exFnAtn,opFnAtn MovAxDisp B$ATN8 jmp DispR8 MakeExe exFnExp,opFnExp MovAxDisp B$EXP8 jmp DispR8 MakeExe exFnSqr,opFnSqr PREC53 fsqrt ;Do the root PREC64 DispMac MakeExe exFnLog,opFnLog MovAxDisp B$LOG8 jmp DispR8 MakeExe exFnIntR8,opFnInt MovAxDisp B$INT8 jmp DispR8 MakeExe exFnFixR8,opFnFix MovAxDisp B$FIX8 jmp DispR8 ;Rewritten with [21] MakeExe exUMiR8,opUMi fchs DispMac MakeExe exFnAbsR8,opFnAbs fabs DispMac MakeExe exFnSgnR8,opFnSgn fldz ;Put zero on stack fcompp ;Compare with zero and remove operands fstsw [Stat] ;Save result of comparison fwait mov ax,[Stat] sahf ;Unsigned flags now set like 0 - operand mov ax,1 jb SgnDone ;If operand was +, return 1 jz DecOnce dec ax DecOnce: dec ax SgnDone: push ax DispMac subttl R8 Compare Routines page DbPub CompareR8 CompareR8: fxch ;Compare in right order fcompp ;Compare to other arg on the stack fstsw [Stat] fwait mov ax,[Stat] ;Load 87 status to ax sahf ret ;End of [21] ;EQ MakeExe exStCaseEQR8,opStCaseEQ SkipExHeader MakeExe exStCaseR8,opStCase SkipExHeader MakeExe exEQR8,opEQ call CompareR8 mov ax,0 jnz @F ;NE dec ax @@: push ax DispMac ;NE MakeExe exStCaseNER8,opStCaseNE SkipExHeader MakeExe exNER8,opNE call CompareR8 mov ax,0 jz @F ;EQ dec ax @@: push ax DispMac ;GT MakeExe exStCaseGTR8,opStCaseGT SkipExHeader MakeExe exGTR8,opGT call CompareR8 mov ax,-1 ja @F ;GT inc ax @@: push ax DispMac ;GE MakeExe exStCaseGER8,opStCaseGE SkipExHeader MakeExe exGER8,opGE call CompareR8 mov ax,-1 jnb @F ;GE inc ax @@: push ax DispMac ;LE MakeExe exStCaseLER8,opStCaseLE SkipExHeader MakeExe exLER8,opLE call CompareR8 mov ax,0 ja @F ;GT dec ax @@: push ax DispMac ;LT MakeExe exStCaseLTR8,opStCaseLT SkipExHeader MakeExe exLTR8,opLT call CompareR8 mov ax,-1 jb @F ;LT inc ax @@: push ax DispMac ;=============================================================================== subttl CY Math Support page ;=============================================================================== subttl SD Math Support page MakeExe exAddSD,opAdd call CheckCONST ;Declare error if in CONST CALLRT B$SCAT,DispMovSd ;add strings ;*** ;CompareSD, CompareSDNoRel - Compare for type ET_SD ;Purpose: ; Near interface to B$SCMP. ; Near interface to B$ISCMPNoRel. ; ; Function: ; Set sign and Zero flags based on comparing left and right strings ; [left] > [right] carry clear and zero clear ; [left] < [right] carry set and zero clear ; [left] = [right] carry clear and zero set ;Input: ; Two SDs on the stack. ;Output: ; ax = FALSE ; PSW set as per compare ; ;****************************************************************************** sEnd CODE sBegin DATA Vector DW (?) sEnd DATA sBegin CODE DbPub CompareSDNoRel ;string compare without releasing temps CompareSDNoRel: pop [Vector] ;remove retaddr to access other values on stack call B$ISCMPNoRel ;compare without releasing left side if temp. jmp short CompareSDCom DbPub CompareSD CompareSD: pop [Vector] ;remove retaddr to access other values on stack call B$SCMP CompareSDCom: mov ax,FALSE ;in case we want to return FALSE jmp [Vector] ;return to caller ;CASE string comparisons MakeExe exStCaseGESD,opStCaseGE call CompareSDNoRel jae SD_TrueRet ;brif greater than or equal to jmp short SD_Ret MakeExe exStCaseGTSD,opStCaseGT call CompareSDNoRel ja SD_TrueRet ;brif greater than (z, s clear) jmp short SD_Ret MakeExe exStCaseLTSD,opStCaseLT call CompareSDNoRel jb SD_TrueRet ;brif less than jmp short SD_Ret MakeExe exStCaseLESD,opStCaseLE call CompareSDNoRel jna SD_TrueRet ;brif less than or equal to jmp short SD_Ret ;brif greater than - return false MakeExe exStCaseEQSD,opStCaseEQ SkipExHeader MakeExe exStCaseSD,opStCase call CompareSDNoRel je SD_TrueRet ;brif strings are equal jmp short SD_Ret MakeExe exStCaseNESD,opStCaseNE call CompareSDNoRel jne SD_TrueRet ;brif strings are not equal jmp short SD_Ret ;String comparisons MakeExe exGESD,opGE call CompareSD jae SD_TrueRet ;brif greater than or equal to jmp short SD_Ret MakeExe exGTSD,opGT call CompareSD ja short SD_TrueRet;brif greater than (z, c clear) jmp short SD_Ret MakeExe exLTSD,opLT call CompareSD jb SD_TrueRet ;brif less than jmp short SD_Ret MakeExe exLESD,opLE call CompareSD jbe SD_TrueRet ; brif less than or equal to jmp short SD_Ret MakeExe exEQSD,opEQ call CompareSD je SD_TrueRet ;brif strings are equal jmp short SD_Ret MakeExe exNESD,opNE call CompareSD je SD_Ret ;brif strings are equal SD_TrueRet: dec ax SD_Ret: push ax DispMac ;CASE text comparisons ;=============================================================================== subttl CASE TO comparison support for I2/I4/R4/R8/SD page ;exStCaseToI2, exStCaseToI4, exStCaseToR4, exStCaseToR8, exStCaseToSD ; ;The stack contains three values coerced to the same type. These ;routines emit a NOT FALSE onto the stack if exp1 is in inclusive ;range defined by [exp2,exp3], else a FALSE is emitted. MakeExe exStCaseToR8,opStCaseTo fld st(2) ;Duplicate input value call CompareR8 ;is upper bound < val? jb ToR8_FalsePop ;brif so call CompareR8 ;is val < lower bound? jb ToI4_False ;brif so jmp short ToI4_True ToR8_FalsePop: fpoptwo ;[21]Pop two values jmp short ToI4_False MakeExe exStCaseToI2,opStCaseTo pop bx ;upper bound pop cx ;lower bound pop dx ;value xor ax,ax ;initially FALSE cmp dx,cx ;is val < lower bound? jl ToI2_Ret ;brif so cmp dx,bx ;is val > upper bound? jg ToI2_Ret ;brif so dec ax ;TRUE ToI2_Ret: push ax DispMac MakeExe exStCaseToI4,opStCaseTo mov bx,sp ;set up frame ptr push DGROUP:[bx+10] ;push High word of val push DGROUP:[bx+8] ;push low word of val call CompareI4 ;is upper bound < val? jb ToI4_FalsePop ;brif so - pop off lower bound/val call CompareI4 ;is val < lower bound ? jb ToI4_False ;brif so ToI4_True: mov ax,NOT FALSE jmp short ToI2_Ret ToI4_FalsePop: add sp,8 ;pop off lower bound and value ToI4_False: xor ax,ax jmp short ToI2_Ret MakeExe exStCaseToSD,opStCaseTo mov bx,sp push DGROUP:[bx+4] ;duplicate string descriptor push DGROUP:[bx] ;duplicate upper bound call CompareSDNoRel ;is val > upper bound? pop ax ;(pop off copy of upper bound) ja ToSD_FalsePop ;brif so call CompareSDNoRel ;is val < lower bound? jb ToI4_False ;brif so jmp short ToI4_True ToSD_FalsePop: call B$FLEN ;dealloc lower bound if it was a temp pop ax ;pop off val jmp short ToI4_False ;====================================================================== subttl Like operator support (EB only) page ;====================================================================== subttl Math Error Handler Support page ;*** ;exMathErr ;Purpose: ; Route math errors to the BASIC error handler. ; ;Input: ; bx = BASIC error number ; si = <garbage> ; di = <garbage> ; sp = <garbage> ; bp = <garbage> ; es = <garbage> ; ; grs.GRS_oTxCur = oTx of error ; ;Output: ; none ; ;Exit: ; B$SERR ; ;****************************************************************************** sEnd CODE extrn B$SERR:far sBegin CODE ;Declare error if in a CONST statement CheckCONST: test [SsFlags],SSF_ScanAndExec;Implies CONST is in progress jnz exMathErrFC ;Inside ScanAndExec implies CONST ret ;evaluation is in progress exMathErrFC: mov bx,ER_FC ;Illegal Function call error jmp short Err public exMathErrOVF exMathErrOVF: mov bx,ER_OV ;Overflow error jmp short Err public exMathErrDV0 exMathErrDV0: mov bx,ER_DV0 ;/0 error Err: mov [grs.GRS_oTxCur],si ;Save oTx of error exMathErr: cCall B$SERR,bx ;Declare the error DbHalt CODE,<exMathOp.asm - B$SERR Returned!> ;=============================================================================== subttl Any type executors needed for Forms page ;=============================================================================== subttl opcode to executor maps for math routines page ;These tables are used by scan routines to map opcodes to executors. sEnd CODE sBegin SCAN assumes cs, SCAN NOTIMP MACRO DW 0 ENDM public mUMiOpExe mUMiOpExe: DW exUMiI2 DW exUMiI4 DW exUMiR8 DW exUMiR8 public mNEOpExe mNEOpExe: DW exNEI2 DW exNEI4 DW exNER8 DW exNER8 DW exNESD public mGEOpExe mGEOpExe: DW exGEI2 DW exGEI4 DW exGER8 DW exGER8 DW exGESD public mLEOpExe mLEOpExe: DW exLEI2 DW exLEI4 DW exLER8 DW exLER8 DW exLESD public mEQOpExe mEQOpExe: DW exEQI2 DW exEQI4 DW exEQR8 DW exEQR8 DW exEQSD public mGTOpExe mGTOpExe: DW exGTI2 DW exGTI4 DW exGTR8 DW exGTR8 DW exGTSD public mLTOpExe mLTOpExe: DW exLTI2 DW exLTI4 DW exLTR8 DW exLTR8 DW exLTSD public mOrOpExe mOrOpExe: DW exOrI2 DW exOrI4 public mAndOpExe mAndOpExe: DW exAndI2 DW exAndI4 public mXorOpExe mXorOpExe: DW exXorI2 DW exXorI4 public mNotOpExe mNotOpExe: DW exNotI2 DW exNotI4 public mFnSgnOpExe mFnSgnOpExe: DW exFnSgnI2 DW exFnSgnI4 DW exFnSgnR8 DW exFnSgnR8 public mImpOpExe mImpOpExe: DW exImpI2 DW exImpI4 public mEqvOpExe mEqvOpExe: DW exEqvI2 DW exEqvI4 public mPwrOpExe mPwrOpExe: DW exPwrR8 ; Need I2 entry in case of type mismatch NOTIMP DW exPwrR8 DW exPwrR8 public mMulOpExe mMulOpExe: DW exMulI2 DW exMulI4 DW exMulR8 DW exMulR8 public mAddOpExe mAddOpExe: DW exAddI2 DW exAddI4 DW exAddR8 DW exAddR8 DW exAddSD public mSubOpExe mSubOpExe: DW exSubI2 DW exSubI4 DW exSubR8 DW exSubR8 public mDivOpExe mDivOpExe: DW exDivR8 ; Need I2 entry in case of type mismatch NOTIMP DW exDivR8 DW exDivR8 public mIdvOpExe mIdvOpExe: DW exIdvI2 DW exIdvI4 public mModOpExe mModOpExe: DW exModI2 DW exModI4 public mFnAbsOpExe mFnAbsOpExe: DW exFnAbsI2 DW exFnAbsI4 DW exFnAbsR8 DW exFnAbsR8 public mFnIntOpExe mFnIntOpExe: DW exFnIntInt DW exFnIntInt DW exFnIntR8 DW exFnIntR8 public mFnFixOpExe mFnFixOpExe: DW exFnFixInt DW exFnFixInt DW exFnFixR8 DW exFnFixR8 sEnd SCAN end
#ifndef BEHEMOTH_HPP #define BEHEMOTH_HPP // TODO: move class Behemoth to this file #endif // BEHEMOTH_HPP
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x5476, %r15 nop nop nop nop add $61372, %rdx movl $0x61626364, (%r15) inc %r12 lea addresses_normal_ht+0xc125, %r15 nop nop nop nop nop xor %r10, %r10 mov (%r15), %r11 nop nop xor %r10, %r10 lea addresses_WC_ht+0x142a5, %rsi lea addresses_WC_ht+0x120a5, %rdi nop nop nop nop dec %r9 mov $14, %rcx rep movsl nop nop nop nop xor $30178, %r11 lea addresses_WC_ht+0xdd5d, %rsi lea addresses_normal_ht+0xaea5, %rdi nop nop cmp %rdx, %rdx mov $16, %rcx rep movsb nop nop inc %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r8 push %rbx push %rcx push %rdx // Store lea addresses_PSE+0x7eaf, %rbx nop nop nop nop nop dec %r10 mov $0x5152535455565758, %rdx movq %rdx, (%rbx) nop nop nop add %r12, %r12 // Store lea addresses_RW+0x1b251, %r11 nop nop nop nop cmp %rcx, %rcx mov $0x5152535455565758, %r8 movq %r8, %xmm1 vmovups %ymm1, (%r11) nop nop nop and %r12, %r12 // Store lea addresses_A+0x13aa5, %r8 nop nop nop nop cmp $65232, %r10 mov $0x5152535455565758, %rbx movq %rbx, %xmm4 movntdq %xmm4, (%r8) add $30899, %r12 // Store lea addresses_RW+0xc565, %rbx nop nop nop nop sub $11447, %r12 mov $0x5152535455565758, %r8 movq %r8, %xmm1 vmovups %ymm1, (%rbx) // Exception!!! nop mov (0), %r8 xor %r11, %r11 // Store lea addresses_normal+0x1bf4d, %rdx nop nop nop sub $26693, %rbx movl $0x51525354, (%rdx) nop nop nop sub $17230, %rcx // Store lea addresses_RW+0x18a25, %r8 nop nop nop xor $40242, %rdx movl $0x51525354, (%r8) nop sub %rdx, %rdx // Store lea addresses_WT+0x11aa5, %r8 nop nop nop nop nop cmp $45188, %r12 movb $0x51, (%r8) nop and $14681, %r11 // Store mov $0xa5, %rdx nop nop nop add $36734, %rcx mov $0x5152535455565758, %r10 movq %r10, %xmm6 vmovups %ymm6, (%rdx) nop nop add $20825, %rcx // Faulty Load lea addresses_A+0x13aa5, %r11 nop sub %r8, %r8 mov (%r11), %ecx lea oracles, %rdx and $0xff, %rcx shlq $12, %rcx mov (%rdx,%rcx,1), %rcx pop %rdx pop %rcx pop %rbx pop %r8 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'51': 22} 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 */
; A298679: Start with the hexagonal tile of the Shield tiling and recursively apply the substitution rule. a(n) is the number of square tiles after n iterations. ; Submitted by Jon Maiga ; 0,3,6,33,102,423,1494,5745,21102,79431,295086,1103985,4114710,15367143,57329286,213999153,798569022,2980473543,11122931934,41512040625,154923657702,578185735911,2157812994486,8053078824945,30054477139470,112164880064583,418604942455566,1562255091084273,5830415019228342,21759405791135463,81207206534700774,303069423568893105,1131070481298420702,4221212514509691591,15753779550970541886,58793905740912083505,219421843309598577030,818893467703640654823,3056152027092647181846,11405714641491581793393 mov $1,2 lpb $0 sub $0,1 mov $3,$1 sub $4,$1 mov $1,$4 add $3,$2 mul $3,2 add $2,$3 mov $4,$2 add $4,$3 lpe mov $0,$2 div $0,4 mul $0,3
; ; Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without modification, ; are permitted provided that the following conditions are met: ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. Neither the name of the copyright holder nor the names of its contributors ; may be used to endorse or promote products derived from this software without ; specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ; POSSIBILITY OF SUCH DAMAGE. ; ; vrs4_log2f_bdozr.S ; ; An implementation of the log2f libm function. ; ; Prototype: ; ; float log2f(float x); ; ; ; Algorithm: ; Similar to one presnted in log.S ; include fm.inc FN_PROTOTYPE_FMA3 vrs4_log2f ; local variable storage offsets save_xmm6 EQU 00h save_xmm7 EQU 020h save_xmm8 EQU 040h save_xmm9 EQU 060h save_xmm10 EQU 080h save_xmm11 EQU 0A0h save_xmm12 EQU 0C0h save_xmm13 EQU 0E0h save_xmm14 EQU 0100h save_xmm15 EQU 0120h stack_size EQU 0148h ; We take 8 as the last nibble to allow for ; alligned data movement. text SEGMENT EXECUTE ALIGN 16 PUBLIC fname fname PROC FRAME StackAllocate stack_size SaveAllXMMRegs .ENDPROLOG movupd xmm0, XMMWORD PTR [rcx] vmovaps xmm15,DWORD PTR L__real_one vmovaps xmm13,DWORD PTR L__real_inf vmovaps xmm10,DWORD PTR L__real_nan ; compute exponent part xor eax,eax ;eax=0 vpsrld xmm3,xmm0,23 ;xmm3 = (ux>>23) vpsubd xmm3,xmm3,DWORD PTR L__mask_127 ; xmm3 = (ux>>23) - 127 vandps xmm12,xmm13,xmm0 ;speacial case processing Nans Infs and,Negatives e's ; NaN or inf vpcmpeqd xmm6,xmm13,xmm12 ; if((ux & 07f800000h) == 07f800000h) go to DWORD PTR L__x_is_inf_or_nan ;xmm6 stores the mask for Nans and Infs vaddps xmm11,xmm0,xmm0 vpand xmm11,xmm6,xmm11 ;xmm11 stores the result for Nan's and INfs ;check for negative numbers vxorps xmm1,xmm1,xmm1 vpcmpgtd xmm7,xmm1,xmm0 ; if( x <= 0.0 ) ;xmm7 stores the negative mask for negative numbers vpor xmm6,xmm7,xmm6 ;vpcmov xmm7 ,xmm10,xmm11,xmm7 vandnpd xmm2 , xmm7, xmm11 vandpd xmm7 , xmm10, xmm7 vorpd xmm7 , xmm7, xmm2 ; xmm6 = Mask for Nan Infs and negatives ; xmm7 = result of Nan Infs and negatives vpand xmm2,xmm0,DWORD PTR L__real_mant ; xmm2 = ux & 0007FFFFFh vsubps xmm4,xmm0,xmm15 ; xmm4 = x - 1.0 vpcmpeqd xmm8,xmm3,DWORD PTR L__mask_neg_127 ; if (xexp == 127) ;xmm8 stores the mask for denormal numbers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; commenting this part of the code will not process the denormal inputs ;if 1 vpor xmm11,xmm15,xmm2 vsubps xmm10,xmm11,xmm15 vpand xmm11,xmm10,DWORD PTR L__real_mant ;vpcmov xmm2 ,xmm11,xmm2,xmm8 vandnpd xmm1 , xmm8, xmm2 vandpd xmm2 , xmm11, xmm8 vorpd xmm2 , xmm2, xmm1 vpsrld xmm10,xmm10,23 vpsubd xmm10,xmm10,DWORD PTR L__mask_253 ;vpcmov xmm3 ,xmm10,xmm3,xmm8 vandnpd xmm1 , xmm8, xmm3 vandpd xmm3 , xmm10, xmm8 vorpd xmm3 , xmm3, xmm1 ;endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; vcvtdq2ps xmm5,xmm3 ; xmm5 = xexp ; compute the index into the log tables vpand xmm11,xmm2,DWORD PTR L__mask_mant_all7 ;xmm11 = ux & 0007f0000h vpand xmm8,xmm2,DWORD PTR L__mask_mant8 ; xmm8 = ux & 0007f0000h vpslld xmm8,xmm8,1 ;xmm8 = (ux & 000008000h) << 1 vpaddd xmm1,xmm11,xmm8 ;xmm1 = (ux & 0007f0000h) + ((ux & 000008000h) << 1) ; near one codepath vpand xmm4,xmm4,DWORD PTR L__real_notsign ; xmm4 = fabs (x - 1.0) vcmpltps xmm4,xmm4,DWORD PTR L__real_threshold ; if (xmm4 < real_threshold) go to near_one ;xmm4 stores the mask for nearone values ; F,Y vpsrld xmm9,xmm1,16 vpor xmm2,xmm2,DWORD PTR L__real_half ; xmm2 = Y = ((ux & 0007FFFFFh) | 03f000000h) vpor xmm1,xmm1,DWORD PTR L__real_half ; xmm1 = F = ((ux & 0007f0000h) + ((ux & 000008000h) << 1) | 03f000000h) lea r9,DWORD PTR L__log_F_inv ; lea r10,DWORD PTR L__log2_128_lead_tail xor r8,r8 ; can be removed ;1st vmovd r8d,xmm9 vpsrldq xmm9,xmm9,4 vmovss xmm10,DWORD PTR[r9 + r8 * 4] vmovsd xmm11,QWORD PTR[r10 + r8 * 8] vpslldq xmm10,xmm10,4 ;2nd vmovd r8d,xmm9 vpsrldq xmm9,xmm9,4 vmovss xmm13,DWORD PTR[r9 + r8 * 4] vmovss xmm10,xmm10,xmm13 vmovsd xmm14,QWORD PTR[r10 + r8 * 8] vpslldq xmm14,xmm14,8 vmovsd xmm11,xmm14,xmm11 vpslldq xmm10,xmm10,4 ;3rd vmovd r8d,xmm9 vpsrldq xmm9,xmm9,4 vmovss xmm13,DWORD PTR[r9 + r8 * 4] vmovss xmm10,xmm10,xmm13 vmovsd xmm12,QWORD PTR[r10 + r8 * 8] vpslldq xmm10,xmm10,4 ;4th vmovd r8d,xmm9 vmovss xmm13,DWORD PTR[r9 + r8 * 4] vmovss xmm10,xmm10,xmm13 vmovsd xmm14,QWORD PTR[r10 + r8 * 8] vpslldq xmm14,xmm14,8 vmovsd xmm12,xmm14,xmm12 vpermilps xmm10,xmm10,01Bh ; 1B = 00011011 ; f = F - Y,r = f * inv vsubps xmm1,xmm1,xmm2 ; f = F - Y vmulps xmm1,xmm1,xmm10 ; r = f * log_F_inv[index] ;poly vmovaps xmm3,DWORD PTR L__real_1_over_3 ;vfmaddps xmm2 ,xmm1,xmm3,DWORD PTR L__real_1_over_2 ; 1/3*r + 1/2 vfmadd213ps xmm3,xmm1,DWORD PTR L__real_1_over_2 vmulps xmm14,xmm1,xmm1 ; r*r ;vmovaps xmm3,DWORD PTR L__real_log2_tail ;xmm3 = log2_tail ;vmovaps xmm10,DWORD PTR L__real_log2_lead ;xmm10 = log2_lead ;vfmaddps xmm1 ,xmm14,xmm2,xmm1 ;poly = r + 1/2*r*r + 1/3*r*r*r vfmadd231ps xmm1, xmm14, xmm3 vmulps xmm1,xmm1,DWORD PTR L__real_log2_e ; poly = -log2_e*poly ;vfmsubps xmm3 ,xmm5,xmm3,xmm1 ; z2 = (xexp * log2_tail) - poly ; m*log(2) + log(G) - poly ;vmulps xmm10,xmm10,xmm5 ; z1 = xexp * log2_lead ; xexp = 4321 ; poly = 4321 ; xex poly,p = 44332211 ; t,h = thththth ; add the two ; xmm1 = poly, xmm5 = xex xmm11,p=lead,tail xmm12=lead/tail vpxor xmm13,xmm13,xmm13 vunpcklps xmm9,xmm5,xmm1 ; xmm9 = 2211 in xexp,poly order vunpckhps xmm10,xmm5,xmm1 ; xmm10 = 4433 in xexp,poly order vinsertf128 ymm9 ,ymm9,xmm10,1 ; ymm9 = pol xexp,y - 44332211 in poly,xexp order vinsertf128 ymm10 ,ymm11,xmm12,1 ; thththth in z1,z2 order vaddps ymm11,ymm10,ymm9 ; z z1,2 = (- poly + log_128_tail[index]),(xexp + log_128_lead[index]) vhaddps ymm13,ymm11,ymm13 vextractf128 xmm14,ymm13,1 ; vmovlhps xmm9,xmm13,xmm14 ;xmm9 stores the result ;Now calculate for values near one ; r = x - 1.0; vmovaps xmm2,DWORD PTR L__real_two ; xmm2 = 2.0 vpand xmm11,xmm0,DWORD PTR L__real_notsign ;get the zero input masks vpxor xmm12,xmm12,xmm12 vsubps xmm0,xmm0,xmm15 ; xmm0 = r = = x - 1.0 vpcmpeqd xmm12,xmm11,xmm12 ; xmm12 stores the mask for zero ; u = r / (2.0 + r) vaddps xmm2,xmm2,xmm0 ; (r+2.0) vdivps xmm1,xmm0,xmm2 ; u = r / (2.0 + r) ; correction = r * u vmulps xmm10,xmm0,xmm1 ; correction = u*r ; u = u + u; vaddps xmm1,xmm1,xmm1 ; u = u+u vmulps xmm2,xmm1,xmm1 ; v = u^2 ; r2 = (u * v * (ca_1 + v * ca_2) - correction) vmulps xmm3,xmm1,xmm2 ; u^3 vmovaps xmm5,DWORD PTR L__real_ca2 ; xmm5 = ca_2 ;vfmaddps xmm2 ,xmm5,xmm2,DWORD PTR L__real_ca1 ; ca1 + ca2 * v ;vfmsubps xmm2 ,xmm2,xmm3,xmm10 ; r2 = (ca1 + ca2 * v) * u^3 - correction vfmadd213ps xmm2, xmm5, DWORD PTR L__real_ca1 vfmsub213ps xmm2 , xmm3, xmm10 ; r + r2 vpand xmm5,xmm0,DWORD PTR L__mask_lower vsubps xmm0,xmm0,xmm5 vaddps xmm2,xmm2,xmm0 vmulps xmm1,xmm2,DWORD PTR L__real_log2_e_lead vmulps xmm0,xmm5,DWORD PTR L__real_log2_e_tail vmulps xmm5,xmm5,DWORD PTR L__real_log2_e_lead ;vfmaddps xmm0 ,xmm2,DWORD PTR L__real_log2_e_tail,xmm0 vfmadd231ps xmm0, xmm2, DWORD PTR L__real_log2_e_tail vaddps xmm0,xmm0,xmm1 vaddps xmm0,xmm0,xmm5 ; till here I have ; xmm0 = DWORD PTR L__near_one results ; xmm9 = away from 1.0 results ; Masks ;xmm4 stores the mask for nearone values ;xmm12 stores the mask for 0.0 ;xmm6 = Mask for Nan Infs e's and negatives ;xmm7 = result of Nan Infs e's and negatives vmovaps xmm5,DWORD PTR L__real_ninf ;vmovaps xmm14,DWORD PTR L__real_inf ;vpcmov xmm0 ,xmm0,xmm9,xmm4 ; xmm0 stores nearone and away from one results ;vpcmov xmm0 ,xmm7,xmm0,xmm6 ;vpcmov xmm0 ,xmm5,xmm0,xmm12 vandnpd xmm13 , xmm4, xmm9 vandpd xmm0 , xmm0, xmm4 vorpd xmm0 , xmm0, xmm13 vandnpd xmm13 , xmm6, xmm0 vandpd xmm0 , xmm7, xmm6 vorpd xmm0 , xmm0, xmm13 vandnpd xmm13 , xmm12, xmm0 vandpd xmm0 , xmm5, xmm12 vorpd xmm0 , xmm0, xmm13 RestoreAllXMMRegs StackDeallocate stack_size ret fname endp TEXT ENDS data SEGMENT READ CONST SEGMENT ALIGN 16 L__real_one DQ 03f8000003f800000h ; 1.0 DQ 03f8000003f800000h L__real_two DQ 04000000040000000h ; 1.0 DQ 04000000040000000h L__real_ninf DQ 0ff800000ff800000h ; -inf DQ 0ff800000ff800000h L__real_inf DQ 07f8000007f800000h ; +inf DQ 07f8000007f800000h L__real_nan DQ 07fc000007fc00000h ; NaN DQ 07fc000007fc00000h L__real_ef DQ 0402DF854402DF854h ; float e DQ 0402DF854402DF854h L__real_neg_qnan DQ 0ffc00000ffc00000h DQ 0ffc00000ffc00000h L__real_sign DQ 08000000080000000h ; sign bit DQ 08000000080000000h L__real_notsign DQ 07ffFFFFF7ffFFFFFh ; ^sign bit DQ 07ffFFFFF7ffFFFFFh L__real_qnanbit DQ 00040000000400000h ; quiet nan bit DQ 00040000000400000h L__real_mant DQ 0007FFFFF007FFFFFh ; mantissa bits DQ 0007FFFFF007FFFFFh L__mask_127 DQ 00000007f0000007fh ; DQ 00000007f0000007fh L__mask_neg_127 DQ 0FFFFFF81FFFFFF81h ; DQ 0FFFFFF81FFFFFF81h L__mask_mant_all7 DQ 0007f0000007f0000h DQ 0007f0000007f0000h L__mask_mant8 DQ 00000800000008000h DQ 00000800000008000h L__real_ca1 DQ 03DAAAAAB3DAAAAABh ; 8.33333333333317923934e-02 DQ 03DAAAAAB3DAAAAABh L__real_ca2 DQ 03C4CCCCD3C4CCCCDh ; 1.25000000037717509602e-02 DQ 03C4CCCCD3C4CCCCDh L__real_log2_lead DQ 03F3170003F317000h ; 0.693115234375 DQ 03F3170003F317000h L__real_log2_tail DQ 03805FDF43805FDF4h ; 0.000031946183 DQ 03805FDF43805FDF4h L__real_half DQ 03f0000003f000000h ; 1/2 DQ 03f0000003f000000h L__real_log2_e DQ 0bfb8aa3bbfb8aa3bh DQ 0bfb8aa3bbfb8aa3bh L__real_log2_e_lead DQ 03FB800003FB80000h ; 1.4375000000 DQ 03FB800003FB80000h L__real_log2_e_tail DQ 03BAA3B293BAA3B29h ; 0.0051950408889633 DQ 03BAA3B293BAA3B29h L__mask_lower DQ 0ffff0000ffff0000h DQ 0ffff0000ffff0000h ALIGN 16 L__mask_253 DQ 0000000fd000000fdh DQ 0000000fd000000fdh L__real_threshold DQ 03d8000003d800000h DQ 03d8000003d800000h L__real_1_over_3 DQ 03eaaaaab3eaaaaabh DQ 03eaaaaab3eaaaaabh L__real_1_over_2 DQ 03f0000003f000000h DQ 03f0000003f000000h ALIGN 16 ;L__log_128_lead L__log_128_tail L__log2_128_lead_tail DD 000000000h ;lead DD 000000000h ;tail DD 03c37c000h ;lead DD 0374a16ddh ;tail DD 03cb70000h DD 037f2d0b8h DD 03d08c000h DD 0381a3aa2h DD 03d35c000h DD 037b4dd63h DD 03d624000h DD 0383f5721h DD 03d874000h DD 0384e27e8h DD 03d9d4000h DD 0380bf749h DD 03db30000h DD 0387dbeb2h DD 03dc8c000h DD 037216e46h DD 03dde4000h DD 03684815bh DD 03df38000h DD 0383b045fh DD 03e044000h DD 0390b119bh DD 03e0ec000h DD 0391a32eah DD 03e194000h DD 038ba789eh DD 03e238000h DD 039553f30h DD 03e2e0000h DD 03651cfdeh DD 03e380000h DD 039685a9dh DD 03e424000h DD 039057a05h DD 03e4c4000h DD 0395ba0efh DD 03e564000h DD 0396bc5b6h DD 03e604000h DD 03936d9bbh DD 03e6a4000h DD 038772619h DD 03e740000h DD 039017ce9h DD 03e7dc000h DD 03902d720h DD 03e83c000h DD 038856dd8h DD 03e888000h DD 03941f6b4h DD 03e8d4000h DD 03980b652h DD 03e920000h DD 03980f561h DD 03e96c000h DD 039443f13h DD 03e9b8000h DD 038926752h DD 03ea00000h DD 039c8c763h DD 03ea4c000h DD 0391e12f3h DD 03ea94000h DD 039b7bf89h DD 03eae0000h DD 036d1cfdeh DD 03eb28000h DD 038c7f233h DD 03eb70000h DD 039087367h DD 03ebb8000h DD 038e95d3fh DD 03ec00000h DD 038256316h DD 03ec44000h DD 039d38e5ch DD 03ec8c000h DD 0396ea247h DD 03ecd4000h DD 0350e4788h DD 03ed18000h DD 0395d829fh DD 03ed5c000h DD 039c30f2fh DD 03eda0000h DD 039fd7ee7h DD 03ede8000h DD 03872e9e7h DD 03ee2c000h DD 03897d694h DD 03ee70000h DD 03824923ah DD 03eeb0000h DD 039ea7c06h DD 03eef4000h DD 039a7fa88h DD 03ef38000h DD 0391aa879h DD 03ef78000h DD 039dace65h DD 03efbc000h DD 039215a32h DD 03effc000h DD 039af3350h DD 03f01c000h DD 03a7b5172h DD 03f040000h DD 0389cf27fh DD 03f060000h DD 03902806bh DD 03f080000h DD 03909d8a9h DD 03f0a0000h DD 038c9faa1h DD 03f0c0000h DD 037a33dcah DD 03f0dc000h DD 03a6623d2h DD 03f0fc000h DD 03a3c7a61h DD 03f11c000h DD 03a083a84h DD 03f13c000h DD 039930161h DD 03f15c000h DD 035d1cfdeh DD 03f178000h DD 03a2d0ebdh DD 03f198000h DD 0399f1aadh DD 03f1b4000h DD 03a67ff6dh DD 03f1d4000h DD 039ecfea8h DD 03f1f0000h DD 03a7b26f3h DD 03f210000h DD 039ec1fa6h DD 03f22c000h DD 03a675314h DD 03f24c000h DD 0399e12f3h DD 03f268000h DD 03a2d4b66h DD 03f288000h DD 0370c3845h DD 03f2a4000h DD 0399ba329h DD 03f2c0000h DD 03a1044d3h DD 03f2dc000h DD 03a49a196h DD 03f2f8000h DD 03a79fe83h DD 03f318000h DD 03905c7aah DD 03f334000h DD 039802391h DD 03f350000h DD 039abe796h DD 03f36c000h DD 039c65a9dh DD 03f388000h DD 039cfa6c5h DD 03f3a4000h DD 039c7f593h DD 03f3c0000h DD 039af6ff7h DD 03f3dc000h DD 039863e4dh DD 03f3f8000h DD 0391910c1h DD 03f414000h DD 0369d5be7h DD 03f42c000h DD 03a541616h DD 03f448000h DD 03a1ee960h DD 03f464000h DD 039c38ed2h DD 03f480000h DD 038e61600h DD 03f498000h DD 03a4fedb4h DD 03f4b4000h DD 039f6b4abh DD 03f4d0000h DD 038f8d3b0h DD 03f4e8000h DD 03a3b3faah DD 03f504000h DD 0399fb693h DD 03f51c000h DD 03a5cfe71h DD 03f538000h DD 039c5740bh DD 03f550000h DD 03a611eb0h DD 03f56c000h DD 039b079c4h DD 03f584000h DD 03a4824d7h DD 03f5a0000h DD 039439a54h DD 03f5b8000h DD 03a1291eah DD 03f5d0000h DD 03a6d3673h DD 03f5ec000h DD 03981c731h DD 03f604000h DD 03a0da88fh DD 03f61c000h DD 03a53945ch DD 03f638000h DD 03895ae91h DD 03f650000h DD 03996372ah DD 03f668000h DD 039f9a832h DD 03f680000h DD 03a27eda4h DD 03f698000h DD 03a4c764fh DD 03f6b0000h DD 03a6a7c06h DD 03f6cc000h DD 0370321ebh DD 03f6e4000h DD 03899ab3fh DD 03f6fc000h DD 038f02086h DD 03f714000h DD 0390a1707h DD 03f72c000h DD 039031e44h DD 03f744000h DD 038c6b362h DD 03f75c000h DD 0382bf195h DD 03f770000h DD 03a768e36h DD 03f788000h DD 03a5c503bh DD 03f7a0000h DD 03a3c1179h DD 03f7b8000h DD 03a15de1dh DD 03f7d0000h DD 039d3845dh DD 03f7e8000h DD 0395f263fh DD 03f800000h DD 000000000h ALIGN 16 L__log_F_inv DD 040000000h DD 03ffe03f8h DD 03ffc0fc1h DD 03ffa232dh DD 03ff83e10h DD 03ff6603eh DD 03ff4898dh DD 03ff2b9d6h DD 03ff0f0f1h DD 03fef2eb7h DD 03fed7304h DD 03febbdb3h DD 03fea0ea1h DD 03fe865ach DD 03fe6c2b4h DD 03fe52598h DD 03fe38e39h DD 03fe1fc78h DD 03fe07038h DD 03fdee95ch DD 03fdd67c9h DD 03fdbeb62h DD 03fda740eh DD 03fd901b2h DD 03fd79436h DD 03fd62b81h DD 03fd4c77bh DD 03fd3680dh DD 03fd20d21h DD 03fd0b6a0h DD 03fcf6475h DD 03fce168ah DD 03fcccccdh DD 03fcb8728h DD 03fca4588h DD 03fc907dah DD 03fc7ce0ch DD 03fc6980ch DD 03fc565c8h DD 03fc43730h DD 03fc30c31h DD 03fc1e4bch DD 03fc0c0c1h DD 03fbfa030h DD 03fbe82fah DD 03fbd6910h DD 03fbc5264h DD 03fbb3ee7h DD 03fba2e8ch DD 03fb92144h DD 03fb81703h DD 03fb70fbbh DD 03fb60b61h DD 03fb509e7h DD 03fb40b41h DD 03fb30f63h DD 03fb21643h DD 03fb11fd4h DD 03fb02c0bh DD 03faf3adeh DD 03fae4c41h DD 03fad602bh DD 03fac7692h DD 03fab8f6ah DD 03faaaaabh DD 03fa9c84ah DD 03fa8e83fh DD 03fa80a81h DD 03fa72f05h DD 03fa655c4h DD 03fa57eb5h DD 03fa4a9cfh DD 03fa3d70ah DD 03fa3065eh DD 03fa237c3h DD 03fa16b31h DD 03fa0a0a1h DD 03f9fd80ah DD 03f9f1166h DD 03f9e4cadh DD 03f9d89d9h DD 03f9cc8e1h DD 03f9c09c1h DD 03f9b4c70h DD 03f9a90e8h DD 03f99d723h DD 03f991f1ah DD 03f9868c8h DD 03f97b426h DD 03f97012eh DD 03f964fdah DD 03f95a025h DD 03f94f209h DD 03f944581h DD 03f939a86h DD 03f92f114h DD 03f924925h DD 03f91a2b4h DD 03f90fdbch DD 03f905a38h DD 03f8fb824h DD 03f8f177ah DD 03f8e7835h DD 03f8dda52h DD 03f8d3dcbh DD 03f8ca29ch DD 03f8c08c1h DD 03f8b7034h DD 03f8ad8f3h DD 03f8a42f8h DD 03f89ae41h DD 03f891ac7h DD 03f888889h DD 03f87f781h DD 03f8767abh DD 03f86d905h DD 03f864b8ah DD 03f85bf37h DD 03f853408h DD 03f84a9fah DD 03f842108h DD 03f839930h DD 03f83126fh DD 03f828cc0h DD 03f820821h DD 03f81848eh DD 03f810204h DD 03f808081h DD 03f800000h CONST ENDS data ENDS END
; ; BASIC-DOS Boot Code ; ; @author Jeff Parsons <Jeff@pcjs.org> ; @copyright (c) 2020-2021 Jeff Parsons ; @license MIT <https://basicdos.com/LICENSE.txt> ; ; This file is part of PCjs, a computer emulation software project at pcjs.org ; BIOSEQU equ 1 include macros.inc include bios.inc include disk.inc include devapi.inc include version.inc ; TWAIT equ 16 ; timed wait is now disabled BOOT segment word public 'CODE' ; ; We "ORG" at BOOT_SECTOR_LO rather than BOOT_SECTOR, because after part1 ; finishes, we're running at BOOT_SECTOR_LO. ; org BOOT_SECTOR_LO ASSUME CS:BOOT, DS:NOTHING, ES:NOTHING, SS:NOTHING ; ; All we assume on entry is: ; ; CS = 0 ; IP = 7C00h ; DL = drive # (eg, 00h or 80h) ; ; The original IBM PC had these additional inputs: ; ; DS = ES = 0 ; SS:SP = 30h:100h ; ; which apparently didn't become a standard, because if we rely on those ; other assumptions, we can run into boot failures. ; start: cld jmp short start1 DEFLBL PART1_COPY ; start of PART1 code/data mybpb: BPB <,512,1,1,2,64,320,MEDIA_160K,1,8,1,0,0,0,8,3,7> DEV_FILE db "IBMBIO COM" DOS_FILE db "IBMDOS COM" CFG_FILE db "CONFIG SYS",-1 ; ; This intermediate jump could be eliminated if I used a long jump above, ; but I wanted to make this boot sector unique in the annals of "future" boot ; sectors, by using CLD (FCh) as the first opcode. Will it confuse "future" ; Intel boot sector detection code? Maybe. Do I care? No. ; start1: jmp short part1 ; can't quite make it in one jump ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; get_chs ; ; Get CHS from LBA in AX, using BPB at DS:SI. ; ; Inputs: ; AX = LBA ; DS:SI -> BPB ; ; Outputs: ; DH = head #, DL = drive # ; CH = cylinder #, CL = sector ID ; ; Modifies: ; AX, CX, DX ; DEFPROC get_chs sub dx,dx ; DX:AX is LBA div [si].BPB_CYLSECS; AX = cylinder, DX = remaining sectors xchg al,ah ; AH = cylinder, AL = cylinder bits 8-9 ror al,1 ; future-proofing: saving cylinder bits 8-9 ror al,1 xchg cx,ax ; CH = cylinder # xchg ax,dx ; AX = remaining sectors from last divide div byte ptr [si].BPB_TRACKSECS mov dh,al ; DH = head # (quotient of last divide) or cl,ah ; CL = sector # (remainder of last divide) inc cx ; LBA are zero-based, sector IDs are 1-based mov dl,[si].BPB_DRIVE ret ENDPROC get_chs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; get_lba ; ; Get LBA from CLN in AX, using BPB at DS:SI. ; ; Inputs: ; AX = CLN ; DS:SI -> BPB ; ; Outputs: ; If successful, carry clear, AX = LBA, CX = sectors per cluster ; If unsuccessful, carry set ; ; Modifies: ; AX, CX, DX ; DEFPROC get_lba sub ax,2 jb gl9 sub cx,cx mov cl,[si].BPB_CLUSSECS mul cx add ax,[si].BPB_LBADATA gl9: ret ENDPROC get_lba ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; read_sector ; ; Read 1 sector into ES:DI using LBA in AX and BPB at DS:SI. ; ; Inputs: ; AX = LBA ; DS:SI -> BPB ; ES:DI -> buffer ; ; Output: ; Carry clear if successful, set if error (see AH for reason) ; ; Modifies: ; AX ; DEFPROC read_sector push bx push cx push dx call get_chs mov ax,(FDC_READ SHL 8) OR 1 mov bx,di ; ES:BX = address int INT_FDC ; AX and carry are whatever the ROM returns pop dx pop cx pop bx ret ENDPROC read_sector ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; print ; ; Print the null-terminated string at DS:SI. ; ; Inputs: ; DS:SI -> string ; ; Outputs: ; None ; ; Modifies: ; AX, BX, SI ; DEFPROC printp mov ah,VIDEO_TTYOUT mov bh,0 int INT_VIDEO print label near lodsb test al,al jnz printp ret ENDPROC printp DEFLBL PART1_COPY_END ; end of PART1 code/data to copy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; part1 ; ; Move the DPT from ROM to RAM so we can tweak a few values, and then move ; ourselves to low memory where we'll be out of the way, should we ever need ; to load more than 32K. ; DEFLBL PART1 push cs pop es ASSUME ES:BIOS lds si,dword ptr es:[INT_DPT*4] mov cx,size DPT ; DS:SI -> original table (in ROM) mov di,offset DPT_ACTIVE ; ES:DI -> DPT_ACTIVE push di rep movsb pop si push cs pop ds ASSUME DS:BIOS mov [si].DP_SPECIFY1,0DFh ; change step rate to 6ms mov [si].DP_HEADSETTLE,cl ; and change head settle time to 0ms mov ds:[INT_DPT*4],si mov ds:[INT_DPT*4+2],ds ; update INT_DPT vector mov si,BOOT_SECTOR ; now move boot sector down mov ch,1 ; mov cx,512 (aka [mybpb].BPB_SECBYTES) mov di,BOOT_SECTOR_LO rep movsw mov ax,offset main jmp ax ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; main ; ; If there's a hard disk, but we didn't boot from it, display a prompt. ; ; If there's no hard disk (or we were told to bypass it), then look for ; all the the required files in the root directory (starting with DEV_FILE), ; load the first sector of the first file, and continue booting from there. ; DEFPROC main,far ; now at BOOT_SECTOR_LO mov ds:[mybpb].BPB_DRIVE,dl ; save boot drive (DL) in BPB IFDEF DEBUG cmp ds:[BOOT_KEY].LOB,cl ; boot key zero? jne m0 ; no, force a boot prompt ENDIF test dl,dl ; hard drive? jl find ; yes mov ah,HDC_GETPARMS ; get hard drive parameters mov dl,80h ; int INT_FDC ; jc find ; jump if call failed test dl,dl ; any hard disks? jz find ; jump if no hard disks m0: mov si,offset product call print ; print the product name call print ; then the prompt call wait ; wait for a key jcxz hard ; jump if no key pressed mov [BOOT_KEY],cx ; save boot key ; ; Find all the files in our file list, starting with DEV_FILE. ; find: mov si,offset mybpb ; SI -> BPB mov dx,[si].BPB_LBAROOT ; DX = root dir LBA m1: mov ax,dx ; AX = LBA mov di,offset DIR_SECTOR ; DI = dir sector call read_sector ; read it jc boot_error ; jump if error m2: mov cx,3 ; CX = # files left to find mov bx,offset DEV_FILE ; first file to find m3: cmp byte ptr [bx],ch ; more files to find? jl m7 ; no, see if we're done jg m6 ; no, this file hasn't been found yet m4: dec cx ; reduce the # files left m5: add bx,size DIR_NAME ; partly, skip to next filename jmp m3 ; and check again m6: call find_dirent ; jz m4 ; we found a file jmp m5 ; no, try the next file m7: jcxz read ; all files found, go read inc dx ; DX = next dir LBA cmp dx,[si].BPB_LBADATA ; exhausted root directory? jb m1 ; jump if not exhausted dec cx ; only 1 file missing? jnz file_error ; no cmp [CFG_FILE],ch ; was the missing file CFG_FILE? jnz read ; yes, that's OK file_error label near IFDEF LATER mov si,offset errmsg2 jmp short hltmsg ENDIF boot_error label near mov si,offset errmsg1 hltmsg: call print jmp $ ; "halt" ; ; There's a hard disk and no response, so boot from hard disk instead. ; hard: mov al,[CRT_MODE] cbw ; AH = 00h (SET MODE) int INT_VIDEO mov ax,0201h ; AH = 02h (READ), AL = 1 sector inc cx ; CH = CYL 0, CL = SEC 1 mov dx,0080h ; DH = HEAD 0, DL = DRIVE 80h mov bx,BOOT_SECTOR ; ES:BX -> BOOT_SECTOR int INT_FDC ; read it jc boot_error jmp bx ; jump to the hard disk boot sector ; ; We found all the required files, so read the first sector of the first file. ; read: mov bx,offset DEV_FILE mov ax,[bx+2] ; AX = CLN call get_lba jc boot_error call read_sector ; DI -> DIR_SECTOR jc boot_error ; ; Move the non-boot code from this sector (ie, the first chunk of DEV_FILE) ; into its final resting place (ie, BIOS_END) and save that ending address as ; the next load address. ; move: mov ax,[si].BPB_SECBYTES mov si,offset PART2_COPY mov di,offset BIOS_END mov cx,offset DIR_SECTOR add cx,ax sub cx,si rep movsb ; move first bit of DEV_FILE jmp near ptr part2 + 2 ; jump to next part (skip fake INT 20h) ENDPROC main ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; find_dirent ; ; Find DIRENT in sector at ES:DI using filename at DS:BX. ; ; Inputs: ; DS:BX -> filename ; ES:DI -> directory sector ; ; Outputs: ; Zero flag set if match (in DI), carry set if end of directory ; ; Modifies: ; AX ; DEFPROC find_dirent push cx ; CH is zero on entry push si push di mov ax,[si].BPB_SECBYTES add ax,di ; AX -> end of sector data dec ax ; ensure DI will never equal AX fd1: cmp byte ptr [di],ch je file_error ; 0 indicates end of allocated entries mov si,bx mov cl,size DIR_NAME repe cmpsb jz fd8 add di,cx add di,size DIRENT - 11 cmp di,ax jb fd1 jmp short fd9 fd8: mov [bx],cl ; zero the first byte of the filename mov ax,[di-11].DIR_CLN mov [bx+2],ax ; with cluster number and size, mov ax,[di-11].DIR_SIZE.OFF mov [bx+4],ax ; since we're done with the filename mov ax,[di-11].DIR_SIZE.SEG mov [bx+6],ax fd9: pop di pop si pop cx ret ENDPROC find_dirent ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; wait (for a key) ; ; Waits some number of ticks, or until a key is pressed. ; ; NOTE: There are now two variations of this function: if TWAIT is defined, ; then we perform the original timed wait (91 ticks or 5 seconds); otherwise, ; we wait indefinitely for a key, and if the key is ESC, then we return 0, ; indicating that our boot code should be bypassed. ; ; There are two main advantages to NOT using TWAIT: 1) faster-than-normal ; PCJS machines generate ticks faster as well, so that the IBM ROM POST tests ; won't fail, which means the delay may be too short; and 2) it makes the boot ; code smaller. ; ; Inputs: ; None ; ; Outputs: ; CX = char code (lo), scan code (hi); 0 if no key pressed ; ; Modifies: ; AX, CX (and DX if TWAIT is defined) ; DEFPROC wait IFDEF TWAIT mov ah,TIME_GETTICKS int INT_TIME ; CX:DX is initial tick count add ax,91 * TWAIT mov dx,cx adc dx,0 ; DX:AX is target tick count ws1: push dx push ax mov ah,KBD_CHECK int INT_KBD jz ws2 pop ax pop dx mov ah,KBD_READ int INT_KBD xchg cx,ax ; CL = char code, CH = scan code jmp short ws9 ws2: mov ah,TIME_GETTICKS int INT_TIME ; CX:DX is updated tick count pop ax ; subtract target value on the stack sub dx,ax pop dx sbb cx,dx ; as long as the target value is bigger jc ws1 ; carry will be set sub cx,cx ; no key was pressed in time ELSE mov ah,KBD_READ int INT_KBD cmp al,CHR_ESCAPE ; escape key? xchg cx,ax ; CL = char code, CH = scan code jne ws9 sub cx,cx ; yes, zero CX ENDIF ws9: mov si,offset crlf call print ret ENDPROC wait product db "BASIC-DOS " VERSION_STR crlf db 13,10,0 prompt db "Press a key to start...",0 errmsg1 db "System boot error, halted",0 IFDEF LATER errmsg2 db "System file(s) missing, halted",0 ENDIF DEFLBL PART1_END ASSERT <offset PART1_END - offset start>,LE,510 org BOOT_SECTOR_LO + 510 dw 0AA55h ; ; The rest of the boot code will be loaded into DIR_SECTOR. ; org DIR_SECTOR_OFF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Part 2 of the boot process: ; ; 1) Copy critical data from PART1 to PART2, before FAT reads (if any) ; overwrite it. ; ; 2) Load the rest of DEV_FILE; the file need not be first, nor ; contiguous, since we read the FAT to process the cluster chain; ; the downside is that any FAT sectors read will overwrite the first ; half of the boot code, so any code/data that must be copied between ; the halves should be copied above (see step 1). ; ; 3) Locate DEV_FILE's "init" code, which resides just beyond all the ; device drivers, and call it. It must return the next available ; load address. ; DEFPROC part2,far int 20h ; fake DOS terminate call push di ; copy PART1 data to PART2 mov si,offset PART1_COPY mov di,offset PART2_COPY mov cx,offset PART1_COPY_END - offset PART1_COPY rep movsb mov di,offset FAT_BUFHDR mov cx,offset DIR_SECTOR sub cx,di ; now we can zero the area rep stosb ; from FAT_BUFHDR to DIR_SECTOR pop di ; restore DEV_FILE read address mov bx,offset DEV_FILE2 sub [bx+4],ax ; reduce DEV_FILE file size by AX sbb [bx+6],cx ; (CX is zero) mov si,offset PART2_COPY call read_data ; read the rest of DEV_FILE (see BX) into DI ; ; To find the entry point of DEV_FILE's init code, we must walk the ; driver headers. And since they haven't been chained together yet (that's ; the DEV_FILE init code's job), we do this by simply "hopping" over all ; the headers. ; mov di,offset BIOS_END; BIOS's end is DEV_FILE's beginning mov cx,100 ; put a limit on this loop i1: mov ax,[di] ; AX = current driver's total size cmp ax,-1 ; have we reached end of drivers? je i3 ; yes add di,ax loop i1 i2: jmp load_error ; ; Prepare to "call" the DEV_FILE entry point, with DI -> end of drivers. ; i3: mov [DD_LIST].OFF,ax; initialize driver list head (to -1) mov ax,di test ax,0Fh ; paragraph boundary? jnz i2 ; no push cs mov cx,offset part3 push cx ; far return address -> part3 mov cx,4 shr ax,cl push ax push cx ; far "call" address -> CS:0004h ret ; "call" ENDPROC part2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Part 3 of the boot process: ; ; 1) When DEV_FILE returns, load DOS_FILE at the next load address, ; and then jump to it. At that point, we never return to this code. ; DEFPROC part3,far mov si,offset PART2_COPY ; ; Convert ES:DI to SEG:0, and then load ES with the new segment ; add di,15 mov cl,4 shr di,cl mov es,di ASSUME ES:NOTHING sub di,di ; ES:DI now converted mov bx,offset DOS_FILE2 call read_file ; load DOS_FILE push di mov bx,offset CFG_FILE2 sub dx,dx ; default CFG_FILE size is zero cmp [bx],dl ; did we find CFG_FILE? jne i9 ; no push [bx+4] ; push CFG_FILE size (assume < 64K) call read_file ; load CFG_FILE above DOS_FILE pop dx ; DX = CFG_FILE size i9: pop bx ; BX = CFG_FILE data address push es mov ax,2 ; skip the fake INT 20h in DOS_FILE push ax ; far "jmp" address -> CS:0002h mov ax,offset PART2_COPY ret ; AX = offset of BPB ENDPROC part3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; read_data ; ; Read file data into ES:DI using directory info at BX and BPB at DS:SI. ; ; Inputs: ; BX -> DIR info ; DS:SI -> BPB ; ES:DI -> buffer ; ; Output: ; ES:DI updated to next available address ; ; Modifies: ; AX, CX, DX ; DEFPROC read_data ; ; Sysinit will initialize the buffer chain, but it still assumes that any ; buffer we used (ie, FAT_BUF) will contain valid BUF_DRIVE and BUF_LBA values, ; so that we don't needlessly throw good disk data away. This code was loaded ; into DIR_BUF, so DIR_BUF is already toast, which is why we already zeroed ; DIR_BUFHDR. ; mov al,[si].BPB_DRIVE mov [FAT_BUFHDR].BUF_DRIVE,al mov dx,1 ; DX = sectors already read rd1: cmp word ptr [bx+4],0 jne rd2 cmp word ptr [bx+6],0 je rd3 ; file size is zero, carry clear rd2: mov ax,[bx+2] ; AX = CLN cmp ax,2 ; too low? jc read_error ; yes cmp ax,CLN_END ; too high? jae read_error ; yes call read_cluster ; read cluster into DI jc read_error ; error mul [si].BPB_SECBYTES; DX:AX = number of sectors read add di,ax ; adjust next read address sub [bx+4],ax ; reduce file size sbb [bx+6],dx ; (DX is zero) jnc rd5 ; jump if file size still positive add di,[bx+4] ; rewind next load address by rd3: ret ; the amount of file size underflow read_error label near jmp load_error rd5: mov ax,[bx+2] ; AX = CLN push es mov es,dx ; relies on DX still being zero ASSUME ES:BIOS call read_fat ; DX = next CLN pop es ASSUME ES:NOTHING mov [bx+2],dx ; update CLN read_file label near sub dx,dx ; normal case: read all cluster sectors jmp rd1 ENDPROC read_data ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; read_fat (see also: get_cln in disk.asm) ; ; For the CLN in AX, get the next CLN in DX, using the BPB at DS:SI. ; ; Inputs: ; AX = CLN ; DS:SI -> BPB ; ; Outputs: ; DX (next CLN) ; ; Modifies: ; AX, CX, DX, BP ; DEFPROC read_fat push bx push di ; ; We observe that the FAT sector # containing a 12-bit CLN is: ; ; (CLN * 12) / 4096 ; ; assuming a 512-byte sector with 4096 or 2^12 bits. The expression ; can be simplified to (CLN * 12) SHR 12, or (CLN * 3) SHR 10, or simply ; (CLN + CLN + CLN) SHR 10. ; ; Next, we need the nibble offset within the sector, which is: ; ; ((CLN * 12) % 4096) / 4 ; ; TODO: If we're serious about being sector-size-agnostic, our BPB should ; contain a (precalculated) LOG2 of BPB_SECBYTES, to avoid hard-coded shifts. ; That'll be tough to do without wasting buffer memory though, since sectors ; can be as large as 1K. ; mov bx,ax add ax,ax add ax,bx mov bx,ax mov cl,10 shr ax,cl ; AX = FAT sector ((CLN * 3) SHR 10) add ax,[si].BPB_RESSECS ; ; Next, we need the nibble offset within the sector, which is: ; ; ((CLN * 12) % 4096) / 4 ; and bx,3FFh ; nibble offset (assuming 1024 nibbles) mov di,offset FAT_SECTOR cmp ax,[FAT_BUFHDR].BUF_LBA je rf1 mov [FAT_BUFHDR].BUF_LBA,ax call read_sector2 jc read_error rf1: mov bp,bx ; save nibble offset in BP shr bx,1 ; BX -> byte, carry set if odd nibble mov dl,[di+bx] inc bx cmp bp,03FFh ; at the sector boundary? jb rf2 ; no inc [FAT_BUFHDR].BUF_LBA mov ax,[FAT_BUFHDR].BUF_LBA call read_sector2 ; read next FAT LBA jc read_error sub bx,bx rf2: mov dh,[di+bx] shr bp,1 ; was that an odd nibble again? jc rf8 ; yes and dx,0FFFh ; no, so make sure top 4 bits clear jmp short rf9 rf8: mov cl,4 shr dx,cl ; otherwise, shift all 12 bits down rf9: pop di pop bx ret ENDPROC read_fat ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; read_cluster ; ; Read cluster AX into memory at ES:DI, using BPB at DS:SI. ; ; Inputs: ; AX = CLN ; DX = # sectors already read from cluster (usually 0) ; DS:SI -> BPB ; ES:DI -> buffer ; ; Output: ; If successful, carry clear, AX = # sectors read ; If unsuccessful, carry set, AH = BIOS error code ; ; Modifies: ; AX, CX, DX ; DEFPROC read_cluster push dx ; DX = sectors already read call get_lba2 ; AX = LBA, CX = sectors/cluster pop dx jc rc9 add ax,dx ; adjust LBA by sectors already read sub cx,dx ; sectors remaining? jbe rc8 ; no push cx push di rc1: push ax ; save LBA call read_sector2 pop dx ; DX = previous LBA jc rc2 add di,[si].BPB_SECBYTES inc dx ; advance LBA xchg ax,dx ; and move to AX loop rc1 ; keep looping until cluster is fully read rc2: pop di pop cx jc rc9 ; ; The ROM claims that, on success, AL will (normally) contain the number of ; sectors actually read, but I'm not seeing that, so I'll just move CL to AL. ; rc8: xchg ax,cx rc9: ret ENDPROC read_cluster ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; load_error ; ; Print load error message and "halt" ; ; Returns: Nothing ; ; Modifies: AX, BX, SI ; DEFPROC load_error mov si,offset errmsg3 call print2 jmp $ ; "halt" ENDPROC load_error errmsg3 db "System load error, halted",0 ; ; Code and data copied from PART1 (BPB, file data, and shared functions) ; DEFLBL PART2_COPY org $ + (offset DEV_FILE - offset PART1_COPY) DEV_FILE2 label byte org $ + (offset DOS_FILE - offset DEV_FILE) DOS_FILE2 label byte org $ + (offset CFG_FILE - offset DOS_FILE) CFG_FILE2 label byte org $ + (offset get_lba - offset CFG_FILE) get_lba2 label near org $ + (offset read_sector - offset get_lba) read_sector2 label near org $ + (offset print - offset read_sector) print2 label near org $ + (offset PART1_COPY_END - offset print) DEFLBL PART2_END ASSERT <offset PART2_END - offset part2>,LE,512 BOOT ends end
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x13b8f, %rcx clflush (%rcx) nop nop nop nop cmp %rsi, %rsi movw $0x6162, (%rcx) nop nop nop inc %rax lea addresses_UC_ht+0x199ff, %rcx nop nop xor %rbx, %rbx movb (%rcx), %r13b cmp %rax, %rax lea addresses_WC_ht+0x7db7, %rax nop nop nop nop nop sub $16206, %rbx movb (%rax), %cl nop nop nop and %rax, %rax lea addresses_WT_ht+0x1213f, %rsi lea addresses_D_ht+0x1af6, %rdi nop nop nop nop sub %r11, %r11 mov $1, %rcx rep movsw and %rbx, %rbx lea addresses_D_ht+0x161ff, %rsi lea addresses_A_ht+0x21ff, %rdi clflush (%rsi) nop nop nop nop nop add $12118, %r11 mov $39, %rcx rep movsl nop xor $5197, %r11 lea addresses_WT_ht+0x1a207, %rcx nop cmp $10036, %r13 movl $0x61626364, (%rcx) nop nop and $47272, %r13 lea addresses_WC_ht+0x1e4bf, %r13 clflush (%r13) nop nop nop xor $6363, %rbx movw $0x6162, (%r13) nop nop nop nop nop and $35351, %r10 lea addresses_normal_ht+0xd37f, %rsi lea addresses_D_ht+0x1adbb, %rdi clflush (%rsi) clflush (%rdi) nop nop add $7553, %rax mov $107, %rcx rep movsl nop nop cmp %rcx, %rcx lea addresses_A_ht+0x4cbc, %r11 cmp %rbx, %rbx mov $0x6162636465666768, %r13 movq %r13, (%r11) nop sub $8968, %rax lea addresses_UC_ht+0x617f, %rcx dec %rbx mov $0x6162636465666768, %r11 movq %r11, (%rcx) nop nop xor %rsi, %rsi lea addresses_A_ht+0xe57f, %rsi lea addresses_A_ht+0xe8ff, %rdi nop nop nop sub %r11, %r11 mov $53, %rcx rep movsb nop nop add $64309, %rcx lea addresses_normal_ht+0x1477f, %r13 clflush (%r13) nop nop nop xor $63056, %rbx mov $0x6162636465666768, %rsi movq %rsi, (%r13) nop nop and %rsi, %rsi lea addresses_UC_ht+0x8057, %rbx nop nop nop nop and %rdi, %rdi and $0xffffffffffffffc0, %rbx movaps (%rbx), %xmm4 vpextrq $0, %xmm4, %r13 nop nop nop nop cmp %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r9 push %rax push %rbp push %rcx push %rdx // Faulty Load lea addresses_RW+0x1f9ff, %rbp xor $27320, %rax vmovups (%rbp), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %rcx lea oracles, %r9 and $0xff, %rcx shlq $12, %rcx mov (%r9,%rcx,1), %rcx pop %rdx pop %rcx pop %rbp pop %rax pop %r9 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}} {'32': 434} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
.module inttest .title Tests Integer Module .include 'integer.def' .include '..\io\io.def' STACK == 0xFFFF ;SYSTEM STACK .area BOOT (ABS) .org 0x0000 RST0: LXI SP,STACK ;INITALIZE STACK JMP START .org 0x0038 RST7: HLT ;********************************************************* ;* MAIN PROGRAM ;********************************************************* .area _CODE START: CALL IO_CLS ; CALL TEST_INEG ; CALL TEST_IADD ; CALL TEST_ISUB ; CALL TEST_ICMP ; CALL TEST_IMUL CALL TEST_ITOA CALL TEST_ITOA2 ; CALL TEST_ABS ; CALL TEST_SGN ; CALL TEST_RND ; CALL TEST_SQR HLT TEST_INEG: LXI H,0x0000 ; = 0 SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_NEG ; SHOULD BE 0 LXI H,0x0001 ; = 1 SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_NEG ; SHOULD BE -1 (0xFFFF) LXI H,0xFFFF ; = -1 SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_NEG ; SHOULD BE 1 (0x0001) LXI H,0x7FFF ; = 32767 SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_NEG ; SHOULD BE -32767 (0x8001) LXI H,0x8001 ; = -32767 SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_NEG ; SHOULD BE 32767 (0x7FFF) LXI H,0x8000 ; = -32768 SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_NEG ; OVERFLOW SHOULD BE 1 RET TEST_IADD: MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x7FFF ; = 32767 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_ADD ; OVERFLOW SHOULD BE 1 MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0xFFFF ; = -1 SHLD INT_ACC0 LXI H,0x8001 ; = -32767 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_ADD ; = -32768 MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0xFFFF ; = -1 SHLD INT_ACC0 LXI H,0x8000 ; = -32768 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_ADD ; = OVERFLOW SHOULD BE 1 MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x7FFF ; = 32767 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_ADD ; = OVERFLOW SHOULD BE 1 MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x4000 ; = 16384 SHLD INT_ACC0 LXI H,0x3FFF ; = 16383 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_ADD ; = 32767 (0x7FFF) RET TEST_ISUB: MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x0001 ; = 1 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_SUB ; = 0 (0x0000) MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x7FFF ; = 32767 SHLD INT_ACC0 LXI H,0xFFFF ; = -1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_SUB ; = OVERFLOW SHOULD BE 1 MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x0000 ; = 0 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_SUB ; = -1 (0xFFFF) MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0x8001 ; = -32767 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_SUB ; = -32768 (0x8000) MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0xFFFF ; = -1 SHLD INT_ACC0 LXI H,0x7FFF ; = 32767 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_SUB ; = -32768 (0x8000) MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,0xFFFE ; = -2 SHLD INT_ACC0 LXI H,0x7FFF ; = 32767 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_SUB ; = OVERFLOW SHOULD BE 1 RET TEST_ICMP: LXI H,0x0000 ; = 0 SHLD INT_ACC0 LXI H,0x0000 ; = 0 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0 LXI H,0x0000 ; = 0 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0xFF LXI H,0x0001 ; = 1 SHLD INT_ACC0 LXI H,0x0000 ; = 0 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0x01 LXI H,0x8000 ; = -32768 SHLD INT_ACC0 LXI H,0x0001 ; = 1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0xFF LXI H,0x0001 ; = 1 SHLD INT_ACC0 LXI H,0x8000 ; = -32768 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0x01 LXI H,0x7FFF ; = 32767 SHLD INT_ACC0 LXI H,0xFFFF ; = -1 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0x01 LXI H,0xFFFF ; = -1 SHLD INT_ACC0 LXI H,0x7FFF ; = 32767 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0xFF LXI H,0x8000 ; = -32768 SHLD INT_ACC0 LXI H,0x8000 ; = -32768 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0x00 LXI H,0x7FFF ; = 32767 SHLD INT_ACC0 LXI H,0x7FFF ; = 32767 SHLD INT_ACC1 LXI H,INT_ACC1 CALL INT_CMP ; ACC = 0x00 RET TEST_IMUL: MVI A,0 STA INT_OVERFLOW ; RESET OVERFLOW FLAG LXI H,2048 SHLD INT_ACC0 LXI H,15 SHLD INT_ACC2 LXI H,INT_ACC2 CALL INT_MUL RET TEST_ITOA: LXI H,0 SHLD INT_ACC0 CALL INT_ITOA ; = "0", LEN 1 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,1 SHLD INT_ACC0 CALL INT_ITOA ; = "1", LEN 1 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,10 SHLD INT_ACC0 CALL INT_ITOA ; = "10", LEN 2 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,100 SHLD INT_ACC0 CALL INT_ITOA ; = "100", LEN 3 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,1000 SHLD INT_ACC0 CALL INT_ITOA ; = "1000", LEN 4 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,10000 SHLD INT_ACC0 CALL INT_ITOA ; = "10000", LEN 5 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,32767 SHLD INT_ACC0 CALL INT_ITOA ; = "32767", LEN 5 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-1 SHLD INT_ACC0 CALL INT_ITOA ; = "-1", LEN 2 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-10 SHLD INT_ACC0 CALL INT_ITOA ; = "-10", LEN 3 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-100 SHLD INT_ACC0 CALL INT_ITOA ; = "-100", LEN 4 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-1000 SHLD INT_ACC0 CALL INT_ITOA ; = "-1000", LEN 5 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-10000 SHLD INT_ACC0 CALL INT_ITOA ; = "-10000", LEN 6 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-32767 SHLD INT_ACC0 CALL INT_ITOA ; = "-32767", LEN 6 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR LXI H,-32768 SHLD INT_ACC0 CALL INT_ITOA ; = "-32768", LEN 6 CALL IO_PUTCH MVI A,': CALL IO_PUTC CALL IO_PUTS CALL IO_PUTCR RET ; ITOA all values from 0-255 TEST_ITOA2: MVI B,0x00 1$: MVI H,0 MOV L,B SHLD INT_ACC0 CALL INT_ITOA CALL IO_PUTS MVI A,'\t CALL IO_PUTC INR B JNZ 1$ RET TEST_ATOI: LXI H,TESTSTR1 CALL INT_ATOI LXI H,TESTSTR2 CALL INT_ATOI LXI H,TESTSTR3 CALL INT_ATOI LXI H,TESTSTR4 CALL INT_ATOI LXI H,TESTSTR5 CALL INT_ATOI LXI H,TESTSTR6 CALL INT_ATOI ; LXI H,TESTSTR7 ; CALL INT_ATOI LXI H,TESTSTR8 CALL INT_ATOI LXI H,TESTSTR9 CALL INT_ATOI LXI H,TESTSTR10 CALL INT_ATOI LXI H,TESTSTR11 CALL INT_ATOI LXI H,TESTSTR12 CALL INT_ATOI LXI H,TESTSTR13 CALL INT_ATOI ; LXI H,TESTSTR14 ; CALL INT_ATOI LXI H,TESTSTR15 CALL INT_ATOI LXI H,TESTSTR16 CALL INT_ATOI LXI H,TESTSTR17 CALL INT_ATOI LXI H,TESTSTR18 CALL INT_ATOI LXI H,TESTSTR19 CALL INT_ATOI LXI H,TESTSTR20 CALL INT_ATOI ; LXI H,TESTSTR21 ; CALL INT_ATOI LXI H,TESTSTR22 CALL INT_ATOI ; LXI H,TESTSTR23 ; CALL INT_ATOI LXI H,TESTSTR24 CALL INT_ATOI LXI H,TESTSTR25 CALL INT_ATOI RET TEST_ABS: LXI H,0x0000 ; ABS(0) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_ABS ; = 0 LXI H,0x0001 ; ABS(1) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_ABS ; = 1 LXI H,0xFFFF ; ABS(-1) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_ABS ; = 1 LXI H,0x7FFF ; ABS(32767) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_ABS ; = 32767 LXI H,0x8001 ; ABS(-32767) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_ABS ; = 32767 LXI H,0x8000 ; ABS(-32768) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_ABS ; = OVERFLOW RET TEST_SGN: LXI H,0x0000 ; SGN(0) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SGN ; = 0 LXI H,0x0001 ; SGN(1) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SGN ; = 1 LXI H,0xFFFF ; SGN(-1) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SGN ; = -1 LXI H,0x7FFF ; SGN(32767) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SGN ; = 1 LXI H,0x8001 ; SGN(-32767) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SGN ; = -1 LXI H,0x8000 ; SGN(-32768) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SGN ; = -1 RET TEST_RND: CALL INT_RND CALL INT_RND CALL INT_RND CALL INT_RND RET TEST_SQR: LXI H,0x0000 ; SQR(0) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 0 LXI H,0x0001 ; SQR(1) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 1 LXI H,0x0002 ; SQR(2) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 1 LXI H,0x0004 ; SQR(4) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 2 LXI H,0x0005 ; SQR(5) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 2 LXI H,0x0050 ; SQR(80) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 8 LXI H,0x0500 ; SQR(1280) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 35 LXI H,0x5000 ; SQR(20480) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 143 LXI H,0x7FFF ; SQR(32767) SHLD INT_ACC0 LXI H,INT_ACC0 CALL INT_SQR ; = 181 RET TESTSTR1: .asciz '0' TESTSTR2: .asciz '1' TESTSTR3: .asciz '12' TESTSTR4: .asciz '123' TESTSTR5: .asciz '1234' TESTSTR6: .asciz '12345' TESTSTR7: .asciz '123456' TESTSTR8: .asciz '+0' TESTSTR9: .asciz '+1' TESTSTR10: .asciz '+12' TESTSTR11: .asciz '+123' TESTSTR12: .asciz '+1234' TESTSTR13: .asciz '+12345' TESTSTR14: .asciz '+123456' TESTSTR15: .asciz '-0' TESTSTR16: .asciz '-1' TESTSTR17: .asciz '-12' TESTSTR18: .asciz '-123' TESTSTR19: .asciz '-1234' TESTSTR20: .asciz '-12345' TESTSTR21: .asciz '-123456' TESTSTR22: .asciz '32767' TESTSTR23: .asciz '32768' TESTSTR24: .asciz '-32767' TESTSTR25: .asciz '-32768'
// upload image to imagebin.org #include <iostream> #include <boost/noncopyable.hpp> #include <boost/array.hpp> #include <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> #include "avhttp.hpp" int main(int argc, char* argv[]) { if (argc < 2) { std::cerr << "usage: " << argv[0] << " <filename> [nickname]\n"; return -1; } std::string filename = std::string(argv[1]); std::string extension = boost::filesystem::path(filename).extension().string(); boost::to_lower(extension); if (extension != ".png" && extension != ".jpg" && extension != ".jpeg" && extension != ".gif" && extension != ".jpe") { std::cerr << "You must provide a image!\n"; return -1; } boost::asio::io_service io; avhttp::file_upload upload(io); avhttp::request_opts opts; opts.insert("Referer", "http://imagebin.org/index.php?page=add"); opts.insert(avhttp::http_options::user_agent, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"); opts.insert("Origin", "http://imagebin.org"); opts.insert("Cache-Control", "max-age=0"); opts.insert("Accept-Language", "zh-CN,zh;q=0.8"); upload.request_option(opts); avhttp::file_upload::form_args args; args["nickname"] = "Cai"; args["remember_nickname"] = "Y"; args["title"] = boost::filesystem::path(filename).leaf().string(); args["description"] = "Upload by avhttp"; args["disclaimer_agree"] = "Y"; args["Submit"] = "Submit"; args["mode"] = "add"; avhttp::http_stream& http = upload.get_http_stream(); http.max_redirects(0); boost::system::error_code ec; upload.open("http://imagebin.org/index.php", filename, "image", args, ec); if (ec) { return -1; } // start upload image. avhttp::default_storge file; file.open(filename, ec); if (ec) { return -1; } boost::array<char, 1024> buffer; while (!file.eof()) { int readed = file.read(buffer.data(), 1024); boost::asio::write(upload, boost::asio::buffer(buffer, readed), ec); if (ec) { return -1; } } upload.write_tail(ec); if (ec) { return -1; } // output image url. std::string path = http.location(); std::cout << path << std::endl; return 0; }
; A097378: SquareFreeKernel(n)*CubeFreeKernel(n) + 1. ; Submitted by Jon Maiga ; 2,5,10,9,26,37,50,9,28,101,122,73,170,197,226,9,290,109,362,201,442,485,530,73,126,677,28,393,842,901,962,9,1090,1157,1226,217,1370,1445,1522,201,1682,1765,1850,969,676,2117,2210,73,344,501,2602,1353,2810 lpb $0 mov $2,$0 seq $2,62378 ; n divided by largest cubefree factor of n. div $0,$2 lpe seq $0,78310 ; a(n) = n*rad(n) + 1, where rad = A007947 (squarefree kernel).
/** * Copyright Soramitsu Co., Ltd. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ #include <gmock/gmock.h> #include <backend/plain/account.hpp> #include <backend/plain/domain.hpp> #include <backend/plain/peer.hpp> #include <backend/plain/signature.hpp> #include "ametsuchi/impl/postgres_wsv_command.hpp" #include "ametsuchi/impl/postgres_wsv_query.hpp" #include "framework/test_logger.hpp" #include "integration/acceptance/fake_peer_fixture.hpp" #include "interfaces/common_objects/string_view_types.hpp" #include "module/irohad/ametsuchi/ametsuchi_fixture.hpp" using namespace std::literals; using namespace shared_model::interface::types; namespace iroha { namespace ametsuchi { class WsvQueryTest : public AmetsuchiTest { public: void SetUp() override { AmetsuchiTest::SetUp(); sql = std::make_unique<soci::session>(*soci::factory_postgresql(), pgopt_); command = std::make_unique<PostgresWsvCommand>(*sql); query = std::make_unique<PostgresWsvQuery>(*sql, getTestLogger("WsvQuery")); } void TearDown() override { sql->close(); AmetsuchiTest::TearDown(); } std::unique_ptr<soci::session> sql; std::unique_ptr<WsvCommand> command; std::unique_ptr<WsvQuery> query; }; /** * @given storage with peers * @when trying to get existing peers * @then peer list successfully received */ TEST_F(WsvQueryTest, GetPeers) { std::shared_ptr<shared_model::interface::Peer> peer1 = std::make_shared<shared_model::plain::Peer>( "some-address", "0a", std::nullopt); command->insertPeer(*peer1); std::shared_ptr<shared_model::interface::Peer> peer2 = std::make_shared<shared_model::plain::Peer>( "another-address", "0b", std::nullopt); command->insertPeer(*peer2); auto result = query->getPeers(); ASSERT_TRUE(result); ASSERT_THAT(*result, testing::ElementsAre(makePeerPointeeMatcher(peer1), makePeerPointeeMatcher(peer2))); } /** * @given storage with signatories * @when trying to get signatories of one account * @then signature list for one account successfully received */ TEST_F(WsvQueryTest, GetSignatories) { command->insertRole("role"); shared_model::plain::Domain domain("domain", "role"); command->insertDomain(domain); shared_model::plain::Account account("account", "domain", 1, "{}"); command->insertAccount(account); PublicKeyHexStringView pub_key1{"some-public-key"sv}; command->insertSignatory(pub_key1); command->insertAccountSignatory("account", pub_key1); PublicKeyHexStringView pub_key2{"another-public-key"sv}; command->insertSignatory(pub_key2); command->insertAccountSignatory("account", pub_key2); auto result = query->getSignatories("account"); ASSERT_TRUE(result); auto signatories = result.get(); ASSERT_THAT(signatories, testing::UnorderedElementsAre(pub_key1, pub_key2)); } } // namespace ametsuchi } // namespace iroha
; ; print.asm ; KripayaOS ; [bits 16] print16: pusha mov ah, 0x0e .loop16: cmp [bx], BYTE 0 je .end16 mov al, [bx] int 0x10 add bx, 1 jmp .loop16 .end16: popa ret clear16: pusha mov ah, 0x00 mov al, 0x03 ; text mode 80x25 16 colours int 0x10 popa ret
; 1 "synth_sse_float.S" ; 1 "<built-in>" ; 1 "<command line>" ; 1 "synth_sse_float.S" ; 9 "synth_sse_float.S" ; 1 "mangle.h" 1 ; 13 "mangle.h" ; 1 "config.h" 1 ; 14 "mangle.h" 2 ; 1 "intsym.h" 1 ; 15 "mangle.h" 2 ; 10 "synth_sse_float.S" 2 ; 26 "synth_sse_float.S" %include "asm_nasm.inc" _sym_mangle synth_1to1_real_sse_asm SECTION .data align 32 scale_sse: dd 939524096 dd 939524096 dd 939524096 dd 939524096 SECTION .text align 16 GLOBAL synth_1to1_real_sse_asm synth_1to1_real_sse_asm: push dword ebp mov dword ebp, esp push dword ebx push dword esi mov dword ebx, [ebp+8] mov dword edx, [ebp+12] mov dword esi, [ebp+16] mov dword eax, [ebp+20] shl dword eax, 2 lea dword ebx, [ebx+64] sub dword ebx, eax mov dword ecx, 4 align 16 Loop_start_1: movups xmm0, [ebx] movups xmm1, [ebx+16] movups xmm2, [ebx+32] movups xmm3, [ebx+48] movups xmm4, [ebx+128] movups xmm5, [ebx+144] movups xmm6, [ebx+160] movups xmm7, [ebx+176] mulps xmm0, [edx+0] mulps xmm1, [edx+16] mulps xmm2, [edx+32] mulps xmm3, [edx+48] mulps xmm4, [edx+64] mulps xmm5, [edx+80] mulps xmm6, [edx+96] mulps xmm7, [edx+112] addps xmm0, xmm1 addps xmm2, xmm3 addps xmm4, xmm5 addps xmm6, xmm7 addps xmm0, xmm2 addps xmm4, xmm6 movaps xmm5, xmm4 movaps xmm4, xmm0 lea dword ebx, [ebx+256] lea dword edx, [edx+128] movups xmm0, [ebx] movups xmm1, [ebx+16] movups xmm2, [ebx+32] movups xmm3, [ebx+48] movups xmm6, [ebx+128] movups xmm7, [ebx+144] mulps xmm0, [edx] mulps xmm1, [edx+16] mulps xmm2, [edx+32] mulps xmm3, [edx+48] mulps xmm6, [edx+64] mulps xmm7, [edx+80] addps xmm0, xmm1 addps xmm2, xmm3 addps xmm6, xmm7 movups xmm1, [ebx+160] movups xmm3, [ebx+176] mulps xmm1, [edx+96] mulps xmm3, [edx+112] addps xmm0, xmm2 addps xmm1, xmm3 addps xmm6, xmm1 movaps xmm7, xmm6 movaps xmm6, xmm0 lea dword ebx, [ebx+256] lea dword edx, [edx+128] movaps xmm0, xmm4 movaps xmm1, xmm6 unpcklps xmm4, xmm5 unpcklps xmm6, xmm7 unpckhps xmm0, xmm5 unpckhps xmm1, xmm7 movaps xmm2, xmm4 movaps xmm3, xmm0 movlhps xmm4, xmm6 movhlps xmm6, xmm2 movlhps xmm0, xmm1 movhlps xmm1, xmm3 subps xmm4, xmm6 subps xmm0, xmm1 addps xmm0, xmm4 movups xmm1, [esi] movups xmm2, [esi+16] mulps xmm0, [scale_sse] shufps xmm1, xmm2, 0xdd movaps xmm2, xmm0 unpcklps xmm0, xmm1 unpckhps xmm2, xmm1 movups [esi], xmm0 movups [esi+16], xmm2 lea dword esi, [esi+32] dec dword ecx jnz Loop_start_1 mov dword ecx, 4 align 16 Loop_start_2: movups xmm0, [ebx] movups xmm1, [ebx+16] movups xmm2, [ebx+32] movups xmm3, [ebx+48] movups xmm4, [ebx+128] movups xmm5, [ebx+144] movups xmm6, [ebx+160] movups xmm7, [ebx+176] mulps xmm0, [edx+0] mulps xmm1, [edx+16] mulps xmm2, [edx+32] mulps xmm3, [edx+48] mulps xmm4, [edx+-64] mulps xmm5, [edx+-48] mulps xmm6, [edx+-32] mulps xmm7, [edx+-16] addps xmm0, xmm1 addps xmm2, xmm3 addps xmm4, xmm5 addps xmm6, xmm7 addps xmm0, xmm2 addps xmm4, xmm6 movaps xmm5, xmm4 movaps xmm4, xmm0 lea dword ebx, [ebx+256] lea dword edx, [edx+-128] movups xmm0, [ebx] movups xmm1, [ebx+16] movups xmm2, [ebx+32] movups xmm3, [ebx+48] movups xmm6, [ebx+128] movups xmm7, [ebx+144] mulps xmm0, [edx] mulps xmm1, [edx+16] mulps xmm2, [edx+32] mulps xmm3, [edx+48] mulps xmm6, [edx+-64] mulps xmm7, [edx+-48] addps xmm0, xmm1 addps xmm2, xmm3 addps xmm6, xmm7 movups xmm1, [ebx+160] movups xmm3, [ebx+176] mulps xmm1, [edx+-32] mulps xmm3, [edx+-16] addps xmm0, xmm2 addps xmm1, xmm3 addps xmm6, xmm1 movaps xmm7, xmm6 movaps xmm6, xmm0 lea dword ebx, [ebx+256] lea dword edx, [edx+-128] movaps xmm0, xmm4 movaps xmm1, xmm6 unpcklps xmm4, xmm5 unpcklps xmm6, xmm7 unpckhps xmm0, xmm5 unpckhps xmm1, xmm7 movaps xmm2, xmm4 movaps xmm3, xmm0 movlhps xmm4, xmm6 movhlps xmm6, xmm2 movlhps xmm0, xmm1 movhlps xmm1, xmm3 addps xmm4, xmm6 addps xmm0, xmm1 addps xmm0, xmm4 movups xmm1, [esi] movups xmm2, [esi+16] mulps xmm0, [scale_sse] shufps xmm1, xmm2, 0xdd movaps xmm2, xmm0 unpcklps xmm0, xmm1 unpckhps xmm2, xmm1 movups [esi], xmm0 movups [esi+16], xmm2 lea dword esi, [esi+32] dec dword ecx jnz Loop_start_2 xor dword eax, eax pop dword esi pop dword ebx mov dword esp, ebp pop dword ebp ret
dnl IA-64 mpn_lshiftc. dnl Contributed to the GNU project by Torbjorn Granlund. dnl Copyright 2000-2005, 2010 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C Itanium: ? C Itanium 2: 1.25 C This code is scheduled deeply since the plain shift instructions shr and shl C have a latency of 4 (on Itanium) or 3 (on Itanium 2). Poor scheduling of C these instructions cause a 10 cycle replay trap on Itanium. C The ld8 scheduling should probably be decreased to make the function smaller. C Good lfetch will make sure we never stall anyway. C We should actually issue the first ld8 at cycle 0, and the first BSH/FSH pair C at cycle 2. Judicious use of predicates could allow us to issue more ld8's C in the prologue. C INPUT PARAMETERS define(`rp', `r32') define(`up', `r33') define(`n', `r34') define(`cnt',`r35') define(`tnc',`r9') define(`FSH',`shl') define(`BSH',`shr.u') define(`UPD',`-8') define(`POFF',`-512') define(`PUPD',`-32') define(`func',`mpn_lshiftc') ASM_START() PROLOGUE(mpn_lshiftc) .prologue .save ar.lc, r2 .body ifdef(`HAVE_ABI_32', ` addp4 rp = 0, rp C M I addp4 up = 0, up C M I sxt4 n = n C M I nop.m 0 nop.m 0 zxt4 cnt = cnt C I ;; ') {.mmi; nop 0 C M I and r14 = 3, n C M I mov.i r2 = ar.lc C I0 }{.mmi; add r15 = -1, n C M I sub tnc = 64, cnt C M I nop 0 ;; }{.mmi; cmp.eq p6, p0 = 1, r14 C M I cmp.eq p7, p0 = 2, r14 C M I shr.u n = r15, 2 C I0 }{.mmi; cmp.eq p8, p0 = 3, r14 C M I shladd up = r15, 3, up C M I shladd rp = r15, 3, rp C M I ;; }{.mmi; add r11 = POFF, up C M I ld8 r10 = [up], UPD C M01 mov.i ar.lc = n C I0 }{.bbb; (p6) br.dptk .Lb01 (p7) br.dptk .Lb10 (p8) br.dptk .Lb11 ;; } .Lb00: ld8 r19 = [up], UPD ;; ld8 r16 = [up], UPD ;; ld8 r17 = [up], UPD BSH r8 = r10, tnc br.cloop.dptk L(gt4) ;; FSH r24 = r10, cnt BSH r25 = r19, tnc ;; FSH r26 = r19, cnt BSH r27 = r16, tnc ;; FSH r20 = r16, cnt BSH r21 = r17, tnc ;; or r14 = r25, r24 FSH r22 = r17, cnt ;; or r15 = r27, r26 sub r31 = -1, r14 br .Lr4 L(gt4): {.mmi; nop 0 nop 0 FSH r24 = r10, cnt }{.mmi; ld8 r18 = [up], UPD nop 0 BSH r25 = r19, tnc ;; } {.mmi; nop 0 nop 0 FSH r26 = r19, cnt }{.mmi; ld8 r19 = [up], UPD nop 0 BSH r27 = r16, tnc ;; } {.mmi; nop 0 nop 0 FSH r20 = r16, cnt }{.mmi; ld8 r16 = [up], UPD nop 0 BSH r21 = r17, tnc ;; } {.mmi; nop 0 or r14 = r25, r24 FSH r22 = r17, cnt }{.mib; ld8 r17 = [up], UPD BSH r23 = r18, tnc br.cloop.dptk L(gt8) ;; } {.mmi; nop 0 or r15 = r27, r26 FSH r24 = r18, cnt }{.mib; sub r31 = -1, r14 BSH r25 = r19, tnc br .Lr8 } L(gt8): or r15 = r27, r26 FSH r24 = r18, cnt ld8 r18 = [up], UPD sub r31 = -1, r14 BSH r25 = r19, tnc br .LL00 .Lb01: br.cloop.dptk L(gt1) ;; BSH r8 = r10, tnc FSH r22 = r10, cnt ;; sub r31 = -1, r22 br .Lr1 ;; L(gt1): ld8 r18 = [up], UPD BSH r8 = r10, tnc FSH r22 = r10, cnt ;; ld8 r19 = [up], UPD ;; ld8 r16 = [up], UPD ;; ld8 r17 = [up], UPD BSH r23 = r18, tnc br.cloop.dptk L(gt5) ;; nop 0 FSH r24 = r18, cnt BSH r25 = r19, tnc ;; nop 0 FSH r26 = r19, cnt BSH r27 = r16, tnc ;; or r15 = r23, r22 FSH r20 = r16, cnt BSH r21 = r17, tnc ;; or r14 = r25, r24 FSH r22 = r17, cnt sub r31 = -1, r15 br .Lr5 L(gt5): {.mmi; nop 0 nop 0 FSH r24 = r18, cnt }{.mmi; ld8 r18 = [up], UPD nop 0 BSH r25 = r19, tnc ;; } {.mmi; nop 0 nop 0 FSH r26 = r19, cnt }{.mmi; ld8 r19 = [up], UPD nop 0 BSH r27 = r16, tnc ;; } {.mmi; nop 0 or r15 = r23, r22 FSH r20 = r16, cnt }{.mmi; ld8 r16 = [up], UPD nop 0 BSH r21 = r17, tnc ;; } {.mmi; or r14 = r25, r24 sub r31 = -1, r15 FSH r22 = r17, cnt }{.mib; ld8 r17 = [up], UPD BSH r23 = r18, tnc br L(end) ;; } .Lb10: ld8 r17 = [up], UPD br.cloop.dptk L(gt2) ;; BSH r8 = r10, tnc FSH r20 = r10, cnt ;; BSH r21 = r17, tnc FSH r22 = r17, cnt ;; or r14 = r21, r20 ;; sub r31 = -1, r14 br .Lr2 ;; L(gt2): ld8 r18 = [up], UPD BSH r8 = r10, tnc FSH r20 = r10, cnt ;; ld8 r19 = [up], UPD ;; ld8 r16 = [up], UPD BSH r21 = r17, tnc FSH r22 = r17, cnt ;; ld8 r17 = [up], UPD BSH r23 = r18, tnc br.cloop.dptk L(gt6) ;; nop 0 FSH r24 = r18, cnt BSH r25 = r19, tnc ;; or r14 = r21, r20 FSH r26 = r19, cnt BSH r27 = r16, tnc ;; {.mmi; nop 0 or r15 = r23, r22 FSH r20 = r16, cnt }{.mib; sub r31 = -1, r14 BSH r21 = r17, tnc br .Lr6 ;; } L(gt6): {.mmi; nop 0 nop 0 FSH r24 = r18, cnt }{.mmi; ld8 r18 = [up], UPD nop 0 BSH r25 = r19, tnc ;; } {.mmi; nop 0 or r14 = r21, r20 FSH r26 = r19, cnt }{.mmi; ld8 r19 = [up], UPD nop 0 BSH r27 = r16, tnc ;; } {.mmi; or r15 = r23, r22 sub r31 = -1, r14 FSH r20 = r16, cnt }{.mib; ld8 r16 = [up], UPD BSH r21 = r17, tnc br .LL10 } .Lb11: ld8 r16 = [up], UPD ;; ld8 r17 = [up], UPD BSH r8 = r10, tnc FSH r26 = r10, cnt br.cloop.dptk L(gt3) ;; BSH r27 = r16, tnc ;; FSH r20 = r16, cnt BSH r21 = r17, tnc ;; FSH r22 = r17, cnt ;; or r15 = r27, r26 ;; or r14 = r21, r20 sub r31 = -1, r15 br .Lr3 ;; L(gt3): ld8 r18 = [up], UPD ;; ld8 r19 = [up], UPD BSH r27 = r16, tnc ;; {.mmi; nop 0 nop 0 FSH r20 = r16, cnt }{.mmi; ld8 r16 = [up], UPD nop 0 BSH r21 = r17, tnc ;; }{.mmi; nop 0 nop 0 FSH r22 = r17, cnt }{.mib; ld8 r17 = [up], UPD BSH r23 = r18, tnc br.cloop.dptk L(gt7) ;; } or r15 = r27, r26 FSH r24 = r18, cnt BSH r25 = r19, tnc ;; {.mmi; nop 0 or r14 = r21, r20 FSH r26 = r19, cnt }{.mib; sub r31 = -1, r15 BSH r27 = r16, tnc br .Lr7 } L(gt7): {.mmi; nop 0 or r15 = r27, r26 FSH r24 = r18, cnt }{.mmi; ld8 r18 = [up], UPD nop 0 BSH r25 = r19, tnc ;; } {.mmi; or r14 = r21, r20 sub r31 = -1, r15 FSH r26 = r19, cnt }{.mib; ld8 r19 = [up], UPD BSH r27 = r16, tnc br .LL11 } C *** MAIN LOOP START *** ALIGN(32) L(top): .LL01: {.mmi; st8 [rp] = r31, UPD C M2 or r15 = r27, r26 C M3 FSH r24 = r18, cnt C I0 }{.mmi; ld8 r18 = [up], UPD C M0 sub r31 = -1, r14 C M1 BSH r25 = r19, tnc C I1 ;; } .LL00: {.mmi; st8 [rp] = r31, UPD or r14 = r21, r20 FSH r26 = r19, cnt }{.mmi; ld8 r19 = [up], UPD sub r31 = -1, r15 BSH r27 = r16, tnc ;; } .LL11: {.mmi; st8 [rp] = r31, UPD or r15 = r23, r22 FSH r20 = r16, cnt }{.mmi; ld8 r16 = [up], UPD sub r31 = -1, r14 BSH r21 = r17, tnc ;; } .LL10: {.mmi; st8 [rp] = r31, UPD or r14 = r25, r24 FSH r22 = r17, cnt }{.mmi; ld8 r17 = [up], UPD sub r31 = -1, r15 BSH r23 = r18, tnc ;; } L(end): lfetch [r11], PUPD br.cloop.dptk L(top) C *** MAIN LOOP END *** {.mmi; st8 [rp] = r31, UPD or r15 = r27, r26 FSH r24 = r18, cnt }{.mib; sub r31 = -1, r14 BSH r25 = r19, tnc nop 0 ;; } .Lr8: {.mmi; st8 [rp] = r31, UPD or r14 = r21, r20 FSH r26 = r19, cnt }{.mib; sub r31 = -1, r15 BSH r27 = r16, tnc nop 0 ;; } .Lr7: {.mmi; st8 [rp] = r31, UPD or r15 = r23, r22 FSH r20 = r16, cnt }{.mib; sub r31 = -1, r14 BSH r21 = r17, tnc nop 0 ;; } .Lr6: st8 [rp] = r31, UPD or r14 = r25, r24 FSH r22 = r17, cnt sub r31 = -1, r15 ;; .Lr5: st8 [rp] = r31, UPD or r15 = r27, r26 sub r31 = -1, r14 ;; .Lr4: st8 [rp] = r31, UPD or r14 = r21, r20 sub r31 = -1, r15 ;; .Lr3: st8 [rp] = r31, UPD sub r31 = -1, r14 ;; .Lr2: st8 [rp] = r31, UPD sub r31 = -1, r22 ;; .Lr1: st8 [rp] = r31, UPD C M23 mov ar.lc = r2 C I0 br.ret.sptk.many b0 C B EPILOGUE(func) ASM_END()
;----------------------------------------------- ; Entering password game state Password_loop: call clearScreenLeftToRight ; print enter password string: ld hl,UI_message_enter_password ld de,NAMTBL2+256+9 ld bc,UI_message_enter_password_end-UI_message_enter_password call LDIRVM ; reset the password string: ld hl,patternCopyBuffer ld de,patternCopyBuffer+1 xor a ld (hl),a ld bc,31 ldir call getcharacter_nonwaiting_reset ld de,patternCopyBuffer ld hl,NAMTBL2+256+32*2+12 xor a ld (game_cycle),a Password_loop_loop: halt exx call getcharacter_nonwaiting exx cp 8 jr z,Password_loop_delete cp 13 ;; ENTER jr z,Password_loop_TestPassword cp 27 ;; ESC jp z,TitleScreen_Loop or a jr nz,Password_loop_insertCharacter ld a,(game_cycle) inc a ld (game_cycle),a and #08 jr z,Password_loop_draw_cursor Password_loop_draw_character: ld a,(de) ; ld hl,NAMTBL2+256+32*2+12 call WRTVRM jr Password_loop_loop Password_loop_draw_cursor: ld a,193 ; ld hl,NAMTBL2+256+32*2+12 call WRTVRM jr Password_loop_loop Password_loop_delete: ld a,e cp patternCopyBuffer%256 jr z,Password_loop_delete_nodec cp (patternCopyBuffer+8)%256 jr z,Password_loop_delete_up_a_line xor a call WRTVRM ; delete the cursor Password_loop_delete_bforedec: dec de dec hl Password_loop_delete_nodec: xor a ld (de),a jr Password_loop_loop Password_loop_delete_up_a_line: xor a call WRTVRM ; delete the cursor ld hl,NAMTBL2+256+32*2+12+8 jr Password_loop_delete_bforedec Password_loop_insertCharacter: ld b,a ld a,e cp (patternCopyBuffer+16)%256 jr z,Password_loop_loop ld a,b ld (de),a call WRTVRM inc de inc hl ld a,e cp (patternCopyBuffer+8)%256 jr z,Password_loop_delete_down_a_line jr Password_loop_loop Password_loop_delete_down_a_line: ld hl,NAMTBL2+256+32*3+12 jr Password_loop_loop ;----------------------------------------------- ; Checks whether the password is correct, decodes it and starts the game Password_loop_TestPassword: exx ; save DE/HL for the password loop ; test if it works ld hl,patternCopyBuffer ld de,password_buffer ld b,16 ld c,0 ; c will keep the XOR Password_loop_TestPassword_to_bytes: ld a,(hl) or a jr z,Password_loop_TestPassword_failed cp 'A' jp m,Password_loop_TestPassword_noletter sub 43 ; make the letters be just before the numbers Password_loop_TestPassword_noletter: sub 22 ;; so that 'A' is 0, and '0' is 26 ld (de),a xor c ld c,a inc hl inc de djnz Password_loop_TestPassword_to_bytes or a jr z,Password_loop_TestPassword_passesXORtest Password_loop_TestPassword_failed: ld hl,SFX_playerhit call play_SFX_with_high_priority exx ; restore DE/HL for the password loop jp Password_loop_loop Password_loop_TestPassword_passesXORtest: ; check health is > 0 and <=16: ld a,(password_buffer+1) or a jr z,Password_loop_TestPassword_failed cp 17 jp p,Password_loop_TestPassword_failed ; check mana is <=31: ld a,(password_buffer+2) cp 32 jp p,Password_loop_TestPassword_failed call initializeGame ; decode password: ; health: ld hl,password_buffer+1 ld a,(hl) ld (player_health),a inc hl ; mana: ld a,(hl) ld (player_mana),a inc hl ; weapons and secondary weapons: ld de,available_weapons+1 ld a,1 ld b,(hl) push hl ld hl,current_weapon bit 0,b jr z,Password_loop_TestPassword_no_sword ld (de),a ld (hl),a Password_loop_TestPassword_no_sword: inc de bit 1,b jr z,Password_loop_TestPassword_no_goldsword ld (de),a ld (hl),2 Password_loop_TestPassword_no_goldsword: ld de,available_secondary_weapons+1 ld hl,current_secondary_weapon bit 2,b jr z,Password_loop_TestPassword_no_arrows ld (de),a ld (hl),a Password_loop_TestPassword_no_arrows: inc de bit 3,b jr z,Password_loop_TestPassword_no_icearrows ld (de),a ld (hl),2 Password_loop_TestPassword_no_icearrows: inc de bit 4,b jr z,Password_loop_TestPassword_no_hourglass ld (de),a ld (hl),3 Password_loop_TestPassword_no_hourglass: pop hl inc hl ; decode armors: ld de,available_armors+1 ld b,2 Pasword_lop_TestPassword_decoding_armors_loop: ld c,(hl) bit 4,c jr z,Password_loop_TestPassword_no_armor ld (de),a ; set it as the current armor: ld a,b xor #03 ; turn 1 into 2 and 2 into 1 ld (current_armor),a ld a,1 Password_loop_TestPassword_no_armor: inc de inc hl djnz Pasword_lop_TestPassword_decoding_armors_loop ; decode keys: xor a ld c,(hl) bit 4,c jr z,Password_loop_TestPassword_no_keys1 inc a Password_loop_TestPassword_no_keys1: inc hl ld c,(hl) bit 4,c jr z,Password_loop_TestPassword_no_keys2 inc a inc a Password_loop_TestPassword_no_keys2: inc hl ld (player_keys),a ; decode bosses: ld de,globalState_BossesKilled ld b,4 ld a,1 Pasword_lop_TestPassword_decoding_bosses_loop: ld c,(hl) bit 4,c jr z,Password_loop_TestPassword_boss_alive ld (de),a Password_loop_TestPassword_boss_alive: inc de inc hl djnz Pasword_lop_TestPassword_decoding_bosses_loop ; decode doors: ld hl,password_buffer+4 ;; the position where the doors start to be decoded ld de,globalState_doorsOpen ld b,4 ; loop 4 times, each loop does 2 maps, so this decodes the first 8 maps, which are the only ones encoded in the password Pasword_lop_TestPassword_decoding_doors_loop: ld c,(hl) bit 0,c jr z,Pasword_lop_TestPassword_decoding_doors_door1_closed ld (de),a Pasword_lop_TestPassword_decoding_doors_door1_closed: inc de bit 1,c jr z,Pasword_lop_TestPassword_decoding_doors_door2_closed ld (de),a Pasword_lop_TestPassword_decoding_doors_door2_closed: inc de bit 2,c jr z,Pasword_lop_TestPassword_decoding_doors_door3_closed ld (de),a Pasword_lop_TestPassword_decoding_doors_door3_closed: inc de bit 3,c jr z,Pasword_lop_TestPassword_decoding_doors_door4_closed ld (de),a Pasword_lop_TestPassword_decoding_doors_door4_closed: inc hl inc de djnz Pasword_lop_TestPassword_decoding_doors_loop ; decode items: ld de,globalState_itemsPickedUp ld b,8 ; loop 8 times, once per map Pasword_lop_TestPassword_decoding_items_loop: ld c,(hl) bit 0,c jr z,Pasword_lop_TestPassword_decoding_items_item1_notpickedup ld (de),a Pasword_lop_TestPassword_decoding_items_item1_notpickedup: inc de bit 1,c jr z,Pasword_lop_TestPassword_decoding_items_item2_notpickedup ld (de),a Pasword_lop_TestPassword_decoding_items_item2_notpickedup: inc de bit 2,c jr z,Pasword_lop_TestPassword_decoding_items_item3_notpickedup ld (de),a Pasword_lop_TestPassword_decoding_items_item3_notpickedup: inc de bit 3,c jr z,Pasword_lop_TestPassword_decoding_items_item4_notpickedup ld (de),a Pasword_lop_TestPassword_decoding_items_item4_notpickedup: inc hl inc de ; inc HL MAX_PICKUPS_PER_MAP-4 push hl ld hl,MAX_PICKUPS_PER_MAP-4 add hl,de ex de,hl pop hl djnz Pasword_lop_TestPassword_decoding_items_loop ld a,1 ld (globalState_itemsPickedUp+4),a ;; the 5th item (a key) needs to have been picked up to ;; save a password, but we are not saving it to save a bit ; change the weapons to the selected ones: call ChangeWeapon_next_found call ChangeSecondaryWeapon_next_found call ChangeArmor_next_found ; clear the message: ld hl,splash_line1+5 ; this points to a space ld c,1 call displayUIMessage ; decode start location: ; assume it's fortress1: ld a,MAP_FORTRESS1 ld (player_map),a ld hl,map_fortress1_pletter ld a,12*16+8 ld (player_y),a ld (player_precision_y+1),a ld a,(password_buffer+12) bit 4,a jr z,Pasword_lop_TestPassword_decoding_startlocation_its_fortress1 ; set fortress 2: ld a,MAP_FORTRESS2 ld (player_map),a ld hl,map_fortress2_pletter ld a,6*16+8 ld (player_x),a ld (player_precision_x+1),a ld a,8*16+8 ld (player_y),a ld (player_precision_y+1),a ;ld a,#a0 ;ld (texture_colors+7),a ;ld (texture_colors+8),a Pasword_lop_TestPassword_decoding_startlocation_its_fortress1: ld a,GAME_STATE_PLAYING ld (game_state),a jp Game_Loop_after_setting_map ;----------------------------------------------- ;; Adapted from the CHGET routine here: https://sourceforge.net/p/cbios/cbios/ci/master/tree/src/main.asm#l289 ;; It returns 0 if no key is ready to be read ;; If a key is ready to be read, it checks if it is one of these: ;; - ESC / DELETE / ENTER ;; - 'a' - 'z' (converts it to upper case and returns) ;; - 'Z' - 'Z' ;; - otherwise, it returns 0 getcharacter_nonwaiting: ld hl,(GETPNT) ld de,(PUTPNT) call DCOMPR jr z,getcharacter_nonwaiting_invalidkey ;; there is a character ready to be read: ld a,(hl) push af inc hl ld a,l cp #00ff & (KEYBUF + 40) jr nz,getcharacter_nonwaiting_nowrap ld hl,KEYBUF getcharacter_nonwaiting_nowrap: ld (GETPNT),hl pop af cp 8 ;; DELETE ret z cp 13 ;; ENTER ret z cp 27 ;; ESC ret z cp '0' jp m,getcharacter_nonwaiting_invalidkey cp '9'+1 ret m and #df ; make it upper case cp 'Z'+1 jp p,getcharacter_nonwaiting_invalidkey cp 'A' ret p getcharacter_nonwaiting_invalidkey: xor a ret ; cp 'z'+1 ; jp p,getcharacter_nonwaiting_invalidkey ; cp 'a' ; jp p,getcharacter_nonwaiting_lower_case ;getcharacter_nonwaiting_after_converting_to_upper_case ; cp 'Z'+1 ; jp p,getcharacter_nonwaiting_invalidkey ; cp 'A' ; ret p ; cp '9'+1 ; jp p,getcharacter_nonwaiting_invalidkey ; cp '0' ; ret p ;getcharacter_nonwaiting_invalidkey: ; xor a ; ret ;getcharacter_nonwaiting_lower_case: ; add a,'A'-'a' ; jr getcharacter_nonwaiting_after_converting_to_upper_case getcharacter_nonwaiting_reset: di ld hl,(PUTPNT) ld (GETPNT),hl ei ret ;----------------------------------------------- ; Generates a password based on the current state, ; and displays it as a message triggerEvent_generatePassword: ; Generate password in "patternCopyBuffer" ; health and mana: ld hl,player_health ld de,patternCopyBuffer+1 ;; +1 since the first byte is the XOR ldi ; player health ldi ; player mana ; weapons: ld hl,available_weapons+1 ld b,(hl) ; first bit of the available weapons (sword) inc hl ld a,(hl) or a jr z,triggerEvent_generatePassword_no_gold_sword set 1,b ; gold sword triggerEvent_generatePassword_no_gold_sword: ld hl,available_secondary_weapons+1 ld a,(hl) or a jr z,triggerEvent_generatePassword_no_arrows set 2,b ; arrows triggerEvent_generatePassword_no_arrows: inc hl ld a,(hl) or a jr z,triggerEvent_generatePassword_no_ice_arrows set 3,b ; ice arrows triggerEvent_generatePassword_no_ice_arrows: inc hl ld a,(hl) or a jr z,triggerEvent_generatePassword_no_hourglass set 4,b ; hourglass triggerEvent_generatePassword_no_hourglass: ex de,hl ld (hl),b inc hl ; armors: ld de,available_armors+1 ld a,(de) or a jr z,triggerEvent_generatePassword_no_silver_armor ld a,#10 triggerEvent_generatePassword_no_silver_armor: ld (hl),a inc de inc hl ld a,(de) or a jr z,triggerEvent_generatePassword_no_golden_armor ld a,#10 triggerEvent_generatePassword_no_golden_armor: ld (hl),a inc hl ; keys: ld a,(player_keys) ld b,0 bit 0,a jr z,triggerEvent_generatePassword_keysbit0_zero ld b,#10 triggerEvent_generatePassword_keysbit0_zero: ld (hl),b inc hl ld b,0 bit 1,a jr z,triggerEvent_generatePassword_keysbit1_zero ld b,#10 triggerEvent_generatePassword_keysbit1_zero: ld (hl),b inc hl ; bosses: ld b,4 ld de,globalState_BossesKilled triggerEvent_generatePassword_bosskilled_loop: ld a,(de) or a jr z,triggerEvent_generatePassword_bosskilled_zero ld a,#10 triggerEvent_generatePassword_bosskilled_zero: ld (hl),a inc hl inc de djnz triggerEvent_generatePassword_bosskilled_loop ; save the save location (fortress1 or fortress2): ld (hl),#10 ; save "fortress2" temporarily ld a,(player_map) cp MAP_FORTRESS1 jr nz,triggerEvent_generatePassword_savelocation_fortress2 xor a ld (hl),a ; save "fortress1" triggerEvent_generatePassword_savelocation_fortress2: ; set to 0 the last 3 bytes of the password inc hl xor a ld (hl),a inc hl ld (hl),a inc hl ld (hl),a ; doors: ld hl,patternCopyBuffer+4 ld de,globalState_doorsOpen ld b,4 triggerEvent_generatePassword_doors_loop: ld c,(hl) ld a,(de) or a jr z,triggerEvent_generatePassword_doors1_zero set 0,c triggerEvent_generatePassword_doors1_zero: inc de ld a,(de) or a jr z,triggerEvent_generatePassword_doors2_zero set 1,c triggerEvent_generatePassword_doors2_zero: inc de ld a,(de) or a jr z,triggerEvent_generatePassword_doors3_zero set 2,c triggerEvent_generatePassword_doors3_zero: inc de ld a,(de) or a jr z,triggerEvent_generatePassword_doors4_zero set 3,c triggerEvent_generatePassword_doors4_zero: ld (hl),c inc hl inc de djnz triggerEvent_generatePassword_doors_loop ; items: ld de,globalState_itemsPickedUp ld b,8 triggerEvent_generatePassword_items_loop: ld c,(hl) ld a,(de) or a jr z,triggerEvent_generatePassword_items1_zero set 0,c triggerEvent_generatePassword_items1_zero: inc de ld a,(de) or a jr z,triggerEvent_generatePassword_items2_zero set 1,c triggerEvent_generatePassword_items2_zero: inc de ld a,(de) or a jr z,triggerEvent_generatePassword_items3_zero set 2,c triggerEvent_generatePassword_items3_zero: inc de ld a,(de) or a jr z,triggerEvent_generatePassword_items4_zero set 3,c triggerEvent_generatePassword_items4_zero: ld (hl),c inc hl push hl ld hl,MAX_PICKUPS_PER_MAP-3 add hl,de ex de,hl pop hl djnz triggerEvent_generatePassword_items_loop ; XOR: ld hl,patternCopyBuffer+1 ld b,15 xor a triggerEvent_generatePassword_xor_loop xor (hl) inc hl djnz triggerEvent_generatePassword_xor_loop ld hl,patternCopyBuffer ld (hl),a ; copy to currentMapMessages + 44 + 8 ; (which has a template for it): ; by turning it into characters ld de,currentMapMessages + 44 + 7 ld b,8 triggerEvent_generatePassword_convert_to_characters_line1: ld a,(hl) cp 26 jp p,triggerEvent_generatePassword_convert_to_characters_line1_number add a,'A' jr triggerEvent_generatePassword_convert_to_characters_line1_continue triggerEvent_generatePassword_convert_to_characters_line1_number: add a,'0'-26 triggerEvent_generatePassword_convert_to_characters_line1_continue: ld (de),a inc hl inc de djnz triggerEvent_generatePassword_convert_to_characters_line1 ld de,currentMapMessages + 66 + 7 ld b,8 triggerEvent_generatePassword_convert_to_characters_line2: ld a,(hl) cp 26 jp p,triggerEvent_generatePassword_convert_to_characters_line2_number add a,'A' jr triggerEvent_generatePassword_convert_to_characters_line2_continue triggerEvent_generatePassword_convert_to_characters_line2_number: add a,'0'-26 triggerEvent_generatePassword_convert_to_characters_line2_continue: ld (de),a inc hl inc de djnz triggerEvent_generatePassword_convert_to_characters_line2 jp triggerEvent_Message1
/*****************************************************************************/ // Serial port transport add-on. // // Author // Michael Pfeiffer // // This application and all source files used in its construction, except // where noted, are licensed under the MIT License, and have been written // and are: // // Copyright (c) 2001-2003 OpenBeOS Project // // 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. /*****************************************************************************/ #include <unistd.h> #include <stdio.h> #include <StorageKit.h> #include <SupportKit.h> #include "PrintTransportAddOn.h" class SerialTransport : public BDataIO { public: SerialTransport(BDirectory* printer, BMessage* msg); ~SerialTransport(); status_t InitCheck() { return fFile > -1 ? B_OK : B_ERROR; } ssize_t Read(void* buffer, size_t size); ssize_t Write(const void* buffer, size_t size); private: int fFile; }; // Impelmentation of SerialTransport SerialTransport::SerialTransport(BDirectory* printer, BMessage* msg) : fFile(-1) { char address[80]; char device[B_PATH_NAME_LENGTH]; bool bidirectional = true; unsigned int size = printer->ReadAttr("transport_address", B_STRING_TYPE, 0, address, sizeof(address)); if (size <= 0 || size >= sizeof(address)) return; address[size] = 0; // make sure string is 0-terminated strcat(strcpy(device, "/dev/ports/"), address); fFile = open(device, O_RDWR | O_EXCL, 0); if (fFile < 0) { // Try unidirectional access mode bidirectional = false; fFile = open(device, O_WRONLY | O_EXCL, 0); } if (fFile < 0) return; if (! msg) // Caller don't care about transport init message output content... return; msg->what = 'okok'; msg->AddBool("bidirectional", bidirectional); msg->AddString("_serial/DeviceName", device); } SerialTransport::~SerialTransport() { if (InitCheck() == B_OK) close(fFile); } ssize_t SerialTransport::Read(void* buffer, size_t size) { return read(fFile, buffer, size); } ssize_t SerialTransport::Write(const void* buffer, size_t size) { return write(fFile, buffer, size); } BDataIO* instantiate_transport(BDirectory* printer, BMessage* msg) { SerialTransport* transport = new SerialTransport(printer, msg); if (transport->InitCheck() == B_OK) return transport; delete transport; return NULL; } status_t list_transport_ports(BMessage* msg) { BDirectory dir("/dev/ports"); status_t rc; if ((rc=dir.InitCheck()) != B_OK) return rc; if ((rc=dir.Rewind()) != B_OK) return rc; entry_ref ref; while(dir.GetNextRef(&ref) == B_OK) msg->AddString("port_id", ref.name); return B_OK; }
; A140303: Triangle T(n,k) = 3^(n-k) read by rows. ; Submitted by Christian Krause ; 1,3,1,9,3,1,27,9,3,1,81,27,9,3,1,243,81,27,9,3,1,729,243,81,27,9,3,1,2187,729,243,81,27,9,3,1,6561,2187,729,243,81,27,9,3,1,19683,6561,2187,729,243,81,27,9,3,1,59049,19683,6561,2187,729,243,81,27,9,3,1 lpb $0 add $1,1 sub $0,$1 lpe sub $1,$0 mov $0,3 pow $0,$1
;; ;; Copyright (c) 2012-2018, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; * Neither the name of Intel Corporation nor the names of its contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; %include "os.asm" %include "job_aes_hmac.asm" %include "mb_mgr_datastruct.asm" %include "reg_sizes.asm" %include "memcpy.asm" extern sha1_mult_avx section .data default rel align 16 byteswap: ;ddq 0x0c0d0e0f08090a0b0405060700010203 dq 0x0405060700010203, 0x0c0d0e0f08090a0b section .text %if 1 %ifdef LINUX %define arg1 rdi %define arg2 rsi %define reg3 rcx %define reg4 rdx %else %define arg1 rcx %define arg2 rdx %define reg3 rdi %define reg4 rsi %endif %define state arg1 %define job arg2 %define len2 arg2 ; idx needs to be in rbx, rbp, r12-r15 %define last_len rbp %define idx rbp %define p r11 %define start_offset r11 %define unused_lanes rbx %define tmp4 rbx %define job_rax rax %define len rax %define size_offset reg3 %define tmp2 reg3 %define lane reg4 %define tmp3 reg4 %define extra_blocks r8 %define tmp r9 %define p2 r9 %define lane_data r10 %endif ; This routine clobbers rdi, rsi, rbx, rbp struc STACK _gpr_save: resq 4 _rsp_save: resq 1 endstruc ; JOB* submit_job_hmac_avx(MB_MGR_HMAC_SHA_1_OOO *state, JOB_AES_HMAC *job) ; arg 1 : rcx : state ; arg 2 : rdx : job MKGLOBAL(submit_job_hmac_avx,function,internal) submit_job_hmac_avx: mov rax, rsp sub rsp, STACK_size and rsp, -16 mov [rsp + _gpr_save + 8*0], rbx mov [rsp + _gpr_save + 8*1], rbp %ifndef LINUX mov [rsp + _gpr_save + 8*2], rsi mov [rsp + _gpr_save + 8*3], rdi %endif mov [rsp + _rsp_save], rax ; original SP mov unused_lanes, [state + _unused_lanes] movzx lane, BYTE(unused_lanes) shr unused_lanes, 8 imul lane_data, lane, _HMAC_SHA1_LANE_DATA_size lea lane_data, [state + _ldata + lane_data] mov [state + _unused_lanes], unused_lanes mov len, [job + _msg_len_to_hash_in_bytes] mov tmp, len shr tmp, 6 ; divide by 64, len in terms of blocks mov [lane_data + _job_in_lane], job mov dword [lane_data + _outer_done], 0 mov [state + _lens + 2*lane], WORD(tmp) mov last_len, len and last_len, 63 lea extra_blocks, [last_len + 9 + 63] shr extra_blocks, 6 mov [lane_data + _extra_blocks], DWORD(extra_blocks) mov p, [job + _src] add p, [job + _hash_start_src_offset_in_bytes] mov [state + _args_data_ptr + PTR_SZ*lane], p cmp len, 64 jb copy_lt64 fast_copy: add p, len vmovdqu xmm0, [p - 64 + 0*16] vmovdqu xmm1, [p - 64 + 1*16] vmovdqu xmm2, [p - 64 + 2*16] vmovdqu xmm3, [p - 64 + 3*16] vmovdqa [lane_data + _extra_block + 0*16], xmm0 vmovdqa [lane_data + _extra_block + 1*16], xmm1 vmovdqa [lane_data + _extra_block + 2*16], xmm2 vmovdqa [lane_data + _extra_block + 3*16], xmm3 end_fast_copy: mov size_offset, extra_blocks shl size_offset, 6 sub size_offset, last_len add size_offset, 64-8 mov [lane_data + _size_offset], DWORD(size_offset) mov start_offset, 64 sub start_offset, last_len mov [lane_data + _start_offset], DWORD(start_offset) lea tmp, [8*64 + 8*len] bswap tmp mov [lane_data + _extra_block + size_offset], tmp mov tmp, [job + _auth_key_xor_ipad] vmovdqu xmm0, [tmp] mov DWORD(tmp), [tmp + 4*4] vmovd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*lane + 0*SHA1_DIGEST_ROW_SIZE], xmm0 vpextrd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*lane + 1*SHA1_DIGEST_ROW_SIZE], xmm0, 1 vpextrd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*lane + 2*SHA1_DIGEST_ROW_SIZE], xmm0, 2 vpextrd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*lane + 3*SHA1_DIGEST_ROW_SIZE], xmm0, 3 mov [state + _args_digest + SHA1_DIGEST_WORD_SIZE*lane + 4*SHA1_DIGEST_ROW_SIZE], DWORD(tmp) test len, ~63 jnz ge64_bytes lt64_bytes: mov [state + _lens + 2*lane], WORD(extra_blocks) lea tmp, [lane_data + _extra_block + start_offset] mov [state + _args_data_ptr + PTR_SZ*lane], tmp mov dword [lane_data + _extra_blocks], 0 ge64_bytes: cmp unused_lanes, 0xff jne return_null jmp start_loop align 16 start_loop: ; Find min length vmovdqa xmm0, [state + _lens] vphminposuw xmm1, xmm0 vpextrw DWORD(len2), xmm1, 0 ; min value vpextrw DWORD(idx), xmm1, 1 ; min index (0...3) cmp len2, 0 je len_is_0 vpshuflw xmm1, xmm1, 0 vpsubw xmm0, xmm0, xmm1 vmovdqa [state + _lens], xmm0 ; "state" and "args" are the same address, arg1 ; len is arg2 call sha1_mult_avx ; state and idx are intact len_is_0: ; process completed job "idx" imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size lea lane_data, [state + _ldata + lane_data] mov DWORD(extra_blocks), [lane_data + _extra_blocks] cmp extra_blocks, 0 jne proc_extra_blocks cmp dword [lane_data + _outer_done], 0 jne end_loop proc_outer: mov dword [lane_data + _outer_done], 1 mov DWORD(size_offset), [lane_data + _size_offset] mov qword [lane_data + _extra_block + size_offset], 0 mov word [state + _lens + 2*idx], 1 lea tmp, [lane_data + _outer_block] mov job, [lane_data + _job_in_lane] mov [state + _args_data_ptr + PTR_SZ*idx], tmp vmovd xmm0, [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 0*SHA1_DIGEST_ROW_SIZE] vpinsrd xmm0, xmm0, [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 1*SHA1_DIGEST_ROW_SIZE], 1 vpinsrd xmm0, xmm0, [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 2*SHA1_DIGEST_ROW_SIZE], 2 vpinsrd xmm0, xmm0, [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 3*SHA1_DIGEST_ROW_SIZE], 3 vpshufb xmm0, xmm0, [rel byteswap] mov DWORD(tmp), [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 4*SHA1_DIGEST_ROW_SIZE] bswap DWORD(tmp) vmovdqa [lane_data + _outer_block], xmm0 mov [lane_data + _outer_block + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp) mov tmp, [job + _auth_key_xor_opad] vmovdqu xmm0, [tmp] mov DWORD(tmp), [tmp + 4*4] vmovd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 0*SHA1_DIGEST_ROW_SIZE], xmm0 vpextrd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 1*SHA1_DIGEST_ROW_SIZE], xmm0, 1 vpextrd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 2*SHA1_DIGEST_ROW_SIZE], xmm0, 2 vpextrd [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 3*SHA1_DIGEST_ROW_SIZE], xmm0, 3 mov [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 4*SHA1_DIGEST_ROW_SIZE], DWORD(tmp) jmp start_loop align 16 proc_extra_blocks: mov DWORD(start_offset), [lane_data + _start_offset] mov [state + _lens + 2*idx], WORD(extra_blocks) lea tmp, [lane_data + _extra_block + start_offset] mov [state + _args_data_ptr + PTR_SZ*idx], tmp mov dword [lane_data + _extra_blocks], 0 jmp start_loop align 16 copy_lt64: ;; less than one message block of data ;; beginning of source block ;; destination extrablock but backwards by len from where 0x80 pre-populated lea p2, [lane_data + _extra_block + 64] sub p2, len memcpy_avx_64_1 p2, p, len, tmp4, tmp2, xmm0, xmm1, xmm2, xmm3 mov unused_lanes, [state + _unused_lanes] jmp end_fast_copy return_null: xor job_rax, job_rax jmp return align 16 end_loop: mov job_rax, [lane_data + _job_in_lane] mov unused_lanes, [state + _unused_lanes] mov qword [lane_data + _job_in_lane], 0 or dword [job_rax + _status], STS_COMPLETED_HMAC shl unused_lanes, 8 or unused_lanes, idx mov [state + _unused_lanes], unused_lanes mov p, [job_rax + _auth_tag_output] ; copy 12 bytes mov DWORD(tmp), [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 0*SHA1_DIGEST_ROW_SIZE] mov DWORD(tmp2), [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 1*SHA1_DIGEST_ROW_SIZE] mov DWORD(tmp3), [state + _args_digest + SHA1_DIGEST_WORD_SIZE*idx + 2*SHA1_DIGEST_ROW_SIZE] bswap DWORD(tmp) bswap DWORD(tmp2) bswap DWORD(tmp3) mov [p + 0*SHA1_DIGEST_WORD_SIZE], DWORD(tmp) mov [p + 1*SHA1_DIGEST_WORD_SIZE], DWORD(tmp2) mov [p + 2*SHA1_DIGEST_WORD_SIZE], DWORD(tmp3) return: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*2] mov rdi, [rsp + _gpr_save + 8*3] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %ifdef LINUX section .note.GNU-stack noalloc noexec nowrite progbits %endif
#Adds two values together #Run and look at the $t0, $t1, and $t2 registers li $t0, 73 #Loads the constant 73 (0x49) to $t0 li $t1, 31 #Loads the constant 31 (0x1f) to $t1 sub $t2, $t0, $t1 #$t2 = $t0 - $t1 #Result is 42 (0x2a)
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/iot/model/SubscribeTopicRequest.h> using AlibabaCloud::Iot::Model::SubscribeTopicRequest; SubscribeTopicRequest::SubscribeTopicRequest() : RpcServiceRequest("iot", "2018-01-20", "SubscribeTopic") { setMethod(HttpRequest::Method::Post); } SubscribeTopicRequest::~SubscribeTopicRequest() {} std::string SubscribeTopicRequest::getIotInstanceId()const { return iotInstanceId_; } void SubscribeTopicRequest::setIotInstanceId(const std::string& iotInstanceId) { iotInstanceId_ = iotInstanceId; setParameter("IotInstanceId", iotInstanceId); } std::string SubscribeTopicRequest::getProductKey()const { return productKey_; } void SubscribeTopicRequest::setProductKey(const std::string& productKey) { productKey_ = productKey; setParameter("ProductKey", productKey); } std::string SubscribeTopicRequest::getApiProduct()const { return apiProduct_; } void SubscribeTopicRequest::setApiProduct(const std::string& apiProduct) { apiProduct_ = apiProduct; setBodyParameter("ApiProduct", apiProduct); } std::vector<std::string> SubscribeTopicRequest::getTopic()const { return topic_; } void SubscribeTopicRequest::setTopic(const std::vector<std::string>& topic) { topic_ = topic; for(int dep1 = 0; dep1!= topic.size(); dep1++) { setParameter("Topic."+ std::to_string(dep1), topic.at(dep1)); } } std::string SubscribeTopicRequest::getApiRevision()const { return apiRevision_; } void SubscribeTopicRequest::setApiRevision(const std::string& apiRevision) { apiRevision_ = apiRevision; setBodyParameter("ApiRevision", apiRevision); } std::string SubscribeTopicRequest::getDeviceName()const { return deviceName_; } void SubscribeTopicRequest::setDeviceName(const std::string& deviceName) { deviceName_ = deviceName; setParameter("DeviceName", deviceName); }
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1 TITLE Z:\Sources\Lunor\Repos\rougemeilland\Palmtree.Math.Core.Implements\Palmtree.Math.Core.Implements\pmc_subtruct.c .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRTD INCLUDELIB OLDNAMES msvcjmc SEGMENT __7B7A869E_ctype@h DB 01H __457DD326_basetsd@h DB 01H __4384A2D9_corecrt_memcpy_s@h DB 01H __4E51A221_corecrt_wstring@h DB 01H __2140C079_string@h DB 01H __1887E595_winnt@h DB 01H __9FC7C64B_processthreadsapi@h DB 01H __FA470AEC_memoryapi@h DB 01H __F37DAFF1_winerror@h DB 01H __7A450CCC_winbase@h DB 01H __B4B40122_winioctl@h DB 01H __86261D59_stralign@h DB 01H __7B8DBFC3_pmc_uint_internal@h DB 01H __6B0481B0_pmc_inline_func@h DB 01H __89DB6AB9_autogenerated_inline_func@h DB 01H __1898920A_pmc_subtruct@c DB 01H msvcjmc ENDS PUBLIC _Subtruct_Imp PUBLIC _Initialize_Subtruct PUBLIC _PMC_Subtruct_I_X@12 PUBLIC _PMC_Subtruct_L_X@16 PUBLIC _PMC_Subtruct_X_I@12 PUBLIC _PMC_Subtruct_X_L@16 PUBLIC _PMC_Subtruct_X_X@12 PUBLIC __JustMyCode_Default EXTRN _CheckBlockLight:PROC EXTRN _AllocateNumber:PROC EXTRN _DeallocateNumber:PROC EXTRN _CommitNumber:PROC EXTRN _CheckNumber:PROC EXTRN _DuplicateNumber:PROC EXTRN @_RTC_CheckStackVars@8:PROC EXTRN @__CheckForDebuggerJustMyCode@4:PROC EXTRN __RTC_CheckEsp:PROC EXTRN __RTC_InitBase:PROC EXTRN __RTC_Shutdown:PROC EXTRN __allshl:PROC EXTRN __aullshr:PROC EXTRN _number_zero:BYTE ; COMDAT rtc$TMZ rtc$TMZ SEGMENT __RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown rtc$TMZ ENDS ; COMDAT rtc$IMZ rtc$IMZ SEGMENT __RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase rtc$IMZ ENDS ; Function compile flags: /Odt ; COMDAT __JustMyCode_Default _TEXT SEGMENT __JustMyCode_Default PROC ; COMDAT push ebp mov ebp, esp pop ebp ret 0 __JustMyCode_Default ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv80 = -20 ; size = 4 tv76 = -16 ; size = 4 tv71 = -12 ; size = 4 tv67 = -8 ; size = 4 _c$1 = -1 ; size = 1 _up$ = 8 ; size = 4 _u_count$ = 12 ; size = 4 _v_hi$ = 16 ; size = 4 _v_lo$ = 20 ; size = 4 _wp$ = 24 ; size = 4 _w_count$ = 28 ; size = 4 _Subtruct_X_2W PROC ; 98 : { push ebp mov ebp, esp sub esp, 20 ; 00000014H mov eax, -858993460 ; ccccccccH mov DWORD PTR [ebp-20], eax mov DWORD PTR [ebp-16], eax mov DWORD PTR [ebp-12], eax mov DWORD PTR [ebp-8], eax mov DWORD PTR [ebp-4], eax mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 99 : if (u_count < 2) cmp DWORD PTR _u_count$[ebp], 2 jae SHORT $LN2@Subtruct_X ; 100 : { ; 101 : // u が 1 ワードしかなかった場合 ; 102 : ; 103 : // 明らかに演算結果が負になるのでエラーを通知する。 ; 104 : return (PMC_STATUS_INTERNAL_BORROW); mov eax, -258 ; fffffefeH jmp $LN1@Subtruct_X ; 105 : } jmp $LN1@Subtruct_X $LN2@Subtruct_X: ; 106 : else ; 107 : { ; 108 : // x が 2 ワード以上あった場合 ; 109 : ; 110 : // 最下位のワードの減算をする ; 111 : char c = _SUBTRUCT_UNIT(0, *up++, v_lo, wp++); mov eax, DWORD PTR _wp$[ebp] mov DWORD PTR tv67[ebp], eax mov ecx, DWORD PTR _wp$[ebp] add ecx, 4 mov DWORD PTR _wp$[ebp], ecx mov edx, DWORD PTR _up$[ebp] mov eax, DWORD PTR [edx] mov DWORD PTR tv71[ebp], eax mov ecx, DWORD PTR _up$[ebp] add ecx, 4 mov DWORD PTR _up$[ebp], ecx mov edx, DWORD PTR tv67[ebp] push edx mov eax, DWORD PTR _v_lo$[ebp] push eax mov ecx, DWORD PTR tv71[ebp] push ecx push 0 call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$1[ebp], al ; 112 : ; 113 : // 最下位から 2 番目のワードの減算をする。 ; 114 : c = _SUBTRUCT_UNIT(c, *up++, v_hi, wp++); mov edx, DWORD PTR _wp$[ebp] mov DWORD PTR tv76[ebp], edx mov eax, DWORD PTR _wp$[ebp] add eax, 4 mov DWORD PTR _wp$[ebp], eax mov ecx, DWORD PTR _up$[ebp] mov edx, DWORD PTR [ecx] mov DWORD PTR tv80[ebp], edx mov eax, DWORD PTR _up$[ebp] add eax, 4 mov DWORD PTR _up$[ebp], eax mov ecx, DWORD PTR tv76[ebp] push ecx mov edx, DWORD PTR _v_hi$[ebp] push edx mov eax, DWORD PTR tv80[ebp] push eax movzx ecx, BYTE PTR _c$1[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$1[ebp], al ; 115 : u_count -= 2; mov edx, DWORD PTR _u_count$[ebp] sub edx, 2 mov DWORD PTR _u_count$[ebp], edx ; 116 : w_count -= 2; mov eax, DWORD PTR _w_count$[ebp] sub eax, 2 mov DWORD PTR _w_count$[ebp], eax ; 117 : ; 118 : // 残りの桁の繰り上がりを計算し、復帰する。 ; 119 : return (DoBorrow(c, up, u_count, wp, w_count)); mov ecx, DWORD PTR _w_count$[ebp] push ecx mov edx, DWORD PTR _wp$[ebp] push edx mov eax, DWORD PTR _u_count$[ebp] push eax mov ecx, DWORD PTR _up$[ebp] push ecx movzx edx, BYTE PTR _c$1[ebp] push edx call _DoBorrow add esp, 20 ; 00000014H $LN1@Subtruct_X: ; 120 : } ; 121 : } add esp, 20 ; 00000014H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 _Subtruct_X_2W ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv70 = -12 ; size = 4 tv66 = -8 ; size = 4 _c$ = -1 ; size = 1 _up$ = 8 ; size = 4 _u_count$ = 12 ; size = 4 _v$ = 16 ; size = 4 _wp$ = 20 ; size = 4 _w_count$ = 24 ; size = 4 _Subtruct_X_1W PROC ; 86 : { push ebp mov ebp, esp sub esp, 12 ; 0000000cH mov DWORD PTR [ebp-12], -858993460 ; ccccccccH mov DWORD PTR [ebp-8], -858993460 ; ccccccccH mov DWORD PTR [ebp-4], -858993460 ; ccccccccH mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 87 : // 最下桁の減算を行う ; 88 : char c = _SUBTRUCT_UNIT(0, *up++, v, wp++); mov eax, DWORD PTR _wp$[ebp] mov DWORD PTR tv66[ebp], eax mov ecx, DWORD PTR _wp$[ebp] add ecx, 4 mov DWORD PTR _wp$[ebp], ecx mov edx, DWORD PTR _up$[ebp] mov eax, DWORD PTR [edx] mov DWORD PTR tv70[ebp], eax mov ecx, DWORD PTR _up$[ebp] add ecx, 4 mov DWORD PTR _up$[ebp], ecx mov edx, DWORD PTR tv66[ebp] push edx mov eax, DWORD PTR _v$[ebp] push eax mov ecx, DWORD PTR tv70[ebp] push ecx push 0 call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 89 : --u_count; mov edx, DWORD PTR _u_count$[ebp] sub edx, 1 mov DWORD PTR _u_count$[ebp], edx ; 90 : --w_count; mov eax, DWORD PTR _w_count$[ebp] sub eax, 1 mov DWORD PTR _w_count$[ebp], eax ; 91 : ; 92 : // 残りの桁の繰上りを行い復帰する。 ; 93 : return (DoBorrow(c, up, u_count, wp, w_count)); mov ecx, DWORD PTR _w_count$[ebp] push ecx mov edx, DWORD PTR _wp$[ebp] push edx mov eax, DWORD PTR _u_count$[ebp] push eax mov ecx, DWORD PTR _up$[ebp] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call _DoBorrow add esp, 20 ; 00000014H ; 94 : } add esp, 12 ; 0000000cH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 _Subtruct_X_1W ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv75 = -8 ; size = 4 tv71 = -4 ; size = 4 _c$ = 8 ; size = 1 _up$ = 12 ; size = 4 _u_count$ = 16 ; size = 4 _wp$ = 20 ; size = 4 _w_count$ = 24 ; size = 4 _DoBorrow PROC ; 40 : { push ebp mov ebp, esp sub esp, 8 mov DWORD PTR [ebp-8], -858993460 ; ccccccccH mov DWORD PTR [ebp-4], -858993460 ; ccccccccH mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 $LN4@DoBorrow: ; 41 : // 桁借りを続く限り行う ; 42 : for (;;) ; 43 : { ; 44 : if (u_count <= 0) cmp DWORD PTR _u_count$[ebp], 0 ja SHORT $LN7@DoBorrow ; 45 : { ; 46 : // x の最上位まで達してしまった場合 ; 47 : ; 48 : if (c) movsx eax, BYTE PTR _c$[ebp] test eax, eax je SHORT $LN9@DoBorrow ; 49 : { ; 50 : // かつそれでも桁借りを行う必要がある場合 ; 51 : ; 52 : // 減算結果が負になってしまったので呼び出し元に通知する。 ; 53 : return (PMC_STATUS_INTERNAL_BORROW); mov eax, -258 ; fffffefeH jmp $LN1@DoBorrow $LN9@DoBorrow: ; 54 : } ; 55 : ; 56 : // xの最上位に達してしまった場合はいずれにしろループを中断して正常復帰する。 ; 57 : ; 58 : return (PMC_STATUS_OK); xor eax, eax jmp $LN1@DoBorrow ; 59 : } jmp $LN8@DoBorrow $LN7@DoBorrow: ; 60 : else if (c) movsx ecx, BYTE PTR _c$[ebp] test ecx, ecx je SHORT $LN5@DoBorrow ; 61 : { ; 62 : // xの最上位に達しておらず、かつボローが立っている場合 ; 63 : ; 64 : // 桁借りを継続する ; 65 : c = _SUBTRUCT_UNIT(c, *up++, 0, wp++); mov edx, DWORD PTR _wp$[ebp] mov DWORD PTR tv71[ebp], edx mov eax, DWORD PTR _wp$[ebp] add eax, 4 mov DWORD PTR _wp$[ebp], eax mov ecx, DWORD PTR _up$[ebp] mov edx, DWORD PTR [ecx] mov DWORD PTR tv75[ebp], edx mov eax, DWORD PTR _up$[ebp] add eax, 4 mov DWORD PTR _up$[ebp], eax mov ecx, DWORD PTR tv71[ebp] push ecx push 0 mov edx, DWORD PTR tv75[ebp] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 66 : --u_count; mov ecx, DWORD PTR _u_count$[ebp] sub ecx, 1 mov DWORD PTR _u_count$[ebp], ecx ; 67 : --w_count; mov edx, DWORD PTR _w_count$[ebp] sub edx, 1 mov DWORD PTR _w_count$[ebp], edx ; 68 : } jmp SHORT $LN8@DoBorrow $LN5@DoBorrow: ; 69 : else ; 70 : { ; 71 : // xの最上位に達しておらず、かつボローが立っていない場合 ; 72 : ; 73 : // 桁借りを中断し、xの残りのデータをzにそのまま複写し、正常復帰する。 ; 74 : while (u_count > 0) cmp DWORD PTR _u_count$[ebp], 0 jbe SHORT $LN6@DoBorrow ; 75 : { ; 76 : *wp++ = *up++; mov eax, DWORD PTR _wp$[ebp] mov ecx, DWORD PTR _up$[ebp] mov edx, DWORD PTR [ecx] mov DWORD PTR [eax], edx mov eax, DWORD PTR _wp$[ebp] add eax, 4 mov DWORD PTR _wp$[ebp], eax mov ecx, DWORD PTR _up$[ebp] add ecx, 4 mov DWORD PTR _up$[ebp], ecx ; 77 : --u_count; mov edx, DWORD PTR _u_count$[ebp] sub edx, 1 mov DWORD PTR _u_count$[ebp], edx ; 78 : --w_count; mov eax, DWORD PTR _w_count$[ebp] sub eax, 1 mov DWORD PTR _w_count$[ebp], eax ; 79 : } jmp SHORT $LN5@DoBorrow $LN6@DoBorrow: ; 80 : return (PMC_STATUS_OK); xor eax, eax jmp SHORT $LN1@DoBorrow $LN8@DoBorrow: ; 81 : } ; 82 : } jmp $LN4@DoBorrow $LN1@DoBorrow: ; 83 : } add esp, 8 cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 _DoBorrow ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\autogenerated_inline_func.h _TEXT SEGMENT _c$ = 8 ; size = 1 _xp$ = 12 ; size = 4 _yp$ = 16 ; size = 4 _zp$ = 20 ; size = 4 __SUBTRUCT_2WORDS_SBB PROC ; 4464 : { push ebp mov ebp, esp mov ecx, OFFSET __89DB6AB9_autogenerated_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 4465 : #ifdef _MSC_VER ; 4466 : c = _SUBTRUCT_UNIT(c, xp[0], yp[0], &zp[0]); mov eax, 4 imul ecx, eax, 0 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 4467 : c = _SUBTRUCT_UNIT(c, xp[1], yp[1], &zp[1]); mov edx, 4 shl edx, 0 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 4468 : #elif defined(__GNUC__) ; 4469 : #ifdef _M_IX86 ; 4470 : __asm__ volatile ( ; 4471 : "addb\t$-1, %0\n\t" ; 4472 : "movl\t(%1), %%ecx\n\t" ; 4473 : "sbbl\t(%2), %%ecx\n\t" ; 4474 : "movl\t%%ecx, (%3)\n\t" ; 4475 : "movl\t4(%1), %%ecx\n\t" ; 4476 : "sbbl\t4(%2), %%ecx\n\t" ; 4477 : "movl\t%%ecx, 4(%3)\n\t" ; 4478 : "setc\t%0" ; 4479 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 4480 : : ; 4481 : : "cc", "memory", "%ecx" ; 4482 : ); ; 4483 : #elif defined(_M_IX64) ; 4484 : __asm__ volatile ( ; 4485 : "addb\t$-1, %0\n\t" ; 4486 : "movq\t(%1), %%rcx\n\t" ; 4487 : "sbbq\t(%2), %%rcx\n\t" ; 4488 : "movq\t%%rcx, (%3)\n\t" ; 4489 : "movq\t8(%1), %%rcx\n\t" ; 4490 : "sbbq\t8(%2), %%rcx\n\t" ; 4491 : "movq\t%%rcx, 8(%3)\n\t" ; 4492 : "setc\t%0" ; 4493 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 4494 : : ; 4495 : : "cc", "memory", "%rcx" ; 4496 : ); ; 4497 : #else ; 4498 : #error unknown platform ; 4499 : #endif ; 4500 : #else ; 4501 : #error unknown compiler ; 4502 : #endif ; 4503 : return (c); mov al, BYTE PTR _c$[ebp] ; 4504 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __SUBTRUCT_2WORDS_SBB ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\autogenerated_inline_func.h _TEXT SEGMENT _c$ = 8 ; size = 1 _xp$ = 12 ; size = 4 _yp$ = 16 ; size = 4 _zp$ = 20 ; size = 4 __SUBTRUCT_4WORDS_SBB PROC ; 4050 : { push ebp mov ebp, esp mov ecx, OFFSET __89DB6AB9_autogenerated_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 4051 : #ifdef _MSC_VER ; 4052 : c = _SUBTRUCT_UNIT(c, xp[0], yp[0], &zp[0]); mov eax, 4 imul ecx, eax, 0 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 4053 : c = _SUBTRUCT_UNIT(c, xp[1], yp[1], &zp[1]); mov edx, 4 shl edx, 0 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 4054 : c = _SUBTRUCT_UNIT(c, xp[2], yp[2], &zp[2]); mov ecx, 4 shl ecx, 1 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 4055 : c = _SUBTRUCT_UNIT(c, xp[3], yp[3], &zp[3]); mov eax, 4 imul ecx, eax, 3 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 3 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 3 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 4056 : #elif defined(__GNUC__) ; 4057 : #ifdef _M_IX86 ; 4058 : __asm__ volatile ( ; 4059 : "addb\t$-1, %0\n\t" ; 4060 : "movl\t(%1), %%ecx\n\t" ; 4061 : "sbbl\t(%2), %%ecx\n\t" ; 4062 : "movl\t%%ecx, (%3)\n\t" ; 4063 : "movl\t4(%1), %%ecx\n\t" ; 4064 : "sbbl\t4(%2), %%ecx\n\t" ; 4065 : "movl\t%%ecx, 4(%3)\n\t" ; 4066 : "movl\t8(%1), %%ecx\n\t" ; 4067 : "sbbl\t8(%2), %%ecx\n\t" ; 4068 : "movl\t%%ecx, 8(%3)\n\t" ; 4069 : "movl\t12(%1), %%ecx\n\t" ; 4070 : "sbbl\t12(%2), %%ecx\n\t" ; 4071 : "movl\t%%ecx, 12(%3)\n\t" ; 4072 : "setc\t%0" ; 4073 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 4074 : : ; 4075 : : "cc", "memory", "%ecx" ; 4076 : ); ; 4077 : #elif defined(_M_IX64) ; 4078 : __asm__ volatile ( ; 4079 : "addb\t$-1, %0\n\t" ; 4080 : "movq\t(%1), %%rcx\n\t" ; 4081 : "sbbq\t(%2), %%rcx\n\t" ; 4082 : "movq\t%%rcx, (%3)\n\t" ; 4083 : "movq\t8(%1), %%rcx\n\t" ; 4084 : "sbbq\t8(%2), %%rcx\n\t" ; 4085 : "movq\t%%rcx, 8(%3)\n\t" ; 4086 : "movq\t16(%1), %%rcx\n\t" ; 4087 : "sbbq\t16(%2), %%rcx\n\t" ; 4088 : "movq\t%%rcx, 16(%3)\n\t" ; 4089 : "movq\t24(%1), %%rcx\n\t" ; 4090 : "sbbq\t24(%2), %%rcx\n\t" ; 4091 : "movq\t%%rcx, 24(%3)\n\t" ; 4092 : "setc\t%0" ; 4093 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 4094 : : ; 4095 : : "cc", "memory", "%rcx" ; 4096 : ); ; 4097 : #else ; 4098 : #error unknown platform ; 4099 : #endif ; 4100 : #else ; 4101 : #error unknown compiler ; 4102 : #endif ; 4103 : return (c); mov al, BYTE PTR _c$[ebp] ; 4104 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __SUBTRUCT_4WORDS_SBB ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\autogenerated_inline_func.h _TEXT SEGMENT _c$ = 8 ; size = 1 _xp$ = 12 ; size = 4 _yp$ = 16 ; size = 4 _zp$ = 20 ; size = 4 __SUBTRUCT_8WORDS_SBB PROC ; 3454 : { push ebp mov ebp, esp mov ecx, OFFSET __89DB6AB9_autogenerated_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 3455 : #ifdef _MSC_VER ; 3456 : c = _SUBTRUCT_UNIT(c, xp[0], yp[0], &zp[0]); mov eax, 4 imul ecx, eax, 0 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3457 : c = _SUBTRUCT_UNIT(c, xp[1], yp[1], &zp[1]); mov edx, 4 shl edx, 0 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3458 : c = _SUBTRUCT_UNIT(c, xp[2], yp[2], &zp[2]); mov ecx, 4 shl ecx, 1 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3459 : c = _SUBTRUCT_UNIT(c, xp[3], yp[3], &zp[3]); mov eax, 4 imul ecx, eax, 3 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 3 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 3 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3460 : c = _SUBTRUCT_UNIT(c, xp[4], yp[4], &zp[4]); mov edx, 4 shl edx, 2 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 2 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 2 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3461 : c = _SUBTRUCT_UNIT(c, xp[5], yp[5], &zp[5]); mov ecx, 4 imul edx, ecx, 5 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 5 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 5 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3462 : c = _SUBTRUCT_UNIT(c, xp[6], yp[6], &zp[6]); mov eax, 4 imul ecx, eax, 6 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 6 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 6 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3463 : c = _SUBTRUCT_UNIT(c, xp[7], yp[7], &zp[7]); mov edx, 4 imul eax, edx, 7 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 7 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 7 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 3464 : #elif defined(__GNUC__) ; 3465 : #ifdef _M_IX86 ; 3466 : __asm__ volatile ( ; 3467 : "addb\t$-1, %0\n\t" ; 3468 : "movl\t(%1), %%ecx\n\t" ; 3469 : "sbbl\t(%2), %%ecx\n\t" ; 3470 : "movl\t%%ecx, (%3)\n\t" ; 3471 : "movl\t4(%1), %%ecx\n\t" ; 3472 : "sbbl\t4(%2), %%ecx\n\t" ; 3473 : "movl\t%%ecx, 4(%3)\n\t" ; 3474 : "movl\t8(%1), %%ecx\n\t" ; 3475 : "sbbl\t8(%2), %%ecx\n\t" ; 3476 : "movl\t%%ecx, 8(%3)\n\t" ; 3477 : "movl\t12(%1), %%ecx\n\t" ; 3478 : "sbbl\t12(%2), %%ecx\n\t" ; 3479 : "movl\t%%ecx, 12(%3)\n\t" ; 3480 : "movl\t16(%1), %%ecx\n\t" ; 3481 : "sbbl\t16(%2), %%ecx\n\t" ; 3482 : "movl\t%%ecx, 16(%3)\n\t" ; 3483 : "movl\t20(%1), %%ecx\n\t" ; 3484 : "sbbl\t20(%2), %%ecx\n\t" ; 3485 : "movl\t%%ecx, 20(%3)\n\t" ; 3486 : "movl\t24(%1), %%ecx\n\t" ; 3487 : "sbbl\t24(%2), %%ecx\n\t" ; 3488 : "movl\t%%ecx, 24(%3)\n\t" ; 3489 : "movl\t28(%1), %%ecx\n\t" ; 3490 : "sbbl\t28(%2), %%ecx\n\t" ; 3491 : "movl\t%%ecx, 28(%3)\n\t" ; 3492 : "setc\t%0" ; 3493 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 3494 : : ; 3495 : : "cc", "memory", "%ecx" ; 3496 : ); ; 3497 : #elif defined(_M_IX64) ; 3498 : __asm__ volatile ( ; 3499 : "addb\t$-1, %0\n\t" ; 3500 : "movq\t(%1), %%rcx\n\t" ; 3501 : "sbbq\t(%2), %%rcx\n\t" ; 3502 : "movq\t%%rcx, (%3)\n\t" ; 3503 : "movq\t8(%1), %%rcx\n\t" ; 3504 : "sbbq\t8(%2), %%rcx\n\t" ; 3505 : "movq\t%%rcx, 8(%3)\n\t" ; 3506 : "movq\t16(%1), %%rcx\n\t" ; 3507 : "sbbq\t16(%2), %%rcx\n\t" ; 3508 : "movq\t%%rcx, 16(%3)\n\t" ; 3509 : "movq\t24(%1), %%rcx\n\t" ; 3510 : "sbbq\t24(%2), %%rcx\n\t" ; 3511 : "movq\t%%rcx, 24(%3)\n\t" ; 3512 : "movq\t32(%1), %%rcx\n\t" ; 3513 : "sbbq\t32(%2), %%rcx\n\t" ; 3514 : "movq\t%%rcx, 32(%3)\n\t" ; 3515 : "movq\t40(%1), %%rcx\n\t" ; 3516 : "sbbq\t40(%2), %%rcx\n\t" ; 3517 : "movq\t%%rcx, 40(%3)\n\t" ; 3518 : "movq\t48(%1), %%rcx\n\t" ; 3519 : "sbbq\t48(%2), %%rcx\n\t" ; 3520 : "movq\t%%rcx, 48(%3)\n\t" ; 3521 : "movq\t56(%1), %%rcx\n\t" ; 3522 : "sbbq\t56(%2), %%rcx\n\t" ; 3523 : "movq\t%%rcx, 56(%3)\n\t" ; 3524 : "setc\t%0" ; 3525 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 3526 : : ; 3527 : : "cc", "memory", "%rcx" ; 3528 : ); ; 3529 : #else ; 3530 : #error unknown platform ; 3531 : #endif ; 3532 : #else ; 3533 : #error unknown compiler ; 3534 : #endif ; 3535 : return (c); mov al, BYTE PTR _c$[ebp] ; 3536 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __SUBTRUCT_8WORDS_SBB ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\autogenerated_inline_func.h _TEXT SEGMENT _c$ = 8 ; size = 1 _xp$ = 12 ; size = 4 _yp$ = 16 ; size = 4 _zp$ = 20 ; size = 4 __SUBTRUCT_16WORDS_SBB PROC ; 2494 : { push ebp mov ebp, esp mov ecx, OFFSET __89DB6AB9_autogenerated_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 2495 : #ifdef _MSC_VER ; 2496 : c = _SUBTRUCT_UNIT(c, xp[0], yp[0], &zp[0]); mov eax, 4 imul ecx, eax, 0 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2497 : c = _SUBTRUCT_UNIT(c, xp[1], yp[1], &zp[1]); mov edx, 4 shl edx, 0 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2498 : c = _SUBTRUCT_UNIT(c, xp[2], yp[2], &zp[2]); mov ecx, 4 shl ecx, 1 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2499 : c = _SUBTRUCT_UNIT(c, xp[3], yp[3], &zp[3]); mov eax, 4 imul ecx, eax, 3 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 3 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 3 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2500 : c = _SUBTRUCT_UNIT(c, xp[4], yp[4], &zp[4]); mov edx, 4 shl edx, 2 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 2 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 2 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2501 : c = _SUBTRUCT_UNIT(c, xp[5], yp[5], &zp[5]); mov ecx, 4 imul edx, ecx, 5 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 5 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 5 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2502 : c = _SUBTRUCT_UNIT(c, xp[6], yp[6], &zp[6]); mov eax, 4 imul ecx, eax, 6 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 6 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 6 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2503 : c = _SUBTRUCT_UNIT(c, xp[7], yp[7], &zp[7]); mov edx, 4 imul eax, edx, 7 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 7 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 7 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2504 : c = _SUBTRUCT_UNIT(c, xp[8], yp[8], &zp[8]); mov ecx, 4 shl ecx, 3 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 shl edx, 3 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 shl edx, 3 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2505 : c = _SUBTRUCT_UNIT(c, xp[9], yp[9], &zp[9]); mov eax, 4 imul ecx, eax, 9 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 9 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 9 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2506 : c = _SUBTRUCT_UNIT(c, xp[10], yp[10], &zp[10]); mov edx, 4 imul eax, edx, 10 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 10 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 10 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2507 : c = _SUBTRUCT_UNIT(c, xp[11], yp[11], &zp[11]); mov ecx, 4 imul edx, ecx, 11 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 11 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 11 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2508 : c = _SUBTRUCT_UNIT(c, xp[12], yp[12], &zp[12]); mov eax, 4 imul ecx, eax, 12 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 12 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 12 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2509 : c = _SUBTRUCT_UNIT(c, xp[13], yp[13], &zp[13]); mov edx, 4 imul eax, edx, 13 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 13 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 13 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2510 : c = _SUBTRUCT_UNIT(c, xp[14], yp[14], &zp[14]); mov ecx, 4 imul edx, ecx, 14 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 14 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 14 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2511 : c = _SUBTRUCT_UNIT(c, xp[15], yp[15], &zp[15]); mov eax, 4 imul ecx, eax, 15 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 15 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 15 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 2512 : #elif defined(__GNUC__) ; 2513 : #ifdef _M_IX86 ; 2514 : __asm__ volatile ( ; 2515 : "addb\t$-1, %0\n\t" ; 2516 : "movl\t(%1), %%ecx\n\t" ; 2517 : "sbbl\t(%2), %%ecx\n\t" ; 2518 : "movl\t%%ecx, (%3)\n\t" ; 2519 : "movl\t4(%1), %%ecx\n\t" ; 2520 : "sbbl\t4(%2), %%ecx\n\t" ; 2521 : "movl\t%%ecx, 4(%3)\n\t" ; 2522 : "movl\t8(%1), %%ecx\n\t" ; 2523 : "sbbl\t8(%2), %%ecx\n\t" ; 2524 : "movl\t%%ecx, 8(%3)\n\t" ; 2525 : "movl\t12(%1), %%ecx\n\t" ; 2526 : "sbbl\t12(%2), %%ecx\n\t" ; 2527 : "movl\t%%ecx, 12(%3)\n\t" ; 2528 : "movl\t16(%1), %%ecx\n\t" ; 2529 : "sbbl\t16(%2), %%ecx\n\t" ; 2530 : "movl\t%%ecx, 16(%3)\n\t" ; 2531 : "movl\t20(%1), %%ecx\n\t" ; 2532 : "sbbl\t20(%2), %%ecx\n\t" ; 2533 : "movl\t%%ecx, 20(%3)\n\t" ; 2534 : "movl\t24(%1), %%ecx\n\t" ; 2535 : "sbbl\t24(%2), %%ecx\n\t" ; 2536 : "movl\t%%ecx, 24(%3)\n\t" ; 2537 : "movl\t28(%1), %%ecx\n\t" ; 2538 : "sbbl\t28(%2), %%ecx\n\t" ; 2539 : "movl\t%%ecx, 28(%3)\n\t" ; 2540 : "movl\t32(%1), %%ecx\n\t" ; 2541 : "sbbl\t32(%2), %%ecx\n\t" ; 2542 : "movl\t%%ecx, 32(%3)\n\t" ; 2543 : "movl\t36(%1), %%ecx\n\t" ; 2544 : "sbbl\t36(%2), %%ecx\n\t" ; 2545 : "movl\t%%ecx, 36(%3)\n\t" ; 2546 : "movl\t40(%1), %%ecx\n\t" ; 2547 : "sbbl\t40(%2), %%ecx\n\t" ; 2548 : "movl\t%%ecx, 40(%3)\n\t" ; 2549 : "movl\t44(%1), %%ecx\n\t" ; 2550 : "sbbl\t44(%2), %%ecx\n\t" ; 2551 : "movl\t%%ecx, 44(%3)\n\t" ; 2552 : "movl\t48(%1), %%ecx\n\t" ; 2553 : "sbbl\t48(%2), %%ecx\n\t" ; 2554 : "movl\t%%ecx, 48(%3)\n\t" ; 2555 : "movl\t52(%1), %%ecx\n\t" ; 2556 : "sbbl\t52(%2), %%ecx\n\t" ; 2557 : "movl\t%%ecx, 52(%3)\n\t" ; 2558 : "movl\t56(%1), %%ecx\n\t" ; 2559 : "sbbl\t56(%2), %%ecx\n\t" ; 2560 : "movl\t%%ecx, 56(%3)\n\t" ; 2561 : "movl\t60(%1), %%ecx\n\t" ; 2562 : "sbbl\t60(%2), %%ecx\n\t" ; 2563 : "movl\t%%ecx, 60(%3)\n\t" ; 2564 : "setc\t%0" ; 2565 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 2566 : : ; 2567 : : "cc", "memory", "%ecx" ; 2568 : ); ; 2569 : #elif defined(_M_IX64) ; 2570 : __asm__ volatile ( ; 2571 : "addb\t$-1, %0\n\t" ; 2572 : "movq\t(%1), %%rcx\n\t" ; 2573 : "sbbq\t(%2), %%rcx\n\t" ; 2574 : "movq\t%%rcx, (%3)\n\t" ; 2575 : "movq\t8(%1), %%rcx\n\t" ; 2576 : "sbbq\t8(%2), %%rcx\n\t" ; 2577 : "movq\t%%rcx, 8(%3)\n\t" ; 2578 : "movq\t16(%1), %%rcx\n\t" ; 2579 : "sbbq\t16(%2), %%rcx\n\t" ; 2580 : "movq\t%%rcx, 16(%3)\n\t" ; 2581 : "movq\t24(%1), %%rcx\n\t" ; 2582 : "sbbq\t24(%2), %%rcx\n\t" ; 2583 : "movq\t%%rcx, 24(%3)\n\t" ; 2584 : "movq\t32(%1), %%rcx\n\t" ; 2585 : "sbbq\t32(%2), %%rcx\n\t" ; 2586 : "movq\t%%rcx, 32(%3)\n\t" ; 2587 : "movq\t40(%1), %%rcx\n\t" ; 2588 : "sbbq\t40(%2), %%rcx\n\t" ; 2589 : "movq\t%%rcx, 40(%3)\n\t" ; 2590 : "movq\t48(%1), %%rcx\n\t" ; 2591 : "sbbq\t48(%2), %%rcx\n\t" ; 2592 : "movq\t%%rcx, 48(%3)\n\t" ; 2593 : "movq\t56(%1), %%rcx\n\t" ; 2594 : "sbbq\t56(%2), %%rcx\n\t" ; 2595 : "movq\t%%rcx, 56(%3)\n\t" ; 2596 : "movq\t64(%1), %%rcx\n\t" ; 2597 : "sbbq\t64(%2), %%rcx\n\t" ; 2598 : "movq\t%%rcx, 64(%3)\n\t" ; 2599 : "movq\t72(%1), %%rcx\n\t" ; 2600 : "sbbq\t72(%2), %%rcx\n\t" ; 2601 : "movq\t%%rcx, 72(%3)\n\t" ; 2602 : "movq\t80(%1), %%rcx\n\t" ; 2603 : "sbbq\t80(%2), %%rcx\n\t" ; 2604 : "movq\t%%rcx, 80(%3)\n\t" ; 2605 : "movq\t88(%1), %%rcx\n\t" ; 2606 : "sbbq\t88(%2), %%rcx\n\t" ; 2607 : "movq\t%%rcx, 88(%3)\n\t" ; 2608 : "movq\t96(%1), %%rcx\n\t" ; 2609 : "sbbq\t96(%2), %%rcx\n\t" ; 2610 : "movq\t%%rcx, 96(%3)\n\t" ; 2611 : "movq\t104(%1), %%rcx\n\t" ; 2612 : "sbbq\t104(%2), %%rcx\n\t" ; 2613 : "movq\t%%rcx, 104(%3)\n\t" ; 2614 : "movq\t112(%1), %%rcx\n\t" ; 2615 : "sbbq\t112(%2), %%rcx\n\t" ; 2616 : "movq\t%%rcx, 112(%3)\n\t" ; 2617 : "movq\t120(%1), %%rcx\n\t" ; 2618 : "sbbq\t120(%2), %%rcx\n\t" ; 2619 : "movq\t%%rcx, 120(%3)\n\t" ; 2620 : "setc\t%0" ; 2621 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 2622 : : ; 2623 : : "cc", "memory", "%rcx" ; 2624 : ); ; 2625 : #else ; 2626 : #error unknown platform ; 2627 : #endif ; 2628 : #else ; 2629 : #error unknown compiler ; 2630 : #endif ; 2631 : return (c); mov al, BYTE PTR _c$[ebp] ; 2632 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __SUBTRUCT_16WORDS_SBB ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\autogenerated_inline_func.h _TEXT SEGMENT _c$ = 8 ; size = 1 _xp$ = 12 ; size = 4 _yp$ = 16 ; size = 4 _zp$ = 20 ; size = 4 __SUBTRUCT_32WORDS_SBB PROC ; 806 : { push ebp mov ebp, esp mov ecx, OFFSET __89DB6AB9_autogenerated_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 807 : #ifdef _MSC_VER ; 808 : c = _SUBTRUCT_UNIT(c, xp[0], yp[0], &zp[0]); mov eax, 4 imul ecx, eax, 0 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 809 : c = _SUBTRUCT_UNIT(c, xp[1], yp[1], &zp[1]); mov edx, 4 shl edx, 0 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 0 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 810 : c = _SUBTRUCT_UNIT(c, xp[2], yp[2], &zp[2]); mov ecx, 4 shl ecx, 1 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 shl edx, 1 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 811 : c = _SUBTRUCT_UNIT(c, xp[3], yp[3], &zp[3]); mov eax, 4 imul ecx, eax, 3 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 3 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 3 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 812 : c = _SUBTRUCT_UNIT(c, xp[4], yp[4], &zp[4]); mov edx, 4 shl edx, 2 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 2 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 2 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 813 : c = _SUBTRUCT_UNIT(c, xp[5], yp[5], &zp[5]); mov ecx, 4 imul edx, ecx, 5 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 5 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 5 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 814 : c = _SUBTRUCT_UNIT(c, xp[6], yp[6], &zp[6]); mov eax, 4 imul ecx, eax, 6 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 6 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 6 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 815 : c = _SUBTRUCT_UNIT(c, xp[7], yp[7], &zp[7]); mov edx, 4 imul eax, edx, 7 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 7 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 7 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 816 : c = _SUBTRUCT_UNIT(c, xp[8], yp[8], &zp[8]); mov ecx, 4 shl ecx, 3 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 shl edx, 3 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 shl edx, 3 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 817 : c = _SUBTRUCT_UNIT(c, xp[9], yp[9], &zp[9]); mov eax, 4 imul ecx, eax, 9 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 9 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 9 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 818 : c = _SUBTRUCT_UNIT(c, xp[10], yp[10], &zp[10]); mov edx, 4 imul eax, edx, 10 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 10 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 10 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 819 : c = _SUBTRUCT_UNIT(c, xp[11], yp[11], &zp[11]); mov ecx, 4 imul edx, ecx, 11 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 11 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 11 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 820 : c = _SUBTRUCT_UNIT(c, xp[12], yp[12], &zp[12]); mov eax, 4 imul ecx, eax, 12 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 12 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 12 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 821 : c = _SUBTRUCT_UNIT(c, xp[13], yp[13], &zp[13]); mov edx, 4 imul eax, edx, 13 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 13 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 13 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 822 : c = _SUBTRUCT_UNIT(c, xp[14], yp[14], &zp[14]); mov ecx, 4 imul edx, ecx, 14 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 14 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 14 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 823 : c = _SUBTRUCT_UNIT(c, xp[15], yp[15], &zp[15]); mov eax, 4 imul ecx, eax, 15 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 15 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 15 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 824 : c = _SUBTRUCT_UNIT(c, xp[16], yp[16], &zp[16]); mov edx, 4 shl edx, 4 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 shl eax, 4 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 shl eax, 4 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 825 : c = _SUBTRUCT_UNIT(c, xp[17], yp[17], &zp[17]); mov ecx, 4 imul edx, ecx, 17 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 17 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 17 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 826 : c = _SUBTRUCT_UNIT(c, xp[18], yp[18], &zp[18]); mov eax, 4 imul ecx, eax, 18 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 18 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 18 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 827 : c = _SUBTRUCT_UNIT(c, xp[19], yp[19], &zp[19]); mov edx, 4 imul eax, edx, 19 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 19 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 19 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 828 : c = _SUBTRUCT_UNIT(c, xp[20], yp[20], &zp[20]); mov ecx, 4 imul edx, ecx, 20 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 20 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 20 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 829 : c = _SUBTRUCT_UNIT(c, xp[21], yp[21], &zp[21]); mov eax, 4 imul ecx, eax, 21 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 21 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 21 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 830 : c = _SUBTRUCT_UNIT(c, xp[22], yp[22], &zp[22]); mov edx, 4 imul eax, edx, 22 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 22 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 22 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 831 : c = _SUBTRUCT_UNIT(c, xp[23], yp[23], &zp[23]); mov ecx, 4 imul edx, ecx, 23 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 23 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 23 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 832 : c = _SUBTRUCT_UNIT(c, xp[24], yp[24], &zp[24]); mov eax, 4 imul ecx, eax, 24 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 24 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 24 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 833 : c = _SUBTRUCT_UNIT(c, xp[25], yp[25], &zp[25]); mov edx, 4 imul eax, edx, 25 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 25 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 25 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 834 : c = _SUBTRUCT_UNIT(c, xp[26], yp[26], &zp[26]); mov ecx, 4 imul edx, ecx, 26 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 26 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 26 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 835 : c = _SUBTRUCT_UNIT(c, xp[27], yp[27], &zp[27]); mov eax, 4 imul ecx, eax, 27 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 27 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 27 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 836 : c = _SUBTRUCT_UNIT(c, xp[28], yp[28], &zp[28]); mov edx, 4 imul eax, edx, 28 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 28 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 28 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 837 : c = _SUBTRUCT_UNIT(c, xp[29], yp[29], &zp[29]); mov ecx, 4 imul edx, ecx, 29 add edx, DWORD PTR _zp$[ebp] push edx mov eax, 4 imul ecx, eax, 29 mov edx, DWORD PTR _yp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax mov ecx, 4 imul edx, ecx, 29 mov eax, DWORD PTR _xp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 838 : c = _SUBTRUCT_UNIT(c, xp[30], yp[30], &zp[30]); mov eax, 4 imul ecx, eax, 30 add ecx, DWORD PTR _zp$[ebp] push ecx mov edx, 4 imul eax, edx, 30 mov ecx, DWORD PTR _yp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx mov eax, 4 imul ecx, eax, 30 mov edx, DWORD PTR _xp$[ebp] mov eax, DWORD PTR [edx+ecx] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 839 : c = _SUBTRUCT_UNIT(c, xp[31], yp[31], &zp[31]); mov edx, 4 imul eax, edx, 31 add eax, DWORD PTR _zp$[ebp] push eax mov ecx, 4 imul edx, ecx, 31 mov eax, DWORD PTR _yp$[ebp] mov ecx, DWORD PTR [eax+edx] push ecx mov edx, 4 imul eax, edx, 31 mov ecx, DWORD PTR _xp$[ebp] mov edx, DWORD PTR [ecx+eax] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 840 : #elif defined(__GNUC__) ; 841 : #ifdef _M_IX86 ; 842 : __asm__ volatile ( ; 843 : "addb\t$-1, %0\n\t" ; 844 : "movl\t(%1), %%ecx\n\t" ; 845 : "sbbl\t(%2), %%ecx\n\t" ; 846 : "movl\t%%ecx, (%3)\n\t" ; 847 : "movl\t4(%1), %%ecx\n\t" ; 848 : "sbbl\t4(%2), %%ecx\n\t" ; 849 : "movl\t%%ecx, 4(%3)\n\t" ; 850 : "movl\t8(%1), %%ecx\n\t" ; 851 : "sbbl\t8(%2), %%ecx\n\t" ; 852 : "movl\t%%ecx, 8(%3)\n\t" ; 853 : "movl\t12(%1), %%ecx\n\t" ; 854 : "sbbl\t12(%2), %%ecx\n\t" ; 855 : "movl\t%%ecx, 12(%3)\n\t" ; 856 : "movl\t16(%1), %%ecx\n\t" ; 857 : "sbbl\t16(%2), %%ecx\n\t" ; 858 : "movl\t%%ecx, 16(%3)\n\t" ; 859 : "movl\t20(%1), %%ecx\n\t" ; 860 : "sbbl\t20(%2), %%ecx\n\t" ; 861 : "movl\t%%ecx, 20(%3)\n\t" ; 862 : "movl\t24(%1), %%ecx\n\t" ; 863 : "sbbl\t24(%2), %%ecx\n\t" ; 864 : "movl\t%%ecx, 24(%3)\n\t" ; 865 : "movl\t28(%1), %%ecx\n\t" ; 866 : "sbbl\t28(%2), %%ecx\n\t" ; 867 : "movl\t%%ecx, 28(%3)\n\t" ; 868 : "movl\t32(%1), %%ecx\n\t" ; 869 : "sbbl\t32(%2), %%ecx\n\t" ; 870 : "movl\t%%ecx, 32(%3)\n\t" ; 871 : "movl\t36(%1), %%ecx\n\t" ; 872 : "sbbl\t36(%2), %%ecx\n\t" ; 873 : "movl\t%%ecx, 36(%3)\n\t" ; 874 : "movl\t40(%1), %%ecx\n\t" ; 875 : "sbbl\t40(%2), %%ecx\n\t" ; 876 : "movl\t%%ecx, 40(%3)\n\t" ; 877 : "movl\t44(%1), %%ecx\n\t" ; 878 : "sbbl\t44(%2), %%ecx\n\t" ; 879 : "movl\t%%ecx, 44(%3)\n\t" ; 880 : "movl\t48(%1), %%ecx\n\t" ; 881 : "sbbl\t48(%2), %%ecx\n\t" ; 882 : "movl\t%%ecx, 48(%3)\n\t" ; 883 : "movl\t52(%1), %%ecx\n\t" ; 884 : "sbbl\t52(%2), %%ecx\n\t" ; 885 : "movl\t%%ecx, 52(%3)\n\t" ; 886 : "movl\t56(%1), %%ecx\n\t" ; 887 : "sbbl\t56(%2), %%ecx\n\t" ; 888 : "movl\t%%ecx, 56(%3)\n\t" ; 889 : "movl\t60(%1), %%ecx\n\t" ; 890 : "sbbl\t60(%2), %%ecx\n\t" ; 891 : "movl\t%%ecx, 60(%3)\n\t" ; 892 : "movl\t64(%1), %%ecx\n\t" ; 893 : "sbbl\t64(%2), %%ecx\n\t" ; 894 : "movl\t%%ecx, 64(%3)\n\t" ; 895 : "movl\t68(%1), %%ecx\n\t" ; 896 : "sbbl\t68(%2), %%ecx\n\t" ; 897 : "movl\t%%ecx, 68(%3)\n\t" ; 898 : "movl\t72(%1), %%ecx\n\t" ; 899 : "sbbl\t72(%2), %%ecx\n\t" ; 900 : "movl\t%%ecx, 72(%3)\n\t" ; 901 : "movl\t76(%1), %%ecx\n\t" ; 902 : "sbbl\t76(%2), %%ecx\n\t" ; 903 : "movl\t%%ecx, 76(%3)\n\t" ; 904 : "movl\t80(%1), %%ecx\n\t" ; 905 : "sbbl\t80(%2), %%ecx\n\t" ; 906 : "movl\t%%ecx, 80(%3)\n\t" ; 907 : "movl\t84(%1), %%ecx\n\t" ; 908 : "sbbl\t84(%2), %%ecx\n\t" ; 909 : "movl\t%%ecx, 84(%3)\n\t" ; 910 : "movl\t88(%1), %%ecx\n\t" ; 911 : "sbbl\t88(%2), %%ecx\n\t" ; 912 : "movl\t%%ecx, 88(%3)\n\t" ; 913 : "movl\t92(%1), %%ecx\n\t" ; 914 : "sbbl\t92(%2), %%ecx\n\t" ; 915 : "movl\t%%ecx, 92(%3)\n\t" ; 916 : "movl\t96(%1), %%ecx\n\t" ; 917 : "sbbl\t96(%2), %%ecx\n\t" ; 918 : "movl\t%%ecx, 96(%3)\n\t" ; 919 : "movl\t100(%1), %%ecx\n\t" ; 920 : "sbbl\t100(%2), %%ecx\n\t" ; 921 : "movl\t%%ecx, 100(%3)\n\t" ; 922 : "movl\t104(%1), %%ecx\n\t" ; 923 : "sbbl\t104(%2), %%ecx\n\t" ; 924 : "movl\t%%ecx, 104(%3)\n\t" ; 925 : "movl\t108(%1), %%ecx\n\t" ; 926 : "sbbl\t108(%2), %%ecx\n\t" ; 927 : "movl\t%%ecx, 108(%3)\n\t" ; 928 : "movl\t112(%1), %%ecx\n\t" ; 929 : "sbbl\t112(%2), %%ecx\n\t" ; 930 : "movl\t%%ecx, 112(%3)\n\t" ; 931 : "movl\t116(%1), %%ecx\n\t" ; 932 : "sbbl\t116(%2), %%ecx\n\t" ; 933 : "movl\t%%ecx, 116(%3)\n\t" ; 934 : "movl\t120(%1), %%ecx\n\t" ; 935 : "sbbl\t120(%2), %%ecx\n\t" ; 936 : "movl\t%%ecx, 120(%3)\n\t" ; 937 : "movl\t124(%1), %%ecx\n\t" ; 938 : "sbbl\t124(%2), %%ecx\n\t" ; 939 : "movl\t%%ecx, 124(%3)\n\t" ; 940 : "setc\t%0" ; 941 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 942 : : ; 943 : : "cc", "memory", "%ecx" ; 944 : ); ; 945 : #elif defined(_M_IX64) ; 946 : __asm__ volatile ( ; 947 : "addb\t$-1, %0\n\t" ; 948 : "movq\t(%1), %%rcx\n\t" ; 949 : "sbbq\t(%2), %%rcx\n\t" ; 950 : "movq\t%%rcx, (%3)\n\t" ; 951 : "movq\t8(%1), %%rcx\n\t" ; 952 : "sbbq\t8(%2), %%rcx\n\t" ; 953 : "movq\t%%rcx, 8(%3)\n\t" ; 954 : "movq\t16(%1), %%rcx\n\t" ; 955 : "sbbq\t16(%2), %%rcx\n\t" ; 956 : "movq\t%%rcx, 16(%3)\n\t" ; 957 : "movq\t24(%1), %%rcx\n\t" ; 958 : "sbbq\t24(%2), %%rcx\n\t" ; 959 : "movq\t%%rcx, 24(%3)\n\t" ; 960 : "movq\t32(%1), %%rcx\n\t" ; 961 : "sbbq\t32(%2), %%rcx\n\t" ; 962 : "movq\t%%rcx, 32(%3)\n\t" ; 963 : "movq\t40(%1), %%rcx\n\t" ; 964 : "sbbq\t40(%2), %%rcx\n\t" ; 965 : "movq\t%%rcx, 40(%3)\n\t" ; 966 : "movq\t48(%1), %%rcx\n\t" ; 967 : "sbbq\t48(%2), %%rcx\n\t" ; 968 : "movq\t%%rcx, 48(%3)\n\t" ; 969 : "movq\t56(%1), %%rcx\n\t" ; 970 : "sbbq\t56(%2), %%rcx\n\t" ; 971 : "movq\t%%rcx, 56(%3)\n\t" ; 972 : "movq\t64(%1), %%rcx\n\t" ; 973 : "sbbq\t64(%2), %%rcx\n\t" ; 974 : "movq\t%%rcx, 64(%3)\n\t" ; 975 : "movq\t72(%1), %%rcx\n\t" ; 976 : "sbbq\t72(%2), %%rcx\n\t" ; 977 : "movq\t%%rcx, 72(%3)\n\t" ; 978 : "movq\t80(%1), %%rcx\n\t" ; 979 : "sbbq\t80(%2), %%rcx\n\t" ; 980 : "movq\t%%rcx, 80(%3)\n\t" ; 981 : "movq\t88(%1), %%rcx\n\t" ; 982 : "sbbq\t88(%2), %%rcx\n\t" ; 983 : "movq\t%%rcx, 88(%3)\n\t" ; 984 : "movq\t96(%1), %%rcx\n\t" ; 985 : "sbbq\t96(%2), %%rcx\n\t" ; 986 : "movq\t%%rcx, 96(%3)\n\t" ; 987 : "movq\t104(%1), %%rcx\n\t" ; 988 : "sbbq\t104(%2), %%rcx\n\t" ; 989 : "movq\t%%rcx, 104(%3)\n\t" ; 990 : "movq\t112(%1), %%rcx\n\t" ; 991 : "sbbq\t112(%2), %%rcx\n\t" ; 992 : "movq\t%%rcx, 112(%3)\n\t" ; 993 : "movq\t120(%1), %%rcx\n\t" ; 994 : "sbbq\t120(%2), %%rcx\n\t" ; 995 : "movq\t%%rcx, 120(%3)\n\t" ; 996 : "movq\t128(%1), %%rcx\n\t" ; 997 : "sbbq\t128(%2), %%rcx\n\t" ; 998 : "movq\t%%rcx, 128(%3)\n\t" ; 999 : "movq\t136(%1), %%rcx\n\t" ; 1000 : "sbbq\t136(%2), %%rcx\n\t" ; 1001 : "movq\t%%rcx, 136(%3)\n\t" ; 1002 : "movq\t144(%1), %%rcx\n\t" ; 1003 : "sbbq\t144(%2), %%rcx\n\t" ; 1004 : "movq\t%%rcx, 144(%3)\n\t" ; 1005 : "movq\t152(%1), %%rcx\n\t" ; 1006 : "sbbq\t152(%2), %%rcx\n\t" ; 1007 : "movq\t%%rcx, 152(%3)\n\t" ; 1008 : "movq\t160(%1), %%rcx\n\t" ; 1009 : "sbbq\t160(%2), %%rcx\n\t" ; 1010 : "movq\t%%rcx, 160(%3)\n\t" ; 1011 : "movq\t168(%1), %%rcx\n\t" ; 1012 : "sbbq\t168(%2), %%rcx\n\t" ; 1013 : "movq\t%%rcx, 168(%3)\n\t" ; 1014 : "movq\t176(%1), %%rcx\n\t" ; 1015 : "sbbq\t176(%2), %%rcx\n\t" ; 1016 : "movq\t%%rcx, 176(%3)\n\t" ; 1017 : "movq\t184(%1), %%rcx\n\t" ; 1018 : "sbbq\t184(%2), %%rcx\n\t" ; 1019 : "movq\t%%rcx, 184(%3)\n\t" ; 1020 : "movq\t192(%1), %%rcx\n\t" ; 1021 : "sbbq\t192(%2), %%rcx\n\t" ; 1022 : "movq\t%%rcx, 192(%3)\n\t" ; 1023 : "movq\t200(%1), %%rcx\n\t" ; 1024 : "sbbq\t200(%2), %%rcx\n\t" ; 1025 : "movq\t%%rcx, 200(%3)\n\t" ; 1026 : "movq\t208(%1), %%rcx\n\t" ; 1027 : "sbbq\t208(%2), %%rcx\n\t" ; 1028 : "movq\t%%rcx, 208(%3)\n\t" ; 1029 : "movq\t216(%1), %%rcx\n\t" ; 1030 : "sbbq\t216(%2), %%rcx\n\t" ; 1031 : "movq\t%%rcx, 216(%3)\n\t" ; 1032 : "movq\t224(%1), %%rcx\n\t" ; 1033 : "sbbq\t224(%2), %%rcx\n\t" ; 1034 : "movq\t%%rcx, 224(%3)\n\t" ; 1035 : "movq\t232(%1), %%rcx\n\t" ; 1036 : "sbbq\t232(%2), %%rcx\n\t" ; 1037 : "movq\t%%rcx, 232(%3)\n\t" ; 1038 : "movq\t240(%1), %%rcx\n\t" ; 1039 : "sbbq\t240(%2), %%rcx\n\t" ; 1040 : "movq\t%%rcx, 240(%3)\n\t" ; 1041 : "movq\t248(%1), %%rcx\n\t" ; 1042 : "sbbq\t248(%2), %%rcx\n\t" ; 1043 : "movq\t%%rcx, 248(%3)\n\t" ; 1044 : "setc\t%0" ; 1045 : : "+r"(c), "+r"(xp), "+r"(yp), "+r"(zp) ; 1046 : : ; 1047 : : "cc", "memory", "%rcx" ; 1048 : ); ; 1049 : #else ; 1050 : #error unknown platform ; 1051 : #endif ; 1052 : #else ; 1053 : #error unknown compiler ; 1054 : #endif ; 1055 : return (c); mov al, BYTE PTR _c$[ebp] ; 1056 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __SUBTRUCT_32WORDS_SBB ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h _TEXT SEGMENT _pos$ = -8 ; size = 4 _x$ = 8 ; size = 4 __LZCNT_ALT_UNIT PROC ; 629 : { push ebp mov ebp, esp sub esp, 12 ; 0000000cH mov DWORD PTR [ebp-12], -858993460 ; ccccccccH mov DWORD PTR [ebp-8], -858993460 ; ccccccccH mov DWORD PTR [ebp-4], -858993460 ; ccccccccH mov ecx, OFFSET __6B0481B0_pmc_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 630 : if (x == 0) cmp DWORD PTR _x$[ebp], 0 jne SHORT $LN2@LZCNT_ALT_ ; 631 : return (sizeof(x) * 8); mov eax, 32 ; 00000020H jmp SHORT $LN1@LZCNT_ALT_ $LN2@LZCNT_ALT_: ; 632 : #ifdef _M_IX86 ; 633 : _UINT32_T pos; ; 634 : #ifdef _MSC_VER ; 635 : _BitScanReverse(&pos, x); bsr eax, DWORD PTR _x$[ebp] mov DWORD PTR _pos$[ebp], eax ; 636 : #elif defined(__GNUC__) ; 637 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 638 : #else ; 639 : #error unknown compiler ; 640 : #endif ; 641 : #elif defined(_M_X64) ; 642 : #ifdef _MSC_VER ; 643 : _UINT32_T pos; ; 644 : _BitScanReverse64(&pos, x); ; 645 : #elif defined(__GNUC__) ; 646 : _UINT64_T pos; ; 647 : __asm__("bsrq %1, %0" : "=r"(pos) : "rm"(x)); ; 648 : #else ; 649 : #error unknown compiler ; 650 : #endif ; 651 : #else ; 652 : #error unknown platform ; 653 : #endif ; 654 : return (sizeof(x) * 8 - 1 - pos); mov eax, 31 ; 0000001fH sub eax, DWORD PTR _pos$[ebp] $LN1@LZCNT_ALT_: ; 655 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN6@LZCNT_ALT_ call @_RTC_CheckStackVars@8 pop eax pop edx add esp, 12 ; 0000000cH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 $LN6@LZCNT_ALT_: DD 1 DD $LN5@LZCNT_ALT_ $LN5@LZCNT_ALT_: DD -8 ; fffffff8H DD 4 DD $LN4@LZCNT_ALT_ $LN4@LZCNT_ALT_: DB 112 ; 00000070H DB 111 ; 0000006fH DB 115 ; 00000073H DB 0 __LZCNT_ALT_UNIT ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h _TEXT SEGMENT _pos$ = -8 ; size = 4 _x$ = 8 ; size = 4 __LZCNT_ALT_32 PROC ; 596 : { push ebp mov ebp, esp sub esp, 12 ; 0000000cH mov DWORD PTR [ebp-12], -858993460 ; ccccccccH mov DWORD PTR [ebp-8], -858993460 ; ccccccccH mov DWORD PTR [ebp-4], -858993460 ; ccccccccH mov ecx, OFFSET __6B0481B0_pmc_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 597 : if (x == 0) cmp DWORD PTR _x$[ebp], 0 jne SHORT $LN2@LZCNT_ALT_ ; 598 : return (sizeof(x) * 8); mov eax, 32 ; 00000020H jmp SHORT $LN1@LZCNT_ALT_ $LN2@LZCNT_ALT_: ; 599 : _UINT32_T pos; ; 600 : #ifdef _MSC_VER ; 601 : _BitScanReverse(&pos, x); bsr eax, DWORD PTR _x$[ebp] mov DWORD PTR _pos$[ebp], eax ; 602 : #elif defined(__GNUC__) ; 603 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 604 : #else ; 605 : #error unknown compiler ; 606 : #endif ; 607 : return (sizeof(x) * 8 - 1 - pos); mov eax, 31 ; 0000001fH sub eax, DWORD PTR _pos$[ebp] $LN1@LZCNT_ALT_: ; 608 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN6@LZCNT_ALT_ call @_RTC_CheckStackVars@8 pop eax pop edx add esp, 12 ; 0000000cH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 $LN6@LZCNT_ALT_: DD 1 DD $LN5@LZCNT_ALT_ $LN5@LZCNT_ALT_: DD -8 ; fffffff8H DD 4 DD $LN4@LZCNT_ALT_ $LN4@LZCNT_ALT_: DB 112 ; 00000070H DB 111 ; 0000006fH DB 115 ; 00000073H DB 0 __LZCNT_ALT_32 ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h _TEXT SEGMENT _borrow$ = 8 ; size = 1 _u$ = 12 ; size = 4 _v$ = 16 ; size = 4 _w$ = 20 ; size = 4 __SUBTRUCT_UNIT PROC ; 269 : { push ebp mov ebp, esp push ebx mov ecx, OFFSET __6B0481B0_pmc_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 270 : #ifdef _M_IX86 ; 271 : return (_subborrow_u32(borrow, u, v, w)); mov eax, DWORD PTR _w$[ebp] mov ecx, DWORD PTR _v$[ebp] mov edx, DWORD PTR _u$[ebp] mov bl, BYTE PTR _borrow$[ebp] add bl, 255 ; 000000ffH sbb edx, ecx setb cl mov DWORD PTR [eax], edx mov al, cl ; 272 : #elif defined(_M_X64) ; 273 : return (_subborrow_u64(borrow, u, v, w)); ; 274 : #else ; 275 : #error unknown platform ; 276 : #endif ; 277 : } pop ebx cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __SUBTRUCT_UNIT ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h _TEXT SEGMENT _value$ = 8 ; size = 8 _result_high$ = 16 ; size = 4 __FROMDWORDTOWORD PROC ; 182 : { push ebp mov ebp, esp mov ecx, OFFSET __6B0481B0_pmc_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 183 : *result_high = (_UINT32_T)(value >> 32); mov eax, DWORD PTR _value$[ebp] mov edx, DWORD PTR _value$[ebp+4] mov cl, 32 ; 00000020H call __aullshr mov ecx, DWORD PTR _result_high$[ebp] mov DWORD PTR [ecx], eax ; 184 : return ((_UINT32_T)value); mov eax, DWORD PTR _value$[ebp] ; 185 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __FROMDWORDTOWORD ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h _TEXT SEGMENT _value_high$ = 8 ; size = 4 _value_low$ = 12 ; size = 4 __FROMWORDTODWORD PROC ; 177 : { push ebp mov ebp, esp mov ecx, OFFSET __6B0481B0_pmc_inline_func@h call @__CheckForDebuggerJustMyCode@4 ; 178 : return (((_UINT64_T)value_high << 32) | value_low); xor edx, edx mov eax, DWORD PTR _value_high$[ebp] mov cl, 32 ; 00000020H call __allshl xor ecx, ecx or eax, DWORD PTR _value_low$[ebp] or edx, ecx ; 179 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 __FROMWORDTODWORD ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv145 = -52 ; size = 4 _nz_light_check_code$1 = -44 ; size = 4 _z_bit_count$2 = -36 ; size = 4 _y_bit_count$3 = -32 ; size = 4 _x_bit_count$4 = -28 ; size = 4 _nz$ = -20 ; size = 4 _result$ = -12 ; size = 4 _ny$ = -8 ; size = 4 _nx$ = -4 ; size = 4 _x$ = 8 ; size = 4 _y$ = 12 ; size = 4 _o$ = 16 ; size = 4 _PMC_Subtruct_X_X@12 PROC ; 665 : { push ebp mov ebp, esp sub esp, 52 ; 00000034H push edi lea edi, DWORD PTR [ebp-52] mov ecx, 13 ; 0000000dH mov eax, -858993460 ; ccccccccH rep stosd mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 666 : if (x == NULL) cmp DWORD PTR _x$[ebp], 0 jne SHORT $LN2@PMC_Subtru ; 667 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN2@PMC_Subtru: ; 668 : if (y == NULL) cmp DWORD PTR _y$[ebp], 0 jne SHORT $LN3@PMC_Subtru ; 669 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN3@PMC_Subtru: ; 670 : if (o == NULL) cmp DWORD PTR _o$[ebp], 0 jne SHORT $LN4@PMC_Subtru ; 671 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN4@PMC_Subtru: ; 672 : NUMBER_HEADER* nx = (NUMBER_HEADER*)x; mov eax, DWORD PTR _x$[ebp] mov DWORD PTR _nx$[ebp], eax ; 673 : NUMBER_HEADER* ny = (NUMBER_HEADER*)y; mov ecx, DWORD PTR _y$[ebp] mov DWORD PTR _ny$[ebp], ecx ; 674 : PMC_STATUS_CODE result; ; 675 : if ((result = CheckNumber(nx)) != PMC_STATUS_OK) mov edx, DWORD PTR _nx$[ebp] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN5@PMC_Subtru ; 676 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN5@PMC_Subtru: ; 677 : if ((result = CheckNumber(ny)) != PMC_STATUS_OK) mov eax, DWORD PTR _ny$[ebp] push eax call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN6@PMC_Subtru ; 678 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN6@PMC_Subtru: ; 679 : NUMBER_HEADER* nz; ; 680 : if (nx->IS_ZERO) mov ecx, DWORD PTR _nx$[ebp] mov edx, DWORD PTR [ecx+24] shr edx, 1 and edx, 1 je SHORT $LN7@PMC_Subtru ; 681 : { ; 682 : if (ny->IS_ZERO) mov eax, DWORD PTR _ny$[ebp] mov ecx, DWORD PTR [eax+24] shr ecx, 1 and ecx, 1 je SHORT $LN9@PMC_Subtru ; 683 : { ; 684 : // y が 0 である場合 ; 685 : ; 686 : // x と y がともに 0 であるので、演算結果の 0 を呼び出し元に返す。 ; 687 : *o = &number_zero; mov edx, DWORD PTR _o$[ebp] mov DWORD PTR [edx], OFFSET _number_zero ; 688 : } jmp SHORT $LN10@PMC_Subtru $LN9@PMC_Subtru: ; 689 : else ; 690 : { ; 691 : // y が 0 ではない場合 ; 692 : ; 693 : // 演算結果は負となってしまうのでエラーを返す。 ; 694 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN10@PMC_Subtru: ; 695 : } ; 696 : } jmp $LN8@PMC_Subtru $LN7@PMC_Subtru: ; 697 : else ; 698 : { ; 699 : // x が 0 ではない場合 ; 700 : ; 701 : if (ny->IS_ZERO) mov eax, DWORD PTR _ny$[ebp] mov ecx, DWORD PTR [eax+24] shr ecx, 1 and ecx, 1 je SHORT $LN11@PMC_Subtru ; 702 : { ; 703 : // y が 0 である場合 ; 704 : ; 705 : // 演算結果となる x の値を持つ NUMBER_HEADER 構造体を獲得し、呼び出し元へ返す。 ; 706 : if ((result = DuplicateNumber(nx, &nz)) != PMC_STATUS_OK) lea edx, DWORD PTR _nz$[ebp] push edx mov eax, DWORD PTR _nx$[ebp] push eax call _DuplicateNumber add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN13@PMC_Subtru ; 707 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN13@PMC_Subtru: ; 708 : } jmp $LN12@PMC_Subtru $LN11@PMC_Subtru: ; 709 : else ; 710 : { ; 711 : // x と y がともに 0 ではない場合 ; 712 : ; 713 : // x と y の差を計算する ; 714 : __UNIT_TYPE x_bit_count = nx->UNIT_BIT_COUNT; mov ecx, DWORD PTR _nx$[ebp] mov edx, DWORD PTR [ecx+12] mov DWORD PTR _x_bit_count$4[ebp], edx ; 715 : __UNIT_TYPE y_bit_count = ny->UNIT_BIT_COUNT; mov eax, DWORD PTR _ny$[ebp] mov ecx, DWORD PTR [eax+12] mov DWORD PTR _y_bit_count$3[ebp], ecx ; 716 : if (x_bit_count < y_bit_count) mov edx, DWORD PTR _x_bit_count$4[ebp] cmp edx, DWORD PTR _y_bit_count$3[ebp] jae SHORT $LN14@PMC_Subtru ; 717 : { ; 718 : // 演算結果は負となってしまうのでエラーを返す。 ; 719 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN14@PMC_Subtru: ; 720 : } ; 721 : __UNIT_TYPE z_bit_count = x_bit_count; mov eax, DWORD PTR _x_bit_count$4[ebp] mov DWORD PTR _z_bit_count$2[ebp], eax ; 722 : __UNIT_TYPE nz_light_check_code; ; 723 : if ((result = AllocateNumber(&nz, z_bit_count, &nz_light_check_code)) != PMC_STATUS_OK) lea ecx, DWORD PTR _nz_light_check_code$1[ebp] push ecx mov edx, DWORD PTR _z_bit_count$2[ebp] push edx lea eax, DWORD PTR _nz$[ebp] push eax call _AllocateNumber add esp, 12 ; 0000000cH mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN15@PMC_Subtru ; 724 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN15@PMC_Subtru: ; 725 : if ((result = Subtruct_Imp(nx->BLOCK, nx->UNIT_WORD_COUNT, ny->BLOCK, ny->UNIT_WORD_COUNT, nz->BLOCK, nz->BLOCK_COUNT)) != PMC_STATUS_OK) mov ecx, DWORD PTR _nz$[ebp] mov edx, DWORD PTR [ecx+28] push edx mov eax, DWORD PTR _nz$[ebp] mov ecx, DWORD PTR [eax+32] push ecx mov edx, DWORD PTR _ny$[ebp] mov eax, DWORD PTR [edx+8] push eax mov ecx, DWORD PTR _ny$[ebp] mov edx, DWORD PTR [ecx+32] push edx mov eax, DWORD PTR _nx$[ebp] mov ecx, DWORD PTR [eax+8] push ecx mov edx, DWORD PTR _nx$[ebp] mov eax, DWORD PTR [edx+32] push eax call _Subtruct_Imp add esp, 24 ; 00000018H mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN16@PMC_Subtru ; 726 : { ; 727 : DeallocateNumber(nz); mov ecx, DWORD PTR _nz$[ebp] push ecx call _DeallocateNumber add esp, 4 ; 728 : return (result == PMC_STATUS_INTERNAL_BORROW ? PMC_STATUS_OVERFLOW : result); cmp DWORD PTR _result$[ebp], -258 ; fffffefeH jne SHORT $LN20@PMC_Subtru mov DWORD PTR tv145[ebp], -2 ; fffffffeH jmp SHORT $LN21@PMC_Subtru $LN20@PMC_Subtru: mov edx, DWORD PTR _result$[ebp] mov DWORD PTR tv145[ebp], edx $LN21@PMC_Subtru: mov eax, DWORD PTR tv145[ebp] jmp SHORT $LN1@PMC_Subtru $LN16@PMC_Subtru: ; 729 : } ; 730 : if ((result = CheckBlockLight(nz->BLOCK, nz_light_check_code)) != PMC_STATUS_OK) mov eax, DWORD PTR _nz_light_check_code$1[ebp] push eax mov ecx, DWORD PTR _nz$[ebp] mov edx, DWORD PTR [ecx+32] push edx call _CheckBlockLight add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN17@PMC_Subtru ; 731 : return (result); mov eax, DWORD PTR _result$[ebp] jmp SHORT $LN1@PMC_Subtru $LN17@PMC_Subtru: ; 732 : CommitNumber(nz); mov eax, DWORD PTR _nz$[ebp] push eax call _CommitNumber add esp, 4 $LN12@PMC_Subtru: ; 733 : } ; 734 : *o = nz; mov ecx, DWORD PTR _o$[ebp] mov edx, DWORD PTR _nz$[ebp] mov DWORD PTR [ecx], edx $LN8@PMC_Subtru: ; 735 : } ; 736 : #ifdef _DEBUG ; 737 : if ((result = CheckNumber(*o)) != PMC_STATUS_OK) mov eax, DWORD PTR _o$[ebp] mov ecx, DWORD PTR [eax] push ecx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN18@PMC_Subtru ; 738 : return (result); mov eax, DWORD PTR _result$[ebp] jmp SHORT $LN1@PMC_Subtru $LN18@PMC_Subtru: ; 739 : #endif ; 740 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_Subtru: ; 741 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN25@PMC_Subtru call @_RTC_CheckStackVars@8 pop eax pop edx pop edi add esp, 52 ; 00000034H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 12 ; 0000000cH npad 1 $LN25@PMC_Subtru: DD 2 DD $LN24@PMC_Subtru $LN24@PMC_Subtru: DD -20 ; ffffffecH DD 4 DD $LN22@PMC_Subtru DD -44 ; ffffffd4H DD 4 DD $LN23@PMC_Subtru $LN23@PMC_Subtru: DB 110 ; 0000006eH DB 122 ; 0000007aH DB 95 ; 0000005fH DB 108 ; 0000006cH DB 105 ; 00000069H DB 103 ; 00000067H DB 104 ; 00000068H DB 116 ; 00000074H DB 95 ; 0000005fH DB 99 ; 00000063H DB 104 ; 00000068H DB 101 ; 00000065H DB 99 ; 00000063H DB 107 ; 0000006bH DB 95 ; 0000005fH DB 99 ; 00000063H DB 111 ; 0000006fH DB 100 ; 00000064H DB 101 ; 00000065H DB 0 $LN22@PMC_Subtru: DB 110 ; 0000006eH DB 122 ; 0000007aH DB 0 _PMC_Subtruct_X_X@12 ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv200 = -116 ; size = 4 tv169 = -112 ; size = 4 tv140 = -108 ; size = 4 _nz_light_check_code$1 = -100 ; size = 4 _z_bit_count$2 = -92 ; size = 4 _y_bit_count$3 = -88 ; size = 4 _x_bit_count$4 = -84 ; size = 4 _nz_light_check_code$5 = -76 ; size = 4 _z_bit_count$6 = -68 ; size = 4 _y_bit_count$7 = -64 ; size = 4 _nz_light_check_code$8 = -56 ; size = 4 _z_bit_count$9 = -48 ; size = 4 _y_bit_count$10 = -44 ; size = 4 _y_lo$11 = -40 ; size = 4 _y_hi$12 = -32 ; size = 4 _x_bit_count$13 = -24 ; size = 4 _nz$ = -16 ; size = 4 _result$ = -8 ; size = 4 _nx$ = -4 ; size = 4 _x$ = 8 ; size = 4 _y$ = 12 ; size = 8 _o$ = 20 ; size = 4 _PMC_Subtruct_X_L@16 PROC ; 524 : { push ebp mov ebp, esp sub esp, 116 ; 00000074H push edi lea edi, DWORD PTR [ebp-116] mov ecx, 29 ; 0000001dH mov eax, -858993460 ; ccccccccH rep stosd mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 525 : if (__UNIT_TYPE_BIT_COUNT * 2 < sizeof(y) * 8) xor eax, eax je SHORT $LN2@PMC_Subtru ; 526 : { ; 527 : // _UINT64_T が 2 ワードで表現しきれない処理系には対応しない ; 528 : return (PMC_STATUS_INTERNAL_ERROR); mov eax, -256 ; ffffff00H jmp $LN1@PMC_Subtru $LN2@PMC_Subtru: ; 529 : } ; 530 : if (x == NULL) cmp DWORD PTR _x$[ebp], 0 jne SHORT $LN3@PMC_Subtru ; 531 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN3@PMC_Subtru: ; 532 : if (o == NULL) cmp DWORD PTR _o$[ebp], 0 jne SHORT $LN4@PMC_Subtru ; 533 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN4@PMC_Subtru: ; 534 : NUMBER_HEADER* nx = (NUMBER_HEADER*)x; mov ecx, DWORD PTR _x$[ebp] mov DWORD PTR _nx$[ebp], ecx ; 535 : PMC_STATUS_CODE result; ; 536 : if ((result = CheckNumber(nx)) != PMC_STATUS_OK) mov edx, DWORD PTR _nx$[ebp] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN5@PMC_Subtru ; 537 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN5@PMC_Subtru: ; 538 : NUMBER_HEADER* nz; ; 539 : if (nx->IS_ZERO) mov eax, DWORD PTR _nx$[ebp] mov ecx, DWORD PTR [eax+24] shr ecx, 1 and ecx, 1 je SHORT $LN6@PMC_Subtru ; 540 : { ; 541 : // x が 0 である場合 ; 542 : ; 543 : if (y == 0) mov edx, DWORD PTR _y$[ebp] or edx, DWORD PTR _y$[ebp+4] jne SHORT $LN8@PMC_Subtru ; 544 : { ; 545 : // y が 0 である場合 ; 546 : ; 547 : // x と y がともに 0 であるので、演算結果の 0 を呼び出し元に返す。 ; 548 : *o = &number_zero; mov eax, DWORD PTR _o$[ebp] mov DWORD PTR [eax], OFFSET _number_zero ; 549 : } jmp SHORT $LN9@PMC_Subtru $LN8@PMC_Subtru: ; 550 : else ; 551 : { ; 552 : // y が 0 ではない場合 ; 553 : ; 554 : // 演算結果は負となってしまうのでエラーを返す。 ; 555 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN9@PMC_Subtru: ; 556 : } ; 557 : } jmp $LN7@PMC_Subtru $LN6@PMC_Subtru: ; 558 : else ; 559 : { ; 560 : // x が 0 ではない場合 ; 561 : ; 562 : if (y == 0) mov ecx, DWORD PTR _y$[ebp] or ecx, DWORD PTR _y$[ebp+4] jne SHORT $LN10@PMC_Subtru ; 563 : { ; 564 : // y が 0 である場合 ; 565 : ; 566 : // 演算結果となる x の値を持つ NUMBER_HEADER 構造体を獲得し、呼び出し元へ返す。 ; 567 : if ((result = DuplicateNumber(nx, &nz)) != PMC_STATUS_OK) lea edx, DWORD PTR _nz$[ebp] push edx mov eax, DWORD PTR _nx$[ebp] push eax call _DuplicateNumber add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN12@PMC_Subtru ; 568 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN12@PMC_Subtru: ; 569 : } jmp $LN11@PMC_Subtru $LN10@PMC_Subtru: ; 570 : else ; 571 : { ; 572 : // x と y がともに 0 ではない場合 ; 573 : ; 574 : // x と y の差を計算する ; 575 : if (__UNIT_TYPE_BIT_COUNT < sizeof(y) * 8) mov ecx, 1 test ecx, ecx je $LN13@PMC_Subtru ; 576 : { ; 577 : // _UINT64_T が 1 ワードで表現しきれない場合 ; 578 : ; 579 : __UNIT_TYPE x_bit_count = nx->UNIT_BIT_COUNT; mov edx, DWORD PTR _nx$[ebp] mov eax, DWORD PTR [edx+12] mov DWORD PTR _x_bit_count$13[ebp], eax ; 580 : _UINT32_T y_hi; ; 581 : _UINT32_T y_lo = _FROMDWORDTOWORD(y, &y_hi); lea ecx, DWORD PTR _y_hi$12[ebp] push ecx mov edx, DWORD PTR _y$[ebp+4] push edx mov eax, DWORD PTR _y$[ebp] push eax call __FROMDWORDTOWORD add esp, 12 ; 0000000cH mov DWORD PTR _y_lo$11[ebp], eax ; 582 : if (y_hi == 0) cmp DWORD PTR _y_hi$12[ebp], 0 jne $LN15@PMC_Subtru ; 583 : { ; 584 : // y の値が 32bit で表現可能な場合 ; 585 : __UNIT_TYPE y_bit_count = sizeof(y_lo) * 8 - _LZCNT_ALT_32(y_lo); mov ecx, DWORD PTR _y_lo$11[ebp] push ecx call __LZCNT_ALT_32 add esp, 4 mov edx, 32 ; 00000020H sub edx, eax mov DWORD PTR _y_bit_count$10[ebp], edx ; 586 : if (x_bit_count < y_bit_count) mov eax, DWORD PTR _x_bit_count$13[ebp] cmp eax, DWORD PTR _y_bit_count$10[ebp] jae SHORT $LN17@PMC_Subtru ; 587 : { ; 588 : // 演算結果は負となってしまうのでエラーを返す。 ; 589 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN17@PMC_Subtru: ; 590 : } ; 591 : __UNIT_TYPE z_bit_count = x_bit_count; mov ecx, DWORD PTR _x_bit_count$13[ebp] mov DWORD PTR _z_bit_count$9[ebp], ecx ; 592 : __UNIT_TYPE nz_light_check_code; ; 593 : if ((result = AllocateNumber(&nz, z_bit_count, &nz_light_check_code)) != PMC_STATUS_OK) lea edx, DWORD PTR _nz_light_check_code$8[ebp] push edx mov eax, DWORD PTR _z_bit_count$9[ebp] push eax lea ecx, DWORD PTR _nz$[ebp] push ecx call _AllocateNumber add esp, 12 ; 0000000cH mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN18@PMC_Subtru ; 594 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN18@PMC_Subtru: ; 595 : if ((result = Subtruct_X_1W(nx->BLOCK, nx->UNIT_WORD_COUNT, y_lo, nz->BLOCK, nz->BLOCK_COUNT)) != PMC_STATUS_OK) mov edx, DWORD PTR _nz$[ebp] mov eax, DWORD PTR [edx+28] push eax mov ecx, DWORD PTR _nz$[ebp] mov edx, DWORD PTR [ecx+32] push edx mov eax, DWORD PTR _y_lo$11[ebp] push eax mov ecx, DWORD PTR _nx$[ebp] mov edx, DWORD PTR [ecx+8] push edx mov eax, DWORD PTR _nx$[ebp] mov ecx, DWORD PTR [eax+32] push ecx call _Subtruct_X_1W add esp, 20 ; 00000014H mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN19@PMC_Subtru ; 596 : { ; 597 : DeallocateNumber(nz); mov edx, DWORD PTR _nz$[ebp] push edx call _DeallocateNumber add esp, 4 ; 598 : return (result == PMC_STATUS_INTERNAL_BORROW ? PMC_STATUS_OVERFLOW : result); cmp DWORD PTR _result$[ebp], -258 ; fffffefeH jne SHORT $LN32@PMC_Subtru mov DWORD PTR tv140[ebp], -2 ; fffffffeH jmp SHORT $LN33@PMC_Subtru $LN32@PMC_Subtru: mov eax, DWORD PTR _result$[ebp] mov DWORD PTR tv140[ebp], eax $LN33@PMC_Subtru: mov eax, DWORD PTR tv140[ebp] jmp $LN1@PMC_Subtru $LN19@PMC_Subtru: ; 599 : } ; 600 : if ((result = CheckBlockLight(nz->BLOCK, nz_light_check_code)) != PMC_STATUS_OK) mov ecx, DWORD PTR _nz_light_check_code$8[ebp] push ecx mov edx, DWORD PTR _nz$[ebp] mov eax, DWORD PTR [edx+32] push eax call _CheckBlockLight add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN20@PMC_Subtru ; 601 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN20@PMC_Subtru: ; 602 : } jmp $LN16@PMC_Subtru $LN15@PMC_Subtru: ; 603 : else ; 604 : { ; 605 : // y の値が 32bit では表現できない場合 ; 606 : __UNIT_TYPE y_bit_count = sizeof(y) * 8 - _LZCNT_ALT_32(y_hi); mov ecx, DWORD PTR _y_hi$12[ebp] push ecx call __LZCNT_ALT_32 add esp, 4 mov edx, 64 ; 00000040H sub edx, eax mov DWORD PTR _y_bit_count$7[ebp], edx ; 607 : if (x_bit_count < y_bit_count) mov eax, DWORD PTR _x_bit_count$13[ebp] cmp eax, DWORD PTR _y_bit_count$7[ebp] jae SHORT $LN21@PMC_Subtru ; 608 : { ; 609 : // 演算結果は負となってしまうのでエラーを返す。 ; 610 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN21@PMC_Subtru: ; 611 : } ; 612 : __UNIT_TYPE z_bit_count = x_bit_count; mov ecx, DWORD PTR _x_bit_count$13[ebp] mov DWORD PTR _z_bit_count$6[ebp], ecx ; 613 : __UNIT_TYPE nz_light_check_code; ; 614 : if ((result = AllocateNumber(&nz, z_bit_count, &nz_light_check_code)) != PMC_STATUS_OK) lea edx, DWORD PTR _nz_light_check_code$5[ebp] push edx mov eax, DWORD PTR _z_bit_count$6[ebp] push eax lea ecx, DWORD PTR _nz$[ebp] push ecx call _AllocateNumber add esp, 12 ; 0000000cH mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN22@PMC_Subtru ; 615 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN22@PMC_Subtru: ; 616 : if ((result = Subtruct_X_2W(nx->BLOCK, nx->UNIT_WORD_COUNT, y_hi, y_lo, nz->BLOCK, nz->BLOCK_COUNT)) != PMC_STATUS_OK) mov edx, DWORD PTR _nz$[ebp] mov eax, DWORD PTR [edx+28] push eax mov ecx, DWORD PTR _nz$[ebp] mov edx, DWORD PTR [ecx+32] push edx mov eax, DWORD PTR _y_lo$11[ebp] push eax mov ecx, DWORD PTR _y_hi$12[ebp] push ecx mov edx, DWORD PTR _nx$[ebp] mov eax, DWORD PTR [edx+8] push eax mov ecx, DWORD PTR _nx$[ebp] mov edx, DWORD PTR [ecx+32] push edx call _Subtruct_X_2W add esp, 24 ; 00000018H mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN23@PMC_Subtru ; 617 : { ; 618 : DeallocateNumber(nz); mov eax, DWORD PTR _nz$[ebp] push eax call _DeallocateNumber add esp, 4 ; 619 : return (result == PMC_STATUS_INTERNAL_BORROW ? PMC_STATUS_OVERFLOW : result); cmp DWORD PTR _result$[ebp], -258 ; fffffefeH jne SHORT $LN34@PMC_Subtru mov DWORD PTR tv169[ebp], -2 ; fffffffeH jmp SHORT $LN35@PMC_Subtru $LN34@PMC_Subtru: mov ecx, DWORD PTR _result$[ebp] mov DWORD PTR tv169[ebp], ecx $LN35@PMC_Subtru: mov eax, DWORD PTR tv169[ebp] jmp $LN1@PMC_Subtru $LN23@PMC_Subtru: ; 620 : } ; 621 : if ((result = CheckBlockLight(nz->BLOCK, nz_light_check_code)) != PMC_STATUS_OK) mov edx, DWORD PTR _nz_light_check_code$5[ebp] push edx mov eax, DWORD PTR _nz$[ebp] mov ecx, DWORD PTR [eax+32] push ecx call _CheckBlockLight add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN16@PMC_Subtru ; 622 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN16@PMC_Subtru: ; 623 : } ; 624 : } jmp $LN14@PMC_Subtru $LN13@PMC_Subtru: ; 625 : else ; 626 : { ; 627 : // _UINT64_T が 1 ワードで表現できる場合 ; 628 : ; 629 : __UNIT_TYPE x_bit_count = nx->UNIT_BIT_COUNT; mov edx, DWORD PTR _nx$[ebp] mov eax, DWORD PTR [edx+12] mov DWORD PTR _x_bit_count$4[ebp], eax ; 630 : __UNIT_TYPE y_bit_count = sizeof(y) * 8 - _LZCNT_ALT_UNIT((__UNIT_TYPE)y); mov ecx, DWORD PTR _y$[ebp] push ecx call __LZCNT_ALT_UNIT add esp, 4 mov edx, 64 ; 00000040H sub edx, eax mov DWORD PTR _y_bit_count$3[ebp], edx ; 631 : if (x_bit_count < y_bit_count) mov eax, DWORD PTR _x_bit_count$4[ebp] cmp eax, DWORD PTR _y_bit_count$3[ebp] jae SHORT $LN25@PMC_Subtru ; 632 : { ; 633 : // 演算結果は負となってしまうのでエラーを返す。 ; 634 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN25@PMC_Subtru: ; 635 : } ; 636 : __UNIT_TYPE z_bit_count = x_bit_count; mov ecx, DWORD PTR _x_bit_count$4[ebp] mov DWORD PTR _z_bit_count$2[ebp], ecx ; 637 : __UNIT_TYPE nz_light_check_code; ; 638 : if ((result = AllocateNumber(&nz, z_bit_count, &nz_light_check_code)) != PMC_STATUS_OK) lea edx, DWORD PTR _nz_light_check_code$1[ebp] push edx mov eax, DWORD PTR _z_bit_count$2[ebp] push eax lea ecx, DWORD PTR _nz$[ebp] push ecx call _AllocateNumber add esp, 12 ; 0000000cH mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN26@PMC_Subtru ; 639 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN26@PMC_Subtru: ; 640 : if ((result = Subtruct_X_1W(nx->BLOCK, nx->UNIT_WORD_COUNT, (__UNIT_TYPE)y, nz->BLOCK, nz->BLOCK_COUNT)) != PMC_STATUS_OK) mov edx, DWORD PTR _nz$[ebp] mov eax, DWORD PTR [edx+28] push eax mov ecx, DWORD PTR _nz$[ebp] mov edx, DWORD PTR [ecx+32] push edx mov eax, DWORD PTR _y$[ebp] push eax mov ecx, DWORD PTR _nx$[ebp] mov edx, DWORD PTR [ecx+8] push edx mov eax, DWORD PTR _nx$[ebp] mov ecx, DWORD PTR [eax+32] push ecx call _Subtruct_X_1W add esp, 20 ; 00000014H mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN27@PMC_Subtru ; 641 : { ; 642 : DeallocateNumber(nz); mov edx, DWORD PTR _nz$[ebp] push edx call _DeallocateNumber add esp, 4 ; 643 : return (result == PMC_STATUS_INTERNAL_BORROW ? PMC_STATUS_OVERFLOW : result); cmp DWORD PTR _result$[ebp], -258 ; fffffefeH jne SHORT $LN36@PMC_Subtru mov DWORD PTR tv200[ebp], -2 ; fffffffeH jmp SHORT $LN37@PMC_Subtru $LN36@PMC_Subtru: mov eax, DWORD PTR _result$[ebp] mov DWORD PTR tv200[ebp], eax $LN37@PMC_Subtru: mov eax, DWORD PTR tv200[ebp] jmp SHORT $LN1@PMC_Subtru $LN27@PMC_Subtru: ; 644 : } ; 645 : if ((result = CheckBlockLight(nz->BLOCK, nz_light_check_code)) != PMC_STATUS_OK) mov ecx, DWORD PTR _nz_light_check_code$1[ebp] push ecx mov edx, DWORD PTR _nz$[ebp] mov eax, DWORD PTR [edx+32] push eax call _CheckBlockLight add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN14@PMC_Subtru ; 646 : return (result); mov eax, DWORD PTR _result$[ebp] jmp SHORT $LN1@PMC_Subtru $LN14@PMC_Subtru: ; 647 : } ; 648 : CommitNumber(nz); mov ecx, DWORD PTR _nz$[ebp] push ecx call _CommitNumber add esp, 4 ; 649 : if (nz->IS_ZERO) mov edx, DWORD PTR _nz$[ebp] mov eax, DWORD PTR [edx+24] shr eax, 1 and eax, 1 je SHORT $LN11@PMC_Subtru ; 650 : { ; 651 : DeallocateNumber(nz); mov ecx, DWORD PTR _nz$[ebp] push ecx call _DeallocateNumber add esp, 4 ; 652 : nz = &number_zero; mov DWORD PTR _nz$[ebp], OFFSET _number_zero $LN11@PMC_Subtru: ; 653 : } ; 654 : } ; 655 : *o = nz; mov edx, DWORD PTR _o$[ebp] mov eax, DWORD PTR _nz$[ebp] mov DWORD PTR [edx], eax $LN7@PMC_Subtru: ; 656 : } ; 657 : #ifdef _DEBUG ; 658 : if ((result = CheckNumber(*o)) != PMC_STATUS_OK) mov ecx, DWORD PTR _o$[ebp] mov edx, DWORD PTR [ecx] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN30@PMC_Subtru ; 659 : return (result); mov eax, DWORD PTR _result$[ebp] jmp SHORT $LN1@PMC_Subtru $LN30@PMC_Subtru: ; 660 : #endif ; 661 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_Subtru: ; 662 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN44@PMC_Subtru call @_RTC_CheckStackVars@8 pop eax pop edx pop edi add esp, 116 ; 00000074H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 16 ; 00000010H npad 2 $LN44@PMC_Subtru: DD 5 DD $LN43@PMC_Subtru $LN43@PMC_Subtru: DD -16 ; fffffff0H DD 4 DD $LN38@PMC_Subtru DD -32 ; ffffffe0H DD 4 DD $LN39@PMC_Subtru DD -56 ; ffffffc8H DD 4 DD $LN40@PMC_Subtru DD -76 ; ffffffb4H DD 4 DD $LN41@PMC_Subtru DD -100 ; ffffff9cH DD 4 DD $LN42@PMC_Subtru $LN42@PMC_Subtru: DB 110 ; 0000006eH DB 122 ; 0000007aH DB 95 ; 0000005fH DB 108 ; 0000006cH DB 105 ; 00000069H DB 103 ; 00000067H DB 104 ; 00000068H DB 116 ; 00000074H DB 95 ; 0000005fH DB 99 ; 00000063H DB 104 ; 00000068H DB 101 ; 00000065H DB 99 ; 00000063H DB 107 ; 0000006bH DB 95 ; 0000005fH DB 99 ; 00000063H DB 111 ; 0000006fH DB 100 ; 00000064H DB 101 ; 00000065H DB 0 $LN41@PMC_Subtru: DB 110 ; 0000006eH DB 122 ; 0000007aH DB 95 ; 0000005fH DB 108 ; 0000006cH DB 105 ; 00000069H DB 103 ; 00000067H DB 104 ; 00000068H DB 116 ; 00000074H DB 95 ; 0000005fH DB 99 ; 00000063H DB 104 ; 00000068H DB 101 ; 00000065H DB 99 ; 00000063H DB 107 ; 0000006bH DB 95 ; 0000005fH DB 99 ; 00000063H DB 111 ; 0000006fH DB 100 ; 00000064H DB 101 ; 00000065H DB 0 $LN40@PMC_Subtru: DB 110 ; 0000006eH DB 122 ; 0000007aH DB 95 ; 0000005fH DB 108 ; 0000006cH DB 105 ; 00000069H DB 103 ; 00000067H DB 104 ; 00000068H DB 116 ; 00000074H DB 95 ; 0000005fH DB 99 ; 00000063H DB 104 ; 00000068H DB 101 ; 00000065H DB 99 ; 00000063H DB 107 ; 0000006bH DB 95 ; 0000005fH DB 99 ; 00000063H DB 111 ; 0000006fH DB 100 ; 00000064H DB 101 ; 00000065H DB 0 $LN39@PMC_Subtru: DB 121 ; 00000079H DB 95 ; 0000005fH DB 104 ; 00000068H DB 105 ; 00000069H DB 0 $LN38@PMC_Subtru: DB 110 ; 0000006eH DB 122 ; 0000007aH DB 0 _PMC_Subtruct_X_L@16 ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv135 = -48 ; size = 4 _w_light_check_code$1 = -40 ; size = 4 _w_bit_count$2 = -32 ; size = 4 _v_bit_count$3 = -28 ; size = 4 _u_bit_count$4 = -24 ; size = 4 _nw$ = -16 ; size = 4 _result$ = -8 ; size = 4 _nu$ = -4 ; size = 4 _u$ = 8 ; size = 4 _v$ = 12 ; size = 4 _w$ = 16 ; size = 4 _PMC_Subtruct_X_I@12 PROC ; 269 : { push ebp mov ebp, esp sub esp, 48 ; 00000030H push edi lea edi, DWORD PTR [ebp-48] mov ecx, 12 ; 0000000cH mov eax, -858993460 ; ccccccccH rep stosd mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 270 : if (__UNIT_TYPE_BIT_COUNT < sizeof(v) * 8) xor eax, eax je SHORT $LN2@PMC_Subtru ; 271 : { ; 272 : // _UINT32_T が 1 ワードで表現しきれない処理系には対応しない ; 273 : return (PMC_STATUS_INTERNAL_ERROR); mov eax, -256 ; ffffff00H jmp $LN1@PMC_Subtru $LN2@PMC_Subtru: ; 274 : } ; 275 : if (u == NULL) cmp DWORD PTR _u$[ebp], 0 jne SHORT $LN3@PMC_Subtru ; 276 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN3@PMC_Subtru: ; 277 : if (w == NULL) cmp DWORD PTR _w$[ebp], 0 jne SHORT $LN4@PMC_Subtru ; 278 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN4@PMC_Subtru: ; 279 : NUMBER_HEADER* nu = (NUMBER_HEADER*)u; mov ecx, DWORD PTR _u$[ebp] mov DWORD PTR _nu$[ebp], ecx ; 280 : PMC_STATUS_CODE result; ; 281 : if ((result = CheckNumber(nu)) != PMC_STATUS_OK) mov edx, DWORD PTR _nu$[ebp] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN5@PMC_Subtru ; 282 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN5@PMC_Subtru: ; 283 : NUMBER_HEADER* nw; ; 284 : if (nu->IS_ZERO) mov eax, DWORD PTR _nu$[ebp] mov ecx, DWORD PTR [eax+24] shr ecx, 1 and ecx, 1 je SHORT $LN6@PMC_Subtru ; 285 : { ; 286 : // u が 0 である場合 ; 287 : ; 288 : if (v == 0) cmp DWORD PTR _v$[ebp], 0 jne SHORT $LN8@PMC_Subtru ; 289 : { ; 290 : // v が 0 である場合 ; 291 : ; 292 : // u と v がともに 0 であるので、演算結果の 0 を呼び出し元に返す。 ; 293 : *w = &number_zero; mov edx, DWORD PTR _w$[ebp] mov DWORD PTR [edx], OFFSET _number_zero ; 294 : } jmp SHORT $LN9@PMC_Subtru $LN8@PMC_Subtru: ; 295 : else ; 296 : { ; 297 : // v が 0 ではない場合 ; 298 : ; 299 : // 演算結果は負となってしまうのでエラーを返す。 ; 300 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN9@PMC_Subtru: ; 301 : } ; 302 : } jmp $LN7@PMC_Subtru $LN6@PMC_Subtru: ; 303 : else ; 304 : { ; 305 : // u が 0 ではない場合 ; 306 : ; 307 : if (v == 0) cmp DWORD PTR _v$[ebp], 0 jne SHORT $LN10@PMC_Subtru ; 308 : { ; 309 : // v が 0 である場合 ; 310 : ; 311 : // 演算結果となる x の値を持つ NUMBER_HEADER 構造体を獲得し、呼び出し元へ返す。 ; 312 : if ((result = DuplicateNumber(nu, &nw)) != PMC_STATUS_OK) lea eax, DWORD PTR _nw$[ebp] push eax mov ecx, DWORD PTR _nu$[ebp] push ecx call _DuplicateNumber add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN12@PMC_Subtru ; 313 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN12@PMC_Subtru: ; 314 : } jmp $LN11@PMC_Subtru $LN10@PMC_Subtru: ; 315 : else ; 316 : { ; 317 : // u と v がともに 0 ではない場合 ; 318 : ; 319 : // u と v の差を計算する ; 320 : __UNIT_TYPE u_bit_count = nu->UNIT_BIT_COUNT; mov edx, DWORD PTR _nu$[ebp] mov eax, DWORD PTR [edx+12] mov DWORD PTR _u_bit_count$4[ebp], eax ; 321 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_32(v); mov ecx, DWORD PTR _v$[ebp] push ecx call __LZCNT_ALT_32 add esp, 4 mov edx, 32 ; 00000020H sub edx, eax mov DWORD PTR _v_bit_count$3[ebp], edx ; 322 : if (u_bit_count < v_bit_count) mov eax, DWORD PTR _u_bit_count$4[ebp] cmp eax, DWORD PTR _v_bit_count$3[ebp] jae SHORT $LN13@PMC_Subtru ; 323 : { ; 324 : // 演算結果は負となってしまうのでエラーを返す。 ; 325 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN13@PMC_Subtru: ; 326 : } ; 327 : __UNIT_TYPE w_bit_count = u_bit_count; mov ecx, DWORD PTR _u_bit_count$4[ebp] mov DWORD PTR _w_bit_count$2[ebp], ecx ; 328 : __UNIT_TYPE w_light_check_code; ; 329 : if ((result = AllocateNumber(&nw, w_bit_count, &w_light_check_code)) != PMC_STATUS_OK) lea edx, DWORD PTR _w_light_check_code$1[ebp] push edx mov eax, DWORD PTR _w_bit_count$2[ebp] push eax lea ecx, DWORD PTR _nw$[ebp] push ecx call _AllocateNumber add esp, 12 ; 0000000cH mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN14@PMC_Subtru ; 330 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN14@PMC_Subtru: ; 331 : if ((result = Subtruct_X_1W(nu->BLOCK, nu->UNIT_WORD_COUNT, v, nw->BLOCK, nw->BLOCK_COUNT)) != PMC_STATUS_OK) mov edx, DWORD PTR _nw$[ebp] mov eax, DWORD PTR [edx+28] push eax mov ecx, DWORD PTR _nw$[ebp] mov edx, DWORD PTR [ecx+32] push edx mov eax, DWORD PTR _v$[ebp] push eax mov ecx, DWORD PTR _nu$[ebp] mov edx, DWORD PTR [ecx+8] push edx mov eax, DWORD PTR _nu$[ebp] mov ecx, DWORD PTR [eax+32] push ecx call _Subtruct_X_1W add esp, 20 ; 00000014H mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN15@PMC_Subtru ; 332 : { ; 333 : DeallocateNumber(nw); mov edx, DWORD PTR _nw$[ebp] push edx call _DeallocateNumber add esp, 4 ; 334 : return (result == PMC_STATUS_INTERNAL_BORROW ? PMC_STATUS_OVERFLOW : result); cmp DWORD PTR _result$[ebp], -258 ; fffffefeH jne SHORT $LN20@PMC_Subtru mov DWORD PTR tv135[ebp], -2 ; fffffffeH jmp SHORT $LN21@PMC_Subtru $LN20@PMC_Subtru: mov eax, DWORD PTR _result$[ebp] mov DWORD PTR tv135[ebp], eax $LN21@PMC_Subtru: mov eax, DWORD PTR tv135[ebp] jmp SHORT $LN1@PMC_Subtru $LN15@PMC_Subtru: ; 335 : } ; 336 : if ((result = CheckBlockLight(nw->BLOCK, w_light_check_code)) != PMC_STATUS_OK) mov ecx, DWORD PTR _w_light_check_code$1[ebp] push ecx mov edx, DWORD PTR _nw$[ebp] mov eax, DWORD PTR [edx+32] push eax call _CheckBlockLight add esp, 8 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN16@PMC_Subtru ; 337 : return (result); mov eax, DWORD PTR _result$[ebp] jmp SHORT $LN1@PMC_Subtru $LN16@PMC_Subtru: ; 338 : CommitNumber(nw); mov ecx, DWORD PTR _nw$[ebp] push ecx call _CommitNumber add esp, 4 ; 339 : if (nw->IS_ZERO) mov edx, DWORD PTR _nw$[ebp] mov eax, DWORD PTR [edx+24] shr eax, 1 and eax, 1 je SHORT $LN11@PMC_Subtru ; 340 : { ; 341 : DeallocateNumber(nw); mov ecx, DWORD PTR _nw$[ebp] push ecx call _DeallocateNumber add esp, 4 ; 342 : nw = &number_zero; mov DWORD PTR _nw$[ebp], OFFSET _number_zero $LN11@PMC_Subtru: ; 343 : } ; 344 : } ; 345 : *w = nw; mov edx, DWORD PTR _w$[ebp] mov eax, DWORD PTR _nw$[ebp] mov DWORD PTR [edx], eax $LN7@PMC_Subtru: ; 346 : } ; 347 : #ifdef _DEBUG ; 348 : if ((result = CheckNumber(*w)) != PMC_STATUS_OK) mov ecx, DWORD PTR _w$[ebp] mov edx, DWORD PTR [ecx] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN18@PMC_Subtru ; 349 : return (result); mov eax, DWORD PTR _result$[ebp] jmp SHORT $LN1@PMC_Subtru $LN18@PMC_Subtru: ; 350 : #endif ; 351 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_Subtru: ; 352 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN25@PMC_Subtru call @_RTC_CheckStackVars@8 pop eax pop edx pop edi add esp, 48 ; 00000030H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 12 ; 0000000cH npad 3 $LN25@PMC_Subtru: DD 2 DD $LN24@PMC_Subtru $LN24@PMC_Subtru: DD -16 ; fffffff0H DD 4 DD $LN22@PMC_Subtru DD -40 ; ffffffd8H DD 4 DD $LN23@PMC_Subtru $LN23@PMC_Subtru: DB 119 ; 00000077H DB 95 ; 0000005fH DB 108 ; 0000006cH DB 105 ; 00000069H DB 103 ; 00000067H DB 104 ; 00000068H DB 116 ; 00000074H DB 95 ; 0000005fH DB 99 ; 00000063H DB 104 ; 00000068H DB 101 ; 00000065H DB 99 ; 00000063H DB 107 ; 0000006bH DB 95 ; 0000005fH DB 99 ; 00000063H DB 111 ; 0000006fH DB 100 ; 00000064H DB 101 ; 00000065H DB 0 $LN22@PMC_Subtru: DB 110 ; 0000006eH DB 119 ; 00000077H DB 0 _PMC_Subtruct_X_I@12 ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT _borrow$1 = -105 ; size = 1 _temp_w$2 = -100 ; size = 4 _v_bit_count$3 = -92 ; size = 4 _u_bit_count$4 = -88 ; size = 4 _borrow$5 = -81 ; size = 1 _temp_w_lo$6 = -76 ; size = 4 _temp_w_hi$7 = -64 ; size = 4 _v_bit_count$8 = -56 ; size = 4 _u_bit_count$9 = -52 ; size = 4 _borrow$10 = -45 ; size = 1 _temp_w$11 = -40 ; size = 4 _v_bit_count$12 = -32 ; size = 4 _u_bit_count$13 = -28 ; size = 4 _u_lo$14 = -24 ; size = 4 _u_hi$15 = -16 ; size = 4 _result$ = -8 ; size = 4 _nv$ = -4 ; size = 4 _u$ = 8 ; size = 8 _v$ = 16 ; size = 4 _w$ = 20 ; size = 4 _PMC_Subtruct_L_X@16 PROC ; 355 : { push ebp mov ebp, esp sub esp, 108 ; 0000006cH push edi lea edi, DWORD PTR [ebp-108] mov ecx, 27 ; 0000001bH mov eax, -858993460 ; ccccccccH rep stosd mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 356 : if (__UNIT_TYPE_BIT_COUNT * 2 < sizeof(u) * 8) xor eax, eax je SHORT $LN2@PMC_Subtru ; 357 : { ; 358 : // _UINT64_T が 2 ワードで表現しきれない処理系には対応しない ; 359 : return (PMC_STATUS_INTERNAL_ERROR); mov eax, -256 ; ffffff00H jmp $LN1@PMC_Subtru $LN2@PMC_Subtru: ; 360 : } ; 361 : if (v == NULL) cmp DWORD PTR _v$[ebp], 0 jne SHORT $LN3@PMC_Subtru ; 362 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN3@PMC_Subtru: ; 363 : if (w == NULL) cmp DWORD PTR _w$[ebp], 0 jne SHORT $LN4@PMC_Subtru ; 364 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN4@PMC_Subtru: ; 365 : NUMBER_HEADER* nv = (NUMBER_HEADER*)v; mov ecx, DWORD PTR _v$[ebp] mov DWORD PTR _nv$[ebp], ecx ; 366 : PMC_STATUS_CODE result; ; 367 : if ((result = CheckNumber(nv)) != PMC_STATUS_OK) mov edx, DWORD PTR _nv$[ebp] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN5@PMC_Subtru ; 368 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN5@PMC_Subtru: ; 369 : if (u == 0) mov eax, DWORD PTR _u$[ebp] or eax, DWORD PTR _u$[ebp+4] jne SHORT $LN6@PMC_Subtru ; 370 : { ; 371 : // u が 0 である場合 ; 372 : ; 373 : if (nv->IS_ZERO) mov ecx, DWORD PTR _nv$[ebp] mov edx, DWORD PTR [ecx+24] shr edx, 1 and edx, 1 je SHORT $LN8@PMC_Subtru ; 374 : { ; 375 : // v が 0 である場合 ; 376 : ; 377 : // x と y がともに 0 であるので、演算結果の 0 を呼び出し元に返す。 ; 378 : *w = 0; mov eax, DWORD PTR _w$[ebp] mov DWORD PTR [eax], 0 mov DWORD PTR [eax+4], 0 ; 379 : } jmp SHORT $LN9@PMC_Subtru $LN8@PMC_Subtru: ; 380 : else ; 381 : { ; 382 : // v が 0 ではない場合 ; 383 : ; 384 : // 演算結果は負となってしまうのでエラーを返す。 ; 385 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN9@PMC_Subtru: ; 386 : } ; 387 : } jmp $LN7@PMC_Subtru $LN6@PMC_Subtru: ; 388 : else ; 389 : { ; 390 : // u が 0 ではない場合 ; 391 : ; 392 : if (nv->IS_ZERO) mov ecx, DWORD PTR _nv$[ebp] mov edx, DWORD PTR [ecx+24] shr edx, 1 and edx, 1 je SHORT $LN10@PMC_Subtru ; 393 : { ; 394 : // v が 0 である場合 ; 395 : ; 396 : // 演算結果となる u の値を持つ NUMBER_HEADER 構造体を獲得し、呼び出し元へ返す。 ; 397 : *w = u; mov eax, DWORD PTR _w$[ebp] mov ecx, DWORD PTR _u$[ebp] mov DWORD PTR [eax], ecx mov edx, DWORD PTR _u$[ebp+4] mov DWORD PTR [eax+4], edx ; 398 : } jmp $LN7@PMC_Subtru $LN10@PMC_Subtru: ; 399 : else ; 400 : { ; 401 : // u と v がともに 0 ではない場合 ; 402 : ; 403 : // u と v の差を計算する ; 404 : if (__UNIT_TYPE_BIT_COUNT < sizeof(u) * 8) mov eax, 1 test eax, eax je $LN12@PMC_Subtru ; 405 : { ; 406 : // _UINT64_T が 1 ワードで表現しきれない場合 ; 407 : ; 408 : _UINT32_T u_hi; ; 409 : _UINT32_T u_lo = _FROMDWORDTOWORD(u, &u_hi); lea ecx, DWORD PTR _u_hi$15[ebp] push ecx mov edx, DWORD PTR _u$[ebp+4] push edx mov eax, DWORD PTR _u$[ebp] push eax call __FROMDWORDTOWORD add esp, 12 ; 0000000cH mov DWORD PTR _u_lo$14[ebp], eax ; 410 : if (u_hi == 0) cmp DWORD PTR _u_hi$15[ebp], 0 jne $LN14@PMC_Subtru ; 411 : { ; 412 : // u の値が 32bit で表現可能な場合 ; 413 : __UNIT_TYPE u_bit_count = sizeof(u_lo) * 8 - _LZCNT_ALT_32(u_lo); mov ecx, DWORD PTR _u_lo$14[ebp] push ecx call __LZCNT_ALT_32 add esp, 4 mov edx, 32 ; 00000020H sub edx, eax mov DWORD PTR _u_bit_count$13[ebp], edx ; 414 : __UNIT_TYPE v_bit_count = nv->UNIT_BIT_COUNT; mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+12] mov DWORD PTR _v_bit_count$12[ebp], ecx ; 415 : if (u_bit_count < v_bit_count) mov edx, DWORD PTR _u_bit_count$13[ebp] cmp edx, DWORD PTR _v_bit_count$12[ebp] jae SHORT $LN16@PMC_Subtru ; 416 : { ; 417 : // 明らかに u < v である場合 ; 418 : ; 419 : // 演算結果は負となってしまうのでエラーを返す。 ; 420 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru ; 421 : } jmp SHORT $LN17@PMC_Subtru $LN16@PMC_Subtru: ; 422 : else ; 423 : { ; 424 : // u のビット長が v のビット長以上である場合 ; 425 : ; 426 : // u が32bit 整数で表現できるので v も 32bit 整数で表現できる ; 427 : ; 428 : __UNIT_TYPE temp_w; ; 429 : char borrow = _SUBTRUCT_UNIT(0, u_lo, nv->BLOCK[0], &temp_w); lea eax, DWORD PTR _temp_w$11[ebp] push eax mov ecx, 4 imul edx, ecx, 0 mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+32] mov edx, DWORD PTR [ecx+edx] push edx mov eax, DWORD PTR _u_lo$14[ebp] push eax push 0 call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _borrow$10[ebp], al ; 430 : if (borrow) movsx ecx, BYTE PTR _borrow$10[ebp] test ecx, ecx je SHORT $LN18@PMC_Subtru ; 431 : { ; 432 : // ボローが発生した場合は演算結果が負なのでエラーとする ; 433 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru ; 434 : } jmp SHORT $LN17@PMC_Subtru $LN18@PMC_Subtru: ; 435 : else ; 436 : { ; 437 : *w = temp_w; mov edx, DWORD PTR _temp_w$11[ebp] xor eax, eax mov ecx, DWORD PTR _w$[ebp] mov DWORD PTR [ecx], edx mov DWORD PTR [ecx+4], eax $LN17@PMC_Subtru: ; 438 : } ; 439 : } ; 440 : } jmp $LN15@PMC_Subtru $LN14@PMC_Subtru: ; 441 : else ; 442 : { ; 443 : // u の値が 32bit では表現できない場合 ; 444 : __UNIT_TYPE u_bit_count = sizeof(u) * 8 - _LZCNT_ALT_32(u_hi); mov edx, DWORD PTR _u_hi$15[ebp] push edx call __LZCNT_ALT_32 add esp, 4 mov ecx, 64 ; 00000040H sub ecx, eax mov DWORD PTR _u_bit_count$9[ebp], ecx ; 445 : __UNIT_TYPE v_bit_count = nv->UNIT_BIT_COUNT; mov edx, DWORD PTR _nv$[ebp] mov eax, DWORD PTR [edx+12] mov DWORD PTR _v_bit_count$8[ebp], eax ; 446 : if (u_bit_count < v_bit_count) mov ecx, DWORD PTR _u_bit_count$9[ebp] cmp ecx, DWORD PTR _v_bit_count$8[ebp] jae SHORT $LN20@PMC_Subtru ; 447 : { ; 448 : // 明らかに u < v である場合 ; 449 : ; 450 : // 演算結果は負となってしまうのでエラーを返す。 ; 451 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru ; 452 : } jmp $LN15@PMC_Subtru $LN20@PMC_Subtru: ; 453 : else ; 454 : { ; 455 : // u のビット長が v のビット長以上である場合 ; 456 : ; 457 : // この時点では u は 33 ~ 64bit 整数であり、v は 1 ~ 64bit整数である ; 458 : ; 459 : __UNIT_TYPE temp_w_hi; ; 460 : __UNIT_TYPE temp_w_lo; ; 461 : char borrow; ; 462 : borrow = _SUBTRUCT_UNIT(0, u_lo, nv->BLOCK[0], &temp_w_lo); lea edx, DWORD PTR _temp_w_lo$6[ebp] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _nv$[ebp] mov eax, DWORD PTR [edx+32] mov ecx, DWORD PTR [eax+ecx] push ecx mov edx, DWORD PTR _u_lo$14[ebp] push edx push 0 call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _borrow$5[ebp], al ; 463 : if (nv->UNIT_WORD_COUNT <= 1) mov eax, DWORD PTR _nv$[ebp] cmp DWORD PTR [eax+8], 1 ja SHORT $LN22@PMC_Subtru ; 464 : { ; 465 : // v が 1 ワードで表現できる場合(1 ~ 32bit 整数) ; 466 : borrow = _SUBTRUCT_UNIT(borrow, u_hi, 0, &temp_w_hi); lea ecx, DWORD PTR _temp_w_hi$7[ebp] push ecx push 0 mov edx, DWORD PTR _u_hi$15[ebp] push edx movzx eax, BYTE PTR _borrow$5[ebp] push eax call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _borrow$5[ebp], al ; 467 : } jmp SHORT $LN23@PMC_Subtru $LN22@PMC_Subtru: ; 468 : else ; 469 : { ; 470 : // v が 1 ワードで表現できない場合(33 ~ 64bit 整数) ; 471 : borrow = _SUBTRUCT_UNIT(borrow, u_hi, nv->BLOCK[1], &temp_w_hi); lea ecx, DWORD PTR _temp_w_hi$7[ebp] push ecx mov edx, 4 shl edx, 0 mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+32] mov edx, DWORD PTR [ecx+edx] push edx mov eax, DWORD PTR _u_hi$15[ebp] push eax movzx ecx, BYTE PTR _borrow$5[ebp] push ecx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _borrow$5[ebp], al $LN23@PMC_Subtru: ; 472 : } ; 473 : if (borrow) movsx edx, BYTE PTR _borrow$5[ebp] test edx, edx je SHORT $LN24@PMC_Subtru ; 474 : { ; 475 : // ボローが発生した場合は演算結果が負なのでエラーとする ; 476 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru ; 477 : } jmp SHORT $LN15@PMC_Subtru $LN24@PMC_Subtru: ; 478 : else ; 479 : { ; 480 : *w = _FROMWORDTODWORD((_UINT32_T)temp_w_hi, (_UINT32_T)temp_w_lo); mov eax, DWORD PTR _temp_w_lo$6[ebp] push eax mov ecx, DWORD PTR _temp_w_hi$7[ebp] push ecx call __FROMWORDTODWORD add esp, 8 mov ecx, DWORD PTR _w$[ebp] mov DWORD PTR [ecx], eax mov DWORD PTR [ecx+4], edx $LN15@PMC_Subtru: ; 481 : } ; 482 : ; 483 : } ; 484 : } ; 485 : } jmp SHORT $LN7@PMC_Subtru $LN12@PMC_Subtru: ; 486 : else ; 487 : { ; 488 : // _UINT64_T が 1 ワードで表現できる場合 ; 489 : ; 490 : __UNIT_TYPE u_bit_count = sizeof(u) * 8 - _LZCNT_ALT_UNIT((__UNIT_TYPE)u); mov edx, DWORD PTR _u$[ebp] push edx call __LZCNT_ALT_UNIT add esp, 4 mov ecx, 64 ; 00000040H sub ecx, eax mov DWORD PTR _u_bit_count$4[ebp], ecx ; 491 : __UNIT_TYPE v_bit_count = nv->UNIT_BIT_COUNT; mov edx, DWORD PTR _nv$[ebp] mov eax, DWORD PTR [edx+12] mov DWORD PTR _v_bit_count$3[ebp], eax ; 492 : if (u_bit_count < v_bit_count) mov ecx, DWORD PTR _u_bit_count$4[ebp] cmp ecx, DWORD PTR _v_bit_count$3[ebp] jae SHORT $LN26@PMC_Subtru ; 493 : { ; 494 : // 明らかに u < v である場合 ; 495 : ; 496 : // 演算結果は負となってしまうのでエラーを返す。 ; 497 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp SHORT $LN1@PMC_Subtru ; 498 : } jmp SHORT $LN7@PMC_Subtru $LN26@PMC_Subtru: ; 499 : else ; 500 : { ; 501 : // u のビット長が v のビット長以上である場合 ; 502 : ; 503 : // u が 64bit 整数で表現できるので v も 64bit 整数で表現できる ; 504 : ; 505 : __UNIT_TYPE temp_w; ; 506 : char borrow = _SUBTRUCT_UNIT(0, (__UNIT_TYPE)u, nv->BLOCK[0], &temp_w); lea edx, DWORD PTR _temp_w$2[ebp] push edx mov eax, 4 imul ecx, eax, 0 mov edx, DWORD PTR _nv$[ebp] mov eax, DWORD PTR [edx+32] mov ecx, DWORD PTR [eax+ecx] push ecx mov edx, DWORD PTR _u$[ebp] push edx push 0 call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _borrow$1[ebp], al ; 507 : if (borrow) movsx eax, BYTE PTR _borrow$1[ebp] test eax, eax je SHORT $LN28@PMC_Subtru ; 508 : { ; 509 : // ボローが発生した場合は演算結果が負なのでエラーとする ; 510 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp SHORT $LN1@PMC_Subtru ; 511 : } jmp SHORT $LN7@PMC_Subtru $LN28@PMC_Subtru: ; 512 : else ; 513 : { ; 514 : *w = temp_w; mov ecx, DWORD PTR _temp_w$2[ebp] xor edx, edx mov eax, DWORD PTR _w$[ebp] mov DWORD PTR [eax], ecx mov DWORD PTR [eax+4], edx $LN7@PMC_Subtru: ; 515 : } ; 516 : } ; 517 : } ; 518 : } ; 519 : } ; 520 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_Subtru: ; 521 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN37@PMC_Subtru call @_RTC_CheckStackVars@8 pop eax pop edx pop edi add esp, 108 ; 0000006cH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 16 ; 00000010H $LN37@PMC_Subtru: DD 5 DD $LN36@PMC_Subtru $LN36@PMC_Subtru: DD -16 ; fffffff0H DD 4 DD $LN31@PMC_Subtru DD -40 ; ffffffd8H DD 4 DD $LN32@PMC_Subtru DD -64 ; ffffffc0H DD 4 DD $LN33@PMC_Subtru DD -76 ; ffffffb4H DD 4 DD $LN34@PMC_Subtru DD -100 ; ffffff9cH DD 4 DD $LN35@PMC_Subtru $LN35@PMC_Subtru: DB 116 ; 00000074H DB 101 ; 00000065H DB 109 ; 0000006dH DB 112 ; 00000070H DB 95 ; 0000005fH DB 119 ; 00000077H DB 0 $LN34@PMC_Subtru: DB 116 ; 00000074H DB 101 ; 00000065H DB 109 ; 0000006dH DB 112 ; 00000070H DB 95 ; 0000005fH DB 119 ; 00000077H DB 95 ; 0000005fH DB 108 ; 0000006cH DB 111 ; 0000006fH DB 0 $LN33@PMC_Subtru: DB 116 ; 00000074H DB 101 ; 00000065H DB 109 ; 0000006dH DB 112 ; 00000070H DB 95 ; 0000005fH DB 119 ; 00000077H DB 95 ; 0000005fH DB 104 ; 00000068H DB 105 ; 00000069H DB 0 $LN32@PMC_Subtru: DB 116 ; 00000074H DB 101 ; 00000065H DB 109 ; 0000006dH DB 112 ; 00000070H DB 95 ; 0000005fH DB 119 ; 00000077H DB 0 $LN31@PMC_Subtru: DB 117 ; 00000075H DB 95 ; 0000005fH DB 104 ; 00000068H DB 105 ; 00000069H DB 0 _PMC_Subtruct_L_X@16 ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT _borrow$1 = -29 ; size = 1 _temp_w$2 = -24 ; size = 4 _v_bit_count$3 = -16 ; size = 4 _u_bit_count$4 = -12 ; size = 4 _result$ = -8 ; size = 4 _nv$ = -4 ; size = 4 _u$ = 8 ; size = 4 _v$ = 12 ; size = 4 _w$ = 16 ; size = 4 _PMC_Subtruct_I_X@12 PROC ; 189 : { push ebp mov ebp, esp sub esp, 32 ; 00000020H mov eax, -858993460 ; ccccccccH mov DWORD PTR [ebp-32], eax mov DWORD PTR [ebp-28], eax mov DWORD PTR [ebp-24], eax mov DWORD PTR [ebp-20], eax mov DWORD PTR [ebp-16], eax mov DWORD PTR [ebp-12], eax mov DWORD PTR [ebp-8], eax mov DWORD PTR [ebp-4], eax mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 190 : if (__UNIT_TYPE_BIT_COUNT < sizeof(u) * 8) xor eax, eax je SHORT $LN2@PMC_Subtru ; 191 : { ; 192 : // _UINT32_T が 1 ワードで表現しきれない処理系には対応しない ; 193 : return (PMC_STATUS_INTERNAL_ERROR); mov eax, -256 ; ffffff00H jmp $LN1@PMC_Subtru $LN2@PMC_Subtru: ; 194 : } ; 195 : if (v == NULL) cmp DWORD PTR _v$[ebp], 0 jne SHORT $LN3@PMC_Subtru ; 196 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN3@PMC_Subtru: ; 197 : if (w == NULL) cmp DWORD PTR _w$[ebp], 0 jne SHORT $LN4@PMC_Subtru ; 198 : return (PMC_STATUS_ARGUMENT_ERROR); or eax, -1 jmp $LN1@PMC_Subtru $LN4@PMC_Subtru: ; 199 : NUMBER_HEADER* nv = (NUMBER_HEADER*)v; mov ecx, DWORD PTR _v$[ebp] mov DWORD PTR _nv$[ebp], ecx ; 200 : PMC_STATUS_CODE result; ; 201 : if ((result = CheckNumber(nv)) != PMC_STATUS_OK) mov edx, DWORD PTR _nv$[ebp] push edx call _CheckNumber add esp, 4 mov DWORD PTR _result$[ebp], eax cmp DWORD PTR _result$[ebp], 0 je SHORT $LN5@PMC_Subtru ; 202 : return (result); mov eax, DWORD PTR _result$[ebp] jmp $LN1@PMC_Subtru $LN5@PMC_Subtru: ; 203 : if (u == 0) cmp DWORD PTR _u$[ebp], 0 jne SHORT $LN6@PMC_Subtru ; 204 : { ; 205 : // u が 0 である場合 ; 206 : ; 207 : if (nv->IS_ZERO) mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+24] shr ecx, 1 and ecx, 1 je SHORT $LN8@PMC_Subtru ; 208 : { ; 209 : // v が 0 である場合 ; 210 : ; 211 : // u と v がともに 0 であるので、演算結果の 0 を呼び出し元に返す。 ; 212 : *w = 0; mov edx, DWORD PTR _w$[ebp] mov DWORD PTR [edx], 0 ; 213 : } jmp SHORT $LN9@PMC_Subtru $LN8@PMC_Subtru: ; 214 : else ; 215 : { ; 216 : // v が 0 ではない場合 ; 217 : ; 218 : // 演算結果は負となってしまうのでエラーを返す。 ; 219 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp $LN1@PMC_Subtru $LN9@PMC_Subtru: ; 220 : } ; 221 : } jmp $LN7@PMC_Subtru $LN6@PMC_Subtru: ; 222 : else ; 223 : { ; 224 : // u が 0 ではない場合 ; 225 : ; 226 : if (nv->IS_ZERO) mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+24] shr ecx, 1 and ecx, 1 je SHORT $LN10@PMC_Subtru ; 227 : { ; 228 : // v が 0 である場合 ; 229 : ; 230 : // 演算結果となる u の値を持つ NUMBER_HEADER 構造体を獲得し、呼び出し元へ返す。 ; 231 : *w = u; mov edx, DWORD PTR _w$[ebp] mov eax, DWORD PTR _u$[ebp] mov DWORD PTR [edx], eax ; 232 : } jmp SHORT $LN7@PMC_Subtru $LN10@PMC_Subtru: ; 233 : else ; 234 : { ; 235 : // u と v がともに 0 ではない場合 ; 236 : ; 237 : // x と y の差を計算する ; 238 : __UNIT_TYPE u_bit_count = sizeof(u) * 8 - _LZCNT_ALT_32(u); mov ecx, DWORD PTR _u$[ebp] push ecx call __LZCNT_ALT_32 add esp, 4 mov edx, 32 ; 00000020H sub edx, eax mov DWORD PTR _u_bit_count$4[ebp], edx ; 239 : __UNIT_TYPE v_bit_count = nv->UNIT_BIT_COUNT; mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+12] mov DWORD PTR _v_bit_count$3[ebp], ecx ; 240 : if (u_bit_count < v_bit_count) mov edx, DWORD PTR _u_bit_count$4[ebp] cmp edx, DWORD PTR _v_bit_count$3[ebp] jae SHORT $LN12@PMC_Subtru ; 241 : { ; 242 : // 明らかに u < v である場合 ; 243 : // 演算結果は負となってしまうのでエラーを返す。 ; 244 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp SHORT $LN1@PMC_Subtru ; 245 : } jmp SHORT $LN7@PMC_Subtru $LN12@PMC_Subtru: ; 246 : else ; 247 : { ; 248 : // u のビット長が v のビット長以上である場合 ; 249 : ; 250 : // u が 32bit 整数なので、v も32bit 整数で表現できる ; 251 : __UNIT_TYPE temp_w; ; 252 : char borrow = _SUBTRUCT_UNIT(0, u, nv->BLOCK[0], &temp_w); lea eax, DWORD PTR _temp_w$2[ebp] push eax mov ecx, 4 imul edx, ecx, 0 mov eax, DWORD PTR _nv$[ebp] mov ecx, DWORD PTR [eax+32] mov edx, DWORD PTR [ecx+edx] push edx mov eax, DWORD PTR _u$[ebp] push eax push 0 call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _borrow$1[ebp], al ; 253 : if (borrow) movsx ecx, BYTE PTR _borrow$1[ebp] test ecx, ecx je SHORT $LN14@PMC_Subtru ; 254 : { ; 255 : // ボローが発生した場合は演算結果が負なのでエラーとする ; 256 : return (PMC_STATUS_OVERFLOW); mov eax, -2 ; fffffffeH jmp SHORT $LN1@PMC_Subtru ; 257 : } jmp SHORT $LN7@PMC_Subtru $LN14@PMC_Subtru: ; 258 : else ; 259 : { ; 260 : *w = (_UINT32_T)temp_w; mov edx, DWORD PTR _w$[ebp] mov eax, DWORD PTR _temp_w$2[ebp] mov DWORD PTR [edx], eax $LN7@PMC_Subtru: ; 261 : } ; 262 : } ; 263 : } ; 264 : } ; 265 : return (PMC_STATUS_OK); xor eax, eax $LN1@PMC_Subtru: ; 266 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN19@PMC_Subtru call @_RTC_CheckStackVars@8 pop eax pop edx add esp, 32 ; 00000020H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 12 ; 0000000cH npad 3 $LN19@PMC_Subtru: DD 1 DD $LN18@PMC_Subtru $LN18@PMC_Subtru: DD -24 ; ffffffe8H DD 4 DD $LN17@PMC_Subtru $LN17@PMC_Subtru: DB 116 ; 00000074H DB 101 ; 00000065H DB 109 ; 0000006dH DB 112 ; 00000070H DB 95 ; 0000005fH DB 119 ; 00000077H DB 0 _PMC_Subtruct_I_X@12 ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT _feature$ = 8 ; size = 4 _Initialize_Subtruct PROC ; 744 : { push ebp mov ebp, esp mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 745 : return (PMC_STATUS_OK); xor eax, eax ; 746 : } cmp ebp, esp call __RTC_CheckEsp pop ebp ret 0 _Initialize_Subtruct ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_subtruct.c _TEXT SEGMENT tv157 = -20 ; size = 4 tv154 = -16 ; size = 4 tv151 = -12 ; size = 4 _count$ = -8 ; size = 4 _c$ = -1 ; size = 1 _up$ = 8 ; size = 4 _u_count$ = 12 ; size = 4 _vp$ = 16 ; size = 4 _v_count$ = 20 ; size = 4 _wp$ = 24 ; size = 4 _w_count$ = 28 ; size = 4 _Subtruct_Imp PROC ; 125 : { push ebp mov ebp, esp sub esp, 20 ; 00000014H mov eax, -858993460 ; ccccccccH mov DWORD PTR [ebp-20], eax mov DWORD PTR [ebp-16], eax mov DWORD PTR [ebp-12], eax mov DWORD PTR [ebp-8], eax mov DWORD PTR [ebp-4], eax mov ecx, OFFSET __1898920A_pmc_subtruct@c call @__CheckForDebuggerJustMyCode@4 ; 126 : char c = 0; mov BYTE PTR _c$[ebp], 0 ; 127 : ; 128 : // まず 32 ワードずつ減算をする。 ; 129 : __UNIT_TYPE count = v_count >> 5; mov eax, DWORD PTR _v_count$[ebp] shr eax, 5 mov DWORD PTR _count$[ebp], eax $LN2@Subtruct_I: ; 130 : while (count != 0) cmp DWORD PTR _count$[ebp], 0 je SHORT $LN3@Subtruct_I ; 131 : { ; 132 : c= _SUBTRUCT_32WORDS_SBB(c, up, vp, wp); mov ecx, DWORD PTR _wp$[ebp] push ecx mov edx, DWORD PTR _vp$[ebp] push edx mov eax, DWORD PTR _up$[ebp] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_32WORDS_SBB add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 133 : up += 32; mov edx, DWORD PTR _up$[ebp] add edx, 128 ; 00000080H mov DWORD PTR _up$[ebp], edx ; 134 : vp += 32; mov eax, DWORD PTR _vp$[ebp] add eax, 128 ; 00000080H mov DWORD PTR _vp$[ebp], eax ; 135 : wp += 32; mov ecx, DWORD PTR _wp$[ebp] add ecx, 128 ; 00000080H mov DWORD PTR _wp$[ebp], ecx ; 136 : --count; mov edx, DWORD PTR _count$[ebp] sub edx, 1 mov DWORD PTR _count$[ebp], edx ; 137 : } jmp SHORT $LN2@Subtruct_I $LN3@Subtruct_I: ; 138 : // この時点で未処理の桁は 32 ワード未満のはず ; 139 : ; 140 : // 未処理の桁が 16 ワード以上あるなら 16 ワード減算を行う。 ; 141 : if (v_count & 0x10) mov eax, DWORD PTR _v_count$[ebp] and eax, 16 ; 00000010H je SHORT $LN4@Subtruct_I ; 142 : { ; 143 : c = _SUBTRUCT_16WORDS_SBB(c, up, vp, wp); mov ecx, DWORD PTR _wp$[ebp] push ecx mov edx, DWORD PTR _vp$[ebp] push edx mov eax, DWORD PTR _up$[ebp] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_16WORDS_SBB add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 144 : up += 16; mov edx, DWORD PTR _up$[ebp] add edx, 64 ; 00000040H mov DWORD PTR _up$[ebp], edx ; 145 : vp += 16; mov eax, DWORD PTR _vp$[ebp] add eax, 64 ; 00000040H mov DWORD PTR _vp$[ebp], eax ; 146 : wp += 16; mov ecx, DWORD PTR _wp$[ebp] add ecx, 64 ; 00000040H mov DWORD PTR _wp$[ebp], ecx $LN4@Subtruct_I: ; 147 : } ; 148 : // この時点で未処理の桁は 16 ワード未満のはず ; 149 : ; 150 : // 未処理の桁が 8 ワード以上あるなら 8 ワード減算を行う。 ; 151 : if (v_count & 0x8) mov edx, DWORD PTR _v_count$[ebp] and edx, 8 je SHORT $LN5@Subtruct_I ; 152 : { ; 153 : c = _SUBTRUCT_8WORDS_SBB(c, up, vp, wp); mov eax, DWORD PTR _wp$[ebp] push eax mov ecx, DWORD PTR _vp$[ebp] push ecx mov edx, DWORD PTR _up$[ebp] push edx movzx eax, BYTE PTR _c$[ebp] push eax call __SUBTRUCT_8WORDS_SBB add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 154 : up += 8; mov ecx, DWORD PTR _up$[ebp] add ecx, 32 ; 00000020H mov DWORD PTR _up$[ebp], ecx ; 155 : vp += 8; mov edx, DWORD PTR _vp$[ebp] add edx, 32 ; 00000020H mov DWORD PTR _vp$[ebp], edx ; 156 : wp += 8; mov eax, DWORD PTR _wp$[ebp] add eax, 32 ; 00000020H mov DWORD PTR _wp$[ebp], eax $LN5@Subtruct_I: ; 157 : } ; 158 : // この時点で未処理の桁は 8 ワード未満のはず ; 159 : ; 160 : // 未処理の桁が 4 ワード以上あるなら 4 ワード減算を行う。 ; 161 : if (v_count & 0x4) mov ecx, DWORD PTR _v_count$[ebp] and ecx, 4 je SHORT $LN6@Subtruct_I ; 162 : { ; 163 : c = _SUBTRUCT_4WORDS_SBB(c, up, vp, wp); mov edx, DWORD PTR _wp$[ebp] push edx mov eax, DWORD PTR _vp$[ebp] push eax mov ecx, DWORD PTR _up$[ebp] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_4WORDS_SBB add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 164 : up += 4; mov eax, DWORD PTR _up$[ebp] add eax, 16 ; 00000010H mov DWORD PTR _up$[ebp], eax ; 165 : vp += 4; mov ecx, DWORD PTR _vp$[ebp] add ecx, 16 ; 00000010H mov DWORD PTR _vp$[ebp], ecx ; 166 : wp += 4; mov edx, DWORD PTR _wp$[ebp] add edx, 16 ; 00000010H mov DWORD PTR _wp$[ebp], edx $LN6@Subtruct_I: ; 167 : } ; 168 : // この時点で未処理の桁は 4 ワード未満のはず ; 169 : ; 170 : // 未処理の桁が 2 ワード以上あるなら 2 ワード減算を行う。 ; 171 : if (v_count & 0x2) mov eax, DWORD PTR _v_count$[ebp] and eax, 2 je SHORT $LN7@Subtruct_I ; 172 : { ; 173 : c = _SUBTRUCT_2WORDS_SBB(c, up, vp, wp); mov ecx, DWORD PTR _wp$[ebp] push ecx mov edx, DWORD PTR _vp$[ebp] push edx mov eax, DWORD PTR _up$[ebp] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call __SUBTRUCT_2WORDS_SBB add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al ; 174 : up += 2; mov edx, DWORD PTR _up$[ebp] add edx, 8 mov DWORD PTR _up$[ebp], edx ; 175 : vp += 2; mov eax, DWORD PTR _vp$[ebp] add eax, 8 mov DWORD PTR _vp$[ebp], eax ; 176 : wp += 2; mov ecx, DWORD PTR _wp$[ebp] add ecx, 8 mov DWORD PTR _wp$[ebp], ecx $LN7@Subtruct_I: ; 177 : } ; 178 : // この時点で未処理の桁は 2 ワード未満のはず ; 179 : ; 180 : // 未処理の桁が 1 ワード以上あるなら 1 ワード減算を行う。 ; 181 : if (v_count & 1) mov edx, DWORD PTR _v_count$[ebp] and edx, 1 je SHORT $LN8@Subtruct_I ; 182 : c = _SUBTRUCT_UNIT(c, *up++, *vp++, wp++); mov eax, DWORD PTR _wp$[ebp] mov DWORD PTR tv151[ebp], eax mov ecx, DWORD PTR _wp$[ebp] add ecx, 4 mov DWORD PTR _wp$[ebp], ecx mov edx, DWORD PTR _vp$[ebp] mov eax, DWORD PTR [edx] mov DWORD PTR tv154[ebp], eax mov ecx, DWORD PTR _vp$[ebp] add ecx, 4 mov DWORD PTR _vp$[ebp], ecx mov edx, DWORD PTR _up$[ebp] mov eax, DWORD PTR [edx] mov DWORD PTR tv157[ebp], eax mov ecx, DWORD PTR _up$[ebp] add ecx, 4 mov DWORD PTR _up$[ebp], ecx mov edx, DWORD PTR tv151[ebp] push edx mov eax, DWORD PTR tv154[ebp] push eax mov ecx, DWORD PTR tv157[ebp] push ecx movzx edx, BYTE PTR _c$[ebp] push edx call __SUBTRUCT_UNIT add esp, 16 ; 00000010H mov BYTE PTR _c$[ebp], al $LN8@Subtruct_I: ; 183 : ; 184 : // 残りの桁の繰り上がりを計算し、復帰する。 ; 185 : return (DoBorrow(c, up, u_count - v_count, wp, w_count - v_count)); mov eax, DWORD PTR _w_count$[ebp] sub eax, DWORD PTR _v_count$[ebp] push eax mov ecx, DWORD PTR _wp$[ebp] push ecx mov edx, DWORD PTR _u_count$[ebp] sub edx, DWORD PTR _v_count$[ebp] push edx mov eax, DWORD PTR _up$[ebp] push eax movzx ecx, BYTE PTR _c$[ebp] push ecx call _DoBorrow add esp, 20 ; 00000014H ; 186 : } add esp, 20 ; 00000014H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 _Subtruct_Imp ENDP _TEXT ENDS END
; MEM_LOG_DATA 2k buffer is defined by code including this (must be 256B aligned!) ; log structure: sequential items (one test can have multiple items, last item ; of particular test has set bit "last" in type). ; one item: ; +0 1B type ; bits 7-6: reserved (invalid counts are not checked, use API only!) ; bit 5: last item for particular test ; bit 4-3: count of words stored in item ; bit 2-0: count of bytes stored in item ; +1 1B b0 ; +2 2B w0 ; +4 2B w1 ; +6 2B w2/stringPtr ; total 8B size ; ; 3b + 2b = max amount 7 for 8b values and 3 for 16b values (not at the same time!) ; msg is displayed, when 8b+16b do not reach into w2, but w2 != nullptr ; 8b values use b0, lo(w0), hi(w0), lo(w1), hi(w1), lo(w2), hi(w2) (7 values max) ; 16b values are using remaining (after 8b) free "wX" (ignoring half-free wX-1) LOG_ITEM_TYPE equ 0 ; 1B [2:1:2:3] = reserved:last:wordCount,byteCount LOG_ITEM_B0 equ 1 ; 1B LOG_ITEM_W0 equ 2 ; 2B LOG_ITEM_W1 equ 4 ; 2B LOG_ITEM_W2 equ 6 ; 2B / if not nullptr and beyond wordCount => msgPtr LOG_ITEM_SIZE equ 8 ; total size LOG_TYPE_EMPTY equ $3F ; special type constant LOG_TYPE_B_CNT_MASK equ $07 LOG_TYPE_W_SHIFT equ 3 ; how many bits to shift for word-count LOG_TYPE_W_CNT_MASK equ $03<<LOG_TYPE_W_SHIFT LOG_TYPE_LAST equ $20 ; item is last in the chain for one test LOG_TYPE_LAST_BIT equ 5 LogLastIndex: db 0 ; call at beginning of the app LogInit: push iy ld a,0 ld (LogLastIndex),a call LogGetItemAddress ld (iy+LOG_ITEM_TYPE),LOG_TYPE_EMPTY ; mark it as empty pop iy ret ;A: index to calculate, returns address in IY LogGetItemAddress: push af push hl ld l,a ld h,0 add hl,hl add hl,hl add hl,hl ; HL = index * 8 ld a,MEM_LOG_DATA>>8 add a,h ld h,a ; address MEM_LOG_DATA added push hl ; move it to IY pop iy ; (avoided IY during calc. to use only official Z80 instructions) pop hl ; restore original HL pop af ret ; will mark the last inserted item as "last" of the items per single test ; call this after test (or ahead of new one), redundant calls are OK LogSealPreviousChainOfItems: push iy ld a,(LogLastIndex) call LogGetItemAddress ld a,LOG_TYPE_LAST or (iy+LOG_ITEM_TYPE) ld (iy+LOG_ITEM_TYPE),a pop iy ret ; Gets new log item, returns: ; ZF=1: IY = new log item address, A = new log item index ; ZF=0: log is full, don't add anything LogAllocateNewItem: ld a,(LogLastIndex) inc a jr z,.logIsFull ld (LogLastIndex),a call LogGetItemAddress ; set nullptr to W2 of newly allocated log item ("no msg") ld (iy+LOG_ITEM_W2),0 ld (iy+LOG_ITEM_W2+1),0 ; return with ZF=1 and index of new item cp a ret .logIsFull: ; return with ZF=0 (A == 0, because that's how I got here) cp 1 ret MACRO ALLOCATE_NEW_ITEM item_type call LogAllocateNewItem ; IY = new log item address, A = log index ret nz ; log is full ld (iy+LOG_ITEM_TYPE),item_type ENDM ; adds new log item with one 8b value in B ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd1B: ALLOCATE_NEW_ITEM 1 ; byte count = 1, word count = 0 .onlyStore: ld (iy+LOG_ITEM_B0),b ret ; adds new log item with two 8b values, first in B, second in C ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd2B: ALLOCATE_NEW_ITEM 2 ; byte count = 2, word count = 0 .onlyStore: ld (iy+LOG_ITEM_W0),c jr LogAdd1B.onlyStore ; adds new log item with three 8b values, {B, C, E} ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd3B: ALLOCATE_NEW_ITEM 3 ; byte count = 3, word count = 0 ld (iy+LOG_ITEM_W0+1),e jr LogAdd2B.onlyStore ; adds new log item with two 8b values, first in B, second in C and one 16b in DE ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd2B1W: ALLOCATE_NEW_ITEM 2+(1<<LOG_TYPE_W_SHIFT) ; byte count = 2, word count = 1 .onlyStore: ld (iy+LOG_ITEM_W1+1),d ld (iy+LOG_ITEM_W1),e jr LogAdd2B.onlyStore ; adds new log item with one 16b value in DE ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd1W: ALLOCATE_NEW_ITEM 1<<LOG_TYPE_W_SHIFT ; byte count = 0, word count = 1 .onlyStore: ld (iy+LOG_ITEM_W0+1),d ld (iy+LOG_ITEM_W0),e ret ; adds new log item with two 16b values, first in DE, second in HL ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd2W: ALLOCATE_NEW_ITEM 2<<LOG_TYPE_W_SHIFT ; byte count = 0, word count = 2 .onlyStore: ld (iy+LOG_ITEM_W1+1),h ld (iy+LOG_ITEM_W1),l jr LogAdd1W.onlyStore ; adds new log item with one 8b in B and one 16b value in DE ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd1B1W: ALLOCATE_NEW_ITEM 1+(1<<LOG_TYPE_W_SHIFT) ; byte count = 1, word count = 1 call LogAdd1B.onlyStore jr LogAdd1W.onlyStore ; adds new log item with one 8b, two 16b values, 8b in B, first word in DE, second in HL ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd1B2W: ALLOCATE_NEW_ITEM 1+(2<<LOG_TYPE_W_SHIFT) ; byte count = 1, word count = 2 call LogAdd1B.onlyStore jr LogAdd2W.onlyStore ; adds new log item with two 8b values, first in B, second in C and two 16b in DE and HL ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd2B2W: ALLOCATE_NEW_ITEM 2+(2<<LOG_TYPE_W_SHIFT) ; byte count = 2, word count = 2 ld (iy+LOG_ITEM_W2+1),h ld (iy+LOG_ITEM_W2),l jr LogAdd2B1W.onlyStore ; adds new log item with three 16b values, first word in DE, second in HL, third in BC ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAdd3W: ALLOCATE_NEW_ITEM 3<<LOG_TYPE_W_SHIFT ; byte count = 0, word count = 3 ld (iy+LOG_ITEM_W2+1),b ld (iy+LOG_ITEM_W2),c jr LogAdd2W.onlyStore ; adds new log item with msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg: ALLOCATE_NEW_ITEM 0 ; byte count = 0, word count = 0 .onlySetMsg: push hl ; preserve HL push ix ; HL = IX pop hl ld (iy+LOG_ITEM_W2+1),h ld (iy+LOG_ITEM_W2),l pop hl ret ; adds new log item with one 8b value in B and msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg1B: call LogAdd1B ; IY = new log item address, A = log index ret nz ; log is full jr LogAddMsg.onlySetMsg ; adds new log item with one 8b value in B and one 16b value in DE and msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg1B1W: call LogAdd1B1W ; IY = new log item address, A = log index ret nz ; log is full jr LogAddMsg.onlySetMsg ; adds new log item with one 8b value in B and two 16b values in DE, HL and msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg1B2W: call LogAdd1B2W ; IY = new log item address, A = log index ret nz ; log is full jr LogAddMsg.onlySetMsg ; adds new log item with two 8b values, first in B, second in C and msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg2B: call LogAdd2B ; IY = new log item address, A = log index ret nz ; log is full jr LogAddMsg.onlySetMsg ; adds new log item with one 16b value in DE and msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg1W: call LogAdd1W ; IY = new log item address, A = log index ret nz ; log is full jr LogAddMsg.onlySetMsg ; adds new log item with two 16b values, first in DE, second in HL and msg in IX ; ZF=1: returns in A the index of new log item (and IY = address of item) ; ZF=0 => log is full (no item added) LogAddMsg2W: call LogAdd2W ; IY = new log item address, A = log index ret nz ; log is full jr LogAddMsg.onlySetMsg ; display log (HL: test address, DE = index*2, IX = test details data) DisplayLogForOneTest: ; clear the log area ld bc,$17 + ((31-CHARPOS_ENCODING)<<8) ld d,0 ld hl,MEM_ZX_SCREEN_4000+1*32+CHARPOS_ENCODING call .DoAllEightPixelLinesUlaFill ld bc,$0117 ld d,$80 ld hl,MEM_ZX_SCREEN_4000+1*32+CHARPOS_ENCODING-1 call .DoAllEightPixelLinesUlaFill ld bc,$0117 ld d,$01 ld hl,MEM_ZX_SCREEN_4000+1*32+31 call .DoAllEightPixelLinesUlaFill ld bc,$7 + ((33-CHARPOS_ENCODING)<<8) ld d,A_BRIGHT|P_YELLOW|BLACK ld hl,MEM_ZX_ATTRIB_5800+1*32+CHARPOS_ENCODING-1 call FillSomeUlaLines ld c,8 ld hl,MEM_ZX_ATTRIB_5800+8*32+CHARPOS_ENCODING-1 call FillSomeUlaLines ld c,8 ld hl,MEM_ZX_ATTRIB_5800+16*32+CHARPOS_ENCODING-1 call FillSomeUlaLines ld d,$FF ld c,1 ld hl,MEM_ZX_SCREEN_4000+1*32+CHARPOS_ENCODING-1 call FillSomeUlaLines ld c,1 ld hl,MEM_ZX_SCREEN_4000+192*32-1*32+CHARPOS_ENCODING-1 call FillSomeUlaLines ; show log item content, DE = VRAM position of new line ld de,MEM_ZX_SCREEN_4000+2*32+CHARPOS_ENCODING ld a,(ix+2) .ShowAllLogItems: push af call LogGetItemAddress ; IY = first log item ; get amount of bytes and word and see if message was added to the item ld a,(iy+LOG_ITEM_TYPE) cp LOG_TYPE_EMPTY ; verify it is not the special "empty" type jp z,.SkipItem and (LOG_TYPE_B_CNT_MASK|LOG_TYPE_W_CNT_MASK) ld c,a .(LOG_TYPE_W_SHIFT) srl c ; c = words count (3x srl) and LOG_TYPE_B_CNT_MASK ld b,a ; b = bytes count ; check if the item contains also text message rra ; CF was 0 from AND add a,c ; amount of total words occupied cp 3 jr nc,.NoMessage ; 3+ words occupied makes message impossible ld l,(iy+LOG_ITEM_W2) ; hl = w2 ld h,(iy+LOG_ITEM_W2+1) ld a,l or h jr z,.NoMessage ; w2 != nullptr if message is added ; display message - wrap it first push ix push de push bc ld de,MEM_LOG_TXT_BUFFER jr .WrapNewLineContinue .WrapNewLine: ; insert end of substring xor a ld (de),a inc de .WrapNewLineContinue: ; skip spaces starting new line dec hl ld a,' ' .SkipStartingSpace: inc hl cp (hl) jr z,.SkipStartingSpace ; copy N character into new substring ld bc,(31-CHARPOS_ENCODING)<<8 ; C = 0 (chars since last good spot to wrap) .BuildSubstringLoop: ld a,(hl) ld (de),a or a ; check for end of the string jr z,.WholeStringWrapped ; see if there's good spot to wrap at this char inc c ; update wrap counter (chars added to substring) cp '@' jr nc,.DoNotWrapHere cp ':' jr nc,.DoWrapHere cp '0' jr nc,.DoNotWrapHere cp ')' jr nc,.DoWrapHere cp '"' jr nc,.DoNotWrapHere .DoWrapHere: ld c,0 ; this is good spot to wrap, remember it .DoNotWrapHere: inc hl inc de djnz .BuildSubstringLoop ; run out of space on current line, see if also end of string was reached xor a cp (hl) jr z,.WholeStringWrapped ; check if the old line did end well wrapped cp c jr z,.WrapNewLine ; there's more of the string to print, wrap it reasonably ld a,31-CHARPOS_ENCODING cp c ; CF=0 jr z,.WrapNewLine ; there was no good spot to wrap, just keep it as is ; return C chars back and start again on new line ex de,hl sbc hl,bc ; revert DE (CF=0 from `cp c`), B=0 from DJNZ, CF=0 again ex de,hl sbc hl,bc ; revert HL jr .WrapNewLine .WholeStringWrapped: inc de ld (de),a ; add empty string at the very end pop bc pop de pop ix ; display all sub-messages produced by wrapping ld hl,MEM_LOG_TXT_BUFFER .PrintAllSubstrings: call OutStringAtDe ex de,hl call AdvanceVramHlToNextLine ex de,hl ld a,(hl) or a jr nz,.PrintAllSubstrings .NoMessage: ; display bytes ld (OutCurrentAdr),de ; set VRAM position for Out... push iy pop hl inc hl ; HL=iy+LOG_ITEM_B0 xor a cp b jr z,.NoBytesToDisplay .DisplayBytes: ld a,(hl) inc hl call OutHexaValue ld a,' ' call OutChar djnz .DisplayBytes ex de,hl call AdvanceVramHlToNextLine ex de,hl .NoBytesToDisplay: ; display words on new line ld b,c ld (OutCurrentAdr),de ; set VRAM position for Out... xor a cp b jr z,.SkipItem ; no words to display ; align HL so it points to the next word element bit 0,l jr z,.DisplayWords ; HL is already aligned inc hl .DisplayWords: ld c,(hl) inc hl ld a,(hl) inc hl call OutHexaValue ld a,c call OutHexaValue ld a,' ' call OutChar djnz .DisplayWords ex de,hl call AdvanceVramHlToNextLine ex de,hl ; next log item .SkipItem: pop af inc a ; index of next log item ; check if the shown item was last in chain, and loop if not bit LOG_TYPE_LAST_BIT,(iy+LOG_ITEM_TYPE) jp z,.ShowAllLogItems ; display "press any key" at bottom of log window ld de,MEM_ZX_SCREEN_4000+(128+6)*32+CHARPOS_ENCODING+1 ld hl,.PressAnyKeyTxt call OutStringAtDe ret .DoAllEightPixelLinesUlaFill: push hl push bc call FillSomeUlaLines pop bc pop hl inc h ld a,h and 7 jr nz,.DoAllEightPixelLinesUlaFill ret .PressAnyKeyTxt: db 'Press any key.',0
PUBLIC AsmEnableVmxOperation PUBLIC AsmVmxVmcall PUBLIC AsmHypervVmcall .code _text ;------------------------------------------------------------------------ AsmEnableVmxOperation PROC PUBLIC push rax ; Save the state xor rax,rax ; Clear the RAX mov rax,cr4 or rax,02000h ; Set the 14th bit mov cr4,rax pop rax ; Restore the state ret AsmEnableVmxOperation ENDP ;------------------------------------------------------------------------ AsmVmxVmcall PROC ; We change r10 to HVFS Hex ASCII and r11 to VMCALL Hex ASCII and r12 to NOHYPERV Hex ASCII so we can make sure that the calling Vmcall comes ; from our hypervisor and we're resposible for managing it, otherwise it has to be managed by Hyper-V pushfq push r10 push r11 push r12 mov r10, 48564653H ; [HVFS] mov r11, 564d43414c4cH ; [VMCALL] mov r12, 4e4f485950455256H ; [NOHYPERV] vmcall ; VmxVmcallHandler(UINT64 VmcallNumber, UINT64 OptionalParam1, UINT64 OptionalParam2, UINT64 OptionalParam3) pop r12 pop r11 pop r10 popfq ret ; Return type is NTSTATUS and it's on RAX from the previous function, no need to change anything AsmVmxVmcall ENDP ;------------------------------------------------------------------------ AsmHypervVmcall PROC vmcall ; __fastcall Vmcall(rcx = HypercallInputValue, rdx = InputParamGPA, r8 = OutputParamGPA) ret AsmHypervVmcall ENDP ;------------------------------------------------------------------------ END
section .data SYS_WRITE equ 1 STDOUT_FILENO equ 1 SYS_EXIT equ 60 EXIT_CODE equ 0 NEW_LINE db 0xa ERR_MSG db "MUST be two command line argument", 0xa ; message byte array, byte section .text global _start _start: pop rcx ; rsp == rbp - rcx*8 - 8; && rsp + 8 ; now rsp points program name cmp rcx, 3 jne argcError add rsp, 8 ; progname to first param. pop rsi ; pop first arg and rsp+8 call str_to_int ; numeric string mov r10, rax ; str_to_int set rax ; r10 = first arg function call pop rsi ; last arg call str_to_int ; numeric string ; rax changed mov r11, rax ; r11 = last arg function call add r10, r11 ; two numeric string changed as int. adds and save to r10 mov rax, r10 ; summation move to rax xor r12, r12 ; set zero jmp int_to_str argcError: mov rax, SYS_WRITE mov rdi, STDOUT_FILENO mov rsi, ERR_MSG mov rdx, 34 ; len of ERR_MSG 33 + 1(0xa) = 34 syscall jmp exit strlen: xor rcx rcx loop: cmp [rsi + rcx], byte 0 je found inc rcx jmp loop str_to_int: xor rax, rax ; set rax to 0 mov rcx, 10 ; set rcx to 10 cmp [rsi], byte 0 ; content of source string index; first byte of rsi je return_str ; end of string in c(null terminate) next: mov bl, [rsi] ; rsi content to bl(1byte) ascii char less than 255 sub bl, 48 ; ascii key to integer add rax, rbx ; myadd1 inc rsi ; next index of source cmp [rsi], byte 0 ; content of source string index; first byte of rsi je return_str ; end of string in c(null terminate) mul rcx jmp next ; loop int_to_str: ; str_to_int will set string to number in rax with loop. mov rdx, 0 add rdx, 0xa push rdx inc r12 loop_its: mov rdx, 0 mov rbx, 10 ; arbitary variable set div rbx ; rdx = rax % rbx(10); rax = rax//10 add rdx, 48 ; rdx is data register which helps rax operation push rdx inc r12 ; before this function call, r12 is 0 cmp rax, 0x0 ; rax emptyfor dividing 10? jne loop_its jmp print print: mov rax, 1 mul r12 ; rax *= r12 mov r12, 8 ; size of symbol mul r12 mov rdx, rax mov rax, SYS_WRITE mov rdi, STDOUT_FILENO mov rsi, rsp syscall jmp exit return_str: ret exit: mov rax, SYS_EXIT mov rdi, EXIT_CODE syscall
;-- level strings are stored in the following format: ;-- "rrrrrrrrrruuuuuuuuulllluuuuuurrrrrrrrrr$" ;-- (r = right, u = up, l = left, d = down, $ or any other char = end) ;-- however, to save some space, they have been compressed like this: ;-- !byte 10, 'r', 9, 'u', 4, 'l', 6, 'u', 10, 'r', $FF ;-- the game unpacks the strings again and then draws the level ;-- according to that unpacked string (as this was the format during ;-- development) ;-- a small python script to pack the strings can be found in etc/ LEVEL1 !byte 20 ;-- y of left platform !byte 5 ;-- y of right platform !byte 12, 19 ;-- start x/y of path ;-- !text "rrrrrrrrrruuuuuuuuulllluuuuuurrrrrrrrrr$" !byte 10, 'r', 9, 'u', 4, 'l', 6, 'u', 10, 'r', $FF LEVEL2 !byte 5 ;-- y of left platform !byte 20 ;-- y of right platform !byte 12, 4 ;-- start x/y of path ;-- !text "rrrrrrrrrrdddddlllldddrrrrrrrruuuuurrrrdddddddddd$" !byte 10, 'r', 5, 'd', 4, 'l', 3, 'd', 8, 'r', 5, 'u', 4, 'r', 10, 'd', $FF LEVEL3 !byte 20 ;-- y of left platform !byte 5 ;-- y of right platform !byte 9, 16 ;-- start x/y of path ;-- !text "uuuuuuurrrrrrrrrrruuulllldddddddrrrrrrruuuuuuuuurrrrr$" !byte 7, 'u', 11, 'r', 3, 'u', 4, 'l', 7, 'd', 7, 'r', 9, 'u', 5, 'r', $FF LEVEL4 !byte 5 ;-- y of left platform !byte 20 ;-- y of right platform !byte 12, 4 ;-- start x/y of path ;-- !text "rrrrrdddddddddddddddddddllluuuuurrrrrrrrruuuuuuuullluuuurrrrrrrrrrrrrddddddlllddddd$" !byte 5, 'r', 19, 'd', 3, 'l', 5, 'u', 9, 'r', 8, 'u', 3, 'l', 4, 'u', 13, 'r', 6, 'd', 3, 'l', 5, 'd', $FF LEVEL5 !byte 20 ;-- y of left platform !byte 15 ;-- y of right platform !byte 9, 16 ;-- start x/y of path ;-- !text "uuuuuuuurrrrrrrruuulllddddddrrrrrrrrdddddrrruuuuuuuuuuuuuullldddddrrrrrrrrddddd$" !byte 8, 'u', 8, 'r', 3, 'u', 3, 'l', 6, 'd', 8, 'r', 5, 'd', 3, 'r', 14, 'u', 3, 'l', 5, 'd', 8, 'r', 5, 'd', $FF LEVEL6 !byte 15 ;-- y of left platform !byte 6 ;-- y of right platform !byte 9, 11 ;-- start x/y of path ;-- !text "uuuurrrrrrrrrrrrrdddlllluuuuuulllllllddddddddrrrrrrrrrrrrrrruuuuuuuuuuurrrrdd$" !byte 4, 'u', 13, 'r', 3, 'd', 4, 'l', 6, 'u', 7, 'l', 8, 'd', 15, 'r', 11, 'u', 4, 'r', 2, 'd', $FF LEVEL7 !byte 6 ;-- y of left platform !byte 20 ;-- y of right platform !byte 12, 5 ;-- start x/y of path ;-- !text "rrrrrddddddddddddddddddllluuurrrrrrrrrruuuuuuuuuullldddrrrrrrruuuuulllllllllllllldddddddrrrrrrrrrrrrrrrrdd$" !byte 5, 'r', 18, 'd', 3, 'l', 3, 'u', 10, 'r', 10, 'u', 3, 'l', 3, 'd', 7, 'r', 5, 'u', 14, 'l', 7, 'd', 16, 'r', 2, 'd', $FF LEVEL8 !byte 20 ;-- y of left platform !byte 5 ;-- y of right platform !byte 9, 16 ;-- start x/y of path ;-- !text "uuuurrrrrruuuuuuuuullldddddrrrrrrdddddddddddddddlllluuurrrrrrrrruuuuurrrrrrrrrdddllllluuuuuuuu" ;-- !text "llllllllllllllllllllluuuurrrrrrrrrrrrrruurrrrrrrr$" !byte 4, 'u', 6, 'r', 9, 'u', 3, 'l', 5, 'd', 6, 'r', 15, 'd', 4, 'l', 3, 'u', 9, 'r', 5, 'u', 9, 'r', 3, 'd', 5, 'l', 8, 'u' !byte 21, 'l', 4, 'u', 14, 'r', 2, 'u', 8, 'r', $FF NUM_LEVELS = 8 T_LEVELS !word LEVEL1 !word LEVEL2 !word LEVEL3 !word LEVEL4 !word LEVEL5 !word LEVEL6 !word LEVEL7 !word LEVEL8 UNPACKED_PATH = $8000
; A013969: a(n) = sigma_21(n), the sum of the 21st powers of the divisors of n. ; 1,2097153,10460353204,4398048608257,476837158203126,21936961102828212,558545864083284008,9223376434903384065,109418989141972712413,1000000476837160300278,7400249944258160101212,46005141850728850805428,247064529073450392704414,1171356134499851307229224,4987885095596323936915704,19342822337210501698682881,69091933913008732880827218,229468361336055499755060189,714209495693373205673756420,2097153000000481235206811382,5842587018944528395924761632,15519456371350833230737049436,39471584120695485887249589624,96479775242539710934765294260,227373675443232536315917968751,518132118339973711411239933342,1144561273540256484027922408840,2456511860179190714522464854056,5132842708382182842735812571630,10460358191885117533274579390712,20825506393391550743120420649632,40564838550125678058396201254913,77409228214821666417857908483248,144896356481468003187225442710354,266335422555582608869350411409008,481230032912740882411465958194141,855531895666462872887391390111638,1497806586521844698398335297472260,2584382238288217966660675209842456,4398048608257009223853272061587190,7386879101213258109624223688656842,12252798894540574559098801630833696,20083415214428110320965436874242044,32546658968098542861450922858907484,52175039835916968289018591435603038,82777951053468900314903138628740472,130033429462229783044185156533092848,202332753609442639866264916848300724,311973482284542371859876185905260057,476837385576801443232536315920065903,722726032277497156269941139976706472 add $0,1 mov $2,$0 lpb $0 mov $3,$2 mov $4,$0 cmp $4,0 add $0,$4 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 pow $3,21 add $1,$3 lpe add $1,1 mov $0,$1
; void dzx7_mega(void *src, void *dst) SECTION code_clib SECTION code_compress_zx7 PUBLIC _dzx7_mega EXTERN asm_dzx7_mega _dzx7_mega: pop af pop hl pop de push de push hl push af jp asm_dzx7_mega
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0xedc9, %rsi lea addresses_normal_ht+0x174b9, %rdi clflush (%rsi) nop nop nop nop sub %r10, %r10 mov $78, %rcx rep movsb nop nop add $42965, %r13 lea addresses_A_ht+0xebd0, %rsi lea addresses_D_ht+0xb6b9, %rdi clflush (%rsi) nop nop nop sub %r14, %r14 mov $12, %rcx rep movsq nop nop cmp $38450, %r14 lea addresses_normal_ht+0x1cf21, %rsi nop nop cmp %rdx, %rdx and $0xffffffffffffffc0, %rsi vmovaps (%rsi), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %r14 nop nop and $44407, %r14 lea addresses_WC_ht+0x962b, %r13 nop and $54768, %rcx mov (%r13), %rdx inc %r14 lea addresses_normal_ht+0x1b785, %r10 add $24374, %rcx movups (%r10), %xmm3 vpextrq $0, %xmm3, %rdi nop nop nop nop nop sub $29217, %rcx lea addresses_D_ht+0x1ee29, %r10 nop nop nop nop xor $36825, %rdx movups (%r10), %xmm5 vpextrq $0, %xmm5, %r13 nop nop nop dec %r13 lea addresses_A_ht+0xd7b9, %rsi lea addresses_UC_ht+0xc179, %rdi nop nop nop nop nop xor %rbx, %rbx mov $22, %rcx rep movsl nop nop xor %rbx, %rbx lea addresses_A_ht+0x130b9, %rsi lea addresses_UC_ht+0x1e6d9, %rdi nop nop xor $38786, %rdx mov $27, %rcx rep movsb nop and $57989, %rdi lea addresses_UC_ht+0x1acd, %rsi lea addresses_A_ht+0x5ab9, %rdi nop lfence mov $46, %rcx rep movsb nop sub $4321, %rdx lea addresses_UC_ht+0xd585, %rsi lea addresses_A_ht+0x4f39, %rdi cmp %r13, %r13 mov $106, %rcx rep movsq nop nop nop nop cmp $4046, %rbx lea addresses_WT_ht+0x1e261, %r13 nop dec %r10 movb (%r13), %bl nop nop nop nop nop xor $44862, %rdi lea addresses_WT_ht+0x891, %rsi lea addresses_WC_ht+0xeb89, %rdi add $54940, %r13 mov $16, %rcx rep movsl nop nop nop xor $49302, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi // Store lea addresses_PSE+0x1a6b9, %r14 nop nop nop nop inc %rbp mov $0x5152535455565758, %r15 movq %r15, %xmm7 vmovups %ymm7, (%r14) nop nop nop nop nop sub $58394, %rsi // REPMOV lea addresses_D+0x3eb9, %rsi lea addresses_A+0x1bef8, %rdi clflush (%rdi) nop nop nop nop and %r9, %r9 mov $106, %rcx rep movsw inc %rax // Faulty Load lea addresses_PSE+0x1a6b9, %rbp nop nop nop xor %r9, %r9 vmovups (%rbp), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %r15 lea oracles, %rbp and $0xff, %r15 shlq $12, %r15 mov (%rbp,%r15,1), %r15 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}} {'src': {'type': 'addresses_D', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': False}} [Faulty Load] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
%ifdef CONFIG { "RegData": { "XMM1": ["0x8000000000000000", "0x4005"], "XMM2": ["0x8000000000000000", "0x4004"], "XMM3": ["0x8000000000000000", "0x4003"], "XMM4": ["0x8000000000000000", "0x4002"], "XMM5": ["0x8000000000000000", "0x4001"], "XMM6": ["0x8000000000000000", "0x4000"] }, "Env": { "FEX_X87REDUCEDPRECISION" : "1" } } %endif ; We don't test XMM0 or the MM* registers due to precision mov rdx, 0xe0000000 mov rax, 2 mov [rdx + 2 * 1], rax mov rax, 4 mov [rdx + 2 * 2], rax mov rax, 8 mov [rdx + 2 * 3], rax mov rax, 16 mov [rdx + 2 * 4], rax mov rax, 32 mov [rdx + 2 * 5], rax mov rax, 64 mov [rdx + 2 * 6], rax fldz fild word [rdx + 2 * 1] fild word [rdx + 2 * 2] fild word [rdx + 2 * 3] fild word [rdx + 2 * 4] fild word [rdx + 2 * 5] fild word [rdx + 2 * 6] fldpi o16 fnsave [rdx] fldpi fldpi fldpi fldpi fldpi fldpi fldpi fldpi o16 frstor [rdx] movups xmm0, [rdx + (0xE + 10 * 0)] movups xmm1, [rdx + (0xE + 10 * 1)] movups xmm2, [rdx + (0xE + 10 * 2)] movups xmm3, [rdx + (0xE + 10 * 3)] movups xmm4, [rdx + (0xE + 10 * 4)] movups xmm5, [rdx + (0xE + 10 * 5)] movups xmm6, [rdx + (0xE + 10 * 6)] movups xmm7, [rdx + (0xE + 10 * 7)] pslldq xmm0, 6 psrldq xmm0, 6 pslldq xmm1, 6 psrldq xmm1, 6 pslldq xmm2, 6 psrldq xmm2, 6 pslldq xmm3, 6 psrldq xmm3, 6 pslldq xmm4, 6 psrldq xmm4, 6 pslldq xmm5, 6 psrldq xmm5, 6 pslldq xmm6, 6 psrldq xmm6, 6 pslldq xmm7, 6 psrldq xmm7, 6 hlt
; =============================================================== ; Dec 2013 ; =============================================================== ; ; int strcoll(const char *s1, const char *s2) ; ; Compare string s1 to string s2. Return when the first ; differing char is found with *s1 - *s2. Char comparison ; is done using currently defined locale. ; ; =============================================================== SECTION code_string PUBLIC asm_strcoll EXTERN __lc_char_cmp_bc asm_strcoll: ; enter : hl = char *s2 ; de = char *s1 ; ; exit : a = h = *s1-*s2 of first differing char ; de = ptr in s1 to first differing char or NUL if equal ; ; if s1==s2 : hl=0, nc+z flags set ; if s1<<s2 : hl<0, c+nz flags set ; if s1>>s2 : hl>0, nc+nz flag set ; ; uses : af, bc, de, hl loop: push de push hl ld a,(de) ld b,a ld c,(hl) call __lc_char_cmp_bc ; a = *s1 - *s2 pop hl pop de jr nz, different ld a,(de) inc de inc hl or a jr nz, loop ; end of string? equal: ; both strings ended same time dec de ld l,a ld h,a ret different: ld h,a ret
#include "card.h" namespace nGame{ Card::Card(Suit suit, Rank rank, glm::vec3 position, glm::vec3 scale){ this->suit = suit; this->rank = rank; this->isFlipped = false; this->isMatched = false; this->position = position; this->scale = scale; } Card::Card(){ this->suit = SUIT_NONE; this->rank = RANK_NONE; this->isFlipped = false; this->isMatched = false; this->position = glm::vec3(0.0f); this->scale = glm::vec3(1.0f); } void ClickCard(Card * card){ Anim::ActivateRotateAnimation(&card->rotateAnimation); card->isFlipped = !card->isFlipped; } bool CardWasClicked(Card * card, OpenglCoords coords){ float leftX = card->position.x - card->scale.x; float leftY = card->position.y - card->scale.y; float rightX = card->position.x + card->scale.x; float rightY = card->position.y + card->scale.y; return RectangleWasClicked(leftX, leftY, rightX, rightY, coords); } };
#include <cmath> #include <iostream> #include <set> #include <vector> using std::set; using std::vector; static set<long long> gen_hammings(long long upper_limit, int hamming_type); static set<long long> gen_primes(long long n); int main() { const long long upper_limit = 1000000000LL; set<long long> hammings = gen_hammings(upper_limit, 100); std::cout << hammings.size() << std::endl; return 0; } static set<long long> gen_hammings(long long upper_limit, int hamming_type) { set<long long> primes = gen_primes(hamming_type); set<long long> hammings{1}; for (auto p : primes) { set<long long> temp(hammings); for (auto h : hammings) { while (h * p <= upper_limit) { temp.insert(h * p); h *= p; } } hammings = temp; } return hammings; } static set<long long> gen_primes(long long n) { // Sieve of Eratosthenes vector<bool> sieve(n + 1); sieve[0] = false; // so that the index starts from 1 for (long long i = 1; i <= n; ++i) { if (i % 2 == 0) { sieve[i] = false; } else { sieve[i] = true; } } sieve[1] = false; // 1 is not prime sieve[2] = true; // 2 is the only even prime long long factor = 3; while (factor <= int(std::sqrt(n))) { for (long long i = factor * factor; i < n; i += factor) { sieve[i] = false; } do { factor += 2; } while (sieve[factor] == false); } set<long long> primes; for (long long i = 0; i < sieve.size(); ++i) { if (sieve[i]) { primes.insert(i); } } return primes; }
; Licensed to the .NET Foundation under one or more agreements. ; The .NET Foundation licenses this file to you under the MIT license. ; See the LICENSE file in the project root for more information. #include "ksarm.h" #include "asmconstants.h" IMPORT FuncEvalHijackWorker IMPORT FuncEvalHijackPersonalityRoutine IMPORT ExceptionHijackWorker IMPORT ExceptionHijackPersonalityRoutine EXPORT ExceptionHijackEnd MACRO CHECK_STACK_ALIGNMENT #ifdef _DEBUG push {r0} add r0, sp, #4 tst r0, #7 pop {r0} beq %0 EMIT_BREAKPOINT 0 #endif MEND TEXTAREA ; ; hijacking stub used to perform a func-eval, see Debugger::FuncEvalSetup() for use. ; ; on entry: ; r0 : pointer to DebuggerEval object ; NESTED_ENTRY FuncEvalHijack,,FuncEvalHijackPersonalityRoutine ; NOTE: FuncEvalHijackPersonalityRoutine is dependent on the stack layout so if ; you change the prolog you will also need to update the personality routine. ; push arg to the stack so our personality routine can find it ; push lr to get good stacktrace in debugger PROLOG_PUSH {r0,lr} CHECK_STACK_ALIGNMENT ; FuncEvalHijackWorker returns the address we should jump to. bl FuncEvalHijackWorker ; effective NOP to terminate unwind mov r2, r2 EPILOG_STACK_FREE 8 EPILOG_BRANCH_REG r0 NESTED_END FuncEvalHijack ; ; This is the general purpose hijacking stub. DacDbiInterfaceImpl::Hijack() will ; set the registers with the appropriate parameters from out-of-process. ; ; on entry: ; r0 : pointer to CONTEXT ; r1 : pointer to EXCEPTION_RECORD ; r2 : EHijackReason ; r3 : void* pdata ; NESTED_ENTRY ExceptionHijack,,ExceptionHijackPersonalityRoutine CHECK_STACK_ALIGNMENT ; make the call bl ExceptionHijackWorker ; effective NOP to terminate unwind mov r3, r3 ; *** should never get here *** EMIT_BREAKPOINT ; exported label so the debugger knows where the end of this function is ExceptionHijackEnd NESTED_END ; must be at end of file END
; Original address was $AC98 ; World 6 second fortress boss room .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_02 | LEVEL1_YSTART_170 .byte LEVEL2_BGPAL_01 | LEVEL2_OBJPAL_10 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_00 | LEVEL3_VSCROLL_LOCKED .byte LEVEL4_BGBANK_INDEX(12) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_FORTRESS | LEVEL5_TIME_300 .byte $6F, $00, $82, $71, $00, $82, $73, $00, $82, $75, $00, $82, $77, $00, $82, $79 .byte $00, $8F, $6F, $06, $1F, $6F, $16, $19, $70, $06, $84, $72, $06, $84, $74, $06 .byte $84, $6F, $1F, $10, $70, $1F, $10, $71, $1F, $10, $72, $1F, $10, $73, $1F, $10 .byte $74, $1F, $10, $75, $1F, $10, $76, $1F, $10, $77, $1F, $10, $78, $1F, $10, $75 .byte $14, $10, $73, $18, $10, $76, $1B, $13, $FF
%include "asm_io.inc" segment .text global asm_main asm_main: enter 0,0 pusha mov eax, 3 push eax call calc add esp, 4 ; Geben Sie den Stack direkt vor dem popa Befehl an. popa mov eax, 0 leave ret calc: enter 4,0 ; lokale Variable fuer Ergebnissicherung ; Geben Sie den Stack immer direkt vor dem mov Befehl an. ; Korrigieren Sie aber zuerst den Fehler. mov ebx, [ebp+8] ; Parameter in ebx ;Basecase mov eax, 1 cmp eax, ebx je end_calc ; Rekursionsvorschrift mov eax, ebx sub eax, 1 push eax call calc add esp, 4 ; Geben Sie den Stack an dieser Stelle einmalig bei der Rückkehr aus calc(1) an. shr ebx, 1 add eax, ebx ;Berechnung beendet end_calc: mov [ebp-4], eax mov eax, [ebp-4] leave ret
\ ****************************************************************************** \ \ ELITE-A MISSILE SHIP BLUEPRINT FILE \ \ Elite-A is an extended version of BBC Micro Elite by Angus Duggan \ \ The original Elite was written by Ian Bell and David Braben and is copyright \ Acornsoft 1984, and the extra code in Elite-A is copyright Angus Duggan \ \ The code on this site is identical to Angus Duggan's source discs (it's just \ been reformatted, and the label names have been changed to be consistent with \ the sources for the original BBC Micro disc version on which it is based) \ \ The commentary is copyright Mark Moxon, and any misunderstandings or mistakes \ in the documentation are entirely my fault \ \ The terminology and notations used in this commentary are explained at \ https://www.bbcelite.com/about_site/terminology_used_in_this_commentary.html \ \ The deep dive articles referred to in this commentary can be found at \ https://www.bbcelite.com/deep_dives \ \ ------------------------------------------------------------------------------ \ \ This source file produces the following binary file: \ \ * MISSILE.bin \ \ This gets loaded as part of elite-loader.asm and gets moved to &7F00 during \ the loading process. \ \ ****************************************************************************** INCLUDE "1-source-files/main-sources/elite-header.h.asm" _RELEASED = (_RELEASE = 1) _SOURCE_DISC = (_RELEASE = 2) _BUG_FIX = (_RELEASE = 3) GUARD &6000 \ Guard against assembling over screen memory \ ****************************************************************************** \ \ Configuration variables \ \ ****************************************************************************** CODE% = &7F00 LOAD% = &2468 ORG CODE% \ ****************************************************************************** \ \ Name: VERTEX \ Type: Macro \ Category: Drawing ships \ Summary: Macro definition for adding vertices to ship blueprints \ Deep dive: Ship blueprints \ \ ------------------------------------------------------------------------------ \ \ The following macro is used to build the ship blueprints: \ \ VERTEX x, y, z, face1, face2, face3, face4, visibility \ \ See the deep dive on "Ship blueprints" for details of how vertices are stored \ in the ship blueprints, and the deep dive on "Drawing ships" for information \ on how vertices are used to draw 3D wiremesh ships. \ \ Arguments: \ \ x The vertex's x-coordinate \ \ y The vertex's y-coordinate \ \ z The vertex's z-coordinate \ \ face1 The number of face 1 associated with this vertex \ \ face2 The number of face 2 associated with this vertex \ \ face3 The number of face 3 associated with this vertex \ \ face4 The number of face 4 associated with this vertex \ \ visibility The visibility distance, beyond which the vertex is not \ shown \ \ ****************************************************************************** MACRO VERTEX x, y, z, face1, face2, face3, face4, visibility IF x < 0 s_x = 1 << 7 ELSE s_x = 0 ENDIF IF y < 0 s_y = 1 << 6 ELSE s_y = 0 ENDIF IF z < 0 s_z = 1 << 5 ELSE s_z = 0 ENDIF s = s_x + s_y + s_z + visibility f1 = face1 + (face2 << 4) f2 = face3 + (face4 << 4) ax = ABS(x) ay = ABS(y) az = ABS(z) EQUB ax, ay, az, s, f1, f2 ENDMACRO \ ****************************************************************************** \ \ Name: EDGE \ Type: Macro \ Category: Drawing ships \ Summary: Macro definition for adding edges to ship blueprints \ Deep dive: Ship blueprints \ \ ------------------------------------------------------------------------------ \ \ The following macro is used to build the ship blueprints: \ \ EDGE vertex1, vertex2, face1, face2, visibility \ \ See the deep dive on "Ship blueprints" for details of how edges are stored \ in the ship blueprints, and the deep dive on "Drawing ships" for information \ on how edges are used to draw 3D wiremesh ships. \ \ Arguments: \ \ vertex1 The number of the vertex at the start of the edge \ \ vertex1 The number of the vertex at the end of the edge \ \ face1 The number of face 1 associated with this edge \ \ face2 The number of face 2 associated with this edge \ \ visibility The visibility distance, beyond which the edge is not \ shown \ \ ****************************************************************************** MACRO EDGE vertex1, vertex2, face1, face2, visibility f = face1 + (face2 << 4) EQUB visibility, f, vertex1 << 2, vertex2 << 2 ENDMACRO \ ****************************************************************************** \ \ Name: FACE \ Type: Macro \ Category: Drawing ships \ Summary: Macro definition for adding faces to ship blueprints \ Deep dive: Ship blueprints \ \ ------------------------------------------------------------------------------ \ \ The following macro is used to build the ship blueprints: \ \ FACE normal_x, normal_y, normal_z, visibility \ \ See the deep dive on "Ship blueprints" for details of how faces are stored \ in the ship blueprints, and the deep dive on "Drawing ships" for information \ on how faces are used to draw 3D wiremesh ships. \ \ Arguments: \ \ normal_x The face normal's x-coordinate \ \ normal_y The face normal's y-coordinate \ \ normal_z The face normal's z-coordinate \ \ visibility The visibility distance, beyond which the edge is always \ shown \ \ ****************************************************************************** MACRO FACE normal_x, normal_y, normal_z, visibility IF normal_x < 0 s_x = 1 << 7 ELSE s_x = 0 ENDIF IF normal_y < 0 s_y = 1 << 6 ELSE s_y = 0 ENDIF IF normal_z < 0 s_z = 1 << 5 ELSE s_z = 0 ENDIF s = s_x + s_y + s_z + visibility ax = ABS(normal_x) ay = ABS(normal_y) az = ABS(normal_z) EQUB s, ax, ay, az ENDMACRO \ ****************************************************************************** \ \ Name: SHIP_MISSILE \ Type: Variable \ Category: Drawing ships \ Summary: Ship blueprint for a missile \ Deep dive: Ship blueprints \ \ ****************************************************************************** .SHIP_MISSILE EQUB 0 \ Max. canisters on demise = 0 EQUW 40 * 40 \ Targetable area = 40 * 40 EQUB LO(SHIP_MISSILE_EDGES - SHIP_MISSILE) \ Edges data offset (low) EQUB LO(SHIP_MISSILE_FACES - SHIP_MISSILE) \ Faces data offset (low) EQUB 81 \ Max. edge count = (81 - 1) / 4 = 20 EQUB 0 \ Gun vertex = 0 EQUB 10 \ Explosion count = 1, as (4 * n) + 6 = 10 EQUB 102 \ Number of vertices = 102 / 6 = 17 EQUB 24 \ Number of edges = 24 EQUW 0 \ Bounty = 0 EQUB 36 \ Number of faces = 36 / 4 = 9 EQUB 14 \ Visibility distance = 14 EQUB 2 \ Max. energy = 2 EQUB 44 \ Max. speed = 44 EQUB HI(SHIP_MISSILE_EDGES - SHIP_MISSILE) \ Edges data offset (high) EQUB HI(SHIP_MISSILE_FACES - SHIP_MISSILE) \ Faces data offset (high) EQUB 2 \ Normals are scaled by = 2^2 = 4 EQUB %00000000 \ Laser power = 0 \ Missiles = 0 \VERTEX x, y, z, face1, face2, face3, face4, visibility VERTEX 0, 0, 68, 0, 1, 2, 3, 31 \ Vertex 0 VERTEX 8, -8, 36, 1, 2, 4, 5, 31 \ Vertex 1 VERTEX 8, 8, 36, 2, 3, 4, 7, 31 \ Vertex 2 VERTEX -8, 8, 36, 0, 3, 6, 7, 31 \ Vertex 3 VERTEX -8, -8, 36, 0, 1, 5, 6, 31 \ Vertex 4 VERTEX 8, 8, -44, 4, 7, 8, 8, 31 \ Vertex 5 VERTEX 8, -8, -44, 4, 5, 8, 8, 31 \ Vertex 6 VERTEX -8, -8, -44, 5, 6, 8, 8, 31 \ Vertex 7 VERTEX -8, 8, -44, 6, 7, 8, 8, 31 \ Vertex 8 VERTEX 12, 12, -44, 4, 7, 8, 8, 8 \ Vertex 9 VERTEX 12, -12, -44, 4, 5, 8, 8, 8 \ Vertex 10 VERTEX -12, -12, -44, 5, 6, 8, 8, 8 \ Vertex 11 VERTEX -12, 12, -44, 6, 7, 8, 8, 8 \ Vertex 12 VERTEX -8, 8, -12, 6, 7, 7, 7, 8 \ Vertex 13 VERTEX -8, -8, -12, 5, 6, 6, 6, 8 \ Vertex 14 VERTEX 8, 8, -12, 4, 7, 7, 7, 8 \ Vertex 15 VERTEX 8, -8, -12, 4, 5, 5, 5, 8 \ Vertex 16 .SHIP_MISSILE_EDGES \EDGE vertex1, vertex2, face1, face2, visibility EDGE 0, 1, 1, 2, 31 \ Edge 0 EDGE 0, 2, 2, 3, 31 \ Edge 1 EDGE 0, 3, 0, 3, 31 \ Edge 2 EDGE 0, 4, 0, 1, 31 \ Edge 3 EDGE 1, 2, 4, 2, 31 \ Edge 4 EDGE 1, 4, 1, 5, 31 \ Edge 5 EDGE 3, 4, 0, 6, 31 \ Edge 6 EDGE 2, 3, 3, 7, 31 \ Edge 7 EDGE 2, 5, 4, 7, 31 \ Edge 8 EDGE 1, 6, 4, 5, 31 \ Edge 9 EDGE 4, 7, 5, 6, 31 \ Edge 10 EDGE 3, 8, 6, 7, 31 \ Edge 11 EDGE 7, 8, 6, 8, 31 \ Edge 12 EDGE 5, 8, 7, 8, 31 \ Edge 13 EDGE 5, 6, 4, 8, 31 \ Edge 14 EDGE 6, 7, 5, 8, 31 \ Edge 15 EDGE 6, 10, 5, 8, 8 \ Edge 16 EDGE 5, 9, 7, 8, 8 \ Edge 17 EDGE 8, 12, 7, 8, 8 \ Edge 18 EDGE 7, 11, 5, 8, 8 \ Edge 19 EDGE 9, 15, 4, 7, 8 \ Edge 20 EDGE 10, 16, 4, 5, 8 \ Edge 21 EDGE 12, 13, 6, 7, 8 \ Edge 22 EDGE 11, 14, 5, 6, 8 \ Edge 23 .SHIP_MISSILE_FACES \FACE normal_x, normal_y, normal_z, visibility FACE -64, 0, 16, 31 \ Face 0 FACE 0, -64, 16, 31 \ Face 1 FACE 64, 0, 16, 31 \ Face 2 FACE 0, 64, 16, 31 \ Face 3 FACE 32, 0, 0, 31 \ Face 4 FACE 0, -32, 0, 31 \ Face 5 FACE -32, 0, 0, 31 \ Face 6 \ --- Mod: Original Acornsoft code removed: -----------> \ FACE 0, 160, 110, 31 \ Face 7 \ FACE 0, 64, 4, 0 \ Face 8 \ --- And replaced by: --------------------------------> FACE 0, 32, 0, 31 \ Face 7 FACE 0, 0, -176, 31 \ Face 8 \ --- End of replacement ------------------------------> \ ****************************************************************************** \ \ Name: VEC \ Type: Variable \ Category: Screen mode \ Summary: The original value of the IRQ1 vector \ \ ****************************************************************************** .VEC \ --- Mod: Original Acornsoft code removed: -----------> \ EQUW &0004 \ VEC = &7FFE \ \ \ \ This gets set to the value of the original IRQ1 vector \ \ by the loading process \ \ \ \ This default value is presumably noise included at the \ \ time of compilation, as it gets overwritten \ --- And replaced by: --------------------------------> SKIP 2 \ VEC = &7FFE \ \ This gets set to the value of the original IRQ1 vector \ by the loading process \ --- End of replacement ------------------------------> \ ****************************************************************************** \ \ Save MISSILE.bin \ \ ****************************************************************************** PRINT "MISSILE" PRINT "Assembled at ", ~CODE% PRINT "Ends at ", ~P% PRINT "Code size is ", ~(P% - CODE%) PRINT "Execute at ", ~LOAD% PRINT "Reload at ", ~LOAD% PRINT "S.MISSILE ",~CODE%," ",~P%," ",~LOAD%," ",~LOAD% SAVE "3-assembled-output/MISSILE.bin", CODE%, P%, LOAD%
.inesprg 1 ; 1x 16KB PRG code .ineschr 1 ; 1x 8KB CHR data .inesmap 0 ; mapper 0 = NROM, no bank swapping .inesmir 1 ; background mirroring ;;;;;;;;;;;;;;; ;; DECLARE SOME VARIABLES HERE .rsset $0000 ;;start variables at ram location 0 gamestate .rs 1 ; .rs 1 means reserve one byte of space ballx .rs 1 ; ball horizontal position bally .rs 1 ; ball vertical position ballup .rs 1 ; 1 = ball moving up balldown .rs 1 ; 1 = ball moving down ballleft .rs 1 ; 1 = ball moving left ballright .rs 1 ; 1 = ball moving right ballspeedx .rs 1 ; ball horizontal speed per frame ballspeedy .rs 1 ; ball vertical speed per frame paddle1ytop .rs 1 ; player 1 paddle top vertical position paddle2ybot .rs 1 ; player 2 paddle bottom vertical position buttons1 .rs 1 ; player 1 gamepad buttons, one bit per button buttons2 .rs 1 ; player 2 gamepad buttons, one bit per button scoreOnes .rs 1 ; byte for each digit in the decimal score scoreTens .rs 1 scoreHundreds .rs 1 ;; DECLARE SOME CONSTANTS HERE STATETITLE = $00 ; displaying title screen STATEPLAYING = $01 ; move paddles/ball, check for collisions STATEGAMEOVER = $02 ; displaying game over screen RIGHTWALL = $F4 ; when ball reaches one of these, do something TOPWALL = $20 BOTTOMWALL = $E0 LEFTWALL = $04 PADDLE1X = $08 ; horizontal position for paddles, doesnt move PADDLE2X = $F0 ;;;;;;;;;;;;;;;;;; .bank 0 .org $C000 RESET: SEI ; disable IRQs CLD ; disable decimal mode LDX #$40 STX $4017 ; disable APU frame IRQ LDX #$FF TXS ; Set up stack INX ; now X = 0 STX $2000 ; disable NMI STX $2001 ; disable rendering STX $4010 ; disable DMC IRQs vblankwait1: ; First wait for vblank to make sure PPU is ready BIT $2002 BPL vblankwait1 clrmem: LDA #$00 STA $0000, x STA $0100, x STA $0300, x STA $0400, x STA $0500, x STA $0600, x STA $0700, x LDA #$FE STA $0200, x INX BNE clrmem vblankwait2: ; Second wait for vblank, PPU is ready after this BIT $2002 BPL vblankwait2 LoadPalettes: LDA $2002 ; read PPU status to reset the high/low latch LDA #$3F STA $2006 ; write the high byte of $3F00 address LDA #$00 STA $2006 ; write the low byte of $3F00 address LDX #$00 ; start out at 0 LoadPalettesLoop: LDA palette, x ; load data from address (palette + the value in x) ; 1st time through loop it will load palette+0 ; 2nd time through loop it will load palette+1 ; 3rd time through loop it will load palette+2 ; etc STA $2007 ; write to PPU INX ; X = X + 1 CPX #$20 ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites BNE LoadPalettesLoop ; Branch to LoadPalettesLoop if compare was Not Equal to zero ; if compare was equal to 32, keep going down ;;;Set some initial ball stats LDA #$01 STA balldown STA ballright LDA #$00 STA ballup STA ballleft LDA #$50 STA bally LDA #$80 STA ballx LDA #$02 STA ballspeedx STA ballspeedy ;;;Set initial score value LDA #$00 STA scoreOnes STA scoreTens STA scoreHundreds ;;:Set starting game state LDA #STATEPLAYING STA gamestate LDA #%10010000 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1 STA $2000 LDA #%00011110 ; enable sprites, enable background, no clipping on left side STA $2001 Forever: JMP Forever ;jump back to Forever, infinite loop, waiting for NMI NMI: LDA #$00 STA $2003 ; set the low byte (00) of the RAM address LDA #$02 STA $4014 ; set the high byte (02) of the RAM address, start the transfer JSR DrawScore ;;This is the PPU clean up section, so rendering the next frame starts properly. LDA #%10010000 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1 STA $2000 LDA #%00011110 ; enable sprites, enable background, no clipping on left side STA $2001 LDA #$00 ;;tell the ppu there is no background scrolling STA $2005 STA $2005 ;;;all graphics updates done by here, run game engine JSR ReadController1 ;;get the current button data for player 1 JSR ReadController2 ;;get the current button data for player 2 GameEngine: LDA gamestate CMP #STATETITLE BEQ EngineTitle ;;game is displaying title screen LDA gamestate CMP #STATEGAMEOVER BEQ EngineGameOver ;;game is displaying ending screen LDA gamestate CMP #STATEPLAYING BEQ EnginePlaying ;;game is playing GameEngineDone: JSR UpdateSprites ;;set ball/paddle sprites from positions RTI ; return from interrupt ;;;;;;;; EngineTitle: ;;if start button pressed ;; turn screen off ;; load game screen ;; set starting paddle/ball position ;; go to Playing State ;; turn screen on JMP GameEngineDone ;;;;;;;;; EngineGameOver: ;;if start button pressed ;; turn screen off ;; load title screen ;; go to Title State ;; turn screen on JMP GameEngineDone ;;;;;;;;;;; EnginePlaying: MoveBallRight: LDA ballright BEQ MoveBallRightDone ;;if ballright=0, skip this section LDA ballx CLC ADC ballspeedx ;;ballx position = ballx + ballspeedx STA ballx LDA ballx CMP #RIGHTWALL BCC MoveBallRightDone ;;if ball x < right wall, still on screen, skip next section LDA #$00 STA ballright LDA #$01 STA ballleft ;;bounce, ball now moving left ;;in real game, give point to player 1, reset ball jsr IncrementScore MoveBallRightDone: MoveBallLeft: LDA ballleft BEQ MoveBallLeftDone ;;if ballleft=0, skip this section LDA ballx SEC SBC ballspeedx ;;ballx position = ballx - ballspeedx STA ballx LDA ballx CMP #LEFTWALL BCS MoveBallLeftDone ;;if ball x > left wall, still on screen, skip next section LDA #$01 STA ballright LDA #$00 STA ballleft ;;bounce, ball now moving right ;;in real game, give point to player 2, reset ball jsr IncrementScore MoveBallLeftDone: MoveBallUp: LDA ballup BEQ MoveBallUpDone ;;if ballup=0, skip this section LDA bally SEC SBC ballspeedy ;;bally position = bally - ballspeedy STA bally LDA bally CMP #TOPWALL BCS MoveBallUpDone ;;if ball y > top wall, still on screen, skip next section LDA #$01 STA balldown LDA #$00 STA ballup ;;bounce, ball now moving down MoveBallUpDone: MoveBallDown: LDA balldown BEQ MoveBallDownDone ;;if ballup=0, skip this section LDA bally CLC ADC ballspeedy ;;bally position = bally + ballspeedy STA bally LDA bally CMP #BOTTOMWALL BCC MoveBallDownDone ;;if ball y < bottom wall, still on screen, skip next section LDA #$00 STA balldown LDA #$01 STA ballup ;;bounce, ball now moving down MoveBallDownDone: MovePaddleUp: ;;if up button pressed ;; if paddle top > top wall ;; move paddle top and bottom up MovePaddleUpDone: MovePaddleDown: ;;if down button pressed ;; if paddle bottom < bottom wall ;; move paddle top and bottom down MovePaddleDownDone: CheckPaddleCollision: ;;if ball x < paddle1x ;; if ball y > paddle y top ;; if ball y < paddle y bottom ;; bounce, ball now moving left CheckPaddleCollisionDone: JMP GameEngineDone UpdateSprites: LDA bally ;;update all ball sprite info STA $0200 LDA #$30 STA $0201 LDA #$00 STA $0202 LDA ballx STA $0203 ;;update paddle sprites RTS DrawScore: LDA $2002 LDA #$20 STA $2006 LDA #$20 STA $2006 ; start drawing the score at PPU $2020 LDA scoreHundreds ; get first digit ; CLC ; ADC #$30 ; add ascii offset (this is UNUSED because the tiles for digits start at 0) STA $2007 ; draw to background LDA scoreTens ; next digit ; CLC ; ADC #$30 ; add ascii offset STA $2007 LDA scoreOnes ; last digit ; CLC ; ADC #$30 ; add ascii offset STA $2007 RTS IncrementScore: IncOnes: LDA scoreOnes ; load the lowest digit of the number CLC ADC #$01 ; add one STA scoreOnes CMP #$0A ; check if it overflowed, now equals 10 BNE IncDone ; if there was no overflow, all done IncTens: LDA #$00 STA scoreOnes ; wrap digit to 0 LDA scoreTens ; load the next digit CLC ADC #$01 ; add one, the carry from previous digit STA scoreTens CMP #$0A ; check if it overflowed, now equals 10 BNE IncDone ; if there was no overflow, all done IncHundreds: LDA #$00 STA scoreTens ; wrap digit to 0 LDA scoreHundreds ; load the next digit CLC ADC #$01 ; add one, the carry from previous digit STA scoreHundreds IncDone: ReadController1: LDA #$01 STA $4016 LDA #$00 STA $4016 LDX #$08 ReadController1Loop: LDA $4016 LSR A ; bit0 -> Carry ROL buttons1 ; bit0 <- Carry DEX BNE ReadController1Loop RTS ReadController2: LDA #$01 STA $4016 LDA #$00 STA $4016 LDX #$08 ReadController2Loop: LDA $4017 LSR A ; bit0 -> Carry ROL buttons2 ; bit0 <- Carry DEX BNE ReadController2Loop RTS ;;;;;;;;;;;;;; .bank 1 .org $E000 palette: .db $22,$29,$1A,$0F, $22,$36,$17,$0F, $22,$30,$21,$0F, $22,$27,$17,$0F ;;background palette .db $22,$1C,$15,$14, $22,$02,$38,$3C, $22,$1C,$15,$14, $22,$02,$38,$3C ;;sprite palette sprites: ;vert tile attr horiz .db $80, $32, $00, $80 ;sprite 0 .db $80, $33, $00, $88 ;sprite 1 .db $88, $34, $00, $80 ;sprite 2 .db $88, $35, $00, $88 ;sprite 3 .org $FFFA ;first of the three vectors starts here .dw NMI ;when an NMI happens (once per frame if enabled) the ;processor will jump to the label NMI: .dw RESET ;when the processor first turns on or is reset, it will jump ;to the label RESET: .dw 0 ;external interrupt IRQ is not used in this tutorial ;;;;;;;;;;;;;; .bank 2 .org $0000 .incbin "mario.chr" ;includes 8KB graphics file from SMB1
; A114211: a(n) = (5*n^3+12*n^2+n+6)/6. ; 1,4,16,42,87,156,254,386,557,772,1036,1354,1731,2172,2682,3266,3929,4676,5512,6442,7471,8604,9846,11202,12677,14276,16004,17866,19867,22012,24306,26754,29361,32132,35072,38186,41479 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 add $0,$2 add $0,$3 add $1,$0 sub $2,1 lpe mov $0,$1
; ; Getsprite - Picks up a sprite from display with the given size ; by Stefano Bodrato - Jan 2001 ; Apr 2002 - Fixed. (Long time, I know...) ; ; The original putsprite code is by Patrick Davidson (TI 85) ; ; Generic version (just a bit slow) ; ; ; $Id: getsprite.asm $ ; SECTION smc_clib PUBLIC getsprite PUBLIC _getsprite PUBLIC getsprite_sub EXTERN pixeladdress EXTERN swapgfxbk EXTERN __graphics_end INCLUDE "graphics/grafix.inc" ; __gfx_coords: d,e (vert-horz) ; sprite: (ix) .getsprite ._getsprite push ix ld hl,4 add hl,sp ld e,(hl) inc hl ld d,(hl) ; sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y __gfx_coords .getsprite_sub ld h,d ld l,e ld (actcoord),hl ; save current coordinates call swapgfxbk call pixeladdress xor 7 ld (_smc+1),a ld h,d ld l,e ld e,(ix+0) ld b,(ix+1) dec e srl e srl e srl e inc e ; INT ((width-1)/8+1) ._oloop push bc ;Save # of rows push de ;Save # of bytes per row ._iloop2 ld a,(hl) inc hl ld d,(hl) ._smc ld b,1 ;Load pixel position inc b dec b jr z,zpos ._iloop rl d rl a djnz _iloop .zpos ld (ix+2),a inc ix dec e jr nz,_iloop2 ; --------- push de ld hl,(actcoord) inc l ld (actcoord),hl call pixeladdress ld h,d ld l,e pop de ; --------- pop de pop bc ;Restore data djnz _oloop jp __graphics_end SECTION bss_graphics .actcoord defw 0
CODES SEGMENT ASSUME CS:CODES,DS:CODES MAIN PROC STRING DB 0DH,0AH,'INPUT A NUMBER(0-20):',0DH,0AH,'$' ERROR DB 0DH,0AH,"OUT OF RANGE! $" YN DB 0DH,0AH,'CONTINUE (YES) ? $' C10 DW 10 ;输入十进制转换的数 N DW ? ;要求阶乘的数 M DW ? ;步长 C DW ? ;进位 I DW ? DW ? START: PUSH CS POP DS MOV DX,OFFSET STRING MOV AH,9 INT 21H CALL SHURU CMP BP,10000 JBE CS_OK MOV DX,OFFSET ERROR MOV AH,9 INT 21H JMP START CS_OK: MOV N,BP MOV AX,0E0DH INT 10H MOV AL,0AH INT 10H ;换行 CALL FRACTOR MOV CX,DI ROUTPUT: ;循环输出 PUSH CX MOV DI,CX CALL OUTPUT POP CX DEC CX CMP CX,0 JGE ROUTPUT EXIT: MOV AX,4C00H INT 21H MAIN ENDP SHURU PROC ;输入---------------------------------- PUSH DX PUSH CX PUSH BX PUSH AX XOR BP,BP MOV BX,10 MOV CX,5 INPUT: MOV AH,0 ;键盘输入数据 INT 16H CMP AL,0DH ;以回车结束输入 JZ OK CMP AL,'0' ;只允许输入 0~9 JB INPUT CMP AL,'9' JA INPUT MOV AH,0EH ; 显示有效输入 INT 10H AND AX,000FH XCHG AX,BP MUL BX ; 扩大10倍 ADD BP,AX ; 加一位 LOOP INPUT OK: NOP ;数值结果放入 BP ;恢复用到的寄存器 POP AX POP BX POP CX POP DX RET SHURU ENDP FRACTOR PROC NEAR;子程序------------------------ MOV CX,N ;N,要求·阶乘的数 MOV I, 1 ;循环计数从一到n MOV M, 0 MOV DI,0 MOV SI,DI SHL SI,1 MOV WORD PTR [SI+200H],1 CTRLI: MOV C, 0 MOV DI,0 CTRLDI: CMP DI,M JA CMPC DONE: MOV SI,DI SHL SI,1 MOV AX,[SI+200H] MOV BX,I MUL BX ADD AX,C ADC DX,0;高16位保存在DX MOV BX,10000 DIV BX MOV C,AX MOV SI,DI SHL SI,1 MOV [SI+200H],DX INC DI JMP CTRLDI CMPC: CMP C,0 JBE NEXT INC M MOV AX,C MOV [SI+2+200H],AX NEXT: INC I CMP CX,0 JNG IF0 LOOP CTRLI IF0: MOV DI,M RET FRACTOR ENDP OUTPUT PROC NEAR ;输出--------------------------- C2: MOV SI,DI SHL SI,1 MOV BX,[SI+200H] BID PROC MOV CX,10000 MOV AX,BX MOV DX,0 DIV CX MOV BX,DX MOV CX,1000 CALL DDIV MOV CX,100 CALL DDIV MOV CX,10 CALL DDIV MOV CX,1 CALL DDIV RET BID ENDP DDIV PROC MOV AX,BX MOV DX,0 DIV CX MOV BX,DX;余数 MOV DL,AL ADD DL,30H;转化为ASCII码输出 MOV AH,02H INT 21H RET DDIV ENDP RET OUTPUT ENDP CODES ENDS END START
; A053469: a(n) = n*6^(n-1). ; 1,12,108,864,6480,46656,326592,2239488,15116544,100776960,665127936,4353564672,28298170368,182849716224,1175462461440,7522959753216,47958868426752,304679870005248,1929639176699904,12187194800209920,76779327241322496,482612914088312832,3027299188372144128,18953525353286467584,118459533458040422400,739187488778172235776,4605706660848611622912,28657730334169138987008,178087324219479649419264,1105369598603666789498880,6853291511342734094893056,42446192586380804716756992,262635816628231229184933888 mov $1,6 pow $1,$0 add $0,1 mul $1,$0 mov $0,$1
; Learn Multi platform Z80 Assembly Programming... With Vampires! ;Please see my website at www.chibiakumas.com/z80/ ;for the 'textbook', useful resources and video tutorials ;File Simple Monitor ;Version V1.0 ;Date 2018/3/29 ;Content Provides simple ability to show the Program Counter, and to show register values without altering z80 state ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Monitor_PushedRegister: ;show a register that was PUSHED before calling ... the pushed register is consumed! ;Usage ; push af ;pushed value to show ; call Monitor_PushedRegister ld (OneRegister_HLrestore_Plus2-2),hl ;BACK UP HL pop hl ;Get the return point ex (SP),HL ;Swap the return point with the pushed value call Monitor_BreakPoint_Show ;Send the pushed value to display routine ld hl,&0000 ;<--SM ;Get HL back OneRegister_HLrestore_Plus2: ret ;Usage ; call Monitor_BreakPoint Monitor_BreakPoint: ;Show the Breakpoint and carry on! ex (SP),HL call Monitor_BreakPoint_Show ex (SP),HL ret ;Usage ; call Monitor_BreakPointOnce Monitor_BreakPointOnce: ;Show the Breakpoint and carry on! ex (SP),HL call Monitor_BreakPoint_Show push af push hl xor a dec hl ;Erase the preceeding 3 bytes before the CALL ld (hl),a ;This SelfModifies the program so the call only occurs once! dec hl ld (hl),a dec hl ld (hl),a pop hl pop af ex (SP),HL ret ;This isn't intended to be called directly Monitor_BreakPoint_Show: ;show *HL* where HL is in HEX - used by the functions above push af ld a,'*' call PrintChar ld a,h call ShowHex ;Show H in HEX ld a,l call ShowHex ;Show L in HEX ld a,'*' call PrintChar ifdef Monitor_Pause call WaitChar ;Do a pause endif pop af ret
// Software License for MTL // // Copyright (c) 2007 The Trustees of Indiana University. // 2008 Dresden University of Technology and the Trustees of Indiana University. // 2010 SimuNova UG (haftungsbeschränkt), www.simunova.com. // All rights reserved. // Authors: Peter Gottschling and Andrew Lumsdaine // // This file is part of the Matrix Template Library // // See also license.mtl.txt in the distribution. #ifndef MTL_MATRIX_SWAP_ROW #define MTL_MATRIX_SWAP_ROW #include <boost/numeric/mtl/utility/exception.hpp> #include <boost/numeric/mtl/utility/is_row_major.hpp> #include <boost/numeric/mtl/utility/tag.hpp> #include <boost/numeric/mtl/utility/category.hpp> #include <boost/numeric/mtl/utility/enable_if.hpp> #include <boost/numeric/mtl/concept/collection.hpp> #include <boost/numeric/mtl/interface/vpt.hpp> namespace mtl { namespace mat { namespace detail { template <typename Matrix, typename Orientation> inline void swap_row(Matrix& A, typename Collection<Matrix>::size_type i, typename Collection<Matrix>::size_type j, tag::dense, Orientation) { // swap(A[irange(i,i+1)][iall], A[irange(j,j+1)][iall]; using std::swap; for (typename Collection<Matrix>::size_type k= 0; k < num_cols(A); k++) swap(A[i][k], A[j][k]); } template <typename Matrix> inline void swap_row(Matrix&, typename Collection<Matrix>::size_type, typename Collection<Matrix>::size_type, tag::sparse, boost::mpl::true_) { MTL_THROW(logic_error("This is not implemented yet.")); } template <typename Matrix> inline void swap_row(Matrix&, typename Collection<Matrix>::size_type, typename Collection<Matrix>::size_type, tag::sparse, boost::mpl::false_) { MTL_THROW(logic_error("This is an ugly operation and not implemented yet.")); } } ///Row i and j are swapped in %matrix A template <typename Matrix> typename mtl::traits::enable_if_matrix<Matrix>::type inline swap_row(Matrix& A, typename Collection<Matrix>::size_type i, typename Collection<Matrix>::size_type j) { vampir_trace<3039> tracer; if (i == j) return; detail::swap_row(A, i, j, typename mtl::traits::category<Matrix>::type(), mtl::traits::is_row_major<Matrix>()); } } // namespace matrix namespace vec { ///Entry i and j are swapped in %vector v template <typename Vector> typename mtl::traits::enable_if_vector<Vector>::type inline swap_row(Vector& v, typename Collection<Vector>::size_type i, typename Collection<Vector>::size_type j) { vampir_trace<236> tracer; using std::swap; if (i == j) return; swap(v[i], v[j]); } } // vector using mat::swap_row; using vec::swap_row; } // namespace mtl #endif // MTL_MATRIX_SWAP_ROW
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; ARShiftU64.nasm ; ; Abstract: ; ; 64-bit arithmetic right shift function for IA-32 ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; UINT64 ; EFIAPI ; InternalMathARShiftU64 ( ; IN UINT64 Operand, ; IN UINTN Count ; ); ;------------------------------------------------------------------------------ global ASM_PFX(InternalMathARShiftU64) ASM_PFX(InternalMathARShiftU64): mov cl, [esp + 12] mov eax, [esp + 8] cdq test cl, 32 jnz .0 mov edx, eax mov eax, [esp + 4] .0: shrd eax, edx, cl sar edx, cl ret
include uXmx86asm.inc option casemap:none ifndef __X64__ .686P .xmm .model flat, c else .X64P .xmm option win64:11 option stackbase:rsp endif option frame:auto .code align 16 uXm_has_AVX512DQ_VL proto VECCALL (byte) align 16 uXm_has_AVX512DQ_VL proc VECCALL (byte) mov eax, 0 cpuid cmp ecx, bit_ntel ; 'GenuineIntel' jne not_supported mov eax, 1 cpuid and ecx, bit_OSXSAVE cmp ecx, bit_OSXSAVE ; check OSXSAVE jne not_supported ; processor XGETBV is enabled by OS mov ecx, 0 ; specify 0 for XCR0 register xgetbv ; result in edx:eax and eax, 0E6h cmp eax, 0E6h ; check OS has enabled both XMM and YMM and ZMM state support jne not_supported mov eax, 7 cpuid and ebx, bit_AVX512F_DQ_VL cmp ebx, bit_AVX512F_DQ_VL ; AVX512F AVX512DQ AVX512VL support by microprocessor jne not_supported mov al, true jmp done not_supported: mov al, false done: ret uXm_has_AVX512DQ_VL endp end ;.code
SECTION code_clib SECTION code_fp_math48 PUBLIC am48_deq EXTERN am48_dcmp, error_oc, error_znc am48_deq: ; Return bool (AC == AC') ; ; enter : AC'= double y ; AC = double x ; ; exit : HL = 0 and carry reset if false ; HL = 1 and carry set if true ; ; uses : af, hl call am48_dcmp jp z, error_oc ; if x == y true jp error_znc
#bankdef a { #bits 8 #addr 0x0 #size 0x4 #outp 0x0 #fill } #bankdef b { #bits 8 #addr 0x0 #size 0x4 #outp 8 * 0x4 #fill } #bank b #d8 4, 3, $ ; = 0x00000000_04030200
; A045320: Primes not congruent to 5 mod 7. ; Submitted by Jon Maiga ; 2,3,7,11,13,17,23,29,31,37,41,43,53,59,67,71,73,79,83,97,101,107,109,113,127,137,139,149,151,157,163,167,179,181,191,193,197,199,211,223,227,233,239,241,251,263,269,277,281,283,293,307,311,317,331,337,347,349,353,359,367,373,379,389,401,409,419,421,431,433,443,449,457,461,463,479,487,491,499,503,521,541,547,557,563,569,571,577,587,599,601,613,617,619,631,641,643,647,653,659 mov $1,4 mov $2,332202 lpb $2 mov $3,$6 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,7 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,18 add $5,$1 div $5,7 mov $6,$5 lpe mov $0,$5 add $0,1
; A183430: One third the number of n X 2 0..3 arrays with no element equal to its row sum plus its column sum mod 4. ; Submitted by Simon Strandgaard ; 4,27,244,2187,19684,177147,1594324,14348907,129140164,1162261467,10460353204,94143178827,847288609444,7625597484987,68630377364884,617673396283947,5559060566555524,50031545098999707,450283905890997364,4052555153018976267,36472996377170786404,328256967394537077627,2954312706550833698644,26588814358957503287787,239299329230617529590084,2153693963075557766310747,19383245667680019896796724,174449211009120179071170507,1570042899082081611640534564,14130386091738734504764811067 add $0,1 mov $1,9 pow $1,$0 mov $2,-1 pow $2,$0 sub $1,$2 mov $2,$1 div $2,3 mov $0,$2 add $0,1
; A028180: Expansion of 1/((1-5x)(1-7x)(1-8x)(1-9x)). ; Submitted by Jon Maiga ; 1,29,530,7810,101451,1213359,13695340,148146020,1551618101,15847349089,158652680550,1562885008230,15193886293951,146104406183219,1392173613916160,13163974362722440,123666997751585001 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 dif $2,$1 sub $2,1 sub $0,$2 seq $0,20782 ; Expansion of 1/((1-7x)(1-8x)(1-9x)). sub $0,$1 mul $1,6 add $1,$0 lpe mov $0,$1
object_const_def ; object_event constants const ROUTE1_YOUNGSTER const ROUTE1_COOLTRAINER_F const ROUTE1_FRUIT_TREE Route1_MapScripts: db 0 ; scene scripts db 0 ; callbacks TrainerSchoolboyDanny: trainer SCHOOLBOY, DANNY, EVENT_BEAT_SCHOOLBOY_DANNY, SchoolboyDannySeenText, SchoolboyDannyBeatenText, 0, .Script .Script: endifjustbattled opentext writetext SchoolboyDannyAfterBattleText waitbutton closetext end TrainerCooltrainerfQuinn: trainer COOLTRAINERF, QUINN, EVENT_BEAT_COOLTRAINERF_QUINN, CooltrainerfQuinnSeenText, CooltrainerfQuinnBeatenText, 0, .Script .Script: endifjustbattled opentext writetext CooltrainerfQuinnAfterBattleText waitbutton closetext end Route1Sign: jumptext Route1SignText Route1FruitTree: fruittree FRUITTREE_ROUTE_1 SchoolboyDannySeenText: text "If trainers meet," line "the first thing to" cont "do is battle." done SchoolboyDannyBeatenText: text "Awww… I've got a" line "losing record…" done SchoolboyDannyAfterBattleText: text "For trainers, it's" line "a given that we'll" para "battle whenever we" line "meet." done CooltrainerfQuinnSeenText: text "You there!" line "Want to battle?" done CooltrainerfQuinnBeatenText: text "Down and out…" done CooltrainerfQuinnAfterBattleText: text "You're strong." para "You obviously must" line "have trained hard." done Route1SignText: text "ROUTE 1" para "PALLET TOWN -" line "VIRIDIAN CITY" done Route1_MapEvents: db 0, 0 ; filler db 0 ; warp events db 0 ; coord events db 1 ; bg events bg_event 7, 27, BGEVENT_READ, Route1Sign db 3 ; object events object_event 4, 12, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 4, TrainerSchoolboyDanny, -1 object_event 9, 25, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 2, TrainerCooltrainerfQuinn, -1 object_event 3, 7, SPRITE_FRUIT_TREE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Route1FruitTree, -1